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
|
@@ -1,111 +1,18 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ddd-workflow
|
|
3
|
-
description:
|
|
3
|
+
description: Model domain concepts, invariants, and context boundaries when the user requests domain design or a project already uses domain-driven design.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
# Domain Design
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Start with the project's language and actual consistency requirements. Domain-driven design is an optional modeling approach, not a prerequisite for ordinary edits or naming a variable.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
Identify concepts that have distinct rules or ownership, the operations that must be atomic, and the interfaces between them. Use established terms consistently. Prefer the simplest model that enforces the required invariants; do not introduce aggregates, events, repositories, or adapters without a concrete need.
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
## Bounded Contexts
|
|
14
|
-
- **Billing** — everything about invoices, payments, subscriptions
|
|
15
|
-
- **Catalog** — products, pricing, availability
|
|
16
|
-
- **Fulfillment** — order processing, shipping, returns
|
|
12
|
+
Use the existing domain document when present. `.planning/DOMAIN.md` is GSD's convention, not a required global source of truth. Record meaningful changes to the model alongside implementation in the project's established documentation.
|
|
17
13
|
|
|
18
|
-
|
|
19
|
-
- **Invoice** — a document requesting payment for delivered goods or services
|
|
20
|
-
- **Order** — a customer's request to purchase goods, before fulfillment
|
|
21
|
-
- **Line Item** — a single row on an invoice or order
|
|
22
|
-
- **SKU** — a unique identifier for a product variant in the catalog
|
|
14
|
+
For context boundaries, make ownership and coupling explicit. Direct calls, events, and adapters each have trade-offs; choose according to consistency, latency, failure handling, and dependency direction. A cross-directory import alone does not prove a boundary violation.
|
|
23
15
|
|
|
24
|
-
|
|
25
|
-
- Billing ← Catalog (downstream — billing reads product info)
|
|
26
|
-
- Fulfillment ← Billing (downstream — fulfillment needs invoice status)
|
|
27
|
-
- Shared kernel: Money, TaxRate (used by Billing and Fulfillment)
|
|
16
|
+
For existing code, use `draht-tools graph-clusters` and `graph-context` to find candidate groupings when a map is available. Import clusters are structural evidence; validate their domain meaning against code, docs, and requirements. Do not reorganize a working codebase solely to match graph clusters or a textbook layout.
|
|
28
17
|
|
|
29
|
-
|
|
30
|
-
### Billing
|
|
31
|
-
- Invoice (root) — LineItem, Payment
|
|
32
|
-
- Subscription (root) — BillingCycle
|
|
33
|
-
|
|
34
|
-
### Catalog
|
|
35
|
-
- Product (root) — Variant, Price
|
|
36
|
-
|
|
37
|
-
## Domain Events
|
|
38
|
-
- `InvoiceIssued` — Billing → Fulfillment, Notification
|
|
39
|
-
- `PaymentReceived` — Billing → Notification
|
|
40
|
-
- `OrderShipped` — Fulfillment → Notification, Customer
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
## The Five Rules
|
|
44
|
-
|
|
45
|
-
### 1. Bounded contexts shape the code
|
|
46
|
-
- File/module structure mirrors bounded contexts: `src/billing/`, `src/catalog/`, `src/fulfillment/`
|
|
47
|
-
- Each context owns its aggregates, value objects, services, and domain events
|
|
48
|
-
- Cross-context imports are suspicious — prefer domain events or ACL adapters
|
|
49
|
-
|
|
50
|
-
### 2. Code uses the ubiquitous language
|
|
51
|
-
- Class names, method names, variable names must match the glossary
|
|
52
|
-
- If you need a new term, update `DOMAIN.md` **first**, then write the code
|
|
53
|
-
- Never invent terms in code that aren't in the glossary
|
|
54
|
-
|
|
55
|
-
### 3. Aggregates enforce invariants
|
|
56
|
-
- Each aggregate has one root entity
|
|
57
|
-
- All writes go through the root — never modify child entities directly from outside
|
|
58
|
-
- Aggregate boundaries align with transaction boundaries
|
|
59
|
-
- Aggregates reference each other by ID, not by reference
|
|
60
|
-
|
|
61
|
-
### 4. Domain events cross context boundaries
|
|
62
|
-
- Upstream context publishes an event (`InvoiceIssued`)
|
|
63
|
-
- Downstream contexts subscribe and react (Notification sends email, Fulfillment releases order)
|
|
64
|
-
- No direct function call from Billing into Fulfillment — always via event
|
|
65
|
-
|
|
66
|
-
### 5. Shared kernel is explicit
|
|
67
|
-
- If two contexts must share a type (e.g. `Money`, `TaxRate`), put it in `src/shared/` and document it in the Context Map
|
|
68
|
-
- Shared kernel changes are high-cost — they affect multiple contexts
|
|
69
|
-
- Prefer duplication over coupling when in doubt
|
|
70
|
-
|
|
71
|
-
## The Post-Phase Domain Health Check
|
|
72
|
-
|
|
73
|
-
The `gsd-post-phase.cjs` hook checks `DOMAIN.md` after each phase:
|
|
74
|
-
- Is `## Bounded Contexts` section present?
|
|
75
|
-
- Is `## Ubiquitous Language` section present?
|
|
76
|
-
- Count of unique PascalCase terms (proxy for glossary size)
|
|
77
|
-
|
|
78
|
-
The `gsd-quality-gate.cjs` script also runs a domain validator that compares identifiers in code against the glossary and flags unknown terms.
|
|
79
|
-
|
|
80
|
-
Drift check: after each phase, run `draht-tools graph-clusters` and compare the map's clusters/contexts against `DOMAIN.md` — a new cluster or a cluster spanning two contexts means the code drifted from the model. Reconcile `DOMAIN.md` first, then the code.
|
|
81
|
-
|
|
82
|
-
## Extracting Domain from Existing Code
|
|
83
|
-
|
|
84
|
-
When running `/init-project` or `/map-codebase` on a codebase that wasn't built with DDD:
|
|
85
|
-
|
|
86
|
-
0. Surface CANDIDATE contexts from the map: `draht-tools graph-clusters` for code groupings + `draht-tools graph-context <dir>` to orient each. Clusters are STRUCTURAL (import topology), not semantic — confirm with a human before equating a cluster with a bounded context.
|
|
87
|
-
1. List top-level `src/` subdirectories — candidates for bounded contexts
|
|
88
|
-
2. Scan PascalCase class / interface / type names — seed from `modules[*].symbols` / GRAPH_REPORT.md instead of grepping — candidates for entities and value objects
|
|
89
|
-
3. Scan repeated nouns in function names — candidates for domain concepts
|
|
90
|
-
4. Look for cross-directory imports — candidates for context coupling to fix
|
|
91
|
-
5. Write `DOMAIN.md` with what you found + what should exist
|
|
92
|
-
6. Use subsequent phases to refactor toward the target model
|
|
93
|
-
|
|
94
|
-
## Anti-patterns
|
|
95
|
-
|
|
96
|
-
**Anemic domain model** — entities that are just data bags with no behaviour. Push logic into the entities.
|
|
97
|
-
|
|
98
|
-
**Scattered aggregates** — one aggregate's logic spread across multiple contexts. Consolidate or introduce an ACL.
|
|
99
|
-
|
|
100
|
-
**Terminology drift** — the same concept called different things in different files. Fix in `DOMAIN.md` first, rename code second.
|
|
101
|
-
|
|
102
|
-
**Shared database** — multiple contexts writing to the same tables without explicit shared-kernel agreement. Break the coupling.
|
|
103
|
-
|
|
104
|
-
**Direct cross-context imports** — `import { ... } from '../billing/...'` in `src/fulfillment/`. Use domain events or ACL adapters.
|
|
105
|
-
|
|
106
|
-
## When to Update DOMAIN.md
|
|
107
|
-
|
|
108
|
-
- Before writing code that introduces a new term → add it to the glossary first
|
|
109
|
-
- During `/discuss-phase` when gray areas reveal missing concepts
|
|
110
|
-
- After `/verify-work` when the reviewer agent flags domain language drift
|
|
111
|
-
- Whenever a refactor reveals that existing names don't match reality
|
|
18
|
+
Validate domain invariants with behavior tests and structural rules with project-defined checks. GSD's glossary/heading checks and import heuristics can reveal possible drift, but they do not prove domain correctness.
|
|
@@ -1,138 +1,28 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: debugging-workflow
|
|
3
|
-
description:
|
|
3
|
+
description: Investigate a software defect, test plausible causes, and verify a focused repair with regression evidence.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Debugging Workflow
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Start from the observed symptom and expected behavior. A reported cause is a hypothesis until supported by evidence. Respect the delegated scope: diagnosis-only work proposes a fix; read-only work makes no edits, including test or instrumentation edits.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
Read relevant code, logs, history, and configuration to understand the path and construct a reproduction. Use a repository's codebase graph before broad search when available. Source inspection and exploratory hypotheses can precede reproduction; label conclusions that have not been checked.
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
## Reproduce and isolate
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
Prefer a small repeatable command that asserts the reported symptom: a focused test, request, CLI fixture, captured-event replay, or browser interaction. For intermittent failures, record reproduction frequency and environmental conditions. If automation cannot reach the problem, document exact manual steps and the missing access or artifact.
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
A useful reproduction has a known invocation, observed output, and an assertion that fails on this defect. Lack of a reproduction limits confidence; it does not forbid further read-only investigation. Do not claim a confirmed repair without evidence that addresses the symptom.
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
Develop as many plausible hypotheses as the evidence warrants. For each unresolved cause, choose a discriminating observation or experiment. Test one meaningful variable at a time, record the result, and remove unsuccessful probes. Compare working examples when they expose a relevant difference; there is no fixed hypothesis count.
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
If evidence stops improving, revisit assumptions or report the missing information. Respect the caller's retry budget. Three failed attempts are a stopping bound when configured, not proof of an architectural defect.
|
|
21
21
|
|
|
22
|
-
##
|
|
22
|
+
## Repair and verify
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
- Failing tests
|
|
26
|
-
- Production errors
|
|
27
|
-
- Unexpected behaviour
|
|
28
|
-
- Performance regressions
|
|
29
|
-
- Build failures
|
|
30
|
-
- Integration issues
|
|
31
|
-
- "Why is X doing Y?"
|
|
24
|
+
When repair is authorized, add a regression test that fails for the observed reason before changing the implementation where a suitable test seam exists. Otherwise preserve the reproduction and explain the testing limitation. Apply the smallest complete fix and run the reproduction plus relevant regression and project-required checks.
|
|
32
25
|
|
|
33
|
-
|
|
26
|
+
Keep unrelated cleanup out of scope. Remove temporary instrumentation. Comment only non-obvious constraints or rationale. Record TDD phases with `red:`, `green:`, and `refactor:` when commits are authorized; debugging does not authorize committing or creating planning state.
|
|
34
27
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
1. **Read error messages carefully.** Don't skip past the trace — read line numbers and file paths. Stack traces often contain the exact answer.
|
|
38
|
-
2. **Build a reproduction loop.** This step is the phase — a tight pass/fail signal that goes red on *this* bug is what bisection, hypothesis-testing, and instrumentation all consume. Spend disproportionate effort here. Work down the ladder and take the first rung that reaches the bug:
|
|
39
|
-
- failing test at whatever seam reaches the bug (unit, integration, e2e)
|
|
40
|
-
- HTTP request script against a running dev server
|
|
41
|
-
- CLI invocation on a fixture input, output diffed against a known-good snapshot
|
|
42
|
-
- headless browser script asserting on DOM / console / network
|
|
43
|
-
- replay of a captured payload, trace, or event log through the code path in isolation
|
|
44
|
-
- throwaway harness: a minimal subset of the system (mocked deps) exercising the bug path in one call
|
|
45
|
-
- property/fuzz loop: hundreds of random inputs when the output is only sometimes wrong
|
|
46
|
-
- bisection harness: automate "checkout state X, run the check" so `git bisect run` can drive it
|
|
47
|
-
- differential loop: the same input through old vs new version (or two configs), outputs diffed
|
|
48
|
-
- last resort, human-in-the-loop: exact numbered steps for the user to run by hand, output pasted back
|
|
49
|
-
|
|
50
|
-
Flaky bugs: the goal is a HIGHER reproduction rate, not a clean repro — loop the trigger 100x, add stress, narrow timing windows until it fails often enough to debug against.
|
|
51
|
-
|
|
52
|
-
**Exit checklist — all four before steps 4-6:** (a) ONE named command; (b) already run at least once; (c) invocation and output shown (secrets redacted); (d) it asserts the exact reported symptom — able to go red on this bug and green once fixed, not merely "runs without erroring".
|
|
53
|
-
|
|
54
|
-
**Self-interrupt:** reading code to build a causal theory before this command exists is the anchoring failure this protocol prevents. No red-capable command, no steps 4-6.
|
|
55
|
-
|
|
56
|
-
**If you genuinely cannot build a loop:** stop and say so — list what you tried, then ask for environment access, a captured artifact (log dump, recording, saved payload), or permission to add temporary instrumentation. Do not hypothesise without a loop.
|
|
57
|
-
3. **Check recent changes.** `git log --oneline -20`, `git diff HEAD~N` on the affected paths. What was the last thing that touched this?
|
|
58
|
-
4. **Trace data flow.** Where does the bad value originate? What called the function with that value? Keep tracing **upward** until you find the source. Fix at source, not at the symptom site.
|
|
59
|
-
5. **State the root cause in one sentence:** "X happens because Y at <file:line>."
|
|
60
|
-
6. **Label each step** observed (you ran it and saw it), derived (follows necessarily from evidence), or assumed (unchecked — name what would check it). A root cause resting on an assumption is a hypothesis, not a diagnosis.
|
|
61
|
-
|
|
62
|
-
If you cannot state the root cause clearly, you do not understand the bug yet. Do not proceed.
|
|
63
|
-
|
|
64
|
-
## Phase 1.5 — Orient on the failing file
|
|
65
|
-
|
|
66
|
-
Before walking the tree, orient via the living map. Run `draht-tools graph-context <failing-file>` for pkg/layer/cluster/importers/imports/sinks and `draht-tools graph-callers <failing-file>` to see who feeds bad values in (supports the "trace UPWARD" step above). If `.planning/codebase/MAP.json` is absent, run `draht-tools map-graph` first.
|
|
67
|
-
|
|
68
|
-
## Phase 2 — Pattern Analysis
|
|
69
|
-
|
|
70
|
-
1. **Find working examples.** Use `draht-tools graph-query "<concept>"` instead of grep to locate reference implementations in this repo that do the same kind of thing correctly.
|
|
71
|
-
2. **Read references completely.** Not skimmed — read every line of the working version.
|
|
72
|
-
3. **List every difference** between working and broken, however small.
|
|
73
|
-
4. **Note dependencies.** What config / env / call-order does the working version assume?
|
|
74
|
-
|
|
75
|
-
If Phase 2 contradicts Phase 1, go back to Phase 1. Don't paper over disagreement.
|
|
76
|
-
|
|
77
|
-
## Phase 3 — Ranked Hypotheses
|
|
78
|
-
|
|
79
|
-
1. Generate **3-5 ranked falsifiable hypotheses** before testing any of them. A single hypothesis anchors you to the first plausible idea — ranking forces the alternatives into view.
|
|
80
|
-
2. Each hypothesis must state its prediction: "If X is the cause, then changing Y will make the bug disappear / changing Z will make it worse." If you cannot state the prediction, it is a vibe — discard it or sharpen it.
|
|
81
|
-
3. If the user named a cause, it is **Hypothesis #0** and enters the ranking with the others — ranked on evidence, not privileged for being first.
|
|
82
|
-
4. Show the ranked list to the user before testing. Domain knowledge re-ranks instantly ("we just deployed a change to #3") and rules hypotheses out for free. Do not block waiting for a reply — proceed in ranked order if none comes.
|
|
83
|
-
5. Test in rank order, one hypothesis at a time. Design the **smallest possible change** that would prove or falsify the prediction — one variable, one line if possible. Before applying, run `draht-tools graph-impact <file-to-change>` to scope the blast radius (reverse-dependents, affected entry points, crossed boundaries) and avoid regressions. Re-run the Phase 1 reproduction command to read the verdict.
|
|
84
|
-
- **Prediction confirmed** → proceed to Phase 4 with this cause.
|
|
85
|
-
- **Falsified** → revert the probe, record which prediction failed, move to the next hypothesis. Do not pile changes on top.
|
|
86
|
-
6. When a probe needs logging, prefer one debugger/REPL inspection over ten log lines; if you must log, tag every line with one unique session prefix, e.g. `[DEBUG-a4f2]`, and never "log everything and grep".
|
|
87
|
-
7. **After 3 falsified hypotheses, STOP.** This is an architectural problem, not a ranking problem. Discuss before continuing.
|
|
88
|
-
|
|
89
|
-
## Phase 4 — Implementation
|
|
90
|
-
|
|
91
|
-
1. **Write the reproducing test FIRST.** Seed it from the Phase 1 reproduction command — the loop that already goes red is the test's skeleton; port its scenario and its symptom assertion to the right test seam. Confirm it FAILS for the right reason (not syntax, not missing import).
|
|
92
|
-
- Commit: `red: reproduce <bug>`
|
|
93
|
-
2. **Apply the single fix** from Phase 3. No other changes.
|
|
94
|
-
- Failing test now PASSES.
|
|
95
|
-
- Full test suite — no regressions.
|
|
96
|
-
- Commit: `green: fix <bug>`
|
|
97
|
-
3. **Refactor (optional)** — only if clear improvement. Tests stay green.
|
|
98
|
-
- Commit: `refactor: <description>`
|
|
99
|
-
4. **Verify the original symptom is gone** — run the user-level reproduction, not just the unit test.
|
|
100
|
-
5. **Sweep instrumentation.** Grep your `[DEBUG-` prefix — done means the grep returns nothing. Tagged probes die here; untagged probes survive to pollute production.
|
|
101
|
-
|
|
102
|
-
## Red Flags — STOP
|
|
103
|
-
|
|
104
|
-
Stop immediately if you catch yourself:
|
|
105
|
-
- "Quick fix for now, investigate later"
|
|
106
|
-
- Multiple changes simultaneously
|
|
107
|
-
- Skipping the reproducing test
|
|
108
|
-
- Proposing solutions before understanding data flow
|
|
109
|
-
- Reading code to build a causal theory before a red-capable reproduction command exists
|
|
110
|
-
- "One more attempt" after 2+ failures
|
|
111
|
-
- Each fix revealing new problems elsewhere
|
|
112
|
-
- Proposing solutions before you can state the root cause in one sentence
|
|
113
|
-
|
|
114
|
-
## Rationalization Table
|
|
115
|
-
|
|
116
|
-
| Excuse | Reality |
|
|
117
|
-
|--------|---------|
|
|
118
|
-
| "Simple bug, skip the process" | Simple bugs have root causes too. The process is fast for them. |
|
|
119
|
-
| "Emergency, no time for process" | Systematic debugging is *faster* than thrashing. |
|
|
120
|
-
| "I'll write the test after I confirm the fix" | Untested fixes don't stick. Test-first proves the bug existed. |
|
|
121
|
-
| "Let me try a few things" | Can't isolate what worked. Creates new bugs. |
|
|
122
|
-
| "I already manually tested it" | A reproducing test is the only durable proof. |
|
|
123
|
-
| "I can see what's wrong, I don't need Phase 1" | "See" is not "understand". Trace it. |
|
|
124
|
-
| "The user already told me the cause" | The reporter saw the symptom. Their diagnosis is Hypothesis #0, not a finding. |
|
|
125
|
-
| "The fix passed, so my diagnosis was right" | Fixes can mask. Verify the causal chain, not just the symptom's absence. |
|
|
126
|
-
| "I can't build a repro, I'll reason it out" | No red-capable command, no diagnosis. Ask for access, an artifact, or permission to instrument. |
|
|
127
|
-
|
|
128
|
-
## Relationship to /fix
|
|
129
|
-
|
|
130
|
-
This skill is the *protocol*. `/fix` is the *command* that runs it with subagent delegation, commit conventions, and state updates. Use the skill transversally; use `/fix` when you want the full workflow with tracking.
|
|
131
|
-
|
|
132
|
-
## Relationship to /why
|
|
133
|
-
|
|
134
|
-
This protocol answers "why is X doing the wrong thing right now" — a live defect with a reproduction loop. The `why` command answers "why is X built this way" — intent, history, and rejected alternatives reconstructed from git, the review record, and `.planning/`, with `epistemics`-calibrated confidence. If the investigation shows the surprising behaviour is a recorded decision, not a defect, stop debugging and route to `/why`; if a `/why` investigation surfaces a live defect, hand it to `/fix`.
|
|
135
|
-
|
|
136
|
-
## Relationship to verification-gate
|
|
137
|
-
|
|
138
|
-
After Phase 4, verification-gate kicks in: don't claim "bug fixed" without running the proving command and seeing the output.
|
|
28
|
+
Report the supported cause or leading hypothesis, changes made, checks and their outcomes, and remaining uncertainty. Use `verification-gate` for freshness and claim scope. Use `why` when the question is historical intent rather than current defective behavior.
|
|
@@ -12,27 +12,23 @@ Phase: $1
|
|
|
12
12
|
|
|
13
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>` via the Bash tool.
|
|
14
14
|
|
|
15
|
-
## Atomic Reasoning
|
|
16
|
-
|
|
17
|
-
Decompose the work into independently verifiable units before acting; the `atomic-reasoning` skill holds the full discipline — load it when the decomposition is not obvious.
|
|
18
|
-
|
|
19
15
|
## Steps
|
|
20
16
|
1. Run `draht-tools phase-info $1` to load phase context
|
|
21
17
|
2. Ground the discussion in current structure: run `draht-tools graph-context <area>` and `draht-tools graph-clusters` on the area being discussed, and cross-check discovered domain terms with `draht-tools graph-query <term>`.
|
|
22
18
|
3. Identify gray areas based on what's being built
|
|
23
|
-
4.
|
|
19
|
+
4. Ask about material unresolved decisions, grouping related questions and offering recommendations. Obtain repository facts directly; proceed with independent work while waiting.
|
|
24
20
|
5. If `.planning/DOMAIN.md` exists, load it and validate discovered terms against the glossary. Add any new domain terms found during discussion.
|
|
25
|
-
6. Record decisions with `draht-tools save-context $1` — label each entry **decided** (the user explicitly chose) or **assumed** (you inferred from context). An answer accepted by number counts as decided.
|
|
26
|
-
7.
|
|
21
|
+
6. Record decisions with `draht-tools save-context $1` — label each entry **decided** (the user explicitly chose) or **assumed** (you inferred from context). An answer accepted by number counts as decided. State material assumptions and clarify those that would change scope or correctness.
|
|
22
|
+
7. If committing is authorized: `draht-tools commit-docs "capture phase $1 context"`
|
|
27
23
|
|
|
28
24
|
## Workflow
|
|
29
|
-
This is one step in the per-phase cycle.
|
|
25
|
+
This is one step in the per-phase cycle. Start a fresh session when context limits make it useful:
|
|
30
26
|
|
|
31
27
|
```
|
|
32
28
|
/discuss-phase N → /plan-phase N → /execute-phase N → /verify-work N → /discuss-phase N+1 → ...
|
|
33
29
|
```
|
|
34
30
|
|
|
35
|
-
After completing this command,
|
|
31
|
+
After completing this command, identify `/plan-phase $1` as the next step. Do NOT suggest `/next-milestone` — that is only after ALL phases in the milestone are verified.
|
|
36
32
|
|
|
37
33
|
## Gray Area Categories
|
|
38
34
|
- **Visual features** → Layout, density, interactions, empty states
|
package/skills/draht/SKILL.md
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: draht
|
|
3
|
-
description: Router and catalog for
|
|
3
|
+
description: Router and catalog for Draht coding, verification, review, and optional project workflows. Use when the user asks what Draht is, which skill to select, how to invoke it, or how to install or upgrade the bundle.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Draht
|
|
7
7
|
|
|
8
|
-
Draht
|
|
8
|
+
Draht provides coding tools, specialist agents, and verification workflows. Start from the user's task: inspect the code, choose a suitable approach, make the change, and run the relevant checks. Models can structure ordinary work without a prescribed planning ceremony. Load a skill when its specific capability helps or the user requests it.
|
|
9
|
+
|
|
10
|
+
GSD milestone → phase → plan → task tracking is optional. Use it only when the user chooses that project-management workflow; ordinary coding does not require `.planning/`, XML plans, roadmap updates, or session resets. Existing planning documents may supply relevant context without making their lifecycle the active task. The codebase graph and deterministic checks are useful independently of GSD.
|
|
11
|
+
|
|
12
|
+
This catalog routes to sibling skills; it does not activate them all.
|
|
9
13
|
|
|
10
14
|
## Two Kinds of Sibling Skills
|
|
11
15
|
|
|
12
|
-
- **16
|
|
13
|
-
- **23 command skills** —
|
|
16
|
+
- **16 support skills** — load the relevant discipline or explicitly chosen workflow: `atomic-reasoning`, `blast-radius`, `brainstorming`, `ddd-workflow`, `debugging-workflow`, `epistemics`, `explainers`, `gsd-workflow`, `judge`, `loop-workflow`, `model-tiering`, `saga-spawner`, `tdd-workflow`, `typescript-discipline`, `unslop`, `verification-gate`.
|
|
17
|
+
- **23 command skills** — explicit actions, including ad-hoc work and optional GSD lifecycle stages: `new-project`, `init-project`, `map-codebase`, `discuss-phase`, `plan-phase`, `execute-phase`, `verify-work`, `next-milestone`, `pause-work`, `resume-work`, `progress`, `quick`, `fix`, `review`, `atomic-commit`, `orchestrate`, `orchestrate-loop`, `resolve-conflicts`, `grill`, `why`, `create-verification-skill`, `triage`, `speak`.
|
|
14
18
|
|
|
15
19
|
Every skill's frontmatter `name` matches its directory name, so `skills/<name>/` and the name you invoke are always the same string.
|
|
16
20
|
|
|
@@ -18,20 +22,20 @@ Every skill's frontmatter `name` matches its directory name, so `skills/<name>/`
|
|
|
18
22
|
|
|
19
23
|
- `skills/<name>/SKILL.md` — every skill has one; frontmatter (`name`, `description`) plus instructions.
|
|
20
24
|
- `skills/<name>/command.md` — the 23 command skills only. This is the full prompt template; the command skill's `SKILL.md` is a thin wrapper that reads it.
|
|
21
|
-
- The 16
|
|
25
|
+
- The 16 support skills have no `command.md` — their `SKILL.md` is self-contained.
|
|
22
26
|
- This file, `skills/draht/SKILL.md`, is itself a plain skill (no `command.md`) — it is discovered and loaded the same way any discipline skill is.
|
|
23
27
|
|
|
24
28
|
## How the Catalog Composes
|
|
25
29
|
|
|
26
|
-
|
|
30
|
+
An explicitly selected command may use supporting disciplines; ordinary requests do not need a command workflow. `plan-phase` and `execute-phase` both assume `atomic-reasoning` and `tdd-workflow`; every command that ends with a completion claim assumes `verification-gate`; `fix` applies the `debugging-workflow` protocol; `orchestrate-loop` is `loop-workflow` applied to one goal; `why` leans on `epistemics` for every claim it reports; `triage` borrows `debugging-workflow`'s cause-first discipline for its bounded trace and `epistemics` for labeling what it carries into a ticket; `create-verification-skill` generates the project-local harness whose evidence `verification-gate` demands and `verify-work`'s verifier drives; `review`'s refutation step escalates to `blast-radius`'s rung-4 script when a Critical finding hinges on library or runtime behavior; `why`, `review`, `plan-phase`, `verify-work`, and `blast-radius` reach for `explainers` when their output is a graph. When in doubt about which disciplines a command skill pulls in, open that command skill's `command.md` — the disciplines it expects are named in its own text.
|
|
27
31
|
|
|
28
32
|
## Situation → Skill
|
|
29
33
|
|
|
30
|
-
###
|
|
34
|
+
### Optional project lifecycle and phase cycle
|
|
31
35
|
|
|
32
36
|
| Situation | Skill |
|
|
33
37
|
|---|---|
|
|
34
|
-
|
|
|
38
|
+
| User requests project brainstorming or help resolving goals and scope | `brainstorming` |
|
|
35
39
|
| Starting a greenfield project from questioning through roadmap | `new-project` |
|
|
36
40
|
| Bringing draht's GSD workflow onto an existing codebase | `init-project` |
|
|
37
41
|
| Standalone architecture / domain / test-strategy extraction | `map-codebase` |
|
|
@@ -49,7 +53,7 @@ Command skills and discipline skills are not independent choices — most comman
|
|
|
49
53
|
| Pausing work and writing a handoff document | `pause-work` |
|
|
50
54
|
| Resuming a paused project from its handoff document | `resume-work` |
|
|
51
55
|
| Checking current position in the roadmap | `progress` |
|
|
52
|
-
|
|
|
56
|
+
| Complete an ad-hoc task directly with relevant verification | `quick` |
|
|
53
57
|
| Diagnosing and fixing one specific bug end to end | `fix` |
|
|
54
58
|
| Code review and security audit of recent changes | `review` |
|
|
55
59
|
| Splitting a diff into atomic conventional commits | `atomic-commit` |
|
|
@@ -61,7 +65,7 @@ Command skills and discipline skills are not independent choices — most comman
|
|
|
61
65
|
| Generating a committed project-local `verify-<app>` skill that drives the real app as a user and captures proof artifacts | `create-verification-skill` |
|
|
62
66
|
| Classifying an external issue report — dedupe, file, reroute, or answer — without fixing it | `triage` |
|
|
63
67
|
|
|
64
|
-
###
|
|
68
|
+
### Supporting disciplines and optional workflows
|
|
65
69
|
|
|
66
70
|
| Situation | Skill |
|
|
67
71
|
|---|---|
|
|
@@ -84,8 +88,8 @@ Command skills and discipline skills are not independent choices — most comman
|
|
|
84
88
|
|
|
85
89
|
A few sibling pairs are easy to reach for incorrectly:
|
|
86
90
|
|
|
87
|
-
- `fix` vs `debugging-workflow` — `fix` is
|
|
88
|
-
- `quick` vs `execute-phase` — `quick`
|
|
91
|
+
- `fix` vs `debugging-workflow` — `fix` is an explicitly selected bug-fixing workflow with reproduction and retry limits; `debugging-workflow` supplies investigation discipline without requiring project tracking.
|
|
92
|
+
- `quick` vs `execute-phase` — `quick` completes an ad-hoc task without planning artifacts; `execute-phase` explicitly selects execution of existing phase plans and their review gates.
|
|
89
93
|
- `orchestrate` vs `orchestrate-loop` — `orchestrate` fans a task out to specialists once; `orchestrate-loop` re-runs one worker against a deterministic check until it passes or a bound is hit.
|
|
90
94
|
- `review` vs `verify-work` — `review` is ad hoc, any time; `verify-work` is the phase-level acceptance gate and additionally checks the diff against the phase's plan files.
|
|
91
95
|
- `grill` vs `brainstorming` — `brainstorming` is the project-creation gate: it ends in a written spec and a handoff to `/new-project` or `/init-project`; `grill` interrogates any subject with no presumed outcome — the artifact (spec, tickets, decision record, notes, or nothing) is chosen only when the frontier is empty.
|
|
@@ -101,7 +105,7 @@ A few sibling pairs are easy to reach for incorrectly:
|
|
|
101
105
|
| Claude Code | `/draht:<command>` slash commands for the 23 command skills (for example `/draht:plan-phase`); the 16 discipline skills load automatically by description match or on request |
|
|
102
106
|
| Codex | `$draht:<command>` prompts, or `/skills` and pick the wrapper, for the 23 command skills; discipline skills load automatically or by name |
|
|
103
107
|
| Any Agent-Skills-compatible host | invoke the sibling skill directly by name — every `SKILL.md` in this tree is self-contained and portable |
|
|
104
|
-
| draht CLI (`@draht/coding-agent`) |
|
|
108
|
+
| draht CLI (`@draht/coding-agent`) | work directly with the coding tools, or explicitly invoke a bundled command |
|
|
105
109
|
|
|
106
110
|
Once loaded, a skill behaves the same regardless of host — only the invocation surface differs. Skill bodies never hardcode a host name or a plugin-root path for this reason: the same `skills/` tree renders into both plugin packages, and could render into a future host's package the same way.
|
|
107
111
|
|
|
@@ -116,4 +120,4 @@ Once loaded, a skill behaves the same regardless of host — only the invocation
|
|
|
116
120
|
|
|
117
121
|
## See Also
|
|
118
122
|
|
|
119
|
-
For the workflow content itself, do not read this file further — load the sibling skill named in the tables above. `gsd-workflow`
|
|
123
|
+
For the workflow content itself, do not read this file further — load the sibling skill named in the tables above. Start with the task itself. Load `gsd-workflow` only for its optional milestone and phase tracking; use the other skills independently when they help.
|
|
@@ -1,99 +1,24 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: epistemics
|
|
3
|
-
description:
|
|
3
|
+
description: Calibrate historical or uncertain investigation findings, distinguish evidence from inference, and report source coverage and gaps.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Epistemics
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Cite evidence for claims about history or intent. Code demonstrates behavior; motivation requires a decision record, commit/PR discussion, source comment, or other relevant evidence. When those are absent, label the inference.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
Use these tiers when they help communicate uncertainty:
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
- **Direct:** a cited explicit statement from a source in a position to know.
|
|
13
|
+
- **Supported:** independent indirect sources converge; explain that support without presenting it as an explicit statement.
|
|
14
|
+
- **Inferred:** a plausible interpretation of evidence; state the inference and what it rests on.
|
|
15
|
+
- **Speculative:** an unresolved hypothesis, separate from established findings.
|
|
16
|
+
- **Unknown:** evidence was unavailable or searches did not resolve the question.
|
|
13
17
|
|
|
14
|
-
|
|
18
|
+
Treat the user's suggested explanation as a candidate. Seek evidence that could contradict the leading interpretation. Surface conflicting sources instead of choosing a tidier narrative. Repeated code can reflect convention or copying; it does not establish intent by itself.
|
|
15
19
|
|
|
16
|
-
|
|
20
|
+
Distinguish a search with no result from a source that was not searched. A null result means no evidence was found within the stated scope, not that no evidence exists. Report material gaps; do not invent a gap to satisfy a report template.
|
|
17
21
|
|
|
18
|
-
|
|
22
|
+
For an investigation report, include a concise **Sources Consulted** summary with relevant queries, coverage, null results, and unavailable sources. Scope source collection to the question; do not require every service or evidence category for every answer. Follow any caller-specified report format.
|
|
19
23
|
|
|
20
|
-
|
|
21
|
-
- A PR description: "Switching to cursor pagination because offset scans time out past 100k rows" (PR #212).
|
|
22
|
-
- An ADR title and context section naming the decision and its forcing constraint.
|
|
23
|
-
- A `.planning/STATE.md` `## Decisions` line, dated and attributed.
|
|
24
|
-
2. **Supported** — multiple independent indirect sources converge on the same reading. Phrase as fact with all citations, and say the support is convergent, not explicit.
|
|
25
|
-
- A commit message names the symptom and the linked issue describes the incident it fixed.
|
|
26
|
-
- An inline comment names an upstream constraint and the dependency's changelog confirms it existed at that date.
|
|
27
|
-
3. **Inferred** — one plausible reading of circumstantial evidence. Phrase with hedged vocabulary and show the inference chain: "Given A and B, C is likely because D."
|
|
28
|
-
- The retry wrapper landed two days after a revert of the same call site — consistent with a reaction to a production failure, but nothing says so.
|
|
29
|
-
4. **Speculative** — a hypothesis the evidence neither supports nor rules out. Belongs only in a hypotheses section, phrased as a candidate, never in findings.
|
|
30
|
-
5. **Unknown** — the searches ran and came up empty, or the source that would know is unavailable. Reported explicitly, never silently omitted.
|
|
31
|
-
|
|
32
|
-
## Phrasing Guide
|
|
33
|
-
|
|
34
|
-
Confidence-carrying words assert knowledge of intent. Each one demands a citation immediately adjacent:
|
|
35
|
-
|
|
36
|
-
- "because", "the reason is", "was designed to", "fixes", "the team decided"
|
|
37
|
-
|
|
38
|
-
Hedge words mark inference and are the only vocabulary allowed for tier 3:
|
|
39
|
-
|
|
40
|
-
- "appears to", "likely", "suggests", "is consistent with", "one reading is"
|
|
41
|
-
|
|
42
|
-
Banned words: "obviously", "clearly", "of course", "just". And replace "I think" with "the evidence suggests" — the reader needs the evidence's confidence, not yours.
|
|
43
|
-
|
|
44
|
-
## Never Cite Code as Evidence of Its Own Intent
|
|
45
|
-
|
|
46
|
-
Code is mechanics; motivation is external. "The cache exists to reduce latency" cited to the cache implementation is circular — the code proves a cache exists, not why anyone wanted one. A performance rationale needs a source outside the code: a commit message, a benchmark in the PR, a decision record. Without one, it is an Inferred claim wearing a fact's clothes.
|
|
47
|
-
|
|
48
|
-
## Null Results Are Evidence; Skipped Searches Are Blind Spots
|
|
49
|
-
|
|
50
|
-
- A **null result** — "searched the review record for pagination discussion across the file's full history; nothing found" — is a data point. It rules readings out and belongs in the report.
|
|
51
|
-
- A **skipped search** is a blind spot. It rules nothing out and must be reported as a gap, not dressed up as a null result.
|
|
52
|
-
|
|
53
|
-
The reader cannot tell the two apart unless the report distinguishes them. Always state what was searched (queries verbatim) so an empty result is meaningful.
|
|
54
|
-
|
|
55
|
-
## Contradictions Are Findings
|
|
56
|
-
|
|
57
|
-
When two sources disagree — the commit message says performance, the linked ticket says a correctness bug — surface both with their citations. Do not pick the tidier narrative, do not average them into a vague middle. The historical record contradicts itself more often than it lies consistently, and the contradiction is usually the most informative thing the investigation found.
|
|
58
|
-
|
|
59
|
-
## The Sycophancy Trap
|
|
60
|
-
|
|
61
|
-
When the question embeds a hypothesis — "why did we switch to X, was it performance?" — the embedded guess is a candidate to check independently, not a conclusion to confirm. Search for evidence that would support it AND evidence that would contradict it, at equal effort.
|
|
62
|
-
|
|
63
|
-
> **The user's guess is a prompt for investigation, not a conclusion to validate.**
|
|
64
|
-
|
|
65
|
-
## Anti-Rationalization
|
|
66
|
-
|
|
67
|
-
- Never retrofit intent: "this must have been for scalability" is storytelling unless a source says so.
|
|
68
|
-
- A consistent pattern across files may be a deliberate convention — or copy-paste of the first instance. Investigate the origin, don't infer policy from repetition.
|
|
69
|
-
- Absence of evidence is not evidence of absence: "no discussion found" supports "we found no discussion", not "there was no discussion".
|
|
70
|
-
|
|
71
|
-
## The Coverage-Map Contract
|
|
72
|
-
|
|
73
|
-
Every findings report ends with a **Sources Consulted** map: one line per evidence category, including the empty ones. A category may be skipped only with a written justification, and only two justifications are valid:
|
|
74
|
-
|
|
75
|
-
1. **Unavailable in this runtime** — the source cannot be searched here. That is a coverage gap, not a choice, and is reported as one.
|
|
76
|
-
2. **Provably irrelevant, not probably.** A build-time script with no runtime path provably cannot appear in runtime error tracking. "It's feature code, error tracking won't have anything" is a probability judgment, not a proof — search it.
|
|
77
|
-
|
|
78
|
-
## Calibration Checklist
|
|
79
|
-
|
|
80
|
-
Before finalizing any findings report:
|
|
81
|
-
|
|
82
|
-
- Does every factual claim have a citation adjacent to it?
|
|
83
|
-
- Is every uncited claim phrased with tier-3 hedge vocabulary and filed in an inference section?
|
|
84
|
-
- Is any claim citing code as evidence of its own intent?
|
|
85
|
-
- Is the gaps section present and specific? **If no gaps are mentioned, that's suspicious** — every real investigation has them.
|
|
86
|
-
|
|
87
|
-
## Failure Modes
|
|
88
|
-
|
|
89
|
-
- **Confident storytelling** — a plausible narrative assembled from mechanics and phrased as history. The most common failure, and the hardest to spot from inside.
|
|
90
|
-
- **Citing code as evidence of its own intent** — circular sourcing dressed as citation.
|
|
91
|
-
- **Recency bias** — explaining the current shape as one decision when it is an accretion of many. Trace back through the history; the first version's rationale is usually not the current version's.
|
|
92
|
-
- **Sycophantic confirmation** — finding only the evidence that agrees with the asker's framing.
|
|
93
|
-
- **Skipping the gaps section** — shipping a coverage map with no empties is claiming a completeness no investigation has.
|
|
94
|
-
|
|
95
|
-
## Relationship to verification-gate
|
|
96
|
-
|
|
97
|
-
`verification-gate` governs claims about **present** state that a command can prove — run the command, read the output, then claim. Epistemics governs claims about **historical intent** that no command can prove: there is nothing to run, so the discipline is to tier and cite instead. The two compose; neither substitutes for the other.
|
|
98
|
-
|
|
99
|
-
One fixed-format carve-out: `verify-work`'s observed/derived/assumed labels and its verdict-first UAT ordering are fixed report formats — epistemics governs historical-intent claims and never rewords those labels or that ordering.
|
|
24
|
+
Use `verification-gate` for present-state claims that can be checked by execution. Preserve `verify-work`'s observed/derived/assumed labels and verdict-first ordering when that command is selected.
|