|
| 1 | +--- |
| 2 | +name: claude-mem-coded-assistant |
| 3 | +description: > |
| 4 | + Entry-point skill for using claude-mem to keep CLAUDE.md and MEMORY.md |
| 5 | + in sync so Claude learns from past work and avoids repeating mistakes. |
| 6 | +version: 1.1.0 |
| 7 | +--- |
| 8 | + |
| 9 | +# Claude‑Mem Coding Skill |
| 10 | + |
| 11 | +## What This Skill Does |
| 12 | + |
| 13 | +This skill teaches Claude how to: |
| 14 | + |
| 15 | +- Mine **claude-mem** (via MCP) for high‑signal past work. |
| 16 | +- Maintain a concise, high‑impact **CLAUDE.md** (~1,500 tokens). |
| 17 | +- Maintain a curated **MEMORY.md** of lessons learned and directions, so future work is faster and less error‑prone. |
| 18 | + |
| 19 | +It is an **entry point**, not a full manual. Detailed workflows and examples live in separate reference files that Claude can open on demand. |
| 20 | + |
| 21 | +--- |
| 22 | + |
| 23 | +## When to Use This Skill |
| 24 | + |
| 25 | +Claude should activate this skill when: |
| 26 | + |
| 27 | +- A feature, refactor, or significant bugfix is completed. |
| 28 | +- An infra/deployment change introduces new operational lessons. |
| 29 | +- Starting work on an area with substantial history in claude-mem. |
| 30 | +- Performing a daily “memory maintenance” pass on an active repo. |
| 31 | + |
| 32 | +--- |
| 33 | + |
| 34 | +## Inputs and Outputs |
| 35 | + |
| 36 | +### Inputs |
| 37 | + |
| 38 | +Claude relies on: |
| 39 | + |
| 40 | +- **Files** (in repo root): |
| 41 | + - `CLAUDE.md` – main project instructions. |
| 42 | + - `MEMORY.md` – curated lessons and directions. |
| 43 | +- **claude-mem MCP tools** (already installed & connected): |
| 44 | + - `search` – index‑level observation search. |
| 45 | + - `timeline` – temporal context around observations. |
| 46 | + - `get_observations` – full structured details. |
| 47 | + |
| 48 | +### Outputs |
| 49 | + |
| 50 | +This skill produces: |
| 51 | + |
| 52 | +- **Patch‑style edits** to: |
| 53 | + - `MEMORY.md` – new or updated lessons, patterns, and playbooks. |
| 54 | + - `CLAUDE.md` – refreshed rules while staying under ~1,500 tokens. |
| 55 | +- No raw claude-mem transcripts are copied; only compressed, actionable guidance. |
| 56 | + |
| 57 | +--- |
| 58 | + |
| 59 | +## How Claude Should Behave |
| 60 | + |
| 61 | +### 1. Mine claude-mem → Update MEMORY.md |
| 62 | + |
| 63 | +High‑level behavior (details in `claude-mem-usage.md`): |
| 64 | + |
| 65 | +- Use **progressive disclosure** against claude-mem: |
| 66 | + 1. `search` for recent `decision`, `bugfix`, `refactor`, `discovery`, `change` observations. |
| 67 | + 2. `timeline` around promising IDs to see context. |
| 68 | + 3. `get_observations` for a small set of high‑value IDs. |
| 69 | +- From those, update `MEMORY.md` with: |
| 70 | + - Architectural decisions and their impact. |
| 71 | + - Implementation patterns and anti‑patterns. |
| 72 | + - Debugging playbooks and DevOps lessons. |
| 73 | + |
| 74 | +**Constraints** |
| 75 | + |
| 76 | +- Prefer short bullets over long prose. |
| 77 | +- Record *why* decisions were made and how to act next time. |
| 78 | +- Never store secrets or credentials in `MEMORY.md`. |
| 79 | + |
| 80 | +For a full template and examples, Claude should open: |
| 81 | + |
| 82 | +- `memory-structure-reference.md` |
| 83 | +- `claude-mem-usage.md` |
| 84 | + |
| 85 | +--- |
| 86 | + |
| 87 | +### 2. Distill MEMORY.md → Refresh CLAUDE.md (≈1,500 tokens) |
| 88 | + |
| 89 | +High‑level behavior: |
| 90 | + |
| 91 | +- Read the existing `CLAUDE.md` and approximate its size; keep the body around **1–1.5k tokens** for optimal behavior. |
| 92 | +- Pull only **current, high‑impact** content from `MEMORY.md`: |
| 93 | + - Still‑valid architectural directions. |
| 94 | + - Frequently reused patterns and gotchas. |
| 95 | + - Operational guardrails that materially affect daily work. |
| 96 | +- Rewrite historical notes as **timeless rules**, e.g.: |
| 97 | + - “When adding retries to DB writes, always use the shared retry helper instead of manual loops.” |
| 98 | + |
| 99 | +- Use links instead of inlining: |
| 100 | + - `.clauderules/code-style.md` for style. |
| 101 | + - `.clauderules/testing.md` for testing. |
| 102 | + - `MEMORY.md` sections for deeper background. |
| 103 | + |
| 104 | +**Token Discipline** |
| 105 | + |
| 106 | +- If CLAUDE.md is too long: |
| 107 | + - Merge overlapping bullets. |
| 108 | + - Drop generic advice that doesn’t change behavior. |
| 109 | + - Replace detailed explanations with references to supporting docs. |
| 110 | + |
| 111 | +**Diff‑First** |
| 112 | + |
| 113 | +- Propose **minimal patches**, not full rewrites: |
| 114 | + - Update only sections that need change (e.g., “Architectural Directions”, “Patterns & Gotchas”). |
| 115 | + - Preserve stable layout and headings. |
| 116 | +- Always leave final acceptance to human review in Git/CI. |
| 117 | + |
| 118 | +For concrete layouts and example diffs, Claude should open: |
| 119 | + |
| 120 | +- `claude-md-layout-reference.md` |
| 121 | +- `example-diffs.md` |
| 122 | + |
| 123 | +--- |
| 124 | + |
| 125 | +## Safety and Priority Rules |
| 126 | + |
| 127 | +Claude must: |
| 128 | + |
| 129 | +- **Always**: |
| 130 | + - Query claude-mem before re‑solving problems already encountered in this project. |
| 131 | + - Update `MEMORY.md` after meaningful work with concise, actionable lessons. |
| 132 | + - Keep `CLAUDE.md` focused on rules that change how work is done, not on general LLM tips. |
| 133 | + |
| 134 | +- **Never**: |
| 135 | + - Overwrite `CLAUDE.md` or `MEMORY.md` entirely; always propose small diffs. |
| 136 | + - Paste raw claude-mem observations verbatim into either file. |
| 137 | + - Store secrets, API keys, or sensitive infra details in these files. |
| 138 | + |
| 139 | +- **Conflict resolution priority**: |
| 140 | + 1. Explicit instructions in `CLAUDE.md`. |
| 141 | + 2. Latest curated guidance in `MEMORY.md`. |
| 142 | + 3. Raw claude-mem observations and session summaries. |
| 143 | + 4. Ad‑hoc reasoning in the current session. |
| 144 | + |
| 145 | +--- |
| 146 | + |
| 147 | +## Quick “How to Call Me” |
| 148 | + |
| 149 | +Users can invoke this skill with prompts like: |
| 150 | + |
| 151 | +> “Use the claude-mem coding skill to: |
| 152 | +> 1) mine claude-mem for recent work, |
| 153 | +> 2) update MEMORY.md with lessons, and |
| 154 | +> 3) refresh CLAUDE.md under the ~1,500‑token budget.” |
| 155 | +
|
| 156 | +Claude should then: |
| 157 | + |
| 158 | +1. Run the claude-mem `search → timeline → get_observations` flow. |
| 159 | +2. Draft a patch for `MEMORY.md` with new lessons. |
| 160 | +3. Draft a patch for `CLAUDE.md` derived from `MEMORY.md`. |
| 161 | +4. Present both patches clearly for human review and commit. |
| 162 | + |
| 163 | +--- |
| 164 | + |
| 165 | +## External References |
| 166 | + |
| 167 | +To keep this SKILL.md lean and within best‑practice size, Claude should open these files when more detail is needed: |
| 168 | + |
| 169 | +- `claude-mem-usage.md` – detailed claude-mem MCP workflows, filters, and example queries. |
| 170 | +- `memory-structure-reference.md` – full MEMORY.md templates and longer examples. |
| 171 | +- `claude-md-layout-reference.md` – canonical CLAUDE.md section layouts and size guidance. |
| 172 | +- `example-diffs.md` – sample before/after patches for CLAUDE.md and MEMORY.md. |
| 173 | + |
0 commit comments