# Protocol 024: the two-signal decision rule
Status: draft, to be declared by recording the frozen manifest's SHA-256 in HANDOFF.md before any export of the six instances, or any per-step or condition-mean readout of them in `confirm-023r2/results/results.json`, is read for this rule
Date: 2026-11-13

## Goal
Give the controller a rule for two signals that arrive at once, and test it out of sample. Notes 22 and 25 established that the model circuit does not add two superimposed gratings: the stronger one dominates. Note 22 said a controller fed two signals at once "would need its own declared encoder". This protocol declares that encoder and its decision rule, fixes every number of the rule on the pilot's one instance (A), and then applies it unchanged to the six instances of protocol 023 revision 2.

## Non-goals
- No new model run. The six instances' exports exist and are published (`confirm-023r2/exports`).
- No market data, no executor, no transaction, no token. Which real signals become A and B, and what the actions A and B stand for, is decided later and is not part of this protocol.
- No claim that the cortex's own connections make the decisions (see Limits), and no claim about cat cortex.
- No change to protocol 017's readout or to any frozen package.

## The rule (an engineering choice, disclosed as one)
- **Encoder.** Signal A is a grating at 45°, signal B a grating at 135°, shown together for one step with protocol 017's timing (210 ms on, 147 ms grey). A signal's strength is its grating's contrast, from 0 to 30 %.
- **Readout.** z(k) is protocol 017's frozen readout of step k: all layer 4 excitatory cells, balanced weights, spike counts 40 to 300 ms after onset. In it 45° lies along +i and 135° along −i.
- **Calibration, per instance:** z0 is the mean z over the 8 blank steps. S = [Im mean z(45°, 30 %) − Im mean z(135°, 30 %)] / 2 over the 8 + 8 single-grating steps at 30 %. An instance with S below 1,500 is refused.
- **Decision variable.** v(k) = −Im(z(k) − z0) / S: positive toward B, negative toward A, about ±1 for one signal alone at full strength.
- **Action.** B if v > T, A if v < −T, hold otherwise. **T = 0.32.**
- **Where 0.32 comes from.** On the pilot's intact run the largest |v| among the 16 equal-plaid steps is 0.22 and the smallest |v| among the 16 single-grating steps at 15 % is 0.42; T is their midpoint. The unequal plaids' smallest |v| there is 0.54.
- The component of z across the A/B axis is ignored by the rule and reported.

## The test
- **Data:** the six analysed exports of protocol 023 revision 2 (pynn_seed 8, 10, 11, 12, 13, 14), at their published SHA-256. Each holds the declared plaid stimulus set of protocol 022 in its own order: 96 analysed steps.
- **Calibration steps** (24 per instance: blank, 45@30, 135@30) set z0 and S and are not scored.
- **Test steps,** 56 per instance, 336 in all, with the intended action:

  | Steps | Stimulus | Intended |
  |---|---|---|
  | 8 + 8 | equal plaids, 15 + 15 % and 30 + 30 % | hold |
  | 8 | plaid, A 30 % with B 15 % | A |
  | 8 | plaid, A 15 % with B 30 % | B |
  | 8 + 4 | A alone at 15 % and at 60 % | A |
  | 8 + 4 | B alone at 15 % and at 60 % | B |

- **Outcome,** decided by `decide_024.py` alone:
  - **PASS:** every instance takes the intended action in at least 51 of its 56 test steps (91 %), and the six together in at least 320 of 336 (95 %).
  - **FAIL:** otherwise.
  - **NOT INTERPRETABLE:** a refusal (an export that is not the declared one or cannot be read, steps that are not the declared set, S below 1,500, frozen code not at its recorded hashes, a readout that differs from the published one, or two result files that are not byte-identical).
  - A NOT INTERPRETABLE or crashed run is not rerun with changed code or numbers; any follow-up is a new protocol. A rerun of unchanged code after a machine fault (differing result files) is allowed once and is reported.
- **Reported beside it, with no decision role:**
  - per condition and instance: mean, SD and range of v, and the actions taken;
  - the relay rule: the same threshold applied to the sum of the two single gratings' mean v, per plaid and instance, and whether it gives the intended action. On the pilot the relay rule holds on the plaid "A 15 % with B 30 %" (relay v +0.24) where the circuit acts (v +0.64);
  - block B (a grating at 90° alone or with B), described only: the rule was not designed for a third orientation;
  - the calibration steps' own actions.
- The run is made twice, from `work/controller-024`, and the two result files must be byte-identical.

## What is already known (disclosure)
- The pilot (instance A), intact and lesion, was read in full to design the rule: `work/controller-024/design-pilot.json`. With T = 0.32 it takes the intended action in 56 of 56 test steps in both runs. **The lesion run passes too:** on instance A the rule works as well without the cortex's own connections.
- For the six instances, three summary measures and their intervals are known and published (XOS, Dc, ds; note 25). Dc says the group preferring the stronger grating keeps more of its response, so a PASS is the expected direction. - **The six instances' readouts already exist in a published file.** Protocol 023's analysis computed and published, in `confirm-023r2/results/results.json`, each instance's per-step readout z in window D, its condition means, the condition of every step and the side-measure decisions under protocol 017's rule (S5). The whole outcome of this protocol could be computed from that file. The held-out status therefore rests on a statement, not on the data being out of reach: in designing this rule only the top-level key names of that file were listed; no per-step or condition-mean readout, no S5 count and no value of S or v of the six instances was read, printed or used. The pre-declaration reviewer listed key names and lengths there and reports computing nothing from them. The figures of note 25 used the three measures only.
- The tool turns the published readouts into a check: its own z must equal the published z of every step exactly, or the run is refused.
- These are held data analysed again, not fresh runs. That is weaker than a new confirmatory run and is said beside the outcome.

## Limits to state beside any outcome
- A 3 × 3 grid of strengths (0, 15, 30 %) plus two singles at 60 %, one orientation pair, one timing, one orientation map shared by all instances, single-step decisions.
- Calibration uses steps of the same run as the test steps (different steps, same presentation).
- T was chosen on one instance; nothing else was tuned.
- The held-out status of the six instances rests on the disclosure above, since their readouts were already published.
- The rule reads the whole circuit, input stage included. The pilot's lesion run shows the same decisions without the intracortical connections, so a PASS says the rule is reliable on this model, not that the cortex's connections compute it. No lesion runs exist for the six instances.
- Simulation only. No market signal, no action taken.

## Test plan
- `test_decide_024.py`: the thresholds, the signs of A and B, a relay-like circuit and a biased equal plaid must lose steps, the refusals, the outcome arithmetic at its boundaries.
- The design run on the pilot reproduces the numbers quoted above.

## Done when
- [ ] Tool, tests and this spec frozen in `work/controller-024/MANIFEST-frozen.txt`; the manifest's SHA-256 and the time recorded in HANDOFF.md before any of the six exports is read
- [ ] `decide_024.py` run twice on the six exports, byte-identical results
- [ ] Outcome reported with its limits in a package and a journal note, public copy in neutral terms (actions A, B, hold)
