Skip to content

Builder context reset should be a first-class flow: save-state → /clear → re-orient #1273

Description

@waleedkadous

Problem

Long-running builders (multi-phase ASPIR/SPIR lanes) exhaust their context window repeatedly. afx spawn --resume reattaches the SAME conversation, so a deep session resumes deep — it does not give the builder a fresh window. Today (shannon, 2026-07-27) we hand-ran a full reset on a coordinator builder that worked well, recommended by the operator:

  1. Architect instructs the builder: write complete working state to an UNTRACKED file at the worktree root (role, receipts, open questions, standing orders — written for a cold reader; untracked because porch done sweeps staged files).
  2. Architect verifies the file exists and is substantive before proceeding (ours was 203 lines).
  3. Architect sends /clear via afx send <builder> --raw.
  4. Architect sends a re-orientation message: role + protocol + worktree/branch, pointer to the state file, plus anything that post-dates the save.

This is ~4 manual steps with two failure modes the tooling could eliminate: clearing before the save lands (state loss), and the re-orientation omitting the role/protocol frame (builder drifts).

Ask

An afx reset <builder> (or afx spawn --reset) that automates the sequence: request save-state, wait for the file, /clear, then send a templated re-orientation assembled from the builder registry (protocol, worktree, branch) + the state-file pointer + optional architect-supplied addendum. Porch-strict lanes should re-inject the porch phase context the same way --resume does.

Related prior art: the boundary-recycle pattern (/exit + spawn --resume) that this improves on, and codev#1260's target-by-convention discussion.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/towerArea: Tower server / agent farm CLI

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions