Skip to content

Certified-plan re-query, prompt templates, arm renames, gate contract - #166

Merged
yichao-liang merged 6 commits into
masterfrom
bl-merge-12-explorer-arms
Sep 1, 2026
Merged

Certified-plan re-query, prompt templates, arm renames, gate contract#166
yichao-liang merged 6 commits into
masterfrom
bl-merge-12-explorer-arms

Conversation

@yichao-liang

Copy link
Copy Markdown
Collaborator

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:

  • log_viewer: a certified plan's query-free replay gets its own chip
  • explorer: a certified plan is followed by a query for a different certified plan, not a replay
  • prompts: one rule per layer, Markdown templates, golden renders
  • explorers+approaches: rename agent arms to model-free/model-based, share session plumbing
  • agent harness: one gate substrate/seed contract, strict annotations, sandbox cwd, tool ergonomics

Part of the bridge-learning merge stack.

🤖 Generated with Claude Code

https://claude.ai/code/session_01VQkk8ycwwwiSKraDw88FVm

@yichao-liang
yichao-liang force-pushed the bl-merge-12-explorer-arms branch from e9d9286 to ce0498a Compare September 1, 2026 14:21
@yichao-liang
yichao-liang force-pushed the bl-merge-11-prompts-fit branch 2 times, most recently from 8e97f58 to 191662d Compare September 1, 2026 14:43
@yichao-liang
yichao-liang force-pushed the bl-merge-12-explorer-arms branch 2 times, most recently from 7e14335 to 3d29697 Compare September 1, 2026 15:01
@yichao-liang
yichao-liang force-pushed the bl-merge-11-prompts-fit branch 2 times, most recently from f2c481d to 0d929d2 Compare September 1, 2026 15:26
@yichao-liang
yichao-liang force-pushed the bl-merge-12-explorer-arms branch 2 times, most recently from 3e481d9 to d8ab893 Compare September 1, 2026 15:42
@yichao-liang
yichao-liang force-pushed the bl-merge-11-prompts-fit branch 2 times, most recently from 80cae96 to e02eef2 Compare September 1, 2026 15:55
@yichao-liang
yichao-liang force-pushed the bl-merge-12-explorer-arms branch from d8ab893 to b0cdbca Compare September 1, 2026 15:55
@yichao-liang
yichao-liang changed the base branch from bl-merge-11-prompts-fit to master September 1, 2026 16:10
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
yichao-liang force-pushed the bl-merge-12-explorer-arms branch from b0cdbca to ca8f71d Compare September 1, 2026 16:11
@yichao-liang
yichao-liang merged commit f99e276 into master Sep 1, 2026
14 checks passed
@yichao-liang
yichao-liang deleted the bl-merge-12-explorer-arms branch September 1, 2026 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant