Codex Hygiene
Audit first, identify the measured contributor, and make reversible changes only when the user asks. Keep required evidence and capabilities available.
Workflow
- Resolve this skill's directory from the loaded
SKILL.md path.
- Run the bundled measurement before making claims:
"<skill-directory>/scripts/measure_codex_context.sh" 30
"<skill-directory>/scripts/measure_codex_context.sh" 5 <thread_id>
- Classify the strongest measured contributor:
- large
codex_apps tool surface
- enabled unused MCPs or plugins
- repeated tool-list or uncached snapshot rows
- stale
[projects."..."] stanzas
- long-thread context replay or active transcript rereading
- subagent, automation, or high-reasoning fan-out
- Return exact timestamps and compact counts with one recommended sequence.
- Back up
config.toml before any approved edit.
- Remeasure the same window and thread scope after the change.
Interpret Signals Carefully
- Tool-list and snapshot rows describe context/tool assembly, not actual tool calls.
- Plugin enablement does not prove that plugin tools were attached to the model.
- Cached app inventory can be stale and does not prove current app enablement.
- Per-thread token deltas are local cumulative telemetry, not billing totals.
- Treat internal SQLite schemas and cache layouts as version-dependent.
Guardrails
- Use
sqlite3 -readonly for Codex databases.
- Do not dump full logs, config, app or MCP schemas, secrets,
.env values, or complete missing-path lists.
- Do not delete logs, caches, config, worktrees, or project directories as a first response.
- Do not disable surfaces without explicit user approval or a clear prior preference.
- Preserve small required helpers unless the user asks to remove them. Common examples are
node_repl and openai-api-key-local-confirmation.
- Prefer local
git and gh for ordinary commits, rebases, merges, and pushes when PR, issue, review, CI artifact, or remote API tools are unnecessary.
App Controls
Use current documented per-app controls when only selected connectors should be disabled:
[apps."connector-id"]
enabled = false
Use the global switch only when the user wants all Apps/connectors unavailable or fresh measurement shows that per-app controls do not shrink the surface on that local build:
[features]
apps = false
Verify either change against fresh-thread list_all_tools rows. See the remediation reference for backups, MCP controls, project-local configuration, and observed fallback behavior.
Long-Running Goals
Do not treat a valuable long-running goal as the problem by default. Separate:
- runtime-managed resume, compaction, system, or tool context that may already be attached
- agent-chosen rereading of old rollouts, transcripts, broad plugin docs, or unrelated evidence
A narrowing prompt can stop unnecessary agent-chosen reads; it cannot guarantee that runtime-managed context was removed. Compare with a fresh tiny measurement thread when attribution matters, while preserving the active goal unless the user approves a fork, archive, reset, or replacement.
Read the long-thread reference when the goal must stay alive or final analysis quality must remain high.
Verification
Create a fresh measurement thread when useful:
Please reply exactly: OK
Then rerun the five-minute measurement with that thread id. Good signs include:
- no
codex_apps rows when Apps are globally disabled
- only intentionally available MCPs in
list_all_tools
- fewer or explainable snapshot rows
- lower per-thread cumulative deltas, or a remaining floor attributable to base, system, tool, or thread context
Final Report
Return:
- measured contributor and confidence
- change made or prepared
- capability intentionally retained
- remaining uncertainty or approval boundary
- verification performed
1---2name: codex-hygiene3description: Audit Codex Desktop context and tool surfaces with compact read-only telemetry. Use when usage rises unexpectedly, `codex_apps` is large, many MCPs or plugins are enabled, snapshot rows repeat, project stanzas are stale, or long-running goals may be reloading unnecessary context.4metadata:5 source: https://skillmd.com/skills/openclaw-cn-dev/codex-hygiene6---78# Codex Hygiene910Audit first, identify the measured contributor, and make reversible changes only when the user asks. Keep required evidence and capabilities available.1112## Workflow13141. Resolve this skill's directory from the loaded `SKILL.md` path.152. Run the bundled measurement before making claims:1617```bash18"<skill-directory>/scripts/measure_codex_context.sh" 3019"<skill-directory>/scripts/measure_codex_context.sh" 5 <thread_id>20```21223. Classify the strongest measured contributor:23 - large `codex_apps` tool surface24 - enabled unused MCPs or plugins25 - repeated tool-list or uncached snapshot rows26 - stale `[projects."..."]` stanzas27 - long-thread context replay or active transcript rereading28 - subagent, automation, or high-reasoning fan-out294. Return exact timestamps and compact counts with one recommended sequence.305. Back up `config.toml` before any approved edit.316. Remeasure the same window and thread scope after the change.3233## Interpret Signals Carefully3435- Tool-list and snapshot rows describe context/tool assembly, not actual tool calls.36- Plugin enablement does not prove that plugin tools were attached to the model.37- Cached app inventory can be stale and does not prove current app enablement.38- Per-thread token deltas are local cumulative telemetry, not billing totals.39- Treat internal SQLite schemas and cache layouts as version-dependent.4041## Guardrails4243- Use `sqlite3 -readonly` for Codex databases.44- Do not dump full logs, config, app or MCP schemas, secrets, `.env` values, or complete missing-path lists.45- Do not delete logs, caches, config, worktrees, or project directories as a first response.46- Do not disable surfaces without explicit user approval or a clear prior preference.47- Preserve small required helpers unless the user asks to remove them. Common examples are `node_repl` and `openai-api-key-local-confirmation`.48- Prefer local `git` and `gh` for ordinary commits, rebases, merges, and pushes when PR, issue, review, CI artifact, or remote API tools are unnecessary.4950## App Controls5152Use current documented per-app controls when only selected connectors should be disabled:5354```toml55[apps."connector-id"]56enabled = false57```5859Use the global switch only when the user wants all Apps/connectors unavailable or fresh measurement shows that per-app controls do not shrink the surface on that local build:6061```toml62[features]63apps = false64```6566Verify either change against fresh-thread `list_all_tools` rows. See the [remediation reference](references/remediation.md) for backups, MCP controls, project-local configuration, and observed fallback behavior.6768## Long-Running Goals6970Do not treat a valuable long-running goal as the problem by default. Separate:7172- runtime-managed resume, compaction, system, or tool context that may already be attached73- agent-chosen rereading of old rollouts, transcripts, broad plugin docs, or unrelated evidence7475A narrowing prompt can stop unnecessary agent-chosen reads; it cannot guarantee that runtime-managed context was removed. Compare with a fresh tiny measurement thread when attribution matters, while preserving the active goal unless the user approves a fork, archive, reset, or replacement.7677Read the [long-thread reference](references/long-thread-replay.md) when the goal must stay alive or final analysis quality must remain high.7879## Verification8081Create a fresh measurement thread when useful:8283```text84Please reply exactly: OK85```8687Then rerun the five-minute measurement with that thread id. Good signs include:8889- no `codex_apps` rows when Apps are globally disabled90- only intentionally available MCPs in `list_all_tools`91- fewer or explainable snapshot rows92- lower per-thread cumulative deltas, or a remaining floor attributable to base, system, tool, or thread context9394## Final Report9596Return:9798- measured contributor and confidence99- change made or prepared100- capability intentionally retained101- remaining uncertainty or approval boundary102- verification performed