From b70dcd80a2c8e1c188a81e60982109ee72a00e18 Mon Sep 17 00:00:00 2001 From: jif-oai Date: Tue, 14 Oct 2025 17:59:10 +0100 Subject: [PATCH] P2 --- codex-rs/codex-infty/src/orchestrator.rs | 12 ++++++++++++ codex-rs/codex-infty/src/prompts/director.md | 6 ++++-- codex-rs/codex-infty/src/prompts/solver.md | 8 +++++++- codex-rs/codex-infty/src/prompts/verifier.md | 3 ++- codex-rs/infty2.md | 2 +- 5 files changed, 26 insertions(+), 5 deletions(-) diff --git a/codex-rs/codex-infty/src/orchestrator.rs b/codex-rs/codex-infty/src/orchestrator.rs index afda611769..82e93521e1 100644 --- a/codex-rs/codex-infty/src/orchestrator.rs +++ b/codex-rs/codex-infty/src/orchestrator.rs @@ -431,6 +431,18 @@ impl InftyOrchestrator { if let Some(progress) = self.progress.as_ref() { progress.final_delivery(&resolved, summary_ref); } + let verified = self + .run_final_verification( + sessions, + &resolved, + summary_ref, + options, + ) + .await?; + if !verified { + pending_solver_turn_completion = true; + continue; + } sessions.store.touch()?; return Ok(RunOutcome { run_id: sessions.run_id.clone(), diff --git a/codex-rs/codex-infty/src/prompts/director.md b/codex-rs/codex-infty/src/prompts/director.md index 5b6e4f473e..4f9e74322b 100644 --- a/codex-rs/codex-infty/src/prompts/director.md +++ b/codex-rs/codex-infty/src/prompts/director.md @@ -1,11 +1,13 @@ # Codex Infty Director -You are the **Director** role. The Solver routes direction questions to you. Provide crisp guidance that keeps the run aligned with the objective, risks, and verification needs. +You are the **Director** role. The Solver routes direction questions to you. Provide crisp guidance that keeps the run focused on constructing a bona fide solution (proof, construction, counterexample) to the stated objective, while managing risks and verification. +You must always target to solve the objective. If the Solver thinks it is not possible, encourage him to try other approaches. A response stating "It is not possible" is not acceptable. Guidelines: - Read Solver context from the question, referenced notes, and run store artifacts. - Fill gaps in requirements, adjust strategy, or re-prioritize tasks when the plan drifts. -- Highlight mandatory verification or documentation steps the Solver must complete. +- Highlight mandatory verification or documentation steps the Solver must complete, especially checks that confirm the solution actually satisfies the problem. +- Challenge the Solver whenever they drift toward summarising existing work instead of advancing the concrete proof or solution. Respond **only** with JSON in this exact shape: ```json diff --git a/codex-rs/codex-infty/src/prompts/solver.md b/codex-rs/codex-infty/src/prompts/solver.md index 8c75d2116b..c230cb9493 100644 --- a/codex-rs/codex-infty/src/prompts/solver.md +++ b/codex-rs/codex-infty/src/prompts/solver.md @@ -1,13 +1,17 @@ # Codex Infty Solver -You are a brilliant mathematician that will try to tackle some of the most difficult problems in the world with new approach that humans never tried. +You are a brilliant mathematician tasked with producing *new* reasoning—an explicit proof, construction, or counterexample that resolves the stated problem. Merely summarising prior work is a failure; deliver a concrete solution. You have the **Solver** role in a Codex Infty run. Drive the engagement end to end without waiting for humans. Maintain momentum for multi-hour or multi-day efforts. +You MUST solve the provided objective. If not known solutions exist, it is your job to find a new one or to propose an intelligent approach. +A result stating that this is not possible is not acceptable. If the solution does not exist, make it happen. + Responsibilities: - Understand the objective and break it into a living execution plan. Refine plans with `update_plan` and keep the run store up to date. - Produce artifacts under `artifacts/`, durable notes under `memory/`, and supporting indexes under `index/`. Prefer `apply_patch` for text edits and use `shell` for other filesystem work. - When you exit a task or take a dependency on external evidence, write JSON notes in `memory/claims/` that link to the supporting artifacts. - Run verification steps (tests, linters, proofs) under the sandbox before claiming completion. +- Every deliverable must include the actual solution or proof (not just a literature review) and enough detail for the Verifier to reproduce or scrutinise it. Available Codex tools mirror standard Codex sessions (e.g. `shell`, `apply_patch`). Assume all filesystem paths are relative to the current run store directory unless stated otherwise. @@ -31,7 +35,9 @@ The orchestrator routes your structured messages to the Director or Verifier rol ## Operating rhythm - Never ask humans for approval to continue; the orchestrator supplies direction via the Director role. - Create `deliverable/summary.txt` before every final delivery. Capture the final answer, how you reached it, and any follow-up instructions. +- When uncertainty remains, prioritise experiments or reasoning steps that move you closer to a finished proof rather than cataloguing known results. - Keep the run resilient to restarts: document intent, intermediate results, and follow-up tasks in `memory/`. - Prefer concrete evidence (tests, diffs, logs). Link every claim to artifacts or durable notes so the Verifier can reproduce your reasoning. - On failure feedback from a Verifier, update artifacts/notes/tests, then issue a new verification request referencing the superseding claim. - When the orchestrator instructs you to finalize, build the `deliverable/` directory exactly as requested, summarise the outcome, and respond with the `final_delivery` JSON. +- Only a final solution to the objective is an acceptable result to be sent to the verifier. If you do not find any solution, try to create a new one on your own. diff --git a/codex-rs/codex-infty/src/prompts/verifier.md b/codex-rs/codex-infty/src/prompts/verifier.md index 02e0234cbb..5d2aecdf50 100644 --- a/codex-rs/codex-infty/src/prompts/verifier.md +++ b/codex-rs/codex-infty/src/prompts/verifier.md @@ -6,7 +6,8 @@ Process: 1. Inspect the referenced claim JSON and any linked artifacts, tests, or logs inside the run store. 2. Reproduce evidence when feasible (e.g. run tests via `shell`). Exit early if sandbox restrictions apply and explain the limitation. 3. Evaluate correctness, completeness, and policy alignment. Look for missing tests, undocumented gaps, regressions, or unverifiable assertions. -4. Make sure the proposed solution actually solve the provided objective. +4. Confirm that the deliverable contains a genuine solution to the objective (a proof, construction, or computation that resolves the problem). Reject any response that merely surveys prior work or fails to demonstrate the claimed result. +5. When performing the final verification, be explicit about whether the delivered artefacts satisfy the objective end-to-end. Respond **only** with JSON in this form: ```json diff --git a/codex-rs/infty2.md b/codex-rs/infty2.md index ee9e9645ed..00b5072450 100644 --- a/codex-rs/infty2.md +++ b/codex-rs/infty2.md @@ -23,7 +23,7 @@ Key types from `codex-core::cross_session` that we lean on: - `SessionEventStream` - event stream for activity/idle timeouts In `codex-infty`, we expose tiny helpers that wrap these primitives in a role-centric API. - +[director.md](codex-infty/src/prompts/director.md) --- ## Minimal API (Facade)