draht-codex 2026.10.20 → 2026.10.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.codex-plugin/plugin.json +1 -1
- package/CHANGELOG.md +16 -0
- package/agents/advisor.md +2 -2
- package/agents/architect.md +10 -71
- package/agents/debugger.md +12 -82
- package/agents/git-committer.md +10 -52
- package/agents/implementer.md +15 -63
- package/agents/investigator.md +11 -63
- package/agents/reviewer.md +15 -65
- package/agents/security-auditor.md +12 -105
- package/agents/spec-reviewer.md +12 -53
- package/agents/verifier.md +13 -54
- package/commands/atomic-commit.md +9 -9
- package/commands/create-verification-skill.md +8 -48
- package/commands/discuss-phase.md +5 -9
- package/commands/execute-phase.md +17 -47
- package/commands/fix.md +16 -130
- package/commands/grill.md +6 -51
- package/commands/init-project.md +10 -14
- package/commands/map-codebase.md +2 -2
- package/commands/new-project.md +9 -14
- package/commands/next-milestone.md +3 -7
- package/commands/orchestrate-loop.md +12 -12
- package/commands/orchestrate.md +12 -11
- package/commands/pause-work.md +1 -1
- package/commands/plan-phase.md +16 -38
- package/commands/quick.md +9 -78
- package/commands/resolve-conflicts.md +2 -15
- package/commands/triage.md +3 -14
- package/commands/verify-work.md +17 -106
- package/commands/why.md +18 -118
- package/hooks/hooks.json +10 -0
- package/package.json +4 -4
- package/scripts/checks-runtime.cjs +215 -0
- package/scripts/git-safety-hook.cjs +21 -0
- package/scripts/git-safety.cjs +198 -0
- package/scripts/gsd-post-task.cjs +78 -39
- package/scripts/gsd-quality-gate.cjs +206 -120
- package/scripts/prompt-context.cjs +40 -6
- package/scripts/session-start.cjs +6 -4
- package/scripts/stop-quality-gate.cjs +55 -25
- package/skills/atomic-commit/command.md +9 -9
- package/skills/atomic-reasoning/SKILL.md +6 -105
- package/skills/blast-radius/SKILL.md +1 -1
- package/skills/brainstorming/SKILL.md +8 -126
- package/skills/create-verification-skill/SKILL.md +1 -1
- package/skills/create-verification-skill/command.md +8 -48
- package/skills/ddd-workflow/SKILL.md +8 -101
- package/skills/debugging-workflow/SKILL.md +12 -122
- package/skills/discuss-phase/SKILL.md +1 -0
- package/skills/discuss-phase/agents/openai.yaml +2 -0
- package/skills/discuss-phase/command.md +5 -9
- package/skills/draht/SKILL.md +18 -14
- package/skills/epistemics/SKILL.md +12 -87
- package/skills/execute-phase/SKILL.md +1 -0
- package/skills/execute-phase/agents/openai.yaml +2 -0
- package/skills/execute-phase/command.md +17 -47
- package/skills/explainers/SKILL.md +1 -1
- package/skills/fix/SKILL.md +2 -1
- package/skills/fix/agents/openai.yaml +2 -0
- package/skills/fix/command.md +16 -130
- package/skills/grill/SKILL.md +1 -1
- package/skills/grill/command.md +6 -51
- package/skills/gsd-workflow/SKILL.md +37 -21
- package/skills/gsd-workflow/agents/openai.yaml +2 -0
- package/skills/init-project/SKILL.md +1 -0
- package/skills/init-project/agents/openai.yaml +2 -0
- package/skills/init-project/command.md +10 -14
- package/skills/loop-workflow/SKILL.md +7 -41
- package/skills/map-codebase/command.md +2 -2
- package/skills/model-tiering/SKILL.md +7 -7
- package/skills/new-project/SKILL.md +1 -0
- package/skills/new-project/agents/openai.yaml +2 -0
- package/skills/new-project/command.md +9 -14
- package/skills/next-milestone/SKILL.md +1 -0
- package/skills/next-milestone/agents/openai.yaml +2 -0
- package/skills/next-milestone/command.md +3 -7
- package/skills/orchestrate/command.md +12 -11
- package/skills/orchestrate-loop/command.md +12 -12
- package/skills/pause-work/SKILL.md +1 -0
- package/skills/pause-work/agents/openai.yaml +2 -0
- package/skills/pause-work/command.md +1 -1
- package/skills/plan-phase/SKILL.md +1 -0
- package/skills/plan-phase/agents/openai.yaml +2 -0
- package/skills/plan-phase/command.md +16 -38
- package/skills/progress/SKILL.md +1 -0
- package/skills/progress/agents/openai.yaml +2 -0
- package/skills/quick/SKILL.md +2 -1
- package/skills/quick/agents/openai.yaml +2 -0
- package/skills/quick/command.md +9 -78
- package/skills/resolve-conflicts/command.md +2 -15
- package/skills/resume-work/SKILL.md +1 -0
- package/skills/resume-work/agents/openai.yaml +2 -0
- package/skills/saga-spawner/SKILL.md +1 -1
- package/skills/tdd-workflow/SKILL.md +15 -104
- package/skills/triage/SKILL.md +2 -1
- package/skills/triage/agents/openai.yaml +2 -0
- package/skills/triage/command.md +3 -14
- package/skills/typescript-discipline/SKILL.md +12 -42
- package/skills/typescript-discipline/references/patterns.md +25 -266
- package/skills/unslop/SKILL.md +14 -105
- package/skills/verification-gate/SKILL.md +16 -76
- package/skills/verify-work/SKILL.md +1 -0
- package/skills/verify-work/agents/openai.yaml +2 -0
- package/skills/verify-work/command.md +17 -106
- package/skills/why/SKILL.md +1 -1
- package/skills/why/command.md +18 -118
|
@@ -4,17 +4,18 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* Stop-Time Quality Gate Hook (Stop)
|
|
6
6
|
* Runs the draht quality gate when the agent tries to end its turn with
|
|
7
|
-
* uncommitted
|
|
8
|
-
*
|
|
7
|
+
* uncommitted JavaScript or TypeScript changes, independently of planning
|
|
8
|
+
* metadata or whether command prose invoked verification.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* Explicit project checks cover every configured language and committed work.
|
|
11
|
+
* Passing evidence is reused only while its input scope is unchanged. A failed
|
|
12
|
+
* repeated Stop remains failed; the host retry flag cannot bypass verification.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
const {
|
|
15
|
+
const { execFileSync, spawnSync } = require("node:child_process");
|
|
16
16
|
const fs = require("node:fs");
|
|
17
17
|
const path = require("node:path");
|
|
18
|
+
const { runChecks } = require("./checks-runtime.cjs");
|
|
18
19
|
|
|
19
20
|
function readStdin() {
|
|
20
21
|
try {
|
|
@@ -24,15 +25,45 @@ function readStdin() {
|
|
|
24
25
|
}
|
|
25
26
|
}
|
|
26
27
|
|
|
28
|
+
function hasSourceChanges(status) {
|
|
29
|
+
const entries = status.split("\0");
|
|
30
|
+
for (let index = 0; index < entries.length; index++) {
|
|
31
|
+
const entry = entries[index];
|
|
32
|
+
if (!entry) continue;
|
|
33
|
+
const files = [entry.slice(3)];
|
|
34
|
+
// In porcelain -z, a rename/copy records destination then original path.
|
|
35
|
+
if (/[RC]/.test(entry.slice(0, 2))) files.push(entries[++index] || "");
|
|
36
|
+
if (files.some((file) => /\.(ts|tsx|js|jsx|mjs|cjs)$/.test(file))) return true;
|
|
37
|
+
}
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function failGate(result) {
|
|
42
|
+
const reason = result.error?.code || result.signal ||
|
|
43
|
+
(typeof result.status === "number" ? `exit ${result.status}` : "unknown exit");
|
|
44
|
+
console.error(`Quality gate failed on uncommitted source changes (${reason}) — fix before ending the turn:`);
|
|
45
|
+
for (const output of [result.stdout, result.stderr, result.error?.message]) {
|
|
46
|
+
if (output) console.error(String(output).slice(0, 1500));
|
|
47
|
+
}
|
|
48
|
+
process.exit(2);
|
|
49
|
+
}
|
|
50
|
+
|
|
27
51
|
try {
|
|
28
52
|
const payload = JSON.parse(readStdin() || "{}");
|
|
29
|
-
if (payload?.stop_hook_active) process.exit(0);
|
|
30
53
|
|
|
31
54
|
const cwd = payload?.cwd || process.cwd();
|
|
55
|
+
const project = runChecks({ cwd });
|
|
56
|
+
if (project.configured || project.status === "failed") {
|
|
57
|
+
if (project.status === "failed") {
|
|
58
|
+
console.error(project.summary);
|
|
59
|
+
for (const check of project.checks) if (check.output) console.error(check.output.slice(0, 1500));
|
|
60
|
+
process.exit(2);
|
|
61
|
+
}
|
|
62
|
+
process.exit(0);
|
|
63
|
+
}
|
|
32
64
|
const planning = path.join(cwd, ".planning");
|
|
33
|
-
if (!fs.existsSync(planning)) process.exit(0);
|
|
34
65
|
|
|
35
|
-
//
|
|
66
|
+
// Planning metadata is optional; retain existing projects' explicit opt-out.
|
|
36
67
|
try {
|
|
37
68
|
const config = JSON.parse(fs.readFileSync(path.join(planning, "config.json"), "utf-8"));
|
|
38
69
|
if (config?.hooks?.stopGate === false) process.exit(0);
|
|
@@ -42,27 +73,26 @@ try {
|
|
|
42
73
|
// with a clean tree has nothing to verify.
|
|
43
74
|
let dirty = "";
|
|
44
75
|
try {
|
|
45
|
-
dirty =
|
|
76
|
+
dirty = execFileSync("git", ["status", "--porcelain=v1", "-z", "--untracked-files=all"], {
|
|
77
|
+
encoding: "utf-8", cwd, timeout: 10000, stdio: ["ignore", "pipe", "pipe"],
|
|
78
|
+
});
|
|
46
79
|
} catch {
|
|
47
80
|
process.exit(0); // not a git repo
|
|
48
81
|
}
|
|
49
|
-
|
|
50
|
-
.split("\n")
|
|
51
|
-
.filter(Boolean)
|
|
52
|
-
.map((l) => l.slice(3))
|
|
53
|
-
.filter((f) => /\.(ts|tsx|js|jsx|mjs|cjs)$/.test(f));
|
|
54
|
-
if (dirtySource.length === 0) process.exit(0);
|
|
82
|
+
if (!hasSourceChanges(dirty)) process.exit(0);
|
|
55
83
|
|
|
56
|
-
//
|
|
57
|
-
//
|
|
84
|
+
// Run configured types/lint checks, without GSD heuristics or a full test
|
|
85
|
+
// suite on every turn-end. The gate retains its project strictness policy.
|
|
58
86
|
const gate = path.join(__dirname, "gsd-quality-gate.cjs");
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
87
|
+
let result;
|
|
88
|
+
try {
|
|
89
|
+
result = spawnSync(process.execPath, [gate, "--no-tests", "--checks-only"], { encoding: "utf-8", cwd, timeout: 170000 });
|
|
90
|
+
} catch (error) {
|
|
91
|
+
failGate({ error });
|
|
64
92
|
}
|
|
93
|
+
if (result.error || result.signal || result.status !== 0) failGate(result);
|
|
65
94
|
process.exit(0);
|
|
66
|
-
} catch {
|
|
67
|
-
|
|
95
|
+
} catch (error) {
|
|
96
|
+
console.error(`Quality gate could not run: ${error.message}`);
|
|
97
|
+
process.exit(2);
|
|
68
98
|
}
|
|
@@ -7,9 +7,9 @@ allowed-tools: Bash, Read, Task
|
|
|
7
7
|
|
|
8
8
|
Analyze changes and create atomic commits.
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## Commit prerequisites
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
Resolve these conditions before committing:
|
|
13
13
|
|
|
14
14
|
- A single proposed commit mixes unrelated concerns (e.g., a feature + an unrelated refactor + a config tweak)
|
|
15
15
|
- The change set contains potential secrets (`.env`, credentials, API keys in source)
|
|
@@ -17,7 +17,7 @@ Do NOT proceed with a commit if **any** of these is true:
|
|
|
17
17
|
- Pre-commit hooks fail — fix the cause, never use `--no-verify`
|
|
18
18
|
- You cannot articulate the "why" of a commit in one sentence — that's a sign it contains more than one logical change
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
Split unrelated changes and resolve check failures within scope. Report secrets or ownership questions that cannot be safely resolved.
|
|
21
21
|
|
|
22
22
|
## Atomic Reasoning
|
|
23
23
|
|
|
@@ -33,9 +33,9 @@ First, gather the current state:
|
|
|
33
33
|
|
|
34
34
|
## Strategy
|
|
35
35
|
|
|
36
|
-
Based on the changes, analyze and group them into logical,
|
|
36
|
+
Based on the changes, analyze and group them into logical, atomic commits. Each commit should:
|
|
37
37
|
|
|
38
|
-
1. Contain
|
|
38
|
+
1. Contain one logical change only
|
|
39
39
|
2. Be self-contained and complete
|
|
40
40
|
3. Not break the build if applied independently
|
|
41
41
|
|
|
@@ -44,7 +44,7 @@ You may delegate this work to the `git-committer` subagent via Codex subagents w
|
|
|
44
44
|
For each group of changes you identify:
|
|
45
45
|
- List the specific files that belong together
|
|
46
46
|
- Generate a clear, descriptive commit message following conventional commits format
|
|
47
|
-
- Explain
|
|
47
|
+
- Explain why these changes belong in one commit
|
|
48
48
|
|
|
49
49
|
Then execute the `git add <specific-files>` and `git commit` commands for each atomic commit in the order they should be applied.
|
|
50
50
|
|
|
@@ -56,7 +56,7 @@ type(scope): brief description
|
|
|
56
56
|
Common types: feat, fix, refactor, docs, test, chore, style, perf. For strict TDD cycles, also use `red:`, `green:`, `refactor:`.
|
|
57
57
|
|
|
58
58
|
## Rules
|
|
59
|
-
-
|
|
60
|
-
-
|
|
61
|
-
-
|
|
59
|
+
- Never use `git add -A` or `git add .` — always stage specific files
|
|
60
|
+
- Never use `git commit --no-verify`
|
|
61
|
+
- Never force push
|
|
62
62
|
- Review diffs before committing to ensure nothing unexpected is staged
|
|
@@ -1,115 +1,16 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: atomic-reasoning
|
|
3
|
-
description: Decompose work into
|
|
3
|
+
description: Decompose complex work into coherent, independently verifiable units when planning dependencies, parallel implementation, or atomic commits.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Atomic Reasoning
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Use decomposition when it helps coordinate or verify the work. Small tasks can be implemented directly; this skill does not open every command or require a written plan.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
For each unit, identify its intended outcome, dependencies, affected scope, and proving checks. Keep changes together when splitting them would leave an incoherent intermediate state. Split unrelated outcomes. A unit may span files or layers when one behavior requires them; neither a time estimate nor a file count determines atomicity.
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
Use `draht-tools graph-context <files>` and `graph-impact <files>` when the repository has a map and dependency boundaries are unclear. Structural clusters are evidence about coupling, not a rule that each task must fit one cluster.
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
Resolve uncertainty that could invalidate later work early. Parallelize units with independent ownership and explicit integration points. Give each subagent the outcome, scope, constraints, and acceptance checks; a blocker requires investigation, not automatic subdivision.
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
- What does this change do? What is its singular purpose?
|
|
18
|
-
- What observable outcome does it produce?
|
|
19
|
-
- Does it complete a thought, or is it half of one?
|
|
20
|
-
|
|
21
|
-
If you can't state the purpose in one sentence, the unit is not yet atomic — keep decomposing.
|
|
22
|
-
|
|
23
|
-
### 2. Validate Independence
|
|
24
|
-
- Can this be done without touching unrelated features?
|
|
25
|
-
- Does it depend on other units, or is it standalone?
|
|
26
|
-
- Which files does it touch? Are those files coupled to anything outside this unit's concern?
|
|
27
|
-
- If applied alone, would the codebase still build/run?
|
|
28
|
-
|
|
29
|
-
If the answer to "would it build alone" is *no*, the unit is too small — pair it with the dependency. If the answer to "does it touch unrelated concerns" is *yes*, the unit is too big — split it.
|
|
30
|
-
|
|
31
|
-
### 3. Verify Correctness
|
|
32
|
-
- What test or check would prove this unit works?
|
|
33
|
-
- What inputs → what expected outputs or state changes?
|
|
34
|
-
- What edge cases or failure modes exist?
|
|
35
|
-
|
|
36
|
-
If you can't name the proving test, you don't yet understand what "correct" means for this unit. Define it before building.
|
|
37
|
-
|
|
38
|
-
## How to Apply
|
|
39
|
-
|
|
40
|
-
### Before planning a feature
|
|
41
|
-
For each observable user-visible outcome:
|
|
42
|
-
1. State the logical component (what must be true for the user?)
|
|
43
|
-
2. Validate independence (which artifacts prove this? can it be built standalone?)
|
|
44
|
-
3. Verify correctness (what scenarios prove it works?)
|
|
45
|
-
|
|
46
|
-
### Validate a decomposition against the living map
|
|
47
|
-
Run `draht-tools graph-context <file...>` on each unit's files: a unit whose files share one cluster/bounded context is atomic; a unit spanning multiple contexts should be split along the boundary.
|
|
48
|
-
|
|
49
|
-
### Before splitting a commit
|
|
50
|
-
For each file in the diff:
|
|
51
|
-
1. State the logical component (what does this change accomplish?)
|
|
52
|
-
2. Validate independence (would this build alone? does it mix concerns?)
|
|
53
|
-
3. Verify correctness (is the change complete? does it leave a coherent intermediate state?)
|
|
54
|
-
|
|
55
|
-
### Before fixing a bug
|
|
56
|
-
1. State the logical component (what is the observed failure? what should happen vs what does?)
|
|
57
|
-
2. Validate independence (which components are involved? can we isolate it?)
|
|
58
|
-
3. Verify correctness (what test reproduces it reliably? what would prove it fixed?)
|
|
59
|
-
|
|
60
|
-
### Before refactoring
|
|
61
|
-
1. State the logical component (what structural change are you making?)
|
|
62
|
-
2. Validate independence (which behaviour-equivalence test proves this is a refactor, not a rewrite?)
|
|
63
|
-
3. Verify correctness (all tests stay green after the change?)
|
|
64
|
-
|
|
65
|
-
## Atomicity Heuristics
|
|
66
|
-
|
|
67
|
-
A unit is atomic if:
|
|
68
|
-
- ✅ It can be described in one sentence
|
|
69
|
-
- ✅ It can be built or applied in 2–5 minutes of focused work
|
|
70
|
-
- ✅ It can be verified by ONE test or check
|
|
71
|
-
- ✅ It touches ONE concern in the codebase
|
|
72
|
-
- ✅ All files in the atomic unit belong to one bounded context (or explicitly cross a documented boundary) — confirm with `draht-tools graph-context`
|
|
73
|
-
- ✅ It produces ONE commit (or one TDD red→green→refactor trio)
|
|
74
|
-
- ✅ Its `<files>` list contains specific paths, not "all relevant files"
|
|
75
|
-
- ✅ Its outcome is a concrete state change, not "improve X"
|
|
76
|
-
|
|
77
|
-
If any of these fail, decompose further.
|
|
78
|
-
|
|
79
|
-
## Order by Risk
|
|
80
|
-
|
|
81
|
-
Decomposition tells you the units; it doesn't tell you which to do first. When the units are independent, sequence is a lever — use it to fail cheaply.
|
|
82
|
-
|
|
83
|
-
Score each unit by **uncertainty** (has this codebase done it before?) × **blast radius** (how many other units become invalid if this one is wrong?). Do the highest-scoring unit first; push boilerplate last. Boilerplate never invalidates the plan — the risky, unfamiliar unit regularly does, and you want to discover that before you've built everything downstream of it.
|
|
84
|
-
|
|
85
|
-
*Example:* a feature needs a third-party webhook and a settings screen. Both are atomic. Prove the webhook round-trip first — if the contract isn't what you assumed, the settings screen you'd have built on top of it was wasted. *Prevents:* sinking effort into work that a later, riskier unit turns out to obsolete.
|
|
86
|
-
|
|
87
|
-
## Anti-Patterns — STOP
|
|
88
|
-
|
|
89
|
-
- **"Improve performance"** — not atomic. Pick one metric, one bottleneck, one change.
|
|
90
|
-
- **"Refactor the X module"** — not atomic. Pick one structural change with one behaviour-equivalence proof.
|
|
91
|
-
- **"Add error handling"** — not atomic. Pick one error case, one handler, one test.
|
|
92
|
-
- **"Wire up the Y feature"** — not atomic. Decompose into the components, the data flow, and the integration.
|
|
93
|
-
- **"And also fix the related bug while I'm there"** — that's a different atomic unit. Different commit.
|
|
94
|
-
|
|
95
|
-
## Relationship to TDD
|
|
96
|
-
|
|
97
|
-
Atomicity and TDD reinforce each other:
|
|
98
|
-
- TDD's RED phase forces you to name the proving test (Question 3) before building
|
|
99
|
-
- Atomic units fit naturally inside one RED → GREEN → REFACTOR cycle
|
|
100
|
-
- A test that requires changes in multiple unrelated files means the unit is not atomic
|
|
101
|
-
|
|
102
|
-
## Relationship to /atomic-commit
|
|
103
|
-
|
|
104
|
-
`/atomic-commit` is this skill applied to the git history: each commit is one atomic unit. The questions are the same; the artifact is a commit instead of a plan task.
|
|
105
|
-
|
|
106
|
-
## Relationship to subagent dispatch
|
|
107
|
-
|
|
108
|
-
Subagents work best on atomic units. When dispatching:
|
|
109
|
-
- Each subagent task should answer the three questions inside its prompt
|
|
110
|
-
- Parallel dispatch is only safe when units are genuinely independent (Question 2)
|
|
111
|
-
- A subagent returning `STATUS: BLOCKED — complexity` often means the unit wasn't atomic — split it.
|
|
112
|
-
|
|
113
|
-
## Output
|
|
114
|
-
|
|
115
|
-
This skill produces *thought*, not files. The artifact is a clearer plan / commit / fix scope before any code is written.
|
|
16
|
+
A commit should express one coherent change when commits are authorized. Testing and decomposition do not independently authorize commits. The `red:`, `green:`, and `refactor:` conventions apply when recording TDD phases.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: blast-radius
|
|
3
|
-
description:
|
|
3
|
+
description: Find what a change could break beyond the diff and prove the one fact its safety rests on by running real code — use when asked what a change could break, or before shipping one you distrust. Not the uncertainty × blast-radius ordering heuristic in planning commands.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Blast Radius
|
|
@@ -1,138 +1,20 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: brainstorming
|
|
3
|
-
description:
|
|
3
|
+
description: Explore a project idea, compare approaches, and resolve unclear goals or scope when the user asks to brainstorm or design.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Brainstorming
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Help the user choose an approach that serves their goal. Brainstorming is optional; it is not a prerequisite for coding, planning, or project initialization.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
Read the relevant project context before asking for facts available in the repository. Use an existing codebase map for focused questions when helpful; do not generate a full map just to start a discussion.
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
Clarify only decisions that materially change the outcome: intended users, observable success, constraints, scope, and significant risks. Group related questions, offer a recommendation where useful, and distinguish confirmed decisions from assumptions. Do not require a fixed number of questions, alternatives, or approval rounds. A clear request can already supply enough direction.
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
Compare plausible approaches when there is a real trade-off. Explain the consequences in concrete terms. Present a coherent design at a level of detail appropriate to the task, including unresolved decisions and how success will be checked.
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
2. When the user names a solution, ask what it solves before refining it. Solutions stay candidates until the need is confirmed.
|
|
18
|
-
3. State the need back in one sentence ("so the real problem is X — right?") and get an explicit yes before proposing any approach.
|
|
16
|
+
If the user asks to proceed, continue with the authorized work and state necessary assumptions. Ask for clarification only when a missing decision prevents useful work or the next action requires authorization that is not already present.
|
|
19
17
|
|
|
20
|
-
|
|
18
|
+
The result can be a concise recommendation in chat. Write a design document when requested or useful for substantial work, using the project's established location. Separate proposals from accepted decisions. Use `.planning/specs/` and hand off to GSD commands only when the user selected that workflow.
|
|
21
19
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
> Do NOT invoke any planning skill, write any code, scaffold any project, or take any implementation action until you have:
|
|
25
|
-
> 1. Worked the question frontier in rounds until it was empty
|
|
26
|
-
> 2. Proposed 2–3 approaches with trade-offs
|
|
27
|
-
> 3. Presented a structured design and the user has approved it
|
|
28
|
-
> 4. Written the design to `.planning/specs/YYYY-MM-DD-<slug>-design.md`
|
|
29
|
-
|
|
30
|
-
If the user pushes to skip ("just build it"), surface the trade-off: "I can scaffold something now, but skipping brainstorming usually means we throw out the first version. Are you sure?" If yes, proceed but make the assumption explicit in the spec.
|
|
31
|
-
|
|
32
|
-
## The Process
|
|
33
|
-
|
|
34
|
-
### 1. Explore Context
|
|
35
|
-
|
|
36
|
-
Before asking anything, read what's already on disk:
|
|
37
|
-
- `git log --oneline -30` — what has the user been working on recently?
|
|
38
|
-
- `ls -la` — what's in the project root?
|
|
39
|
-
- `.planning/` if it exists — is there an active project?
|
|
40
|
-
- `README.md`, `package.json`, any `*.md` in root — what does this codebase claim to do?
|
|
41
|
-
|
|
42
|
-
If an existing codebase is in play (extending a real project), run `draht-tools map-codebase` + `draht-tools graph-hotspots` first to ground ideation in the real structure — so brainstormed ideas don't contradict existing architecture.
|
|
43
|
-
|
|
44
|
-
Use this to ground questions in reality instead of asking things the user has already told you.
|
|
45
|
-
|
|
46
|
-
### 2. Question in Rounds — Ask the Whole Frontier
|
|
47
|
-
|
|
48
|
-
Most failed projects come from rushing past ambiguity. Map the open decisions as a design tree — every decision branches into the decisions that hang off it. The **frontier** is every question whose prerequisites are already settled. Each round, ask the WHOLE frontier in one message: numbered, foundational → detailed, each question with a *Recommended:* answer line so the user can accept by number ("1 yes, 2: B, 3 later"). A question accepted by number or answered explicitly is **decided**; a recommendation acted on without confirmation is **assumed** and stays flagged. Questions that depend on still-open answers wait for a later round. Environment facts (files, git history, code structure) are your job, never the user's — dispatch a subagent non-blockingly; only the questions downstream of it wait.
|
|
49
|
-
|
|
50
|
-
Question categories (sequence from foundational → detailed):
|
|
51
|
-
- **Goal** — who is this for? what changes for them when it ships?
|
|
52
|
-
- **Constraints** — deadline? budget? team size? language/stack preferences?
|
|
53
|
-
- **Scope** — what's in v1? what's explicitly NOT in v1?
|
|
54
|
-
- **Success criteria** — how do we know it works? what's the demoable outcome?
|
|
55
|
-
- **Domain** — what are the key nouns and verbs in this space? any existing glossary?
|
|
56
|
-
- **Risks** — what's the scariest part of this? what would make it fail?
|
|
57
|
-
|
|
58
|
-
If the project is obviously oversized for one cycle (e.g., "I want to build a social network"), flag it explicitly and propose decomposition into a v1 / v2 / out-of-scope split.
|
|
59
|
-
|
|
60
|
-
### 3. Propose 2–3 Approaches With Trade-offs
|
|
61
|
-
|
|
62
|
-
Once you have enough context, propose multiple approaches:
|
|
63
|
-
- Approach A: the simplest path. What it sacrifices.
|
|
64
|
-
- Approach B: the most flexible. What it costs.
|
|
65
|
-
- (Optional) Approach C: the most ambitious. Why it's tempting and why it might be too much.
|
|
66
|
-
|
|
67
|
-
For each: list trade-offs in plain language (time, complexity, future flexibility, lock-in). Let the user pick — don't pre-pick for them.
|
|
68
|
-
|
|
69
|
-
### 4. Present the Design in Sections, Each With an Approval Gate
|
|
70
|
-
|
|
71
|
-
Once an approach is chosen, present the design **section by section**, not all at once:
|
|
72
|
-
1. Goal & non-goals
|
|
73
|
-
2. User stories / observable truths
|
|
74
|
-
3. Domain model (bounded contexts, key nouns)
|
|
75
|
-
4. Architecture sketch (components, data flow)
|
|
76
|
-
5. v1 scope (what ships) vs v2/out-of-scope (what doesn't)
|
|
77
|
-
6. Open questions / risks
|
|
78
|
-
|
|
79
|
-
After each section, ask: "Does this match what you want, or should we adjust?" Only move to the next section once the current one is approved.
|
|
80
|
-
|
|
81
|
-
### 5. Write the Spec to `.planning/specs/`
|
|
82
|
-
|
|
83
|
-
Once all sections are approved:
|
|
84
|
-
|
|
85
|
-
```
|
|
86
|
-
.planning/specs/YYYY-MM-DD-<topic-slug>-design.md
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
Write spec prose through the `unslop` skill — name mechanisms, not feelings; the spec structure below stays as specified.
|
|
90
|
-
|
|
91
|
-
The file should include:
|
|
92
|
-
- Header with date and approver
|
|
93
|
-
- All approved sections
|
|
94
|
-
- Open questions section (the things you flagged but didn't resolve)
|
|
95
|
-
- Next step: which draht command picks this up (`/new-project` or `/init-project`)
|
|
96
|
-
|
|
97
|
-
### 6. Self-Review the Written Spec
|
|
98
|
-
|
|
99
|
-
Before handing off, attack the spec as if you were paid to kill it:
|
|
100
|
-
- Contradictions between sections (the goal says X, the architecture implies not-X)
|
|
101
|
-
- Gaps (a user story with no architectural support)
|
|
102
|
-
- Premature commitments (specific tech choices made before they were needed)
|
|
103
|
-
- Domain language drift (different names for the same thing)
|
|
104
|
-
- The strongest case the whole design is wrong — wrong scope, wrong user, or already solved by a simpler existing tool. Write that case and why the design survives it into the spec's Open Questions.
|
|
105
|
-
|
|
106
|
-
Report any findings to the user and update before proceeding. A spec that was never attacked has never been tested.
|
|
107
|
-
|
|
108
|
-
### 7. Hand Off
|
|
109
|
-
|
|
110
|
-
Direct the user to the next command:
|
|
111
|
-
- Greenfield with no codebase → `/new-project`
|
|
112
|
-
- Existing codebase → `/init-project`
|
|
113
|
-
|
|
114
|
-
The spec file becomes input to those commands.
|
|
115
|
-
|
|
116
|
-
## Anti-Patterns — STOP
|
|
117
|
-
|
|
118
|
-
- **Dribbling questions one at a time** — a serial interview hides the decision tree and wastes rounds; ask the whole frontier, numbered, with recommended answers
|
|
119
|
-
- **Asking the user for facts you can look up** — filesystem, git history, and code structure are your job; dispatch a subagent and keep the round moving
|
|
120
|
-
- **Pre-deciding before they've answered** — "I'll just assume you mean X" is a failure mode
|
|
121
|
-
- **Skipping the alternatives** — proposing only one approach hides the trade-space
|
|
122
|
-
- **Writing the spec before approval** — the spec records *decisions*, not *proposals*. Get the decision first.
|
|
123
|
-
- **Brainstorming code** — this skill is for the design, not the implementation. Resist the urge to start writing.
|
|
124
|
-
|
|
125
|
-
## Rationalization Table
|
|
126
|
-
|
|
127
|
-
| Excuse | Reality |
|
|
128
|
-
|--------|---------|
|
|
129
|
-
| "It's a simple project, no need to brainstorm" | Simple projects also have ambiguous scope. The skill is fast for simple ones. |
|
|
130
|
-
| "User said 'just build it'" | They'll be unhappier when the wrong thing gets built. Surface the trade-off. |
|
|
131
|
-
| "I already know what they want" | Verify by stating it back and getting confirmation. |
|
|
132
|
-
| "Let's iterate after a first draft" | A first draft in code is more expensive to throw away than a first draft on paper. |
|
|
133
|
-
| "Ten questions at once will overwhelm them" | Numbered questions with recommended answers are skimmable — the user replies "1 yes, 2: B, 3 later". Serial questioning is the slower burden. |
|
|
134
|
-
| "I'll just ask what's in the repo" | Finding facts is your job, never the user's. Dispatch a subagent. |
|
|
135
|
-
|
|
136
|
-
## Output
|
|
137
|
-
|
|
138
|
-
Brainstorming ends with a written spec file in `.planning/specs/`. That file is the artifact. If no file is written, the skill did not complete.
|
|
20
|
+
Use `grill` for a requested adversarial review of an idea or decision; it is not a mandatory next step.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: create-verification-skill
|
|
3
|
-
description:
|
|
3
|
+
description: Create a project-local skill that drives an application and captures verification evidence when the user requests one.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Draht Command: create-verification-skill
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: Generate a
|
|
2
|
+
description: Generate a project-local verify-<app> skill that drives the real app the way a user does and captures proof artifacts — proven end to end once before handover
|
|
3
3
|
argument-hint: "[app or surface]"
|
|
4
4
|
allowed-tools: Bash, Read, Write, Edit
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# /create-verification-skill
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Create a project-local `.draht/skills/verify-<app>/` skill that launches the real application, exercises user-visible behavior, and captures reusable evidence.
|
|
10
10
|
|
|
11
11
|
Target: $ARGUMENTS (optional — when empty, the interview below picks the primary user-facing surface)
|
|
12
12
|
|
|
@@ -20,11 +20,11 @@ Answer these from the codebase and only ask the user what you cannot observe:
|
|
|
20
20
|
|
|
21
21
|
- **Surface:** what does a user actually touch? A web UI, a CLI/TUI, a desktop app, an API, a mobile app, a library? A repo can have several; pick the primary one and note the rest.
|
|
22
22
|
- **Run:** how does the app start locally? Prefer the repo's own documented dev command (package scripts, Makefile, README quickstart). Note ports, env vars, seed data, auth.
|
|
23
|
-
- **Drive:** how can an agent interact with it programmatically? Existing harnesses first — Playwright/Cypress specs, expect scripts, PTY helpers, curl-able endpoints, a debug port. Only then pick a generic recipe: a browser debug port (CDP) for web and Electron, a tmux/PTY harness for CLI and TUI, plain HTTP for services.
|
|
23
|
+
- **Drive:** how can an agent interact with it programmatically? Existing harnesses first — Playwright/Cypress specs, expect scripts, PTY helpers, curl-able endpoints, a debug port. Only then pick a generic recipe: a browser debug port (CDP) for web and Electron, a tmux/PTY harness for CLI and TUI, plain HTTP for services. Use the host's supported automation tools or a repository harness; include a shell-based fallback only when needed. Respect repository command restrictions.
|
|
24
24
|
- **Observe:** what evidence can be captured? Screenshots, terminal transcripts, response bodies, logs, exit codes, DB state.
|
|
25
25
|
- **Isolate:** can two instances run side by side (ports, data dirs, profiles)? If not, say so in the generated skill: refusing to double-drive a shared instance beats corrupting the user's session.
|
|
26
26
|
|
|
27
|
-
If the checkout doesn't build or start as-is,
|
|
27
|
+
If the checkout doesn't build or start as-is, resolve in-scope prerequisites or report the blocker precisely before claiming the skill verified; a skill written against a broken base teaches wrong steps. When an irrelevant missing asset blocks startup (a static dir the API never serves, a sample config), the generated skill may create it, clearly marked as verification scaffolding, and remove it in cleanup.
|
|
28
28
|
|
|
29
29
|
### 2 — Generate the skill
|
|
30
30
|
|
|
@@ -41,7 +41,7 @@ Frontmatter is `name: verify-<app>` plus a `description` that names the app, the
|
|
|
41
41
|
|
|
42
42
|
### 3 — Seed the feature map
|
|
43
43
|
|
|
44
|
-
Create a `features/` directory inside the generated skill dir, holding `features/README.md` plus one file per user-facing feature you can identify (
|
|
44
|
+
Create a `features/` directory inside the generated skill dir, holding `features/README.md` plus one file per user-facing feature you can identify (start with the relevant user paths identified from routes, commands, menus, or docs). The README carries the baseline preconditions (launch target, disposable data location, seed data, the Doctor requirement), the driving conventions (stable handles over positions, commands taken literally, restore mutated fixtures, never remove proof artifacts), the proof and skip-reporting rules (record the feature ID and entry point with every artifact; report an unreachable path with the attempted command and the unmet precondition; never report a skipped entry point as verified through a different path), and an index linking every feature file.
|
|
45
45
|
|
|
46
46
|
Each feature file starts with an H1 title and one paragraph of user-visible behaviour, then exactly four H2 sections in this order:
|
|
47
47
|
|
|
@@ -50,56 +50,16 @@ Each feature file starts with an H1 title and one paragraph of user-visible beha
|
|
|
50
50
|
3. `Driving it with <harness>` — starts with `Preconditions:`, then labelled bullets pairing each user action with an exact command and its observable result.
|
|
51
51
|
4. `Gotchas` — traps that can waste or invalidate a verification run.
|
|
52
52
|
|
|
53
|
-
Keep implementation details out of the map: name only user paths, stable handles, required state, commands, and observable proof.
|
|
54
|
-
|
|
55
|
-
```markdown
|
|
56
|
-
# Create a note
|
|
57
|
-
|
|
58
|
-
Create note lets a user save a titled note and confirm it from a second view.
|
|
59
|
-
|
|
60
|
-
## Sub-features
|
|
61
|
-
|
|
62
|
-
- `create-save` persists a title and body.
|
|
63
|
-
|
|
64
|
-
## How to get to it (user POV)
|
|
65
|
-
|
|
66
|
-
- Choose the `New note` button in the browser toolbar.
|
|
67
|
-
|
|
68
|
-
## Driving it with the CDP harness
|
|
69
|
-
|
|
70
|
-
Preconditions:
|
|
71
|
-
|
|
72
|
-
- Notes is healthy at `http://127.0.0.1:4173` and no note is titled `Release checklist`.
|
|
73
|
-
|
|
74
|
-
- **Open editor.** Choose `New note`. Click the button with accessible name `New note`. A form named `Note editor` appears.
|
|
75
|
-
- **Save note.** Fill `Title` with `Release checklist`, choose `Save note`. A status named `Note saved` appears.
|
|
76
|
-
- **Proof.** Reopen the note from `All notes`; screenshot to `artifacts/create-note/list.png`. The list shows `Release checklist`.
|
|
77
|
-
|
|
78
|
-
## Gotchas
|
|
79
|
-
|
|
80
|
-
- A save status alone is insufficient proof. Reopen the note from the list.
|
|
81
|
-
```
|
|
82
|
-
|
|
53
|
+
Keep implementation details out of the map: name only user paths, stable handles, required state, commands, and observable proof.
|
|
83
54
|
The map is the repo's maintained verification source; a proof that drives one convenient entry point is incomplete when the map lists others.
|
|
84
55
|
|
|
85
56
|
### 4 — Prove the generated skill before handing it over
|
|
86
57
|
|
|
87
58
|
Run its own instructions end to end once: launch, doctor, drive ONE mapped feature (one is enough — the map exists so later runs can cover the rest), capture evidence, clean up. After cleanup, confirm the evidence still exists at the named location — a cleanup that eats the proof fails this step. Fix what fails, and run the generated cleanup after every failed iteration too, so broken attempts don't strand processes and ports. A generated skill that was never executed is a draft, not a deliverable.
|
|
88
59
|
|
|
89
|
-
### 5 —
|
|
60
|
+
### 5 — Hand over
|
|
90
61
|
|
|
91
|
-
|
|
62
|
+
Keep the skill, feature map, and helpers with the application. Commit only when authorized. Report the verified feature and evidence location, plus these maintenance notes:
|
|
92
63
|
|
|
93
64
|
- `/verify-work` picks it up: when a `verify-<app>` skill exists, the phase verifier drives one mapped feature and captures its evidence instead of stopping at the test suite.
|
|
94
65
|
- The map stays honest only if it changes with the app: a change that adds or reshapes a user-facing feature updates the matching feature file in the same change. A map entry the app has outgrown is worse than none — it teaches wrong steps with confidence.
|
|
95
|
-
|
|
96
|
-
## Failure Modes — STOP
|
|
97
|
-
|
|
98
|
-
Stop immediately if you catch yourself:
|
|
99
|
-
|
|
100
|
-
- Writing recipes against an app you never started — generate from observed behaviour, not from reading the code
|
|
101
|
-
- Trusting a dry-run or test mode by its name instead of observing what it actually skips
|
|
102
|
-
- Proving a feature through a test-only endpoint or internal setter instead of the real user path
|
|
103
|
-
- Driving an instance this run did not start
|
|
104
|
-
- Writing a cleanup that deletes the proof artifacts
|
|
105
|
-
- Handing over a skill whose own instructions were never executed end to end
|