"keep-codex-fast"
"Use when Codex feels slow or bloated, when local sessions/logs/worktrees/config have grown over time, or when a user wants safe maintenance for Codex Desktop/CLI state. Provides a read-only report by default, backs up before applying changes, archives instead of deleting, normalizes Windows extended paths, prunes dead config projects, rotates large logs, and moves stale worktrees."
Safety scan
A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.
Badge for your README
Markdown
[](/listings/vibeforge1111-keep-codex-fast)HTML
<a href="/listings/vibeforge1111-keep-codex-fast"><img src="/api/listings/vibeforge1111-keep-codex-fast/badge.svg" alt="findsafeskills safety rating" /></a>Install
Install instructions from the README
As written by the repo's author. findsafeskills has not verified these steps.
Ask Codex:
Use $keep-codex-fast to inspect my Codex local state and recommend a safe maintenance plan.
Codex should show you what it found first. Then you decide what to hand off, what to keep active, and what can be archived.
What was scanned
The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.
SKILL.md · Manifest · 207 lines
View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)
- ---
- name: "keep-codex-fast"
- description: "Use when Codex feels slow or bloated, when local sessions/logs/worktrees/config have grown over time, or when a user wants safe maintenance for Codex Desktop/CLI state. Provides a read-only report by default, backs up before applying changes, archives instead of deleting, normalizes Windows extended paths, prunes dead config projects, rotates large logs, and moves stale worktrees."
- metadata:
- short-description: "Safe Codex local-state maintenance"
- ---
- # Keep Codex Fast
- Use this skill to inspect and safely maintain local Codex state. The goal is to reduce local drag without surprising the user or losing continuity.
- Primary principle: preserve continuity before applying changes. For active repo chats the user may continue, recommend a comprehensive handoff document and reactivation prompt before archiving anything.
- ## Safety Rules
- - Inspect before mutating.
- - The first run must be report-only. Report mode must not write files, create backups, move folders, or change local Codex state.
- - Back up before applying changes. Use `--backup-only` when the user wants backups without moving or changing local state.
- - Archive or move files instead of deleting them. Do not permanently delete user chats, logs, worktrees, memories, skills, plugins, or automations.
- - Write manifests and restore scripts when sessions/worktrees are moved.
- - If Codex is running, default to report-only. Apply changes only after Codex is closed or when the user explicitly accepts waiting for Codex to exit.
- - Never modify or copy credential files unless the user explicitly asks for that. Back up memory/skill/plugin/automation files before touching local state.
- - Treat backup folders as private local artifacts because they can contain Codex metadata. Do not ask users to publish or share backups unless they have reviewed them first.
- - Do not print raw thread IDs, chat titles, local paths, or process paths unless the user asks for details or runs `--details`.
- - Before applying changes, tell the user to create handoff docs for active repo chats they may continue.
- - Before archiving any active repo chat the user may want to continue, recommend creating a comprehensive handoff doc plus a reactivation prompt.
- - Do not archive old-but-important active repo chats until the user either confirms a handoff exists or confirms they do not need one.
- ## Mental Model
- There are three modes:
- - Inspect: report-only, no writes.
- - Maintain: normal `--apply`; backs up, archives old sessions, moves stale worktrees, rotates logs, prunes dead config, and normalizes paths. It does not trim thread title/preview metadata.
- - Optional repair: `--apply --repair-thread-metadata-bloat`; shortens oversized SQLite display title/preview metadata after backup. The rollout transcript stays intact.
- ## Default Workflow
- 1. Reassure the user: the first run is read-only, privacy-safe, and the skill archives instead of deleting when changes are later applied.
- 2. Run the bundled script in report mode:
- ```bash
- python scripts/keep_codex_fast.py
- ```
- 3. Summarize:
- - active session size
- - archived session size
- - largest active sessions
- - thread metadata bloat: active title/preview character totals, max title/preview lengths, and over-limit counts
- - stale worktree candidates
- - log size
- - bad Windows `\\?\` path counts
- - config project prune candidates
- - top Node/dev processes
- 4. Before applying changes, recommend that the user create handoffs for all active repo chats they may continue. Explain that handoffs let them archive heavy chats and resume from docs in fresh threads.
- 5. Identify large/old active repo chats that may still matter. For each one the user wants to continue, create or update:
- - a repo-local handoff doc
- - a reactivation prompt that can start a fresh chat without losing the thread
- 6. If the user wants to apply the recommended maintenance, ask them to close Codex or use `--wait-for-codex-exit`, then run:
- ```bash
- python scripts/keep_codex_fast.py --apply --archive-older-than-days 10 --worktree-older-than-days 7
- ```
- 7. Verify after applying:
- ```bash
- python scripts/keep_codex_fast.py
- ```
- 8. Ask whether the user wants a recurring report-only reminder:
- - weekly for heavy Codex use across many repos/terminals
- - biweekly for lighter use
- - no reminder if they prefer manual maintenance
- If the user wants automation and the Codex app automation tool is available, create only a recurring report/reminder automation. Do not recommend recurring mutating maintenance, because automation cannot know whether the user created handoffs. The prompt must say not to pass `--apply`, not to archive/move/prune/rotate/normalize/delete/mutate local state, and to remind the user that manual apply should happen only after handoffs are confirmed and Codex is closed.
- ## What Apply Does
- - Backs up important metadata to `~/Documents/Codex/codex-backups/keep-codex-fast-*`.
- - Archives old non-pinned sessions to `~/.codex/archived_sessions/`.
- - Normalizes Windows extended paths like `\\?\C:\...` inside local SQLite text fields.
- - Prunes missing/temp project blocks from `config.toml` and writes UTF-8 without BOM.
- - Moves stale worktrees to `~/.codex/archived_worktrees/`.
- - Rotates `logs_2.sqlite*` into `~/.codex/archived_logs/` only when above the threshold.
- - Reports heavy Node processes without killing them.
- - Reports pathological active thread titles and `first_user_message` previews. It only repairs them when the user explicitly opts in with `--repair-thread-metadata-bloat`.
- Report mode does none of those mutations. It only prints counts and pseudonymous candidates. Use `--details` when raw IDs, titles, or paths are needed for diagnosis.
- ## Recommended Policy
- - Keep only the last 7-10 days of non-pinned chats active.
- - Use handoff docs for important old threads.
- - Start fresh threads from handoff docs instead of repeatedly resuming giant chats.
- - Run weekly maintenance if Codex is used daily across many repos/terminals.
- - Offer weekly or biweekly report-only reminders after the first successful apply; do not assume the user wants recurring maintenance.
- - When in doubt, leave a chat active or ask the user. Never archive a chat that is pinned, current, or explicitly marked as still needed without a handoff.
- - Treat title/preview repair as metadata repair only. The full rollout transcript remains in the session JSONL; bounded SQLite fields are for list/navigation display.
- ## Thread Metadata Bloat
- Codex Desktop can become slow when `threads.title` or `threads.first_user_message` stores a full prompt/history-sized value instead of a display title or preview. This affects the thread list/navigation path before the UI renders anything.
- The script reports active thread count, total title/preview characters, maximum title/preview length, active titles over the configured title limit, and active previews over the configured preview limit and over 10k characters.
- Normal apply mode reports metadata-bloat candidates but does not repair them. If the user explicitly opts in, after backups and only when Codex is not running, run:
- ```bash
- python scripts/keep_codex_fast.py --apply --repair-thread-metadata-bloat
- ```
- That bounds active `threads.title` and `threads.first_user_message` values. Defaults are 120 characters for titles and 240 characters for previews. It also appends repaired titles to `session_index.jsonl`, matching current upstream name-update storage, so reconciliation/name lookup does not immediately prefer the old full-message fallback.
- The targeted repair manifest stores the old full title/preview values so the change can be reversed. Treat `thread-metadata-repairs.jsonl`, `restore-thread-metadata.py`, and the whole backup folder as private local artifacts.
- This is a local maintenance workaround for metadata bloat. It does not solve app renderer hydration of very large rollout histories; that needs upstream staged/paged thread loading.
- ## Handoff Doc + Reactivation Prompt
- For important active repo chats, create a handoff before archiving. Prefer a repo-local path such as `docs/codex-handoffs/YYYY-MM-DD-topic.md` or a user-approved docs location.
- Use `references/handoff-template.md` when the user wants a concrete template.
- A handoff document converts an old chat into durable project memory. It should let a fresh Codex thread continue after reading the repo and the handoff, without needing the original chat history.
- Offer this prompt for each active repo chat the user may want to continue:
- ```text
- Create a comprehensive handoff document for this repo/session before I archive Codex history.
- Include:
- - repo/path and branch
- - current goal
- - what we already completed
- - files touched or investigated
- - commands/tests already run
- - known errors, warnings, or failing checks
- - open decisions
- - constraints, user preferences, and do-not-touch areas
- - the next 3-7 concrete steps
- Also include a reactivation prompt I can paste into a fresh Codex chat so it can continue from this handoff without relying on the old chat context.
- Save the handoff in a sensible repo-local place like docs/codex-handoffs/YYYY-MM-DD-topic.md unless this repo already has a better handoff location.
- ```
- The handoff should capture:
- - repo/path and branch
- - current goal
- - what was already done
- - key files touched or investigated
- - commands/tests already run
- - known failures or warnings
- - open decisions
- - next 3-7 concrete steps
- - any constraints, user preferences, or "do not touch" areas
- Add a reactivation prompt at the top or bottom:
- ```text
- We are continuing from this handoff. Read this document first, inspect the current repo state, verify what still applies, and continue from the next steps without assuming the old chat context is available.
- ```
- ## Automation Reminder Prompt
- Offer this after the first report/apply/verify cycle:
- ```text
- Use $keep-codex-fast to create a recurring Codex maintenance reminder.
- Schedule it weekly if I use Codex heavily, or biweekly if that seems safer.
- The reminder should:
- - run the keep-codex-fast report first
- - never pass --apply or run mutating maintenance automatically
- - never archive, move, prune, rotate, normalize, delete, or mutate local Codex state
- - remind me to create comprehensive handoff docs and reactivation prompts for active repo chats before any manual apply
- - summarize active session size, archived session size, extended path candidates, old session candidates, worktree candidates, log size, and top Node/dev processes
- - report heavy Node/dev processes without killing them
- - tell me that manual apply should only happen after I confirm handoffs exist or are not needed and Codex is closed
- ```
- ## Anti-Patterns
- Avoid these behaviors:
- - deleting sessions, logs, worktrees, memories, plugins, or skills permanently
- - applying changes while Codex is actively writing the DB
- - archiving important repo chats before creating handoff docs
- - treating active history size as "bad" without checking whether the user needs continuity
- - treating preview metadata repair as deletion of the actual rollout transcript
- - killing Node/dev processes automatically
- - rewriting `config.toml` without a backup and parse check
- - writing UTF-8 TOML with a BOM on Windows
- - promising speed gains as universal fact; frame improvements as local-state maintenance results
- - making users feel like they did something wrong by using Codex heavily
- ## User-Facing Caution
- Tell users this does not permanently delete chats, worktrees, or logs. It moves them into archive folders and writes restore helpers. The only removed content is stale metadata, such as project entries pointing to folders that no longer exist, and even that happens after backing up `config.toml`.
- Also tell users that thread title/preview bloat repair is not part of normal apply. Normal use only reports title/preview bloat. Recommend `--repair-thread-metadata-bloat` only as an optional extra when the report shows large metadata payloads and the user understands that SQLite display metadata will be shortened while the real transcript remains in rollout JSONL.
- Also tell users backup folders can contain private local Codex metadata, including old thread titles and first-message previews. They should keep backups local and avoid publishing or sharing them unless they have reviewed what is inside.
README.md · README · 220 lines
View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)
- # Keep Codex Fast
- 
- When Codex starts feeling heavy after weeks of chats, terminals, logs, worktrees, and project history, this gives you a calm way to inspect what is going on and reduce local drag.
- This skill helps you organize local state without losing context.
- The rule is simple:
- > Make handoffs first. Archive, don't delete. Apply changes only when you are ready.
- ## Three Modes
- - **Inspect:** report-only, no writes.
- - **Maintain:** normal apply; backs up, archives old sessions, moves stale worktrees, rotates logs, prunes dead config, and normalizes paths. It does not trim thread title/preview metadata.
- - **Optional repair:** only with `--apply --repair-thread-metadata-bloat`; shortens oversized SQLite display title/preview metadata after backup. The transcript stays intact.
- ## Who This Is For
- Use this if Codex has started feeling slower after heavy use, especially if you:
- - keep long chats around
- - resume old threads often
- - work across many repos
- - run multiple terminals or dev servers
- - want maintenance to feel safe, not scary
- ## What It Does
- By default, this skill only reports. It does not write files, create backups, move folders, or change local Codex state until you explicitly ask it to.
- It helps Codex:
- - see which local state has grown over time
- - create handoff docs before archiving old chats
- - back up important state before applying changes
- - archive old chats instead of deleting them
- - detect pathological thread title/preview metadata that can slow chat navigation
- - move stale worktrees out of the hot path
- - rotate large logs
- - prune dead project references
- - report heavy Node/dev processes without killing them
- ## Quick Start
- Ask Codex:
- ```text
- Use $keep-codex-fast to inspect my Codex local state and recommend a safe maintenance plan.
- ```
- Codex should show you what it found first. Then you decide what to hand off, what to keep active, and what can be archived.
- ## Handoffs First
- Before archiving old active chats, create handoff documents for any repo/session you may want to continue.
- A handoff is a small continuity note. It captures:
- - what you were doing
- - what changed
- - what files matter
- - what commands or checks already ran
- - what is still broken or undecided
- - what to do next
- That lets you archive the heavy chat and start a fresh Codex thread from the handoff.
- Copy this into each active repo chat you care about:
- ```text
- Create a comprehensive handoff document for this repo/session before I archive Codex history.
- Include:
- - repo/path and branch
- - current goal
- - what we already completed
- - files touched or investigated
- - commands/tests already run
- - known errors, warnings, or failing checks
- - open decisions
- - constraints, user preferences, and do-not-touch areas
- - the next 3-7 concrete steps
- Also include a reactivation prompt I can paste into a fresh Codex chat so it can continue from this handoff without relying on the old chat context.
- Save the handoff in a sensible repo-local place like docs/codex-handoffs/YYYY-MM-DD-topic.md unless this repo already has a better handoff location.
- ```
- ## Safe Apply
- After handoffs exist for the chats you care about, use this:
- ```text
- Use $keep-codex-fast to apply safe Codex maintenance.
- Before changing anything, confirm that important active repo chats have handoff docs or do not need them.
- Then back up first, archive instead of deleting, move stale worktrees, rotate large logs, prune dead config references, and verify the result.
- If Codex is currently running, do not mutate local state. Tell me to close Codex first.
- ```
- ## Thread Title And Preview Bloat
- Some Codex builds can store a full first user prompt as both the thread title and the list preview. When those fields grow into hundreds of thousands of characters, thread navigation can become sluggish even before a large chat is opened.
- The script reports title and preview payload size in report mode and normal apply mode. It does not trim this metadata unless you explicitly opt in:
- ```bash
- python scripts/keep_codex_fast.py --apply --repair-thread-metadata-bloat
- ```
- With that flag, after backing up and only when Codex is not running, it trims active SQLite title/preview metadata to bounded display values. It also appends repaired titles to `session_index.jsonl`, which matches current Codex name-update storage.
- This does not remove the actual conversation transcript. The full rollout JSONL remains available unless you separately archive the session.
- The repair manifest stores the old full title/preview values so you can restore them. Keep the backup folder private, especially `thread-metadata-repairs.jsonl` and `restore-thread-metadata.py`.
- If you are using the skill normally, this repair does not happen automatically. Treat it as an extra recommendation only when the report shows unusually large title/preview metadata.
- ## Weekly Or Biweekly Reminder
- Recurring maintenance should be a reminder, not an automatic apply.
- Why: an automation cannot know whether you created handoffs for chats you still care about. It should inspect and remind you, but not archive, move, prune, rotate, normalize, delete, or mutate anything by itself.
- Copy this into Codex:
- ```text
- Use $keep-codex-fast to create a recurring Codex maintenance reminder.
- Schedule it weekly if I use Codex heavily, or biweekly if that seems safer.
- The reminder should:
- - run the keep-codex-fast report first
- - never pass --apply or run mutating maintenance automatically
- - never archive, move, prune, rotate, normalize, delete, or mutate local Codex state
- - remind me to create comprehensive handoff docs and reactivation prompts for active repo chats before any manual apply
- - summarize active session size, archived session size, extended path candidates, old session candidates, worktree candidates, log size, and top Node/dev processes
- - report heavy Node/dev processes without killing them
- - tell me that manual apply should only happen after I confirm handoffs exist or are not needed and Codex is closed
- ```
- ## Install
- Ask Codex:
- ```text
- Install the keep-codex-fast skill from https://github.com/vibeforge1111/keep-codex-fast
- ```
- Or clone/copy this folder into your Codex skills directory as `keep-codex-fast`.
- ## Advanced: Manual Script Use
- Most users can stay inside Codex and use the prompts above. The script is here for people who want to run it directly.
- Report only. This is read-only and privacy-safe by default:
- ```bash
- python scripts/keep_codex_fast.py
- ```
- Show raw thread IDs, chat titles, paths, and process paths only when you need detail:
- ```bash
- python scripts/keep_codex_fast.py --details
- ```
- Create backups only, without moving or changing local state:
- ```bash
- python scripts/keep_codex_fast.py --backup-only
- ```
- Backup folders can contain private local Codex metadata. Keep them on your machine, and do not publish or share them unless you have reviewed what is inside.
- Apply core maintenance actions. This does not trim thread title/preview metadata:
- ```bash
- python scripts/keep_codex_fast.py --apply --archive-older-than-days 10 --worktree-older-than-days 7
- ```
- Optionally repair oversized title/preview metadata only when the report recommends it:
- ```bash
- python scripts/keep_codex_fast.py --apply --repair-thread-metadata-bloat
- ```
- Wait for Codex to exit before applying:
- ```bash
- python scripts/keep_codex_fast.py --apply --wait-for-codex-exit
- ```
- ## What Can Change
- The skill can safely handle:
- - old non-pinned active sessions
- - stale worktrees
- - large `logs_2.sqlite*` files
- - dead/temp project entries in `config.toml`
- - Windows `\\?\C:\...` path mismatches in local SQLite text fields
- - oversized thread title and first-message preview metadata in `state_5.sqlite`, only with `--repair-thread-metadata-bloat`
- It does not permanently delete chats, logs, or worktrees. It moves them into archive folders and writes backup/restore artifacts before applying changes.
- ## Mental Model
- - Chats are for execution.
- - Handoff docs are for memory.
- - Archives are for history.
- - Fresh threads are for speed.
- ## Flow
- 
Ratings and comments
Sign in to rate this skill.
Sign inFree to use. If it’s helped, pass it on.