mema-kit 1.0.5 → 1.1.0
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 +89 -40
- package/bin/cli.js +3 -3
- package/docs/guide.md +121 -218
- package/package.json +2 -2
- package/skills/_memory-protocol.md +32 -25
- package/skills/mema.challenge/SKILL.md +121 -0
- package/skills/mema.clarify/SKILL.md +109 -0
- package/skills/mema.create-skill/SKILL.md +304 -0
- package/skills/mema.implement/SKILL.md +167 -0
- package/skills/mema.onboard/SKILL.md +364 -0
- package/skills/mema.plan/SKILL.md +150 -0
- package/skills/mema.recall/SKILL.md +129 -0
- 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 +16 -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/skills/create-skill/SKILL.md +0 -242
- package/skills/implement/SKILL.md +0 -184
- package/skills/onboard/SKILL.md +0 -557
- package/skills/plan/SKILL.md +0 -206
- package/skills/recall/SKILL.md +0 -135
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Execute implementation plan steps one at a time. Picks up the next step from an existing feature plan, implements it, verifies the result, and tracks progress. Run /mema.plan first to create a plan.
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# /mema.implement — Feature Step Execution
|
|
6
|
+
|
|
7
|
+
You are executing the /mema.implement skill. Follow these steps carefully.
|
|
8
|
+
|
|
9
|
+
This skill picks up a step from an existing feature plan (created by `/mema.plan`), implements it, verifies the result, and updates progress tracking. By default, it implements **one step at a time** to give the user control.
|
|
10
|
+
|
|
11
|
+
## Phase 1: AUTO-LOAD
|
|
12
|
+
|
|
13
|
+
1. Read `.mema/index.md` to understand current project state
|
|
14
|
+
2. If `index.md` is missing or `.mema/` does not exist:
|
|
15
|
+
- Tell the user: "No memory found. Run `/mema.onboard` first."
|
|
16
|
+
- **Stop here.**
|
|
17
|
+
3. If `index.md` is empty, run the **Rebuild Procedure** from `_memory-protocol.md`
|
|
18
|
+
4. Scan `## Active Features` in `index.md` to find features with plans
|
|
19
|
+
5. Load relevant memory:
|
|
20
|
+
- `project/architecture.md` — technical context
|
|
21
|
+
- `project/decisions/` — past decisions that affect implementation
|
|
22
|
+
- `agent/lessons.md` — mistakes to avoid
|
|
23
|
+
- `agent/patterns.md` — reusable approaches
|
|
24
|
+
|
|
25
|
+
## Phase 2: WORK
|
|
26
|
+
|
|
27
|
+
### 2a: Select Feature
|
|
28
|
+
|
|
29
|
+
Parse the user's input:
|
|
30
|
+
|
|
31
|
+
- **Feature name or number:** `/mema.implement user-auth` or `/mema.implement 001` → find `features/NNN-name/`
|
|
32
|
+
- **Feature + step:** `/mema.implement user-auth step 3` → implement that specific step
|
|
33
|
+
- **No input:** list active features from index.md and ask which one
|
|
34
|
+
- **"all" modifier:** `/mema.implement user-auth all` → implement all remaining steps (see 2e)
|
|
35
|
+
|
|
36
|
+
If the feature directory doesn't exist:
|
|
37
|
+
- Tell the user: "No feature found for '[input]'. Run `/mema.specify` and `/mema.plan` first."
|
|
38
|
+
- **Stop here.**
|
|
39
|
+
|
|
40
|
+
### 2b: Load Feature Context
|
|
41
|
+
|
|
42
|
+
Read from `features/NNN-name/`:
|
|
43
|
+
|
|
44
|
+
1. **`tasks.md`** — the ordered task list (prefer this over plan.md for step selection)
|
|
45
|
+
2. **`plan.md`** — the technical design
|
|
46
|
+
3. **`spec.md`** — what the feature is supposed to do
|
|
47
|
+
4. **`status.md`** — current progress
|
|
48
|
+
|
|
49
|
+
If `tasks.md` is missing, tell the user: "No tasks found. Run `/mema.tasks [feature]` first."
|
|
50
|
+
|
|
51
|
+
### 2c: Select Step
|
|
52
|
+
|
|
53
|
+
- **If user specified a step:** validate it exists and isn't already complete. If complete, ask if they want to re-implement it.
|
|
54
|
+
- **If no step specified:** find the first incomplete item (`- [ ]`) in `tasks.md`. If all items are complete, proceed to 2f (Task Completion).
|
|
55
|
+
|
|
56
|
+
Tell the user which step is being implemented:
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
## Implementing: [task description]
|
|
60
|
+
|
|
61
|
+
[Brief description of what this step does]
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### 2d: Implement the Step
|
|
65
|
+
|
|
66
|
+
1. **Read the task details** from `tasks.md` — files to create/modify, what to do
|
|
67
|
+
2. **Check dependencies** — if the task references prior tasks that aren't done, warn the user and ask to confirm before proceeding
|
|
68
|
+
3. **Implement the changes** — create/modify files as specified; follow the project's existing patterns (from architecture.md and patterns.md); apply lessons (from lessons.md) to avoid known pitfalls
|
|
69
|
+
4. **Verify:**
|
|
70
|
+
- If the project has tests relevant to this step: run them
|
|
71
|
+
- Check for syntax errors, missing imports, obvious issues
|
|
72
|
+
- If verification fails: do NOT mark as complete; report what went wrong and suggest a fix
|
|
73
|
+
|
|
74
|
+
### 2e: Implement All Remaining (if requested)
|
|
75
|
+
|
|
76
|
+
1. Implement tasks sequentially from first incomplete task
|
|
77
|
+
2. Verify each before moving to next
|
|
78
|
+
3. If any step fails, stop and report — do not continue
|
|
79
|
+
4. Show a brief progress update after each step
|
|
80
|
+
|
|
81
|
+
### 2f: Update Progress
|
|
82
|
+
|
|
83
|
+
After each step:
|
|
84
|
+
|
|
85
|
+
1. **Update `features/NNN-name/status.md`:**
|
|
86
|
+
- Update status to `in-progress` if this is the first step
|
|
87
|
+
- Add a progress log entry: date + task + notes
|
|
88
|
+
- Update "Next Task" field
|
|
89
|
+
- Update `**Updated:**` date
|
|
90
|
+
|
|
91
|
+
2. **Update `features/NNN-name/tasks.md`:**
|
|
92
|
+
- Mark completed task: `- [x]`
|
|
93
|
+
|
|
94
|
+
3. **Print progress summary:**
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
## Progress: [Feature Name]
|
|
98
|
+
|
|
99
|
+
Task complete: [what was done]
|
|
100
|
+
|
|
101
|
+
[if verified:] Verified: [how]
|
|
102
|
+
[if failed:] Issue: [what went wrong] | Suggested fix: [how to resolve]
|
|
103
|
+
|
|
104
|
+
### Overall Progress
|
|
105
|
+
[====------] [completed]/[total] tasks
|
|
106
|
+
Next: [next task description]
|
|
107
|
+
|
|
108
|
+
To continue: /mema.implement [feature-name]
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### 2g: Feature Completion
|
|
112
|
+
|
|
113
|
+
If all tasks in `tasks.md` are now complete:
|
|
114
|
+
|
|
115
|
+
1. Print completion summary:
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
## Feature Complete: [Feature Name]
|
|
119
|
+
|
|
120
|
+
All [N] tasks implemented.
|
|
121
|
+
|
|
122
|
+
### What was built
|
|
123
|
+
[Summary of changes]
|
|
124
|
+
|
|
125
|
+
### Files changed
|
|
126
|
+
[List of files created or modified]
|
|
127
|
+
|
|
128
|
+
Archive this feature? (moves to archive/ and removes from active features)
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
2. If user confirms, archive in Phase 3.
|
|
132
|
+
|
|
133
|
+
### 2h: Learn
|
|
134
|
+
|
|
135
|
+
After completing work, reflect:
|
|
136
|
+
- Unexpected issues → record as lesson
|
|
137
|
+
- Patterns that worked → record as pattern
|
|
138
|
+
- Previous lessons that were wrong → update or delete them
|
|
139
|
+
|
|
140
|
+
## Phase 3: AUTO-SAVE & CURATE
|
|
141
|
+
|
|
142
|
+
Follow curation rules in `_memory-protocol.md`:
|
|
143
|
+
|
|
144
|
+
- **Decisions made** during implementation → ADD to `project/decisions/YYYY-MM-DD-short-name.md`
|
|
145
|
+
- **Architecture changes** → UPDATE `project/architecture.md`
|
|
146
|
+
- **Lessons learned** → ADD/UPDATE `agent/lessons.md`
|
|
147
|
+
- **Patterns discovered** → ADD/UPDATE `agent/patterns.md`
|
|
148
|
+
- **Task progress** → UPDATE `features/NNN-name/status.md` (done in 2f)
|
|
149
|
+
|
|
150
|
+
Most files will be NOOP.
|
|
151
|
+
|
|
152
|
+
### Feature Archiving (on completion)
|
|
153
|
+
|
|
154
|
+
If fully complete and user confirmed:
|
|
155
|
+
|
|
156
|
+
1. Update `features/NNN-name/status.md`: set `**Status:** complete`
|
|
157
|
+
2. Move `features/NNN-name/` to `archive/NNN-name/`
|
|
158
|
+
3. Remove feature from `## Active Features` in `index.md`
|
|
159
|
+
|
|
160
|
+
## Phase 4: AUTO-INDEX
|
|
161
|
+
|
|
162
|
+
Update `.mema/index.md`:
|
|
163
|
+
1. Re-read the current index
|
|
164
|
+
2. Update the feature's summary in `## Active Features` with current progress (e.g., "3/7 tasks complete")
|
|
165
|
+
3. If archived: remove from `## Active Features`
|
|
166
|
+
4. Add entries for new files (decisions, lessons, patterns)
|
|
167
|
+
5. Update `**Updated:**` date
|
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Bootstrap the mema-kit memory system for this project. Creates .mema/ directory, scans the project, populates initial memory, and configures CLAUDE.md and .gitignore.
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# /mema.onboard — Project Memory Bootstrap
|
|
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 without confirming.
|
|
8
|
+
|
|
9
|
+
## Step 1: Check Current State
|
|
10
|
+
|
|
11
|
+
Before creating anything, assess what already exists:
|
|
12
|
+
|
|
13
|
+
1. Check if `.mema/` directory exists
|
|
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
|
|
17
|
+
|
|
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."
|
|
19
|
+
|
|
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
|
|
31
|
+
|
|
32
|
+
Create the following directories if they don't already exist:
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
.mema/
|
|
36
|
+
├── product/
|
|
37
|
+
├── features/
|
|
38
|
+
├── project/
|
|
39
|
+
│ └── decisions/
|
|
40
|
+
├── agent/
|
|
41
|
+
└── archive/
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
For each directory: if it exists, skip it. If it doesn't, create it.
|
|
45
|
+
|
|
46
|
+
## Step 4: Write Template Files
|
|
47
|
+
|
|
48
|
+
Write the following files to `.mema/_templates/`. If a template file already exists, **skip it**.
|
|
49
|
+
|
|
50
|
+
### `.mema/_templates/decision.md`
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
# [Decision Title]
|
|
54
|
+
|
|
55
|
+
**Status:** active | **Updated:** YYYY-MM-DD
|
|
56
|
+
|
|
57
|
+
## Context
|
|
58
|
+
|
|
59
|
+
## Decision
|
|
60
|
+
|
|
61
|
+
## Options Considered
|
|
62
|
+
|
|
63
|
+
### Option A: [Name]
|
|
64
|
+
|
|
65
|
+
### Option B: [Name]
|
|
66
|
+
|
|
67
|
+
## Reasoning
|
|
68
|
+
|
|
69
|
+
## Consequences
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### `.mema/_templates/spec.md`
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
# [Feature Name] — Spec
|
|
76
|
+
|
|
77
|
+
**Status:** active | **Updated:** YYYY-MM-DD
|
|
78
|
+
|
|
79
|
+
## Purpose
|
|
80
|
+
|
|
81
|
+
## User Scenarios
|
|
82
|
+
|
|
83
|
+
### Scenario 1
|
|
84
|
+
|
|
85
|
+
Given [state], When [action], Then [outcome]
|
|
86
|
+
|
|
87
|
+
## Acceptance Criteria
|
|
88
|
+
|
|
89
|
+
- [ ] [Criterion]
|
|
90
|
+
|
|
91
|
+
## Constraints
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### `.mema/_templates/status.md`
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
# [Feature Name] — Status
|
|
98
|
+
|
|
99
|
+
**Status:** pending | **Updated:** YYYY-MM-DD
|
|
100
|
+
|
|
101
|
+
## Current Status
|
|
102
|
+
|
|
103
|
+
`pending` — not started
|
|
104
|
+
|
|
105
|
+
## Progress Log
|
|
106
|
+
|
|
107
|
+
| Date | Task | Notes |
|
|
108
|
+
|------|------|-------|
|
|
109
|
+
|
|
110
|
+
## Next Task
|
|
111
|
+
|
|
112
|
+
## Blockers
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### `.mema/_templates/lessons.md`
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
# Agent Lessons
|
|
119
|
+
|
|
120
|
+
**Updated:** YYYY-MM-DD
|
|
121
|
+
|
|
122
|
+
## Lessons
|
|
123
|
+
|
|
124
|
+
### [Short Title]
|
|
125
|
+
- **Context:**
|
|
126
|
+
- **Example:**
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### `.mema/_templates/patterns.md`
|
|
132
|
+
|
|
133
|
+
```
|
|
134
|
+
# Agent Patterns
|
|
135
|
+
|
|
136
|
+
**Updated:** YYYY-MM-DD
|
|
137
|
+
|
|
138
|
+
## Patterns
|
|
139
|
+
|
|
140
|
+
### [Pattern Name]
|
|
141
|
+
- **Structure:**
|
|
142
|
+
- **Example:**
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
## Step 5: Scan the Project
|
|
148
|
+
|
|
149
|
+
Read and analyze the project to populate memory with real content.
|
|
150
|
+
|
|
151
|
+
### 5a: Detect Project Type and Stack
|
|
152
|
+
|
|
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.)
|
|
158
|
+
|
|
159
|
+
### 5b: Scan Directory Structure
|
|
160
|
+
|
|
161
|
+
List top-level directories and key subdirectories (1-2 levels deep). Note source, test, and config locations.
|
|
162
|
+
|
|
163
|
+
### 5c: Read Representative Source Files
|
|
164
|
+
|
|
165
|
+
Pick 2-3 files that best represent the codebase: main entry point, a representative module, a test file.
|
|
166
|
+
|
|
167
|
+
### 5d: Compile Findings
|
|
168
|
+
|
|
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
|
|
177
|
+
|
|
178
|
+
## Step 6: Populate Initial Memory
|
|
179
|
+
|
|
180
|
+
Using scan findings, create files with **real content** (not empty placeholders).
|
|
181
|
+
|
|
182
|
+
### `.mema/project/architecture.md`
|
|
183
|
+
|
|
184
|
+
```
|
|
185
|
+
# Project Architecture
|
|
186
|
+
|
|
187
|
+
**Status:** active | **Updated:** [today]
|
|
188
|
+
|
|
189
|
+
## Stack
|
|
190
|
+
- **Language:** [detected]
|
|
191
|
+
- **Framework:** [detected]
|
|
192
|
+
[other stack items]
|
|
193
|
+
|
|
194
|
+
## Structure
|
|
195
|
+
- `[dir]/` — [purpose]
|
|
196
|
+
[other directories]
|
|
197
|
+
|
|
198
|
+
## Architecture
|
|
199
|
+
[Pattern in 1-2 sentences. Entry point: path/to/entry]
|
|
200
|
+
|
|
201
|
+
## Commands
|
|
202
|
+
- `[dev command]` — Start development
|
|
203
|
+
- `[test command]` — Run tests
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### `.mema/project/requirements.md`
|
|
207
|
+
|
|
208
|
+
```
|
|
209
|
+
# Project Requirements
|
|
210
|
+
|
|
211
|
+
**Status:** active | **Updated:** [today]
|
|
212
|
+
|
|
213
|
+
## Purpose
|
|
214
|
+
[What this project does, from README and code]
|
|
215
|
+
|
|
216
|
+
## Key Requirements
|
|
217
|
+
- [Requirement from code/docs]
|
|
218
|
+
|
|
219
|
+
## Constraints
|
|
220
|
+
- [Constraint discovered]
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
### `.mema/agent/lessons.md`
|
|
224
|
+
|
|
225
|
+
```
|
|
226
|
+
# Agent Lessons
|
|
227
|
+
|
|
228
|
+
**Updated:** [today]
|
|
229
|
+
|
|
230
|
+
## Lessons
|
|
231
|
+
|
|
232
|
+
[Add any project-specific gotchas found during scan, or leave as:]
|
|
233
|
+
<!-- Lessons will be added here as development experience accumulates. -->
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### `.mema/agent/patterns.md`
|
|
237
|
+
|
|
238
|
+
```
|
|
239
|
+
# Agent Patterns
|
|
240
|
+
|
|
241
|
+
**Updated:** [today]
|
|
242
|
+
|
|
243
|
+
## Patterns
|
|
244
|
+
|
|
245
|
+
[Add any clear patterns from source files, or leave as:]
|
|
246
|
+
<!-- Patterns will be added here as development experience accumulates. -->
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
### `.mema/index.md`
|
|
250
|
+
|
|
251
|
+
Build the index from files just created:
|
|
252
|
+
|
|
253
|
+
```
|
|
254
|
+
# Memory Index
|
|
255
|
+
|
|
256
|
+
**Updated:** [today]
|
|
257
|
+
|
|
258
|
+
## Active Features
|
|
259
|
+
|
|
260
|
+
## Product Discovery
|
|
261
|
+
|
|
262
|
+
## Project Knowledge
|
|
263
|
+
- `project/architecture.md` — [one-line stack/architecture summary]
|
|
264
|
+
- `project/requirements.md` — [one-line purpose summary]
|
|
265
|
+
|
|
266
|
+
## Agent Knowledge
|
|
267
|
+
- `agent/lessons.md` — [N] lessons recorded
|
|
268
|
+
- `agent/patterns.md` — [N] patterns recorded
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
## Step 7: Update CLAUDE.md
|
|
272
|
+
|
|
273
|
+
Read the current `CLAUDE.md` (if exists) and follow the appropriate path:
|
|
274
|
+
|
|
275
|
+
### Path A: CLAUDE.md already exists
|
|
276
|
+
|
|
277
|
+
1. Search for `## Memory System`
|
|
278
|
+
2. If found → **skip this step** (already configured)
|
|
279
|
+
3. If not found → append the Memory System section below
|
|
280
|
+
|
|
281
|
+
Memory System section:
|
|
282
|
+
|
|
283
|
+
```
|
|
284
|
+
## Memory System
|
|
285
|
+
|
|
286
|
+
This project uses mema-kit for persistent memory across sessions.
|
|
287
|
+
|
|
288
|
+
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`.
|
|
289
|
+
|
|
290
|
+
Memory is managed automatically by skills — do not manually modify `.mema/` files unless correcting an error.
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
### Path B: CLAUDE.md does NOT exist — Generate from scratch
|
|
294
|
+
|
|
295
|
+
Follow sub-steps 7a through 7f.
|
|
296
|
+
|
|
297
|
+
#### 7a: Ask user "About Me"
|
|
298
|
+
|
|
299
|
+
Ask one question using AskUserQuestion:
|
|
300
|
+
|
|
301
|
+
> "Before I generate your CLAUDE.md, how would you describe yourself?"
|
|
302
|
+
|
|
303
|
+
Options:
|
|
304
|
+
- **Junior developer** — "I'm learning. Explain decisions, be thorough, correct my terminology gently."
|
|
305
|
+
- **Senior developer** — "I'm experienced. Keep explanations brief, focus on trade-offs and edge cases."
|
|
306
|
+
- **Skip** — Use a sensible default
|
|
307
|
+
|
|
308
|
+
#### 7b–7f: Generate CLAUDE.md sections
|
|
309
|
+
|
|
310
|
+
Use Step 5 scan data to write:
|
|
311
|
+
- `# About Me` — from user's answer in 7a
|
|
312
|
+
- `## Project Overview` — name, description, directory tree, architecture
|
|
313
|
+
- `## Coding Standards` — naming conventions, style, patterns, tooling detected
|
|
314
|
+
- `## Technical Workflows` — dev/test/build commands from package scripts
|
|
315
|
+
- `## Skill Commands` — scan `.claude/skills/` for SKILL.md frontmatter descriptions
|
|
316
|
+
- `## Memory System` — standard section (same as Path A)
|
|
317
|
+
|
|
318
|
+
## Step 8: Update .gitignore
|
|
319
|
+
|
|
320
|
+
1. Read current `.gitignore` (if exists)
|
|
321
|
+
2. If `.mema` is already excluded → skip
|
|
322
|
+
3. If not → append:
|
|
323
|
+
|
|
324
|
+
```
|
|
325
|
+
# mema-kit memory (developer-local)
|
|
326
|
+
.mema/*
|
|
327
|
+
# Uncomment to share project decisions with your team:
|
|
328
|
+
# !.mema/project/
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
## Step 9: Confirm to User
|
|
332
|
+
|
|
333
|
+
Print a summary of what was done:
|
|
334
|
+
|
|
335
|
+
```
|
|
336
|
+
mema-kit initialized!
|
|
337
|
+
|
|
338
|
+
[check] .mema/ structure created (product/, features/, project/, agent/)
|
|
339
|
+
[check] CLAUDE.md [generated / updated / already configured]
|
|
340
|
+
[check] .gitignore updated
|
|
341
|
+
|
|
342
|
+
Project scan:
|
|
343
|
+
- [Language/framework]
|
|
344
|
+
- [Architecture pattern]
|
|
345
|
+
- [Key finding]
|
|
346
|
+
|
|
347
|
+
Next steps:
|
|
348
|
+
- New idea? Run /mema.seed to start the discovery workflow
|
|
349
|
+
- Existing feature to build? Run /mema.specify to create a feature spec
|
|
350
|
+
- Start a new session? Run /mema.recall to load context
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
For a re-run with migration:
|
|
354
|
+
|
|
355
|
+
```
|
|
356
|
+
mema-kit updated!
|
|
357
|
+
|
|
358
|
+
[check] Migrated project-memory/ → project/
|
|
359
|
+
[check] Migrated agent-memory/ → agent/
|
|
360
|
+
[check] Migrated task-memory/ → features/
|
|
361
|
+
[check] Directory structure verified
|
|
362
|
+
|
|
363
|
+
Your existing memory is preserved. Run /mema.recall to see current state.
|
|
364
|
+
```
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Create a technical implementation plan for a feature. Reads the feature spec, explores the codebase, and writes a detailed plan to features/NNN-name/plan.md for use by /mema.tasks and /mema.implement.
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# /mema.plan — Feature Technical Design
|
|
6
|
+
|
|
7
|
+
You are executing the /mema.plan skill. Follow these steps carefully.
|
|
8
|
+
|
|
9
|
+
This skill takes a feature spec (created by `/mema.specify`) and produces a technical implementation plan — what to build, how it fits the existing architecture, and which files to change.
|
|
10
|
+
|
|
11
|
+
## Phase 1: AUTO-LOAD
|
|
12
|
+
|
|
13
|
+
1. Read `.mema/index.md` to understand current project state
|
|
14
|
+
2. If `index.md` is missing or `.mema/` does not exist:
|
|
15
|
+
- Tell the user: "No memory found. Run `/mema.onboard` first to set up mema-kit."
|
|
16
|
+
- **Stop here.**
|
|
17
|
+
3. If `index.md` is empty, run the **Rebuild Procedure** from `_memory-protocol.md`
|
|
18
|
+
4. Load relevant memory:
|
|
19
|
+
- `project/architecture.md` — current stack and patterns
|
|
20
|
+
- `project/requirements.md` — constraints to respect
|
|
21
|
+
- `project/decisions/` — past decisions that affect this plan
|
|
22
|
+
- `agent/lessons.md` — mistakes to avoid
|
|
23
|
+
- `agent/patterns.md` — reusable approaches to apply
|
|
24
|
+
|
|
25
|
+
## Phase 2: WORK
|
|
26
|
+
|
|
27
|
+
### 2a: Select Feature
|
|
28
|
+
|
|
29
|
+
Parse the user's input:
|
|
30
|
+
- **Feature name or number given:** `/mema.plan user-auth` or `/mema.plan 001` → find matching `features/NNN-name/`
|
|
31
|
+
- **No input:** list features that have a `spec.md` but no `plan.md`; ask which to plan
|
|
32
|
+
|
|
33
|
+
If the feature directory doesn't exist:
|
|
34
|
+
- Tell the user: "No feature found for '[input]'. Run `/mema.specify` first to create a feature spec."
|
|
35
|
+
- **Stop here.**
|
|
36
|
+
|
|
37
|
+
If `plan.md` already exists:
|
|
38
|
+
- Tell the user: "A plan already exists for [feature-name]. Would you like to revise it or start fresh?"
|
|
39
|
+
- If revising: load the existing plan as a starting point.
|
|
40
|
+
|
|
41
|
+
### 2b: Load the Feature Spec
|
|
42
|
+
|
|
43
|
+
Read `features/NNN-name/spec.md` in full.
|
|
44
|
+
|
|
45
|
+
If `spec.md` is missing:
|
|
46
|
+
- Tell the user: "No spec found for [feature-name]. Run `/mema.specify` first."
|
|
47
|
+
- **Stop here.**
|
|
48
|
+
|
|
49
|
+
### 2c: Explore the Codebase
|
|
50
|
+
|
|
51
|
+
Before writing the plan, explore what already exists. Read 3–5 files relevant to this feature:
|
|
52
|
+
- Entry points or route files the feature will touch
|
|
53
|
+
- Existing patterns for similar features (e.g., if adding auth, read an existing auth-adjacent file)
|
|
54
|
+
- Test files for the area being changed
|
|
55
|
+
- Config files if the feature requires configuration changes
|
|
56
|
+
|
|
57
|
+
Note: current patterns, naming conventions, architectural constraints, and anything the spec didn't mention that affects implementation.
|
|
58
|
+
|
|
59
|
+
### 2d: Clarify if Needed
|
|
60
|
+
|
|
61
|
+
If the spec leaves meaningful technical ambiguity, ask **one clarifying question** using AskUserQuestion. Skip this step if the spec is clear.
|
|
62
|
+
|
|
63
|
+
Good clarifying questions:
|
|
64
|
+
- "The spec mentions [X]. Should this follow the existing pattern in [file], or take a new approach?"
|
|
65
|
+
- "Should this feature include tests, or is that deferred?"
|
|
66
|
+
|
|
67
|
+
### 2e: Write the Plan
|
|
68
|
+
|
|
69
|
+
Produce a technical plan in these parts:
|
|
70
|
+
|
|
71
|
+
**Approach** — 1–2 paragraphs:
|
|
72
|
+
- What architectural approach will be used?
|
|
73
|
+
- How does it fit the existing codebase patterns?
|
|
74
|
+
- What key technical decisions does this plan make?
|
|
75
|
+
|
|
76
|
+
**Key Entities / Data** (if relevant):
|
|
77
|
+
- Data structures, models, or types involved
|
|
78
|
+
- Database schema changes if applicable
|
|
79
|
+
|
|
80
|
+
**File Changes** — the complete set of files to create or modify:
|
|
81
|
+
- List each file with a one-line description of what changes
|
|
82
|
+
- Include test files
|
|
83
|
+
|
|
84
|
+
**Implementation Notes** — gotchas, constraints, dependencies:
|
|
85
|
+
- Lessons from lessons.md that apply
|
|
86
|
+
- Patterns from patterns.md to follow
|
|
87
|
+
- Non-obvious dependencies or ordering requirements
|
|
88
|
+
|
|
89
|
+
### 2f: Write Plan File
|
|
90
|
+
|
|
91
|
+
Write `features/NNN-name/plan.md`:
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
# [Feature Name] — Plan
|
|
95
|
+
|
|
96
|
+
**Status:** active | **Updated:** [today's date]
|
|
97
|
+
|
|
98
|
+
## Approach
|
|
99
|
+
|
|
100
|
+
[High-level technical approach from 2e]
|
|
101
|
+
|
|
102
|
+
## Key Entities
|
|
103
|
+
|
|
104
|
+
[Data structures / models if applicable]
|
|
105
|
+
|
|
106
|
+
## File Changes
|
|
107
|
+
|
|
108
|
+
- `path/to/file` — [what changes]
|
|
109
|
+
- `path/to/file` — [what changes]
|
|
110
|
+
|
|
111
|
+
## Implementation Notes
|
|
112
|
+
|
|
113
|
+
[Gotchas, patterns to follow, ordering requirements]
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### 2g: Present to User
|
|
117
|
+
|
|
118
|
+
```
|
|
119
|
+
## Plan: [Feature Name]
|
|
120
|
+
|
|
121
|
+
### Approach
|
|
122
|
+
[1-2 sentence summary]
|
|
123
|
+
|
|
124
|
+
### Files to change ([N] total)
|
|
125
|
+
- [file] — [what]
|
|
126
|
+
- [file] — [what]
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
Plan saved to features/[NNN-name]/plan.md
|
|
130
|
+
Next: /mema.tasks [NNN-name]
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Phase 3: AUTO-SAVE & CURATE
|
|
134
|
+
|
|
135
|
+
Follow the curation rules in `_memory-protocol.md`:
|
|
136
|
+
|
|
137
|
+
- **Significant architectural decisions** made during planning → ADD to `project/decisions/YYYY-MM-DD-short-name.md`
|
|
138
|
+
- **Architecture discoveries** (found something missing or wrong in architecture.md) → UPDATE `project/architecture.md`
|
|
139
|
+
- **Lessons** from planning → ADD/UPDATE `agent/lessons.md`
|
|
140
|
+
- **Patterns** identified → ADD/UPDATE `agent/patterns.md`
|
|
141
|
+
|
|
142
|
+
Most files will be NOOP.
|
|
143
|
+
|
|
144
|
+
## Phase 4: AUTO-INDEX
|
|
145
|
+
|
|
146
|
+
Update `.mema/index.md`:
|
|
147
|
+
1. Re-read the current index
|
|
148
|
+
2. If the feature's entry in `## Active Features` doesn't mention a plan, update its summary: add "(plan ready)"
|
|
149
|
+
3. Add entries for any new decision files
|
|
150
|
+
4. Update `**Updated:**` date
|