in reviewhumanPR #326Identity

SimOps AI: five construction trades coordinate Week 9 through a referee service, with duplicate, late-accept and forged-seat tests

SimOps AI is a simulation environment and coordination layer for construction AI agents. Each trade's agent negotiates one shared schedule, and a neutral referee checks every move against site rules (zones, crane, crew limits, trade order)…

Author

Status
In review
Opened on
Nov 10
Branch
integration/simops-week9

Description

The pitch.

## Summary

SimOps AI is a simulation environment and coordination layer for construction AI agents. Each trade's agent negotiates one shared schedule, and a neutral referee checks every move against site rules (zones, crane, crew limits, trade order) and commits only what every affected trade signed.

This PR adds `examples/simops/`. In the Lab, five Town trade agents find a SimOps desk in Town's registry and play Building 01, Week 9 of a data center job through it: board, private briefs, proposals, the referee's refusals and alternatives, a swap agreed over Town messages, signatures, the week closing, and SimOps's own audit. Then we break it on purpose: calls arrive twice, an offer arrives after the week closed, a rogue speaks for Electrical under hmac and under `plain.v1`, a desk trusts sender names, and SimOps goes down. No SimOps engine code is in the PR.

## Integration

- SimOps runs separately: hosted for this check at `https://simops-production.up.railway.app` (its repository is private). Town reaches it over MCP (streamable HTTP, `/mcp`) and its playground routes (`/api/playground`: a fresh run with one seat token per trade, close the week, read the log and audit).
- `simops-desk` publishes a signed card with capability `construction.schedule.referee`. Trades send `call.<tool>` Town messages to it with their own seat token; the desk calls SimOps with that token and records every answer as an attributed `simops_call` event. Seat tokens and brief bodies are declared private (`redact_fields`).
- Validator `simops_week9` judges from those events: referee_discovered, briefs_private, rules_enforced, swap_signed_by_all, applied_once, forged_seat_refused, stale_calls_refused, week_committed, simops_verified, plus Town's ledger and privacy checks.
- `run_check.py` cross-checks Town's record against SimOps's own log of each run: same calls, same order, same outcomes; door refusals absent from SimOps's log; the same audit digest.
- The trades, desk and rogue are fixtures we wrote; this is not independent adoption.

## Reproduce

```bash
git clone https://github.com/iggyops/nandatown -b integration/simops-week9 && cd nandatown
python3 -m venv .venv && source .venv/bin/activate && python -m pip install -e '.[dev]'
export SIMOPS_URL=https://simops-production.up.railway.app
python examples/simops/run_check.py --out /tmp/simops-evidence        # every case, live
python -m pytest -q tests/test_simops_integration.py                   # offline evidence + live clean case
python examples/simops/run_check.py --verify examples/simops/evidence  # offline, no network
nandatown run examples/simops/simops_week9.yaml --out /tmp/town-lab
nandatown compare examples/simops/simops_week9_forged.yaml --swap auth=plain.v1
```

- Nanda Town: `6f9a7c0` (main), nandatown 0.2.0, Lab evaluator `lab-0.2.6`, Python 3.12.
- SimOps: 0.1.0, build `hw8-town@26aa2b8`, image `sha256:c7671aaf8b3632b267d09502ecbe5ad118309bba93ff707eb8c8e7e1f6ae1599`.
- Optional `live_seat` case: OpenAI `gpt-6-luna`, needs `OPENAI_API_KEY`, about $0.004 a run.
- `python -m pytest -q` passes on the branch (1,867 passed; the live test skips without `SIMOPS_URL`), and `git diff --check` is clean.

## Results and limitations

| Case | Expected | Observed |
|---|---|---|
| clean | every stage passes | passed: 1 refusal (`zone_exclusive`), 1 swap signed by both, nothing unscheduled, SimOps I1-I5 hold |
| duplicate (fault) | repeats change nothing | passed: 3 repeated deliveries refused (`not_open`, `already_signed`, `not_agreed`), 1 commit |
| late_accept (boundary) | late accept refused, run reports the week did not commit | failed as expected: accept refused `not_open`, `ELE-roughin` unscheduled, `stale_calls_refused` passed |
| forged (fault) | Town's hmac stops the forged sender | passed: 3/3 `bad signature` |
| forged_weak_auth (boundary) | with `plain.v1`, SimOps still refuses | passed: 3/3 reached SimOps, 3/3 `unauthorized` |
| trusting_desk (control) | fails on purpose | failed as

…

Try it

Open PR on GitHubView diff

Checkout locally

git fetch origin pull/326/head:pr-326
git checkout pr-326