Skip to main content

Session handover engine for AI coding agents: checkpointed, resumable, backend-agnostic persistent memory.

Project description

agent-handover

Session handover engine for AI coding agents: checkpointed, resumable, backend-agnostic persistent memory.

AI coding agents (Claude Code, Codex, OpenCode, Cline, ...) are stateless between sessions. Every new session starts with re-explaining the project, the decisions already made, and what was left half-done. agent-handover is the small piece of infrastructure that fixes this: at the end of a session the agent writes a structured handover; at the start of the next one, it resumes from it — even if the previous handover crashed halfway.

Extracted from a personal "AI Team OS" that has run daily handovers across multiple machines and agents since 2025.

The problem

  • Context loss: the next session doesn't know what the last one decided.
  • Half-written state: a handover that dies mid-run silently corrupts memory. The next session boots from a state that is partly updated — worse than stale.
  • Remote memory is fragile: vector DBs and hosted notebooks go down. If your agent's memory has no local fallback, your agent has no memory.

Design

┌─ session ends ──────────────────────────────────────────────┐
│  HandoverEngine(steps, checkpoint, pause_file)              │
│    step 1: collect session facts          ── checkpointed   │
│    step 2: MemoryStore.write(layer=1...)  ── checkpointed   │
│    step 3: MemoryStore.write(layer=2...)  ── checkpointed   │
│    step 4: GitBackend.publish(...)        ── checkpointed   │
└──────────────────────────────────────────────────────────────┘
┌─ next session starts ───────────────────────────────────────┐
│  $ agent-handover check    # 0=clean  1=RESUME  2=completed │
│  read layer2/current-state.md  →  agent has context again   │
└──────────────────────────────────────────────────────────────┘

Three memory layers, all plain Markdown (git-friendly, diff-able, readable by humans and any agent that can read a file):

Layer File pattern Semantics
1 layer1/YYYY-MM/<tag>-<date>.md session notes (append, dated)
2 layer2/current-state.md "where are we now" (always overwritten)
3 layer3/YYYY-MM-<tag>-archive.md monthly compaction of old notes

Three rules learned in production:

  1. Every step is checkpointed. An interrupted handover is detected (agent-handover check → exit 1) and resumed without re-running done steps.
  2. A PAUSE file is an absolute kill-switch. Agents that write to your repos need a brake a human can pull with touch PAUSE.
  3. The filesystem is the source of truth. Remote layers (NotebookLM, vector stores) are optional accelerators; the local copy is always enough to boot.

Install

pip install agent-handover   # or: pip install -e . from a clone

Usage

from pathlib import Path
from agent_handover import Checkpoint, HandoverEngine, MemoryStore, Step, GitBackend

store = MemoryStore("memory/")
cp = Checkpoint(".agent-handover/checkpoint.json")
git = GitBackend(".", paths=["memory/"])

engine = HandoverEngine(
    steps=[
        Step("session_note", lambda: store.write(1, notes, tag="refactor")),
        Step("current_state", lambda: store.write(2, snapshot)),
        Step("publish", lambda: git.publish("handover: session sync")),
    ],
    checkpoint=cp,
    pause_file=Path.home() / ".agent_handover" / "PAUSE",
)
engine.run()  # resumes pending steps automatically after a crash

In your agent's bootstrap (CLAUDE.md / AGENTS.md):

agent-handover check   # exit 1 → finish the interrupted handover first

Status & roadmap

  • checkpointed engine, 3-layer Markdown store, git backend, pause guardrail
  • handover quality scoring (was the note actually useful next session?)
  • adapters: NotebookLM, sqlite-vec
  • agent-handover run with declarative step config (TOML)

Issues and PRs welcome — especially reports from other agent stacks (Codex CLI, Cline, OpenCode).

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agent_handover-0.1.0.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agent_handover-0.1.0-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file agent_handover-0.1.0.tar.gz.

File metadata

  • Download URL: agent_handover-0.1.0.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for agent_handover-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6737c64743f1d2c38bb1a4b91f8e8542b6f31c0323fecac92e4c3c494d36b089
MD5 9b526e0635ac59eb6136d1719e4a21c6
BLAKE2b-256 c1408037f0bda4fb5aeaa2da76f8e0b5a134cf2d87d5176a8ba3eb42476ea9e1

See more details on using hashes here.

Provenance

The following attestation bundles were made for agent_handover-0.1.0.tar.gz:

Publisher: publish.yml on hikari716/agent-handover

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file agent_handover-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: agent_handover-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for agent_handover-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1bb67173a837061e04ad8e8c8d1c16660a7c7414cb96d4d7d1266df197987866
MD5 c6cb9a0da7ecba093f8a1ef16452218c
BLAKE2b-256 87b3c68fcbaaae58e3db6639ac8b14772d79c1192ee6a96a89b0569761bd77cc

See more details on using hashes here.

Provenance

The following attestation bundles were made for agent_handover-0.1.0-py3-none-any.whl:

Publisher: publish.yml on hikari716/agent-handover

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page