# agent-archive

> A CLI that archives Claude Code, Codex, and Cursor sessions to your own S3 or R2 bucket and hands them off between agents or machines.

agent-archive is an open-source command-line tool published under the MIT License by GitHub user wangjohn. It records coding-agent sessions from Claude Code, Codex, and Cursor, optionally backs them up to a user-owned S3 or R2 bucket, and lets you continue a session in a different agent. The latest release listed is v0.2.2.

## What It Is

agent-archive is a session history and handoff utility for AI coding agents. It addresses the loss of conversation context when switching between agents, computers, or accounts. You can pick a prior Claude Code or Codex session and bring its conversation context into another agent, and you can browse sessions from all supported agents in one place.

## How the workflow runs

Setup edits each included app's hook settings and adds a background job: a LaunchAgent on macOS or a systemd user timer on Linux. Lifecycle hooks record sessions to local state. A collector then filters, bundles, uploads, and verifies transcripts in your bucket every 60 seconds. Setup also writes skill files so Claude Code, Codex, and Cursor can find and load earlier sessions by name. Old sessions are deleted from the bucket after 90 days by default.

## Commands for browsing and analysis

The CLI includes commands to list sessions filtered by topic, project, branch, or PR number, search conversation text in a private local index, and show a session summary or transcript. A stats command reports session counts, tokens, and estimated spend by agent, model, and project. A backfill command previews sessions already on the machine for import, and pause and resume control collection.

## Setup path

The install script supports release binaries for macOS (Intel and Apple Silicon) and Linux (x86-64 and arm64). Running handoff works without a bucket. Running setup enables automatic archiving to your own S3 or R2 storage and access from other machines.

## Features
- Hand off sessions between Claude Code and Codex
- Automatic archiving of Claude Code, Codex, and Cursor transcripts to S3 or R2
- Browse and filter sessions by topic, project, branch, or PR number
- Local full-text search of conversation text
- Usage and estimated spend stats by agent, model, and project
- Backfill of existing local sessions
- Pause and resume collection
- Agent skill files for continuing sessions by name
- Multi-machine access via shared bucket

## Integrations
Claude Code, Codex, Cursor, Amazon S3, Cloudflare R2, launchd, systemd

## Platforms
MACOS, LINUX, API, CLI

## Pricing
Open Source

## Version
v0.2.2

## Links
- Website: https://github.com/wangjohn/agent-archive
- Documentation: https://github.com/wangjohn/agent-archive/blob/main/docs/README.md
- Repository: https://github.com/wangjohn/agent-archive
- EveryDev.ai: https://www.everydev.ai/tools/agent-archive
