declare-cc 0.2.0 → 0.3.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 (63) hide show
  1. package/README.md +126 -27
  2. package/agents/declare-codebase-mapper.md +761 -0
  3. package/agents/declare-debugger.md +1198 -0
  4. package/agents/declare-plan-checker.md +608 -0
  5. package/agents/declare-planner.md +1015 -0
  6. package/agents/declare-research-synthesizer.md +309 -0
  7. package/agents/declare-researcher.md +484 -0
  8. package/commands/declare/add-todo.md +41 -0
  9. package/commands/declare/audit.md +76 -0
  10. package/commands/declare/check-todos.md +125 -0
  11. package/commands/declare/complete-milestone.md +215 -0
  12. package/commands/declare/dashboard.md +76 -0
  13. package/commands/{gsd → declare}/debug.md +11 -11
  14. package/commands/declare/discuss.md +65 -0
  15. package/commands/declare/health.md +92 -0
  16. package/commands/declare/map-codebase.md +149 -0
  17. package/commands/declare/new-milestone.md +172 -0
  18. package/commands/declare/new-project.md +565 -0
  19. package/commands/declare/pause.md +138 -0
  20. package/commands/declare/plan.md +236 -0
  21. package/commands/declare/progress.md +116 -0
  22. package/commands/declare/quick.md +119 -0
  23. package/commands/declare/reapply-patches.md +178 -0
  24. package/commands/declare/research.md +267 -0
  25. package/commands/declare/resume.md +146 -0
  26. package/commands/declare/set-profile.md +66 -0
  27. package/commands/declare/settings.md +119 -0
  28. package/commands/declare/update.md +251 -0
  29. package/commands/declare/verify.md +64 -0
  30. package/dist/declare-tools.cjs +1234 -3
  31. package/package.json +1 -1
  32. package/workflows/discuss.md +476 -0
  33. package/workflows/verify.md +504 -0
  34. package/commands/gsd/add-phase.md +0 -39
  35. package/commands/gsd/add-todo.md +0 -42
  36. package/commands/gsd/audit-milestone.md +0 -42
  37. package/commands/gsd/check-todos.md +0 -41
  38. package/commands/gsd/cleanup.md +0 -18
  39. package/commands/gsd/complete-milestone.md +0 -136
  40. package/commands/gsd/discuss-phase.md +0 -87
  41. package/commands/gsd/execute-phase.md +0 -42
  42. package/commands/gsd/health.md +0 -22
  43. package/commands/gsd/help.md +0 -22
  44. package/commands/gsd/insert-phase.md +0 -33
  45. package/commands/gsd/join-discord.md +0 -18
  46. package/commands/gsd/list-phase-assumptions.md +0 -50
  47. package/commands/gsd/map-codebase.md +0 -71
  48. package/commands/gsd/new-milestone.md +0 -51
  49. package/commands/gsd/new-project.md +0 -42
  50. package/commands/gsd/new-project.md.bak +0 -1041
  51. package/commands/gsd/pause-work.md +0 -35
  52. package/commands/gsd/plan-milestone-gaps.md +0 -40
  53. package/commands/gsd/plan-phase.md +0 -44
  54. package/commands/gsd/progress.md +0 -24
  55. package/commands/gsd/quick.md +0 -40
  56. package/commands/gsd/reapply-patches.md +0 -110
  57. package/commands/gsd/remove-phase.md +0 -32
  58. package/commands/gsd/research-phase.md +0 -187
  59. package/commands/gsd/resume-work.md +0 -40
  60. package/commands/gsd/set-profile.md +0 -34
  61. package/commands/gsd/settings.md +0 -36
  62. package/commands/gsd/update.md +0 -37
  63. package/commands/gsd/verify-work.md +0 -39
@@ -0,0 +1,565 @@
1
+ ---
2
+ name: declare:new-project
3
+ description: Initialize a new project with deep context gathering, PROJECT.md, and STATE.md
4
+ argument-hint: "[--auto]"
5
+ allowed-tools:
6
+ - Read
7
+ - Write
8
+ - Bash
9
+ - Glob
10
+ - Grep
11
+ - Task
12
+ - AskUserQuestion
13
+ ---
14
+
15
+ <context>
16
+ **Flags:**
17
+ - `--auto` — Automatic mode. After config questions, runs research without further interaction. Expects idea document via @ reference.
18
+ </context>
19
+
20
+ <objective>
21
+ Initialize a new project through a unified flow: questioning → research (optional) → PROJECT.md → STATE.md → config.
22
+
23
+ **Creates:**
24
+ - `.planning/PROJECT.md` — persistent project context document
25
+ - `.planning/STATE.md` — session memory and decision log
26
+ - `.planning/config.json` — workflow preferences
27
+ - `.planning/research/` — domain research (optional, 4 parallel agents)
28
+
29
+ **After this command:** Run `/declare:future` to declare the project's futures (desired outcomes), then `/declare:milestones` to plan how to achieve them.
30
+ </objective>
31
+
32
+ <process>
33
+
34
+ ## 1. Setup
35
+
36
+ **MANDATORY FIRST STEP — Run before any user interaction:**
37
+
38
+ ```bash
39
+ mkdir -p .planning
40
+ ```
41
+
42
+ Check if project already exists:
43
+
44
+ ```bash
45
+ [ -f ".planning/PROJECT.md" ] && echo "EXISTS" || echo "NEW"
46
+ ```
47
+
48
+ **If PROJECT.md already exists:** Tell the user the project is already initialized, show the contents of `.planning/PROJECT.md`, and suggest running `/declare:status` to see current state. Exit.
49
+
50
+ Check git status:
51
+
52
+ ```bash
53
+ git rev-parse --git-dir 2>/dev/null && echo "HAS_GIT" || echo "NO_GIT"
54
+ ```
55
+
56
+ **If no git repo:** Initialize git:
57
+
58
+ ```bash
59
+ git init
60
+ ```
61
+
62
+ ## 2. Auto Mode Detection
63
+
64
+ Check if `--auto` flag is present in $ARGUMENTS.
65
+
66
+ **If auto mode:**
67
+ - Skip deep questioning (extract context from provided document)
68
+ - An idea document must be present — either:
69
+ - File reference: `/declare:new-project --auto @prd.md`
70
+ - Pasted/written text in the prompt
71
+ - If no document content found, error:
72
+
73
+ ```
74
+ Error: --auto requires an idea document.
75
+
76
+ Usage:
77
+ /declare:new-project --auto @your-idea.md
78
+ /declare:new-project --auto [paste or write your idea here]
79
+
80
+ The document should describe what you want to build.
81
+ ```
82
+
83
+ Skip to Step 4 (auto mode skips deep questioning).
84
+
85
+ ## 3. Deep Questioning
86
+
87
+ **Display stage banner:**
88
+
89
+ ```
90
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
91
+ DECLARE ► QUESTIONING
92
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
93
+ ```
94
+
95
+ **Open the conversation:**
96
+
97
+ Ask inline (freeform, NOT AskUserQuestion):
98
+
99
+ "What do you want to build?"
100
+
101
+ Wait for their response. This gives you the context needed to ask intelligent follow-up questions.
102
+
103
+ **Follow the thread:**
104
+
105
+ Based on what they said, ask follow-up questions that dig into their response. Use AskUserQuestion with options that probe what they mentioned — interpretations, clarifications, concrete examples.
106
+
107
+ Keep following threads. Each answer opens new threads to explore. Ask about:
108
+ - What problem sparked this project
109
+ - What domain or industry it lives in
110
+ - Who uses it and what they achieve
111
+ - What's already decided (tech stack, integrations, constraints)
112
+ - What success looks like in 6 months
113
+ - What existing tools they've tried and why those fall short
114
+ - What they explicitly want to avoid building
115
+
116
+ **Surface the core value:**
117
+
118
+ Push toward articulating the ONE thing the project does better than anything else. The core value statement should be a single sentence that would make a potential user say "yes, that's exactly what I need."
119
+
120
+ **Decision gate:**
121
+
122
+ When you could write a clear PROJECT.md, use AskUserQuestion:
123
+
124
+ - header: "Ready?"
125
+ - question: "I think I understand what you're building. Ready to create PROJECT.md?"
126
+ - options:
127
+ - "Create PROJECT.md" — Let's move forward
128
+ - "Keep exploring" — I want to share more / ask me more
129
+
130
+ If "Keep exploring" — ask what they want to add, or identify gaps and probe naturally.
131
+
132
+ Loop until "Create PROJECT.md" selected.
133
+
134
+ ## 4. Write PROJECT.md
135
+
136
+ **If auto mode:** Synthesize context from provided document. Proceed directly after writing.
137
+
138
+ Synthesize all context gathered into `.planning/PROJECT.md` using this format:
139
+
140
+ ```markdown
141
+ # [Project Name]
142
+
143
+ ## What This Is
144
+
145
+ [1-2 sentence description of what the project does and who it's for]
146
+
147
+ ## Core Value
148
+
149
+ [The main value proposition — the ONE thing this does better than alternatives]
150
+
151
+ ## Current State
152
+
153
+ [What's been built so far. For new projects: "Not yet started — planning phase."]
154
+
155
+ ## Constraints
156
+
157
+ [Tech stack choices, compatibility requirements, things that must or cannot be used]
158
+
159
+ ## Key Decisions
160
+
161
+ | Decision | Rationale | Date |
162
+ |----------|-----------|------|
163
+ | [First decision from questioning] | [Why] | [today] |
164
+
165
+ ---
166
+ *Last updated: [date] after initialization*
167
+ ```
168
+
169
+ Write the file:
170
+
171
+ ```bash
172
+ # Use Write tool to create .planning/PROJECT.md
173
+ ```
174
+
175
+ **Commit PROJECT.md:**
176
+
177
+ ```bash
178
+ node dist/declare-tools.cjs commit "docs: initialize project context" --files .planning/PROJECT.md
179
+ ```
180
+
181
+ ## 5. Workflow Preferences
182
+
183
+ **If auto mode:** Use defaults — interactive mode, balanced model profile, research enabled, plan_check enabled. Skip to Step 5.5.
184
+
185
+ **Round 1 — Core settings:**
186
+
187
+ ```
188
+ AskUserQuestion([
189
+ {
190
+ header: "Mode",
191
+ question: "How do you want to work?",
192
+ multiSelect: false,
193
+ options: [
194
+ { label: "Interactive (Recommended)", description: "Confirm key decisions, stay in the loop" },
195
+ { label: "Auto", description: "Execute without interruptions — trust the agents" }
196
+ ]
197
+ },
198
+ {
199
+ header: "Git Tracking",
200
+ question: "Commit planning docs to git?",
201
+ multiSelect: false,
202
+ options: [
203
+ { label: "Yes (Recommended)", description: "Planning docs tracked in version control" },
204
+ { label: "No", description: "Keep .planning/ local-only (add to .gitignore)" }
205
+ ]
206
+ }
207
+ ])
208
+ ```
209
+
210
+ **Round 2 — Workflow agents:**
211
+
212
+ ```
213
+ AskUserQuestion([
214
+ {
215
+ header: "Research",
216
+ question: "Research the domain before planning? (adds tokens/time, improves quality)",
217
+ multiSelect: false,
218
+ options: [
219
+ { label: "Yes (Recommended)", description: "Discover patterns, gotchas, standard approaches" },
220
+ { label: "No", description: "Plan directly from what we discussed" }
221
+ ]
222
+ },
223
+ {
224
+ header: "Plan Check",
225
+ question: "Verify plans will achieve their goals? (adds tokens/time)",
226
+ multiSelect: false,
227
+ options: [
228
+ { label: "Yes (Recommended)", description: "Catch gaps before execution starts" },
229
+ { label: "No", description: "Execute plans without verification" }
230
+ ]
231
+ },
232
+ {
233
+ header: "AI Models",
234
+ question: "Which AI models for planning agents?",
235
+ multiSelect: false,
236
+ options: [
237
+ { label: "Balanced (Recommended)", description: "Sonnet for most agents — good quality/cost ratio" },
238
+ { label: "Quality", description: "Opus for research/roadmap — higher cost, deeper analysis" },
239
+ { label: "Budget", description: "Haiku where possible — fastest, lowest cost" }
240
+ ]
241
+ }
242
+ ])
243
+ ```
244
+
245
+ Create `.planning/config.json`:
246
+
247
+ ```json
248
+ {
249
+ "mode": "interactive|auto",
250
+ "commit_docs": true|false,
251
+ "model_profile": "quality|balanced|budget",
252
+ "workflow": {
253
+ "research": true|false,
254
+ "plan_check": true|false,
255
+ "auto_advance": false
256
+ }
257
+ }
258
+ ```
259
+
260
+ **If commit_docs = No:** Add `.planning/` to `.gitignore` (create if needed).
261
+
262
+ **Commit config.json:**
263
+
264
+ ```bash
265
+ node dist/declare-tools.cjs commit "chore: add project config" --files .planning/config.json
266
+ ```
267
+
268
+ ## 5.5. Initialize STATE.md
269
+
270
+ Create `.planning/STATE.md` with the project initialized:
271
+
272
+ ```markdown
273
+ # Project State
274
+
275
+ **Last Updated:** [today]
276
+ **Current Position:** Project initialized — ready for /declare:future
277
+
278
+ ## Recent Work
279
+
280
+ Project initialized via /declare:new-project. PROJECT.md written with project context.
281
+
282
+ ## Decisions Made
283
+
284
+ | Decision | Rationale | Date |
285
+ |----------|-----------|------|
286
+ | [Key decisions from questioning] | [Rationale] | [today] |
287
+
288
+ ## Blockers
289
+
290
+ (none)
291
+
292
+ ## Session History
293
+
294
+ | Date | Stopped At | Resume File |
295
+ |------|------------|-------------|
296
+ | [today] | Initialized project | /declare:future |
297
+ ```
298
+
299
+ **Commit STATE.md:**
300
+
301
+ ```bash
302
+ node dist/declare-tools.cjs commit "docs: initialize project state" --files .planning/STATE.md
303
+ ```
304
+
305
+ ## 6. Research Decision
306
+
307
+ **If workflow.research = false or auto mode with research disabled:** Skip to Step 7.
308
+
309
+ **If auto mode with research enabled:** Default to research. Skip the question.
310
+
311
+ **Interactive mode — ask:**
312
+
313
+ Use AskUserQuestion:
314
+ - header: "Research"
315
+ - question: "Run domain research now? (4 parallel agents, 2-5 minutes)"
316
+ - options:
317
+ - "Research now (Recommended)" — Discover standard approaches, pitfalls, architecture patterns
318
+ - "Skip research" — I know this domain well, proceed to next steps
319
+
320
+ **If research selected:**
321
+
322
+ Display stage banner:
323
+ ```
324
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
325
+ DECLARE ► RESEARCHING
326
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
327
+
328
+ Researching [domain] ecosystem...
329
+ ◆ Spawning 4 researchers in parallel...
330
+ → Stack research
331
+ → Features research
332
+ → Architecture research
333
+ → Pitfalls research
334
+ ```
335
+
336
+ Create research directory:
337
+ ```bash
338
+ mkdir -p .planning/research
339
+ ```
340
+
341
+ Spawn 4 parallel research agents:
342
+
343
+ ```
344
+ Task(prompt="You are a domain researcher for the Declare project planning system.
345
+
346
+ <research_type>
347
+ Project Research — Stack dimension for [domain].
348
+ </research_type>
349
+
350
+ <question>
351
+ What is the standard 2025-2026 stack for building [domain]? What libraries, frameworks, and tools are production-ready?
352
+ </question>
353
+
354
+ <project_context>
355
+ [PROJECT.md content — what they're building, constraints, core value]
356
+ </project_context>
357
+
358
+ <output_requirements>
359
+ Write your findings to .planning/research/STACK.md
360
+
361
+ Format:
362
+ # Stack Research: [Domain]
363
+
364
+ ## Recommended Stack
365
+ [Library/framework with version, rationale, confidence level]
366
+
367
+ ## What NOT to Use
368
+ [Alternatives to avoid and why]
369
+
370
+ ## Key Tradeoffs
371
+ [Most important choices and their implications]
372
+
373
+ Quality bar: versions must be current (not from training data — verify with docs), rationale must explain WHY not just WHAT.
374
+ </output_requirements>
375
+ ", subagent_type="general-purpose", description="Stack research for [domain]")
376
+
377
+ Task(prompt="You are a domain researcher for the Declare project planning system.
378
+
379
+ <research_type>
380
+ Project Research — Features dimension for [domain].
381
+ </research_type>
382
+
383
+ <question>
384
+ What features do [domain] products have? What is table stakes (users expect it) vs differentiating (competitive advantage)?
385
+ </question>
386
+
387
+ <project_context>
388
+ [PROJECT.md content]
389
+ </project_context>
390
+
391
+ <output_requirements>
392
+ Write your findings to .planning/research/FEATURES.md
393
+
394
+ Format:
395
+ # Features Research: [Domain]
396
+
397
+ ## Table Stakes
398
+ [Features users expect — missing these causes abandonment]
399
+
400
+ ## Differentiators
401
+ [Features that create competitive advantage]
402
+
403
+ ## Anti-Features
404
+ [Things to deliberately NOT build — why they're traps]
405
+
406
+ ## Complexity Notes
407
+ [Which features are deceptively hard, which look hard but aren't]
408
+ </output_requirements>
409
+ ", subagent_type="general-purpose", description="Features research for [domain]")
410
+
411
+ Task(prompt="You are a domain researcher for the Declare project planning system.
412
+
413
+ <research_type>
414
+ Project Research — Architecture dimension for [domain].
415
+ </research_type>
416
+
417
+ <question>
418
+ How are [domain] systems typically structured? What are the major components, how do they interact, and what's the natural build order?
419
+ </question>
420
+
421
+ <project_context>
422
+ [PROJECT.md content]
423
+ </project_context>
424
+
425
+ <output_requirements>
426
+ Write your findings to .planning/research/ARCHITECTURE.md
427
+
428
+ Format:
429
+ # Architecture Research: [Domain]
430
+
431
+ ## Component Map
432
+ [Major components and their boundaries]
433
+
434
+ ## Data Flow
435
+ [How information moves through the system]
436
+
437
+ ## Build Order
438
+ [Natural sequence for building — what depends on what]
439
+
440
+ ## Common Patterns
441
+ [Established architectural patterns for this domain]
442
+ </output_requirements>
443
+ ", subagent_type="general-purpose", description="Architecture research for [domain]")
444
+
445
+ Task(prompt="You are a domain researcher for the Declare project planning system.
446
+
447
+ <research_type>
448
+ Project Research — Pitfalls dimension for [domain].
449
+ </research_type>
450
+
451
+ <question>
452
+ What do [domain] projects commonly get wrong? What are the critical mistakes, hidden complexity traps, and decisions that seem right but cause problems later?
453
+ </question>
454
+
455
+ <project_context>
456
+ [PROJECT.md content]
457
+ </project_context>
458
+
459
+ <output_requirements>
460
+ Write your findings to .planning/research/PITFALLS.md
461
+
462
+ Format:
463
+ # Pitfalls Research: [Domain]
464
+
465
+ ## Critical Mistakes
466
+ [Mistakes that cause project failure or major rework]
467
+
468
+ ## Hidden Complexity
469
+ [Features that look simple but are actually hard]
470
+
471
+ ## Prevention Strategies
472
+ [How to avoid each pitfall]
473
+
474
+ ## Early Warning Signs
475
+ [How to detect you're heading toward a pitfall]
476
+ </output_requirements>
477
+ ", subagent_type="general-purpose", description="Pitfalls research for [domain]")
478
+ ```
479
+
480
+ Wait for all 4 agents to complete. Then display:
481
+
482
+ ```
483
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
484
+ DECLARE ► RESEARCH COMPLETE
485
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
486
+
487
+ Research files: .planning/research/
488
+ STACK.md — technology choices
489
+ FEATURES.md — table stakes vs differentiators
490
+ ARCHITECTURE.md — component structure
491
+ PITFALLS.md — what to watch out for
492
+ ```
493
+
494
+ Commit research files:
495
+
496
+ ```bash
497
+ node dist/declare-tools.cjs commit "docs: add domain research" --files .planning/research/STACK.md .planning/research/FEATURES.md .planning/research/ARCHITECTURE.md .planning/research/PITFALLS.md
498
+ ```
499
+
500
+ ## 7. Done
501
+
502
+ Record the session:
503
+
504
+ ```bash
505
+ node dist/declare-tools.cjs record-session --stopped-at "Project initialized" --resume-file "/declare:future"
506
+ ```
507
+
508
+ Present completion summary:
509
+
510
+ ```
511
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
512
+ DECLARE ► PROJECT INITIALIZED
513
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
514
+
515
+ **[Project Name]**
516
+ [Core value — one sentence]
517
+
518
+ | Artifact | Location |
519
+ |---------------|---------------------------|
520
+ | Project | .planning/PROJECT.md |
521
+ | State | .planning/STATE.md |
522
+ | Config | .planning/config.json |
523
+ | Research | .planning/research/ |
524
+
525
+ ───────────────────────────────────────────────────────
526
+
527
+ ## Next Up
528
+
529
+ Declare the futures (desired outcomes) you want to achieve:
530
+
531
+ /declare:future
532
+
533
+ This creates the declaration graph that all milestones and actions will be traced back to.
534
+
535
+ Also available:
536
+ - /declare:status — see graph state
537
+ - /declare:help — full command reference
538
+
539
+ ───────────────────────────────────────────────────────
540
+ ```
541
+
542
+ </process>
543
+
544
+ <output>
545
+ - `.planning/PROJECT.md` — project context (committed)
546
+ - `.planning/STATE.md` — session memory initialized (committed)
547
+ - `.planning/config.json` — workflow preferences (committed)
548
+ - `.planning/research/STACK.md` — if research selected (committed)
549
+ - `.planning/research/FEATURES.md` — if research selected (committed)
550
+ - `.planning/research/ARCHITECTURE.md` — if research selected (committed)
551
+ - `.planning/research/PITFALLS.md` — if research selected (committed)
552
+ </output>
553
+
554
+ <success_criteria>
555
+ - [ ] .planning/ directory created
556
+ - [ ] Git repo initialized (if needed)
557
+ - [ ] Existing project detection: error shown if already initialized
558
+ - [ ] Deep questioning completed (threads followed, not rushed)
559
+ - [ ] PROJECT.md captures full context → committed
560
+ - [ ] config.json has mode, commit_docs, model_profile, workflow settings → committed
561
+ - [ ] STATE.md initialized with session record → committed
562
+ - [ ] Research completed if selected (4 parallel agents spawned) → committed
563
+ - [ ] User knows next step is /declare:future
564
+ - [ ] record-session called at completion
565
+ </success_criteria>
@@ -0,0 +1,138 @@
1
+ ---
2
+ name: declare:pause
3
+ description: Capture current work state into .continue-here.md and commit it for safe resumption
4
+ allowed-tools:
5
+ - Read
6
+ - Write
7
+ - Bash
8
+ - Glob
9
+ - Grep
10
+ ---
11
+
12
+ Capture the current work state and create a `.continue-here.md` handoff file so work can be resumed cleanly in a future session.
13
+
14
+ **Step 1: Load current state.**
15
+
16
+ Run:
17
+
18
+ ```bash
19
+ node dist/declare-tools.cjs get-state
20
+ ```
21
+
22
+ ```bash
23
+ node dist/declare-tools.cjs load-graph
24
+ ```
25
+
26
+ Parse both JSON outputs.
27
+
28
+ If `get-state` returns an error, display:
29
+
30
+ ```
31
+ No STATE.md found. Nothing to pause — run /declare:new-project to initialize.
32
+ ```
33
+
34
+ Then stop.
35
+
36
+ **Step 2: Gather current position.**
37
+
38
+ From `get-state` extract:
39
+ - `currentPosition`: active milestone/action
40
+ - `recentWork`: what was last done
41
+ - `decisions`: recent decisions
42
+ - `blockers`: any recorded blockers
43
+
44
+ From `load-graph` find:
45
+ - The active milestone (status `ACTIVE`) and its ID/title
46
+ - Its actions: separate into DONE and PENDING lists
47
+ - Any blockers explicitly noted in the graph
48
+
49
+ **Step 3: Build the handoff file content.**
50
+
51
+ Construct `.continue-here.md` with this structure:
52
+
53
+ ```markdown
54
+ # Continue Here
55
+
56
+ **Paused:** [ISO timestamp, e.g., 2026-02-17T14:30:00Z]
57
+ **Position:** [currentPosition from STATE.md]
58
+
59
+ ## Active Milestone
60
+
61
+ **[M-XX]: [title]** (status: [ACTIVE/PENDING])
62
+
63
+ ## Completed Actions
64
+
65
+ [List each DONE action:]
66
+ - [A-XX]: [title]
67
+
68
+ (or "None yet" if no actions are done)
69
+
70
+ ## Remaining Actions
71
+
72
+ [List each PENDING action:]
73
+ - [A-XX]: [title]
74
+
75
+ (or "None — milestone may be ready for verification" if all done)
76
+
77
+ ## Decisions Made This Session
78
+
79
+ [decisions content from STATE.md, or "(none recorded)"]
80
+
81
+ ## Blockers
82
+
83
+ [blockers content from STATE.md, or "(none)"]
84
+
85
+ ## Recent Work
86
+
87
+ [recentWork content from STATE.md]
88
+
89
+ ## Resume Instructions
90
+
91
+ Run `/declare:resume` to restore this context in a new session.
92
+
93
+ Or resume manually:
94
+ 1. Read this file
95
+ 2. Check `.planning/STATE.md` for full project state
96
+ 3. Run `node dist/declare-tools.cjs load-graph` to see the full graph
97
+ 4. Continue with the first PENDING action listed above
98
+ ```
99
+
100
+ Use the current UTC timestamp (from `date -u +"%Y-%m-%dT%H:%M:%SZ"` or equivalent).
101
+
102
+ **Step 4: Write the handoff file.**
103
+
104
+ Write the constructed content to `.continue-here.md` at the project root.
105
+
106
+ **Step 5: Record session in STATE.md.**
107
+
108
+ ```bash
109
+ node dist/declare-tools.cjs record-session \
110
+ --stopped-at "[currentPosition]" \
111
+ --resume-file ".continue-here.md"
112
+ ```
113
+
114
+ **Step 6: Commit the handoff file.**
115
+
116
+ ```bash
117
+ node dist/declare-tools.cjs commit "chore: pause work — [currentPosition]" \
118
+ --files .continue-here.md .planning/STATE.md
119
+ ```
120
+
121
+ Parse the JSON result. If `committed` is false and `reason` is `nothing_to_commit`, that is acceptable — the state is already saved.
122
+
123
+ **Step 7: Display confirmation.**
124
+
125
+ ```
126
+ ## Work Paused
127
+
128
+ **Position captured:** [currentPosition]
129
+ **Handoff file:** .continue-here.md
130
+ **Session recorded:** .planning/STATE.md
131
+
132
+ Paused. Run /declare:resume to restore context in a new session.
133
+ ```
134
+
135
+ **Error handling:**
136
+
137
+ - If `load-graph` returns an error: still write `.continue-here.md` using only the STATE.md data. Note "Graph data unavailable" in the Remaining Actions section.
138
+ - If commit fails for reasons other than nothing_to_commit: display the error and note the file was written but not committed. User should commit manually.