mema-kit 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +0 -2
  2. package/docs/guide.md +100 -249
  3. package/package.json +5 -1
package/README.md CHANGED
@@ -76,8 +76,6 @@ This creates `.claude/skills/review/SKILL.md` with the full 4-phase memory lifec
76
76
  - **Standard** (4 phases) — Most skills that read and write memory
77
77
  - **Advanced** (4 phases + task management) — Multi-step workflows with archiving
78
78
 
79
- See [docs/guide.md](docs/guide.md) for a complete worked example.
80
-
81
79
  ## Updating
82
80
 
83
81
  ```bash
package/docs/guide.md CHANGED
@@ -2,327 +2,178 @@
2
2
 
3
3
  **A memory protocol kit for Claude Code skills.**
4
4
 
5
- Install two skills. Get persistent, curated memory across every session. Build new skills that plug into the same memory system.
5
+ Two built-in skills. Persistent memory across sessions. A protocol for building your own.
6
6
 
7
7
  ---
8
8
 
9
- ## How Memory Interacts with Claude Code's Context
9
+ ## Why Memory Matters
10
10
 
11
- Before diving in, it helps to understand **what's actually happening** when mema-kit "loads" and "saves" memory.
12
-
13
- **There's no magic.** Claude Code has a **context window** — everything it "knows" during a conversation. mema-kit works **within** that context window, not outside it.
11
+ Claude Code has a **context window** everything it "knows" during a conversation. mema-kit works within that window, not outside it.
14
12
 
15
13
  ```
16
- "Load memory" = Agent uses the Read tool to read .mema/ files
17
- file contents enter the context window
18
-
19
- "Save memory" = Agent uses the Write tool to write .mema/ files
20
- → knowledge persists on disk for the next session
21
-
22
- "Decide what's = Agent reads the short index.md (~20 lines),
23
- relevant" then chooses which files to Read based on your request
14
+ "Load memory" = Read .mema/ files contents enter the context window
15
+ "Save memory" = Write .mema/ files knowledge persists for next session
16
+ "What's relevant" = Read index.md (~20 lines) → choose which files to load
24
17
  ```
25
18
 
26
- ### Why This Matters
27
-
28
- **Without mema-kit:** Every new session starts blank. The agent knows nothing about your project. You re-explain everything, or the agent explores your entire codebase (slow, expensive, loads irrelevant files into context).
19
+ **Without mema-kit:** every session starts blank. You re-explain everything, or the agent explores your entire codebase (slow, expensive).
29
20
 
30
- **With mema-kit:** The agent reads `index.md` (small file), instantly knows your architecture, recent decisions, and active tasks. It reads only the 2-3 files relevant to your current task then gets to work with the right context already loaded.
31
-
32
- ```
33
- Without kit: With kit:
34
- ┌──────────────────────┐ ┌──────────────────────┐
35
- │ Context Window │ │ Context Window │
36
- │ │ │ │
37
- │ CLAUDE.md │ │ CLAUDE.md │
38
- │ Your message │ │ SKILL.md instructions │
39
- │ ...nothing else. │ │ Your message │
40
- │ │ │ index.md (auto-read) │
41
- │ Agent must explore │ │ architecture.md │
42
- │ entire codebase │ │ relevant decision.md │
43
- │ from scratch. │ │ │
44
- │ ❌ Slow, expensive │ │ Agent starts work │
45
- │ ❌ Loads irrelevant │ │ with RIGHT context. │
46
- │ files into context │ │ ✓ Fast, token-lean │
47
- └──────────────────────┘ └──────────────────────┘
48
- ```
21
+ **With mema-kit:** the agent reads `index.md`, instantly knows your architecture and recent decisions, loads only the 2-3 files relevant to your task, and gets to work.
49
22
 
50
- **Think of it like a developer's notebook.** The notebook doesn't give you a bigger brain it gives you the right information faster. mema-kit doesn't expand Claude Code's context window. It **uses the context window more efficiently** by loading curated, relevant knowledge instead of raw codebase exploration.
23
+ Think of it like a developer's notebook it doesn't give you a bigger brain, it gives you the right information faster.
51
24
 
52
25
  ---
53
26
 
54
- ## Quick Setup
27
+ ## Quick Start
55
28
 
56
29
  ```bash
57
- # 1. Install mema-kit skills into your project
58
- npx mema-kit
59
-
60
- # 2. Open your project in Claude Code
61
- cd your-project
30
+ npx mema-kit # install skills to .claude/skills/
62
31
  claude
63
-
64
- # 3. Bootstrap memory (scans project, creates .mema/, populates initial knowledge)
65
- /onboard
32
+ > /onboard # scan project, create .mema/, populate initial memory
66
33
  ```
67
34
 
68
- After setup, your project looks like this:
69
-
70
- ```
71
- your-project/
72
- ├── .claude/skills/ # mema-kit skills (2 commands) — committed to git
73
- │ ├── _memory-protocol.md # Shared curation rules
74
- │ ├── onboard/SKILL.md # /onboard — bootstrap memory
75
- │ └── create-skill/SKILL.md # /create-skill — generate new skills
76
- ├── .mema/ # Memory system (auto-managed) — gitignored
77
- │ ├── _templates/ # Templates for memory files
78
- │ ├── index.md # Memory map — agent reads this first
79
- │ ├── project-memory/ # Tech stack, requirements, decisions
80
- │ ├── task-memory/ # Per-task context, plans, decisions
81
- │ ├── agent-memory/ # Lessons learned, reusable patterns
82
- │ └── archive/ # Completed task memories
83
- ├── .gitignore # .mema/ gitignored by /onboard
84
- └── CLAUDE.md # Memory system conventions
85
- ```
35
+ `/onboard` reads your package.json, README, directory structure, and representative source files, then writes real content to `architecture.md` and `requirements.md`. Idempotent — safe to re-run.
86
36
 
87
37
  ---
88
38
 
89
- ## Using /onboard
39
+ ## Example: Building a Spec-Driven Dev Workflow
40
+
41
+ mema-kit ships with `/onboard` and `/create-skill`. Everything else you build yourself. Here's how to create a 3-skill workflow: **explore → plan → implement**.
90
42
 
91
- Run once per project. `/onboard` doesn't just create empty directories — it actively scans your project and populates memory with real content.
43
+ ### Step 1: Create `/explore`
92
44
 
93
45
  ```
94
- You: /onboard
46
+ > /create-skill
47
+ Name: explore
48
+ Purpose: Research technical decisions and save findings
49
+ Complexity: standard
95
50
  ```
96
51
 
97
- **What happens:**
98
- 1. Creates `.mema/` directory with all subdirectories and templates
99
- 2. Scans your project: reads package.json, README, directory structure, and representative source files
100
- 3. Populates `architecture.md` with your actual tech stack, project structure, and build commands
101
- 4. Populates `requirements.md` with discovered project purpose and constraints
102
- 5. Creates starter `lessons.md` and `patterns.md` (with any gotchas found during scanning)
103
- 6. Builds `index.md` pointing to all populated files
104
- 7. Adds memory system section to CLAUDE.md
105
- 8. Adds `.mema/` to `.gitignore`
52
+ Creates `.claude/skills/explore/SKILL.md` — a 4-phase skill that loads existing architecture and decisions, helps you research options, then saves new decisions and context to `.mema/`.
106
53
 
107
- **Example output:**
54
+ **Using it:**
108
55
 
109
56
  ```
110
- mema-kit initialized! Here's what was set up:
111
-
112
- ✓ .mema/ directory structure (memory system)
113
- ✓ Memory templates in .mema/_templates/
114
- ✓ CLAUDE.md updated with memory system conventions
115
- ✓ .gitignore updated to exclude .mema/
116
-
117
- Project scan results:
118
- - TypeScript 5.x + Fastify 4.x + PostgreSQL via Drizzle ORM
119
- - REST API with controller → service → repository layers
120
- - 4 source directories mapped (src/, tests/, drizzle/, config/)
121
- - Vitest for testing, pnpm for package management
122
-
123
- Memory populated:
124
- - architecture.md — Node.js + Fastify + PostgreSQL + Drizzle stack
125
- - requirements.md — Task management REST API with JWT auth
126
- - lessons.md — 0 initial lessons
127
- - patterns.md — 0 initial patterns
57
+ > /explore what auth strategy should we use?
128
58
  ```
129
59
 
130
- Idempotent safe to re-run. On subsequent runs, verifies and repairs rather than overwriting.
131
-
132
- ---
133
-
134
- ## Using /create-skill
135
-
136
- Generate a new memory-aware skill for your project.
60
+ The agent loads your stack from memory, researches JWT vs sessions vs OAuth, and saves the decision:
137
61
 
138
62
  ```
139
- You: /create-skill
63
+ .mema/project-memory/decisions/2026-02-24-auth-strategy.md
64
+ → "JWT with refresh tokens. Why: stateless, fits our REST API, team has experience."
140
65
  ```
141
66
 
142
- The agent asks 2-3 quick questions, then generates a complete SKILL.md with the right memory lifecycle.
67
+ Next session, any skill that loads memory will know this decision exists.
143
68
 
144
- ### Worked Example: Creating a /review Skill
69
+ ### Step 2: Create `/plan`
145
70
 
146
71
  ```
147
- You: /create-skill
148
-
149
- Agent: What should this skill be called?
150
- You: review
151
-
152
- Agent: What does /review do?
153
- You: Reviews code changes for quality, consistency with project patterns, and potential issues.
72
+ > /create-skill
73
+ Name: plan
74
+ Purpose: Generate implementation plans from exploration findings
75
+ Complexity: standard
76
+ ```
154
77
 
155
- Agent: Memory needs — should /review read memory, write memory, or both?
156
- Default is both (read architecture + patterns, save new lessons).
157
- You: both is good
78
+ **Using it:**
158
79
 
159
- Agent: Complexity level?
160
- - Simple (3 phases) read-only, no memory writes
161
- - Standard (4 phases) — read + write memory [default]
162
- - Advanced (4 phases + task management)
163
- You: standard
80
+ ```
81
+ > /plan plan the user auth endpoints
164
82
  ```
165
83
 
166
- **Result:** `.claude/skills/review/SKILL.md` is created with:
167
-
168
- ```markdown
169
- ---
170
- description: Reviews code changes for quality, consistency with project patterns, and potential issues.
171
- ---
84
+ The agent loads the auth decision from Step 1, architecture, and requirements — then writes a step-by-step plan to `.mema/task-memory/user-auth/plan.md`.
172
85
 
173
- # /review Code Review
86
+ ### Step 3: Create `/implement`
174
87
 
175
- You are executing the /review skill. Follow these steps carefully.
88
+ ```
89
+ > /create-skill
90
+ Name: implement
91
+ Purpose: Implement code following a plan, run tests, save lessons
92
+ Complexity: advanced
93
+ ```
176
94
 
177
- ## Phase 1: AUTO-LOAD
178
- 1. Read `.mema/index.md` to understand current project state
179
- 2. If `index.md` is missing or empty, run the Rebuild Procedure from `_memory-protocol.md`
180
- 3. Based on the user's request, identify and read relevant memory files
181
- 4. Read only what's needed — don't load everything
95
+ Advanced complexity adds task tracking and archiving. When the task is done, the agent moves task files to `archive/` and records any lessons learned.
182
96
 
183
- **Relevant memory for this skill:**
184
- - `project-memory/architecture.md` — for technical context
185
- - `project-memory/decisions/` — for past decisions related to this work
186
- - `agent-memory/lessons.md` — for mistakes to avoid
187
- - `agent-memory/patterns.md` — for reusable approaches
97
+ **Using it:**
188
98
 
189
- ## Phase 2: WORK
190
- [Review logic check code against architecture, patterns, lessons...]
99
+ ```
100
+ > /implement implement user auth endpoints
101
+ ```
191
102
 
192
- ## Phase 3: AUTO-SAVE & CURATE
193
- [Save any new lessons or patterns discovered during review...]
103
+ The agent loads the plan, architecture, and past lessons. It implements each step, runs tests, and when done:
194
104
 
195
- ## Phase 4: AUTO-INDEX
196
- [Update index.md to reflect changes...]
197
- ```
105
+ - Saves "Drizzle needs explicit type casting for enums" to `lessons.md`
106
+ - Archives `task-memory/user-auth/` to `archive/user-auth/`
107
+ - Updates `index.md`
198
108
 
199
- Now you can use it:
109
+ ### How Memory Flows Between Skills
200
110
 
201
111
  ```
202
- You: /review check the auth middleware changes
112
+ /explore /plan /implement
113
+ │ │ │
114
+ ├─ reads: ├─ reads: ├─ reads:
115
+ │ architecture │ architecture │ plan
116
+ │ requirements │ decisions │ lessons
117
+ │ │ context │ patterns
118
+ ├─ writes: ├─ writes: │
119
+ │ decisions │ plan ├─ writes:
120
+ │ context │ status │ lessons
121
+ │ │ │ patterns
122
+ │ │ │ status → archive
123
+ ▼ ▼ ▼
124
+ all flow through .mema/index.md
203
125
  ```
204
126
 
205
- The agent loads your architecture, past decisions, and known patterns then reviews the code with that full context.
127
+ Each skill reads what previous skills wrote. The index ties it all together.
206
128
 
207
129
  ---
208
130
 
209
- ## The Memory Protocol in Depth
210
-
211
- Every memory-aware skill follows four phases. This is defined in `_memory-protocol.md` and shared across all skills.
212
-
213
- ### Phase 1: AUTO-LOAD
214
-
215
- 1. Read `.mema/index.md` — the pointer map to all memory files
216
- 2. Scan each entry's one-line summary for relevance to the current task
217
- 3. Read only the relevant files into context
218
- 4. If `index.md` is missing, rebuild it from the `.mema/` directory structure
219
-
220
- **Rule:** When in doubt about relevance, load it. When clearly unrelated, skip it.
131
+ ## The Memory Protocol
221
132
 
222
- ### Phase 2: WORK
133
+ Every skill follows four phases, defined in `_memory-protocol.md`:
223
134
 
224
- Execute the skill's core purpose with loaded context. This phase varies per skill.
135
+ **1. AUTO-LOAD** Read `index.md`, load relevant files only
136
+ **2. WORK** — Do the skill's job with loaded context
137
+ **3. AUTO-SAVE & CURATE** — For each piece of knowledge: ADD, UPDATE, DELETE, or NOOP
138
+ **4. AUTO-INDEX** — Update `index.md` to reflect changes
225
139
 
226
- ### Phase 3: AUTO-SAVE & CURATE
140
+ ### Curation Rules
227
141
 
228
- For every piece of knowledge produced, decide one of four actions:
142
+ | Action | When |
143
+ |--------|------|
144
+ | **ADD** | New decision, finding, lesson, or pattern |
145
+ | **UPDATE** | Existing knowledge changed (refined reasoning, new example) |
146
+ | **DELETE** | Wrong, superseded, or redundant |
147
+ | **NOOP** | Still accurate — leave it alone (most files, most of the time) |
229
148
 
230
- | Action | When to Use |
231
- |--------|------------|
232
- | **ADD** | New knowledge that doesn't exist yet (new decision, finding, lesson, pattern) |
233
- | **UPDATE** | Existing knowledge that has changed (refined reasoning, adjusted plan, new example) |
234
- | **DELETE** | Knowledge that is wrong, superseded, or irrelevant (dead-end exploration, duplicate info) |
235
- | **NOOP** | Still accurate and relevant — leave unchanged (most files, most of the time) |
236
-
237
- #### Per-File Curation Rules
238
-
239
- - **decision.md** — Conservative. Rarely delete. Even reversed decisions teach why something didn't work.
240
- - **context.md** — Aggressive. Prune dead-end explorations. Consolidate overlapping findings.
241
- - **plan.md** — Replace. Keep the final version only. Update during implementation.
242
- - **lessons.md / patterns.md** — Consolidation. Merge similar entries. Add examples to existing ones.
243
-
244
- ### Phase 4: AUTO-INDEX
245
-
246
- Update `.mema/index.md` to reflect all changes. This is mandatory — never skip it.
247
-
248
- 1. Add entries for new files
249
- 2. Update summaries for modified files
250
- 3. Remove entries for deleted files
251
- 4. Update the `**Updated:**` date
149
+ Different file types have different curation styles:
150
+ - **Decisions** — conservative (rarely delete, even reversed decisions teach)
151
+ - **Context** aggressive (prune dead ends, consolidate overlaps)
152
+ - **Plans** replace (keep final version only)
153
+ - **Lessons/Patterns** consolidate (merge similar entries)
252
154
 
253
155
  ---
254
156
 
255
- ## Memory Structure Reference
157
+ ## Memory Structure
256
158
 
257
159
  ```
258
160
  .mema/
259
- ├── _templates/ # File templates (copied by /onboard)
260
- ├── decision.md, context.md, plan.md, lessons.md, patterns.md, status.md
261
-
262
- ├── index.md # Pointer map read this first
263
-
264
- ├── project-memory/ # Project-wide knowledge
265
- │ ├── architecture.md # Tech stack, structure, patterns
266
- │ ├── requirements.md # Purpose, constraints, requirements
267
- │ └── decisions/ # Individual decision records
268
- │ ├── 2026-02-23-tech-stack.md
269
- │ └── 2026-02-23-auth-jwt.md
270
-
271
- ├── task-memory/ # Per-task working memory
272
- │ └── api-setup/
273
- │ ├── context.md # Research findings
274
- │ ├── plan.md # Implementation plan
275
- │ └── status.md # Progress tracking
276
-
277
- ├── agent-memory/ # Agent-learned knowledge
278
- │ ├── lessons.md # Mistakes and surprises
279
- │ └── patterns.md # Reusable approaches
280
-
281
- └── archive/ # Completed tasks (preserved for reference)
282
- └── api-setup/
283
- ```
284
-
285
- ### Metadata Format
286
-
287
- Every memory file includes in-body metadata (not YAML frontmatter):
288
-
289
- ```
290
- **Status:** active | **Updated:** 2026-02-23
291
- ```
292
-
293
- Status values: `active` (current), `complete` (finished but useful), `archived` (moved to archive/).
294
-
295
- ### Index Format
296
-
297
- ```markdown
298
- # Memory Index
299
-
300
- **Updated:** 2026-02-23
301
-
302
- ## Active Tasks
303
- - `task-memory/api-setup/` — Setting up REST API with Fastify (plan ready, implementing)
304
-
305
- ## Project Knowledge
306
- - `project-memory/architecture.md` — Node.js + Fastify + PostgreSQL + Drizzle stack
307
- - `project-memory/requirements.md` — Core requirements and constraints
308
-
309
- ## Recent Decisions
310
- - `project-memory/decisions/2026-02-23-tech-stack.md` — Chose Fastify + PostgreSQL + Drizzle
311
-
312
- ## Agent Lessons
313
- - `agent-memory/lessons.md` — 3 lessons recorded
314
- - `agent-memory/patterns.md` — 2 patterns recorded
161
+ ├── index.md # Pointer map read this first
162
+ ├── project-memory/ # Architecture, requirements, decisions
163
+ └── decisions/ # YYYY-MM-DD-short-name.md
164
+ ├── task-memory/ # Per-task context, plans, status
165
+ ├── agent-memory/ # Lessons learned, reusable patterns
166
+ ├── archive/ # Completed tasks
167
+ └── _templates/ # File templates
315
168
  ```
316
169
 
317
- The index is a **rebuildable cache** — convenient but never the only source of truth. The actual files in `.mema/` are the source of truth.
170
+ The index is a **rebuildable cache** — if it gets out of sync, the next skill rebuilds it from the directory structure. The actual `.mema/` files are the source of truth.
318
171
 
319
172
  ---
320
173
 
321
174
  ## Tips
322
175
 
323
- - **Memory is just markdown.** Open any `.mema/` file to see what the agent knows. Edit directly if something's wrong.
324
- - **index.md is self-healing.** If it gets out of sync, the next skill will rebuild it from the `.mema/` directory structure.
325
- - **Decisions include "why."** Every decision file explains the reasoning — so future-you (or future-agent) understands the context, not just the choice.
326
- - **`.mema/` is gitignored by default.** It's your local agent workspace. To share project decisions with your team, uncomment `!.mema/project-memory/` in `.gitignore`.
327
- - **Any skill can use the protocol.** The memory protocol isn't limited to the two built-in skills. Use `/create-skill` to generate new ones, or manually follow the 4-phase lifecycle in any SKILL.md.
328
- - **Curate, don't hoard.** The value of memory is in its signal-to-noise ratio. Aggressive pruning of dead-end explorations and consolidation of similar lessons keeps memory useful.
176
+ - **Memory is just markdown.** Open any file to see what the agent knows. Edit directly if something's wrong.
177
+ - **`.mema/` is gitignored by default.** To share decisions with your team, uncomment `!.mema/project-memory/` in `.gitignore`.
178
+ - **Curate, don't hoard.** The value of memory is its signal-to-noise ratio. Prune aggressively.
179
+ - **Any skill can use the protocol.** Use `/create-skill` or manually follow the 4-phase lifecycle.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mema-kit",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Memory protocol kit for Claude Code skills",
5
5
  "bin": {
6
6
  "mema-kit": "bin/cli.js"
@@ -19,6 +19,10 @@
19
19
  "agent-memory"
20
20
  ],
21
21
  "license": "MIT",
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "git+https://github.com/simonv15/mema-kit.git"
25
+ },
22
26
  "engines": {
23
27
  "node": ">=16.7.0"
24
28
  }