
Summary
Key points of this document
- Consolidating into a single executor leads to bias in judgment and confirmation within the same context.
- The four models are defined by boundaries of modification authority, not by a hierarchy of capabilities.
- Fix task packets before implementation; do not parallelize ambiguity.
Overview
Simply running multiple models simultaneously does not stabilize safety or speed. To achieve effectiveness, it is necessary to separate the roles of defining requirements and contracts, reading existing paths, writing only limited scopes, and independently refuting, and to design write permissions and merge conditions beforehand.
Consolidating into a single executor leads to bias in judgment and confirmation within the same context.
If a single Codex session handles requirements organization, existing code research, implementation, testing, and review all at once, intermediate logs and exploration results will overwhelm the judgment context. Furthermore, because one verifies a design chosen by oneself, while confirming expected normal cases, refutations and failure paths tend to become weaker.
What is effective there is a four-model division of labor, separated by responsibility and authority rather than processing volume. The main person in charge retains decision-making and sends research, limited implementation, and independent review to separate contexts. Each result is returned as a summary and evidence, and the main person in charge integrates them into the same contract.
However, the goal should not be to simply launch four people simultaneously. If they write to shared files or shared states concurrently, conflict resolution will take more time than waiting. Achieving both safety and speed is possible when the boundaries between reading and writing, barriers before merging, and verification responsibilities are clear.
- Context Separation: Do not flood the main person in charge with exploration logs or test outputs; return only conclusions and evidence.
- Permission Separation: Clearly define read-only roles and roles with write access, and do not grant the same permissions to everyone.
- Judgment Separation: A role different from the implementation role questions assumptions and checks negative paths.
- Integration Responsibility: The final design changes, diff acceptance/rejection, migration, and cutover are returned to a single main person in charge.
The four models are defined by boundaries of modification authority, not by a hierarchy of capabilities.
In this document, Sol, Luna, Spark, and Terra are used as designations to identify four model roles, not as names of human personnel. The official Codex manual at the time of publication lists Sol, Terra, and Luna as the three recommended models for GPT-5.6, and Spark is not included in these three recommended models. In this paper, Spark is treated as a designation for a fast, limited implementation role, and the actual model ID will be assigned after confirming the models available in the contract plan and client version.
Sol is the main person in charge. It organizes requirements and non-objectives, and determines architecture, API, data, error, and test contracts. Sol also owns matters that cannot be decided by local implementation alone, such as IAM, migration, backward compatibility, cutover, and rollback, as well as the final diff integration judgment.
Luna is responsible for read-only exploration. It investigates paths and impact areas from existing entry points to persistence, external integration, and testing, returning files, symbols, call relationships, existing tests, and unconfirmed areas with evidence. It does not preemptively write proposed fixes and includes the base SHA at the time of investigation in the results.
Spark is responsible for limited implementation. It only modifies within the scope of target files, symbols, inputs, outputs, errors, and test contracts confirmed by Sol. If it finds contract deficiencies or ripple effects to out-of-scope files, it stops and returns to Sol without unilaterally expanding the scope.
Terra is responsible for read-only independent review. It does not confirm Sol's or Spark's explanations as correct premises but searches for counterexamples, boundary values, insufficient permissions, retries, timeouts, partial failures, and unrecoverable rollback conditions. It separates baseline auditing and final diff review, returning unexecuted items as unverified rather than problem-free.
- Sol — Input: Requirements and constraints. Deliverables: Contracts, division, integration judgment. Prohibited: Implicitly passing unknowns to implementation.
- Luna — Input: Investigation questions and base SHA. Deliverables: Paths, impact scope, evidence, unconfirmed. Prohibited: Write to repository.
- Spark — Input: Confirmed task packet. Deliverables: Limited diff and corresponding test results. Prohibited: Unilateral changes to contracts or permitted scope.
- Terra — Input: Baseline or final diff. Deliverables: Refutations, failure paths, insufficient verification. Prohibited: Mixing fixes and approving based solely on explanation.
Fix task packets before implementation; do not parallelize ambiguity.
Before proceeding with parallel execution, Sol creates a task packet. At a minimum, it includes the base SHA, purpose, non-purpose, allowed write set, target symbols, normal and abnormal input/output, error representation, existing compatibility, required tests, forbidden areas, and termination conditions. This defines the implementation boundary for Spark and the review criteria for Terra.
API contracts are insufficient with just requests and responses. They also define validation, authentication and authorization, error codes, retryability, idempotency, timeouts, and necessary logs and metrics for observation. Data contracts address nullability, default values, uniqueness, update order, and coexistence periods with older versions.
If Luna's investigation reveals that contract assumptions are broken, Sol updates the task packet instead of rushing Spark into action. Conversely, if Spark finds an undefined branch, it does not expand the scope of change but returns it as a contract difference. The discovery of ambiguity is treated not as a failure, but as a barrier to return to design.
- Reference point: Records the base SHA and the branch to be compared.
- Scope: Lists allowed files, allowed symbols, forbidden areas, and handling of generated artifacts.
- Contract: Defines input/output, validation, permissions, errors, retries, timeouts, compatibility, and observation.
- Completion conditions: Pre-writes the tests to be executed, expected results, review perspectives, and termination conditions.
Connect three parallel sections with barriers.
The first parallel section involves Sol's requirement and contract organization, and Luna's existing path investigation. Sol defines the necessary behavior after the change, and Luna investigates which paths the current implementation takes. Combining both results, implementation does not proceed until Sol finalizes the targets and contracts.
The second parallel section involves Spark's limited implementation and Terra's baseline and test perspective audit. Before looking at Spark's diff, Terra independently organizes what existing tests guarantee and which failure paths are missing. This allows for retaining test perspectives that are not influenced by the implementation details.
The third parallel section involves Terra's final diff review and Sol's static verification. Terra refutes the difference from the correct base, and Sol checks format, lint, typecheck, dependency direction, artifacts, and configuration consistency. After the results are aligned, Sol decides on the feasibility of integration, migration, and cutover.
Timeout of subagents, interruptions, tool failures, or returning only partial results are not counted as successes. Unverified aspects are explicitly marked as such, and Sol decides whether to re-execute or revert to serial execution.
- Section 1: Sol's contract organization + Luna's read-only investigation → Sol finalizes contract.
- Section 2: Spark's limited implementation + Terra's baseline and test perspective audit.
- Section 3: Terra's final diff review + Sol's static verification → Sol makes integration decision.
- At the confluence of each section, verify the base, artifacts, unconfirmed items, and any contract changes.
Parallel writes are generally restricted to completely non-overlapping files.
Parallel writes are only allowed if the changed targets are completely non-overlapping and indirect writes, including generation and formatting, do not intersect. Even for different symbols in the same file, changes to import lists, formatters, code generation, or common types can touch the same lines. Therefore, the principle is a single owner per file. If splitting by symbol, Sol must first confirm that shared areas are not touched.
Identical artifacts, DBs, Terraform states, workflows, and lockfiles are subject to exclusion. Operations like changing package manifests separately to generate a single lockfile, applying multiple migrations to the same DB simultaneously, or layering plan and apply on the same Terraform state are not safe, even if the files are separate.
Heavy queues shared across the entire terminal also contend. Processes that widely use CPU, memory, ports, and cache, such as full workspace builds, E2E tests, Docker image builds, coverage, and dependency installs, are put into a machine-wide heavy queue for serialization. Even with separate worktrees, sharing external DBs, Docker daemons, ports, caches, and remote workflows is not automatically isolated.
- Parallelizable: Independent normal files where changes to imports, formatters, generators, and common types do not intersect.
- Single owner: same file, same artifact, snapshot, package manifest and lockfile, workflow.
- External lock: DB migration, Terraform state, shared bucket, shared queue, common preview environment.
- Terminal queue: heavy processes such as install, full build, E2E, Docker build, coverage.
Declare roles in .codex/config.toml and duplicate instructions and permissions.
Project settings should be placed in .codex/config.toml, which is only read by trusted projects. Sol will be the main agent, and up to three subagents (Luna, Spark, Terra) can be opened simultaneously. Each role should be separated into independent TOML files under .codex/agents, and must include name, description, and developer_instructions.
In the following example, the main session is Sol, Luna and Terra are read-only, and only Spark is workspace-write. Luna and Terra show model IDs at the time of release, but Spark's agent file does not fix the model. When launching Spark, explicitly specify a fast model confirmed in the usage environment, or add only confirmed model IDs to the agent file. Do not write secrets or unique information such as API keys, tokens, account IDs, or internal URLs to the configuration.
sandbox*Mode is an important layer of defense, but it is not considered the sole enforcement boundary. Since live permission overrides from parent turns may be reapplied during spawn, developer instructions, task packets, tool permissions, and final diff inspection are used in combination. Also, if a read-only role executes tests, it may modify DBs, snapshots, caches, build artifacts, and ports, so specify a flag without side effects or a separate environment.*Sol: Owns requirements, contracts, IAM, migration, cutover, and final integration in the main session.
- Luna: Investigates existing implementations in read-only mode and returns base SHA and evidence.
- Spark: Restricts scope even with workspace-write using allowed write set and termination conditions.
- Terra: Audits baseline and final diff separately in read-only mode.
- Validation is divided into layers: baseline, diff, contract, and failure paths.
// .codex/config.toml
model = "gpt-5.6-sol"
model_reasoning_effort = "high"
[agents]
enabled = true
max_concurrent_threads_per_session = 3
[agents.luna_explorer]
description = "A read-only agent that investigates existing paths and their scope of impact with evidence."
config_file = "./agents/luna-explorer.toml"
[agents.spark_worker]
description = "A limited implementation agent that only modifies within the scope of confirmed contracts."
config_file = "./agents/spark-worker.toml"
[agents.terra_reviewer]
description = "A read-only agent that independently audits counter-evidence and failure paths."
config_file = "./agents/terra-reviewer.toml"// .codex/agents/luna-explorer.toml
name = "luna_explorer"
description = "Read-only agent that investigates existing paths and impact scope with evidence."
model = "gpt-5.6-luna"
model_reasoning_effort = "medium"
sandbox_mode = "read-only"
developer_instructions = """
Do not modify files. Record the base SHA, and track entry points, call paths, persistence, external integrations, and existing tests.
Return files and symbols as evidence, and clearly state unconfirmed items.
"""// .codex/agents/spark-worker.toml
name = "spark_worker"
description = "Responsible for limited implementation that only modifies within the scope of confirmed contracts."
model_reasoning_effort = "low"
sandbox_mode = "workspace-write"
developer_instructions = """
Implement only the files, symbols, inputs/outputs, errors, and test contracts listed in the task packet.
If you find any ripple effects outside the scope or insufficient contracts, do not expand the changes and return them to Sol.
"""// .codex/agents/terra-reviewer.toml
name = "terra_reviewer"
description = "A read-only agent that independently audits counter-evidence and failure paths."
model = "gpt-5.6-terra"
model_reasoning_effort = "high"
sandbox_mode = "read-only"
developer_instructions = """
Do not modify files. Do not simply confirm descriptions; instead, find counter-examples, edge cases, permissions issues, and failure paths by comparing with the correct base.
Do not mark unexecuted verifications as passed; return reproduction steps and missing tests.
"""Terra records not only that existing tests pass with the pre-implementation baseline, but also what is not being validated. After Spark's implementation, it executes the target tests, and Sol checks format, lint, typecheck, static analysis, and dependency direction. In the final stage, Terra reviews the diff from the base and audits out-of-contract changes and failure paths.
For API and data contracts, in addition to success cases, validate validation errors, unauthenticated access, insufficient permissions, duplicate requests, timeouts, retries, partial success, and requests from older versions. For IAM, check not only allow but also deny and least privilege, and ensure that no secrets or personal information appear in observation logs.
Even in read-only reviews, execution commands may have side effects. Use a dedicated namespace for test DBs, disable snapshot updates, separate cache and build outputs, and assign ports. A configuration where Terra rewrites a shared DB to establish a baseline is not operationally read-only, even if it is permission-wise read-only.
Baseline: Records existing successes, known failures, unvalidated items, and execution environment.
- Diff: Checks allowed write set, deletions, renames, generated files, lockfiles, and secret contamination.
- Static validation: Checks format, lint, typecheck, dependency direction, and configuration consistency.
- Contract validation: Success cases, validation, authentication/authorization, retries, idempotency, timeouts, compatibility.
- Operational validation: Checks health, logs, metrics, rollback, and termination conditions.
- IAM, migration, and cutover are separated from local implementations.
IAM, migration, and cutover are separated from local implementation.
IAM changes do not shift the judgment of permission boundaries from Sol, even if Spark can edit configuration fragments. We organize the necessary principals, resources, actions, and conditions, confirm least privilege and explicit deny, impact on existing permissions, and audit logs. Terra looks for both excessive permissions and counterexamples where legitimate paths are denied.
In DB migration, we separate expand and contract, and provide a period where old and new versions can run simultaneously. We include lock time, backfill, re-executability, mid-failure, backup and restore, and non-rollbackable changes into task packets. Multiple agents do not apply migration to the same DB; Sol determines the order after a dry-run in a dedicated environment.
Cutover is not executed just because the code is green. We check the target version, migrated data, health, error rate, queue backlog, compatibility, and rollback destination. We decide the stop conditions beforehand, and in case of abnormality, we do not make additional fixes on the spot; instead, we roll back and isolate the cause.
- IAM: allow, deny, least privilege, impact on existing principals, audit logs.
- Migration: expand/contract, simultaneous operation, lock, backfill, re-execution, restore.
- Cutover: target version, health, error, queue, compatibility, stop conditions, rollback destination.
- Final judgment: Sol consistently owns it, not the model that implemented the fragments.
There are signs that you should stop, even if it looks fast.
If Luna's investigation base and Spark's implementation base diverge, the evidence of the scope of impact becomes outdated. Even if it seems like a small difference, either re-investigate or Sol re-reads the changed path. Using old investigation results as is turns the time gained by parallelization into rework.
We also return to the barrier if Spark requires unauthorized files, Terra finds a missing contract itself, shared artifacts or lockfiles change, or tests update a shared DB. Loosening boundaries to complete a diff loses the meaning of limited implementation and independent review.
Stopping is also required if the reviewer merely summarizes the implementer's explanation. We pass the base, task packet, diff, and test results to Terra, but we do not fix the implementation intent as correct. We distinguish between the absence of disproof and the failure to attempt disproof.
- Investigation base became stale.
- Changes propagated outside the allowed write set.
- Simultaneous writes became necessary for shared state, artifacts, lockfiles, or workflows.
- Read-only validation causes side effects on shared DBs or snapshots.
- Almost treated agent interruption or timeout as non-problematic.
Some changes are not suitable for the 4-model division of labor.
For typo corrections or changes to a single pure function, the cost of task packet creation and barriers outweighs the implementation time. For changes with a narrow scope of impact and little value in independent review, it is simpler for Sol to implement them serially and perform normal validation.
Changes centered around shared schemas, identical Terraform states, a single workflow, or identical lockfiles are also areas where it is difficult to safely divide writes. It is safer to parallelize only read-only investigations and reviews, and return writes to a single person. Increasing unnatural file divisions to maintain parallelism harms long-term maintainability.
Subagents increase the cost of tokens, synchronization, summarization, and reconfirmation. Also, even if different names are given, if they share only the same assumptions, inputs, and evaluation criteria, independence becomes superficial. Vary questions, permissions, and completion conditions for each role, and use them only when necessary.
- Small changes: Serial execution reduces coordination costs.
- Shared write-centric: Parallelize only investigation and review; implementation by a single owner.
- High uncertainty: Sol and Luna reduce uncertainty first; do not rush implementation.
- Model availability: Maintain role contracts; substitute with available models.
In operations, we measure not only speed but also conflicts and oversights.
When starting operations, we choose changes that, even if small, affect multiple paths. First, we move Sol and Luna, then Spark and Terra, and record what was stopped by the barrier. Instead of keeping all roles constantly active, we select sections for parallelization based on the amount of investigation, change boundaries, and impact in case of failure.
It's not just lead time that we measure. We record the number of write conflicts, contract rejections, stale investigations, rework after review, unverified carry-overs, and paths missed in failures. If speed increases but conflicts and oversights also increase, we narrow the write division or move the barrier back.
We also define the conditions for role transfer. If Luna requires a design decision, it goes to Sol; if Spark finds something outside the contract, it goes to Sol; if Terra finds a critical counterexample, implementation stops and it returns to Sol. We don't continuously pass corrections directly between roles; instead, design changes are consolidated with the primary owner.
- Measurements: lead time, parallel wait time, write conflicts, rejections, rework, oversights.
- Conditions for reverting to serial: shared write, unconfirmed contract, stale investigation, insufficient environment separation.
- Retrigger investigation: base update, common type change, route change, migration addition, test premise change.
- Audit records: task packet, base, agent results, unverified, verification command, integration decision.
Safety is built not on the number of models, but on contracts and a single write owner.
The core of the 4-model division of labor is not the names Sol, Luna, Spark, and Terra. It's important to be able to pass requirements and integration decisions, evidence of existing paths, limited writes, and independent refutations without mixing them.
We parallelize work that, even if advanced simultaneously, does not break each other's assumptions. Processes that touch shared state or identical artifacts are exclusive, and investigation and review are parallelized first. When increasing writes, we start with completely non-overlapping files.
The four decision criteria to take away in practice are: can the task packet be fixed, can permissions be separated, can independent verification be done with the correct base, and can the final decision be returned to one person? If the 4 models are used only within the scope where these conditions are met, an operation can be built that reduces waiting time without compromising safety.


