slaguru666andClaude Opus 5 9d177e1f74 Preserve the managed block's interior; keep root keys at the document root
Builds on aedbf8a, which fixed the discard-everything-after-the-block bug.
Two related faults remained, both reproducible on a config that has drifted:

1. The block's interior was still dropped. Where an older kit let the end
   marker drift below content Codex had written, real [plugins.*] and
   [projects.*] sections ended up *inside* the block, so discarding it
   deleted them. This was the live state on the macOS machine: the markers
   spanned lines 15-88 with plugins, marketplaces, projects and
   mcp_servers.graphiti between them. The interior is now filtered like the
   rest, which also heals the layout in a single run.

2. Bare root keys were still landing under a table. With the block emitted
   after `before`, and `before` ending in [sandbox_workspace_write], TOML
   bound model/web_search/project_doc_max_bytes to that table rather than to
   the document root. Output is now ordered: root keys, managed block, then
   tables.

Against a fixture with a plugin inside the block and an mcp_server after it,
aedbf8a yields:

  swallowed plugin kept: False
  sandbox keys: [network_access, model, model_reasoning_effort,
                 project_doc_max_bytes, web_search]
  root keys:    [approval_policy]

and this commit yields:

  swallowed plugin kept: True
  after-block mcp kept:  True
  sandbox keys: [network_access]
  root keys:    [approval_policy, model, model_reasoning_effort,
                 project_doc_max_bytes, web_search]

BOM handling, profile file layout and model choices from aedbf8a are
unchanged. Verified on macOS: repeated runs are byte-identical, all 13
plugins / 3 projects / 6 mcp_servers survive, and `codex exec --profile deep`
works.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-04 23:13:33 +01:00
2026-04-12 14:05:48 +01:00
2026-04-12 14:00:55 +01:00
2026-04-12 14:00:55 +01:00
2026-04-12 14:00:55 +01:00

Codex Ops Kit

This repository turns a local Codex setup into something you can keep lean, remember more usefully, and share across machines without dragging along secrets or multi-gigabyte session logs.

What We Improved

  • Added explicit Codex profiles for economy, balanced, and deep work.
  • Added a short global AGENTS.md pattern that tells Codex where to find durable memory without bloating every session.
  • Added portable memory files you can keep in Git and sync between machines.
  • Added audit, export, install, and session-maintenance scripts.
  • Documented research-backed guidance from current OpenAI docs plus community findings.

Findings From This Machine

Audit date: 2026-04-12

  • ~/.codex/sessions was about 2.8G.
  • ~/.codex/state_5.sqlite was about 227M.
  • ~/.codex/memories was empty.
  • Current config only set the model and plugin flags, so there were no cost-oriented profiles or memory workflow conventions in place.

The biggest issue was not a lack of raw stored data. It was that durable, reusable knowledge was not being separated from bulky transcript history.

Repo Layout

  • docs/research.md
  • docs/new-machine-setup.md
  • templates/global/AGENTS.md
  • templates/global/config.toml
  • memory/
  • scripts/

Local Setup

Install this kit into your current Codex home:

bash scripts/install_codex_kit.sh

Set up a fresh machine from this repo:

git clone https://github.com/slaguru666/codex-ops-kit.git
cd codex-ops-kit
bash scripts/install_codex_kit.sh

Create a portable export bundle you can move to another machine:

bash scripts/export_codex_portable.sh

Audit your live Codex home:

bash scripts/audit_codex_home.sh

Preview old session files that are taking space:

bash scripts/prune_codex_sessions.sh

Archive old session files after reviewing the plan:

bash scripts/prune_codex_sessions.sh --apply

Extract a markdown summary skeleton from a large session transcript:

python3 scripts/session_to_memory.py ~/.codex/sessions/2026/03/19/rollout-....jsonl

Use balanced for normal work, economy for quick edits and low-risk tasks, and deep only for the hard stuff.

Keep AGENTS.md concise. Put stable personal preferences, project summaries, and long-lived decisions into the markdown files under memory/.

When a long session finishes, distill the durable facts into memory notes instead of relying on Codex to rediscover them from old transcript files.

Run the audit script periodically. If session storage balloons again, archive the biggest old transcripts instead of letting ~/.codex/sessions become your accidental memory system.

Profiles

  • economy: lowest-cost default for shallow work
  • balanced: everyday profile
  • deep: higher-effort work when architecture or debugging really needs it

Each profile is defined in its own templates/global/<name>.config.toml and is installed to ~/.codex/<name>.config.toml. Select one with codex --profile <name>; plain codex uses the config.toml defaults, which match balanced.

Codex 0.144+ rejects the legacy top-level profile = "..." key and [profiles.<name>] tables, so the kit no longer emits them and strips them from a live config on upgrade.

The installer merges the managed cost and memory block into your live ~/.codex/config.toml, preserving machine-specific settings that appear before the managed block.

New Machine Rollout

Use the short guide in docs/new-machine-setup.md when bringing another Mac or workstation onto the same Codex setup.

S
Description
Portable Codex configuration, memory, and maintenance kit for lower cost and better continuity across machines
Readme
46 KiB
Languages
Shell 71.5%
Python 28.5%