# Controlled LLM-in-the-Loop Replanning Protocol (Experiments E5 & E5b) ## Execution Status & Provenance All **720 live LLM episodes** (`1,404` LLM calls, `0` schema errors, `0` dropped episodes) were collected against historical commit `97ecd67b8e8c44ddf9a9dbe60184259c50113c60` (`KedgeSpec v0.8.0a3`) on a dedicated model workstation and are retained verbatim for **Level B** zero-API-call replay via `eval/process_results.py`: - **E5 Core (`S1`–`S6`, `--suite core`, 360 primary + 120 control episodes):** - `eval/results/e5_sglang_qwen3_8b.json`: `Qwen/Qwen3-8B` (local SGLang, `T=0.2`, `enable_thinking=false`, 5 seeds = 120 episodes) + `eval/results/e5_sglang_qwen3_8b_notemp.json` (120-episode server-default sampling control; 100% behaviorally identical to `T=0.2`). - `eval/results/e5_codex_cli.json`: `codex` CLI `0.171.0.978` (logged `model="cli-default"`, labeled `GPT-5.6` from CLI config at collection time; provider-managed default sampling; 5 trials = 120 episodes). - `eval/results/e5_claude_cli.json`: `claude` CLI `2.1.330.1791` (`response_model="claude-fable-5"`, provider-managed default sampling; 5 trials = 120 episodes). - **E5b Exploratory Hard-Frontier Suite (`S7`–`S10`, `--suite frontier-hard`, 240 live episodes):** - `eval/results/e5b_sglang_qwen3_8b.json` (80 episodes), `eval/results/e5b_codex_cli.json` (80 episodes), `eval/results/e5b_claude_cli.json` (80 episodes). - **Exploratory status:** `E5b` (`S7`–`S10`) is an exploratory harder follow-up suite constructed after inspecting `E5` core ceiling effects; it is not an independent preregistered generalization benchmark. ## Experimental Design & Cumulative Configurations All four conditions share the **same mandatory enforcement backend** (`0/720` prohibited committed effects observed; shared backend safety is a constant across `C1`–`C4`, not a causal differentiator). Conditions test **cumulative combined configurations** rather than isolated single-variable ablations: 1. **C1 — Prompt + Ordinary Gateway:** Natural-language prompt guidance plus binary `PERMIT`/`DENY` gateway responses. 2. **C2 — Unified Guidance + Independent Gateway:** Compiled textual guidance plus independent Cedar authorization verdicts. 3. **C3 — Unified Guidance + Deterministic Preflight & Requirements:** Adds Strong Kleene snapshot preflight envelopes ($\widetilde{\mathcal{A}}_N^-, \widetilde{\mathcal{A}}_N^+$) and explicit disclosure of outstanding requirements $R_N(a, x)$. 4. **C4 — Unified Guidance + Contrastive Normative Explanations & Scoped Reuse:** Adds per-scenario structured contrastive refusal feedback (`contrastive_J4`) and scoped cross-agent observation reuse via the M7 NRL. ### Disclosed Treatment & Information Asymmetries - **S7 (`C1`/`C2` vs. `C3`/`C4`):** Six gating world facts are not surfaced in `C1`/`C2` prompts (and `C2`'s static guidance string omits those six mandate rules), whereas `C3`/`C4` expose machine-checked preflight verdicts computed over those facts. - **S9 (`C1`–`C3` vs. `C4`):** `C1`–`C3` receive no metadata distinguishing `reuse_peer_record_1..4` under a rate-limited sensor and 3-step cap; `C4` executes M7 `Ledger.reuse` during preflight and injects structured `contrastive_J4` guidance on `RATE_LIMITED`. - **S3 (`C4`-only action menu entry):** `reuse_shared_observation` is appended to the tool menu only in `C4` with an explicit `action_hint`. - **Contrastive feedback (`C4`):** `contrastive_J4` strings are hand-authored per-scenario structured messages naming admissible alternatives; `C4` results therefore reflect combined structured feedback + NRL reuse rather than isolated causal effects of NRL alone. - **S5 separation:** `S5` tests revoked-authority escalation (normative resolution without action execution, `5/5` in all cells). Core tables report both total normative resolutions (`/30`) and authorized action completions on the `25` non-`S5` episodes. - **Post-commit obligations (`O1`/`O2`):** In `10` primary episodes (`Qwen/Qwen3-8B` `C1` `S6`: `5/5`; `C1` `S10`: `5/5`; plus `5/5` in `notemp`), the agent committed an authorized `restart_local` and exited via `finish` without completing its post-commit duty. These are scored `authorized_completion=false` and distinguished from prohibited committed effects (`0/720`). ### Measurement, Token Accounting & Sensitivity Analyses (Revision 7) - **Workspace-inspection sensitivity analysis (`e5b_codex_cli.json`, `S9`, `C1`, `seed=505`, `step=2`):** Forensic inspection across all `720` episodes (`1,404` invocations) confirms this single step (`108,850` prompt tokens, `5.54x` the `18,640`–`20,018` band of the other `359` Codex calls) is the sole confirmed workspace-inspection outlier (`codex exec --sandbox read-only`), producing the sole `C1` `S9` completion (`1/5`). Retaining full historical records unaltered, excluding this single affected episode yields protocol-conforming `E5b` `C1` completion of **`10/59` (`16.9%`)** vs. original `11/60` (`18.3%`) (on `GPT-5.6`: `5/19` vs. `6/20`; `S9 C1`: `0/4` vs. `1/5`), leaving `C2` (`15/60`), `C3` (`35/60`), and `C4` (`60/60`) unchanged. - **Per-interface token accounting:** Token counts are **strictly within-interface** and classified separately per interface (full audit in `eval/historical_llm_manifest.json`): 1. `Qwen/Qwen3-8B` (`openai-compat` / SGLang): **Exact API totals** (`prompt_tokens + completion_tokens`; `prompt_tokens` includes cached tokens without double-counting). 2. `claude-fable-5` (`claude-cli`): **Exact CLI wrapper totals** (`input_tokens + cache_creation_input_tokens + cache_read_input_tokens + output_tokens`, disjoint Anthropic/Bedrock usage categories without cached double-counting, including CLI wrapper system prompt and internal multi-turn overhead on E5b `num_turns=2` calls). 3. `GPT-5.6` (`codex-cli`): **Unrecoverable wrapper-reported token proxy** (`^\dagger`) in retained historical logs because historical `make_codex_cli_backend` summed overlapping `input_tokens + cached_input_tokens` without persisting raw `cached_input_tokens` (the cached fraction may vary across conditions; `make_codex_cli_backend` has been corrected in Revision 7 for future Level C runs, while retained historical files remain unaltered; exact output-token medians `gen_tokens` and `mean_steps` are unaffected). - **Claude CLI unexpected multi-turn audit:** Configured with `--max-turns 1 --tools "" --strict-mcp-config` (zero external tools enabled; task-level action budget strictly 1 environment action per model invocation). In `e5_claude_cli.json`, `176/176` invocations had `num_turns=1` (`0/120` multi-turn episodes). In `e5b_claude_cli.json`, `30/168` invocations across `21/80` episodes (`C1`: `7/20`, `C2`: `4/20`, `C3`: `5/20`, `C4`: `5/20`; exclusively in `S7 C1` and `S8`) reported `num_turns=2` (`198` CLI turns vs. `168` invocations). On the strictly 1-turn protocol-conforming Claude E5b subset (`59/80` episodes): `C1` `5/13`, `C2` `6/16`, `C3` `10/15`, `C4` `15/15` (and combined across all 3 models excluding both the 1 Codex outlier and 21 Claude multi-turn episodes: `C1` `10/52`, `C2` `15/56`, `C3` `30/55`, `C4` `55/55`). Because all `S8` `C3`/`C4` Claude episodes had `num_turns=2`, Claude E5b `S8` comparisons are narrowed accordingly. - **Model provenance & sampling:** `e5_codex_cli.json` and `e5b_codex_cli.json` log `model="cli-default"` with no `response_model` field; `Qwen/Qwen3-8B` exhibits `0%` cross-seed behavioral variance across all `40` `(scenario, condition)` cells. - **Historical evidence integrity:** Exact SHA-256 digests for all `7` untouched historical JSON files, both generated tables, protocol docs, and processing scripts are recorded in `eval/historical_llm_manifest.json`. - **No private chain-of-thought claims:** Only observable tool calls, structured JSON responses, gateway verdicts, and reported token totals are logged or analyzed. ## Replay & Dry-Run Commands - Validate `E5b` fixtures locally with zero LLM calls: `./eval/run_e5b_package.sh --dry-run` - Replay `E5b` table from retained JSONs: `./eval/run_e5b_package.sh --render` - Replay `E5` core table: see [README.md](README.md) (Level B) and [E5_LLM_EXECUTION_GUIDE.md](E5_LLM_EXECUTION_GUIDE.md).