Certified-plan re-query, prompt templates, arm renames, gate contract - #166
Merged
Conversation
yichao-liang
force-pushed
the
bl-merge-12-explorer-arms
branch
from
September 1, 2026 14:21
e9d9286 to
ce0498a
Compare
yichao-liang
force-pushed
the
bl-merge-11-prompts-fit
branch
2 times, most recently
from
September 1, 2026 14:43
8e97f58 to
191662d
Compare
yichao-liang
force-pushed
the
bl-merge-12-explorer-arms
branch
2 times, most recently
from
September 1, 2026 15:01
7e14335 to
3d29697
Compare
yichao-liang
force-pushed
the
bl-merge-11-prompts-fit
branch
2 times, most recently
from
September 1, 2026 15:26
f2c481d to
0d929d2
Compare
yichao-liang
force-pushed
the
bl-merge-12-explorer-arms
branch
2 times, most recently
from
September 1, 2026 15:42
3e481d9 to
d8ab893
Compare
yichao-liang
force-pushed
the
bl-merge-11-prompts-fit
branch
2 times, most recently
from
September 1, 2026 15:55
80cae96 to
e02eef2
Compare
yichao-liang
force-pushed
the
bl-merge-12-explorer-arms
branch
from
September 1, 2026 15:55
d8ab893 to
b0cdbca
Compare
The explorer replays a cycle's belief-certified plan for the cycle's remaining requests without a new query, so the replay's interaction verdict has no transcript and the parser dropped it: a cycle that certified a plan showed one explore chip and a 1/1 tally while the early-stop rule judged two attempts. The parser now reads the explorer's capture-gate and replay lines, marks the certified session (diamond) and books each replay as a dashed chip after it, the per-cycle tally counts replays as attempts, and the session page labels the replay's interaction video. Claude-Session: https://claude.ai/code/session_01Pbv9TvedRD2iKyoKMJKx6H
…tified plan, not a replay Two real executions of one plan test repeatability, not the belief model: in the Aug-29 policy-s0 run the same model solved the train task twice and failed the test task. The cycle's later requests now always query the agent, which sees the certified plan under the plans already scheduled and is asked, in order of preference, for a structurally different goal-reaching plan validated through the same capture gate, then the same structure with materially different parameters, then the certified plan unchanged as a last resort. The early-stop rule is unchanged: every attempt must be certified and solve for real, so a failed alternative blocks the stop that cycle and lands its data where the model is wrong. agent_explorer_replay_certified_plan is renamed agent_explorer_execute_certified_plan (it only gates the verbatim execution now); cycle_certified_plans and the explorer's replay branch are gone, and the log viewer drops the replay chip it grew for that branch while keeping the certified marker. Claude-Session: https://claude.ai/code/session_01Pbv9TvedRD2iKyoKMJKx6H
The solve, explore, and learn prompts had accumulated the same rules in two to four places across the system prompt, the query, and the sandbox CLAUDE.md, with incident anecdotes and em dashes in the shipped text. Rewrite them as Markdown templates under predicators/agent_sdk/prompts/ (section markers, __PLACEHOLDER__ substitution that fails on a missing or unused value, prose unwrapping before data is substituted) with one owner per rule: - system prompt: identity, deliverable, plan grammar, tool semantics, working principles, run-record protocol, and (explore) the exploration setting, including the early-stop note; - query: task data, run-record contents, scheduled plans, open questions, and one short instruction block; - CLAUDE.md: sandbox mechanics only. The learn system prompt absorbs the deliverables that lived in the first message (decision record, hypothesis rule, declared uncertainty, GO/NO-GO, open_questions.md, strategy.md) and the threshold-fitting protocol from CLAUDE.md; the first message carries this cycle's data. Domain-specific names stay out of the prompt text. sketch_prompts gains build_solve_system_prompt and build_early_stop_note; learn_prompts is new; build_claude_md takes no phase. Golden renders of every phase and mode live in tests/agent_sdk/prompt_goldens and are checked by test_prompt_goldens.py (UPDATE_PROMPT_GOLDENS=1 regenerates). Claude-Session: https://claude.ai/code/session_01Pbv9TvedRD2iKyoKMJKx6H
…are session plumbing Rename the agent explorer and approach CLI names to match the class hierarchy: explorer agent_plan -> agent_model_free and agent_bilevel -> agent_model_based; approach agent_planner -> agent_model_free and agent_bilevel -> agent_model_based. The old names stay as deprecated aliases in both factories (with a warning), so requeued jobs and old configs keep working; log_viewer's certified-plan regex matches both the new and pre-rename log lines. Consolidate the copy-pasted session plumbing into AgentExplorerBase (construction, tool-name lookup, random fallback) and share the two helpers duplicated across the explorers and the model-free approach: extract_final_text lives in agent_sdk.response_parser and summarize_trajectories in agent_sdk.sketch_prompts. Also drop the dead agent_explorer_max_turns setting (nothing read it). Claude-Session: https://claude.ai/code/session_01XXi3ZreZvYMjpaXeWuGexB
…sandbox cwd, tool ergonomics Domain-general fixes from the 2026-08-30 bridge run review (seeds 0/1): - submit_plan/submit_policy: rollout 1 now runs on the same fresh env as the validation repeats, at the base planner seed, so the whole capture gate is reproducible in-session - sim.run(plan, trials=N) runs the identical rollout set. Failure guidance now names fresh=True; step images render from the rollout's states explicitly. - sketch parsing: strict (tool-input) mode rejects subgoal atoms with unknown predicates/objects or wrong arity instead of silently dropping them; tolerant mode warns once per process instead of per parse. format_step_line renders NOT atoms, so attempts.md matches the monitored sketch. Zero-parameter options may omit their []. - run_python executes with the sandbox as cwd (stale repo-root plan.txt was silently executed cross-session); _get_log_dir is absolute so harness writes are cwd-independent; sim.residuals resolves a relative path against the sandbox and errors on a missing file instead of degrading to the baseline report. - Wait parity: submit_plan and sim.run ground via ground_step so an annotated Wait waits for its targets on every surface; captured plans re-align Wait targets with the filtered (verifiable) sketch; the belief option model applies the real executor's wait_option_max_steps backstop; a cap-hit Wait explains itself in step reports. - tool ergonomics: probe results delegate the full str API (.split cost a 1200 s refine re-run); sim.state() keys are name:type with bare-name lookups still accepted; sweep_params='all' with an empty registry, refine's require_solved recommendation on evaluator-less tasks, physics_sweep's rule-margin confusion, and the correlated- trials note all say what is actually available. - prompts: initial-state features print at 4 decimals; strategy and open-questions injections truncate at line/entry boundaries with a read-the-file pointer; latent-reading predicates are marked in the annotation roster. - logs: motion-planner refusal diagnostics demoted to debug (they reach the agent via the failure reason), plan-exhausted control flow no longer dumps tracebacks, transcript rendering dedupes repeated tool-use/result deliveries and drops empty turn stubs, and attempt-log headers carry the harness cycle number. Verified: mypy clean (68 files), pylint clean, 634 tests green, prompt goldens regenerated (4 dp state dicts only). Claude-Session: https://claude.ai/code/session_017Acb4dHk2Ryju5XFvcjdNU
Branch-local advance of the skill_factories bullet of the later review -fixes commit (50d6528), which lands in the next chunk: log_errors is _diagnose's final-failure emission contract (every in-run caller passes False), so the gated site logs at ERROR; the ungated per-candidate site stays debug. Restores the two records the collision-diagnostics logging test asserts. Claude-Session: https://claude.ai/code/session_01VQkk8ycwwwiSKraDw88FVm
yichao-liang
force-pushed
the
bl-merge-12-explorer-arms
branch
from
September 1, 2026 16:11
b0cdbca to
ca8f71d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
After a certified plan the explorer queries for a different certified plan instead of replaying, prompts move to one-rule-per-layer Markdown templates with golden renders, the agent arms are renamed model-free/model-based with shared session plumbing, and the agent harness gets one gate substrate/seed contract, strict annotations, sandbox cwd, and tool ergonomics. The log viewer marks query-free replays with their own chip.
Commits:
Part of the bridge-learning merge stack.
🤖 Generated with Claude Code
https://claude.ai/code/session_01VQkk8ycwwwiSKraDw88FVm