codexsm is a safety-first local Codex session manager written in Go.
| Topic | Link |
|---|---|
| Architecture | docs/ARCHITECTURE.md |
| Command Guide | docs/COMMANDS.md |
| Release Checklist | docs/RELEASE.md |
| Changelog | CHANGELOG.md |
- Go:
1.26+ - Required experiment:
GOEXPERIMENT=jsonv2 - JSON packages:
encoding/json/v2,encoding/json/jsontext
Important
GOEXPERIMENT=jsonv2 is required for build, install, and test.
export GOEXPERIMENT=jsonv2GOEXPERIMENT=jsonv2 go install github.com/MysticalDevil/codexsm@v0.3.9Or with mise:
GOEXPERIMENT=jsonv2 mise install go:github.com/MysticalDevil/codexsm@v0.3.9# List sessions
codexsm list
# Open TUI
codexsm tui
# Grouped TUI
codexsm tui --group-by host
# Run health checks
codexsm doctor
# Explain AGENTS.md rule sources and effective rules
codexsm agents explain
# Lint AGENTS.md layering for shadowed/duplicate rules
codexsm agents lint --strict
# Dry-run single session migration to a new cwd
codexsm session migrate --from /old/path --to /new/path
# Dry-run batch migration from TOML mappings
codexsm session migrate --file ./migrate.toml
# Dry-run delete
codexsm delete --id-prefix 019ca9
# Dry-run restore from trash
codexsm restore --id-prefix 019ca9Tip
For complete examples and command flags, use docs/COMMANDS.md.
| Area | Summary |
|---|---|
| Browse | list, group, and tui for session discovery |
| Safety | dry-run by default, explicit --confirm for real actions |
| Recovery | batch_id-based rollback with restore --batch-id |
| Migration | session migrate for Resume-compatible cwd/path moves |
| Diagnostics | doctor and config validation tooling |
| Rules Visibility | agents explain / agents lint for AGENTS.md traceability and policy checks |
- Session listing and grouping (
list,group) - Interactive browser (
tui) with theme support - Safe delete/restore workflow (
dry-runby default) - TUI group delete from a selected group header with triple confirm for real execution
- Resume-compatible session migration (
session migrate) - TUI pending-action confirmation shown in bottom keybar (
Y/N) with stronger visibility - TUI delete keeps navigation continuity by advancing selection to the next session
- Batch rollback via
restore --batch-id - Diagnostics and configuration (
doctor,config) - AGENTS.md instruction visibility and lint checks (
agents explain,agents lint)
- Destructive actions default to simulation (
--dry-run=true). - Real execution requires explicit opt-in (
--dry-run=false --confirm). - Multi-target real execution requires additional approval (
--yesor interactive confirmation). - TUI real delete from a group header requires three explicit confirms before execution.
- Soft-delete is default; hard delete is explicit (
--hard). - Operation logs include
batch_idfor audit and rollback.
Note
Recommended flow: preview first, then real execution with explicit confirmation.
Config path resolution:
$CSM_CONFIGwhen set- otherwise
~/.config/codexsm/config.json
Example:
{
"sessions_root": "~/.codex/sessions",
"trash_root": "~/.codex/trash",
"log_file": "~/.codex/codexsm/logs/actions.log",
"tui": {
"group_by": "host",
"source": "sessions",
"theme": "catppuccin",
"colors": {
"keys_label": "#ffffff",
"keys_key": "#89dceb",
"border_focus": "#f38ba8"
}
}
}TUI note:
- main panes follow the terminal's default background
- theme colors still control borders, titles, selection, keybar, and preview roles
bgremains available for local emphasis, such as highlighted action prompts- semantic state tokens are available for status UI:
status_ok,status_warn,status_risk,status_info,accent_group - group tree supports folding with
z(toggle selected session group) andZ(expand all groups) - pressing
don a group header targets the whole group; real execution uses a dedicated3/3confirm flow - layout is adaptive by width tier:
full(>=118),medium(96-117),compact(80-95),ultra(65-79) ultramode switches to a single active pane (tree/preview) withTabor1/2, while keeping shared selection state- minimum supported runtime size is
65x24
mise install
just build
just check
just bench-session
just bench-cli
just bench-gate
just bench-tui
just stress-cli
codexsm doctor risk --sessions-root ./testdata/fixtures/risky-static/sessions --format json --sample-limit 5
just gen-sessions-extreme
just gen-sessions-large
just check-release 0.3.9Fixture note:
testdata/fixtures/rich/keeps the general regression corpus.testdata/fixtures/risky-static/keeps deterministic risk-oriented samples fordoctor risk.testdata/fixtures/extreme-static/keeps a small extreme corpus for oversized meta lines, long single messages, no-final-newline files, mixed corruption, and Unicode-heavy previews.- Larger stress files are intentionally generated on demand via
just gen-sessions-extremeorjust gen-sessions-largeinstead of being committed as multi-megabyte fixtures. - Lightweight benchmark suites are available through
just bench-session,just bench-cli, andjust bench-tui;just stress-cliis the heavier local-only smoke path for generated large datasets.
Release build example:
GOEXPERIMENT=jsonv2 go build -ldflags="-X main.version=0.3.9" -o codexsm .BSD 3-Clause. See LICENSE.