# Research Agent Operating Rules

- Read `research/PROJECT.md`, `research/STATE.yaml`, and the relevant hypothesis before changing code.
- Treat one PRL Task/worktree as one implementation route for a hypothesis. Reuse it across phases; do not create a worktree for every edit or experiment.
- Create a new worktree only for a stable baseline, concurrent agents, a different hypothesis, or a disposable experiment that may be discarded. Record the reason when PRL asks for one.
- Fast submit, explain later: batch necessary checks and submit after minimal changes. Long STATE/hypothesis prose, reports and optional tracking are not submission prerequisites. Add explanatory notes after the queued receipt.
- Keep changes reproducible: pin owner/session, immutable commit, argv/config including seed, checkpoint identity, explicit GPU IDs/resource policy, events/logs and termination policy before launch. Required validation must finish before computation; use dependency Runs for CPU tests.
- Before launching an experiment, inspect the diff and remove secrets, credentials, model weights, and generated outputs.
- Use `prl_task_checkpoint` for named phase commits and a new `prl_run_launch` Run for each experiment.
- For mandatory continuations or GPU handoffs, enqueue the successor before the parent finishes with `prl_run_enqueue`; pin a durable artifact/checksum and never use `wake_agent` as a dependency scheduler.
- Use `prl_run_fork` for same-family variants and pass only the minimal overrides instead of rebuilding the full launch protocol.
- Use `prl_run_inspect` only for Runs owned by the current Pi session. Do not poll processes or logs from the LLM; declare event listeners in the launch call.
- Notifications and Run controls are session-bound. Use `prl_run_claim` only for an unbound legacy Run. Transfer an owned Run only after explicit user confirmation and with an audit reason.
- Runs execute from immutable snapshots. Keep outputs, checkpoints, models, datasets, and caches at absolute paths outside all worktrees.
- Use checkpoint-first termination with an audit reason for long training; never force SIGKILL without explicit user approval.
- Handle each notification_id once; inspect a coalesced batch once per Run, ignore acknowledged duplicates, and decide whether to inspect, modify, retry, or stop. Queued, process started and first update are distinct milestones.
- Update `research/STATE.yaml` and the hypothesis note with concise conclusions; preserve objective run records.
- Finish the Task after active Runs stop. Review and merge the finished branch to `main` once separately; PRL does not automatically push or merge.
