Pi Subagents Guide
OpenCode is the canonical control plane for this repo.
This guide describes the secondary Pi-native integration. It follows the same local workflow:
- no hosted Autolab backend
- no Gastown assets or terminology
- local promoted master in
train_orig.py,research/live/master.json, andresearch/results.tsv - managed benchmark runs through Hugging Face Jobs
- observability through Trackio
Checked-In Pi Assets
.pi/settings.jsonProject Pi settings. It declares thepi-subagentspackage and keeps Pi session files under.runtime/..pi/APPEND_SYSTEM.mdParent-session Autolab coordinator guidance appended to Pi's default prompt..pi/agents/Project agents:planner,reviewer,researcher,reporter,memory-keeper, andexperiment-worker..pi/prompts/autolab.mdA reusable/autolabparent-session kickoff prompt.scripts/print_pi_kickoff.pyPrints a standard parent-session prompt.scripts/pi_worker.pyCreates isolated worktrees and launchesexperiment-workerthrough Pi.
Setup
Install Pi once if it is not already available:
npm install -g @mariozechner/pi-coding-agentFrom the pre-training project root, start Pi:
piThe project .pi/settings.json declares npm:pi-subagents@0.22.0. Pi should install missing project packages on startup. If you prefer to install the package explicitly, run:
pi install npm:pi-subagents@0.22.0 -lAuthenticate a provider with /login, or start Pi with the provider API key in the environment.
Parent Session
Refresh current benchmark truth before planning:
uv run scripts/refresh_master.py --fetch-dagPrint a kickoff prompt if you want a copy-paste skeleton:
uv run scripts/print_pi_kickoff.py --gpu-slots 1Start Pi in the pre-training project root and run the project prompt template:
/autolab "recent-master: follow-ups" 1 3The parent session should use:
plannerfor fresh queuesreviewerfor rule and comparability checksresearcherfor paper-derived ideasreporterfor HF Jobs and Trackio statusmemory-keeperfor durable markdown updates in the main checkoutexperiment-workeronly from reserved experiment worktrees
Useful Pi Commands
/run planner "Propose up to 3 fresh single-change experiments for the current campaign."
/run reviewer "Review this planned experiment for stale-master, duplicate, and multi-change risk."
/parallel reporter "Summarize active HF Jobs and Trackio anomalies." -> reviewer "Check whether the next launch is comparable."
/run memory-keeper "Record this completed worker summary in the durable notebook."pi-subagents also scans legacy .agents/**/*.md files. In this repo that means the shared .agents/skills/*/SKILL.md files can appear in /agents. Treat the canonical Pi role agents as the files under .pi/agents/.
Pi supports background subagent runs with --bg, but do not exceed real GPU capacity for active experiment workers.
Experiment Worker Flow
Create one explicit worktree reservation per experiment:
uv run scripts/pi_worker.py create exp-warmdown-20 \
--campaign "schedule: shorter cooldowns" \
--hypothesis "Shorten warmdown to test whether the long cooldown tail is wasting the fixed budget."Launch the worker:
uv run scripts/pi_worker.py run exp-warmdown-20The launcher runs Pi from the reserved worktree, invokes the project experiment-worker agent, and exports:
AUTOLAB_CAMPAIGNAUTOLAB_EXPERIMENT_IDAUTOLAB_WORKER_IDAUTOLAB_HYPOTHESISAUTOLAB_LOG_PATHAUTOLAB_EXPERIMENT_NOTE
Use --dry-run to inspect the exact pi -p command and environment without starting the worker.
When the run is fully recorded by memory-keeper, remove the worktree:
uv run scripts/pi_worker.py cleanup exp-warmdown-20Worktree Rules
The pi-subagents package has its own worktree option for generic parallel coding tasks. For paid Autolab experiments, prefer scripts/pi_worker.py instead because it reserves the experiment id, worktree, note path, and log path using the same repo-local state as the OpenCode and Hermes launchers.
The parent Pi session stays in the main checkout. Experiment workers run from