Repository navigation
docs(spec-38): WS1 delegation accuracy spec and tasks - #254
Conversation
Spec 38 plans WS1 of the September 2026 session audit: when Loom or Tapestry delegates, it picks an agent that exists, is the right one, and completes, and failures recover without the user noticing. It records the state on main (the bare-model bug is fixed; routing evals already meet the 90% target), the decisions agreed on 25 Sep 2026 (OpenCode V1/V2 scope for adapter work, Loom's size rule, the audit script now), nine work items with the L1-L5 test layers, the measurement plan, the done-when and a finish line. Adds the index row, bumps the next spec number, and points Spec 37's finish line at Spec 38. Refs #253 Refs #183 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01T15PT3299yvdvr6gkzyDmk
|
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (5)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Resolve the materialized-agent fallback and fixture rules, clarify the plan-state API boundary, and make metrics and task ordering deterministic.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 3
Open (4)
What changed in this PR
This documentation-only PR adds Spec 38, defining the delegation-accuracy workstream and implementation plan.
Changes:
- Adds the Spec 38 specification and task checklist.
- Documents delegation rules, metrics, tests, CI proofs, and audit work.
- Updates spec navigation, Spec 37 linkage, and Codesight metadata.
| File | Summary |
|---|---|
docs/specs/README.md |
Adds the Spec 38 catalog entry. |
docs/specs/38-spec-delegation-accuracy/38-tasks-delegation-accuracy.md |
Defines implementation tasks, ordering, and checkpoints. |
docs/specs/38-spec-delegation-accuracy/38-spec-delegation-accuracy.md |
Defines delegation goals, rules, metrics, and work items. |
docs/specs/37-spec-repository-foundation/37-spec-repository-foundation.md |
Links forward to Spec 38. |
.codesight/CODESIGHT.md |
Updates generated scan metadata. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| > | ||
| > When the size is unclear, delegate if the job would take more than a few steps, so you stay responsive to the user. | ||
|
|
||
| **Recovery rule** (Loom and Tapestry): after a transient error (for example a connection reset), send the same task once more. After a configuration error (the agent or its model is not found), send the task to `shuttle` and tell the user in one line which agent is broken. |
| - [ ] 1.3 **L2 prompt contract**, alongside [`prompt-snapshots.test.ts`](../../../packages/cli/src/evals/__tests__/prompt-snapshots.test.ts): render Loom's and Tapestry's composed prompts for each fixture; collect every agent-like name in the rendered text (bold or backticked names, `shuttle-*` tokens, names after "delegate to"); assert each is a materialized agent. A small allowlist covers non-agent tokens (for example command names), with a comment per entry. | ||
| - [ ] 1.4 Assertions that fail on today's `main` (expected: L1's delegation list against a failed materialization for (b), L2 against the `shuttle-backend` / `shuttle-frontend` line for (c)) are committed as known failures (`test.failing`) naming the group that fixes them. |
| ## 6. Loom never executes plans — PR: _ | ||
|
|
||
| - [ ] 6.1 Template context: add plan-state paths (for example `plan.active`, `plan.name`, `plan.tasksRemaining`) to `ALLOWED_TEMPLATE_PATHS` and the context types in [`template-context.ts`](../../../packages/engine/src/template-context.ts), supplied by the adapter and absent when it supplies none. Document them in [`prompt-composition.md`](../../prompt-composition.md#template-context) and the Template Context table in [`AGENTS.md`](../../../AGENTS.md). | ||
| - [ ] 6.2 OpenCode V1 and V2: read plan state through the existing plan-state provider ([Spec 19](../19-spec-plan-state-provider/19-spec-plan-state-provider.md)) and make Loom see the current state mid-session: re-compose Loom's prompt when the state changes, or a per-turn mechanism verified on that harness. Record which, per adapter. |
|
|
||
| - **Harness scope.** Adapter-specific work (hiding built-ins, the audit script, the live proof) covers **OpenCode V1 and OpenCode V2**. Engine and prompt changes apply to every adapter. Claude Code and Pi come later. | ||
| - **Loom's size rule (proportional delegation).** Loom does small, self-contained work itself and delegates the rest. The wording for `loom.md` is below; the maintainer may adjust it in review. | ||
| - **The session-audit script is built now**, for WS1's delegation metrics only, against the OpenCode V1 and V2 session stores. The [Spec 37 metric definitions](../37-spec-repository-foundation/37-tasks-repository-foundation.md#metric-definitions-for-the-session-audit-script) apply; this spec adds two (see [Metrics](#metrics)). |


Refs #253 (tracking issue for Spec 38)
Refs #183 (WS0 / Spec 37 context)
What
Docs only. Adds Spec 38, WS1 of the September 2026 session audit, in the Spec 37 format:
docs/specs/38-spec-delegation-accuracy/38-spec-delegation-accuracy.md: the goal, the state onmainper root cause (a)–(f), the decisions agreed on 25 Sep 2026, the prompt rules written positively (delegation, Loom's size rule, recovery, active plan), nine work items with outcomes, item notes, two added metrics, measurement, done-when and a finish line.38-tasks-delegation-accuracy.md: "Start here", order and dependencies, one checkbox group per item (PR: _), measurement checkpoints after items 3, 4 and 6, a close-out group, and a relevant-files table.docs/specs/README.md: the Spec 38 row; next available integer is now after 38.Things the spec calls out for review
src/api/orders.ts), andloom-route-pattern-boundary-small-fixexpects a one-place fix to go toshuttle. Under the size rule Loom may do both itself. Item 3 re-runs them; the spec's default is to change the case, not the rule (widen feat(evals): add a delegation-accuracy trajectory case #230 to spansrc/api/andsrc/db/). Item 8's L3 proof uses feat(evals): add a delegation-accuracy trajectory case #230 in whatever form item 3 leaves it.Checks
bun run docs:check-linkspasses.🤖 Generated with Claude Code
https://claude.ai/code/session_01T15PT3299yvdvr6gkzyDmk