Lifecycle-Long Stale-Base Prevention & Mid-Task Worktree Sync
Agents Remember 2.8.0
Base-currency becomes a lifecycle-long guarantee (GitHub #54): every stage of a task — session start, worktree start, and mid-task — can now see when its view of the official line went stale, and pull the official line in safely instead of silently building on old code and memory.
Highlights
- Stale-base preflight:
worktree_startrefuses to base a new worktree on a source branch that is behind or diverged from its remote — withstale_base_choice="fast-forward"(the tool fast-forwards and proceeds) or"proceed-stale"recoveries. A stale base doesn't just produce wrong code: it silently defeated the provider seed fast-path into a multi-minute reindex. - New
worktree_synctool: pull a moved official line into a live worktree atomically — the new code tip must be ledger-mapped at the official memory tip, the code work branch merges (conflicts abort cleanly), parked memory fast-forwards, and the contract's recorded base pair advances with a durablesync_log. Sync early — before memories are written — and end-of-series integration staysff-onlywith no carryover reconciliation. - Memory main keeps up:
memory_carryover_applynow fast-forwards memorymainto the official checkout tip (memory_main_advance), so cycles run on non-main source branches no longer leave memorymainbehind indefinitely.
Freshness Checkpoints
context_packetgains an opt-ininclude_freshnesssection: upstream ahead/behind for the code and memory checkouts plusledgerMapsCodeHead, forming the lifecycle-start trust checkpoint (the l-01 skill opts in).worktree_statuscarries a fetch-freefreshnessblock (recorded base pair vs local source tips) with asyncHintrecommendingworktree_sync— network-free, so the background provider-setup polling loop stays fast.- A missing external-memory source branch is auto-created at the official memory tip using the code source branch name as template — one less manual step before
worktree_start.
Onboarding And Memory
- Runtime skills (l-01, c-09, c-11) teach the three checkpoints and the sync-early-before-memories doctrine.
- The
providers.contextfacade import-order fix (landed with 2.7.0) is now pinned by fresh-interpreter regression tests on Python 3.11. - Change-notification ping transport for the freshness payload is tracked as follow-up #60.