@draht/coding-agent 2026.7.7-1 → 2026.7.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/README.md +2 -2
- package/agents/advisor.md +44 -0
- package/bin/draht-tools.cjs +1808 -988
- package/dist/agents/advisor.md +44 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +1 -1
- package/dist/cli/args.js.map +1 -1
- package/dist/core/agent-session.d.ts +16 -3
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +76 -18
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/cache-stats.d.ts +49 -0
- package/dist/core/cache-stats.d.ts.map +1 -0
- package/dist/core/cache-stats.js +101 -0
- package/dist/core/cache-stats.js.map +1 -0
- package/dist/core/compaction/compaction.d.ts +1 -2
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +51 -73
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/extensions/index.d.ts +1 -1
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +23 -4
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +1 -24
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +9 -9
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/model-registry.d.ts +4 -6
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +34 -8
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +2 -5
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/settings-manager.d.ts +7 -3
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +10 -1
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/slash-commands.d.ts +1 -0
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +3 -3
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/gsd/hook-utils.d.ts.map +1 -1
- package/dist/gsd/hook-utils.js +3 -1
- package/dist/gsd/hook-utils.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +1 -0
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts +4 -0
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +1 -1
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts +3 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.js +17 -6
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +2 -0
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +10 -0
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +10 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +247 -47
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/theme/theme-schema.json +3 -4
- package/dist/modes/interactive/theme/theme.d.ts +2 -1
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +8 -4
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js +1 -1
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts +6 -6
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +3 -3
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +4 -1
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/prompts/commands/execute-phase.md +2 -2
- package/dist/prompts/commands/fix.md +1 -1
- package/dist/prompts/commands/map-codebase.md +8 -8
- package/dist/prompts/commands/next-milestone.md +1 -0
- package/dist/prompts/commands/orchestrate-loop.md +99 -0
- package/dist/prompts/commands/orchestrate.md +25 -2
- package/dist/prompts/commands/pause-work.md +2 -1
- package/dist/prompts/commands/plan-phase.md +1 -0
- package/dist/prompts/commands/quick.md +2 -2
- package/dist/utils/clipboard-image.d.ts.map +1 -1
- package/dist/utils/clipboard-image.js +1 -1
- package/dist/utils/clipboard-image.js.map +1 -1
- package/docs/custom-provider.md +4 -3
- package/docs/extensions.md +15 -10
- package/docs/models.md +49 -8
- package/docs/rpc.md +15 -5
- package/docs/sdk.md +1 -1
- package/docs/settings.md +3 -2
- package/docs/themes.md +5 -3
- package/docs/tui.md +1 -1
- package/docs/usage.md +2 -2
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/preset.ts +2 -2
- package/examples/extensions/reload-runtime.ts +2 -2
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/examples/sdk/README.md +1 -1
- package/package.json +5 -5
- package/prompts/commands/execute-phase.md +2 -2
- package/prompts/commands/fix.md +1 -1
- package/prompts/commands/map-codebase.md +8 -8
- package/prompts/commands/next-milestone.md +1 -0
- package/prompts/commands/orchestrate-loop.md +99 -0
- package/prompts/commands/orchestrate.md +25 -2
- package/prompts/commands/pause-work.md +2 -1
- package/prompts/commands/plan-phase.md +1 -0
- package/prompts/commands/quick.md +2 -2
package/prompts/commands/fix.md
CHANGED
|
@@ -37,7 +37,7 @@ Stop immediately if you catch yourself:
|
|
|
37
37
|
- Making "one more fix attempt" after already trying 2+
|
|
38
38
|
- Watching each fix reveal new problems elsewhere
|
|
39
39
|
|
|
40
|
-
After **3 failed fix attempts**, STOP. This is an architectural problem, not a hypothesis problem. Report back to the user — do not try a 4th fix.
|
|
40
|
+
After **3 failed fix attempts**, STOP. This is a **hard cap**, not advice — an architectural problem, not a hypothesis problem. Report back to the user — do not try a 4th fix. Before reporting, append one dated line to `.planning/STATE.md` under `## Lessons`: what was tried and why it failed, so the next session doesn't repeat the same three attempts.
|
|
41
41
|
|
|
42
42
|
## Atomic Reasoning
|
|
43
43
|
|
|
@@ -30,15 +30,15 @@ Before analyzing, decompose codebase understanding into atomic reasoning units:
|
|
|
30
30
|
- Note architectural concerns and patterns
|
|
31
31
|
|
|
32
32
|
## Steps
|
|
33
|
-
1. Run `draht-tools map-codebase $1`
|
|
33
|
+
1. Run `draht-tools map-codebase $1` (graph artifacts are always whole-repo — see below)
|
|
34
34
|
2. Tool generates: STACK.md, ARCHITECTURE.md, CONVENTIONS.md, CONCERNS.md
|
|
35
|
-
2a. Run `draht-tools map-graph
|
|
35
|
+
2a. Run `draht-tools map-graph` to produce the **living architecture map**. The graph always maps the whole repository from the git root, regardless of any directory argument — the tool enforces this deterministically; a directory argument only scopes the narrative analysis in step 3, not the graph itself.
|
|
36
36
|
- `.planning/codebase/MAP.json` — machine-readable map with **entry points** (CLI bins, HTTP routes, library main exports), **sinks** (FS / net / DB / stdout / exec calls), **bounded contexts** (packages), **cross-package dataflow edges**, **symbol-resolved call edges**, **flows** (which sinks each entry point reaches and through which intermediate module), per-module **layer** (presentation / application / domain / infrastructure / support), and exports/imports per file. Agents starting a new task should read MAP.json first instead of re-scanning the tree.
|
|
37
|
-
- `.planning/codebase/MAP.html` — interactive
|
|
38
|
-
- **
|
|
39
|
-
- **
|
|
37
|
+
- `.planning/codebase/MAP.html` — interactive visualization with three tabs:
|
|
38
|
+
- **Graph** — the primary interactive force-directed knowledge graph: nodes colored by cluster and sized by degree; click a node for an inspector (file, symbols, importers, callers); search plus filters for layer / cluster / edge-confidence (EXTRACTED/INFERRED/AMBIGUOUS); legend; PNG/SVG export; double-click a cluster to expand/collapse it.
|
|
39
|
+
- **Architecture** — package containers in layer bands with cross-package dataflow arrows.
|
|
40
40
|
- **Flows** — entry points on top, sinks on bottom, intermediate modules ranked by depth from entry. Click an entry point to trace which sinks it reaches.
|
|
41
|
-
Open directly
|
|
41
|
+
Open `MAP.html` directly via `file://` — the data is embedded inline so it works fully offline — or run `draht-tools map-serve` for a live-reloading dev view (regenerates on every code-file save (docs/asset saves are ignored by design), via SSE).
|
|
42
42
|
3. **Run parallel deep analysis via subagents:**
|
|
43
43
|
Use the `subagent` tool in **parallel mode** with these tasks:
|
|
44
44
|
- `architect` agent: "Analyze the codebase at $1. Identify bounded contexts from directory structure — look for top-level src/ subdirectories, packages, or modules that encapsulate coherent domain concepts. Note any cross-directory coupling suggesting blurred context boundaries. Extract domain language: collect PascalCase class/interface/type names, key function names, database table/collection names. Look for repeated nouns representing core domain concepts. Output a structured list of: bounded contexts (name + description), domain terms (glossary), aggregates per context, and context relationships (upstream/downstream, shared kernel, ACL). End with `STATUS: DONE | DONE_WITH_CONCERNS | NEEDS_CONTEXT | BLOCKED`. Do NOT run draht, draht-tools, or pi commands."
|
|
@@ -61,7 +61,7 @@ Before analyzing, decompose codebase understanding into atomic reasoning units:
|
|
|
61
61
|
|
|
62
62
|
## Living map for agents
|
|
63
63
|
|
|
64
|
-
The `MAP.json` produced in step 2a is the single source of truth for "what's in this codebase":
|
|
65
|
-
- Subagents that need orientation should read `.planning/codebase/MAP.json` before walking the file tree.
|
|
64
|
+
The `MAP.json` produced in step 2a is the single source of truth for "what's in this codebase". It is always the **whole-repo** map — `map-graph` maps from the git root regardless of where it's invoked or what directory argument is passed:
|
|
65
|
+
- Subagents that need orientation should read `.planning/codebase/MAP.json` before walking the file tree, even when working from a subdirectory — they get the full map via the `graph-*` commands, not a scoped one.
|
|
66
66
|
- It is regenerated every time `map-codebase`, `map-graph`, or `map-serve` runs, so it stays current with the code.
|
|
67
67
|
- Developers can keep `draht-tools map-serve` running in a terminal — the HTML visualization updates live as files change, so architecture documentation is never stale.
|
|
@@ -42,6 +42,7 @@ Before planning the next milestone, decompose progress into atomic reasoning uni
|
|
|
42
42
|
2. Review completed work:
|
|
43
43
|
- Scan `.planning/phases/` for all UAT reports (`*-UAT.md`) and summaries (`*-SUMMARY.md`)
|
|
44
44
|
- Note what was built, what worked well, what had issues
|
|
45
|
+
- **Write the distilled lessons back**: append each durable lesson as a dated bullet to `.planning/STATE.md` under `## Lessons` (create the section before `## Blockers` if missing) — extraction that only informs this session evaporates; the `## Lessons` section is what future sessions reread
|
|
45
46
|
3. Assess requirements:
|
|
46
47
|
- Which v1 requirements are now satisfied?
|
|
47
48
|
- Which v1 requirements remain?
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Run a verification-gated loop of fresh subagent iterations until a deterministic check passes"
|
|
3
|
+
argument-hint: "<goal with a measurable success criterion> [--max-iterations N]"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /orchestrate-loop
|
|
7
|
+
|
|
8
|
+
Run fresh-context worker iterations against a fixed goal until an independent check passes — or a hard stop fires. The loop closes on a deterministic check, never on an agent's claim of completion.
|
|
9
|
+
|
|
10
|
+
Goal: $ARGUMENTS
|
|
11
|
+
|
|
12
|
+
> **Tool note**: Use the `subagent` tool. Workers are `implementer` (or `debugger` for pure-diagnosis goals); the final gate is `spec-reviewer`. One worker per iteration — never parallel workers inside the loop.
|
|
13
|
+
|
|
14
|
+
## When to Loop vs Orchestrate
|
|
15
|
+
|
|
16
|
+
| Situation | Command |
|
|
17
|
+
|---|---|
|
|
18
|
+
| Decomposition is known, sub-tasks dispatch once | `/orchestrate` |
|
|
19
|
+
| Phase plans exist in `.planning/phases/` | `/execute-phase` |
|
|
20
|
+
| Goal needs iteration until a measurable criterion holds | `/orchestrate-loop` |
|
|
21
|
+
|
|
22
|
+
Loops trade tokens for persistence: use one when the work is too large or too uncertain for a single pass AND success is checkable without human judgment.
|
|
23
|
+
|
|
24
|
+
## The Loop Contract — no check, no loop
|
|
25
|
+
|
|
26
|
+
A loop is only as good as its check. Before iterating, establish all four:
|
|
27
|
+
|
|
28
|
+
1. **GOAL** — one measurable end state, stated in one sentence.
|
|
29
|
+
2. **CHECK** — a command that proves the goal, pass/fail by exit code (test suite, typecheck + lint, a script comparing against a known-good oracle). Prefer terse output: failures only.
|
|
30
|
+
3. **STOP CONDITIONS** — check passes (verified independently), max iterations reached (default 10; `--max-iterations N` overrides), stall detected, or `STATUS: BLOCKED`.
|
|
31
|
+
4. **CONSTRAINTS** — what no iteration may touch: existing tests and the check itself are immutable (weakening either to "make it pass" is a hard-stop violation), plus anything out of scope.
|
|
32
|
+
|
|
33
|
+
If no deterministic check can be derived from the goal, STOP and ask the user to define one (or fall back to `/orchestrate`). Never start a loop whose only stop signal is "looks done" — without a check, you become the verification loop and it never closes.
|
|
34
|
+
|
|
35
|
+
Write the contract to `.planning/loop/LOOP.md`:
|
|
36
|
+
|
|
37
|
+
```markdown
|
|
38
|
+
# Loop: <slug>
|
|
39
|
+
Started: <date> | Max iterations: <N>
|
|
40
|
+
|
|
41
|
+
## Goal
|
|
42
|
+
<one sentence>
|
|
43
|
+
|
|
44
|
+
## Check
|
|
45
|
+
`<command>` — passes when <what the output proves>
|
|
46
|
+
|
|
47
|
+
## Constraints
|
|
48
|
+
- <immutables and out-of-scope items>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Create `.planning/loop/PROGRESS.md` alongside it (append-only iteration log).
|
|
52
|
+
|
|
53
|
+
## Iteration Protocol
|
|
54
|
+
|
|
55
|
+
Each iteration dispatches ONE fresh worker whose prompt contains, in full (workers cannot see this conversation):
|
|
56
|
+
|
|
57
|
+
1. The loop contract verbatim
|
|
58
|
+
2. The last 3 entries of `PROGRESS.md` and the last 5 `git log --oneline` lines — the recoverable state
|
|
59
|
+
3. The previous iteration's failure evidence, terse: the failing assertions or error lines, not full output
|
|
60
|
+
4. Standing orders:
|
|
61
|
+
- **Startup ritual** — read the progress log, run the CHECK first, observe the current failure before changing anything
|
|
62
|
+
- **One increment** — the smallest change that moves the check toward passing; do not batch
|
|
63
|
+
- **Commit the increment** even if the check still fails — state must survive context death
|
|
64
|
+
- **Append one `PROGRESS.md` entry** — what changed / check result observed / suggested next step
|
|
65
|
+
- Never edit or delete tests or the check to make it pass; never claim completion without quoting check output
|
|
66
|
+
|
|
67
|
+
## Independent Verification — the gate
|
|
68
|
+
|
|
69
|
+
After EVERY iteration, re-run the CHECK yourself and read exit code and output. Completion is decided by this re-run, never by the worker's report — worker claims are inputs, not verdicts.
|
|
70
|
+
|
|
71
|
+
- **Check passes** → dispatch `spec-reviewer` once over the full loop diff (contract vs everything changed since the loop started). Only a clean spec review ends the loop as DONE; concerns trigger one more targeted iteration.
|
|
72
|
+
- **Check fails** → extract the terse failure evidence and feed it into the next iteration's prompt as guidance.
|
|
73
|
+
|
|
74
|
+
## Stall Detection
|
|
75
|
+
|
|
76
|
+
Stop early when the loop is running but not progressing:
|
|
77
|
+
|
|
78
|
+
- Two consecutive iterations with the identical failure signature, or
|
|
79
|
+
- An iteration that produced no commit
|
|
80
|
+
|
|
81
|
+
On stall, do not dispatch the same input again — change something: decompose the goal, add context the workers were missing, switch worker (`implementer` → `debugger`), consult `advisor` for a course correction, or surface to the user with the evidence so far.
|
|
82
|
+
|
|
83
|
+
## Steps
|
|
84
|
+
|
|
85
|
+
1. Parse `$ARGUMENTS` into GOAL and flags; derive the CHECK; refuse to loop without one
|
|
86
|
+
2. Write `.planning/loop/LOOP.md` and `.planning/loop/PROGRESS.md`
|
|
87
|
+
3. Iterate: dispatch worker → re-run CHECK yourself → branch (pass → gate, fail → next iteration, stall / max / BLOCKED → hard stop)
|
|
88
|
+
4. On success: spec-review the full diff, then report — outcome first, check output quoted, iterations used
|
|
89
|
+
5. On any hard stop: append a handoff entry to `PROGRESS.md` (state observed, failure evidence, recommended next step) and report with observed / derived / assumed labels
|
|
90
|
+
6. Leave `.planning/loop/` in place as the loop's record
|
|
91
|
+
|
|
92
|
+
## Rules
|
|
93
|
+
|
|
94
|
+
- One worker, one increment, at least one commit per iteration
|
|
95
|
+
- Loops are volume work — run workers on the executor tier and keep steering (this context, `advisor`, `spec-reviewer`) on the strongest tier
|
|
96
|
+
- The worker never grades its own work — your re-run of the check plus a fresh-context spec review decide completion
|
|
97
|
+
- Never raise max iterations mid-loop without asking the user
|
|
98
|
+
- Tests and the check are immutable inside the loop; tampering means revert and hard stop
|
|
99
|
+
- Evidence discipline applies to the loop verdict: label results observed / derived / assumed
|
|
@@ -9,7 +9,7 @@ Decompose a task and dispatch the right mix of specialist subagents.
|
|
|
9
9
|
|
|
10
10
|
Task: $ARGUMENTS
|
|
11
11
|
|
|
12
|
-
> **Tool note**: Use the `subagent` tool. Set `agent` to one of: `architect`, `implementer`, `spec-reviewer`, `reviewer`, `debugger`, `verifier`, `git-committer`, `security-auditor`. Use `tasks: [...]` for parallel dispatch and `chain: [...]` for sequential pipelines.
|
|
12
|
+
> **Tool note**: Use the `subagent` tool. Set `agent` to one of: `architect`, `implementer`, `spec-reviewer`, `reviewer`, `debugger`, `verifier`, `git-committer`, `security-auditor`, `advisor`. Use `tasks: [...]` for parallel dispatch and `chain: [...]` for sequential pipelines.
|
|
13
13
|
|
|
14
14
|
## Atomic Reasoning
|
|
15
15
|
|
|
@@ -32,9 +32,28 @@ Before delegating, decompose the task into atomic work units:
|
|
|
32
32
|
| Audit for security issues | `security-auditor` |
|
|
33
33
|
| Run lint / typecheck / tests | `verifier` |
|
|
34
34
|
| Create atomic commits | `git-committer` |
|
|
35
|
+
| Strategic steer at a decision point — rare, high-leverage | `advisor` |
|
|
35
36
|
|
|
36
37
|
`spec-reviewer` and `reviewer` are distinct on purpose. Spec-reviewer ONLY checks "did the diff implement what the spec asked, no more no less". Reviewer evaluates quality. For any task with a written spec, run spec-reviewer **before** reviewer.
|
|
37
38
|
|
|
39
|
+
## Effort Scaling
|
|
40
|
+
|
|
41
|
+
Match orchestration weight to the task — over-orchestration burns tokens without adding verification value:
|
|
42
|
+
|
|
43
|
+
| Task shape | Dispatch |
|
|
44
|
+
|---|---|
|
|
45
|
+
| Single question or trivial fix | One agent, or handle it directly — no orchestration |
|
|
46
|
+
| One change set to evaluate | 2–4 parallel evaluators (reviewer, security-auditor, verifier) |
|
|
47
|
+
| Multi-part feature with known decomposition | Fan-out / fan-in |
|
|
48
|
+
| Goal needing iteration until a measurable criterion holds | `/orchestrate-loop` |
|
|
49
|
+
|
|
50
|
+
## Model Tiering
|
|
51
|
+
|
|
52
|
+
Bill volume tokens at the cheaper rate:
|
|
53
|
+
|
|
54
|
+
- **Orchestrator pattern** — run this command on the strongest tier (e.g. Claude Fable 5) and let workers execute on the executor tier (e.g. Claude Sonnet 5): planning quality where it matters, volume tokens at worker rates.
|
|
55
|
+
- **Advisor pattern** — when the session runs on the executor tier, dispatch `advisor` sparingly: once after orientation before committing to an approach, again when stuck or before declaring a hard task done. ~1–3 consults per task; treat its guidance with serious weight.
|
|
56
|
+
|
|
38
57
|
## Orchestration Modes
|
|
39
58
|
|
|
40
59
|
### Parallel
|
|
@@ -57,6 +76,9 @@ implementer → spec-reviewer → reviewer
|
|
|
57
76
|
|
|
58
77
|
Never run quality review on a spec-non-compliant diff. This is the per-task loop inside `/execute-phase`.
|
|
59
78
|
|
|
79
|
+
### Loop (iterate until a check passes)
|
|
80
|
+
When the work cannot land in one dispatch but success is provable by a deterministic check, do not improvise retries here — hand off to `/orchestrate-loop`. It runs fresh worker iterations gated by an independent re-run of the check, with max-iteration and stall bounds.
|
|
81
|
+
|
|
60
82
|
## Reading Subagent Status
|
|
61
83
|
|
|
62
84
|
Every draht agent ends its response with one of four status lines. Branch on it:
|
|
@@ -76,7 +98,8 @@ Every draht agent ends its response with one of four status lines. Branch on it:
|
|
|
76
98
|
|
|
77
99
|
## Rules
|
|
78
100
|
- Prefer parallel dispatch when possible — it's faster and each subagent has its own context
|
|
79
|
-
-
|
|
101
|
+
- Every dispatch is a complete brief: objective, expected output format, tool guidance, and task boundaries — subagents cannot see the main conversation
|
|
80
102
|
- Do not nest delegations deeply — one level is usually enough
|
|
81
103
|
- Never retry the same agent on the same input after `BLOCKED` — change something
|
|
82
104
|
- For any spec-driven work, spec-reviewer runs before quality reviewer
|
|
105
|
+
- The agent that produced work never evaluates it — completion verdicts come from a fresh-context evaluator plus your own re-run of the decisive check
|
|
@@ -26,4 +26,5 @@ Before pausing, decompose session state into atomic reasoning units:
|
|
|
26
26
|
|
|
27
27
|
## Steps
|
|
28
28
|
1. Run `draht-tools pause` — creates CONTINUE-HERE.md
|
|
29
|
-
2.
|
|
29
|
+
2. **Distill lessons before the context is lost**: for anything this session tried that failed, or an approach that worked against expectations, append one dated bullet to `.planning/STATE.md` under `## Lessons` (create the section before `## Blockers` if missing). Lessons name what to do differently — "runner hits TLS issue in PowerShell, use bash", not "had problems with tests".
|
|
30
|
+
3. Commit: `draht-tools commit-docs "pause work"`
|
|
@@ -48,6 +48,7 @@ Before creating plans, decompose this phase goal into atomic reasoning units:
|
|
|
48
48
|
|
|
49
49
|
## Steps
|
|
50
50
|
1. Run `draht-tools load-phase-context $1` to gather all context
|
|
51
|
+
1b. Read `.planning/STATE.md` `## Lessons` — every plan must respect the recorded lessons; a plan that repeats a documented failure is invalid. Feed relevant lessons into each architect prompt.
|
|
51
52
|
2. Optional: `draht-tools research-phase $1` for domain research
|
|
52
53
|
3. Goal-backward planning:
|
|
53
54
|
a. State the goal (outcome, not activity)
|
|
@@ -69,11 +69,11 @@ Before executing, decompose this task into atomic reasoning units:
|
|
|
69
69
|
End with `STATUS: DONE | DONE_WITH_CONCERNS | NEEDS_CONTEXT | BLOCKED`.
|
|
70
70
|
```
|
|
71
71
|
- `DONE` → go to Stage 3.
|
|
72
|
-
- `BLOCKED` → re-dispatch implementer with Required Fixes. Repeat until `DONE`.
|
|
72
|
+
- `BLOCKED` → re-dispatch implementer with Required Fixes. Repeat until `DONE`. **Hard cap: 3 re-dispatches total** — at the cap, STOP and report the disagreement to the user.
|
|
73
73
|
|
|
74
74
|
5. **Stage 3 — Reviewer (optional code-quality pass).** For non-trivial quick tasks (more than one file, or domain code), use the `subagent` tool with the `reviewer` agent. Otherwise skip.
|
|
75
75
|
- `DONE` → task complete.
|
|
76
|
-
- `BLOCKED` → re-dispatch implementer with Must-fix list.
|
|
76
|
+
- `BLOCKED` → re-dispatch implementer with Must-fix list — same **hard cap of 3 re-dispatches**; at the cap, STOP and report.
|
|
77
77
|
|
|
78
78
|
6. Write summary: `draht-tools write-quick-summary NNN`
|
|
79
79
|
7. Update state: `draht-tools update-state`
|