@draht/coding-agent 2026.4.26 → 2026.5.12
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/CHANGELOG.md +17 -0
- package/bin/draht-tools.cjs +53 -0
- package/dist/prompts/commands/atomic-commit.md +12 -0
- package/dist/prompts/commands/execute-phase.md +48 -17
- package/dist/prompts/commands/fix.md +86 -23
- package/dist/prompts/commands/map-codebase.md +3 -3
- package/dist/prompts/commands/orchestrate.md +31 -6
- package/dist/prompts/commands/plan-phase.md +39 -6
- package/dist/prompts/commands/quick.md +36 -6
- package/dist/prompts/commands/review.md +28 -11
- package/dist/prompts/commands/verify-work.md +34 -17
- package/package.json +6 -5
- package/prompts/commands/atomic-commit.md +12 -0
- package/prompts/commands/execute-phase.md +48 -17
- package/prompts/commands/fix.md +86 -23
- package/prompts/commands/map-codebase.md +3 -3
- package/prompts/commands/orchestrate.md +31 -6
- package/prompts/commands/plan-phase.md +39 -6
- package/prompts/commands/quick.md +36 -6
- package/prompts/commands/review.md +28 -11
- package/prompts/commands/verify-work.md +34 -17
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: "Code review and security audit of recent changes"
|
|
2
|
+
description: "Code review and security audit of recent changes (parallel reviewer + security-auditor + optional spec-reviewer)"
|
|
3
3
|
---
|
|
4
4
|
|
|
5
5
|
# /review
|
|
@@ -25,7 +25,7 @@ Before reviewing, decompose code changes into atomic reasoning units:
|
|
|
25
25
|
3. **Verify correctness** — Is this change correct? Type-safe? Secure? Does it follow conventions? What could go wrong?
|
|
26
26
|
|
|
27
27
|
**Synthesize review strategy:**
|
|
28
|
-
- Group changes by concern (correctness, security, style)
|
|
28
|
+
- Group changes by concern (correctness, security, style, spec compliance)
|
|
29
29
|
- Prioritize findings (critical, important, minor)
|
|
30
30
|
- Identify patterns across multiple files
|
|
31
31
|
- Check domain language compliance and bounded context boundaries
|
|
@@ -35,13 +35,30 @@ Before reviewing, decompose code changes into atomic reasoning units:
|
|
|
35
35
|
- If argument given: use those files/directories/description as scope
|
|
36
36
|
- If no argument: run `git diff --stat` and `git diff --cached --stat` to find changes
|
|
37
37
|
2. Determine the list of changed files and produce a scope summary
|
|
38
|
-
3. **
|
|
38
|
+
3. **Detect spec context.** Look for a relevant plan:
|
|
39
|
+
- If `$ARGUMENTS` mentions a phase/task/plan number → load that PLAN.md
|
|
40
|
+
- If `.planning/STATE.md` references an in-progress phase → check its plans for tasks matching the diff
|
|
41
|
+
- If no plan applies → spec-reviewer is skipped
|
|
42
|
+
4. **Delegate to subagents in parallel:**
|
|
39
43
|
Use the `subagent` tool in **parallel mode** with these tasks:
|
|
40
|
-
- `reviewer` agent: "Review the following code changes for correctness, type safety, conventions, and potential issues. Scope: <scope summary and file list>. Read each changed file
|
|
41
|
-
- `security-auditor` agent: "Audit the following code changes for security vulnerabilities. Scope: <scope summary and file list>.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
5.
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
- **
|
|
44
|
+
- `reviewer` agent: "Review the following code changes for correctness, type safety, conventions, and potential issues. Scope: <scope summary and file list>. Read each changed file. For each finding: cite the exact file and line, explain the issue, suggest the fix. Prioritize: Critical / Important / Minor. End with `STATUS: DONE | DONE_WITH_CONCERNS | NEEDS_CONTEXT | BLOCKED`. Do NOT run draht, draht-tools, or pi commands."
|
|
45
|
+
- `security-auditor` agent: "Audit the following code changes for security vulnerabilities. Scope: <scope summary and file list>. Check injection, auth bypass, secrets, unsafe deserialization, path traversal, prototype pollution. Report severity / file / line / fix. End with `STATUS: ...`. Do NOT run draht, draht-tools, or pi commands."
|
|
46
|
+
- **(If spec context exists)** `spec-reviewer` agent: "Review the diff against plan at <plan file path>. ONLY spec compliance — does the diff implement exactly what the <test>/<action>/<done> sections asked? Flag omissions and over-builds. End with `STATUS: ...`."
|
|
47
|
+
|
|
48
|
+
5. Read each subagent's final `STATUS:` line.
|
|
49
|
+
6. Collect and merge results.
|
|
50
|
+
7. Produce a unified, prioritized findings report:
|
|
51
|
+
- **Critical** — must fix before merge (security `BLOCKED`, spec gaps for required deliverables, correctness issues that cause data loss / crashes)
|
|
52
|
+
- **Important** — should fix (bugs, type issues, spec over-builds, missing error handling)
|
|
53
|
+
- **Minor** — style, naming, optional improvements
|
|
54
|
+
|
|
55
|
+
## Reading STATUS
|
|
56
|
+
- Any `STATUS: BLOCKED` → its findings escalate to Critical in the merged report
|
|
57
|
+
- `STATUS: NEEDS_CONTEXT` → provide missing info and re-dispatch that one agent
|
|
58
|
+
- `STATUS: DONE` / `DONE_WITH_CONCERNS` are normal terminal states
|
|
59
|
+
|
|
60
|
+
## Rules
|
|
61
|
+
- Cite file paths and line numbers precisely
|
|
62
|
+
- Do not restate the diff — focus on findings
|
|
63
|
+
- If no issues found, state that explicitly
|
|
64
|
+
- spec-reviewer only runs when a spec exists — ad-hoc reviews skip it
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: "Acceptance testing of completed phase work"
|
|
2
|
+
description: "Acceptance testing of completed phase work (parallel verifier + security-auditor + reviewer + spec-reviewer)"
|
|
3
3
|
---
|
|
4
4
|
|
|
5
5
|
# /verify-work
|
|
6
6
|
|
|
7
|
-
Walk through acceptance testing of completed phase work, using subagents for parallel verification.
|
|
7
|
+
Walk through acceptance testing of completed phase work, using subagents for parallel verification — including a spec-compliance pass against the phase's plan files.
|
|
8
8
|
|
|
9
9
|
## Usage
|
|
10
10
|
```
|
|
@@ -23,30 +23,47 @@ Before verifying, decompose phase acceptance into atomic reasoning units:
|
|
|
23
23
|
3. **Verify correctness** — What tests prove it works? What edge cases must pass? What security concerns exist?
|
|
24
24
|
|
|
25
25
|
**Synthesize verification strategy:**
|
|
26
|
-
- Group parallel verification tasks (test suite, security audit, code review, domain compliance)
|
|
27
|
-
- Map each deliverable to
|
|
26
|
+
- Group parallel verification tasks (test suite, security audit, code review, spec compliance, domain compliance)
|
|
27
|
+
- Map each deliverable to its plan file (the spec)
|
|
28
28
|
- Identify critical vs optional checks
|
|
29
29
|
- Plan fix strategies for potential failures
|
|
30
30
|
|
|
31
31
|
## Steps
|
|
32
32
|
1. Run `draht-tools extract-deliverables $1` to get testable items
|
|
33
|
-
2.
|
|
33
|
+
2. Discover the phase's plan files (`.planning/phases/<N>-*/<N>-NN-PLAN.md`). Each plan is the spec the spec-reviewer evaluates against.
|
|
34
|
+
3. **Run parallel verification via subagents:**
|
|
34
35
|
Use the `subagent` tool in **parallel mode** with these tasks:
|
|
35
|
-
- `verifier` agent: "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. Do NOT run draht, draht-tools, or pi commands."
|
|
36
|
-
- `security-auditor` agent: "Audit the recent code changes (use git log and git diff to
|
|
37
|
-
- `reviewer` agent: "Review the recent code changes
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
4.
|
|
41
|
-
|
|
42
|
-
|
|
36
|
+
- `verifier` agent: "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. End with `STATUS: DONE | DONE_WITH_CONCERNS | NEEDS_CONTEXT | BLOCKED`. Do NOT run draht, draht-tools, or pi commands."
|
|
37
|
+
- `security-auditor` agent: "Audit the recent code changes (use git log and git diff, scoped to this phase's commits). Check for injection risks, auth bypasses, secrets in code, unsafe patterns. Report findings by severity. End with `STATUS: ...`. Do NOT run draht, draht-tools, or pi commands."
|
|
38
|
+
- `reviewer` agent: "Review the recent code changes for this phase. Check domain language compliance against `.planning/DOMAIN.md` if it exists — scan for identifiers not in the glossary and cross-context boundary violations. Report Must fix / Should fix / Consider. End with `STATUS: ...`. Do NOT run draht, draht-tools, or pi commands."
|
|
39
|
+
- `spec-reviewer` agent: "Phase-level spec compliance check for phase $1. The phase has these plan files (each is a spec): <list of .planning/phases/<N>-*/<N>-NN-PLAN.md paths>. For each plan, evaluate whether the phase's commits implement exactly what the plan's <task> elements asked — no missing tasks, no over-builds. Use git log and git diff against the phase commit range. Output a per-plan compliance verdict with omissions and over-builds. End with `STATUS: ...`."
|
|
40
|
+
|
|
41
|
+
4. **Read each subagent's `STATUS:` line.** Treat the phase as failed if any of these is `BLOCKED`:
|
|
42
|
+
- `verifier` (tests / lint / typecheck failed)
|
|
43
|
+
- `security-auditor` (Critical or High findings)
|
|
44
|
+
- `spec-reviewer` (any plan non-compliant)
|
|
45
|
+
- `reviewer` (Must-fix correctness issues)
|
|
46
|
+
|
|
47
|
+
5. Collect results and walk user through each deliverable, incorporating findings.
|
|
48
|
+
6. Record results (pass/fail/partially/skip).
|
|
49
|
+
7. For failures: diagnose and create fix plans via `draht-tools create-fix-plan $1 P`
|
|
43
50
|
- Fix plans MUST include a reproducing test that demonstrates the failure before any implementation
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
51
|
+
- Spec-reviewer omissions become explicit fix-plan tasks (one task per omission)
|
|
52
|
+
8. Write UAT report: `draht-tools write-uat $1`
|
|
53
|
+
- 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
|
|
54
|
+
9. If all passed: mark phase complete.
|
|
47
55
|
- If more phases remain in the milestone: tell the user to start a new session and run `/discuss-phase N+1`.
|
|
48
56
|
- If ALL phases in the milestone are complete: tell the user to start a new session and run `/next-milestone`.
|
|
49
|
-
|
|
57
|
+
10. If failures: route to `execute-phase $1 --gaps-only`
|
|
58
|
+
|
|
59
|
+
## Why a phase-level spec-reviewer
|
|
60
|
+
|
|
61
|
+
`/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:
|
|
62
|
+
- A whole plan was skipped (no implementer ever ran on it)
|
|
63
|
+
- A task's commit was reverted or rebased away
|
|
64
|
+
- Out-of-scope drift that accumulated across multiple tasks
|
|
65
|
+
|
|
66
|
+
Cheap insurance — the diff and plans already exist; the agent maps one to the other.
|
|
50
67
|
|
|
51
68
|
## Workflow
|
|
52
69
|
This is the last step in the per-phase cycle. Each step runs in its own session (`/new` between steps):
|