Skip to content

Commit 320ecf1

Browse files
committed
docs: subagent notebook lanes (Phase 5)
1 parent 7e223cd commit 320ecf1

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ projects/
8888
- **Interview tool (clarifying questions).** The `interview` custom tool (`server/src/agent/interview.ts`) blocks the run on a pending-answer promise; the questions ride the normal `tool_start` SSE frame and the chat UI renders them as an inline form (`web/src/components/interview-form.tsx`), POSTing answers to `/sessions/:id/interview/:toolCallId`. Tool `promptGuidelines` + the seeded `AGENTS.md` push the agent to interview liberally before assuming. Question schema mirrors pi-interview (single/multi/text/image/info, recommended/conviction/weight, code `content`, image/table/mermaid/chart/html `media`); user-uploaded images return to the model as image blocks. Deliberately NOT exposed to sub-agent child processes — they are headless and must not block on user input.
8989
- **Thinking level.** Each chat tab has a per-run thinking-level selector (`web/src/components/thinking-selector.tsx`, default `high`); the run body's `thinkingLevel` is validated by `server/src/agent/thinking.ts` and applied via Pi's `session.setThinkingLevel()` after `setModel`. Ollama and Fusion runs send no level (chip disabled). Caveat: like `setModel`, Pi's `setThinkingLevel` also persists the value as the **global default** in `~/.pi/agent/settings.json` — so the last level picked in any tab becomes the starting level for subagent child `pi` processes and for the user's own `pi` CLI. Pin a `thinking` level in a specialist's frontmatter if a subagent must not inherit it.
9090
- **Modal remote compute (`modal_run`).** Gated on `MODAL_TOKEN_ID`/`MODAL_TOKEN_SECRET` (managed live via `/credentials`; `modalConfigured()` in `server/src/config.ts`). `server/src/agent/modal-tool.ts` is an in-process custom tool, registered in `session-registry.ts` only when configured. It uses the `modal` JS SDK to create an isolated Sandbox on a chosen instance (`server/src/agent/modal-instances.ts` catalogue — `cpu`→`h100`, with GPU string + hourly rate), stages `files_in`, runs the command, copies `files_out` back into the local sandbox (which stays the canonical filesystem — no split-brain), and ledgers wall-time × rate as a `compute` row. The per-chat instance is picked in the UI (`web/src/components/compute-selector.tsx`, gated on `modalConfigured`) and threaded through the run body → `setSessionComputeTarget` → the tool's session default. Like `interview`, it is an in-process custom tool, so it is NOT seen by sub-agent child `pi` processes; promoting it to a Pi package (mirroring web-access) would extend it to them. No secrets are injected into the sandbox by default.
91-
- **Living Lab Notebook (`notebook`).** The `notebook` in-process custom tool (like `interview` and `modal_run`) is available only to the lead agent; sub-agent child processes do not see it entries are authored by the lead only. A Phase 5 follow-on would promote it to a Pi package to extend notebook entries to subagents and render them in per-role lanes.
91+
- **Living Lab Notebook (`notebook`).** The lead agent uses an in-process `notebook` custom tool (like `interview` and `modal_run`) to write entries live to the notebook. Subagents get the tool via the vendored `kady-notebook` Pi package (referenced from `sandbox/.pi/settings.json`, like pi-web-access); the package registers the tool only in child processes (gated on `PI_SUBAGENT_CHILD` env var) so it never collides with the lead's tool. When a subagent finishes, its notebook entries are harvested from its session JSONL file, role-stamped with the agent name, and appended to the parent notebook (the parent is the single writer). Subagent entries appear batch-on-completion, not live token-by-token; for asynchronous/background subagents, entries may appear on the next notebook fetch if the child finishes after the parent run ends. Nested subagents (depth > 1) are not harvested in this version.
9292
- **OpenRouter cost** is read from Pi's `usage.cost` (computed from `model.cost`). For synthesized OpenRouter models the pricing comes from `web/src/data/models.json`; keep that catalogue current for accurate cost.
9393
- **Node ≥ 22.19** is what Pi targets; lower 22.x usually works but emits an `EBADENGINE` warning. Node < 22 (e.g. v20) fails to build/install the packages, so `start.sh` refuses to run on it.
9494
- **Don't run our source through `tsc` for emit** — both dev and prod run via `tsx`; `tsconfig.json` is `noEmit` for typechecking only.

docs/lab-notebook.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@ Each chat tab (session) has its own notebook; closing the tab does not delete en
3232
- **Auto-scroll.** The view scrolls to the newest entry as they arrive.
3333
- **Empty state.** Before any entries are logged, the notebook shows a friendly message.
3434

35+
## Subagent lanes
36+
37+
The notebook groups entries into collapsible per-agent lanes. The lead agent's entries appear in the "Kady (lead)" lane first, followed by a lane for each subagent that contributed entries (labeled by agent name, with an entry count). A notebook with only lead entries (no subagents) displays without explicit lane headers—unchanged from before.
38+
39+
Subagent entries appear when the subagent finishes, as a batch, not live. For asynchronous/background subagents that finish after the parent run ends, entries may only appear on the next notebook fetch or page reload.
40+
41+
**Limitation:** Nested subagents (depth > 1) are not harvested in this version — only direct children contribute.
42+
3543
## Export and print
3644

3745
- **Markdown export.** The notebook view has an "Export as Markdown" button that downloads a file with a header, per-entry sections, embedded figures from artifacts, and inline code.

0 commit comments

Comments
 (0)