@hir4ta/mneme 0.17.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/.claude-plugin/plugin.json +29 -0
- package/.mcp.json +18 -0
- package/README.ja.md +400 -0
- package/README.md +410 -0
- package/bin/mneme.js +203 -0
- package/dist/lib/db.js +340 -0
- package/dist/lib/fuzzy-search.js +214 -0
- package/dist/lib/github.js +121 -0
- package/dist/lib/similarity.js +193 -0
- package/dist/lib/utils.js +62 -0
- package/dist/public/apple-touch-icon.png +0 -0
- package/dist/public/assets/index-BgqCALAg.css +1 -0
- package/dist/public/assets/index-EMvn4VEa.js +330 -0
- package/dist/public/assets/react-force-graph-2d-DWoBaKmT.js +46 -0
- package/dist/public/favicon-128-max.png +0 -0
- package/dist/public/favicon-256-max.png +0 -0
- package/dist/public/favicon-32-max.png +0 -0
- package/dist/public/favicon-512-max.png +0 -0
- package/dist/public/favicon-64-max.png +0 -0
- package/dist/public/index.html +15 -0
- package/dist/server.js +4791 -0
- package/dist/servers/db-server.js +30558 -0
- package/dist/servers/search-server.js +30366 -0
- package/hooks/default-tags.json +1055 -0
- package/hooks/hooks.json +61 -0
- package/hooks/post-tool-use.sh +96 -0
- package/hooks/pre-compact.sh +187 -0
- package/hooks/session-end.sh +567 -0
- package/hooks/session-start.sh +380 -0
- package/hooks/user-prompt-submit.sh +253 -0
- package/package.json +77 -0
- package/servers/db-server.ts +993 -0
- package/servers/search-server.ts +675 -0
- package/skills/AGENTS.override.md +5 -0
- package/skills/harvest/skill.md +295 -0
- package/skills/init-mneme/skill.md +101 -0
- package/skills/plan/skill.md +422 -0
- package/skills/report/skill.md +74 -0
- package/skills/resume/skill.md +278 -0
- package/skills/review/skill.md +419 -0
- package/skills/save/skill.md +482 -0
- package/skills/search/skill.md +175 -0
- package/skills/using-mneme/skill.md +185 -0
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: resume
|
|
3
|
+
description: |
|
|
4
|
+
Resume a previous session with full context restoration.
|
|
5
|
+
Use when: (1) continuing work from a previous session, (2) reviewing past session details,
|
|
6
|
+
(3) picking up where you left off after a break.
|
|
7
|
+
argument-hint: "[session-id]"
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# /mneme:resume
|
|
11
|
+
|
|
12
|
+
Resume a previous session.
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
/mneme:resume # Show recent sessions
|
|
18
|
+
/mneme:resume <id> # Resume specific session
|
|
19
|
+
/mneme:resume --type=implementation # Filter by session type
|
|
20
|
+
/mneme:resume --tag=auth # Filter by tag
|
|
21
|
+
/mneme:resume --days=7 # Filter by last N days
|
|
22
|
+
/mneme:resume --branch=feature/auth # Filter by branch
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Filter Options
|
|
26
|
+
|
|
27
|
+
| Option | Description | Example |
|
|
28
|
+
|--------|-------------|---------|
|
|
29
|
+
| `--type=<type>` | Filter by sessionType | `--type=implementation` |
|
|
30
|
+
| `--tag=<tag>` | Filter by tag | `--tag=auth` |
|
|
31
|
+
| `--days=<n>` | Filter by last N days | `--days=7` |
|
|
32
|
+
| `--branch=<name>` | Filter by branch | `--branch=main` |
|
|
33
|
+
|
|
34
|
+
Multiple filters can be combined:
|
|
35
|
+
```
|
|
36
|
+
/mneme:resume --type=implementation --days=14
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Session Types
|
|
40
|
+
|
|
41
|
+
| Type | Description |
|
|
42
|
+
|------|-------------|
|
|
43
|
+
| `decision` | Decision cycle present |
|
|
44
|
+
| `implementation` | Code changes made |
|
|
45
|
+
| `research` | Research, learning |
|
|
46
|
+
| `exploration` | Codebase exploration |
|
|
47
|
+
| `discussion` | Discussion only |
|
|
48
|
+
| `debug` | Debugging |
|
|
49
|
+
| `review` | Code review |
|
|
50
|
+
|
|
51
|
+
## Execution Steps
|
|
52
|
+
|
|
53
|
+
1. Read all JSON files under `.mneme/sessions/` (including year/month folders)
|
|
54
|
+
2. Apply filters if specified:
|
|
55
|
+
- `--type`: Match `summary.sessionType` or `sessionType` field
|
|
56
|
+
- `--tag`: Match any tag in `tags` array
|
|
57
|
+
- `--days`: Compare `createdAt` with current date
|
|
58
|
+
- `--branch`: Match `context.branch` field
|
|
59
|
+
3. Sort by `createdAt` descending (most recent first)
|
|
60
|
+
4. Display filtered session list
|
|
61
|
+
5. If session ID specified, read the JSON file and get details
|
|
62
|
+
6. **Create session-link file** (new master session support)
|
|
63
|
+
7. **Update master session JSON with `workPeriods` entry**
|
|
64
|
+
8. **Update current session JSON with `resumedFrom` field** (legacy, for backwards compatibility)
|
|
65
|
+
9. Load session context to resume work
|
|
66
|
+
|
|
67
|
+
### File Operations
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
# Get session list
|
|
71
|
+
Glob: .mneme/sessions/**/*.json
|
|
72
|
+
|
|
73
|
+
# Read each session file (metadata)
|
|
74
|
+
Read: .mneme/sessions/{year}/{month}/{filename}.json
|
|
75
|
+
|
|
76
|
+
# Get interactions from local SQLite (private, project-local)
|
|
77
|
+
# Local DB location: .mneme/local.db
|
|
78
|
+
sqlite3 ".mneme/local.db" "SELECT * FROM interactions WHERE session_id = '{id}' ORDER BY timestamp;"
|
|
79
|
+
|
|
80
|
+
# Create session-link file (NEW - master session support)
|
|
81
|
+
# This links current Claude session to the master mneme session
|
|
82
|
+
Write: .mneme/session-links/{current_session_short_id}.json
|
|
83
|
+
→ {"masterSessionId": "{resumed_session_id}", "claudeSessionId": "{current_full_session_id}", "linkedAt": "{now}"}
|
|
84
|
+
|
|
85
|
+
# Update MASTER session with workPeriods entry (NEW)
|
|
86
|
+
Edit: .mneme/sessions/{master_year}/{master_month}/{master_id}.json
|
|
87
|
+
→ Add entry to workPeriods array: {"claudeSessionId": "{current_full_session_id}", "startedAt": "{now}", "endedAt": null}
|
|
88
|
+
|
|
89
|
+
# Update CURRENT session with resumedFrom (legacy, for backwards compatibility)
|
|
90
|
+
Edit: .mneme/sessions/{current_year}/{current_month}/{current_id}.json
|
|
91
|
+
→ Add "resumedFrom": "{resumed_session_id}"
|
|
92
|
+
|
|
93
|
+
# Filter logic (pseudo-code)
|
|
94
|
+
for each session:
|
|
95
|
+
if --type specified and session.summary?.sessionType != type: skip
|
|
96
|
+
if --tag specified and tag not in session.tags: skip
|
|
97
|
+
if --days specified and session.createdAt < (now - days): skip
|
|
98
|
+
if --branch specified and session.context.branch != branch: skip
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Output Format
|
|
102
|
+
|
|
103
|
+
### List View
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
Recent sessions (filtered: --type=implementation --days=14):
|
|
107
|
+
|
|
108
|
+
1. [abc123] JWT authentication implementation (2026-01-24, feature/auth)
|
|
109
|
+
Type: implementation
|
|
110
|
+
Tags: [auth] [jwt] [backend]
|
|
111
|
+
Interactions: 3
|
|
112
|
+
Has Summary: Yes
|
|
113
|
+
|
|
114
|
+
2. [def456] User management API (2026-01-23, feature/user)
|
|
115
|
+
Type: implementation
|
|
116
|
+
Tags: [user] [api]
|
|
117
|
+
Interactions: 2
|
|
118
|
+
Has Summary: No
|
|
119
|
+
|
|
120
|
+
Select a session to resume (1-2), or enter ID:
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Resume View
|
|
124
|
+
|
|
125
|
+
```
|
|
126
|
+
Resuming session "JWT authentication implementation"
|
|
127
|
+
|
|
128
|
+
Session chain: current ← abc123
|
|
129
|
+
(Updated current session with resumedFrom: abc123)
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## Summary:
|
|
134
|
+
|
|
135
|
+
Title: JWT authentication implementation
|
|
136
|
+
Goal: Implement JWT-based auth with refresh token support
|
|
137
|
+
Outcome: success
|
|
138
|
+
Type: implementation
|
|
139
|
+
|
|
140
|
+
## Plan:
|
|
141
|
+
|
|
142
|
+
Tasks:
|
|
143
|
+
- [x] JWT signing method selection
|
|
144
|
+
- [x] Middleware implementation
|
|
145
|
+
- [ ] Add tests
|
|
146
|
+
Remaining:
|
|
147
|
+
- Add tests
|
|
148
|
+
|
|
149
|
+
## Discussions:
|
|
150
|
+
|
|
151
|
+
- Signing algorithm: RS256 (Security considerations for production)
|
|
152
|
+
|
|
153
|
+
## Handoff:
|
|
154
|
+
|
|
155
|
+
Stopped: Test creation postponed to next session
|
|
156
|
+
Notes:
|
|
157
|
+
- vitest configured
|
|
158
|
+
- Mock key pair in test/fixtures/
|
|
159
|
+
Next:
|
|
160
|
+
- Create jwt.test.ts
|
|
161
|
+
- Add E2E tests
|
|
162
|
+
|
|
163
|
+
## Errors:
|
|
164
|
+
|
|
165
|
+
- secretOrPrivateKey must be asymmetric → Generate RS256 key pair
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## Interactions Log (from SQLite):
|
|
170
|
+
|
|
171
|
+
[int-001] 2026-01-24T10:00:00Z
|
|
172
|
+
User: Implement authentication
|
|
173
|
+
Thinking: JWT would be better for microservices...
|
|
174
|
+
Assistant: Implemented JWT auth with RS256 signing
|
|
175
|
+
|
|
176
|
+
[int-002] 2026-01-24T10:30:00Z
|
|
177
|
+
User: What should be the refresh token expiry?
|
|
178
|
+
Thinking: Balance between security and UX...
|
|
179
|
+
Assistant: Set to 7 days
|
|
180
|
+
|
|
181
|
+
(Note: If this session was created by another user, interactions won't be available - only metadata from JSON)
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
Ready to continue?
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
## Context Injection
|
|
189
|
+
|
|
190
|
+
When resuming, inject context from JSON (metadata) and SQLite (interactions):
|
|
191
|
+
|
|
192
|
+
### Structured Data (from JSON, set by /mneme:save):
|
|
193
|
+
1. **Summary**: title, goal, outcome, description, sessionType
|
|
194
|
+
2. **Plan**: tasks, remaining → what was planned and what's left
|
|
195
|
+
3. **Discussions**: decisions with reasoning and alternatives
|
|
196
|
+
4. **Code examples**: significant changes with before/after
|
|
197
|
+
5. **Errors**: problems encountered and solutions
|
|
198
|
+
6. **Handoff**: stoppedReason, notes, nextSteps → critical for continuity
|
|
199
|
+
7. **References**: documents and resources used
|
|
200
|
+
|
|
201
|
+
### Log Data (from JSON, auto-saved by SessionEnd):
|
|
202
|
+
8. **Title/Tags**: For quick context
|
|
203
|
+
9. **Files**: What files were changed
|
|
204
|
+
10. **Metrics**: Message counts, tool usage
|
|
205
|
+
|
|
206
|
+
### Interactions (from SQLite, auto-saved by SessionEnd):
|
|
207
|
+
11. **Interactions**: Full conversation log with thinking (private, local only)
|
|
208
|
+
|
|
209
|
+
**Privacy Note**: Interactions are stored in project-local SQLite (`.mneme/local.db`) and are private to each developer.
|
|
210
|
+
If you're resuming a session created by another team member, interactions won't be available.
|
|
211
|
+
|
|
212
|
+
**Important**:
|
|
213
|
+
- JSON contains metadata (shared via Git)
|
|
214
|
+
- SQLite contains interactions (local, private)
|
|
215
|
+
- Always update the CURRENT session's JSON with `resumedFrom` to track session chains.
|
|
216
|
+
|
|
217
|
+
## Session Chain Tracking (Master Session Support)
|
|
218
|
+
|
|
219
|
+
When resuming session `abc123` (master) in a new Claude session `xyz789`:
|
|
220
|
+
|
|
221
|
+
### Step 1: Create session-link file
|
|
222
|
+
|
|
223
|
+
```bash
|
|
224
|
+
# Create .mneme/session-links/ directory if not exists
|
|
225
|
+
mkdir -p .mneme/session-links/
|
|
226
|
+
|
|
227
|
+
# Write session-link file
|
|
228
|
+
Write: .mneme/session-links/xyz78901.json
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
```json
|
|
232
|
+
{
|
|
233
|
+
"masterSessionId": "abc12345",
|
|
234
|
+
"claudeSessionId": "xyz78901-38e9-464d-9b7c-a9cdca203b5e",
|
|
235
|
+
"linkedAt": "2026-01-27T09:10:00Z"
|
|
236
|
+
}
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
### Step 2: Update master session workPeriods
|
|
240
|
+
|
|
241
|
+
```bash
|
|
242
|
+
Edit: .mneme/sessions/{year}/{month}/abc12345.json
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
Add to `workPeriods` array:
|
|
246
|
+
```json
|
|
247
|
+
{
|
|
248
|
+
"workPeriods": [
|
|
249
|
+
{"claudeSessionId": "abc12345-...", "startedAt": "...", "endedAt": "..."},
|
|
250
|
+
{"claudeSessionId": "xyz78901-...", "startedAt": "2026-01-27T09:10:00Z", "endedAt": null}
|
|
251
|
+
]
|
|
252
|
+
}
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
### Step 3: Update current session (legacy, backwards compatibility)
|
|
256
|
+
|
|
257
|
+
```bash
|
|
258
|
+
Edit: .mneme/sessions/{year}/{month}/xyz78901.json
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
```json
|
|
262
|
+
{
|
|
263
|
+
"id": "xyz78901",
|
|
264
|
+
"resumedFrom": "abc12345",
|
|
265
|
+
...
|
|
266
|
+
}
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
### Result
|
|
270
|
+
|
|
271
|
+
- **session-link file**: Links Claude session → mneme master session
|
|
272
|
+
- **workPeriods**: Tracks all work periods in the master session
|
|
273
|
+
- **resumedFrom**: Legacy chain tracking (backwards compatible)
|
|
274
|
+
|
|
275
|
+
This design allows:
|
|
276
|
+
1. Multiple Claude sessions to contribute to one logical mneme session
|
|
277
|
+
2. `/mneme:save` to merge all data into the master session
|
|
278
|
+
3. Dashboard to show unified conversation history
|
|
@@ -0,0 +1,419 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: review
|
|
3
|
+
description: |
|
|
4
|
+
Code review based on repository-specific rules (dev-rules.json / review-guidelines.json).
|
|
5
|
+
Use when: (1) reviewing staged changes before commit, (2) reviewing a GitHub PR,
|
|
6
|
+
(3) checking code quality against team standards.
|
|
7
|
+
argument-hint: "[--staged|--all|--diff=branch|PR-URL]"
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# /mneme:review
|
|
11
|
+
|
|
12
|
+
Code review based on repository-specific rules (`dev-rules.json` / `review-guidelines.json`).
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
/mneme:review # Default: --staged (Stage 2 only)
|
|
18
|
+
/mneme:review --staged # Review staged changes
|
|
19
|
+
/mneme:review --all # Review all changes
|
|
20
|
+
/mneme:review --diff=main # Review diff against branch
|
|
21
|
+
/mneme:review --full # Two-stage review (Stage 1: Spec + Stage 2: Code)
|
|
22
|
+
/mneme:review https://github.com/owner/repo/pull/123 # Review GitHub PR
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Default Behavior
|
|
26
|
+
|
|
27
|
+
- **`--staged` is default**
|
|
28
|
+
- If staged is empty, suggest `--all` / `--diff=branch`
|
|
29
|
+
|
|
30
|
+
### PR URL Review
|
|
31
|
+
|
|
32
|
+
When a GitHub PR URL is provided:
|
|
33
|
+
1. Parse URL to extract owner, repo, and PR number
|
|
34
|
+
2. Fetch PR diff using `gh pr diff {number} --repo {owner}/{repo}`
|
|
35
|
+
3. Apply the same rule-based review as local diffs
|
|
36
|
+
4. Save result with `target.type: "pr"` and `target.prSource`
|
|
37
|
+
|
|
38
|
+
### Two-Stage Review (--full)
|
|
39
|
+
|
|
40
|
+
When `--full` is specified, perform two-stage review:
|
|
41
|
+
|
|
42
|
+
**Stage 1: Spec Compliance** (blocks if fails)
|
|
43
|
+
- Check implementation against plan/design documents
|
|
44
|
+
- Verify all planned tasks were implemented
|
|
45
|
+
- Confirm architecture matches design
|
|
46
|
+
- Must pass before Stage 2
|
|
47
|
+
|
|
48
|
+
**Stage 2: Code Quality** (standard review)
|
|
49
|
+
- Apply dev-rules.json / review-guidelines.json
|
|
50
|
+
- Check language/framework best practices
|
|
51
|
+
- Generate findings
|
|
52
|
+
|
|
53
|
+
## Execution
|
|
54
|
+
|
|
55
|
+
**Recommended**: Use the `mneme-reviewer` subagent for isolated review context:
|
|
56
|
+
|
|
57
|
+
```typescript
|
|
58
|
+
Task({
|
|
59
|
+
subagent_type: "mneme-reviewer",
|
|
60
|
+
prompt: "Review staged changes against mneme rules",
|
|
61
|
+
description: "Code review"
|
|
62
|
+
})
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
The subagent has the review skill preloaded and operates with isolated context for focused review.
|
|
66
|
+
|
|
67
|
+
**Alternative**: Execute steps manually (see below).
|
|
68
|
+
|
|
69
|
+
## Execution Steps
|
|
70
|
+
|
|
71
|
+
### PR URL Detection
|
|
72
|
+
|
|
73
|
+
Before processing flags, check if the argument is a GitHub PR URL:
|
|
74
|
+
```
|
|
75
|
+
Pattern: https://github.com/{owner}/{repo}/pull/{number}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
If PR URL detected:
|
|
79
|
+
1. Parse URL → `{ owner, repo, prNumber, url }`
|
|
80
|
+
2. Fetch diff: `gh pr diff {prNumber} --repo {owner}/{repo}`
|
|
81
|
+
3. Skip to step 2 (Load rules)
|
|
82
|
+
4. Save result with PR-specific target format
|
|
83
|
+
|
|
84
|
+
### Standard Review (default)
|
|
85
|
+
|
|
86
|
+
1. **Get target diff**
|
|
87
|
+
- `--staged`: `git diff --staged`
|
|
88
|
+
- `--all`: `git diff`
|
|
89
|
+
- `--diff=branch`: `git diff <branch>...HEAD`
|
|
90
|
+
- PR URL: `gh pr diff {number} --repo {owner}/{repo}`
|
|
91
|
+
2. **Load rules**
|
|
92
|
+
- `.mneme/rules/dev-rules.json`
|
|
93
|
+
- `.mneme/rules/review-guidelines.json`
|
|
94
|
+
3. **Filter applicable rules**
|
|
95
|
+
- Only `status: active`
|
|
96
|
+
- Filter by `scope / tags / appliesTo / exceptions`
|
|
97
|
+
4. **Generate findings**
|
|
98
|
+
- Extract where rules match the diff
|
|
99
|
+
- Determine severity from `priority`
|
|
100
|
+
5. **Output review**
|
|
101
|
+
- Structure: Blocker / Warning / Suggestion
|
|
102
|
+
6. **Save review result**
|
|
103
|
+
- `.mneme/reviews/YYYY/MM/review-YYYY-MM-DD_HHMMSS.json`
|
|
104
|
+
|
|
105
|
+
### Two-Stage Review (--full)
|
|
106
|
+
|
|
107
|
+
#### Stage 1: Spec Compliance
|
|
108
|
+
|
|
109
|
+
1. **Find plan/design documents**
|
|
110
|
+
```
|
|
111
|
+
Search for recent files:
|
|
112
|
+
- docs/plans/*-tasks.md
|
|
113
|
+
- docs/plans/*-design.md
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
2. **Extract planned items**
|
|
117
|
+
- Parse task list from tasks.md
|
|
118
|
+
- Extract architecture/components from design.md
|
|
119
|
+
|
|
120
|
+
3. **Verify implementation**
|
|
121
|
+
- Check each planned task has corresponding code
|
|
122
|
+
- Verify architecture matches design
|
|
123
|
+
- Confirm all components exist
|
|
124
|
+
|
|
125
|
+
4. **Generate Stage 1 findings**
|
|
126
|
+
```markdown
|
|
127
|
+
## Stage 1: Spec Compliance
|
|
128
|
+
|
|
129
|
+
**Plan file:** docs/plans/2026-01-27-feature-tasks.md
|
|
130
|
+
**Design file:** docs/plans/2026-01-27-feature-design.md
|
|
131
|
+
|
|
132
|
+
### Status: PASS / FAIL
|
|
133
|
+
|
|
134
|
+
### Findings
|
|
135
|
+
- [MISSING] Task 3 not implemented
|
|
136
|
+
- [MISMATCH] Component X uses different architecture than planned
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
5. **Block if Stage 1 fails**
|
|
140
|
+
- If any MISSING or MISMATCH findings, stop review
|
|
141
|
+
- User must fix before Stage 2
|
|
142
|
+
|
|
143
|
+
#### Stage 2: Code Quality
|
|
144
|
+
|
|
145
|
+
(Standard review steps 2-6)
|
|
146
|
+
|
|
147
|
+
## Additional Review Perspectives (Required)
|
|
148
|
+
|
|
149
|
+
### Document-Code Consistency
|
|
150
|
+
|
|
151
|
+
- Verify changes match **all documentation**
|
|
152
|
+
- If spec documents exist, **always reference**:
|
|
153
|
+
- Files/dirs containing `spec` / `requirements` / `design` / `architecture` / `adr` / `decision` / `workflow` / `contract`
|
|
154
|
+
- Common doc locations: `docs/`, `documentation/`, `design/`, `spec/`, `requirements/`
|
|
155
|
+
- Root docs: `README*`, `DEVELOPER*`, `ARCHITECTURE*`, `CONTRIBUTING*`, `SPEC*`, `ADR*`
|
|
156
|
+
- If not found, **ask user for location** before proceeding
|
|
157
|
+
|
|
158
|
+
### Language/Framework Best Practices
|
|
159
|
+
|
|
160
|
+
- Check against language/framework conventions for changed files
|
|
161
|
+
- When uncertain, **research official docs** and cite source
|
|
162
|
+
- e.g., React / TypeScript / Hono / Node official docs
|
|
163
|
+
- Mark as **"needs investigation"** if uncertain
|
|
164
|
+
|
|
165
|
+
## Rule Application Guidelines
|
|
166
|
+
|
|
167
|
+
### scope Determination (from path)
|
|
168
|
+
|
|
169
|
+
- `dashboard/` → `dashboard`
|
|
170
|
+
- `hooks/` → `hooks`
|
|
171
|
+
- `skills/` → `skills`
|
|
172
|
+
- `dashboard/server/` → `server`
|
|
173
|
+
- `config`/`env`/`tsconfig`/`vite.config` → `config`
|
|
174
|
+
- Other → `general`
|
|
175
|
+
|
|
176
|
+
### tags Assignment (from path or diff content)
|
|
177
|
+
|
|
178
|
+
- `ui` (dashboard/react/css)
|
|
179
|
+
- `api` (server/api)
|
|
180
|
+
- `quality` (lint/test/build)
|
|
181
|
+
- `security` (auth/secret/token)
|
|
182
|
+
- `docs` (README/docs/*.md)
|
|
183
|
+
- `release` (version/changelog)
|
|
184
|
+
|
|
185
|
+
### appliesTo / exceptions Handling
|
|
186
|
+
|
|
187
|
+
- If `appliesTo` exists, apply only when **scope/tags/path** matches
|
|
188
|
+
- If `exceptions` matches, **exclude**
|
|
189
|
+
|
|
190
|
+
### tokens Handling
|
|
191
|
+
|
|
192
|
+
- If `tokens` exists, only target those appearing in diff
|
|
193
|
+
- If not appearing, **skip to avoid noise**
|
|
194
|
+
|
|
195
|
+
## Severity Mapping
|
|
196
|
+
|
|
197
|
+
| priority | severity |
|
|
198
|
+
|----------|----------|
|
|
199
|
+
| p0 | Blocker |
|
|
200
|
+
| p1 | Warning |
|
|
201
|
+
| p2 | Suggestion |
|
|
202
|
+
|
|
203
|
+
## Output Format (Markdown)
|
|
204
|
+
|
|
205
|
+
```
|
|
206
|
+
# Review: {target}
|
|
207
|
+
|
|
208
|
+
## Summary
|
|
209
|
+
- Blocker: N
|
|
210
|
+
- Warning: N
|
|
211
|
+
- Suggestion: N
|
|
212
|
+
- Matched rules: X (of Y)
|
|
213
|
+
- New rule proposals: Z
|
|
214
|
+
|
|
215
|
+
## Findings
|
|
216
|
+
|
|
217
|
+
### Blocker
|
|
218
|
+
1. {short title}
|
|
219
|
+
- File: path/to/file.ts:123
|
|
220
|
+
- Evidence: {diff snippet}
|
|
221
|
+
- Rule: {rule.id} / {rule.text}
|
|
222
|
+
- Rationale: {rule.rationale}
|
|
223
|
+
|
|
224
|
+
### Warning
|
|
225
|
+
...
|
|
226
|
+
|
|
227
|
+
### Suggestion
|
|
228
|
+
...
|
|
229
|
+
|
|
230
|
+
## Rule Coverage
|
|
231
|
+
- Applied: {rule ids}
|
|
232
|
+
- Skipped (scope mismatch): {rule ids}
|
|
233
|
+
|
|
234
|
+
## Rule Proposals
|
|
235
|
+
- {proposal} (source: {which finding triggered this})
|
|
236
|
+
|
|
237
|
+
## Stale Rules
|
|
238
|
+
- {rule.id} (lastSeenAt: YYYY-MM-DD)
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
## Review JSON Format
|
|
242
|
+
|
|
243
|
+
Save to `.mneme/reviews/YYYY/MM/review-YYYY-MM-DD_HHMMSS.json`:
|
|
244
|
+
|
|
245
|
+
```json
|
|
246
|
+
{
|
|
247
|
+
"id": "review-2026-01-25_145500",
|
|
248
|
+
"createdAt": "2026-01-25T14:55:00Z",
|
|
249
|
+
"target": {
|
|
250
|
+
"type": "staged", // or "pr" for GitHub PRs
|
|
251
|
+
"branch": "main"
|
|
252
|
+
},
|
|
253
|
+
"summary": {
|
|
254
|
+
"blocker": 1,
|
|
255
|
+
"warning": 2,
|
|
256
|
+
"suggestion": 3,
|
|
257
|
+
"matchedRules": 4,
|
|
258
|
+
"totalRules": 10,
|
|
259
|
+
"newRuleProposals": 1
|
|
260
|
+
},
|
|
261
|
+
"findings": [
|
|
262
|
+
{
|
|
263
|
+
"id": "finding-001",
|
|
264
|
+
"severity": "blocker",
|
|
265
|
+
"title": "Hardcoded production secret",
|
|
266
|
+
"ruleId": "review-2026-01-24_abc123-0",
|
|
267
|
+
"ruleText": "Secrets should be in environment variables",
|
|
268
|
+
"rationale": "Avoid leak risk",
|
|
269
|
+
"file": "src/config.ts",
|
|
270
|
+
"line": 42,
|
|
271
|
+
"evidence": "API_KEY = \"xxx\""
|
|
272
|
+
}
|
|
273
|
+
],
|
|
274
|
+
"coverage": {
|
|
275
|
+
"appliedRuleIds": ["review-2026-01-24_abc123-0"],
|
|
276
|
+
"skippedRuleIds": ["dev-2026-01-20_def456-1"]
|
|
277
|
+
},
|
|
278
|
+
"proposals": [
|
|
279
|
+
{
|
|
280
|
+
"text": "API client must always set timeout",
|
|
281
|
+
"fromFindingIds": ["finding-002"]
|
|
282
|
+
}
|
|
283
|
+
],
|
|
284
|
+
"staleRules": [
|
|
285
|
+
{ "id": "dev-2025-12-01_aaa111-0", "lastSeenAt": "2025-12-05T00:00:00Z" }
|
|
286
|
+
],
|
|
287
|
+
"context": {
|
|
288
|
+
"projectDir": "/path/to/project",
|
|
289
|
+
"branch": "main"
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
### PR Review Target Format
|
|
295
|
+
|
|
296
|
+
When reviewing a GitHub PR, use this target format:
|
|
297
|
+
|
|
298
|
+
```json
|
|
299
|
+
{
|
|
300
|
+
"target": {
|
|
301
|
+
"type": "pr",
|
|
302
|
+
"prSource": {
|
|
303
|
+
"owner": "owner",
|
|
304
|
+
"repo": "repo",
|
|
305
|
+
"prNumber": 123,
|
|
306
|
+
"url": "https://github.com/owner/repo/pull/123"
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
### Updating Rule Effectiveness
|
|
313
|
+
|
|
314
|
+
When rules are applied during review:
|
|
315
|
+
1. Increment `appliedCount` for each matched rule
|
|
316
|
+
2. After user feedback (accepted/rejected), update `acceptedCount`
|
|
317
|
+
3. Update `lastAppliedAt` timestamp
|
|
318
|
+
|
|
319
|
+
## Two-Stage Review JSON Format (--full)
|
|
320
|
+
|
|
321
|
+
Extended format for `--full` reviews:
|
|
322
|
+
|
|
323
|
+
```json
|
|
324
|
+
{
|
|
325
|
+
"id": "review-2026-01-27_103000",
|
|
326
|
+
"createdAt": "2026-01-27T10:30:00Z",
|
|
327
|
+
"mode": "full",
|
|
328
|
+
"target": {
|
|
329
|
+
"type": "staged",
|
|
330
|
+
"branch": "feature/auth"
|
|
331
|
+
},
|
|
332
|
+
|
|
333
|
+
"specCompliance": {
|
|
334
|
+
"planFile": "docs/plans/2026-01-27-auth-tasks.md",
|
|
335
|
+
"designFile": "docs/plans/2026-01-27-auth-design.md",
|
|
336
|
+
"status": "pass",
|
|
337
|
+
"findings": [
|
|
338
|
+
{
|
|
339
|
+
"type": "missing",
|
|
340
|
+
"description": "Task 3: Add refresh token endpoint - not implemented",
|
|
341
|
+
"planReference": "### Task 3: Add refresh token endpoint"
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
"type": "mismatch",
|
|
345
|
+
"description": "JWT storage uses localStorage instead of httpOnly cookie",
|
|
346
|
+
"planReference": "## Security: Store tokens in httpOnly cookies",
|
|
347
|
+
"actualImplementation": "src/auth/storage.ts:15 - localStorage.setItem('token', ...)"
|
|
348
|
+
}
|
|
349
|
+
]
|
|
350
|
+
},
|
|
351
|
+
|
|
352
|
+
"codeQuality": {
|
|
353
|
+
"summary": {
|
|
354
|
+
"blocker": 0,
|
|
355
|
+
"warning": 1,
|
|
356
|
+
"suggestion": 2
|
|
357
|
+
},
|
|
358
|
+
"findings": [
|
|
359
|
+
{
|
|
360
|
+
"id": "finding-001",
|
|
361
|
+
"severity": "warning",
|
|
362
|
+
"title": "Missing error handling",
|
|
363
|
+
"ruleId": "dev-error-handling-001",
|
|
364
|
+
"file": "src/auth/jwt.ts",
|
|
365
|
+
"line": 42
|
|
366
|
+
}
|
|
367
|
+
]
|
|
368
|
+
},
|
|
369
|
+
|
|
370
|
+
"coverage": {
|
|
371
|
+
"appliedRuleIds": ["dev-error-handling-001"],
|
|
372
|
+
"skippedRuleIds": []
|
|
373
|
+
},
|
|
374
|
+
"proposals": [],
|
|
375
|
+
"staleRules": [],
|
|
376
|
+
"context": {
|
|
377
|
+
"projectDir": "/path/to/project",
|
|
378
|
+
"branch": "feature/auth"
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
### specCompliance Fields
|
|
384
|
+
|
|
385
|
+
| Field | Type | Description |
|
|
386
|
+
|-------|------|-------------|
|
|
387
|
+
| planFile | string | Path to tasks.md used for verification |
|
|
388
|
+
| designFile | string | Path to design.md used for verification |
|
|
389
|
+
| status | `"pass"\|"fail"` | Whether spec compliance passed |
|
|
390
|
+
| findings | array | List of compliance issues |
|
|
391
|
+
|
|
392
|
+
### specCompliance Finding Types
|
|
393
|
+
|
|
394
|
+
| Type | Description |
|
|
395
|
+
|------|-------------|
|
|
396
|
+
| `missing` | Planned item not implemented |
|
|
397
|
+
| `mismatch` | Implementation differs from design |
|
|
398
|
+
| `incomplete` | Partially implemented |
|
|
399
|
+
|
|
400
|
+
## Recording Review in Session
|
|
401
|
+
|
|
402
|
+
**Note:** Review interactions are auto-saved by SessionEnd hook.
|
|
403
|
+
|
|
404
|
+
Review results are saved to `.mneme/reviews/` directory (separate from session files).
|
|
405
|
+
|
|
406
|
+
If significant decisions were made during review (e.g., architectural changes), capture them via `/mneme:save`:
|
|
407
|
+
|
|
408
|
+
```yaml
|
|
409
|
+
discussions:
|
|
410
|
+
- topic: "Code review findings"
|
|
411
|
+
timestamp: "[ISO8601]"
|
|
412
|
+
decision: "[Key decision from review]"
|
|
413
|
+
reasoning: "[Why this change was required]"
|
|
414
|
+
|
|
415
|
+
references:
|
|
416
|
+
- type: review
|
|
417
|
+
path: ".mneme/reviews/YYYY/MM/review-YYYY-MM-DD_HHMMSS.json"
|
|
418
|
+
description: "Review result"
|
|
419
|
+
```
|