draht-codex 2026.7.30 → 2026.10.4-2

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 (110) hide show
  1. package/.codex-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +81 -0
  3. package/README.md +57 -6
  4. package/agents/debugger.md +12 -1
  5. package/agents/git-committer.md +1 -0
  6. package/agents/implementer.md +11 -2
  7. package/agents/investigator.md +75 -0
  8. package/agents/reviewer.md +7 -0
  9. package/agents/speaker.md +44 -0
  10. package/agents/verifier.md +4 -3
  11. package/bin/draht-tools.cjs +472 -41
  12. package/bin/judge +613 -0
  13. package/cli.mjs +769 -46
  14. package/commands/atomic-commit.md +1 -12
  15. package/commands/create-verification-skill.md +105 -0
  16. package/commands/discuss-phase.md +3 -14
  17. package/commands/execute-phase.md +7 -14
  18. package/commands/fix.md +38 -17
  19. package/commands/grill.md +66 -0
  20. package/commands/init-project.md +5 -15
  21. package/commands/map-codebase.md +1 -13
  22. package/commands/new-project.md +5 -15
  23. package/commands/next-milestone.md +2 -13
  24. package/commands/orchestrate.md +1 -1
  25. package/commands/pause-work.md +1 -8
  26. package/commands/plan-phase.md +3 -11
  27. package/commands/progress.md +0 -8
  28. package/commands/quick.md +3 -11
  29. package/commands/resolve-conflicts.md +72 -0
  30. package/commands/resume-work.md +0 -8
  31. package/commands/review.md +6 -13
  32. package/commands/speak.md +45 -0
  33. package/commands/triage.md +161 -0
  34. package/commands/verify-work.md +6 -13
  35. package/commands/why.md +141 -0
  36. package/graph-archive.mjs +125 -0
  37. package/graph-manifest.mjs +97 -0
  38. package/hooks/hooks.json +39 -0
  39. package/package.json +5 -3
  40. package/scripts/gsd-quality-gate.cjs +3 -3
  41. package/scripts/judge-hook.cjs +42 -0
  42. package/scripts/judge-hook.py +391 -0
  43. package/scripts/judgegates.py +673 -0
  44. package/scripts/judgelib.py +382 -0
  45. package/scripts/speak.cjs +202 -0
  46. package/skills/atomic-commit/SKILL.md +1 -1
  47. package/skills/atomic-commit/command.md +62 -0
  48. package/skills/blast-radius/SKILL.md +56 -0
  49. package/skills/brainstorming/SKILL.md +11 -4
  50. package/skills/cinematic-continuation/SKILL.md +111 -0
  51. package/skills/cinematic-continuation/references/continuity-schema.md +75 -0
  52. package/skills/cinematic-continuation/references/seedance-adapter.md +44 -0
  53. package/skills/cinematic-continuation/references/style-bible.md +223 -0
  54. package/skills/cinematic-continuation/scripts/compile-continuation.mjs +173 -0
  55. package/skills/cinematic-continuation/templates/continuation-spec.json +50 -0
  56. package/skills/create-verification-skill/SKILL.md +14 -0
  57. package/skills/create-verification-skill/command.md +105 -0
  58. package/skills/debugging-workflow/SKILL.md +38 -10
  59. package/skills/discuss-phase/SKILL.md +1 -1
  60. package/skills/discuss-phase/command.md +44 -0
  61. package/skills/draht/SKILL.md +119 -0
  62. package/skills/epistemics/SKILL.md +99 -0
  63. package/skills/execute-phase/SKILL.md +1 -1
  64. package/skills/execute-phase/command.md +170 -0
  65. package/skills/explainers/SKILL.md +65 -0
  66. package/skills/fix/SKILL.md +1 -1
  67. package/skills/fix/command.md +154 -0
  68. package/skills/grill/SKILL.md +14 -0
  69. package/skills/grill/command.md +66 -0
  70. package/skills/gsd-workflow/SKILL.md +2 -0
  71. package/skills/init-project/SKILL.md +1 -1
  72. package/skills/init-project/command.md +57 -0
  73. package/skills/judge/SKILL.md +57 -0
  74. package/skills/map-codebase/SKILL.md +1 -1
  75. package/skills/map-codebase/command.md +61 -0
  76. package/skills/new-project/SKILL.md +1 -1
  77. package/skills/new-project/command.md +64 -0
  78. package/skills/next-milestone/SKILL.md +1 -1
  79. package/skills/next-milestone/command.md +42 -0
  80. package/skills/orchestrate/SKILL.md +1 -1
  81. package/skills/orchestrate/command.md +106 -0
  82. package/skills/orchestrate-loop/SKILL.md +1 -1
  83. package/skills/orchestrate-loop/command.md +100 -0
  84. package/skills/pause-work/SKILL.md +1 -1
  85. package/skills/pause-work/command.md +32 -0
  86. package/skills/plan-phase/SKILL.md +1 -1
  87. package/skills/plan-phase/command.md +140 -0
  88. package/skills/progress/SKILL.md +1 -1
  89. package/skills/progress/command.md +22 -0
  90. package/skills/quick/SKILL.md +1 -1
  91. package/skills/quick/command.md +91 -0
  92. package/skills/resolve-conflicts/SKILL.md +14 -0
  93. package/skills/resolve-conflicts/command.md +72 -0
  94. package/skills/resume-work/SKILL.md +1 -1
  95. package/skills/resume-work/command.md +27 -0
  96. package/skills/review/SKILL.md +1 -1
  97. package/skills/review/command.md +83 -0
  98. package/skills/saga-spawner/SKILL.md +131 -0
  99. package/skills/speak/SKILL.md +14 -0
  100. package/skills/speak/command.md +45 -0
  101. package/skills/tdd-workflow/SKILL.md +2 -0
  102. package/skills/triage/SKILL.md +14 -0
  103. package/skills/triage/command.md +161 -0
  104. package/skills/typescript-discipline/SKILL.md +50 -0
  105. package/skills/typescript-discipline/references/patterns.md +294 -0
  106. package/skills/unslop/SKILL.md +119 -0
  107. package/skills/verify-work/SKILL.md +1 -1
  108. package/skills/verify-work/command.md +117 -0
  109. package/skills/why/SKILL.md +14 -0
  110. package/skills/why/command.md +141 -0
@@ -0,0 +1,57 @@
1
+ ---
2
+ description: Initialize GSD planning for an existing project (codebase mapping → questioning → domain model → roadmap)
3
+ argument-hint: "[focus area]"
4
+ allowed-tools: Bash, Read, Write, Edit, Task
5
+ ---
6
+
7
+ # /init-project
8
+
9
+ Initialize planning framework for an existing project: codebase mapping → questioning → domain model → requirements → roadmap.
10
+
11
+ Focus: $ARGUMENTS
12
+
13
+ Use this when you have an existing codebase and want to add structured planning. For greenfield projects, use `/new-project` instead.
14
+
15
+ > **Tool note**: Invoke `draht-tools <subcommand>` as `node "${PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT:-$HOME/.draht/codex-marketplace/plugins/draht}}/bin/draht-tools.cjs" <subcommand>` via the Bash tool.
16
+
17
+ ## Atomic Reasoning
18
+
19
+ 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.
20
+
21
+ ## Steps
22
+ 1. Run `draht-tools init` to check preconditions (git repo, etc.)
23
+ 2. Run `draht-tools map-codebase` to build a structural map of the existing code, then `draht-tools map-graph` to produce `.planning/codebase/MAP.json` + `GRAPH_REPORT.md` (map-codebase alone does NOT emit MAP.json)
24
+ 3. Analyze the codebase map to understand architecture, tech stack, and conventions: read `.planning/codebase/MAP.json` and run `draht-tools graph-hotspots` + `draht-tools graph-clusters` to surface high-traffic and cohesive modules
25
+ 4. Deep questioning phase (3-7 rounds — each round asks the whole frontier: settled-prerequisite questions only, numbered, each with a recommended answer):
26
+ - What is this project? Who uses it?
27
+ - What are the current pain points or goals?
28
+ - What is MVP vs aspirational scope?
29
+ - What constraints exist (infra, team size, deadlines)?
30
+ 5. Run `draht-tools create-project` with gathered info
31
+ 6. Run `draht-tools create-domain-model` to define bounded contexts, entities, and ubiquitous language
32
+ 7. Create `.planning/DOMAIN.md` with the same sections as `/new-project`:
33
+ Bounded Contexts, Ubiquitous Language, Context Map, Aggregates, Domain Events.
34
+ Seed the Ubiquitous Language glossary from `GRAPH_REPORT.md` key concepts / `modules[*].symbols` (start from extracted terms, not zero)
35
+ 8. Create `.planning/TEST-STRATEGY.md` with: Test Framework, Directory Conventions, Coverage Goals, Testing Levels, Excluded
36
+ 9. Optional research phase via `draht-tools research`
37
+ 10. Run `draht-tools create-requirements` with v1/v2/out-of-scope (map requirements to bounded contexts)
38
+ 11. Run `draht-tools create-roadmap` with phases
39
+ 12. Run `draht-tools init-state`
40
+ 13. Git commit via `draht-tools commit-docs "initialize project planning"`
41
+
42
+ ## Workflow
43
+ After project initialization, phases are executed one at a time in fresh sessions:
44
+
45
+ ```
46
+ /init-project → /discuss-phase 1 → /plan-phase 1 → /execute-phase 1 → /verify-work 1
47
+ → ... (repeat for all phases in the milestone)
48
+ → /next-milestone (only after ALL phases are complete)
49
+ ```
50
+
51
+ ## Rules
52
+ - Ask the whole frontier per round — numbered, each with a recommended answer; the user replies by number, and accepted-by-number counts as decided
53
+ - Questions that depend on still-open answers wait for a later round
54
+ - Finding facts is your job, never the user's — dispatch a subagent for anything the environment can answer and keep asking the rest of the frontier while it runs
55
+ - When the focus names a solution ("migrate to X"), ask what problem it solves — the existing code may admit a smaller answer
56
+ - Respect what already exists — do not propose rewriting working code
57
+ - Stop when you have: current state, goals, MVP scope, constraints, success criteria
@@ -0,0 +1,57 @@
1
+ ---
2
+ name: judge
3
+ description: The judge queue — a human-judgment TUI that reviews the gates an agent writes, replaying each new test to show whether it can actually fail before the implementation is written. Use when the user asks to open, start, or check judge, asks why an edit was held or denied, asks how good the project's tests are as gates, or when a "[judge]" feedback block appears in context.
4
+ ---
5
+
6
+ # judge
7
+
8
+ `judge` reviews **gates**: the tests a session writes to constrain itself. A test the agent wrote is a claim, not evidence — the same process that can get the code wrong wrote the check that is supposed to catch it. This queue turns the claim into evidence wherever a machine can, and puts one question to the human: is this the right thing to gate, and is the bar high enough.
9
+
10
+ It cannot run inside an agent session — it needs its own terminal pane.
11
+
12
+ ## When the user asks to open it
13
+
14
+ Run this immediately (no confirmation) and report the one-line result:
15
+
16
+ judge open
17
+
18
+ That pops a new cmux split to the right with the TUI running. If it prints that cmux is not found, tell the user to run `judge` in any other terminal pane. If it says "already running", say so.
19
+
20
+ If `judge` is not on PATH, the same binary ships with this plugin at `${PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT:-$HOME/.draht/codex-marketplace/plugins/draht}}/bin/judge` — run it by path, and tell the user the plugin installer can link it onto PATH for them.
21
+
22
+ Other commands: `judge list` (the open queue), `judge gates` (the ledger: every judged gate, its mutation kill rate, the recurring smells), `judge clear` (expire every open card).
23
+
24
+ ## What a gate card is
25
+
26
+ Two stages, because the two questions can only be answered at different moments.
27
+
28
+ **RED** — a test was written and the session is now reaching for the implementation. The test is replayed against the code as it stands, in a throwaway worktree, and the result is on the card:
29
+
30
+ - *fails on an assertion* — a real red. The test knows what wrong behaviour looks like.
31
+ - *fails on an import or compile error* — a weak red. It proves a module is missing, not that behaviour is checked.
32
+ - *PASSES without the implementation* — not a gate at all. This one is denied without asking anyone: a test that already passes cannot fail when the implementation about to be written is wrong, whatever it turns out to be.
33
+
34
+ A test written for behaviour that already exists is a different case, and is not treated as a lie: with no implementation coming, passing is the expected result, so it is carded as *already-green* at the end of the turn and nothing is held.
35
+
36
+ **GREEN** — the implementation landed and the test passes. Single-token mutations are applied to the source lines the change touched (comparisons flipped, boolean operators swapped, literals bumped) and the test is re-run against each. A mutation the test does not notice is a survivor, and a gate whose survivors outnumber its kills does not bite. Mutants that fail to compile are discarded rather than counted as caught.
37
+
38
+ Both stages also carry static smells that no run can excuse: assertions only about mocks being called, a snapshot as the sole assertion, no assertion at all, a tautology, a skipped or `.only` test, reaching into private internals, an empty catch swallowing the failure.
39
+
40
+ ## What a verdict does
41
+
42
+ A gate is held while it is judged, so:
43
+
44
+ - **real gate →** the edit proceeds; the gate is recorded for the mutation pass once the implementation lands.
45
+ - **weak gate ←** the edit is denied and the session receives the evidence plus the reviewer's comment. Address it by strengthening the test — assert the behaviour that would actually break — and do not write the implementation until the gate would catch a wrong one. If the reject carried no comment, work out from the evidence why the gate is too weak and say what you think was wrong before changing it.
46
+
47
+ When you see a `[judge]` block, that is the human's verdict on the gate you just wrote. It comes before everything else you were doing.
48
+
49
+ ## What stays out of the way
50
+
51
+ Nothing is gated unless the TUI is running: with judge closed, edits proceed and the host's own permission dialog behaves exactly as it did before. Permission prompts and finished turns still queue as their own card kinds. A repo with no runnable test command, no git, or a suite that will not start produces a card with less evidence on it — never a blocked session.
52
+
53
+ Per-repo settings live under `"gates"` in `.planning/config.json`: `enabled`, `testCommand` (with `{file}` substituted), `timeout`, `mutants`, `budget`. `JUDGE_GATES=0` in the environment turns the whole thing off.
54
+
55
+ ## State
56
+
57
+ Everything lives under the host config dir, in `$CLAUDE_CONFIG_DIR/judge`: `cards` for the queue, `inbox/<session>` for undelivered feedback, `sessions` for which tests are still unjudged, `gates.jsonl` for the ledger, and `heartbeat`, touched once a second while the TUI runs. The draht status line reads the same directory to show its `⚖ N` segment.
@@ -8,7 +8,7 @@ description: Draht command prompt wrapper for map-codebase. Use when the user se
8
8
  This skill exposes the Draht prompt command template to Codex's `$draht` and `/skills` surfaces.
9
9
 
10
10
  When invoked:
11
- 1. Read `../../commands/map-codebase.md` relative to this `SKILL.md`.
11
+ 1. Read `./command.md` in this skill's directory.
12
12
  2. Treat the user's text after the skill mention as `$ARGUMENTS`. If the template uses `$1`, use the first positional argument.
13
13
  3. Follow that command template as the active workflow.
14
14
  4. Use Draht support skills such as `atomic-reasoning`, `tdd-workflow`, `verification-gate`, or `debugging-workflow` when the command template calls for that discipline.
@@ -0,0 +1,61 @@
1
+ ---
2
+ description: Analyze existing codebase before planning — extract architecture, domain model, and test strategy
3
+ argument-hint: "[directory]"
4
+ allowed-tools: Bash, Read, Write, Edit, Task, Grep, Glob
5
+ ---
6
+
7
+ # /map-codebase
8
+
9
+ Analyze existing codebase before planning, using subagents for parallel analysis.
10
+
11
+ Directory: $1
12
+
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 matching Draht agent prompts (for example `architect` and `verifier`).
14
+
15
+ ## Atomic Reasoning
16
+
17
+ 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.
18
+
19
+ ## Steps
20
+ 1. Run `draht-tools map-codebase $1`
21
+ 2. Tool generates the prose docs (STACK.md, ARCHITECTURE.md, CONVENTIONS.md, CONCERNS.md, DOMAIN-HINTS.md) **and**, in the same pass, the **living architecture map** (MAP.json + MAP.html + GRAPH_REPORT.md).
22
+ 2a. The living architecture map produced by step 1 (re-run `draht-tools map-graph $1` any time to refresh just the map without rewriting the docs):
23
+ - `.planning/codebase/MAP.json` — machine-readable map with **entry points** (CLI bins, HTTP routes, library main exports), **sinks** (FS / net / DB / stdout / exec calls), **bounded contexts** (packages), **cross-package dataflow edges**, **symbol-resolved call edges**, **flows** (which sinks each entry point reaches and through which intermediate module), per-module **layer** (presentation / application / domain / infrastructure / support), and exports/imports per file. Agents starting a new task should read MAP.json first instead of re-scanning the tree.
24
+ - `.planning/codebase/MAP.html` — interactive layered visualization with four views:
25
+ - **Architecture** — packages drawn as containers in architectural layers, with cross-package dataflow arrows. Thickness encodes import count.
26
+ - **Modules** — every file inside its package container, import edges between them; click a package or sink to highlight.
27
+ - **Flow Trace** — entry points on top, sinks on bottom, intermediate modules ranked by depth from entry. Click an entry point to trace which sinks it reaches.
28
+ - **Insights** — graphify-style knowledge graph: clusters (label-propagation communities), god-nodes (high-degree hotspots), and surprising cross-cluster edges.
29
+ Open directly, or run `draht-tools map-serve` for a live-reloading dev view (regenerates on every file save).
30
+
31
+ 3. **Run parallel deep analysis via Codex subagents**:
32
+ Dispatch these two subagents in parallel (single assistant turn, two Codex subagent calls):
33
+
34
+ - **Codex subagent** with ``architect` agent prompt` and prompt:
35
+ "Analyze the codebase at $1. Identify bounded contexts from directory structure — look for top-level src/ subdirectories, packages, or modules that encapsulate coherent domain concepts. Note any cross-directory coupling suggesting blurred context boundaries. Extract domain language: collect PascalCase class/interface/type names, key function names, database table/collection names. Look for repeated nouns representing core domain concepts. Output a structured list of: bounded contexts (name + description), domain terms (glossary), aggregates per context, and context relationships (upstream/downstream, shared kernel, ACL).
36
+
37
+ End with `STATUS: DONE | DONE_WITH_CONCERNS | NEEDS_CONTEXT | BLOCKED`."
38
+
39
+ - **Codex subagent** with ``verifier` agent prompt` and prompt:
40
+ "Analyze the test infrastructure at $1. Discover: test framework(s) in use (check package.json, config files), test directory conventions (co-located, __tests__/, test/), existing coverage configuration and goals, which layers have tests (unit, integration, e2e), gaps and recommendations. Output a structured test strategy report.
41
+
42
+ End with `STATUS: DONE | DONE_WITH_CONCERNS | NEEDS_CONTEXT | BLOCKED`."
43
+
44
+ 4. Read each subagent's `STATUS:` line. `BLOCKED` or `NEEDS_CONTEXT` from either means STOP — `map-codebase` produces foundational artifacts and partial output here causes downstream confusion. Collect subagent results and merge with the draht-tools output.
45
+ 5. Create `.planning/DOMAIN.md` (if it doesn't exist). Everything in it is **inferred from code, not confirmed by the user** — mark uncertain context boundaries and ambiguous terms as `(inferred)` so later commands know to confirm rather than build on them. With:
46
+ - `## Bounded Contexts` — one entry per discovered context with a brief description
47
+ - `## Ubiquitous Language` — glossary of extracted domain terms
48
+ - `## Context Map` — how bounded contexts relate (upstream/downstream, shared kernel, ACL)
49
+ - `## Aggregates` — aggregates and their root entities per context
50
+ - `## Domain Events` — any existing event names or patterns discovered
51
+ 6. Create `.planning/TEST-STRATEGY.md` with: Test Framework, Directory Conventions, Coverage Goals, Testing Levels, Excluded
52
+ 7. Commit: `draht-tools commit-docs "map existing codebase"`
53
+
54
+ ## Living map for agents
55
+
56
+ Step 2a also writes `.planning/codebase/GRAPH_REPORT.md` — the **primary skimmable artifact**: key concepts (clusters), god nodes, surprising connections, and suggested questions. Read it first for orientation.
57
+ - The `MAP.json` is the machine-readable source of truth — now also carrying **clusters**, **hotspots**, **surprisingConnections**, **rationaleIndex**, per-module **symbols**, and edge **confidence** fields.
58
+ - Instead of walking the tree, agents orient with `draht-tools graph-context <file>`, `graph-impact <file>`, `graph-query "<concept>"`, `graph-callers`/`graph-callees`, `graph-path <from> <to>`, `graph-hotspots`, and `graph-clusters`.
59
+ - MAP.html gains an **Insights** view (clusters, god-nodes, surprising edges) alongside System / Modules / Flows.
60
+ - It is regenerated every time `map-codebase`, `map-graph`, or `map-serve` runs; run `draht-tools graph-hook install` to auto-refresh MAP.json on every commit.
61
+ - Developers can keep `draht-tools map-serve` running in a terminal — the HTML visualization updates live as files change, so architecture documentation is never stale.
@@ -8,7 +8,7 @@ description: Draht command prompt wrapper for new-project. Use when the user sel
8
8
  This skill exposes the Draht prompt command template to Codex's `$draht` and `/skills` surfaces.
9
9
 
10
10
  When invoked:
11
- 1. Read `../../commands/new-project.md` relative to this `SKILL.md`.
11
+ 1. Read `./command.md` in this skill's directory.
12
12
  2. Treat the user's text after the skill mention as `$ARGUMENTS`. If the template uses `$1`, use the first positional argument.
13
13
  3. Follow that command template as the active workflow.
14
14
  4. Use Draht support skills such as `atomic-reasoning`, `tdd-workflow`, `verification-gate`, or `debugging-workflow` when the command template calls for that discipline.
@@ -0,0 +1,64 @@
1
+ ---
2
+ description: Initialize a new project with structured GSD planning (questioning → domain model → requirements → roadmap)
3
+ argument-hint: "[description]"
4
+ allowed-tools: Bash, Read, Write, Edit, Task
5
+ ---
6
+
7
+ # /new-project
8
+
9
+ Initialize a new project: questioning → research → requirements → roadmap.
10
+
11
+ Description: $ARGUMENTS
12
+
13
+ > **Tool note**: When this command says `draht-tools <subcommand>`, invoke it as `node "${PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT:-$HOME/.draht/codex-marketplace/plugins/draht}}/bin/draht-tools.cjs" <subcommand>` via the Bash tool. `PLUGIN_ROOT` is used when Codex exposes it; `CLAUDE_PLUGIN_ROOT` is a compatibility fallback.
14
+
15
+ ## Atomic Reasoning
16
+
17
+ 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.
18
+
19
+ ## Steps
20
+ 1. Run `draht-tools init` to check preconditions
21
+ 2. If existing code detected, run `draht-tools map-codebase` first
22
+ 3. Deep questioning phase (3-7 rounds — each round asks the whole frontier: every question whose prerequisites are settled, numbered, each with a recommended answer)
23
+ 4. Run `draht-tools create-project` with gathered info
24
+ 5. Run `draht-tools create-domain-model` to define bounded contexts, entities, and ubiquitous language
25
+ 6. Create `.planning/DOMAIN.md` with:
26
+ - `## Bounded Contexts` — each context with name, responsibility, and brief description
27
+ - `## Ubiquitous Language` — glossary of domain terms agreed with the user (term → definition)
28
+ - `## Context Map` — how bounded contexts relate to each other (upstream/downstream, shared kernel, ACL)
29
+ - `## Aggregates` — aggregates and their root entities per context
30
+ - `## Domain Events` — named events that cross context boundaries
31
+ 7. Create `.planning/TEST-STRATEGY.md` with:
32
+ - `## Test Framework` — chosen framework and rationale
33
+ - `## Directory Conventions` — where test files live relative to source
34
+ - `## Coverage Goals` — target coverage percentage and which paths are critical
35
+ - `## Testing Levels` — what is tested at unit level vs integration vs e2e, with examples
36
+ - `## Excluded` — what is explicitly not tested and why (config files, generated code, etc.)
37
+ 8. Optional research phase via `draht-tools research`
38
+ 9. Run `draht-tools create-requirements` with v1/v2/out-of-scope (map requirements to bounded contexts)
39
+ 10. Run `draht-tools create-roadmap` with phases
40
+ 11. Run `draht-tools init-state`
41
+ 12. Git commit via `draht-tools commit-docs "initialize project planning"`
42
+
43
+ ## Workflow
44
+ After project initialization, phases are executed one at a time in fresh sessions:
45
+
46
+ ```
47
+ /new-project → /discuss-phase 1 → /plan-phase 1 → /execute-phase 1 → /verify-work 1
48
+ → /discuss-phase 2 → /plan-phase 2 → /execute-phase 2 → /verify-work 2
49
+ → ... (repeat for all phases in the milestone)
50
+ → /next-milestone (only after ALL phases are complete)
51
+ ```
52
+
53
+ Start a fresh session (`/clear`) between steps. Do NOT suggest `/next-milestone` until every phase in the milestone is verified.
54
+
55
+ ## Rules
56
+ - Ask the whole frontier per round — numbered, each with a recommended answer; the user replies by number, and accepted-by-number counts as decided
57
+ - Questions that depend on still-open answers wait for a later round
58
+ - Finding facts is your job, never the user's — dispatch a subagent for anything the environment can answer and keep asking the rest of the frontier while it runs
59
+ - Follow threads based on answers
60
+ - Use examples ("Like Stripe Checkout, or custom?")
61
+ - Confirm, don't assume
62
+ - When the description names a solution ("an app with X"), ask what problem it solves — requirements record problems and outcomes; mechanisms stay candidates
63
+ - 3-7 follow-up rounds typical
64
+ - Stop when you have: problem, audience, MVP scope, constraints, success criteria
@@ -8,7 +8,7 @@ description: Draht command prompt wrapper for next-milestone. Use when the user
8
8
  This skill exposes the Draht prompt command template to Codex's `$draht` and `/skills` surfaces.
9
9
 
10
10
  When invoked:
11
- 1. Read `../../commands/next-milestone.md` relative to this `SKILL.md`.
11
+ 1. Read `./command.md` in this skill's directory.
12
12
  2. Treat the user's text after the skill mention as `$ARGUMENTS`. If the template uses `$1`, use the first positional argument.
13
13
  3. Follow that command template as the active workflow.
14
14
  4. Use Draht support skills such as `atomic-reasoning`, `tdd-workflow`, `verification-gate`, or `debugging-workflow` when the command template calls for that discipline.
@@ -0,0 +1,42 @@
1
+ ---
2
+ description: Plan the next milestone after ALL phases in the current one are complete
3
+ allowed-tools: Bash, Read, Write, Edit
4
+ ---
5
+
6
+ # /next-milestone
7
+
8
+ Plan the next milestone after ALL phases in the current one are complete.
9
+
10
+ > **Tool note**: Invoke `draht-tools <subcommand>` as `node "${PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT:-$HOME/.draht/codex-marketplace/plugins/draht}}/bin/draht-tools.cjs" <subcommand>` via the Bash tool.
11
+
12
+ ## Atomic Reasoning
13
+
14
+ 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.
15
+
16
+ ## Steps
17
+ 1. Run `draht-tools verify-milestone` to ensure every phase in the current milestone is `complete`
18
+ 2. If any phase is not complete, STOP and tell the user which phase needs attention
19
+ 3. Read all phase reports in `.planning/phase-N-report.md` to extract lessons learned
20
+ 4. Read the execution log `.planning/execution-log.jsonl` for failure patterns
21
+ 4b. **Write the distilled lessons back**: append each durable lesson from steps 3-4 as a dated bullet to `.planning/STATE.md` under `## Lessons` (create the section before `## Blockers` if missing). Extraction that only informs this planning session evaporates; the `## Lessons` section is what future sessions actually reread.
22
+ 5. Refresh the living map if stale: `draht-tools map-graph --quiet` (guarded — skip if the post-phase hook already refreshed), then `draht-tools graph-clusters --surprising`. Compare clusters / bounded contexts / entry points against the milestone start to surface architectural drift before planning the next milestone
23
+ 6. Review `.planning/DOMAIN.md` — is it still accurate? Any terms to add/revise (esp. drift flagged in step 5)?
24
+ 7. Review `.planning/TEST-STRATEGY.md` — any updates needed?
25
+ 8. Questioning phase (whole frontier per round — numbered, each with a recommended answer):
26
+ - What is the next milestone's goal?
27
+ - What user-visible outcomes must be true by the end?
28
+ - What is in vs out of scope?
29
+ 9. Propose phases for the next milestone. Each phase must have:
30
+ - A clear goal (outcome, not activity)
31
+ - Mapped requirements
32
+ - Acceptance criteria
33
+ 10. Update `.planning/ROADMAP.md` with the new milestone header and phases (status: `pending`)
34
+ 11. Update `.planning/REQUIREMENTS.md` with any new requirements
35
+ 12. Commit: `draht-tools commit-docs "plan milestone <N>"`
36
+
37
+ ## Rules
38
+ - Do not start planning phase details — that happens in `/discuss-phase` + `/plan-phase`
39
+ - Distinguish **verified-complete** (a UAT report shows observed passes) from **believed-complete** (someone said so) — only the former counts toward requirement satisfaction; the latter goes back on the list
40
+ - Respect lessons learned from the previous milestone — don't repeat mistakes
41
+ - Keep the next milestone focused — 3-6 phases is typical
42
+ - Order the new phases risk-first: the phase carrying the highest uncertainty × blast radius comes earliest, so a wrong bet invalidates the least downstream work
@@ -8,7 +8,7 @@ description: Draht command prompt wrapper for orchestrate. Use when the user sel
8
8
  This skill exposes the Draht prompt command template to Codex's `$draht` and `/skills` surfaces.
9
9
 
10
10
  When invoked:
11
- 1. Read `../../commands/orchestrate.md` relative to this `SKILL.md`.
11
+ 1. Read `./command.md` in this skill's directory.
12
12
  2. Treat the user's text after the skill mention as `$ARGUMENTS`. If the template uses `$1`, use the first positional argument.
13
13
  3. Follow that command template as the active workflow.
14
14
  4. Use Draht support skills such as `atomic-reasoning`, `tdd-workflow`, `verification-gate`, or `debugging-workflow` when the command template calls for that discipline.
@@ -0,0 +1,106 @@
1
+ ---
2
+ description: Decompose a task and orchestrate multiple specialist subagents in parallel and chain modes
3
+ argument-hint: "<task description>"
4
+ allowed-tools: Bash, Read, Write, Edit, Task
5
+ ---
6
+
7
+ # /orchestrate
8
+
9
+ Decompose a task and dispatch the right mix of specialist subagents.
10
+
11
+ Task: $ARGUMENTS
12
+
13
+ > **Tool note**: Spawn Codex subagents using the matching Draht `architect` agent prompt, `implementer`, `spec-reviewer`, `reviewer`, `debugger`, `verifier`, `git-committer`, `security-auditor`, `advisor`. Dispatch multiple tasks in the same assistant turn for parallel execution.
14
+
15
+ ## Atomic Reasoning
16
+
17
+ 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.
18
+
19
+ 1. **State the logical components** — What sub-tasks make up this work? Which are independent? A sub-task is well-cut only if its success can be checked without reference to the others.
20
+ 2. **Match agents to work** — Which specialist is right for each sub-task?
21
+ 3. **Determine order** — What can run in parallel vs what must be sequential? For **code-touching** sub-tasks (skip for doc-only work), run `draht-tools graph-impact <files>` on each sub-task's targets: disjoint impact sets parallelize, overlapping ones sequence. The orchestrator runs it and pastes the summary into each Codex subagent's prompt. Among independent sub-tasks, dispatch the riskiest first (highest uncertainty × blast radius): its failure invalidates the rest of the graph most cheaply, before effort is sunk into work it would obsolete.
22
+ 4. **Define success** — What does "done" look like for each sub-task, and for the whole?
23
+
24
+ ## Agent Selection Guide
25
+
26
+ | Need | Agent |
27
+ |---|---|
28
+ | Plan structure before coding | `architect` |
29
+ | Write or change code | `implementer` |
30
+ | Check that a diff covers exactly the spec — no more, no less | `spec-reviewer` |
31
+ | Review code quality (correctness, conventions, domain language) | `reviewer` |
32
+ | Find what's broken (root-cause diagnosis) | `debugger` |
33
+ | Audit for security issues | `security-auditor` |
34
+ | Run lint / typecheck / tests | `verifier` |
35
+ | Create atomic commits | `git-committer` |
36
+ | Strategic steer at a decision point — rare, high-leverage | `advisor` |
37
+
38
+ `spec-reviewer` and `reviewer` are distinct on purpose. Spec-reviewer ONLY checks "did the diff implement what the spec asked, no more no less". Reviewer evaluates quality (naming, structure, type safety). For any task with a written spec, run spec-reviewer **before** reviewer — accepting "close enough" on spec is a known failure mode.
39
+
40
+ ## Effort Scaling
41
+
42
+ Match orchestration weight to the task — over-orchestration burns tokens without adding verification value:
43
+
44
+ | Task shape | Dispatch |
45
+ |---|---|
46
+ | Single question or trivial fix | One agent, or handle it directly — no orchestration |
47
+ | One change set to evaluate | 2–4 parallel evaluators (reviewer, security-auditor, verifier) |
48
+ | Multi-part feature with known decomposition | Fan-out / fan-in |
49
+ | Goal needing iteration until a measurable criterion holds | `/orchestrate-loop` |
50
+
51
+ ## Model Tiering
52
+
53
+ Bill volume tokens at the cheaper rate — see the `model-tiering` skill:
54
+
55
+ - **Orchestrator pattern** — run this command on the strongest tier (e.g. Claude Fable 5) and let workers execute on the executor tier (e.g. Claude Sonnet 5): planning quality where it matters, volume tokens at worker rates.
56
+ - **Advisor pattern** — when the session runs on the executor tier, dispatch `advisor` sparingly: once after orientation before committing to an approach, again when stuck or before declaring a hard task done. ~1–3 consults per task; treat its guidance with serious weight.
57
+
58
+ ## Orchestration Modes
59
+
60
+ ### Parallel
61
+ Dispatch several Codex subagent calls in a single assistant turn when the sub-tasks don't depend on each other. Example: review + security audit of the same change set.
62
+
63
+ ### Chain
64
+ Dispatch Codex subagent calls sequentially when later work depends on earlier output. Example: architect produces plan → implementer executes plan → verifier runs tests → reviewer audits the diff.
65
+
66
+ ### Fan-out / Fan-in
67
+ Architect decomposes into N independent plans → dispatch N implementers in parallel → collect all outputs → single verifier run → single reviewer audit. This is the standard pattern for `/execute-phase` work.
68
+
69
+ ### Two-Stage Review (spec → quality)
70
+ For any task that has a written spec, follow implementer with **spec-reviewer first, then reviewer**:
71
+
72
+ ```
73
+ implementer → spec-reviewer → reviewer
74
+ ↓ BLOCKED
75
+ re-dispatch implementer with required fixes
76
+ ```
77
+
78
+ Never run quality review on a spec-non-compliant diff. This is the standard pattern inside `/execute-phase`'s per-task loop.
79
+
80
+ ### Loop (iterate until a check passes)
81
+ When the work cannot land in one dispatch but success is provable by a deterministic check, do not improvise retries here — hand off to `/orchestrate-loop`. It runs fresh worker iterations gated by an independent re-run of the check, with max-iteration and stall bounds. See the `loop-workflow` skill for the discipline.
82
+
83
+ ## Reading Subagent Status
84
+
85
+ Every draht agent ends its response with one of four status lines. Branch on it:
86
+
87
+ - `STATUS: DONE` — check the evidence before proceeding: a `DONE` that quotes no verification output (test counts, command results) is treated as `DONE_WITH_CONCERNS` — re-run the decisive check yourself. Subagent claims are inputs, not verdicts.
88
+ - `STATUS: DONE_WITH_CONCERNS` — note the concerns. If they're correctness-related, address before moving on; otherwise log and continue.
89
+ - `STATUS: NEEDS_CONTEXT` — provide the missing information and re-dispatch the same agent. Do NOT skip ahead with a guess.
90
+ - `STATUS: BLOCKED` — STOP. Report the blocker to the user. Do not retry the same agent on the same input — adjust the inputs (provide more context, decompose further, pick a different agent) or surface the problem.
91
+
92
+ ## Steps
93
+ 1. Read the task description and identify sub-tasks
94
+ 2. Map each sub-task to the right agent from the table above
95
+ 3. Decide parallel vs chain vs fan-out vs two-stage based on dependencies
96
+ 4. Dispatch Codex subagent calls accordingly
97
+ 5. Read each subagent's final `STATUS:` line and branch per the protocol above
98
+ 6. Collect results, handle failures, report to the user — outcome first (what happened, in one line), evidence second (what each agent verified, quoted), risk last (what remains unverified or assumed)
99
+
100
+ ## Rules
101
+ - Prefer parallel dispatch when possible — it's faster and each subagent has its own context
102
+ - Every dispatch is a complete brief: objective, expected output format, tool guidance, and task boundaries — subagents cannot see the main conversation
103
+ - Do not nest delegations deeply — one level is usually enough
104
+ - Never retry the same agent on the same input after `BLOCKED` — change something
105
+ - For any spec-driven work, spec-reviewer runs before quality reviewer
106
+ - The agent that produced work never evaluates it — completion verdicts come from a fresh-context evaluator plus your own re-run of the decisive check
@@ -8,7 +8,7 @@ description: Draht command prompt wrapper for orchestrate-loop. Use when the use
8
8
  This skill exposes the Draht prompt command template to Codex's `$draht` and `/skills` surfaces.
9
9
 
10
10
  When invoked:
11
- 1. Read `../../commands/orchestrate-loop.md` relative to this `SKILL.md`.
11
+ 1. Read `./command.md` in this skill's directory.
12
12
  2. Treat the user's text after the skill mention as `$ARGUMENTS`. If the template uses `$1`, use the first positional argument.
13
13
  3. Follow that command template as the active workflow.
14
14
  4. Use Draht support skills such as `atomic-reasoning`, `loop-workflow`, `tdd-workflow`, `verification-gate`, or `debugging-workflow` when the command template calls for that discipline.
@@ -0,0 +1,100 @@
1
+ ---
2
+ description: Run a verification-gated loop of fresh subagent iterations until a deterministic check passes
3
+ argument-hint: "<goal with a measurable success criterion> [--max-iterations N]"
4
+ allowed-tools: Bash, Read, Write, Edit, Task
5
+ ---
6
+
7
+ # /orchestrate-loop
8
+
9
+ Run fresh-context worker iterations against a fixed goal until an independent check passes — or a hard stop fires. The loop closes on a deterministic check, never on an agent's claim of completion.
10
+
11
+ Goal: $ARGUMENTS
12
+
13
+ > **Tool note**: Spawn Codex subagents using the matching Draht agent prompts. Workers are `implementer` (or `debugger` for pure-diagnosis goals); the final gate is `spec-reviewer`. One worker per iteration — never parallel workers inside the loop.
14
+
15
+ ## When to Loop vs Orchestrate
16
+
17
+ | Situation | Command |
18
+ |---|---|
19
+ | Decomposition is known, sub-tasks dispatch once | `/orchestrate` |
20
+ | Phase plans exist in `.planning/phases/` | `/execute-phase` |
21
+ | Goal needs iteration until a measurable criterion holds | `/orchestrate-loop` |
22
+
23
+ Loops trade tokens for persistence: use one when the work is too large or too uncertain for a single pass AND success is checkable without human judgment.
24
+
25
+ ## The Loop Contract — no check, no loop
26
+
27
+ A loop is only as good as its check. Before iterating, establish all four:
28
+
29
+ 1. **GOAL** — one measurable end state, stated in one sentence.
30
+ 2. **CHECK** — a command that proves the goal, pass/fail by exit code (test suite, typecheck + lint, a script comparing against a known-good oracle). Prefer terse output: failures only.
31
+ 3. **STOP CONDITIONS** — check passes (verified independently), max iterations reached (default 10; `--max-iterations N` overrides), stall detected, or `STATUS: BLOCKED`.
32
+ 4. **CONSTRAINTS** — what no iteration may touch: existing tests and the check itself are immutable (weakening either to "make it pass" is a hard-stop violation), plus anything out of scope.
33
+
34
+ If no deterministic check can be derived from the goal, STOP and ask the user to define one (or fall back to `/orchestrate`). Never start a loop whose only stop signal is "looks done" — without a check, you become the verification loop and it never closes.
35
+
36
+ Write the contract to `.planning/loop/LOOP.md`:
37
+
38
+ ```markdown
39
+ # Loop: <slug>
40
+ Started: <date> | Max iterations: <N>
41
+
42
+ ## Goal
43
+ <one sentence>
44
+
45
+ ## Check
46
+ `<command>` — passes when <what the output proves>
47
+
48
+ ## Constraints
49
+ - <immutables and out-of-scope items>
50
+ ```
51
+
52
+ Create `.planning/loop/PROGRESS.md` alongside it (append-only iteration log).
53
+
54
+ ## Iteration Protocol
55
+
56
+ Each iteration dispatches ONE fresh worker whose prompt contains, in full (workers cannot see this conversation):
57
+
58
+ 1. The loop contract verbatim
59
+ 2. The last 3 entries of `PROGRESS.md` and the last 5 `git log --oneline` lines — the recoverable state
60
+ 3. The previous iteration's failure evidence, terse: the failing assertions or error lines, not full output
61
+ 4. Standing orders:
62
+ - **Startup ritual** — read the progress log, run the CHECK first, observe the current failure before changing anything
63
+ - **One increment** — the smallest change that moves the check toward passing; do not batch
64
+ - **Commit the increment** even if the check still fails — state must survive context death
65
+ - **Append one `PROGRESS.md` entry** — what changed / check result observed / suggested next step
66
+ - Never edit or delete tests or the check to make it pass; never claim completion without quoting check output
67
+
68
+ ## Independent Verification — the gate
69
+
70
+ After EVERY iteration, re-run the CHECK yourself and read exit code and output. Completion is decided by this re-run, never by the worker's report — worker claims are inputs, not verdicts.
71
+
72
+ - **Check passes** → dispatch `spec-reviewer` once over the full loop diff (contract vs everything changed since the loop started). Only a clean spec review ends the loop as DONE; concerns trigger one more targeted iteration.
73
+ - **Check fails** → extract the terse failure evidence and feed it into the next iteration's prompt as guidance.
74
+
75
+ ## Stall Detection
76
+
77
+ Stop early when the loop is running but not progressing:
78
+
79
+ - Two consecutive iterations with the identical failure signature, or
80
+ - An iteration that produced no commit
81
+
82
+ On stall, do not dispatch the same input again — change something: decompose the goal, add context the workers were missing, switch worker (`implementer` → `debugger`), consult `advisor` for a course correction, or surface to the user with the evidence so far.
83
+
84
+ ## Steps
85
+
86
+ 1. Parse `$ARGUMENTS` into GOAL and flags; derive the CHECK; refuse to loop without one
87
+ 2. Write `.planning/loop/LOOP.md` and `.planning/loop/PROGRESS.md`
88
+ 3. Iterate: dispatch worker → re-run CHECK yourself → branch (pass → gate, fail → next iteration, stall / max / BLOCKED → hard stop)
89
+ 4. On success: spec-review the full diff, then report — outcome first, check output quoted, iterations used
90
+ 5. On any hard stop: append a handoff entry to `PROGRESS.md` (state observed, failure evidence, recommended next step) and report with observed / derived / assumed labels
91
+ 6. Leave `.planning/loop/` in place as the loop's record
92
+
93
+ ## Rules
94
+
95
+ - One worker, one increment, at least one commit per iteration
96
+ - Loops are volume work — run workers on the executor tier and keep steering (this context, `advisor`, `spec-reviewer`) on the strongest tier
97
+ - The worker never grades its own work — your re-run of the check plus a fresh-context spec review decide completion
98
+ - Never raise max iterations mid-loop without asking the user
99
+ - Tests and the check are immutable inside the loop; tampering means revert and hard stop
100
+ - Evidence discipline applies to the loop verdict: label results observed / derived / assumed
@@ -8,7 +8,7 @@ description: Draht command prompt wrapper for pause-work. Use when the user sele
8
8
  This skill exposes the Draht prompt command template to Codex's `$draht` and `/skills` surfaces.
9
9
 
10
10
  When invoked:
11
- 1. Read `../../commands/pause-work.md` relative to this `SKILL.md`.
11
+ 1. Read `./command.md` in this skill's directory.
12
12
  2. Treat the user's text after the skill mention as `$ARGUMENTS`. If the template uses `$1`, use the first positional argument.
13
13
  3. Follow that command template as the active workflow.
14
14
  4. Use Draht support skills such as `atomic-reasoning`, `tdd-workflow`, `verification-gate`, or `debugging-workflow` when the command template calls for that discipline.
@@ -0,0 +1,32 @@
1
+ ---
2
+ description: Create a CONTINUE-HERE handoff document for session continuity
3
+ allowed-tools: Bash, Read, Write, Edit
4
+ ---
5
+
6
+ # /pause-work
7
+
8
+ Create a handoff document for session continuity.
9
+
10
+ > **Tool note**: Invoke `draht-tools <subcommand>` as `node "${PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT:-$HOME/.draht/codex-marketplace/plugins/draht}}/bin/draht-tools.cjs" <subcommand>` via the Bash tool.
11
+
12
+ ## Steps
13
+ 1. Run `git status` and `git diff --stat` to see uncommitted changes
14
+ 2. Read `.planning/STATE.md` for current phase/status
15
+ 3. Write `.planning/CONTINUE-HERE.md` with:
16
+ - `## Current Phase` — which phase and plan is active
17
+ - `## Last Completed` — last task or milestone that finished cleanly
18
+ - `## In Progress` — what is partially done (be specific: file paths, failing tests)
19
+ - `## Uncommitted Changes` — list of modified files and why
20
+ - `## Decisions Made This Session` — any design decisions or context
21
+ - `## Next Steps` — exact commands to run when resuming
22
+ - `## Blockers` — anything waiting on external input or clarification
23
+ 4. **Distill lessons before the context is lost**: for anything this session tried that failed, or an approach that worked against expectations, append one dated bullet to `.planning/STATE.md` under `## Lessons` (create the section before `## Blockers` if missing). Lessons name what to do differently — "runner hits TLS issue in PowerShell, use bash", not "had problems with tests".
24
+ 5. Update `.planning/STATE.md` last activity timestamp via `draht-tools update-state`
25
+ 6. Commit: `draht-tools commit-docs "pause work — handoff"`
26
+ 7. Tell the user: "Resume with `/resume-work` in a fresh session."
27
+
28
+ ## Rules
29
+ - Be specific — "fix bug in auth" is useless; "null check in src/auth/session.ts:42, test reproducing in test/auth-null.test.ts" is useful
30
+ - Include exact commands, not vague directions
31
+ - Capture any in-flight decisions or trade-offs being weighed
32
+ - Handoff and lesson prose follows the `unslop` skill — plain words, no filler, specifics over vibes; commands, paths, and quoted output stay verbatim.
@@ -8,7 +8,7 @@ description: Draht command prompt wrapper for plan-phase. Use when the user sele
8
8
  This skill exposes the Draht prompt command template to Codex's `$draht` and `/skills` surfaces.
9
9
 
10
10
  When invoked:
11
- 1. Read `../../commands/plan-phase.md` relative to this `SKILL.md`.
11
+ 1. Read `./command.md` in this skill's directory.
12
12
  2. Treat the user's text after the skill mention as `$ARGUMENTS`. If the template uses `$1`, use the first positional argument.
13
13
  3. Follow that command template as the active workflow.
14
14
  4. Use Draht support skills such as `atomic-reasoning`, `tdd-workflow`, `verification-gate`, or `debugging-workflow` when the command template calls for that discipline.