Agent History Tether banner
havurgiray havurgiray

Agent History Tether

AI community

Description

Move, rename, or copy a project folder without losing your AI coding agents' chat history. aht relinks the per-project histories of Claude Code, Codex, Gemini, Cursor, OpenCode, Copilot, and Kimi automatically - with watchers, tray apps, folder badges, and auto-backups on macOS, Linux, and Windows. History is never deleted or overwritten.

Installation

This entry records only its repository, not the path inside it, so there is no exact command to give. Open the source below and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

README

agent-history-tether (`aht`)

**Move a project folder and your AI coding agents forget everything about it.** Claude Code, Codex, Gemini, Cursor and friends each keep per-project conversation history keyed to the folder's *absolute path* — as an encoded directory name, a path hash, or a cwd recorded inside session files. Rename, move, nest or copy the folder and the agent silently starts from zero; the history is still on disk, but orphaned, with no built-in way to reattach it.

**aht fixes that for all of them at once.** One tiny identity marker travels with each folder; one background watcher (plus Claude Code's SessionStart hook as a backstop) notices moves, renames and copies and re-links every agent's history — asking first, by default. It also auto-backs-up all histories, restores them wherever a folder ends up, and badges managed folders. History is never deleted or overwritten.

Supported agents

backend agent CLI storage model relink confidence
claude Claude Code ~/.claude/projects/ rename dir verified (+ SessionStart hook backstop)
gemini Gemini CLI ~/.gemini/tmp/ rename dir high
cursor Cursor Agent CLI ~/.cursor/chats/ rename dir best-effort
opencode OpenCode $XDG_DATA_HOME/opencode/project/ rename dir best-effort
codex OpenAI Codex CLI ~/.codex/sessions/**/*.jsonl (cwd inside) rewrite cwd, backup-first high (layout confirmed on a real install)
copilot GitHub Copilot CLI ~/.copilot/history-session-state/** rewrite cwd, backup-first best-effort
kimi Kimi Code ~/.kimi/sessions/ (+ user-history/.jsonl companion) rename dir + companion verified (mapped from a real install)

**Why "best-effort" is still safe:** dir-rename backends are *self-verifying* — aht only acts when `key(old_path)` names a director