opensession
OpenSession is a local-first workflow for recording, registering, sharing, and inspecting AI session traces.
Website: opensession.io
Docs: opensession.io/docs
DX Reset v1
The CLI/Web/API contract is now centered on three actions:
register: store canonical HAIL JSONL locally (no network side effects)share: produce a shareable output from a Source URIhandoff: build immutable artifacts and manage artifact aliases
Legacy command trees and routes were removed:
opensession publish ...removedopensession session handoff ...removed- Legacy shortcut routes (
/git,/gh/*,/resolve/*) are no longer served and return 404 by design /api/ingest/previewremoved in favor of/api/parse/preview
URI Model
os://src/local/<sha256>os://src/gh/<owner>/<repo>/ref/<ref_enc>/path/<path...>os://src/gl/<project_b64>/ref/<ref_enc>/path/<path...>os://src/git/<remote_b64>/ref/<ref_enc>/path/<path...>os://artifact/<sha256>
Notes:
ref_encis RFC3986 percent-encoding.project_b64/remote_b64are base64url without padding.
Install
opensession is the user-facing CLI. Session auto-capture additionally requires the daemon process to be running.
Install-and-Forget Setup
# 1) Install CLI
# 2) Diagnose local setup (flutter doctor style)
# 3) Apply recommended setup values (explicit confirmation prompt)
# Optional: pin fanout storage mode while fixing
# Automation / non-interactive mode
doctor reuses the existing setup pipeline under the hood.
doctor --fix now prints the setup plan and asks for confirmation before applying hook/shim/fanout changes.
On first interactive apply, OpenSession asks which fanout storage mode to use (hidden_ref or git_notes) and stores the choice in local git config (.git/config) as opensession.fanout-mode.
In non-interactive mode, --fix requires --yes and an explicit --fanout-mode when no fanout mode is already configured in git.
Start daemon (required for automatic session capture):
# if opensession-daemon binary is available
# from source checkout
Without daemon, parse/register/share still work manually, but background auto-capture is not active.
Quick Start
# Print the first-user command flow
# Parse agent-native log -> canonical HAIL JSONL
# Register to local object store (repo-scoped by default)
# -> os://src/local/<sha256>
# Read it back
# Inspect summary metadata
Share
# Convert local URI -> git shareable source URI
# Optional network mutation
# Install/update OpenSession pre-push hook (best-effort fanout)
# Optional: fail push when fanout is unavailable/fails
OPENSESSION_STRICT=1
# Web URL generation from remote-resolvable URI
share --web requires explicit .opensession/config.toml.
Git-native writes now target hidden ledger refs (refs/opensession/branches/<branch_b64url>); legacy fixed ref writes are removed.
opensession doctor --fix installs the shim at ~/.local/share/opensession/bin/opensession for hook stability.
Cleanup Automation
Configure hidden-ref and artifact cleanup for GitHub/GitLab/generic git remotes:
# initialize cleanup config and templates
# non-interactive setup
# inspect cleanup status + janitor preview
# dry-run janitor (default)
# apply cleanup deletions
Defaults:
- hidden ref TTL: 30 days
- artifact branch TTL: 30 days
- GitHub/GitLab setup also writes PR/MR session-review automation that updates an artifact branch and posts a review comment on PR/MR updates.
Sensitive repositories can force immediate cleanup:
Handoff
# Build immutable artifact
# -> os://artifact/<sha256>
# Read artifact payload in desired representation
# Verify hash + payload validity
# Alias management
# Removal policy: only unpinned artifacts
Canonical Web Routes
/src/gh/<owner>/<repo>/ref/<ref_enc>/path/<path...>/src/gl/<project_b64>/ref/<ref_enc>/path/<path...>/src/git/<remote_b64>/ref/<ref_enc>/path/<path...>
API Surface (v1)
GET /api/healthGET /api/capabilitiesPOST /api/parse/previewGET /api/sessionsGET /api/sessions/{id}GET /api/sessions/{id}/rawDELETE /api/admin/sessions/{id}(requiresX-OpenSession-Admin-Key)
Failure Recovery
Common failure signatures and immediate recovery commands:
share --webwith a local URI:
share --gitwithout remote:
share --gitoutside a git repository:
share --webwithout.opensession/config.toml:
registerwith non-canonical input:
parsewith parser/input mismatch:
viewtarget cannot be resolved:
cleanup runbefore cleanup setup:
5-minute recovery path for first-time users:
Local Development
# Required validation gates
# Runtime web validation
BASE_URL=http://127.0.0.1:8788