draht-codex 2026.6.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.codex-plugin/plugin.json +44 -0
- package/CHANGELOG.md +15 -0
- package/LICENSE +21 -0
- package/README.md +173 -0
- package/agents/architect.md +56 -0
- package/agents/debugger.md +67 -0
- package/agents/git-committer.md +61 -0
- package/agents/implementer.md +45 -0
- package/agents/reviewer.md +67 -0
- package/agents/security-auditor.md +119 -0
- package/agents/spec-reviewer.md +65 -0
- package/agents/verifier.md +55 -0
- package/bin/draht-tools.cjs +4875 -0
- package/cli.mjs +452 -0
- package/commands/atomic-commit.md +73 -0
- package/commands/discuss-phase.md +55 -0
- package/commands/execute-phase.md +173 -0
- package/commands/fix.md +121 -0
- package/commands/init-project.md +66 -0
- package/commands/map-codebase.md +73 -0
- package/commands/new-project.md +73 -0
- package/commands/next-milestone.md +50 -0
- package/commands/orchestrate.md +83 -0
- package/commands/pause-work.md +38 -0
- package/commands/plan-phase.md +142 -0
- package/commands/progress.md +30 -0
- package/commands/quick.md +95 -0
- package/commands/resume-work.md +35 -0
- package/commands/review.md +87 -0
- package/commands/verify-work.md +122 -0
- package/hooks/hooks.json +26 -0
- package/package.json +55 -0
- package/scripts/gsd-post-phase.cjs +144 -0
- package/scripts/gsd-post-task.cjs +165 -0
- package/scripts/gsd-pre-execute.cjs +146 -0
- package/scripts/gsd-quality-gate.cjs +252 -0
- package/scripts/prompt-context.cjs +36 -0
- package/scripts/session-start.cjs +52 -0
- package/skills/atomic-commit/SKILL.md +14 -0
- package/skills/atomic-reasoning/SKILL.md +107 -0
- package/skills/brainstorming/SKILL.md +120 -0
- package/skills/ddd-workflow/SKILL.md +111 -0
- package/skills/debugging-workflow/SKILL.md +101 -0
- package/skills/discuss-phase/SKILL.md +14 -0
- package/skills/execute-phase/SKILL.md +14 -0
- package/skills/fix/SKILL.md +14 -0
- package/skills/init-project/SKILL.md +14 -0
- package/skills/map-codebase/SKILL.md +14 -0
- package/skills/new-project/SKILL.md +14 -0
- package/skills/next-milestone/SKILL.md +14 -0
- package/skills/orchestrate/SKILL.md +14 -0
- package/skills/pause-work/SKILL.md +14 -0
- package/skills/plan-phase/SKILL.md +14 -0
- package/skills/progress/SKILL.md +14 -0
- package/skills/quick/SKILL.md +14 -0
- package/skills/resume-work/SKILL.md +14 -0
- package/skills/review/SKILL.md +14 -0
- package/skills/tdd-workflow/SKILL.md +117 -0
- package/skills/verification-gate/SKILL.md +82 -0
- package/skills/verify-work/SKILL.md +14 -0
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
## Atomic Reasoning
|
|
13
|
+
|
|
14
|
+
Before pausing, decompose session state into atomic reasoning units:
|
|
15
|
+
|
|
16
|
+
1. **State the logical component** — What was accomplished this session? What is in-progress? What is the current phase/task?
|
|
17
|
+
2. **Validate independence** — Are there uncommitted changes? Are there blockers? What decisions were made?
|
|
18
|
+
3. **Verify correctness** — Is the current state stable? Can work resume cleanly? What context needs to be captured?
|
|
19
|
+
|
|
20
|
+
## Steps
|
|
21
|
+
1. Run `git status` and `git diff --stat` to see uncommitted changes
|
|
22
|
+
2. Read `.planning/STATE.md` for current phase/status
|
|
23
|
+
3. Write `.planning/CONTINUE-HERE.md` with:
|
|
24
|
+
- `## Current Phase` — which phase and plan is active
|
|
25
|
+
- `## Last Completed` — last task or milestone that finished cleanly
|
|
26
|
+
- `## In Progress` — what is partially done (be specific: file paths, failing tests)
|
|
27
|
+
- `## Uncommitted Changes` — list of modified files and why
|
|
28
|
+
- `## Decisions Made This Session` — any design decisions or context
|
|
29
|
+
- `## Next Steps` — exact commands to run when resuming
|
|
30
|
+
- `## Blockers` — anything waiting on external input or clarification
|
|
31
|
+
4. Update `.planning/STATE.md` last activity timestamp via `draht-tools update-state`
|
|
32
|
+
5. Commit: `draht-tools commit-docs "pause work — handoff"`
|
|
33
|
+
6. Tell the user: "Resume with `/resume-work` in a fresh session."
|
|
34
|
+
|
|
35
|
+
## Rules
|
|
36
|
+
- 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
|
|
37
|
+
- Include exact commands, not vague directions
|
|
38
|
+
- Capture any in-flight decisions or trade-offs being weighed
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Create atomic execution plans for a roadmap phase (parallel via architect subagents)
|
|
3
|
+
argument-hint: "<phase-number>"
|
|
4
|
+
allowed-tools: Bash, Read, Write, Edit, Task
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# /plan-phase
|
|
8
|
+
|
|
9
|
+
Create atomic execution plans for a roadmap phase, using subagents for parallel plan creation.
|
|
10
|
+
|
|
11
|
+
Phase: $1
|
|
12
|
+
|
|
13
|
+
## Red Flags — STOP
|
|
14
|
+
|
|
15
|
+
A plan is only as good as the tasks inside it. STOP and revise instead of saving if **any** of these is true:
|
|
16
|
+
|
|
17
|
+
- Any task contains placeholder text: `[TBD]`, `[files]`, `[description]`, "appropriate error handling", "similar to Task N", or `...` in code positions
|
|
18
|
+
- A task's `<test>` section names no concrete test cases (e.g., "test the function" with no inputs/outputs)
|
|
19
|
+
- A task's `<files>` section lists no concrete file paths
|
|
20
|
+
- A task takes more than ~5 minutes of focused work — break it down further
|
|
21
|
+
- The plan introduces new domain terms that are NOT in `.planning/DOMAIN.md` — update DOMAIN.md first
|
|
22
|
+
- A plan touches more than one bounded context without explicit ACL — split per context
|
|
23
|
+
|
|
24
|
+
Run `draht-tools validate-plans $1` after saving. If it reports issues, fix them before commit.
|
|
25
|
+
|
|
26
|
+
> **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 a Codex subagent using the `architect` agent prompt. Dispatch multiple parallel tasks in a single assistant turn by making multiple Codex subagent calls at once.
|
|
27
|
+
|
|
28
|
+
## Atomic Reasoning
|
|
29
|
+
|
|
30
|
+
Before creating plans, decompose this phase goal into atomic reasoning units:
|
|
31
|
+
|
|
32
|
+
**For each observable truth (user-visible outcome):**
|
|
33
|
+
1. **State the logical component** — What must be true for the user? What can they do/see/verify?
|
|
34
|
+
2. **Validate independence** — Which artifacts (files, endpoints, schemas) prove this truth exists? Can it be built independently?
|
|
35
|
+
3. **Verify correctness** — What test scenarios would prove this observable truth? What are the specific inputs → expected outputs?
|
|
36
|
+
|
|
37
|
+
**Synthesize planning strategy:**
|
|
38
|
+
- Group related observable truths into cohesive plans (2-5 tasks each)
|
|
39
|
+
- Identify which plans can be created in parallel vs sequentially
|
|
40
|
+
- Map each plan to specific bounded contexts and domain concepts
|
|
41
|
+
- Ensure each plan produces testable, verifiable outcomes
|
|
42
|
+
|
|
43
|
+
## Steps
|
|
44
|
+
1. Run `draht-tools load-phase-context $1` to gather all context
|
|
45
|
+
2. Optional: `draht-tools research-phase $1` for domain research
|
|
46
|
+
3. Goal-backward planning:
|
|
47
|
+
a. State the goal (outcome, not activity)
|
|
48
|
+
b. Derive observable truths (3-7 from user perspective)
|
|
49
|
+
c. From each observable truth, derive the test scenarios that would prove it (specific inputs → expected outputs or state changes)
|
|
50
|
+
d. Map to required artifacts (files, endpoints, schemas)
|
|
51
|
+
- GRAPH-ORIENT: read `.planning/codebase/MAP.json` (regenerate with `draht-tools map-graph` if absent), then run `draht-tools graph-context <target-files>` for pkg/layer/importers and `draht-tools graph-query <term...>` to locate the code instead of grepping.
|
|
52
|
+
e. Break into plan groups of 2-5 tasks each
|
|
53
|
+
4. Identify which plans are independent (no shared files, no dependency edges)
|
|
54
|
+
- GRAPH-IMPACT: run `draht-tools graph-impact <plan-files>` per plan; plans with disjoint impact sets (reverse-dependents, entry points, sinks) are safe to parallelize — overlapping blast radius means a dependency edge.
|
|
55
|
+
|
|
56
|
+
5. **Delegate plan creation to subagents via Codex subagents:**
|
|
57
|
+
- For **independent plans**: dispatch multiple `spawn_agent` calls in parallel (single assistant turn), each using the `architect` agent prompt, one per plan.
|
|
58
|
+
- For **dependent plans**: dispatch sequentially — one `spawn_agent` call per plan, feeding predecessor outputs as context into the next.
|
|
59
|
+
- Each architect prompt must include:
|
|
60
|
+
- The phase context summary (paste it inline — subagents cannot run draht-tools)
|
|
61
|
+
- The specific observable truths this plan must satisfy
|
|
62
|
+
- The target files/artifacts — the orchestrator runs `draht-tools graph-context <plan-files>` and pastes the slice (pkg/layer/importers/imports) inline, since the architect subagent cannot run draht-tools
|
|
63
|
+
- The XML task format specification (below)
|
|
64
|
+
- The instruction below about the **delimiter convention** for output
|
|
65
|
+
|
|
66
|
+
### Architect Output Delimiter Convention
|
|
67
|
+
|
|
68
|
+
The architect agent appends a `STATUS:` footer per the standard agent contract. For `/plan-phase`, the orchestrator pipes the architect's output to `create-plan` as a file — we must NOT include the `STATUS:` line in the saved plan.
|
|
69
|
+
|
|
70
|
+
Include this instruction in every architect prompt:
|
|
71
|
+
```
|
|
72
|
+
Output your plan as XML, followed by a line containing exactly `---END-PLAN---`, followed by your final `STATUS: ...` line.
|
|
73
|
+
|
|
74
|
+
The orchestrator will split your output on `---END-PLAN---` and save only the plan content. The STATUS line is read for control flow but not saved.
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
6. **Collect and split outputs.** For each architect's output:
|
|
78
|
+
- Split on the literal `---END-PLAN---` line
|
|
79
|
+
- Plan content = everything BEFORE the delimiter (trimmed)
|
|
80
|
+
- Status line = everything AFTER the delimiter (the `STATUS:` line)
|
|
81
|
+
- Read the status:
|
|
82
|
+
- `DONE` / `DONE_WITH_CONCERNS` → save the plan
|
|
83
|
+
- `NEEDS_CONTEXT` → provide missing info and re-dispatch this architect
|
|
84
|
+
- `BLOCKED` → STOP, report blocker; do not save a partial plan
|
|
85
|
+
|
|
86
|
+
7. Save each plan by piping the split plan content into `draht-tools create-plan`:
|
|
87
|
+
```bash
|
|
88
|
+
printf '%s' "$plan_content" | node "${PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT:-$HOME/.draht/codex-marketplace/plugins/draht}}/bin/draht-tools.cjs" create-plan $1 P [title]
|
|
89
|
+
```
|
|
90
|
+
The content must contain real task details (files, actions, tests) — NOT placeholder brackets. If `create-plan` is called without stdin, it writes a useless template.
|
|
91
|
+
|
|
92
|
+
8. Validate: `draht-tools validate-plans $1` — if it exits non-zero, fix the offending plan before commit.
|
|
93
|
+
9. Commit: `draht-tools commit-docs "create phase $1 plans"`
|
|
94
|
+
|
|
95
|
+
## Plan Format
|
|
96
|
+
Plans use XML task format:
|
|
97
|
+
```xml
|
|
98
|
+
<task type="auto">
|
|
99
|
+
<n>Task name</n>
|
|
100
|
+
<context>Bounded context this task belongs to</context>
|
|
101
|
+
<domain>Aggregates, entities, value objects, or events touched</domain>
|
|
102
|
+
<files>affected files</files>
|
|
103
|
+
<test>
|
|
104
|
+
RED phase: Write failing tests FIRST.
|
|
105
|
+
- List specific test cases with expected behavior
|
|
106
|
+
- Test domain invariants and business rules
|
|
107
|
+
- Test at the right level: unit for domain logic, integration for context boundaries
|
|
108
|
+
- Tests MUST fail before implementation
|
|
109
|
+
</test>
|
|
110
|
+
<action>
|
|
111
|
+
GREEN phase: Minimal implementation to make tests pass.
|
|
112
|
+
- No gold-plating — just make the red tests green
|
|
113
|
+
- Respect aggregate boundaries
|
|
114
|
+
- Use domain language in code (class names, method names, variable names)
|
|
115
|
+
</action>
|
|
116
|
+
<refactor>
|
|
117
|
+
REFACTOR phase: Improve structure while keeping tests green.
|
|
118
|
+
- Extract value objects, push logic into domain layer
|
|
119
|
+
- Ensure naming matches ubiquitous language
|
|
120
|
+
- Remove duplication across bounded contexts (or make shared kernel explicit)
|
|
121
|
+
</refactor>
|
|
122
|
+
<verify>How to verify (tests pass + manual check if needed)</verify>
|
|
123
|
+
<done>What "done" looks like — expressed as passing test assertions</done>
|
|
124
|
+
</task>
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Task types: `auto`, `checkpoint:human-verify`, `checkpoint:decision`
|
|
128
|
+
|
|
129
|
+
## Workflow
|
|
130
|
+
This is one step in the per-phase cycle:
|
|
131
|
+
|
|
132
|
+
```
|
|
133
|
+
/discuss-phase N → /plan-phase N → /execute-phase N → /verify-work N
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
After completing this command, tell the user to start a fresh session (`/clear`) and run `/execute-phase $1`. Do NOT suggest `/next-milestone`.
|
|
137
|
+
|
|
138
|
+
## Domain Rules for Plans
|
|
139
|
+
- File/module structure should mirror bounded contexts (e.g., `src/billing/`, `src/catalog/`)
|
|
140
|
+
- Never scatter one aggregate's logic across multiple contexts without an explicit ACL
|
|
141
|
+
- If a plan introduces a new domain term, update `.planning/DOMAIN.md` first
|
|
142
|
+
- Cross-context communication should use domain events, not direct imports
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Show current GSD project status (milestone, phase, task, blockers)
|
|
3
|
+
allowed-tools: Bash, Read
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /progress
|
|
7
|
+
|
|
8
|
+
Show current project status.
|
|
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
|
+
Before checking progress, decompose project state into atomic reasoning units:
|
|
15
|
+
|
|
16
|
+
1. **State the logical component** — What milestone are we in? What phase is active? What work is complete vs in-progress?
|
|
17
|
+
2. **Validate independence** — Are there blockers? Are phases in the correct sequence? Is anything waiting on external input?
|
|
18
|
+
3. **Verify correctness** — Does the reported state match reality? Are all verified phases truly complete? Are there unreported issues?
|
|
19
|
+
|
|
20
|
+
## Steps
|
|
21
|
+
1. Read `.planning/STATE.md` for current phase and status
|
|
22
|
+
2. Read `.planning/ROADMAP.md` and extract all phases with their status
|
|
23
|
+
3. Check for `.planning/CONTINUE-HERE.md` (paused session)
|
|
24
|
+
4. Read `.planning/execution-log.jsonl` for the last 10 entries
|
|
25
|
+
5. Report:
|
|
26
|
+
- Current phase and status
|
|
27
|
+
- Milestone completion (X of Y phases complete)
|
|
28
|
+
- Recent activity (last 5 task results)
|
|
29
|
+
- Any blockers or paused work
|
|
30
|
+
- Next suggested command based on state (e.g., `/resume-work`, `/discuss-phase N+1`)
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Execute a small ad-hoc task with tracking (implementer subagent + TDD cycle + optional spec-reviewer pass)
|
|
3
|
+
argument-hint: "<description>"
|
|
4
|
+
allowed-tools: Bash, Read, Write, Edit, Task
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# /quick
|
|
8
|
+
|
|
9
|
+
Execute a small ad-hoc task with tracking.
|
|
10
|
+
|
|
11
|
+
Task: $ARGUMENTS
|
|
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 `implementer`, `spec-reviewer`, or `reviewer` agent prompts.
|
|
14
|
+
|
|
15
|
+
## Atomic Reasoning
|
|
16
|
+
|
|
17
|
+
Before executing, decompose this task into atomic reasoning units:
|
|
18
|
+
|
|
19
|
+
1. **State the logical component** — What is the single, concrete outcome? What files need to change? What behavior needs to work?
|
|
20
|
+
2. **Validate independence** — Can this be done without touching other features? What dependencies exist? What could break?
|
|
21
|
+
3. **Verify correctness** — What test proves this works? What edge cases matter? Is this testable behavior or pure config?
|
|
22
|
+
|
|
23
|
+
**Synthesize execution plan:**
|
|
24
|
+
- Define specific files to modify
|
|
25
|
+
- Write failing test (if testable behavior)
|
|
26
|
+
- Implement minimal solution
|
|
27
|
+
- Verify and document
|
|
28
|
+
|
|
29
|
+
## Steps
|
|
30
|
+
1. Run `draht-tools next-quick-number` to get task number
|
|
31
|
+
2. Analyze the task and write a concrete plan with actual task details (files, actions, verification). Pipe it into `draht-tools create-quick-plan`:
|
|
32
|
+
```bash
|
|
33
|
+
echo 'plan content here' | node "${PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT:-$HOME/.draht/codex-marketplace/plugins/draht}}/bin/draht-tools.cjs" create-quick-plan NNN "$ARGUMENTS"
|
|
34
|
+
```
|
|
35
|
+
The plan content must include: a `# Quick Task NNN: title` heading, a `## Tasks` section with one or more `<task>` XML blocks containing real file paths, real actions, and real verification steps — NOT placeholders like `[files]`.
|
|
36
|
+
|
|
37
|
+
3. **Stage 1 — Implementer.** _Optional scoping (multi-file tasks):_ run `draht-tools graph-context <files>` and paste the pkg/layer/importers summary into the Codex subagent prompt. Then dispatch a Codex subagent using the `implementer` agent prompt:
|
|
38
|
+
```
|
|
39
|
+
Execute this task: $ARGUMENTS
|
|
40
|
+
|
|
41
|
+
Follow the TDD cycle:
|
|
42
|
+
- RED — Write a failing test that describes the desired behaviour
|
|
43
|
+
- GREEN — Write the minimum implementation to make it pass
|
|
44
|
+
- REFACTOR — Clean up while keeping the test green
|
|
45
|
+
|
|
46
|
+
Exception: skip the TDD cycle only for pure config or documentation-only tasks that have no testable behaviour.
|
|
47
|
+
|
|
48
|
+
After completion, report: files changed, tests written, and verification results.
|
|
49
|
+
|
|
50
|
+
End your response with `STATUS: DONE | DONE_WITH_CONCERNS | NEEDS_CONTEXT | BLOCKED` per the agent contract.
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Read the final `STATUS:` line:
|
|
54
|
+
- `DONE` → go to Stage 2 (or skip Stage 2 for pure-config / pure-docs tasks).
|
|
55
|
+
- `DONE_WITH_CONCERNS` → log concerns; correctness issues → re-dispatch; otherwise continue.
|
|
56
|
+
- `NEEDS_CONTEXT` → provide missing info and re-dispatch.
|
|
57
|
+
- `BLOCKED` → STOP, report to user.
|
|
58
|
+
|
|
59
|
+
4. **Stage 2 — Spec-reviewer (skip for pure-config / pure-docs).** Dispatch a Codex subagent using the `spec-reviewer` agent prompt and prompt:
|
|
60
|
+
```
|
|
61
|
+
Review the diff for this quick task against the plan written in `.planning/quick/NNN-*-PLAN.md`. ONLY check spec compliance — does the diff implement exactly what the plan's <test>/<action>/<done> sections asked, no more, no less?
|
|
62
|
+
|
|
63
|
+
Plan path: <plan file>
|
|
64
|
+
Diff: <run `git diff` on the commits since plan creation, or instruct the agent to>
|
|
65
|
+
|
|
66
|
+
End with `STATUS: DONE | DONE_WITH_CONCERNS | NEEDS_CONTEXT | BLOCKED`.
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
- `DONE` → go to Stage 3.
|
|
70
|
+
- `BLOCKED` → re-dispatch implementer with the "Required Fixes" list. Repeat Stage 1+2 until `DONE`.
|
|
71
|
+
|
|
72
|
+
5. **Stage 3 — Reviewer (optional code-quality pass).** For non-trivial quick tasks (touches more than one file or modifies domain code), _optionally_ run `draht-tools graph-impact <changed files>` and paste its reverse-dependents + boundary warnings into the Codex subagent prompt. Then dispatch a Codex subagent using the `reviewer` agent prompt:
|
|
73
|
+
```
|
|
74
|
+
Code-quality review of the diff for quick task NNN. Spec compliance already confirmed — focus on correctness, type safety, conventions, domain language. Report Must fix / Should fix / Consider.
|
|
75
|
+
|
|
76
|
+
End with `STATUS: DONE | DONE_WITH_CONCERNS | NEEDS_CONTEXT | BLOCKED`.
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
- `DONE` → quick task complete.
|
|
80
|
+
- `BLOCKED` → re-dispatch implementer with the Must-fix list.
|
|
81
|
+
|
|
82
|
+
6. Write summary: `draht-tools write-quick-summary NNN`
|
|
83
|
+
7. Update state: `draht-tools update-state`
|
|
84
|
+
|
|
85
|
+
## When to skip Stage 3
|
|
86
|
+
|
|
87
|
+
Stage 3 (quality review) is optional for `/quick` since these are by definition small tasks. Run it when:
|
|
88
|
+
- The diff touches more than one file
|
|
89
|
+
- The diff modifies code in `.planning/DOMAIN.md`'s bounded contexts
|
|
90
|
+
- The task is non-trivial behaviour, not pure mechanical change
|
|
91
|
+
|
|
92
|
+
Skip it when:
|
|
93
|
+
- Pure config (tsconfig, biome, formatter changes)
|
|
94
|
+
- Docs-only edits
|
|
95
|
+
- Single-line, obvious changes (typo fix, version bump)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Resume from the CONTINUE-HERE handoff document
|
|
3
|
+
allowed-tools: Bash, Read, Write, Edit
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /resume-work
|
|
7
|
+
|
|
8
|
+
Resume from last session state.
|
|
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
|
+
Before resuming, decompose handoff context into atomic reasoning units:
|
|
15
|
+
|
|
16
|
+
1. **State the logical component** — What phase/task was active? What was the last accomplishment? What decisions were made?
|
|
17
|
+
2. **Validate independence** — Are there blockers? What changed since the pause? Is the codebase in the expected state?
|
|
18
|
+
3. **Verify correctness** — Is the handoff document complete? Does the current state match what was documented? Can work continue safely?
|
|
19
|
+
|
|
20
|
+
## Steps
|
|
21
|
+
1. Read `.planning/CONTINUE-HERE.md` (if missing, tell the user there's nothing to resume)
|
|
22
|
+
2. Read `.planning/STATE.md` for current phase/status
|
|
23
|
+
3. Run `git status` to check current working state
|
|
24
|
+
4. Compare handoff document's "Uncommitted Changes" to actual git state — report any discrepancies
|
|
25
|
+
5. Summarize to the user:
|
|
26
|
+
- What was in progress
|
|
27
|
+
- What the next step is
|
|
28
|
+
- Any blockers to resolve first
|
|
29
|
+
6. Delete `.planning/CONTINUE-HERE.md` only after the user confirms work is resumed
|
|
30
|
+
7. Proceed with the next step from the handoff
|
|
31
|
+
|
|
32
|
+
## Rules
|
|
33
|
+
- Do not auto-execute the next step — confirm with the user first
|
|
34
|
+
- If the codebase state doesn't match the handoff (e.g., uncommitted changes missing), flag it before proceeding
|
|
35
|
+
- Preserve CONTINUE-HERE.md until the user acknowledges; this is the safety net
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Code review and security audit of recent changes (parallel reviewer + security-auditor + optional spec-reviewer)
|
|
3
|
+
argument-hint: "[scope]"
|
|
4
|
+
allowed-tools: Bash, Read, Task
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# /review
|
|
8
|
+
|
|
9
|
+
Code review and security audit of recent changes, using subagents for parallel analysis.
|
|
10
|
+
|
|
11
|
+
Scope: $ARGUMENTS
|
|
12
|
+
|
|
13
|
+
If no scope given, reviews all recent uncommitted changes.
|
|
14
|
+
|
|
15
|
+
> **Tool note**: For subagents, spawn Codex subagents and dispatch multiple in parallel (single assistant turn = multiple Codex subagent calls).
|
|
16
|
+
|
|
17
|
+
## Atomic Reasoning
|
|
18
|
+
|
|
19
|
+
Before reviewing, decompose code changes into atomic reasoning units:
|
|
20
|
+
|
|
21
|
+
**For each changed file:**
|
|
22
|
+
1. **State the logical component** — What does this change do? What problem does it solve? What behavior does it add/modify?
|
|
23
|
+
2. **Validate independence** — Does this change have side effects? Does it affect other modules? Are there hidden dependencies?
|
|
24
|
+
3. **Verify correctness** — Is this change correct? Type-safe? Secure? Does it follow conventions? What could go wrong?
|
|
25
|
+
|
|
26
|
+
**Synthesize review strategy:**
|
|
27
|
+
- Group changes by concern (correctness, security, style, spec compliance)
|
|
28
|
+
- Prioritize findings (critical, important, minor)
|
|
29
|
+
- Identify patterns across multiple files
|
|
30
|
+
- Check domain language compliance and bounded context boundaries
|
|
31
|
+
|
|
32
|
+
## Steps
|
|
33
|
+
1. Identify the scope:
|
|
34
|
+
- If argument given: use those files/directories/description as scope
|
|
35
|
+
- If no argument: run `git diff --stat` and `git diff --cached --stat` to find changes
|
|
36
|
+
2. Determine the list of changed files and produce a scope summary.
|
|
37
|
+
- Before reviewing, run `draht-tools graph-context <changed-files>` and `draht-tools graph-impact <changed-files>` for affected contexts + boundary/layer violations (if `.planning/codebase/MAP.json` is absent, run `draht-tools map-graph` first).
|
|
38
|
+
- Codex subagents cannot run draht-tools: paste the affected-contexts / boundary-violation summary into the reviewer and security-auditor prompts below.
|
|
39
|
+
|
|
40
|
+
3. **Detect spec context.** Look for a relevant plan in scope:
|
|
41
|
+
- If `$ARGUMENTS` mentions a phase/task/plan number → load that PLAN.md
|
|
42
|
+
- If `.planning/STATE.md` references an in-progress phase → check its plans for tasks matching the diff
|
|
43
|
+
- If no plan applies → spec-reviewer is skipped (ad-hoc review only)
|
|
44
|
+
|
|
45
|
+
4. **Delegate to subagents in parallel via Codex subagents** (dispatch all in the same assistant turn):
|
|
46
|
+
|
|
47
|
+
- **Codex subagent** with ``reviewer` agent prompt` and prompt:
|
|
48
|
+
```
|
|
49
|
+
Review the following code changes for correctness, type safety, conventions, and potential issues. Scope: <scope summary and file list>. Read each changed file to understand the changes. For each finding: cite the exact file and line, explain the issue, suggest the fix. Prioritize: Critical (must fix) > Important (should fix) > Minor (style/optional). Check domain language compliance against `.planning/DOMAIN.md` if it exists.
|
|
50
|
+
|
|
51
|
+
End with `STATUS: DONE | DONE_WITH_CONCERNS | NEEDS_CONTEXT | BLOCKED`.
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
- **Codex subagent** with ``security-auditor` agent prompt` and prompt:
|
|
55
|
+
```
|
|
56
|
+
Audit the following code changes for security vulnerabilities. Scope: <scope summary and file list>. Read each changed file. Check for: injection risks, auth bypasses, secrets in code, unsafe deserialization, path traversal, prototype pollution. Report findings with severity, file, line, and recommendation.
|
|
57
|
+
|
|
58
|
+
End with `STATUS: DONE | DONE_WITH_CONCERNS | NEEDS_CONTEXT | BLOCKED`.
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
- **(If spec context exists)** Codex subagent using the `spec-reviewer` agent prompt and prompt:
|
|
62
|
+
```
|
|
63
|
+
Review the diff against the plan at <plan file path>. ONLY check spec compliance — does the diff implement exactly what the plan's <test>/<action>/<done> sections asked, no more, no less? Flag omissions and over-builds.
|
|
64
|
+
|
|
65
|
+
Diff: <git diff range>
|
|
66
|
+
|
|
67
|
+
End with `STATUS: DONE | DONE_WITH_CONCERNS | NEEDS_CONTEXT | BLOCKED`.
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
5. Read each subagent's final `STATUS:` line.
|
|
71
|
+
6. Collect and merge results from all dispatched subagents.
|
|
72
|
+
7. Produce a unified, prioritized findings report:
|
|
73
|
+
- **Critical** — must fix before merge (security `BLOCKED`, spec gaps for required deliverables, correctness issues that cause data loss / crashes)
|
|
74
|
+
- **Important** — should fix (bugs, type issues, spec over-builds, missing error handling)
|
|
75
|
+
- **Minor** — style, naming, or optional improvements
|
|
76
|
+
|
|
77
|
+
## Reading STATUS
|
|
78
|
+
|
|
79
|
+
- Any subagent returning `STATUS: BLOCKED` → its findings escalate to Critical in the merged report
|
|
80
|
+
- `STATUS: NEEDS_CONTEXT` → provide missing info and re-dispatch that one agent; don't re-run the whole fan-out
|
|
81
|
+
- `STATUS: DONE` and `STATUS: DONE_WITH_CONCERNS` are normal terminal states; map their `Must fix` / `Should fix` / `Consider` outputs to Critical / Important / Minor in the merged report
|
|
82
|
+
|
|
83
|
+
## Rules
|
|
84
|
+
- Cite file paths and line numbers precisely
|
|
85
|
+
- Do not restate the diff — focus on findings
|
|
86
|
+
- If no issues found, state that explicitly
|
|
87
|
+
- spec-reviewer only runs when a spec exists — ad-hoc reviews skip it
|
|
@@ -0,0 +1,122 @@
|
|
|
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
|
+
Before verifying, decompose phase acceptance into atomic reasoning units:
|
|
18
|
+
|
|
19
|
+
**For each deliverable:**
|
|
20
|
+
1. **State the logical component** — What was this deliverable meant to produce? What user value does it provide?
|
|
21
|
+
2. **Validate independence** — Can this deliverable be tested independently? What are its dependencies?
|
|
22
|
+
3. **Verify correctness** — What tests prove it works? What edge cases must pass? What security concerns exist?
|
|
23
|
+
|
|
24
|
+
**Synthesize verification strategy:**
|
|
25
|
+
- Group parallel verification tasks (test suite, security audit, code review, spec compliance, domain compliance)
|
|
26
|
+
- Map each deliverable to its plan file (the spec)
|
|
27
|
+
- Identify critical vs optional checks
|
|
28
|
+
- Plan fix strategies for potential failures
|
|
29
|
+
|
|
30
|
+
## Steps
|
|
31
|
+
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.
|
|
32
|
+
1. Run `draht-tools extract-deliverables $1` to get testable items
|
|
33
|
+
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.
|
|
34
|
+
|
|
35
|
+
3. **Run parallel verification via Codex subagents.** Dispatch four subagents in parallel (single assistant turn, four Codex subagent calls):
|
|
36
|
+
|
|
37
|
+
- **Codex subagent** with ``verifier` agent prompt` and prompt:
|
|
38
|
+
```
|
|
39
|
+
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.
|
|
40
|
+
|
|
41
|
+
End with `STATUS: DONE | DONE_WITH_CONCERNS | NEEDS_CONTEXT | BLOCKED`.
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
- **Codex subagent** with ``security-auditor` agent prompt` and prompt:
|
|
45
|
+
```
|
|
46
|
+
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.
|
|
47
|
+
|
|
48
|
+
End with `STATUS: DONE | DONE_WITH_CONCERNS | NEEDS_CONTEXT | BLOCKED`.
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
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.
|
|
52
|
+
|
|
53
|
+
- **Codex subagent** with ``reviewer` agent prompt` and prompt:
|
|
54
|
+
```
|
|
55
|
+
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.
|
|
56
|
+
|
|
57
|
+
End with `STATUS: DONE | DONE_WITH_CONCERNS | NEEDS_CONTEXT | BLOCKED`.
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
- **Codex subagent** with ``spec-reviewer` agent prompt` and prompt:
|
|
61
|
+
```
|
|
62
|
+
Phase-level spec compliance check for phase $1. The phase has these plan files (each is a spec):
|
|
63
|
+
<list of .planning/phases/<N>-*/<N>-NN-PLAN.md paths>
|
|
64
|
+
|
|
65
|
+
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.
|
|
66
|
+
|
|
67
|
+
Output a per-plan compliance verdict (✅ COMPLIANT / ❌ NON-COMPLIANT) with omissions and over-builds listed for each.
|
|
68
|
+
|
|
69
|
+
End with `STATUS: DONE | DONE_WITH_CONCERNS | NEEDS_CONTEXT | BLOCKED`.
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
4. Run the quality gate check:
|
|
73
|
+
```bash
|
|
74
|
+
node "${PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT:-$HOME/.draht/codex-marketplace/plugins/draht}}/scripts/gsd-quality-gate.cjs"
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
5. **Read each subagent's `STATUS:` line and the quality gate exit code.** Treat the phase as failed if **any** of these is true:
|
|
78
|
+
- `verifier` returns `STATUS: BLOCKED` (tests / lint / typecheck failed)
|
|
79
|
+
- `security-auditor` returns `STATUS: BLOCKED` (Critical or High findings)
|
|
80
|
+
- `spec-reviewer` returns `STATUS: BLOCKED` (any plan is non-compliant)
|
|
81
|
+
- `reviewer` returns `STATUS: BLOCKED` (Must-fix correctness issues)
|
|
82
|
+
- Quality gate exits non-zero
|
|
83
|
+
|
|
84
|
+
6. Walk the user through each deliverable one at a time, incorporating findings from all four subagents.
|
|
85
|
+
|
|
86
|
+
7. Record results (pass/fail/partially/skip).
|
|
87
|
+
|
|
88
|
+
8. For failures: diagnose and create fix plans via `draht-tools create-fix-plan $1 P`
|
|
89
|
+
- Fix plans MUST include a reproducing test that demonstrates the failure before any implementation
|
|
90
|
+
- Spec-reviewer omissions become explicit fix-plan tasks (one task per omission)
|
|
91
|
+
|
|
92
|
+
9. Write UAT report: `draht-tools write-uat $1`
|
|
93
|
+
- Report must include: test health summary (pass/fail/coverage), security audit results, **spec compliance summary per plan**, domain model status (any glossary violations), deliverable results
|
|
94
|
+
|
|
95
|
+
10. If all passed: mark phase complete.
|
|
96
|
+
- If more phases remain in the milestone: tell the user to start a fresh session and run `/discuss-phase N+1`.
|
|
97
|
+
- If ALL phases in the milestone are complete: tell the user to start a fresh session and run `/next-milestone`.
|
|
98
|
+
|
|
99
|
+
11. If failures: route to `/execute-phase $1 --gaps-only`
|
|
100
|
+
|
|
101
|
+
## Why a phase-level spec-reviewer
|
|
102
|
+
|
|
103
|
+
`/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:
|
|
104
|
+
|
|
105
|
+
- A whole plan was skipped (no implementer ever ran on it)
|
|
106
|
+
- A task's commit was reverted or rebased away
|
|
107
|
+
- An out-of-scope drift that accumulated across multiple tasks
|
|
108
|
+
|
|
109
|
+
Cheap insurance — the diff already exists and the plans already exist; the agent just maps one to the other.
|
|
110
|
+
|
|
111
|
+
## Workflow
|
|
112
|
+
This is the last step in the per-phase cycle:
|
|
113
|
+
|
|
114
|
+
```
|
|
115
|
+
/discuss-phase N → /plan-phase N → /execute-phase N → /verify-work N
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
After verify-work passes:
|
|
119
|
+
- More phases remaining → `/discuss-phase N+1`
|
|
120
|
+
- ALL phases in milestone verified → `/next-milestone`
|
|
121
|
+
|
|
122
|
+
`/next-milestone` is ONLY for generating new phases after every phase in the current milestone is complete.
|
package/hooks/hooks.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"hooks": {
|
|
3
|
+
"SessionStart": [
|
|
4
|
+
{
|
|
5
|
+
"matcher": "",
|
|
6
|
+
"hooks": [
|
|
7
|
+
{
|
|
8
|
+
"type": "command",
|
|
9
|
+
"command": "node \"${PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT}}/scripts/session-start.cjs\""
|
|
10
|
+
}
|
|
11
|
+
]
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
"UserPromptSubmit": [
|
|
15
|
+
{
|
|
16
|
+
"matcher": "",
|
|
17
|
+
"hooks": [
|
|
18
|
+
{
|
|
19
|
+
"type": "command",
|
|
20
|
+
"command": "node \"${PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT}}/scripts/prompt-context.cjs\""
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "draht-codex",
|
|
3
|
+
"version": "2026.6.11",
|
|
4
|
+
"description": "Draht GSD, multi-agent, TDD and DDD workflows as a Codex plugin. Install with `npx draht-codex install`.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"draht-codex": "./cli.mjs"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
".codex-plugin",
|
|
11
|
+
"bin",
|
|
12
|
+
"scripts",
|
|
13
|
+
"hooks",
|
|
14
|
+
"commands",
|
|
15
|
+
"agents",
|
|
16
|
+
"skills",
|
|
17
|
+
"cli.mjs",
|
|
18
|
+
"README.md",
|
|
19
|
+
"LICENSE",
|
|
20
|
+
"CHANGELOG.md"
|
|
21
|
+
],
|
|
22
|
+
"scripts": {
|
|
23
|
+
"sync-tools": "node ../../scripts/sync-draht-tools.mjs",
|
|
24
|
+
"test": "node cli.mjs --help > /dev/null && node scripts/gsd-pre-execute.cjs --self-check 2>/dev/null || true",
|
|
25
|
+
"prepublishOnly": "node ../../scripts/sync-draht-tools.mjs"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@draht/tools": "2026.6.11"
|
|
29
|
+
},
|
|
30
|
+
"keywords": [
|
|
31
|
+
"codex",
|
|
32
|
+
"codex-plugin",
|
|
33
|
+
"draht",
|
|
34
|
+
"gsd",
|
|
35
|
+
"planning",
|
|
36
|
+
"tdd",
|
|
37
|
+
"ddd",
|
|
38
|
+
"multi-agent",
|
|
39
|
+
"workflow",
|
|
40
|
+
"installer"
|
|
41
|
+
],
|
|
42
|
+
"author": "Oskar Freye",
|
|
43
|
+
"license": "MIT",
|
|
44
|
+
"publishConfig": {
|
|
45
|
+
"access": "public"
|
|
46
|
+
},
|
|
47
|
+
"repository": {
|
|
48
|
+
"type": "git",
|
|
49
|
+
"url": "git+https://github.com/draht-dev/draht.git",
|
|
50
|
+
"directory": "packages/draht-codex"
|
|
51
|
+
},
|
|
52
|
+
"engines": {
|
|
53
|
+
"node": ">=20.6.0"
|
|
54
|
+
}
|
|
55
|
+
}
|