draht-codex 2026.10.20 → 2026.10.23

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 (107) hide show
  1. package/.codex-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +16 -0
  3. package/agents/advisor.md +2 -2
  4. package/agents/architect.md +10 -71
  5. package/agents/debugger.md +12 -82
  6. package/agents/git-committer.md +10 -52
  7. package/agents/implementer.md +15 -63
  8. package/agents/investigator.md +11 -63
  9. package/agents/reviewer.md +15 -65
  10. package/agents/security-auditor.md +12 -105
  11. package/agents/spec-reviewer.md +12 -53
  12. package/agents/verifier.md +13 -54
  13. package/commands/atomic-commit.md +9 -9
  14. package/commands/create-verification-skill.md +8 -48
  15. package/commands/discuss-phase.md +5 -9
  16. package/commands/execute-phase.md +17 -47
  17. package/commands/fix.md +16 -130
  18. package/commands/grill.md +6 -51
  19. package/commands/init-project.md +10 -14
  20. package/commands/map-codebase.md +2 -2
  21. package/commands/new-project.md +9 -14
  22. package/commands/next-milestone.md +3 -7
  23. package/commands/orchestrate-loop.md +12 -12
  24. package/commands/orchestrate.md +12 -11
  25. package/commands/pause-work.md +1 -1
  26. package/commands/plan-phase.md +16 -38
  27. package/commands/quick.md +9 -78
  28. package/commands/resolve-conflicts.md +2 -15
  29. package/commands/triage.md +3 -14
  30. package/commands/verify-work.md +17 -106
  31. package/commands/why.md +18 -118
  32. package/hooks/hooks.json +10 -0
  33. package/package.json +4 -4
  34. package/scripts/checks-runtime.cjs +215 -0
  35. package/scripts/git-safety-hook.cjs +21 -0
  36. package/scripts/git-safety.cjs +198 -0
  37. package/scripts/gsd-post-task.cjs +78 -39
  38. package/scripts/gsd-quality-gate.cjs +206 -120
  39. package/scripts/prompt-context.cjs +40 -6
  40. package/scripts/session-start.cjs +6 -4
  41. package/scripts/stop-quality-gate.cjs +55 -25
  42. package/skills/atomic-commit/command.md +9 -9
  43. package/skills/atomic-reasoning/SKILL.md +6 -105
  44. package/skills/blast-radius/SKILL.md +1 -1
  45. package/skills/brainstorming/SKILL.md +8 -126
  46. package/skills/create-verification-skill/SKILL.md +1 -1
  47. package/skills/create-verification-skill/command.md +8 -48
  48. package/skills/ddd-workflow/SKILL.md +8 -101
  49. package/skills/debugging-workflow/SKILL.md +12 -122
  50. package/skills/discuss-phase/SKILL.md +1 -0
  51. package/skills/discuss-phase/agents/openai.yaml +2 -0
  52. package/skills/discuss-phase/command.md +5 -9
  53. package/skills/draht/SKILL.md +18 -14
  54. package/skills/epistemics/SKILL.md +12 -87
  55. package/skills/execute-phase/SKILL.md +1 -0
  56. package/skills/execute-phase/agents/openai.yaml +2 -0
  57. package/skills/execute-phase/command.md +17 -47
  58. package/skills/explainers/SKILL.md +1 -1
  59. package/skills/fix/SKILL.md +2 -1
  60. package/skills/fix/agents/openai.yaml +2 -0
  61. package/skills/fix/command.md +16 -130
  62. package/skills/grill/SKILL.md +1 -1
  63. package/skills/grill/command.md +6 -51
  64. package/skills/gsd-workflow/SKILL.md +37 -21
  65. package/skills/gsd-workflow/agents/openai.yaml +2 -0
  66. package/skills/init-project/SKILL.md +1 -0
  67. package/skills/init-project/agents/openai.yaml +2 -0
  68. package/skills/init-project/command.md +10 -14
  69. package/skills/loop-workflow/SKILL.md +7 -41
  70. package/skills/map-codebase/command.md +2 -2
  71. package/skills/model-tiering/SKILL.md +7 -7
  72. package/skills/new-project/SKILL.md +1 -0
  73. package/skills/new-project/agents/openai.yaml +2 -0
  74. package/skills/new-project/command.md +9 -14
  75. package/skills/next-milestone/SKILL.md +1 -0
  76. package/skills/next-milestone/agents/openai.yaml +2 -0
  77. package/skills/next-milestone/command.md +3 -7
  78. package/skills/orchestrate/command.md +12 -11
  79. package/skills/orchestrate-loop/command.md +12 -12
  80. package/skills/pause-work/SKILL.md +1 -0
  81. package/skills/pause-work/agents/openai.yaml +2 -0
  82. package/skills/pause-work/command.md +1 -1
  83. package/skills/plan-phase/SKILL.md +1 -0
  84. package/skills/plan-phase/agents/openai.yaml +2 -0
  85. package/skills/plan-phase/command.md +16 -38
  86. package/skills/progress/SKILL.md +1 -0
  87. package/skills/progress/agents/openai.yaml +2 -0
  88. package/skills/quick/SKILL.md +2 -1
  89. package/skills/quick/agents/openai.yaml +2 -0
  90. package/skills/quick/command.md +9 -78
  91. package/skills/resolve-conflicts/command.md +2 -15
  92. package/skills/resume-work/SKILL.md +1 -0
  93. package/skills/resume-work/agents/openai.yaml +2 -0
  94. package/skills/saga-spawner/SKILL.md +1 -1
  95. package/skills/tdd-workflow/SKILL.md +15 -104
  96. package/skills/triage/SKILL.md +2 -1
  97. package/skills/triage/agents/openai.yaml +2 -0
  98. package/skills/triage/command.md +3 -14
  99. package/skills/typescript-discipline/SKILL.md +12 -42
  100. package/skills/typescript-discipline/references/patterns.md +25 -266
  101. package/skills/unslop/SKILL.md +14 -105
  102. package/skills/verification-gate/SKILL.md +16 -76
  103. package/skills/verify-work/SKILL.md +1 -0
  104. package/skills/verify-work/agents/openai.yaml +2 -0
  105. package/skills/verify-work/command.md +17 -106
  106. package/skills/why/SKILL.md +1 -1
  107. package/skills/why/command.md +18 -118
@@ -13,22 +13,9 @@ Arguments: $ARGUMENTS
13
13
 
14
14
  > **Tool note**: Invoke `draht-tools <subcommand>` as `node "${PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT:-$HOME/.draht/codex-marketplace/plugins/draht}}/bin/draht-tools.cjs" <subcommand>`. For subagent delegation, spawn Codex subagents using the `implementer`, `spec-reviewer`, or `reviewer` agent prompts. Dispatch multiple parallel tasks in a single assistant turn by making multiple Codex subagent calls at once.
15
15
 
16
- ## Red Flags — STOP
16
+ ## Execution prerequisites
17
17
 
18
- STOP and report to the user instead of proceeding if **any** of these is true:
19
-
20
- - `gsd-pre-execute.cjs` exits non-zero (missing DOMAIN.md, missing plans, uncommitted changes blocking start)
21
- - Any plan file contains placeholder text: `[TBD]`, `[files]`, `[description]`, "appropriate error handling", "similar to Task N", "..." in code positions, or empty `<test>` / `<action>` / `<verify>` / `<done>` sections — these are not executable
22
- - A plan has zero `<task>` elements
23
- - `.planning/DOMAIN.md` is absent on a non-greenfield project — implementers will guess at naming
24
- - The working tree is dirty with changes unrelated to this phase
25
- - An implementer subagent returns `STATUS: BLOCKED` — never retry blindly; report what blocked it and ask the user
26
-
27
- ## Atomic Reasoning
28
-
29
- Decompose the work into independently verifiable units before acting; the `atomic-reasoning` skill holds the full discipline — load it when the decomposition is not obvious.
30
-
31
- Within each group of independent plans, dispatch the riskiest plan first (highest uncertainty × blast radius) — its failure invalidates the rest of the phase most cheaply, before effort has been sunk into work it would obsolete.
18
+ Validate plans before execution and honor pre-execute hook failures. Preserve unrelated work. An implementation blocker stops that task; a review blocker follows the bounded correction loop below.
32
19
 
33
20
  ## Steps
34
21
 
@@ -39,7 +26,7 @@ Within each group of independent plans, dispatch the riskiest plan first (highes
39
26
  If it exits non-zero, STOP and report errors to the user. Do not proceed.
40
27
 
41
28
  1. Run `draht-tools discover-plans $1` to find and order plans
42
- 2. Read each plan file yourself (from `.planning/phases/`) and analyze dependencies to identify which plans can run in parallel vs sequential. **Graph-impact:** run `draht-tools graph-impact <each plan's files>` and parallelize ONLY plans whose blast-radius/sink sets are disjoint; serialize any plans with overlapping reverse-dependents.
29
+ 2. Read each plan file yourself (from `.planning/phases/`) and analyze dependencies to identify which plans can run in parallel vs sequential. **Graph-impact:** run `draht-tools graph-impact <each plan's files>` and use dependency and impact information to avoid conflicting changes and shared mutable resources.
43
30
  3. **Validate plans before dispatching:**
44
31
  ```bash
45
32
  node "${PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT:-$HOME/.draht/codex-marketplace/plugins/draht}}/bin/draht-tools.cjs" validate-plans $1
@@ -48,11 +35,11 @@ Within each group of independent plans, dispatch the riskiest plan first (highes
48
35
 
49
36
  4. **Per-plan execution loop.** For each plan (parallel where independent, sequential where dependent):
50
37
 
51
- For each `<task>` in the plan, run a **three-stage** dispatch — implementer → spec-reviewer → reviewer — before moving to the next task. Do not pause for user input between tasks; only stop when a stage returns `STATUS: BLOCKED` or `STATUS: NEEDS_CONTEXT`.
38
+ For each `<task>` in the plan, run a **three-stage** dispatch — implementer → spec-reviewer → reviewer — before moving to the next task. Do not pause for user input between tasks. Resolve missing context and review findings through the branches below; stop for an implementer blocker, unavailable required context, or the retry cap.
52
39
 
53
40
  ### Stage 1 — Implementer
54
41
  Dispatch a Codex subagent using the `implementer` agent prompt and the prompt from the template below. Read the final `STATUS:` line in the response.
55
- - `STATUS: DONE` → **re-derive before trusting**: a `DONE` that does not quote its verification output (test counts, command output) is treated as `DONE_WITH_CONCERNS` — run the task's `<verify>` step yourself and read the result before Stage 2. Subagent claims are inputs, not verdicts.
42
+ - `STATUS: DONE` → inspect the actual verification evidence and checked state. Reuse results only if the relevant inputs and environment are unchanged; run missing, stale, or insufficient verification before Stage 2.
56
43
  - `STATUS: DONE_WITH_CONCERNS` → note the concerns; if any are correctness issues, instruct the implementer to fix and re-dispatch; otherwise go to Stage 2.
57
44
  - `STATUS: NEEDS_CONTEXT` → provide the missing context (paste the relevant file content or decision) and re-dispatch. Do not skip.
58
45
  - `STATUS: BLOCKED` → STOP. Report the blocker to the user. Do not move on.
@@ -70,18 +57,20 @@ Within each group of independent plans, dispatch the riskiest plan first (highes
70
57
  ```
71
58
  - `STATUS: DONE` → go to Stage 3.
72
59
  - `STATUS: DONE_WITH_CONCERNS` → note, go to Stage 3.
60
+ - `STATUS: NEEDS_CONTEXT` → supply the missing spec, diff, or context and repeat this review; do not advance.
73
61
  - `STATUS: BLOCKED` → re-dispatch the implementer with the "Required Fixes" list to address the gaps. Repeat Stage 1+2 until `DONE`. **Never proceed to Stage 3 with a non-compliant diff.** **Hard cap: 3 implementer re-dispatches per task (across Stage 2 and Stage 3 combined).** On the 3rd failed re-dispatch, record the task as failed via the post-task hook and STOP — report the disagreement to the user. Never negotiate past the cap.
74
62
 
75
63
  ### Stage 3 — Reviewer (code quality)
76
64
  Once spec compliance is ✅, dispatch a Codex subagent using the `reviewer` agent prompt and a prompt of the form:
77
65
  ```
78
- Code-quality review of the diff for task <task-name>. Focus on correctness, type safety, conventions, maintainability, and domain language compliance. Spec compliance has already been confirmed — do NOT re-check spec.
66
+ Code-quality review of the diff for task <task-name>. Focus on correctness, type safety, conventions, maintainability, and domain language compliance. Spec compliance has already been confirmed. Do not repeat the full spec audit; escalate any discovered mismatch as Must fix for spec re-review.
79
67
 
80
68
  Diff to review:
81
69
  <run `git diff <range>` and paste, or instruct the agent to run it>
82
70
  ```
83
71
  - `STATUS: DONE` → task is complete, run the post-task hook (below), then move to the next task.
84
72
  - `STATUS: DONE_WITH_CONCERNS` → log the `Should fix` items; if any are correctness-critical, re-dispatch implementer; otherwise log and move on.
73
+ - `STATUS: NEEDS_CONTEXT` → supply the missing diff or context and repeat this review; do not advance.
85
74
  - `STATUS: BLOCKED` → `Must fix` issues exist; re-dispatch the implementer with the issue list. Repeat the three stages until `DONE` — subject to the same **hard cap of 3 implementer re-dispatches per task**; at the cap, record the task as failed and STOP.
86
75
 
87
76
  ### Post-task hook
@@ -89,7 +78,7 @@ Within each group of independent plans, dispatch the riskiest plan first (highes
89
78
  ```bash
90
79
  node "${PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT:-$HOME/.draht/codex-marketplace/plugins/draht}}/scripts/gsd-post-task.cjs" <phase> <plan> <task-num> <status> <commit-hash>
91
80
  ```
92
- If the hook exits non-zero (3+ recorded failures for the task), that is a **harness-enforced hard stop**: do not dispatch any further implementer runs for this task; report to the user or create a fix plan.
81
+ If the hook exits non-zero, do not advance to the next task; address the reported check failures within the existing retry cap. A **HARD STOP** (3 recorded failures) forbids another implementer dispatch: report to the user or create a fix plan.
93
82
 
94
83
  5. After all plans complete, run `draht-tools verify-phase $1` yourself (not the subagent)
95
84
  6. Run the post-phase hook to generate the phase report:
@@ -97,44 +86,38 @@ Within each group of independent plans, dispatch the riskiest plan first (highes
97
86
  node "${PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT:-$HOME/.draht/codex-marketplace/plugins/draht}}/scripts/gsd-post-phase.cjs" $1
98
87
  ```
99
88
  7. Run `draht-tools update-state` yourself
100
- 8. Final commit: `draht-tools commit-docs "complete phase $1 execution"`
101
- 9. Tell the user to start a fresh session (`/clear`) and run `/verify-work $1`
89
+ 8. If committing is authorized, final documentation commit: `draht-tools commit-docs "complete phase $1 execution"`
90
+ 9. Identify `/verify-work $1` as the next step; a fresh session is optional
102
91
 
103
92
  ## Subagent Task Template (Stage 1: implementer)
104
93
 
105
94
  ```
106
- Execute this plan. Here is the full plan content:
95
+ Execute only task <task-name>. The full plan below is context; do not execute later tasks before the orchestrator completes this task's reviews:
107
96
 
108
97
  <paste full plan XML here>
109
98
 
110
99
  [Optional — orchestrator MAY paste a `draht-tools graph-context <task files>` slice here for orientation (pkg/layer/importers/imports/sinks). Codex subagents cannot run draht-tools.]
111
100
 
112
- For each <task> in the plan, follow this TDD cycle:
101
+ For the assigned <task>, follow its test requirements and this TDD cycle where applicable. Commit the phases only when the user has authorized commits:
113
102
  1. RED — Write failing tests from <test>. Run the test runner, confirm they FAIL for the right reason. Commit with: git add <test-files> && git commit -m "red: <description>"
114
103
  2. GREEN — Write minimal implementation from <action> to make tests pass. Run tests, confirm PASS. Commit with: git add <files> && git commit -m "green: <task name>"
115
104
  3. REFACTOR — Apply <refactor> improvements if any. Tests must stay green after each change. Commit with: git add <files> && git commit -m "refactor: <description>"
116
105
  4. VERIFY — Run the <verify> step, confirm <done> criteria are met.
117
106
 
118
- Domain rules: Use ubiquitous language from .planning/DOMAIN.md (read it). Do not import across bounded context boundaries.
107
+ Use established project terms and documented boundaries; read relevant domain context when present.
119
108
 
120
- Comment discipline: comments exist ONLY for constraints the code cannot express — a protocol quirk, a deliberate deviation, a non-obvious invariant. If code needs comments to be understood, rewrite the code until it doesn't. Never narrate steps, restate the diff, or leave "removed X" / "this handles Y" breadcrumbs. Comment density above the surrounding file's norm is a defect — fix it before committing. A heavily-commented solution signals the design is wrong: redesign, don't annotate.
109
+ Comments explain non-obvious constraints or rationale; avoid step narration and diff restatements.
121
110
 
122
111
  Checkpoint handling:
123
112
  - type="auto" → execute silently.
124
113
  - type="checkpoint:human-verify" → stop and report back what was built.
125
114
  - type="checkpoint:decision" → stop and report the options.
126
115
 
127
- Evidence rule: quote the decisive output of every test run and <verify> step in your report (pass/fail counts, exit codes, error text). Unquoted claims will be re-run by the orchestrator. If a plan instruction contradicts what you find in the code, stop and report NEEDS_CONTEXT — do not silently obey either side.
116
+ Evidence rule: report decisive commands, working directories, outcomes, and the code/configuration state checked. A bare success status is insufficient; missing or stale evidence must be verified. If a plan instruction contradicts what you find in the code, stop and report NEEDS_CONTEXT — do not silently obey either side.
128
117
 
129
118
  End your response with `STATUS: DONE` / `DONE_WITH_CONCERNS` / `NEEDS_CONTEXT` / `BLOCKED` per the agent contract.
130
119
  ```
131
120
 
132
- ## Two-Stage Review Rationale
133
-
134
- - **Spec compliance prevents over/under-building.** Implementers can drift — adding "helpful" extras or skipping pieces they think are obvious. The spec-reviewer catches this with fresh eyes.
135
- - **Code quality runs only after spec ✅.** Mixing the two reviews lets quality concerns mask spec gaps. Keep them ordered.
136
- - **Never accept "close enough" on spec compliance.** A `BLOCKED` from spec-reviewer means re-dispatch implementer, not move on.
137
-
138
121
  ## Parallelization Rules
139
122
 
140
123
  - Plans sharing no files and having no dependency edges can run in parallel
@@ -142,19 +125,6 @@ End your response with `STATUS: DONE` / `DONE_WITH_CONCERNS` / `NEEDS_CONTEXT` /
142
125
  - **Inside a plan, tasks run sequentially** — the three-stage review loop must complete before the next task starts (so each task gets clean review context)
143
126
  - If a parallel subagent fails, report which plan failed and continue with independent plans
144
127
 
145
- ## TDD Rules
146
-
147
- - Never write implementation before a failing test exists
148
- - If a test passes immediately after being written, it is not testing the right thing — fix it
149
- - Red → Green → Refactor is not optional; skipping steps invalidates the safety net
150
- - Each TDD phase gets its own commit so the history is auditable
151
-
152
- ## Domain Rules
153
-
154
- - All identifiers (class names, method names, variables) must use the ubiquitous language from `.planning/DOMAIN.md`
155
- - Do not import across bounded context boundaries directly — use domain events or ACL adapters
156
- - If implementation reveals a missing domain term, stop and update DOMAIN.md before continuing
157
-
158
128
  ## Workflow
159
129
 
160
130
  This is one step in the per-phase cycle:
@@ -163,7 +133,7 @@ This is one step in the per-phase cycle:
163
133
  /discuss-phase N → /plan-phase N → /execute-phase N → /verify-work N
164
134
  ```
165
135
 
166
- After completing this command, tell the user to start a fresh session (`/clear`) and run `/verify-work $1`. Do NOT suggest `/next-milestone`.
136
+ After completing this command, identify `/verify-work $1` as the next step; a fresh session is optional. Do NOT suggest `/next-milestone`.
167
137
 
168
138
  ## Flags
169
139
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: explainers
3
- description: Pick the output form that lets a human understand agent work fastest, and build it from evidence — Mermaid diagrams for relational content, a self-contained HTML explainer for findings worth exploring, the STE register in unslop for procedures, and narrated video reels as a non-core option. Use when a report, review, plan, investigation, or handoff describes structure (dependencies, call paths, data flow, state machines, sequences, timelines, wave order), when the user asks to "draw", "diagram", "visualize", "show me", "explain as HTML", "make an explainer", or "Schaubild", or when prose alone would make the reader rebuild a graph in their head.
3
+ description: Choose prose, a Mermaid diagram, or a self-contained HTML explainer for agent output, built only from cited evidence. Use when output describes dependencies, call paths, sequences or state, or the user asks for a diagram.
4
4
  ---
5
5
 
6
6
  # Explainers
@@ -1,6 +1,7 @@
1
1
  ---
2
+ disable-model-invocation: true
2
3
  name: fix
3
- description: Draht command prompt wrapper for fix. Use when the user selects the Draht fix workflow or wants systematic root-cause debugging with TDD discipline.
4
+ description: Run the Draht fix command when the user explicitly selects its root-cause debugging and TDD workflow.
4
5
  ---
5
6
 
6
7
  # Draht Command: fix
@@ -0,0 +1,2 @@
1
+ policy:
2
+ allow_implicit_invocation: false
@@ -6,149 +6,35 @@ allowed-tools: Bash, Read, Write, Edit, Task
6
6
 
7
7
  # /fix
8
8
 
9
- Diagnose and fix a bug using the **four-phase systematic debugging protocol**: root cause investigation → pattern analysis → ranked hypotheses & testing → implementation with a reproducing test.
10
-
11
9
  Issue: $ARGUMENTS
12
10
 
13
- > **Tool note**: Invoke `draht-tools <subcommand>` as `node "${PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT:-$HOME/.draht/codex-marketplace/plugins/draht}}/bin/draht-tools.cjs" <subcommand>`. For subagents, spawn Codex subagents using the `debugger` or `implementer` agent prompts.
14
-
15
- ## The Iron Law
16
-
17
- > **NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST.**
18
-
19
- Symptom fixes are failure — they create new bugs in different places. If you find yourself proposing a "quick fix for now, investigate later", STOP and return to Phase 1.
20
-
21
- ## The Report Is a Symptom, Not a Diagnosis
22
-
23
- **Procedure:** Restate the failure as observable behavior — "X happens when Y; expected Z" — before touching anything. If the user names a cause ("the cache is stale"), treat it as Hypothesis #0: it enters the Phase 3 ranking like any other hypothesis and does not skip Phase 1.
24
-
25
- **Example:** "fix the stale cache bug" — Phase 1 traces the data flow and finds the cache is fine; the query behind it silently drops a filter. The fix lands in the query.
26
-
27
- **Prevents:** shipping a correct fix to the wrong component.
11
+ Investigate and repair the reported defect within the requested scope. Historical design questions belong in `/why`; a triage trace supplies hypotheses, not an already-confirmed diagnosis.
28
12
 
29
- Not every why is a bug: if the user is asking why the code is *shaped* the way it is — intent, history, design rationale — and nothing is misbehaving, route to `/why` instead. `/fix` answers defects; `/why` answers intent. When Phase 1 needs design intent (is this behaviour a decision or an accident?), consult `/why` and feed its Preserve/Avoid constraints into the hypothesis ranking. A `/triage` verdict ending in `[triage:bug]` or `[triage:performance]` is a ready entry here: take the linked tracker issue as the report and treat triage's cause-trace findings as ranked-hypothesis material — labeled hypotheses, not a diagnosis.
13
+ > Invoke noninteractive Draht tooling as `node "${PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT:-$HOME/.draht/codex-marketplace/plugins/draht}}/bin/draht-tools.cjs" <subcommand>`. The `debugging-workflow` skill provides investigation guidance.
30
14
 
31
- ## Red Flags — STOP
15
+ ## Investigation
32
16
 
33
- Stop immediately if you catch yourself:
34
- - Proposing "quick fixes for now, investigate later"
35
- - Attempting multiple changes simultaneously
36
- - Skipping a reproducing test before fixing
37
- - Proposing solutions before understanding data flow
38
- - Reading code to build a causal theory before a red-capable reproduction command exists
39
- - Making "one more fix attempt" after already trying 2+
40
- - Watching each fix reveal new problems elsewhere
41
- - Implementing before a failing test exists for the bug
17
+ Read the relevant source, errors, configuration, and history. Restate observed versus expected behavior and identify a command that can expose the symptom. Code inspection and hypotheses may precede reproduction; distinguish a candidate cause from a demonstrated one.
42
18
 
43
- When you've tried **3 fix attempts and still failing**, STOP. This is a **hard cap**, not advice — an architectural problem, not a hypothesis problem. Report back to the user — do not try a 4th fix. Before reporting, append one line to `.planning/STATE.md` under `## Lessons`: what was tried, why it failed, dated — so the next session doesn't repeat the same three attempts.
44
-
45
- ## Atomic Reasoning
46
-
47
- Decompose the work into independently verifiable units before acting; the `atomic-reasoning` skill holds the full discipline — load it when the decomposition is not obvious.
48
-
49
- ## The Four Phases
50
-
51
- ### Phase 1 — Root Cause Investigation (before ANY fix)
52
-
53
- Once the affected/buggy file is identified, run `draht-tools graph-context <buggy-file>` and `draht-tools graph-callers <buggy-file>` to orient (package, layer, who calls it) — paste the summary into the Codex subagent prompt to support its "trace UPWARD" step.
54
-
55
- Dispatch the `debugger` subagent with this prompt:
19
+ Use the `debugger` agent when a separate investigation is useful. Pass the issue, relevant code/context, and this scope:
56
20
 
57
21
  ```
58
- Investigate this issue using Phase 1 root-cause discipline. Do NOT fix anything — only diagnose.
59
-
60
- Issue: $ARGUMENTS
61
-
62
- Walk through these steps and report on each:
63
- 1. Read the error message / stack trace carefully — exact line numbers, exact file paths.
64
- 2. Build a reproduction loop — ONE command that goes red on this bug. This step is the heart of the diagnosis; spend disproportionate effort here. Work down the ladder and take the first rung that reaches the bug:
65
- - failing test at whatever seam reaches the bug (unit, integration, e2e)
66
- - HTTP request script against a running dev server
67
- - CLI invocation on a fixture input, output diffed against a known-good snapshot
68
- - headless browser script asserting on DOM / console / network
69
- - replay of a captured payload, trace, or event log through the code path in isolation
70
- - throwaway harness: a minimal subset of the system (mocked deps) exercising the bug path in one call
71
- - property/fuzz loop: hundreds of random inputs when the output is only sometimes wrong
72
- - bisection harness: automate "checkout state X, run the check" so `git bisect run` can drive it
73
- - differential loop: the same input through old vs new version (or two configs), outputs diffed
74
- - last resort, human-in-the-loop: exact numbered steps for the user to run by hand, output pasted back
75
- Flaky bugs: the goal is a HIGHER reproduction rate, not a clean repro — loop the trigger 100x, add stress, narrow timing windows until it fails often enough to debug against.
76
- Exit checklist — all four must hold before you continue: (a) ONE named command (a test invocation, a script path, a curl); (b) you have ALREADY RUN it at least once; (c) your report shows the invocation AND its output (secrets redacted); (d) it asserts the user's EXACT symptom — able to go red on this bug and green once fixed, not merely "runs without erroring".
77
- Self-interrupt: if you catch yourself reading code to build a causal theory before this command exists, STOP — anchoring on the first plausible idea is the exact failure this protocol prevents. No red-capable command, no steps 4-6.
78
- If you genuinely cannot build a loop: list what you tried, name what you need (environment access, a captured artifact such as a log dump or recording, or permission to add temporary instrumentation), and end with STATUS: NEEDS_CONTEXT rather than guessing.
79
- 3. Check recent changes — `git log --oneline -20` and `git diff HEAD~5` against the affected files. What changed?
80
- 4. For multi-component flows: trace data flow. Where does the bad value originate? What called this with that value? Keep tracing UPWARD until you find the source. Fix at source, not at symptom.
81
- 5. State the root cause as one sentence: "X happens because Y at <file:line>."
82
- 6. Label every statement in your report: observed (you ran it and saw it), derived (follows necessarily from evidence), or assumed (unchecked — say what would check it). A root cause resting on an assumption is a hypothesis, not a diagnosis.
83
-
84
- End your response with `STATUS: DONE | DONE_WITH_CONCERNS | NEEDS_CONTEXT | BLOCKED`.
22
+ Diagnose this issue; do not apply a production fix. Read the affected path and build a reproduction when feasible. Report the supported cause or labeled hypotheses, relevant files, reproduction command/output, and any missing evidence. Respect any read-only restriction, including on test or instrumentation edits.
23
+ End with exactly one: STATUS: DONE, STATUS: DONE_WITH_CONCERNS, STATUS: NEEDS_CONTEXT, or STATUS: BLOCKED.
85
24
  ```
86
25
 
87
- If `BLOCKED` or `NEEDS_CONTEXT`: provide the missing info and re-dispatch. Do not skip ahead.
88
-
89
- ### Phase 2 — Pattern Analysis
90
-
91
- Read the root cause from Phase 1. Then:
92
-
93
- 1. Find working examples in the codebase that do the same kind of thing correctly — use `draht-tools graph-query "<concept>"` to locate reference implementations instead of grepping
94
- 2. Read those reference implementations **completely** — not skimmed
95
- 3. List every difference between the working code and the broken code, however small
96
- 4. Note dependencies: what config, settings, environment, or call-order does the working version assume?
97
-
98
- If Phase 2 reveals a different root cause than Phase 1, go back to Phase 1 and re-investigate. Do not paper over the disagreement.
99
-
100
- ### Phase 3 — Ranked Hypotheses
101
-
102
- 1. Generate **3-5 ranked falsifiable hypotheses** before testing any of them. A single hypothesis anchors you to the first plausible idea — ranking forces the alternatives into view.
103
- 2. Each hypothesis must state its prediction: "If X is the cause, then changing Y will make the bug disappear / changing Z will make it worse." If you cannot state the prediction, it is a vibe — discard it or sharpen it.
104
- 3. If the user named a cause, it is **Hypothesis #0** and enters the ranking with the others — ranked on evidence, not privileged for being first.
105
- 4. Show the ranked list to the user before testing. Domain knowledge re-ranks instantly ("we just deployed a change to #3") and rules hypotheses out for free. Do not block waiting for a reply — proceed in ranked order if none comes.
106
- 5. Test in rank order, one hypothesis at a time. Design the **smallest possible change** that would prove or falsify the prediction — one variable, one line if possible — and re-run the Phase 1 reproduction command to read the verdict.
107
- - **Prediction confirmed** → proceed to Phase 4 with this cause.
108
- - **Falsified** → revert the probe, record which prediction failed, move to the next hypothesis. Do not pile changes on top.
109
- 6. When a probe needs logging, prefer one debugger/REPL inspection over ten log lines; if you must log, tag every line with one unique session prefix, e.g. `[DEBUG-a4f2]`, and never "log everything and grep".
110
- 7. If after 3 falsified hypotheses you are still failing, STOP. Question the architecture, not the ranking. Report to the user.
111
-
112
- You may also say "I don't understand X" rather than pretend. That is the correct answer when it's true.
113
-
114
- ### Phase 4 — Implementation
115
-
116
- Comment discipline: the fix ships no narration — comments exist ONLY for constraints the code cannot express: a protocol quirk, a deliberate deviation, a non-obvious invariant. If code needs comments to be understood, rewrite the code until it doesn't. Never narrate steps, restate the diff, or leave "removed X" / "this handles Y" breadcrumbs. Comment density above the surrounding file's norm is a defect — fix it before committing. A heavily-commented solution signals the design is wrong: redesign, don't annotate.
117
-
118
- 1. **Write the reproducing test FIRST.** Seed it from the Phase 1 reproduction command — the loop that already goes red is the test's skeleton; port its scenario and its symptom assertion to the right test seam. Smallest possible test that demonstrates the bug. Run it — confirm it FAILS for the right reason (not for a syntax error, not for a missing import).
119
- - Commit: `git add <test-files> && git commit -m "red: reproduce <bug>"`
120
-
121
- 2. **Apply the single fix** identified in Phase 3. No other changes — no opportunistic refactor, no "while I'm here".
122
- - Run the failing test — confirm it now PASSES.
123
- - Run the FULL test suite — confirm no regressions.
124
- - Commit: `git add <files> && git commit -m "green: fix <bug>"`
125
-
126
- 3. **Refactor (optional)** — only if there's clear improvement that doesn't change behaviour. Tests must stay green after every change.
127
- - Commit: `git add <files> && git commit -m "refactor: <description>"`
26
+ - If `NEEDS_CONTEXT`, provide available missing information and retry within the budget.
27
+ - If `BLOCKED`, report the blocker and evidence; do not keep retrying.
28
+ - At most 3 re-dispatches or failed repair attempts; stop with a concise record when that bound is reached. It does not establish that the architecture is wrong.
128
29
 
129
- 4. **Verify the fix solved the original symptom**, not just the unit test. Run the user-level reproduction one more time.
30
+ Test plausible causes with discriminating observations or small experiments. Use the number of hypotheses the evidence warrants. Remove unsuccessful probes rather than layering speculative changes. When reproduction is unavailable, continue useful read-only investigation and identify what prevents confirmation.
130
31
 
131
- 5. **Sweep instrumentation** — grep your `[DEBUG-` prefix across the tree; the fix is not done until the grep returns nothing. Tagged probes die here; untagged probes survive to pollute production.
32
+ ## Repair
132
33
 
133
- 6. **Update state**: `draht-tools update-state`
34
+ Apply a focused fix once the evidence supports it. Preserve a regression check: observe it fail for the intended reason before the repair, then pass afterward where a test seam exists. Explain any inability to establish that evidence. Run the original reproduction when available, relevant regression checks, and project-required validation; do not automatically run every available command.
134
35
 
135
- ## Rationalization Table
36
+ Remove temporary instrumentation and avoid unrelated cleanup. Delegate the implementation to `implementer` only when useful, with the issue, scope, evidence, checks, and the same STATUS contract.
136
37
 
137
- | Excuse | Reality |
138
- |--------|---------|
139
- | "Simple bug, skip the process" | Simple bugs have root causes too. The process is fast. |
140
- | "It's an emergency, no time" | Systematic debugging is *faster* than thrashing on guesses. |
141
- | "I'll write the test after I confirm the fix" | Untested fixes don't stick. The test-first proves the bug existed. |
142
- | "I'll just try a few things and see what works" | Can't isolate what worked. Creates new bugs. |
143
- | "I already manually tested it" | A reproducing test is the only durable proof. |
144
- | "The user already told me the cause" | The reporter saw the symptom. Their diagnosis is Hypothesis #0, not a finding. |
145
- | "The fix passed, so my diagnosis was right" | Fixes can mask. Verify the causal chain, not just the symptom's absence. |
146
- | "I can't reproduce it, but the cause is obvious from the code" | Reading code yields theories, not verdicts. No red-capable command, no diagnosis — report NEEDS_CONTEXT and name what's missing. |
38
+ Commit only when authorized. For recorded TDD phases use plain Git with explicit paths and `red:`, `green:`, `refactor:` subjects; never route source commits through docs-only tooling. Update GSD state only for an active GSD task.
147
39
 
148
- ## Rules
149
- - Always reproduce before fixing — a fix without a test is a guess
150
- - One bug, one fix, one commit series. Do not bundle unrelated changes.
151
- - Fix at the source, not the symptom
152
- - If 3 fix attempts have failed, the architecture is wrong — stop and discuss
153
- - If the fix is non-obvious, the commit body explains the chain
154
- - Final report order: verdict first (fixed / not fixed, root cause in one sentence), then evidence (reproducing test red→green, suite results), then risk (what the fix could regress, what stays assumed)
40
+ Report the verdict and supported cause first, decisive commands/results next, then residual risk and missing evidence. A completion claim requires checks that cover the current state; reuse recorded results only when their inputs and environment remain unchanged.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: grill
3
- description: Draht command prompt wrapper for grill. Use when the user wants to stress-test any subject — an idea, a spec, raw tickets, an architecture decision, or an open discussion — through relentless structured interrogation with no presumed outcome. Triggers on phrases like "grill", "stress-test", "poke holes in", "interrogate", "tear this apart".
3
+ description: Examine an idea, specification, or decision through critical questioning when the user asks to stress-test it.
4
4
  ---
5
5
 
6
6
  # Draht Command: grill
@@ -6,61 +6,16 @@ allowed-tools: Bash, Read, Write, Edit, Task
6
6
 
7
7
  # /grill
8
8
 
9
- Interrogate the subject relentlessly until you reach a shared understanding. A grill has no fixed outcome: it can end in a refined spec, a ticket list, a decision record, plain notes, or nothing but the conversation. The output form is chosen at the end, never presumed at the start.
10
-
11
- ## Usage
12
- ```
13
- /grill [subject]
14
- ```
15
-
16
9
  Subject: $ARGUMENTS
17
10
 
18
- > **Tool note**: For environment facts, spawn a Codex subagent using the `architect` agent prompt — read-only fact-finding; never block the current round on it.
19
-
20
- ## The Design Tree
21
-
22
- Map the subject as a **design tree**: every decision branches into the decisions that hang off it. The **frontier** is every decision whose prerequisites are already settled — the questions you can ask now without guessing at answers you haven't heard yet.
23
-
24
- ## Rounds
25
-
26
- 1. **Orient without blocking.** Skim what the subject names before round 1: files mentioned in it, `.planning/` if present, recent git history. Dispatch fact-finders for anything deeper — do not hold the first round for them.
27
- 2. **Ask the WHOLE frontier in one message.** Number every question, foundational → detailed, and give each one a recommended answer:
28
-
29
- ```
30
- **Q1 — <title>**: <body; may offer options>
31
- *Recommended:* <your recommended answer>
32
-
33
- ---
34
-
35
- **Q2 — <title>**: <body>
36
- *Recommended:* <your recommended answer>
37
- ```
38
-
39
- 3. **Defer dependent questions.** A question whose answer depends on another question still open this round belongs to a later round — asking it now means guessing at an answer you haven't heard.
40
- 4. **Let the user answer by number.** "1 yes, 2: B, 4 later" is a complete reply. Anything accepted by number or answered explicitly is **decided**. A recommendation acted on without confirmation is **assumed** and stays flagged until the user confirms it.
41
- 5. **Recompute and repeat.** Every answer reshapes the tree: settled decisions push the frontier outward and unblock the questions that hung off them. Recompute the frontier and ask the next round.
42
-
43
- ## Facts Are Your Job
44
-
45
- Finding facts is your job, never the user's. When a frontier question needs an environment fact — filesystem, git history, code structure, existing docs — dispatch a fact-finder instead of asking. Don't block on it: a running exploration is an unsettled prerequisite, so only the questions downstream of it wait; ask the rest of the frontier now. Decisions belong to the user: put each one to them and wait.
46
-
47
- ## Done
48
-
49
- The grill is done when the frontier is empty: every branch of the tree visited, nothing left silently assumed. Present the decided-vs-assumed summary, then — and only then — ask which artifact to produce:
11
+ Stress-test the subject through focused questions about assumptions, evidence, trade-offs, and failure modes. The result may be a refined idea, decision, spec, ticket list, or simply a clearer conversation; do not presume a GSD handoff.
50
12
 
51
- 1. **Refined spec** → `.planning/specs/YYYY-MM-DD-<slug>-design.md`. When it describes a project to build, offer to hand off to `/new-project` or `/init-project`.
52
- 2. **Ticket list** → `.planning/tickets/YYYY-MM-DD-<slug>.md`
53
- 3. **Decision record** → `.planning/decisions/YYYY-MM-DD-<slug>.md`
54
- 4. **Plain notes** → a file the user names
13
+ Read the relevant context before asking for repository facts. Use the `architect` agent for independent read-only fact-finding when useful; continue questions that do not depend on it.
55
14
 
56
- Whatever form is chosen, write the artifact through the `unslop` skill; the user's own words in quoted decisions stay verbatim.
15
+ Group related open decisions and ask the questions whose answers would change the result. Offer a recommendation with its trade-off when helpful. Defer questions that depend on unresolved answers. Preserve what the user decided, label assumptions, and follow new evidence that challenges the leading approach.
57
16
 
58
- When no `.planning/` directory exists, every mode becomes a standalone file the user names. "No artifact" is a valid answer — sometimes the conversation was the point. Never start implementing or invoke a planning command without the user's explicit go-ahead.
17
+ Continue while useful unresolved questions remain and the user wants deeper examination. There is no requirement to enumerate every imaginable branch or empty a fixed question tree. Respect requests to stop, narrow scope, or proceed with authorized work.
59
18
 
60
- ## Anti-Patterns — STOP
19
+ End with the decisions, consequential assumptions, remaining risks, and recommended next action. Produce the artifact the user requested; otherwise a chat summary is sufficient. Use project conventions for files, and `.planning/` only when that workflow is selected. Follow `unslop` for prose and preserve quoted user decisions exactly.
61
20
 
62
- - **Dribbling questions one at a time** — a serial interview hides the decision tree and wastes rounds; ask the whole frontier, numbered, with recommended answers
63
- - **Asking the user for facts the environment can answer** — filesystem, git history, and code structure are yours to look up
64
- - **Blocking a whole round on a running fact-finder** — only the questions downstream of it wait; ask the rest now
65
- - **Presuming the outcome at round 1** — deciding early that this "is" a spec narrows the questioning to spec-shaped answers
66
- - **Acting on the result before the user confirms shared understanding** — an empty frontier ends the questioning; only the user's confirmation ends the grill
21
+ A request to discuss alone does not authorize implementation. When the user subsequently asks to implement, use that authorization without requiring another ceremonial approval.
@@ -1,11 +1,12 @@
1
1
  ---
2
+ disable-model-invocation: true
2
3
  name: gsd-workflow
3
- description: Draht's Get Shit Done workflow — how to use /new-project, /discuss-phase, /plan-phase, /execute-phase, /verify-work, /next-milestone, /pause-work, /resume-work, /progress, /fix, /quick and the .planning/ directory structure to drive a project from idea to shipping. Use when the user asks how to plan work, structure a project, set up milestones, track progress, or wants to start using draht's workflow.
4
+ description: Optional GSD milestone and phase workflow with .planning/ artifacts. Use only when the user explicitly chooses GSD, asks about its lifecycle, or invokes its project or phase commands.
4
5
  ---
5
6
 
6
7
  # GSD (Get Shit Done) Workflow
7
8
 
8
- Draht's GSD workflow is a milestone → phase → plan → task hierarchy that lives in `.planning/` and is driven by slash commands + hooks.
9
+ GSD is an optional milestone → phase → plan → task hierarchy in `.planning/`, selected through explicit project-management commands. It is not required for ordinary coding, debugging, review, or verification. The presence of `.planning/` alone does not select this workflow; it may hold only a codebase graph or historical context.
9
10
 
10
11
  At repository-saga scope, each planned `saga-spawner` beat maps 1:1 to one roadmap phase; the saga graph schedules phases without replacing their plans or verification.
11
12
 
@@ -55,14 +56,14 @@ If `MAP.json` is absent, run `draht-tools map-graph` first. Subagents can't run
55
56
  - **`/init-project`** — existing codebase: map → extract domain → questioning → roadmap
56
57
  - **`/map-codebase`** — standalone codebase analysis
57
58
 
58
- ### Per-phase cycle (fresh session between each step)
59
+ ### Per-phase cycle (when selected)
59
60
  Each step is **graph-first** (see above): orient via `graph-context`/`graph-query`/`graph-impact` before grepping or walking the tree.
60
61
  1. **`/discuss-phase N`** — capture decisions, gray areas, domain terms
61
62
  2. **`/plan-phase N`** — create atomic execution plans (parallel via `architect` subagents). Architects emit `---END-PLAN---` to separate plan content from the `STATUS:` footer.
62
63
  3. **`/execute-phase N`** — per-task three-stage loop: `implementer → spec-reviewer → reviewer`. TDD red→green→refactor inside each implementer task. Tasks within a plan are sequential; independent plans parallelize.
63
64
  4. **`/verify-work N`** — parallel `verifier` + `security-auditor` + `reviewer` + `spec-reviewer` (phase-level compliance against the plan files), produce UAT report.
64
65
 
65
- Start a fresh session (`/clear`) between steps. Each command assumes a clean context.
66
+ Session resets are optional. Carry relevant plans, evidence, and unresolved work when a context handoff is useful.
66
67
 
67
68
  ### Milestone transition
68
69
  - **`/next-milestone`** — only after ALL phases in the current milestone are `complete`
@@ -73,10 +74,10 @@ Start a fresh session (`/clear`) between steps. Each command assumes a clean con
73
74
  - **`/progress`** — show current position in the roadmap
74
75
 
75
76
  ### Ad-hoc
76
- - **`/quick`** — small task with tracking. Implementer → spec-reviewer → (optional) reviewer.
77
- - **`/fix`** — bug fix with 4-phase systematic debugging (root cause → pattern → hypothesis → reproducing-test-first impl). Stops after 3 failed fix attempts.
77
+ - **`/quick`** — complete an ad-hoc task directly with relevant checks; specialist delegation is optional and planning artifacts are not required.
78
+ - **`/fix`** — investigate a bug, test the leading explanation, then fix and verify it. Stops after 3 failed fix attempts without treating that retry limit as a diagnosis.
78
79
  - **`/review`** — parallel `reviewer` + `security-auditor`, plus `spec-reviewer` when a plan is in scope.
79
- - **`/atomic-commit`** — analyze diff, split into atomic conventional commits (Red Flag block prevents mixed-concern commits).
80
+ - **`/atomic-commit`** — analyze the diff and create authorized atomic conventional commits.
80
81
  - **`/orchestrate`** — general-purpose specialist dispatch with parallel / chain / fan-out / two-stage modes.
81
82
 
82
83
  ## Subagent Roster
@@ -94,14 +95,14 @@ Start a fresh session (`/clear`) between steps. Each command assumes a clean con
94
95
 
95
96
  ## Subagent STATUS Protocol
96
97
 
97
- Every draht agent ends with one of four status lines. Orchestrating commands branch on it:
98
+ Orchestrating commands must request one final status line from each dispatched agent and check its evidence:
98
99
 
99
- - **`STATUS: DONE`** — proceed
100
+ - **`STATUS: DONE`** — proceed after checking the evidence
100
101
  - **`STATUS: DONE_WITH_CONCERNS`** — proceed; log concerns. If correctness-related, address first.
101
102
  - **`STATUS: NEEDS_CONTEXT`** — provide missing info and re-dispatch the same agent
102
- - **`STATUS: BLOCKED`** — STOP. Do not retry the same agent on the same input. Adjust inputs or surface to user.
103
+ - **`STATUS: BLOCKED`** — an implementer blocker stops the task. Review findings return to the implementer and required reviews, within the active command's retry cap (at most 3 implementer re-dispatches per task). Do not retry unchanged inputs or advance past unresolved required findings.
103
104
 
104
- For any spec-driven work, `spec-reviewer` runs **before** `reviewer`. Spec compliance prevents over/under-building; running quality review first lets spec gaps hide.
105
+ When both reviews are required by a selected workflow, run `spec-reviewer` before `reviewer`.
105
106
 
106
107
  ## Task Format (XML inside PLAN.md files)
107
108
 
@@ -128,37 +129,52 @@ The plugin ships workflow hooks under `${PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT}}/scr
128
129
  - `gsd-pre-execute.cjs <phase>` — preconditions before execution (DOMAIN.md, plans, uncommitted changes)
129
130
  - `gsd-post-task.cjs <phase> <plan> <task> <status> [commit]` — record result + type check + tests + TDD cycle check
130
131
  - `gsd-post-phase.cjs <phase>` — generate phase report, update ROADMAP status
131
- - `gsd-quality-gate.cjs [--strict]` — lint + typecheck + test + coverage against `.planning/config.json` threshold
132
+ - `gsd-quality-gate.cjs [--strict]` — applicable lint, typecheck, and tests, plus source/domain heuristics; `--no-tests --checks-only` restricts it to deterministic type and lint checks
132
133
 
133
- These are invoked from inside commands. In addition, two **lifecycle hooks** fire automatically regardless of command prose (registered in `hooks/hooks.json`):
134
+ The phase hooks are invoked by their explicit commands. Automatic checks are independent of GSD and do not require `.planning/` (registered in `hooks/hooks.json`):
134
135
 
135
136
  - `post-edit-check.cjs` — PostToolUse on Edit/Write: file-scoped lint feedback on every edit
136
- - `stop-quality-gate.cjs` — Stop: runs the quality gate when a turn ends with uncommitted source changes in a `.planning` project
137
+ - `stop-quality-gate.cjs` — Stop: runs project-defined `.draht/checks.json` commands and reuses successful results while their inputs are unchanged. Without that configuration, plugins run type/lint checks on uncommitted source changes. Automatic verification excludes GSD heuristics.
138
+
139
+ Native sessions run the same configured project checks before completion in trusted projects. Failed checks return diagnostics for at most three repair attempts, then leave a visible unverified result. Neither committed changes nor non-JavaScript inputs escape configured checks. Tests run automatically only when the project explicitly configures them; focused task checks can still be run directly.
137
140
 
138
141
  ## Configuration
139
142
 
140
- `.planning/config.json` (optional):
143
+ Use `.draht/checks.json` for deterministic verification, independently of GSD:
144
+
145
+ ```json
146
+ {
147
+ "checks": [
148
+ { "name": "acceptance", "command": ["node", "scripts/check.mjs"], "inputs": ["src", "scripts/check.mjs", "package.json"] }
149
+ ]
150
+ }
151
+ ```
152
+
153
+ Commands are argv arrays; paths are project-relative files/directories, without globs. Include all dependencies in `inputs`, or omit it to cover the project. Set `cache: false` for checks that depend on services, environment variables, or ignored dependencies. Configured failures always block, including on repeated Stop events; `enabled: false` explicitly disables this gate. Use the runner's `--force` option to discard reusable evidence.
154
+
155
+ `.planning/config.json` controls optional GSD hooks and the plugins' unconfigured fallback:
141
156
 
142
157
  ```json
143
158
  {
144
159
  "hooks": {
145
- "coverageThreshold": 80,
146
160
  "tddMode": "advisory",
147
161
  "qualityGateStrict": true,
148
- "stopGate": true
162
+ "stopGate": true,
163
+ "planningContext": false
149
164
  }
150
165
  }
151
166
  ```
152
167
 
153
168
  - `tddMode: "strict"` — post-task hook aborts on green: commit without preceding red:
154
169
  - `tddMode: "advisory"` — logs a warning instead
155
- - `qualityGateStrict` — **defaults to true**: the gate fails (exit 1) on any lint/type/test/coverage miss; set `false` to demote to warnings
156
- - `stopGate: false` — disable the automatic Stop-time quality gate
157
- - Hard stop: 3 recorded failures for the same task make `gsd-post-task.cjs` exit non-zero — the retry loop ends there
170
+ - `qualityGateStrict` — defaults to true in standalone quality gates: failed applicable lint/type/test commands return nonzero; set `false` for legacy advisory results. Post-task verification still records failures in advisory mode. Configured `.draht/checks.json` checks always enforce their exit status.
171
+ - `stopGate: false` — disable the plugin fallback when no `.draht/checks.json` exists
172
+ - `planningContext: true` — opt into automatic planning-state context at session start and before prompts. The default is silent, even when planning files exist; explicit workflows can read those files themselves.
173
+ - Hard stop: 3 recorded failures for the same task end the retry loop. A strict post-task verification failure also returns nonzero before that cap; it must be corrected without exceeding the cap.
158
174
 
159
175
  ## Key Rules
160
176
 
161
- - One phase at a time, one cycle step per session
177
+ - When GSD is selected, track the active phase and complete its required gates and documented handoffs
162
178
  - `/next-milestone` ONLY after every phase in the current milestone is verified
163
179
  - Fix plans include a reproducing test before any implementation
164
180
  - Never skip verification — it's the only thing that marks a phase complete
@@ -0,0 +1,2 @@
1
+ policy:
2
+ allow_implicit_invocation: false
@@ -1,4 +1,5 @@
1
1
  ---
2
+ disable-model-invocation: true
2
3
  name: init-project
3
4
  description: Draht command prompt wrapper for init-project. Use when the user selects the Draht init-project workflow or wants to initialize GSD planning for an existing codebase.
4
5
  ---
@@ -0,0 +1,2 @@
1
+ policy:
2
+ allow_implicit_invocation: false