Adds a first-class registerTool (R14 'proper tool usage') so the Pi
agent can load its active Mosaic mission, milestone progress, task
counts, and latest scratchpad as a tool call before planning — instead
of shelling out or guessing. Reuses detectMission/buildMissionSummary;
returns AgentToolResult text + structured details. promptGuidelines
names the tool explicitly per the pi extension authoring contract.
Tool shape verified against @earendil-works/pi-coding-agent@0.79.9
ToolDefinition (name/label/description/promptSnippet/promptGuidelines/
parameters + execute(toolCallId,params,signal,onUpdate,ctx)).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EsgTQzV5YUGk1JtCLP4B83
WIP — not for merge yet. Implements the core of the custom Pi harness (R14/R15):
- runtime/pi/mosaic-extension.ts: native heartbeat — writes the same .hb contract
(ts/pid/status[/model]) on a MOSAIC_HEARTBEAT_INTERVAL timer; turn_start/turn_end
flip status busy/ok; model self-report via ctx.model; touches a .hb.native
precedence marker. Also FIXES a latent bug: session_end -> session_shutdown (the
old handler never fired) + corrects the import scope to @earendil-works/pi-coding-agent.
- start-agent-session.sh: sidecar DEFERS when the .hb.native marker is fresh
(< 2x interval), else writes the fallback — native precedence, sidecar fallback,
same contract so fleet ps is agnostic (per Lead's design). Generated script
validated (bash -n) + deferral/fallback behavior tested.
REMAINING before PR: surface model in `fleet ps` (parseHeartbeat + row); vitest for
the native-HB writer; "proper tool usage" (registerTool) piece; rebase onto #599's
%q sidecar (overlap on the printf line).
Refs #588
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>