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,119 @@
1
+ ---
2
+ name: unslop
3
+ description: Cut AI tells from prose deliverables the agent produces — docs, READMEs, reports, summaries, UAT reports, handoff documents, commit bodies, PR descriptions, client-facing text — then add voice back so the result is neither slop nor sterile. Use when writing or substantially editing any prose deliverable, or when the user says "unslop", "de-AI-ify", "sounds like AI", "make it sound human", asks to clean up slop, or asks for ASD-STE100, Simplified Technical English, or easier-to-follow instructions. Covers German prose by analogy (Füllwörter, Werbesprache, Anglizismen). Never applies to code, code comments, quoted output or evidence, machine-parsed formats (commit subjects, STATUS lines, frontmatter), or draht's own prompt and skill corpus.
4
+ ---
5
+
6
+ # Unslop
7
+
8
+ An editing pass over prose the agent produces. Run it while the deliverable is being written — as the report, doc, or handoff takes shape — never as a sweep over a repository. The job has two halves: cut the tells, then put voice back. Sterile prose is as recognizable as sloppy prose.
9
+
10
+ ## Scope
11
+
12
+ Unslop governs prose draht produces: docs, READMEs, reports, UAT reports, summaries, handoff documents, specs, commit bodies, PR descriptions, client-facing text.
13
+
14
+ It never applies to code, identifiers, or code comments, and never to user-authored text uninvited. Draht's own prompts and skills are not a target: the corpus legitimately uses em dashes and bold lead-ins as house style. This skill governs work products, not the toolchain's instruction files.
15
+
16
+ Edit only text you are producing or were asked to edit. Never rewrite quoted command output, error messages, evidence, or the user's own words. Fixed formats stay fixed: conventional-commit subject lines, red:/green:/refactor: prefixes, STATUS: lines, frontmatter, verdict-first report ordering.
17
+
18
+ ## Process
19
+
20
+ 1. Scan the text for the patterns below.
21
+ 2. Rewrite. Preserve meaning and register.
22
+ 3. Add voice back — register-aware (see Adding Voice).
23
+ 4. Self-audit: ask "What makes this obviously AI generated?" and fix the remaining tells.
24
+
25
+ ## Patterns
26
+
27
+ Every entry pairs the tell with its fix.
28
+
29
+ ### Content
30
+
31
+ - **Puffery and promotional language.** "pivotal moment", "testament to", "evolving landscape", "groundbreaking", "vibrant", "renowned", "stunning". Cut it; state what happened.
32
+ - **Superficial -ing phrases.** "highlighting...", "ensuring...", "showcasing...", "fostering...". Delete, or expand into a real statement with a real source.
33
+ - **Vague attributions.** "Experts believe", "reports suggest", "some argue". Name the source or delete. In a report this means citing the command or file, not "tests suggest".
34
+
35
+ ### Language
36
+
37
+ - **AI vocabulary** (English-calibrated): additionally, crucial, delve, enduring, enhance, fostering, garner, interplay, intricate, landscape (abstract), pivotal, showcase, tapestry (abstract), testament, underscore, vibrant. Use the plain word.
38
+ - **Fancy ways to say "is".** "serves as", "stands as", "boasts", "features". Say "is" or "has".
39
+ - **"Not just X, but Y."** State the point directly.
40
+ - **Rule of three.** Ideas forced into groups of three. Use the natural number.
41
+ - **Synonym cycling.** Protagonist, main character, central figure, hero in one paragraph. Pick one term and repeat it — repeating the established name is precision, not monotony.
42
+ - **False ranges.** "from X to Y" where X and Y sit on no meaningful scale. List the items directly.
43
+
44
+ ### Style
45
+
46
+ - **Dash moderation.** An em dash is punctuation, not a tell. Three per paragraph is. Do not chain them, do not let dashes replace every comma and period; vary the connective.
47
+ - **Colon crutches.** A colon is for a list or an example, not a mid-sentence connector. Rewrite so the point stands on its own.
48
+ - **Boldface spam.** Don't bold every noun, proper name, or acronym.
49
+ - **Inline-header lists.** The tell is a bold label and colon restating the line. A bold lead-in ending in a period, naming the item, followed by genuinely new detail is fine.
50
+ - **Headings** (English-only rule): sentence case, not title case.
51
+ - **Decorative emojis.** Remove from headings and bullets.
52
+ - **Curly quotes.** Replace with straight quotes.
53
+
54
+ ### Communication Artifacts
55
+
56
+ The group most relevant to reports and handoffs.
57
+
58
+ - **Chatbot phrases.** "I hope this helps!", "Let me know if...", "Certainly!", "Found the smoking gun!". Remove.
59
+ - **Cutoff disclaimers.** "While specific details are limited...". Find the fact or drop the sentence.
60
+ - **Sycophancy.** "Great question!", "You're absolutely right!". Respond directly.
61
+
62
+ ### Filler
63
+
64
+ - **Filler phrases** (English-calibrated). "In order to" becomes "To". "Due to the fact that" becomes "Because". "It is important to note that" gets deleted.
65
+ - **Hedging stacks.** "could potentially possibly be argued that it might" becomes "may".
66
+ - **Generic conclusions.** "The future looks bright." State the specific plan or fact, or end one sentence earlier.
67
+
68
+ ### Jargon
69
+
70
+ - **Abstract metaphor nouns.** Substrate, wedge, vector, nexus, bedrock, modality, paradigm, north star, flywheel, endgame. These sound technical but hide a plainer concrete word: "substrate" becomes "base", "wedge in" becomes "add", "north star" / "flywheel" / "endgame" become the plain phrase. Pick the concrete word.
71
+ - **Carve-out.** A term defined in .planning/DOMAIN.md or established in the project's vocabulary is never slop — the ubiquitous-language rule wins over this list.
72
+
73
+ ### Plain Speech
74
+
75
+ - **Name the mechanism, not the feeling.** "the database stays close at hand" names a feeling; "a column rename fails the build" names a mechanism. Restate every claim as a concrete instruction, fact, or number — or cut it. If the sentence could appear unchanged in another project's docs, it says nothing about this one. Cut it.
76
+ - **One idea per sentence.** If the reader has to backtrack to parse a sentence, split it or drop clauses.
77
+ - **Active voice with a named actor.** "queries are validated" becomes "the compiler validates queries". Passive is fine only when the actor is unknown or genuinely irrelevant.
78
+ - **Cut adverbs, or use the measured number.** "significantly improves" becomes the measured delta. An adverb propping up a weak verb means the verb is wrong.
79
+ - **Prefer the plain word** (English-calibrated). "utilize" becomes "use", "leverage" becomes "use", "facilitate" becomes "help", "numerous" becomes "many", "in the event that" becomes "if".
80
+
81
+ ## Adding Voice
82
+
83
+ Removing patterns is half the job — voiceless prose is just as obviously machine-made. Register decides how much voice returns:
84
+
85
+ - **Docs and READMEs**: have opinions and react to facts instead of neutrally listing pros and cons; vary rhythm (short sentences, then longer ones that take their time); use "I" when it fits; be specific.
86
+ - **Reports, UAT reports, handoffs, client-facing text**: stay factual and concrete. Specificity is the voice there — name the file, the count, the command. No filler warmth, no manufactured mess.
87
+
88
+ ## Controlled Register (STE-lite)
89
+
90
+ ASD-STE100 (Simplified Technical English) is a controlled language written for aircraft maintenance manuals. Its full rule set is strict. Going most of the way gives text that a tired or non-native reader can act on without rereading.
91
+
92
+ Use it for procedures, runbooks, setup and fix steps, warnings, and the "next steps" of a handoff. Also use it when the user asks for "STE", "ASD-STE100", "Simplified Technical English", or "make it easier to follow". Do not use it for docs and READMEs that need voice.
93
+
94
+ - **Sentence length.** At most 20 words in a procedure, at most 25 in a description.
95
+ - **One instruction per sentence.** Use the imperative: "Run `npm run check`." not "You should run the check."
96
+ - **Numbered steps, one action each.** Put the condition first: "If the check fails, read the first error."
97
+ - **Warnings before the step they protect.** Start with the instruction, then give the reason: "Do not delete `bun.lock`. The install is no longer reproducible."
98
+ - **One word, one meaning.** Pick one term for one thing and keep it. Terms from `.planning/DOMAIN.md` win.
99
+ - **Active voice, present tense** for descriptions.
100
+ - **Keep the articles.** "Open the file", not "Open file". Telegraphic style is not STE.
101
+ - **Paragraphs** have one topic and at most six sentences.
102
+ - **Technical names stay exact.** Commands, identifiers, paths, and error text are quoted verbatim even when they break the rules above.
103
+
104
+ STE is defined for English. For German text, apply the same limits by analogy: kurze Sätze, Imperativ in Anleitungen, ein Begriff pro Sache, Warnung vor dem Schritt.
105
+
106
+ ## German Prose
107
+
108
+ The word lists above are English-calibrated. The discipline generalizes to German by category, not by translated catalog:
109
+
110
+ - **Füllwörter**: "im Grunde genommen", "quasi", "sozusagen" — streichen.
111
+ - **Werbesprache**: "innovativ", "ganzheitlich", "im heutigen digitalen Zeitalter", "spielt eine entscheidende Rolle" — sagen, was passiert ist.
112
+ - **Anglizismen-Slop**: "leveragen", "alignen" where a German word exists — use the German word.
113
+ - "nicht nur X, sondern auch Y" is the "not just X, but Y" tell verbatim: state the point directly.
114
+ - Style and format tells (dash chaining, bold spam, decorative emojis, curly quotes) and communication artifacts (chatbot phrases, disclaimers, sycophancy) are language-independent.
115
+ - The sentence-case-headings rule is English-only — German headings follow German orthography.
116
+
117
+ ## Self-Audit
118
+
119
+ Before delivering, ask once more: "What makes this obviously AI generated?" Fix what you find.
@@ -8,7 +8,7 @@ description: Draht command prompt wrapper for verify-work. 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/verify-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,117 @@
1
+ ---
2
+ description: Acceptance testing of completed phase work (parallel verifier + security-auditor + reviewer + spec-reviewer)
3
+ argument-hint: "<phase-number>"
4
+ allowed-tools: Bash, Read, Write, Edit, Task
5
+ ---
6
+
7
+ # /verify-work
8
+
9
+ Walk through acceptance testing of completed phase work, using subagents for parallel verification — including a spec-compliance pass against the phase's plan files.
10
+
11
+ Phase: $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 and dispatch multiple in parallel (single assistant turn = multiple Codex subagent calls).
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
+ 0. **Refresh the living map (guarded).** If `.planning/codebase/MAP.json` is older than HEAD, run `draht-tools map-graph --quiet` (skip if the post-phase hook already refreshed). This keeps the graph boundary check below accurate.
21
+ 1. Run `draht-tools extract-deliverables $1` to get testable items
22
+ 2. Discover the phase's plan files (`.planning/phases/<N>-*/<N>-NN-PLAN.md`). Each plan is the spec a spec-reviewer evaluates the diff against.
23
+
24
+ 3. **Run parallel verification via Codex subagents.** Dispatch four subagents in parallel (single assistant turn, four Codex subagent calls):
25
+
26
+ - **Codex subagent** with ``verifier` agent prompt` and prompt:
27
+ ```
28
+ Run the full test suite for this project. Check package.json for the test command. Record pass/fail counts. Then run any available lint and typecheck commands (e.g. npm run check, npm run lint, npx tsc --noEmit). Report all results with error details.
29
+
30
+ If a project verification skill exists (a `verify-<app>` skill under `.draht/skills/`, generated by /create-verification-skill), drive the app with it: launch, run its Doctor check, drive ONE mapped feature from its feature map the way a user would, capture the evidence artifacts it names, and clean up per its Cleanup section — cleanup never removes the evidence. Report which feature you drove and where the evidence lives; this is observed evidence of user-visible behaviour. If no such skill exists, say so: test output is then the ceiling of the evidence.
31
+
32
+ End with `STATUS: DONE | DONE_WITH_CONCERNS | NEEDS_CONTEXT | BLOCKED`.
33
+ ```
34
+
35
+ - **Codex subagent** with ``security-auditor` agent prompt` and prompt:
36
+ ```
37
+ Audit the recent code changes (use git log and git diff to find them, limited to this phase's commit range). Check for injection risks, auth bypasses, secrets in code, unsafe patterns. Report findings by severity.
38
+
39
+ End with `STATUS: DONE | DONE_WITH_CONCERNS | NEEDS_CONTEXT | BLOCKED`.
40
+ ```
41
+
42
+ Before dispatching, the orchestrator runs `draht-tools graph-impact <changed-files>` and pastes the crossed-context / boundary-violation summary below as evidence for the DOMAIN.md boundary check.
43
+
44
+ - **Codex subagent** with ``reviewer` agent prompt` and prompt:
45
+ ```
46
+ Review the recent code changes for this phase (use git log and git diff to find them). Check domain language compliance against `.planning/DOMAIN.md` if it exists — scan for identifiers not in the glossary and cross-context boundary violations. Use the pasted graph-impact summary (crossed bounded contexts, boundary violations) as evidence for that boundary check. Report findings as Must fix / Should fix / Consider.
47
+
48
+ End with `STATUS: DONE | DONE_WITH_CONCERNS | NEEDS_CONTEXT | BLOCKED`.
49
+ ```
50
+
51
+ - **Codex subagent** with ``spec-reviewer` agent prompt` and prompt:
52
+ ```
53
+ Phase-level spec compliance check for phase $1. The phase has these plan files (each is a spec):
54
+ <list of .planning/phases/<N>-*/<N>-NN-PLAN.md paths>
55
+
56
+ For each plan, evaluate whether the phase's commits implement exactly what the plan's <task> elements asked — no missing tasks, no over-builds beyond what the spec called for. Use `git log --oneline <phase commit range>` and `git diff` to gather the implementation.
57
+
58
+ Output a per-plan compliance verdict (✅ COMPLIANT / ❌ NON-COMPLIANT) with omissions and over-builds listed for each.
59
+
60
+ End with `STATUS: DONE | DONE_WITH_CONCERNS | NEEDS_CONTEXT | BLOCKED`.
61
+ ```
62
+
63
+ 4. Run the quality gate check:
64
+ ```bash
65
+ node "${PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT:-$HOME/.draht/codex-marketplace/plugins/draht}}/scripts/gsd-quality-gate.cjs"
66
+ ```
67
+
68
+ 5. **Spot-check before aggregating.** Subagent claims are inputs, not verdicts. Before accepting the verifier's `DONE`, re-run the test suite headline yourself and read the counts. Before accepting the spec-reviewer's compliance verdict, read one plan's diff yourself. A pass you only heard about is an "assumed pass" — and an assumed pass is not a pass. This costs two commands and catches the most expensive failure mode this command has: trust laundered into evidence.
69
+
70
+ 6. **Read each subagent's `STATUS:` line and the quality gate exit code.** Treat the phase as failed if **any** of these is true:
71
+ - `verifier` returns `STATUS: BLOCKED` (tests / lint / typecheck failed)
72
+ - `security-auditor` returns `STATUS: BLOCKED` (Critical or High findings)
73
+ - `spec-reviewer` returns `STATUS: BLOCKED` (any plan is non-compliant)
74
+ - `reviewer` returns `STATUS: BLOCKED` (Must-fix correctness issues)
75
+ - Quality gate exits non-zero
76
+
77
+ 7. Walk the user through each deliverable one at a time, incorporating findings from all four subagents.
78
+
79
+ 8. Record results (pass/fail/partially/skip). Label each: **observed** (you or a subagent ran it and quoted output), **derived** (follows necessarily from something observed), or **assumed** (unchecked). Verdicts inherit the weakest label they rest on.
80
+
81
+ 9. For failures: diagnose and create fix plans via `draht-tools create-fix-plan $1 P`
82
+ - Fix plans MUST include a reproducing test that demonstrates the failure before any implementation — held to the /fix Phase 1 red-capable standard: one named command, already run once, invocation and output shown, asserting the exact failing symptom (red now, green once fixed)
83
+ - Spec-reviewer omissions become explicit fix-plan tasks (one task per omission)
84
+
85
+ 10. Write UAT report: `draht-tools write-uat $1`
86
+ - Order: **verdict first** (phase pass/fail, X/Y deliverables, in the first line), **evidence second** (test health summary with pass/fail/coverage, security audit results, spec compliance summary per plan, domain model status, deliverable results with labels), **risk last** (what was NOT tested and how it could bite). Never bury a failure under passes.
87
+ - Report prose follows the `unslop` skill — plain words, active voice, no filler; quoted command output and the verdict-first ordering stay untouched.
88
+ - When the user asks, also write an HTML explainer of the UAT report per the `explainers` skill, with the deliverable results and their observed/derived/assumed labels as its data block. The UAT report stays the source of truth.
89
+
90
+ 11. If all passed: mark phase complete.
91
+ - If more phases remain in the milestone: tell the user to start a fresh session and run `/discuss-phase N+1`.
92
+ - If ALL phases in the milestone are complete: tell the user to start a fresh session and run `/next-milestone`.
93
+
94
+ 12. If failures: route to `/execute-phase $1 --gaps-only`
95
+
96
+ ## Why a phase-level spec-reviewer
97
+
98
+ `/execute-phase` already runs spec-reviewer **per task** before the next task starts. The phase-level pass here catches things the per-task loop can miss:
99
+
100
+ - A whole plan was skipped (no implementer ever ran on it)
101
+ - A task's commit was reverted or rebased away
102
+ - An out-of-scope drift that accumulated across multiple tasks
103
+
104
+ Cheap insurance — the diff already exists and the plans already exist; the agent just maps one to the other.
105
+
106
+ ## Workflow
107
+ This is the last step in the per-phase cycle:
108
+
109
+ ```
110
+ /discuss-phase N → /plan-phase N → /execute-phase N → /verify-work N
111
+ ```
112
+
113
+ After verify-work passes:
114
+ - More phases remaining → `/discuss-phase N+1`
115
+ - ALL phases in milestone verified → `/next-milestone`
116
+
117
+ `/next-milestone` is ONLY for generating new phases after every phase in the current milestone is complete.
@@ -0,0 +1,14 @@
1
+ ---
2
+ name: why
3
+ description: Draht command prompt wrapper for why. Use when the user asks why code is the way it is — design rationale, the history of a decision, rejected alternatives, "why do we do X instead of Y", "was this intentional", or where a threshold value came from — and the answer must be reconstructed from git history, the review record, and planning documents with calibrated confidence. Triggers on "why was this built", "why do we", "what's the history of", "design rationale", "code archaeology".
4
+ ---
5
+
6
+ # Draht Command: why
7
+
8
+ This skill exposes the Draht prompt command template to Codex's `$draht` and `/skills` surfaces.
9
+
10
+ When invoked:
11
+ 1. Read `./command.md` in this skill's directory.
12
+ 2. Treat the user's text after the skill mention as `$ARGUMENTS`. If the template uses `$1`, use the first positional argument.
13
+ 3. Follow that command template as the active workflow.
14
+ 4. Use Draht support skills such as `atomic-reasoning`, `epistemics`, or `verification-gate` when the command template calls for that discipline.
@@ -0,0 +1,141 @@
1
+ ---
2
+ description: Investigate why code is the way it is — design rationale, history, rejected alternatives — via parallel evidence investigators and a confidence-tiered, citation-backed synthesis
3
+ argument-hint: "<file, symbol, or question>"
4
+ allowed-tools: Bash, Read, Task
5
+ ---
6
+
7
+ # /why
8
+
9
+ Reconstruct why code is the way it is — the design rationale, the history, the rejected alternatives — from the evidence the repository and its surroundings actually carry. The output is a confidence-tiered, citation-backed answer with an explicit coverage map, never a plausible story.
10
+
11
+ ## Usage
12
+ ```
13
+ /why <file, symbol, or question>
14
+ ```
15
+
16
+ Question: $ARGUMENTS
17
+
18
+ > **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 `investigator` agent prompt — one per available evidence category, dispatched in parallel (single assistant turn = multiple Codex subagent calls). To escalate a contested synthesis, consult the `advisor` agent.
19
+
20
+ ## Routing
21
+
22
+ `/why` answers intent, history, and forces. Something misbehaving right now is a defect — route it to `/fix`, which is reproduction-gated. A `/why` run that uncovers a live defect hands off to `/fix`; a `/fix` that needs design intent (is this behaviour a decision or an accident?) consults `/why`. For structure and architecture walkthroughs — what the code IS rather than why it is that way — use `/map-codebase`.
23
+
24
+ ## Epistemics
25
+
26
+ Every claim in the output follows the `epistemics` skill — five confidence tiers, cite-or-label-as-inference, null results as evidence. Load it before synthesising; the epistemic framing is the product, and de-hedging it to sound authoritative is the exact failure this command exists to prevent.
27
+
28
+ ## Steps
29
+
30
+ ### 1 — Parse the target and the question archetype
31
+
32
+ Identify what is being asked about (file, symbol, pattern, value) and which archetype the question is: design rationale ("why is this a queue?"), tradeoff-vs-alternative ("why X instead of Y?"), defensive reasoning ("why the triple-check here?"), external forcing function ("why did this change in March?"), dead code ("why does this exist at all?"), or a broad sweep ("why is this module shaped like this?"). If the target is vague, state your best-guess interpretation from context and proceed — do not block on a clarifying question.
33
+
34
+ ### 2 — Build the code anchor
35
+
36
+ Cheap, done once by the lead, pasted into every brief:
37
+
38
+ - file paths and line ranges; the key symbols involved
39
+ - `git blame -L <range> <file>` on the target lines
40
+ - `git log --follow --oneline -20 <file>`
41
+ - PR numbers extracted from `(#N)` commit subjects; for each, `gh pr view <n> --json title,body,author,createdAt,mergedAt,labels,closingIssuesReferences,comments,reviews`
42
+ - linked ticket and ADR identifiers found along the way
43
+ - optionally a pasted `draht-tools graph-context <file>` slice for orientation (lead-only; subagents cannot run draht-tools)
44
+
45
+ ### 3 — Probe the evidence map
46
+
47
+ Five categories. Probe availability before dispatching; each row is the assigned investigator's playbook.
48
+
49
+ | Category | Availability probe | What it uniquely surfaces + playbook |
50
+ |---|---|---|
51
+ | Git history | Always available | Pickaxe (`git log -S`/`-G`), blame, `git show`; test names encoding edge cases; `red:`/`green:`/`refactor:` and `docs:` prefixes as semantic signal. Pitfalls: squash flatlands → fall back to the PR record; misleading messages → read the diff; cargo-culted patterns → investigate the origin commit; bot commits carry no motivation. |
52
+ | Review record | `git remote` + `gh auth status` | PR bodies, review threads, linked issues — the argument that happened before merge, including rejected alternatives. |
53
+ | Planning record | `.planning/` exists | `STATE.md` `## Decisions` (dated, attributed) and `## Lessons`; `phases/NN-*/` PLAN, SUMMARY, VERIFICATION, and UAT files (observed/derived/assumed labels); `specs/`; `quick/`; `loop/PROGRESS.md`; `CONTINUE-HERE.md`. Probe before assuming `.planning/decisions/` and `.planning/tickets/` — they exist only when a grill chose that output. |
54
+ | Decision records | `docs/adr/` and `CHANGELOG.md` files exist | ADR titles are decisions; dated Update blocks cite forcing commits; per-package changelogs date user-visible shifts. |
55
+ | External systems | A registered extension tool only | Tracker, chat, observability, error tracking, analytics — the conversational and operational record. Searchable only via a project-registered tool; when none exists, do not dispatch: record one Sources Consulted gap line — "External records: unavailable — no tool registered in this runtime; the conversational and operational record was not searched." |
56
+
57
+ The map is extensible: a project-registered tool adds an investigator with the same brief shape; an unavailable category is a coverage gap, never a silent drop.
58
+
59
+ **Incident overlay**: when the target looks defensive — null guards, retry, timeout, rate limiting, feature flags — instruct every investigator to hunt incident-shaped evidence inside its own category: revert-then-reapply chains, `## Lessons` entries, ADR Update blocks, UAT failure verdicts.
60
+
61
+ ### 4 — Dispatch parallel investigators
62
+
63
+ Dispatch one investigator per AVAILABLE category, all in a single assistant turn when the host allows it; if the category count exceeds what the host can dispatch at once, fold overflow into the nearest category. Skip rules:
64
+
65
+ - A skip needs a written justification that surfaces in Sources Consulted. Unavailability is a gap, not a choice.
66
+ - "Provably irrelevant, not just probably" — a build-time script with no runtime path provably cannot appear in runtime error tracking; "it's feature code, error tracking won't have anything" is a guess, so search it.
67
+
68
+ Each brief is standalone:
69
+
70
+ ```
71
+ You are investigating ONE evidence category for a why-question. Gather evidence, not narrative — a verbatim quote with a precise citation beats a paragraph of plausible summary.
72
+
73
+ Question: <the question and its archetype>
74
+
75
+ Code anchor:
76
+ <the anchor from Step 2>
77
+
78
+ Your category: <name + the playbook row from Step 3>
79
+ <if the incident overlay applies: hunt incident-shaped evidence inside your category — revert/re-apply chains, Lessons entries, ADR Update blocks, UAT failure verdicts>
80
+
81
+ Report using exactly these sections: Source / What I Searched (queries verbatim) / Direct Evidence Found / Indirect-Circumstantial Evidence (inference chain + alternative readings) / Contradictions / Gaps / Additional Leads.
82
+
83
+ Stay inside your category; record cross-category references under Additional Leads for the owning investigator — never chase them.
84
+
85
+ Do NOT run draht, draht-tools, or pi commands.
86
+
87
+ End with STATUS: DONE | DONE_WITH_CONCERNS | NEEDS_CONTEXT | BLOCKED
88
+ ```
89
+
90
+ `NEEDS_CONTEXT` / `BLOCKED` → supply the missing info and re-dispatch. Hard cap: 3 re-dispatches total.
91
+
92
+ ### 5 — Synthesize (the lead, in this context)
93
+
94
+ - Investigator claims are inputs, not verdicts — spot-verify load-bearing citations with git/gh before repeating them.
95
+ - Merge duplicate citations into one authoritative reference.
96
+ - Surface contradictions without picking a side.
97
+ - Tier every claim per the `epistemics` skill.
98
+ - Hand each investigator's Additional Leads to the owning category's follow-up, or record them as gaps.
99
+ - When competing hypotheses are decision-changing for an imminent code change, consult the `advisor` agent with the tiered findings for a steer.
100
+
101
+ ### 6 — Output contract
102
+
103
+ Exact section order:
104
+
105
+ 1. **The Question**
106
+ 2. **The Code in Question** — what it does mechanically, in two or three sentences
107
+ 3. **What We Found** — [Direct] and [Supported] bullets, each cited
108
+ 4. **What We Can Reasonably Infer** — [Inferred] bullets with the chain visible: "Given A and B, C is likely because D"
109
+ 5. **Competing Hypotheses** — hypothesis + evidence for + evidence against. Don't force a winner. Skip only when there is one clear answer.
110
+ 6. **What We Don't Know** — specific searches that came up empty, named unavailable sources, people who would know
111
+ 7. **Sources Consulted** — one line per category INCLUDING empties, gaps, and justified skips: `- <Category>: <what was searched>. <found / no relevant results / skipped: reason / unavailable: gap>`
112
+ 8. **Confidence Summary** — 1-2 sentences
113
+
114
+ Report prose follows the `unslop` skill; citations and quoted evidence stay verbatim.
115
+
116
+ **Diagram**: when the answer is a chain — the commits that built the code, a forcing sequence, a call path — add one Mermaid diagram after What We Can Reasonably Infer, per the `explainers` skill. Solid edges carry [Direct] or [Supported] facts; [Inferred] links are dashed and labelled. **HTML**: when the user asks, also render the report as an HTML explainer per the same skill; the Markdown report stays the source of truth.
117
+
118
+ **Closing hook**: when the question precedes a change, convert the findings into a Preserve / Change / Avoid / Risk constraint set suitable for `/discuss-phase` or `/plan-phase`.
119
+
120
+ **Effort valve**: a trivial single-commit target whose PR or commit already answers the question may be handled inline by the lead running the git-history archaeology itself — only after stating why the other available categories would be redundant. The output contract and the coverage map still apply.
121
+
122
+ ## Failure Modes — STOP
123
+
124
+ Stop immediately if you catch yourself:
125
+
126
+ - **Confident storytelling** — an uncited bullet belongs under Inferred or Hypotheses, never under What We Found
127
+ - Citing code as evidence of its own intent
128
+ - Recency bias — explaining an accretion as one decision; trace back
129
+ - Sycophantic agreement with the asker's embedded hypothesis
130
+ - Skipping the gaps section
131
+ - Skipping investigators by anticipation — a null result is a data point; a skipped search is a blind spot
132
+ - Collapsing categories into one investigator
133
+
134
+ ## Rationalization Table
135
+
136
+ | Excuse | Reality |
137
+ |--------|---------|
138
+ | "The commit message says X, done" | One source is a lead, not a verdict — the record contradicts itself more often than it lies consistently. |
139
+ | "The code obviously does this for performance" | Code is mechanics; motivation needs an external source or an [Inferred] label. |
140
+ | "The user already told me why" | That is a hypothesis; check it independently. |
141
+ | "No .planning/ here, nothing to search" | git and gh still exist; report the missing categories as gaps, don't invent. |