Skip to main content

ai-sessions

ai-sessions is a searchable terminal browser for local Codex CLI and Claude Code conversations. It indexes each provider's existing on-disk history without modifying transcripts or provider databases.

It runs as sessions on Linux and native Windows PowerShell.

Features

  • One navigable list for Codex and Claude sessions
  • Search and filters for provider, directory, origin, open state, and visibility
  • Human, cross-provider, and subagent/automation origin labels
  • Started and updated timestamps plus user-message counts across compactions
  • Utility-local rename and hide operations that never alter vendor data
  • Detection of currently open sessions on Linux and Windows
  • tmux pane and desktop-terminal focus on Linux when the environment exposes it
  • Safe, dangerous, and custom launch profiles
  • Native paths and argument handling on both operating systems

Windows Terminal does not expose a stable session-ID-to-tab interface. On Windows, open sessions are identified, but exact tab focusing is intentionally not attempted.

Requirements

  • Python 3.11 or newer
  • Codex CLI, Claude Code, or both
  • Linux or native Windows PowerShell

The Windows-only windows-curses dependency is installed automatically. psutil is used for portable process inspection.

Install

From a checkout:

python -m pip install .
sessions

With pipx:

pipx install .
sessions

From PyPI:

pipx install ai-sessions

On Windows, py -m pip can be used in place of python -m pip.

Everyday use

Run sessions, navigate with the arrow keys or j/k, and press Enter to resume the selected conversation.

Key Action
Ctrl-F or / Start search mode
Tab Cycle provider filter
o Cycle Human, Cross, Agent, and All origins
v Cycle visible, hidden, and all sessions
d Choose a directory
s Cycle sort order
p Cycle Safe, Dangerous, and Custom launch modes
r Rename locally
h Hide or restore locally
Ctrl-R Refresh
? Show complete help

Useful noninteractive forms include:

sessions --list --tool codex
sessions --list --query "is:open dir:my-project"
sessions --list --visibility hidden
sessions --resume SESSION_ID
sessions --resume SESSION_ID --dry-run

Launch safety

The package defaults to safe. This leaves approval and sandbox behavior to each provider's normal configuration:

claude --resume SESSION_ID
codex resume SESSION_ID

Dangerous mode adds the providers' explicit bypass flags:

claude --dangerously-skip-permissions --resume SESSION_ID
codex --dangerously-bypass-approvals-and-sandbox resume SESSION_ID

These options disable important protections. Use them only where you have consciously accepted that risk.

Set a persistent mode from the command line:

sessions --set-launch-mode safe
sessions --set-launch-mode dangerous

Use --launch-mode for a one-time override. The active mode is always displayed in the interface header.

Configuration

Configuration is stored in:

  • Linux: ~/.config/ai-sessions/config.toml
  • Windows: %APPDATA%\ai-sessions\config.toml

The optional custom profile uses structured argument arrays, avoiding shell interpolation:

[launch]
mode = "custom"
claude_command = ["claude"]
codex_command = ["codex"]

[launch.custom]
claude_args = ["--permission-mode", "acceptEdits"]
codex_args = ["--sandbox", "workspace-write", "--ask-for-approval", "on-request"]

Rename/hide state is kept alongside the configuration as state.json. Caches use ~/.cache/ai-sessions on Linux and %LOCALAPPDATA%\ai-sessions on Windows. Environment overrides are available through AI_SESSIONS_CONFIG_FILE, AI_SESSIONS_STATE_FILE, CODEX_HOME, and CLAUDE_CONFIG_DIR.

How open-session detection works

  • Claude Code publishes a live PID/session registry.
  • Codex on Linux holds per-thread writer locks.
  • Codex on Windows records thread IDs alongside process IDs in its local log database.
  • Linux focus support follows the process into tmux and then uses wmctrl/xdotool when available.

Detection is best-effort and read-only. The utility never writes to provider storage.

Privacy

No transcripts, caches, credentials, local names, or hidden-session state belong in this repository. The defensive .gitignore excludes common provider and local data paths.

Development

python -m unittest discover -s tests -v
python -m build

CI exercises Python 3.11–3.13 on Ubuntu and Windows.

Download files

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

Source Distribution

ai_sessions-3.0.0.tar.gz (29.3 kB view details)

Uploaded Source

Built Distribution

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

ai_sessions-3.0.0-py3-none-any.whl (30.7 kB view details)

Uploaded Python 3

File details

Details for the file ai_sessions-3.0.0.tar.gz.

File metadata

  • Download URL: ai_sessions-3.0.0.tar.gz
  • Upload date:
  • Size: 29.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for ai_sessions-3.0.0.tar.gz
Algorithm Hash digest
SHA256 3ff29494f67249faf2d8523269beab4a93c81f32ecb7fca119572ae98fc7d33c
MD5 3589a0c1d7aee962fc2a26f705c2e767
BLAKE2b-256 514d2cc31cb3675c94467c0651175f79e813ed09464c40392bccb1693079810e

See more details on using hashes here.

Provenance

The following attestation bundles were made for ai_sessions-3.0.0.tar.gz:

Publisher: publish-to-pypi.yml on vandyand/ai-sessions

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

File details

Details for the file ai_sessions-3.0.0-py3-none-any.whl.

File metadata

  • Download URL: ai_sessions-3.0.0-py3-none-any.whl
  • Upload date:
  • Size: 30.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for ai_sessions-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 acef733fc35ff7600adff96077acea9fc1323e22d159752d5971241d72266fe9
MD5 637bc00100ada83de74a90caf823a142
BLAKE2b-256 25f827b876b0d5df1e46ee0ddc73672d2b11bd81d30faf301768ddcd51ae739c

See more details on using hashes here.

Provenance

The following attestation bundles were made for ai_sessions-3.0.0-py3-none-any.whl:

Publisher: publish-to-pypi.yml on vandyand/ai-sessions

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 Sentry Error logging StatusPage Status page