← Back to .knowledge

// Blog / team workflow

Agent handoff between coding sessions without losing repo context

A useful handoff is not a chat recap. It is a repo-local pointer to what changed, what is trusted, and what must be rechecked.

// direct answer

Short answer

Handoff works when the repository stores the continuation point: routing bundle, handoff summary, trust report, repair queue, changed files, and current source-of-truth rules. The next agent should treat chat recap as advisory and re-read source for critical behavior.

Move work from one coding-agent session to another without losing repo context or trust warnings.

// real failure mode

The failure mode

A session ends with useful context in the agent's answer, but none of it is durable or easy to verify.

The next session starts cold, misses a warning, or repeats the same investigation.

The team thinks it handed off work, but it only handed off prose.

// handoff model

The repo-local fix

A handoff should point to files, trust state, changed areas, and repair items.

The handoff summary is useful only when it routes the next agent to source, tests, and evidence.

After meaningful work, rebuild routing and search so the next session sees the current map.

// concrete example

A safe session restart

The first agent updates docs and finds stale module context, but does not finish repair.

Before ending, it refreshes the routing bundle and leaves a handoff summary that points to the stale module and repair queue item.

The next agent reads those artifacts and rechecks source before continuing instead of trusting the prior conversation.

// repo proof

Repo proof to inspect

Handoff summary

.knowledge/maintenance/handoff_summary.json

The next agent needs a compact continuation point with routes, risks, and pending work.

Use it for
  • Session continuation
  • Finding recent context
Do not use it for
  • Skipping source recheck
  • Treating chat recap as truth
Append-only events

.knowledge/maintenance/events/

Events preserve maintenance actions across sessions.

Use it for
  • Understanding recent maintenance
  • Auditing changes to knowledge state
Do not use it for
  • Replacing git history
Open repair work

.knowledge/maintenance/repair_queue.json

Unfinished uncertainty should be visible to the next agent.

Use it for
  • Picking up incomplete work
  • Prioritizing rechecks
Do not use it for
  • Blocking unrelated edits
Current route

.knowledge/maintenance/routing_bundle.json

The next session should start from the current route, not a stale conversation.

Use it for
  • First read
  • Finding module boundaries
Do not use it for
  • Behavior proof

// command transcript

Commands and expected checks

node .knowledge/tools/build-routing-bundle.js
expected
The compact routing file is current for the next session.
inspect next
.knowledge/maintenance/routing_bundle.json
node .knowledge/tools/build-search-index.js
expected
Local search reflects current knowledge artifacts.
inspect next
.knowledge/search/index.json
node .knowledge/tools/doctor.js
expected
The next agent sees whether it should use caution.
inspect next
.knowledge/maintenance/quality_report.json
Handoff timeline repo-local proof

From one session to the next

01 Session A changes or investigates a module.
02 Knowledge maintenance refreshes route, search, trust, and handoff state.
03 Repair queue captures unresolved uncertainty.
04 Session B starts from repo-local artifacts and rechecks source as needed.

// field guide

Handoff artifacts

A handoff should leave inspectable files, not just a friendly summary.
ArtifactCarriesNext agent should
Handoff summaryRecent context and warnings.Use it to choose what to inspect.
Routing bundleCurrent first-read map.Open target source and tests.
Repair queueUnresolved context debt.Repair, assign, or document.
EventsMaintenance actions.Audit what changed since last session.

// guardrails

What the agent should not trust blindly

  • Treat handoff prose as advisory until current source confirms it.
  • Do not hide unresolved uncertainty in a final chat message.
  • After meaningful changes, rebuild routing and search before handoff.

// common mistakes

Common mistakes

  • Ending with a long summary but no file-backed route.
  • Assuming the next agent will remember a warning from chat.
  • Not marking stale context discovered during the session.

// quick FAQ

FAQ

Is a chat summary still useful?

Yes, but it should point to repo-local artifacts and current source files. It should not become the source of truth.

What should be refreshed before handoff?

At minimum, routing, search, and doctor status after meaningful knowledge or source changes.

// page-specific next step

Use this page before ending a coding-agent session

Refresh the repo-local route, make unresolved repair work visible, and make the next agent re-read source for risky behavior.