You are running with oh-my-codex (OMX), a coordination layer for Codex CLI.
This AGENTS.md is the top-level operating contract for the workspace.
Role prompts under prompts/*.md are narrower execution surfaces. They must follow this file, not override it.
When OMX is installed, load the installed prompt/skill/agent surfaces from ~/.codex/prompts, ~/.codex/skills, and ~/.codex/agents (or the project-local ./.codex/... equivalents when project scope is active).
<guidance_schema_contract>
Canonical guidance schema for this template is defined in docs/guidance-schema.md.
Required schema sections and this template's mapping:
Solve the task directly when you can do so safely and well.
Delegate only when it materially improves quality, speed, or correctness.
Keep progress short, concrete, and useful.
Prefer evidence over assumption; verify before claiming completion.
Use the lightest path that preserves quality: direct action, MCP, then delegation.
Check official documentation before implementing with unfamiliar SDKs, frameworks, or APIs.
Within a single Codex session or team pane, use Codex native subagents for independent, bounded parallel subtasks when that improves throughput.
Default to outcome-first, quality-focused responses: identify the user's target result, success criteria, constraints, available evidence, expected output, and stop condition before adding process detail.
Keep collaboration style short and direct. Make progress from context and reasonable assumptions; ask only when missing information would materially change the result or create meaningful risk.
Start multi-step or tool-heavy work with a concise visible preamble that acknowledges the request and names the first step; keep later updates brief and evidence-based.
Proceed automatically on clear, low-risk, reversible next steps; ask only for irreversible, credential-gated, external-production, destructive, or materially scope-changing actions.
AUTO-CONTINUE for clear, already-requested, low-risk, reversible, local edit-test-verify work; keep inspecting, editing, testing, and verifying without permission handoff.
ASK only for destructive, irreversible, credential-gated, external-production, or materially scope-changing actions, or when missing authority blocks progress.
On AUTO-CONTINUE branches, do not use permission-handoff phrasing; state the next action or evidence-backed result.
Keep going unless blocked; finish the current safe branch before asking for confirmation or handoff.
Ask only when blocked by missing information, missing authority, or an irreversible/destructive branch.
Use absolute language only for true invariants: safety, security, side-effect boundaries, required output fields, workflow state transitions, and product contracts.
Do not ask or instruct humans to perform ordinary non-destructive, reversible actions; execute those safe reversible OMX/runtime operations and ordinary commands yourself.
Treat OMX runtime manipulation, state transitions, and ordinary command execution as agent responsibilities when they are safe and reversible.
Treat newer user task updates as local overrides for the active task while preserving earlier non-conflicting instructions.
When the user provides newer same-thread evidence (for example logs, stack traces, or test output), treat it as the current source of truth, re-evaluate earlier hypotheses against it, and do not anchor on older evidence unless the user reaffirms it.
Persist with retrieval, inspection, diagnostics, tests, or tool use only while they materially improve correctness, required citations, validation, or safe execution; stop once the core request is answerable with sufficient evidence.
More effort does not mean reflexive web/tool escalation; re-evaluate low/medium effort and the smallest useful tool loop before escalating reasoning or retrieval.
</operating_principles>
Working agreements
For cleanup/refactor/deslop work, write a cleanup plan and lock behavior with regression tests before editing when coverage is missing.
Prefer deletion, existing utilities, and existing patterns before new abstractions; add dependencies only when explicitly requested.
Keep diffs small, reviewable, and reversible.
Verify with lint, typecheck, tests, and static analysis after changes; final reports include changed files, simplifications, and remaining risks.
<lore_commit_protocol>
Lore Commit Protocol
Every commit message must follow the Lore protocol: a concise decision record using git-native trailers.
Format
code
<scope>: <intent line: why the change was made, not what changed>
<optional concise body: constraints and approach rationale>
Constraint: <external constraint that shaped the decision>
Rejected: <alternative considered> | <reason for rejection>
Confidence: <low|medium|high>
Scope-risk: <narrow|moderate|broad>
Directive: <forward-looking warning for future modifiers>
Tested: <what was verified>
Not-tested: <known gaps in verification>
Rules
Intent line first; describe why, not what.
Use trailers only when they add decision context.
Use Rejected: for alternatives future agents should not re-explore.
Use Directive: for warnings, Constraint: for external forces, and Not-tested: for known verification gaps.
Teams may introduce domain-specific trailers without breaking compatibility.
DO NOT rely on shell-escaped newlines with repeated -m flags when writing or editing a commit message. Write the full message to a temporary file and use git commit --gpg-sign -F <file> so paragraph breaks, backticks, and trailers are preserved exactly.
The 72 Rule
72-character subject line: The subject line of a commit message should be no more than 72 characters long. This is to ensure that the message is concise and easy to read. The subject should provide a brief summary of the changes made in the commit.
72-character body lines: If the commit message includes a body (which is optional but recommended for more detailed explanations), each line in the body should not exceed 72 characters. This helps maintain readability, especially when the commit messages are viewed in the terminal or other tools that may wrap text.
All trailers are exempt from this rule.
</lore_commit_protocol>
<delegation_rules>
Default posture: work directly.
Choose the lane before acting:
$deep-interview for unclear intent, missing boundaries, or explicit "don't assume" requests. This mode clarifies and hands off; it does not implement.
$ralplan when requirements are clear enough but plan, tradeoff, or test-shape review is still needed.
$team when the approved plan needs coordinated parallel execution across multiple lanes.
$ralph when the approved plan needs a persistent single-owner completion / verification loop.
Solo execute when the task is already scoped and one agent can finish + verify it directly.
Delegate only when it materially improves quality, speed, or safety. Do not delegate trivial work or use delegation as a substitute for reading the code.
For substantive code changes, executor is the default implementation role.
Outside active team/swarm mode, use executor (or another standard role prompt) for implementation work; do not invoke worker or spawn Worker-labeled helpers in non-team mode.
Reserve worker strictly for active team/swarm sessions and team-runtime bootstrap flows.
Switch modes only for a concrete reason: unresolved ambiguity, coordination load, or a blocked current lane.
</delegation_rules>
<child_agent_protocol>
Leader responsibilities:
Pick the mode and keep the user-facing brief current.
Delegate only bounded, verifiable subtasks with clear ownership.
Integrate results, decide follow-up, and own final verification.
Worker responsibilities:
Execute the assigned slice; do not rewrite the global plan or switch modes on your own.
Stay inside the assigned write scope; report blockers, shared-file conflicts, and recommended handoffs upward.
Ask the leader to widen scope or resolve ambiguity instead of silently freelancing.
Rules:
Max 6 concurrent child agents.
Child prompts stay under AGENTS.md authority.
worker is a team-runtime surface, not a general-purpose child role.
Child agents should report recommended handoffs upward.
Child agents should finish their assigned role, not recursively orchestrate unless explicitly told to do so.
Prefer inheriting the leader model by omitting spawn_agent.model unless a task truly requires a different model.
Do not hardcode stale frontier-model overrides for Codex native child agents. If an explicit frontier override is necessary, use the current frontier default from OMX_DEFAULT_FRONTIER_MODEL / the repo model contract (currently gpt-5.5), not older values such as gpt-5.2.
Prefer role-appropriate reasoning_effort over explicit model overrides when the only goal is to make a child think harder or lighter.
</child_agent_protocol>
<invocation_conventions>
$name — invoke a workflow skill
/skills — browse available skills
Prefer skill invocation and keyword routing as the primary user-facing workflow surface
</invocation_conventions>
<model_routing>
Match role to task shape:
Low complexity: explore, style-reviewer, writer
Research/discovery: explore for repo lookup, researcher for official docs/reference gathering, dependency-expert for SDK/API/package evaluation
Standard: executor, debugger, test-engineer
High complexity: architect, executor, critic
For Codex native child agents, model routing defaults to inheritance/current repo defaults unless the caller has a concrete reason to override it.
</model_routing>
Route to explore for repo-local file / symbol / pattern / relationship lookup, current implementation discovery, or mapping how this repo currently uses a dependency. explore owns facts about this repo, not external docs or dependency recommendations.
Route to researcher when the main need is official docs, external API behavior, version-aware framework guidance, release-note history, or citation-backed reference gathering. The technology is already chosen; researcher answers “how does this chosen thing work?” and is not the default dependency-comparison role.
Route to dependency-expert when the main need is package / SDK selection or a comparative dependency decision: whether / which package, SDK, or framework to adopt, upgrade, replace, or migrate; candidate comparison; maintenance, license, security, or risk evaluation across options.
Use mixed routing deliberately: explore -> researcher for current local usage plus official-doc confirmation; explore -> dependency-expert for current dependency usage plus upgrade / replacement / migration evaluation; researcher -> explore when docs are clear but repo usage or impact still needs confirmation; dependency-expert -> explore when a dependency decision is clear but the local migration surface still needs mapping.
Specialists should report boundary crossings upward instead of silently absorbing adjacent work.
When external evidence materially affects the answer, do not keep the leader in the main lane on recall alone; route to the relevant specialist first, then return to planning or execution.
explore — first-stop repository lookup and symbol/file mapping
researcher — official docs, references, and external fact gathering
dependency-expert — SDK/API/package evaluation before adopting or changing dependencies
Specialists remain available through the role catalog and native child-agent surfaces when the task clearly benefits from them.
</agent_catalog>
<keyword_detection>
Keyword routing is implemented primarily by native UserPromptSubmit hooks and the generated keyword registry. Treat hook-injected routing context as authoritative for the current turn, then load the named SKILL.md or prompt file as instructed.
Fallback behavior when hook context is unavailable:
Explicit $name invocations run left-to-right and override implicit keywords.
Bare skill names do not activate skills by themselves; skill-name activation requires explicit $skill invocation. Natural-language routing phrases may still map to a workflow when they are not just the bare skill name. Examples: analyze / investigate → $analyze for read-only deep analysis with ranked synthesis, explicit confidence, and concrete file references; deep interview, interview, don't assume, or ouroboros → $deep-interview for Socratic deep interview requirements clarification; ralplan / consensus plan → $ralplan; cancel, stop, or abort → $cancel.
Keep the detailed keyword list in src/hooks/keyword-registry.ts; do not duplicate that table here.
Runtime availability gate:
Treat autopilot, ralph, ultrawork, ultraqa, team/swarm, and ecomode as OMX runtime workflows, not generic prompt aliases.
Auto-activate runtime workflows only when the current session is actually running under OMX CLI/runtime (for example, launched via omx, with OMX session overlay/runtime state available, or when the user explicitly asks to run omx ... in the shell).
In Codex App or plain Codex sessions without OMX runtime, do not treat those keywords alone as activation. Explain that they require OMX CLI runtime support and are not directly available there, and continue with the nearest App-safe surface (deep-interview, ralplan, plan, or native subagents) unless the user explicitly wants you to launch OMX CLI from shell first.
When deep-interview is active in attached-tmux OMX CLI/runtime, ask each interview round via omx question as a temporary popup-style renderer over the leader pane; after launching omx question in a background terminal, wait for that terminal to finish and read the JSON answer before continuing; preserve the leader pane with OMX_QUESTION_RETURN_PANE=$TMUX_PANE (or an explicit %pane value) when invoking it through Bash/tool paths, prefer answers[0].answer / answers[] from the response and use legacy answer only as fallback, and respect Stop-hook blocking while a deep-interview question obligation is pending. Deep-interview remains one question per round; do not batch multiple interview rounds into one questions[] form. Outside tmux or native surfaces that cannot render omx question should use the native structured question path when available, otherwise ask exactly one concise plain-text question and wait for the answer.
<triage_routing>
Triage: advisory prompt-routing context
The keyword detector is the first and deterministic routing surface. Triage runs only when no keyword matches.
When active, triage emits advisory prompt-routing context — a developer-context string that the model may follow. It does not activate a skill or workflow by itself. It is a best-effort hint, not a guarantee.
Note: explore, executor, designer, and researcher are agent role-prompt files under prompts/, not workflow skills. researcher is used for official-doc/reference/source-backed external lookup prompts only; local anchors and implementation-shaped prompts stay with explore/executor/HEAVY routing.
Explicit keywords remain the deterministic control surface when you want explicit, guaranteed routing — use them whenever exact behavior matters.
To opt out per prompt with phrases such as no workflow, just chat, or plain answer — the triage layer will suppress context injection for that prompt.
</triage_routing>
Ralph / Ralplan execution gate:
Enforce ralplan-first when ralph is active and planning is not complete.
Planning is complete only after both .omx/plans/prd-*.md and .omx/plans/test-spec-*.md exist.
Until complete, do not begin implementation or execute implementation-focused tools.
</keyword_detection>
<team_compositions>
Use explicit team orchestration for feature development, bug investigation, code review, UX audit, and similar multi-lane work when coordination value outweighs overhead.
</team_compositions>
<team_pipeline>
Team mode is the structured multi-agent surface.
Canonical pipeline:
team-plan -> team-prd -> team-exec -> team-verify -> team-fix (loop)
Use it when durable staged coordination is worth the overhead. Otherwise, stay direct.
Terminal states: complete, failed, cancelled.
After teams mode, organize each worker's omx(team): auto-checkpoint ... commits by task context.
If file changes are different contexts, do commit split.
</team_pipeline>
<team_model_resolution>
Team/Swarm workers currently share one agentType and one launch-arg set.
Model precedence:
Explicit model in OMX_TEAM_WORKER_LAUNCH_ARGS
Inherited leader --model
Low-complexity default model from OMX_DEFAULT_SPARK_MODEL (legacy alias: OMX_SPARK_MODEL)
Normalize model flags to one canonical --model <value> entry.
Do not guess frontier/spark defaults from model-family recency; use OMX_DEFAULT_FRONTIER_MODEL and OMX_DEFAULT_SPARK_MODEL.
</team_model_resolution>
Model Capability Table
Auto-generated by omx setup from the current config.toml plus OMX model overrides.
Role
Model
Reasoning Effort
Use Case
Frontier (leader)
gpt-5.5
high
Primary leader/orchestrator for planning, coordination, and frontier-class reasoning.
Spark (explorer/fast)
gpt-5.3-codex-spark
low
Fast triage, explore, lightweight synthesis, and low-latency routing.
Standard (subagent default)
gpt-5.5
high
Default standard-capability model for installable specialists and secondary worker lanes unless a role is explicitly frontier or spark.
explore
gpt-5.3-codex-spark
low
Fast codebase search and file/symbol mapping (fast-lane, fast)
Large or security/architectural changes: thorough verification
Verification loop: define the claim and success criteria, run the smallest validation that can prove it, read the output, then report with evidence. If validation fails, iterate; if validation cannot run, explain why and use the next-best check. Keep evidence summaries concise but sufficient.
Run dependent tasks sequentially; verify prerequisites before starting downstream actions.
If a task update changes only the current branch of work, apply it locally and continue without reinterpreting unrelated standing instructions.
For coding work, prefer targeted tests for changed behavior, then typecheck/lint/build/smoke checks when applicable; do not claim completion without fresh evidence or an explicit validation gap.
When correctness depends on retrieval, diagnostics, tests, or other tools, continue only until the task is grounded and verified; avoid extra loops that only improve phrasing or gather nonessential evidence.
<execution_protocols>
Mode selection: use $deep-interview for unclear intent/boundaries; $ralplan for consensus on architecture, tradeoffs, or tests; $team for approved multi-lane work; $ralph for persistent single-owner completion/verification loops; otherwise execute directly in solo mode. Switch modes only when evidence shows the current lane is mismatched or blocked.
Command routing:
When USE_OMX_EXPLORE_CMD enables advisory routing, strongly prefer omx explore as the default surface for simple read-only repository lookup tasks (files, symbols, patterns, relationships).
For simple file/symbol lookups, use omx explore FIRST before attempting full code analysis.
Use omx explore --prompt ... for simple read-only lookups through the shell-only, allowlisted, read-only path. Use omx sparkshell for noisy read-only shell commands, bounded verification, repo-wide listing/search, or explicit omx sparkshell --tmux-pane summaries. Treat sparkshell as explicit opt-in. When to use what: keep ambiguous, implementation-heavy, edit-heavy, diagnostics, tests, MCP/web, and complex shell work on the normal path; if omx explore or omx sparkshell is incomplete, retry narrower or gracefully fall back to the normal path.
Leader vs worker:
The leader chooses the mode, keeps the brief current, delegates bounded work, and owns verification plus stop/escalate calls.
Workers execute their assigned slice, do not re-plan the whole task or switch modes on their own, and report blockers or recommended handoffs upward.
Workers escalate shared-file conflicts, scope expansion, or missing authority to the leader instead of freelancing.
Stop / escalate:
Stop when the task is verified complete, the user says stop/cancel, or no meaningful recovery path remains.
Escalate to the user only for irreversible, destructive, or materially branching decisions, or when required authority is missing.
Escalate from worker to leader for blockers, scope expansion, shared ownership conflicts, or mode mismatch.
deep-interview and ralplan stop at a clarified artifact or approved-plan handoff; they do not implement unless execution mode is explicitly switched.
Output contract:
Default update/final shape: current mode; action/result; evidence or blocker/next step.
Keep rationale once; do not restate the full plan every turn.
Expand only for risk, handoff, or explicit user request.
Parallelization: run independent tasks in parallel, dependent tasks sequentially, and long builds/tests in the background when helpful. Prefer Team mode only when coordination value outweighs overhead. If correctness depends on retrieval, diagnostics, tests, or other tools, continue until the task is grounded and verified.
Anti-slop workflow:
Cleanup/refactor/deslop work still follows the same $deep-interview -> $ralplan -> $team/$ralph path; use $ai-slop-cleaner as a bounded helper inside the chosen execution lane, not as a competing top-level workflow.
Write a cleanup plan before modifying code; lock existing behavior with regression tests first, then make one smell-focused pass at a time.
Prefer deletion over addition, and prefer reuse plus boundary repair over new layers.
No new dependencies without explicit request.
Run lint, typecheck, tests, and static analysis before claiming completion.
Keep writer/reviewer pass separation for cleanup plans and approvals; preserve writer/reviewer pass separation explicitly.
Visual iteration gate:
For visual tasks, run $visual-verdict every iteration before the next edit.
Persist verdict JSON in .omx/state/{scope}/ralph-progress.json.
Continuation:
Before concluding, confirm: no pending work, features working, tests passing, zero known errors, verification evidence collected. If not, continue.
Ralph planning gate:
If ralph is active, verify PRD + test spec artifacts exist before implementation work.
</execution_protocols>
<state_management>
Hooks own normal skill-active and workflow-state persistence under .omx/state/.
OMX persists runtime state under .omx/:
.omx/state/ — mode state
.omx/notepad.md — session notes
.omx/project-memory.json — cross-session memory
.omx/plans/ — plans
.omx/logs/ — logs
Available MCP groups include state/memory tools, code-intel tools, and trace tools.
Agents may use OMX state/MCP tools for explicit lifecycle transitions, recovery, checkpointing, cancellation cleanup, or compaction resilience.
Do not manually duplicate hook-owned activation state unless recovering from missing or stale state.
</state_management>
Setup
Execute omx setup to install all components. Execute omx doctor to verify installation.
<extremely_important>
MUST give full effort. Do not hold back.
MUST reflect after each code change or tool result, evaluate quality, then choose the best next action.
MUST actively use update_plan, and maintain a meaningful English taks with -100 step-by-step items.
MUST run independent operations in parallel whenever possible.
MUST execute work step by step against the current plan.
MUST keep the internal reasoning written in English, even if the user inputs a prompt in Japanese.
MUST before any tool calls for a multi-step task, send a short user-visible update that acknowledges the request and states the first step. Keep it to one or two sentences.
Act as a senior software architect with 30 years of distributed-systems experience.
Expertise:
Go
Python
Lua
TypeScript
C
C++
Objective-C
Protocol Buffers
Terraform
Microservices architecture
Performance optimization at scale
Database design for high-traffic systems
Cloud infrastructure (GCP, AWS, Azure)
Networking (such as L3, L7)
Default approach:
Provide 2-3 alternatives with clear tradeoffs.
Include concrete examples from prior experience.
Identify bottlenecks early.
Always consider scalability implications.
<quality_control>
After proposing a solution, score confidence (0.0-1.0) for:
Cost-effectiveness
Scalability
Reliability
If any score is below 0.9, refine the solution before finalizing.
</quality_control>
<absolute_rules>
Build high-quality, general-purpose solutions using standard tools. Use helper scripts/workarounds only when they improve correctness or efficiency.
Implement real logic that handles all valid inputs. Do not hard-code to tests or examples.
Prioritize requirements understanding and correct algorithms. Tests verify behavior; they do not define behavior.
If requirements are infeasible or tests are incorrect, state this explicitly instead of forcing a workaround.
Never speculate about code you have not read.
If the user references a file, read that file before answering.
Investigate relevant files before making claims about code behavior.
Keep responses grounded and hallucination-free.
NO PARTIAL IMPLEMENTATIONS
complete every feature fully.
NO SIMPLIFICATION placeholders
Do not leave comments like: // simplified for now.
NO CODE DUPLICATION
Reuse existing functions/constants when possible.
Search the codebase before adding new functions.
NO DEAD CODE
Every added path must be used, or remove it.
IMPLEMENT TESTS FOR EVERY FUNCTION
NO CHEATER TESTS
Tests must reflect realistic usage and expose flaws.
Keep tests verbose enough for debugging.
NO INCONSISTENT NAMING
Follow existing naming patterns.
NO OVER-ENGINEERING
Avoid unnecessary abstractions/middleware.
NO MIXED CONCERNS
Keep validation, handlers, persistence, and UI responsibilities separated.
NO RESOURCE LEAKS
Close DB connections, clear timers, remove listeners, and clean up file handles.
</absolute_rules>
</extremely_important>
EXECPLAN
For complex features or significant refactors, use an ExecPlan from design through implementation (see ~/.config/codex/instructions/ExecPlan.md).
ERROR HANDLING
Fail fast for critical configuration (for example, missing text model).
Log and continue for optional features (for example, extraction model).
Gracefully degrade when external services are unavailable.
Surface user-friendly messages via the resilience layer.
TESTING
Always use the test-runner agent to execute tests.
Do not use mock services.
Do not start the next test before the current test completes.
If a test fails, validate test structure before refactoring production code.
Keep tests verbose enough for debugging.
Use rg --threads=8 for rg(ripgrep) commands.
Use google-gemini-search for web search instead of built-in web search tools.
Use context7 and exa-codesearch when detailed library/API documentation is needed.
<language_rules>
Go:
@~/.config/codex/instructions/Go.md
Python:
@~/.config/codex/instructions/Python.md
Rust:
@~/.config/codex/instructions/Rust.md
</language_rules>
--- project-doc ---
Repository Guidelines
Project Structure & Module Organization
This repository stores configuration, prompts, and skills for multiple coding
agents rather than a single deployable application. Keep changes scoped to the
agent surface you are modifying: agent/instructions/ holds shared guidance,
codex/ contains Codex config, skills, scripts, and tests, claude/ contains
Claude-specific commands, agents, plugins, and settings, gemini/ holds Gemini
settings and command definitions, and docs/ contains shared documentation such
as docs/PROMPT.md. Place new tests beside the feature they cover, for example
under codex/tests/ for codex/scripts/.
Tooling
When running ./codex/skills/.system/skill-creator/scripts/quick_validate.py,
use uv run --with PyYAML so the script has the yaml dependency available.
Build, Test, and Development Commands
There is no root build system; use the toolchain that matches the surface you
touch. Verified commands in this repo include:
uv run --script codex/scripts/history-compact.py --help to inspect the
current Codex utility CLI.
uv run --with pytest --with orjson python -m pytest codex/tests/test_history_compact.py -q
to run the tracked Python tests.
rg --threads=8 "pattern" codex claude agent docs for repository-wide
discovery; this is the expected ripgrep form in this repo.
Coding Style & Naming Conventions
Follow the existing file conventions of each subtree instead of inventing new
structure. Markdown, TOML, JSON, and source files use LF endings
(.gitattributes). Python code in codex/scripts/ uses four-space indentation,
type hints, and from __future__ import annotations; keep script filenames
kebab-case, such as history-compact.py. Use descriptive lowercase directory
names for agent surfaces and keep generated artifacts out of tracked paths.
Testing Guidelines
Use pytest for Python coverage and keep tests close to the code under test.
Name files test_*.py and prefer behavior-focused test names such as
test_compact_history_rewrites_in_place. For CLI-oriented scripts, cover both
argument parsing and file rewrite behavior, not just happy-path output.
Commit & Pull Request Guidelines
Recent history uses short, scoped, imperative subjects such as
codex: update config.toml and docs: rename to PROMPT.md. Follow the same
pattern: prefix with the affected area (codex, claude, docs, agent,
gemini) and keep each commit to one logical change. No PR template or GitHub
Actions workflow is tracked here, so include a brief description, touched paths,
and the exact validation commands you ran in every PR.
Configuration & Hygiene
Do not commit local caches or editor output. .gitignore already excludes
**/__pycache__/, claude/plugins/cache/, claude/plugins/marketplaces/, and
codex/skills/dist; extend ignore rules only for project-generated files, not
personal editor state.
Files called AGENTS.md commonly appear in many places inside a container - at "/", in "~", deep within git repositories, or in any other directory; their location is not limited to version-controlled folders.
Their purpose is to pass along human guidance to you, the agent. Such guidance can include coding standards, explanations of the project layout, steps for building or testing, and even wording that must accompany a GitHub pull-request description produced by the agent; all of it is to be followed.
Each AGENTS.md governs the entire directory that contains it and every child directory beneath that point. Whenever you change a file, you have to comply with every AGENTS.md whose scope covers that file. Naming conventions, stylistic rules and similar directives are restricted to the code that falls inside that scope unless the document explicitly states otherwise.
When two AGENTS.md files disagree, the one located deeper in the directory structure overrides the higher-level file, while instructions given directly in the prompt by the system, developer, or user outrank any AGENTS.md content.
$autopilot "improve codex/scripts/history-compact.py to also remove text containing the words OMX_TMUX_INJECT and OMX_TEAM_STATE_ROOT. don't write testcase"
User
<Use_When>
User wants end-to-end autonomous execution from an idea to working code
User says "autopilot", "auto pilot", "autonomous", "build me", "create me", "make me", "full auto", "handle it all", or "I want a/an..."
Task requires multiple phases: planning, coding, testing, and validation
User wants hands-off execution and is willing to let the system run to completion
</Use_When>
<Do_Not_Use_When>
User wants to explore options or brainstorm -- use plan skill instead
User says "just explain", "draft only", or "what would you suggest" -- respond conversationally
User wants a single focused code change -- use ralph or delegate to an executor agent
User wants to review or critique an existing plan -- use plan --review
Task is a quick fix or small bug -- use direct executor delegation
</Do_Not_Use_When>
<Why_This_Exists>
Most non-trivial software tasks require coordinated phases: understanding requirements, designing a solution, implementing in parallel, testing, and validating quality. Autopilot orchestrates all of these phases automatically so the user can describe what they want and receive working code without managing each step.
</Why_This_Exists>
<Execution_Policy>
Each phase must complete before the next begins
Parallel execution is used within phases where possible (Phase 2 and Phase 4)
QA cycles repeat up to 5 times; if the same error persists 3 times, stop and report the fundamental issue
Validation requires approval from all reviewers; rejected items get fixed and re-validated
Cancel with /cancel at any time; progress is preserved for resume
If a deep-interview spec exists, use it as high-clarity phase input instead of re-expanding from scratch
If input is too vague for reliable expansion, offer/trigger $deep-interview first
Do not enter expansion/planning/execution-heavy phases until pre-context grounding exists; if fast execution is forced, proceed only with explicit risk notes
Default to concise, evidence-dense progress and completion reporting unless the user or risk level requires more detail
Treat newer user task updates as local overrides for the active workflow branch while preserving earlier non-conflicting constraints
If correctness depends on additional inspection, retrieval, execution, or verification, keep using the relevant tools until the workflow is grounded
Continue through clear, low-risk, reversible next steps automatically; ask only when the next step is materially branching, destructive, or preference-dependent
</Execution_Policy>
Assistant
Using $autopilot for the requested end-to-end change, but this is a small scoped script update, so I’ll keep the workflow lightweight: inspect current filter logic, patch only the relevant removal path, then run targeted validation without adding tests.
Assistant
Target result is a narrow filter extension with no new test files. I’m grounding the current script behavior and prior repo context first, then I’ll patch the smallest shared removal mechanism and validate with smoke/existing checks.
Assistant
The first context-snapshot command hit zsh glob/PATH quirks (nomatch, cat lookup), so I’m switching to explicit Bash and absolute coreutils where needed. The memory pass found a relevant prior history-compact entry: existing verification should use --help plus the tracked pytest file, but I’ll honor this task’s “no testcase” constraint.
Assistant
Current script only drops older duplicate top-level text entries, and there is no tracked codex/tests/test_history_compact.py in this checkout despite older memory. I’ll implement by classifying blocked text during plan construction so it is excluded from output and counted in removed, without changing non-text or invalid-timestamp retention behavior.
Assistant
The patch now removes matching text before timestamp/dedup handling, so both timestamped and untimestamped matching text are excluded while non-text records remain untouched. I’m moving to QA with a temporary JSONL smoke fixture plus the script help path; no testcase files will be created.
Assistant
QA passed for the core behavior on a temporary fixture: both marker-containing text records were removed, older duplicate removal still worked, and non-text/untimestamped safe records stayed. I’m tightening the user-facing description and then running whitespace/diff checks plus a lightweight reviewer pass.
Assistant
The extra dry-run against the Python source intentionally failed because that file is not JSONL, so I’m discarding it as non-evidence. I confirmed there are no existing compact tests in this checkout, and I’m running the meaningful smoke/syntax checks plus parallel read-only validation reviewers now.
Assistant
Local syntax/smoke validation is clean after the documentation tweak. I’m waiting for the read-only quality and security reviewers, then I’ll either fix any concrete finding or close with evidence.
Assistant
The security reviewer did not return within the allotted wait, and local validation already proves the requested behavior. I’m closing that stalled validation lane and doing the final direct diff review instead of blocking further.
Assistant
Final diff review found the change limited to codex/scripts/history-compact.py, with the marker list centralized and the write path using a plan-level remove set. I’m marking the workflow complete and clearing OMX autopilot/adjacent mode state.
Assistant
Completed $autopilot task.
Result
Updated codex/scripts/history-compact.py to remove any top-level text record containing either:
OMX_TMUX_INJECT
OMX_TEAM_STATE_ROOT
No testcase files were written, per your instruction.
Changed file
codex/scripts/history-compact.py
What changed
Added centralized marker list:
REMOVED_TEXT_MARKERS
Added should_remove_text(text: str) -> bool
Extended CompactPlan with remove_line_numbers
Extended CompactStats with removed_text_records
Updated build_compaction_plan() so matching text records are excluded before timestamp/dedup handling.
This means both timestamped and untimestamped matching text records are removed.
Non-text records remain preserved.
Safe text records without valid timestamps remain preserved.
Updated write_retained_lines() to honor the plan-level remove set.
Updated CLI/help wording and stderr summary to include unsafe OMX injection text removal and removed_text=....
Validation evidence
Passed:
sh
uv run --script codex/scripts/history-compact.py --help
Passed, with help text including:
text
and known unsafe OMX injection text.
Passed:
sh
uv run --with orjson python -m py_compile codex/scripts/history-compact.py
Passed temporary JSONL smoke validation using --stdout.
Smoke fixture covered:
Removes text containing OMX_TMUX_INJECT
Removes text containing OMX_TEAM_STATE_ROOT
Keeps safe timestamped text
Keeps safe untimestamped text
Keeps non-text records
Still removes older duplicate text and keeps the newest duplicate by timestamp/line ordering
User
$autopilot "Fix to sort by ts timestamp in descending order"
User
<Use_When>
User wants end-to-end autonomous execution from an idea to working code
User says "autopilot", "auto pilot", "autonomous", "build me", "create me", "make me", "full auto", "handle it all", or "I want a/an..."
Task requires multiple phases: planning, coding, testing, and validation
User wants hands-off execution and is willing to let the system run to completion
</Use_When>
<Do_Not_Use_When>
User wants to explore options or brainstorm -- use plan skill instead
User says "just explain", "draft only", or "what would you suggest" -- respond conversationally
User wants a single focused code change -- use ralph or delegate to an executor agent
User wants to review or critique an existing plan -- use plan --review
Task is a quick fix or small bug -- use direct executor delegation
</Do_Not_Use_When>
<Why_This_Exists>
Most non-trivial software tasks require coordinated phases: understanding requirements, designing a solution, implementing in parallel, testing, and validating quality. Autopilot orchestrates all of these phases automatically so the user can describe what they want and receive working code without managing each step.
</Why_This_Exists>
<Execution_Policy>
Each phase must complete before the next begins
Parallel execution is used within phases where possible (Phase 2 and Phase 4)
QA cycles repeat up to 5 times; if the same error persists 3 times, stop and report the fundamental issue
Validation requires approval from all reviewers; rejected items get fixed and re-validated
Cancel with /cancel at any time; progress is preserved for resume
If a deep-interview spec exists, use it as high-clarity phase input instead of re-expanding from scratch
If input is too vague for reliable expansion, offer/trigger $deep-interview first
Do not enter expansion/planning/execution-heavy phases until pre-context grounding exists; if fast execution is forced, proceed only with explicit risk notes
Default to concise, evidence-dense progress and completion reporting unless the user or risk level requires more detail
Treat newer user task updates as local overrides for the active workflow branch while preserving earlier non-conflicting constraints
If correctness depends on additional inspection, retrieval, execution, or verification, keep using the relevant tools until the workflow is grounded
Continue through clear, low-risk, reversible next steps automatically; ask only when the next step is materially branching, destructive, or preference-dependent
</Execution_Policy>
Assistant
Using $autopilot again for the scoped history-compact.py behavior change. I’ll ground the current uncommitted script state first, then make the smallest change so retained history records are written in descending ts order and validate with temporary JSONL smoke checks.
Assistant
The relevant memory confirms the history-compact validation pattern, but the current checkout may differ, so I’m verifying the live file and test availability now. Next I’ll patch only the output ordering path.
Assistant
Live inspection shows output writing still streams retained records in original line order, and in-place compaction currently skips rewriting when nothing was removed. I’m changing the plan to know whether retained records are already ts-descending, so unsorted files rewrite even when no records are removed.
Assistant
Reflection after the first patch: sorting itself is correct, but the “already sorted” detection needs to preserve original retained-line order across duplicate winners, non-text, and invalid timestamp records. I’m tightening that now before running validation.
Assistant
The first smoke validation failed because the inline Python assertion script was malformed by shell quoting, not because the compactor output failed. I’m rerunning the smoke using parsed JSON records instead of fragile literal JSON strings.
Assistant
The rerun proved the output order, but one assertion was too broad ("ts":20 also matches "ts":200). I’m correcting that assertion to parse records and verify the old duplicate timestamp precisely.
Assistant
Core smoke now passes for sort + duplicate + marker filtering. I’m adding one more no-removal smoke because the old fast path would have skipped rewriting unsorted input when removed=0.
Assistant
The no-removal smoke command had a shell quoting typo before running the script. I’m rerunning the same validation with the heredoc closed correctly.
Assistant
Validation now proves both important paths: normal compaction sorts output, and no-removal unsorted input still rewrites into descending ts order. I’m doing a final scoped diff review now.
Assistant
Final diff review found one style issue worth fixing before closeout: the sort call line is overly long. I’m wrapping that without changing behavior, then rerunning the focused checks.
Assistant
All focused checks pass after the style fix: syntax/help/diff-check plus two smoke paths covering sort with removals and sort-only rewrite with removed=0. I’m completing and clearing the OMX workflow state now.
Assistant
Completed $autopilot task.
Result
Updated codex/scripts/history-compact.py so retained output records are sorted by top-level ts timestamp in descending order.
This preserves the prior uncommitted behavior from the last task:
removes records whose top-level text contains OMX_TMUX_INJECT
removes records whose top-level text contains OMX_TEAM_STATE_ROOT
still removes older duplicate top-level text records
still keeps the newest duplicate by normalized ts, then later line number as tie-breaker
Changed file
text
M codex/scripts/history-compact.py
Ordering behavior implemented
Sort rule:
Records with valid normalized top-level ts come first.
Valid timestamps are sorted descending: newest first.
Records with missing, invalid, boolean, or non-finite ts sort last.
Equal sort keys preserve original relative order because Python’s sort is stable.
This also applies to non-text records if they have a valid top-level ts.
Important bug fixed
The old fast path skipped rewriting in-place when removed_records == 0.
That would have failed this new requirement for an unsorted file with no duplicate/removal candidates.
Now the in-place no-op skip only happens when:
python
plan.stats.removed_records == 0 and plan.is_sorted
So unsorted files are rewritten into descending timestamp order even when no records are removed.
Validation evidence
Passed:
sh
uv run --with orjson python -m py_compile codex/scripts/history-compact.py
Passed:
sh
uv run --script codex/scripts/history-compact.py --help
Help text now includes:
text
Compact Codex history JSONL by sorting top-level ts timestamps descending,
User
$autopilot "Fix to sort by ts timestamp in ascending order"
User
q/
User
<Use_When>
User wants end-to-end autonomous execution from an idea to working code
User says "autopilot", "auto pilot", "autonomous", "build me", "create me", "make me", "full auto", "handle it all", or "I want a/an..."
Task requires multiple phases: planning, coding, testing, and validation
User wants hands-off execution and is willing to let the system run to completion
</Use_When>
<Do_Not_Use_When>
User wants to explore options or brainstorm -- use plan skill instead
User says "just explain", "draft only", or "what would you suggest" -- respond conversationally
User wants a single focused code change -- use ralph or delegate to an executor agent
User wants to review or critique an existing plan -- use plan --review
Task is a quick fix or small bug -- use direct executor delegation
</Do_Not_Use_When>
<Why_This_Exists>
Most non-trivial software tasks require coordinated phases: understanding requirements, designing a solution, implementing in parallel, testing, and validating quality. Autopilot orchestrates all of these phases automatically so the user can describe what they want and receive working code without managing each step.
</Why_This_Exists>
<Execution_Policy>
Each phase must complete before the next begins
Parallel execution is used within phases where possible (Phase 2 and Phase 4)
QA cycles repeat up to 5 times; if the same error persists 3 times, stop and report the fundamental issue
Validation requires approval from all reviewers; rejected items get fixed and re-validated
Cancel with /cancel at any time; progress is preserved for resume
If a deep-interview spec exists, use it as high-clarity phase input instead of re-expanding from scratch
If input is too vague for reliable expansion, offer/trigger $deep-interview first
Do not enter expansion/planning/execution-heavy phases until pre-context grounding exists; if fast execution is forced, proceed only with explicit risk notes
Default to concise, evidence-dense progress and completion reporting unless the user or risk level requires more detail
Treat newer user task updates as local overrides for the active workflow branch while preserving earlier non-conflicting constraints
If correctness depends on additional inspection, retrieval, execution, or verification, keep using the relevant tools until the workflow is grounded
Continue through clear, low-risk, reversible next steps automatically; ask only when the next step is materially branching, destructive, or preference-dependent
</Execution_Policy>
Assistant
Using $autopilot for the correction: the latest user instruction supersedes the interrupted descending-sort request, so the target is now ts ascending order. I’ll first inspect the partially applied state, then minimally flip the ordering and rerun smoke checks for ascending output plus existing filtering.
Assistant
The context/state update succeeded; the first inspection command only failed because Bash printf treated a leading --- as an option. I’m rerunning inspection with safe printf '%s\n' and then applying the ascending-order correction.
Assistant
Inspection confirms the interrupted change left descending behavior in _history_sort_key() and CLI help text. I’ll flip only those order-facing pieces to ascending while keeping the existing rewrite guard and filtering intact.
Assistant
The code change is intentionally tiny: sort key now returns the timestamp directly, and help text says ascending. I’m moving into QA with syntax/help/diff checks plus temporary JSONL smoke cases.
Assistant
All focused QA checks passed: ascending output with removals and the no-removal rewrite case both work. I’m doing final scoped diff review now, then I’ll clear autopilot state and report the exact evidence.
Assistant
Final diff review is scoped to codex/scripts/history-compact.py; no extra tracked files appeared in the scoped status. I’m marking the workflow complete and clearing OMX mode state.
Assistant
Completed $autopilot task.
Result
Corrected codex/scripts/history-compact.py so retained history records sort by top-level ts timestamp in ascending order.
This supersedes the interrupted descending-order state from the prior turn.
Changed file
text
M codex/scripts/history-compact.py
Behavior now implemented
Sort rule:
Records with valid normalized top-level ts come first.
Valid timestamps are sorted ascending: oldest first.
Records with missing, invalid, boolean, or non-finite ts sort last.
Equal sort keys preserve original relative order via Python’s stable sort.
Preserved existing behavior:
Removes records whose top-level text contains OMX_TMUX_INJECT.
Removes records whose top-level text contains OMX_TEAM_STATE_ROOT.
Removes older duplicate top-level text records.
Keeps the newest duplicate by normalized ts, then later line number as tie-breaker.
Rewrites in-place when records are unsorted even if removed=0.
Exact code correction
The key ordering fix was:
python
def _history_sort_key(timestamp: int | float | None) -> tuple[bool, int | float]:
if timestamp is None:
return (True, 0)
return (False, timestamp)
The previous interrupted state used -timestamp, which produced descending order.
CLI/help text now says:
text
sorting top-level ts timestamps ascending
Validation evidence
Passed:
sh
uv run --with orjson python -m py_compile codex/scripts/history-compact.py
Passed:
sh
uv run --script codex/scripts/history-compact.py --help
User
$autopilot "improve codex/scripts/history-compact.py to also remove text containing the words .omx. don't write testcase"
User
<Use_When>
User wants end-to-end autonomous execution from an idea to working code
User says "autopilot", "auto pilot", "autonomous", "build me", "create me", "make me", "full auto", "handle it all", or "I want a/an..."
Task requires multiple phases: planning, coding, testing, and validation
User wants hands-off execution and is willing to let the system run to completion
</Use_When>
<Do_Not_Use_When>
User wants to explore options or brainstorm -- use plan skill instead
User says "just explain", "draft only", or "what would you suggest" -- respond conversationally
User wants a single focused code change -- use ralph or delegate to an executor agent
User wants to review or critique an existing plan -- use plan --review
Task is a quick fix or small bug -- use direct executor delegation
</Do_Not_Use_When>
<Why_This_Exists>
Most non-trivial software tasks require coordinated phases: understanding requirements, designing a solution, implementing in parallel, testing, and validating quality. Autopilot orchestrates all of these phases automatically so the user can describe what they want and receive working code without managing each step.
</Why_This_Exists>
<Execution_Policy>
Each phase must complete before the next begins
Parallel execution is used within phases where possible (Phase 2 and Phase 4)
QA cycles repeat up to 5 times; if the same error persists 3 times, stop and report the fundamental issue
Validation requires approval from all reviewers; rejected items get fixed and re-validated
Cancel with /cancel at any time; progress is preserved for resume
If a deep-interview spec exists, use it as high-clarity phase input instead of re-expanding from scratch
If input is too vague for reliable expansion, offer/trigger $deep-interview first
Do not enter expansion/planning/execution-heavy phases until pre-context grounding exists; if fast execution is forced, proceed only with explicit risk notes
Default to concise, evidence-dense progress and completion reporting unless the user or risk level requires more detail
Treat newer user task updates as local overrides for the active workflow branch while preserving earlier non-conflicting constraints
If correctness depends on additional inspection, retrieval, execution, or verification, keep using the relevant tools until the workflow is grounded
Continue through clear, low-risk, reversible next steps automatically; ask only when the next step is materially branching, destructive, or preference-dependent
</Execution_Policy>
Assistant
Using $autopilot for the narrow history-compact.py update. I’ll first confirm the current partially edited script state, then add .omx to the existing removal marker path and validate with temporary JSONL smoke checks only, without writing testcase files.
User
$autopilot "improve codex/scripts/history-compact.py to also remove text containing the words .omx/. don't write testcase"
User
<Use_When>
User wants end-to-end autonomous execution from an idea to working code
User says "autopilot", "auto pilot", "autonomous", "build me", "create me", "make me", "full auto", "handle it all", or "I want a/an..."
Task requires multiple phases: planning, coding, testing, and validation
User wants hands-off execution and is willing to let the system run to completion
</Use_When>
<Do_Not_Use_When>
User wants to explore options or brainstorm -- use plan skill instead
User says "just explain", "draft only", or "what would you suggest" -- respond conversationally
User wants a single focused code change -- use ralph or delegate to an executor agent
User wants to review or critique an existing plan -- use plan --review
Task is a quick fix or small bug -- use direct executor delegation
</Do_Not_Use_When>
<Why_This_Exists>
Most non-trivial software tasks require coordinated phases: understanding requirements, designing a solution, implementing in parallel, testing, and validating quality. Autopilot orchestrates all of these phases automatically so the user can describe what they want and receive working code without managing each step.
</Why_This_Exists>
<Execution_Policy>
Each phase must complete before the next begins
Parallel execution is used within phases where possible (Phase 2 and Phase 4)
QA cycles repeat up to 5 times; if the same error persists 3 times, stop and report the fundamental issue
Validation requires approval from all reviewers; rejected items get fixed and re-validated
Cancel with /cancel at any time; progress is preserved for resume
If a deep-interview spec exists, use it as high-clarity phase input instead of re-expanding from scratch
If input is too vague for reliable expansion, offer/trigger $deep-interview first
Do not enter expansion/planning/execution-heavy phases until pre-context grounding exists; if fast execution is forced, proceed only with explicit risk notes
Default to concise, evidence-dense progress and completion reporting unless the user or risk level requires more detail
Treat newer user task updates as local overrides for the active workflow branch while preserving earlier non-conflicting constraints
If correctness depends on additional inspection, retrieval, execution, or verification, keep using the relevant tools until the workflow is grounded
Continue through clear, low-risk, reversible next steps automatically; ask only when the next step is materially branching, destructive, or preference-dependent
</Execution_Policy>
User
$autopilot "improve codex/scripts/history-compact.py to also remove text containing the words /.omx/. don't write testcase"
User
<Use_When>
User wants end-to-end autonomous execution from an idea to working code
User says "autopilot", "auto pilot", "autonomous", "build me", "create me", "make me", "full auto", "handle it all", or "I want a/an..."
Task requires multiple phases: planning, coding, testing, and validation
User wants hands-off execution and is willing to let the system run to completion
</Use_When>
<Do_Not_Use_When>
User wants to explore options or brainstorm -- use plan skill instead
User says "just explain", "draft only", or "what would you suggest" -- respond conversationally
User wants a single focused code change -- use ralph or delegate to an executor agent
User wants to review or critique an existing plan -- use plan --review
Task is a quick fix or small bug -- use direct executor delegation
</Do_Not_Use_When>
<Why_This_Exists>
Most non-trivial software tasks require coordinated phases: understanding requirements, designing a solution, implementing in parallel, testing, and validating quality. Autopilot orchestrates all of these phases automatically so the user can describe what they want and receive working code without managing each step.
</Why_This_Exists>
<Execution_Policy>
Each phase must complete before the next begins
Parallel execution is used within phases where possible (Phase 2 and Phase 4)
QA cycles repeat up to 5 times; if the same error persists 3 times, stop and report the fundamental issue
Validation requires approval from all reviewers; rejected items get fixed and re-validated
Cancel with /cancel at any time; progress is preserved for resume
If a deep-interview spec exists, use it as high-clarity phase input instead of re-expanding from scratch
If input is too vague for reliable expansion, offer/trigger $deep-interview first
Do not enter expansion/planning/execution-heavy phases until pre-context grounding exists; if fast execution is forced, proceed only with explicit risk notes
Default to concise, evidence-dense progress and completion reporting unless the user or risk level requires more detail
Treat newer user task updates as local overrides for the active workflow branch while preserving earlier non-conflicting constraints
If correctness depends on additional inspection, retrieval, execution, or verification, keep using the relevant tools until the workflow is grounded
Continue through clear, low-risk, reversible next steps automatically; ask only when the next step is materially branching, destructive, or preference-dependent
</Execution_Policy>
Assistant
Using $autopilot for the narrow follow-up. I’ll preserve the current uncommitted history-compaction behavior, add /.omx/ to the existing text-removal markers, and validate with temporary smoke data only—no testcase files.
Assistant
Current script already has the centralized removal-marker pipeline and ascending ts sorting from the interrupted prior work. I’m adding /.omx/ as the third literal marker, then running smoke validation without creating tests.
Assistant
The patch is intentionally one line in the marker tuple. I’m validating the full behavior path now: syntax, help, diff hygiene, marker removal including /.omx/, ascending sort, duplicate compaction, and sort-only rewrite.
Assistant
The behavior smoke passed, including /.omx/ removal. The syntax/help/diff command failed only because the help-text grep expected older wording; I’m rerunning it against the current ascending-sort help text and keeping the successful smoke evidence.
Assistant
The help text wraps across lines, so the exact phrase grep is too strict. I’m validating the displayed help content directly with a small Python substring check that tolerates argparse wrapping.
Assistant
All validation paths are now clean: syntax, wrapped help text, diff whitespace, combined marker/sort smoke, and sort-only rewrite smoke. I’m doing the final scoped diff/status review and then clearing the workflow state.
Assistant
Completed $autopilot task.
Result
Updated codex/scripts/history-compact.py to also remove top-level text records containing:
text
/.omx/
No testcase files were written, per your instruction.
On completion:
state_write({mode: "autopilot", active: false, current_phase: "complete", completed_at: "<now>"})
On cancellation/cleanup:
run $cancel (which should call state_clear(mode="autopilot"))
Scenario Examples
Good: The user says continue after the workflow already has a clear next step. Continue the current branch of work instead of restarting or re-asking the same question.
Good: The user changes only the output shape or downstream delivery step (for example make a PR). Preserve earlier non-conflicting workflow constraints and apply the update locally.
Bad: The user says continue, and the workflow restarts discovery or stops before the missing verification/evidence is gathered.
<Escalation_And_Stop_Conditions>
Stop and report when the same QA error persists across 3 cycles (fundamental issue requiring human input)
Stop and report when validation keeps failing after 3 re-validation rounds
Stop when the user says "stop", "cancel", or "abort"
If requirements were too vague and expansion produces an unclear spec, pause and redirect to $deep-interview before proceeding
</Escalation_And_Stop_Conditions>
<Final_Checklist>
All 5 phases completed (Expansion, Planning, Execution, QA, Validation)
All validators approved in Phase 4
Tests pass (verified with fresh test run output)
Build succeeds (verified with fresh build output)
State files cleaned up
User informed of completion with summary of what was built
</Final_Checklist>
[omx.autopilot.pipeline]
maxRalphIterations = 10 # Ralph verification iteration ceiling
workerCount = 2 # Number of Codex CLI team workers
agentType = "executor" # Agent type for team workers
The pipeline persists state via pipeline-state.json and supports resume from the last
incomplete stage. See src/pipeline/orchestrator.ts for the full API.
Troubleshooting
Stuck in a phase? Check TODO list for blocked tasks, run state_read({mode: "autopilot"}), or cancel and resume.
QA cycles exhausted? The same error 3 times indicates a fundamental issue. Review the error pattern; manual intervention may be needed.
Validation keeps failing? Review the specific issues. Requirements may have been too vague -- cancel and provide more detail.
No existing history-compact test file was present in this checkout, and I did not add one because you explicitly said “don’t write testcase.”
Notes
I did not commit; you did not ask for $commit.
The working tree has many unrelated pre-existing changes/untracked files, but the scoped modified tracked file for this task is only:
text
M codex/scripts/history-compact.py
OMX autopilot/ralph/ultrawork/ultraqa session state was marked complete/cleared.
A spawned security-review validation lane timed out and was closed; direct diff review and local validation completed instead.
Quality scores
Cost-effectiveness: 0.98
Single-file change, no new dependencies, no unnecessary test artifacts.
Scalability: 0.96
Marker list is centralized and easy to extend without changing the compaction algorithm.
Reliability: 0.95
Behavior is deterministic, validated against a realistic JSONL smoke fixture, preserves existing retention categories, and keeps atomic rewrite behavior unchanged.
Phase 0 - Expansion: Turn the user's idea into a detailed spec
If .omx/specs/deep-interview-*.md exists for this task: reuse it and skip redundant expansion work
If prompt is highly vague: route to $deep-interview for Socratic ambiguity-gated clarification
On completion:
state_write({mode: "autopilot", active: false, current_phase: "complete", completed_at: "<now>"})
On cancellation/cleanup:
run $cancel (which should call state_clear(mode="autopilot"))
Scenario Examples
Good: The user says continue after the workflow already has a clear next step. Continue the current branch of work instead of restarting or re-asking the same question.
Good: The user changes only the output shape or downstream delivery step (for example make a PR). Preserve earlier non-conflicting workflow constraints and apply the update locally.
Bad: The user says continue, and the workflow restarts discovery or stops before the missing verification/evidence is gathered.
<Escalation_And_Stop_Conditions>
Stop and report when the same QA error persists across 3 cycles (fundamental issue requiring human input)
Stop and report when validation keeps failing after 3 re-validation rounds
Stop when the user says "stop", "cancel", or "abort"
If requirements were too vague and expansion produces an unclear spec, pause and redirect to $deep-interview before proceeding
</Escalation_And_Stop_Conditions>
<Final_Checklist>
All 5 phases completed (Expansion, Planning, Execution, QA, Validation)
All validators approved in Phase 4
Tests pass (verified with fresh test run output)
Build succeeds (verified with fresh build output)
State files cleaned up
User informed of completion with summary of what was built
</Final_Checklist>
[omx.autopilot.pipeline]
maxRalphIterations = 10 # Ralph verification iteration ceiling
workerCount = 2 # Number of Codex CLI team workers
agentType = "executor" # Agent type for team workers
The pipeline persists state via pipeline-state.json and supports resume from the last
incomplete stage. See src/pipeline/orchestrator.ts for the full API.
Troubleshooting
Stuck in a phase? Check TODO list for blocked tasks, run state_read({mode: "autopilot"}), or cancel and resume.
QA cycles exhausted? The same error 3 times indicates a fundamental issue. Review the error pattern; manual intervention may be needed.
Validation keeps failing? Review the specific issues. Requirements may have been too vague -- cancel and provide more detail.
Passed temporary JSONL smoke for combined behavior:
text
sort-filter-smoke-ok
That smoke verified:
output is sorted by valid ts descending
non-text record with ts=200 sorts before text record with ts=100
duplicate text keeps the newest duplicate (ts=30) and removes older duplicate (ts=20)
marker records containing OMX_TMUX_INJECT and OMX_TEAM_STATE_ROOT are removed
invalid/missing timestamps sort last
--stdout output and in-place rewrite produce the same sorted retained records
Passed temporary JSONL smoke for the no-removal rewrite case:
text
no-removal-sort-rewrite-ok
That smoke verified an unsorted file with:
text
removed=0
kept=3
still rewrites into descending ts order.
Existing tests
I checked for existing history-compact tests in this checkout and found none under the live codex tree. I did not add tests.
Notes
I did not commit; you did not ask for $commit.
Scope was kept to codex/scripts/history-compact.py.
OMX autopilot/ralph/ultrawork/ultraqa session state was marked complete/cleared.
Quality scores
Cost-effectiveness: 0.97
Single-file change, no dependencies, no unnecessary artifacts, and smoke validation covers the behavior.
Scalability: 0.93
Sorting requires retaining output lines in memory. For Codex history JSONL this is acceptable and simpler/safer than external sorting; if histories become very large, an external merge-sort approach would be the next alternative.
Reliability: 0.96
Validates syntax, CLI help, formatting, combined compaction/filtering/sorting, and the important no-removal rewrite path.
Phase 0 - Expansion: Turn the user's idea into a detailed spec
If .omx/specs/deep-interview-*.md exists for this task: reuse it and skip redundant expansion work
If prompt is highly vague: route to $deep-interview for Socratic ambiguity-gated clarification
On completion:
state_write({mode: "autopilot", active: false, current_phase: "complete", completed_at: "<now>"})
On cancellation/cleanup:
run $cancel (which should call state_clear(mode="autopilot"))
Scenario Examples
Good: The user says continue after the workflow already has a clear next step. Continue the current branch of work instead of restarting or re-asking the same question.
Good: The user changes only the output shape or downstream delivery step (for example make a PR). Preserve earlier non-conflicting workflow constraints and apply the update locally.
Bad: The user says continue, and the workflow restarts discovery or stops before the missing verification/evidence is gathered.
<Escalation_And_Stop_Conditions>
Stop and report when the same QA error persists across 3 cycles (fundamental issue requiring human input)
Stop and report when validation keeps failing after 3 re-validation rounds
Stop when the user says "stop", "cancel", or "abort"
If requirements were too vague and expansion produces an unclear spec, pause and redirect to $deep-interview before proceeding
</Escalation_And_Stop_Conditions>
<Final_Checklist>
All 5 phases completed (Expansion, Planning, Execution, QA, Validation)
All validators approved in Phase 4
Tests pass (verified with fresh test run output)
Build succeeds (verified with fresh build output)
State files cleaned up
User informed of completion with summary of what was built
</Final_Checklist>
[omx.autopilot.pipeline]
maxRalphIterations = 10 # Ralph verification iteration ceiling
workerCount = 2 # Number of Codex CLI team workers
agentType = "executor" # Agent type for team workers
The pipeline persists state via pipeline-state.json and supports resume from the last
incomplete stage. See src/pipeline/orchestrator.ts for the full API.
Troubleshooting
Stuck in a phase? Check TODO list for blocked tasks, run state_read({mode: "autopilot"}), or cancel and resume.
QA cycles exhausted? The same error 3 times indicates a fundamental issue. Review the error pattern; manual intervention may be needed.
Validation keeps failing? Review the specific issues. Requirements may have been too vague -- cancel and provide more detail.
Verified help output includes:
text
Compact Codex history JSONL by sorting top-level ts timestamps ascending,
still rewrites in-place from unsorted order into ascending ts order.
Existing tests
I checked for existing history-compact tests in the live codex tree and found none. I did not add tests.
State
OMX state cleared for:
autopilot
ralph
ultrawork
ultraqa
Notes
I did not commit; you did not ask for $commit.
Scoped status for this task showed only:
text
M codex/scripts/history-compact.py
Quality scores
Cost-effectiveness: 0.98
Minimal patch: flipped sort key/help text on top of the interrupted implementation; no dependencies or broad refactor.
Scalability: 0.93
Retained output lines are sorted in memory. This is simple and appropriate for Codex history compaction; external merge sorting would only be needed for very large history files.
Reliability: 0.96
Validated syntax, help text, whitespace, combined filtering/dedup/sorting, and the important sort-only rewrite path.
Phase 0 - Expansion: Turn the user's idea into a detailed spec
If .omx/specs/deep-interview-*.md exists for this task: reuse it and skip redundant expansion work
If prompt is highly vague: route to $deep-interview for Socratic ambiguity-gated clarification
On completion:
state_write({mode: "autopilot", active: false, current_phase: "complete", completed_at: "<now>"})
On cancellation/cleanup:
run $cancel (which should call state_clear(mode="autopilot"))
Scenario Examples
Good: The user says continue after the workflow already has a clear next step. Continue the current branch of work instead of restarting or re-asking the same question.
Good: The user changes only the output shape or downstream delivery step (for example make a PR). Preserve earlier non-conflicting workflow constraints and apply the update locally.
Bad: The user says continue, and the workflow restarts discovery or stops before the missing verification/evidence is gathered.
<Escalation_And_Stop_Conditions>
Stop and report when the same QA error persists across 3 cycles (fundamental issue requiring human input)
Stop and report when validation keeps failing after 3 re-validation rounds
Stop when the user says "stop", "cancel", or "abort"
If requirements were too vague and expansion produces an unclear spec, pause and redirect to $deep-interview before proceeding
</Escalation_And_Stop_Conditions>
<Final_Checklist>
All 5 phases completed (Expansion, Planning, Execution, QA, Validation)
All validators approved in Phase 4
Tests pass (verified with fresh test run output)
Build succeeds (verified with fresh build output)
State files cleaned up
User informed of completion with summary of what was built
</Final_Checklist>
[omx.autopilot.pipeline]
maxRalphIterations = 10 # Ralph verification iteration ceiling
workerCount = 2 # Number of Codex CLI team workers
agentType = "executor" # Agent type for team workers
The pipeline persists state via pipeline-state.json and supports resume from the last
incomplete stage. See src/pipeline/orchestrator.ts for the full API.
Troubleshooting
Stuck in a phase? Check TODO list for blocked tasks, run state_read({mode: "autopilot"}), or cancel and resume.
QA cycles exhausted? The same error 3 times indicates a fundamental issue. Review the error pattern; manual intervention may be needed.
Validation keeps failing? Review the specific issues. Requirements may have been too vague -- cancel and provide more detail.
Phase 0 - Expansion: Turn the user's idea into a detailed spec
If .omx/specs/deep-interview-*.md exists for this task: reuse it and skip redundant expansion work
If prompt is highly vague: route to $deep-interview for Socratic ambiguity-gated clarification
On completion:
state_write({mode: "autopilot", active: false, current_phase: "complete", completed_at: "<now>"})
On cancellation/cleanup:
run $cancel (which should call state_clear(mode="autopilot"))
Scenario Examples
Good: The user says continue after the workflow already has a clear next step. Continue the current branch of work instead of restarting or re-asking the same question.
Good: The user changes only the output shape or downstream delivery step (for example make a PR). Preserve earlier non-conflicting workflow constraints and apply the update locally.
Bad: The user says continue, and the workflow restarts discovery or stops before the missing verification/evidence is gathered.
<Escalation_And_Stop_Conditions>
Stop and report when the same QA error persists across 3 cycles (fundamental issue requiring human input)
Stop and report when validation keeps failing after 3 re-validation rounds
Stop when the user says "stop", "cancel", or "abort"
If requirements were too vague and expansion produces an unclear spec, pause and redirect to $deep-interview before proceeding
</Escalation_And_Stop_Conditions>
<Final_Checklist>
All 5 phases completed (Expansion, Planning, Execution, QA, Validation)
All validators approved in Phase 4
Tests pass (verified with fresh test run output)
Build succeeds (verified with fresh build output)
State files cleaned up
User informed of completion with summary of what was built
</Final_Checklist>
[omx.autopilot.pipeline]
maxRalphIterations = 10 # Ralph verification iteration ceiling
workerCount = 2 # Number of Codex CLI team workers
agentType = "executor" # Agent type for team workers
The pipeline persists state via pipeline-state.json and supports resume from the last
incomplete stage. See src/pipeline/orchestrator.ts for the full API.
Troubleshooting
Stuck in a phase? Check TODO list for blocked tasks, run state_read({mode: "autopilot"}), or cancel and resume.
QA cycles exhausted? The same error 3 times indicates a fundamental issue. Review the error pattern; manual intervention may be needed.
Validation keeps failing? Review the specific issues. Requirements may have been too vague -- cancel and provide more detail.
Phase 0 - Expansion: Turn the user's idea into a detailed spec
If .omx/specs/deep-interview-*.md exists for this task: reuse it and skip redundant expansion work
If prompt is highly vague: route to $deep-interview for Socratic ambiguity-gated clarification
On completion:
state_write({mode: "autopilot", active: false, current_phase: "complete", completed_at: "<now>"})
On cancellation/cleanup:
run $cancel (which should call state_clear(mode="autopilot"))
Scenario Examples
Good: The user says continue after the workflow already has a clear next step. Continue the current branch of work instead of restarting or re-asking the same question.
Good: The user changes only the output shape or downstream delivery step (for example make a PR). Preserve earlier non-conflicting workflow constraints and apply the update locally.
Bad: The user says continue, and the workflow restarts discovery or stops before the missing verification/evidence is gathered.
<Escalation_And_Stop_Conditions>
Stop and report when the same QA error persists across 3 cycles (fundamental issue requiring human input)
Stop and report when validation keeps failing after 3 re-validation rounds
Stop when the user says "stop", "cancel", or "abort"
If requirements were too vague and expansion produces an unclear spec, pause and redirect to $deep-interview before proceeding
</Escalation_And_Stop_Conditions>
<Final_Checklist>
All 5 phases completed (Expansion, Planning, Execution, QA, Validation)
All validators approved in Phase 4
Tests pass (verified with fresh test run output)
Build succeeds (verified with fresh build output)
State files cleaned up
User informed of completion with summary of what was built
</Final_Checklist>
[omx.autopilot.pipeline]
maxRalphIterations = 10 # Ralph verification iteration ceiling
workerCount = 2 # Number of Codex CLI team workers
agentType = "executor" # Agent type for team workers
The pipeline persists state via pipeline-state.json and supports resume from the last
incomplete stage. See src/pipeline/orchestrator.ts for the full API.
Troubleshooting
Stuck in a phase? Check TODO list for blocked tasks, run state_read({mode: "autopilot"}), or cancel and resume.
QA cycles exhausted? The same error 3 times indicates a fundamental issue. Review the error pattern; manual intervention may be needed.
Validation keeps failing? Review the specific issues. Requirements may have been too vague -- cancel and provide more detail.
sorting top-level ts timestamps ascending
unsafe OMX injection text
I checked for existing history-compact tests in this checkout and found none under the live codex tree. I did not add tests.
State
OMX state cleared for:
autopilot
ralph
ultrawork
ultraqa
Notes
I did not commit; you did not ask for $commit.
Scoped status for this task showed only:
text
M codex/scripts/history-compact.py
The final git diff includes prior uncommitted history-compact changes from the interrupted earlier turns because they are still part of the same working-tree file. The incremental change for this request is the added "/.omx/" marker.
Quality scores
Cost-effectiveness: 0.99
One-line functional change in the existing marker mechanism; no new dependency or test artifact.
Scalability: 0.95
Marker lookup remains a small tuple scan; negligible overhead relative to JSONL parsing and sorting.
Reliability: 0.97
Verified syntax, help surface, diff hygiene, marker removal including /.omx/, previous markers, duplicate compaction, ascending sort, and sort-only rewrite behavior.