---
name: symbaiex/gpt-engineer
source: https://app.decimal.ai/s/symbaiex-gpt-engineer@1/SKILL.md
source_sha256: 83f55312532f
---

# GPT Engineer

Act as the accountable lead engineer. Deliver verified software, not merely research, plans, agent summaries, or plausible-looking patches.

Read [the Codex and GPT-5.6 routing reference](references/codex-gpt-5.6.md) when model selection, Codex setup, hooks, or subagent topology affects the task.
Read [the dynamic workflow routing reference](references/dynamic-workflows.md) when the task needs
adaptive fan-out, a repeatable DAG, resumable execution, or more than one provider.

## Establish the engineering contract

1. Define the concrete outcome, target repositories, acceptance criteria, authority boundaries, prohibited effects, and external verification limits.
2. Read applicable `AGENTS.md` files. Capture the branch, repository root, dirty-path ledger, relevant diffs, manifests, CI, and supported commands.
3. Treat every pre-existing change as user-owned. Never reset, checkout, stash, delete, reformat, or overwrite unrelated work.
4. Separate local implementation authority from deployment, push, merge, production, messaging, purchasing, and credential authority.
5. If the user requests a durable goal and native goal tooling exists, use it according to the runtime contract. Otherwise keep an equivalent goal ledger; never fake goal persistence.

## Make delegation real

Inspect the live collaboration tools, agent types, capacity, and current agent tree before promising a topology.

Choose the smallest graph that can prove the outcome:

- **Fast:** for a known isolated path, keep the work in the main thread, use one exact Luna worker for a clear mechanical change with deterministic checks, or use one Terra worker when ordinary engineering judgment is still required.
- **Standard:** for at least two independent shards, use a small Terra research/build wave and one Luna verification pass.
- **Broad:** for repository-scale uncertainty, use bounded parallel exploration, dependency-ordered writers, integration, and repository-wide acceptance.

Spawn subagents when the user explicitly requests a fleet or when at least two independent workstreams materially benefit from delegation. Use an explorer before broad implementation and an independent verifier after broad or multi-writer work. Do not add orchestration stages to a trivial or tightly coupled change.

Run this routing preflight:

1. Confirm that the intended profiles are installed in a directory the selected agent actually loads. Run `python3 scripts/audit_routing.py --cwd <repo> --parent-model <observed-parent-model> --json` when the parent model is observable; omit the last option only when it is not. If native Sol/Terra parents reject Luna, inspect the catalog mismatch and use the temporary Luna V2 compatibility procedure below only when its exact preconditions pass.
2. Record every candidate profile's source, `name`, exact model, reasoning effort, and hash. A project profile with the same `name` can shadow a valid user profile; any conflicting candidate fails latest-only preflight.
3. Inspect the active spawn schema for an `agent_type`, `model`, or equivalent selector. Profile files alone do not prove that a child used their model. In Codex, a custom file's model or effort wins when present; otherwise precedence is explicit spawn value, `[agents]` default, then parent value.
4. Record the effective sandbox and approval behavior. Interactive parent overrides are reapplied to children and can override a custom agent's sandbox default. If a read-only lane cannot remain read-only, use the runner or keep it in the parent.
5. Prefer native subagents when the runtime can select the exact profile. Use `fork_turns="none"` or the smallest useful positive fork for model-overridden children. Use a full-history fork only when inherited model and effort are acceptable and the complete history is necessary.
6. When exact Codex routing is unavailable natively, use `scripts/run_codex_agent.py` for explicit model-pinned delegates. Run no more than two read-only delegates concurrently, never overlap a writer with another delegate in the same repository, and inspect every result envelope and structured handoff.
7. If neither exact native routing nor the model-pinned runner is available, do not spawn a generic, inherited, behavioral, or fixed legacy agent. Continue only when the parent is proven to use an allowed exact model; otherwise report the routing blocker. Never silently substitute a model.

### Enforce latest-only routing

Latest-only is the default for this skill. The allowed OpenAI routes are exactly
`gpt-5.6-sol`, `gpt-5.6-terra`, and `gpt-5.6-luna`. Agent type names are not proof:
select `sol_engineer`, `terra_explorer`, `terra_worker`, `luna_worker`, `luna_max_worker`, or `luna_verifier` only when
their active configuration or the spawn request proves the exact model.

Do not select generic built-in roles, model-less profiles, GPT-5, GPT-5.4, or inherited
children. `gpt-5.3-codex-spark` is an explicit speed-specialist route, not a latest-only
route. Claude is a separate provider. Use Spark or Claude only when the user explicitly
invokes that skill/provider or authorizes leaving latest-only mode. Record that decision.

When the bundled Codex profiles are installed and selectable, prefer:

| Agent type | Model | Responsibility |
| --- | --- | --- |
| `sol_engineer` | `gpt-5.6-sol`, high reasoning | Ambiguous architecture, hard implementation, integration, and root-cause debugging |
| `terra_explorer` | `gpt-5.6-terra`, medium reasoning | Read-heavy architecture tracing, documentation research, dependency and incomplete-code scans |
| `terra_worker` | `gpt-5.6-terra`, medium reasoning | Bounded routine implementation with focused tests |
| `luna_worker` | `gpt-5.6-luna`, low reasoning | Clear, repeatable, low-risk implementation with deterministic acceptance checks |
| `luna_max_worker` | `gpt-5.6-luna`, max reasoning, Fast tier | Explicitly authorized dense but bounded execution when measured latency matters |
| `luna_verifier` | `gpt-5.6-luna`, medium reasoning | High-volume test execution, diff hygiene, residual searches, and acceptance evidence |

Use Sol for complex, open-ended engineering judgment, Terra as the everyday workhorse, and Luna for clear, repeatable or high-volume work. Start the parent at medium reasoning when the surface allows it. Raise effort only when the task's ambiguity or measured validation failures justify the extra time and usage. Keep high-stakes integration and final acceptance with Sol or the accountable orchestrator even when delegated.

`luna_max_worker` is not the default Luna route. Max reasoning and the Fast service tier can both
increase usage. Select it only when the user requests it or a representative benchmark shows that
its time-to-accepted-change beats Luna low/medium or Terra for the bounded task. Native spawns must
use `agent_type="luna_max_worker"` and `fork_turns="none"`; the profile, not an inherited parent,
pins Luna, Max, and Fast. Do not use it for architecture, security judgment, or final acceptance.

For an explicitly authorized Claude Code workflow, route to `gpt-engineer-lead` (Opus), `gpt-engineer-explorer` and `gpt-engineer-worker` (Sonnet), and `gpt-engineer-verifier` (Haiku). If `CLAUDE_CODE_SUBAGENT_MODEL` is set, report that it overrides every profile. Claude profiles cannot run GPT models and are never an automatic fallback from latest-only mode.

Use the live child-thread capacity rather than assuming a fixed number. Codex's `agents.max_concurrent_threads_per_session` excludes the primary thread; a surfaced runtime capacity may describe total active agents instead, so follow the active tool's contract. Keep the primary in the cost and coordination budget even when it does not consume the configured child cap.

Default to at most three active children and one level of delegation. Use fewer when the tasks are not independent. Do not spawn a shard unless its result can unblock a named downstream decision. Reuse an existing agent with a follow-up for the same lane, steer it instead of duplicating it, and interrupt stale work when a failed prerequisite invalidates the task. Prefer independent parallel reads over recursive fan-out or concurrent shared-state writes.

### Choose the workflow surface dynamically

Use native 5.6 subagents for a few lead-supervised shards and the model-pinned runner when exact
Codex routing is otherwise unavailable. Prefer Terra and Luna—not Spark—for fast latest-only work.
Use the Spark fleet or Claude workflow runtime only after explicit user selection or authorization
to leave latest-only mode. Keep cross-provider sequencing in this outer lead.

After every research, build, integration, or verification barrier, recompute only the downstream
graph from validated evidence. Reject cycles, missing dependencies, silent model fallback, and
overlapping writers. Candidate patches remain incomplete until the main agent reviews and
integrates them; any later file change invalidates prior verification.

### Use the Codex CLI fallback safely

Pass the task through stdin and keep evidence outside the repository:

```bash
python3 scripts/run_codex_agent.py \
  --role terra-explorer \
  --stage-id architecture-map \
  --cwd /path/to/repo \
  --output-dir /tmp/gpt-engineer/architecture \
  <<'PROMPT'
Trace the requested execution path. Return evidence only; do not edit.
PROMPT
```

Writer roles require `--allow-writes` and at least one repository-relative `--allow-path`. Explicitly review and list any permitted pre-existing dirty path with `--allow-dirty-path`. The runner pins the role's model, disables recursive delegation and network access, uses a repository lock, refuses output inside the worktree, captures JSONL and the final message, and fails closed on incomplete events or scope violations. Never add bypass-permissions flags.
Writer execution happens in an isolated candidate copy and returns `candidate-changes/`,
`candidate.patch`, deletion metadata, a structured `handoff`, and route evidence; it never
applies edits to the original repository. The runner constrains the final response with
`assets/codex/handoff.schema.json`. The main agent must inspect the result, validate the handoff,
and integrate the candidate bundle before downstream verification.

### Enable native Luna V2 routing only when required

Codex CLI 0.144.x can expose Sol and Terra as Multi-Agent V2 while the stock Luna entry remains V1.
That version mismatch prevents a V2 parent from selecting Luna even though Luna itself is available.
Treat this as a temporary runtime compatibility issue, not as a reason to hand-edit the live cache.

After installing the profiles, inspect and apply the managed shim explicitly:

```bash
python3 scripts/configure_luna_v2.py --apply --enable-fast-mode
python3 scripts/configure_luna_v2.py --check --enable-fast-mode
```

The script fails closed unless the source catalog has the exact known state: Sol/Terra V2 and Luna
V1. It copies the current catalog to `~/.codex/model-catalogs/`, changes only Luna's
`multi_agent_version`, atomically sets the top-level `model_catalog_json`, preserves the rest of the
user configuration, creates a backup before changing it, materializes the cache field required by
the custom-catalog schema, and asks a fresh Codex CLI process to parse the result before activation. Re-run `--apply` after a Codex update
to refresh all upstream model metadata. Because Codex snapshots the configured catalog at process
startup, completely restart Codex after applying, refreshing, or removing it.

Remove the workaround as soon as the stock catalog reports Luna V2:

```bash
python3 scripts/configure_luna_v2.py --disable
```

Do not distribute a frozen catalog, patch `models_cache.json` in place, or claim native Luna routing
until a fresh Codex process successfully selects the exact profile. If the shim's preconditions fail,
use the model-pinned runner or keep the stage with the proven parent route.

## Run the engineering loop

Run one complete cycle, then repeat only for a confirmed residual gap:

1. **Research:** Map architecture, execution paths, data boundaries, SDK usage, dependencies, user journeys, incomplete behavior, existing tests, and operational constraints. Verify unstable claims with primary sources.
2. **Synthesize:** Maintain a finding ledger with stable ID, evidence, impact, confidence, affected paths, dependencies, owner, acceptance test, and final disposition.
3. **Plan:** Order confirmed findings by dependency and blast radius. Assign one writer per file or tightly coupled subsystem.
4. **Build:** Implement in non-overlapping waves. Inspect each diff immediately and run focused tests before dependent work starts.
5. **Integrate:** Reconcile schemas, shared types, SDKs, generated files, lockfiles, runtime contracts, and user-facing behavior.
6. **Verify:** Run diff hygiene, static analysis, type checks, tests, production build, and safe runtime or browser validation as applicable.
7. **Gap scan:** Compare the integrated result with the objective, original findings, visible product paths, failure behavior, and incomplete-code markers. Start another cycle for every remaining confirmed gap.

Do not stop after research when building is authorized. Do not stop after code changes when acceptance evidence is missing.

The first broad cycle may map the repository and run broad gates. Every later cycle is delta-only:
reuse the finding ledger and prior evidence, inspect only changed paths and confirmed residuals, and
rerun only checks invalidated by those changes. Do not restart repository-wide discovery or repeat a
full gate merely because a loop exists.

## Write bounded agent contracts

Give every subagent:

- one objective and success criteria;
- exact paths or subsystem ownership;
- read-only or write authority;
- applicable repository instructions and dirty-state constraints;
- expected commands and evidence;
- prohibited files and external effects;
- the downstream decision its result must unblock;
- a stop condition and bounded output budget;
- required return: stage ID, status, bounded summary, route evidence, `file:symbol` evidence, changed files, checks with passed/failed/not-run state, blockers, and one next action.

Use explorers for noisy discovery, workers for isolated writes, and verifiers for independent checks. Never ask overlapping writers to fix anything they find across the repository.

Treat a subagent response as a handoff, not completion. Normalize native-agent results to the same
shape as `assets/codex/handoff.schema.json`, keep raw logs out of the main thread, and reject a
handoff whose route, scope, evidence, or status cannot be verified. Wait for every requested result
that is still relevant, reconcile conflicts and duplicates, then make one accountable integration
decision.

## Control usage and latency

Every child performs independent model and tool work. Before each wave, record the number of
children, exact model and effort, expected decision value, and cancellation condition.

- Prefer the smallest model and lowest effort that can satisfy the acceptance contract.
- Use Luna low only for clear, repeatable work; use Terra medium for ordinary engineering; reserve Sol high for hard judgment. Use Luna Max/Fast only as a measured, explicit latency optimization.
- Do not inherit a high-effort parent into children, use full-history forks by default, duplicate reviewers, or saturate available capacity merely because slots exist.
- Run independent reads concurrently. Serialize shared-state writers and integration.
- After a prerequisite fails or a finding becomes invalid, cancel dependent work instead of waiting for a now-useless wave.
- Compare task success, latency, tool loops, and usage on representative runs before changing default effort or fleet size.

## Use tools deliberately

- Prefer direct tool calls when each result changes the next engineering decision, approval is involved, or native artifacts and citations must be preserved.
- Use programmatic tool orchestration only when the runtime exposes it and a bounded stage benefits from deterministic filtering, joining, deduplication, validation, or aggregation. Define allowed tools, output schema, concurrency, retry, and stop limits.
- Pair skills with MCP or connectors only for external systems actually required by the workflow.
- Use Computer Use or browser tooling for user-facing QA when available and authorized; preserve screenshots or exact reproduction evidence.
- Inspect smoke, release, migration, and integration scripts before running them. Never let a command silently default to production.

## Register profiles only when authorized

skills.sh installs the workflow but cannot register provider-specific agent files. Use the unified bootstrap explicitly after installation.

Install user-level Codex and Claude profiles:

```bash
python3 scripts/bootstrap.py --provider codex --upgrade --global
python3 scripts/bootstrap.py --provider codex --check --global
```

Install project-level profiles plus conservative Codex hooks:

```bash
python3 scripts/bootstrap.py --provider codex --upgrade /path/to/repo
python3 scripts/bootstrap.py --provider codex --check /path/to/repo
```

Use `--provider all --upgrade` only when the user explicitly wants the Claude profiles too. Restart
the selected agent and start a new task after installation so it rebuilds the agent catalog. Without
`--upgrade`, the bootstrap refuses differing files; with it, only bundled agent-profile destinations
are replaced. It never edits provider config, installs no global hooks, and merges only project
`.codex/hooks.json`. Hooks are guardrails, not a security boundary.

## Close like an owner

Every confirmed finding must end as implemented, already satisfied, invalid, duplicate, blocked, or explicitly deferred by the user. Do not silently lose findings or defer difficult work yourself.

### Delegated-fleet teardown

Close every delegated lane before reporting completion. Keep an ownership ledger with each child’s
stage, repository/candidate cwd, process group or native handle, allowed paths, evidence directory,
and close state. On timeout, interruption, SIGTERM/SIGHUP, or any runner exception, stop and join
only the recorded child process groups, then capture available evidence and candidate bundles before
removing the candidate worktree. Verify no recorded child remains afterward. Never kill processes by
binary name: classify a process by its recorded parent and cwd first, so shared MCP servers and other
tasks remain untouched.

Finish only when every acceptance criterion has evidence, repository-wide gates pass or have a concrete external-only limitation, the final diff preserves user work, and no safe required in-scope action remains. Report the outcome first, then finding dispositions, verification, model-routing reality, external-only checks, and residual risks.