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.
<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 compact, information-dense responses; expand only when risk, ambiguity, or the user explicitly calls for detail.
Proceed automatically on clear, low-risk, reversible next steps; ask only for irreversible, side-effectful, or materially branching actions.
Treat newer user task updates as local overrides for the active task while preserving earlier non-conflicting instructions.
Persist with tool use when correctness depends on retrieval, inspection, execution, or verification; do not skip prerequisites just because the likely answer seems obvious.
</operating_principles>
Working agreements
Write a cleanup plan before modifying code for cleanup/refactor/deslop work.
Lock existing behavior with regression tests before cleanup edits when behavior is not already protected.
Prefer deletion over addition.
Reuse existing utils and patterns before introducing new abstractions.
No new dependencies without explicit request.
Keep diffs small, reviewable, and reversible.
Run lint, typecheck, tests, and static analysis after changes.
Final reports must include changed files, simplifications made, and remaining risks.
<lore_commit_protocol>
Lore Commit Protocol
Every commit message must follow the Lore protocol — structured decision records using native git trailers.
Commits are not just labels on diffs; they are the atomic unit of institutional knowledge.
Commit message titles and commit message body line within 72 characters.
Flags:
commit: git commit --gpg-sign ...
rebase: git rebase --gpg-sign ...
Format
gitcommit
scope: <intent line: why the change was made, not what changed. start word in lower case>
<body: narrative context — constraints, 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 (unit, integration, manual)>
Not-tested: <known gaps in verification>
Rules
Intent line first. The first line describes why, not what. The diff already shows what changed.
Trailers are optional but encouraged. Use the ones that add value; skip the ones that don't.
Rejected: prevents re-exploration. If you considered and rejected an alternative, record it so future agents don't waste cycles re-discovering the same dead end.
Directive: is a message to the future. Use it for "do not change X without checking Y" warnings.
Constraint: captures external forces. API limitations, policy requirements, upstream bugs — things not visible in the code.
Not-tested: is honest. Declaring known verification gaps is more valuable than pretending everything is covered.
All trailers use git-native trailer format (key-value after a blank line). No custom parsing required.
Example
code
Prevent silent session drops during long-running operations
The auth service returns inconsistent status codes on token
expiry, so the interceptor catches all 4xx responses and
triggers an inline refresh.
Constraint: Auth service does not support token introspection
Constraint: Must not add latency to non-expired-token paths
Rejected: Extend token TTL to 24h | security policy violation
Rejected: Background refresh on timer | race condition with concurrent requests
Confidence: high
Scope-risk: narrow
Directive: Error handling is intentionally broad (all 4xx) — do not narrow without verifying upstream behavior
Tested: Single expired token refresh (unit)
Not-tested: Auth service cold-start > 500ms behavior
Trailer Vocabulary
Trailer
Purpose
Constraint:
External constraint that shaped the decision
Rejected:
Alternative considered and why it was rejected
Confidence:
Author's confidence level (low/medium/high)
Scope-risk:
How broadly the change affects the system (narrow/moderate/broad)
Reversibility:
How easily the change can be undone (clean/messy/irreversible)
Directive:
Forward-looking instruction for future modifiers
Tested:
What verification was performed
Not-tested:
Known gaps in verification
Related:
Links to related commits, issues, or decisions
Teams may introduce domain-specific trailers without breaking compatibility.
</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.4), 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
/prompts:name — advanced specialist role surface when the task already needs a specific agent
</invocation_conventions>
<model_routing>
Match role to task shape:
Low complexity: explore, style-reviewer, writer
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>
Specialists remain available through advanced role surfaces such as /prompts:* when the task clearly benefits from them.
</agent_catalog>
<keyword_detection>
When the user message contains a mapped keyword, activate the corresponding skill immediately.
Do not ask for confirmation.
Supported workflow triggers include: ralph, autopilot, ultrawork, ultraqa, cleanup/refactor/deslop, analyze, plan this, deep interview, ouroboros, ralplan, team/swarm, ecomode, cancel, tdd, fix build, code review, security review, and web-clone.
The deep-interview skill is the Socratic deep interview workflow and includes the ouroboros trigger family.
Keywords are case-insensitive and match anywhere in the user message.
Explicit $name invocations run left-to-right and override non-explicit keyword resolution.
If multiple non-explicit keywords match, use the most specific match.
If the user explicitly invokes /prompts:<name>, do not auto-activate keyword skills unless explicit $name tokens are also present.
The rest of the user message becomes the task description.
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>
Common team compositions remain available when explicit team orchestration is warranted, for example feature development, bug investigation, code review, and UX audit.
</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.
</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.4
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.4-mini
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: identify what proves the claim, run the verification, read the output, then report with evidence. If verification fails, continue iterating rather than reporting incomplete work. Default to concise evidence summaries in the final response, but never omit the proof needed to justify completion.
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.
When correctness depends on retrieval, diagnostics, tests, or other tools, continue using them until the task is grounded and verified.
<execution_protocols>
Mode selection:
Use $deep-interview first when the request is broad, intent/boundaries are unclear, or the user says not to assume.
Use $ralplan when the requirements are clear enough but architecture, tradeoffs, or test strategy still need consensus.
Use $team when the approved plan has multiple independent lanes, shared blockers, or durable coordination needs.
Use $ralph when the approved plan should stay in a persistent completion / verification loop with one owner.
Otherwise execute directly in solo mode.
Do not change modes casually; switch 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.
When to use what:
Use omx explore --prompt ... for simple read-only lookups.
Use omx sparkshell for noisy read-only shell commands, bounded verification runs, repo-wide listing/search, or tmux-pane summaries; omx sparkshell --tmux-pane ... is explicit opt-in.
Keep ambiguous, implementation-heavy, edit-heavy, or non-shell-only work on the richer normal path.
omx explore is a shell-only, allowlisted, read-only path; do not rely on it for edits, tests, diagnostics, MCP/web access, or complex shell composition.
If omx explore or omx sparkshell is incomplete or ambiguous, retry narrower and 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.
Run dependent tasks sequentially.
Use background execution for builds and tests when helpful.
Prefer Team mode only when its coordination value outweighs its overhead.
If correctness depends on retrieval, diagnostics, tests, or other tools, continue using them 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.
Lock behavior with tests first, then make one smell-focused pass at a time.
Prefer deletion, reuse, and boundary repair over new layers.
Keep writer/reviewer pass separation for cleanup plans and approvals.
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>
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.
Mode lifecycle requirements:
Write state on start.
Update state on phase or iteration change.
Mark inactive with completed_at on completion.
Clear state on cancel/abort cleanup.
</state_management>
Setup
Run omx setup to install all components. Run omx doctor to verify installation.
Important rules
<extremely_important>
MUST USE multi agents
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 with the sequential-thinking MCP server in ultrathink mode, 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 internal reasoning in English, even if the user writes in Japanese.
PERSONA
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.
</extremely_important>
<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.
Prohibitions
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.
SHELL
rg
Use rg --threads=8 for ripgrep commands.
MCP SERVERS
Always use the memory tool for persistent context and recall.
Use gemini-google-search for web search instead of built-in web search tools.
Use context7 when detailed library/API documentation is needed.
</absolute_rules>
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.
<language_rules>
Go:
~/.config/codex/instructions/Go.md
Python programming language
~/.config/codex/instructions/Python.md
</language_rules>
JavaScript REPL (Node)
Use js_repl for Node-backed JavaScript with top-level await in a persistent kernel.
js_repl is a freeform/custom tool. Direct js_repl calls must send raw JavaScript tool input (optionally with first-line // codex-js-repl: timeout_ms=15000). Do not wrap code in JSON (for example {"code":"..."}), quotes, or markdown code fences.
Helpers: codex.cwd, codex.homeDir, codex.tmpDir, codex.tool(name, args?), and codex.emitImage(imageLike).
codex.tool executes a normal tool call and resolves to the raw tool output object. Use it for shell and non-shell tools alike. Nested tool outputs stay inside JavaScript unless you emit them explicitly.
codex.emitImage(...) adds one image to the outer js_repl function output each time you call it, so you can call it multiple times to emit multiple images. It accepts a data URL, a single input_image item, an object like { bytes, mimeType }, or a raw tool response object with exactly one image and no text. It rejects mixed text-and-image content.
codex.tool(...) and codex.emitImage(...) keep stable helper identities across cells. Saved references and persisted objects can reuse them in later cells, but async callbacks that fire after a cell finishes still fail because no exec is active.
Request full-resolution image processing with detail: "original" only when the view_image tool schema includes a detail argument. The same availability applies to codex.emitImage(...): if view_image.detail is present, you may also pass detail: "original" there. Use this when high-fidelity image perception or precise localization is needed, especially for CUA agents.
Example of sharing an in-memory Playwright screenshot: await codex.emitImage({ bytes: await page.screenshot({ type: "jpeg", quality: 85 }), mimeType: "image/jpeg", detail: "original" }).
Example of sharing a local image tool result: await codex.emitImage(codex.tool("view_image", { path: "/absolute/path", detail: "original" })).
When encoding an image to send with codex.emitImage(...) or view_image, prefer JPEG at about 85 quality when lossy compression is acceptable; use PNG when transparency or lossless detail matters. Smaller uploads are faster and less likely to hit size limits.
Top-level bindings persist across cells. If a cell throws, prior bindings remain available and bindings that finished initializing before the throw often remain usable in later cells. For code you plan to reuse across cells, prefer declaring or assigning it in direct top-level statements before operations that might throw. If you hit , first reuse the existing binding, reassign a previously declared , or pick a new descriptive name. Use only for a short temporary block when you specifically need local scratch names; do not wrap an entire cell in block scope if you want those names reusable later. Reset the kernel with only when you need a clean 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.
$ultrawork "Implements formatting generated code with gofumpt"
User
<Use_When>
Multiple independent tasks can run simultaneously
User says "ulw", "ultrawork", or wants parallel execution
You need to delegate work to multiple agents at once
Task benefits from concurrent execution but the user will manage completion themselves
</Use_When>
<Do_Not_Use_When>
Task requires guaranteed completion with verification -- use ralph instead (ralph includes ultrawork)
Task requires a full autonomous pipeline -- use autopilot instead (autopilot includes ralph which includes ultrawork)
There is only one sequential task with no parallelism opportunity -- delegate directly to an executor agent
User needs session persistence for resume -- use ralph which adds persistence on top of ultrawork
</Do_Not_Use_When>
<Why_This_Exists>
Sequential task execution wastes time when tasks are independent. Ultrawork enables firing multiple agents simultaneously and routing each to the right model tier, reducing total execution time while controlling token costs. It is designed as a composable component that ralph and autopilot layer on top of.
</Why_This_Exists>
<Execution_Policy>
Fire all independent agent calls simultaneously -- never serialize independent work
Always pass the model parameter explicitly when delegating
Read docs/shared/agent-tiers.md before first delegation for agent selection guidance
Use run_in_background: true for operations over ~30 seconds (installs, builds, tests)
Run quick commands (git status, file reads, simple checks) in the foreground
</Execution_Policy>
<Tool_Usage>
Use LOW-tier delegation for simple changes
Use STANDARD-tier delegation for standard work
Use THOROUGH-tier delegation for complex work
Use run_in_background: true for package installs, builds, and test suites
Use foreground execution for quick status checks and file operations
</Tool_Usage>
State Management
Use omx_state MCP tools for ultrawork lifecycle state.
On start:
state_write({mode: "ultrawork", active: true, reinforcement_count: 1, started_at: "<now>"})
On each reinforcement/loop step:
state_write({mode: "ultrawork", reinforcement_count: <current>})
On completion:
state_write({mode: "ultrawork", active: false})
User
<turn_aborted>
The user interrupted the previous turn on purpose. Any running unified exec processes may still be running in the background. If any tools/commands were aborted, they may have partially executed.
</turn_aborted>
User
AGENTS.md instructions for /Users/zchee/go/src/github.com/zchee/spanner-manager
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.
<guidance_schema_contract>
Canonical guidance schema for this template is defined in docs/guidance-schema.md.
Required schema sections and this template's mapping:
$ultrawork "Implements formatting generated code with gofumpt package"
User
<Use_When>
Multiple independent tasks can run simultaneously
User says "ulw", "ultrawork", or wants parallel execution
You need to delegate work to multiple agents at once
Task benefits from concurrent execution but the user will manage completion themselves
</Use_When>
<Do_Not_Use_When>
Task requires guaranteed completion with verification -- use ralph instead (ralph includes ultrawork)
Task requires a full autonomous pipeline -- use autopilot instead (autopilot includes ralph which includes ultrawork)
There is only one sequential task with no parallelism opportunity -- delegate directly to an executor agent
User needs session persistence for resume -- use ralph which adds persistence on top of ultrawork
</Do_Not_Use_When>
<Why_This_Exists>
Sequential task execution wastes time when tasks are independent. Ultrawork enables firing multiple agents simultaneously and routing each to the right model tier, reducing total execution time while controlling token costs. It is designed as a composable component that ralph and autopilot layer on top of.
</Why_This_Exists>
<Execution_Policy>
Fire all independent agent calls simultaneously -- never serialize independent work
Always pass the model parameter explicitly when delegating
Read docs/shared/agent-tiers.md before first delegation for agent selection guidance
Use run_in_background: true for operations over ~30 seconds (installs, builds, tests)
Run quick commands (git status, file reads, simple checks) in the foreground
</Execution_Policy>
<Tool_Usage>
Use LOW-tier delegation for simple changes
Use STANDARD-tier delegation for standard work
Use THOROUGH-tier delegation for complex work
Use run_in_background: true for package installs, builds, and test suites
Use foreground execution for quick status checks and file operations
</Tool_Usage>
State Management
Use omx_state MCP tools for ultrawork lifecycle state.
On start:
state_write({mode: "ultrawork", active: true, reinforcement_count: 1, started_at: "<now>"})
On each reinforcement/loop step:
state_write({mode: "ultrawork", reinforcement_count: <current>})
On completion:
state_write({mode: "ultrawork", active: false})
Assistant
{"author":"/root/codegen_surface_scan","recipient":"/root","other_recipients":[],"content":"<subagent_notification>\n{"agent_path":"/root/codegen_surface_scan","status":{"completed":"I attempted to inspect codegen/generator.go and the surrounding repository (per your read-only scan request) but every tool call failed immediately with exec parsing errors (“SyntaxError: Unexpected token ':'”) because the agent runtime insists on receiving raw script text instead of the usual JSON-wrapped payload. Without being able to run shell_command, read_text_file, or any code-introspection tool, I can’t actually open codegen/generator.go, the related tests, or the docs/CLI files you referenced.\n\nOnce the tool blockage is resolved (or if you can paste the relevant files), here’s the concrete, file-by-file path I would follow:\n\n1. Locate the formatting hook in codegen/generator.go. Look for the call that currently marshals generated Go into a buffer and runs go/format on it (likely via format.Source or format.Node). The symbol(s) to touch are the function that takes the generated AST/text and writes it to disk—probably around generateFile, emitFile, or writeFormatted. That’s where you’d swap go/format for mvdan.cc/gofumpt, so the formatting path for every generated file goes through the gofumpt API instead of the standard formatter.\n\n2. Update dependency and invocation. Add mvdan.cc/gofumpt to go.mod (with a specific semantic version that matches your Go version) and replace format.Source calls with gofumpt.Source. If there’s any CLI flag or config option controlling gofmt/formatting, document the new dependency and default, and consider adding a flag (under docs/ or CLI reference) to opt out or switch formatting back to gofmt for rapid iteration.\n\n3. Adjust tests/docs. Identify any tests under codegen/... or tests/... that assert exact formatting output. They’ll need to be updated to reflect gofumpt’s stricter/sharper formatting (e.g., gofumpt adds parentheses around composite literals and enforces consistent spacing). Also, update any CLI documentation or README sections describing gofmt runs to mention gofumpt, including any environment variables (module path/version, Go language version) that gofumpt respects differently.\n\n4. Pitfalls to flag.\n - Module path/version: Ensure still allows (which depends on Go 1.18+). If your GOPATH or module proxy doesn’t include it, you’ll need to vendor or mirror it.\n - : Gofumpt uses go/token/ast matching the Go 1.20+ spec; make sure directives in align so generated code’s gofmt/gofumpt output stays consistent with your target.\n - : If the generator exposes or similar, document how to choose between gofmt and gofumpt, and note that a dependency change may change the generated output.\n\nPlease let me know if you can provide the relevant source files (or fix tool access) so I can double-check the exact symbols and produce a precise set of edits and file paths before editing anything."}}\n</subagent_notification>","trigger_turn":false}
Assistant
{"author":"/root/gofumpt_test_plan","recipient":"/root","other_recipients":[],"content":"<subagent_notification>\n{"agent_path":"/root/gofumpt_test_plan","status":{"completed":"Read-only analysis complete. No files edited.\n\n## Best regression test to add\n\nMost direct test: assert the gofumpt-only header rewrite in the generated header file.\n\nWhy this is the best one:\n- The formatter switch happens centrally in codegen/generator.go:329-337.\n- The generated header already exists in every run and is easy to inspect with existing helpers.\n- I confirmed an actual gofumpt diff on generated output: gofumpt rewrites the header’s four standalone _ = ... lines into a single grouped var (...) block, while current go/format output does not.\n\n### Exact failing-before / passing-after snippet\n\nTarget file:\n- generated spanner_header.spanner.go or spanner_header.yo.go\n\nExact snippet to assert:\ngo\\n// Ensure imports are used.\\nvar (\\n\\t_ = context.Background\\n\\t_ = fmt.Sprintf\\n\\t_ = spanner.Key{}\\n\\t_ = iterator.Done\\n)\\n\n\n### Best place to add it\nOption A, smallest diff: extend the existing header subtest in \ncodegen/generator_test.go:53-61\n\nThat test already reads:\n- spanner_header.yo.go\n- with readTextFile(...)\n\nSo the minimal regression is just one more contains entry for the grouped var ( block.\n\n### Why this is stronger than a generic “run gofumpt” check\nIt is:\n- deterministic,\n- localized,\n- directly tied to a real generated artifact,\n- guaranteed to fail under current go/format behavior,\n- guaranteed to pass after the formatter switch.\n\n---\n\n## Second-best regression test\n\nIf you want a test closer to “real model output” rather than header scaffolding, use the existing custom-import fixture in:\n\n- codegen/generator_test.go:232-275TestGenerator_Generate_CustomTypeImports\n\ngofumpt changes the import block in users.spanner.go from the current awkward grouping to this normalized layout:\n\ngo\\nimport (\\n\\t\\\"context\\\"\\n\\t\\\"fmt\\\"\\n\\n\\t\\\"cloud.google.com/go/spanner\\\"\\n\\n\\tjson \\\"encoding/json\\\"\\n)\\n\n\nThat is also a real observed diff from this repo’s generator output.\n\n### Tradeoff vs header test\n- Header test: simplest, universal, lowest maintenance.\n- Custom-import test: more representative of “actual generated model file” formatting, but slightly more fixture-coupled.\n\n---\n\n## Evidence anchors\n\n### Formatter switch point\n- \n - current code calls \n\n### Existing useful test surfaces\n- \n- \n- \n\n### Actual diffs I verified\nObserved with generated files from repo fixtures and :\n1. \n - four standalone lines become one block\n2. and \n - import ordering/grouping changes to gofumpt style\n\n---\n\n## Recommended test shape\n\n### Recommendation 1: minimum diff\nAdd one exact substring assertion to the existing header test:\n- file: \n- test: \n\nAssert the generated header contains the grouped block above.\n\n### Recommendation 2: slightly stronger\nAdd a new targeted test, e.g.:\n- \n\nGenerate a basic schema, read , and assert the exact grouped block.\n\n### Recommendation 3: strongest long-term\nAdd a helper that compares selected generated files to output and asserts they are already identical.\n\nTradeoff:\n- strongest semantic guarantee,\n- but introduces tool-coupling in tests and depends on availability in the test environment.\n\nGiven this repo’s current test style, .\n\n---\n\n## Broader verification commands\n\nFor the formatting change itself, I’d verify in this order:\n\n1. \n \n\n2. \n \n\n3. \n From \n \n\n4. \n From \n \n\nIf you want only the narrowest smoke test for the formatter migration, the most relevant command is still:\n\n\n\n---\n\n## Bottom line\n\n extend to assert the generated header contains the grouped:\n\n\n\nThat is the cleanest test I found that:\n- replacing with ,\n- the switch,\n- fits the current test style with minimal churn.\n\nConfidence:\n- Cost-effectiveness: \n- Scalability: \n- Reliability: "}}\n</subagent_notification>","trigger_turn":false}
Assistant
{"author":"/root/verify_vet_and_diff","recipient":"/root","other_recipients":[],"content":"<subagent_notification>\n{"agent_path":"/root/verify_vet_and_diff","status":{"completed":"## Verdict\nPASS\n\n## Evidence\n- set -e; go vet ./...; printf '\\\\n-- status --\\\\n'; git status --short --branch — exit code 0\n - go vet ./... passed.\n - git status --short --branch reported:\n - ## main\n - modified: codegen/generator.go\n - modified: codegen/generator_test.go\n - modified: go.mod\n - modified: go.sum\n - untracked: .github/workflows/\n- rg --files vendor | rg 'gofumpt|mvdan.cc' — vendor tree contains:\n - vendor/mvdan.cc/gofumpt/...\n- git check-ignore -v vendor/mvdan.cc/gofumpt vendor/mvdan.cc/gofumpt/format/format.go — both paths are ignored by .gitignore:25:vendor/\n- git ls-files vendor/mvdan.cc/gofumpt — no tracked files returned for that vendor subtree\n\n## Gaps\n- None for the requested verification.\n\n## Risks\n- gofumpt is present in the working tree under vendor/, but that directory is gitignored, so it is not tracked by git ls-files."}}\n</subagent_notification>","trigger_turn":false}
Assistant
{"author":"/root/verify_codegen_tests","recipient":"/root","other_recipients":[],"content":"<subagent_notification>\n{"agent_path":"/root/verify_codegen_tests","status":{"completed":"Verification complete in /Users/zchee/go/src/github.com/zchee/spanner-manager with no file edits.\n\nCommand-by-command results:\n1. git diff --check — PASS \n - Exit code: 0 \n - Output: empty\n\n2. go test ./codegen — PASS \n - Exit code: 0 \n - Output:\n ok \\tgithub.com/zchee/spanner-manager/codegen\\t1.297s\n\n3. go test ./... — PASS \n - Exit code: 0 \n - Output:\n - ? \\tgithub.com/zchee/spanner-manager\\t[no test files]\n - ok \\tgithub.com/zchee/spanner-manager/cmd\\t0.023s\n - ok \\tgithub.com/zchee/spanner-manager/codegen\\t(cached)\n - ok \\tgithub.com/zchee/spanner-manager/diff\\t0.010s\n - ok \\tgithub.com/zchee/spanner-manager/migration\\t0.028s\n - ok \\tgithub.com/zchee/spanner-manager/spannerutil\\t0.023s\n - ok \\tgithub.com/zchee/spanner-manager/sqlutil\\t0.009s\n\nRead-only context from parallel reconnaissance:\n- ./codegen exists and includes tests:\n - codegen/generator_test.go\n - codegen/loader_test.go\n - codegen/naming_test.go\n - codegen/typeinfo_test.go\n- No deeper AGENTS.md applies to ./codegen; the only deeper one found was under .omx/state/..., outside the tested package scope.\n- No error anchors to report because all requested commands passed."}}\n</subagent_notification>","trigger_turn":false}
Assistant
Mode: ultrawork
Result: completed — generated Go code now formats with gofumpt
What changed
codegen/generator.go
Replaced the inline go/format.Source(...) path with a dedicated formatGoSource(...) helper.
Switched formatting to mvdan.cc/gofumpt/format.Source(...).
Added detectGoModuleConfig(...) and parseGoModMetadata(...) so generated code formatting uses:
ModulePath from the nearest go.mod
LangVersion from the nearest go.mod
Kept the prior fallback behavior: if formatting fails, the generator still writes the unformatted source for debugging rather than hard-failing.
codegen/generator_test.go
Strengthened the existing basic generator test to assert a real gofumpt-visible change in the generated header:
the four _ = ... lines are now grouped into a single var (...) block
Added TestDetectGoModuleConfig to verify nearest-go.mod discovery and the empty-config fallback.
go.mod
Added direct dependency: mvdan.cc/gofumpt v0.9.2
go.sum
Added checksums required by the new dependency resolution.
Implementation choice and tradeoffs
I chose the in-process gofumpt library API over the two obvious alternatives:
Use gofumpt as a Go library
Chosen
Pros: deterministic, no subprocess overhead, works inside existing generator flow, testable
Cons: adds a module dependency
Shell out to a gofumpt binary
Rejected
Pros: simple conceptually
Cons: brittle runtime dependency, harder to test, depends on external tool availability
Hardcode module path / Go version
Rejected
Pros: smaller code diff
Cons: wrong import grouping and language-version behavior outside this repo layout
SyntaxError: Identifier 'x' has already been declared
let
{ ... }
js_repl_reset
Top-level static import declarations (for example import x from "./file.js") are currently unsupported in js_repl; use dynamic imports with await import("pkg"), await import("./file.js"), or await import("/abs/path/file.mjs") instead. Imported local files must be ESM .js/.mjs files and run in the same REPL VM context. Bare package imports always resolve from REPL-global search roots (CODEX_JS_REPL_NODE_MODULE_DIRS, then cwd), not relative to the imported file location. Local files may statically import only other local relative/absolute/file://.js/.mjs files; package and builtin imports from local files must stay dynamic. import.meta.resolve() returns importable strings such as file://..., bare package names, and node:... specifiers. Local file modules reload between execs, while top-level bindings persist until js_repl_reset.
Avoid direct access to process.stdout / process.stderr / process.stdin; it can corrupt the JSON line protocol. Use console.log, codex.tool(...), and codex.emitImage(...).
On cancellation/cleanup:
run $cancel (which should call state_clear(mode="ultrawork"))
<Escalation_And_Stop_Conditions>
When ultrawork is invoked directly (not via ralph), apply lightweight verification only -- build passes, tests pass, no new errors
For full persistence and comprehensive architect verification, recommend switching to ralph mode
If a task fails repeatedly across retries, report the issue rather than retrying indefinitely
Escalate to the user when tasks have unclear dependencies or conflicting requirements
</Escalation_And_Stop_Conditions>
<Final_Checklist>
All parallel tasks completed
Build/typecheck passes
Affected tests pass
No new errors introduced
</Final_Checklist>
code
ralph (persistence wrapper)
\-- includes: ultrawork (this skill)
\-- provides: parallel execution only
autopilot (autonomous execution)
\-- includes: ralph
\-- includes: ultrawork (this skill)
ecomode (token efficiency)
\-- modifies: ultrawork's model selection
Ultrawork is the parallelism layer. Ralph adds persistence and verification. Autopilot adds the full lifecycle pipeline. Ecomode adjusts ultrawork's model routing to favor cheaper models.
Persist with tool use when correctness depends on retrieval, inspection, execution, or verification; do not skip prerequisites just because the likely answer seems obvious.
</operating_principles>
Working agreements
Write a cleanup plan before modifying code for cleanup/refactor/deslop work.
Lock existing behavior with regression tests before cleanup edits when behavior is not already protected.
Prefer deletion over addition.
Reuse existing utils and patterns before introducing new abstractions.
No new dependencies without explicit request.
Keep diffs small, reviewable, and reversible.
Run lint, typecheck, tests, and static analysis after changes.
Final reports must include changed files, simplifications made, and remaining risks.
<lore_commit_protocol>
Lore Commit Protocol
Every commit message must follow the Lore protocol — structured decision records using native git trailers.
Commits are not just labels on diffs; they are the atomic unit of institutional knowledge.
Commit message titles and commit message body line within 72 characters.
Flags:
commit: git commit --gpg-sign ...
rebase: git rebase --gpg-sign ...
Format
gitcommit
scope: <intent line: why the change was made, not what changed. start word in lower case>
<body: narrative context — constraints, 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 (unit, integration, manual)>
Not-tested: <known gaps in verification>
Rules
Intent line first. The first line describes why, not what. The diff already shows what changed.
Trailers are optional but encouraged. Use the ones that add value; skip the ones that don't.
Rejected: prevents re-exploration. If you considered and rejected an alternative, record it so future agents don't waste cycles re-discovering the same dead end.
Directive: is a message to the future. Use it for "do not change X without checking Y" warnings.
Constraint: captures external forces. API limitations, policy requirements, upstream bugs — things not visible in the code.
Not-tested: is honest. Declaring known verification gaps is more valuable than pretending everything is covered.
All trailers use git-native trailer format (key-value after a blank line). No custom parsing required.
Example
code
Prevent silent session drops during long-running operations
The auth service returns inconsistent status codes on token
expiry, so the interceptor catches all 4xx responses and
triggers an inline refresh.
Constraint: Auth service does not support token introspection
Constraint: Must not add latency to non-expired-token paths
Rejected: Extend token TTL to 24h | security policy violation
Rejected: Background refresh on timer | race condition with concurrent requests
Confidence: high
Scope-risk: narrow
Directive: Error handling is intentionally broad (all 4xx) — do not narrow without verifying upstream behavior
Tested: Single expired token refresh (unit)
Not-tested: Auth service cold-start > 500ms behavior
Trailer Vocabulary
Trailer
Purpose
Constraint:
External constraint that shaped the decision
Rejected:
Alternative considered and why it was rejected
Confidence:
Author's confidence level (low/medium/high)
Scope-risk:
How broadly the change affects the system (narrow/moderate/broad)
Reversibility:
How easily the change can be undone (clean/messy/irreversible)
Directive:
Forward-looking instruction for future modifiers
Tested:
What verification was performed
Not-tested:
Known gaps in verification
Related:
Links to related commits, issues, or decisions
Teams may introduce domain-specific trailers without breaking compatibility.
</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.4), 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
/prompts:name — advanced specialist role surface when the task already needs a specific agent
</invocation_conventions>
<model_routing>
Match role to task shape:
Low complexity: explore, style-reviewer, writer
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>
Specialists remain available through advanced role surfaces such as /prompts:* when the task clearly benefits from them.
</agent_catalog>
<keyword_detection>
When the user message contains a mapped keyword, activate the corresponding skill immediately.
Do not ask for confirmation.
Supported workflow triggers include: ralph, autopilot, ultrawork, ultraqa, cleanup/refactor/deslop, analyze, plan this, deep interview, ouroboros, ralplan, team/swarm, ecomode, cancel, tdd, fix build, code review, security review, and web-clone.
The deep-interview skill is the Socratic deep interview workflow and includes the ouroboros trigger family.
Keywords are case-insensitive and match anywhere in the user message.
Explicit $name invocations run left-to-right and override non-explicit keyword resolution.
If multiple non-explicit keywords match, use the most specific match.
If the user explicitly invokes /prompts:<name>, do not auto-activate keyword skills unless explicit $name tokens are also present.
The rest of the user message becomes the task description.
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>
Common team compositions remain available when explicit team orchestration is warranted, for example feature development, bug investigation, code review, and UX audit.
</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.
</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.4
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.4-mini
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: identify what proves the claim, run the verification, read the output, then report with evidence. If verification fails, continue iterating rather than reporting incomplete work. Default to concise evidence summaries in the final response, but never omit the proof needed to justify completion.
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.
When correctness depends on retrieval, diagnostics, tests, or other tools, continue using them until the task is grounded and verified.
<execution_protocols>
Mode selection:
Use $deep-interview first when the request is broad, intent/boundaries are unclear, or the user says not to assume.
Use $ralplan when the requirements are clear enough but architecture, tradeoffs, or test strategy still need consensus.
Use $team when the approved plan has multiple independent lanes, shared blockers, or durable coordination needs.
Use $ralph when the approved plan should stay in a persistent completion / verification loop with one owner.
Otherwise execute directly in solo mode.
Do not change modes casually; switch 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.
When to use what:
Use omx explore --prompt ... for simple read-only lookups.
Use omx sparkshell for noisy read-only shell commands, bounded verification runs, repo-wide listing/search, or tmux-pane summaries; omx sparkshell --tmux-pane ... is explicit opt-in.
Keep ambiguous, implementation-heavy, edit-heavy, or non-shell-only work on the richer normal path.
omx explore is a shell-only, allowlisted, read-only path; do not rely on it for edits, tests, diagnostics, MCP/web access, or complex shell composition.
If omx explore or omx sparkshell is incomplete or ambiguous, retry narrower and 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.
Run dependent tasks sequentially.
Use background execution for builds and tests when helpful.
Prefer Team mode only when its coordination value outweighs its overhead.
If correctness depends on retrieval, diagnostics, tests, or other tools, continue using them 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.
Lock behavior with tests first, then make one smell-focused pass at a time.
Prefer deletion, reuse, and boundary repair over new layers.
Keep writer/reviewer pass separation for cleanup plans and approvals.
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>
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.
Mode lifecycle requirements:
Write state on start.
Update state on phase or iteration change.
Mark inactive with completed_at on completion.
Clear state on cancel/abort cleanup.
</state_management>
Setup
Run omx setup to install all components. Run omx doctor to verify installation.
Important rules
<extremely_important>
MUST USE multi agents
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 with the sequential-thinking MCP server in ultrathink mode, 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 internal reasoning in English, even if the user writes in Japanese.
PERSONA
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.
</extremely_important>
<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.
Prohibitions
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.
SHELL
rg
Use rg --threads=8 for ripgrep commands.
MCP SERVERS
Always use the memory tool for persistent context and recall.
Use gemini-google-search for web search instead of built-in web search tools.
Use context7 when detailed library/API documentation is needed.
</absolute_rules>
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.
<language_rules>
Go:
~/.config/codex/instructions/Go.md
Python programming language
~/.config/codex/instructions/Python.md
</language_rules>
JavaScript REPL (Node)
Use js_repl for Node-backed JavaScript with top-level await in a persistent kernel.
js_repl is a freeform/custom tool. Direct js_repl calls must send raw JavaScript tool input (optionally with first-line // codex-js-repl: timeout_ms=15000). Do not wrap code in JSON (for example {"code":"..."}), quotes, or markdown code fences.
Helpers: codex.cwd, codex.homeDir, codex.tmpDir, codex.tool(name, args?), and codex.emitImage(imageLike).
codex.tool executes a normal tool call and resolves to the raw tool output object. Use it for shell and non-shell tools alike. Nested tool outputs stay inside JavaScript unless you emit them explicitly.
codex.emitImage(...) adds one image to the outer js_repl function output each time you call it, so you can call it multiple times to emit multiple images. It accepts a data URL, a single input_image item, an object like { bytes, mimeType }, or a raw tool response object with exactly one image and no text. It rejects mixed text-and-image content.
codex.tool(...) and codex.emitImage(...) keep stable helper identities across cells. Saved references and persisted objects can reuse them in later cells, but async callbacks that fire after a cell finishes still fail because no exec is active.
Request full-resolution image processing with detail: "original" only when the view_image tool schema includes a detail argument. The same availability applies to codex.emitImage(...): if view_image.detail is present, you may also pass detail: "original" there. Use this when high-fidelity image perception or precise localization is needed, especially for CUA agents.
Example of sharing an in-memory Playwright screenshot: await codex.emitImage({ bytes: await page.screenshot({ type: "jpeg", quality: 85 }), mimeType: "image/jpeg", detail: "original" }).
Example of sharing a local image tool result: await codex.emitImage(codex.tool("view_image", { path: "/absolute/path", detail: "original" })).
When encoding an image to send with codex.emitImage(...) or view_image, prefer JPEG at about 85 quality when lossy compression is acceptable; use PNG when transparency or lossless detail matters. Smaller uploads are faster and less likely to hit size limits.
Top-level bindings persist across cells. If a cell throws, prior bindings remain available and bindings that finished initializing before the throw often remain usable in later cells. For code you plan to reuse across cells, prefer declaring or assigning it in direct top-level statements before operations that might throw. If you hit SyntaxError: Identifier 'x' has already been declared, first reuse the existing binding, reassign a previously declared let, or pick a new descriptive name. Use { ... } only for a short temporary block when you specifically need local scratch names; do not wrap an entire cell in block scope if you want those names reusable later. Reset the kernel with js_repl_reset only when you need a clean state.
Top-level static import declarations (for example import x from "./file.js") are currently unsupported in js_repl; use dynamic imports with await import("pkg"), await import("./file.js"), or await import("/abs/path/file.mjs") instead. Imported local files must be ESM .js/.mjs files and run in the same REPL VM context. Bare package imports always resolve from REPL-global search roots (CODEX_JS_REPL_NODE_MODULE_DIRS, then cwd), not relative to the imported file location. Local files may statically import only other local relative/absolute/file://.js/.mjs files; package and builtin imports from local files must stay dynamic. import.meta.resolve() returns importable strings such as file://..., bare package names, and node:... specifiers. Local file modules reload between execs, while top-level bindings persist until js_repl_reset.
Avoid direct access to process.stdout / process.stderr / process.stdin; it can corrupt the JSON line protocol. Use console.log, codex.tool(...), and codex.emitImage(...).
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.
On cancellation/cleanup:
run $cancel (which should call state_clear(mode="ultrawork"))
<Escalation_And_Stop_Conditions>
When ultrawork is invoked directly (not via ralph), apply lightweight verification only -- build passes, tests pass, no new errors
For full persistence and comprehensive architect verification, recommend switching to ralph mode
If a task fails repeatedly across retries, report the issue rather than retrying indefinitely
Escalate to the user when tasks have unclear dependencies or conflicting requirements
</Escalation_And_Stop_Conditions>
<Final_Checklist>
All parallel tasks completed
Build/typecheck passes
Affected tests pass
No new errors introduced
</Final_Checklist>
code
ralph (persistence wrapper)
\-- includes: ultrawork (this skill)
\-- provides: parallel execution only
autopilot (autonomous execution)
\-- includes: ralph
\-- includes: ultrawork (this skill)
ecomode (token efficiency)
\-- modifies: ultrawork's model selection
Ultrawork is the parallelism layer. Ralph adds persistence and verification. Autopilot adds the full lifecycle pipeline. Ecomode adjusts ultrawork's model routing to favor cheaper models.
go.mod
mvdan.cc/gofumpt
Language version mismatch
go
go.mod
CLI flag docs
--fmt
codegen/generator.go:329-337
format.Source(buf.Bytes())
codegen/generator_test.go:29-87
TestGenerator_Generate_BasicFiles
codegen/generator_test.go:232-275
TestGenerator_Generate_CustomTypeImports
codegen/generator_test.go:335-422
TestGenerator_Generate_CompileGeneratedOutput
gofumpt
/Users/zchee/go/bin/gofumpt -d
spanner_header.spanner.go
var _ = ...
var (...)
users.spanner.go
runs.spanner.go
codegen/generator_test.go
TestGenerator_Generate_BasicFiles/header
var (...)
TestGenerator_Generate_GofumptHeaderFormatting
spanner_header.spanner.go
gofumpt
gofumpt
I would not start there
Focused package tests
bash\\n go test ./codegen\\n
Full repo tests
bash\\n go test ./...\\n
Match CI’s stronger lane
.github/workflows/test.yaml:34-36
bash\\n go test -v -race -count=1 -shuffle=on -cover -covermode=atomic -coverpkg=./... -coverprofile=coverage.out -tags='osusergo,netgo,static' -ldflags='-s -w' ./...\\n
Centralized all generated Go formatting in one helper instead of leaving formatter logic inline in writeTemplate.
Auto-detected module metadata from go.mod instead of adding new CLI flags or threading formatter config through more call sites.
Reused the existing basic generation test for the main regression instead of introducing a heavier golden-file harness.
Exact verification run
Passed:
git diff --check
go test ./codegen
go test ./...
go vet ./...
Observed outputs:
go test ./codegen
ok github.com/zchee/spanner-manager/codegen 1.297s
go test ./...
? github.com/zchee/spanner-manager [no test files]
ok github.com/zchee/spanner-manager/cmd 0.023s
ok github.com/zchee/spanner-manager/codegen (cached)
ok github.com/zchee/spanner-manager/diff 0.010s
ok github.com/zchee/spanner-manager/migration 0.028s
ok github.com/zchee/spanner-manager/spannerutil 0.023s
ok github.com/zchee/spanner-manager/sqlutil 0.009s
Current tracked file status
Modified tracked files:
codegen/generator.go
codegen/generator_test.go
go.mod
go.sum
Untouched pre-existing untracked path:
.github/workflows/
Remaining risks
vendor/mvdan.cc/gofumpt/... exists in the local working tree after vendoring, but vendor/ is gitignored here, so it is not tracked. A clean clone will rely on normal module download rather than checked-in vendored code.
Formatting still intentionally falls back to writing unformatted output if gofumpt returns an error. That preserves existing debugging behavior, but it means malformed generated templates still won’t hard-fail on formatter error.