make-it-done 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.
Files changed (42) hide show
  1. package/README.md +263 -0
  2. package/agents/.gitkeep +0 -0
  3. package/agents/mid-debugger.md +88 -0
  4. package/agents/mid-executor.md +69 -0
  5. package/agents/mid-planner.md +97 -0
  6. package/agents/mid-researcher.md +101 -0
  7. package/agents/mid-verifier.md +92 -0
  8. package/bin/install.js +122 -0
  9. package/commands/mid/.gitkeep +0 -0
  10. package/commands/mid/debug.md +19 -0
  11. package/commands/mid/do.md +24 -0
  12. package/commands/mid/help.md +77 -0
  13. package/commands/mid/init.md +18 -0
  14. package/commands/mid/next.md +18 -0
  15. package/commands/mid/plan.md +21 -0
  16. package/commands/mid/quick.md +24 -0
  17. package/commands/mid/report.md +16 -0
  18. package/commands/mid/status.md +16 -0
  19. package/commands/mid/verify.md +19 -0
  20. package/makeitdone/bin/mid-tools.cjs +2048 -0
  21. package/makeitdone/steps/agent-contracts.md +184 -0
  22. package/makeitdone/steps/anti-patterns.md +291 -0
  23. package/makeitdone/steps/context-budget.md +157 -0
  24. package/makeitdone/steps/init-gate.md +42 -0
  25. package/makeitdone/steps/model-route.md +70 -0
  26. package/makeitdone/steps/state-read.md +56 -0
  27. package/makeitdone/templates/plan.md +94 -0
  28. package/makeitdone/templates/project.md +62 -0
  29. package/makeitdone/templates/requirements.md +97 -0
  30. package/makeitdone/templates/roadmap.md +111 -0
  31. package/makeitdone/templates/state.md +28 -0
  32. package/makeitdone/templates/summary.md +58 -0
  33. package/makeitdone/workflows/debug.md +135 -0
  34. package/makeitdone/workflows/execute.md +218 -0
  35. package/makeitdone/workflows/init.md +113 -0
  36. package/makeitdone/workflows/next.md +114 -0
  37. package/makeitdone/workflows/plan.md +231 -0
  38. package/makeitdone/workflows/quick.md +151 -0
  39. package/makeitdone/workflows/report.md +138 -0
  40. package/makeitdone/workflows/status.md +135 -0
  41. package/makeitdone/workflows/verify.md +177 -0
  42. package/package.json +50 -0
@@ -0,0 +1,184 @@
1
+ # Agent Completion Contracts
2
+
3
+ Strict contract definitions. Workflows MUST check for these exact markers.
4
+
5
+ ## mid-executor
6
+
7
+ **Completion Markers:**
8
+ ```
9
+ ## WAVE COMPLETE
10
+ ## PHASE EXECUTION FAILED
11
+ ## BLOCKED - USER INPUT NEEDED
12
+ ## ALL WAVES COMPLETE
13
+ ```
14
+
15
+ **Contract:**
16
+ - Executes one complete wave (all tasks in wave)
17
+ - Updates STATE.md via mid-tools after each task
18
+ - Spawns mid-verifier for per-task validation
19
+ - Returns exact completion marker + blockers list
20
+ - Never continues if task fails (unless --skip-failed flag)
21
+
22
+ **Output Format:**
23
+ ```
24
+ ## WAVE COMPLETE
25
+
26
+ Completed tasks: 3/3
27
+ Wave runtime: 12m
28
+ State updated: wave_1_complete = true
29
+
30
+ Next: Run mid:do 1 --wave 2
31
+ ```
32
+
33
+ ---
34
+
35
+ ## mid-planner
36
+
37
+ **Completion Markers:**
38
+ ```
39
+ ## ROADMAP CREATED
40
+ ## PHASE PLAN CREATED
41
+ ## GAP PLANS CREATED
42
+ ## PLAN VALIDATION PASSED
43
+ ## PLAN VALIDATION FAILED
44
+ ```
45
+
46
+ **Contract:**
47
+ - Creates file(s) in .planning/ directory
48
+ - Respects size limits (PLAN.md < 150 lines)
49
+ - Returns completion marker + file path(s)
50
+ - Includes acceptance criteria in plan
51
+ - Validates against previous phase (dependencies)
52
+
53
+ **Output Format:**
54
+ ```
55
+ ## PHASE PLAN CREATED
56
+
57
+ File: .planning/phases/01-foundation/PLAN.md
58
+ Tasks: 5 (1 wave)
59
+ Estimated: 6-8 hours
60
+ Acceptance: 8 criteria
61
+
62
+ Next: Review with /mid:plan --mode check --phase 1
63
+ ```
64
+
65
+ ---
66
+
67
+ ## mid-researcher
68
+
69
+ **Completion Markers:**
70
+ ```
71
+ ## RESEARCH COMPLETE
72
+ ## RESEARCH PARTIAL (context limit)
73
+ ## RESEARCH FAILED
74
+ ```
75
+
76
+ **Contract:**
77
+ - Creates research.md in phase directory
78
+ - Respects context_window limits
79
+ - Returns marker + summary (20-50 lines max)
80
+ - Partial research includes "(PARTIAL)" in marker and lists stopped-at section
81
+ - Failed research includes error reason
82
+
83
+ **Output Format:**
84
+ ```
85
+ ## RESEARCH COMPLETE
86
+
87
+ File: .planning/phases/01-foundation/research.md
88
+ Coverage: 8 areas
89
+ Lines: 45/150
90
+
91
+ Key findings:
92
+ - [fact 1]
93
+ - [fact 2]
94
+ ```
95
+
96
+ ---
97
+
98
+ ## mid-verifier
99
+
100
+ **Completion Markers:**
101
+ ```
102
+ ## VERIFICATION PASSED
103
+ ## VERIFICATION FAILED - <reason>
104
+ ## VERIFICATION INCOMPLETE
105
+ ```
106
+
107
+ **Contract:**
108
+ - Checks against ACCEPTANCE.md criteria
109
+ - Returns marker + pass/fail per criterion
110
+ - Fast-fails on critical blockers
111
+ - Returns blockers list with remediation steps
112
+ - Never modifies code (read-only)
113
+
114
+ **Output Format:**
115
+ ```
116
+ ## VERIFICATION PASSED
117
+
118
+ Criteria passed: 8/8
119
+ Coverage: 100%
120
+ Duration: 2m
121
+
122
+ Status: Phase 1 ready for /mid:next
123
+ ```
124
+
125
+ ---
126
+
127
+ ## mid-debugger
128
+
129
+ **Completion Markers:**
130
+ ```
131
+ ## DEBUG COMPLETE - <action>
132
+ ## ROOT CAUSE: <identified issue>
133
+ ## ESCALATION NEEDED - <reason>
134
+ ```
135
+
136
+ **Contract:**
137
+ - Identifies root cause of error/blocker
138
+ - Returns diagnostic report (20-40 lines max)
139
+ - Suggests specific fix or escalation path
140
+ - Never attempts to fix (only diagnose)
141
+ - Respects ~5 min time budget
142
+
143
+ **Output Format:**
144
+ ```
145
+ ## ROOT CAUSE: Missing environment variable
146
+
147
+ Error: TypeError: Cannot read property 'apiKey' of undefined
148
+ File: src/api/client.ts:23
149
+
150
+ Finding: process.env.API_KEY not loaded from .env
151
+
152
+ Action: Add API_KEY to .env.example, load in config.ts
153
+
154
+ Next: Run /mid:do 1 --rerun-task 3-2
155
+ ```
156
+
157
+ ---
158
+
159
+ ## Verification Pattern (in Workflows)
160
+
161
+ Always check for completion marker:
162
+
163
+ ```bash
164
+ # Spawn agent
165
+ AGENT_OUTPUT=$(... spawn mid-executor ...)
166
+
167
+ # Parse completion marker
168
+ if [[ $AGENT_OUTPUT == *"## WAVE COMPLETE"* ]]; then
169
+ handle_wave_complete
170
+ elif [[ $AGENT_OUTPUT == *"## BLOCKED"* ]]; then
171
+ handle_blocked
172
+ elif [[ $AGENT_OUTPUT == *"## FAILED"* ]]; then
173
+ handle_failed
174
+ else
175
+ error "Unexpected output, no completion marker"
176
+ fi
177
+ ```
178
+
179
+ ## Anti-patterns
180
+
181
+ - Checking for partial strings ("complete" instead of "## WAVE COMPLETE")
182
+ - Ignoring "FAILED" markers (must escalate)
183
+ - Assuming marker presence without verification (use explicit check)
184
+ - Parsing agent output besides marker (markers are contract boundary)
@@ -0,0 +1,291 @@
1
+ # Universal Anti-patterns
2
+
3
+ Patterns to avoid across all workflows and agents.
4
+
5
+ ## Reading & Context
6
+
7
+ ### ❌ Full File Reads When Frontmatter Suffices
8
+
9
+ ```bash
10
+ # BAD: loads 5K tokens
11
+ STATE=$(cat .planning/STATE.md)
12
+
13
+ # GOOD: loads 200 tokens (frontmatter only)
14
+ STATE_FM=$(mid-tools fm get .planning/STATE.md)
15
+ ```
16
+
17
+ **Rule**: If context_window < 500k, always use frontmatter-only reads.
18
+
19
+ ---
20
+
21
+ ### ❌ Loading All Phases at Once
22
+
23
+ ```bash
24
+ # BAD: loads 50K tokens
25
+ ALL_PHASES=$(find .planning/phases -name "PLAN.md" -exec cat {} \;)
26
+
27
+ # GOOD: load only active phase
28
+ PHASE_PLAN=$(cat .planning/phases/01-foundation/PLAN.md)
29
+ ```
30
+
31
+ **Rule**: Query by phase number, never enumerate all phases.
32
+
33
+ ---
34
+
35
+ ### ❌ Importing All Step Fragments
36
+
37
+ ```bash
38
+ # BAD: monolithic
39
+ @makeitdone/steps/*.md
40
+
41
+ # GOOD: surgical inclusion
42
+ @makeitdone/steps/init-gate.md
43
+ @makeitdone/steps/model-route.md
44
+ ```
45
+
46
+ **Rule**: Only @include steps actually used in workflow.
47
+
48
+ ---
49
+
50
+ ## Agent Spawning
51
+
52
+ ### ❌ Spawning Multiple Agents Per Wave
53
+
54
+ ```bash
55
+ # BAD: context overload
56
+ spawn mid-planner
57
+ spawn mid-researcher
58
+ spawn mid-verifier
59
+ (all in same wave)
60
+
61
+ # GOOD: sequential necessity
62
+ spawn mid-executor (wave 1)
63
+ -> spawn mid-verifier (per-task)
64
+ -> next wave
65
+ ```
66
+
67
+ **Rule**: Max 1 primary agent per wave. Spawn verifier only as quality gate.
68
+
69
+ ---
70
+
71
+ ### ❌ Passing File Contents to Agents
72
+
73
+ ```bash
74
+ # BAD: bloats context
75
+ PLAN_CONTENT=$(cat .planning/phases/01/PLAN.md)
76
+ spawn mid-executor with "${PLAN_CONTENT}"
77
+
78
+ # GOOD: path-based delegation
79
+ spawn mid-executor with phase_dir=".planning/phases/01"
80
+ ```
81
+
82
+ **Rule**: Pass file paths, let agents read. Exceptions: frontmatter extracts (< 500 tokens).
83
+
84
+ ---
85
+
86
+ ### ❌ Lazy Agents Without Guards
87
+
88
+ ```bash
89
+ # BAD: always spawns
90
+ spawn mid-researcher
91
+
92
+ # GOOD: conditional
93
+ if [ "$research_required" = true ] || [ "$RESEARCH_FLAG" = true ]; then
94
+ spawn mid-researcher
95
+ fi
96
+ ```
97
+
98
+ **Rule**: Researchers are lazy-loaded. Check flags first.
99
+
100
+ ---
101
+
102
+ ## State Management
103
+
104
+ ### ❌ Direct STATE.md Writes
105
+
106
+ ```bash
107
+ # BAD: inconsistent, whitespace bloat
108
+ echo "phase: 2" >> .planning/STATE.md
109
+
110
+ # GOOD: atomic via mid-tools
111
+ mid-tools state set phase 2
112
+ mid-tools state advance 2
113
+ ```
114
+
115
+ **Rule**: Never write STATE.md directly. Always use mid-tools CLI.
116
+
117
+ ---
118
+
119
+ ### ❌ Parsing STATE.md Manually
120
+
121
+ ```bash
122
+ # BAD: brittle, breaks on format changes
123
+ PHASE=$(grep "^phase:" .planning/STATE.md | cut -d: -f2)
124
+
125
+ # GOOD: structured extraction
126
+ PHASE=$(mid-tools fm get .planning/STATE.md --field phase)
127
+ ```
128
+
129
+ **Rule**: Use mid-tools for all state reads.
130
+
131
+ ---
132
+
133
+ ## Data Formats
134
+
135
+ ### ❌ JSON in Context
136
+
137
+ ```bash
138
+ # BAD: 40% more tokens
139
+ echo '{"phase":1,"tasks":["a","b"]}'
140
+
141
+ # GOOD: TOON compression
142
+ mid-tools toon <(echo '{"phase":1,"tasks":["a","b"]}')
143
+ ```
144
+
145
+ **Rule**: All JSON payloads → TOON conversion. Output TOON, not JSON.
146
+
147
+ ---
148
+
149
+ ### ❌ Verbose Task Descriptions
150
+
151
+ ```markdown
152
+ # BAD: 20 lines per task
153
+ ### 01-01 Implement Auth Module
154
+ This task involves building an authentication system using JWT tokens.
155
+ We need to support login, logout, token refresh, and logout-all operations.
156
+ The implementation should use industry best practices including:
157
+ - Secure token storage
158
+ - HTTPS-only cookies
159
+ - Rate limiting
160
+ ...
161
+
162
+ # GOOD: 5 lines per task
163
+ ### 01-01 Implement JWT auth (login, refresh, logout)
164
+ User stories: US-001, US-002
165
+ Tests: auth.test.ts
166
+ Acceptance: login works, tokens refreshed, logout clears
167
+ ```
168
+
169
+ **Rule**: PLAN.md max 150 lines. Tasks max 10-12 lines each.
170
+
171
+ ---
172
+
173
+ ## Error Handling
174
+
175
+ ### ❌ Silent Failures
176
+
177
+ ```bash
178
+ # BAD: fails silently
179
+ node ~/.claude/makeitdone/bin/mid-tools.cjs state set phase 2 || true
180
+
181
+ # GOOD: explicit error handling
182
+ if ! node ~/.claude/makeitdone/bin/mid-tools.cjs state set phase 2; then
183
+ error "Failed to advance phase"
184
+ escalate_to_user
185
+ fi
186
+ ```
187
+
188
+ **Rule**: All critical operations must check exit codes and escalate on failure.
189
+
190
+ ---
191
+
192
+ ### ❌ Ignoring Context Exhaustion
193
+
194
+ ```bash
195
+ # BAD: crashes when context < 500k
196
+ STATE=$(cat .planning/STATE.md) # fails silently
197
+
198
+ # GOOD: context-aware fallback
199
+ if [ "$context_window" -lt 500000 ]; then
200
+ STATE=$(mid-tools fm get .planning/STATE.md)
201
+ else
202
+ STATE=$(cat .planning/STATE.md)
203
+ fi
204
+ ```
205
+
206
+ **Rule**: Always check context_window and degrade gracefully.
207
+
208
+ ---
209
+
210
+ ## Workflow Structure
211
+
212
+ ### ❌ Monolithic Workflows
213
+
214
+ ```markdown
215
+ # BAD: one 50KB workflow
216
+ ## Init Gate
217
+ ## Model Routing
218
+ ## Executor Spawn
219
+ ## Verification
220
+ ## State Update
221
+ ## Report Generation
222
+ ...all in one file
223
+ ```
224
+
225
+ **Rule**: One workflow = one responsibility. Max 10-15KB per file.
226
+
227
+ ---
228
+
229
+ ### ❌ Unclear Completion Markers
230
+
231
+ ```markdown
232
+ # BAD: multiple possible outputs
233
+ "execution done"
234
+ "all tasks complete"
235
+ "FINISHED"
236
+ "ready for next"
237
+ ```
238
+
239
+ **Rule**: Exact markers only. See agent-contracts.md.
240
+
241
+ ---
242
+
243
+ ## Performance
244
+
245
+ ### ❌ N+1 Grep Queries
246
+
247
+ ```bash
248
+ # BAD: 10 separate greps
249
+ grep "pattern1" .
250
+ grep "pattern2" .
251
+ grep "pattern3" .
252
+ ...
253
+
254
+ # GOOD: single batched grep
255
+ grep "pattern1|pattern2|pattern3" .
256
+ ```
257
+
258
+ **Rule**: Batch patterns when possible. Grep is ~100 tokens, accumulates fast.
259
+
260
+ ---
261
+
262
+ ### ❌ Polling Loops
263
+
264
+ ```bash
265
+ # BAD: spins waiting
266
+ while [ ! -f .planning/STATE.md ]; do
267
+ sleep 1
268
+ done
269
+
270
+ # GOOD: immediate check or delegation
271
+ if [ ! -f .planning/STATE.md ]; then
272
+ error "STATE.md not found"
273
+ fi
274
+ ```
275
+
276
+ **Rule**: No sleep loops. Check once, escalate if needed.
277
+
278
+ ---
279
+
280
+ ## Summary
281
+
282
+ **Golden Rules:**
283
+
284
+ 1. **Frontmatter-first** when context < 500k
285
+ 2. **Path-based** delegation to agents
286
+ 3. **mid-tools** for all state operations
287
+ 4. **TOON** for all JSON output
288
+ 5. **Selective @include** for steps
289
+ 6. **Exact markers** for agent completion
290
+ 7. **Context guard** every workflow
291
+ 8. **Fast-fail** on errors (escalate immediately)
@@ -0,0 +1,157 @@
1
+ # Context Budget Guidelines
2
+
3
+ Structural guidelines for all workflows to stay within token budget.
4
+
5
+ ## Per-File Limits (hard constraints)
6
+
7
+ - **STATE.md**: Max 100 lines (YAML frontmatter only, no body)
8
+ - **PLAN.md**: Max 150 lines (task descriptions, no implementation)
9
+ - **SUMMARY.md**: Max 80 lines (results only, no verbose explanations)
10
+ - **PROJECT.md**: Max 200 lines (first 50 read, rest optional)
11
+ - **ROADMAP.md**: Max 100 lines (all phases must fit)
12
+
13
+ ## Workflow-Level Budget
14
+
15
+ Typical workflow token distribution:
16
+
17
+ ```
18
+ System prompt (workflow file): ~2-3K tokens
19
+ Agent definition (injected): ~1K tokens
20
+ Step fragments (selective @include): ~2-4K tokens
21
+ Context data (state, init payload): ~1-2K tokens
22
+ Output/completion: ~1K tokens
23
+
24
+ Total: ~7-11K tokens per workflow run
25
+ ```
26
+
27
+ ## Per-Agent Budget
28
+
29
+ When spawning agent:
30
+
31
+ ```
32
+ Agent definition: ~1K tokens
33
+ Agent context (task, findings): ~2-4K tokens
34
+ Agent output: ~3-5K tokens
35
+
36
+ Total agent spawn: ~6-10K tokens
37
+ ```
38
+
39
+ Max 3 agent spawns per workflow (18-30K tokens).
40
+
41
+ ## Token Optimization Strategies
42
+
43
+ ### 1. Selective @include of Steps
44
+
45
+ Instead of importing all steps, only include needed ones:
46
+
47
+ ```
48
+ # Good: surgical inclusion
49
+ @~/makeitdone/steps/init-gate.md
50
+ @~/makeitdone/steps/model-route.md
51
+
52
+ # Bad: monolithic inclusion
53
+ @~/makeitdone/steps/*.md
54
+ ```
55
+
56
+ ### 2. Lazy Agent Spawning
57
+
58
+ Default: no agents unless necessary.
59
+
60
+ ```
61
+ if research_required or --research flag:
62
+ spawn mid-researcher
63
+ else:
64
+ skip
65
+
66
+ if verification_needed:
67
+ spawn mid-verifier
68
+ else:
69
+ skip
70
+ ```
71
+
72
+ ### 3. Frontmatter-First Reads
73
+
74
+ Always check context_window:
75
+
76
+ ```
77
+ if context_window < 500k:
78
+ use: mid-tools fm get <file> --field <specific>
79
+ else:
80
+ use: normal Read
81
+ ```
82
+
83
+ ### 4. Batch Grep Queries
84
+
85
+ Instead of N separate grep calls:
86
+
87
+ ```
88
+ # Bad: 10 separate greps
89
+ grep "pattern1" ...
90
+ grep "pattern2" ...
91
+ grep "pattern3" ...
92
+
93
+ # Good: single grep with alternation
94
+ grep "pattern1|pattern2|pattern3" ...
95
+ ```
96
+
97
+ ### 5. Pass Paths, Not Contents
98
+
99
+ When delegating to agent:
100
+
101
+ ```
102
+ # Good: path-based
103
+ task: "Review PLAN.md at .planning/phases/01/PLAN.md"
104
+
105
+ # Bad: content-based
106
+ task: "Review this plan: [full 150-line PLAN.md content]"
107
+ ```
108
+
109
+ ## Context Tier Actions
110
+
111
+ ### POOR (< 300k)
112
+
113
+ - Frontmatter-only reads
114
+ - No agent spawning
115
+ - Return error: "Context too low for this workflow"
116
+
117
+ ### DEGRADING (300-500k)
118
+
119
+ - Frontmatter-only reads
120
+ - Single agent max (critical path only)
121
+ - Skip optional research
122
+ - Use haiku exclusively
123
+
124
+ ### GOOD (500k-1M)
125
+
126
+ - Full reads enabled
127
+ - Up to 3 agents
128
+ - Model routing by profile
129
+ - Research optional
130
+
131
+ ### PEAK (> 1M)
132
+
133
+ - All features enabled
134
+ - Full parallelization
135
+ - Multiple agents
136
+ - Synthesis work enabled
137
+
138
+ ## Budget Worksheet (for phase plan creators)
139
+
140
+ When creating PLAN.md, estimate waves:
141
+
142
+ ```
143
+ Rough formula:
144
+ - Each wave: ~5-10 tasks
145
+ - Each task: ~10-15 lines in PLAN.md
146
+ - Max PLAN.md: 150 lines
147
+
148
+ If tasks > 10, split into 2+ waves
149
+ If PLAN.md approaches 150 lines, create secondary phase plan
150
+ ```
151
+
152
+ ## Anti-patterns
153
+
154
+ - Loading all documentation at once (use frontmatter)
155
+ - Reading files when context_window < 500k (use mid-tools fm)
156
+ - Creating large context data structures (use TOON, not JSON)
157
+ - Spawning multiple agents per wave (1 executor, 1 verifier max)
@@ -0,0 +1,42 @@
1
+ # Init Gate Pattern
2
+
3
+ Token-optimized initialization payload pattern. Use this in any workflow that needs fresh execution context.
4
+
5
+ ## Pattern
6
+
7
+ ```bash
8
+ PAYLOAD=$(node ~/.claude/makeitdone/bin/mid-tools.cjs init <workflow> <phase>)
9
+ ```
10
+
11
+ The PAYLOAD contains (in TOON format):
12
+ - `phase_dir`: Full path to current phase directory
13
+ - `plans`: List of all PLAN.md files in phase
14
+ - `incomplete_plans`: Plans without SUMMARY.md (not yet done)
15
+ - `branch_name`: Conventional branch name `phase-{number}`
16
+ - `parallelization`: true if multiple plans (waves enabled)
17
+ - `executor_model`: Model routed for execution (sonnet/haiku based on profile)
18
+ - `verifier_model`: Model routed for verification (haiku/sonnet)
19
+ - `context_window`: Token budget from config.json
20
+ - `model_profile`: Current profile (budget/balanced/quality)
21
+
22
+ ## Usage in Workflows
23
+
24
+ At start of workflow:
25
+
26
+ ```
27
+ # Get fresh context
28
+ <context>
29
+ init_payload: (mid-tools init <workflow> <phase-number>)
30
+ </context>
31
+
32
+ Parse TOON payload:
33
+ - Extract phase_dir
34
+ - Extract incomplete_plans count
35
+ - Route models based on executor_model, verifier_model fields
36
+ ```
37
+
38
+ ## Token Savings
39
+
40
+ - TOON format saves ~40% vs JSON
41
+ - Only includes essential fields (not full phase history)
42
+ - Frontmatter-safe for context_window < 500k