# Server source of “One rule, three cabinets”

Everything the browser talks to. Secrets (platform token, model key) come from the server environment; none are in these files.

| file | role |
|---|---|
| `proxy.py` | the only server process (port 18452 behind Caddy). Serves `/api/cabinets/*`: state, evaluate, add a rule from words or as JSON, remove, reset, export. Rule sets are kept per visitor session. |
| `cabinet_core.py` | the languages `cabinet` (a department's own checks) and `policy` (company rules with a scope): eight deal fields, eight operators, outcomes forbid / approve_by_head / warn, the evaluator and its trace. |
| `handler_tail.py` | the device-side entry point the Extella listener calls with a cabinet program and the run parameters (deals and the rule set). |
| `build_registrar.py` | builds `demo_register_cabinet.fython`, computes `HANDLER_SHA`, saves the expert in the agent scope. |
| `demo_register_cabinet.fython` | the registrar as deployed: run once on a device, it registers the handler there. |

## What changes and what does not

Adding a company rule changes a policy document that the three cabinet experts receive as a run parameter. No cabinet program and no handler is touched. A handler change (a new registration on the device) is a different operation and is shown in the block demo.

## Check the two claims

1. **Handler hash.** Take the registrar file, cut the text between the triple quotes, drop the line that starts with `HANDLER_SHA = `, sha256 the rest. It must equal `handler_sha` in any evaluation answer.
2. **Model calls.** One function reaches a model provider (it writes a rule from a sentence); the counter around it is returned as `model_calls_measured` (evaluation: 0) and `model_calls_create` (writing a rule: 1, or 2 with one retry).
