BjornMelin/dev-skills / archive/skills/codex-session-cleanup
codex-session-cleanup
VerifiedSafely scan, triage, quarantine, restore, and purge Codex session/history/state/memory artifacts for current repo, explicit roots, subrepos, Codex-home, or all sessions.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 5.3 KB |
| agents/openai.yaml | config | 332 B |
| archive.json | config | 938 B |
| references/artifact-model.md | markdown | 2.5 KB |
| references/classifier-rules.md | markdown | 2.5 KB |
| references/report-template.md | markdown | 1.2 KB |
| references/safety-restore.md | markdown | 2.3 KB |
| scripts/codex_session_cleanup.py | script | 72.1 KB |
| tests/test_codex_session_cleanup.py | script | 22.5 KB |
references/classifier-rules.md
View on GitHub# Classifier Rules
The cleanup classifier is conservative about development sessions and memory,
but aggressive about old low-value review/fix noise once safety gates pass.
## High Confidence
Select by default when older than the protection window:
- `$gh-pr-review-fix` sessions.
- `review-pack` loops.
- `Review the current code changes...` local review sessions.
- PR review comment remediation sessions.
- CodeRabbit, Sourcery, Copilot, or hosted reviewer fix loops.
- Child reviewer, triager, auditor, or CI-triage roles with review-only titles.
## Medium Confidence
Report by default and include only with `--include-medium`:
- no-user-event threads;
- very short low-token sessions;
- failed or interrupted scratch sessions;
- stale exploratory titles such as temporary probes or throwaway tests.
Medium-confidence memory-linked candidates are audit targets, not automatic
cleanup targets.
## Protected
Exclude unless a future version adds explicit force controls:
- recent sessions within `--min-age-hours`;
- all-session or Codex-home broad candidates without explicit scope;
- sessions without unambiguous ids;
- likely main development sessions;
- high-token implementation-oriented titles;
- active, paused, or budget-limited goals;
- running agent jobs and assigned job items;
- parent/child spawn edges with active or recent related threads;
- candidates whose files or DB rows cannot be backed up;
- any candidate with JSONL parse errors or SQLite integrity failures.
## Memory Triage
Memory findings are not deletion instructions. Recommendations:
- `preserve`: durable workflow/runbook/reusable knowledge.
- `audit`: stale, outdated, conflicting, or drift-prone details.
- `copy`: linked selected-thread memory without durable markers.
- `disposable`: only future versions may use this for confidently useless
memory, and it must still quarantine first.
Current repo docs/code and live provider or GitHub state outrank historical
memory when they conflict.
## Reason Codes
Reason codes are stable strings in reports and manifests. Examples:
- `gh-pr-review-fix-title`
- `local-code-review-title`
- `hosted-review-fix-title`
- `third-party-review-title`
- `ci-triage-title`
- `reviewer-agent-role`
- `no-user-event`
- `short-low-token-session`
- `stale-exploratory-title`
- `protected-recent`
- `protected-main-dev-likely`
- `protected-active-goal-*`
- `protected-active-agent-job`
- `protected-spawn-edge-active`
- `protected-unknown-cwd-codex-home`
- `durable-memory-marker`
- `drift-or-conflict-marker`
- `stale-command-marker`
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |