The /refine endpoint reviews a harness's current trajectory and applies small, evidence-backed updates to supplemental state — prompts, memories, skill descriptions, subagent specs — while preserving the immutable base system prompt and maintaining rollback-safe snapshots. Refine operates both as an IPython-callable skill (scheduling updates without blocking the current turn) and as an endpoint with output budgets derived from the selected model, preventing silent truncation of large proposals.
/refine reviews the current trajectory and can apply small, evidence-backed updates to supplemental harness state — supplemental prompts, memories, skill descriptions, and subagent specs — with recorded snapshots that support rollback; it never rewrites the immutable base system prompt.[1] As of v0.3.3, an agent-callable refine skill lets the model schedule continual harness refinement from IPython via await refine.run() without blocking the current turn.[2] In v0.5.1, /refine was fixed to derive output budgets from the selected model rather than a fixed 4096-token cap, so large multi-edit proposals are no longer truncated mid-string with an opaque JSON parse error; a truncated reply now reports the exhausted budget directly.[3] Refinement pass status and final outcomes are propagated through the message queue and rendered in both interactive and headless modes via structured result messages. Refinement outcome messaging is implemented across packages/coding-agent/src/core/messages.ts, agent-session.ts, components/refinement-outcome-message.ts, modes/headless-completion.ts, and components/conversation-components.ts; test coverage lives in test/refinement-outcome-message.test.ts.
Sources