paste into the Codex chat together with the guide fileBuild me a working Codex setup from the attached guide “Keep your GPT sharp”, then fine-tune it together with me.
There are no ready-made files: you create everything yourself from this prompt; the guide is a model of how it's built. Product, desk and server names and the numbers in the guide are the author's: you carry over the structure, not them. Config and hook syntax — only what exists in the Codex docs (learn.chatgpt.com/docs). A key or flag that doesn't exist in my version of Codex — don't set it: say so and skip it. Go step by step, don't skip ahead.
## Rules for the whole job
- Don't overwrite existing files: only a diff and my “yes”. New files are fine.
- Before editing ~/.codex/config.toml, .codex/config.toml, hooks.json, files in .codex/rules and the VS Code settings.json — a backup next to it: ‹name›.bak-YYYYMMDD-HHMM, then a diff, then my “yes”.
- Don't read or print secrets (~/.ssh, .env, keys, tokens, wallets, seed phrases, ~/.codex/auth.json), don't put them into memory, chat or git. If you see such a file — name only its path.
- Deploy nothing to servers, no restarts, git push — only with my “yes”. Don't touch anything I call off-limits.
- Work mode — sandbox workspace-write. The .git, .codex and .agents folders are read-only in it: writes there and commits go through confirmation. Warn me in advance which steps will ask for it.
- Everything the agent writes often (deadline registry, cases, templates, memory) — outside .codex: in ops/ and memory/ in the project root.
- Keep a list of every file you created or changed — it's needed for rollback.
- Run every hook with test input and show the output. Not checked — say so.
- Talk to me in plain words: I may not know the terminal or git. If I have to do something — one step per line and what it does.
## Step 1. Read and look around (change nothing)
1. Read the whole guide.
2. Project: AGENTS.md and AGENTS.override.md at every level from the git root to the current folder; .codex/ (config.toml, hooks.json, agents/, rules/); .agents/skills/; STATE.md; test and build commands (package.json, Makefile, pyproject, etc.).
3. The Codex home folder: echo $CODEX_HOME (empty means ~/.codex); in it AGENTS.md, config.toml, hooks.json, agents/, rules/; plus ~/.agents/skills/.
4. Tools: codex --version, python3 (parsing TOML needs 3.11+), node, bash, git; is gh installed and logged in (gh auth status). Is the folder already a git repository? Is there a remote?
5. Is there a Claude Code setup (CLAUDE.md, .claude/)? Tell me: Codex carries it over itself with the /import command in terminal codex — rules into AGENTS.md, settings.json into config.toml, hooks, agents, MCP. I run the import; after it, compare the result with this prompt.
6. Files that look like secrets (.env*, *.key, *.pem, id_rsa*, id_ed25519*, *keypair*.json, wallet*, seed*, auth.json): only a list of paths, don't open them.
7. Briefly show what already exists and what will conflict.
## Step 2. Questions (in one message, numbered)
1. What are you building and how do you make money; the main goal, ideally as one number.
2. Which areas do you run, by importance. They'll become desk sessions; where is each one's folder.
3. Stack: languages, frameworks, services. Is there a server where prod lives, and how do you deploy now.
4. What is irreversible and done only with your “yes” (money, wallets, broadcasts, data deletion, other people's services).
5. Sign-in and models: a ChatGPT subscription (which plan) or an API key; which models show up in /model; the main model's context window (shown in /status).
6. Which language should I talk to you in, and text rules: tone, banned words and letters.
7. How to check each project: a test or build command; if there isn't one — what counts as “works”.
8. What must never be touched: folders, services, projects.
9. GitHub: do you have an account; what to name the private repository; push after every task on my own or only on your word.
Don't guess. No answer — leave a ‹answer› placeholder and carry it into the report.
## Step 3. Plan — wait for “yes”
Show a list grouped by the sections of step 4: files to create, edits to existing ones as a diff, config.toml and hooks.json blocks, context thresholds in tokens, subagent models, the first desk and its entry phrase, what goes into git and what into .gitignore. You don't go further without my “yes”.
## Step 4. Build — in the order of the guide's sections
### 4.1 Workplace
- We work in VS Code: the Codex extension (openai.chatgpt) or codex in the VS Code terminal, in the open project folder. The regular ChatGPT chat is for the subscription and cloud tasks, not for work.
- VS Code user settings.json: "chatgpt.openOnStartup": true.
- ~/.codex/config.toml (keep my keys, extend tables; top-level keys go before the first table):
model = "‹master model from answer 5›"
approval_policy = "on-request"
sandbox_mode = "workspace-write"
model_auto_compact_token_limit = ‹90% of the window from answer 5, in tokens›
[agents]
max_concurrent_threads_per_session = 3
default_subagent_model = "‹subagent model from answer 5›"
[projects."‹absolute project path›"]
trust_level = "trusted"
Don't set model_reasoning_effort: each model has its own default effort; raise it per the quality rule in 4.6.
Key check: codex exec --strict-config "answer in one word: ok" (outside a git folder add --skip-git-repo-check) — fails if a key doesn't exist in my version.
- In the report, one line per key on why: on-request + workspace-write — the agent edits inside the project folder on its own and asks before going outside it or to the network; max_concurrent_threads_per_session — no more than three subagents at once; default_subagent_model — without it a subagent takes the master's model and effort; trust_level — without trust Codex doesn't load the project's .codex/ (config, hooks, rules); auto-compaction is only a safety net at the wall.
- Codex saves chat history on its own; don't set [history] max_bytes, so old history isn't cut off.
- A desk = its own chat: the first phrase says which area it is; in the terminal name it via /rename ‹desk›, come back with codex resume or /resume. Start with one or two desks, not all of them.
- Models: master — the model for everyday work (at OpenAI that's GPT-6.2 Sol), hard stuff — one step up (GPT-6.2 Astra), subagents — same as the master, mechanics and search — the cheapest (GPT-6 Luna). What's available — per /model and answer 5.
### 4.2 Private GitHub — .gitignore before the first commit
1. Folder not in git — git init, branch main.
2. .gitignore first: .env, .env.*, *.key, *.pem, id_rsa*, id_ed25519*, *keypair*.json, auth.json, wallet and seed phrase files, *.bak-*, node_modules/, .venv/, dist/, __pycache__/, .codex-log/, large data and logs.
Check: git check-ignore -v .env fires; git status shows not a single file from the secrets list of step 1.
3. Project memory lives in memory/ in the root — it's in git anyway. Global rules live outside the folder — a copy of them goes into the repository. Script ops/sync-copy.sh: ~/.codex/AGENTS.md, ~/.codex/agents/, ~/.codex/hooks.json, ~/.codex/rules/ → codex-global-copy/; ~/.codex/config.toml — a copy without lines containing secrets (http_headers values, oauth client_secret). Never copy auth.json or the folders of Codex's built-in memories (memories, memories_v2).
4. First commit — after the self-check (step 5): sync-copy.sh, git add, then git diff --cached --name-only and compare against the secrets list. Found something — stop and tell me.
5. Private repository. gh installed and logged in: gh repo create ‹name› --private --source . --remote origin (without --push).
No gh or git — explain to me step by step: install git (Mac: xcode-select --install, Windows: git-scm.com); on github.com New repository → Private → no README; send you the URL. You add the remote.
The first git push -u origin main — only after my “yes”.
6. A “Versions and rollback” section in AGENTS.md: after every finished task — sync-copy.sh and a one-line commit “what was done”; push — as in answer 9.
Rollback: git log --oneline → git revert ‹commit› (safe, history stays) or a single file: git restore --source ‹commit› ‹file›.
Explain it to me in words: “restored file X as it was in the commit from ‹date›”. git push --force and git reset --hard — only with my “yes”.
### 4.3 Project rules, desks and STATE
- AGENTS.md in the project root from the answers. Sections:
who and what — the product in one line, the target number, the entry phrase;
style — answer 6, direct and to the point, no pleasantries;
boundaries — product development is my zone, the agent is executor, reviewer and debugger, don't invent a backlog unasked; plan first, then work, after “yes” — a finished result with no interim reports; “done” only after a check (if there's prod — on the live URL from outside, without cookies); the irreversible from answer 4 — only with “yes”; the off-limits from answer 8; don't swap my task for your own, related stuff — as a list at the end of the report; money and trading rules (limits, stops, pause) are enforced by code with a test, not by the agent's memory;
check — a command for each project from answer 7, “done” only after it; no check — build it first, then the code;
diagnostics — one hypothesis at a time, out loud; at most three checks, then a report on what you ruled out, and a question; don't deploy during diagnostics; fix what broke;
always-on work — deadlines into the registry, not into text; memory holds only what can't be looked up again; STATE is short; a hard rule is a hook or a ban, not a line here;
versions and rollback (4.2) · subagents (4.5) · context and compaction (4.6) · ## Code Review Rules — what to flag when Codex reviews in GitHub.
- Size: the project's AGENTS.md up to 16 KiB, ~/.codex/AGENTS.md (style and boundaries for all projects from answer 6) up to 8 KiB. The whole chain shares 32 KiB (project_doc_max_bytes); Codex silently doesn't load the tail beyond the limit. A big section — as a separate file in docs/, with a link in AGENTS.md and when to read it.
- A desk = a session for one area from answer 2. Build the first one now. Its STATE.md (target under 25 KB, limit 60 KB):
# STATE ‹desk› — updated ‹YYYY-MM-DD HH:MM› UTC
## Live — what, when deployed, file and md5, where the backup is, how to roll back
## Open — the task, where we stopped, the next step as one action
## Waiting on me — as one list, with a recommendation; remove closed items so I'm not asked again
## Deadlines — not here, in the registry (4.8)
History — in docs/history/STATE-‹year-month›.md: move it, don't delete.
- The desk's entry prompt for the phrase “‹desk›, let's continue”: what to read and in what order (AGENTS.md, STATE, HANDOFF).
- HANDOFF.md in the root — a log between desks, line format “- ‹date UTC› ‹from› → ‹to›: ‹what›”. Messages between sessions (codex queue) in batches, one for several topics; whatever can wait goes into HANDOFF. A desk writes its report on what's done as a line in its own STATE, not as a message.
### 4.4 Memory and index
- memory/MEMORY.md is the index: one line = one topic with a link to the file. Header:
# Memory index. One line = one topic. Time in UTC.
# Printed by the start hook: keep under 120 lines. A section has grown — into a sub-index _index_‹topic›.md, one link stays here.
- A line in AGENTS.md: “Memory — memory/. The index arrives at startup from the hook; open the file you need via its link, don't read the whole folder”.
- Memory file:
---
name: ‹type›_‹short›
description: ‹one sentence on when this is needed: the agent sees only this in the index and decides from it whether to open the file›
metadata:
type: feedback | project | reference | user
---
**Rule:** what to do, in one sentence.
**Why:** the incident with a date. Without a reason, a month later the rule will be judged outdated.
**How to apply:** a check that can be done by hand.
(later) **‹date› — closed by code:** where it's enforced now and which test.
Create one such file from my answers as an example.
- Codex's built-in memories ([features] memories = true) — only if I ask and only as a hint: don't store rules in them, don't edit or commit their files in ~/.codex.
- Into memory — only what can't be looked up again. Whatever lives in a database, a file or on a server — a pointer and a command, not a copy of the numbers.
- My “don't do that again” → a memory file and an index line right away. Broken a second time → a hook, a test or a rule in .codex/rules.
- Weekly review: orphans (files with no link from the index), outdated stuff, duplicates, contradictions with AGENTS.md. Don't silently rewrite a contradicting file: put a note at the top “> **Update ‹date›:** ‹what's wrong and what the fix is›”, the fix after my “yes”.
### 4.5 Subagents
- Agents in .codex/agents/, one TOML per agent. Required fields name, description, developer_instructions; the model — model and model_reasoning_effort set explicitly (a level from the model's list in /model): without them a subagent inherits the master's model and effort. The agent takes its sandbox, approvals and MCP from the parent; the file doesn't change them. Template:
name = "executor"
description = "Subtask executor working from a brief: edits only the files in the brief and hands in proof."
model = "‹subagent model›"
model_reasoning_effort = "‹level›"
developer_instructions = """
You are the executor. Your inputs are only the BRIEF.md file (and CONTRACT.md), path given in the task.
1. Read the brief and the files it names; others only if you can't do without them, and say which.
2. The minimal change that fully solves the task: what already exists in the project → standard library → new code. No abstractions “for the future”.
3. Branching, money, parsers, security — at least one test or assert. Mark a deliberate simplification shortcut: ‹limitation›, ‹when to update›.
4. Run the check from the brief. Answer in up to 15 lines: files and md5, the check command and its output, what's unchecked and the risk.
Bans: ssh, scp, server restarts, edits outside the brief's paths, plus the bans from answers 6 and 8.
"""
mechanic — the cheapest model; tests, md5, grep, copies; no decisions and no prod.
explorer — a file with name = "explorer" replaces the built-in agent of the same name: the cheapest model, only read and search, edit nothing.
skeptic — not an agent file but a separate read-only run (an agent file won't narrow the sandbox): the script ops/skeptic.sh ‹brief folder› does git diff | codex exec --sandbox read-only --ephemeral -o ‹brief folder›/REVIEW.md "‹skeptic role + path to BRIEF.md›". The skeptic reads the brief and the diff, runs the check, gives a score 1–10, flags only blockers; “no blockers” is a normal answer; 7 or higher — OK to deploy.
- Templates in ops/templates/:
BRIEF.md: # ‹code› — ‹what to do in one line›; project root; contract — CONTRACT.md next to it; You edit ONLY: ‹files›; Don't touch: prod, server, Codex settings, secrets; Why (2–3 lines); What to read first (files and lines); What to do (numbered, every item checkable; tests for empty, zero, dependency failure; old tests green); Check: ‹command› → ‹what it prints›; Report up to 15 lines; don't deploy.
CONTRACT.md: # ‹Feature› — contract between subtasks; source of the decision and a data check of the idea (a number or “never happened”); constants (one name everywhere); fields and schema (name, type, meaning, what if there's no data); calculation rules and edge cases; files and events (who writes, who reads); the master's post-review decisions with a date.
- Subagent rules in AGENTS.md (Codex calls subagents when the task or this file explicitly says so — write down which ones to call for what):
the master (main session) does the breakdown, plan, report and deploy itself;
no more than 3 agents at once (enforced by the agents.max_concurrent_threads_per_session key); a batch of more than three — queued in threes;
inputs go as a file before launch, not as messages along the way;
small code up to ~150 lines the master writes itself, a subagent is for big code;
skeptic — only for money and numbers for users, everything else — /review or codex review --uncommitted;
the skeptic isn't a gate: show reversible things right away, irreversible ones wait for the verdict;
one review round, a second only if the score is 6 or lower; review fixes — by the same executor while its thread is open, otherwise a fresh one with the brief and the diff;
search and mechanics — on the cheapest model; ssh and restarts are banned for subagents (enforced by the hook from 4.7).
### 4.6 Context and /clear
- In AGENTS.md:
one chat — one outcome; don't switch models mid-session — the cache holds on an unchanged beginning of the conversation, and in Claude a model switch wiped it (for Codex there's no direct answer, we keep the rule out of caution);
limit ran out — wait for the reset (what's left is in /status), or /clear and a new session on a lower model;
soft threshold — between steps prepare a continuation prompt in STATE; hard — finish the step and advise me to /clear (in the extension — a new chat); after that — the desk's entry phrase;
read images in batches and once, large files and logs — in parts;
quality isn't enough — first a check, then effort up one step (/model --reasoning=‹level›), then a higher model.
- Compaction: the start hook also fires after history compaction (the compact event) and prints “Waiting on me” and the entry phrase again. A custom compaction instruction — the compact_prompt key in config.toml, only with my “yes”: it overrides the compaction prompt, so write the text in full (our advice) — keep the goal and the “done” criterion, changed files with md5, what's deployed and what isn't, open decisions, check commands, the next step; drop log output, intermediate hypotheses, contents of files read.
- The context counter itself is the ctx-log and ctx-guard hooks in 4.7.
### 4.7 Hooks, bans and harness check
Scripts in .codex/hooks/, python3 and bash with no dependencies. Input for all of them is one JSON on stdin: session_id, transcript_path, cwd, hook_event_name, model, then the event's fields. OpenAI doesn't promise to keep the transcript format stable — don't rely on it. The hook's own error — exit 0, don't break the turn. Paths in commands — from the git root: "$(git rev-parse --show-toplevel)/.codex/hooks/‹script›".
a) session-start.sh (SessionStart, matcher "startup|resume|clear|compact"). Read-only. Codex passes plain text from stdout to the model as context. Prints up to 40 lines: date in UTC; overdue items and the next 3 days from the deadline registry; the last 3 lines of HANDOFF.md; the “Waiting on me” block from STATE.md; how many files are uncommitted (git status --short | wc -l); one line of the harness check (“harness N of M” and the FAIL names); once a week — memory review candidates: files older than 21 days with no link from the index (week stamp — ops/.memory-review-stamp). At the end — memory/MEMORY.md. Always exit 0.
b) ctx-log.py (PostModelRequest). agent_id in the input means it's a subagent — exit. Takes token_usage.input_tokens of the last request and writes the number into a temp file with session_id in its name. The model doesn't see this event's output — only the file. Verify on your own output that cached_input_tokens is included in input_tokens (it is in OpenAI's example), and don't add them twice. exit 0.
ctx-guard.py (UserPromptSubmit and PostToolUse). Reads the number from the file. Thresholds — constants at the top of the script, in tokens: SOFT = 65% and HARD = 70% of the window from answer 5. Below soft — exit 0 with no output.
Soft: to the model “context ~Nk, between steps prepare a continuation prompt in STATE, keep working”. Hard: “finish the step, the prompt must be ready, advise /clear”. It cleans nothing itself — I decide.
Output — one JSON line: {"systemMessage": "‹line for me›", "hookSpecificOutput": {"hookEventName": "‹event›", "additionalContext": "‹text for the model›"}}.
On PostToolUse — hard only, and no more often than once per 25000 tokens (state — a temp file with session_id in its name). exit 0.
c) stop-verify.py (Stop). stop_hook_active true in the input — exit 0 with no output.
Takes project files changed since the last stop (marker — a temp file with session_id, the first time — the last 15 minutes; plus git status --porcelain).
Checks: .py — python3 -m py_compile; .js .mjs .cjs — node --check; .sh — bash -n; .json — parse; .toml — tomllib. Skips node_modules, .venv, .git, dist, __pycache__. Timeout per file 20 s.
Errors found — a list to stderr (file and the last line of the error, up to 8 of them) and exit 2: Codex won't finish, it continues with this text as a new task. No errors — exit 0 and empty stdout (Codex treats plain text on this event as an error).
Full project tests — not here, but before deploy, with the single command from the “check” section.
d) pre-tool-guard.py (PreToolUse, matcher "Bash|apply_patch"). Looks at tool_input.command. Deny if the command reads or writes ~/.ssh, .env*, ~/.codex/auth.json, key and wallet files from step 1; contains git push --force, git reset --hard, rm -rf; bare ssh and scp (to the server — only via the deploy script from 4.10); touches the off-limits from answer 8.
Deny — JSON {"hookSpecificOutput": {"hookEventName": "PreToolUse", "permissionDecision": "deny", "permissionDecisionReason": "‹why; what to do — ask me›"}}. Otherwise exit 0 with no output. This is a safety net, not a complete boundary (as OpenAI says), so secrets also go into .gitignore.
e) .codex/rules/project.rules — rules for commands outside the sandbox, prefix_rule syntax from the docs: git add and git commit — decision "allow"; git push, the deploy command and everything irreversible from answer 4 — "prompt"; each rule has a justification and match and not_match examples.
Check: codex execpolicy check --pretty --rules .codex/rules/project.rules -- git push origin main → prompt.
f) health.py — the harness check, deterministic, no network. One line per item: OK or FAIL with a reason; at the end “N of M”; the --line flag — only the summary line; FAIL — exit 1. Items:
AGENTS.md exists; the ~/.codex/AGENTS.md + project AGENTS.md chain under 32 KiB; memory index under 120 lines and every link points to a file; memory files without a link — as a list; config.toml parses (tomllib); hooks.json is valid JSON; every hook from hooks.json exists and passes a syntax check; ctx-log, ctx-guard, stop-verify and pre-tool-guard are connected; every .codex/agents/*.toml has name, description, developer_instructions and model; ops/skeptic.sh calls codex exec with --sandbox read-only; STATE.md under 60 KB; .gitignore covers .env and keys, git ls-files has no files from the secrets list; the deterministic cases of the mistake catalog (4.9) pass.
Run it after any edit to rules, memory, settings, hooks or agents.
g) Wiring — the project's .codex/hooks.json (backup, diff, “yes”), format from the Codex docs:
{"hooks": {
"SessionStart": [{"matcher": "startup|resume|clear|compact", "hooks": [{"type": "command", "command": "bash \"$(git rev-parse --show-toplevel)/.codex/hooks/session-start.sh\"", "additionalContextLimit": 6000}]}],
"PostModelRequest": [{"hooks": [{"type": "command", "command": "python3 \"$(git rev-parse --show-toplevel)/.codex/hooks/ctx-log.py\""}]}],
"UserPromptSubmit": [{"hooks": [{"type": "command", "command": "python3 \"$(git rev-parse --show-toplevel)/.codex/hooks/ctx-guard.py\""}]}],
"PostToolUse": [{"matcher": "*", "hooks": [{"type": "command", "command": "python3 \"$(git rev-parse --show-toplevel)/.codex/hooks/ctx-guard.py\""}]}],
"PreToolUse": [{"matcher": "Bash|apply_patch", "hooks": [{"type": "command", "command": "python3 \"$(git rev-parse --show-toplevel)/.codex/hooks/pre-tool-guard.py\""}]}],
"Stop": [{"hooks": [{"type": "command", "command": "python3 \"$(git rev-parse --show-toplevel)/.codex/hooks/stop-verify.py\"", "timeout": 60}]}]
}}
Codex won't run a new or changed hook until I trust it: tell me to restart codex in the terminal, type /hooks and trust each one. After any hook edit — /hooks again.
This is exactly “a hard rule is a hook or a ban”: pre-tool-guard refuses even if asked; a prompt rule waits for my manual “yes” every time.
### 4.8 Deadline registry
- .codex/hooks/followups.py, stdlib only, file ops/followups.json:
add YYYY-MM-DD "what" [--owner desk] [--ref file] → prints the id;
due [--days 3] → overdue (“OVERDUE N d”), today and upcoming, with the owner in brackets;
list → all open; done id → close with a date.
- A line in AGENTS.md: “Deadlines go into the registry, not into text. Any future date (check, renew, key expires) — followups.py add; done — done ‹id›”.
- A line in session-start.sh: python3 "$(git rev-parse --show-toplevel)/.codex/hooks/followups.py" due --days 3 2>/dev/null || true
### 4.9 Mistake catalog
- ops/evals/cases.json — an array of cases. One case:
{"id": "‹desk›-‹what broke›", "department": "‹desk›", "source": "memory/‹memory file with the rule›.md",
"situation": "‹the task the way I phrase it›", "trap": "‹what went wrong, with the cost›",
"expected": "‹what the agent should do instead›",
"grader": {"type": "deterministic", "check": "‹a command that fails on a violation›"},
"severity": "users | money | time | data"}
If code can't catch it yet: "grader": {"type": "rubric", "check": ["‹question for the reviewer›?", "…"]}.
- Rule in AGENTS.md: a new rule after a mistake = a new case right away, five lines of JSON. Over time turn question-based cases into commands.
- Now — one case from my answers (for example, about the irreversible from answer 4).
### 4.10 Server — plan only, install nothing
If answer 3 mentions a server — into the report and into the deadline registry for week 2–4:
- one deploy command: tests → lock “one deploy at a time” → a backup with as many copies as there are prod files, otherwise stop → upload under a temp name and syntax check → swap all files at once → restart → smoke test → outside check over https without cookies → a line in STATE (time, files, md5, backup path); failure after the swap — rollback from the backup with one command; in .codex/rules this command is "prompt";
- one sender for service notifications: a log as JSON lines, a repeat pause per key of one day, a “handled” mark; the alert text names what broke, the cause and whose zone it is; new watchdogs start quiet;
- an on-call agent — only once there's an event log: an hourly timer (cron or systemd); nothing new — no model call; something new — timeout 300 codex exec --sandbox read-only --ephemeral -m ‹cheapest model› -o ‹answer file› "‹what to triage›"; codex exec has no turn or spend cap — timeout enforces it, spend is recorded from --json (the turn.completed event); sign-in on the server — codex login --device-auth or CODEX_API_KEY for this call only; it fixes nothing, writes the owner one line;
- long tasks while the laptop is closed — cloud Codex (the task runs in the cloud, the result is a pull request): only if I ask.
### 4.11 Deadlines
Every deadline I've mentioned — into the registry. Plus one in 7 days: “a week with the setup: review of rules and memory”.
## Step 5. Self-check (show me the output)
- Every hook with test input:
echo '{"session_id":"t","transcript_path":null,"cwd":"/tmp","hook_event_name":"Stop","stop_hook_active":false}' | python3 .codex/hooks/stop-verify.py; echo $?
stop-verify: a deliberately broken temp .py → exit 2 and text in stderr, then delete it.
ctx-log and ctx-guard: a temp file with a number above the hard threshold → JSON with both fields; below soft → silence.
pre-tool-guard: {"tool_name": "Bash", "tool_input": {"command": "cat ~/.ssh/id_ed25519"}} → JSON with deny; the ls command → silence.
session-start: run → up to 40 lines plus the memory index, exit 0.
followups: add, due, done on a test entry, then remove it.
codex execpolicy check: git push origin main → prompt, git commit -m t → allow.
- python3 .codex/hooks/health.py — the full output. Goal — no FAIL; if one remains — what it is and how to close it.
- git: git check-ignore -v .env fires; git status is clean after the commit; git log -1 shows the first commit.
- Tell me: restart codex, type /hooks and trust the hooks. Then a rules check: codex --ask-for-approval never "Summarize the current instructions." — Codex should retell the global AGENTS.md and the project's AGENTS.md.
## Step 6. Commit and report
- First commit per 4.2. Push — only after my “yes”.
- What was created and what changed: the path and one line on what's inside. Where the settings backups are.
- Rollback: which files to delete, which config.toml and hooks.json backups to restore, which diffs to revert; the commit to go back to.
- The first desk's entry phrase and the ‹answer› placeholders that stayed empty.
- A 7-day tuning plan:
day 1 — one check command per project in AGENTS.md;
days 2–3 — every “don't do that again” from me goes straight into a memory file, an index line and a catalog case;
days 4–5 — a second desk with its own STATE and entry phrase; the first big task — to a subagent, brief as a file;
day 7 — health.py, a review of memory and rules (orphans, outdated, duplicates, contradictions), /hooks — all trusted, a check that everything is committed and pushed.
Every mistake becomes a rule, a repeated one — a hook, a test or a rule in .codex/rules.