diff --git a/data/assist-prompt.md b/data/assist-prompt.md
--- a/data/assist-prompt.md
+++ b/data/assist-prompt.md
@@ -31,6 +31,11 @@
 - a prose prompt is the right interface for a coding agent
 - the workflow should create or modify project files, optionally after applying baseline modules
 
+Baseline modules apply their files and run their commands before the provider
+starts. Keep deterministic setup in the modules' command declarations. Use
+`seihou agent --debug run NAME` to render the prompt and list the declared
+baseline modules in the current checkout.
+
 Use a module when:
 - all variation is enumerable as `VarDecl`s
 - the output is deterministic given those variables
diff --git a/data/blueprint-prompt.md b/data/blueprint-prompt.md
--- a/data/blueprint-prompt.md
+++ b/data/blueprint-prompt.md
@@ -57,7 +57,9 @@
    when it is available; otherwise ask the user to paste the relevant file.
 
 2. **Examine the baseline.** If the Baseline section above lists applied
-   modules, the project already contains files generated from them. Inspect
+   modules, the project already contains files generated from them, and the
+   modules' commands already ran successfully before you started. Do not run
+   those commands again unless the task asks for it. Inspect
    `seihou status`, `git status` and relevant files when tools are available;
    otherwise ask for the needed output. Preserve user changes and declared
    checkout links; fresh clones restore those with `seihou sync`. Baseline seeds
diff --git a/data/bootstrap-prompt.md b/data/bootstrap-prompt.md
--- a/data/bootstrap-prompt.md
+++ b/data/bootstrap-prompt.md
@@ -130,7 +130,7 @@
 ## Registry Format (for multi-module repos)
 
 A `seihou-registry.dhall` at the repository root lists modules, recipes,
-blueprints, and prompts:
+blueprints, prompts, and judgements:
 
 ```dhall
 { repoName = "my-templates"
@@ -152,8 +152,9 @@
 - **modules**: List of entries with name, version, path, description, tags.
   Keep `version` in sync with each module's `module.dhall` using
   `seihou registry sync-versions`.
-- **recipes**, **blueprints**, **prompts**: Optional lists with the same entry
-  shape, pointing to `recipe.dhall`, `blueprint.dhall`, and `prompt.dhall`.
+- **recipes**, **blueprints**, **prompts**, **judgements**: Optional lists
+  with the same entry shape. Each entry points to the directory with its
+  corresponding definition.
 
 ### Repository layout
 ```
@@ -304,6 +305,8 @@
 
 7. **Plan for versioning**: Set an explicit initial version. Modules can ship
    deterministic layout migrations, automatically included by `seihou update`.
+   Blueprint baselines apply their modules' files and commands before the
+   provider starts. Keep those commands in the module declarations.
    Blueprints can ship separate agent-guided library migrations with
    `versionProbe`, ordered edges and optional `entails`; consumers use
    `seihou agent migrate NAME`. Inspect with parent `--debug` before launching.
diff --git a/data/setup-prompt.md b/data/setup-prompt.md
--- a/data/setup-prompt.md
+++ b/data/setup-prompt.md
@@ -31,7 +31,8 @@
    via `seihou agent run NAME [PROMPT]`. A prompt runs via
    `seihou prompt run NAME [USER-PROMPT]`. If the user names a blueprint,
    switch to the agent-run flow: resolve variables, optionally let the baseline
-   modules apply, then start the configured provider. If the user names a
+   modules apply their files and run their commands, then start the configured
+   provider. If the user names a
    prompt, switch to the prompt-run flow: resolve variables, run command-derived
    variables, render the prompt, then start the provider.
 
@@ -129,8 +130,13 @@
   - `--force`: accept conflicted managed-file deletions; seeds remain protected
 - `seihou agent run BLUEPRINT [PROMPT] [--var K=V] [--no-baseline]` — run a blueprint
   - Discovers the blueprint, resolves variables (same precedence chain as `seihou run`), optionally applies base modules, then starts the configured provider
-  - `--no-baseline`: skip applying declared base modules
-  - `seihou agent --debug run BLUEPRINT`: print the resolved system prompt without contacting the provider
+  - `--no-baseline`: skip the baseline's files and commands
+  - `seihou agent --debug run BLUEPRINT`: render in the current checkout and list declared baseline modules without applying them
+  - In batch mode use `--provider claude-cli` with `--allowed-tool PATTERN` or
+    `--settings FILE`. For Codex, review with
+    `seihou agent review-codex-hooks FILE` in the project terminal and pass
+    `--batch --provider codex-cli --codex-hooks FILE`. The policy applies to
+    the provider invocation. See `seihou help agent`.
 - `seihou prompt run PROMPT [USER-PROMPT] [--var K=V] [--debug]` — run a reusable prompt
   - Discovers the prompt, resolves variables, runs command-derived variables, renders the prompt body, then starts the configured provider
   - `--debug`: print the rendered prompt without contacting the provider
diff --git a/help/agent.md b/help/agent.md
--- a/help/agent.md
+++ b/help/agent.md
@@ -18,9 +18,9 @@
 
   --debug
       Print the resolved system prompt and exit without contacting any
-      provider. Use this to inspect what Seihou would send. Artifact
-      debug renders still run declared commandVars/version probes;
-      agent upgrade also saves its brief outside the project.
+      provider. Use this to inspect what Seihou would send. Migration debug
+      still runs a declared version probe when inferring --to. Agent upgrade
+      also saves its brief outside the project.
 
   --provider PROVIDER
       Select the provider for this invocation. Accepted values:
@@ -165,11 +165,16 @@
       approve tools. With claude-cli, a run in which Claude refused any tool
       call exits 1, names each refused tool and command, and records no
       applied blueprint. Refusals count whatever their cause: a command
-      missing from the blueprint's allowedTools, a guarded write such as one
+      missing from the effective allow-list, a guarded write such as one
       inside .git/ or a shell redirection, or a command run by your own Claude
-      Code hooks. Declare what the blueprint needs in allowedTools, or run it
-      interactively. codex-cli batch runs are not checked this way.
+      Code hooks. Use the caller policy flags below for per-invocation grants.
+      Codex runs with --codex-hooks check native hook evidence.
 
+  seihou agent review-codex-hooks FILE
+      Review synchronous Codex PreToolUse commands from the consuming project's
+      terminal. Inspect the commands shown and type yes to approve them.
+      See Reviewed Codex hooks below for the batch invocation.
+
   seihou agent migrate BLUEPRINT [--from VERSION] [--to VERSION] [PROMPT]
       Run one agent session per in-window migration declared by the blueprint.
       Versions are dotted numbers; gaps are allowed. Successful edges are
@@ -190,12 +195,12 @@
 
       --mark-applied records every pending edge in the window as already
       applied, without running them, on your assertion that you performed the
-      upgrade by hand. No provider is contacted and no file in the working
-      tree is changed. Each receipt is filed under the blueprint that owns its
+      upgrade by hand. It writes only the manifest, without starting a provider
+      or applying project edits. Each receipt is filed under the blueprint that owns its
       edge, so a marked entailed edge suppresses a later direct run of that
       blueprint too; edges that already have receipts are left alone rather
       than restamped. --rerun clears a mistaken marking. The flag is refused
-      alongside --rerun or parent --debug, both of which it contradicts.
+      alongside --rerun, parent --debug, or caller policy flags.
 
       A receipt records that an edge has been dealt with -- a provider
       interaction returned, or you marked it -- not package-manager
@@ -251,6 +256,34 @@
 unchanged. Automatic startup preserves provider tool approvals.
 
 seihou agent --debug run api-service shows the effective initial instruction
-without contacting a provider. Blueprint debug still applies baseline modules
-and records blueprint provenance; it is not a dry run. The manifest records
-the original PROMPT, including omission or blank text.
+and lists the declared baseline modules. Debug leaves project files and the
+manifest untouched.
+A successful execution records the original PROMPT, including omission or blank text.
+
+CALLER TOOL POLICY
+
+A Claude CLI batch run or migration accepts repeatable --allowed-tool PATTERN and
+--settings FILE. For example, --allowed-tool 'Bash(grep *)' adds one static
+grant. Pass an existing Claude settings file with --settings ./campaign/claude-settings.json
+to use its permission rules and hooks. Both flags apply only to this invocation.
+Baseline commands run directly under Seihou before the agent starts.
+
+  seihou agent run fix-nix-haskell-flake-customizations --batch --provider claude-cli --allowed-tool 'Bash(grep *)'
+  seihou agent migrate keiro-upgrade --from 0.22.0.0 --to 0.25.0.0 --batch --provider claude-cli --settings ./campaign/claude-settings.json
+
+Inspect the working diff after a refusal and retry with the intended rule or gate.
+The manifest records inputs in blueprint.callerToolPolicy or each executed
+blueprintMigrations entry. Rules are literal. Files are identified by SHA-256.
+
+Reviewed Codex hooks
+
+Supply a file of synchronous PreToolUse commands with --codex-hooks FILE
+on a Codex batch run or migration. Review the file once from the project:
+
+  seihou agent review-codex-hooks ./caller-hooks.json
+  seihou agent run fix-nix-haskell-flake-customizations --batch --provider codex-cli --codex-hooks ./caller-hooks.json
+
+Seihou checks native review before applying any baseline. Review changed
+declarations again. A blocked or failed gate stops execution without a
+new blueprint or migration receipt. Successful receipts store the digest
+of the supplied hooks file. The reviewed session runs in one thread.
diff --git a/help/blueprints.md b/help/blueprints.md
--- a/help/blueprints.md
+++ b/help/blueprints.md
@@ -79,6 +79,21 @@
   agent runner records the applied blueprint in `.seihou/manifest.json` after
   a successful run, including baseline provenance.
 
+  Applying the baseline matches `seihou run` of its modules: files first,
+  then each module's commands in composition order, all before the provider
+  starts. Every `seihou agent run` applies it again, so its commands run
+  again too. A failing command exits 1 without starting the agent and names
+  the command, its module, and how to retry; `--no-baseline` starts the
+  agent without applying the baseline. Parent `--debug` lists the declared
+  baseline modules and renders the prompt without writing files, running
+  baseline commands, or starting the provider. The command phase reports on
+  standard error. Baseline commands run directly under Seihou and the
+  provider's tool policy applies to the agent.
+
+  Releases through 0.16.0.2 skipped baseline commands. Once consumers run a
+  fixed release, remove any prompt text or `allowedTools` entries that only
+  existed to make the agent run them, or each command runs twice.
+
   Baseline seed steps create project-owned starters once and preserve edits or
   deliberate deletion on rerun, including force. Agents extend those files as
   authorized project work. Status/diff do not compare their contents. Commit seed
@@ -96,7 +111,7 @@
   Reference files are meant for examples, snippets, partial templates, design
   notes, or sample configs that help the agent produce the right project. They
   are not copied automatically by the deterministic engine. During interactive
-  `claude-cli` and `codex-cli` runs, the runner mounts the existing `files/`
+  and batch `claude-cli` and `codex-cli` runs, the runner mounts the existing `files/`
   directory and prints its absolute path in the agent prompt so the agent can
   read references directly. API providers receive fallback guidance because
   they cannot access local directories.
@@ -113,11 +128,11 @@
   its workspace-write sandbox and on-request approval policy because it has no
   equivalent per-tool allow-list option.
 
-  Without allowedTools, a blueprint gets only the base set. A batch run
-  (--batch, or stdin that is not a terminal) cannot approve anything else:
-  Claude refuses it, and `seihou agent run` exits 1 naming each refused
-  command. `seihou validate-blueprint` warns about a blueprint that declares
-  no allowedTools, without failing.
+  Claude starts with the base set and any blueprint allowedTools. A batch run
+  can supply additional policy using the flags below. When Claude reports
+  a refusal, `seihou agent run` exits 1 and names each refused tool call.
+  `seihou validate-blueprint` reports an advisory when a blueprint declares
+  no allowedTools.
 
 LIBRARY UPGRADE MIGRATIONS
 
@@ -215,3 +230,24 @@
 written for that edge. Inspect partial edits, repair the reported problem, and
 rerun the same command; completed edges are skipped. Receipts do not verify that
 the migrated project builds or passes tests.
+
+CALLER TOOL POLICY
+
+A Claude CLI batch run or migration accepts repeatable --allowed-tool PATTERN and
+--settings FILE. For example, --allowed-tool 'Bash(grep *)' adds one static
+grant. Pass an existing Claude settings file with --settings ./campaign/claude-settings.json
+to use its permission rules and hooks. Both flags apply only to this invocation.
+Baseline commands run directly under Seihou before the agent starts.
+
+  seihou agent run fix-nix-haskell-flake-customizations --batch --provider claude-cli --allowed-tool 'Bash(grep *)'
+  seihou agent migrate keiro-upgrade --from 0.22.0.0 --to 0.25.0.0 --batch --provider claude-cli --settings ./campaign/claude-settings.json
+
+Inspect the working diff after a refusal and retry with the intended rule or gate.
+The manifest records inputs in blueprint.callerToolPolicy or each executed
+blueprintMigrations entry. Rules are literal. Files are identified by SHA-256.
+
+Codex batch runs and migrations accept --codex-hooks FILE for synchronous
+PreToolUse command handlers. Run seihou agent review-codex-hooks FILE in a
+terminal from the consuming project to review new or changed declarations.
+A successful receipt stores the file digest, and a reported denial stops the
+attempt. See seihou help agent for the full invocation.
diff --git a/help/extensions.md b/help/extensions.md
--- a/help/extensions.md
+++ b/help/extensions.md
@@ -18,6 +18,7 @@
   output directory after validating the replacement. Invalid declarations or a rejecting
   profile preserve existing output. Run from a fresh registry checkout; no artifact
   installation is needed. Covers modules, recipes, blueprints, prompts and judgements.
+  Artifact pages show Seihou commands and link to individual migration steps.
 
 SEE ALSO
 
diff --git a/help/git-repository.md b/help/git-repository.md
--- a/help/git-repository.md
+++ b/help/git-repository.md
@@ -1,8 +1,8 @@
 GIT REPOSITORY
 
-Seihou modules, recipes, blueprints, and prompts can be shared and installed from git
-repositories. A repository can contain a single runnable item or multiple items
-organized as a registry.
+Seihou modules, recipes, blueprints, prompts, and judgements can be shared and
+installed from git repositories. A repository can contain a single artifact
+or multiple items organized as a registry.
 
 SINGLE-MODULE REPOSITORY
 
@@ -19,24 +19,25 @@
     seihou install https://github.com/user/my-module.git
     seihou install https://github.com/user/my-module.git --name custom-name
 
-SINGLE-RECIPE, SINGLE-BLUEPRINT, OR SINGLE-PROMPT REPOSITORY
+OTHER SINGLE-ARTIFACT REPOSITORIES
 
-  A repository with a recipe.dhall, blueprint.dhall, or prompt.dhall at the
-  root is treated as a single recipe, single blueprint, or single prompt.
-  Install it the same way:
+  A repository with a root recipe.dhall, blueprint.dhall, prompt.dhall, or
+  judgement.dhall is treated as a single artifact. Install it the same way:
 
     seihou install https://github.com/user/my-recipe.git
     seihou install https://github.com/user/my-blueprint.git
     seihou install https://github.com/user/my-prompt.git
+    seihou install https://github.com/user/my-judgement.git
 
   Recipes run through `seihou run`; blueprints run through
-  `seihou agent run`; prompts run through `seihou prompt run`.
+  `seihou agent run`; prompts run through `seihou prompt run`. Adopt a judgement
+  with `seihou run NAME`; see `seihou help judgements`.
 
 REGISTRY REPOSITORY
 
   A repository with a seihou-registry.dhall at the root is treated as a
-  registry containing multiple modules, recipes, blueprints, and prompts. Each item
-  lives in its own subdirectory with its own runnable definition.
+  registry containing modules, recipes, blueprints, prompts, or judgements.
+  Each item lives in its own subdirectory with its own definition.
 
     my-templates/
       seihou-registry.dhall
@@ -44,6 +45,7 @@
       recipes/haskell-library/recipe.dhall
       blueprints/api-service/blueprint.dhall
       prompts/review-changes/prompt.dhall
+      judgements/license-review/judgement.dhall
 
   The registry file declares available items with descriptions, versions, and
   tags. Install specific items, all items, or choose interactively:
@@ -64,8 +66,7 @@
 WHERE ITEMS ARE INSTALLED
 
   Installed items are stored under ~/.config/seihou/installed/<name>/.
-  They appear alongside user-created modules, recipes, blueprints, and prompts in the
-  search path:
+  They appear alongside user-created artifacts in the search path:
 
   1. .seihou/modules/             Project-local items
   2. ~/.config/seihou/modules/    User items
diff --git a/help/manifest.md b/help/manifest.md
--- a/help/manifest.md
+++ b/help/manifest.md
@@ -66,8 +66,10 @@
       11 -> 12 recipe inputs
       12 -> 13 unknown recipe-chain history
       13 -> 14 conditional removal policies and recorded root retirement
+      14 -> 15 active judgements
+      15 -> 16 caller tool policy receipts
 
-    ✓ Upgraded .seihou/manifest.json to schema version 14.
+    ✓ Upgraded .seihou/manifest.json to schema version 16.
       Review the diff and commit it: git diff .seihou/manifest.json
 
   Running it on a manifest that is already current reports that there is
@@ -181,3 +183,20 @@
   removal. Other applications keep shared qualified instances. Explicit
   additional-root compositions and recipe applications retain exact-instance
   selection. See seihou help modules.
+
+ACTIVE JUDGEMENTS AND CALLER TOOL POLICY
+
+  Schema 15 records the project's active judgements and their policy. Adoption
+  through seihou run prepares this schema as needed. See seihou help judgements.
+
+  Schema 16 can record callerToolPolicy on a blueprint run or on each blueprint
+  migration receipt. Claude CLI receipts record the supplied allowed-tool
+  patterns and the digest of any settings file. Reviewed Codex CLI receipts
+  record the hooks file digest. Historical and manually marked receipts have
+  no caller policy. The receipt records per-invocation inputs for inspection.
+  Pass the flags again on a later invocation.
+
+  The first successful policy-bearing invocation upgrades a portable manifest as
+  it writes the receipt. Upgrade explicitly with seihou manifest upgrade when
+  you need to convert a machine-specific manifest first. Readers need Seihou
+  0.17.0.0 or newer to open schema 16. See seihou help agent for the flags.
diff --git a/help/migrations.md b/help/migrations.md
--- a/help/migrations.md
+++ b/help/migrations.md
@@ -22,6 +22,8 @@
   the next starts. A normal rerun resumes after receipts; --rerun repeats them.
   Parent --debug renders pending prompts in order without launching a provider
   or changing the manifest. Migration mode never applies blueprint baseModules.
+  Batch invocations accept Claude CLI --allowed-tool and --settings, or
+  Codex CLI --codex-hooks after terminal review. See seihou help agent.
 
   A receipt means the edge has been dealt with and need not run again: either
   the agent interaction completed, or the consumer upgraded by hand and said so
diff --git a/help/registry.md b/help/registry.md
--- a/help/registry.md
+++ b/help/registry.md
@@ -1,7 +1,7 @@
 REGISTRY
 
 A multi-artifact repository declares seihou-registry.dhall at its root. Lists
-named modules, recipes, blueprints and prompts contain entries with name,
+named modules, recipes, blueprints, prompts and judgements contain entries with name,
 optional version/description, project-relative path and tags. Each path points
 to the directory holding the corresponding runnable definition. Names must be
 unique across kinds; paths must be relative without parent traversal.
@@ -18,8 +18,9 @@
   without writing; use it in CI. Validate checks structure and version agreement.
   Both commands accept --dir PATH, work locally and do not read installed copies.
 
-  Validate item contents with validate-module, validate-recipe, validate-blueprint or
-  validate-prompt as appropriate; registry validation checks metadata.
+  Run the matching artifact validator: validate-module, validate-recipe,
+  validate-blueprint, validate-prompt or validate-judgement. Registry
+  validation checks the entries and their recorded versions.
 
 CONSUMERS
 
diff --git a/seihou-cli.cabal b/seihou-cli.cabal
--- a/seihou-cli.cabal
+++ b/seihou-cli.cabal
@@ -1,6 +1,6 @@
 cabal-version: 3.0
 name: seihou-cli
-version: 0.16.0.2
+version: 0.17.0.0
 synopsis: CLI for Seihou project scaffolding
 description:
   Command-line interface for Seihou, a composable project scaffolding
@@ -78,6 +78,7 @@
     Seihou.CLI.BlueprintExecution
     Seihou.CLI.BlueprintMigration
     Seihou.CLI.BrowseFormat
+    Seihou.CLI.CallerToolPolicy
     Seihou.CLI.CheckoutSync
     Seihou.CLI.CommandExecution
     Seihou.CLI.CommitMessage
@@ -150,11 +151,11 @@
     aeson >=2.1 && <3,
     aeson-pretty >=0.8 && <1,
     ansi-terminal >=1.1 && <2,
-    baikai ^>=0.10.1.0,
-    baikai-claude ^>=0.7.3.0,
-    baikai-kit ^>=0.4.0.3,
-    baikai-openai ^>=0.7.3.0,
-    baikai-typesafe ^>=0.1.0.1,
+    baikai ^>=0.11.0.0,
+    baikai-claude ^>=0.7.3.1,
+    baikai-kit ^>=0.4.0.4,
+    baikai-openai ^>=0.7.4.0,
+    baikai-typesafe ^>=0.1.0.2,
     base >=4.18 && <5,
     bytestring >=0.11 && <1,
     containers >=0.6 && <1,
@@ -166,13 +167,14 @@
     generic-lens >=2.2 && <3,
     lens >=5.2 && <6,
     process >=1.6 && <2,
-    seihou-core ^>=0.16.0.2,
-    shikumi ^>=0.5.1.0,
+    seihou-core ^>=0.17.0.0,
+    shikumi ^>=0.5.1.1,
     streamly-core >=0.3 && <0.5,
     temporary >=1.3 && <2,
     text >=2.0 && <3,
     time >=1.12 && <2,
     transformers >=0.6 && <0.7,
+    unix >=2.8 && <2.9,
     vector ^>=0.13.2.0,
 
 executable seihou
@@ -244,10 +246,10 @@
     aeson >=2.1 && <3,
     aeson-pretty >=0.8 && <1,
     ansi-terminal >=1.1 && <2,
-    baikai ^>=0.10.1.0,
-    baikai-claude ^>=0.7.3.0,
-    baikai-kit ^>=0.4.0.3,
-    baikai-openai ^>=0.7.3.0,
+    baikai ^>=0.11.0.0,
+    baikai-claude ^>=0.7.3.1,
+    baikai-kit ^>=0.4.0.4,
+    baikai-openai ^>=0.7.4.0,
     base >=4.18 && <5,
     bytestring >=0.11 && <1,
     containers >=0.6 && <1,
@@ -261,7 +263,7 @@
     optparse-applicative >=0.18 && <1,
     process >=1.6 && <2,
     seihou-cli-internal,
-    seihou-core ^>=0.16.0.2,
+    seihou-core ^>=0.17.0.0,
     temporary >=1.3 && <2,
     text >=2.0 && <3,
     time >=1.12 && <2,
@@ -293,6 +295,7 @@
     Seihou.CLI.AgentUpgradeE2ESpec
     Seihou.CLI.AppliedBlueprintMigrationSpec
     Seihou.CLI.AppliedBlueprintSpec
+    Seihou.CLI.BaselineCommandE2ESpec
     Seihou.CLI.BlueprintMigrationSpec
     Seihou.CLI.BrowseFormatSpec
     Seihou.CLI.CheckoutSyncE2ESpec
@@ -360,7 +363,7 @@
 
   build-depends:
     aeson >=2.1 && <3,
-    baikai ^>=0.10.1.0,
+    baikai ^>=0.11.0.0,
     base >=4.18 && <5,
     bytestring >=0.11 && <1,
     containers >=0.6 && <1,
@@ -373,8 +376,8 @@
     lens >=5.2 && <6,
     process >=1.6 && <2,
     seihou-cli-internal,
-    seihou-core ^>=0.16.0.2,
-    shikumi ^>=0.5.1.0,
+    seihou-core ^>=0.17.0.0,
+    shikumi ^>=0.5.1.1,
     streamly-core >=0.3 && <0.5,
     tasty >=1.4 && <2,
     tasty-hspec >=1.2 && <2,
diff --git a/src-exe/Main.hs b/src-exe/Main.hs
--- a/src-exe/Main.hs
+++ b/src-exe/Main.hs
@@ -19,6 +19,7 @@
 import Seihou.CLI.Assist (handleAssist)
 import Seihou.CLI.Bootstrap (handleBootstrap)
 import Seihou.CLI.Browse (handleBrowse)
+import Seihou.CLI.CallerToolPolicy (handleCodexHookReview)
 import Seihou.CLI.Check (handleCheck)
 import Seihou.CLI.Commands
 import Seihou.CLI.Completions (handleCompletionsCommand)
@@ -175,6 +176,7 @@
         AgentMigrate migrationOpts -> do
           pending <- pendingAgentConfigFor AgentCmdMigrate (parentAgentFlags agentOpts) (AgentSettingFlags (migrationOpts ^. #provider) (migrationOpts ^. #model) (migrationOpts ^. #effort) (migrationOpts ^. #trace))
           handleAgentMigrate (agentOpts ^. #debug) pending migrationOpts
+        AgentReviewCodexHooks file -> handleCodexHookReview (agentOpts ^. #debug) file
         AgentUpgrade upgradeOpts -> do
           -- Never 'resolveAgentModelConfigFor': it exits on a configuration
           -- error, and this command must not fail on configuration state.
diff --git a/src-exe/Seihou/CLI/AgentMigrate.hs b/src-exe/Seihou/CLI/AgentMigrate.hs
--- a/src-exe/Seihou/CLI/AgentMigrate.hs
+++ b/src-exe/Seihou/CLI/AgentMigrate.hs
@@ -12,7 +12,7 @@
 import Data.Generics.Labels ()
 import Data.List (nub)
 import Data.Map.Strict qualified as Map
-import Data.Maybe (fromMaybe, listToMaybe, maybeToList)
+import Data.Maybe (fromMaybe, isJust, listToMaybe, maybeToList)
 import Data.Text qualified as T
 import Data.Text.Encoding qualified as TE
 import Data.Text.IO qualified as TIO
@@ -25,6 +25,7 @@
     resolveAgentInitialPrompt,
     runAgentCompletion,
     runAgentMigrationCompletionWithCliAccess,
+    runReviewedCodexCompletion,
   )
 import Seihou.CLI.AgentConfig
   ( PendingAgentConfig,
@@ -63,6 +64,7 @@
     runVersionProbe,
     unstatedNotApplicableReason,
   )
+import Seihou.CLI.CallerToolPolicy
 import Seihou.CLI.Commands (BlueprintMigrationOpts (..))
 import Seihou.CLI.MigrationCohort
   ( CohortBlueprint (..),
@@ -167,6 +169,10 @@
       pendingConfig
       (agentLaunchDeclaration (blueprint ^. #launch))
 
+  policy <- resolvePolicy (batchMode || debug) (modelConfig ^. #provider) (opts ^. #policy) >>= either (exitErr level) pure
+  unless debug $
+    preflightPolicyManifest manifestPath policy >>= either (exitErr level) pure
+
   -- The receipts are read before the window is planned, not after, because
   -- the window itself now depends on them: an omitted --from is the highest
   -- version this project has already migrated this blueprint to. The same
@@ -241,7 +247,8 @@
               -- variables. All of them are resolved now rather than lazily per
               -- step: a user should answer every prompt up front rather than
               -- being interrupted between agent sessions.
-              preparedByOwner <- prepareCohort level modelConfig opts cohort pending
+              ownerContexts <- prepareCohort level modelConfig opts cohort pending
+              let preparedByOwner = Map.map (& #allowedTools %~ effectiveTools policy) ownerContexts
               traceSink <- traceSinkForConfig level modelConfig
               context <- gatherAgentContext
               let signalPath = notApplicableSignalPath projectRoot
@@ -257,11 +264,13 @@
                           position
                           total
                           step
-                          <> if batchMode && modelConfig ^. #provider == AgentProviderClaudeCli
+                          <> if (batchMode || debug && isJust (policyEvidence policy)) && modelConfig ^. #provider == AgentProviderClaudeCli
                             then
                               "\n\n## Batch execution permissions\n\nThis run has no approval terminal. Preapproved tools: "
                                 <> T.intercalate ", " (map T.pack (migrationAllowedTools (prepared ^. #allowedTools)))
-                                <> ". Use native Read, Glob, and Grep tools with absolute paths for dependency-source inspection; do not cd into dependency checkouts. Use native file tools for edits. Run shell commands individually: no cd wrappers, command substitution, pipelines, or chained commands. Do not invoke shell commands outside these grants or request additional permissions. A reported permission denial fails this attempt even if you later recover. If a validation command is outside the grants, complete the authorized edits and report that exact check as pending.\n"
+                                <> ". Use native Read, Glob, and Grep tools with absolute paths for dependency-source inspection; do not cd into dependency checkouts. Use native file tools for edits. Run shell commands individually: no cd wrappers, command substitution, pipelines, or chained commands."
+                                <> maybe " Do not invoke shell commands outside these grants or request additional permissions." (const " Caller settings also govern requests. The caller's hook may allow or deny a command.") (settingsPath policy)
+                                <> " A reported permission denial fails this attempt even if you later recover. If a validation command cannot be approved, complete the authorized edits and report that exact check as pending.\n"
                             else ""
                   renderDebugStep position total step =
                     renderStep position total step
@@ -280,15 +289,13 @@
                       <> " -> "
                       <> renderVersion (expandedPlan ^. #to)
                       <> "\n"
+                      <> (if isJust (codexHooksPath policy) then "Caller Codex hooks supplied.\n" else "")
                       <> formatBlueprintMigrationDebugOutput renderDebugStep pending
                 else do
-                  -- The agent needs somewhere to put the signal file, and the
-                  -- directory is created by the first receipt anyway.
-                  createDirectoryIfMissing True (takeDirectory signalPath)
                   result <-
                     runBlueprintMigrationsWith
-                      (launchMigration batchMode traceSink modelConfig opts preparedByOwner signalPath renderStep)
-                      (recordMigration manifestPath cohort)
+                      (launchMigration policy batchMode traceSink modelConfig opts preparedByOwner signalPath renderStep)
+                      (recordMigration policy manifestPath cohort)
                       pending
                   handleRunResult level (blueprint ^. #name) result
 
@@ -324,7 +331,7 @@
   where
     go recorded [] = TIO.putStrLn (formatMarkAppliedSummary recorded)
     go recorded (step : rest) =
-      recordMigration manifestPath cohort step MigrationApplied >>= \case
+      recordMigration emptyPolicy manifestPath cohort step MigrationApplied >>= \case
         Right () -> go (recorded + 1) rest
         Left err ->
           exitErr level $
@@ -354,6 +361,8 @@
 rejectConflictingMarkApplied :: Bool -> BlueprintMigrationOpts -> IO ()
 rejectConflictingMarkApplied debug opts
   | not (opts ^. #markApplied) = pure ()
+  | flags@(_ : _) <- policyOptionNames (opts ^. #policy) =
+      refuse ["--mark-applied cannot be combined with " <> T.intercalate " or " flags <> ". Omit caller policy when recording a manual migration."]
   | opts ^. #rerun =
       refuse
         [ "✗ --mark-applied and --rerun cannot be combined.",
@@ -632,6 +641,7 @@
       pure (Just (fromMaybe unstatedNotApplicableReason firstLine))
 
 launchMigration ::
+  ResolvedPolicy ->
   Bool ->
   -- | built once per command, so every migration edge appends to one destination
   TraceSink ->
@@ -646,7 +656,7 @@
   Int ->
   BlueprintMigrationStep ->
   IO (Either BlueprintMigrationLaunchFailure BlueprintMigrationLaunchResult)
-launchMigration batchMode traceSink modelConfig opts preparedByOwner signalPath renderStep position total step = do
+launchMigration policy batchMode traceSink modelConfig opts preparedByOwner signalPath renderStep position total step = do
   TIO.putStrLn $
     "Running blueprint migration "
       <> stepLabel
@@ -654,23 +664,34 @@
       <> formatMigrationStepLabel step
       <> (if batchMode then " (batch)" else " (interactive)")
   hFlush stdout
-  clearNotApplicableSignal signalPath
   let systemPrompt = renderStep position total step
   case Map.lookup (step ^. #owner) preparedByOwner of
     Nothing -> pure (Left (BlueprintMigrationProviderFailure (missingOwnerMessage step)))
-    Just prepared -> case modelConfig ^. #provider of
-      AgentProviderClaudeCli -> launchCli prepared systemPrompt
-      AgentProviderCodexCli -> launchCli prepared systemPrompt
-      AgentProviderAnthropic -> launchCompletion systemPrompt
-      AgentProviderOpenAI -> launchCompletion systemPrompt
+    Just prepared -> do
+      launched <- withCodexPolicy policy modelConfig (prepared ^. #mountedFilesDir) $ \reviewed -> do
+        createDirectoryIfMissing True (takeDirectory signalPath)
+        clearNotApplicableSignal signalPath
+        case modelConfig ^. #provider of
+          AgentProviderClaudeCli -> launchCli reviewed prepared systemPrompt
+          AgentProviderCodexCli -> launchCli reviewed prepared systemPrompt
+          AgentProviderAnthropic -> launchCompletion systemPrompt
+          AgentProviderOpenAI -> launchCompletion systemPrompt
+      pure (either (Left . BlueprintMigrationProviderFailure) id launched)
   where
-    launchCli prepared systemPrompt
+    launchCli reviewed prepared systemPrompt
       | batchMode =
-          finishCompletion $
-            runAgentMigrationCompletionWithCliAccess
-              (maybeToList (prepared ^. #mountedFilesDir))
-              (prepared ^. #allowedTools)
-              (buildAgentCompletionRequestWith traceSink modelConfig systemPrompt (opts ^. #prompt))
+          verifyPolicyFile policy >>= \case
+            Left err -> pure (Left (BlueprintMigrationProviderFailure err))
+            Right () ->
+              let request = buildAgentCompletionRequestWith traceSink modelConfig systemPrompt (opts ^. #prompt)
+               in finishCompletion $ case reviewed of
+                    Just session -> runReviewedCodexCompletion session request
+                    Nothing ->
+                      runAgentMigrationCompletionWithCliAccess
+                        (settingsPath policy)
+                        (maybeToList (prepared ^. #mountedFilesDir))
+                        (prepared ^. #allowedTools)
+                        request
       | otherwise = launchInteractive prepared systemPrompt
 
     stepLabel = T.pack (show position) <> "/" <> T.pack (show total)
@@ -738,30 +759,35 @@
 -- afterwards finds it and crosses nothing twice. Recording under the invoking
 -- blueprint would make the same work look like two different edges.
 recordMigration ::
+  ResolvedPolicy ->
   FilePath ->
   -- | every blueprint this run loaded, keyed by name
   Map Text CohortBlueprint ->
   BlueprintMigrationStep ->
   MigrationOutcome ->
   IO (Either Text ())
-recordMigration manifestPath cohort step migrationOutcome =
+recordMigration policy manifestPath cohort step migrationOutcome =
   case Map.lookup (step ^. #owner) cohort of
     -- Unreachable: the step came out of a plan this cohort resolved.
     Nothing -> pure (Left (missingOwnerMessage step))
     Just owner -> do
       now <- getCurrentTime
-      recordAppliedBlueprintMigration
-        manifestPath
-        AppliedBlueprintMigration
-          { name = owner ^. #blueprint . #name,
-            origin = owner ^. #origin,
-            blueprintVersion = owner ^. #blueprint . #version,
-            fromVersion = step ^. #edge . #from,
-            toVersion = step ^. #edge . #to,
-            outcome = migrationOutcome,
-            appliedAt = now,
-            agentSessionId = Nothing
-          }
+      verifyPolicyFile policy >>= \case
+        Left err -> pure (Left err)
+        Right () ->
+          recordAppliedBlueprintMigration
+            manifestPath
+            AppliedBlueprintMigration
+              { name = owner ^. #blueprint . #name,
+                origin = owner ^. #origin,
+                blueprintVersion = owner ^. #blueprint . #version,
+                fromVersion = step ^. #edge . #from,
+                toVersion = step ^. #edge . #to,
+                outcome = migrationOutcome,
+                appliedAt = now,
+                agentSessionId = Nothing,
+                callerToolPolicy = policyEvidence policy
+              }
 
 handleRunResult :: LogLevel -> ModuleName -> BlueprintMigrationRunResult -> IO ()
 handleRunResult level blueprintName = \case
diff --git a/src-exe/Seihou/CLI/AgentRun.hs b/src-exe/Seihou/CLI/AgentRun.hs
--- a/src-exe/Seihou/CLI/AgentRun.hs
+++ b/src-exe/Seihou/CLI/AgentRun.hs
@@ -12,12 +12,14 @@
   )
 where
 
+import Baikai.Provider.OpenAI.ReviewedHooks (ReviewedCodexThread)
 import Control.Exception (IOException, displayException, try)
 import Control.Monad (forM_, unless, when)
 import Data.FileEmbed (embedFile)
 import Data.Generics.Labels ()
+import Data.IORef (newIORef, readIORef, writeIORef)
 import Data.Map.Strict qualified as Map
-import Data.Maybe (fromMaybe, maybeToList)
+import Data.Maybe (fromMaybe, isJust, maybeToList)
 import Data.Set qualified as Set
 import Data.Text qualified as T
 import Data.Text.Encoding qualified as TE
@@ -31,6 +33,7 @@
     buildAgentCompletionRequestWith,
     resolveAgentInitialPrompt,
     runAgentCompletionWithCliAccess,
+    runReviewedCodexCompletion,
   )
 import Seihou.CLI.AgentConfig
   ( PendingAgentConfig,
@@ -59,9 +62,24 @@
     prepareBlueprintExecution,
     varValueToText,
   )
+import Seihou.CLI.CallerToolPolicy
 import Seihou.CLI.CheckoutSync (renderCheckoutPlan)
+import Seihou.CLI.CommandExecution
+  ( CommandDisposition (..),
+    CommandExecutionError (..),
+    CommandPlan (..),
+    CommandPolicy (..),
+    PlannedCommand (..),
+    executeCommandPlanWithOutput,
+    expectedCommandReceipts,
+    finalizeCommandReceipts,
+    planCommands,
+    plannedCommandText,
+    setApplicationCommandReceipts,
+    withReceiptWithdrawal,
+  )
 import Seihou.CLI.Commands (BlueprintRunOpts (..))
-import Seihou.CLI.ManifestCapabilityUpgrade (prepareRecordedSeedOwnership)
+import Seihou.CLI.ManifestCapabilityUpgrade (prepareCallerToolPolicy, prepareRecordedSeedOwnership)
 import Seihou.CLI.Shared
   ( deriveNamespace,
     formatVarError,
@@ -76,7 +94,7 @@
 import Seihou.Core.ArtifactFiles (renderAmbiguousArtifact)
 import Seihou.Core.ArtifactOriginDetect (detectArtifactOrigin)
 import Seihou.Core.Checkout
-import Seihou.Core.CommandFingerprint (checkoutCommandsFromOperations)
+import Seihou.Core.CommandFingerprint (checkoutCommandsFromOperations, isCheckoutCommand)
 import Seihou.Core.Context (resolveContext)
 import Seihou.Core.Module (defaultSearchPaths, discoverRunnable)
 import Seihou.Core.Seed (renderSeedOwnershipError, replaceSelectedSeedClaims)
@@ -93,7 +111,7 @@
 import Seihou.Effect.ConsoleInterp (runConsole)
 import Seihou.Effect.Filesystem (createDirectoryIfMissing)
 import Seihou.Effect.FilesystemInterp (runFilesystem)
-import Seihou.Effect.Logger (logError, logInfo, logWarn)
+import Seihou.Effect.Logger (logDebug, logError, logInfo, logWarn)
 import Seihou.Effect.ManifestStore (readManifest, writeManifest)
 import Seihou.Effect.ManifestStoreInterp (runManifestStore)
 import Seihou.Effect.ProcessInterp (runProcessIO)
@@ -109,7 +127,7 @@
 import System.Environment (getEnvironment)
 import System.Exit (ExitCode (..), exitFailure, exitWith)
 import System.FilePath (takeDirectory, (</>))
-import System.IO (hIsTerminalDevice, stdin)
+import System.IO (hIsTerminalDevice, hPutStrLn, stderr, stdin)
 
 -- | The prompt template, embedded at compile time from data/blueprint-prompt.md.
 promptTemplate :: Text
@@ -143,7 +161,22 @@
           <> "'?"
     Left err -> exitErr level (renderModuleLoadError err)
 
-  unless (opts ^. #noBaseline) $ do
+  -- Finish provider/model/effort resolution now that the blueprint is loaded
+  -- and its launch declaration is known. This must precede the
+  -- providerCanMountFiles computation below, which depends on the final
+  -- provider.
+  modelConfig <-
+    resolveDeclaredAgentConfig
+      level
+      ("blueprint '" <> bp ^. #name . #unModuleName <> "'")
+      pending
+      (agentLaunchDeclaration (bp ^. #launch))
+
+  policy <- resolvePolicy (batch || debug) (modelConfig ^. #provider) (opts ^. #policy) >>= either (exitErr level) pure
+  unless debug $
+    preflightPolicyManifest (".seihou" </> "manifest.json") policy >>= either (exitErr level) pure
+
+  unless (debug || opts ^. #noBaseline) $ do
     paths <- defaultSearchPaths
     sourceCheck <- verifyDependencySources paths blueprintDir (bp ^. #baseModules)
     case sourceCheck of
@@ -158,7 +191,7 @@
   -- list. Resolving it here rather than inside 'applyBaseline' also means the
   -- Dhall evaluation happens exactly once.
   baselineComposition <-
-    if opts ^. #noBaseline || null (bp ^. #baseModules)
+    if debug || opts ^. #noBaseline || null (bp ^. #baseModules)
       then pure Nothing
       else Just <$> loadBaselineComposition level (bp ^. #baseModules)
 
@@ -171,29 +204,12 @@
   -- generate from, and nothing else: an artifact this run will not touch must
   -- not block it.
   --
-  -- The check runs in --debug too, unlike on the migrate path. --debug is a
-  -- true dry run for @agent migrate@ but not here: it skips only the provider
-  -- call, still applies the baseline at (c), and still records
-  -- applied-blueprint provenance below. Rewriting the manifest to name a
-  -- blueprint older than the one this project records is ADR 0003's opening
-  -- scenario exactly, so exempting debug would leave the hole this guard
-  -- exists to close.
-  enforceAgentArtifactGuard
-    (opts ^. #allowDowngrade)
-    (".seihou" </> "manifest.json")
-    [bp ^. #name]
-    (baselineComposedNames baselineComposition)
-
-  -- Finish provider/model/effort resolution now that the blueprint is loaded
-  -- and its launch declaration is known. This must precede the
-  -- providerCanMountFiles computation below, which depends on the final
-  -- provider.
-  modelConfig <-
-    resolveDeclaredAgentConfig
-      level
-      ("blueprint '" <> bp ^. #name . #unModuleName <> "'")
-      pending
-      (agentLaunchDeclaration (bp ^. #launch))
+  unless debug $
+    enforceAgentArtifactGuard
+      (opts ^. #allowDowngrade)
+      (".seihou" </> "manifest.json")
+      [bp ^. #name]
+      (baselineComposedNames baselineComposition)
 
   let providerCanMountFiles =
         modelConfig ^. #provider == AgentProviderClaudeCli
@@ -219,58 +235,68 @@
   let resolved = (prepared ^. #resolvedVariables)
       cliOverrides = Map.fromList [(VarName k, v) | (k, v) <- opts ^. #vars]
 
-  -- (c) Baseline.
-  baseline <-
-    if opts ^. #noBaseline
-      then pure BaselineSkipped
-      else case baselineComposition of
-        Nothing -> pure BaselineEmpty
-        Just composition -> applyBaseline level opts composition cliOverrides resolved
+  let run reviewed = do
+        -- (c) Baseline.
+        baseline <-
+          if opts ^. #noBaseline
+            then pure BaselineSkipped
+            else case baselineComposition of
+              Nothing | debug && not (null (bp ^. #baseModules)) -> pure (BaselinePreview (depModuleNames (bp ^. #baseModules)))
+              Nothing -> pure BaselineEmpty
+              Just composition -> applyBaseline level opts composition cliOverrides resolved
 
-  -- (d) Render the system prompt around the prepared shared body.
-  ctx <- gatherAgentContext
-  let systemPrompt = renderSystemPrompt ctx prepared baseline
+        -- (d) Render the system prompt around the prepared shared body.
+        ctx <- gatherAgentContext
+        let systemPrompt = renderSystemPrompt ctx prepared baseline
 
-  -- (f) Launch.
-  launchSucceeded <-
-    runRenderedAgentPromptMode
-      "blueprint"
-      debug
-      batch
-      modelConfig
-      (prepared ^. #allowedTools)
-      (prepared ^. #mountedFilesDir)
-      systemPrompt
-      (opts ^. #prompt)
+        -- (f) Launch.
+        verifyPolicyFile policy >>= either (exitErr level) pure
+        launchSucceeded <-
+          runRenderedAgentPromptMode
+            "blueprint"
+            reviewed
+            policy
+            debug
+            batch
+            modelConfig
+            (effectiveTools policy (prepared ^. #allowedTools))
+            (prepared ^. #mountedFilesDir)
+            systemPrompt
+            (opts ^. #prompt)
 
-  -- (g) Record the applied-blueprint provenance into
-  -- .seihou/manifest.json only after a successful provider response. In
-  -- debug mode, keep the previous successful dry-launch behavior by recording
-  -- after the rendered prompt is printed successfully.
-  when launchSucceeded $ do
+        pure (if launchSucceeded && not debug then Just baseline else Nothing)
+
+  recordedBaseline <-
+    if debug
+      then run Nothing
+      else withCodexPolicy policy modelConfig (prepared ^. #mountedFilesDir) run >>= either (exitErr level) pure
+  forM_ recordedBaseline $ \baseline -> do
+    verifyPolicyFile policy >>= either (exitErr level) pure
     now <- getCurrentTime
     -- Classify the blueprint's discovery directory into a portable origin, so
     -- the recorded entry names the artifact rather than a directory that means
     -- nothing on another developer's machine.
     projectRoot <- getCurrentDirectory
     blueprintOrigin <- detectArtifactOrigin projectRoot blueprintDir
-    let entry = appliedBlueprintFromOutcome bp blueprintOrigin baseline opts now
+    let entry = appliedBlueprintFromOutcome bp blueprintOrigin baseline opts now & #callerToolPolicy .~ policyEvidence policy
         manifestPath = ".seihou" </> "manifest.json"
     writeRes <- recordAppliedBlueprint manifestPath entry
     case writeRes of
       Right () -> pure ()
-      Left err ->
-        logIO level $
-          logError $
-            "Warning: agent succeeded but recording the applied-blueprint entry failed: "
-              <> err
+      Left err -> do
+        logIO level $ logError ("The agent may already have edited files. Recording the blueprint receipt failed: " <> err <> ". Inspect the working diff and manifest before retrying.")
+        when (isJust (policyEvidence policy)) exitFailure
 
 runRenderedAgentPrompt :: Bool -> AgentModelConfig -> [String] -> Maybe FilePath -> Text -> Maybe Text -> IO Bool
-runRenderedAgentPrompt debug = runRenderedAgentPromptMode "agent" debug False
+runRenderedAgentPrompt debug = runRenderedAgentPromptMode "agent" Nothing emptyPolicy debug False
 
-runRenderedAgentPromptMode :: Text -> Bool -> Bool -> AgentModelConfig -> [String] -> Maybe FilePath -> Text -> Maybe Text -> IO Bool
-runRenderedAgentPromptMode sessionName debug batch modelConfig tools mFilesDir systemPrompt initialPrompt
+runRenderedAgentPromptMode :: Text -> Maybe ReviewedCodexThread -> ResolvedPolicy -> Bool -> Bool -> AgentModelConfig -> [String] -> Maybe FilePath -> Text -> Maybe Text -> IO Bool
+runRenderedAgentPromptMode sessionName reviewed policy debug batch modelConfig tools mFilesDir systemPrompt initialPrompt
   | debug = do
+      when (sessionName == "blueprint" && modelConfig ^. #provider == AgentProviderClaudeCli) $ do
+        TIO.putStrLn ("Preapproved tools: " <> T.intercalate ", " (map T.pack tools))
+        TIO.putStrLn (if isJust (settingsPath policy) then "Caller settings supplied." else "No caller settings supplied.")
+      when (isJust (codexHooksPath policy)) (TIO.putStrLn "Caller Codex hooks supplied.")
       TIO.putStr systemPrompt
       forM_ (resolveAgentInitialPrompt (modelConfig ^. #provider) initialPrompt) $ \instruction -> do
         TIO.putStrLn "\n===== Initial user instruction ====="
@@ -294,11 +320,10 @@
         ExitFailure _ -> exitWith exitCode
   | otherwise = do
       sink <- traceSinkForConfig LogNormal modelConfig
-      result <-
-        runAgentCompletionWithCliAccess
-          (maybeToList mFilesDir)
-          tools
-          (buildAgentCompletionRequestWith sink modelConfig systemPrompt initialPrompt)
+      let request = buildAgentCompletionRequestWith sink modelConfig systemPrompt initialPrompt
+      result <- case reviewed of
+        Just session -> runReviewedCodexCompletion session request
+        Nothing -> runAgentCompletionWithCliAccess (settingsPath policy) (maybeToList mFilesDir) tools request
       case result of
         Right assistantText -> do
           TIO.putStrLn assistantText
@@ -321,13 +346,15 @@
       appliedAt = now,
       baselineModules = case baseline of
         BaselineApplied entries -> map fst entries
+        BaselinePreview _ -> []
         BaselineEmpty -> []
         BaselineSkipped -> [],
       noBaseline = case baseline of
         BaselineSkipped -> True
         _ -> False,
       userPrompt = opts ^. #prompt,
-      agentSessionId = Nothing
+      agentSessionId = Nothing,
+      callerToolPolicy = Nothing
     }
 
 -- | One resolved baseline composition: the primary base module, and every
@@ -455,7 +482,7 @@
     Left err -> do
       logIO level $ logError $ "Error reading manifest: " <> err
       exitFailure
-    Right m -> pure (fromMaybe (emptyManifest now) m)
+    Right m -> either (exitErr level) pure (prepareCallerToolPolicy (fromMaybe (emptyManifest now) m))
 
   case validateSeedRun manifest ops of
     Left errors -> mapM_ (logIO level . logError . (^. #message)) errors >> exitFailure
@@ -464,7 +491,30 @@
       applicationId = mkApplicationId appliedTarget []
       primaryOrigins = [(origin, m ^. #version) | (inst, m, origin) <- originedModules, inst ^. #module_ == primary]
       (primaryOrigin, primaryVersion) = case primaryOrigins of pair : _ -> pair; [] -> (LocalOrigin (primary ^. #unModuleName), Nothing)
-      seedApplication = buildAppliedComposition appliedTarget primaryOrigin primaryVersion [] (Just namespace) context originedModules baseResolved now & #checkoutCommands .~ checkoutCommandsFromOperations ops
+      -- The baseline's command phase follows 'seihou run': plan every command
+      -- of the complete compiled composition (before conflict filtering) to
+      -- run, against the receipts this application already holds. The
+      -- receipts a successful phase earns are published with the generated
+      -- files, and the failure map is what the manifest falls back to if the
+      -- phase fails. See
+      -- docs/adr/0023-command-receipts-are-published-before-the-command-phase-runs.md.
+      priorCommandReceipts =
+        case [ application ^. #commandReceipts
+             | application <- manifest ^. #applications,
+               application ^. #applicationId == applicationId
+             ] of
+          receipts : _ -> receipts
+          [] -> Map.empty
+      commandPlan = planCommands RunAllCommands priorCommandReceipts ops
+      failureCommandReceipts = finalizeCommandReceipts commandPlan [] priorCommandReceipts
+      expectedCommandReceiptMap =
+        finalizeCommandReceipts commandPlan (expectedCommandReceipts now commandPlan) priorCommandReceipts
+      seedApplication =
+        buildAppliedComposition appliedTarget primaryOrigin primaryVersion [] (Just namespace) context originedModules baseResolved now
+          & #checkoutCommands
+          .~ checkoutCommandsFromOperations ops
+          & #commandReceipts
+          .~ expectedCommandReceiptMap
   searchPaths <- defaultSearchPaths
   let legacyPaths = Set.fromList [path | (path, receipt) <- Map.toAscList (manifest ^. #seeds), case receipt ^. #ownership of LegacySeedOwners apps -> Set.member applicationId apps || Map.member path seedOwnerMap; _ -> False]
   preparedSeeds <- prepareRecordedSeedOwnership projectRoot searchPaths legacyPaths manifest
@@ -597,6 +647,18 @@
           logIO level $ logWarn $ "Warning: could not prune generated baselines: " <> T.pack (displayException err)
         Right _ -> pure ()
 
+      runBaselineCommands
+        level
+        (opts ^. #name)
+        manifestPath
+        applicationId
+        now
+        commandPlan
+        priorCommandReceipts
+        failureCommandReceipts
+        expectedCommandReceiptMap
+        newManifest
+
       let nNew = length (diff ^. #new)
           nMod = length (diff ^. #modified)
           nUnch = length (diff ^. #unchanged)
@@ -612,6 +674,127 @@
       pure $
         BaselineApplied
           [(m ^. #name, m ^. #version) | (_, m, _) <- modulesInOrder]
+
+-- | Run the baseline's command phase after its files, seeds, and checkout
+-- outputs are applied and the manifest carrying the expected receipts is
+-- saved. Mirrors the command block of @Seihou.CLI.Run.handleRun@, except that
+-- everything it prints goes to standard error: @agent run --batch@ reserves
+-- standard output for the provider's response and @--debug@ prints the
+-- rendered prompt there.
+--
+-- On a failed or interrupted phase only this application's receipts are
+-- rewritten, to @failureReceipts@, in @savedManifest@; the files and
+-- declarations already applied stay. A failure exits 1 before the provider
+-- launches.
+runBaselineCommands ::
+  LogLevel ->
+  ModuleName ->
+  FilePath ->
+  ApplicationId ->
+  UTCTime ->
+  CommandPlan ->
+  Map CommandFingerprint CommandReceipt ->
+  Map CommandFingerprint CommandReceipt ->
+  Map CommandFingerprint CommandReceipt ->
+  Manifest ->
+  IO ()
+runBaselineCommands level blueprintName manifestPath applicationId now commandPlan priorReceipts failureReceipts expectedReceipts savedManifest = do
+  let runnable = filter ((== CommandWillRun) . (^. #disposition)) (commandPlan ^. #commands)
+      blueprint = blueprintName ^. #unModuleName
+      say = hPutStrLn stderr . T.unpack
+  unless (null runnable) $ do
+    -- Command output is captured rather than streamed, so without this line a
+    -- slow command looks like a hang. It is shown at every verbosity.
+    say ("Running " <> T.pack (show (length runnable)) <> " baseline command(s)...")
+    forM_ runnable $ \planned ->
+      logIO level (logDebug ("  run  " <> plannedCommandText planned))
+    let receiptsPublished = expectedReceipts /= failureReceipts
+    -- Nothing: no withdrawal was needed or attempted; Just ok: whether it
+    -- succeeded. withReceiptWithdrawal discards an exception the withdrawal
+    -- throws, so a failure is recorded and reported here.
+    withdrawal <- newIORef Nothing
+    let withdrawReceipts = when receiptsPublished $ do
+          attempt <-
+            try @IOException $
+              runEff $
+                runFilesystem $
+                  runManifestStore manifestPath $
+                    writeManifest (setApplicationCommandReceipts applicationId failureReceipts savedManifest)
+          case attempt of
+            Left err -> do
+              logIO level $
+                logError $
+                  "Could not withdraw this run's command receipts from "
+                    <> T.pack manifestPath
+                    <> ": "
+                    <> T.pack (displayException err)
+              writeIORef withdrawal (Just False)
+            Right () -> writeIORef withdrawal (Just True)
+    commandResult <-
+      withReceiptWithdrawal withdrawReceipts $
+        runEff $
+          runProcessIO $
+            executeCommandPlanWithOutput
+              now
+              (\_ commandStdout _ -> unless (T.null commandStdout) (liftIO (TIO.hPutStr stderr commandStdout)))
+              commandPlan
+    case commandResult of
+      Left commandError -> do
+        let failed = commandError ^. #command
+            operation = failed ^. #operation
+            (owner, directory) = case operation of
+              RunCommandOp {moduleName, workDir} -> (moduleName ^. #unModuleName, maybe "." T.pack workDir)
+              _ -> ("(unknown)", ".")
+        unless (T.null (commandError ^. #stdout)) $ TIO.hPutStr stderr (commandError ^. #stdout)
+        unless (T.null (commandError ^. #stderr)) $ TIO.hPutStr stderr (commandError ^. #stderr)
+        logIO level $
+          logError $
+            "Baseline command failed (exit "
+              <> T.pack (show (commandError ^. #exitCode))
+              <> "): "
+              <> plannedCommandText failed
+        say ("  module: " <> owner)
+        say ("  directory: " <> directory)
+        say "The agent was not started. Baseline files and the effects of earlier commands remain; inspect them before retrying."
+        when (isCheckoutCommand operation) $
+          say "Accepted checkout declarations remain recorded; seihou sync retries their checkout commands."
+        withdrawn <- readIORef withdrawal
+        case withdrawn of
+          Just True ->
+            say
+              ( "The command receipts this run published in advance were withdrawn from "
+                  <> T.pack manifestPath
+                  <> ". If a command in this run committed or pushed the manifest, that snapshot records receipts for commands that did not complete; commit the result of the successful rerun."
+              )
+          Just False ->
+            say
+              ( T.pack manifestPath
+                  <> " may still hold provisional receipts for commands that did not complete; a successful rerun replaces them."
+              )
+          Nothing -> pure ()
+        say ("Correct the failure, then rerun: seihou agent run " <> blueprint)
+        say ("To start the agent without applying the baseline again: seihou agent run " <> blueprint <> " --no-baseline")
+        exitFailure
+      Right completed -> do
+        -- The receipts were published before the phase. Rewrite the manifest
+        -- only if the phase's actual receipts differ from that expectation,
+        -- which would indicate a bug in expectedCommandReceipts.
+        let finalReceipts = finalizeCommandReceipts commandPlan completed priorReceipts
+        if finalReceipts == expectedReceipts
+          then logIO level (logDebug "Command receipts published before the baseline command phase were confirmed.")
+          else do
+            logIO level (logDebug "Command receipts differed from those published before the baseline command phase; rewriting the manifest.")
+            attempt <-
+              try @IOException $
+                runEff $
+                  runFilesystem $
+                    runManifestStore manifestPath $
+                      writeManifest (setApplicationCommandReceipts applicationId finalReceipts savedManifest)
+            case attempt of
+              Left err -> do
+                logIO level $ logError $ "Baseline commands succeeded but their receipts could not be recorded: " <> T.pack (displayException err)
+                exitFailure
+              Right () -> pure ()
 
 -- | Stitch the system-prompt template together. Each block in
 -- @blueprint-prompt.md@ has a @{{key}}@ placeholder filled here.
diff --git a/src-exe/Seihou/CLI/Commands.hs b/src-exe/Seihou/CLI/Commands.hs
--- a/src-exe/Seihou/CLI/Commands.hs
+++ b/src-exe/Seihou/CLI/Commands.hs
@@ -58,6 +58,7 @@
 import Data.Text qualified as T
 import Options.Applicative
 import Options.Applicative.Help.Pretty (Doc, indent, line, pretty, vsep)
+import Seihou.CLI.CallerToolPolicy (CallerPolicyOptions (..))
 import Seihou.CLI.Extension (ExtensionRunOpts (..))
 import Seihou.CLI.Help (HelpCommand, helpCommandParser)
 import Seihou.CLI.Judgement.Validate (activeJudgementNames, discoverJudgementNames)
@@ -146,6 +147,7 @@
   | AgentSetup SetupOpts
   | AgentRun BlueprintRunOpts
   | AgentMigrate BlueprintMigrationOpts
+  | AgentReviewCodexHooks FilePath
   | AgentUpgrade AgentUpgradeOpts
   | AgentModels AgentModelsOpts
   | AgentConfigShow
@@ -476,6 +478,7 @@
     verbose :: !Bool,
     force :: !Bool,
     batch :: !Bool,
+    policy :: !CallerPolicyOptions,
     provider :: !(Maybe Text),
     model :: !(Maybe Text),
     effort :: !(Maybe Text),
@@ -500,6 +503,7 @@
     context :: !(Maybe Text),
     verbose :: !Bool,
     batch :: !Bool,
+    policy :: !CallerPolicyOptions,
     rerun :: !Bool,
     -- | When 'True', record a receipt for every pending step in the window
     -- without starting an agent session, on the user's assertion that the
@@ -1803,7 +1807,7 @@
   info
     (syncVersionsParser <**> helper)
     ( fullDesc
-        <> progDesc "Populate registry entry versions from each module/recipe/blueprint/prompt"
+        <> progDesc "Populate registry entry versions from their artifact definitions"
         <> footerDoc
           ( Just $
               vsep
@@ -1884,8 +1888,8 @@
                   pretty ("anthropic, or openai, and --model for a provider-specific model." :: String),
                   pretty ("Run 'seihou agent models' to list known model choices." :: String),
                   line,
-                  pretty ("Use --debug with any subcommand to print the resolved system" :: String),
-                  pretty ("prompt without contacting the configured provider." :: String),
+                  pretty ("Use --debug with prompt-rendering subcommands to inspect" :: String),
+                  pretty ("the resolved system prompt without contacting a provider." :: String),
                   line,
                   pretty ("Available subcommands:" :: String),
                   indent 2 $
@@ -1895,6 +1899,7 @@
                         pretty ("setup       Guided project setup: configure, run, and commit" :: String),
                         pretty ("run         Run an agent-driven blueprint" :: String),
                         pretty ("migrate     Run ordered library-upgrade blueprint migrations" :: String),
+                        pretty ("review-codex-hooks  Review Codex PreToolUse commands in a terminal" :: String),
                         pretty ("upgrade     Upgrade a module with an agent that repairs manifest state" :: String),
                         pretty ("models      List known agent models" :: String),
                         pretty ("config      Inspect resolved per-command agent settings" :: String)
@@ -1936,6 +1941,12 @@
         <> command "setup" agentSetupInfo
         <> command "run" agentRunInfo
         <> command "migrate" agentMigrateInfo
+        <> command
+          "review-codex-hooks"
+          ( info
+              ((AgentReviewCodexHooks <$> strArgument (metavar "FILE")) <**> helper)
+              (progDesc "Review the native Codex PreToolUse commands in FILE")
+          )
         <> command "upgrade" agentUpgradeInfo
         <> command "models" agentModelsInfo
         <> command "config" agentConfigInfo
@@ -2117,6 +2128,8 @@
                   pretty ("optionally applies the blueprint's baseModules as a starting scaffold," :: String),
                   pretty ("renders the prompt template, and starts the configured" :: String),
                   pretty ("provider. CLI sessions start their first turn automatically and stay open for follow-up input." :: String),
+                  pretty ("The baseline writes its modules' files, then runs their commands, before" :: String),
+                  pretty ("the provider starts; a failing command stops the run without starting it." :: String),
                   pretty ("Baseline seeds are created once; edits and deletion survive --force." :: String),
                   pretty ("Lifecycle changes require seihou update <recorded-target>." :: String),
                   line,
@@ -2124,9 +2137,9 @@
                   pretty ("CLI overrides > env > local config > namespace > context > global > defaults" :: String),
                   pretty ("> interactive prompts." :: String),
                   line,
-                  pretty ("Pass --no-baseline to skip baseline application; --debug (on the parent" :: String),
-                  pretty ("'seihou agent --debug') prints the resolved system prompt without" :: String),
-                  pretty ("contacting the configured provider." :: String),
+                  pretty ("Pass --no-baseline to skip baseline application, files and commands;" :: String),
+                  pretty ("Parent --debug prints the resolved prompt and lists declared baseline modules." :: String),
+                  pretty ("It leaves project files and the manifest untouched." :: String),
                   pretty ("Pass --batch to use a non-interactive CLI provider; Seihou selects" :: String),
                   pretty ("batch mode automatically when stdin is not a terminal." :: String),
                   line,
@@ -2137,13 +2150,20 @@
                         pretty ("seihou agent run my-blueprint \"set this up for billing\"" :: String),
                         pretty ("seihou agent run my-blueprint --var service.name=billing" :: String),
                         pretty ("seihou agent run my-blueprint --no-baseline" :: String),
-                        pretty ("seihou agent run my-blueprint --batch" :: String),
+                        pretty ("seihou agent run my-blueprint --batch --allowed-tool 'Bash(grep *)'" :: String),
                         pretty ("seihou agent --debug run my-blueprint" :: String)
                       ]
                 ]
           )
     )
 
+callerPolicyParser :: Parser CallerPolicyOptions
+callerPolicyParser =
+  CallerPolicyOptions
+    <$> many (strOption (long "allowed-tool" <> metavar "PATTERN" <> help "Preapprove one Claude tool pattern for this batch invocation (repeatable), e.g. 'Bash(grep *)'"))
+    <*> optional (strOption (long "settings" <> metavar "FILE" <> help "Load this Claude JSON settings file, including its hooks, for this batch invocation"))
+    <*> optional (strOption (long "codex-hooks" <> metavar "FILE" <> help "Use reviewed Codex PreToolUse hooks for this batch invocation"))
+
 agentRunParser :: Parser AgentCommand
 agentRunParser =
   fmap AgentRun $
@@ -2155,12 +2175,13 @@
             varPair
             (long "var" <> metavar "KEY=VALUE" <> help "Variable override (repeatable)")
         )
-      <*> switch (long "no-baseline" <> help "Skip applying the blueprint's baseModules before rendering the prompt")
+      <*> switch (long "no-baseline" <> help "Skip applying the blueprint's baseModules, their files and commands, before rendering the prompt")
       <*> optional (option (T.pack <$> str) (long "namespace" <> metavar "NS" <> help "Override namespace for config lookup"))
       <*> optional (option (T.pack <$> str) (long "context" <> short 'c' <> metavar "CTX" <> help "Override context for config lookup"))
       <*> switch (long "verbose" <> short 'v' <> help "Show detailed progress messages")
       <*> switch (long "force" <> help "Accept generated managed baseline files on conflicts; preserve seeds")
       <*> switch (long "batch" <> help "Run a non-interactive CLI provider (automatic when stdin is not a terminal)")
+      <*> callerPolicyParser
       <*> providerOption
       <*> modelOption
       <*> effortOption
@@ -2202,7 +2223,7 @@
                   indent 2 $
                     vsep
                       [ pretty ("seihou agent migrate my-library" :: String),
-                        pretty ("seihou agent migrate my-library --from 1.0.0 --to 3.0.0" :: String),
+                        pretty ("seihou agent migrate my-library --from 1.0.0 --to 3.0.0 --batch --settings ./campaign/claude-settings.json" :: String),
                         pretty ("seihou agent migrate my-library --from 1 --to 3 --rerun" :: String),
                         pretty ("seihou agent --debug migrate my-library --to 3.0.0" :: String)
                       ]
@@ -2241,6 +2262,7 @@
       <*> optional (option (T.pack <$> str) (long "context" <> short 'c' <> metavar "CTX" <> help "Override context for config lookup"))
       <*> switch (long "verbose" <> short 'v' <> help "Show detailed progress messages")
       <*> switch (long "batch" <> help "Run non-interactively (automatic when stdin is not a terminal)")
+      <*> callerPolicyParser
       <*> switch (long "rerun" <> help "Run matching migrations even when a receipt already exists")
       <*> switch
         ( long "mark-applied"
diff --git a/src-exe/Seihou/CLI/Run.hs b/src-exe/Seihou/CLI/Run.hs
--- a/src-exe/Seihou/CLI/Run.hs
+++ b/src-exe/Seihou/CLI/Run.hs
@@ -26,6 +26,8 @@
     expectedCommandReceipts,
     finalizeCommandReceipts,
     planCommands,
+    plannedCommandText,
+    setApplicationCommandReceipts,
     withReceiptWithdrawal,
   )
 import Seihou.CLI.Commands (RunOpts (..))
@@ -865,26 +867,6 @@
 operationDestination (CopyFileOp _ dest) = Just dest
 operationDestination (PatchFileOp dest _ _ _ _) = Just dest
 operationDestination _ = Nothing
-
-plannedCommandText :: PlannedCommand -> Text
-plannedCommandText planned = case planned ^. #operation of
-  RunCommandOp {command} -> command
-  _ -> "<non-command operation>"
-
-setApplicationCommandReceipts ::
-  ApplicationId ->
-  Map CommandFingerprint CommandReceipt ->
-  Manifest ->
-  Manifest
-setApplicationCommandReceipts applicationId receipts manifest =
-  manifest
-    & #applications
-    %~ map updateApplication
-  where
-    updateApplication application
-      | application ^. #applicationId == applicationId =
-          application & #commandReceipts .~ receipts
-      | otherwise = application
 
 -- | Apply the pending-migration policy.
 --
diff --git a/src/Seihou/CLI/AgentCompletion.hs b/src/Seihou/CLI/AgentCompletion.hs
--- a/src/Seihou/CLI/AgentCompletion.hs
+++ b/src/Seihou/CLI/AgentCompletion.hs
@@ -19,6 +19,7 @@
     runAgentCompletion,
     runAgentCompletionWithCliAccess,
     runAgentMigrationCompletionWithCliAccess,
+    runReviewedCodexCompletion,
     resolveAgentInitialPrompt,
     migrationAllowedTools,
     runAgentCompletionWith,
@@ -33,6 +34,8 @@
 import Baikai.Provider.Claude.Cli qualified as ClaudeCli
 import Baikai.Provider.OpenAI.Api qualified as OpenAIApi
 import Baikai.Provider.OpenAI.Cli qualified as CodexCli
+import Baikai.Provider.OpenAI.HookEvidence (CodexPreToolUse (..))
+import Baikai.Provider.OpenAI.ReviewedHooks (CodexHookTurn (..), ReviewedCodexThread)
 import Baikai.Response qualified as BaikaiResponse
 import Baikai.ThinkingLevel (ThinkingLevel (..), renderThinkingLevel)
 import Baikai.Trace qualified as BaikaiTrace
@@ -42,13 +45,13 @@
 import Data.ByteString (ByteString)
 import Data.Generics.Labels ()
 import Data.List (nub)
-import Data.Maybe (fromMaybe)
+import Data.Maybe (fromMaybe, isNothing)
 import Data.Text (Text)
 import Data.Text qualified as Text
 import Data.Text.Encoding qualified as TE
 import Data.Vector qualified as V
 import GHC.Generics (Generic)
-import Seihou.CLI.AgentMigrationProtocol (batchRunRefusals, validateBatchRunOutput, validateMigrationOutput)
+import Seihou.CLI.AgentMigrationProtocol (batchRunRefusals, validateBatchRunOutputWithDetails, validateMigrationOutputWithDetails)
 import Seihou.CLI.KitConfig (seihouKitConfig)
 import System.Directory (getCurrentDirectory)
 import System.Exit (ExitCode (..))
@@ -268,8 +271,8 @@
 -- unattended run cannot approve tools, so a refusal is work the blueprint
 -- expected and did not get. Its response carries zero usage, so a trace of
 -- such a run has no token counts. Other providers are unchanged.
-runAgentCompletionWithCliAccess :: [FilePath] -> [String] -> AgentCompletionRequest -> IO (Either Text Text)
-runAgentCompletionWithCliAccess extraDirs tools req =
+runAgentCompletionWithCliAccess :: Maybe FilePath -> [FilePath] -> [String] -> AgentCompletionRequest -> IO (Either Text Text)
+runAgentCompletionWithCliAccess settings extraDirs tools req =
   case req ^. #modelConfig . #provider of
     AgentProviderClaudeCli ->
       runAgentCompletionUsing
@@ -277,10 +280,10 @@
         ( registerValidatedCli
             Baikai.AnthropicMessagesCli
             AgentProviderClaudeCli
-            (claudeAccessArgs extraDirs tools)
+            (claudeSettingsArgs settings <> claudeAccessArgs extraDirs tools)
             []
             batchRunExitFailure
-            validateBatchRunOutput
+            (validateBatchRunOutputWithDetails (isNothing settings))
         )
         req
     _ -> runAgentCompletionWith (registerAgentProvidersWithCliAccess extraDirs tools) req
@@ -289,7 +292,7 @@
     -- more useful explanation, so report them when stdout has any.
     batchRunExitFailure exe n out err =
       fromMaybe
-        (Text.pack exe <> " exited " <> Text.pack (show n) <> ": " <> Text.take 2000 (Text.strip (Text.pack err <> Text.pack out)))
+        (Text.pack exe <> " exited " <> Text.pack (show n) <> maybe (": " <> Text.take 2000 (Text.strip (Text.pack err <> Text.pack out))) (const ". Check the caller settings and inspect partial edits before retrying.") settings)
         (batchRunRefusals (TE.encodeUtf8 (Text.pack out)))
 
 -- | The shared implementation behind 'runAgentCompletion' and
@@ -337,6 +340,30 @@
               then Left "Provider returned no assistant text."
               else Right body
 
+-- | Use the same completion and trace path with a checked Codex thread.
+-- A successful terminal turn supplies positive completion evidence. An
+-- ordinary command failure inside that turn is distinct from a refusal.
+runReviewedCodexCompletion :: ReviewedCodexThread -> AgentCompletionRequest -> IO (Either Text Text)
+runReviewedCodexCompletion session =
+  runAgentCompletionUsing (^. #message) $
+    Baikai.registerApiProvider $
+      Baikai.apiProviderWith Baikai.OpenAICompletionsCli (Baikai.liftCompleteToStream complete) complete
+  where
+    complete m ctx opts = do
+      result <- CodexCli.completeReviewedCodexCli session ctx opts
+      either (throwIO . Baikai.providerError) pure $ do
+        turn <- result
+        case blockedHooks turn of
+          [] -> pure (validatedResponse m (answer turn))
+          blocked ->
+            Left
+              ( "Codex PreToolUse blocked "
+                  <> Text.pack (show (length blocked))
+                  <> " tool call(s): "
+                  <> Text.intercalate ", " (map runId blocked)
+                  <> ". Inspect the working diff and the caller's gate decisions before retrying."
+              )
+
 responseText :: Baikai.Response -> Text
 responseText =
   Text.intercalate "\n"
@@ -375,11 +402,14 @@
   ClaudeApi.register
   OpenAIApi.register
 
+claudeSettingsArgs :: Maybe FilePath -> [Text]
+claudeSettingsArgs = maybe [] (\path -> ["--settings", Text.pack path])
+
 claudeAccessArgs :: [FilePath] -> [String] -> [Text]
 claudeAccessArgs extraDirs tools =
   ( if null tools
       then []
-      else ["--allowedTools", Text.intercalate "," (map Text.pack tools)]
+      else "--allowedTools" : map Text.pack tools
   )
     <> concatMap (\dir -> ["--add-dir", Text.pack dir]) extraDirs
 
@@ -404,8 +434,8 @@
 -- | A migration must retain raw process/protocol failures until classification.
 -- Register this narrow adapter behind the usual trace wrapper, so it emits to
 -- the command's existing sink and ordinary completion callers remain unchanged.
-runAgentMigrationCompletionWithCliAccess :: [FilePath] -> [String] -> AgentCompletionRequest -> IO (Either Text Text)
-runAgentMigrationCompletionWithCliAccess dirs tools req =
+runAgentMigrationCompletionWithCliAccess :: Maybe FilePath -> [FilePath] -> [String] -> AgentCompletionRequest -> IO (Either Text Text)
+runAgentMigrationCompletionWithCliAccess settings dirs tools req =
   case provider of
     AgentProviderClaudeCli -> runStrict Baikai.AnthropicMessagesCli
     AgentProviderCodexCli -> runStrict Baikai.OpenAICompletionsCli
@@ -419,14 +449,15 @@
         ( registerValidatedCli
             api
             provider
-            (["--permission-mode", "acceptEdits"] <> claudeAccessArgs dirs (migrationAllowedTools tools))
+            (["--permission-mode", "acceptEdits"] <> claudeSettingsArgs settings <> claudeAccessArgs dirs (migrationAllowedTools tools))
             (codexAccessArgs dirs <> sessionArgs)
             migrationExitFailure
-            (validateMigrationOutput (provider == AgentProviderClaudeCli))
+            (validateMigrationOutputWithDetails (isNothing settings) (provider == AgentProviderClaudeCli))
         )
         req
-    migrationExitFailure exe n out err =
-      Text.pack exe <> " exited " <> Text.pack (show n) <> ": " <> Text.take 2000 (Text.pack err <> Text.pack out) <> ". Inspect partial edits, fix the provider error, then retry."
+    migrationExitFailure exe n out err
+      | provider == AgentProviderClaudeCli, Just refusal <- batchRunRefusals (TE.encodeUtf8 (Text.pack out)) = refusal
+      | otherwise = Text.pack exe <> " exited " <> Text.pack (show n) <> ": " <> maybe (Text.take 2000 (Text.pack err <> Text.pack out)) (const "check caller settings") settings <> ". Inspect partial edits, fix the provider error, then retry."
 
 -- | Register a narrow adapter for a local CLI provider that runs the process
 -- itself and validates its raw stdout, so evidence Baikai's stock provider
@@ -481,20 +512,22 @@
                 ExitSuccess -> validate (TE.encodeUtf8 (Text.pack out))
         case result of
           Left err -> throwIO (Baikai.providerError err)
-          Right body ->
-            pure $
-              BaikaiResponse.emptyResponse
-                { BaikaiResponse.model = m,
-                  BaikaiResponse.message =
-                    Baikai.AssistantPayload
-                      { Baikai.content = V.singleton (Baikai.AssistantText (Baikai.TextContent body)),
-                        Baikai.usage = Baikai.zeroUsage,
-                        Baikai.stopReason = Baikai.Stop,
-                        Baikai.errorMessage = Nothing,
-                        Baikai.timestamp = Nothing
-                      }
-                }
+          Right body -> pure (validatedResponse m body)
   Baikai.registerApiProvider (Baikai.apiProviderWith api (Baikai.liftCompleteToStream complete) complete)
+
+validatedResponse :: Baikai.Model -> Text -> Baikai.Response
+validatedResponse m body =
+  BaikaiResponse.emptyResponse
+    { BaikaiResponse.model = m,
+      BaikaiResponse.message =
+        Baikai.AssistantPayload
+          { Baikai.content = V.singleton (Baikai.AssistantText (Baikai.TextContent body)),
+            Baikai.usage = Baikai.zeroUsage,
+            Baikai.stopReason = Baikai.Stop,
+            Baikai.errorMessage = Nothing,
+            Baikai.timestamp = Nothing
+          }
+    }
 
 -- | Source discovery is part of the ordinary migration workflow. Keep grants
 -- specific to read-only Mori commands; registry writes are never implied.
diff --git a/src/Seihou/CLI/AgentGuard.hs b/src/Seihou/CLI/AgentGuard.hs
--- a/src/Seihou/CLI/AgentGuard.hs
+++ b/src/Seihou/CLI/AgentGuard.hs
@@ -61,15 +61,7 @@
 -- nothing to do with it; that is the line ADR 0003 draws for @seihou run@ and
 -- this holds it for the agent path.
 --
--- Whether @--debug@ exempts a command from this check is the caller's
--- decision, and the two agent commands answer differently because @--debug@
--- means different things to them. It is a true dry run for @seihou agent
--- migrate@, which prints its pending prompts and writes nothing, so that
--- command skips the check and stays usable for inspecting a prompt on a
--- machine that has never installed the artifact. It is not a dry run for
--- @seihou agent run@, which still applies the blueprint's baseline and still
--- records applied-blueprint provenance under debug, so that command checks
--- unconditionally.
+-- Both blueprint debug commands skip this guard for read-only inspection.
 enforceAgentArtifactGuard ::
   -- | @--allow-downgrade@
   Bool ->
diff --git a/src/Seihou/CLI/AgentLaunch.hs b/src/Seihou/CLI/AgentLaunch.hs
--- a/src/Seihou/CLI/AgentLaunch.hs
+++ b/src/Seihou/CLI/AgentLaunch.hs
@@ -222,6 +222,7 @@
     BaselineSkipped
   | -- | The blueprint declared no @baseModules@; nothing to apply.
     BaselineEmpty
+  | BaselinePreview [ModuleName]
   | -- | Baseline modules were applied. Each entry is the module's name and (optional) version.
     BaselineApplied [(ModuleName, Maybe Text)]
   deriving stock (Eq, Show)
@@ -241,6 +242,8 @@
 formatBaselineStatus :: BaselineStatus -> Text
 formatBaselineStatus BaselineSkipped =
   "(no baseline applied — `--no-baseline` was passed)"
+formatBaselineStatus (BaselinePreview modules) =
+  "Preview only. A real run applies these baseline modules: " <> T.intercalate ", " (map (^. #unModuleName) modules)
 formatBaselineStatus BaselineEmpty =
   "(this blueprint declares no base modules)"
 formatBaselineStatus (BaselineApplied entries) =
diff --git a/src/Seihou/CLI/AgentMigrationProtocol.hs b/src/Seihou/CLI/AgentMigrationProtocol.hs
--- a/src/Seihou/CLI/AgentMigrationProtocol.hs
+++ b/src/Seihou/CLI/AgentMigrationProtocol.hs
@@ -8,6 +8,8 @@
 module Seihou.CLI.AgentMigrationProtocol
   ( validateMigrationOutput,
     validateBatchRunOutput,
+    validateBatchRunOutputWithDetails,
+    validateMigrationOutputWithDetails,
     batchRunRefusals,
     renderPermissionDenials,
   )
@@ -27,7 +29,12 @@
 import Data.Vector qualified as V
 
 validateMigrationOutput :: Bool -> ByteString -> Either Text Text
-validateMigrationOutput claude bytes = case validate of
+validateMigrationOutput = validateMigrationOutputWithDetails True
+
+-- Provider error text can quote a settings file or its hook. Only return that
+-- detail when the caller did not supply private settings.
+validateMigrationOutputWithDetails :: Bool -> Bool -> ByteString -> Either Text Text
+validateMigrationOutputWithDetails includeDetails claude bytes = case validate of
   Left err -> Left (err <> " Inspect partial edits, check provider permissions/protocol support, then retry the same migration.")
   Right body -> Right body
   where
@@ -45,6 +52,7 @@
           require (field "is_error" value == Just (Bool False)) ("Claude reported an error or omitted is_error. " <> detail value)
           case field "permission_denials" value of
             Just (Array denials) | V.null denials -> pure ()
+            Just (Array denials) -> Left ("Claude reported permission denials: " <> renderPermissionDenials (V.toList denials))
             _ -> Left ("Claude reported permission denials or omitted permission evidence. " <> detail value)
           textField "result" value >>= nonblank
       | otherwise = do
@@ -53,6 +61,7 @@
           require (any (\event -> field "type" event == Just (String "turn.completed")) events) "Codex has no successful terminal turn result."
           let messages = [body | event <- events, field "type" event == Just (String "item.completed"), Just item <- [field "item" event], field "type" item == Just (String "agent_message"), Just (String body) <- [field "text" item]]
           nonblank (T.intercalate "\n" messages)
+    detail _ | not includeDetails = "Check the caller settings and provider configuration."
     detail value = case field "result" value of
       Just (String body) -> T.take 2000 body
       _ -> "Check the Claude CLI authentication and configuration."
@@ -100,7 +109,10 @@
 -- is blank. Everything else the older provider accepted is still accepted: a
 -- missing @permission_denials@, @type@ or @subtype@ is not an error.
 validateBatchRunOutput :: ByteString -> Either Text Text
-validateBatchRunOutput bytes = do
+validateBatchRunOutput = validateBatchRunOutputWithDetails True
+
+validateBatchRunOutputWithDetails :: Bool -> ByteString -> Either Text Text
+validateBatchRunOutputWithDetails includeDetails bytes = do
   events <- decodeClaudeEvents bytes
   maybe (Right ()) Left (refusalsIn events)
   let result = NE.last events
@@ -110,6 +122,7 @@
     Just (String body) -> nonblank body
     _ -> Left "Provider returned no assistant text."
   where
+    resultDetail _ | not includeDetails = "Check the caller settings and inspect the working diff before retrying."
     resultDetail value = case field "result" value of
       Just (String body) | not (T.null (T.strip body)) -> T.take 2000 body
       _ -> "Claude gave no detail. Check the Claude CLI authentication and configuration, then retry."
@@ -133,7 +146,7 @@
             <> noun
             <> " during this unattended run: "
             <> renderPermissionDenials denials
-            <> ". An unattended run cannot approve tools. Declare the commands the blueprint needs in its allowedTools, or run it interactively, then retry."
+            <> ". An unattended run cannot approve tools. Inspect the working diff. Retry with --allowed-tool for the missing rule, pass --settings for your gate, or update the blueprint's allowedTools."
   where
     denialsOf event = case field "permission_denials" event of
       Just (Array values) -> V.toList values
diff --git a/src/Seihou/CLI/AppliedBlueprint.hs b/src/Seihou/CLI/AppliedBlueprint.hs
--- a/src/Seihou/CLI/AppliedBlueprint.hs
+++ b/src/Seihou/CLI/AppliedBlueprint.hs
@@ -1,46 +1,81 @@
--- | Persist 'AppliedBlueprint' provenance to a project's
--- @.seihou/manifest.json@. The runner in @src-exe/Seihou/CLI/AgentRun.hs@
--- assembles an 'AppliedBlueprint' after a successful agent session and
--- delegates the actual read-modify-write to 'recordAppliedBlueprint'.
--- Keeping this helper in @seihou-cli-internal@ (rather than next to the
--- runner) lets the test suite cover it directly: the @seihou@
--- executable target is trapped by @Options.Applicative@/@Data.FileEmbed@
--- and is not importable by @seihou-cli-test@.
+-- | Publish a receipt against the document the provider left on disk. Keep
+-- unrelated JSON members, including producer fields unknown to this binary.
 module Seihou.CLI.AppliedBlueprint
   ( recordAppliedBlueprint,
+    updateReceiptDocument,
+    preflightPolicyReceipt,
   )
 where
 
+import Control.Exception (IOException, displayException, try)
+import Control.Monad (void)
+import Data.Aeson qualified as Aeson
+import Data.Aeson.KeyMap qualified as KM
+import Data.ByteString qualified as BS
+import Data.ByteString.Lazy qualified as LBS
 import Data.Generics.Labels ()
-import Seihou.Core.Types (AppliedBlueprint (..))
-import Seihou.Effect.Filesystem (createDirectoryIfMissing)
-import Seihou.Effect.FilesystemInterp (runFilesystem)
-import Seihou.Effect.ManifestStore (readManifest, writeManifest)
-import Seihou.Effect.ManifestStoreInterp (runManifestStore)
-import Seihou.Manifest.Types (emptyManifest, writeAppliedBlueprint)
+import Data.Maybe (isJust)
+import Data.Text qualified as T
+import Data.Time (UTCTime)
+import Seihou.Core.Types
+import Seihou.Manifest.JSON (decodeManifestValue)
+import Seihou.Manifest.Types (blueprintToJSON, emptyManifest, minimumManifestVersion)
+import Seihou.Manifest.Upgrade (renderManifestUpgradeError, upgradeDocumentLosslessly)
 import Seihou.Prelude
+import System.Directory (createDirectoryIfMissing, renameFile)
 import System.FilePath (takeDirectory)
+import System.IO (hClose)
+import System.IO.Error (isDoesNotExistError)
+import System.IO.Temp (withTempFile)
 
--- | Read the manifest at @manifestPath@, attach the supplied
--- 'AppliedBlueprint' as the project's blueprint provenance, and write
--- the manifest back. If no manifest exists yet, a fresh one is created
--- using the entry's @appliedAt@ timestamp as its @genAt@.
---
--- Returns @Left err@ when the existing manifest cannot be parsed —
--- callers should leave the manifest untouched in that case rather than
--- silently overwriting a hand-edited file. The directory containing
--- the manifest is created if missing, mirroring the pre-existing
--- @applyBaseline@ flow.
+-- Reading a v5 manifest still requires reviewed origin conversion. Validate
+-- before transforming so forged evidence cannot be legalized by an upgrade.
+readReceiptDocument :: Bool -> FilePath -> IO (Either Text (Maybe (Manifest, Aeson.Object)))
+readReceiptDocument upgrade path = do
+  bytes <- try @IOException (BS.readFile path)
+  pure $ case bytes of
+    Left err | isDoesNotExistError err -> Right Nothing
+    Left err -> Left (T.pack (displayException err))
+    Right raw -> do
+      original <- first T.pack (decodeManifestValue (LBS.fromStrict raw))
+      previous <- typed original
+      (manifest, prepared) <-
+        if upgrade && previous ^. #version < minimumManifestVersion CallerToolPolicyEvidence
+          then do
+            (_, doc) <- first renderManifestUpgradeError (upgradeDocumentLosslessly (minimumManifestVersion CallerToolPolicyEvidence) original)
+            (,doc) <$> typed doc
+          else Right (previous, original)
+      case prepared of
+        Aeson.Object fields -> Right (Just (manifest, fields))
+        _ -> Left "Manifest must be a JSON object."
+  where
+    typed doc = case Aeson.fromJSON doc of
+      Aeson.Success manifest -> Right manifest
+      Aeson.Error err -> Left (T.pack err)
+
+preflightPolicyReceipt :: FilePath -> IO (Either Text ())
+preflightPolicyReceipt path = void <$> readReceiptDocument True path
+
 recordAppliedBlueprint :: FilePath -> AppliedBlueprint -> IO (Either Text ())
-recordAppliedBlueprint manifestPath ab =
-  runEff $ runFilesystem $ runManifestStore manifestPath $ do
-    createDirectoryIfMissing True (takeDirectory manifestPath)
-    mManifest <- readManifest
-    case mManifest of
-      Right (Just m) -> do
-        writeManifest (writeAppliedBlueprint ab m)
-        pure (Right ())
-      Right Nothing -> do
-        writeManifest (writeAppliedBlueprint ab (emptyManifest (ab ^. #appliedAt)))
-        pure (Right ())
+recordAppliedBlueprint path receipt =
+  updateReceiptDocument path (receipt ^. #appliedAt) (isJust (receipt ^. #callerToolPolicy)) $ \manifest fields ->
+    KM.insert "blueprint" (blueprintToJSON (manifest ^. #version) receipt) fields
+
+updateReceiptDocument :: FilePath -> UTCTime -> Bool -> (Manifest -> Aeson.Object -> Aeson.Object) -> IO (Either Text ())
+updateReceiptDocument path now upgrade update = do
+  attempt <- try @IOException $ do
+    current <- readReceiptDocument upgrade path
+    case current of
       Left err -> pure (Left err)
+      Right existing -> do
+        let fresh = emptyManifest now
+            initial = case Aeson.toJSON fresh of Aeson.Object o -> o; _ -> mempty
+            (manifest, fields) = maybe (fresh, initial) id existing
+            dir = takeDirectory path
+        createDirectoryIfMissing True dir
+        withTempFile dir "manifest.json.tmp" $ \temporary handle -> do
+          LBS.hPut handle (Aeson.encode (Aeson.Object (update manifest fields)))
+          hClose handle
+          renameFile temporary path
+        pure (Right ())
+  pure (either (Left . T.pack . displayException) id attempt)
diff --git a/src/Seihou/CLI/AppliedBlueprintMigration.hs b/src/Seihou/CLI/AppliedBlueprintMigration.hs
--- a/src/Seihou/CLI/AppliedBlueprintMigration.hs
+++ b/src/Seihou/CLI/AppliedBlueprintMigration.hs
@@ -1,32 +1,27 @@
 -- | Durable manifest receipts for agent-guided blueprint migrations.
-module Seihou.CLI.AppliedBlueprintMigration
-  ( recordAppliedBlueprintMigration,
-  )
-where
+module Seihou.CLI.AppliedBlueprintMigration (recordAppliedBlueprintMigration) where
 
+import Data.Aeson qualified as Aeson
+import Data.Aeson.KeyMap qualified as KM
 import Data.Generics.Labels ()
+import Data.Vector qualified as V
+import Seihou.CLI.AppliedBlueprint (updateReceiptDocument)
 import Seihou.Core.Types (AppliedBlueprintMigration (..))
-import Seihou.Effect.Filesystem (createDirectoryIfMissing)
-import Seihou.Effect.FilesystemInterp (runFilesystem)
-import Seihou.Effect.ManifestStore (readManifest, writeManifest)
-import Seihou.Effect.ManifestStoreInterp (runManifestStore)
-import Seihou.Manifest.Types (emptyManifest, writeAppliedBlueprintMigration)
+import Seihou.Manifest.Types (writeAppliedBlueprintMigration)
 import Seihou.Prelude
-import System.FilePath (takeDirectory)
 
--- | Read or create the project manifest, upsert one exact migration receipt,
--- and write it atomically. A corrupt existing manifest is reported and left
--- untouched rather than being replaced.
 recordAppliedBlueprintMigration :: FilePath -> AppliedBlueprintMigration -> IO (Either Text ())
-recordAppliedBlueprintMigration manifestPath receipt =
-  runEff $ runFilesystem $ runManifestStore manifestPath $ do
-    createDirectoryIfMissing True (takeDirectory manifestPath)
-    mManifest <- readManifest
-    case mManifest of
-      Right (Just manifest) -> do
-        writeManifest (writeAppliedBlueprintMigration receipt manifest)
-        pure (Right ())
-      Right Nothing -> do
-        writeManifest (writeAppliedBlueprintMigration receipt (emptyManifest (receipt ^. #appliedAt)))
-        pure (Right ())
-      Left err -> pure (Left err)
+recordAppliedBlueprintMigration path receipt =
+  updateReceiptDocument path (receipt ^. #appliedAt) True $ \manifest fields ->
+    let updated = writeAppliedBlueprintMigration receipt manifest
+        -- Upsert replaces in place or appends. Preserve the original JSON of
+        -- every skipped edge, even when this invocation ran another owner.
+        originals = case KM.lookup "blueprintMigrations" fields of
+          Just (Aeson.Array values) -> values
+          _ -> V.empty
+        previous = V.fromList (manifest ^. #blueprintMigrations)
+        encodeEdge i edge
+          | previous V.!? i == Just edge, Just raw <- originals V.!? i = raw
+          | otherwise = Aeson.toJSON edge
+        edges = V.imap encodeEdge (V.fromList (updated ^. #blueprintMigrations))
+     in KM.insert "blueprintMigrations" (Aeson.Array edges) fields
diff --git a/src/Seihou/CLI/CallerToolPolicy.hs b/src/Seihou/CLI/CallerToolPolicy.hs
new file mode 100644
--- /dev/null
+++ b/src/Seihou/CLI/CallerToolPolicy.hs
@@ -0,0 +1,189 @@
+-- | A caller's explicit inputs apply to one invocation only.
+module Seihou.CLI.CallerToolPolicy
+  ( CallerPolicyOptions (..),
+    ResolvedPolicy,
+    resolvePolicy,
+    policyEvidence,
+    effectiveTools,
+    settingsPath,
+    codexHooksPath,
+    withCodexPolicy,
+    handleCodexHookReview,
+    verifyPolicyFile,
+    policyOptionNames,
+    emptyPolicy,
+    preflightPolicyManifest,
+  )
+where
+
+import Baikai.Kit.Session qualified as KitSession
+import Baikai.Provider.OpenAI.Cli qualified as CodexCli
+import Baikai.Provider.OpenAI.ReviewedHooks (CodexHooks, ReviewedCodexThread, parseCodexHooks, reviewCodexHooksInTerminal)
+import Control.Exception (IOException, try)
+import Control.Monad (unless)
+import Data.Aeson qualified as Aeson
+import Data.ByteString qualified as BS
+import Data.Char (isControl, isSpace)
+import Data.Generics.Labels ()
+import Data.List (nub)
+import Data.Maybe (isJust)
+import Data.Text qualified as T
+import Data.Text.IO qualified as TIO
+import Seihou.CLI.AgentCompletion (AgentModelConfig, AgentProvider (..), buildBaikaiModel)
+import Seihou.CLI.AppliedBlueprint (preflightPolicyReceipt)
+import Seihou.CLI.KitConfig (seihouKitConfig)
+import Seihou.Core.Types (CallerToolPolicy (..), SHA256)
+import Seihou.Manifest.Hash (hashBytes)
+import Seihou.Prelude
+import System.Directory (getCurrentDirectory, makeAbsolute)
+import System.Exit (exitFailure)
+import System.IO (stderr)
+import System.Posix.Files (getFileStatus, isRegularFile)
+
+data CallerPolicyOptions = CallerPolicyOptions [Text] (Maybe FilePath) (Maybe FilePath)
+  deriving stock (Eq, Show, Generic)
+
+data ResolvedPolicy
+  = ClaudePolicy [Text] (Maybe (FilePath, SHA256))
+  | CodexPolicy FilePath SHA256 CodexHooks
+
+emptyPolicy :: ResolvedPolicy
+emptyPolicy = ClaudePolicy [] Nothing
+
+policyOptionNames :: CallerPolicyOptions -> [Text]
+policyOptionNames (CallerPolicyOptions rules settings hooks) =
+  ["--allowed-tool" | not (null rules)] <> ["--settings" | isJust settings] <> ["--codex-hooks" | isJust hooks]
+
+resolvePolicy :: Bool -> AgentProvider -> CallerPolicyOptions -> IO (Either Text ResolvedPolicy)
+resolvePolicy batch provider options@(CallerPolicyOptions rules file codexFile)
+  | null flags = pure (Right emptyPolicy)
+  | Just path <- codexFile =
+      if not (null rules) || isJust file
+        then pure (Left "--codex-hooks cannot be combined with --allowed-tool or --settings.")
+        else
+          if provider /= AgentProviderCodexCli || not batch
+            then pure (Left ("--codex-hooks requires --batch --provider codex-cli." <> apiTools))
+            else do
+              absolute <- makeAbsolute path
+              contents <- readPolicyFile "--codex-hooks" absolute
+              pure $ do
+                bytes <- contents
+                hooks <- first ("--codex-hooks: " <>) (parseCodexHooks bytes)
+                pure (CodexPolicy absolute (hashBytes bytes) hooks)
+  | provider /= AgentProviderClaudeCli || not batch =
+      pure
+        ( Left
+            ( T.intercalate " and " flags
+                <> " require --batch --provider claude-cli. Omit the policy to keep this launch mode."
+                <> apiTools
+                <> if provider == AgentProviderCodexCli then " For Codex, use --codex-hooks FILE." else ""
+            )
+        )
+  | any invalidRule rules = pure (Left "--allowed-tool requires one nonblank Claude tool pattern per flag, for example 'Bash(grep *)'.")
+  | otherwise = case file of
+      Nothing -> pure (Right (ClaudePolicy (nub rules) Nothing))
+      Just path -> do
+        absolute <- makeAbsolute path
+        contents <- readPolicyFile "--settings" absolute
+        pure $ do
+          bytes <- contents
+          case Aeson.decodeStrict' bytes of
+            Just (Aeson.Object _) -> Right (ClaudePolicy (nub rules) (Just (absolute, hashBytes bytes)))
+            _ -> Left ("--settings must contain a JSON object: " <> T.pack path)
+  where
+    flags = policyOptionNames options
+    apiTools = if provider `elem` [AgentProviderOpenAI, AgentProviderAnthropic] then " This API provider runs no tools." else ""
+    invalidRule rule =
+      let (name, suffix) = T.breakOn "(" rule
+       in T.null name
+            || T.isPrefixOf "-" name
+            || T.any isControl rule
+            || T.any (\c -> isSpace c || c `elem` (",)" :: String)) name
+            || (not (T.null suffix) && not (onePattern 0 (T.unpack suffix)))
+    -- Claude also accepts a delimited list. A single flag must never turn
+    -- into two grants, while punctuation inside a tool's pattern is literal.
+    onePattern :: Int -> String -> Bool
+    onePattern depth [] = depth == 0
+    onePattern depth ('\\' : _ : rest) = depth > 0 && onePattern depth rest
+    onePattern depth ('(' : rest) = onePattern (depth + 1) rest
+    onePattern depth (')' : rest) = depth > 0 && (depth /= 1 || null rest) && onePattern (depth - 1) rest
+    onePattern depth (_ : rest) = depth > 0 && onePattern depth rest
+
+readPolicyFile :: Text -> FilePath -> IO (Either Text BS.ByteString)
+readPolicyFile flag path = do
+  result <- try @IOException $ do
+    status <- getFileStatus path
+    unless (isRegularFile status) $ ioError (userError "expected a regular file")
+    BS.readFile path
+  pure (first (const (flag <> " requires a readable regular file: " <> T.pack path)) result)
+
+verifyPolicyFile :: ResolvedPolicy -> IO (Either Text ())
+verifyPolicyFile = \case
+  ClaudePolicy _ Nothing -> pure (Right ())
+  ClaudePolicy _ (Just (path, digest)) -> verify "--settings" path digest
+  CodexPolicy path digest _ -> verify "--codex-hooks" path digest
+  where
+    verify flag path digest = do
+      current <- readPolicyFile flag path
+      pure $
+        unless (fmap hashBytes current == Right digest) $
+          Left (flag <> " changed or became unreadable: " <> T.pack path <> ". Inspect the working diff and retry with a stable policy file.")
+
+settingsPath :: ResolvedPolicy -> Maybe FilePath
+settingsPath (ClaudePolicy _ file) = fst <$> file
+settingsPath CodexPolicy {} = Nothing
+
+codexHooksPath :: ResolvedPolicy -> Maybe FilePath
+codexHooksPath (CodexPolicy path _ _) = Just path
+codexHooksPath ClaudePolicy {} = Nothing
+
+effectiveTools :: ResolvedPolicy -> [String] -> [String]
+effectiveTools (ClaudePolicy rules _) tools = nub (tools <> map T.unpack rules)
+effectiveTools CodexPolicy {} tools = tools
+
+policyEvidence :: ResolvedPolicy -> Maybe CallerToolPolicy
+policyEvidence (ClaudePolicy [] Nothing) = Nothing
+policyEvidence (ClaudePolicy rules file) = Just (CallerToolPolicy rules (snd <$> file) Nothing Nothing)
+policyEvidence (CodexPolicy _ digest _) = Just (CallerToolPolicy [] Nothing (Just digest) Nothing)
+
+-- | Keep the checked thread live while the caller prepares and runs its turn.
+-- Ordinary invocations keep their existing provider path.
+withCodexPolicy ::
+  ResolvedPolicy ->
+  AgentModelConfig ->
+  Maybe FilePath ->
+  (Maybe ReviewedCodexThread -> IO a) ->
+  IO (Either Text a)
+withCodexPolicy policy config mounted use = case policy of
+  CodexPolicy path _ hooks ->
+    verifyPolicyFile policy >>= \case
+      Left err -> pure (Left err)
+      Right () -> do
+        sessionArgs <- KitSession.codexSessionArgs seihouKitConfig
+        let cli = CodexCli.defaultCodexCliConfig & #extraArgs .~ sessionArgs
+        result <- CodexCli.withReviewedCodexCli cli (buildBaikaiModel config) (maybe [] pure mounted) hooks (use . Just)
+        pure (first (describeError path) result)
+  ClaudePolicy {} -> Right <$> use Nothing
+  where
+    describeError path message
+      | message == "Codex requires review for the current hooks." =
+          message <> " Run seihou agent review-codex-hooks " <> shellPath path <> " and retry."
+      | otherwise = message
+    shellPath path = "'" <> T.replace "'" "'\\''" (T.pack path) <> "'"
+
+handleCodexHookReview :: Bool -> FilePath -> IO ()
+handleCodexHookReview debug path
+  | debug = failReview "To review a Codex hooks file, run seihou agent review-codex-hooks FILE in a terminal."
+  | otherwise = do
+      cwd <- getCurrentDirectory
+      reviewCodexHooksInTerminal "codex" cwd path >>= \case
+        Left err -> failReview err
+        Right False -> failReview "Codex hook review cancelled."
+        Right True -> TIO.putStrLn "Codex has reviewed the current hook declarations."
+  where
+    failReview message = TIO.hPutStrLn stderr message >> exitFailure
+
+preflightPolicyManifest :: FilePath -> ResolvedPolicy -> IO (Either Text ())
+preflightPolicyManifest path policy
+  | isJust (policyEvidence policy) = preflightPolicyReceipt path
+  | otherwise = pure (Right ())
diff --git a/src/Seihou/CLI/CommandExecution.hs b/src/Seihou/CLI/CommandExecution.hs
--- a/src/Seihou/CLI/CommandExecution.hs
+++ b/src/Seihou/CLI/CommandExecution.hs
@@ -18,6 +18,8 @@
     executeCommandOutcomes,
     commandOutcomesFailed,
     checkCheckoutWorkDir,
+    plannedCommandText,
+    setApplicationCommandReceipts,
   )
 where
 
@@ -297,3 +299,29 @@
 
     retainPrior planned =
       (planned ^. #fingerprint,) <$> Map.lookup (planned ^. #fingerprint) priorReceipts
+
+-- | The rendered shell text of a planned command, for progress and failure
+-- messages.
+plannedCommandText :: PlannedCommand -> Text
+plannedCommandText planned = case planned ^. #operation of
+  RunCommandOp {command} -> command
+  _ -> "<non-command operation>"
+
+-- | Replace one application's command receipts inside a manifest, leaving
+-- every other record alone. Used to withdraw receipts published before a
+-- command phase that then failed, and to correct them after one that
+-- succeeded.
+setApplicationCommandReceipts ::
+  ApplicationId ->
+  Map CommandFingerprint CommandReceipt ->
+  Manifest ->
+  Manifest
+setApplicationCommandReceipts applicationId receipts manifest =
+  manifest
+    & #applications
+    %~ map updateApplication
+  where
+    updateApplication application
+      | application ^. #applicationId == applicationId =
+          application & #commandReceipts .~ receipts
+      | otherwise = application
diff --git a/src/Seihou/CLI/ManifestCapabilityUpgrade.hs b/src/Seihou/CLI/ManifestCapabilityUpgrade.hs
--- a/src/Seihou/CLI/ManifestCapabilityUpgrade.hs
+++ b/src/Seihou/CLI/ManifestCapabilityUpgrade.hs
@@ -33,6 +33,7 @@
     prepareRecipeInheritance,
     prepareRemovalPolicies,
     prepareJudgementState,
+    prepareCallerToolPolicy,
     gatherSeedOwnershipEvidence,
     CertificationScope (..),
     EvidencePolicy (..),
@@ -560,3 +561,13 @@
     first renderManifestUpgradeError $
       upgradeDocumentLosslessly (max (manifest ^. #version) (minimumManifestVersion JudgementState)) (Aeson.toJSON manifest)
   first T.pack (manifestFromJSON (Aeson.encode document))
+
+-- | Stage the lossless receipt upgrade before publishing any new evidence.
+prepareCallerToolPolicy :: Manifest -> Either Text Manifest
+prepareCallerToolPolicy manifest
+  | manifest ^. #version >= minimumManifestVersion CallerToolPolicyEvidence = Right manifest
+  | otherwise = do
+      (_, document) <-
+        first renderManifestUpgradeError $
+          upgradeDocumentLosslessly (minimumManifestVersion CallerToolPolicyEvidence) (Aeson.toJSON manifest)
+      first T.pack (manifestFromJSON (Aeson.encode document))
diff --git a/test/Main.hs b/test/Main.hs
--- a/test/Main.hs
+++ b/test/Main.hs
@@ -13,6 +13,7 @@
 import Seihou.CLI.AgentUpgradeE2ESpec qualified as AgentUpgradeE2ESpec
 import Seihou.CLI.AppliedBlueprintMigrationSpec qualified as AppliedBlueprintMigrationSpec
 import Seihou.CLI.AppliedBlueprintSpec qualified as AppliedBlueprintSpec
+import Seihou.CLI.BaselineCommandE2ESpec qualified as BaselineCommandE2ESpec
 import Seihou.CLI.BlueprintMigrationSpec qualified as BlueprintMigrationSpec
 import Seihou.CLI.BrowseFormatSpec qualified as BrowseFormatSpec
 import Seihou.CLI.CheckoutSyncE2ESpec qualified as CheckoutSyncE2ESpec
@@ -92,6 +93,7 @@
         AgentTraceE2ESpec.tests,
         AppliedBlueprintSpec.tests,
         AppliedBlueprintMigrationSpec.tests,
+        BaselineCommandE2ESpec.tests,
         BlueprintMigrationSpec.tests,
         BrowseFormatSpec.tests,
         CommitMessageSpec.tests,
diff --git a/test/Seihou/CLI/AgentGuardE2ESpec.hs b/test/Seihou/CLI/AgentGuardE2ESpec.hs
--- a/test/Seihou/CLI/AgentGuardE2ESpec.hs
+++ b/test/Seihou/CLI/AgentGuardE2ESpec.hs
@@ -133,16 +133,12 @@
       doesFileExist (fixture ^. #launchLog) `shouldReturn` False
       gitStatus fixture `shouldReturn` ""
 
-  it "still checks under agent --debug run, which is not a dry run" $
+  it "can preview a stale blueprint without writing a receipt" $
     withStaleBlueprint $ \fixture -> do
       before <- LBS.readFile (fixture ^. #manifestPath)
-      (code, out, err) <- runSeihou fixture ["agent", "--debug", "run", "upgrade-helper"]
-      code `shouldSatisfy` (/= ExitSuccess)
-      (out <> err) `shouldSatisfy` T.isInfixOf "seihou upgrade upgrade-helper"
-
-      -- Without the check this run would still have applied the baseline and
-      -- rewritten the manifest to name the older blueprint: --debug skips the
-      -- provider call on this path, not the writes.
+      (code, out, _) <- runSeihou fixture ["agent", "--debug", "run", "upgrade-helper"]
+      code `shouldBe` ExitSuccess
+      out `shouldSatisfy` T.isInfixOf "upgrade-helper"
       LBS.readFile (fixture ^. #manifestPath) `shouldReturn` before
       gitStatus fixture `shouldReturn` ""
 
diff --git a/test/Seihou/CLI/AgentMigrateE2ESpec.hs b/test/Seihou/CLI/AgentMigrateE2ESpec.hs
--- a/test/Seihou/CLI/AgentMigrateE2ESpec.hs
+++ b/test/Seihou/CLI/AgentMigrateE2ESpec.hs
@@ -1,6 +1,8 @@
 module Seihou.CLI.AgentMigrateE2ESpec (tests) where
 
 import Control.Lens (to, (^.))
+import Data.Aeson qualified as Aeson
+import Data.Aeson.KeyMap qualified as KM
 import Data.ByteString.Lazy qualified as LBS
 import Data.Generics.Labels ()
 import Data.List (sort)
@@ -13,10 +15,12 @@
 import Seihou.Core.Types
   ( AppliedBlueprint (..),
     AppliedBlueprintMigration (..),
+    CallerToolPolicy (..),
     Manifest (..),
     MigrationOutcome (..),
     ModuleName (..),
   )
+import Seihou.Manifest.Hash (hashContent)
 import Seihou.Manifest.Types (manifestFromJSON)
 import System.Directory
   ( canonicalizePath,
@@ -141,6 +145,79 @@
       launchArgs `shouldNotSatisfy` elem "--permission-mode"
       launchArgs `shouldNotSatisfy` any (T.isInfixOf "mori registry")
 
+  it "grants only the supplied invocation and records its caller inputs" $
+    withBatchBlueprintScript policyReply $ \fixture -> do
+      let run = fixture ^. #runSeihou
+          base = ["agent", "run", "batch-blueprint", "Check the marker"]
+          grant = "Bash(nix build .#docs)"
+          comma = "Bash(echo a,b)"
+          manifest = fixture ^. #manifestPath
+      (denied, msg, _) <- run base
+      denied `shouldBe` ExitFailure 1
+      msg `shouldSatisfy` T.isInfixOf "nix build .#docs"
+      doesFileExist manifest `shouldReturn` False
+      (code, out, err) <- run (base <> ["--batch", "--allowed-tool", grant, "--allowed-tool", "Read", "--allowed-tool", comma, "--allowed-tool", grant])
+      expectSuccess "one-shot grants" code out err
+      argv <- T.lines <$> TIO.readFile (fixture ^. #launchLog)
+      mapM_ (\arg -> length (filter (== T.pack arg) argv) `shouldBe` 1) [grant, "Read", comma]
+      argv `shouldSatisfy` elem "Check the marker"
+      before <- LBS.readFile manifest
+      case manifestFromJSON before of
+        Right m -> ((^. #callerToolPolicy) =<< m ^. #blueprint) `shouldBe` Just (CallerToolPolicy (map T.pack [grant, "Read", comma]) Nothing Nothing Nothing)
+        Left e -> expectationFailure e
+      (again, _, _) <- run base
+      again `shouldBe` ExitFailure 1
+      LBS.readFile manifest `shouldReturn` before
+
+  it "upgrades the on-disk schema-15 document after the provider has edited it" $
+    withBatchBlueprintScript (T.unlines ["if [ -f agent-document ]; then cp agent-document .seihou/manifest.json; fi", policyReply]) $ \fixture -> do
+      let path = fixture ^. #manifestPath
+          project = takeDirectory (takeDirectory path)
+          run = (fixture ^. #runSeihou) ["agent", "run", "batch-blueprint", "--batch", "--allowed-tool", "Bash(nix build .#docs)"]
+      (initial, out, err) <- run
+      expectSuccess "fresh receipt" initial out err
+      Right (Aeson.Object fresh) <- Aeson.eitherDecode <$> LBS.readFile path
+      let oldReceipt = case KM.lookup "blueprint" fresh of
+            Just (Aeson.Object record) -> Aeson.Object (KM.delete "callerToolPolicy" record)
+            _ -> Aeson.Null
+          old = KM.insert "version" (Aeson.Number 15) (KM.insert "blueprint" oldReceipt fresh)
+          agentEdits = KM.insert "producerExtension" (Aeson.String "edited during this run") old
+      LBS.writeFile path (Aeson.encode (Aeson.Object old))
+      LBS.writeFile (project </> "agent-document") (Aeson.encode (Aeson.Object agentEdits))
+      (upgraded, out2, err2) <- run
+      expectSuccess "upgrade current on-disk state" upgraded out2 err2
+      Right (Aeson.Object final) <- Aeson.eitherDecode <$> LBS.readFile path
+      KM.lookup "version" final `shouldBe` Just (Aeson.Number 16)
+      KM.lookup "producerExtension" final `shouldBe` Just (Aeson.String "edited during this run")
+      TIO.writeFile (project </> "agent-document") "{corrupt"
+      (failed, msg, errors) <- run
+      failed `shouldBe` ExitFailure 1
+      (msg <> errors) `shouldSatisfy` T.isInfixOf "agent may already have edited files"
+      TIO.readFile path `shouldReturn` "{corrupt"
+
+  it "hashes the exact settings bytes and rejects a changed input before recording" $
+    withBatchBlueprintScript settingsReply $ \fixture -> do
+      let manifest = fixture ^. #manifestPath
+          settings = takeDirectory (takeDirectory manifest) </> "caller settings.json"
+          contents = "{ \"hooks\": { \"PreToolUse\": [{\"hooks\":[{\"type\":\"command\",\"command\":\"private-gate-script\"}]}] } }\n"
+          run args = (fixture ^. #runSeihou) (["agent", "run", "batch-blueprint", "--batch", "--settings", "caller settings.json"] <> args)
+      TIO.writeFile settings contents
+      (code, out, err) <- run []
+      expectSuccess "settings only" code out err
+      before <- LBS.readFile manifest
+      case manifestFromJSON before of
+        Right m -> ((^. #callerToolPolicy) =<< m ^. #blueprint) `shouldBe` Just (CallerToolPolicy [] (Just (hashContent contents)) Nothing Nothing)
+        Left e -> expectationFailure e
+      (failed, providerOut, providerErr) <- run ["--allowed-tool", "Bash(provider-error)", "--trace", "file"]
+      failed `shouldBe` ExitFailure 1
+      (providerOut <> providerErr) `shouldNotSatisfy` T.isInfixOf "private-gate-script"
+      TIO.readFile (takeDirectory manifest </> "trace.jsonl") >>= (`shouldNotSatisfy` T.isInfixOf "private-gate-script")
+      TIO.readFile manifest >>= (`shouldNotSatisfy` T.isInfixOf "private-gate-script")
+      (changed, stdoutText, stderrText) <- run ["--allowed-tool", "Bash(change-input)"]
+      changed `shouldBe` ExitFailure 1
+      (stdoutText <> stderrText) `shouldSatisfy` T.isInfixOf "--settings changed"
+      LBS.readFile manifest `shouldReturn` before
+
   -- IR-18: an unattended run cannot approve tools, so a session that ended
   -- normally after Claude refused a command is a failed run, not a pass.
   it "fails a batch run whose agent was refused a tool" $
@@ -368,7 +445,9 @@
               "--to",
               "3.0.0",
               "--var",
-              "library.name=baikai"
+              "library.name=baikai",
+              "--allowed-tool",
+              "Bash(check *)"
             ]
 
       (firstExit, firstOutput, firstError) <- runProcessText binary args (Just root) (Just environment)
@@ -380,6 +459,10 @@
       -- The signal is transient state, consumed by the run that read it.
       doesFileExist signalPath `shouldReturn` False
 
+      bytes <- LBS.readFile manifestPath
+      case manifestFromJSON bytes of
+        Right m -> map (^. #callerToolPolicy) (m ^. #blueprintMigrations) `shouldBe` replicate 2 (Just (CallerToolPolicy ["Bash(check *)"] Nothing Nothing Nothing))
+        Left e -> expectationFailure e
       afterFirst <- readReceipts manifestPath
       afterFirst
         `shouldBe` [ ("1.0.0", "2.0.0", MigrationNotApplicable reason),
@@ -409,11 +492,12 @@
 
   it "keeps the first receipt, stops on a failed owner, and resumes only pending work" $
     withCohortProject $ \root run -> do
-      let args = ["agent", "migrate", "keiro-upgrade", "--from", "2.4.0", "--to", "3.0.0", "Keep my explicit instruction", "--model", "migration-model", "--effort", "high", "--trace", "file"]
+      let args = ["agent", "migrate", "keiro-upgrade", "--from", "2.4.0", "--to", "3.0.0", "Keep my explicit instruction", "--model", "migration-model", "--effort", "high", "--trace", "file", "--allowed-tool", "Bash(check *)", "--settings", "caller settings.json"]
           script = root </> "bin/claude"
           logPath = root </> "agent-launch.log"
           manifestPath = root </> ".seihou/manifest.json"
           success = "{\"type\":\"result\",\"subtype\":\"success\",\"is_error\":false,\"permission_denials\":[],\"result\":\"done\"}"
+      TIO.writeFile (root </> "caller settings.json") "{}"
       TIO.writeFile
         (root </> ".seihou/modules/kiroku-upgrade/blueprint.dhall")
         (T.replace "allowedTools = None (List Text)" "allowedTools = Some [ \"Bash(kiroku *)\" ]" (kirokuBlueprintDhall "1.9.0"))
@@ -424,7 +508,7 @@
         T.unlines
           [ "#!/bin/sh",
             "printf '%s\\0' \"$*\" >> \"$SEIHOU_FAKE_AGENT_LOG\"",
-            "if [ -f first-done ] && [ ! -f retry-ready ]; then printf reason > .seihou/.migrate-signal; echo provider-failure >&2; exit 9; fi",
+            "if [ -f first-done ] && [ ! -f retry-ready ]; then printf reason > .seihou/.migrate-signal; echo '{\"type\":\"result\",\"subtype\":\"success\",\"is_error\":false,\"result\":\"refused\",\"permission_denials\":[{\"tool_name\":\"Bash\"}]}'; exit 0; fi",
             "touch first-done",
             "cat <<'RESULT'",
             success,
@@ -432,7 +516,7 @@
           ]
       (failed, _, failure) <- run args
       failed `shouldSatisfy` (/= ExitSuccess)
-      failure `shouldSatisfy` T.isInfixOf "provider-failure"
+      failure `shouldSatisfy` T.isInfixOf "permission denials"
       receipts <- readReceipts manifestPath
       receipts `shouldBe` [("1.9.0", "2.0.0", MigrationApplied)]
       doesFileExist (root </> ".seihou/.migrate-signal") `shouldReturn` False
@@ -446,11 +530,26 @@
       last launches `shouldSatisfy` T.isInfixOf "Bash(keiro *)"
       last launches `shouldSatisfy` T.isInfixOf "--model migration-model"
       last launches `shouldSatisfy` T.isInfixOf "--effort high"
+      mapM_
+        ( \argsText -> do
+            argsText `shouldSatisfy` T.isInfixOf "Bash(check *)"
+            argsText `shouldSatisfy` T.isInfixOf "--permission-mode acceptEdits"
+            argsText `shouldSatisfy` T.isInfixOf "--settings"
+            argsText `shouldSatisfy` T.isInfixOf "caller settings.json"
+        )
+        launches
+      TIO.writeFile (root </> "caller settings.json") "{ }"
       TIO.writeFile (root </> "retry-ready") ""
       (resumed, output, errors) <- run args
       expectSuccess "resume after failed second owner" resumed output errors
       completed <- readReceipts manifestPath
       length completed `shouldBe` 2
+      bytes <- LBS.readFile manifestPath
+      case manifestFromJSON bytes of
+        Right m ->
+          [(r ^. #name, r ^. #callerToolPolicy) | r <- m ^. #blueprintMigrations]
+            `shouldBe` [(name, Just (CallerToolPolicy ["Bash(check *)"] (Just (hashContent contents)) Nothing Nothing)) | (name, contents) <- [("kiroku-upgrade", "{}"), ("keiro-upgrade", "{ }")]]
+        Left e -> expectationFailure e
       allLaunches <- filter (not . T.null) . T.splitOn "\0" <$> TIO.readFile logPath
       length allLaunches `shouldBe` 3
       last allLaunches `shouldNotSatisfy` T.isInfixOf (T.pack (root </> ".seihou/modules/kiroku-upgrade/files"))
@@ -696,6 +795,10 @@
 
       -- The fake provider appends to this log whenever it is invoked, so its
       -- absence is the proof that no session started.
+      bytes <- LBS.readFile manifestPath
+      case manifestFromJSON bytes of
+        Right m -> map (^. #callerToolPolicy) (m ^. #blueprintMigrations) `shouldBe` [Nothing]
+        Left e -> expectationFailure e
       doesFileExist launchLog `shouldReturn` False
 
       -- A marked receipt is an ordinary applied receipt.
@@ -1178,7 +1281,33 @@
 -- argv, writes a workspace file, and prints @reply@ as its JSON result. The
 -- callback receives the project root and a runner for seihou commands.
 withBatchBlueprintRun :: T.Text -> (BatchRunFixture -> IO a) -> IO a
-withBatchBlueprintRun reply action =
+withBatchBlueprintRun reply = withBatchBlueprintScript (T.unlines ["cat <<'RESULT'", reply, "RESULT"])
+
+policyReply, settingsReply :: T.Text
+policyReply =
+  T.unlines
+    [ "for arg do",
+      "  if [ \"$arg\" = 'Bash(nix build .#docs)' ]; then echo '{\"result\":\"ok\"}'; exit; fi",
+      "done",
+      "cat <<'RESULT'",
+      refusedReply,
+      "RESULT"
+    ]
+settingsReply =
+  T.unlines
+    [ "for arg do",
+      "  if [ \"$arg\" = 'Bash(provider-error)' ]; then echo '{\"result\":\"invalid hook private-gate-script\",\"is_error\":true}'; exit 0; fi",
+      "  if [ \"$arg\" = 'Bash(change-input)' ]; then echo '{}' > 'caller settings.json'; fi",
+      "done",
+      "while [ \"$#\" -gt 0 ]; do",
+      "  if [ \"$1\" = '--settings' ] && [ \"$2\" = \"$PWD/caller settings.json\" ]; then echo '{\"result\":\"ok\"}'; exit; fi",
+      "  shift",
+      "done",
+      "exit 1"
+    ]
+
+withBatchBlueprintScript :: T.Text -> (BatchRunFixture -> IO a) -> IO a
+withBatchBlueprintScript replyScript action =
   withSystemTempDirectory "seihou-agent-run-batch" $ \root -> do
     binary <- seihouBinary
     let blueprintDir = root </> ".seihou" </> "modules" </> "batch-blueprint"
@@ -1200,9 +1329,7 @@
         [ "#!/bin/sh",
           "printf '%s\\n' \"$@\" > \"$SEIHOU_FAKE_AGENT_LOG\"",
           "printf 'edited\\n' > \"$SEIHOU_FAKE_WORKSPACE_FILE\"",
-          "cat <<'RESULT'",
-          reply,
-          "RESULT"
+          replyScript
         ]
     permissions <- getPermissions fakeClaude
     -- Permissions comes from `directory` and has no Generic instance, so it
diff --git a/test/Seihou/CLI/AppliedBlueprintMigrationSpec.hs b/test/Seihou/CLI/AppliedBlueprintMigrationSpec.hs
--- a/test/Seihou/CLI/AppliedBlueprintMigrationSpec.hs
+++ b/test/Seihou/CLI/AppliedBlueprintMigrationSpec.hs
@@ -62,7 +62,8 @@
       toVersion = toVersion,
       outcome = outcome,
       appliedAt = appliedAt,
-      agentSessionId = Nothing
+      agentSessionId = Nothing,
+      callerToolPolicy = Nothing
     }
 
 readManifestFile :: FilePath -> IO Manifest
diff --git a/test/Seihou/CLI/AppliedBlueprintSpec.hs b/test/Seihou/CLI/AppliedBlueprintSpec.hs
--- a/test/Seihou/CLI/AppliedBlueprintSpec.hs
+++ b/test/Seihou/CLI/AppliedBlueprintSpec.hs
@@ -49,7 +49,8 @@
       baselineModules = map ModuleName baseline,
       noBaseline = noBL,
       userPrompt = prompt,
-      agentSessionId = Nothing
+      agentSessionId = Nothing,
+      callerToolPolicy = Nothing
     }
 
 readManifestFile :: FilePath -> IO Manifest
diff --git a/test/Seihou/CLI/BaselineCommandE2ESpec.hs b/test/Seihou/CLI/BaselineCommandE2ESpec.hs
new file mode 100644
--- /dev/null
+++ b/test/Seihou/CLI/BaselineCommandE2ESpec.hs
@@ -0,0 +1,394 @@
+-- | A blueprint's baseline runs its modules' commands, driven end to end
+-- through the real binary.
+--
+-- A blueprint baseline is the module composition @seihou agent run@ applies
+-- before the provider starts. Through 0.16.0.2 it generated the modules'
+-- files and silently dropped their commands (BUG-4,
+-- docs/bug-reports/a-blueprint-baseline-silently-skips-its-modules-commands.md).
+-- These cases pin the fixed behavior: the commands run after the files, in
+-- composition order, before the provider launches, with the receipt
+-- publication and withdrawal contract of
+-- docs/adr/0023-command-receipts-are-published-before-the-command-phase-runs.md,
+-- and with everything the phase prints kept off standard output.
+--
+-- See docs/plans/125-run-blueprint-baseline-commands-before-launching-the-agent.md.
+module Seihou.CLI.BaselineCommandE2ESpec (tests) where
+
+import Data.Generics.Labels ()
+import Data.Map.Strict qualified as Map
+import Data.Maybe (fromMaybe)
+import Data.Text qualified as T
+import Data.Text.IO qualified as TIO
+import Seihou.CLI.CommandReceiptE2ESpec (commitCommand, committedManifest, demoReceipts, initCommand)
+import Seihou.CLI.SeedRunE2ESpec (prepare, readManifest)
+import Seihou.Core.Types
+import Seihou.Prelude
+import System.Directory qualified as D
+import System.Environment (getEnvironment)
+import System.Exit (ExitCode (..))
+import System.FilePath (searchPathSeparator)
+import System.IO.Temp (withSystemTempDirectory)
+import System.Process (CreateProcess (..), proc, readCreateProcessWithExitCode)
+import Test.Hspec
+import Test.Tasty
+import Test.Tasty.Hspec (testSpec)
+
+tests :: IO TestTree
+tests = testSpec "blueprint baseline commands" spec
+
+spec :: Spec
+spec = do
+  it "rejects incompatible policies and malformed inputs before applying a baseline" $
+    withProject [sentinelCommand] $ \project -> do
+      let root = project ^. #root
+          reject flags diagnostic = do
+            (code, out, err) <- runSeihou project [] (["agent", "run", "proto-bp", "--batch"] <> flags)
+            code `shouldBe` ExitFailure 1
+            (out <> err) `shouldSatisfy` T.isInfixOf diagnostic
+            D.doesFileExist (root </> "cmd.log") `shouldReturn` False
+            D.doesFileExist (project ^. #launchLog) `shouldReturn` False
+            D.doesFileExist (root </> ".seihou/manifest.json") `shouldReturn` False
+      mapM_ (\v -> reject ["--allowed-tool", v] "--allowed-tool") [" ", "--settings", "Read,Bash"]
+      mapM_ (\v -> reject ["--allowed-tool", "Read", "--provider", v] "--allowed-tool") ["openai", "anthropic", "codex-cli"]
+      reject ["--settings", "missing"] "readable regular file"
+      reject ["--settings", "."] "readable regular file"
+      mapM_ (\v -> TIO.writeFile (root </> "policy.json") v >> reject ["--settings", "policy.json"] "JSON object") ["[]", "false", "{broken"]
+
+  it "previews the baseline without applying commands, launching, or changing receipt bytes" $
+    withProject [sentinelCommand] $ \project -> do
+      let root = project ^. #root
+          path = root </> ".seihou/manifest.json"
+          render = do
+            (out, _) <- succeed project [] ["agent", "--debug", "run", "proto-bp", "Check the preview"]
+            out `shouldSatisfy` T.isInfixOf "Preview only"
+            out `shouldSatisfy` T.isInfixOf "Check the preview"
+            D.doesFileExist (root </> "cmd.log") `shouldReturn` False
+            D.doesFileExist (project ^. #launchLog) `shouldReturn` False
+      render
+      D.doesFileExist path `shouldReturn` False
+      _ <- succeed project [] ["run", "demo", "--no-commands"]
+      TIO.appendFile path "\n  \n"
+      before <- TIO.readFile path
+      render
+      render
+      TIO.readFile path `shouldReturn` before
+
+  it "runs the baseline's commands, as seihou run does, before the agent starts" $ do
+    viaRun <- withProject [sentinelCommand] $ \project -> do
+      _ <- succeed project [] ["run", "demo"]
+      TIO.readFile (project ^. #root </> "cmd.log")
+    viaBlueprint <- withProject [sentinelCommand] $ \project -> do
+      (out, err) <- succeed project [] ["agent", "run", "proto-bp", "--batch"]
+      -- The decisive assertion for BUG-4: the command saw the seed and ran.
+      D.doesFileExist (project ^. #root </> "cmd.log") `shouldReturn` True
+      -- Standard output carries the rendered prompt and nothing from the
+      -- command phase; the progress line and the command's output go to
+      -- standard error.
+      out `shouldSatisfy` T.isInfixOf "baseline complete"
+      out `shouldNotSatisfy` T.isInfixOf commandOutput
+      out `shouldNotSatisfy` T.isInfixOf "baseline command"
+      err `shouldSatisfy` T.isInfixOf "Running 1 baseline command(s)..."
+      err `shouldSatisfy` T.isInfixOf commandOutput
+      -- The agent is told the commands already ran.
+      prompt <- TIO.readFile (project ^. #launchLog)
+      prompt `shouldSatisfy` T.isInfixOf "commands already ran"
+      TIO.readFile (project ^. #root </> "cmd.log")
+    viaBlueprint `shouldBe` viaRun
+
+  it "finishes the command phase before a batch provider launches" $
+    withProject [sentinelCommand] $ \project -> do
+      (out, err) <- succeed project [("SEIHOU_BASELINE_SENTINEL", project ^. #root </> "cmd.log")] ["agent", "run", "proto-bp", "--batch"]
+      -- The stub exits 1 unless cmd.log exists, so success proves ordering.
+      out `shouldSatisfy` T.isInfixOf "baseline complete"
+      out `shouldNotSatisfy` T.isInfixOf commandOutput
+      out `shouldNotSatisfy` T.isInfixOf "Running 1 baseline command(s)..."
+      err `shouldSatisfy` T.isInfixOf "Running 1 baseline command(s)..."
+      err `shouldSatisfy` T.isInfixOf commandOutput
+      D.doesFileExist (project ^. #launchLog) `shouldReturn` True
+      manifest <- readManifest (project ^. #root)
+      map (^. #command) (demoReceipts manifest) `shouldBe` [sentinelCommand]
+      fmap (^. #name) (manifest ^. #blueprint) `shouldBe` Just "proto-bp"
+
+  it "stops at a failing command, withdraws receipts, keeps the files, and never launches" $
+    withProject [firstCommand, "echo third >> cmd.log"] $ \project -> do
+      let root = project ^. #root
+      _ <- succeed project [] ["agent", "run", "proto-bp", "--batch"]
+      earlier <- readManifest root
+      D.removeFile (project ^. #launchLog)
+      D.removeFile (root </> "cmd.log")
+      writeDemo project (commandsField (map apply [firstCommand, "exit 7", "echo third >> cmd.log"]))
+      (code, out, err) <- runSeihou project [] ["agent", "run", "proto-bp", "--batch"]
+      code `shouldBe` ExitFailure 1
+      TIO.readFile (root </> "cmd.log") `shouldReturn` "first\n"
+      D.doesFileExist (project ^. #launchLog) `shouldReturn` False
+      out `shouldNotSatisfy` T.isInfixOf "first-output"
+      err `shouldSatisfy` T.isInfixOf "first-output"
+      err `shouldSatisfy` T.isInfixOf "[error] Baseline command failed (exit 7): exit 7"
+      err `shouldSatisfy` T.isInfixOf "  module: demo"
+      err `shouldSatisfy` T.isInfixOf "  directory: ."
+      err `shouldSatisfy` T.isInfixOf "The agent was not started."
+      err `shouldSatisfy` T.isInfixOf "Correct the failure, then rerun: seihou agent run proto-bp"
+      err `shouldSatisfy` T.isInfixOf "To start the agent without applying the baseline again: seihou agent run proto-bp --no-baseline"
+      manifest <- readManifest root
+      demoReceipts manifest `shouldBe` []
+      D.doesFileExist (root </> "LICENSE") `shouldReturn` True
+      Map.member "LICENSE" (manifest ^. #files) `shouldBe` True
+      -- The earlier successful provenance survives; no new success is claimed.
+      fmap (^. #appliedAt) (manifest ^. #blueprint) `shouldBe` fmap (^. #appliedAt) (earlier ^. #blueprint)
+      -- The ordinary rerun recovers once the failure is corrected.
+      writeDemo project (commandsField (map apply [firstCommand, "echo third >> cmd.log"]))
+      (recoveredOut, _) <- succeed project [] ["agent", "run", "proto-bp", "--batch"]
+      recoveredOut `shouldSatisfy` T.isInfixOf "baseline complete"
+      recovered <- readManifest root
+      map (^. #command) (demoReceipts recovered) `shouldMatchList` [firstCommand, "echo third >> cmd.log"]
+
+  it "publishes receipts before a command commits the manifest, and withdraws them on failure" $ do
+    withProject [initCommand, commitCommand] $ \project -> do
+      let root = project ^. #root
+      _ <- succeed project [] ["agent", "run", "proto-bp", "--batch"]
+      (_, committed) <- committedManifest root
+      map (^. #command) (demoReceipts committed) `shouldMatchList` [initCommand, commitCommand]
+      -- The phase confirmed the published receipts rather than rewriting them.
+      onDisk <- readManifest root
+      demoReceipts onDisk `shouldBe` demoReceipts committed
+    withProject [initCommand, commitCommand, "exit 7"] $ \project -> do
+      let root = project ^. #root
+      (code, _, err) <- runSeihou project [] ["agent", "run", "proto-bp", "--batch"]
+      code `shouldBe` ExitFailure 1
+      err `shouldSatisfy` T.isInfixOf "withdrawn from .seihou/manifest.json"
+      err `shouldSatisfy` T.isInfixOf "commit the result of the successful rerun"
+      onDisk <- readManifest root
+      demoReceipts onDisk `shouldBe` []
+      onDisk ^. #blueprint `shouldBe` Nothing
+      -- ADR 0023's accepted residual: the snapshot the commit took over-claims.
+      (_, committed) <- committedManifest root
+      length (demoReceipts committed) `shouldBe` 3
+
+  it "matches seihou run for dependencies, conditions, variables, and working directories" $ do
+    let extra =
+          ", vars = [S.VarDecl::{name = \"greeting\", type = \"text\", default = Some \"hello\"}, S.VarDecl::{name = \"loud\", type = \"bool\", default = Some \"false\"}]"
+            <> ", dependencies = [S.Dependency::{module = \"child\", vars = [{name = \"slot\", value = \"one\"}]}]"
+            <> commandsField
+              [ commandOf "Apply" (", workDir = Some " <> dhallText "nested") "echo demo-{{greeting}} >> ../order.log",
+                commandOf "Apply" (", when = Some " <> dhallText "Eq loud true") "echo loud >> order.log",
+                commandOf "Apply" (", when = Some " <> dhallText "Eq loud false") "echo quiet >> order.log"
+              ]
+        observe args = withProject [] $ \project -> do
+          writeChild project
+          writeDemo project extra
+          _ <- succeed project [] (args <> ["--var", "greeting=hi"])
+          TIO.readFile (project ^. #root </> "order.log")
+    viaRun <- observe ["run", "demo"]
+    viaRun `shouldBe` "child-one\ndemo-hi\nquiet\n"
+    viaBlueprint <- observe ["agent", "run", "proto-bp", "--batch"]
+    viaBlueprint `shouldBe` viaRun
+
+  it "repeats commands on an explicit rerun and skips files and commands under --no-baseline" $ do
+    withProject [sentinelCommand] $ \project -> do
+      let root = project ^. #root
+      _ <- succeed project [] ["agent", "run", "proto-bp", "--batch"]
+      _ <- succeed project [] ["agent", "run", "proto-bp", "--batch"]
+      TIO.readFile (root </> "cmd.log") `shouldReturn` "applied\napplied\n"
+      (_, err) <- succeed project [] ["agent", "run", "proto-bp", "--batch", "--no-baseline"]
+      err `shouldNotSatisfy` T.isInfixOf "baseline command"
+      TIO.readFile (root </> "cmd.log") `shouldReturn` "applied\napplied\n"
+    withProject [sentinelCommand] $ \project -> do
+      let root = project ^. #root
+      _ <- succeed project [] ["agent", "run", "proto-bp", "--batch", "--no-baseline"]
+      D.doesFileExist (root </> "cmd.log") `shouldReturn` False
+      D.doesFileExist (root </> "LICENSE") `shouldReturn` False
+
+  it "recovers a receipt-free baseline application and keeps receipts seihou run recorded" $ do
+    -- A project BUG-4 affected: the application exists but holds no receipts.
+    withProject [sentinelCommand] $ \project -> do
+      let root = project ^. #root
+      _ <- succeed project [] ["run", "demo", "--no-commands"]
+      before <- readManifest root
+      demoReceipts before `shouldBe` []
+      _ <- succeed project [] ["agent", "run", "proto-bp", "--batch"]
+      TIO.readFile (root </> "cmd.log") `shouldReturn` "applied\n"
+      after <- readManifest root
+      map (^. #command) (demoReceipts after) `shouldBe` [sentinelCommand]
+    -- seihou run and the baseline share one application record.
+    withProject [sentinelCommand] $ \project -> do
+      let root = project ^. #root
+      _ <- succeed project [] ["run", "demo"]
+      _ <- succeed project [] ["agent", "run", "proto-bp", "--batch"]
+      manifest <- readManifest root
+      map (^. #command) (demoReceipts manifest) `shouldBe` [sentinelCommand]
+      length [a | a <- manifest ^. #applications, a ^. #target == AppliedModuleTarget "demo"] `shouldBe` 1
+
+  it "runs a checkout command once without giving it an ordinary receipt" $
+    withProject [] $ \project -> do
+      let root = project ^. #root
+      writeDemo project (commandsField [checkout "echo checkout >> checkout.log", apply sentinelCommand])
+      _ <- succeed project [] ["agent", "run", "proto-bp", "--batch"]
+      TIO.readFile (root </> "checkout.log") `shouldReturn` "checkout\n"
+      manifest <- readManifest root
+      map (^. #command) (demoReceipts manifest) `shouldBe` [sentinelCommand]
+
+  it "keeps command-free and empty baselines quiet" $ do
+    withProject [] $ \project -> do
+      (_, err) <- succeed project [] ["agent", "run", "proto-bp", "--batch"]
+      err `shouldNotSatisfy` T.isInfixOf "baseline command"
+      D.doesFileExist (project ^. #root </> "LICENSE") `shouldReturn` True
+    withProject [sentinelCommand] $ \project -> do
+      writeBlueprint project "[] : List { module : Text, vars : List { name : Text, value : Text } }"
+      (_, err) <- succeed project [] ["agent", "run", "proto-bp", "--batch"]
+      err `shouldNotSatisfy` T.isInfixOf "baseline command"
+      D.doesFileExist (project ^. #root </> "cmd.log") `shouldReturn` False
+
+  it "refuses a baseline conflict before running any command" $
+    withProject [sentinelCommand] $ \project -> do
+      let root = project ^. #root
+      _ <- succeed project [] ["agent", "run", "proto-bp", "--batch"]
+      TIO.writeFile (root </> "LICENSE") "edited by hand\n"
+      (code, out, err) <- runSeihou project [] ["agent", "run", "proto-bp", "--batch"]
+      code `shouldBe` ExitFailure 1
+      (out <> err) `shouldSatisfy` T.isInfixOf "Baseline conflicts detected"
+      TIO.readFile (root </> "cmd.log") `shouldReturn` "applied\n"
+
+-- ----------------------------------------------------------------------------
+-- Fixture
+-- ----------------------------------------------------------------------------
+
+data Project = Project
+  { root :: !FilePath,
+    binary :: !FilePath,
+    launchLog :: !FilePath,
+    fakeBin :: !FilePath
+  }
+  deriving stock (Generic)
+
+-- | The command the first regression relies on: it fails unless the seed the
+-- module generates is already on disk, and it prints to standard output so
+-- the tests can see where that output lands.
+sentinelCommand :: Text
+sentinelCommand = "test -f nested/start.txt && echo applied >> cmd.log && echo " <> commandOutput
+
+commandOutput :: Text
+commandOutput = "command-says-hello"
+
+firstCommand :: Text
+firstCommand = "echo first >> cmd.log && echo first-output"
+
+-- | A fresh project holding the project-local @demo@ module (one seed, one
+-- managed file, the given Apply commands), a @proto-bp@ blueprint whose
+-- baseline is @demo@, and a fake @claude@ that refuses to answer until the
+-- baseline's sentinel exists.
+withProject :: [Text] -> (Project -> IO a) -> IO a
+withProject commands action =
+  withSystemTempDirectory "baseline-commands" $ \tmp -> do
+    root <- D.canonicalizePath tmp
+    (binary, _) <- prepare root
+    let project =
+          Project
+            { root = root,
+              binary = binary,
+              launchLog = root </> "agent-launch.args",
+              fakeBin = root </> "bin"
+            }
+    TIO.writeFile (root </> ".gitignore") "/home/\n/config/\n/cache/\n/bin/\n/agent-launch.args\n"
+    writeDemo project (if null commands then "" else commandsField (map apply commands))
+    writeBlueprint project "[ { module = \"demo\", vars = [] : List { name : Text, value : Text } } ]"
+    D.createDirectoryIfMissing True (project ^. #fakeBin)
+    let fakeClaude = project ^. #fakeBin </> "claude"
+    TIO.writeFile
+      fakeClaude
+      ( T.unlines
+          [ "#!/bin/sh",
+            "printf '%s\\n' \"$@\" > \"$SEIHOU_FAKE_AGENT_LOG\"",
+            "if [ -n \"$SEIHOU_BASELINE_SENTINEL\" ] && [ ! -f \"$SEIHOU_BASELINE_SENTINEL\" ]; then echo 'baseline sentinel missing' >&2; exit 1; fi",
+            "printf '%s\\n' '{\"result\":\"baseline complete\",\"is_error\":false,\"session_id\":\"fake\"}'"
+          ]
+      )
+    permissions <- D.getPermissions fakeClaude
+    -- Permissions has no Generic instance, so record update is the only option.
+    D.setPermissions fakeClaude (permissions {D.executable = True})
+    action project
+
+writeDemo :: Project -> Text -> IO ()
+writeDemo project extra =
+  TIO.writeFile
+    (project ^. #root </> ".seihou/modules/demo/module.dhall")
+    ( "let S = ./schema/package.dhall in S.Module::{name = \"demo\", version = Some \"1.0.0\""
+        <> ", steps = [S.Step::{strategy = \"copy\", src = \"starter\", dest = \"nested/start.txt\", lifecycle = Some \"seed\"}, S.Step::{strategy = \"copy\", src = \"license\", dest = \"LICENSE\"}]"
+        <> extra
+        <> "}"
+    )
+
+writeChild :: Project -> IO ()
+writeChild project = do
+  let child = project ^. #root </> ".seihou/modules/child"
+  D.createDirectoryIfMissing True child
+  TIO.writeFile
+    (child </> "module.dhall")
+    ( "let S = ../demo/schema/package.dhall in S.Module::{name = \"child\", version = Some \"1.0.0\""
+        <> ", vars = [S.VarDecl::{name = \"slot\", type = \"text\", default = Some \"base\"}]"
+        <> commandsField [apply "echo child-{{slot}} >> order.log"]
+        <> "}"
+    )
+
+writeBlueprint :: Project -> Text -> IO ()
+writeBlueprint project baseModules = do
+  let dir = project ^. #root </> ".seihou/modules/proto-bp"
+  D.createDirectoryIfMissing True dir
+  TIO.writeFile
+    (dir </> "blueprint.dhall")
+    ( T.unlines
+        [ "{ name = \"proto-bp\"",
+          ", version = Some \"1.0.0\"",
+          ", description = Some \"Baseline command fixture\"",
+          ", prompt = \"Extend the baseline.\"",
+          ", vars = [] : List { name : Text, type : Text, default : Optional Text, description : Optional Text, required : Bool, validation : Optional Text }",
+          ", prompts = [] : List { var : Text, text : Text, when : Optional Text, choices : Optional (List Text) }",
+          ", baseModules = " <> baseModules,
+          ", files = [] : List { src : Text, description : Optional Text }",
+          ", allowedTools = None (List Text)",
+          ", tags = [] : List Text",
+          ", migrations = [] : List { from : Text, to : Text, prompt : Text }",
+          "}"
+        ]
+    )
+
+commandsField :: [Text] -> Text
+commandsField commands = ", commands = [" <> T.intercalate ", " commands <> "]"
+
+apply :: Text -> Text
+apply = commandOf "Apply" ""
+
+checkout :: Text -> Text
+checkout = commandOf "Checkout" ""
+
+commandOf :: Text -> Text -> Text -> Text
+commandOf action extra text = "S.Command::{action = S.Command.Action." <> action <> " " <> dhallText text <> extra <> "}"
+
+dhallText :: Text -> Text
+dhallText text = "\"" <> T.replace "\"" "\\\"" text <> "\""
+
+-- | Run the binary in the project with isolated home, configuration, and
+-- caches, the fake provider first on PATH, and no inherited agent settings.
+runSeihou :: Project -> [(String, String)] -> [String] -> IO (ExitCode, Text, Text)
+runSeihou project extraEnv args = do
+  inherited <- getEnvironment
+  let root = project ^. #root
+      inheritedPath = fromMaybe "" (lookup "PATH" inherited)
+      overrides =
+        [ ("HOME", root </> "home"),
+          ("XDG_CONFIG_HOME", root </> "config"),
+          ("XDG_CACHE_HOME", root </> "cache"),
+          ("PATH", project ^. #fakeBin <> [searchPathSeparator] <> inheritedPath),
+          ("SEIHOU_FAKE_AGENT_LOG", project ^. #launchLog)
+        ]
+          <> extraEnv
+      cleared = ["SEIHOU_AGENT_PROVIDER", "SEIHOU_AGENT_MODEL", "SEIHOU_AGENT_EFFORT", "SEIHOU_AGENT_TRACE", "SEIHOU_CONTEXT"]
+      environment = overrides <> filter (\(key, _) -> key `notElem` (map fst overrides <> cleared)) inherited
+  (code, out, err) <- readCreateProcessWithExitCode (proc (project ^. #binary) args) {cwd = Just root, env = Just environment} ""
+  pure (code, T.pack out, T.pack err)
+
+succeed :: Project -> [(String, String)] -> [String] -> IO (Text, Text)
+succeed project extraEnv args = do
+  (code, out, err) <- runSeihou project extraEnv args
+  case code of
+    ExitSuccess -> pure (out, err)
+    ExitFailure n -> expectationFailure (unwords args <> " exited " <> show n <> "\nstdout:\n" <> T.unpack out <> "\nstderr:\n" <> T.unpack err) >> pure (out, err)
diff --git a/test/Seihou/CLI/BlueprintMigrationSpec.hs b/test/Seihou/CLI/BlueprintMigrationSpec.hs
--- a/test/Seihou/CLI/BlueprintMigrationSpec.hs
+++ b/test/Seihou/CLI/BlueprintMigrationSpec.hs
@@ -704,7 +704,8 @@
       toVersion,
       outcome,
       appliedAt = read "2026-07-20 12:00:00 UTC" :: UTCTime,
-      agentSessionId = Nothing
+      agentSessionId = Nothing,
+      callerToolPolicy = Nothing
     }
 
 version :: Text -> Version
diff --git a/test/Seihou/CLI/CommandReceiptE2ESpec.hs b/test/Seihou/CLI/CommandReceiptE2ESpec.hs
--- a/test/Seihou/CLI/CommandReceiptE2ESpec.hs
+++ b/test/Seihou/CLI/CommandReceiptE2ESpec.hs
@@ -1,4 +1,4 @@
-module Seihou.CLI.CommandReceiptE2ESpec (tests) where
+module Seihou.CLI.CommandReceiptE2ESpec (tests, initCommand, commitCommand, demoReceipts, committedManifest) where
 
 import Control.Monad (filterM)
 import Data.ByteString qualified as BS
diff --git a/test/Seihou/CLI/JudgementCheckSpec.hs b/test/Seihou/CLI/JudgementCheckSpec.hs
--- a/test/Seihou/CLI/JudgementCheckSpec.hs
+++ b/test/Seihou/CLI/JudgementCheckSpec.hs
@@ -29,7 +29,7 @@
 import Seihou.Effect.ManifestStore (writeManifest)
 import Seihou.Effect.ManifestStoreInterp (runManifestStore)
 import Seihou.Manifest.Judgement (definitionDigest)
-import Seihou.Manifest.Types (emptyManifest, manifestFromJSON)
+import Seihou.Manifest.Types (currentManifestVersion, emptyManifest, manifestFromJSON)
 import Seihou.Prelude
 import System.Directory (createDirectoryIfMissing, doesFileExist, executable, getPermissions)
 import System.FilePath (takeDirectory)
@@ -212,7 +212,7 @@
     it "ships the bundled security-review with the unqualified gate off" $ do
       Right d <- evalJudgementFromFile "data/judgements/security-review/judgement.dhall"
       map (^. #useGate) (toList (d ^. #checks)) `shouldBe` [False, False]
-    it "records the snapshot at schema 15 and installs the hook, idempotently" $ withRepo $ \dir -> do
+    it "records the snapshot on a new manifest and installs the hook, idempotently" $ withRepo $ \dir -> do
       sc <- findScanner
       case sc of
         Nothing -> pendingWith "gitleaks is not on PATH"
@@ -220,7 +220,7 @@
           Right plan <- planAdoption dir (AdoptionInputs route (Just ApprovedRemote) sc Nothing) (Just ApprovedRemote) DirectAdoption BundledJudgement docsJudgement
           applyAdoption plan `shouldReturn` Right ()
           Right m <- manifestFromJSON . LBS.fromStrict <$> BS.readFile (dir </> ".seihou" </> "manifest.json")
-          m ^. #version `shouldBe` ManifestSchemaVersion 15
+          m ^. #version `shouldBe` currentManifestVersion
           map (^. #definition . #name) (m ^. #judgements) `shouldBe` ["docs-review"]
           TIO.readFile (dir </> ".git" </> "hooks" </> "pre-commit") >>= (`shouldSatisfy` T.isInfixOf hookMarker)
           Right again <- planAdoption dir (AdoptionInputs route (Just ApprovedRemote) sc Nothing) (Just ApprovedRemote) DirectAdoption BundledJudgement docsJudgement
diff --git a/test/Seihou/CLI/ManifestCapabilityUpgradeSpec.hs b/test/Seihou/CLI/ManifestCapabilityUpgradeSpec.hs
--- a/test/Seihou/CLI/ManifestCapabilityUpgradeSpec.hs
+++ b/test/Seihou/CLI/ManifestCapabilityUpgradeSpec.hs
@@ -20,7 +20,7 @@
   )
 import Seihou.Core.Types
 import Seihou.Manifest.Hash (hashContent)
-import Seihou.Manifest.Types (emptyManifest, manifestFromJSON)
+import Seihou.Manifest.Types (currentManifestVersion, emptyManifest, manifestFromJSON)
 import System.Directory (doesFileExist, removeDirectoryRecursive, withCurrentDirectory)
 import System.Environment (lookupEnv, setEnv, unsetEnv)
 import System.FilePath ((</>))
@@ -294,7 +294,7 @@
         case manifestFromJSON written of
           Left err -> expectationFailure err
           Right upgraded -> do
-            (upgraded ^. #version) `shouldBe` ManifestSchemaVersion 15
+            (upgraded ^. #version) `shouldBe` currentManifestVersion
             (^. #sharedWriteMode) <$> Map.lookup ".gitignore" (upgraded ^. #files)
               `shouldBe` Just SharedWriteAdditiveOnly
         TIO.readFile (fixture ^. #gitignorePath) `shouldReturn` gitignoreBefore
diff --git a/test/Seihou/CLI/ManifestRepairOriginsSpec.hs b/test/Seihou/CLI/ManifestRepairOriginsSpec.hs
--- a/test/Seihou/CLI/ManifestRepairOriginsSpec.hs
+++ b/test/Seihou/CLI/ManifestRepairOriginsSpec.hs
@@ -44,7 +44,7 @@
          ]
     & #applications .~ [betaApplication]
     & #recipe ?~ AppliedRecipe (RecipeName "stack") (origin (localPath <> "/") "stack") (Just "1.0.0") testTime
-    & #blueprint ?~ AppliedBlueprint "service" (origin localPath "service") (Just "2.0.0") testTime [] False Nothing Nothing
+    & #blueprint ?~ AppliedBlueprint "service" (origin localPath "service") (Just "2.0.0") testTime [] False Nothing Nothing Nothing
     & #blueprintMigrations .~ [receipt]
   where
     betaApplication =
@@ -64,7 +64,7 @@
           recipeChain = Nothing
         }
     receipt =
-      AppliedBlueprintMigration "service" (origin localPath "service") (Just "2.0.0") "1.0.0" "2.0.0" MigrationApplied testTime Nothing
+      AppliedBlueprintMigration "service" (origin localPath "service") (Just "2.0.0") "1.0.0" "2.0.0" MigrationApplied testTime Nothing Nothing
 
 sitesFor :: Manifest -> [OriginSite]
 sitesFor manifest = concat (Map.elems (localOriginUrls manifest))
diff --git a/test/Seihou/CLI/ManifestUpgradeSpec.hs b/test/Seihou/CLI/ManifestUpgradeSpec.hs
--- a/test/Seihou/CLI/ManifestUpgradeSpec.hs
+++ b/test/Seihou/CLI/ManifestUpgradeSpec.hs
@@ -264,12 +264,12 @@
         outcome <- runManifestUpgrade (opts False False Nothing)
         case outcome of
           UpgradeWritten result -> do
-            map stepVersions (result ^. #steps) `shouldBe` [(6, 7), (7, 8), (8, 9), (9, 10), (10, 11), (11, 12), (12, 13), (13, 14), (14, 15)]
+            map stepVersions (result ^. #steps) `shouldBe` [(6, 7), (7, 8), (8, 9), (9, 10), (10, 11), (11, 12), (12, 13), (13, 14), (14, 15), (15, 16)]
             (result ^. #entries) `shouldBe` []
-            (result ^. #toVersion) `shouldBe` ManifestSchemaVersion 15
+            (result ^. #toVersion) `shouldBe` ManifestSchemaVersion 16
           other -> expectationFailure ("expected a write, got " <> show other)
         document <- readDocument manifestPath
-        lookupPath ["version"] document `shouldBe` Just (Aeson.Number 15)
+        lookupPath ["version"] document `shouldBe` Just (Aeson.Number 16)
         lookupPath ["files", ".gitignore", "sharedWriteMode"] document `shouldBe` Just (Aeson.String "additive-only")
         lookupPath ["files", "README.md", "sharedWriteMode"] document `shouldBe` Just (Aeson.String "unknown")
         lookupPath ["files", ".gitignore", "additiveOnly"] document `shouldBe` Nothing
@@ -281,7 +281,7 @@
         before <- LBS.readFile manifestPath
         outcome <- runManifestUpgrade (opts False False Nothing)
         case outcome of
-          UpgradeNotNeeded version _ -> version `shouldBe` ManifestSchemaVersion 15
+          UpgradeNotNeeded version _ -> version `shouldBe` ManifestSchemaVersion 16
           other -> expectationFailure ("expected nothing to do, got " <> show other)
         LBS.readFile manifestPath `shouldReturn` before
 
@@ -310,7 +310,7 @@
         outcome <- runManifestUpgrade (opts True True Nothing)
         case outcome of
           UpgradeWouldWrite result [] -> do
-            map stepVersions (result ^. #steps) `shouldBe` [(5, 6), (6, 7), (7, 8), (8, 9), (9, 10), (10, 11), (11, 12), (12, 13), (13, 14), (14, 15)]
+            map stepVersions (result ^. #steps) `shouldBe` [(5, 6), (6, 7), (7, 8), (8, 9), (9, 10), (10, 11), (11, 12), (12, 13), (13, 14), (14, 15), (15, 16)]
             map (^. #artifactName) (result ^. #entries)
               `shouldBe` ["haskell-base", "project-lint", "haskell-service", "scratch-helper"]
             let report = formatUpgradeReport result
@@ -335,10 +335,10 @@
         outcome <- runManifestUpgrade (opts False True Nothing)
         case outcome of
           UpgradeWritten result ->
-            map stepVersions (result ^. #steps) `shouldBe` [(2, 3), (3, 4), (4, 5), (5, 6), (6, 7), (7, 8), (8, 9), (9, 10), (10, 11), (11, 12), (12, 13), (13, 14), (14, 15)]
+            map stepVersions (result ^. #steps) `shouldBe` [(2, 3), (3, 4), (4, 5), (5, 6), (6, 7), (7, 8), (8, 9), (9, 10), (10, 11), (11, 12), (12, 13), (13, 14), (14, 15), (15, 16)]
           other -> expectationFailure ("expected a write, got " <> show other)
         document <- readDocument manifestPath
-        lookupPath ["version"] document `shouldBe` Just (Aeson.Number 15)
+        lookupPath ["version"] document `shouldBe` Just (Aeson.Number 16)
 
     it "rejects a target newer than this build or older than the document" $ do
       withUpgradeProject schema6Manifest $ \_ ->
@@ -366,7 +366,7 @@
         output `shouldSatisfy` T.isInfixOf "5 -> 6"
         output `shouldSatisfy` T.isInfixOf "6 -> 7"
         document <- readDocument manifestPath
-        lookupPath ["version"] document `shouldBe` Just (Aeson.Number 15)
+        lookupPath ["version"] document `shouldBe` Just (Aeson.Number 16)
         lookupPath ["modules", "0", "origin"] document
           `shouldBe` Just (Aeson.toJSON (RemoteOrigin "https://example.com/demo-modules.git" "demo" (Just "demo-modules")))
         filter absoluteLooking (documentStrings document) `shouldBe` []
diff --git a/test/Seihou/CLI/RecipeExtensionE2ESpec.hs b/test/Seihou/CLI/RecipeExtensionE2ESpec.hs
--- a/test/Seihou/CLI/RecipeExtensionE2ESpec.hs
+++ b/test/Seihou/CLI/RecipeExtensionE2ESpec.hs
@@ -77,7 +77,7 @@
       before <- readManifest root
       case Aeson.eitherDecode before :: Either String Aeson.Value of
         Right (Aeson.Object fields) -> do
-          KM.lookup "version" fields `shouldBe` Just (Aeson.toJSON (15 :: Int))
+          KM.lookup "version" fields `shouldBe` Just (Aeson.toJSON (16 :: Int))
           T.pack (show fields) `shouldSatisfy` T.isInfixOf "recipeChain"
           T.pack (show fields) `shouldSatisfy` T.isInfixOf "descriptorHash"
         other -> expectationFailure (show other)
diff --git a/test/Seihou/CLI/SeedRunE2ESpec.hs b/test/Seihou/CLI/SeedRunE2ESpec.hs
--- a/test/Seihou/CLI/SeedRunE2ESpec.hs
+++ b/test/Seihou/CLI/SeedRunE2ESpec.hs
@@ -25,7 +25,7 @@
 
 invoke binary root args = do
   inherited <- getEnvironment
-  let overrides = [("HOME", root </> "home"), ("XDG_CONFIG_HOME", root </> "config"), ("XDG_CACHE_HOME", root </> "cache")]
+  let overrides = [("PATH", (root </> "bin") <> ":" <> maybe "" id (lookup "PATH" inherited)), ("HOME", root </> "home"), ("XDG_CONFIG_HOME", root </> "config"), ("XDG_CACHE_HOME", root </> "cache")]
   readCreateProcessWithExitCode (proc binary args) {cwd = Just root, env = Just (overrides <> filter (\(key, _) -> key `notElem` map fst overrides) inherited)} ""
 
 success binary root args = do
@@ -171,14 +171,19 @@
       let blueprint = root </> ".seihou/modules/seed-blueprint"
       D.createDirectoryIfMissing True blueprint
       TIO.writeFile (blueprint </> "blueprint.dhall") "let S = ../demo/schema/package.dhall in S.Blueprint::{name=\"seed-blueprint\",version=Some \"1.0.0\",prompt=\"Describe the accepted baseline.\", baseModules = [ S.Dependency::{ module = \"demo\" } ]}"
-      _ <- success binary root ["agent", "--debug", "run", "seed-blueprint", "--force"]
+      let provider = root </> "bin/claude"
+      D.createDirectoryIfMissing True (takeDirectory provider)
+      TIO.writeFile provider "#!/bin/sh\necho '{\"result\":\"done\"}'\n"
+      permissions <- D.getPermissions provider
+      D.setPermissions provider (permissions {D.executable = True})
+      _ <- success binary root ["agent", "run", "seed-blueprint", "--batch", "--provider", "claude-cli", "--force"]
       first <- readManifest root
       Map.member "nested/start.txt" (first ^. #seeds) `shouldBe` True
       TIO.writeFile (root </> "nested/start.txt") "agent project changes\n"
-      _ <- success binary root ["agent", "--debug", "run", "seed-blueprint", "--force"]
+      _ <- success binary root ["agent", "run", "seed-blueprint", "--batch", "--provider", "claude-cli", "--force"]
       TIO.readFile (root </> "nested/start.txt") `shouldReturn` "agent project changes\n"
       D.removeFile (root </> "nested/start.txt")
-      _ <- success binary root ["agent", "--debug", "run", "seed-blueprint", "--force"]
+      _ <- success binary root ["agent", "run", "seed-blueprint", "--batch", "--provider", "claude-cli", "--force"]
       D.doesPathExist (root </> "nested/start.txt") `shouldReturn` False
   it "reports receipts without drift and retires a seed-only owner without a removal specification" $
     withSystemTempDirectory "seed-remove" $ \root -> do
diff --git a/test/Seihou/CLI/StatusSpec.hs b/test/Seihou/CLI/StatusSpec.hs
--- a/test/Seihou/CLI/StatusSpec.hs
+++ b/test/Seihou/CLI/StatusSpec.hs
@@ -145,7 +145,8 @@
       baselineModules = map ModuleName baselines,
       noBaseline = noBL,
       userPrompt = prompt,
-      agentSessionId = Nothing
+      agentSessionId = Nothing,
+      callerToolPolicy = Nothing
     }
 
 withManifestBlueprint :: Maybe AppliedBlueprint -> Manifest -> Manifest
@@ -166,7 +167,8 @@
       toVersion = toVersion,
       outcome = outcome,
       appliedAt = fixedTime,
-      agentSessionId = Nothing
+      agentSessionId = Nothing,
+      callerToolPolicy = Nothing
     }
 
 spec :: Spec
diff --git a/test/Seihou/CLI/UpdateE2ESpec.hs b/test/Seihou/CLI/UpdateE2ESpec.hs
--- a/test/Seihou/CLI/UpdateE2ESpec.hs
+++ b/test/Seihou/CLI/UpdateE2ESpec.hs
@@ -359,7 +359,7 @@
       expectSuccess "targeted update" exitCode stdoutText stderrText
       stdoutText `shouldSatisfy` T.isInfixOf "\"outcome\":\"applied\""
       manifestText <- TIO.readFile (fixture ^. #manifestPath)
-      manifestText `shouldSatisfy` T.isInfixOf "\"version\":15"
+      manifestText `shouldSatisfy` T.isInfixOf "\"version\":16"
       manifestText `shouldSatisfy` T.isInfixOf "\"sharedWriteMode\":\"additive-only\""
       -- Recording an answer must not touch a single byte of the project.
       TIO.readFile (fixture ^. #gitignorePath) `shouldReturn` beforeGitignore
@@ -419,7 +419,7 @@
       case decoded of
         Left err -> expectationFailure err
         Right manifest -> do
-          (manifest ^. #version) `shouldBe` ManifestSchemaVersion 15
+          (manifest ^. #version) `shouldBe` ManifestSchemaVersion 16
           case Map.lookup ".gitignore" (manifest ^. #files) of
             Nothing -> expectationFailure "the manifest lost .gitignore"
             Just record -> do
diff --git a/test/Seihou/CLI/UpdateSpec.hs b/test/Seihou/CLI/UpdateSpec.hs
--- a/test/Seihou/CLI/UpdateSpec.hs
+++ b/test/Seihou/CLI/UpdateSpec.hs
@@ -667,7 +667,7 @@
                   Nothing -> expectationFailure "expected a manifest preparation"
                   Just preparation -> do
                     (preparation ^. #fromVersion) `shouldBe` ManifestSchemaVersion 6
-                    (preparation ^. #toVersion) `shouldBe` currentManifestVersion
+                    (preparation ^. #toVersion) `shouldBe` ManifestSchemaVersion 15
                     (preparation ^. #modeChanges)
                       `shouldBe` Map.singleton ".gitignore" (SharedWriteUnknown, SharedWriteAdditiveOnly)
                 map (^. #applicationId) (plan ^. #applications) `shouldBe` [fixture ^. #alphaApplicationId]
@@ -691,7 +691,7 @@
       withSystemTempDirectory "seihou-update-schema-5" $ \root -> do
         fixture <- prepareSharedPathFixture CoOwnerAppends root
         manifestText <- TIO.readFile (fixture ^. #manifestPath)
-        TIO.writeFile (fixture ^. #manifestPath) (T.replace "\"version\":15" "\"version\":5" manifestText)
+        TIO.writeFile (fixture ^. #manifestPath) (T.replace "\"version\":16" "\"version\":5" manifestText)
         withSavedEnv "XDG_CONFIG_HOME" (Just (fixture ^. #xdgHome)) $
           withCurrentDirectory (fixture ^. #projectRoot) $ do
             forM_ [NamedUpdateTargets ["alpha"], AllRecordedApplications] $ \selection -> do
diff --git a/test/Seihou/CLI/UpgradeDiagnosisSpec.hs b/test/Seihou/CLI/UpgradeDiagnosisSpec.hs
--- a/test/Seihou/CLI/UpgradeDiagnosisSpec.hs
+++ b/test/Seihou/CLI/UpgradeDiagnosisSpec.hs
@@ -43,7 +43,7 @@
       withFixture CoOwnerAppendsPredatingEvidence noDamage $ \_ _ diagnose -> do
         checks <- readiness <$> diagnose "alpha"
         statusOf "manifest-schema-current" checks `shouldBe` NeedsAttention
-        detailOf "manifest-schema-current" checks `shouldSatisfy` T.isInfixOf "schema 6 is older than 15"
+        detailOf "manifest-schema-current" checks `shouldSatisfy` T.isInfixOf "schema 6 is older than 16"
         statusOf "shared-evidence-known" checks `shouldBe` NeedsAttention
         detailOf "shared-evidence-known" checks `shouldBe` ".gitignore is shared with beta and its write mode is unknown"
         statusOf "update-plans-cleanly" checks `shouldBe` Ready
@@ -59,7 +59,7 @@
         ((^. #errorCode) <$> diagnosis ^. #updateDryRun) `shouldBe` ProbeOk (Just "shared_write_evidence_unavailable")
 
     it "reports a schema-5 manifest as needing seihou manifest upgrade" $
-      withFixture CoOwnerAppends (withManifestText (T.replace "\"version\":15" "\"version\":5")) $ \_ _ diagnose -> do
+      withFixture CoOwnerAppends (withManifestText (T.replace "\"version\":16" "\"version\":5")) $ \_ _ diagnose -> do
         diagnosis <- diagnose "alpha"
         let checks = readiness diagnosis
         statusOf "manifest-readable" checks `shouldBe` NeedsAttention
@@ -154,7 +154,7 @@
       [ ("healthy" :: Text, CoOwnerAppends, const (pure ())),
         ("schema 6", CoOwnerAppendsPredatingEvidence, const (pure ())),
         ("evidence unavailable", CoOwnerAppendsPredatingEvidence, evidenceUnavailable),
-        ("schema 5", CoOwnerAppends, withManifestText (T.replace "\"version\":15" "\"version\":5")),
+        ("schema 5", CoOwnerAppends, withManifestText (T.replace "\"version\":16" "\"version\":5")),
         ("not json", CoOwnerAppends, withManifestText (const "{not json")),
         ("local origin", CoOwnerAppends, localBetaOrigin),
         ("pending transaction", CoOwnerAppends, pendingTransaction)
