mema-kit 1.0.6 → 1.1.1
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.
- package/README.md +88 -38
- package/docs/guide.md +122 -218
- package/package.json +2 -2
- package/skills/_memory-protocol.md +37 -24
- package/skills/mema.challenge/SKILL.md +121 -0
- package/skills/mema.clarify/SKILL.md +109 -0
- package/skills/mema.create-skill/SKILL.md +110 -43
- package/skills/mema.implement/SKILL.md +88 -104
- package/skills/mema.onboard/SKILL.md +180 -338
- package/skills/mema.plan/SKILL.md +79 -135
- package/skills/mema.recall/SKILL.md +69 -67
- package/skills/mema.research/SKILL.md +109 -0
- package/skills/mema.roadmap/SKILL.md +134 -0
- package/skills/mema.seed/SKILL.md +88 -0
- package/skills/mema.specify/SKILL.md +120 -0
- package/skills/mema.tasks/SKILL.md +128 -0
- package/templates/agent/lessons.md +16 -0
- package/templates/agent/patterns.md +16 -0
- package/templates/features/feature/plan.md +23 -0
- package/templates/features/feature/spec.md +30 -0
- package/templates/features/feature/status.md +23 -0
- package/templates/features/feature/tasks.md +16 -0
- package/templates/index.md +17 -5
- package/templates/product/challenge.md +23 -0
- package/templates/product/clarify.md +23 -0
- package/templates/product/research.md +21 -0
- package/templates/product/roadmap.md +26 -0
- package/templates/product/seed.md +11 -0
- package/templates/project/architecture.md +28 -0
- package/templates/project/decisions/decision.md +23 -0
- package/templates/project/requirements.md +16 -0
- package/templates/project/structure.md +32 -0
|
@@ -4,37 +4,48 @@ description: Bootstrap the mema-kit memory system for this project. Creates .mem
|
|
|
4
4
|
|
|
5
5
|
# /mema.onboard — Project Memory Bootstrap
|
|
6
6
|
|
|
7
|
-
You are setting up the mema-kit memory system for this project. Follow these steps carefully. This command is idempotent — safe to re-run. Never overwrite existing data.
|
|
7
|
+
You are setting up the mema-kit memory system for this project. Follow these steps carefully. This command is idempotent — safe to re-run. Never overwrite existing data without confirming.
|
|
8
8
|
|
|
9
9
|
## Step 1: Check Current State
|
|
10
10
|
|
|
11
11
|
Before creating anything, assess what already exists:
|
|
12
12
|
|
|
13
13
|
1. Check if `.mema/` directory exists
|
|
14
|
-
2. Check if
|
|
15
|
-
3. Check if
|
|
14
|
+
2. Check if it uses the **old structure** (`project-memory/`, `task-memory/`, `agent-memory/`) — if so, migration is needed
|
|
15
|
+
3. Check if `CLAUDE.md` exists and has a `## Memory System` section
|
|
16
|
+
4. Check if `.gitignore` contains `.mema` entries
|
|
16
17
|
|
|
17
|
-
Report
|
|
18
|
+
Report to the user: "Setting up mema-kit. Found existing .mema/ — will verify and update." or "Fresh setup — creating everything from scratch." or "Found old mema-kit structure — will migrate to new layout."
|
|
18
19
|
|
|
19
|
-
## Step 2:
|
|
20
|
+
## Step 2: Migrate Old Structure (if needed)
|
|
21
|
+
|
|
22
|
+
If the old directory structure exists, migrate it before creating anything new:
|
|
23
|
+
|
|
24
|
+
- If `.mema/project-memory/` exists and `.mema/project/` does not → rename to `.mema/project/`; tell user: "Migrated project-memory/ → project/"
|
|
25
|
+
- If `.mema/agent-memory/` exists and `.mema/agent/` does not → rename to `.mema/agent/`; tell user: "Migrated agent-memory/ → agent/"
|
|
26
|
+
- If `.mema/task-memory/` exists and `.mema/features/` does not → rename to `.mema/features/`; tell user: "Migrated task-memory/ → features/"
|
|
27
|
+
|
|
28
|
+
If new structure already exists: NOOP on that directory.
|
|
29
|
+
|
|
30
|
+
## Step 3: Create .mema/ Directory Structure
|
|
20
31
|
|
|
21
32
|
Create the following directories if they don't already exist:
|
|
22
33
|
|
|
23
34
|
```
|
|
24
35
|
.mema/
|
|
25
|
-
├──
|
|
26
|
-
├──
|
|
36
|
+
├── product/
|
|
37
|
+
├── features/
|
|
38
|
+
├── project/
|
|
27
39
|
│ └── decisions/
|
|
28
|
-
├──
|
|
29
|
-
├── agent-memory/
|
|
40
|
+
├── agent/
|
|
30
41
|
└── archive/
|
|
31
42
|
```
|
|
32
43
|
|
|
33
44
|
For each directory: if it exists, skip it. If it doesn't, create it.
|
|
34
45
|
|
|
35
|
-
## Step
|
|
46
|
+
## Step 4: Write Template Files
|
|
36
47
|
|
|
37
|
-
Write the following files to `.mema/_templates/`. If a template file already exists, **skip it
|
|
48
|
+
Write the following files to `.mema/_templates/`. If a template file already exists, **skip it**.
|
|
38
49
|
|
|
39
50
|
### `.mema/_templates/decision.md`
|
|
40
51
|
|
|
@@ -44,85 +55,61 @@ Write the following files to `.mema/_templates/`. If a template file already exi
|
|
|
44
55
|
**Status:** active | **Updated:** YYYY-MM-DD
|
|
45
56
|
|
|
46
57
|
## Context
|
|
47
|
-
<!-- What situation or question prompted this decision? What problem are we solving? -->
|
|
48
58
|
|
|
49
59
|
## Decision
|
|
50
|
-
<!-- What was decided? Be specific and concrete. -->
|
|
51
60
|
|
|
52
61
|
## Options Considered
|
|
53
62
|
|
|
54
63
|
### Option A: [Name]
|
|
55
|
-
<!-- Brief description. Why chosen/rejected. -->
|
|
56
64
|
|
|
57
65
|
### Option B: [Name]
|
|
58
|
-
<!-- Brief description. Why chosen/rejected. -->
|
|
59
66
|
|
|
60
67
|
## Reasoning
|
|
61
|
-
<!-- Why this option was selected. What factors mattered most? What trade-offs were accepted? -->
|
|
62
68
|
|
|
63
69
|
## Consequences
|
|
64
|
-
<!-- What are the implications? What does this enable or constrain? Any known trade-offs or risks? -->
|
|
65
70
|
```
|
|
66
71
|
|
|
67
|
-
### `.mema/_templates/
|
|
72
|
+
### `.mema/_templates/spec.md`
|
|
68
73
|
|
|
69
74
|
```
|
|
70
|
-
# [
|
|
75
|
+
# [Feature Name] — Spec
|
|
71
76
|
|
|
72
77
|
**Status:** active | **Updated:** YYYY-MM-DD
|
|
73
78
|
|
|
74
|
-
##
|
|
75
|
-
<!-- 2-3 sentence overview of what was explored and the key takeaway. -->
|
|
79
|
+
## Purpose
|
|
76
80
|
|
|
77
|
-
##
|
|
78
|
-
<!-- Bullet list of important facts, constraints, or insights discovered. Be specific and concise. -->
|
|
81
|
+
## User Scenarios
|
|
79
82
|
|
|
80
|
-
|
|
81
|
-
-
|
|
82
|
-
-
|
|
83
|
+
### Scenario 1
|
|
83
84
|
|
|
84
|
-
|
|
85
|
-
<!-- What remains unresolved? What needs further exploration or a decision? -->
|
|
85
|
+
Given [state], When [action], Then [outcome]
|
|
86
86
|
|
|
87
|
-
|
|
88
|
-
-
|
|
87
|
+
## Acceptance Criteria
|
|
89
88
|
|
|
90
|
-
|
|
91
|
-
<!-- Links to related memory files (decisions, other context, plans). Use relative paths. -->
|
|
89
|
+
- [ ] [Criterion]
|
|
92
90
|
|
|
93
|
-
|
|
91
|
+
## Constraints
|
|
94
92
|
```
|
|
95
93
|
|
|
96
|
-
### `.mema/_templates/
|
|
94
|
+
### `.mema/_templates/status.md`
|
|
97
95
|
|
|
98
96
|
```
|
|
99
|
-
# [
|
|
97
|
+
# [Feature Name] — Status
|
|
100
98
|
|
|
101
|
-
**Status:**
|
|
102
|
-
|
|
103
|
-
## General Plan
|
|
104
|
-
<!-- High-level approach: architecture decisions, component design, data flow. Keep it to 1-2 paragraphs or a short list. This should answer "what are we building and how does it fit together?" -->
|
|
99
|
+
**Status:** pending | **Updated:** YYYY-MM-DD
|
|
105
100
|
|
|
106
|
-
##
|
|
107
|
-
<!-- Step-by-step implementation tasks. Each step should be specific enough to implement directly. -->
|
|
101
|
+
## Current Status
|
|
108
102
|
|
|
109
|
-
|
|
110
|
-
<!-- What to do, which files to create/modify, any dependencies on prior steps. -->
|
|
111
|
-
- Files: `path/to/file`
|
|
112
|
-
- Details:
|
|
103
|
+
`pending` — not started
|
|
113
104
|
|
|
114
|
-
|
|
115
|
-
- Files: `path/to/file`
|
|
116
|
-
- Details:
|
|
105
|
+
## Progress Log
|
|
117
106
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
- Details:
|
|
107
|
+
| Date | Task | Notes |
|
|
108
|
+
|------|------|-------|
|
|
121
109
|
|
|
122
|
-
##
|
|
123
|
-
<!-- What this plan explicitly does NOT cover. Prevents scope creep during implementation. -->
|
|
110
|
+
## Next Task
|
|
124
111
|
|
|
125
|
-
|
|
112
|
+
## Blockers
|
|
126
113
|
```
|
|
127
114
|
|
|
128
115
|
### `.mema/_templates/lessons.md`
|
|
@@ -135,13 +122,10 @@ Write the following files to `.mema/_templates/`. If a template file already exi
|
|
|
135
122
|
## Lessons
|
|
136
123
|
|
|
137
124
|
### [Short Title]
|
|
138
|
-
|
|
139
|
-
- **
|
|
140
|
-
- **Example:** <!-- Concrete code example or scenario if applicable. -->
|
|
125
|
+
- **Context:**
|
|
126
|
+
- **Example:**
|
|
141
127
|
|
|
142
128
|
---
|
|
143
|
-
|
|
144
|
-
<!-- Add new lessons above this line. When entries exceed ~30, consolidate related lessons under grouped headers. -->
|
|
145
129
|
```
|
|
146
130
|
|
|
147
131
|
### `.mema/_templates/patterns.md`
|
|
@@ -154,404 +138,262 @@ Write the following files to `.mema/_templates/`. If a template file already exi
|
|
|
154
138
|
## Patterns
|
|
155
139
|
|
|
156
140
|
### [Pattern Name]
|
|
157
|
-
- **Structure:**
|
|
158
|
-
- **Example:**
|
|
141
|
+
- **Structure:**
|
|
142
|
+
- **Example:**
|
|
159
143
|
|
|
160
144
|
---
|
|
161
|
-
|
|
162
|
-
<!-- Add new patterns above this line. -->
|
|
163
145
|
```
|
|
164
146
|
|
|
165
|
-
|
|
147
|
+
## Step 5: Scan the Project
|
|
166
148
|
|
|
167
|
-
|
|
168
|
-
# [Task Name] — Status
|
|
149
|
+
Read and analyze the project to populate memory with real content.
|
|
169
150
|
|
|
170
|
-
|
|
151
|
+
### 5a: Detect Project Type and Stack
|
|
171
152
|
|
|
172
|
-
|
|
153
|
+
Read (skip any that don't exist):
|
|
154
|
+
1. `package.json`, `pyproject.toml`, `Cargo.toml`, `go.mod`, `pom.xml`, or `Gemfile` — language, framework, dependencies
|
|
155
|
+
2. `README.md` — project purpose and setup
|
|
156
|
+
3. `CLAUDE.md` — existing conventions
|
|
157
|
+
4. Config files (`tsconfig.json`, `.eslintrc`, etc.)
|
|
173
158
|
|
|
174
|
-
|
|
175
|
-
- [ ] Step 2: [description]
|
|
176
|
-
- [ ] Step 3: [description]
|
|
159
|
+
### 5b: Scan Directory Structure
|
|
177
160
|
|
|
178
|
-
|
|
179
|
-
<!-- Any blockers, deviations from plan, or important observations during implementation. -->
|
|
161
|
+
List top-level directories and key subdirectories (1-2 levels deep). Note source, test, and config locations.
|
|
180
162
|
|
|
181
|
-
|
|
182
|
-
**Completed:**
|
|
183
|
-
```
|
|
184
|
-
|
|
185
|
-
## Step 4: Scan the Project
|
|
186
|
-
|
|
187
|
-
This is the intelligence step. Read and analyze the project to populate memory with real content instead of empty placeholders.
|
|
188
|
-
|
|
189
|
-
### 4a: Detect Project Type and Stack
|
|
190
|
-
|
|
191
|
-
Read the following files (skip any that don't exist):
|
|
192
|
-
|
|
193
|
-
1. `package.json` or `pyproject.toml` or `Cargo.toml` or `go.mod` or `pom.xml` or `Gemfile` — to identify language, framework, and dependencies
|
|
194
|
-
2. `README.md` — to understand project purpose and setup
|
|
195
|
-
3. `CLAUDE.md` — to understand existing conventions and instructions
|
|
196
|
-
4. `tsconfig.json` or equivalent config files — to understand build setup
|
|
197
|
-
|
|
198
|
-
### 4b: Scan Directory Structure
|
|
163
|
+
### 5c: Read Representative Source Files
|
|
199
164
|
|
|
200
|
-
|
|
201
|
-
- Source code location (`src/`, `lib/`, `app/`, etc.)
|
|
202
|
-
- Test location (`tests/`, `__tests__/`, `test/`, etc.)
|
|
203
|
-
- Config files present
|
|
204
|
-
- Any existing documentation
|
|
165
|
+
Pick 2-3 files that best represent the codebase: main entry point, a representative module, a test file.
|
|
205
166
|
|
|
206
|
-
###
|
|
167
|
+
### 5d: Compile Findings
|
|
207
168
|
|
|
208
|
-
|
|
209
|
-
-
|
|
210
|
-
-
|
|
211
|
-
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
Before writing memory, compile your findings:
|
|
218
|
-
- **Project name** and purpose
|
|
219
|
-
- **Language/framework/stack** with versions
|
|
220
|
-
- **Architecture pattern** (monolith, microservices, CLI tool, library, etc.)
|
|
221
|
-
- **Key directories** and what they contain
|
|
222
|
-
- **Testing setup** (framework, patterns)
|
|
223
|
-
- **Build/run commands**
|
|
224
|
-
- **Notable conventions** (naming, patterns, config)
|
|
225
|
-
|
|
226
|
-
## Step 5: Populate Initial Memory
|
|
227
|
-
|
|
228
|
-
Using the scan findings, create memory files with **real content** (not empty placeholders).
|
|
169
|
+
Before writing memory, note:
|
|
170
|
+
- Project name and purpose
|
|
171
|
+
- Language/framework/stack with versions
|
|
172
|
+
- Architecture pattern
|
|
173
|
+
- Key directories
|
|
174
|
+
- Testing setup
|
|
175
|
+
- Build/run commands
|
|
176
|
+
- Notable conventions
|
|
229
177
|
|
|
230
|
-
|
|
178
|
+
## Step 6: Populate Initial Memory
|
|
231
179
|
|
|
232
|
-
|
|
233
|
-
- Tech stack with versions
|
|
234
|
-
- Project structure (key directories and their purposes)
|
|
235
|
-
- Architecture pattern
|
|
236
|
-
- Key entry points
|
|
237
|
-
- Build and run commands
|
|
180
|
+
Using scan findings, create files with **real content** (not empty placeholders).
|
|
238
181
|
|
|
239
|
-
|
|
182
|
+
### `.mema/project/architecture.md`
|
|
240
183
|
|
|
241
184
|
```
|
|
242
185
|
# Project Architecture
|
|
243
186
|
|
|
244
|
-
**Status:** active | **Updated:** [today
|
|
187
|
+
**Status:** active | **Updated:** [today]
|
|
245
188
|
|
|
246
189
|
## Stack
|
|
247
|
-
- **Language:**
|
|
248
|
-
- **
|
|
249
|
-
|
|
250
|
-
- **Database:** PostgreSQL 16 via Drizzle ORM
|
|
251
|
-
- **Testing:** Vitest
|
|
190
|
+
- **Language:** [detected]
|
|
191
|
+
- **Framework:** [detected]
|
|
192
|
+
[other stack items]
|
|
252
193
|
|
|
253
194
|
## Structure
|
|
254
|
-
- `
|
|
255
|
-
|
|
256
|
-
- `services/` — Business logic
|
|
257
|
-
- `db/` — Database schema and migrations
|
|
258
|
-
- `tests/` — Test files mirroring src/ structure
|
|
195
|
+
- `[dir]/` — [purpose]
|
|
196
|
+
[other directories]
|
|
259
197
|
|
|
260
198
|
## Architecture
|
|
261
|
-
|
|
262
|
-
Entry point: `src/app.ts`
|
|
199
|
+
[Pattern in 1-2 sentences. Entry point: path/to/entry]
|
|
263
200
|
|
|
264
201
|
## Commands
|
|
265
|
-
- `
|
|
266
|
-
- `
|
|
267
|
-
- `npm run build` — Build for production
|
|
202
|
+
- `[dev command]` — Start development
|
|
203
|
+
- `[test command]` — Run tests
|
|
268
204
|
```
|
|
269
205
|
|
|
270
|
-
### `.mema/project
|
|
271
|
-
|
|
272
|
-
Write a requirements summary based on README, package.json description, and observed functionality:
|
|
206
|
+
### `.mema/project/requirements.md`
|
|
273
207
|
|
|
274
208
|
```
|
|
275
209
|
# Project Requirements
|
|
276
210
|
|
|
277
|
-
**Status:** active | **Updated:** [today
|
|
211
|
+
**Status:** active | **Updated:** [today]
|
|
278
212
|
|
|
279
213
|
## Purpose
|
|
280
|
-
[What this project does,
|
|
214
|
+
[What this project does, from README and code]
|
|
281
215
|
|
|
282
216
|
## Key Requirements
|
|
283
|
-
- [Requirement
|
|
284
|
-
- [Requirement discovered from code/docs]
|
|
217
|
+
- [Requirement from code/docs]
|
|
285
218
|
|
|
286
219
|
## Constraints
|
|
287
|
-
- [
|
|
220
|
+
- [Constraint discovered]
|
|
288
221
|
```
|
|
289
222
|
|
|
290
|
-
### `.mema/
|
|
223
|
+
### `.mema/project/structure.md`
|
|
291
224
|
|
|
292
|
-
|
|
225
|
+
Using the directory scan from Step 5b, write an annotated repo tree and navigation guide:
|
|
293
226
|
|
|
294
227
|
```
|
|
295
|
-
#
|
|
228
|
+
# Repository Structure
|
|
296
229
|
|
|
297
|
-
**Updated:** [today
|
|
230
|
+
**Status:** active | **Updated:** [today]
|
|
298
231
|
|
|
299
|
-
##
|
|
232
|
+
## Directory Tree
|
|
300
233
|
|
|
301
|
-
<!-- Lessons will be added here as the agent learns from development experience. -->
|
|
302
234
|
```
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
### `.mema/agent-memory/patterns.md`
|
|
307
|
-
|
|
308
|
-
Create a starter patterns file. If you identified clear patterns from the source files you read, add them:
|
|
309
|
-
|
|
235
|
+
[project-name]/
|
|
236
|
+
[2–3 level annotated tree derived from Step 5b scan]
|
|
310
237
|
```
|
|
311
|
-
# Agent Patterns
|
|
312
238
|
|
|
313
|
-
|
|
239
|
+
## Entry Points
|
|
314
240
|
|
|
315
|
-
|
|
241
|
+
[Key files per subsystem, e.g.:]
|
|
242
|
+
- `[entry file]` — [what it does]
|
|
316
243
|
|
|
317
|
-
|
|
318
|
-
```
|
|
244
|
+
## Source vs. Generated
|
|
319
245
|
|
|
320
|
-
|
|
246
|
+
- **Source:** [source dirs]
|
|
247
|
+
- **Generated:** [build output, node_modules, etc.]
|
|
248
|
+
- **Gitignored:** `.mema/`, [other gitignored items]
|
|
321
249
|
|
|
322
|
-
|
|
250
|
+
## Where to Find X
|
|
323
251
|
|
|
252
|
+
[Quick-reference for the top subsystems found during scan:]
|
|
253
|
+
- **[Component type]:** `[path/]`
|
|
324
254
|
```
|
|
325
|
-
# Memory Index
|
|
326
|
-
|
|
327
|
-
**Updated:** [today's date]
|
|
328
255
|
|
|
329
|
-
|
|
256
|
+
### `.mema/agent/lessons.md`
|
|
330
257
|
|
|
331
|
-
## Project Knowledge
|
|
332
|
-
- `project-memory/architecture.md` — [one-line summary of stack/architecture]
|
|
333
|
-
- `project-memory/requirements.md` — [one-line summary of purpose]
|
|
334
|
-
|
|
335
|
-
## Recent Decisions
|
|
336
|
-
|
|
337
|
-
## Agent Lessons
|
|
338
|
-
- `agent-memory/lessons.md` — [N] lessons recorded
|
|
339
|
-
- `agent-memory/patterns.md` — [N] patterns recorded
|
|
340
258
|
```
|
|
259
|
+
# Agent Lessons
|
|
341
260
|
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
Read the current `CLAUDE.md` (if it exists) and follow the appropriate path:
|
|
345
|
-
|
|
346
|
-
### Path A: CLAUDE.md already exists
|
|
347
|
-
|
|
348
|
-
1. Search for `## Memory System` in the file content
|
|
349
|
-
2. If found → **skip this step entirely** (already configured). Record outcome as **skipped**.
|
|
350
|
-
3. If not found → append the Memory System section (see below) at the end of the file. Record outcome as **appended**.
|
|
261
|
+
**Updated:** [today]
|
|
351
262
|
|
|
352
|
-
|
|
263
|
+
## Lessons
|
|
353
264
|
|
|
265
|
+
[Add any project-specific gotchas found during scan, or leave as:]
|
|
266
|
+
<!-- Lessons will be added here as development experience accumulates. -->
|
|
354
267
|
```
|
|
355
|
-
## Memory System
|
|
356
268
|
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
Memory lives in `.mema/`. At the start of each task, read `.mema/index.md` to load relevant context. After completing work, curate and save knowledge following the memory protocol in `.claude/skills/_memory-protocol.md`.
|
|
269
|
+
### `.mema/agent/patterns.md`
|
|
360
270
|
|
|
361
|
-
Memory is managed automatically by skills — do not manually modify `.mema/` files unless correcting an error.
|
|
362
271
|
```
|
|
272
|
+
# Agent Patterns
|
|
363
273
|
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
Follow sub-steps 6a through 6f to build a rich CLAUDE.md from scratch. Use the scan data collected in Step 4 for all content. Record outcome as **generated**.
|
|
367
|
-
|
|
368
|
-
#### 6a: Ask user "About Me"
|
|
369
|
-
|
|
370
|
-
Ask the user a single question using the AskUserQuestion tool:
|
|
371
|
-
|
|
372
|
-
> "Before I generate your CLAUDE.md, I'd like to personalize it. How would you describe yourself? (e.g., experience level, preferences for code style, anything you want Claude to know)"
|
|
373
|
-
|
|
374
|
-
Provide 3 options:
|
|
375
|
-
- **Junior developer** — "I'm learning. Explain decisions, be thorough in comments, correct my terminology gently."
|
|
376
|
-
- **Senior developer** — "I'm experienced. Keep explanations brief, focus on trade-offs and edge cases."
|
|
377
|
-
- **Skip** — "Skip personalization, use a sensible default."
|
|
274
|
+
**Updated:** [today]
|
|
378
275
|
|
|
379
|
-
|
|
276
|
+
## Patterns
|
|
380
277
|
|
|
278
|
+
[Add any clear patterns from source files, or leave as:]
|
|
279
|
+
<!-- Patterns will be added here as development experience accumulates. -->
|
|
381
280
|
```
|
|
382
|
-
When I ask you to implement something, briefly explain key decisions. Prefer clear, well-commented code.
|
|
383
|
-
```
|
|
384
|
-
|
|
385
|
-
#### 6b: Write the `# About Me` section
|
|
386
|
-
|
|
387
|
-
Use the user's response from 6a to write a natural-language paragraph (3-5 lines). This section uses **H1** (`# About Me`), matching mema-kit's own CLAUDE.md convention.
|
|
388
|
-
|
|
389
|
-
#### 6c: Write the `## Project Overview` section
|
|
390
|
-
|
|
391
|
-
Using Step 4 scan data, generate three sub-sections:
|
|
392
281
|
|
|
393
|
-
|
|
282
|
+
### `.mema/index.md`
|
|
394
283
|
|
|
395
|
-
|
|
284
|
+
Build the index from files just created:
|
|
396
285
|
|
|
397
286
|
```
|
|
398
|
-
|
|
399
|
-
├── src/ # Source code
|
|
400
|
-
├── tests/ # Test suite
|
|
401
|
-
└── package.json # Dependencies and scripts
|
|
402
|
-
```
|
|
403
|
-
|
|
404
|
-
**`### Architecture`:** Architecture pattern (e.g., REST API, CLI tool, library), key entry points, and data flow. Keep to 2-4 sentences. If the project is too simple or unclear for an architecture description, write: "Architecture details will be added as the project grows."
|
|
405
|
-
|
|
406
|
-
#### 6d: Write the `## Coding Standards` section
|
|
407
|
-
|
|
408
|
-
Using Step 4c source file analysis, generate a bullet list covering:
|
|
287
|
+
# Memory Index
|
|
409
288
|
|
|
410
|
-
|
|
411
|
-
- **Style:** Formatting patterns (semicolons, quotes, indentation)
|
|
412
|
-
- **Patterns:** Recurring code patterns (e.g., "error-first callbacks", "async/await throughout")
|
|
413
|
-
- **Tooling:** Linting/formatting tools detected (ESLint, Prettier, Black, rustfmt, etc. — check `devDependencies`, config files like `.eslintrc`, `.prettierrc`, `pyproject.toml [tool.black]`)
|
|
289
|
+
**Updated:** [today]
|
|
414
290
|
|
|
415
|
-
|
|
291
|
+
## Active Features
|
|
416
292
|
|
|
417
|
-
|
|
293
|
+
## Product Discovery
|
|
418
294
|
|
|
419
|
-
|
|
295
|
+
## Project Knowledge
|
|
296
|
+
- `project/architecture.md` — [one-line stack/architecture summary]
|
|
297
|
+
- `project/requirements.md` — [one-line purpose summary]
|
|
298
|
+
- `project/structure.md` — [one-line: e.g. "Annotated repo tree, 3 top-level dirs"]
|
|
420
299
|
|
|
421
|
-
|
|
422
|
-
- `
|
|
423
|
-
- `
|
|
424
|
-
- `npm run build` — Build for production
|
|
300
|
+
## Agent Knowledge
|
|
301
|
+
- `agent/lessons.md` — [N] lessons recorded
|
|
302
|
+
- `agent/patterns.md` — [N] patterns recorded
|
|
425
303
|
```
|
|
426
304
|
|
|
427
|
-
|
|
305
|
+
## Step 7: Update CLAUDE.md
|
|
428
306
|
|
|
429
|
-
|
|
307
|
+
Read the current `CLAUDE.md` (if exists) and follow the appropriate path:
|
|
430
308
|
|
|
431
|
-
|
|
309
|
+
### Path A: CLAUDE.md already exists
|
|
432
310
|
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
311
|
+
1. Search for `## Memory System`
|
|
312
|
+
2. If found → **skip this step** (already configured)
|
|
313
|
+
3. If not found → append the Memory System section below
|
|
436
314
|
|
|
437
|
-
|
|
315
|
+
Memory System section:
|
|
438
316
|
|
|
439
317
|
```
|
|
440
|
-
|
|
441
|
-
- `/mema.recall` — Recall project memory into current session
|
|
442
|
-
- `/mema.create-skill` — Generate a new memory-aware skill
|
|
443
|
-
```
|
|
444
|
-
|
|
445
|
-
**Memory System:** Append the standard Memory System section (same text as Path A).
|
|
318
|
+
## Memory System
|
|
446
319
|
|
|
447
|
-
|
|
320
|
+
This project uses mema-kit for persistent memory across sessions.
|
|
448
321
|
|
|
449
|
-
|
|
322
|
+
Memory lives in `.mema/`. At the start of each task, read `.mema/index.md` to load relevant context. After completing work, curate and save knowledge following the memory protocol in `.claude/skills/_memory-protocol.md`.
|
|
450
323
|
|
|
324
|
+
Memory is managed automatically by skills — do not manually modify `.mema/` files unless correcting an error.
|
|
451
325
|
```
|
|
452
|
-
# CLAUDE.md
|
|
453
|
-
|
|
454
|
-
This file provides guidance to Claude Code when working with code in this repository.
|
|
455
|
-
|
|
456
|
-
# About Me
|
|
457
|
-
[Content from 6b]
|
|
458
|
-
|
|
459
|
-
## Project Overview
|
|
460
|
-
|
|
461
|
-
[Content from 6c — opening paragraph]
|
|
462
|
-
|
|
463
|
-
### Repository Structure
|
|
464
|
-
|
|
465
|
-
[Content from 6c — tree]
|
|
466
|
-
|
|
467
|
-
### Architecture
|
|
468
|
-
|
|
469
|
-
[Content from 6c — architecture description]
|
|
470
|
-
|
|
471
|
-
## Coding Standards
|
|
472
326
|
|
|
473
|
-
|
|
327
|
+
### Path B: CLAUDE.md does NOT exist — Generate from scratch
|
|
474
328
|
|
|
475
|
-
|
|
329
|
+
Follow sub-steps 7a through 7f.
|
|
476
330
|
|
|
477
|
-
|
|
331
|
+
#### 7a: Ask user "About Me"
|
|
478
332
|
|
|
479
|
-
|
|
333
|
+
Ask one question using AskUserQuestion:
|
|
480
334
|
|
|
481
|
-
|
|
335
|
+
> "Before I generate your CLAUDE.md, how would you describe yourself?"
|
|
482
336
|
|
|
483
|
-
|
|
337
|
+
Options:
|
|
338
|
+
- **Junior developer** — "I'm learning. Explain decisions, be thorough, correct my terminology gently."
|
|
339
|
+
- **Senior developer** — "I'm experienced. Keep explanations brief, focus on trade-offs and edge cases."
|
|
340
|
+
- **Skip** — Use a sensible default
|
|
484
341
|
|
|
485
|
-
|
|
342
|
+
#### 7b–7f: Generate CLAUDE.md sections
|
|
486
343
|
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
344
|
+
Use Step 5 scan data to write:
|
|
345
|
+
- `# About Me` — from user's answer in 7a
|
|
346
|
+
- `## Project Overview` — name, description, directory tree, architecture
|
|
347
|
+
- `## Coding Standards` — naming conventions, style, patterns, tooling detected
|
|
348
|
+
- `## Technical Workflows` — dev/test/build commands from package scripts
|
|
349
|
+
- `## Skill Commands` — scan `.claude/skills/` for SKILL.md frontmatter descriptions
|
|
350
|
+
- `## Memory System` — standard section (same as Path A)
|
|
491
351
|
|
|
492
|
-
## Step
|
|
352
|
+
## Step 8: Update .gitignore
|
|
493
353
|
|
|
494
|
-
1. Read
|
|
495
|
-
2.
|
|
496
|
-
3. If
|
|
497
|
-
4. If not found → append the following block at the end of the file
|
|
498
|
-
5. If `.gitignore` doesn't exist → create the file with this content
|
|
499
|
-
|
|
500
|
-
Append this block:
|
|
354
|
+
1. Read current `.gitignore` (if exists)
|
|
355
|
+
2. If `.mema` is already excluded → skip
|
|
356
|
+
3. If not → append:
|
|
501
357
|
|
|
502
358
|
```
|
|
503
359
|
# mema-kit memory (developer-local)
|
|
504
360
|
.mema/*
|
|
505
361
|
# Uncomment to share project decisions with your team:
|
|
506
|
-
# !.mema/project
|
|
362
|
+
# !.mema/project/
|
|
507
363
|
```
|
|
508
364
|
|
|
509
|
-
## Step
|
|
510
|
-
|
|
511
|
-
Print a summary of what was done, including what you discovered about the project. Use the CLAUDE.md outcome recorded in Step 6 to select the appropriate message.
|
|
512
|
-
|
|
513
|
-
For the CLAUDE.md line, use the matching outcome:
|
|
365
|
+
## Step 9: Confirm to User
|
|
514
366
|
|
|
515
|
-
|
|
516
|
-
- **appended** → `[check] CLAUDE.md updated — memory system section appended`
|
|
517
|
-
- **skipped** → `[check] CLAUDE.md — memory system section already present`
|
|
518
|
-
|
|
519
|
-
### Fresh setup (first run):
|
|
367
|
+
Print a summary of what was done:
|
|
520
368
|
|
|
521
369
|
```
|
|
522
|
-
mema-kit initialized!
|
|
523
|
-
|
|
524
|
-
[check] .mema/ directory structure (memory system)
|
|
525
|
-
[check] Memory templates in .mema/_templates/
|
|
526
|
-
[check] [CLAUDE.md outcome message from above]
|
|
527
|
-
[check] .gitignore updated to exclude .mema/
|
|
370
|
+
mema-kit initialized!
|
|
528
371
|
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
- [Notable findings]
|
|
372
|
+
[check] .mema/ structure created (product/, features/, project/, agent/)
|
|
373
|
+
[check] project/structure.md generated
|
|
374
|
+
[check] CLAUDE.md [generated / updated / already configured]
|
|
375
|
+
[check] .gitignore updated
|
|
534
376
|
|
|
535
|
-
|
|
536
|
-
-
|
|
537
|
-
-
|
|
538
|
-
-
|
|
539
|
-
- patterns.md — [N] initial patterns
|
|
377
|
+
Project scan:
|
|
378
|
+
- [Language/framework]
|
|
379
|
+
- [Architecture pattern]
|
|
380
|
+
- [Key finding]
|
|
540
381
|
|
|
541
|
-
Next:
|
|
382
|
+
Next steps:
|
|
383
|
+
- New idea? Run /mema.seed to start the discovery workflow
|
|
384
|
+
- Existing feature to build? Run /mema.specify to create a feature spec
|
|
385
|
+
- Start a new session? Run /mema.recall to load context
|
|
542
386
|
```
|
|
543
387
|
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
Adjust the summary to show what was verified vs. created:
|
|
388
|
+
For a re-run with migration:
|
|
547
389
|
|
|
548
390
|
```
|
|
549
|
-
mema-kit
|
|
391
|
+
mema-kit updated!
|
|
550
392
|
|
|
551
|
-
[check]
|
|
552
|
-
[check]
|
|
553
|
-
[check]
|
|
554
|
-
[check]
|
|
393
|
+
[check] Migrated project-memory/ → project/
|
|
394
|
+
[check] Migrated agent-memory/ → agent/
|
|
395
|
+
[check] Migrated task-memory/ → features/
|
|
396
|
+
[check] Directory structure verified
|
|
555
397
|
|
|
556
|
-
Your
|
|
398
|
+
Your existing memory is preserved. Run /mema.recall to see current state.
|
|
557
399
|
```
|