Skip to content

docs(spec-38): WS1 delegation accuracy spec and tasks - #254

Merged
pgermishuys merged 1 commit into
mainfrom
docs/spec-38-delegation-accuracy
Sep 25, 2026
Merged

pgermishuys merged 1 commit into
mainfrom
docs/spec-38-delegation-accuracy

Conversation

@pgermishuys

Copy link
Copy Markdown
Contributor

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 on main per 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.
  • Spec 37: a one-line "Next: Spec 38" pointer after its finish line.

Things the spec calls out for review

  • The size rule conflicts with existing cases. The feat(evals): add a delegation-accuracy trajectory case #230 delegation trajectory case is a one-file fix (src/api/orders.ts), and loom-route-pattern-boundary-small-fix expects a one-place fix to go to shuttle. 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 span src/api/ and src/db/). Item 8's L3 proof uses feat(evals): add a delegation-accuracy trajectory case #230 in whatever form item 3 leaves it.
  • Plan state is read mid-session, but adapters compose prompts once at plugin load. Item 6 has to choose, for each adapter, between re-composing Loom's prompt and a per-turn mechanism.
  • Prompt composition happens before adapter materialization. Item 2's ADR has to settle that order.
  • Root cause (f) is partly addressed already. Loom's list renders a category's triggers; Tapestry's list and the harness's own agent list show only the bare category description.
  • Required-check mechanics for L3. The job always registers and decides inside itself whether to run, so a paths-filtered required check never blocks merging.

Checks

  • bun run docs:check-links passes.

🤖 Generated with Claude Code

https://claude.ai/code/session_01T15PT3299yvdvr6gkzyDmk

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
Copilot AI lite review requested due to automatic review settings September 25, 2026 06:15
@coderabbitai

coderabbitai Bot commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (5)
  • .codesight/CODESIGHT.md is excluded by !.codesight/**
  • docs/specs/37-spec-repository-foundation/37-spec-repository-foundation.md is excluded by !docs/specs/**
  • docs/specs/38-spec-delegation-accuracy/38-spec-delegation-accuracy.md is excluded by !docs/specs/**
  • docs/specs/38-spec-delegation-accuracy/38-tasks-delegation-accuracy.md is excluded by !docs/specs/**
  • docs/specs/README.md is excluded by !docs/specs/**

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 27469373-c6f9-4b92-a9df-dd38b0592a10

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pgermishuys
pgermishuys merged commit e5db4c0 into main Sep 25, 2026
3 checks passed
@pgermishuys
pgermishuys deleted the docs/spec-38-delegation-accuracy branch September 25, 2026 06:17

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 Medium severity · 1 Low severity

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.
Comment on lines +24 to +25
- [ ] 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)).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants