Skip to content

Latest commit

 

History

History
225 lines (130 loc) · 46.9 KB

codex-skill-runtime.md

File metadata and controls

225 lines (130 loc) · 46.9 KB

Skill research mode

This branch separates pinned Skill research methods from execution and coordination. A native agent harness executes research and tools; a project skill supplies methods. The host keeps the frozen problem, source policy, resource accounting, writer shutdown, independent Lean acceptance and persistent artifacts. New collaborative runs use the Codex native team. Codex, Claude Code, OpenCode and a configured headless CLI also support single-researcher workloads; see harness configuration and verified limits.

Start and resume

Build the runtime normally with bun run build --state-root EXTERNAL_BUILD_DIRECTORY. Use its manifest when preparing a new isolated run:

bun bin/math.ts run --research-mode skill \
  --workspace NEW_PROBLEM_WORKSPACE --task-file TASK_FILE \
  --output NEW_RESULT_FILE --build-manifest BUILD_MANIFEST

New Codex runs default to a native team with capacity for four members including Lead. Set --agent-team N for a different capacity or --workers 1 for a solo researcher. Teams work autonomously unless the owner enables --plan-approval. Then Lead publishes the initial route and waits for approval of the displayed version before starting proof work. Existing budget options keep their defaults. New Skill runs use the existing library application and task automation where applicable, checked through the original acceptance path.

The --resume command continues solo runs and native teams with their saved research mode, Skill loading, provider and environment. The host checks the frozen identities before resuming the thread. New runs save researchSkillWorkflow: full and an execution plan. Historical single-researcher checkpoints without that marker keep their original workflow. Inspect older host-scheduled archives with the current CLI and use the original pinned runtime to resume them. A new strategy can start a separate run from the saved artifacts.

For Codex sessions metered by upstream request receipts, the host sends excludeTurns: true on resume. Codex restores the thread internally and returns metadata without sending the full transcript over stdio. Direct providers whose budget gate uses native thread totals still request turn history so Codex can replay saved usage. If that reply exceeds the 8 MiB stdio frame limit, the host reopens the thread once with excludeTurns: true; the next turn's cumulative total still includes the skipped replay. In continuous cooling, an oversized frame that recurs after one cooldown stops the run instead of cooling again.

The default --skill-loading native checks Codex discovery and sends native skill input on ordinary host turns. --skill-loading file explicitly directs Codex to read the same pinned file. Native child communication carries the host's frozen context and explicit pinned-file reading instructions; its execution plan records file loading because Codex's typed input cannot combine an inter-agent communication with a skill input. Discovery and an accepted request do not prove that a provider followed the skill; that requires separate execution evidence.

Codex adapter boundary

The adapter uses Codex's native shell, process polling, patches, tool-error feedback, Skill loading, thread resume and compaction. Shell settings are supplied once in the thread's developer instructions. Rejected arguments return through Codex's own tool output; the host no longer polls rollout files, counts refusals or injects duplicate corrections into later turns.

Ordinary declaration lookup uses native shell rg over the saved declaration index and source files. The host still generates the index and preserves frozen package identities. Catalog operations remain available for dependency metadata and archived evidence; the historical declaration-search CLI remains compatible with saved Skill instructions.

File handoffs use native fs/watch on the existing parent directory before the writer starts, fs/changed notifications and fs/unwatch during cleanup. There is no host polling timer. Codex 0.169.0 debounces watch events by 200ms and may fall back to a noop watcher; request admission and terminal completion therefore still read the output synchronously. Already validated output is checked by digest after the turn settles so a validator with submission side effects is not invoked twice. Content validation and independent proof acceptance stay with the host.

New Codex report workflows prefer native outputSchema and the final response bound to the completed turn. The host closes the session, validates the response and saves the frozen output file. outputDelivery freezes this choice; older requests without the field retain their file protocol and instruction hashes. Replay, other harnesses, the DeepSeek/Westlake Chat bridge and early proof handoffs retain file delivery. The audit reads the session's final-response record instead of collecting a second copy of agent messages.

The non-Skill solo path uses native thread/compact/start between settled turns before rotating a thread for context capacity. The adapter waits for the contextCompaction item and the successful terminal event before it resumes research. Its maintenance requests are accounted for separately from proof turns. Failed compaction retains the existing fresh-thread recovery. Skill research keeps Codex's own automatic compaction behavior.

Native teams deliver through Codex's mailbox and attributed input. Queue-only delivery leaves an idle turn waiting. Codex accepting a message confirms queue ownership. The receiver's read status is tracked separately. Anchoring an active update to its turn prevents a late notification from starting another writer. Delivery can remain uncertain after worker loss.

Native team runs use the separately built Codex AgentControl backend. Official spawn_agent, send_message, followup_task, list_agents, wait_agent and interrupt_agent handlers stay installed. The adapter connects them over stdio to TheoremOS's isolated writer lifecycle. The host prepares a separate process and worktree before the first child model request; trusted bootstrap preserves native tree identity, captured instructions, parent lineage and native fork history. Workspace relocation revokes the parent's writable worktree and permits the destination isolated workspace while retaining other restrictions. Per-worker provider settings stay local to the worker process.

Codex's generic root/subagent role messages are deliberately suppressed: their defaults assume a shared working directory and allow recursive child teams. TheoremOS supplies the actual flat-team identities, isolated workspace permissions and native usage guidance through the pinned context instead. This does not remove native tool descriptions. Deferred mailbox preemption preserves delivery at the next model boundary after the current response and tools settle; it does not require a host coordination acknowledgment.

Native team sessions set Codex's features.multi_agent_v2.multi_agent_mode_hint_text. Lead receives authorization to delegate useful complementary work. Members can exchange messages. Lead alone can dispatch or interrupt members. The override is recorded with the runtime configuration and reapplied on new and resumed writer sessions.

Build the pinned backend to start a native team. It defaults to out/codex-backend/codex. Set THEOREMOS_CODEX_BACKEND_EXECUTABLE to select another build. The run pins the executable's real path and digest. Native teams require a compatible profile such as the Responses gateway. The host confirms writer shutdown before freezing sources, checking them in Lean and making them available for Lead adoption. See the backend startup rules.

The backend's real-binary loopback fixture covers isolated native spawn, attributed messages, idle queues, cold resume with first-request FIFO mail, full-history fork, loaded-agent listing, mailbox wakeup, changes to a running member's expertise and idle/active interruption. It verifies writer shutdown, checked delivery, adoption and final proof references. Provider responses are fixed local data. Installing the CLI backend does not upgrade an existing Web worker image.

Real installed-Codex tests with local fixed Responses replies cover native shell refusal/correction and concurrent advisory injection, preservation of parallel tool results, and idle injection without model work. These verify transport and lifecycle behavior; no mathematical speedup is inferred from them.

Agent-organized proof-writing team

To set the capacity of a new Codex team, pass --agent-team:

bun bin/math.ts run --agent-team 3 \
  --workspace NEW_PROBLEM_WORKSPACE --task-file TASK_FILE \
  --output NEW_RESULT_FILE --build-manifest BUILD_MANIFEST

--agent-team sets capacity from 2 to 8, including Lead, and defaults to 4. An idle or interrupted member retains its place. Lead can use followup_task to give that member a new assignment. Use --plan-approval to review the initial route before proof work. Native teams require the pinned Codex backend. Other harnesses can start solo runs.

Before starting a team, optionally select preferred roles in the Web form or pass a comma-separated list, e.g. --skill-preferred-profiles researcher,engineer,D011. Work roles and domain specialties come from the pinned Skill catalogue; a domain ID or its slug is accepted. A preference tells the Lead what expertise you would like considered. It does not reserve seats, start members, restrict other roles, or mark any expertise as used. The run saves these preferences for resume. Leave the list empty for ordinary autonomous selection.

You can also select a released personal Skill or Agent as a source of expertise. The web service checks access and freezes the selected version, including relevant material from its referenced Skills. It uses descriptions, areas, inputs, outputs and examples. To make a source available to an expert, include its citation or link in one of those fields. Legacy steps, execution instructions, module overrides, model and staffing choices are not imported. Put knowledge that you want to reuse from an old instruction block in the description or examples and publish a new version.

For CLI runs, --skill-expert-cards-file FILE takes a JSON array with string fields assetId, version, digest (the release's SHA-256), name, summary and knowledge. Lead sees the available names and summaries; a dispatch such as Profiles: researcher, asset:topology supplies the selected knowledge to that assignment. The run retains its frozen cards on resume. A card supplies background; it cannot grant tools or certify a claim.

Lead chooses the mathematical decomposition, delegates proof work, changes routes and selects results for adoption. The default Skill guidance uses a flat team working on complementary gaps in the shared proof effort, with alternative-route investigations when useful. Members can discuss findings and interfaces directly. Each child has an isolated writable worktree, the same pinned Skill and a native thread that persists across assignments. Codex tools handle delegation, instructions and communication. The host's theoremos_team handles mathematical evidence, source handoffs and checked-result adoption.

The Skill guides Lead to look for complementary work early. A useful research question can be assigned before a complete proof route or exact helper type is known. Lead chooses tasks, methods, when to reassess and team size within capacity. send_message carries findings, route changes and status. followup_task supplies further instructions, and interrupt_agent stops a member's turn.

Lead and member contexts report remaining run milliseconds, the stage checkpoint and the hard turn limit; continuation recompiles the remaining-time observation. A finite --max-turn-seconds remains a hard ceiling. Team turns start handing back control at 80% of that limit: new paid requests stop at the next admission boundary, after the in-flight response and its native tools have finished. For a 300-second turn, the stage checkpoint is at 240 seconds, leaving up to 60 seconds for settlement. A normal native completion is retained; a checkpoint preserves the saved thread and sources. The hard turn deadline, overall deadline and explicit cancellation can still interrupt an unfinished request. Missing usage remains unknown and blocks finite-budget continuation. With no turn limit, no timed stage checkpoint is added.

Team identity is stable: Lead owns the original problem and may also write proofs; each child is a mathematical researcher and Lean proof writer. The pinned Skill's specialist profiles supply specialized knowledge: concepts and structures, relevant theories with their conditions, important distinctions and connections to neighboring subjects. Each member chooses its reasoning and proof approach for the assigned question. The catalog contains 100 domain profiles and 24 work or supporting-expertise profiles; these can be combined and are separate from the runtime's agent capacity. Lead provides the question and members read the relevant knowledge sections. The work profiles, including Researcher, Lean Prover, Lean Engineer and Reviewer, describe responsibilities that can accompany a specialization. Lead selects, combines or changes expertise and responsibilities in native spawn and followup messages; no separate role or domain parameter or host authority is added. Independent review requires a non-producing member and fixed evidence; a role change alone does not make the producing thread independent. This is a Skill collaboration requirement, not an additional host review gate. The host refreshes developer identity and source permissions, while the pinned Skill supplies domain knowledge and collaboration guidance. Each child dispatch starts with a bounded current-assignment section containing its task ID, objective, source and delivery baselines, own prior feedback, peer work and addressed inbox. The inbox cursor advances only after turn-start acknowledgment. See the source research and prompt design.

Start a specialized spawn_agent or followup_task message with Profiles: followed by comma-separated domain and work-profile IDs or slugs selected for the gap. A work profile alone is valid. The child receives the selected profile text and the locations of local reading notes. When Lead changes the expertise of a running member, the same attributed followup delivers the new profile context to the current turn. The host records the pinned Skill digest, the requested and loaded IDs, and any unresolved names after the native backend accepts the input. The record establishes which material was supplied.

The Lead charter assigns concrete gaps with a consumer and first usable result, with one owner per active obligation including Lead. While a member owns a gap, Lead advances its consumer or other work; different methods for proving the same target still overlap. Whole-target delegation has one owner while others provide targeted support, integration or review. Alternative routes start with the smallest finding that resolves a specific uncertainty. Members receive the original problem as background to their current assignment and send useful intermediate findings before the complete proof. These are Skill and native role instructions, without a host scheduler or delegation gate.

Native followup retains the member's workspace, thread and draft while the adapter records the latest accepted task instructions and retains earlier instructions in history. A new Profiles: header changes the selection. The host binds a submit call to the member's current task. Profile records retain exact loaded passage identities. A member can explain a passage's application in its messages or saved research notes.

Members use independent Git object stores; each writer's namespace hides the peer-workspace parent and rebinds only its own workspace. Checked fixed commits and evidence are archived outside writer visibility and imported by exact version for explicit adoption. inspect records exposure to a peer delivery, and completed adoption records reuse. These records persist across tasks and accompany later deliveries with the source producer, task and commit. They record explicit source transfers, not complete reasoning independence or independent authorship of reused declarations.

Before a team Lead or member starts Codex, the host runs check-lean --health through the same PID/mount isolation, environment, profile and hidden roots. It checks the sealed mapping, lease and pinned compiler without compiling proofs or admitting a model request. Readiness is retained in the isolation receipt and emitted as lean_environment_ready; a failure produces structured infrastructure diagnostics and stops that launch. A missing mapping is a namespace visibility fault and does not establish that a host process died. Canonical check-lean returns a nonzero structured error when Lean cannot start; a shell pipeline's final status remains distinct from the compiler result.

Each domain profile also links collected domain materials. The Skill pins original knowledge notes with source identities, exact reading locations and coverage limits, so these notes are available in the isolated workspace without fetching a book. Full third-party documents and retrieval evidence stay outside the repository; reading an original online follows the run's network policy. The collection supplies domain background and leaves proof approaches to the members. It does not install formal declarations or import literature into the checked theorem catalog.

Collaboration follows useful milestones. Lead keeps the shared route and gap ownership visible through native messages when needed, and assesses findings, probes, blockers and route changes when they affect the next decision. A member messages usable findings and blockers promptly, submits independent helpers once they answer the assignment and returns for checking before expanding its scope. These instructions guide Agent choices without a timed polling loop, forced proof method, task quota or automatic adoption. Waiting is useful when progress depends on an outstanding member result; an empty loaded team alone is not a reason to wait.

Codex collaboration tools handle identity, dispatch, instructions, messaging, waiting and interruption. Lead and members can call history, inspect, inspect-research and route_summary through theoremos_team. Lead can also call finish, adopt and retire_route. When first-route approval is enabled, Lead calls publish_plan with a route covering every original goal, then waits for approval before writing proofs or dispatching members. Members can call yield and submit. Set helpersOnly: true on submit to share standalone helpers and keep the assignment open. followup_task resumes a yielded draft or assigns work to a completed member. list_agents lists loaded agents. The saved overview retains members and their task and evidence identities after their writer process stops.

Lead and member contexts use a bounded overview projection of current and recent assignments, research and proof references, and integration status. activity reports execution states such as preparing, running, checking and paused. history(agentId?, offset?, limit?) pages through complete task instructions and saved summaries with source and evidence IDs. inspect returns checked declaration interfaces, source excerpts, commits and proof evidence for adoption decisions. Share route changes through native messages and save reproducible findings in RESEARCH.md.

After an executed child task's writer stops, its result records the stable sourceCommit and researchArtifactId. The artifact contains the task's summary and status, plus the root RESEARCH.md when present; missing notes return notes:null. The researchArtifacts index exposes artifact ID, producer, task and commit without host storage paths. Any member can use inspect-research(artifactId, offset?, limit?) to read paginated saved notes at that fixed commit, using Unicode code point offsets and nextOffset. This preserves inspectable counterexamples, literature mappings, calculations and failed routes even when no Lean declaration was submitted. An artifact remains advisory and separate from a checked proof delivery. Historical checkpoints can omit these new fields; the context then has no invented summary or artifact.

For a temporary dependency or Lead decision, a child saves its draft and notes, calls yield(reason) and returns. The host confirms writer shutdown before marking the task paused. Lead can adopt needed results and use followup_task to continue in the same worktree and thread, with the original delivery baseline and cumulative usage. A normal return completes the investigation, and a submitted proof enters checking.

Any configured token, turn or solving-time allowance is shared by the run. The default is unlimited and usage is recorded independently of limits. Token caps govern subsequent requests based on observed receipts, so an admitted request may finish beyond the cap. Removing a saved token limit on resume requires --max-total-tokens 0.

A child saves its sources, calls submit with exact declarations and returns. Submission and yield also checkpoint at the next unpaid request boundary, after the current paid response and tool group settle; submission enters checking, while yielding retains the task for resume. The host confirms writer shutdown, freezes those bytes and checks the delivery independently. Adopt defaults to Lead and queues integration. Lead saves sources and notes before requesting it; a pending Lead adoption triggers an automatic checkpoint before the next model request. Lead normally saves the complete proof and returns for independent checking. Lead can call finish(summary) after saving to request early handoff. Remaining holes or errors return normal feedback. The paid response and its tools finish and usage settles before confirmed writer shutdown; the host then freezes sources, rechecks and integrates the delivery and continues the saved thread. No token, time or turn allowance is added. Adoption into an idle child also queues and returns immediately; its safe work loop integrates before dispatching the next assignment, allowing native messages and interruption during slow checking. Lead can send the consumer instructions after requesting adoption and inspect the resulting status and feedback. Changed source versions, conflicts or failed checks return feedback. Checked declarations and completed adoptions never replace independent whole-problem acceptance.

send_message binds the sender to the issuing native thread. Use /root for Lead and canonical paths or native IDs for peers. Relative paths follow Codex resolution.

For native teams, result.teamContributions and inspect distinguish checked declarations and their adoption from use in each original proof. The report ties a delivered source version to its transfer into Lead's worktree and to final Lean evidence. Where the evidence permits, it distinguishes a delivered target proof, a direct reference, an indirect reference, and a declaration absent from the proof's references. An older receipt may establish a reference without its depth; missing or ambiguous evidence stays unknown. Member messages are separate advisory records, not proof of adoption or mathematical use.

For long declarations, inspect returns a preview for each source change. Pass the same deliveryId, its changeIndex and offset: nextOffset to read the next page at the fixed commit without adopting it. Native spawn evidence distinguishes a fresh thread, a thread with parent history and an unknown history. A parent's inspection before a full-history fork is recorded as possible exposure through the parent. It is neither a direct read by the child nor proof that the source reached the model after context compaction.

Team writers use Linux bubblewrap isolation with separate PID namespaces. On recovery, the host uses saved process identities to confirm previous writers stopped before reusing their sources. Native threads, messages, tasks, delivery identities and adoption progress persist on resume. Lead explicitly reassigns interrupted work. Pending proof checks and adoption use their saved source identities. An unconfirmed writer stop blocks further use of that workspace.

Deferred or rejected source drafts keep their original delivery baseline across assignments, so a corrected helper remains transferable. A stopped child can adopt checked peer work while retaining its own unpublished draft. The host merges against fixed commits, preserves the child's draft and baseline, tracks adopted peer declarations and freshly checks the subsequent combined delivery; the child still names all its own unpublished declarations. Each submit accepts up to 32 declarations. For larger sets assembled by the host, source changes and duplicates are checked across the full set. Each declaration receives an independent Lean check against the same frozen source and environment. Conflicts and unconfirmed writer shutdown remain explicit failures. Successful deliveries advance the baseline. Lead adoption completion durably records the next source freeze. If the host exits before whole-proof checking, resume verifies a complete adopted original candidate before admitting another model turn, including when the turn allowance is exhausted.

Child completion and its proof nomination are saved in one transition. A durable submit acknowledged before a crash is also recovered when the final model response was not saved: after confirming writer shutdown, the host freezes and checks the nomination while leaving the interrupted task's status truthful. Historical completion-before-pending checkpoints are repaired only when their fixed source commit is still the current HEAD. The run inspection includes the same bounded runtime overview, fresh aggregate usage, task allowances, pending delivery identities and message provenance; these observations never confer original-problem acceptance.

Skill and host responsibilities

skills/theoremos-research/SKILL.md contains stable research methods with references loaded as needed. It has no specific problem answers or universal task graph. The full directory, including references, participates in build and run identity. A run gets its own copy under .agents/skills/theoremos-research; the host checks its identity before dispatch and after writer shutdown. Only a host-pinned projection is allowed by source ownership. Legacy runs do not gain a new editable directory.

First installation copies into advisory scratch, checks the complete directory identity, freezes its files and atomically moves it into the final location. An interrupted copy leaves no partially installed skill, so a restart can retry. An existing installed projection with changed bytes is still rejected rather than overwritten.

Precise command examples are generated at .scratch/theoremos-help.md, using the existing local-help implementation. References route to this help and existing command --help; they do not maintain a second tool registry. Research sources, probes and public notes stay in the existing worktree and scratch storage. Internal chain of thought is neither required nor treated as an artifact.

Skill, team and native-baseline preparation save the Lean project location at .scratch/worker-project.json, so check-lean --worktree and other shared project tools work without a cooperative assignment. Older cooperative workspaces retain their COOPERATION.json fallback. The location is advisory; canonical paths, frozen source policies and environment validation still apply. Team help omits the cooperative-only research-observe entry point and uses the team submission interface.

Single Skill research, complete Skill workflows and common-guidance/native comparisons generate optional tool references through the same researchToolGuide.ts implementation. It selects the actual projected executable and available corpus, knowledge and library resources. Complete workflows reuse the existing context compiler for tasks, consumers, required feedback, routes, definitions, families and fixed-source review. Workflow guidance and comparison guidance retain distinct purposes. The shared reference does not enable native delegation. The durable writer avoids rewriting unchanged help bytes.

Cooperative sessions keep role, delivery and source rules in their session instructions. The pinned cooperation reference describes the stable formats for Skill sessions. Same-thread continuations carry the current assignment, contract, inbox and feedback. A worker sees checkOutcome when assigned a pending check. Lead receives nextCheckDecisions with the outcomes that need a decision. Unanswered human guidance is referenced by ID in the prompt and available in that worker's COOPERATION.json. Pending correction receipt indexes remain mandatory even when their full details exceed the optional context budget.

Normal turn completion saves source and notes after confirmed writer shutdown. Native resume, request recovery, compaction handling, leases, cumulative usage and the existing dispatch budget remain shared infrastructure. A missing shutdown confirmation quarantines that workspace before any new writer, freeze or acceptance. Unfinished original proofs do not trigger a full original-target compilation after every research turn. A complete candidate still goes through the original strict check and S3 evaluation of every frozen original target.

After the frozen research responsibility has actually been dispatched to a native thread, later turns in the same host process use a compact continuation instead of repeating the full task and statement. Current source/check feedback, declaration feedback and saved-work references remain present; the developer source and acceptance rules are unchanged. The first dispatch, a new responsibility/thread, the first dispatch after native context compaction and the first dispatch after a host restart all retain the full task. Both standalone skill and common-guidance comparison paths use this behavior and the existing context byte accounting.

For a single Skill researcher, after confirmed writer shutdown the host durably records pendingResearchFreeze before committing sources. It binds the prior HEAD, owned-source digest, problem receipt and environment. Recovery accepts only those unchanged source bytes at the prior HEAD or its single host checkpoint, then completes freezing and check delivery before admitting another model turn. A crash after the source commit but before creating a pending proof check therefore does not require another model turn. An unconfirmed writer stop still quarantines the workspace.

Complete original candidates also acquire a host-owned pendingProofCheck after writer shutdown and source freeze, before helper processing or original-target verification. It binds the commit, owned-source digest, problem receipt and environment. Resume completes any pending helper processing and verifies the frozen original candidate before admitting another model turn, even after the turn/token allowance is exhausted. Verification checkpoints retain their normal retry allowance; unavailable verification or host storage errors retain the candidate. A deterministic mathematical rejection clears this pending check and returns its feedback for correction. Persisted successful acceptance can finish pending cleanup without repeating verification; a changed candidate or environment is rejected.

Independent declaration artifacts

To preserve a reusable helper before the whole problem is solved, the researcher writes .scratch/declaration-submission.json, then stops editing and returns:

{
  "declarations": [
    {
      "file": "Submission.lean",
      "name": "Qualified.helper",
      "type": "COMPLETE_CLOSED_LEAN_TYPE"
    }
  ]
}

The request accepts up to 32 declarations, with optional descriptions and explicit premises. The host confirms writer shutdown, freezes actual bytes, checks the exact declaration and full type in an isolated projection, and preserves source, environment, checked commit, Lean receipts and references. Other original goals can remain unfinished. A helper depending on their unproved bodies or on new axioms cannot acquire unconditional evidence. Ordinary diagnostics remain advisory.

Successful evidence is stored in the host runtime directory's declarations.json; feedback goes to .scratch/declaration-feedback.json. Invalid submissions and failed proofs receive correctable feedback. Cancellation, resumable verification checkpoints and unavailable environments retain the request and their distinct failure meaning. Resume rechecks the frozen commit and request bytes before any new model admission, even when the model turn or token budget is exhausted. If that candidate also completes the original problem, the host checks all original targets in the same recovery without another model turn. An independent helper does not mark the original problem accepted.

Small archives keep the v1 manifest. When the next write would exceed 4096 records or 32 MiB, the host preserves the records in content-addressed segments and atomically publishes a v2 root in declarations.json. Each segment retains both limits and its run/problem/environment identity; the reader verifies its digest, record count and unique record identities. Segment persistence precedes root replacement, so an interrupted append leaves the previous archive readable and can be retried. The writer can migrate an old v1 count overflow that still fits within 32 MiB; an already oversized legacy file or a single oversized record remains an explicit storage error. Historical records in either format still require fresh consumer checks.

After successful host persistence, consumption is marked completed in host-owned state before removing the request. Recovery can finish either side of that removal without repeating completed verification. A missing request is permitted only for that saved completion phase; changed source or an existing request with changed bytes remains an error. The worker-editable feedback file cannot grant completion. Host evidence-storage failures retain the pending request and propagate as infrastructure failures instead of being consumed as mathematical rejections.

Only explicitly classified submission-content errors and deterministic proof failures produce correctable rejection feedback. Host filesystem, Git, source-integrity and verifier-initialization exceptions propagate with the pending request retained; they do not consume the helper or start a mathematical correction turn.

Within a native team run, an unchanged declaration submission can return its previous deterministic Lean rejection. The host first checks ownership and the proposed patch, then matches the problem, project and baseline trees, declaration list, verifier settings and toolchain. A changed type, dependency or environment triggers a new check. The diagnostic identifies reuse; it does not count as a new Lean receipt. Timeouts and infrastructure failures are retried normally. The cache is local to the running host process.

The existing knowledge interface imports this sidecar alongside legacy cooperative records:

bun bin/math.ts knowledge build --state RESULT.runtime/state.json \
  --output NEW_CATALOG --report NEW_IMPORT_REPORT

Catalog records retain their complete source and provenance, are labeled recorded evidence, and require a fresh check in each consumer. inspect and the Web observation types understand the new mode without creating fake tasks, routes or Lead progress. Declaration inspection reports recorded evidence, not fresh acceptance. Library extraction without a legacy canonical record continues to require an explicit commit.

Continue from old research

Start a new native team or solo Skill run with --continuation-source-run OLD_RESULT_OR_STATE. The importer pins the old canonical commit, preserves worker drafts, research notes, old costs and historical proof snapshots separately, and checks available helpers in the new run. The history attachment records source identity and usage. To use a personal expert in the new team, select its release for that run. Same-run --resume retains its frozen configuration. A failed or conditional historical claim remains advisory.

When the source was a native team, a same-problem Skill continuation can also search members' archived RESEARCH.md notes. Use the continuation search command shown in the assignment with --kind research-notes. Read the original hypotheses and the scoped claim before reusing a counterexample or abandoning a route. These notes do not create an assignment or mark any proof as checked.

Initialization can resume from its frozen capture after interruption. It rejects changed destination research or configuration instead of overwriting new work. Live source drafts are captured with explicit stability checks and labeled as separate observations, not as a globally atomic snapshot. This command does not stop or migrate the old run.

Historical comparisons

Use the pinned revision of the original experiment to prepare and execute host scheduling comparisons. The current CLI can read and check their saved reports.

compare --skill-baseline native|file --phase prepare ... replaces the legacy single arm with skill research. Preparation freezes skill identity in the plan and launch files without starting a model. The existing independent and cooperative arms share the planned model, tools, environment and total token allowance. Reports retain all planned attempts and missing usage.

The --skill-baseline comparisons remain system-mode comparisons: legacy prompts contain additional mathematical guidance, so commonGuidanceFrozen and strategyIsolation are false. --common-research-skill native|file instead pins the same mathematical skill and minimal host contracts in all three arms. This isolates host strategy choices while preserving their actual coordination and delivery protocols. --dataset lean-task --source-file FILE --task-file FILE admits a frozen local statement without importing old answers or human-assisted research history. Plans, launches and reports retain the guidance, model, provider, effort, environment, knowledge and total resource identities. One diagnostic problem establishes that the comparison runs; it cannot establish an efficiency advantage.

Comparison preparation and solver startup share resource binding for the retrieval corpus, installed mathematics tools and proof-search backend before computing the environment digest. Changed pinned resource bytes remain an error. The first preregistered three-arm diagnostic exposed the previous missing tools binding: all three observations were rejected for an environment identity mismatch and had already stopped at their dispatch allowance. Their frozen plan and raw report remain unchanged. Observed consumption was 8,733 tokens for skill, 17,583 for independent and 11,285 for cooperative; these are costs of invalid attempts, not accepted comparison results. The repair is checked with disposable startup processes without rerunning the observed paid sample.

Saved records of the old fixed task graph, host-tools teams and theoremos_investigate remain available for inspection and export. Use the run's original runtime to execute those methods again. The cooperation fields in an old archive describe what happened in that run.

Web workflow

New collaborative Web proof requests use the Codex native team. Capacity is 2–8 including Lead. Web starts one host Lead and requires a Codex provider and a worker image with both org.theoremos.native-agent-control=v1 and org.theoremos.native-team-workflow=v1. The runner starts the image ID it checked. The owner can enable initial route approval for direct Lean input and after natural-language formalization. Historical cooperative requests can still be viewed, including their saved plan and approval records. Resuming them requires the original service and Worker versions.

The Skill view displays the researcher and declaration source, full type, premises, checked commit, environment and receipt references. Recorded evidence requires a fresh consumer check. Large collections report omitted declaration records. Single researchers keep their declaration workflow. Capture and archive remain supported. Context builders use the host-projected agent tools, including when Docker hides application source.

Completion and rollout status

Work Verified result Remaining boundary
Agent-organized team Local protocol processes exercise two isolated proof writers, independent arrivals, two Lead thread resumes and checked adoption of both helpers. The actual CLI path prepares Lead/child dependencies and environments, independently accepts all original targets through S3 and saves the final result. Manager/proof tests cover follow-up tasks, messages, child-to-child reuse, shared budgets and interrupted integration recovery before another writer starts. Protocol peers control responses; no paid-model team campaign, deployment or comparative success-rate result is claimed.
Native team tool transport An installed Codex app-server with an isolated profile advertises the Lead operations and their argument contracts to a local Responses endpoint, executes a returned team function call through the manager, and sends the host result in its next request. The local endpoint supplies fixed replies.
Actual skill execution An isolated real provider read the pinned native/file skill and reference, reproduced their hashes and a fresh tag, resumed each saved thread, and confirmed all four stops. A separate native compaction also completed. Raw reports retain their captured runtime hashes. Subsequent delegation guard changes are covered by local regressions; the reports are not relabeled as a test of different bytes.
Process recovery and context continuity Twelve isolated Linux process-death cases cover preparation, request acknowledgment, tool writes, freeze, pending helper verification, both declaration-consumption windows and complete original candidates before/after source commit and independent verification, using actual SIGKILL, flock, adapter processes and durable state. A separate SIGKILL case interrupts first skill projection. Unknown usage blocks replay; pending helpers and original candidates use real Lean. Protocol peers control model responses; this is not a prolonged paid-provider resilience benchmark.
Knowledge consumption Three real Lean cases exercise a separate consumer searching, reading, adapting and independently checking a saved declaration, including rejection of changed premises and stale evidence. A measured research-performance gain from transferred knowledge still needs a matched experiment.
Historical comparisons After a resource-binding repair in the historical runtime, a fresh plan and three startup-only runs had matching environment identities and zero model turns. The rejected earlier diagnostic and its actual costs remain recorded. A repaired paid comparison has yet to be run.
Historical read-only investigation The retired host-mediated tool was verified with Codex 0.169.0 and local fixed replies, covering independent read-only threads, cold resume, denied writes and process cleanup. Use the historical runtime to reproduce those checks.
Web workflow Creation, draft restoration, configuration freezing, declaration display, supported controls and translated desktop/mobile browser flows are covered. A private image derived from an immutable baseline rebuilt the branch's headless runtime and agent tools; native/file startup-only, statement elaboration and pinned skill projection pass. A separate offline probe runs the image's actual Codex 0.162.0 and adapter: native discovery, both actual shell readbacks, bundled tool usage and confirmed stops pass with application source hidden. The packaged probe binds that immutable image, before the later recovery fixes. Its provider replies are fixed loopback data; actual provider authentication, metered relay behavior and mathematical performance inside the image remain untested.

The single researcher shares session execution and accounting in research.ts. Its source freeze, declaration delivery and pending-proof recovery live in skillProofLifecycle.ts. Recovery runs before another model dispatch, including when the model allowance is exhausted. Current verification covers the retained solo and native team paths. Historical scheduling comparisons remain tied to the builds used by their original runs.

Verification

Focused tests exercise native skill requests and discovery errors, full-directory identity, CLI opt-in/resume, writer quarantine, declaration delivery, helper import, old-run continuation, inspection and comparison identity. Declaration tests include real isolated Lean verification for successful helpers and rejection of incorrect types, dependence on unproved goals and unapproved axioms. Ordinary regressions use protocol peers and disposable workspaces. Explicit provider acceptance is a separate opt-in script, scripts/mathematics/validateSkillProvider.ts, with per-round request/token accounting, missing-usage rejection, estimated in-flight reservation and readback evidence. An observed dispatch allowance is not a hard cap on tokens generated by a request already in flight.

The 2026-11-16 real-model Putnam 1963 A4 diagnostic used runtime 7284f3b, deepseek-flash/high, a 1200-second run allowance and a 300-second hard turn limit. It created no child and completed no proof: the first turn was interrupted at 300 seconds, and the final request had no usage receipt, so finite-budget admission stopped the run. That observation informed early collaboration guidance and earlier host coordination checkpoints, which current team execution no longer uses. Collaboration decisions now stay with Lead as described above. Local regressions and the native transport test do not replace a separately recorded real-model retest.

Historical archives can retain coordination decisions, observations and presentation identities. These remain recorded data and advance neither an inbox cursor nor a Lead decision. Current team execution does not use them to require acknowledgments, restrict tools or schedule coordination-only handoffs.

Deterministic source-policy rejection is corrective feedback, including exact outside-ownership paths when available. Team members retain invalid draft files and notes in their own workspace, clear the rejected nomination and can receive an explicit correction assignment against the last actual source commit. Invalid drafts create no proof/research acceptance artifact. Lead receives the same precise feedback and can correct its workspace; arbitrary Git, I/O and environment faults retain their error behavior.