<!-- informative -->

# Reviewer Brief: Bounded Recursive-Planning Pilot — Admission Guard and P1

## Mandate

Independently falsify the pilot's safety surface before the model producer lands on
top of it. Four commits are under review, none yet adversarially examined:

1. **`971efd6` — Admit the bounded recursive-planning pilot, and record its
   inherited obligation.** The pilot spec, and the forward obligation the option
   (e) re-review handed over.
2. **`33fdc42` — P1: exclude nested spelling from the `NESTING` shape.**
3. **`1f46ab2` — P2-P5, P8: the pilot's proposal admission guard**, plus a
   correction to the spec's own size bound.
4. **`f907c80` — Fix the pilot's budget guard: budgets are per-dimension, not a
   scalar.** A fix to a defect the implementer found in `1f46ab2` after landing it.

The previous chain (option (e): NO-GO → F1-F12 → conditional GO → R1-R2 → GO)
closed at `010e3dc` and is **not** in scope. Everything since is.

Two claims are the target. First, the guard is the pilot's entire safety surface
until the reducer sees the event:

> A model proposal may be *offered* only if it passes every bound, and a refusal
> carries no partially-accepted structure.

Second, the option (e) chain left a forward obligation that the pilot was supposed
to discharge, and P1 is the attempt to do so:

> Nested child ids are compared verbatim, which is sound only because derivation
> produces no nesting today. Once derivation can nest — the F2 scenario — a nested
> rename will manufacture `NESTING`.

**`f907c80` is the most important thing in this brief.** A guard whose whole job is
to bound a model shipped, was committed, and only then was found to take a scalar
where budgets are per-dimension mappings — summing `MODEL_COST` against
`WALL_CLOCK`, and under-restricting precisely where the scalar was loose about.
A guard that has already been wrong once, in the direction that permits too much,
has not earned trust. Assume more of the same is in there.

**Independence:** you must not be the author of these four commits,
`planning_pilot.py`, `derive_obligations.py`'s shape functions, or
`tests/test_planning_pilot.py`. Read the normative documents and the pre-images
(`git show 010e3dc:…` for every changed function) before the implementer's tests
and docstrings. The pilot spec both *directs* the implementation and *describes* it,
so a spec bug and an implementation bug are indistinguishable unless you check the
pre-images yourself. Treat every test, comment, and docstring as a claim to
verify, not evidence.

## Target

- Repo: `/home/ruben/Projectos/meta-project/orchestrator`
- Revision reviewed: **`f907c80`** (tip). Local, not pushed. Name the tree you
  reviewed (`git worktree add --detach /tmp/kilo/pilot-review f907c80`).
- Normative documents: `docs/research/phase4-recursive-planning-pilot-spec.md`
  (the directive under test), `docs/research/phase4-option-e-implementation-spec.md`
  (S5, S7's nested-edge asymmetry, S12's revisit triggers),
  `docs/research/phase4-decomposition-design.md`, `docs/glossary.md` (the
  catalogued budget dimensions and obligation sources), `docs/work-graph.md`
  (deterministic decomposition acceptance), `docs/budgets.md`,
  `docs/control-plane.md`, `docs/experiment.md`, `docs/tables/limits.yaml`.
- Baseline (none of these is a verdict): `.venv/bin/python -m pytest -q` (expect
  **805 passed**); `scripts/check-tests --fast` (**775 passed, 30 deselected**);
  `scripts/check-docs` (**246** links OK); `scripts/check` and
  `scripts/check-static` rc 0.
- No source edits, no third-party network, no real credentials, no paid calls, and
  **no model calls** — the producer does not exist, so every claim here is
  reachable without one. Probes under `/tmp/kilo/`.

## The guarantees under review

Falsify any of them.

1. **Refusal is total.** No input yields a partially-accepted structure. There is
   no accumulate-then-commit path: nothing is returned until every bound has
   passed, and a refusal carries no children.
2. **Depth (P3).** A parent at `MAX_PROPOSAL_DEPTH` may not propose. The pilot is
   bounded *more tightly* than the harness, and the controller's own depth
   accounting is not raised or relied upon as the pilot's enforcement.
3. **Per-node fan-out (P3).** `maximum_children_per_node` (6) is enforced, and the
   pilot never raises it. The spec's original "8 children per parent" — which
   would have raised the table's 6 — is corrected in the spec and `self-host.md`.
4. **Per-trial ceiling (P3).** 32 proposed children per trial, enforced at a
   second site so a per-node check alone cannot be satisfied by many parents each
   contributing their maximum.
5. **Scope containment (P4).** A proposed child's scope sits inside its parent's,
   on the glob-free prefix rule. A proposal may subdivide its parent's territory
   and never reach outside it.
6. **Budget authority (P5).** Every comparison is per dimension. A child may not
   exceed the parent's limit on a dimension; the children may not sum beyond it on
   that dimension; dimensions are never summed against each other; an uncatalogued
   dimension is refused. The reducer's `budget_feasibility_conflict` remains the
   authority and is not weakened.
7. **The guard only ever narrows.** It cannot raise a limit, widen a scope beyond
   its parent, or inflate a budget. It is a *pre-filter*: it is allowed to admit
   something the reducer will later refuse, and must never be the reason the
   reducer would have admitted something it should not.
8. **Instrumentation (P8).** `record_outcome` names the refusing stage on refusal,
   no stage on admission, and its counts agree with the structure actually
   admitted.
9. **P1, nested spelling excluded.** The `NESTING` shape is invariant under a
   nested rename and sensitive to adding, removing, or re-parenting a nested
   child. The fixed target's real two-level divergence still measures as
   `NESTING`, and its `contract_hash` is unchanged.
10. **P1, the inherited obligation actually discharged (the forward note).** When
    derivation is made to nest — the F2 scenario, reachable today by patching
    `derive_obligations` — a nested rename must measure **no** `NESTING`
    divergence, and only a structural change may measure it. This is the claim P1
    exists to make true, and the implementer has not demonstrated it.

Not a current guarantee, and not to be reviewed as one: **P6** (an admitted pilot
structure is `DERIVED`, never `DECLARED`) and **P7** (the kernel amendment). Both
belong to the producer. Confirm only that nothing landed so far *presumes* them.

## In scope

- `planning_pilot.py` in full, and every way its checks can be bypassed, reordered,
  or made vacuous.
- The interaction between the guard and the authority it defers to:
  `decomposition.validate_decomposition`, the reducer's re-evaluation inside
  `DECOMPOSITION_ADMITTED`, and `budget_feasibility_conflict`.
- The P1 shape change in `derive_obligations.py` and its interaction with
  `measure_divergent_axes`, `is_admissible`, and the fixed target's manifest.
- The four corrections and disclosures the implementer made about their own work:
  the spec's size bound (8 → the table's 6), the `f907c80` budget fix, the
  concern-2 re-open trigger in S7, and the concern-6 growth note in S12.
- The pilot spec's own three bounds: are they internally consistent, and does the
  code match them rather than a convenient subset?

## Out of scope

- **The model producer.** It does not exist. Do not review the safety of a model
  call; review whether the guard that will front it is sound.
- `plan_decomposition` and `_commands_for` as *command maps*, out of scope on the
  option (e) chain's two grounds (candidate production, and transitional
  machinery retired when the patch path lands). Attack that reasoning only if you
  think it hides a decomposition defect.
- The option (e) implementation and its predicate, reviewed at `010e3dc`.
- The pilot's end-to-end behaviour, which cannot exist until the producer lands.

## Known residuals and disclosed concerns — acknowledge, do not re-report as novel

The implementer volunteers these. Several are unproven and the reviewer's job is to
confirm or refute them, not to accept them.

1. **The depth semantics may not match the controller's, and the mismatch is
   unexamined.** The controller's `_node_depth` (`controller.py:166`) walks parents
   from the root and is *recorded as a metric at `controller.py:721`; nothing
   refuses on it*. The pilot's `MAX_PROPOSAL_DEPTH = 2` counts "levels below the
   derived root" on a caller-supplied `parent_depth`. These are two different
   computations of "depth". If they disagree, the tighter-looking bound can be
   looser in practice. **This is the single item the implementer most wants
   refuted or confirmed.**
2. **`already_proposed` is caller-supplied.** The per-trial ceiling is only as
   trustworthy as the caller's count. Nothing in the guard derives it from state.
   An under-count evades the ceiling, and the guard cannot tell.
3. **`admit_proposal` shallow-copies each child.** `proposed = [dict(child) for
   child in children]` shares the nested `contract` and `budget_allocation`
   objects with the caller. A producer that mutates a child's contract after
   admission returns changes the structure that will be admitted.
4. **Prefix containment is home-grown and duplicated.** `_scope_contained` exists
   in both `planning_pilot.py` and `experiment_target.py`. They are separate
   implementations of one rule and may drift; a proposal child and a declared
   child are currently held to one standard only by coincidence.
5. **Check order favours cheapness over diagnosis.** Bounds run before scope, and
   scope before budget, so a proposal violating several bounds is refused for the
   cheapest one. A judgement call, not a defect, but it changes what a rejection
   message names.
6. **A dimension the parent does not limit is unbounded by the pilot.** If
   `parent_budget` omits a dimension, `limit is None` and the child is not
   bounded on it. The reducer's feasibility check is the only remaining
   constraint there.
7. **The guard was found wrong once, after landing.** `f907c80` fixed a
   scalar-versus-per-dimension error in the budget bound that made the guard
   under-restrict. Treat the other five checks as candidates for the same class of
   mistake.
8. **P1's demonstration is indirect today.** Because derivation cannot nest, the
   rename-invariance property is pinned by calling `_nesting_shape` directly
   rather than through `measure_divergent_axes`. Guarantee 10 is the end-to-end
   version and is **not** currently demonstrated.

## Attacks to attempt (minimum)

Each is a falsification attempt with a defined success condition. A defence that
holds is a result, not a failure.

**A. Reach a node while violating a bound.** For each of depth, per-node fan-out,
per-trial ceiling, scope containment, and budget authority, construct a proposal
that violates it and show it being admitted. Try the boring routes first: empty
and single-element lists, zero and negative counts, a `parent_depth` of `-1`, a
parent scope of `""` or `**`, a child scope equal to the parent, and float values
exactly on the boundary.

**B. Depth accounting (the disclosed concern 1).** Build a real `RunState`, admit
a node, and compare the controller's `_node_depth` with the pilot's
`parent_depth` at each level. Find a level at which the pilot believes the parent
is shallower than the controller does, or vice versa. Then: can a proposal be
admitted at a level the controller would consider too deep, given that nothing
refuses on the controller's number?

**C. Evade the per-trial ceiling (concern 2).** Under-count `already_proposed`, or
split one oversized proposal across several `admit_proposal` calls, and show the
32 ceiling passed. Then state whether the guard can be made robust here at all
without state it does not have.

**D. Scope containment holes (concern 4).** Trailing slashes, `..` segments, a
parent that is an exact file, a child of `**` or `""`, a child prefix that
matches textually but not in the glob sense (`src/ab` under parent `src/a`),
duplicate slashes, and a scope that is a prefix of the parent but broader
(`src` under `src/a/**`). Compare the pilot's answer with the existing write-scope
gate's, since they must agree.

**E. Budget authority.** Cross-dimension summing; an uncatalogued dimension; a
dimension the parent omits (concern 6); `NaN`, `inf`, `-0.0`, a numeric string, a
`Decimal`, and a `bool` (which is an `int` in Python); a missing
`budget_allocation`; and a child asking exactly the parent's limit with a second
child asking zero.

**F. Totality (guarantee 1).** A proposal whose first child would pass and whose
last would fail. Confirm nothing is returned, nothing is mutated, and the input
objects are unchanged. Then check the converse: is there any path that returns
children *and* raises, or returns a partial list?

**G. Guard versus authority (guarantee 7).** Find input the guard admits that the
reducer refuses — that is expected and fine, a pre-filter. The finding you want is
the reverse: input where the guard's admission *is* the reason the reducer would
have admitted something, i.e. the guard is load-bearing where it should be
defence-in-depth. Specifically: does the reducer's own `validate_decomposition`
re-check containment and per-dimension budget authority, or does it trust the
proposal? If it trusts them, the guard is the only enforcement and its defects
matter far more.

**H. P1 end-to-end (guarantee 10).** Patch `derive_obligations` to return nested
obligations — the F2 scenario — then show that renaming a nested child measures
**no** `NESTING` divergence while adding, removing, or re-parenting one does. This
is the claim the whole forward obligation rests on, and it is reachable today
without a producer. If a nested rename still manufactures divergence, P1 did not
discharge the obligation.

**I. Shallow-copy mutation (concern 3).** Call `admit_proposal`, mutate a returned
child's nested `contract` or `budget_allocation`, and show whether the structure
that would be admitted changed. Decide whether that is a real hole given the
reducer re-validates, or a non-issue.

**J. Instrumentation agreement (guarantee 8).** Cross-check `record_outcome`
against real admissions and refusals: does the accepted count equal the number of
children actually admitted, and is the refusing stage the one that actually
fired?

## Method

- Read the normative documents and the pre-images (`git show 010e3dc:…`) of every
  changed function first, and list the semantic deltas before testing any of them.
  In particular diff `measure_divergent_axes` and its three shape helpers against
  the pre-image, and account for every comparison that changed.
- Drive the real entry points — `planning_pilot.admit_proposal` and its checks,
  `decomposition.validate_decomposition`, the reducer's
  `_on_decomposition_admitted`, `derive_obligations`, `measure_divergent_axes`,
  `is_admissible`, `build_fixed_target` — with throwaway git repositories and
  constructed `RunState`s under `/tmp/kilo/`. Use the project's
  `GIT_ENVIRONMENT` fixture identity when committing a throwaway repository.
- Prefer whole-path reproducers (a proposal through `admit_proposal` and then
  through the reducer) over unit pokes, and unit calls only for the shape questions.
- Where a claim depends on a caller supplying a correct argument (`parent_depth`,
  `parent_scope`, `already_proposed`, `parent_budget`), test the claim *as the code
  stands*, then separately say whether the guard should have derived it and could
  have.
- For each attack: exact commands, the probe (not a source edit), observed vs
  expected, and the guarantee violated. Prefer a failing reproducer. Do not weaken
  or edit tests. If a guarantee holds, say "attacked, not falsified" and state the
  method.

## Deliverable

1. **Verdict:** GO / NO-GO for the model producer to land on this base.
2. **A ruling on concern 1 (depth semantics).** Does the pilot's depth bound and
   the controller's depth accounting agree? If not, which is authoritative, and
   what must change before a producer relies on either. This is the item the
   implementer most wants adjudicated.
3. **Findings** with severity (P0/P1/P2), the guarantee violated, a minimal
   reproducer, observed vs expected, and the proposed permanent regression test.
4. **Claims verified:** each of the ten guarantees with its falsification attempt
   and outcome.
5. **An authority map:** for each of the pilot's five bounds, name what enforces
   it — the pilot guard, `validate_decomposition`, the reducer, the budget ledger,
   or nothing. Any bound enforced by nothing but the pilot guard is called out, and
   any bound the guard is the *only* enforcement for is a finding.
6. **A ruling on concern 4 (duplicated containment).** Should the two
   `_scope_contained` implementations be unified now, and does their current
   agreement hold?
7. **Residual unknowns:** what you could not test and why.

## Exit criteria

- Every guarantee is either falsified with a reproducer or explicitly
  "attacked, not falsified" with the method.
- Guarantee 10 is resolved end to end by patching derivation to nest, in one
  direction or the other, with the nested-rename result stated plainly.
- The authority map is complete, and bounds enforced by nothing are named.
- Concern 1 is resolved with a ruling, not a note.
- The spec's three bounds are checked against the code: the depth bound, the
  per-node 6, and the per-trial 32 each have a corresponding check, and no check is
  more permissive than its bound.
- The four implementer corrections (size bound, budget fix, S7 trigger, S12 note)
  are verified rather than taken on trust — each was a self-reported defect or
  omission, and the budget fix is the one that shipped.
- No source edits, no model calls, no network, no credentials; host state left
  clean.
- Findings are reproducible from the report alone against `f907c80`.
- The review states what it did not cover.

## Reproduce everything

List every probe command, constructed state, patched derivation, and worktree
revision here so the verdict can be re-run against a corrective revision.
