declare-cc 0.1.0 → 0.2.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/commands/declare/actions.md +41 -20
- package/commands/declare/execute.md +518 -0
- package/commands/declare/help.md +31 -0
- package/commands/declare/init.md +36 -0
- package/commands/declare/milestones.md +7 -7
- package/commands/declare/prioritize.md +65 -0
- package/commands/declare/status.md +14 -11
- package/commands/declare/trace.md +81 -0
- package/commands/declare/visualize.md +74 -0
- package/package.json +4 -2
- package/templates/future.md +4 -0
- package/templates/milestones.md +11 -0
- package/workflows/actions.md +89 -0
- package/workflows/future.md +185 -0
- package/workflows/milestones.md +87 -0
|
@@ -7,7 +7,7 @@ allowed-tools:
|
|
|
7
7
|
- Glob
|
|
8
8
|
- Grep
|
|
9
9
|
- AskUserQuestion
|
|
10
|
-
argument-hint: "[M-XX]"
|
|
10
|
+
argument-hint: "[M-XX] [--auto]"
|
|
11
11
|
---
|
|
12
12
|
|
|
13
13
|
Derive action plans for milestones by working backward from what must be done.
|
|
@@ -15,7 +15,7 @@ Derive action plans for milestones by working backward from what must be done.
|
|
|
15
15
|
**Step 1: Load current graph state.**
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
|
-
node
|
|
18
|
+
node dist/declare-tools.cjs load-graph
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
Parse the JSON output. If the output contains an `error` field, tell the user to run `/declare:init` first and stop.
|
|
@@ -24,28 +24,23 @@ If no milestones exist in the graph, tell the user to run `/declare:milestones`
|
|
|
24
24
|
|
|
25
25
|
Note all milestones and their current plan status from the graph.
|
|
26
26
|
|
|
27
|
-
**Step 2: Determine scope.**
|
|
27
|
+
**Step 2: Determine scope and mode.**
|
|
28
28
|
|
|
29
29
|
- If `$ARGUMENTS` contains a milestone ID (e.g., `M-01`), derive only for that milestone.
|
|
30
30
|
- Otherwise, derive for all milestones that don't have a plan yet (milestones where `hasPlan` is false or no PLAN.md folder exists).
|
|
31
|
+
- If `$ARGUMENTS` contains `--auto`, use **auto mode** (see Step 3b). Otherwise use **interactive mode** (Step 3a).
|
|
31
32
|
|
|
32
33
|
If all milestones already have plans and no specific milestone was requested, tell the user: "All milestones already have action plans. Run `/declare:status` to see coverage."
|
|
33
34
|
|
|
34
|
-
**Step
|
|
35
|
+
**Step 3a: Interactive mode (default) — per-milestone approval.**
|
|
35
36
|
|
|
36
|
-
Read and follow the
|
|
37
|
+
Read and follow the workflow:
|
|
37
38
|
|
|
38
|
-
|
|
39
|
+
@workflows/actions.md
|
|
39
40
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
**Step 4: For each milestone, derive and present plan for approval.**
|
|
43
|
-
|
|
44
|
-
The workflow derives actions for each milestone. After derivation, present the complete plan and ask for approval using AskUserQuestion:
|
|
41
|
+
For each milestone, derive and present the plan, then ask for approval using AskUserQuestion:
|
|
45
42
|
|
|
46
43
|
```
|
|
47
|
-
Use AskUserQuestion to ask the user to approve the derived plan for each milestone.
|
|
48
|
-
|
|
49
44
|
Proposed plan for M-XX "[milestone title]":
|
|
50
45
|
- A-XX: [action title] -- produces [what]
|
|
51
46
|
- A-XX: [action title] -- produces [what]
|
|
@@ -55,23 +50,49 @@ Approve this plan? (yes/adjust/skip)
|
|
|
55
50
|
|
|
56
51
|
If the user wants adjustments, adjust and re-present. If they skip, move to the next milestone.
|
|
57
52
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
For each approved plan, call create-plan:
|
|
53
|
+
After approval, persist:
|
|
61
54
|
|
|
62
55
|
```bash
|
|
63
|
-
node
|
|
56
|
+
node dist/declare-tools.cjs create-plan --milestone "M-XX" --actions '[{"title":"Action Title","produces":"what it creates"}]'
|
|
64
57
|
```
|
|
65
58
|
|
|
66
|
-
|
|
59
|
+
**Step 3b: Auto mode (`--auto`) — derive all, present once, persist all.**
|
|
60
|
+
|
|
61
|
+
Derive action plans for ALL milestones in scope without pausing between them. Use the same backward derivation logic from the workflow, but skip all AskUserQuestion prompts.
|
|
62
|
+
|
|
63
|
+
After deriving all plans:
|
|
64
|
+
|
|
65
|
+
1. Present the complete set as one summary:
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
## Derived Action Plans
|
|
69
|
+
|
|
70
|
+
### M-01: [title]
|
|
71
|
+
1. [Action A] -- produces [what]
|
|
72
|
+
2. [Action B] -- produces [what]
|
|
73
|
+
|
|
74
|
+
### M-02: [title]
|
|
75
|
+
1. [Action A] -- produces [what]
|
|
76
|
+
2. [Action B] -- produces [what]
|
|
77
|
+
|
|
78
|
+
...
|
|
79
|
+
|
|
80
|
+
Total: X milestones, Y actions
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
2. Ask ONE confirmation using AskUserQuestion: "Create all plans?" with options: "Yes, create all" / "Let me adjust first"
|
|
84
|
+
|
|
85
|
+
3. If approved, persist ALL plans by calling create-plan for each milestone (these are fast — just file writes + commits).
|
|
86
|
+
|
|
87
|
+
4. If the user wants adjustments, let them specify which milestones to adjust, adjust, then re-present.
|
|
67
88
|
|
|
68
|
-
**Step
|
|
89
|
+
**Step 4: Show summary and suggest next step.**
|
|
69
90
|
|
|
70
91
|
After all milestones processed:
|
|
71
92
|
|
|
72
93
|
1. Reload the graph to get final counts:
|
|
73
94
|
```bash
|
|
74
|
-
node
|
|
95
|
+
node dist/declare-tools.cjs load-graph
|
|
75
96
|
```
|
|
76
97
|
|
|
77
98
|
2. Show summary: milestones processed, plans created, total actions derived.
|
|
@@ -0,0 +1,518 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Execute actions for a milestone with wave-based scheduling and upward verification
|
|
3
|
+
allowed-tools:
|
|
4
|
+
- Read
|
|
5
|
+
- Write
|
|
6
|
+
- Bash
|
|
7
|
+
- Glob
|
|
8
|
+
- Grep
|
|
9
|
+
- Task
|
|
10
|
+
argument-hint: "[M-XX] [--confirm]"
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
Execute all pending actions for a milestone using wave-based scheduling, parallel agent spawning, per-wave verification, and automatic milestone completion.
|
|
14
|
+
|
|
15
|
+
**Step 1: Determine milestone scope.**
|
|
16
|
+
|
|
17
|
+
Parse `$ARGUMENTS` for a milestone ID (matching pattern `M-XX`) and a `--confirm` flag.
|
|
18
|
+
|
|
19
|
+
If `$ARGUMENTS` contains a milestone ID, use it directly and proceed to Step 2.
|
|
20
|
+
|
|
21
|
+
If `$ARGUMENTS` is empty or contains no milestone ID (interactive mode):
|
|
22
|
+
- Run the milestone picker:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
node dist/declare-tools.cjs execute
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
- Parse the JSON output. It contains a `milestones` array with `{id, title, status, actionCount, doneCount}` objects.
|
|
29
|
+
- Display a numbered list:
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
## Select a Milestone to Execute
|
|
33
|
+
|
|
34
|
+
1. M-01: [title] — [status] ([doneCount]/[actionCount] actions done)
|
|
35
|
+
2. M-02: [title] — [status] ([doneCount]/[actionCount] actions done)
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
- Ask the user: "Which milestone would you like to execute? Provide the ID (e.g., M-01)."
|
|
39
|
+
- Wait for the user's response, then use their provided ID in Step 2.
|
|
40
|
+
|
|
41
|
+
Check if `--confirm` is present in `$ARGUMENTS`. If so, pause between waves for user review.
|
|
42
|
+
|
|
43
|
+
**Step 2: Load execution data.**
|
|
44
|
+
|
|
45
|
+
Run:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
node dist/declare-tools.cjs execute --milestone M-XX
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Parse the JSON output.
|
|
52
|
+
|
|
53
|
+
If `allDone` is true:
|
|
54
|
+
- Display: "All actions for M-XX are already complete. Milestone status: [status]"
|
|
55
|
+
- Exit.
|
|
56
|
+
|
|
57
|
+
Display a banner:
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
## Executing: M-XX — [milestoneTitle]
|
|
61
|
+
|
|
62
|
+
**Declarations:** [for each declaration: "D-XX (title)"]
|
|
63
|
+
**Actions:** [pendingCount] pending of [totalActions] total | **Waves:** [waves.length]
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
**Step 2.5: Check for drift.**
|
|
67
|
+
|
|
68
|
+
Before executing waves, check whether any nodes have drifted from the declared future.
|
|
69
|
+
|
|
70
|
+
Run:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
node dist/declare-tools.cjs check-drift
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Parse the JSON output.
|
|
77
|
+
|
|
78
|
+
If `hasDrift` is true:
|
|
79
|
+
- Display a drift warning:
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
## Drift Detected
|
|
83
|
+
|
|
84
|
+
The following nodes have no causation path to any declaration:
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
For each drifted node in `driftedNodes`, display:
|
|
88
|
+
```
|
|
89
|
+
- [type] [id]: [title] (status: [status])
|
|
90
|
+
Suggestions:
|
|
91
|
+
- Connect to [suggestion.target] ([suggestion.targetTitle]) -- [suggestion.reason]
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Then ask: "Drifted nodes detected. Continue execution anyway? (yes/no/fix)"
|
|
95
|
+
- "yes" -> proceed with execution
|
|
96
|
+
- "no" -> abort execution
|
|
97
|
+
- "fix" -> suggest the user run /declare:milestones or manually edit MILESTONES.md/PLAN.md to reconnect orphaned nodes, then retry
|
|
98
|
+
|
|
99
|
+
This is a SOFT BLOCK -- warn but allow continuation.
|
|
100
|
+
|
|
101
|
+
If `hasDrift` is false: proceed silently.
|
|
102
|
+
|
|
103
|
+
**Step 3: For each wave, execute actions.**
|
|
104
|
+
|
|
105
|
+
Iterate over each wave in the `waves` array:
|
|
106
|
+
|
|
107
|
+
**3a. Generate exec plans (on-demand, per wave):**
|
|
108
|
+
|
|
109
|
+
For each action in the wave:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
node dist/declare-tools.cjs generate-exec-plan --action A-XX --milestone M-XX --wave N
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Parse the JSON output and note the `outputPath` for each action.
|
|
116
|
+
|
|
117
|
+
If any generation returns an error, display it and suggest fixes (e.g., "Run /declare:actions first to create the milestone plan folder").
|
|
118
|
+
|
|
119
|
+
**3b. Display wave banner:**
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
--- Wave N of [total waves] ---
|
|
123
|
+
**Actions:** A-XX ([title]), A-XX ([title])
|
|
124
|
+
Spawning [count] agent(s)...
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
**3c. Spawn executor agents in parallel using the Task tool:**
|
|
128
|
+
|
|
129
|
+
For each action in the wave, spawn a Task with instructions like:
|
|
130
|
+
|
|
131
|
+
```
|
|
132
|
+
Execute the plan at [outputPath].
|
|
133
|
+
|
|
134
|
+
Read the EXEC-PLAN file at the path above. Follow all tasks described in it.
|
|
135
|
+
Make atomic commits per task. When complete, report:
|
|
136
|
+
- What was done
|
|
137
|
+
- Files created or modified
|
|
138
|
+
- Commit hashes
|
|
139
|
+
- Any issues encountered
|
|
140
|
+
|
|
141
|
+
Context: This action is part of milestone M-XX ([milestoneTitle]).
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Use one Task tool call per action. If the wave has multiple actions, spawn them all in the same response so they execute in parallel.
|
|
145
|
+
|
|
146
|
+
**3d. After all agents in the wave complete, verify:**
|
|
147
|
+
|
|
148
|
+
Run:
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
node dist/declare-tools.cjs verify-wave --milestone M-XX --actions "A-01,A-02"
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
(Use the comma-separated list of action IDs from the current wave.)
|
|
155
|
+
|
|
156
|
+
Parse the verification JSON output.
|
|
157
|
+
|
|
158
|
+
Display automated check results:
|
|
159
|
+
|
|
160
|
+
```
|
|
161
|
+
### Wave N Verification
|
|
162
|
+
|
|
163
|
+
| Action | Check | Result |
|
|
164
|
+
| ------ | ------------ | ------ |
|
|
165
|
+
| A-XX | action-exists | PASS |
|
|
166
|
+
| A-XX | produces-exist| PASS |
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Perform AI review: Given the trace context from the verification result (`traceContext.whyChain` and `traceContext.declarations`), assess whether the completed work meaningfully advances the milestone. Produce a 1-2 sentence assessment.
|
|
170
|
+
|
|
171
|
+
If `passed` is false (verification failed):
|
|
172
|
+
- Identify which actions failed and what checks failed.
|
|
173
|
+
- Retry up to 2 times: re-spawn the failed action's Task agent with the failure context appended:
|
|
174
|
+
|
|
175
|
+
```
|
|
176
|
+
Previous attempt failed verification. Failure details:
|
|
177
|
+
- Check [check-name] failed for action A-XX
|
|
178
|
+
- [Details from allChecks]
|
|
179
|
+
|
|
180
|
+
Please fix the issues and try again.
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
- After 2 retries with continued failure, surface to user:
|
|
184
|
+
"Action A-XX failed verification after 2 retries. Details: [failure info]. What would you like to do?"
|
|
185
|
+
- Wait for user guidance before continuing.
|
|
186
|
+
|
|
187
|
+
If `--confirm` flag was set, pause after successful verification:
|
|
188
|
+
- "Wave N complete and verified. Proceed to Wave N+1? (yes/no)"
|
|
189
|
+
- Wait for user confirmation before continuing.
|
|
190
|
+
|
|
191
|
+
**3e. Update action statuses in PLAN.md:**
|
|
192
|
+
|
|
193
|
+
After successful wave verification, update each completed action's status in the milestone's PLAN.md file:
|
|
194
|
+
|
|
195
|
+
1. Use the `milestoneFolderPath` from Step 2 to locate the PLAN.md file.
|
|
196
|
+
2. Read the PLAN.md file.
|
|
197
|
+
3. For each action in the completed wave, find `**Status:** PENDING` (or `**Status:** ACTIVE`) for that action and change it to `**Status:** DONE`.
|
|
198
|
+
4. Write the updated PLAN.md back.
|
|
199
|
+
|
|
200
|
+
**Step 4: After all waves complete, check milestone completion.**
|
|
201
|
+
|
|
202
|
+
If `milestoneCompletable` is true from the final verify-wave result:
|
|
203
|
+
1. Read `.planning/MILESTONES.md`.
|
|
204
|
+
2. Find the row for M-XX in the milestones table.
|
|
205
|
+
3. Change its Status from PENDING or ACTIVE to DONE.
|
|
206
|
+
4. Write the updated MILESTONES.md back.
|
|
207
|
+
5. Display: "Milestone M-XX marked as DONE (pending verification)."
|
|
208
|
+
|
|
209
|
+
Proceed to Step 5. Do NOT display a completion banner yet -- that happens in Step 8 after verification.
|
|
210
|
+
|
|
211
|
+
**Step 5: Milestone truth verification.**
|
|
212
|
+
|
|
213
|
+
After marking the milestone DONE in Step 4, verify whether the milestone truth actually holds.
|
|
214
|
+
|
|
215
|
+
**5a. Run programmatic verification:**
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
node dist/declare-tools.cjs verify-milestone --milestone M-XX
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
Parse the JSON result. It contains `criteria` (array of `{id, type, passed, description, evidence}`), `programmaticPassed`, `aiAssessmentNeeded`, and `traceContext`.
|
|
222
|
+
|
|
223
|
+
**5b. Display programmatic check results:**
|
|
224
|
+
|
|
225
|
+
```
|
|
226
|
+
### Milestone Verification: M-XX
|
|
227
|
+
|
|
228
|
+
| Criterion | Type | Result | Evidence |
|
|
229
|
+
| --------- | ---- | ------ | -------- |
|
|
230
|
+
| SC-01 | artifact | PASS | File found at path (NNN bytes) |
|
|
231
|
+
| SC-02 | test | PASS | npm test exited with code 0 |
|
|
232
|
+
| SC-03 | ai | (pending) | |
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
For each criterion in the result, show its id, type, result (PASS if `passed === true`, NOT YET MET if `passed === false`, `(pending)` if `passed === null`), and evidence.
|
|
236
|
+
|
|
237
|
+
**5c. Perform AI assessment:**
|
|
238
|
+
|
|
239
|
+
If `programmaticPassed` is false, skip AI assessment -- programmatic criteria not yet met are definitive. Proceed directly to remediation (Step 6).
|
|
240
|
+
|
|
241
|
+
If `programmaticPassed` is true, perform the AI assessment for the criterion with `type: "ai"`:
|
|
242
|
+
|
|
243
|
+
- Read the milestone title and the trace context (`traceContext.declarations` and `traceContext.whyChain`) from the verify-milestone result.
|
|
244
|
+
- Review the work completed across all waves (the actions executed, their produces, the wave verification results).
|
|
245
|
+
- Assess: "Given that all actions for this milestone have completed, does the milestone truth statement hold? Is '[milestone title]' actually true?"
|
|
246
|
+
- If the AI assessment is positive: mark the AI criterion as passed with a 1-2 sentence evidence summary.
|
|
247
|
+
- If the AI assessment is negative: mark the AI criterion as not yet met with evidence explaining what is missing.
|
|
248
|
+
|
|
249
|
+
Use restoration-focused language throughout: "criterion met" / "criterion not yet met" (never "passed" / "failed" in user-facing output).
|
|
250
|
+
|
|
251
|
+
**5d. Determine verification outcome:**
|
|
252
|
+
|
|
253
|
+
- ALL criteria met (including AI): proceed to mark KEPT (Step 5e).
|
|
254
|
+
- ANY criterion not yet met: proceed to remediation loop (Step 6).
|
|
255
|
+
|
|
256
|
+
**5e. All criteria met -- mark milestone KEPT:**
|
|
257
|
+
|
|
258
|
+
1. Read `.planning/MILESTONES.md`, change M-XX status from DONE to KEPT.
|
|
259
|
+
2. Write the updated MILESTONES.md back.
|
|
260
|
+
3. Write VERIFICATION.md to the milestone folder using the `writeVerificationFile` format:
|
|
261
|
+
- State: `KEPT`
|
|
262
|
+
- Criteria: all criteria with their pass/fail status, descriptions, and evidence
|
|
263
|
+
- History: one attempt entry with `passed: true`, `remediationTriggered: false`, `stateTransition: "DONE -> KEPT"`
|
|
264
|
+
4. Display (3-5 lines):
|
|
265
|
+
|
|
266
|
+
```
|
|
267
|
+
Milestone M-XX verified as KEPT -- "[milestone title]" holds true.
|
|
268
|
+
[Brief summary of what was verified: N artifact checks, test suite, AI assessment all met.]
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
5. Skip to completion banner (Step 8).
|
|
272
|
+
|
|
273
|
+
**Step 6: Remediation loop (max 2 attempts).**
|
|
274
|
+
|
|
275
|
+
If verification in Step 5 found criteria not yet met:
|
|
276
|
+
|
|
277
|
+
**6a. Update MILESTONES.md status to BROKEN for M-XX.**
|
|
278
|
+
|
|
279
|
+
Read `.planning/MILESTONES.md`, change M-XX status from DONE to BROKEN, write back.
|
|
280
|
+
|
|
281
|
+
**6b. Write initial VERIFICATION.md to the milestone folder.**
|
|
282
|
+
|
|
283
|
+
Write VERIFICATION.md with:
|
|
284
|
+
- State: `BROKEN`
|
|
285
|
+
- Criteria: all criteria with current results
|
|
286
|
+
- History: one attempt entry with `passed: false`, `remediationTriggered: true`, `stateTransition: "DONE -> BROKEN"`, checks summary (which criteria not yet met)
|
|
287
|
+
|
|
288
|
+
**6c. For each remediation attempt (max 2):**
|
|
289
|
+
|
|
290
|
+
**i. Derive remediation actions.** Analyze the criteria not yet met. For each criterion not yet met, derive 1-3 targeted remediation actions using AI reasoning:
|
|
291
|
+
|
|
292
|
+
```
|
|
293
|
+
Given these verification results for milestone M-XX ("[milestone title]"):
|
|
294
|
+
|
|
295
|
+
Criteria not yet met:
|
|
296
|
+
- SC-XX: [description] -- Evidence: [evidence]
|
|
297
|
+
|
|
298
|
+
Derive remediation actions. Rules:
|
|
299
|
+
- Each action targets exactly one criterion not yet met
|
|
300
|
+
- Do not modify code that already meets its criteria
|
|
301
|
+
- Maximum 3 actions per remediation attempt
|
|
302
|
+
- Each action needs: title, produces field, description
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
**ii. Append remediation actions to PLAN.md.** For each derived action:
|
|
306
|
+
- Read the existing PLAN.md from the milestone folder (use `milestoneFolderPath` from Step 2).
|
|
307
|
+
- Add a new action section at the bottom with the next available A-XX ID.
|
|
308
|
+
- Mark it with `**Derived:** remediation (attempt N)` instead of a creation date.
|
|
309
|
+
- Write the updated PLAN.md.
|
|
310
|
+
|
|
311
|
+
**iii. Generate exec plans for remediation actions:**
|
|
312
|
+
|
|
313
|
+
```bash
|
|
314
|
+
node dist/declare-tools.cjs generate-exec-plan --action A-XX --milestone M-XX --wave remediation
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
**iv. Display remediation banner:**
|
|
318
|
+
|
|
319
|
+
```
|
|
320
|
+
--- Remediation Attempt N ---
|
|
321
|
+
**Criteria not yet met:** SC-XX, SC-YY
|
|
322
|
+
**Actions:** A-XX ([title]), A-YY ([title])
|
|
323
|
+
Spawning [count] agent(s)...
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
**v. Spawn executor agents for remediation actions using the Task tool** (same pattern as Step 3c).
|
|
327
|
+
|
|
328
|
+
**vi. After remediation agents complete, re-run verification:**
|
|
329
|
+
|
|
330
|
+
```bash
|
|
331
|
+
node dist/declare-tools.cjs verify-milestone --milestone M-XX
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
Re-perform AI assessment for the AI criterion (same process as Step 5c).
|
|
335
|
+
|
|
336
|
+
**vii. If ALL criteria now met:**
|
|
337
|
+
- Read `.planning/MILESTONES.md`, change M-XX status from BROKEN to HONORED.
|
|
338
|
+
- Write the updated MILESTONES.md back.
|
|
339
|
+
- Update VERIFICATION.md: use `appendAttempt` to add the successful attempt with `passed: true`, `remediationTriggered: false`, `stateTransition: "BROKEN -> HONORED"`, and update the header state to HONORED.
|
|
340
|
+
- Display (3-5 lines):
|
|
341
|
+
|
|
342
|
+
```
|
|
343
|
+
Milestone M-XX verified as HONORED -- "[milestone title]" now holds true.
|
|
344
|
+
Remediation: [brief description of what was fixed]. [N] criteria now met.
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
- Skip to completion banner (Step 8).
|
|
348
|
+
|
|
349
|
+
**viii. If criteria still not met after attempt 2:** proceed to escalation (Step 7).
|
|
350
|
+
|
|
351
|
+
**Step 7: Escalation.**
|
|
352
|
+
|
|
353
|
+
After 2 remediation attempts with criteria still not met:
|
|
354
|
+
|
|
355
|
+
**7a. Update VERIFICATION.md** with the final attempt (attempt 2) results using `appendAttempt`.
|
|
356
|
+
|
|
357
|
+
**7b. Display diagnosis report:**
|
|
358
|
+
|
|
359
|
+
```
|
|
360
|
+
## Verification: M-XX requires attention
|
|
361
|
+
|
|
362
|
+
**Milestone:** [milestone title]
|
|
363
|
+
**Remediation attempts:** 2 (criteria still not yet met)
|
|
364
|
+
|
|
365
|
+
### What was tried
|
|
366
|
+
|
|
367
|
+
**Attempt 1:** [actions taken] -- [which criteria still not yet met]
|
|
368
|
+
**Attempt 2:** [actions taken] -- [which criteria still not yet met]
|
|
369
|
+
|
|
370
|
+
### Criteria still not yet met
|
|
371
|
+
|
|
372
|
+
| Criterion | Evidence |
|
|
373
|
+
| --------- | -------- |
|
|
374
|
+
| SC-XX | [latest evidence] |
|
|
375
|
+
|
|
376
|
+
### Suggestions
|
|
377
|
+
|
|
378
|
+
- [Specific suggestion per criterion not yet met, e.g., "Consider narrowing SC-02 to check only the main export" or "The test in SC-03 may need a mock for external service X"]
|
|
379
|
+
|
|
380
|
+
### Options
|
|
381
|
+
|
|
382
|
+
1. **Adjust** the milestone statement or success criteria, then I will retry verification
|
|
383
|
+
2. **Accept** the current state and continue to the next milestone
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
**7c. Wait for user response.**
|
|
387
|
+
|
|
388
|
+
If user chooses to **adjust**:
|
|
389
|
+
- Apply the user's adjustments to the milestone statement or success criteria.
|
|
390
|
+
- Re-run verification (Step 5).
|
|
391
|
+
- If all criteria now met: change M-XX status from BROKEN to RENEGOTIATED in MILESTONES.md.
|
|
392
|
+
- Update VERIFICATION.md with a new attempt entry with `stateTransition: "BROKEN -> RENEGOTIATED"`.
|
|
393
|
+
- Display: "Milestone M-XX renegotiated and verified -- adjusted criteria now hold."
|
|
394
|
+
- Proceed to Step 8.
|
|
395
|
+
|
|
396
|
+
If user chooses to **accept**:
|
|
397
|
+
- Leave M-XX status as BROKEN in MILESTONES.md.
|
|
398
|
+
- Add a note to VERIFICATION.md: "User accepted current state. Milestone remains BROKEN."
|
|
399
|
+
- Proceed to Step 8.
|
|
400
|
+
|
|
401
|
+
**Step 8: Occurrence check at milestone completion.**
|
|
402
|
+
|
|
403
|
+
After execution and verification, check whether declarations still occur as declared.
|
|
404
|
+
|
|
405
|
+
Run:
|
|
406
|
+
|
|
407
|
+
```bash
|
|
408
|
+
node dist/declare-tools.cjs check-occurrence
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
Parse the JSON output. For each declaration in the `declarations` array:
|
|
412
|
+
|
|
413
|
+
Perform AI assessment: Given the declaration statement and its connected milestones/actions, assess:
|
|
414
|
+
1. Does this declaration still occur as what was declared? (Is it still true/relevant?)
|
|
415
|
+
2. Has any work drifted from the declaration's intent?
|
|
416
|
+
3. Rate alignment: HIGH / MEDIUM / LOW
|
|
417
|
+
|
|
418
|
+
Display the assessment:
|
|
419
|
+
|
|
420
|
+
```
|
|
421
|
+
### Occurrence Check: [declarationId] -- [statement]
|
|
422
|
+
|
|
423
|
+
**Statement:** "[statement]"
|
|
424
|
+
**Connected milestones:** [milestoneCount] ([count of verified] verified)
|
|
425
|
+
**Assessment:** [AI assessment of whether this still occurs as declared]
|
|
426
|
+
**Alignment:** [HIGH/MEDIUM/LOW]
|
|
427
|
+
```
|
|
428
|
+
|
|
429
|
+
If the AI assessment determines a declaration is "no longer true" or alignment is LOW:
|
|
430
|
+
- Ask the user: "Declaration [declarationId] appears to no longer occur as declared. Renegotiate? (yes/no)"
|
|
431
|
+
- If "yes" -> enter renegotiation flow (Step 9a)
|
|
432
|
+
- If "no" -> note it and continue
|
|
433
|
+
|
|
434
|
+
**Step 9a: Renegotiation flow (if triggered).**
|
|
435
|
+
|
|
436
|
+
Ask the user: "Why is this declaration no longer true?" and capture their reason.
|
|
437
|
+
|
|
438
|
+
Run:
|
|
439
|
+
|
|
440
|
+
```bash
|
|
441
|
+
node dist/declare-tools.cjs renegotiate --declaration D-XX --reason "[user's reason]"
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
Parse the JSON output.
|
|
445
|
+
|
|
446
|
+
Display:
|
|
447
|
+
|
|
448
|
+
```
|
|
449
|
+
### Renegotiation Complete: [archived.id]
|
|
450
|
+
|
|
451
|
+
**Archived to:** FUTURE-ARCHIVE.md
|
|
452
|
+
**Reason:** [reason]
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
If `orphanedMilestones` is non-empty, display them grouped:
|
|
456
|
+
|
|
457
|
+
```
|
|
458
|
+
**Orphaned milestones requiring review:**
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
For each orphaned milestone:
|
|
462
|
+
```
|
|
463
|
+
- [id]: [title] ([status])
|
|
464
|
+
Actions: [action.id] ([action.status]), ...
|
|
465
|
+
Options:
|
|
466
|
+
1. Reassign to another declaration
|
|
467
|
+
2. Archive this milestone
|
|
468
|
+
3. Leave for now (will appear as drift)
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
"Which milestones would you like to reassign? Provide IDs or 'skip' to leave for later."
|
|
472
|
+
|
|
473
|
+
If user provides IDs, guide them through reassignment (edit MILESTONES.md to update the Realizes column). If "skip", acknowledge and continue.
|
|
474
|
+
|
|
475
|
+
Then prompt: "Would you like to create a replacement declaration now? (yes/no)"
|
|
476
|
+
- If "yes": suggest running `/declare:future` to add a new declaration
|
|
477
|
+
- If "no": continue
|
|
478
|
+
|
|
479
|
+
**Step 9: Completion banner.**
|
|
480
|
+
|
|
481
|
+
Display the final execution summary:
|
|
482
|
+
|
|
483
|
+
```
|
|
484
|
+
## Execution Complete: M-XX -- [milestoneTitle]
|
|
485
|
+
|
|
486
|
+
**Actions completed:** [count of actions executed, including remediation actions]
|
|
487
|
+
**Waves executed:** [count of waves]
|
|
488
|
+
**Verification:** [KEPT | HONORED | RENEGOTIATED | BROKEN (user accepted)]
|
|
489
|
+
**Milestone status:** [final status in MILESTONES.md]
|
|
490
|
+
**Occurrence check:** [Performed — X declarations assessed / Skipped (if no declarations affected)]
|
|
491
|
+
```
|
|
492
|
+
|
|
493
|
+
**Error handling:**
|
|
494
|
+
|
|
495
|
+
- If any CJS command returns a JSON with an `error` field, display it clearly and suggest fixes.
|
|
496
|
+
- If milestone folder not found, suggest running `/declare:actions` first to create the milestone plan.
|
|
497
|
+
- If no pending actions, report the milestone is already complete.
|
|
498
|
+
- If a Task agent fails (non-verification failure), display the error and ask the user how to proceed.
|
|
499
|
+
|
|
500
|
+
**Key patterns:**
|
|
501
|
+
|
|
502
|
+
- Execution scope is per-milestone (never cross-milestone).
|
|
503
|
+
- Wave scheduling is automatic from the action graph.
|
|
504
|
+
- Auto-advance between waves by default; `--confirm` pauses for user review.
|
|
505
|
+
- GSD-style banners with progress at each stage.
|
|
506
|
+
- Atomic commits per task (handled by executor agents).
|
|
507
|
+
- Two-layer verification: automated checks (CJS tool) then AI review (this slash command).
|
|
508
|
+
- Max 2 retries on verification failure before escalating to user.
|
|
509
|
+
- Milestone truth verification after all waves: DONE is intermediate, KEPT/HONORED/RENEGOTIATED are final.
|
|
510
|
+
- Auto-remediation derives targeted actions, appends to PLAN.md, executes, and re-verifies.
|
|
511
|
+
- Escalation provides diagnosis with specific suggestions, never judgment.
|
|
512
|
+
- Language is restoration-focused: "criterion not yet met" not "failed", "requires attention" not "broken".
|
|
513
|
+
- State transitions: DONE -> KEPT (all criteria met first try), DONE -> BROKEN -> HONORED (remediated), DONE -> BROKEN -> RENEGOTIATED (user adjusted criteria).
|
|
514
|
+
- VERIFICATION.md written to milestone folder with full attempt history and audit trail.
|
|
515
|
+
- Drift pre-check (Step 2.5): soft-block warning before wave execution if orphaned nodes detected.
|
|
516
|
+
- Occurrence checks (Step 9): AI assessment of each declaration after milestone completion.
|
|
517
|
+
- Renegotiation flow (Step 9a): archives declaration to FUTURE-ARCHIVE.md, presents orphans for reassignment.
|
|
518
|
+
- FUTURE.md is the shared future document referenced as the source of truth for all alignment checks.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Show available Declare commands
|
|
3
|
+
allowed-tools:
|
|
4
|
+
- Read
|
|
5
|
+
- Bash
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
Show the Declare command reference.
|
|
9
|
+
|
|
10
|
+
**Step 1: Run the help tool.**
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
node dist/declare-tools.cjs help
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Parse the JSON output.
|
|
17
|
+
|
|
18
|
+
**Step 2: Format the help display.**
|
|
19
|
+
|
|
20
|
+
Display a clean command reference:
|
|
21
|
+
|
|
22
|
+
**Header:** "Declare -- Future-first project planning"
|
|
23
|
+
|
|
24
|
+
**Brief description:** Declare lets you define what you want to be true about the future, then builds a causal graph of milestones and actions to get there. It validates structural integrity and tracks progress through the graph.
|
|
25
|
+
|
|
26
|
+
**Available Commands:** For each command in the JSON output, display:
|
|
27
|
+
- Command name (bold)
|
|
28
|
+
- Description
|
|
29
|
+
- Usage example
|
|
30
|
+
|
|
31
|
+
**Version:** Show the version number at the bottom.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Initialize Declare project with future declarations and graph structure
|
|
3
|
+
allowed-tools:
|
|
4
|
+
- Read
|
|
5
|
+
- Write
|
|
6
|
+
- Bash
|
|
7
|
+
- Glob
|
|
8
|
+
- Grep
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
Initialize a Declare project in the current working directory.
|
|
12
|
+
|
|
13
|
+
**Step 1: Run the init tool.**
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
node dist/declare-tools.cjs init $ARGUMENTS
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Parse the JSON output. It will contain:
|
|
20
|
+
- `initialized`: whether initialization succeeded
|
|
21
|
+
- `created`: list of files that were created
|
|
22
|
+
- `existing`: list of files that already existed
|
|
23
|
+
- `committed`: whether a git commit was made
|
|
24
|
+
|
|
25
|
+
**Step 2: Handle existing files.**
|
|
26
|
+
|
|
27
|
+
If the `existing` array is non-empty, present the existing files to the user and ask which ones they want to keep vs replace. For each file they want to replace:
|
|
28
|
+
1. Delete the existing file
|
|
29
|
+
2. Re-run `node dist/declare-tools.cjs init` to recreate it
|
|
30
|
+
|
|
31
|
+
**Step 3: Report results.**
|
|
32
|
+
|
|
33
|
+
Show the user a summary of what was created:
|
|
34
|
+
- List each created file with a brief description of its purpose
|
|
35
|
+
- If a commit was made, mention the commit hash
|
|
36
|
+
- Suggest next steps: "Add your first future declaration to `.planning/FUTURE.md`" and "Run `/declare:status` to see graph state"
|