Per-project session persistence for AI CLI tools
Project description
ai-session-manager
Per-project session persistence for AI CLI tools.
ai-session-manager adds automatic project-scoped resume behavior to supported AI CLIs so you can leave a project and come back without manually reopening the right conversation.
Works on Linux, macOS, and Windows.
[!WARNING] This tool renames installed CLI binaries and replaces them with wrapper scripts. Use it at your own risk, and make sure you understand how to restore the original binaries with
ai-session-manager teardown.
Why
Most AI CLIs support sessions, but they do not all resume the same way and they do not all make project-scoped resume automatic. This project adds one consistent wrapper layer across tools.
Today it supports:
| Tool | Auto-resume behavior |
|---|---|
agy |
After first run, launches agy -c in the same project |
copilot |
Stores a stable session UUID and launches copilot --session-id <uuid> |
claude |
After first run, launches claude -c in the same project |
gemini |
After first run, launches gemini --resume in the same project |
codex |
After first run, launches codex resume --last in the same project |
Project-scoped state lives in:
.ai-session-manager/inside the project root, whether it is a git repo or a plain folder
Existing state is still recognized and migrated from:
.git/ai-session-manager/
Copilot legacy state is also recognized and migrated from:
.git/copilot-session.copilot-session
Requirements
- Python 3.8+
- One or more supported CLIs installed: Antigravity, Copilot, Claude Code, Gemini CLI, or Codex CLI
Installation
pip install --editable ~/ai-session-manager
Once published:
pip install ai-session-manager
Setup
Install wrappers for every supported tool found in PATH:
ai-session-manager setup
Or target specific tools:
ai-session-manager setup agy copilot claude gemini codex
Each selected binary is renamed to <tool>-real and replaced with a thin Python wrapper. From that point on, keep using the original command name.
Usage
Copilot
cd ~/my-project
copilot
# [ai-session-manager] New session 4f1a2b3c-... (my-project)
cd ~/my-project
copilot
# [ai-session-manager] Resuming session 4f1a2b3c-... (my-project)
AGY / Claude / Gemini / Codex
agy
# [ai-session-manager] Starting new Antigravity CLI session (my-project)
agy
# [ai-session-manager] Resuming latest Antigravity CLI session (my-project)
claude
# [ai-session-manager] Starting new Claude Code session (my-project)
claude
# [ai-session-manager] Resuming latest Claude Code session (my-project)
gemini
# [ai-session-manager] Starting new Gemini CLI session (my-project)
gemini
# [ai-session-manager] Resuming latest Gemini CLI session (my-project)
codex
# [ai-session-manager] Starting new Codex session (my-project)
codex
# [ai-session-manager] Resuming latest Codex session (my-project)
Supported tools are still fully usable with their own native session commands. If you pass an explicit resume or session-management flag/subcommand, the wrapper gets out of the way.
For example:
agy --conversation 123e4567-e89b-12d3-a456-426614174000
copilot --resume
claude -r my-session
gemini --list-sessions
codex resume --last
Start fresh in the current project
ai-session-manager reset
Or reset one tool only:
ai-session-manager reset claude
Commands
| Command | Description |
|---|---|
ai-session-manager setup [tools...] |
Install wrappers for all detected or selected tools |
ai-session-manager teardown [tools...] |
Remove wrappers and restore original binaries |
ai-session-manager status [tools...] |
Show platform, binary paths, and state files |
ai-session-manager reset [tools...] |
Delete persisted wrapper state for the current project |
State layout
project root:
.ai-session-manager/
copilot.json
claude.json
codex.json
gemini.json
agy.json
Copilot stores a generated UUID in its state file. The other tools use the file as an on/off marker that tells the wrapper to invoke the tool's native resume-latest behavior on future launches.
Platform details
| Linux | macOS | Windows | |
|---|---|---|---|
| Wrapper file | tool name (shebang script) | tool name (shebang script) | tool .cmd wrapper |
| Real binary | <tool>-real |
<tool>-real |
<tool>-real.exe or <tool>-real.cmd |
| Process launch | os.execv (true replace) |
os.execv (true replace) |
subprocess + exit code |
Project structure
ai-session-manager/
├── pyproject.toml
├── README.md
└── src/
├── ai_session_manager/
│ ├── wrapper.py
│ └── cli.py
Reinstalling a tool CLI
If a wrapped tool is manually reinstalled and overwrites the wrapper, run setup again:
ai-session-manager setup copilot
Uninstall
ai-session-manager teardown
pip uninstall ai-session-manager
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ai_session_manager-0.1.3.tar.gz.
File metadata
- Download URL: ai_session_manager-0.1.3.tar.gz
- Upload date:
- Size: 11.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
27d1a8530889f73b5c8b575976d9bad8605cdb98197e4f79225aa1c4ad9e2ffd
|
|
| MD5 |
259b77101f0341225497d361798125e4
|
|
| BLAKE2b-256 |
7c5ed4e8984185db9848266a10503c893651d42bb35fcfaba47c2dbb7a14715b
|
Provenance
The following attestation bundles were made for ai_session_manager-0.1.3.tar.gz:
Publisher:
publish-pypi.yml on DrFatihTekin/ai-session-manager
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ai_session_manager-0.1.3.tar.gz -
Subject digest:
27d1a8530889f73b5c8b575976d9bad8605cdb98197e4f79225aa1c4ad9e2ffd - Sigstore transparency entry: 1724057805
- Sigstore integration time:
-
Permalink:
DrFatihTekin/ai-session-manager@c92e27210d118a2fe0385bb172fa1fdc2db39286 -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/DrFatihTekin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@c92e27210d118a2fe0385bb172fa1fdc2db39286 -
Trigger Event:
release
-
Statement type:
File details
Details for the file ai_session_manager-0.1.3-py3-none-any.whl.
File metadata
- Download URL: ai_session_manager-0.1.3-py3-none-any.whl
- Upload date:
- Size: 10.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8c12554c35a5e162db72f2c21f440712e8922fe31fab694bc1756c666d9eba37
|
|
| MD5 |
b060a12114fc5ec1040e768766b4f4da
|
|
| BLAKE2b-256 |
5f521a4f246b605ee75e311b8ff51eb8d588474b0565585532baf6ae830e4276
|
Provenance
The following attestation bundles were made for ai_session_manager-0.1.3-py3-none-any.whl:
Publisher:
publish-pypi.yml on DrFatihTekin/ai-session-manager
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ai_session_manager-0.1.3-py3-none-any.whl -
Subject digest:
8c12554c35a5e162db72f2c21f440712e8922fe31fab694bc1756c666d9eba37 - Sigstore transparency entry: 1724057942
- Sigstore integration time:
-
Permalink:
DrFatihTekin/ai-session-manager@c92e27210d118a2fe0385bb172fa1fdc2db39286 -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/DrFatihTekin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@c92e27210d118a2fe0385bb172fa1fdc2db39286 -
Trigger Event:
release
-
Statement type: