session-control
Private web control plane for local AI assistant session files.
session-control scans local Codex, Claude Code, Continue, and GitHub Copilot
session stores, summarizes what each session was about, shows the command to
resume it, and moves old sessions into a local trash directory from a small
Flask web UI.
Prerequisites
- Python 3.10 or newer
- Flask, installed through the package metadata
- Local session files from one or more supported tools:
- Codex:
~/.codex/sessions - Claude Code:
~/.claude/projects - Continue:
~/.continue/sessions - GitHub Copilot CLI:
~/.copilot/session-state
- Codex:
Quick Start
python3 -m venv .venv
. .venv/bin/activate
pip install -e ".[dev]"
session-control scan
session-control web
The web UI binds to 127.0.0.1:5420 by default. For phone access, keep the app
on loopback and expose it through a trusted local proxy such as
wiring-harness Caddy with mTLS or a WireGuard-only route.
Configuration
Copy config/session-control.env.example to
config/session-control.env.local and adjust local paths or proxy origins.
The .local file is gitignored.
Common variables:
| Variable | Default | Purpose |
|---|---|---|
SESSION_CONTROL_HOST |
127.0.0.1 |
Flask bind host |
SESSION_CONTROL_PORT |
5420 |
Flask bind port |
SESSION_CONTROL_PUBLIC_ORIGIN |
unset | External origin used by a trusted proxy |
SESSION_CONTROL_ALLOWED_ORIGINS |
unset | Comma-separated extra origins for CSRF checks |
SESSION_CONTROL_TRASH_DIR |
~/.local/share/session-control/trash |
Delete destination |
SESSION_CONTROL_PRUNE_OLDER_THAN |
180d |
Default age for scheduled pruning |
Set SESSION_CONTROL_ALLOW_REMOTE=1 only when intentionally binding the Flask
app outside loopback. The preferred phone path is still a loopback app behind
wiring-harness/Caddy or WireGuard.
Resume Commands
The scanner emits provider-specific resume commands:
- Codex:
codex resume <session-id>orcodex resume --model <model> <session-id>when the session records a model - Claude Code:
claude --resume <session-id> - Continue:
cn --fork <session-id> - GitHub Copilot CLI:
copilot --resume=<session-id>
When a session records a workspace, the command is prefixed with cd <workspace>.
Set SESSION_CONTROL_CODEX_RESUME_MODEL to force a known-good Codex model for
web-launched resumes when the global Codex default is not supported by the
machine's current auth mode.
Multiple machines
Session stores remain local to their owning machine. Do not synchronize raw provider directories or transcripts. Instead, a node can export a deliberately restricted inventory containing only a title, provider, timestamp, workspace basename, size/count metadata, and model:
session-control inventory --json
session-control publish-inventory \
--url https://session-control.example.internal/api/federation/v1/inventories/air \
--token-file ~/.config/session-control/federation-air.token \
--ca-file ~/.config/wiring-harness/certs/ca.crt \
--cert-file ~/.config/wiring-harness/certs/client.crt \
--key-file ~/.config/wiring-harness/certs/client.key
The central node enables SESSION_CONTROL_FEDERATION_STORE_DIR and assigns a
distinct owner-only token to each approved node in
SESSION_CONTROL_FEDERATION_TOKENS. Its All machines page displays local
and received inventories by host. Remote records are read-only: opening,
resuming, deleting, and restoring remain local operations. Put the receiver
behind the existing Caddy mTLS route; the per-node bearer token is an additional
authorization check, not a substitute for mTLS.
Codex itself can set permission defaults in ~/.codex/config.toml, for example
sandbox_mode = "danger-full-access" and approval_policy = "never", or per
launch with codex resume --sandbox ... --ask-for-approval .... For Codex
sessions, session-control shows the last recorded sandbox/approval policy and
adds a launch-time dropdown with these presets:
default: rely on Codex config filesrecorded: reuse the session's last recorded sandbox and approval policyread-only: launch with--sandbox read-only --ask-for-approval on-requestauto: launch with--sandbox workspace-write --ask-for-approval on-requestfull-auto: launch with--sandbox danger-full-access --ask-for-approval never
Set SESSION_CONTROL_CODEX_PERMISSION_PRESET to choose the default dropdown
selection for web-launched Codex resumes.
Provider Format Diagnostics
Session Control probes the local formats it understands while scanning. If a provider changes an index, session file, workspace file, or event log schema, the index page shows a provider-specific warning without suppressing sessions from other providers. The warning names only the local file or session directory, never its full private path. Update the minimized fixtures and scanner support before relying on a new format.
The Open action creates a tmux window in the configured webterm session, selects that window for new webterm tabs, and keeps the window open when the resume command exits with an error so the failure message is visible.
Assistant Usage
When Codex session files include token_count events, the index page shows the
newest known last-turn token usage, context window, session total, plan type,
and primary/secondary rate-limit percentages.
When Claude Code session files include assistant message.usage objects, the
index page shows the newest known last-turn token usage, session token total,
cache token counts, model, and service tier. Claude Code local session files do
not record plan limit windows, reset times, or usage percentages, so the web UI
labels Claude limits as not locally recorded instead of inventing a limit value.
Set SESSION_CONTROL_CLAUDE_STATUS_POLL=1 to have the web service periodically
run a sanitized Claude CLI status command. The default command is
claude auth status --json, which reports auth/subscription status on current
Claude Code releases but still does not expose usage-limit windows or reset
percentages. If a future Claude CLI version adds limit fields to that JSON,
session-control will surface sanitized limit/usage fields automatically.
When authenticated and the status command has no limit fields, the poller also
queries /usage in a fresh print-mode session with --no-session-persistence.
It never resumes a saved conversation, so probes do not append to chat history
or create saved sessions requiring cleanup. Unsupported or failed probes leave
limits unavailable; there is no fallback to resuming user sessions.
SESSION_CONTROL_CLAUDE_STATUS_POLL_INTERVAL controls the interval (default:
300 seconds). Account limits can change through activity in other sessions, so
polling does not depend on changes to any one local transcript.
When running under systemd, set SESSION_CONTROL_CLAUDE_STATUS_COMMAND to an
absolute claude path if the service PATH cannot find the CLI.
Delete Behavior
Delete actions move session files or directories into the configured trash
directory instead of hard-deleting them immediately. Continue and Codex index
files are updated when a session is removed. Copilot sessions with a live
inuse.<pid>.lock are not deleted.
Each newly deleted or pruned session records local restore metadata alongside its trash payload. List candidates, then restore one by its exact displayed identifier:
session-control restore --list
session-control restore 20260827T120000Z/continue/<session-id>
Restore only accepts an entry beneath the configured trash directory, returns every file to its original provider-relative path, rebuilds the Continue index when needed, and refuses to overwrite any existing target. Sessions moved to trash before this feature do not have restore metadata and remain manual recovery cases.
Pruning
Pruning uses the same delete-to-trash path as the web UI. A session is eligible when its last activity timestamp is older than the configured age; active sessions are skipped.
Preview the default 180-day cleanup:
session-control prune --older-than 180d --dry-run
Run the cleanup:
session-control prune --older-than 180d
Install the daily user-level clockwork timer:
./scripts/install_prune_timer.sh --older-than 180d
The timer is rendered from
config/clockwork/prune-sessions.toml.template and runs daily at 03:35 with a
small randomized delay. It can be inspected with:
systemctl --user list-timers session-control-prune.timer
Development
pytest -q
ruff check .
ruff format --check .
pre-commit run --all-files
Contributing
See CONTRIBUTING.md.
License
MIT. See LICENSE.
Metadata
Release files for session-control 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| session_control-0.2.0.tar.gz | 59.2 kB | With provenance | Details for session_control-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| session_control-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for session_control-0.2.0-py3-none-any.whl |
Total release size: 115.2 kB
Release files / session_control-0.2.0.tar.gz
| Download URL | session_control-0.2.0.tar.gz |
|---|---|
| Size | 59.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c18faa07fd2c7df3b00f13d89d68063b4d1152f297c751922915b2b85546e293
|
|
BLAKE2b-256 checksum How to use checksums |
77f96210df43a67160e576724ed9ade555134bfcc5b7d8fa2ca6e2b7cdff2346
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.
Transparency logRelease files / session_control-0.2.0-py3-none-any.whl
| Download URL | session_control-0.2.0-py3-none-any.whl |
|---|---|
| Size | 56.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b9504d10ee9f67b4d704a6d9d45fdef604bcc0fc24325f9051d0413fbf573aa7
|
|
BLAKE2b-256 checksum How to use checksums |
081e3c889cb93da9fd5aa1dbabdf9f337464db633e7685ba9202b4a56d949b1c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.
Transparency logSecurity for session-control 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for session_control-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.