Spec Studio

The mod answers an agent's steps from the sidecar and never calls a model

spec:cc-agents.mod-layerUse Case / Behavior · featureready floor ready

Packs: none

Design: 5 design entries · 2 pinned declarations · no decisions

Findings: no errors, no warnings

specs/runner/mod-layer.sdp.md

2 open questions and no blocking questions; implementation binding present, verifier binding present, and expected-outcome oracle none.

The mod is plugin/hooks/register.js, loaded by Claude Code's mod standard. It handles agent spawns, turn starts, steps, messages and stops for agent types of this plugin and passes everything else through untouched. It speaks only the sidecar's neutral endpoints and events, and names no harness: the harness is the part of the agent type after cc-agents:.

Intent
actor
The Claude Code engine, running a subagent of type cc-agents:<harness>.
problem
The engine runs a real model loop for every subagent, and left alone it would call the type's fallback Claude model for the task.
outcome
Each step of such an agent is answered from the harness's turn, and an agent the mod cannot serve fails closed instead of reaching the fallback model.
value
The subagent's own model is never called, and the user's rows, transcripts and Workflow roles behave as for a Claude agent.

Open questions

  • non-blocking · question.untestedPaths line 25 · specs/runner/mod-layer.sdp.md:25 · Built but not exercised by any test: a spawn that asks to be a team teammate is denied; the agent.spawn catch handler denies an agent the hook could not prepare; the internal progress tool answers "Still working." and is denied to agents that are not ours; a follow-up message to an ended agent starts a new run on the same thread; a step aborted mid-stream interrupts the turn; the turn-complete hook of an agent stopped before its first step asks the sidecar to interrupt it.Decider: delegatedProvisional: The code is as described; tests would pin each path.
  • non-blocking · question.stepLabel line 28 · specs/runner/mod-layer.sdp.md:28 · The steps hand over through an internal progress tool call, so a step shows its progress only when it ends, every 20 seconds by default, never token by token.Decider: ownerProvisional: Kept as built; Claude Code buffers output until a step ends.
Behavior
rule.ourTypesOnly line 34 · specs/runner/mod-layer.sdp.md:34
Only agent types named cc-agents:<harness> are handled; a spawn, step or message of any other agent passes through untouched.

no example exercises it

rule.headerThenCheck line 35 · specs/runner/mod-layer.sdp.md:35
A spawn reads an optional header of model, effort and mode lines ended by a line ---, refuses an unknown key before anything starts, asks the sidecar to check the settings, and starts the subagent with the task alone.

no example exercises it

rule.refusalNamesWhy line 36 · specs/runner/mod-layer.sdp.md:36
A check the sidecar refuses denies the spawn with its reason, and an OpenCode agent with no model and no default is refused with a pointer to the user's model guide.

no example exercises it

rule.defaultsAreOptions line 37 · specs/runner/mod-layer.sdp.md:37
A harness's default model comes from the option <harness>Model; a model in the header wins; with neither, the harness's own check decides.

no example exercises it

rule.slotBeforeStart line 38 · specs/runner/mod-layer.sdp.md:38
A spawn takes a slot from the sidecar before the subagent starts, and over the cap or on a critical machine it waits with a status line and a toast that name the reason once.

no example exercises it

rule.stepsFromEvents line 39 · specs/runner/mod-layer.sdp.md:39
A step shows the harness's events as the agent's text, and while the turn runs it ends by calling the internal progress tool; a step lasts the option stepSeconds, 20 by default and at least 5.

no example exercises it

rule.failClosed line 40 · specs/runner/mod-layer.sdp.md:40
An agent of this plugin that the mod has no record of after a reload, or whose spawn never recorded it, is answered with a message saying so and never handed to the type's Claude model, and Workflow agents in no list are recognised by a marker the mod wrote at spawn.

no example exercises it

rule.reloadReattaches line 41 · specs/runner/mod-layer.sdp.md:41
After the mod reloads, a step of an agent the sidecar knows attaches to its running turn from the event cursor, or hands back the answer that already came.

no example exercises it

rule.firstStepWaitsForSpawn line 42 · specs/runner/mod-layer.sdp.md:42
A first step waits for its own spawn to finish recording the agent, hands over to the next step when its share of five seconds is used, and gives up after two minutes.

no example exercises it

rule.lostTurnEnds line 43 · specs/runner/mod-layer.sdp.md:43
A turn whose sidecar restarted ends with a stated reason instead of polling forever.

no example exercises it

0 unkeyed rules.

Design
sidecarEndpoints line 47 · specs/runner/mod-layer.sdp.md:47
/check, /reserve, /release, /register, /start, /events, /steer, /interrupt, /status, /agent, /resume-lookup, each described by the sidecar Spec.

no citation recorded

agentType line 48 · specs/runner/mod-layer.sdp.md:48
cc-agents:<harness>, where <harness> is also the adapter module's name and the agent file plugin/agents/<harness>.md.

no citation recorded

header line 49 · specs/runner/mod-layer.sdp.md:49
Lines key: value for model, effort and mode, then a line ---, then the task; a prompt without that shape is the task.
progressTool line 50 · specs/runner/mod-layer.sdp.md:50
An internal deferred tool named progress that the mod registers at session start; its calls mark a turn still running.
ownershipMarker line 51 · specs/runner/mod-layer.sdp.md:51
A file owned-<agent id> in the session's run directory, naming the harness, written at spawn.
Verification

Verifier bindings

  • test:cc-agents.mod-suite · the mod against a scripted sidecar · anchored · test anchor binding present · plugin/tests/mod.test.ts:4
Design view

Requirement drawing

  • Declared verifying examples: no declared verifying example.
Requirement drawing for spec:cc-agents.mod-layer
The diagram as text
  • spec:cc-agents.mod-layer: The mod answers an agent's steps from the sidecar and never calls a model · declared Spec
  • spec:cc-agents.runner: Other model families run as real Claude Code agents · declared Spec
  • impl:cc-agents.mod: answers each step of an agent from the sidecar's events, hands back the exact answer, steers and stops, and returns the job state block · anchored code · plugin/hooks/register.js:9
  • test:cc-agents.mod-suite: the mod against a scripted sidecar · anchored test binding · binding present · plugin/tests/mod.test.ts:4
  • spec:cc-agents.mod-layer refines spec:cc-agents.runner · declared
  • impl:cc-agents.mod satisfies spec:cc-agents.mod-layer · anchored
  • test:cc-agents.mod-suite verifies spec:cc-agents.mod-layer · anchored
Mermaid source

Copyable source; the Studio draws static SVG.

Preferred and chosen syntax: requirementDiagram; exact refines, satisfies and verifies, with claim words in nodes and per-edge comments.

Decisions

No decision record named.

Runtime
  • impl:cc-agents.mod · answers each step of an agent from the sidecar's events, hands back the exact answer, steers and stops, and returns the job state block · plugin/hooks/register.js:9

    Uses

    None.

Runtime observation: not tracked.

Evidence

Runtime observation: not tracked.

Build attestations: not tracked.

Deployments: not tracked.

Bills of materials: not tracked.

Impact
Relations of spec:cc-agents.mod-layer
The diagram as text
  • spec:cc-agents.exact-answer: The agent's last message is exactly the harness's final answer
  • spec:cc-agents.mod-layer: The mod answers an agent's steps from the sidecar and never calls a model
  • spec:cc-agents.relay-job-type: The job agent takes Relay's header and returns Relay's state block
  • spec:cc-agents.runner: Other model families run as real Claude Code agents
  • spec:cc-agents.sidecar: One sidecar per Claude session owns the session's harness turns
  • spec:cc-agents.steering-and-stop: A message reaches the running turn at once, and a stop ends the harness turn
  • spec:cc-agents.mod-layer dependsOn spec:cc-agents.sidecar · declared — every decision of the mod is a request to the session's sidecar
  • spec:cc-agents.mod-layer refines spec:cc-agents.runner · declared
  • spec:cc-agents.exact-answer dependsOn spec:cc-agents.mod-layer · declared — the final step is one of the steps the mod answers
  • spec:cc-agents.relay-job-type dependsOn spec:cc-agents.mod-layer · declared — a job is an agent the mod spawns and steps like any other
  • spec:cc-agents.runner dependsOn spec:cc-agents.mod-layer · declared — the layer that speaks to Claude Code
  • spec:cc-agents.steering-and-stop dependsOn spec:cc-agents.mod-layer · declared — steering and stopping are hooks of the mod
Mermaid source

Copyable source; the Studio draws static SVG.

Preferred syntax: flowchart. Chosen syntax: labelled flowchart, preserving exact relations, claims and folds.

Rests on

Rested on by

Distance 1

  • spec:cc-agents.exact-answer

    Implementing units

    • impl:cc-agents.mod · plugin/hooks/register.js:9

    Referencing units

    None.

    Enabled verifiers: test:cc-agents.mod-suite

    Packs: None

  • spec:cc-agents.relay-job-type

    Implementing units

    • impl:cc-agents.mod · plugin/hooks/register.js:9
    • impl:cc-agents.relay-header · plugin/sidecar/relay-header.mjs:9
    • impl:cc-agents.sidecar · plugin/sidecar/server.mjs:12

    Referencing units

    None.

    Enabled verifiers: test:cc-agents.mod-suite, test:cc-agents.sidecar-suite

    Packs: None

  • spec:cc-agents.runner

    Implementing units

    None.

    Referencing units

    None.

    Enabled verifiers: None

    Packs: None

  • spec:cc-agents.steering-and-stop

    Implementing units

    • impl:cc-agents.mod · plugin/hooks/register.js:9
    • impl:cc-agents.sidecar · plugin/sidecar/server.mjs:12

    Referencing units

    None.

    Enabled verifiers: test:cc-agents.mod-suite, test:cc-agents.sidecar-suite

    Packs: None

Distance 2

  • spec:cc-agents.adapter-contract

    Implementing units

    • impl:cc-agents.codex · plugin/sidecar/adapters/codex.mjs:15
    • impl:cc-agents.opencode · plugin/sidecar/adapters/opencode.mjs:26
    • impl:cc-agents.sidecar · plugin/sidecar/server.mjs:12

    Referencing units

    None.

    Enabled verifiers: test:cc-agents.opencode-suite, test:cc-agents.sidecar-suite

    Packs: None

  • spec:cc-agents.codex-adapter

    Implementing units

    • impl:cc-agents.codex · plugin/sidecar/adapters/codex.mjs:15

    Referencing units

    None.

    Enabled verifiers: test:cc-agents.sidecar-suite

    Packs: None

  • spec:cc-agents.cross-session-slots

    Implementing units

    • impl:cc-agents.sidecar · plugin/sidecar/server.mjs:12
    • impl:cc-agents.slots · plugin/sidecar/slots.mjs:16

    Referencing units

    None.

    Enabled verifiers: test:cc-agents.sidecar-suite

    Packs: None

  • spec:cc-agents.hq-links

    Implementing units

    None.

    Referencing units

    None.

    Enabled verifiers: None

    Packs: None

  • spec:cc-agents.installation

    Implementing units

    None.

    Referencing units

    • impl:cc-agents.harness-options · plugin/hooks/harnesses.js:5

    Enabled verifiers: None

    Packs: None

  • spec:cc-agents.machine-guard

    Implementing units

    • impl:cc-agents.machine · plugin/sidecar/machine.mjs:20

    Referencing units

    • impl:cc-agents.sidecar · plugin/sidecar/server.mjs:12

    Enabled verifiers: test:cc-agents.machine-suite, test:cc-agents.sidecar-suite

    Packs: None

  • spec:cc-agents.model-templates

    Implementing units

    • impl:cc-agents.harness-options · plugin/hooks/harnesses.js:5
    • impl:cc-agents.mod · plugin/hooks/register.js:9

    Referencing units

    • impl:cc-agents.sync-templates · scripts/sync-templates.mjs:10

    Enabled verifiers: test:cc-agents.mod-suite

    Packs: None

  • spec:cc-agents.opencode-adapter

    Implementing units

    • impl:cc-agents.opencode · plugin/sidecar/adapters/opencode.mjs:26

    Referencing units

    None.

    Enabled verifiers: test:cc-agents.opencode-suite

    Packs: None

  • spec:cc-agents.pane

    Implementing units

    • impl:cc-agents.harness-options · plugin/hooks/harnesses.js:5
    • impl:cc-agents.pane · plugin/hooks/pane.js:13

    Referencing units

    None.

    Enabled verifiers: test:cc-agents.mod-suite, test:cc-agents.pane-suite

    Packs: None

  • spec:cc-agents.sidecar

    Implementing units

    • impl:cc-agents.launch · plugin/sidecar/launch.mjs:7
    • impl:cc-agents.sidecar · plugin/sidecar/server.mjs:12

    Referencing units

    None.

    Enabled verifiers: test:cc-agents.sidecar-suite

    Packs: None

  • spec:cc-agents.work-containment

    Implementing units

    • impl:cc-agents.groups · plugin/sidecar/groups.mjs:13
    • impl:cc-agents.guard · plugin/sidecar/guard.mjs:16

    Referencing units

    None.

    Enabled verifiers: test:cc-agents.sidecar-suite

    Packs: None

Relations

Relation and directionOther endClaimReasonExercised keys
dependsOn · outgoingOne sidecar per Claude session owns the session's harness turns
spec:cc-agents.sidecar · resolves
declaredevery decision of the mod is a request to the session's sidecarNone
refines · outgoingOther model families run as real Claude Code agents
spec:cc-agents.runner · resolves
declaredNoneNone
dependsOn · incomingThe agent's last message is exactly the harness's final answer
spec:cc-agents.exact-answer · resolves
declaredthe final step is one of the steps the mod answersNone
dependsOn · incomingThe job agent takes Relay's header and returns Relay's state block
spec:cc-agents.relay-job-type · resolves
declareda job is an agent the mod spawns and steps like any otherNone
dependsOn · incomingOther model families run as real Claude Code agents
spec:cc-agents.runner · resolves
declaredthe layer that speaks to Claude CodeNone
dependsOn · incomingA message reaches the running turn at once, and a stop ends the harness turn
spec:cc-agents.steering-and-stop · resolves
declaredsteering and stopping are hooks of the modNone

Bindings

Implementation binding: present

  • impl:cc-agents.mod · answers each step of an agent from the sidecar's events, hands back the exact answer, steers and stops, and returns the job state block · plugin/hooks/register.js:9

Design reference: none

Verifier binding: present

  • test:cc-agents.mod-suite · the mod against a scripted sidecar · anchored · plugin/tests/mod.test.ts:4 · test anchor

Expected-outcome oracle: none

Runtime observation: not tracked.

Run results: not recorded in the graph.

Findings

None.

Composing (0)

Composing needs the script.