← All Labs Lab 27 / 28 Side questions on a tool-less fork
Lab 27 · Durable agents · Learned

Side questions on a tool-less fork

Questions about a finished beat run on one fork per beat, taken at that beat's answer with tools [], so they never reach a tool, see only the session up to that beat, build on each other, and leave the main conversation unchanged.

Learned Needs: tool-calling Smoke: pnpm exec tsx examples/27-side-questions-on-a-fork/run.ts --smoke Run: pnpm exec tsx examples/27-side-questions-on-a-fork/run.ts Source: examples/27-side-questions-on-a-fork

A durable coding agent with its own git workspace finishes a beat: one user message and everything the agent does until it waits for you again. While it waits, you want to ask about the session ("what was the intent?", "is this finished?", "what should I check?") without the agent doing anything.

This lab asks those questions on a fork of the session, made at the beat's answer with habitat.fork(entryId, { tools: [] }). The fork shares everything up to the beat (Lab 07: it copies nothing), its model is offered no tools, and follow-up questions go to the same fork. It's the mechanism under the planned chat-sidebar lab (28).

zsh
pnpm exec tsx examples/27-side-questions-on-a-fork/run.ts            # narrated, offline faux model
pnpm exec tsx examples/27-side-questions-on-a-fork/run.ts --smoke    # PASS/FAIL lines, exit 1 on any failure
MYCEL_URL=https://mycel.thefocus.ai pnpm exec tsx examples/27-side-questions-on-a-fork/run.ts \
  --live --model mycel:deepseek/deepseek-v4.1-flash

Add --keep to keep the temp root. The run does two beats (write src/slug.ts, then a README.md), forks at beat 1, asks three questions on that fork, then runs a third beat on the main conversation.

Checks

The offline model is adversarial: on a lens question it calls write whenever write is offered.

CheckWhat it proves
beat-used-toolsThe control: on a main beat the model is offered write and uses it.
lens-never-reaches-a-toolThe fork's own entries have no tool call or result, and the workspace's git state is identical. Also checked live.
lens-offered-no-toolsEvery lens request offers an empty tool set, replaying the request's toolsAdded/toolsRemoved.
lens-sees-up-to-its-beatAsked after beat 2, the lens on beat 1 carries beat 1's message and not beat 2's.
follow-ups-share-the-forkThe third question's request carries all three questions: one fork per beat.
main-continues-unchangedThe main conversation's entries are identical across the questions, and its next turn carries no lens question. Also checked live.

Live mode can't see the requests, so it runs only the two checks marked live.

Break it

In DurableHabitat.fork (durable-habitat.ts), drop the line that passes tools into the fork's agent. The fork keeps the parent's six tools, the lens writes lens-leak.txt into the workspace, lens-never-reaches-a-tool and lens-offered-no-tools fail, and the smoke exits 1.

Files

  • run.ts: the beats, the lens fork and the checks.
  • PROMPT.md: the prompt to rebuild this lab.
  • FINDINGS.md: what we learned.

Prompt

Coding-Agent Prompt · Ready to Paste
Build `examples/27-side-questions-on-a-fork/`: a lab that tests one thing: questions about a finished beat of a durable coding agent run on one fork per beat, made with `habitat.fork(answerEntryId, { tools: [] })`, so they never reach a tool, see only the session up to that beat, build on each other, and leave the main conversation unchanged.

Read first: `packages/habitat/src/durable/durable-habitat.ts` (`ask`, `fork` and its `tools` option, which is pi-durable's `AgentChange.tools`), `examples/07-durable-forks/run.ts` (faux model wiring and entry paging), and `SystemMessage` in `@earendil-works/pi-ai` (the offered tools are the replay of `toolsAdded`/`toolsRemoved`). Do not import from other example folders.

1. One file, `run.ts`. In a `mkdtemp` root, `git init` an `owned-app/` workspace with a baseline commit and open a SQLite `DurableHabitat` with `env: "local"` and `ownedRepoRoot`.
2. Offline faux model (default): on main beats, "write <file>" / "in <file>" becomes a `write` tool call with `{ stopReason: "toolUse" }`. On lens questions it calls `write` whenever `write` is offered (adversarial). Record every request's phase, offered tools and user messages. `--live --model <provider:model>` uses `resolvePiModel(parseModelSpecString(spec))`, for example `mycel:deepseek/deepseek-v4.1-flash`.
3. Run two beats on root, fork at beat 1's answer with `tools: []` and reviewer instructions, ask three questions on that fork (intent, finished or waiting, and one that refers to the previous answers), then run a third beat on root.
4. Checks, one `PASS <name>: …`/`FAIL <name>: …` line each, exit 1 on any failure: beat-used-tools (control), lens-never-reaches-a-tool (no tool entries on the fork, git state unchanged), lens-offered-no-tools, lens-sees-up-to-its-beat (beat 1's message, not beat 2's), follow-ups-share-the-fork, main-continues-unchanged (root entries identical, next turn carries no lens question). Live runs only the checks that don't need request recording.
5. Strict TypeScript, zero `any`; close the habitat and remove the temp root in `finally`. README with frontmatter, a check table and a Break it section, and FINDINGS.md.
Works in Pi, Claude Code, Codex & Antigravity Offline mock first → --live opt-in

What we learned

The answer

A tool-less fork is enough to ask questions about a session without the agent acting. habitat.fork(answerEntryId, { tools: [] }) stores an empty tool filter on the fork. Every request on it offered no tools, its entries held no tool calls, and the workspace was unchanged, even with a model that calls write whenever it can. The main conversation's entries were identical before and after, and its next turn didn't see the questions.

Live on DeepSeek V4.1 Flash through Mycel (2026-12-01), asked about beat 1 after beat 2 had run:

  • Intent: "The user asked me to create a slugify(text) function in src/slug.ts that lowercases text and joins words with dashes."
  • Finished or waiting: "Finished. The requested file src/slug.ts was written … the closing note offering an ASCII-only variant was just an optional suggestion, not a question."
  • What to check: it pointed out the implementation does more than asked (strips punctuation, collapses dashes, keeps Unicode letters).

None of the answers mentioned the README from beat 2, which the fork can't see.

Findings

  • DurableHabitat.fork needed a tools option. It passed only model and instructions into the fork's agent. It now passes tools through (pi-durable AgentChange.tools), with a unit test in durable-habitat.test.ts that fails without it.
  • The filter removes tools; it doesn't hide the old ones. The fork's requests still carry the parent's toolsAdded system messages, followed by a toolsRemoved. The offered set is the replay of both, so check that, not toolsAdded alone. Keeping the parent's prefix intact is also what lets a provider reuse its prompt cache.
  • The fork takes AgentChange types, not AgentState. AgentState.tools is a list of names, but ConversationCreateOptions.agent is an AgentChange, whose tools are registrations. [] is valid for both.
  • The model answers in the agent's voice. Live, the lens said "The user asked me…", because the fork is the agent's own conversation. The reviewer instructions don't change that.

Not tested

  • Prompt-cache hits on the fork. The fork reuses the parent's prefix, but this run didn't read cached_tokens.
  • Questions while a beat is still running. The lab asks only once the agent is idle.
  • Many beats, many forks. One fork per beat could leave a lot of forks in a long session.

Smoke run

Visual Target Wireframe ASCII Layout
PASS beat-used-tools: beat 1 offered [bash, edit, publish_ui_resource, read, tool_search, write] and wrote src/slug.ts (the faux model does call tools when offered)
PASS lens-never-reaches-a-tool: 7 fork entries, 0 with a tool call or result; workspace unchanged
PASS lens-offered-no-tools: 3 lens requests, tools offered: [] [] []
PASS lens-sees-up-to-its-beat: first lens request carries beat 1's message: true; beat 2's: false
PASS follow-ups-share-the-fork: third lens request carries all 3/3 lens questions
PASS main-continues-unchanged: main entries identical across the lens questions; next main turn carries no lens question