the-frame-ai 0.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/LICENSE +21 -0
- package/README.md +335 -0
- package/README.ru.md +333 -0
- package/bin/the-frame +5 -0
- package/bin/the-frame-ai +5 -0
- package/package.json +29 -0
- package/src/cli.js +84 -0
- package/src/doctor.js +164 -0
- package/src/init.js +178 -0
- package/src/languages.js +141 -0
- package/src/manifest.js +55 -0
- package/src/update.js +87 -0
- package/src/utils.js +55 -0
- package/templates/agents/builder.md +240 -0
- package/templates/agents/devils-advocate.md +136 -0
- package/templates/agents/planner.md +277 -0
- package/templates/agents/researcher.md +195 -0
- package/templates/agents/reviewer.md +300 -0
- package/templates/commands/frame:add-task.md +57 -0
- package/templates/commands/frame:build.md +170 -0
- package/templates/commands/frame:check-deps.md +118 -0
- package/templates/commands/frame:checkpoint.md +158 -0
- package/templates/commands/frame:cleanup-memory.md +80 -0
- package/templates/commands/frame:context.md +64 -0
- package/templates/commands/frame:daily.md +77 -0
- package/templates/commands/frame:debug.md +146 -0
- package/templates/commands/frame:doctor.md +170 -0
- package/templates/commands/frame:estimate.md +105 -0
- package/templates/commands/frame:explain.md +84 -0
- package/templates/commands/frame:fast.md +89 -0
- package/templates/commands/frame:forensics.md +139 -0
- package/templates/commands/frame:headless.md +118 -0
- package/templates/commands/frame:health.md +86 -0
- package/templates/commands/frame:init.md +231 -0
- package/templates/commands/frame:migrate.md +107 -0
- package/templates/commands/frame:note.md +32 -0
- package/templates/commands/frame:pause.md +145 -0
- package/templates/commands/frame:performance.md +228 -0
- package/templates/commands/frame:plan.md +198 -0
- package/templates/commands/frame:refactor.md +161 -0
- package/templates/commands/frame:research.md +131 -0
- package/templates/commands/frame:resume.md +137 -0
- package/templates/commands/frame:retrospective.md +196 -0
- package/templates/commands/frame:review.md +174 -0
- package/templates/commands/frame:rollback.md +207 -0
- package/templates/commands/frame:ship.md +148 -0
- package/templates/commands/frame:sprint-check.md +111 -0
- package/templates/commands/frame:status.md +103 -0
- package/templates/commands/frame:unstuck.md +102 -0
- package/templates/commands/frame:wave.md +312 -0
- package/templates/commands/frame:where.md +5 -0
- package/templates/commands/frame:why.md +57 -0
- package/templates/commands/frame:worktree.md +219 -0
- package/templates/hooks/git-safety.sh +33 -0
- package/templates/hooks/quality-gate.sh +52 -0
- package/templates/hooks/safety-net.sh +13 -0
- package/templates/hooks/session-init.sh +81 -0
- package/templates/planning/pause-state.json +1 -0
- package/templates/project/CLAUDE.md +63 -0
- package/templates/project/CONTEXT.md +16 -0
- package/templates/project/MAP.md +35 -0
- package/templates/project/ROADMAP.md +12 -0
- package/templates/project/STATE.md +13 -0
- package/templates/project/config.json +74 -0
- package/templates/project/memory/anti-patterns.md +14 -0
- package/templates/project/memory/context.md +23 -0
- package/templates/project/memory/conventions.md +19 -0
- package/templates/project/memory/decisions.md +20 -0
- package/templates/project/memory/dependencies.md +23 -0
- package/templates/project/memory/metrics.md +22 -0
- package/templates/project/memory/patterns.md +30 -0
- package/templates/project/memory/wins.md +11 -0
- package/templates/project/settings.local.json +50 -0
- package/templates/project/specs/_template/PRD.md +24 -0
- package/templates/project/specs/_template/plan.md +25 -0
- package/templates/project/specs/_template/spec.md +27 -0
- package/templates/project/specs/_template/subagent-prompt.md +43 -0
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
# /frame:checkpoint -- Git Checkpoints
|
|
2
|
+
|
|
3
|
+
> **When to use manually**: before a risky change that isn't covered by an automatic checkpoint
|
|
4
|
+
> (e.g., editing config files, manual DB migrations, experimental refactors mid-session).
|
|
5
|
+
> Automatic checkpoints already fire before each phase (research/plan/build/review) if `autoCheckpoint: true` in config.
|
|
6
|
+
> Use this command when you want a checkpoint *outside* those phase boundaries.
|
|
7
|
+
|
|
8
|
+
Manage checkpoints (git tags) before each phase.
|
|
9
|
+
|
|
10
|
+
## Instructions
|
|
11
|
+
|
|
12
|
+
Command: **$ARGUMENTS**
|
|
13
|
+
|
|
14
|
+
### Routing
|
|
15
|
+
|
|
16
|
+
Determine action from the first argument:
|
|
17
|
+
- `list` -- show all checkpoints
|
|
18
|
+
- `create <message>` -- create a manual checkpoint
|
|
19
|
+
- `auto <phase>` -- automatic checkpoint before a phase
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Action: list
|
|
24
|
+
|
|
25
|
+
Show all checkpoints for the current feature.
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
git tag -l "frame/checkpoint/*" --sort=-creatordate
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Output
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
+======================================================================+
|
|
35
|
+
| FRAME CHECKPOINTS |
|
|
36
|
+
+======================================================================+
|
|
37
|
+
| frame/checkpoint/research-20260519-1430 |
|
|
38
|
+
| frame/checkpoint/plan-20260519-1500 |
|
|
39
|
+
| frame/checkpoint/build-20260519-1530 |
|
|
40
|
+
| |
|
|
41
|
+
| Total: 3 checkpoints |
|
|
42
|
+
| Max: 10 |
|
|
43
|
+
+======================================================================+
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Action: create
|
|
49
|
+
|
|
50
|
+
Create a manual checkpoint.
|
|
51
|
+
|
|
52
|
+
### Step 1: Check Max Checkpoints
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
COUNT=$(git tag -l "frame/checkpoint/*" | wc -l)
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
If COUNT >= 10, suggest removing old ones:
|
|
59
|
+
```bash
|
|
60
|
+
git tag -l "frame/checkpoint/*" --sort=creatordate | head -n 5
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Step 2: Create Tag
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
TIMESTAMP=$(date +%Y%m%d-%H%M)
|
|
67
|
+
git tag "frame/checkpoint/manual-$TIMESTAMP" -m "Manual checkpoint: $MESSAGE"
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Step 3: Show Result
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
+======================================================================+
|
|
74
|
+
| CHECKPOINT CREATED |
|
|
75
|
+
+======================================================================+
|
|
76
|
+
| Tag: frame/checkpoint/manual-{timestamp} |
|
|
77
|
+
| Message: {message} |
|
|
78
|
+
| Commit: {hash} |
|
|
79
|
+
| |
|
|
80
|
+
| Rollback: /frame:rollback --to manual-{timestamp} |
|
|
81
|
+
+======================================================================+
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## Action: auto
|
|
87
|
+
|
|
88
|
+
Automatic checkpoint before a phase.
|
|
89
|
+
|
|
90
|
+
### Step 1: Identify Phase
|
|
91
|
+
|
|
92
|
+
Phase from the argument or from STATE.md:
|
|
93
|
+
```bash
|
|
94
|
+
grep -oP 'Phase: \K.*' .planning/STATE.md
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Step 2: Check Settings
|
|
98
|
+
|
|
99
|
+
```json
|
|
100
|
+
{
|
|
101
|
+
"autoCheckpoint": true,
|
|
102
|
+
"checkpointBefore": ["research", "plan", "build", "review"]
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
If the phase is in checkpointBefore, create a checkpoint.
|
|
107
|
+
|
|
108
|
+
### Step 3: Create Checkpoint
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
TIMESTAMP=$(date +%Y%m%d-%H%M)
|
|
112
|
+
git tag "frame/checkpoint/$PHASE-$TIMESTAMP" -m "Auto checkpoint before $PHASE phase"
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Step 4: Clean Up Old Checkpoints if Needed
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
COUNT=$(git tag -l "frame/checkpoint/*" | wc -l)
|
|
119
|
+
if [ "$COUNT" -gt 10 ]; then
|
|
120
|
+
git tag -l "frame/checkpoint/*" --sort=creatordate | head -n $((COUNT - 10)) | xargs git tag -d
|
|
121
|
+
fi
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## Action: cleanup
|
|
127
|
+
|
|
128
|
+
Remove checkpoints after a successful Ship.
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
# Delete all frame/checkpoint/* tags
|
|
132
|
+
git tag -l "frame/checkpoint/*" | xargs git tag -d
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Output
|
|
136
|
+
|
|
137
|
+
```
|
|
138
|
+
+======================================================================+
|
|
139
|
+
| CHECKPOINTS CLEANED |
|
|
140
|
+
+======================================================================+
|
|
141
|
+
| Deleted: {count} checkpoints |
|
|
142
|
+
| Reason: cleanupAfterShip |
|
|
143
|
+
+======================================================================+
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Rules
|
|
147
|
+
|
|
148
|
+
- **Git tags, not commits** -- do not pollute history
|
|
149
|
+
- **Max 10 checkpoints** -- to avoid bloat
|
|
150
|
+
- **cleanupAfterShip** -- removes checkpoints after a successful Ship
|
|
151
|
+
- **Auto checkpoint** -- before each phase listed in checkpointBefore
|
|
152
|
+
- **Timestamp format**: `%Y%m%d-%H%M`
|
|
153
|
+
|
|
154
|
+
## Result
|
|
155
|
+
|
|
156
|
+
- Checkpoint created via git tag
|
|
157
|
+
- Old checkpoints automatically pruned
|
|
158
|
+
- Cleanup after Ship
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# /frame:cleanup-memory -- Memory Cleanup
|
|
2
|
+
|
|
3
|
+
Cleans and updates memory files.
|
|
4
|
+
|
|
5
|
+
## Instructions
|
|
6
|
+
|
|
7
|
+
Run memory and artifact cleanup.
|
|
8
|
+
|
|
9
|
+
### Step 1: Split patterns into Core and Archive
|
|
10
|
+
|
|
11
|
+
Scan `.planning/memory/patterns.md` and apply the following rules:
|
|
12
|
+
|
|
13
|
+
#### Promote to Core
|
|
14
|
+
|
|
15
|
+
Move patterns from the `## Active` section to `## Core` if they meet **any** of:
|
|
16
|
+
- `confidence: high` (confirmed 5+ times)
|
|
17
|
+
- `confidence: medium` with `confirmed: >= 3` **and** `last:` within the last 90 days
|
|
18
|
+
|
|
19
|
+
Core patterns are the default approaches that the Planner reads for decision-making.
|
|
20
|
+
|
|
21
|
+
#### Stale-mark active patterns
|
|
22
|
+
|
|
23
|
+
Scan patterns in `## Active` where `last:` is older than 90 days. Add `[stale]` to the header — do not delete:
|
|
24
|
+
```markdown
|
|
25
|
+
## Redis Sessions [stale, confidence: high, confirmed: 8x, added: 2025-11-01, last: 2025-12-10]
|
|
26
|
+
```
|
|
27
|
+
When a stale pattern is confirmed again, remove the `[stale]` tag and update `last:`.
|
|
28
|
+
|
|
29
|
+
#### Archive low-confidence patterns
|
|
30
|
+
|
|
31
|
+
Move patterns with `confidence: low` and `last:` older than 60 days to the `## Archived` section. If their `confirmed` count is now >= 2, promote to `medium` first.
|
|
32
|
+
|
|
33
|
+
### Step 2: Trim metrics.md
|
|
34
|
+
|
|
35
|
+
Keep only the last 4 weeks of data in `.planning/memory/metrics.md`.
|
|
36
|
+
|
|
37
|
+
### Step 3: Trim wins.md
|
|
38
|
+
|
|
39
|
+
Keep only the last 10 entries in `.planning/memory/wins.md`.
|
|
40
|
+
|
|
41
|
+
### Step 4: Trim decisions.md
|
|
42
|
+
|
|
43
|
+
Keep only the last 20 entries in `.planning/memory/decisions.md`. Move older ones to an `## Archived` section at the bottom.
|
|
44
|
+
|
|
45
|
+
### Step 5: Stale-mark anti-patterns.md
|
|
46
|
+
|
|
47
|
+
Scan `.planning/memory/anti-patterns.md`. For any entry not referenced in the last 90 days, add `[stale]` to its header — do not delete.
|
|
48
|
+
|
|
49
|
+
### Step 6: Archive old specs
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
find docs/specs -mindepth 1 -maxdepth 1 -type d -mtime +90 2>/dev/null
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
If any are older than 90 days, move them to `docs/specs/archive/`.
|
|
56
|
+
|
|
57
|
+
### Step 7: Check MAP.md
|
|
58
|
+
|
|
59
|
+
Read `.planning/MAP.md` and extract the list of key directories from the architecture or key files section. For each directory listed, verify it exists on disk and report any that are missing.
|
|
60
|
+
|
|
61
|
+
### Create report
|
|
62
|
+
|
|
63
|
+
Create `.planning/reports/cleanup/{date}.md`:
|
|
64
|
+
|
|
65
|
+
```markdown
|
|
66
|
+
# Memory Cleanup -- {date}
|
|
67
|
+
|
|
68
|
+
## Actions
|
|
69
|
+
- [x] Core/Archive split: reviewed (N promoted, N stale-marked, N archived)
|
|
70
|
+
- [x] Metrics: trimmed to 4 weeks
|
|
71
|
+
- [x] Wins: trimmed to 10 entries
|
|
72
|
+
- [x] Decisions: trimmed to 20 entries
|
|
73
|
+
- [x] Anti-patterns: stale-marked (N)
|
|
74
|
+
- [x] Specs archived: N
|
|
75
|
+
- [x] MAP.md: verified (N missing)
|
|
76
|
+
|
|
77
|
+
## Archived Specs
|
|
78
|
+
- {spec1}
|
|
79
|
+
- {spec2}
|
|
80
|
+
```
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# /frame:context -- Quick Context Digest
|
|
2
|
+
|
|
3
|
+
> Shows a compact re-entry digest (git activity, current task, next step).
|
|
4
|
+
> Different from `memory/context.md` — that file stores persistent project context written by agents.
|
|
5
|
+
> This command *reads* that file (and STATE.md, git log) and presents a summary.
|
|
6
|
+
|
|
7
|
+
Fast re-entry after a break: what happened, where you are, what's next.
|
|
8
|
+
|
|
9
|
+
## Instructions
|
|
10
|
+
|
|
11
|
+
### Step 1: Git activity (last 3 days)
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
git log --oneline --since="3 days ago"
|
|
15
|
+
git diff HEAD~3 --stat 2>/dev/null || git diff --stat
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### Step 2: Read state files
|
|
19
|
+
|
|
20
|
+
Read in order:
|
|
21
|
+
- `.planning/STATE.md` — current phase, feature, task
|
|
22
|
+
- `.planning/pause-history/` — last pause-state if exists (most recent file)
|
|
23
|
+
|
|
24
|
+
### Step 3: Find open tasks
|
|
25
|
+
|
|
26
|
+
From STATE.md extract tasks list. Count: total, done, remaining.
|
|
27
|
+
If `resumeHint` exists in pause-state — use it as the next step.
|
|
28
|
+
Otherwise derive next step from the first unchecked task in plan.md (if exists).
|
|
29
|
+
|
|
30
|
+
### Step 4: Output digest
|
|
31
|
+
|
|
32
|
+
Print a compact summary:
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
╔══════════════════════════════════════════╗
|
|
36
|
+
║ FRAME CONTEXT ║
|
|
37
|
+
╠══════════════════════════════════════════╣
|
|
38
|
+
║ Phase: {phase} ║
|
|
39
|
+
║ Feature: {feature} ║
|
|
40
|
+
║ Task: {done}/{total} ║
|
|
41
|
+
║ Status: {status} ║
|
|
42
|
+
╠══════════════════════════════════════════╣
|
|
43
|
+
║ Last 3 days: ║
|
|
44
|
+
║ {commit 1} ║
|
|
45
|
+
║ {commit 2} ║
|
|
46
|
+
║ ... ║
|
|
47
|
+
╠══════════════════════════════════════════╣
|
|
48
|
+
║ Changed files (diff HEAD~3): ║
|
|
49
|
+
║ {file 1} (+N -M) ║
|
|
50
|
+
║ {file 2} (+N -M) ║
|
|
51
|
+
╠══════════════════════════════════════════╣
|
|
52
|
+
║ Next: {resumeHint or next task} ║
|
|
53
|
+
╚══════════════════════════════════════════╝
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
If no commits in 3 days, show "No commits — fresh start?"
|
|
57
|
+
If tasks remain: show count "X tasks left"
|
|
58
|
+
|
|
59
|
+
## Rules
|
|
60
|
+
|
|
61
|
+
- Output only — no STATE.md writes
|
|
62
|
+
- Max 25 lines total
|
|
63
|
+
- If STATE.md is missing: "Run /frame:init first"
|
|
64
|
+
- Always show next step — never leave user without direction
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# /frame:daily -- Morning Briefing
|
|
2
|
+
|
|
3
|
+
> **Start here** after any break. This is your single entry point — replaces `/frame:where` and `/frame:status` for daily use.
|
|
4
|
+
> Use `/frame:status` only when you need a full technical dump (git, memory, blockers).
|
|
5
|
+
|
|
6
|
+
One-call daily standup: what was done, what's next, any blockers.
|
|
7
|
+
|
|
8
|
+
## Instructions
|
|
9
|
+
|
|
10
|
+
### Step 1: Git activity (yesterday)
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
git log --oneline --since="yesterday" --until="now"
|
|
14
|
+
git log --oneline --since="2 days ago" --until="yesterday"
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### Step 2: Read planning files
|
|
18
|
+
|
|
19
|
+
Read in order:
|
|
20
|
+
- `.planning/STATE.md` — current phase, feature, tasks
|
|
21
|
+
- `.planning/ROADMAP.md` — upcoming milestones (first 30 lines)
|
|
22
|
+
- `.planning/memory/context.md` — blockers and current focus
|
|
23
|
+
|
|
24
|
+
### Step 3: Check open tasks
|
|
25
|
+
|
|
26
|
+
If plan.md exists for current feature:
|
|
27
|
+
```bash
|
|
28
|
+
find docs/specs -name "plan.md" | head -3
|
|
29
|
+
```
|
|
30
|
+
Count `[ ]` (open) vs `[x]` (done) tasks.
|
|
31
|
+
|
|
32
|
+
### Step 4: Output briefing
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
╔══════════════════════════════════════════╗
|
|
36
|
+
║ FRAME DAILY — {date} ║
|
|
37
|
+
╠══════════════════════════════════════════╣
|
|
38
|
+
║ Yesterday: ║
|
|
39
|
+
║ {commit 1} ║
|
|
40
|
+
║ {commit 2} ║
|
|
41
|
+
║ (or "No commits yesterday") ║
|
|
42
|
+
╠══════════════════════════════════════════╣
|
|
43
|
+
║ Current: ║
|
|
44
|
+
║ Phase: {phase} ║
|
|
45
|
+
║ Feature: {feature} ║
|
|
46
|
+
║ Tasks: {done}/{total} done ║
|
|
47
|
+
╠══════════════════════════════════════════╣
|
|
48
|
+
║ Next up: ║
|
|
49
|
+
║ {next unchecked task or next phase} ║
|
|
50
|
+
╠══════════════════════════════════════════╣
|
|
51
|
+
║ Blockers: {blockers or "None"} ║
|
|
52
|
+
╠══════════════════════════════════════════╣
|
|
53
|
+
║ Roadmap: {next milestone} ║
|
|
54
|
+
╚══════════════════════════════════════════╝
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Step 5: Action item
|
|
58
|
+
|
|
59
|
+
After the briefing box, always output one line:
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
→ Run: {command} — {one-line reason}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Pick the command based on context:
|
|
66
|
+
- Has open tasks in plan.md → `/frame:build`
|
|
67
|
+
- No plan.md yet → `/frame:research` or `/frame:fast`
|
|
68
|
+
- Has blockers → `/frame:unstuck`
|
|
69
|
+
- Phase is REVIEW → `/frame:review`
|
|
70
|
+
- Phase is SHIP → `/frame:ship`
|
|
71
|
+
|
|
72
|
+
## Rules
|
|
73
|
+
|
|
74
|
+
- Output only — no file writes
|
|
75
|
+
- Max 35 lines
|
|
76
|
+
- If STATE.md missing: "Run /frame:init first"
|
|
77
|
+
- Always end with the `→ Run:` action item — never leave without a concrete next command
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# /frame:debug -- Systematic Debugging
|
|
2
|
+
|
|
3
|
+
4-phase debugging workflow: Reproduce -> Root Cause -> Fix -> Review.
|
|
4
|
+
|
|
5
|
+
## Instructions
|
|
6
|
+
|
|
7
|
+
Debug the problem: **$ARGUMENTS**
|
|
8
|
+
|
|
9
|
+
### Step 0a: Initialize STATE.md
|
|
10
|
+
|
|
11
|
+
Before starting, write to `STATE.md`:
|
|
12
|
+
```markdown
|
|
13
|
+
- Phase: DEBUG
|
|
14
|
+
- Bug: {description from $ARGUMENTS}
|
|
15
|
+
- Status: IN_PROGRESS
|
|
16
|
+
- Current Phase: 1/4
|
|
17
|
+
- Started: {timestamp}
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
> If the session is interrupted, the next session will know where to resume.
|
|
21
|
+
|
|
22
|
+
### Step 0b: Severity Classification
|
|
23
|
+
|
|
24
|
+
- **Critical** (auth, billing, data loss) → create `git stash`, work in a separate branch, warn the user before any code changes
|
|
25
|
+
- **High** (main flow broken) → standard debug protocol
|
|
26
|
+
- **Low** (UI, minor UX) → can defer, add to backlog
|
|
27
|
+
|
|
28
|
+
### Step 0c: Check Memory
|
|
29
|
+
|
|
30
|
+
Before any grep, check:
|
|
31
|
+
- `memory/anti-patterns.md` → look for a similar symptom (may have been solved before)
|
|
32
|
+
- `memory/decisions.md` → does the bug contradict an accepted decision
|
|
33
|
+
- `memory/patterns.md` → understand expected behavior
|
|
34
|
+
|
|
35
|
+
> A developer should not spend an hour on a bug that was already solved.
|
|
36
|
+
|
|
37
|
+
### Phase 1: Reproduce
|
|
38
|
+
|
|
39
|
+
**Goal**: Understand the problem and reproduce it.
|
|
40
|
+
|
|
41
|
+
Update STATE.md: `Current Phase: 1/4`
|
|
42
|
+
|
|
43
|
+
1. **Describe the problem**:
|
|
44
|
+
- What is happening?
|
|
45
|
+
- What is expected?
|
|
46
|
+
- Under what conditions?
|
|
47
|
+
|
|
48
|
+
2. **Find related code**:
|
|
49
|
+
- `grep -r "{keywords}" --include="*.ts" --include="*.tsx" | head -20`
|
|
50
|
+
- Check `.planning/MAP.md` for navigation
|
|
51
|
+
|
|
52
|
+
3. **Reproduce**:
|
|
53
|
+
- Run relevant tests
|
|
54
|
+
- Check logs
|
|
55
|
+
- Identify steps to reproduce
|
|
56
|
+
|
|
57
|
+
> **Key principle**: do not fix until you have reproduced the problem.
|
|
58
|
+
|
|
59
|
+
### Phase 2: Root Cause
|
|
60
|
+
|
|
61
|
+
**Goal**: Find the root cause through deterministic steps.
|
|
62
|
+
|
|
63
|
+
Update STATE.md: `Current Phase: 2/4`
|
|
64
|
+
|
|
65
|
+
1. **[D]** `grep -n "{symptom}"` across the codebase → get specific files and lines
|
|
66
|
+
2. **[P]** Read related files, understand data flow
|
|
67
|
+
3. **[D]** Add `console.log` / temporary test to confirm hypothesis
|
|
68
|
+
4. **[P]** Formulate root cause: where, why, what triggers it
|
|
69
|
+
5. **[D]** Run isolated test to confirm root cause
|
|
70
|
+
|
|
71
|
+
> **Key principle**: root cause is a confirmed fact, not an LLM guess.
|
|
72
|
+
|
|
73
|
+
**If root cause not found within 30 minutes** → stop and run `/frame:forensics` for deep analysis.
|
|
74
|
+
> Debug = quick fix for a known bug type. Forensics = investigation of a systemic problem.
|
|
75
|
+
|
|
76
|
+
### Phase 3: Fix
|
|
77
|
+
|
|
78
|
+
**Goal**: Fix the problem using TDD.
|
|
79
|
+
|
|
80
|
+
Update STATE.md: `Current Phase: 3/4`
|
|
81
|
+
|
|
82
|
+
1. **Write a regression test**:
|
|
83
|
+
- A test that reproduces the bug
|
|
84
|
+
- **D-step**: The test must FAIL (confirms the bug)
|
|
85
|
+
|
|
86
|
+
2. **Fix the code**:
|
|
87
|
+
- Minimal fix for the root cause
|
|
88
|
+
- Do not change anything unnecessary
|
|
89
|
+
|
|
90
|
+
3. **Verify the fix**:
|
|
91
|
+
- **D-step**: Regression test must PASS
|
|
92
|
+
- Run all tests: `{quality.commands.test}`
|
|
93
|
+
- Type check: `{quality.commands.typecheck}`
|
|
94
|
+
|
|
95
|
+
### Phase 4: Review and Knowledge Capture
|
|
96
|
+
|
|
97
|
+
**Goal**: Ensure the fix is safe and preserve the knowledge.
|
|
98
|
+
|
|
99
|
+
Update STATE.md: `Current Phase: 4/4`
|
|
100
|
+
|
|
101
|
+
1. **Check side effects**:
|
|
102
|
+
- Did the fix break anything else?
|
|
103
|
+
- Are there related tests?
|
|
104
|
+
|
|
105
|
+
2. **Git commit**:
|
|
106
|
+
```bash
|
|
107
|
+
git add {files}
|
|
108
|
+
git commit -m "fix({scope}): {description}"
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
3. **Update memory/anti-patterns.md**:
|
|
112
|
+
```markdown
|
|
113
|
+
## {short bug name}
|
|
114
|
+
- Symptom: {what was observed}
|
|
115
|
+
- Root cause: {where and why}
|
|
116
|
+
- Fix: {what was done}
|
|
117
|
+
- Regression test: {path to test}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
4. **Update STATE.md**:
|
|
121
|
+
```markdown
|
|
122
|
+
## Current Position
|
|
123
|
+
- Phase: DEBUG
|
|
124
|
+
- Feature: {issue}
|
|
125
|
+
- Status: Bug fixed
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
> **Key principle**: the most valuable output of a debug session is not just the fixed code, but the captured knowledge.
|
|
129
|
+
|
|
130
|
+
## Rules
|
|
131
|
+
|
|
132
|
+
- **Check memory first** -- anti-patterns.md may already have the answer
|
|
133
|
+
- **Reproduce first** -- do not fix until you understand the problem
|
|
134
|
+
- **D→P→D in Phase 2** -- every hypothesis is confirmed by a deterministic step
|
|
135
|
+
- **Regression test required** -- so the bug does not return
|
|
136
|
+
- **Minimal fix** -- do not change anything unnecessary
|
|
137
|
+
- **Quality gates** -- type check + tests before commit
|
|
138
|
+
- **Write to anti-patterns.md** -- knowledge must not be lost
|
|
139
|
+
|
|
140
|
+
## Result
|
|
141
|
+
|
|
142
|
+
- Root cause identified and confirmed deterministically
|
|
143
|
+
- Bug fixed with regression test
|
|
144
|
+
- Quality gates passed
|
|
145
|
+
- Git commit created
|
|
146
|
+
- `memory/anti-patterns.md` updated
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
# /frame:doctor -- FRAME Health Check
|
|
2
|
+
|
|
3
|
+
Diagnoses all FRAME systems and outputs a report.
|
|
4
|
+
|
|
5
|
+
## Instructions
|
|
6
|
+
|
|
7
|
+
Run a full project diagnostics. Check each component:
|
|
8
|
+
|
|
9
|
+
### 1. Node.js version
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
node_version=$(node -e "process.exit(parseInt(process.versions.node) >= 18 ? 0 : 1)" 2>/dev/null && echo "OK" || echo "REQUIRES >=18")
|
|
13
|
+
echo "Node.js: $(node --version) — $node_version"
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
### 2. CLAUDE.md
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
if [ -f "CLAUDE.md" ]; then
|
|
20
|
+
echo "CLAUDE.md: OK ($(grep -c "## " CLAUDE.md) sections)"
|
|
21
|
+
else
|
|
22
|
+
echo "CLAUDE.md: MISSING"
|
|
23
|
+
fi
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### 3. .planning/ structure
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
for file in STATE.md ROADMAP.md CONTEXT.md MAP.md; do
|
|
30
|
+
if [ -f ".planning/$file" ]; then
|
|
31
|
+
echo "$file: OK"
|
|
32
|
+
else
|
|
33
|
+
echo "$file: MISSING"
|
|
34
|
+
fi
|
|
35
|
+
done
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### 4. .planning/memory/
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
for file in context.md patterns.md conventions.md decisions.md anti-patterns.md wins.md metrics.md dependencies.md; do
|
|
42
|
+
if [ -f ".planning/memory/$file" ]; then
|
|
43
|
+
echo "$file: OK"
|
|
44
|
+
else
|
|
45
|
+
echo "$file: MISSING"
|
|
46
|
+
fi
|
|
47
|
+
done
|
|
48
|
+
|
|
49
|
+
# Check patterns.md has required sections
|
|
50
|
+
if [ -f ".planning/memory/patterns.md" ]; then
|
|
51
|
+
for section in "## Core" "## Active" "## Archived"; do
|
|
52
|
+
if grep -q "^${section}$" .planning/memory/patterns.md; then
|
|
53
|
+
echo "patterns.md section '${section}': OK"
|
|
54
|
+
else
|
|
55
|
+
echo "patterns.md section '${section}': MISSING"
|
|
56
|
+
fi
|
|
57
|
+
done
|
|
58
|
+
fi
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### 5. .frame/config.json
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
if [ -f ".frame/config.json" ]; then
|
|
65
|
+
if node -e "JSON.parse(require('fs').readFileSync('.frame/config.json','utf-8'))" 2>/dev/null; then
|
|
66
|
+
echo "config.json: OK (language: $(node -e "console.log(JSON.parse(require('fs').readFileSync('.frame/config.json','utf-8')).language||'not set')"))"
|
|
67
|
+
else
|
|
68
|
+
echo "config.json: INVALID JSON"
|
|
69
|
+
fi
|
|
70
|
+
else
|
|
71
|
+
echo "config.json: MISSING"
|
|
72
|
+
fi
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### 6. Settings
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
if [ -f ".claude/settings.local.json" ]; then
|
|
79
|
+
echo "settings.local.json: OK"
|
|
80
|
+
if grep -q "hooks" .claude/settings.local.json; then
|
|
81
|
+
echo " Hooks configured: OK"
|
|
82
|
+
else
|
|
83
|
+
echo " Hooks configured: MISSING"
|
|
84
|
+
fi
|
|
85
|
+
else
|
|
86
|
+
echo "settings.local.json: MISSING"
|
|
87
|
+
fi
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### 7. Commands
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
command_count=$(ls .claude/commands/frame:*.md 2>/dev/null | wc -l | tr -d ' ')
|
|
94
|
+
expected_count=$(ls .claude/commands/frame:*.md 2>/dev/null | wc -l | tr -d ' ')
|
|
95
|
+
if [ "$command_count" -ge 1 ]; then
|
|
96
|
+
echo "Commands: $command_count — OK"
|
|
97
|
+
else
|
|
98
|
+
echo "Commands: $command_count — INCOMPLETE (no commands found)"
|
|
99
|
+
fi
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### 8. Agents
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
agent_count=$(ls .claude/agents/*.md 2>/dev/null | wc -l | tr -d ' ')
|
|
106
|
+
if [ "$agent_count" -ge 5 ]; then
|
|
107
|
+
echo "Agents: $agent_count/5 — OK"
|
|
108
|
+
else
|
|
109
|
+
echo "Agents: $agent_count/5 — INCOMPLETE"
|
|
110
|
+
fi
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### 9. Hooks
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
for hook in safety-net.sh git-safety.sh quality-gate.sh session-init.sh; do
|
|
117
|
+
if [ -f ".claude/hooks/$hook" ]; then
|
|
118
|
+
if [ -x ".claude/hooks/$hook" ]; then
|
|
119
|
+
echo "$hook: OK (executable)"
|
|
120
|
+
else
|
|
121
|
+
echo "$hook: WARNING — not executable (chmod +x needed)"
|
|
122
|
+
fi
|
|
123
|
+
else
|
|
124
|
+
echo "$hook: MISSING"
|
|
125
|
+
fi
|
|
126
|
+
done
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### 10. Git
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
git_status=$(git status --short 2>/dev/null | wc -l | tr -d ' ')
|
|
133
|
+
echo "Uncommitted changes: $git_status"
|
|
134
|
+
echo "Recent commits:"
|
|
135
|
+
git log --oneline -5 2>/dev/null
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Output Format
|
|
139
|
+
|
|
140
|
+
```
|
|
141
|
+
+======================================================================+
|
|
142
|
+
| FRAME DOCTOR REPORT |
|
|
143
|
+
+======================================================================+
|
|
144
|
+
| |
|
|
145
|
+
| Environment: |
|
|
146
|
+
| Node.js v20.x — OK |
|
|
147
|
+
| |
|
|
148
|
+
| Core Files: |
|
|
149
|
+
| CLAUDE.md OK (N sections) |
|
|
150
|
+
| .planning/ OK (4/4 files) |
|
|
151
|
+
| .planning/memory/ OK (8/8 files) |
|
|
152
|
+
| .frame/config.json OK (language: en) |
|
|
153
|
+
| settings.local.json OK |
|
|
154
|
+
| |
|
|
155
|
+
| FRAME Components: |
|
|
156
|
+
| Commands: N — OK |
|
|
157
|
+
| Agents: 5/5 — OK |
|
|
158
|
+
| Hooks: 4/4 — OK |
|
|
159
|
+
| |
|
|
160
|
+
| Git: |
|
|
161
|
+
| Uncommitted: N files |
|
|
162
|
+
| |
|
|
163
|
+
+======================================================================+
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## Result
|
|
167
|
+
|
|
168
|
+
- Full FRAME diagnostics completed
|
|
169
|
+
- Problems identified
|
|
170
|
+
- Recommendations for fixes
|