Cogneris
Environmental Compliance & Inspection

Intent · Every environmental obligation current and evidenced — zero reportable exceedances at Woodbine (UTS).

Operating tolerance: issues closed in ≤ 5 days · no repeat findings · every permit condition met.

← Documentsdocs/WORKLIST.md44,705 words

Worklist

The single place work is planned and tracked. Not a ticket system — a list that survives a session, so nothing depends on remembering a conversation.

Convention: [ ] not started · [~] in progress · [x] done · [!] blocked, with the blocker named. Newest section at the top. Dates are absolute.


H · The lifecycle is seven phases, not five — scope work only (2026-08-11)

Signed: Claude Opus 5 (Claude Code), session of 2026-08-11. Pete: *"i want a document that covers all that is missing in our current platform — Infrastructure Project"*, *"we are not trying to build this yet.. we are only drawing additional documentation and diagrams"*, and *"the book … i want to apply to all major infrastructure projects. the technology also has application to pipelines, mining and oil operations."*

Nothing in this section is code. Nothing in it proposes code. It is a specification of absence plus eight drawings, and the correct next action on any of it is a decision about whether the thing should exist at all.

  • [x] H1 · Three specifications, in the docs estate (per the doc-placement policy — not in this repo): CognerisDocs/ESG/SCOPE_Infrastructure_Lifecycle_End_to_End_2026-08-11.md (master), SPEC_Systems_Assurance_Overlay_2026-08-11.md, SPEC_Owner_Side_Capital_Delivery_2026-08-11.md. A claim-identification note went to CognerisDocs-IP/ESG-IP/.
  • [x] H2 · Eight sheets added to the library — 39–46 in diagrams/SDMS/ESG/, registered in scripts/library-diagrams.json under the existing model group, and published to /v2/library/diagrams by npm run library. All eight validated as XML and rendered through headless Chrome before commit.
  • [x] H2a · They were first written to public/library/diagrams/ESG/ — the wrong place, and silently so. That tree is generated and gitignored; scripts/build-library.mjs rebuilds it by walking diagrams/SDMS, so the sheets would have been committed nowhere and wiped by the next dev, build or library run. The 33 existing sheets sit in both trees, which is exactly why the wrong one looks right. Source of record is diagrams/SDMS/ESG/. public/library/ is output.
  • [x] H3 · Source material. Method taken from Field guide to Systems Assurance, Sanz Vivanco (2023), transcribed at Foreman/docs/esg/field-guide-to-systems-assurance.md. The book is in print and its text and figures may not ship in anything. The method is ordinary industry practice and is prior art; only it was used.

The finding, in two lines

  • Sheet 37 is five disciplines under one name — ESG, GRC, H&S, project quality assurance and project delivery. Two of the five (GRC risk/controls, project delivery) are specified nowhere, including in the new documents, and are named absent on purpose.
  • The lifecycle begins and ends in the wrong places. Phase 0 (need, public consultation, funding, financing, procurement) and phase 6 (operations, monitoring, warranty, handback, closure) belong to the owner, and the obligations that bind hardest are created in one and consumed in the other.

Not true — do not claim otherwise

  • [!] None of it is built and none of it is scheduled. Coverage on sheet 45 is assembled from documents — GAP-ANALYSIS (2026-07-29), sheet 20 (verified 2026-08-01), BRD-lifecycle-all-phases (2026-08-04) — not from a code audit run on 2026-08-11. Anything built since 2026-08-04 is not reflected.
  • [!] No jurisdiction was checked. Every BR-FIN, BR-PRC and BR-PPP rule is a general-practice sketch. Ontario development charges, Canadian debenture limits and US continuing disclosure differ in ways that change the rules, not the parameters. Blocked on a jurisdiction determination (DP-23) before any of it is implementable.
  • [!] The vertical mapping on sheet 46 (pipelines · mining · oil & gas) is unverified. Programme and standard names are cited from general practice; no standard was opened and no practitioner from those industries reviewed it. It is a hypothesis, not a market claim.
  • [!] RD-1 blocks the owner side at the identity layer, not the data layer: the signed session claim carries project singular and phases 0 and 6 are inherently portfolio-scoped.
  • [ ] The public-input model has no privacy specification (OD-41). Nothing should be built against BR-PUB-2 until that is answered.
  • [ ] Foreman's src/diagrams.ts mirror was not regenerated — its stated source of record (MyDemos/esgm) no longer exists on this machine, so the Foreman console will not show sheets 39–46 until the generator is repointed at this repo.

Decided, so it is not re-argued

  • Origin is recorded, never inferred. An obligation arriving as "contract, source unknown" cannot be argued, varied or defended. Six of the nine origins on sheet 41 exist before any bidder reads a tender.
  • The public is never a user. Public input is a record about what someone said, authored by a staff member. No public identity plane is created.
  • Verticals are configuration, never code branches. If rail, pipeline or mine vocabulary had to be expressed in code, the object model would not be neutral and the claim on sheet 46 would be false.
  • The one open question everything else hangs on is OD-20: is this an environmental compliance tool, or an obligation substrate with an environmental first vertical? It is a positioning decision before it is an engineering one, and it has not been made.

G · The console is v2, end to end (2026-08-08)

Signed: Claude Opus 5 (Claude Code), session of 2026-08-07 → 08-08. Pete: *"several links in the left nav that are v2… everything should be v2. each role should also have completed portals v2. all of the pages should have ?role=<user role>"* and *"so that i can see all roles and select a role it should be /v2/roles."*

  • [x] G1 · One navigation, not two. The rail hand-kept its own list of v1 routes while the v2 portal was reachable only by typing a URL, so a reader could leave v2 without noticing. app/lib/v2nav.ts is now the single registry (15 surfaces, each with its v2 href, the v1 route it replaces, its group and what it is FOR); ConsoleShell builds the rail from it and adds nothing but icons. A surface highlights on either its v2 route or the v1 one it replaces, so an old link still lights the rail.
  • [x] G2 · Fourteen new v2 surfaces, one per rail destination: /v2/{site,projects,maps,my-work,inspections,submissions,compliance,obligations,permits,ledger,conversations,dashboard,demoapp,vui}. The body of each is the v1 surface, deliberately — same registers, same derivations, no second implementation to drift. What v2 adds is the chrome: the agent, the stated role, and what the record can tie to that person.
  • [x] G3 · ?role= is carried, and it shapes rather than gates. V2Surface prints who you are acting as, their one question, what this surface is for in their terms, and the role lens — how many rows the record actually ties to them. For five of the seven roles the honest answer is NONE, because the record carries no actor string for them; the shell says that rather than printing a zero that would read as "nothing outstanding". Every page states plainly that the surface below is not filtered and nothing is withheld: there is no identity service, no session and no permission check in this console. - The rail carries the role onto every link via useSearchParams inside a Suspense boundary — reading it in the shell itself would opt every page in the layout out of static rendering, and paying that on the whole console to decorate fifteen hrefs is a bad trade. The fallback renders the same rail with plain links.
  • [x] G4 · Every role has all three surfaces. A role portal rendered ONE surface and showed the other two as greyed labels — a person with a third of a portal. app/v2/surfaces/roleSurfaces.tsx adds role-parameterised Record · Queue · Answer; ?surface= selects, defaulting to the role's home, where the richer bespoke view still wins. SurfaceBar items are now real links instead of dead spans. - A party (board, client, auditor) gets no invented queue: it says a party holds no session, receives a released pack, and shows what is outstanding for information only.
  • [x] G5 · Choosing a role has its own address. The chooser moved from /v2 (behind a ?from= parameter that set nothing) to /v2/roles, and picking a card sets ?role=. /v2 redirects there, honouring an old ?from=. Every "← All roles" button and the shell's role switcher point at it.
  • [x] G6 · The front doors are v2. The brand mark and the breadcrumb root now open /v2/site rather than the v1 site map.
  • [x] G7 · The v1 routes redirect (2026-08-08). All 15 legacy routes 307 to their v2 surface, derived from V2_SURFACES in next.config.ts rather than restated, so a sixteenth surface cannot be added with its redirect forgotten. Verified live: / → /v2/site, /compliance → /v2/compliance, and twelve more. - Exact matches only, deliberately. /projects/PRJ-ontario and /inspections/[id] still serve — there is no v2 surface for a single project or one inspection, and redirecting them would strand the page rather than move it. /admin is untouched; it is gated at the edge. - 307, not 308. A permanent redirect is cached by browsers long enough to outlive a decision to reverse this.
  • [x] G8 · The naming sweep is done in the UI (2026-08-08). Eight "Portal v2" strings across the seven /v2/library files are now "Console v2". - The four docs/PORTAL-*.md files were deliberately NOT renamed. They are cited 94 times across code and docs, and their filenames are the library's URL slugs — renaming them churns 94 references and breaks every link to four authority documents to fix a word. Not worth it; the word stays in filenames only.
  • [x] G10 · The stated role survives a click, at the edge (2026-08-08). CORRECTS G9's claim that there was no cheap fix — there was, and it is not in the layout at all. middleware.ts now writes a valid ?role= to a cookie and redirects any /v2 request that arrives without one back to the same URL WITH it. The role therefore survives a click made before hydration, static rendering is untouched (the layout reads nothing), and the address bar still shows the role — a role that shaped a page while staying out of the URL would give two people the same link and different screens. - It is still not a session. The cookie remembers a stated preference and carries no authority: nothing checks it for permission and no record is filtered by it. The middleware comment says so, at length, on purpose.
  • [x] G11 · The two person-blocked items now have artifacts (2026-08-08), so they are decisions somebody can take rather than work nobody can start. - docs/INTENT-declarations-for-signoff.md — one page: both authored intents, what each component would be measured by, what must exist before each can be scored, and the two questions each owner has to answer. Signing changes basis from "authored" to "product" in app/lib/alignment.ts and stops the amber panel rendering. - docs/DECISION-news-and-activity-sources.md — four independent decisions, one per origin, with the honest position on each: extend the internal derivation (code only), connect weather (one public API, and it already drives OBL-091), manual entry for vendor and partner with mandatory refs, and no scraper without a maintainer — a silently broken scraper reads as "nothing happened", which a briefed item never does. Recommends a third basis: "fetched" value when the first real source lands.
  • [ ] G12 · What is still NOT done, and now needs somebody else. - ?role= grants nothing. Stated context, not authority. S1 (identity) + S2 (decisions) are the blockers — product gaps, not console work, and the largest open items in the system. - Both intent sign-offs are outstanding — H&S manager and PM. The artifact is written; the signatures are not. - No news source is connected. Four decisions are on the table and none has been taken. The feed keeps saying 13 of its 24 items were authored.

F · Console: intent alignment, opportunities, news & activity (2026-08-07)

Signed: Claude Opus 5 (Claude Code), session of 2026-08-07. Requested by Pete: *"add more info and functionality in Brief to see overall intent alignment and analysis of where alignment is strongest and weakest… opportunities is another section in intent & alignment analysis… incorporate news and activity — internal, external, vendor, partners."*

Naming, settled. It is the console, not a portal, because it reads three disciplines and not one. The lanes are Development · ESG · Safety. The lane Pete remembered as "Progress" is Development — stage of work per place; the record store still tags it discipline: "progress" (app/lib/sitePlans.ts), and the UI says "Development progress". Visible "Portal v2" strings in the v2 brief were changed to "Console v2"; the rest of /v2 still says Portal and is a follow-up.

  • [x] F1 · app/lib/alignment.ts — three lanes, three declared intents. Alignment is distance from a DECLARED intent, so each lane states its own statement, tolerance, owner and basis. Only the ESG intent is basis: "product" (it pre-dates this work and the brief already narrated against it). Safety and Development intents are basis: "authored" — written by the console, agreed by nobody, and every surface that renders one prints that fact. - Components carry their own target and where it came from: 100 where the tolerance states it, 85 (DEFAULT_TARGET) where it does not. Weakest is ranked by distance from its own target, not by lowest number — 88 against 100 is further off intent than 84 against 85. - Reads today: overall 66 across 2 of 3 lanes · ESG 75 (7 of 8 components) · Development 57 (1 of 4) · Safety unassessed (0 of 4). 8 of 16 components carry no data and are excluded rather than scored zero.
  • [x] F2 · app/lib/opportunities.ts — the upside half, with the arithmetic. 11 moves, ranked: 5 close moves worth 138 component points, each showing the component recomputed as if the named gap were shut (e.g. Permit conditions 50 → 100), and 6 unlock moves that state NO number at all because they create a measurement rather than raise one. Two of the six are the Safety lane on its own. Distinct from brief q5: options are briefed and weighed on judgement, opportunities are derived and show their working. Neither authorises anything.
  • [x] F3 · app/lib/signals.ts — news & activity, four origins kept apart. Internal · External · Vendor · Partner, because they differ in who can be held to them. 24 items: 11 DERIVED from the registers the console holds (tickets, permits) and 13 BRIEFED — authored here. unresolvedRefs() proves every briefed item points at a real ticket/obligation/permit/place id and currently returns empty; a stale id shows up as a failure rather than a dead link.
  • [x] F4 · One implementation, two densities. app/components/alignmentPanels.tsx renders all three panels with no hooks and no handlers, so the client brief and the server brief use the same components. This is the analytics.ts lesson applied: two surfaces with private copies of the same numbers drift.
  • [x] F5 · Both briefs carry it. New widget kinds (alignment, opportunities, signals) and three new scripted entries, so the panels are reachable by chip AND by free text ("how aligned are we", "opportunities", "vendor news") on both /brief and /v2/brief. /brief gained an "Across the lanes" row and now says plainly that the intent block above it is the ESG lane's and is the only agreed one. INTENT in lib/brief.ts is now sourced from the ESG declaration rather than being a second copy of it.
  • [ ] F6 · What is NOT true, stated plainly. - No news ingestion exists. No feed reader, no regulator subscription, no vendor portal, no partner channel. The briefed items are authored sentences and say so on their face. - The Safety and Development intents are not signed. OPP-SAFETY-INTENT is on the board precisely because scoring a lane against a target nobody agreed is worse than not scoring it. - No unit tests cover the three new modules. The test harness (node --experimental-strip-types) cannot resolve extensionless relative imports, so it can only import app/lib modules whose relative imports are type-only — a pre-existing constraint, not a new one. Verified instead by a staged run of every export plus next build, tsc --noEmit and eslint clean.

E · Estate: identity, ownership, and the Jira divergence (2026-08-07)

Signed: Claude Opus 5 (Claude Code), session of 2026-08-03 → 08-07.

  • [x] E1 · pete@arivant.com retired as the git identity. arivant.com is a shut-down company; Cogneris is the successor and is what we use going forward (Pete, 2026-08-07). - ~/.gitconfig now user.email = pjones@cogneris.com. Stale .gitconfig.bak.* files holding the old address were deleted. - It never carried any rights. search/users?q=pete@arivant.com in:email returns 0 — it was a git author LABEL, not a GitHub account. Real access is the NeoRivets account, already an admin of the Cogneris org. There was nothing to "transfer back". - DO NOT strip CoreArivant — that is THIS MACHINE'S HOSTNAME (40 files reference it) and is unrelated to the dead domain. Only 4 files mention arivant.com, all of them historical bookmark data in the bookmarks corpus.
  • [x] E2 · All repos consolidated under the Cogneris org. 40/40 (the 41st is datalab-to/marker, a third-party upstream — correctly untouched). - Transferred: Ascent-GRC, AscentAutoGovernance, AscentGRC, VEP, bookmarks. - TurboCivics and ordinance REFUSED with "Repositories cannot be transferred to the original owner" — both began in Cogneris and were moved out, and GitHub blocks the return trip. Cogneris/TurboCivics already existed at the identical HEAD (858426b6) so the local remote was repointed; Cogneris/ordinance was created fresh and pushed (all branches + tags).
  • [~] E3 · Author-email history rewrite — 5 of 8 repos done. git filter-repo --mailmap, then fetch + push --force-with-lease. - Done: AscentAutoGovernance · CognerisDocs-IP · Foreman · PrivateClaudeCode · Rivetly (24 commits). - --force-with-lease FAILS straight after filter-repo — it strips remote-tracking refs so the lease has no basis. git fetch first. - Remaining 151 commits are NOT on any main branch. They sit on dependabot/*, old foreman/ESG-* branches, and one Rivetly rescue/* branch — plus three repos blocked by uncommitted work. - [!] BLOCKED — esgm (115 commits), CognerisDocs (17), Sequents (1). Blocker: uncommitted work in the tree. esgm must wait for the other agent to finish — rewriting it destroys their working files.
  • [x] E4 · ~44 GB reclaimed (81 GB → 126 GB free, 80% → 9% used). - Deleted: a 3.1 GB clone of TurboCivics nested inside TurboCivics itself (same upstream, 0 unpushed); all node_modules / .next / .venv / .turbo / __pycache__; 301 .DS_Store; a duplicate ColdStorage archive proven a subset before deletion. - APFS pins deleted space in local snapshots — df showed no change until tmutil thinlocalsnapshots. Space is not free until the snapshots go. - NOT deleted, and must not be: Cogneris_Sites/archive/**/dist (the DEPLOY SOURCE for the nine live sites) and esg-field/{ios,android} (untracked native trees carrying enclave/StrongBox config that expo prebuild will NOT regenerate).
  • [!] E5 · JIRA AND THE WORKLIST HAVE DIVERGED. Read this before trusting Jira. - Zero ESG tickets have been touched since 2026-08-03. ESG holds 418 tickets (217 open, 213 To Do, 4 In Progress — all unassigned and untouched since 27 July, three of them Foreman infrastructure rather than product). - None of this week's work exists in Jira. Searches for "v2 portal", "director", "boardroom", "lifecycle BRD", "diagram" each return 0. - Everything IS memorialised — in this worklist, in ~26 docs/*.md, and in commit messages. The worklist is the resumable state; Jira is a stale plan. An agent resuming from Jira alone would redo built-and-deployed work. - Ticket quality itself is good: 40/40 sampled To Do items carry real descriptions. The gap is currency, not substance. - Not reconciled. Doing so means closing what is demonstrably done and raising ESG tickets for the ~15 items that landed without one — and adding the dual-write rule to AGENTS.md so it cannot silently drift again.

V · WARP as the private network (2026-08-07)

Goal, in Pete's words: *connect with WARP and then anywhere I connect, as long as I connect via that WARP, connects me to all resources on this dedicated network* — and, decisively, *I don't want to have that impact the LAN. WARP is supposed to be a VPN.* Client-to-site, no LAN changes.

  • [x] V1 · Duplicate connector removed. com.cogneris.cloudflared and com.cogneris.cloudflared-corearivant were BOTH loaded and BOTH running tunnel run corearivant off the same config — two connectors advertising one tunnel. Survivable for hostname ingress, fatal for private routing (flapping + split return paths). The former is moved aside to ~/.cloudflared/disabled-agents/. One connector remains.
  • [x] V2 · The LAN itself is routed over the tunnel. cloudflared tunnel route ip add 192.168.50.0/24 corearivant → route 4701a3b3-1d14-449e-9d83-481edd551862, vnet da4c723f-a4e9-499f-af64-d165dbff00b4. cloudflared proxies TCP/UDP to any host in that range, so every LAN resource is reachable, and the LAN is untouched. Confirms the ZT account (a10d32c701ce468c46d915c19e0afbb0, org cogneris) supports private networking.
  • [x] V3 · There is no warp-routing.enabled flag any more. cloudflared 2026.7.3 config.WarpRoutingConfig accepts ONLY connectTimeout, tcpKeepAlive, maxActiveFlows. Setting enabled: true produces field enabled not found in type config.WarpRoutingConfig. Private routing is activated by THE ROUTE EXISTING, not by a config flag. Older guides and model training data say otherwise; wrong for this version. config.yml backed up to config.yml.bak.pre-warp-routing.
  • [x] V4 · THE NETWORK IS DOUBLE-NATTED — two subnets, not one (2026-08-07). Found while chasing "why can't I reach the Synology". The ASUS ZenWiFi is NOT the edge router; it is itself a client of a Bell router.

Internet +-- Bell Home Hub 192.168.2.1 <-- 192.168.2.0/24, 13 hosts +-- Synology "JARVIS" 192.168.2.28 (DSM 5000/5001, SMB 445) +-- dropbear device 192.168.2.18 (SSH, embedded) +-- ASUS ZenWiFi CT8 (WAN side) | NAT +-- 192.168.50.0/24, 14 hosts +-- CoreArivant 192.168.50.95 (Wi-Fi, NOT wired)

Both subnets are now routed over the tunnel — 192.168.50.0/24 (route 4701a3b3-1d14-449e-9d83-481edd551862) and 192.168.2.0/24 (route 342fa712-825d-488b-aca2-071f65c6a816). Routing only the first would have left the NAS unreachable over the VPN.

  • [!] V5 · Blocked on the Zero Trust split-tunnel list — the LAST step. The WARP profile is in Exclude mode and excludes 192.168.0.0/16, which swallows BOTH routed ranges. Cloudflare has NO include-exception in Exclude mode, so that one entry must be replaced by its 12-CIDR complement — everything in 192.168.0.0/16 except .2.0/24 and .50.0/24: 192.168.0.0/23, 192.168.3.0/24, 192.168.4.0/22, 192.168.8.0/21, 192.168.16.0/20, 192.168.32.0/20, 192.168.48.0/23, 192.168.51.0/24, 192.168.52.0/22, 192.168.56.0/21, 192.168.64.0/18, 192.168.128.0/17. Blocker: no Cloudflare API token on this machine (only wrangler OAuth, which lacks Zero Trust scope) — dashboard change, Pete only.
  • [ ] V6 · Enrol WARP on the other machines into org cogneris. The laptop was wiped to 64K in the 08-05 migration; whether it has the client at all is UNVERIFIED.

Why the Synology and the other laptop "cannot be reached" (2026-08-07)

Nothing is broken. The Synology is on the OTHER subnet, upstream of the ASUS's NAT. Proven reachable from CoreArivant right now, BY IP: http://192.168.2.28:5000 → HTTP 200, https://192.168.2.28:5001 → 200, SMB 445 open. Page title: JARVIS - Synology NAS.

What fails is discovery, not connectivity. Bonjour/mDNS is link-local and does NOT cross a router, so the NAS never appears in Finder's Network sidebar and jarvis.local does not resolve (verified: it does not). Connect by IP — smb://192.168.2.28 — not by name.

Corollary, and the reason the double-NAT went unnoticed: devices on 192.168.50.x can freely initiate OUT to 192.168.2.x, but nothing on 192.168.2.x can initiate IN to 192.168.50.x. The asymmetry looks like an intermittent fault if you only ever test one direction.

Why Pete could not ping the other device (2026-08-07)

Not a firewall, not WARP, not routing. A sweep of all 254 addresses on 192.168.50.0/24 found 15 live hosts, and the target was not among them. The proof is ARP: entries read (incomplete), meaning nothing answered at layer 2, which sits BELOW IP, firewalls and WARP. A host that is present but firewalled still answers ARP. Nothing answered, so nothing is at that address — powered off, asleep, on the guest SSID, or on a mesh node with client isolation. 192.168.50.253 and .203 are both dead. This machine's own firewall is off.

Decided 2026-08-07, so it is not re-argued

  • The LAN is NOT renumbered. An earlier plan in this session proposed moving the LAN to 10.225.205.0/24. That was rejected — it was never a WARP requirement, only a consequence of also wanting the dialing addresses to be 10.225.205.x. Drop that and WARP does the job with zero LAN impact. Do not re-propose renumbering.
  • cloudflared routes real subnets and cannot NAT or renumber. Therefore the range you dial IS the range the LAN uses: 192.168.50.x. Any wish for different addressing means either a renumber (rejected) or per-host loopback aliases (only covers the aliased host, not the whole LAN).
  • Known trade-off, accepted: 192.168.50.0/24 is the ASUS factory default, so at another ASUS-defaulted site the local network collides with the routed one. Cloudflare virtual networks (vnets) are the escape hatch if it ever bites.
  • Known trade-off, accepted: once 192.168.50.0/24 leaves the exclude list, WARP carries that range even when Pete is AT HOME, so local traffic hairpins out to the Cloudflare edge and back while WARP is on.
  • WARP-to-Tunnel is one-way. It makes the LAN reachable. A plain WARP client gets no routable address, so nothing on the LAN can dial the laptop unless the laptop runs its own tunnel. Fine for client-to-site.

Recorded by Claude Code (Opus 5) session 961b0c01, 2026-08-07.

Q · Post-quantum posture + the diamond identity card (2026-08-07)

2026-08-07 · Claude Opus 5 (Claude Code, session 58cff4ff). Pete: "i want this to be quantum", then a hardware direction — a card/device embedding a room-temperature (NV-centre) diamond chip, the diamond grown from his own hair as a personal identity substrate. Then, explicitly: "i dont want you to build it just spec it out and mark it future development."

NOTHING WAS BUILT. No source file under packages/ or workers/ was changed. Deliverables are documents only:

  • docs/POSITION-quantum-security-and-identity.md — the position and strategy (P1–P6, horizons S0–S5 with entry gates and exit tests, risks, decision log). Read this one first. Pete, 2026-08-07: "we can do further research and then build later" — so R1–R6 in §S0 are the current work, not any horizon.
  • docs/PLAN-diamond-identity-card.md — the technical annex at implementation depth (the four claims tested, the PUF construction, the §9 crypto-agility spec).
  • docs/ARCHITECTURE-high-assurance-and-zero-authority.md — an EXTERNAL position piece supplied by Pete (LLM-assisted; its NIST/NSA sources are real but its claims are not independently verified here), reproduced substantially verbatim, plus a Part 11 written from the code placing ESG on its 8-level ladder. Provenance is marked in the header — do not cite Parts 1–10 as our own assessment.
  • docs/ARCHITECTURE-separation-of-authority-and-capability.md — the second EXTERNAL piece (same provenance caveat): the US nuclear command chain as a model for Authority != credentials != capability != execution, plus a Part 6 written from the code.
  • docs/ARCHITECTURE-entanglement-qkd-and-hybrid-trust.md — the third EXTERNAL piece (same provenance caveat): entanglement-based QKD, E91, DI-QKD, and a hybrid trust fabric, plus a Part 7 on what is usable and what is structurally unavailable to ESG.
  • app/lib/library.generated.ts regenerated so all five are in the console corpus (58 documents).
  • [x] Q1 · Quantum exposure of the ESG auth surface, assessed. The device bearer credential (app/lib/deviceAuth.ts) is a 256-bit shared symmetric secret and is already post-quantum safe — Grover only halves it. Same for the esg-sync HMAC-SHA256 gateway assertion and the SHA-256 event chain. The real exposure is ECDSA P-256 signatures: workers/esg-query/src/authz.ts (ES256 session-JWT) and Actor.sig in @esg/event-envelope. Do not "harden" the bearer token — there is nothing to harden.
  • [ ] Q2 · FUTURE DEVELOPMENT · Crypto-agility seam. Spec at docs/PLAN-diamond-identity-card.md §9. Two additive, independently mergeable changes: an optional Actor.alg + algorithm registry in @esg/event-envelope, and an ESG_SESSION_JWT_ALGORITHMS allow-list (unset ⇒ ['ES256'], so zero behaviour change) replacing the hardcoded pin in esg-query. Not started, by instruction. Key properties already argued in the spec so they are not re-derived: it is hash-stable for every anchored event (the canonicaliser omits undefined), and alg is downgrade-proof for free because deviceSigningBytes is a denylist.
  • [ ] Q3 · FUTURE DEVELOPMENT · ML-DSA itself is NOT specced as buildable. Workers' WebCrypto does not expose it, so it needs a WASM/JS dependency in a bundled Worker with real size and cold-start cost. Separate ticket, after Q2. Do not write a stub verifier — one that returns true is a forgery oracle.
  • [ ] Q4 · FUTURE DEVELOPMENT · Diamond identity card, Tier 1. Secure-element card/fob + a hair-grown diamond enrolled as an unclonable PUF factor. Blocked on a product decision, not on engineering: §7.1, who is this for. An executive credential at £1–5k each is coherent; a site-wide worker badge is not. Lead time on the stone is 6–9 months and is the binding constraint.
  • [ ] Q5 · FUTURE DEVELOPMENT · Tier 2 ODMR reader. Needs an engineering partner and £20k–£100k+ order-of-magnitude. Not costed for real.
  • [ ] Q6 · RESEARCH IS THE CURRENT WORK — R1–R6, POSITION-quantum-security-and-identity.md §S0. Two can kill their own horizon and are cheap to answer, so do them first: R3 (ML-DSA cost in a bundled Worker — Workers' WebCrypto does not expose it) and R4 (NV-PUF fuzzy-extractor error rates). R6 (who the buyer is) is a decision, not research, and blocks all hardware spend.
  • [ ] Q7 · FUTURE DEVELOPMENT · Transport PQ is sequenced FIRST (S1), ahead of signatures. Harvest-now-decrypt-later applies to recorded evidence content — GPS, transcripts — and not to signatures: a forged signature in 2035 does not retroactively forge a 2026 inspection. Starts with R1, a measurement of what handsets actually negotiate, not an opinion.
  • [x] Q10 · CORRECTION — the session's opening question was misread. Pete asked about "the president and code issuance and verification". This session read "president" as presented (the bearer token in presentedToken()) and answered about the device-credential path. He meant the US Presidential nuclear authentication chain — the biscuit, the football, NC3. The answer given was accurate about ESG but was not the question asked; the intended subject is now docs/ARCHITECTURE-separation-of-authority-and-capability.md.
  • [x] Q13 · The KEY COMBINER is the one directly usable idea from the QKD piece — and it needs no quantum hardware at all. K = K_A XOR K_B forces an attacker to break BOTH. Combining a classical ECDH secret with an ML-KEM secret is exactly what hybrid TLS X25519MLKEM768 already does — i.e. horizon S1, our cheapest item — and it is the same reasoning behind hybrid ES256+ML-DSA over pure ML-DSA in S3. The essay's best idea is already our plan, minus the exotic hardware.
  • [x] Q14 · QKD is structurally unavailable to the ESG field tier. Not "not yet" — never. It needs a physical optical channel between endpoints; our endpoint is a handset in a rail tunnel. It could apply to a datacentre-to-datacentre sovereign link, which ESG does not have and has no plan for. Offering it as an optional sovereign transport for a future customer is legitimate sales posture; implying ESG data rides it is not.
  • [ ] Q11 · The device credential IS the "universal launch key" the NC3 piece warns about. ESG_DEVICE_TOKENS proves identity AND grants write capability AND is the same value on every handset of a build — one credential travelling the whole chain. The fix is not a stronger shared token: it is identity and capability as separate things. Seam is deviceToken(). See Part 6.
  • [x] Q12 · ESG already implements the NC3 principle in the event contract. Verified in code, not assumed: a signature, not a bearer token, authenticates a captured event (so an offline queue past token expiry stays valid); sign-off is two InspectionSigned events with missingSignedEvents reconciling an interrupted pair; SystemActor.upstreamRef is REQUIRED, so no machine-authored event exists without a human provenance root. The event contract is the model to extend to the front door, not to replace.
  • [ ] Q8 · THE UNGLAMOROUS GAP IS THE REAL ONE. Part 11 of the high-assurance doc places ESG on the ladder honestly: Level 2 is NOT met for human access — console pages are unauthenticated unless Cloudflare Access is configured in front of the origin, and it is not configured. Nothing on the Level 5–8 ladder (confidential computing, sovereign architecture) is worth funding while the front door is open. A dashboard change, not a code change.
  • [x] Q9 · ESG is unusually strong at exactly one of the essay's principles. @esg/event-envelope's two nested hash chains + three signed actor classes already are the "cryptographically verifiable history of institutional state" the piece describes as the hard part. This is buildable evidence, not an intention — say so in a submission.

Decided, so it is not re-argued

  • A quantum computer is a threat model, not a credential. Qubits in a card sign nothing. The defence against Shor is post-quantum mathematics (ML-DSA), which runs on ordinary silicon. Tier 3 ("on-card quantum") is not on a roadmap and gets no date.
  • A hair-grown diamond contains NO DNA. Purification to elemental carbon destroys the sequence. The honest claim is chain-of-custody of the carbon, never "contains your DNA" — and the truthful framing also keeps the product out of GDPR Art. 9 special-category scope, which the false one would drag it into.
  • The security value is the PUF, not the qubit. NV-centre distribution is stochastic and unclonable by the grower too. That is a real hardware root of trust and it needs no quantum computer.
  • Authority != credentials != capability != execution. Keep the four separate. No single credential travels the whole chain. The event contract already honours this; the console front door does not.
  • Do NOT imply ESG is built to NC3 standard. NC3 is a classified system described publicly only in outline. Using it as design vocabulary is legitimate; claiming the standard is exactly what P3 forbids.
  • PQC + HSM + attestation + key isolation BEFORE exotic quantum communication. FOUR independent routes, one answer: NSA (CNSA 2.0 / "QKD not recommended for NSS"), the high-assurance piece (§10), the QKD piece ("I would not make QKD the foundation"), and POSITION-quantum-security-and-identity.md from our own code. Settled — stop re-opening it.
  • You cannot escape PQC by buying photons. QKD does not authenticate the far end; it still needs conventional authentication to know Bob is Bob. That gap is the decisive argument, not a footnote.
  • DI-QKD stays out of any diagram with our name on it. Elegant Zero Trust and a real Nature result, but key rates are bits/second at lab range. Principles discussion only.
  • Never claim "quantum-secured by an on-card quantum chip." It is false and it is the kind of false that ends a procurement conversation. Full honesty register at docs/PLAN-diamond-identity-card.md §5.

B · "No script URL provided" — the phone had no JS at all (2026-08-06)

2026-08-06 · Claude Opus 5 (Claude Code, session 54df98bb). Pete: the app had been failing on this "constantly".

  • [x] B1 · ROOT CAUSE: the Release .apps contained no main.jsbundle. apps/esg-field/node_modules was entirely absent, so Xcode's "Bundle React Native code and images" phase produced nothing — and the build still reported success. Both /tmp/dd-inspect and /tmp/dd-demo products were verified bundle-less. In Release, bundleURL() returns Bundle.main.url(forResource:"main"); with no such file it is nil, which is exactly unsanitizedScriptURLString = (null). It was never a Metro problem — restarting the packager could not have fixed it.
  • [x] B2 · Deps + pods restored. npm install --legacy-peer-deps (450 MB). pod install then failed once on a raced ReactAppDependencyProvider.podspec and was clean on retry (95 pods). A stale Pods tree was what broke the first rebuild with a missing sherpa-onnx/c-api/cxx-api.h.
  • [x] B3 · Console 500 fixed. app/lib/arrivals.ts declared PAYLOAD_LIMIT a second time while already importing it from ./arrivalsContract — that 500'd every /api/* route and the Submissions page. Duplicate removed.
  • [x] B4 · Build now carries its config. EXPO_PUBLIC_PORTAL_URL, EXPO_PUBLIC_SYNC_URL and EXPO_PUBLIC_DEVICE_TOKEN are inlined at bundle time, all three verified present in the Hermes bytecode after building. Installed to "Mini Me" as com.cogneris.esginspect; launched, process alive, no crash reports.
  • [x] B5 · EXPO_PUBLIC_SYNC_URL is required or inspections never leave the device (found by Codex, verified). lib/sync/connectivity.ts resolveSyncEndpoint() reads only that env var or extra.syncUrl, and app.config.js sets neither — it defines portalUrl and deviceToken only. A build without it queues signed inspections forever, silently. It must point at <console>/api/submissions.
  • [x] B6 · CORRECTION — production is NOT storeless. An earlier claim in this session that "the deployed console cannot receive submissions" was WRONG. Verified by real POST against esg.cogneris.com: /api/ncrs → 200 stored:true, /api/submissions → 200 with a receipt. Both are D1-backed via the ESG_NCR_DB binding. Only /api/inspections is still on node:sqlite (app/lib/db.ts) and it is the legacy web-demo route — Codex confirmed the app's {op,siteId} client in lib/ncr/api.ts has no runtime callers. Probing that one route produced the fs.mkdirSync error that caused the wrong conclusion.
  • [!] B7 · PRODUCTION ACCEPTS UNAUTHENTICATED WRITES. esg.cogneris.com answers device POSTs with "device":"anonymous" — the deployed build predates app/lib/deviceAuth.ts. ESG_DEVICE_TOKENS is set as a Worker secret and the local console enforces it correctly (401 without a token, 200 with), but the deployed code has never shipped, so anyone on the internet can file an NCR. Blocked on a decision to run pnpm cf:deploy; note the regime FLIPS on deploy — every handset without a matching EXPO_PUBLIC_DEVICE_TOKEN starts getting 401.
  • [x] B8 · Build must run in the FOREGROUND. Three backgrounded xcodebuild runs died with ** BUILD INTERRUPTED ** (exit 144) at the asset-catalog phase — not disk (79 GB free) and not memory (40% free). The foreground run succeeded first time. Do not background this build.
  • [x] B9 · CORRECTION to B7, same day: production now ENFORCES auth, and our token is NOT the one it holds. While this session ran, a concurrent session deployed deviceAuth. esg.cogneris.com and esg-web.sequents.workers.dev now answer an anonymous GET with 401, and answer OUR credential with "That device credential is not recognised". The pair in ~/foreman/.env is internally consistent (device token == the secret half of ESG_DEVICE_TOKENS, 64 hex, label esg-field) and the LOCAL console accepts it, so the DEPLOYED Worker secret is simply a different value. Secret values cannot be read back, only replaced. Any device build must therefore target the local console until the deployed secret and the build's token are reconciled — do not assume a prod-pointed build can submit.
  • [!] B10 · THIS MACHINE'S LAN IP CHANGED: 192.168.50.95 → 192.168.50.160. Found only because the console stopped answering on the LAN mid-session. Consequences that outlive this session: docs/DEMO-ontario-line-rehearsal.md line 5 is STALE (it names http://192.168.50.95:3000), and the com.cogneris.esgfield demo build described there has the old address baked into its bundle, so it cannot reach the console. EXPO_PUBLIC_* values are inlined at bundle time — a changed IP means a REBUILD, not a restart. A DHCP reservation or a hostname would stop this recurring; not done. Note the machine-topology memory naming .95 is now wrong.
  • [x] B11 · Verify the bundle, always. After every build, before installing: ls <app>/main.jsbundle, then strings -a it for the expected portal/sync URL, the absence of any stale URL, and the device token. This session's build was checked that way (4.8 MB bundle, 192.168.50.160 present, zero hits for .95, token present). Every failure in this session would have been caught in seconds by that check.
  • [x] B12 · The project map carries layers (2026-08-06). screens/project/ProjectSummary.tsx, embedded in Home's existing project status panel — that panel WAS the project summary, it just drew geometry and said nothing about the state of the project. Five chips, one layer at a time: NCRs · Inspections · Delivery · ESG · H&S. What each layer may claim is the whole point: NCRs and Inspections are REAL (folded from the ticket log and the walk events); Delivery is SEEDED and its legend says so; ESG claims nothing where no walk exists; and H&S colours NOTHING because no framework exists — a green zone would say somebody checked and it was fine. Tickets raised with no location are counted as "not placed on the map", never dropped and never guessed onto a zone, because NcrOrigin.locationId is explicitly never inferred from GPS. ui/siteMap.tsx gained a zoneOverlay prop: the overlay is CALLER-SUPPLIED because the map knows geometry and must not reach into an event log. 6 tests in screens/project/__tests__/ lock the negative claims. NOTE: it is a plain View, NOT a ScrollView — it embeds in Home's scroller, and a nested flex: 1 scroller in a content-sized parent collapses to zero height (that is the B-series blank-walk bug).
  • [x] B13 · DisciplineAssessed had no durability coverage. It was declared in INSPECTION_EVENT_TYPES with a decoder and a live consumer, but sampleDrafts() in durability.test.ts had no sample for it — so the one test that proves EVERY event type survives a restart silently was not covering it. Sample added in its declared position.
  • [!] B14 · The on-device speech model fails to initialise. NOT the known "models are gitignored" trap: whisper-base.en-int8, whisper-tiny-int8 and zipformer-en-stream are ALL present in the built .app WITH their tokens. engine.isAvailable() returns false after prepare(), and the engine reports NO cause, so NoteCapture shows its generic fallback. Diagnosing it needs the device console captured while the mic is held. Typed notes work, so it does not block a walk.
  • [x] B15 · THE RESUME LIST REPORTED "0 of 9 sections" FOR EVERY LOCATION WALK. Pete: Eglinton "seems to get caught in a loop". InProgressTab.sectionsRecorded counted AreaInspected, which is emitted ONLY by the section-based walk. A site with a location register (Eglinton, Ontario Line) emits LocationInspected / LocationNotReached and NEVER AreaInspected, so the one screen that lists resumable work told an inspector nothing had been recorded — inviting them to start the walk again. That is the loop. Now counts PLACES, with the register's total when the site is known by name and NO denominator when it is not (an invented total is worse than none). 4 tests in screens/__tests__/openWorkProgress.test.tsx.
  • [x] B16 · A WALK MAY SPAN WEEKS, and the model already allowed it (Pete, 2026-08-06: "it could be 2 weeks with each area taking 1 full day"). Verified, not assumed: the event log persists, an inspection stays open until InspectionSigned, TaskFlow resumes on taskId, and useOpenWork has NO date filter, so nothing ages out. The defect was never the data model — only B15's reporting. Do not "add multi-day support"; it exists.
  • [x] B17 · The map is a way in, not a picture. A picked zone now offers "Inspect here" / "Raise NCR here" (wired to the shell) and LISTS THE ASSETS registered at that place — Pete: "I want to be able to view/list assets for inspection". "Audit here" is deliberately NOT offered: the shell models audit as a task kind but no audit flow exists behind it. STILL MISSING: the started flow does not yet PRE-FOCUS the picked place — that needs plumbing through TaskFlow and was not bolted on.
  • [x] B18 · CLOUDFLARE ONLY. NEVER RUN THE CONSOLE LOCALLY (Pete, 2026-08-07, emphatically). Device builds now point at https://esg.cogneris.com; the local next dev console is stopped and must not be restarted. A field app has to submit over ANY internet connection — a phone on 5G at a corridor is the normal case — and a LAN console makes the product untestable in the field and unreachable off-site. My error, stated plainly: I chose a LAN console because production's /api/inspections threw fs.mkdirSync, without checking that this is the one legacy node:sqlite route THE APP NEVER CALLS. /api/ncrs and /api/submissions were D1-backed and working in production the whole time. VERIFY BEFORE EVERY INSTALL: strings -a main.jsbundle contains esg.cogneris.com and NO localhost / 192.168.* / .local of ours.
  • [x] B19 · Production accepts the device token — CHANGED MID-SESSION. Earlier on 2026-08-07 production answered our credential with "That device credential is not recognised"; later the same day it returned 200 and stored (receiptId RCP-1W3WV19, device: esg-field). Something changed server-side that this session did not do. Observed, not controlled — if it starts refusing again, that is the thing to check first.
  • [x] B20 · Per-area submissions (Pete: "multiple submissions on a site of multiple areas than no submissions until all areas are complete"). Recording an area enqueues that area's own submission immediately — no signature required. Filed under <inspectionId>#<locationId> because the receiver keys on entity id and area two would otherwise REPLACE area one. state: "in-progress", signatures: [] — an area is recorded, not certified. 7 tests in lib/sync/__tests__/areaSubmission.test.ts. NOTE: a first attempt used state: "area-recorded"; the type union is the RECEIVER's vocabulary and rejected it. Do not mint states the far end has not been taught.
  • [!] B21 · The phone could not be reached to install for ~40 min. The Cloudflare-pointed build is BUILT AND VERIFIED but NOT INSTALLED, so the handset still carries a build pointing at the dead LAN console and cannot submit anywhere. Installing needs USB or same-Wi-Fi (an Xcode constraint); SUBMITTING needs only internet. TestFlight export started 2026-08-07 to remove the cable dependency — see §2a. NOT UPLOADED, and the three browser steps (App ID for com.cogneris.esginspect, App Store Connect record, tester invite) are still not done.

Decided 2026-08-06, so it is not re-argued

  • The app is "Field Agent". Not "ESG Inspect", not "Field Intel". The name states the ROLE, not the task: inspection is one thing this tool does, and the same walk/capture/ticket model is intended to serve field SERVICE and maintenance for future clients. A name built on "inspect" or "intel" argues against every one of those uses. It is also short enough that iOS does not truncate it under the icon — "Field Intelligence" did. The PRODUCT term is Field Intelligence; the ICON says Field Agent.
  • The lanes are Delivery / ESG / H&S. development → Delivery, because the lane carries progress, construction, permits AND the project plan — permits and plan are not progress, they are what progress is measured against, so "Progress" excludes most of it, and "Construction Progress" welds the lane to construction on a platform meant to serve service work too. safety → H&S, which is how it is spoken and written.
  • LANE IDS ARE NOT RENAMED. development / esg / safety stay as keys. They are already written onto recorded events; renaming a key to improve a label would orphan the history authored against it. Labels are for people.
  • GRC is deliberately ABSENT, not stubbed. Named by the client but not yet specified. An empty lane on a map asserts that nothing is wrong in it.
  • ONLY ESG HAS FUNCTIONALITY (Pete, 2026-08-06). H&S has no framework anywhere in the app and Delivery's stage data is SEEDED, not surveyed. The existing three-state LaneState already says this honestly — no-framework ("there is nothing to do it with") is deliberately distinct from not-assessed ("nobody has done it yet"), because collapsing them would tell a director that H&S is merely outstanding on a site when the truth is the product cannot do it. Do not paint an unbuilt lane green.
  • NEVER BAKE A DHCP IP INTO THE BUNDLE. EXPO_PUBLIC_* is inlined at build time. This machine's lease moved .95 → .160 → .95 within one session, silently breaking every installed build. Builds now target http://CoreArivant.local:3000 (mDNS), which survives the move. Verify with strings -a main.jsbundle that the hostname is present and no literal IP is.
  • iOS Local Network permission is required for mDNS. If denied, the console is unreachable and it will look like a network fault, not a permissions one.
  • NOT VERIFIED: nobody has yet driven the app by hand — raise an NCR, complete a walk, sign and submit — and confirmed the row appears in the console. The transport is proven by direct HTTP; the UI path is not.

P · Development progress, recorded on the walk (2026-08-05)

Source: PLAN-progress-stage-of-work.md. Pete: *"site inspection is not just about NCRs, it is about project progress… we want management to understand how the project is progressing and to determine if there is anything unforeseen arising."* Builds on the area-by-area walk (E16).

2026-08-05 · Claude Opus 5 (Claude Code, session d44cfa8b).

  • [x] P1 · The stage vocabulary and the seeded register. app/lib/workStages.ts and its byte-identical device mirror apps/esg-field/data/workStages.ts: seven ORDINAL stages (not-started → establishment → excavation → structure → backfill → reinstatement → complete). Ordinal on purpose — order is what makes "regressed" and "out of sequence" computable facts rather than opinions. STAGE_AT_LAST_SURVEY seeds Eglinton's ten places at a deliberately uneven spread so the signals have something to find. It is SEEDED, NOT SURVEYED — authored data, superseded by the first real walk.
  • [x] P2 · LocationStageObserved. Additive event; SCHEMA_VERSION stays 1. Carries previousStage ON the event rather than recomputing it later, so a movement is a fact on the record instead of a diff two readers could derive differently. Runtime-decoded in lib/store/decode.ts; the stage VOCABULARY is deliberately not validated there, so a retired stage id still reads back instead of turning a durable row corrupt.
  • [x] P3/P4 · The fold and the four signals, with 20 tests at the boundaries: stalled (no movement across N walks), regressed (went backwards), out-of-sequence (a stage skipped with nothing recorded between) and repeatedly-not-reached (a blind spot forming). Each carries derivedFromWalks so a reader can weigh it — "stalled across 2 walks" and "across 9" are different statements. Confirming a place has NOT moved is recorded as a real observation; it is the only thing that distinguishes a stall from a place nobody checked. ONE IMPLEMENTATION, TWO CALLERS. The rules live in workStages.ts (foldDeliveredProgress); the handset folds its event log into the same neutral shape and delegates. tests/registers.test.ts asserts the two copies of that file are identical from the first declaration down, because a console and a handset that disagree about a warning is the one contradiction this model exists to prevent.
  • [x] P5/P7 · The walk asks the stage FIRST at each place, before its checks — it is the question an inspector can answer the instant they arrive, and it frames everything under it. Three actions: confirm, advance one, or open the full line. Going BACKWARDS is offered plainly but REQUIRES a reason; rework is the most valuable thing a walk can report and hiding it behind a correction flow would discourage recording it. 7 render tests.
  • [x] P8 · Progress rides the existing delivery path. lib/inspection/ submissionProgress.ts builds the block; lib/sync/outbox.ts carries it as an additive progress field. NO SIGNAL IS COMPUTED ON THE DEVICE — one walk cannot see a series, and shipping a signal from the handset would ship a claim it had no evidence for. The transport itself was NOT built here: it is session 0add9fc1's outbox → /api/submissions → inspectionStore.
  • [x] P10 · The console reads the series. app/lib/projectProgress.ts folds every delivered walk for a project; components/projectProgressPanel.tsx renders SIGNALS FIRST, then where each place has got to. No percentage anywhere — a percent-complete figure is a quantity surveyor's instrument and nobody in this chain owns the quantities. The store read is wrapped because /projects/[id] prerenders; a store that throws must not take the build down. VERIFIED 2026-08-05: console tsc clean · root node --test 66/66 · jest in apps/esg-field 218/218 (18 suites) · golden fixture digest OK.
  • [ ] P6 · A dedicated progress view on the handset. NOT BUILT. The walk shows each place's stage on its card, which is most of the value, but there is no per-project progress screen on the device.
  • [ ] P11 · Stage on the site plan. NOT BUILT. Zones are not tinted by the stage last observed.
  • [ ] P13 · Raise an NCR from inside the walk. STILL NOT WIRED, and asked for twice. NcrOrigin.locationId was added so a ticket can say WHERE on the site, but nothing reaches CaptureFlow from the walk — it is rendered only from the app shell. The walk binds photo evidence to (place, check); it does not raise a ticket.
  • [ ] P14 · (location × stage) → checks. NOT BUILT, and deliberately last. Applicability is still static per location, so the walk asks the same questions at a place whatever is happening in it. This is the change that makes progress an INPUT to the inspection rather than a report beside it, and it must not land before the bindings are approved.

What is NOT true, plainly: the stage register is seeded demo data, nobody who has stood on the ground has approved either it or the check bindings, and with two walks on record the signals are thin evidence — which is why every one of them prints the walk count it was derived from.

N · Build plan, field + console (2026-08-06) — AWAITING PETE'S REVIEW

docs/PLAN-field-and-console-2026-08-06.md. The Codex UX proposal filtered through the Bernard Principles: highest value first, high impact for low effort, fewer features flawlessly executed, simplest EXPERIENCE rather than simplest UI. Six slices, six things explicitly CUT with the reason in writing. Signed: Claude Opus 5 (Claude Code, session 0add9fc1).

  • [x] N0-V · Slice 0 — voice: real-time feedback, and the audio kept. 2026-08-06. On-device recognition was already real (5,619 sherpa symbols and 345 MB of models INSIDE the app binary); what was wrong was that dictation asked for getAudioEngine("ondevice"), which honours EXPO_PUBLIC_SHERPA_MODE — defaulting to batch, so words appeared only after the operator stopped. It now asks for the streaming engine BY NAME. lib/audio/pcmWav.ts + startNoteCapture/finishNoteCapture make the microphone a single writer with TWO INDEPENDENT CONSUMERS (Pete's CQRS framing): storage appends PCM to a real WAV in two-second batches DURING the turn, transcription decodes the same frames for live partials. A crash mid-note no longer costs the audio; an interrupted turn leaves a recoverable WAV whose header is patched at launch. The accurate pass RE-READS THE FILE (transcribeFile), which is exactly the operation a better model will perform later. The screen states the hand-over — "Refined by … after you finished", with what was heard live.
  • [x] N1 · Slice 1 — dictation that files the right KIND of record (field). 2026-08-06. Reachable from the map's location card and from each location in the walk. The kind is answered by WHERE it was started and the screen says what it will be filed as. NoteRecorded carries the confirmed words, the machine transcript, the live text when the two differed, the model that produced it, and the recording. Category derived from the check, absent otherwise. Notes render on the place headed "none of them answers a check", folded outside foldCoverage — that separation IS the point.
  • [x] N2 · Slice 2 — the console can open ONE delivered inspection. 2026-08-06. app/inspections/[id] renders what was delivered: the two clocks (signed on the device vs received here), the receipt, where the inspector went, what was NOT reached and why, findings, signatures — and a closing panel naming what the record does NOT contain (photos and audio stay on the handset; dictated notes are not yet carried; an unanswered check is not a compliant one). Reached by clicking the arrivals row, which until now was a row and nothing else. A record delivered before the progress block existed still opens and says so.
  • [!] N-COLLISION · two cross-session fixes, recorded so they are not undone. (a) app/lib/inspectionStore.ts gained an import "server-only" from the other session — correct, but the package is not installed, which broke the node test suite. The guard is KEPT; the pure receiptFor moved to app/lib/receipt.ts where a test can load it. (b) applicability is now MIRRORED — app/lib/applicability.ts is the source and apps/esg-field/data/applicability.ts must match exactly (tests/registers.test.ts). My Ontario Line binding had landed only on the device; it is now in both, and the four checks it left homeless (spill-4/5/6, waste-5) are asked at East Harbour, the laydown. Highest value: the models are on the handset, NoteRecorded exists, and there is still nowhere to put a spoken observation that is not a non-conformance. "What are you recording? Location note · Check note · Finding", then confirm, then write. A note never changes coverage.
  • [ ] N2 · Slice 2 — the console can open ONE inspection. Lowest effort of the high-value items. The device delivers into D1 and the console shows a queue row; the chain ends in a list.
  • [x] N3 · Slice 3 — the console walk goes place-first. 2026-08-06. app/inspections/page.tsx now asks WHERE ARE YOU STANDING before it asks what — the places come from the governed applicability map, each showing how many checks apply there, and choosing one NARROWS the category chips to what can actually be answered at that place. The ones set aside are STATED ("3 other categories do not apply at this place"), never silently hidden, so a reader can tell "does not apply" from "was not asked". A finding now carries locationId; absent means not recorded, never site-wide. The place is not pre-filled — a pre-filled place is a claim the inspector did not make. C3.3 was already done, better, by the other session: Coverage carries its BASIS (locations/sections/areas) so a reader is told why two figures are not comparable, rather than being handed two bare numbers. app/inspections/page.tsx is still the category-first screen. Two surfaces telling different stories about one method is the most expensive inconsistency in the product. Includes splitting areasClean into locations-covered and checks-clean.
  • [x] N4 · Slice 4 — an asset is selectable, and events carry assetId. 2026-08-06. Assets were printed and nothing more, so "the shoreline dust monitor" could be READ on the plan and could not be the SUBJECT of anything. They are now the third rung of the drill — Site › Control area › Asset, in the breadcrumb — and selecting one binds the next record to it: NoteRecorded.assetId and NcrRaised.assetId. A ticket against the dust monitor is actionable by whoever maintains it; the same ticket against "Exhibition shoreline" sends someone to walk 700 m looking for what was meant. The card shows a COUNT of what has been recorded against each asset and never a verdict — an asset with nothing against it is one nobody has spoken about, not one found satisfactory. Absent assetId means "not about a registered thing", never "unknown".
  • [x] N5 · Slice 5 — TWO disciplines honestly, not three. 2026-08-06. lib/inspection/disciplines.ts folds three lanes per place and each folds ONLY its own events, so a PM confirming "structure" can never satisfy an environmental check. THE DISTINCTION THAT CARRIES THE SLICE: two kinds of absence, drawn and worded differently — not-assessed ("nobody has done it yet", a task a person can close) versus no-framework ("there is nothing to do it with", which no amount of walking closes). Safety is the second: this application has no safety checklist, no safety event and no safety framework, and the lane SAYS that rather than reading as somebody's overdue task. ESG states coverage APART from conformity — "2 of 3 answered · 1 deficient", never "67% compliant". D5.4 holds: the Ontario Line has no seeded stages, so the lane says "no prior stage observation exists for this site" instead of rendering the not-started fallback as a field claim. 5 specs in lib/inspection/__tests__/disciplines.test.ts. HONEST GAP (D5.3 is PARTIAL): the event envelope carries NO actor — one inspectorId per inspection, no per-event authorship — so a lane can say which inspection an assessment came from and cannot yet say which of two assessors wrote a given verdict. Per-event authorship is a change to the envelope, not something this fold can infer. Stated in the module. Development (LocationStageObserved) and ESG both exist; the lane for Safety SAYS it is unassessed rather than pretending. Coverage keyed by project+location+discipline+framework+item.
  • [x] N6 · Slice 6 — the demo tells one story. 2026-08-06. docs/DEMO-ontario-line-rehearsal.md — one path, and a table separating what is REAL from what is AUTHORED before anything else. (a) The three formerly unplotted places are on the plan, centred on REAL published station points; the earlier decision to drop them was right and its reason is honoured — they had been placed by chainage guess, which put "Lakeshore East corridor" on an underground segment nowhere near the GO corridor. (b) STAGE_AT_LAST_SURVEY seeded for PRJ-ontario in BOTH copies, labelled authored-not-surveyed like Eglinton's. (c) DELIBERATELY NOT SEEDED: any finding, note or verdict. The log is append-only and IS the compliance record; writing invented findings into it would make a demonstration indistinguishable from evidence. Codex proposed a full sample set of failures and dictated notes per location (§4 of its report) — that part is declined, with the reason, rather than quietly skipped. Seeding the stages broke my own D5.4 spec, correctly: it pinned "no stage register" against the Ontario Line, which now has one. The spec follows the CONDITION now (an unseeded project) and a second spec covers the other absence — "nothing observed on this walk" reads differently from "no register exists". Ontario Line seed set from §4 of the Codex report, labelled synthetic; geometry for the three unplotted locations; one rehearsed path.
  • [!] N0 · BLOCKED ON A RELEASE DECISION for production only. Slices 2, 3 and 6 are true in production only after pnpm cf:deploy AND wrangler secret put ESG_DEVICE_TOKENS — together, because the auth fails closed. All of it is demonstrable locally without deploying.

R2 · One app, named Field Agent (2026-08-07)

  • [x] R2.1 · The app is "Field Agent". Pete, 2026-08-07. The field variant in apps/esg-field/app.config.js carried "Field Intelligence Agency" while the native plist already read $(APP_DISPLAY_NAME:default=Field Agent), so the config and the icon disagreed. They agree now. The reasoning is the other variant's and it holds: the name has to survive the use case — inspection is one thing this tool does, the same walk/capture/ticket model is meant to serve field service and maintenance, and a name built on "inspect" argues against every one of those. The ROLE outlives the task.
  • [!] R2.2 · TWO VARIANTS PUT TWO IDENTICAL ICONS ON PETE'S PHONE, and that is why "I don't see any changes on the mobile app" was TRUE. com.cogneris.esgfield (mine, every build this session) and com.cogneris.esginspect (the other session's) both showed "Field Agent", because a direct xcodebuild inherits whatever display name the native project last had. He had no way to tell which he was opening, and one of them was hours stale. Both are now deleted and ONE is installed. The rule: if two variants can be installed side by side, their ICONS must differ. A build label inside the app is not enough — nobody opens an app to find out whether it is the one they meant to open.
  • [ ] R2.3 · Installing still needs a cable. transportType: wired today. Wireless works — the device is paired and "Connect via network" makes devicectl reach it — but the tunnel drops whenever the phone sleeps or locks, which cost time twice today. TestFlight (internal testers, OTA, no Mac) or an itms-services manifest hosted on the Worker would both remove the cable; TestFlight needs App Store Connect, OTA needs each device's UDID registered. Pete's call.

Q · What Pete found by testing it (2026-08-06)

Each item here came from Pete using the app or the console and telling me what was wrong. Signed: Claude Opus 5 (Claude Code, session 0add9fc1).

  • [x] Q1 · Voice notes could not be heard. Every note kept a durable WAV, written WHILE the operator spoke and retained precisely so a transcript could be checked against the words — and no screen would play it. lib/audio/notePlayer.ts + Listen/Stop on the walk list and the map card, one at a time, with "the recording is missing from this device" said out loud rather than a button that does nothing. Plus "+ Record another note here" and "Speak about this check", because check notes were unreachable.
  • [x] Q2 · The map drew the WRONG CORRIDOR. SiteMapView was hardcoded to the Ontario Line, so an Eglinton walk showed Ontario Line geometry under an Eglinton heading — a plan of the wrong site, every part of it legible, plausible and about somewhere else. Now per-project, with Eglinton's own 4,310-path basemap shipped to the device.
  • [x] Q3 · No street detail at Corridor level. Roads were hidden entirely there, on the reasoning that 4,000 roads are a grey wash. Right about the side streets, wrong about the rest: with no expressway, arterial or rail the corridor floated on a blank field. Motorway/trunk/primary now draw at EVERY level; the secondary net still waits for District.
  • [x] Q4 · Pinch to zoom. The spatial model said "named levels, never free zoom" and I built buttons. Pete overrode it. Scale is continuous now (PanResponder, no new dependency) and the level-of-detail thresholds stay named and stated — the part that reasoning was actually protecting. Console equivalent: ctrl/⌘+scroll, with plain scroll left alone so the page still scrolls past the canvas.
  • [x] Q5 · Ten areas shared ten assets, one had none. Drilling to Street showed a heading with nothing under it. 39 assets now, three to six per area, mirrored into the console — where the two registers ALREADY disagreed: AST-OL-WASH-3 sits at Don valley on the console and Thorncliffe on the device. Left alone and written down: moving an asset between control areas changes what past inspections were about.
  • [x] Q6 · Notes had no category, and no way to see one. Category chips on the note screen — offered, not forced, LOCKED when derived from a check. The listing shows subject, category (or "unclassified", said) and whether a recording was kept.
  • [x] Q7 · Copy and navigation. "Project Status Overview". Tiles pluralised. The New inspection screen stopped asking which site — it states it and shows what has already been walked here, in-progress first with Resume. The tiles open a LIST of that kind (This project / All projects, in progress before submitted) instead of starting a new one; starting is an action inside the list.
  • [!] Q8 · TWO STALE SURFACES cost Pete an afternoon, and both were mine. The next dev server had not recompiled for hours, and the handset carried a build predating the work — so he tested, saw nothing, and reasonably concluded the features did not exist. RULE: verify the artefact, not the edit. For the phone that means grepping main.jsbundle in BOTH ascii and utf-16 (Hermes stores some strings as UTF-16) before installing.
  • [!] Q9 · I diagnosed a Cloudflare bug that does not exist. I claimed Authorization was stripped in front of the Worker and wrote it into the source as "proved in production". A deployed header probe showed it arrives intact on both hosts. The real causes were mine: a secret re-uploaded seconds earlier (propagation), and a test that sent label:secret as the bearer value against the bare secret in the other header. The correction is left in lib/ncr/submit.ts rather than deleted, because the wrong version was believed for an hour.
  • [x] Q10 · ESG_ALLOW_ANONYMOUS_SUBMISSIONS deleted from production, on Pete's instruction, 2026-08-07. Verified after: no token 401, wrong token 401, the phone's token 200 with receiver: d1. Nothing changed functionally — configured tokens always won — but the switch is gone. AND A CORRECTION TO MY OWN ACCOUNT OF IT. I reported this twice as "another session set a switch I did not create". The NAME IS MINE: I designed the hatch in app/lib/deviceAuth.ts and put it in the 503 body — "or set ESG_ALLOW_ANONYMOUS_SUBMISSIONS=true to deliberately run without one". So when the fail-closed deploy started refusing handsets, somebody did exactly what my own error message instructed. That is a design consequence, not a rogue change. THE LESSON, WHICH OUTLIVES THE SECRET: an error message that tells a reader how to turn a security control off will eventually be followed, by someone in a hurry, on production. The hatch still exists in code for a demo box or a LAN test — it is the right escape valve to have — but it should not be ADVERTISED in the failure that an operator hits when things are already going wrong.

P · Three managers, three registers (2026-08-06)

Stated by Pete: during PLANNING the H&S manager, the project manager and the ESG manager each define the elements to be assessed and reported on, and each will ultimately USE this application. Signed: Claude Opus 5 (session 0add9fc1).

  • [x] P1 · The planning register exists. apps/esg-field/data/disciplineRegister.ts — versioned frameworks for SAFETY (9 items: permits, edge protection, exclusion zones, plant/pedestrian separation, rescue plan, height equipment, hot works at fuel storage, confined space at containment assets, rail adjacency) and DEVELOPMENT (6 items: stage matches record, access serviceable, predecessor complete, constraints in force, consent monitoring installed, two-week look-ahead). ESG is NOT duplicated — it already lives in the template plus applicability.ts, and a second copy would drift from the signed form. Items are asked per PLACE or per ASSET KIND, with stated exceptions (rail adjacency is not asked in the middle of the Port Lands, because a question asked where it cannot apply is how N/A stopped meaning anything).
  • [x] P2 · The lanes read it. Safety was "no framework" and is now a real count of planned items — AND says plainly that none can be answered yet, because there is still no safety EVENT to record one in. A count of planned work is not an assessment. Development reports the stage observed AND how many of the PM's planned items remain unasked.
  • [x] P3 · Mock records for all three domains. app/lib/sitePlans.ts carried nine records, every one environmental. Added 7 H&S (near miss, edge protection, extinguisher out of date, no lookout on the live corridor, hot works permit, lifting gear, confined space) and 6 PROGRESS (stage confirmed, haul route restricted, possession cancelled, predecessor incomplete, bird-window reschedule, road occupancy permit). Plotted gained an optional discipline; ABSENT MEANS ESG, because every record written before today was environmental and back-filling would assert something nobody recorded. The surface has a filter and every row names its discipline — an open safety observation must never read as an environmental one.
  • [ ] P4 · Nothing can ANSWER a safety or progress item yet. The registers are planned and the records are mock. There is no SafetyAssessmentRecorded event and no screen to record one, so the H&S manager can read this application and cannot yet use it. That is the next slice, and the lane says so rather than implying otherwise.

M · The inspection is a place, and a place has more than one assessor (2026-08-05)

Stated by Pete on 2026-08-05, on the phone, looking at the running build. Recorded here because it is a PRODUCT SHAPE, not a screen tweak, and three earlier conversations about it were lost to their own sessions. Signed: Claude Opus 5 (Claude Code, session 0add9fc1).

The experience, in his words: select a project · two view modes, LIST and SPATIAL MAP · zoom and drill down · when the inspection starts you can switch between view modes · each area carries its items to check AND indicates overall development progress and environmental assessment · the project manager enters overall development progress, H&S provides the safety assessment, ESG assesses category compliance and progress.

So an area is a place with SEVERAL assessments on it, by different people. That is the part no existing screen models: today an inspection has one author.

  • [ ] M1 · Spatial map view on the device. The phone ALREADY has the geometry — data/corridorGeo.ts holds OL_ROUTE, OL_STATIONS_GEO and 7 OL_ZONES_GEO control areas for the Ontario Line, with a true-aspect corridorProjection(); react-native-svg is already a dependency. Nothing needs moving from the console. Ontario Line is the demo site.
  • [ ] M2 · Zoom at NAMED levels and drill-down as a hierarchy. Both are already specified in docs/SPATIAL-MODEL-purpose-and-views.md §5 and both are already BUILT — in the console (app/components/siteMap.tsx + planCanvas.tsx), never on the phone. Corridor · District · Street for zoom; Site › Control area › Asset › Record with a breadcrumb for drill. Level of detail AGGREGATES, never hides: a control area carries one badge, coloured by the WORST record present, never an average.
  • [ ] M3 · List / Map toggle, live during an inspection. One walk, two drawings of it — the same argument as E13, extended to the field app.
  • [x] M6 · Codex UX review, and the three things it ranked first. 2026-08-06, Claude Opus 5 (session 0add9fc1). Full proposal in docs/UX-inspection-experience-codex-2026-08-06.md. Applied from it: (a) arch-1 was asked BOTH corridor-wide and at First Parliament — one check id, two answers, ambiguous when folded. Now asked only at z-ol-parliament, with the divergence from Eglinton explained in the data. (b) not-visited and not-reached are now DIFFERENT states on the plan: grey for "nobody has been yet", amber for "somebody went and was turned away, and said why". Drawing them alike told a reader a blocked place was merely pending. (c) "Inspect here" now opens the walk INSIDE the place you tapped — LocationWalk takes focusLocationId — instead of dropping you on a list scrolled to the top. (d) NoteRecorded exists: an observation with NO verdict in it, bound to a location, a check or a ticket, keeping the recogniser's transcript BESIDE any operator correction rather than overwriting it, with the category OPTIONAL (derived from the check where there is one). Nothing about a note establishes coverage.
  • [ ] M7 · The note event has no producer yet. NoteRecorded is in the vocabulary and in the durability spec; no screen writes one. The capture affordance Codex proposes — "What are you recording? [Location note] [Check note] [Finding]" — is the next slice, and it is what makes dictation useful for anything that is not a non-conformance.
  • [ ] M4 · Per-area, per-discipline assessment. Development progress (PM), safety (H&S), ESG category compliance (ESG). Needs an event vocabulary: one aggregate (the area), several assessors, each contributing their own lane, none overwriting another. This is the real design work — the other three items are a view over it.
  • [!] M0 · The device has TWO walks and the route reaches the wrong one. LocationWalk (place-first, 857 lines) is wired at TaskFlow.tsx:905, but the path taken from New inspection lands on the LEGACY section list at TaskFlow.tsx:1355 — {done} of {SECTIONS.length} sections recorded, the "0 of 9 sections" on Pete's screenshot. BLOCKER FOR M1–M3: there is no point drawing a map onto a flow that then hands off to the category walk. TaskFlow.tsx and LocationWalk.tsx are being actively edited by another session (E16, location events added 07:38, LocationWalk 14:55) — coordinate before touching them.

S · Submissions audit findings (2026-08-04)

Source: docs/AUDIT-submissions-2026-08-04.md — independent read-only audit by OpenAI Codex (codex exec), every load-bearing claim re-verified against source by Claude Opus 5 (Claude Code, session 22f75e25) on 2026-08-04. Nothing was run: no live D1 read, no endpoint probe, no test execution, no on-device check. Three codex claims were overstated or wrong and are corrected in §8 of the audit — do not re-import them from the raw transcript.

2026-08-05 · Claude Opus 5 (Claude Code, session 0add9fc1) — TWO PASSES, ALL EIGHT ITEMS ADDRESSED. First pass: S1, S2, S4, S7, S8(a)/(b) and the validation half of S3. Second pass, after Pete asked for the deferred three to be completed: S3 authentication, S5 receiver, S6 feed. See the ADDENDUM and "Fixed in the second pass" at the foot of the audit.

Verified: tsc --noEmit clean on both trees over every file touched · node --test tests/*.test.ts 62/62 (17 at the start) · jest in apps/esg-field 150/151, 14 suites · eslint clean on every file changed here.

The one failing jest suite is NOT this work: another session added three location-bound event types to INSPECTION_EVENT_TYPES at 07:38 on 2026-08-05 without extending its own sampleDrafts() in lib/store/__tests__/durability.test.ts. Same session owns the coverage rename errors in HomeTab.tsx, projects/page.tsx, portfolio.ts, demoapp/page.tsx and corridorGeo.ts, and the 4 eslint errors in app/.

NOT VERIFIED, AND IT MATTERS OPERATIONALLY: nothing was run against a deployment, D1 or a handset. The auth FAILS CLOSED, so the deployed console will refuse device traffic until ESG_DEVICE_TOKENS is set, and migrations/0003_delivered_inspections.sql has not been applied. One command each — docs/OPS-device-credential.md.

  • [x] S1 · A retry overwrites the accepted NCR and restamps its arrival time. CRITICAL. app/lib/ncrStore.ts:151-179 (D1) and app/lib/db.ts:527-540 (sqlite) both compute duplicate, then INSERT OR REPLACE every column including received_at = Date.now(). So an unknown-outcome re-send destroys the original arrival time — the one fact app/api/submissions/route.ts exists to keep — reorders the inbox (ORDER BY received_at DESC), and lets any field of an already-accepted compliance record be rewritten on replay. With S3 unfixed, any caller who knows an id can do it. Fix: insert once; on an existing id verify-and-return duplicate: true untouched. Never replace, never restamp. DONE 2026-08-05 (Claude Opus 5, session 0add9fc1). Both backends are INSERT-ONCE: existing id → {stored:false, duplicate:true} and NO write, so received_at and every asserted field survive a replay; first write uses INSERT OR IGNORE so losing a race keeps the FIRST row. A replay carrying DIFFERENT content is reported via ncrConflict() and the route now answers {ok, id, stored, duplicate, conflict}. Two specs in tests/persistence.regression.test.ts, incl. the forged-rewrite case.
  • [x] S2 · The post-raise delivery sweep cannot see the NCR that triggered it. CaptureFlow.tsx:176-178 calls raiseNcr then deliverSoon(log), but the log from useNcrLog.ts:53-63 closes over the pre-append React events array, so delivery.ts:124 filters a set the new ticket is not in. Recovered by the next sweep (Submissions mount, SubmissionsTab.tsx:115), so LATE, NOT LOST — but delivery.ts:10 claims "the raise triggers delivery" and that is untrue of the raise that triggers it. DONE 2026-08-05 (Claude Opus 5, session 0add9fc1). useNcrLog keeps what it has appended since its render and answers reads from snapshot + appended, reconciled on eventId. NOT done via the store singleton — the adapter has to stay drivable from a test that mocks lib/store. Also: deliverPending no longer returns "nothing attempted" when it waits on an in-flight sweep; it runs one bounded follow-up, so a raise landing mid-sweep is still carried.
  • [x] S3 · Neither submissions endpoint has any authentication, and both answer on the deployed host. app/api/ncrs/route.ts:9-13 says so itself; /api/submissions GET is equally open. The 2026-08-01 probe recorded at apps/esg-field/lib/ncr/api.ts:14-25 is the evidence they are reachable unauthenticated. Anyone who can reach the console can POST a fabricated NCR under any employee's name at any timestamp and read the arrivals list — GPS to 4dp, raiser, and the dictated transcript. No enum, ISO-timestamp, GPS-bounds or payload-size validation either (route.ts:83-95), and the route invents defaults for four NOT NULL columns. PART ONE DONE 2026-08-05 (Claude Opus 5, session 0add9fc1) — VALIDATION ONLY. STILL UNAUTHENTICATED. POST /api/ncrs now refuses: a body over 256 KB (checked before parsing), a non-object body, any text field over 4,000 chars, a severity outside low|medium|high|critical, a raisedAt that is not a real ISO-8601 instant, a GPS that is not two finite numbers in ±90/±180, a silly photoCount. All errors returned at once, because the device now treats a refusal as terminal (S4). An unstated severity records as unspecified, not medium; severityTone/severityLabel are total so that renders neutrally. [!] BLOCKED ON A DECISION — the auth mechanism. Access service token vs mTLS/device credential vs shared secret each imply different things for a handset working in a tunnel. Until one is chosen, anyone who can reach the console can still READ every arrival — GPS to 4dp, raiser, dictated transcript. This is now the most serious open finding. PART TWO DONE 2026-08-05 (Claude Opus 5, session 0add9fc1) — THE ROUTES ARE AUTHENTICATED. POST/GET /api/ncrs, GET /api/ncrs/[id] and GET /api/submissions require Authorization: Bearer … against ESG_DEVICE_TOKENS (app/lib/deviceAuth.ts), compared in constant time. FAILS CLOSED — an unconfigured deployment refuses device traffic with a 503 naming the variable; the hatch is ESG_ALLOW_ANONYMOUS_SUBMISSIONS and is reported in every response. Bearer, because a handset that delivers hours later cannot hold a session and Expo has no mTLS. THE READ HOLE WAS CLOSED BY DELETING THE ENDPOINT'S ONLY BROWSER CALLER, not by guarding it: the Submissions page reads the store server-side (app/lib/arrivals.ts) and passes rows + raise events down as props. No header a browser sends can prove who is behind it, so guarding would have been theatre. Device side: the credential rides on every request; a refused credential is unauthorized, NOT rejected — folding it into a terminal state would let one missing secret permanently kill delivery on every handset. Diagnostics shows WHETHER a credential is set, never its value. 9 specs in tests/deviceAuth.test.ts, 3 in the device delivery suite. Ops: docs/OPS-device-credential.md. [!] STILL OPEN — HUMAN access to the console PAGES. No identity provider exists here and no code change supplies one: it is Cloudflare Access in front of the origin, and it has NOT been configured. Also: the token is per BUILD, not per device (seam: deviceToken()).
  • [x] S4 · A permanent rejection retries forever with no terminal state. submit.ts:28-36 documents rejected as non-retryable; delivery.ts:131-149 writes a receipt only on delivered, so a 400 is re-POSTed on every sweep for the life of the install and shows as "pending" — the state reserved for "something is still trying", which invites nobody to look. DONE 2026-08-05 (Claude Opus 5, session 0add9fc1). A rejected outcome writes a DeliveryRejection (status + the portal's own words), the ticket leaves the sweep, and Submissions reads "refused by the portal (HTTP n) — needs a look" in the issue colour, not "sending". clearRejection(ncrId) re-queues one when the far end is fixed. Four specs in the new apps/esg-field/lib/ncr/__tests__/delivery.test.ts.
  • [x] S5 · The inspection outbox has no receiver, and its failure is invisible. SignoffSheet.tsx:191-206 queues {closedOffAt, signatures[]} (no siteId, no summary, no findings); lib/sync/upload.ts posts a shape neither /api/submissions (GET-only — no POST handler at all) nor /api/inspections (op-keyed) can accept. Latent, not live: no endpoint is configured. Two real defects on the same path — the enqueue catch at SignoffSheet.tsx:203-206 promises "re-queued on the next close-off attempt" and nothing re-attempts it, and TaskFlow.tsx:651-654 hardcodes {kind:"queued"} at render, so a failed enqueue still reads "Queued". NOT STARTED — deliberately (2026-08-05). Latent: nothing is configured to post, so nothing is being lost today. Giving the outbox a receiver is a design decision about what an inspection submission IS, and docs/INSPECTION-AREA-FIRST-proposal.md (E16) is re-opening exactly that. Do not wire a receiver before E16 is decided. DONE 2026-08-05 (Claude Opus 5, session 0add9fc1) — THE OUTBOX HAS A RECEIVER. POST /api/submissions speaks the outbox's OWN envelope, so no device needs a new build to be received. Insert-once on the device's inspection id into delivered_inspections (D1 + local sqlite, migrations/0003); a replay is answered with the SAME receipt and honours Idempotency-Replayed, the proof lib/sync/upload.ts already looked for. The payload is folded from the same log the report is (site, template, kind, summary, finding count, signatures) — it carries siteName and templateId, NOT a siteId, because the event holds none and inventing one would read as fact at the far end. reconcileOutbox() is the re-queue the old catch only promised: any signed inspection with no row gets one, idempotently, on mount. TaskFlow derives all four Delivery states from the real row instead of hardcoding "queued" — and a synced row with NO receipt still reads "queued", because delivery observed is not a receipt issued. 3 specs in tests/persistence.regression.test.ts, 7 in lib/sync/__tests__/outbox.test.ts. NOT APPLIED: migrations/0003 has not been run against D1.
  • [x] S6 · The register and every score are fed fixtures while the inbox is real. NCR_SUBMISSIONS (app/lib/ncr.ts:198) is the default for analytics.ts:63,122,144,169,186 and ncr.ts:380,407,420, so an arrived device ticket shows in the inbox and moves no figure. The derivation is real and already parameterised (rows: NcrSubmission[] = NCR_SUBMISSIONS) — this is a feed swap, not a rewrite. NOT STARTED — Pete's call, not a defect fix (2026-08-05). The swap is one line per call site, but it empties the demo console of the seven fixture rows every screenshot and deck page depends on. Needs a decision about which surfaces read live and which stay demo-fed. DONE 2026-08-05 (Claude Opus 5, session 0add9fc1). app/lib/ncrFeed.ts maps a received ticket onto a register row and CHOOSES the source with ESG_CONSOLE_FEED: auto (default — live when this console holds any, else the sample), live, sample, mixed. WHATEVER IS CHOSEN IS NAMED ON THE SURFACE, which is what answers the "it would empty the demo" objection: the deck keeps its seven worked-example rows until a real ticket arrives, and the moment one does the page is about real tickets and says so. Wired into the Submissions register and the reporting dashboard roll-up; ncrSummary was the one derivation not already parameterised and now is, default intact. A live row is OPEN with an empty history — no owner, no action, no verification — because none has happened; syncedAt is the one field it knows better than a fixture. 7 specs in tests/ncrFeed.test.ts. STILL FIXTURE-FED: app/v2/** and components/dashboard-widgets.tsx call the derivations with no argument. They are client components mid-edit in the E16 session; threading the feed through them belongs with that work.
  • [x] S7 · Receipts are the weakest link in an otherwise durable chain. delivery.ts:83-93 overwrites one JSON file in place — no temp-and-rename, unlike the signature repo. A kill mid-write yields malformed JSON, read as {} at delivery.ts:68-81, so every delivered ticket reverts to pending and is re-sent — which under S1 restamps every arrival in the console. DONE 2026-08-05 (Claude Opus 5, session 0add9fc1). Temp-write, delete, rename — the lib/signature idiom — and the temp file is ALSO the fallback read, so a kill between the delete and the rename loses nothing. The file is versioned ({v:2, receipts, rejections}) and a v1 flat file is still read, so upgrading does not re-send everything. Three specs, one reproducing the truncated-JSON state the old in-place write produced.
  • [~] S8 · Smaller confirmed items. Sign-off and enqueue are not atomic (SignoffSheet.tsx:172-192) with no signed-but-unqueued recovery sweep · app/api/submissions/route.ts:124-129 reports an inspection-DB failure as "no inspections" · "Raise another" keeps the last ticket's site/area/severity (CaptureFlow.tsx:138) · {kind:"confirm"} is fully implemented and never set (CaptureFlow.tsx:48) · submitFinding/submitSummary/ sealInspection/fetchOpenInspection are exported and called by nothing · submit.ts:46-70 returns null where api.ts:48-59 defaults to esg.cogneris.com, so an unconfigured build READS production arrivals while DELIVERING nowhere · api.ts:274-280 validates only id/title before SubmissionsTab.tsx:219-227 dereferences detail and calls new Date(receivedAt).toISOString(). TWO OF THESE DONE 2026-08-05 (Claude Opus 5, session 0add9fc1). (a) resolvePortalBaseUrl() now delegates to portalBaseUrl() and returns null when nothing is configured; the three call sites answer {kind:"no-endpoint"}. No build reads production arrivals while delivering nowhere. (b) fetchPortalSubmissions NORMALISES each row instead of filtering two fields: receivedAt is number | null (never a substituted epoch), kind/site/detail/at coerced, and a row with no time at all is dropped by SubmissionsTab rather than crashing it on new Date(NaN).toISOString(). STILL OPEN: sign-off/enqueue atomicity · inspection-DB failure reported as "no inspections" · "Raise another" inheriting the last classification · the dead {kind:"confirm"} stage · the four uncalled lib/ncr/api.ts functions.
  • [x] S13 · DONE 2026-08-05 09:2x EDT — migration 0003 applied and the device credential minted. Claude Opus 5 (Claude Code, session 22f75e25.) The two production steps Pete authorised; the CODE deploy was deliberately NOT done. - migrations/0003_delivered_inspections.sql APPLIED to remote esg-ncr-db (changed_db: true, num_tables: 2). Verified after: tables are now ncrs, delivered_inspections, _cf_KV, and SELECT count(*) FROM delivered_inspections answers 0. This clears the "NOT APPLIED" caveat on S5 and on S12. - ESG_DEVICE_TOKENS minted and set as the esg-web Worker secret (wrangler secret list confirms one secret_text of that name). 64 hex chars from openssl rand, labelled esg-field, sha256 begins 066c2781e899. The two halves are NOT the same string — deviceAuth.parseCredentials splits on :, so the Worker holds esg-field:<secret> while the DEVICE presents <secret> ALONE as Authorization: Bearer. Both are recorded in ~/foreman/.env (ESG_DEVICE_TOKENS, EXPO_PUBLIC_DEVICE_TOKEN) per Pete's convention; ~/.env does not exist on this machine. The secret was never echoed to a terminal or into a transcript. - Both steps are inert until the code ships, and that was verified, not assumed: after setting the secret, production still answers GET /api/ncrs 200, GET /api/submissions 200, and 200 to a deliberately bogus Bearer — the deployed build (pre-deviceAuth) ignores the secret, so nothing was broken and S3 remains live. - The code deploy was NOT done, on purpose. pnpm cf:deploy builds the working tree. Recommended prerequisite before it runs: confirm the tree is the one intended to ship, then expect the regime to FLIP — the moment deviceAuth is live, every handset without a matching EXPO_PUBLIC_DEVICE_TOKEN in its bundle gets 401 and keeps its tickets. A device build must be issued with the credential BEFORE or WITH that deploy, not after.
  • [x] S15 · SESSION CLOSE-OUT 2026-08-07/08 · Claude Opus 5 (Claude Code, session 22f75e25). Backend built and PROVEN AGAINST PRODUCTION, not read from source. All seven of this session's commits are pushed (ba9c7cf→3c12640). Everything below was executed, with the evidence. - NCR lifecycle exists. migrations/0004_ncr_lifecycle.sql applied to remote esg-ncr-db; app/lib/ncrLifecycle.ts + POST/GET /api/ncrs/<id>/transition; GET /api/ncrs joins the stage at READ time (append-only, current stage = latest row). A REAL ticket (1bce5da7) was moved assigned → remediation → verify → closed; history reads back in device-clock order; replay answers 200 duplicate:true with Idempotency-Replayed. The notes and assignee on that ticket are MINE, invented for the proof — good demo seed, but they are not a real contractor's words. Clear it if that matters. - Evidence storage was never deployed. The R2 binding was in the tree and absent from the running Worker, so production had no evidence store at all. Deployed; bytes round-tripped upload → R2 → serve, byte-identical, device-authed. Test object deleted. - Device work counts are real. useWorkCounts no longer adds NEEDS_ME; it unions the local log with GET /api/ncrs by id. Inbox read 12/12 (the real tickets), then 11/12 after a server-side closure. stageKnown:false is never treated as open. - Project coverage is real. lib/inspection/projectCoverage.ts folds the log; the home row went from a hardcoded "6 of 10" with a 60% bar to "0 of 10" with an empty bar on a device that had walked nothing. - THE LESSON THAT COST THE MOST: a hand-exported credential. EXPO_PUBLIC_DEVICE_TOKEN was exported into the expo run:ios shell, Metro never saw it, and the token was ABSENT from the bundle (0 occurrences vs 3 for the portal URL). The app 401'd on every request while looking healthy and could not have delivered anything. A gitignored apps/esg-field/.env now carries portal + token; Metro logs env: load .env. Never export a device credential by hand.
  • [ ] S16 · THE INSPECTION THAT ARRIVES IS HOLLOW — the one real bug left. Inspections now DO reach the console from the app: two landed together at 14:59:38 on 2026-08-07 with UUID outbox keys (receipts RCP-00CI8HO, RCP-1EIAV8X), which is the sync engine draining its queue, not a curl. But the stored payload is: summary:null · findings:0 · closedOffAt:"" · signatures:[] with only progress.observed[] populated. So the walk's POSITION travels and the RECORD does not — no verdicts, no summary, no signature. The console correctly shows "0 findings · unsigned". Fix is device-side, in SignoffSheet's enqueue payload — the remaining half of S5/audit §5.
  • [ ] S17 · A health probe is writing into a compliance table. Row HEALTH-9406 in delivered_inspections — site "health", title "health" — surfaces in the arrivals queue as an inspection. It should write elsewhere or nowhere. Observed 2026-08-07 22:38Z.
  • [!] S18 · Arrivals 503 recurs on any build older than ad33b545. Blocker to be aware of, not open: /api/submissions returned 503 [unenv] fs.mkdirSync is not implemented yet! because the Worker reached the local sqlite inspection store and the detector classified "no filesystem" as "store present and CORRUPT". Writes were landing in D1 the whole time and only the READ was refused. The fix (extending isModuleUnavailable in app/lib/arrivals.ts) was already in the tree, UNCOMMITTED, when production broke — so it must stay committed and deployed together. Deployed ad33b545; feed back to 200 with 15 items.
  • [ ] S19 · Left running on .95 by session 22f75e25: Metro (expo start --dev-client --host lan, pid 74881 at close) and the iPhone 16 Pro simulator with com.cogneris.esgfield installed and credentialled. Kill Metro when done; the simulator build is a debug build that needs Metro to run.
  • [x] S14 · Working tree committed 2026-08-05 (ba9c7cf). Pete asked for the tree to be committed. Session 0add9fc1 had already committed the S1–S8 source work; what remained was three non-hand-authored files — app/lib/library.generated.ts (rebuilt index: GENERATED_AT + the new audit doc's summary), pnpm-lock.yaml (real drift — packages/esg-golden-gate, wrangler 4.119.0, miniflare, workerd, sharp, eslint import resolver) and the previously-untracked, un-gitignored tools/agent-console/pnpm-lock.yaml. No source, test or config change. npx tsc --noEmit clean. The 158 eslint errors under tools/agent-console/out/** and sequents/** are pre-existing.
  • [x] S12 · THE "NOT VERIFIED" ITEMS ABOVE ARE NOW VERIFIED — executed 2026-08-05 08:20–08:45 EDT · Claude Opus 5 (Claude Code, session 22f75e25). Session 0add9fc1 correctly recorded its S1–S8 work as never run against a deployment, D1 or a handset. It has now been run. Appended, not edited into their entries. - Production is still wide open, and there is now proof rather than inference. GET https://esg.cogneris.com/api/ncrs with Authorization: Bearer not-a-real-token → 200 with the data. A build running deviceAuth answers 401 + WWW-Authenticate (deviceAuth.ts:154,173), so the deployed build checks no credential. GET /api/submissions → 200; POST /api/ncrs {} → 400, i.e. refused by FIELD VALIDATION, not by auth. esg-web.sequents.workers.dev identical. The S1–S8 fixes are uncommitted (HEAD is 8ef6618, 2026-08-01), so none of them is protecting anything yet. - The live D1 was read back: receiver:"d1", 8 real NCRs raised 2026-07-31 → 2026-08-02, each raisedBy:"Environmental Manager" with free-text descriptions and GPS to ~11 decimals (43.6672, −79.3318). That is the data currently readable by anyone who can resolve the hostname. - Both suites are green at 08:44: console npm test 63/63 exit 0; esg-field npx jest 17 suites / 191 tests, all pass — including the new lib/ncr/__tests__/delivery.test.ts. The durability failure noted above was fixed between my 08:20 and 08:44 runs. - My own correction: at 08:20 I attributed that one failing suite to SubmissionsTab's act(...) warnings, reading the tail of the output instead of the FAIL line. Wrong — those are console.error noise from a passing suite. Session 0add9fc1's attribution (durability.test.ts vs widened INSPECTION_EVENT_TYPES) was the right one. - NOT verified, and why: wrangler d1 execute --remote is blocked — the cached OAuth token expired 2026-08-04T23:40Z and refresh is refused (code: 7403, account a10d32c7…fbb0); it needs an interactive wrangler login this session cannot run (see S11). D1 was therefore read through the deployed route at 08:44. RESOLVED 08:55 — the cached token refreshed and the direct read worked, so S11 is cleared and the schema question is answered below. No on-device check. Nothing was deployed, committed or written: the only POST issued was an empty body the route rejects before touching the store. - LIVE D1 SCHEMA READ DIRECTLY 2026-08-05 08:55. esg-ncr-db holds ncrs and nothing else (+ ncrs_received_at, sqlite_autoindex_ncrs_1, _cf_KV). The 13 ncrs columns match the current NCRS_DDL exactly, so no ncrs migration is outstanding. But delivered_inspections DOES NOT EXIST — migrations/0003 is confirmed NOT APPLIED, so the S5 inspection-delivery chain cannot function in production even once the code ships. 0001_event_store / 0002_event_chains tables are absent from this database too. - ESG_DEVICE_TOKENS does not exist anywhere yet. ~/.env is absent; ~/foreman/.env holds 44 keys and none is an ESG device credential. It is a secret to be MINTED, not retrieved. The device half is EXPO_PUBLIC_DEVICE_TOKEN / extra.deviceToken (lib/ncr/submit.ts:98-117), baked into the bundle — it proves the build was issued by this organisation, not who holds the handset. Procedure is already written up in docs/OPS-device-credential.md (session 0add9fc1).
  • [!] S11 · wrangler cannot reach D1 from this machine. Blocker: cached OAuth token in ~/Library/Preferences/.wrangler/config/default.toml expired 2026-08-04T23:40Z, refresh refused (code: 7403, account a10d32c7…fbb0). Needs an interactive wrangler login. Until then D1 can only be inspected through the deployed routes, which cannot show schema — so migrations/0003 cannot be confirmed applied. Observed 2026-08-05 · Claude Opus 5 (Claude Code, session 22f75e25).
  • [x] S0 · Audit written — docs/AUDIT-submissions-2026-08-04.md. 2026-08-04 · Claude Opus 5 (Claude Code) with OpenAI Codex as the independent reader. Raw codex transcript is deliberately NOT in the repo; it is in the session scratchpad (codex-submissions-audit.md, report begins line 15,133).

S · Left over from the session of 2026-08-03 → 08-05

Resuming this? Read HANDOFF-2026-08-05-session-review-and-resume.md first. It records six claims made this session that turned out to be wrong and were corrected, the traps that mislead a fresh agent (Foreman is not ESG; there are two different agentic frameworks; an agent may never amend the constitution), and the commands to verify each claim before acting on it.

Logged by Claude Opus 5 (Claude Code) at Pete's instruction on 2026-08-05: "anything that is not started needs to be logged as a task to complete." Every item below names the repo it belongs to, because they are not all ESG.

Not started — real build work

  • [ ] S-1 · Build the GRC portal — grc-web.sequents.workers.dev/v1. Repo: AutoGRC. Pete asked for this on 2026-08-04 and it was never started. Agreed shape: the same pattern as the ESG /v2 portal — a role launcher, one surface per role, and a document library. The four role copilots are already defined (CRO/CFO, Compliance Officer, Audit Lead, Controls/BCM Admin) and there are four diagrams ready to render. Honest constraint: a documentation-led portal is buildable; an operational GRC console is not, because the five product modules are README placeholders with no implementation behind them.
  • [ ] S-2 · Build the development-platform portal — sdlc-web.sequents.workers.dev/v1. Repo: Foreman. Also asked for on 2026-08-04, never started. Roles come from the Foreman authority hierarchy (Operator → Committee → Board above CAT/CST oversight above the Foreman above CPT→CDT→CRT). The architecture documents 00–08 and the 11 diagrams are the library source. Naming to settle first: this is called sdlc-web in one place and /appdev in another. Pick one word for it.
  • [x] S-3 · Write the BRD, FRD and TSD for the Foreman development platform. DONE 2026-08-04 — this entry was stale and is corrected 2026-08-08 by Claude Opus 5 (session 45b14b6f). All three exist in CognerisDocs/Foreman/, committed 2026-08-04 as "Foreman: BRD / FRD / TSD draft 0.1 for the delivery platform": BRD_Foreman_Autonomous_Software_Delivery_Platform.md (288 lines), FRD_… (488), TSD_… (559). They are draft 0.1 and have had no review pass — do not treat them as approved. A review ticket, not an authoring ticket, is what remains.

Started but unverified — needs a review pass before it is trusted

  • [x] S-4 · Review the proposed governance amendment. DONE 2026-08-05. Codex checked every claimed fix: 11 of 14 hold, 3 do not, and 7 new defects were found. Verdict recorded in section 7.1 of the amendment.
  • [x] S-4a · Fix what the amendment review found. DONE 2026-08-05 — revisions 3 and 4, after a third review. The rule was rebuilt twice and now reads no actor may both judge work and act against a worker. Two of the fixes are admissions rather than repairs: stopping an agent denies it work indefinitely if nobody reviews it (deliberate — a control that fails open is not a control), and giving the control plane the power to suspend is new authority someone must explicitly grant, not something the wording can assume.
  • [ ] S-4b · Decide the amendment. After three reviews it is internally sound, and it is still not in force — it cannot be until a human writes it into the constitution. Three decisions gate everything else: (1) grant the control plane the power to suspend an agent — without this the whole design collapses; (2) set the deadline by which a suspension must be reviewed; (3) approve building the three registries the automatic triggers depend on, since those triggers cannot be switched on before them.
  • [x] S-5 · Review the three sections added to the ESG technical design. DONE 2026-08-05. Codex found 10 defects; all 10 corrected in the document. The notable one: the golden report fixture Test_Aecon.pdf is present and matches its checksum — an earlier claim that it was missing was wrong. What is actually missing is the test runner, so the gate is a library rather than an enforced gate, and neither renderer has been shown to pass it.
  • [ ] S-5a · Wire the golden-gate test runner. packages/esg-golden-gate has the comparison code but no tests, no fixture loader and no CI job, so nothing currently checks a generated report against the pinned original.
  • [~] S-6 · Two more GRC diagrams. Module architecture DONE 2026-08-05 (05_module_architecture.svg). The role/authority model is still to draw.

Decisions only Pete can make — each one blocks work behind it

  • [ ] S-7 · Is CRM, communications and the build ledger part of the shared core, or part of Rivetly? Rivetly holds 24 packages and roughly 19 of them look like platform, not product. Until this is answered the Rivetly code cannot be promoted into the Sequents workspace. This blocks S-9.
  • [ ] S-8 · Which intent engine becomes the shared one? There are three: TypeScript in Rivetly (infra/services/intent), Python in Rivetly (intent-engine/, chromadb + sqlalchemy), and TypeScript in ESG (sequents/intent). Choosing wrong propagates to every product.
  • [ ] S-9 · Move Rivetly into the Sequents workspace. Blocked by S-7. Recommendation on record: promote Rivetly's existing tree and rename packages upward as each is confirmed, rather than porting into a clean scaffold — most of Rivetly is platform, so porting would mean rewriting it. The GoHighLevel bridge packages (ghl, ghl-sync, ghl-oauth) are V1 scaffolding and must be retired, never promoted.
  • [ ] S-10 · Is calendar a core pillar, or part of each product? Scheduling is needed by both Rivetly (booking) and ESG (inspections), and it is currently in neither the core pillar list nor the scaffold.
  • [ ] S-11 · Adopt or reject the governance amendment (see S-4). It proposes four new teams (R&D, penetration testing, security, investigations), an ID scheme so every agent can be tracked, and a rule that the agent that detects a problem is never the one that punishes it. Nothing in it has force until it is written into the constitution by a human.
  • [ ] S-12 · Sixteen open technical decisions already listed in section 12 of the ESG technical design — anchor vendor, report renderer libraries, import depth, anomaly thresholds and others. Not re-listed here.

Tidy-ups found on the way

  • [ ] S-13 · Two Sequents repos exist. Cogneris/sequents is empty (created March); the real workspace is Cogneris/sequents-workspace. Retire or redirect the empty one.
  • [ ] S-14 · app/lib/library.generated.ts is committed and not ignored. 763 KB of build output, regenerated on every build, so it will churn in every diff. public/library/ is already ignored on the same grounds.
  • [ ] S-15 · ~/MyProjects/AscentGRC still points at NeoRivets/AscentGRC, not the current Cogneris/AutoGRC mirror. The four new GRC diagrams were committed to the old remote's clone.

R · Roles and the director portal

  • [x] R1 · Environmental-director persona, remit, access and dashboard — docs/PERSONA-environmental-director.md. For Clarke Gunter, environmental director. Written 2026-08-03 · Claude Opus 5 (Claude Code); revised the same day after Pete corrected the scope twice. - The correction is the point of the document. The first draft was NCR-shaped and delivery-only. The real remit is TWO DIMENSIONS: four field processes (NCR · inspections · investigations · audits) and four project phases (bidding · costing/budgeting/planning · onboarding · managing). Managing is ONE CELL of an eight-cell grid, and it is the only cell built. Do not re-scope this back to NCRs or to delivery-only. - Unify at the closure end, never at the record end. An NCR is the single closure mechanism for all four processes (BR-X6), so the director's queue is one list — but an inspection verdict and an audit grade are different vocabularies with different consequences (BR-AU3–5). - Phases 1–3 are absent, not thin. Canonical Project (packages/esg-projects/src/index.ts:70) is id/name/client/contractRef with no lifecycle state — a project springs into existence already being inspected. app/lib/projects.ts has a phase field but it holds prose ("Corridor · tunnel and surface"), not a state. A grep of app/ apps/ packages/ for bid/tender/budget/costing/procurement/mobilisation/onboarding returns ONE incidental hit. - The register is the spine that makes four phases one project. An obligation identified at bid becomes a budget line, a permit application, an inspection item, then an NCR. Four systems cannot answer "you bid this on the basis of X — did you do X?" - Approvals have NO vocabulary in any layer (FIELD-INTELLIGENCE §3) and that is the director's core primitive. Every authority in §6 is a button anyone can press until it and the role model exist. - Raises open decisions CG-1..CG-8. CG-3 restates BRD OD-5 and is urgent; CG-7 (does Project gain a lifecycle state, or do phases 1–3 live in a separate pre-award aggregate) decides whether a bid can carry through to a live project without re-keying.
  • [x] R3 · Portal proposal — docs/PORTAL-proposal.md. Reviews the LIVE deployed console and both presentation decks, then proposes the portal. Written 2026-08-03 · Claude Opus 5 (Claude Code). - Review the live console at https://esg-web.sequents.workers.dev/. esg.cogneris.com returns 403 (Cloudflare Access) to any tool. The deployed build is AHEAD of main — live nav has 15 entries including Projects / Site maps / Submissions, none of which exist on main. Do not infer what is live by reading main. - The decks already specify the portal and we have not built it. The Value Proposition deck states it outright: "It is not a dashboard-only product. It is where field evidence becomes governed execution" — review · decide · authorize · assign · escalate · verify · learn. All seven are writes. None exists. - The console writes on INGEST and never on GOVERNANCE. POST /api/inspections, /api/ncrs, /api/admin, /api/summarize all work. No governance endpoint exists. - /my-work renders five governance actions as DEAD BUTTONS (app/my-work/page.tsx:151 — styled, hover state, no onClick, no form). Labels are the director's exact authorities. This breaks the app's own rule "every visible control does something" — the console holds itself to a lower standard than the handset. Fixing these five buttons is the cheapest credible step from dashboard to portal. - Two surfaces are better than the decks. app/lib/brief.ts implements the agent's five questions AND adds INTENT (the target drift is measured against), which the deck has no equivalent of. DecisionRecord (app/lib/ledger.ts:15) is the institutional-memory causal chain plus repeatOf — recurrence, which the deck asks for as an escalation trigger. Both are mock; both should be made live rather than redesigned. - CORRECTS the "no bindings" assumption. main's wrangler.jsonc declares a DB D1 binding — it is simply unread there (ncrStore.ts does not exist on main). The working branch adds ncrStore.ts + ESG_NCR_DB + /api/submissions. Real persistence is one merge away, not one project. - Adds decisions PT-1..PT-3 (store for approvals · does the portal stay behind Access or gain its own identity layer · one role-scoped surface or several).
  • [x] R4 · Boardroom + modules — docs/PORTAL-boardroom-and-modules.md. What the environmental director presents upward, and the menus / components / services / modules that follow. Written 2026-08-03 · Claude Opus 5. - The product answers ONE question: "how do you know that's true?" The deck already states the thesis — "evidence is accumulated during work, not manufactured at quarter-end" — and nothing implements it. - Four audiences, ONE derivation, four renderers. Board (are we exposed + does our control system work) · client (contract conformity) · regulator (notified in time, fixed) · management (where to put resource). Never four reports — four cuts of one record, or they disagree. - The board's real block is #3, control effectiveness — a board is not accountable for a spill, it is accountable for whether the organisation would have known. Nobody currently produces this block. - THE SUBTRACTION: 15 menu entries → 3 surfaces + a persistent agent. The Record (what is true) · The Queue (what needs me, and I can act) · The Answer (what we tell them). The agent is an always-present ask bar, NOT a menu item — an advisor you must remember to visit is one nobody visits. Field app / Voice leave the portal nav entirely. - Critical path is S1+S2+S3 — identity, decision service, write store. Unglamorous, and it is the whole difference between dashboard and portal. - Step 2 is the moment it becomes a portal: make the five dead /my-work buttons real. Step 3 (provenance chip — one click from any figure to its evidence) is the demo that wins the room. - The line to hold: we are not making the board pack prettier, we are making it TRUE. Every honesty rule looks like a liability in a demo and is an asset in a boardroom. Do not trade them for a nicer number. - Adds decisions BD-1..BD-4 (commit to the 3-surface collapse? · is the pack generated-on-demand or signed-and-frozen? · who signs it? · do lenders/insurers get their own cut?).
  • [x] R8 · Foreman diagrams moved OUT of the ESG repo. Done 2026-08-03 · Claude Opus 5 (Claude Code), at Pete's instruction. - esgm IS the ESG app. Foreman is the agentic development platform that BUILDS the ESG platform. They are separate products. Pete's correction, verbatim: "i thought this is supposed to ESG app.. which IS NOT the foreman platform. the foreman platform will build the esg platform." - The ESG library had been publishing 11 Foreman-SDLC diagrams among 35 (authority hierarchy, CPT internals, pipeline, platform loop…) because build-library.mjs copies everything under diagrams/SDMS/. Live on the deployed site until this change. - Moved diagrams/SDMS/Foreman-SDLC/*.svg (11) and diagrams/README.md — which was itself the Foreman-SDLC-OS readme, not an ESG one — to /Users/pjones/MyProjects/Foreman/diagrams/. The ESG diagrams readme is diagrams/SDMS/ESG/README.md and was left alone. - Removed the 11 Foreman entries from scripts/library-diagrams.json (35 → 24). Library regenerates as 40 docs · 24 diagrams · 11 pages. - Staged, NOT committed, in both repos. Foreman branch salvage/pete-ascent-foreman-2026-08-03. - Known nit, not fixed: the moved README.md lists its files as svg/01_... but they sit flat in diagrams/. Left as-is rather than silently rewriting a Foreman doc from the ESG side.
  • [x] R7 · Portal information contract — docs/PORTAL-INFORMATION-CONTRACT.md. What the portal WILL and WILL NOT tell each role, with the blocker named for every exclusion. Written 2026-08-03 · Claude Opus 5 (Claude Code) + Codex (codex-cli 0.144.6), jointly. Claude: role model, the 7 surfaces, §0–§3, §5.1–§5.3, §7. Codex: library inventory, build-library.mjs pipeline, data provenance, absence audit (§4.3, §5.4, §6), then an adversarial review of the draft — 18 defects reported, 13 valid and fixed. - The companion to R5, not a replacement. PORTAL-ROLES.md is the authority on who may do what; this is the authority on what each role is shown. Where they disagree: PORTAL-ROLES wins on authority, this wins on content. - D-1/D-2/D-3 — app/lib/roles.ts DIVERGES FROM PORTAL-ROLES.md (§2.1), found during joint review and not yet fixed in code: - D-1 the portal reserves retraction and NCR closure to the director; PORTAL-ROLES §6.5/§4.1 give both to the manager (U5). SoD-1 bars only the raiser, not the manager. The portal is stricter than the model. - D-2 external auditor carries maySign: [] + "write anything at all" under may-not, while the SAME object grants grade-findings, raise-ncr, sign-conformity. Self-contradictory; invisible only because audits are unbuilt. - D-3 client rep is granted raise-query and simultaneously told it may not "write anything at all". A query IS a write — to a different aggregate. - Fix these in app/lib/roles.ts, not in the prose. A grant list and a printed prohibition that disagree produce two different implementations. - Honest limits recorded that the surfaces do not state themselves: the ask bar is NOT role-scoped (every role posts to one /v2/brief hardcoded to roleId="director" — the client rep and external auditor get the director's brief); composeLocal() exists but the route never calls it, so off-script questions return the nearest of five scripted answers; the brief narration carries ungraded hardcoded figures (88%, 4.2, "3 repeat findings") while its footer claims every figure is derived live; /v2/brief charts carry NO BasisTag; the surface bar INDICATES and does not navigate. - One clock, and it is frozen. All four v2 permit callers pass TODAY = 2026-07-18. Only the legacy /permits route advances asOf client-side (app/permits/page.tsx:124) — so /v2 vs /permits is a real date divergence, and inside /v2 there is none. An earlier draft claimed two live clocks in the portal; that was wrong and is corrected. - 4 sign-in roles have a brief and NO surface — U2 environmental monitor, U4 HSE lead, U7 internal auditor, U10 platform administrator. /v2/hse-lead 404s via notFound(). - Agent output was verified, not adopted. 2 of Codex's 18 findings were themselves wrong and were rejected after checking (it claimed nothing advances the permit asOf; it read the manager's own-verification bar as a divergence when SoD-2 makes it correct).
  • [x] R6 · V2 portal BUILT — /v2 launcher + 7 role surfaces. Built 2026-08-03 · Claude Opus 5 (Claude Code). - Routes: /v2 (launcher) · /v2/{board,director,manager,supervisor,auditor,client,inspector}. All 8 render 200, unknown role 404s, tsc --noEmit -p tsconfig.json clean. - New files: app/lib/roles.ts · app/lib/portfolio.ts · app/components/v2.tsx · app/v2/page.tsx · app/v2/[role]/page.tsx · app/v2/views/{board,director,manager,supervisor,auditor,client,inspector}.tsx. - RECONCILED TO R5's docs/PORTAL-ROLES.md, which is the AUTHORITY. The first cut of app/lib/roles.ts invented a flat 6-role enum — exactly the second-enum drift PORTAL-ROLES §3.1 warns against. Corrected mid-build to band × scope × grants over the four bands that already ship (inspector · reviewer · manager · admin, authz.ts:50). Do not re-add a portal-only role enum. - The board is a PARTY, not a user (PORTAL-ROLES §6.11). /v2/board renders band: null, states "holds no session, signs in nowhere", and is framed as the pack the director RELEASES. Do not turn it into a login. - External auditor (U8) and client rep (U9) were split after being wrongly collapsed into one role. The client surface is deliberately mostly empty: "released" is not a state this system has, so it cannot show a released record and refuses to show the live register instead. - RD-1 is surfaced in the UI, not just the doc: the director header states the project-singular claim blocks the role at the claim shape. - NO DEAD BUTTONS. ActionControl is visibly inert (dashed border) and names the service it waits on. This is the deliberate fix for app/my-work/page.tsx:151, which ships five fully-styled governance buttons with no handler. The inertness is the honesty — do not "tidy" these into normal buttons. - Provenance REALLY WORKS — native <details>, no JS, no backend, reading evidence / GPS / transcript / delivery state + ncrHistory() off the ticket. This is the "how do you know that's true?" click, demo-able today, and it is the differentiator from PORTAL-boardroom §7. - BasisTag grades every figure derived / fixture / not-captured. The pre-award phase columns (app/lib/portfolio.ts) are FIXTURES because the domain has no lifecycle state — do not let them read as measurements. - Data constraint found: all 7 tickets are ONE site (Woodbine UTS), there is no critical severity, and actors are role strings ("Site super", "M. Michaud") not people. Views were scoped to that reality rather than inventing rows; the supervisor and inspector surfaces state the person-vs-string mismatch as the S1 argument.
  • [x] R7 · V2 dashboard rebuilt Oura-style, with real analytics. 2026-08-03 · Claude Opus 5 (Claude Code). Pete's direction: "simplistic and intuitive as this [Oura Today screen] … analytics as part of the dashboard." - New: app/lib/analytics.ts · app/components/v2charts.tsx; rewrote app/v2/views/director.tsx. Shape = glance strip → spotlight → why → analytics → queue. tsc clean, next build clean, all 8 v2 routes 200. - A NUMBER, A WORD, AND A SENTENCE on every score. Headline defensibility() = 77 · Fair, derived as the mean of five measured components (Closure 50 · On time 80 · Delivered 86 · Evidence 71 · Second party 100). Coverage is null → renders "no data", never 0 — a zero there would be a lie, not a low score. - A composite is only legitimate if it decomposes. contributors ARE the strip, so headline and strip cannot disagree, and the caveat states the excluded component every time the number is shown. - COLOUR WAS COMPUTED, NOT EYEBALLED (dataviz validator): - green↔red = ΔE 2.9 deutan → FAIL. Net flow is therefore DIVERGING warm/cool --flow-raising #ea580c / --flow-closing #0284c7, which passes every dark-surface check (ΔE 23.4). Do not "brighten" these — brighter values leave the dark lightness band and fail. - the 8 --cat-* colours FAIL the dark lightness band, and concentration /ageing are MAGNITUDE jobs anyway → one hue, not eight. - REFUSED TO DRAW A TREND. Register is 7 tickets over 10 days. flow() shows the real daily window + FLOW_CAVEAT. The old /dashboard TREND is 6 weeks of hardcoded literals — do not port it. - Derived finding now stated on the page: across all 10 days the backlog never once shrank. - Every chart has <title> hover + direct labels + a DataTable fallback. - NOTE — concurrent session built /v2/library (docs · diagrams · demos · md viewer, app/lib/library.generated.ts, app/components/libraryGallery.tsx). That covers Pete's earlier "html viewer that reads md files" ask. Do not duplicate it.
  • [x] R8 · Agent console on top + full-size animated brief analytics. 2026-08-03 · Claude Opus 5. Pete: "at the very top of the page (content) is the chat agent … 5 questions and intent right under the chat text field … each tab of my brief would use the oura type analytics NOT small … use any and all types of animated controls." - New AgentConsole (in app/components/v2.tsx) renders FIRST in content on every v2 surface — hoisted into app/v2/[role]/page.tsx above the role header, and the small AskBar was deleted from all 7 views. - IT IS A REAL FORM, NOT DECORATION. Plain GET → /v2/brief, routed server-side through the existing matchScripted(). No JS. Verified: ?ask=what+is+it+costing → 04 Consequence, ?ask=what+moved → 03 Cause, nonsense → falls back to 01 WITH an honest "did not match a briefed question" notice rather than composing a confident wrong answer. A chat box that looks live and does nothing is the /my-work dead-button failure with a nicer cursor. - Five questions + intent sit directly under the field — drift has no meaning without the declared target. - New app/v2/brief/page.tsx: 5 tabs, each given the whole screen. q1 rings(188/140px) · q2 meters w/ tolerance marker · q3 full-height diverging flow + ageing · q4 exposure figures + what's late · q5 options with forecast bars. - New big kit in v2charts.tsx: BigRing · BigBars · BigNetFlow · BigStat · BigMeter. Director upgraded off the small kit (64 animated elements). - MOTION RULES (in globals.css) — CSS-only, server-rendered, no JS, so it cannot desync from the data. Each animation moves ONE compositor property. Nothing loops or pulses: on a compliance surface continuing motion reads as liveness the data does not have. prefers-reduced-motion lands everything instantly. Do not add looping/pulsing effects. - q4 states exposure, NOT a dollar figure: no rate card, delay model or claim history exists, so a currency number would be invented. - tsc exit 0 · next build clean (89 pages) · all v2 routes 200.
  • [x] R9 · New logo, pinned header, ONE ask box. 2026-08-03/04 · Claude Opus 5. - Logo replaced. public/cogneris-logo-2026.svg (from ~/Downloads/cogneris-logo-01.svg) — waveform + bold wordmark as ONE lockup replacing the separate insignia + wordmark pair, so the two can never drift apart or be spaced differently on two surfaces. Source art is dark-on-light → brightness-0 invert on the dark chrome. Verified by headless-Chrome screenshot, not just by compiling. - Candidates ruled out: NewLogo_cogneris.svg is a letter-size logo SHEET (two lockups on an artboard, 3300×5100) — not a header asset. The deck SVG and cogneris-logo-gradient.svg are different lockups again. - Header pinned (sticky top-0 z-50) and the library tab bar pinned (it genuinely did scroll away). Note the shell was ALREADY structurally pinned — h-screen flex-col + shrink-0 bars + overflow-y-auto main — so sticky is belt-and-braces, not the fix. - EXACTLY ONE ASK BOX EVERYWHERE. Pete: "there should only be a single ChatAskBar." ConsoleShell now computes onV2 and the chrome ChatAskBar stands down on /v2*, where the full AgentConsole (field + five questions + intent) lives in content. - REGRESSION CAUGHT AND FIXED MID-CHANGE: hiding the chrome bar left /v2/library* and /v2 with ZERO ask boxes. AgentConsole was added to the launcher and the library layout. Verified count = 1 on /v2, /v2/director, /v2/brief, /v2/library, /v2/library/diagrams, /v2/board, /dashboard, /compliance. If you add a new /v2 route, it must render AgentConsole or it will have no agent at all. - Count rendered <form action="/v2/brief">, NOT the placeholder string — the string appears ~4× per page in the RSC flight payload. - THE DEPLOYED BUILD WAS STALE, which is why the old logo persisted: deployed HTML still referenced cogneris-wordmark, no sticky, no console. .open-next bundle rebuilt and ready; deploy still blocked on a Cloudflare credential (none on this machine; laptop OAuth expired 2026-03-09). - opennextjs-cloudflare build crashed once (Node OOM in the turbo runtime) and succeeded on a straight re-run — retry before investigating.
  • [x] R10 · DEPLOYED + role/org-chart/flow diagrams. 2026-08-04 · Claude Opus 5. - LIVE at https://esg-web.sequents.workers.dev — version 1df5cfe5-b880-401b-ae73-27527e192bc7. Verified ON THE LIVE SITE: new logo, sticky header, exactly one ask box, 44 animated chart elements, all v2 routes 200. - DEPLOY RECIPE (this works, use it): CLOUDFLARE_ACCOUNT_ID=a10d32c701ce468c46d915c19e0afbb0 npx wrangler deploy The account id is REQUIRED — the login (pjones@cogneris.com) can see TWO accounts, and without pinning it wrangler tries an interactive picker that fails in a non-interactive shell. Run node scripts/build-library.mjs + npx opennextjs-cloudflare build first. - The ESG_NCR_DB → esg-ncr-db binding shipped and that was correct: it is what ncrStore.ts reads (env.ESG_NCR_DB ?? env.DB), and the old DB binding was declared but never read by any deployed code. Nothing lost a DB. - Seven new diagrams via scripts/build-role-diagrams.py: 30_roles_org_chart + 31..36_role_flow_{director,manager,supervisor, inspector,auditor,client}. Source of truth is docs/PORTAL-ROLES.md. - HAND-PLACED GEOMETRY, generator only for consistency — the house rule (memory: esg-diagram-house-style) is hand-authored SVG, never Mermaid. Palette/type scale matched to 03_ncr_lifecycle.svg. - Rendered with rsvg-convert and LOOKED AT before shipping, not just compiled. - Two pipeline gotchas for the next person adding a diagram: 1. scripts/build-library.mjs warns NOT DESCRIBED unless you add an entry to scripts/library-diagrams.json (file/set/group/title/note). 2. A NEW group value must also be added to GROUPS in app/components/libraryGallery.tsx or its filter chip never appears. Added roles → "Roles & flows". 3. Served path is /library/diagrams/ESG/<file>.svg — NOT /library/ESG/.
  • [x] R11 · Laptop (.253) → server (.95) migration COMPLETE AND VERIFIED. 2026-08-04 · Claude Opus 5. - /Users/mac/MyProjects → ~/MyProjects. Verified against rsync's own stats: 112,103 regular files · 19,790 dirs · 8,379 symlinks · 14.5 GB, RSYNC_EXIT=0, zero errors. 39 projects moved whole; 6 overlapping ones merged with --ignore-existing (13,414 files added, none overwritten). - DECISION: the LOCAL (.95) copy wins on all 616 differing files. No further merge. Newest-wins would have been WRONG. Evidence — git lineage, not mtime: - CognerisDocs: laptop HEAD 58b6a79 IS the common ancestor; .95 is 4 commits ahead, laptop 0 ahead. - Foreman: laptop HEAD 86a9287 is the ancestor; .95 2 ahead, laptop 0. - AscentAutoGovernance: identical HEAD 9c0ca72; diffs are working-tree/untracked noise. - AscentGRC: staged copy is not a git repo at all; only .DS_Store + README.md differ. MyDemos: only .DS_Store. - ANSWER TO "did it reinvent functionality working in parallel?" — NO. Zero commits are unique to the laptop on any repo. There is no fork, so nothing was re-implemented and nothing unique exists there to lose. - WHY mtime WOULD HAVE MISLED: rsync -a preserves mtimes and .git plumbing writes (COMMIT_EDITMSG, FETCH_HEAD) make laptop files look recent while being older content. 513 of CognerisDocs' "differences" are largely .git/ internals. Use git lineage, never mtime, to decide. - TRANSFER GOTCHAS (cost two failed runs): 1. Laptop SLEEPS mid-transfer → ssh mac@... 'nohup caffeinate -dimsu -t N &' first. WoL packet to ba:1e:7d:ee:c0:6f wakes it. 2. Laptop /usr/bin/rsync is openrsync (protocol 29) and rejects --info=, dying with a usage dump before one byte. Pin --rsync-path=/opt/homebrew/bin/rsync (3.4.4 both ends). 3. Do not pipe rsync into tail/tee — the shell returns the LAST command's status, so failures report as exit 0. End with exit $ec. - NOT migrated (out of the original scope): ~/Desktop/CognerisDocs-IP_BACKUP/ (a git repo), plus ~/DevCache, ~/SynologyDrive, ~/nasmount, ~/Google Drive, ~/Documents — unexamined. - ~/MyProjects-from-laptop/ retained as the undo until Pete says otherwise.

S · Estate: secrets, repos and the Cogneris sites

  • [x] S1 · Real .env files relocated out of every repo. 2026-08-04 · Opus 5. scripts/relocate-env.sh (idempotent, DRY_RUN=1 supported). - Layout: real values in ~/.Projects/<same path>/.env (store 700, files 600), a symlink back into the repo so tooling is unchanged, and a committed .env.example with the SAME KEYS and no values. - 6 files / 17 secret values moved. ~/foreman/.env left alone — it is the runner's own environment, not a project's. - VERIFIED FIRST: no real .env was EVER tracked by git. This was prevention, not cleanup. Nothing needs history rewriting.
  • [x] S2 · Cold storage (RP-4). old_AscentGRC (269M → 209M), _salvage, archived_projects → ~/ColdStorage/*-2026-08-04.tar.gz, removed from ~/MyProjects (49 entries now).
  • [x] S3 · NINE Cogneris audience sites DEPLOYED + an index portal. https://cogneris-sites.sequents.workers.dev ← the portal. - Live: cogneris-{institutional,investors,investors-advisors,partners, compass,access,portal-shell,console-shell} + sequents-investor-demo, all *.sequents.workers.dev, all verified 200 with real titles. - TEN were asked for; the tenth is not a website. informational_website has NO index.html — it is content specifications + a proposal PDF. It belongs with the documents. Do not try to deploy it. - TWO GOTCHAS THAT COST A FULL FAILED ROUND: 1. Every dist/ ships a Pages-style _redirects containing /* /index.html 200. Cloudflare Workers Assets REJECTS it — "Infinite loop detected in this rule". Workers does SPA fallback natively: drop the file and set assets.not_found_handling: "single-page-application". 2. Deploy from a STAGED COPY (Cogneris_Sites/deploy/<name>/public/, rsync'd excluding _redirects _headers _worker.js _routes.json) so the 2026-07-15 archive stays byte-for-byte unmodified. - Largest asset is 6.4 MB (an .mp4), well under the 25 MiB per-file cap. - One deploy hit a transient "malformed response from the API"; a straight retry worked. Retry before investigating. - The portal states each site's AUDIENCE, not just its name, and carries a prominent notice that these are ARCHIVED 2026-07-15 iterations — the archive README records that nobody could confirm which variant was actually live on cogneris.com, because it sat behind Access.
  • [x] S4 · Repos DONE — 21 initialised + pushed, all PRIVATE under Cogneris. 2026-08-05 · Opus 5. scripts/init-repos.sh (idempotent, DRY_RUN=1). - 21/21 committed and pushed clean (ahead=0). Class C finished too: fryandfledge got its first-ever commit (the repo had 0 commits); Cogneris_Sites and rivetly-api were already pushed by Pete. - SECRET AUDIT: ZERO secret-shaped files tracked in ANY Cogneris repo. - The script REFUSES rather than warns — gate 1 rejects a staged .env/.pem/id_rsa/credentials.json; gate 2 rejects any file over GitHub's 100 MB hard limit. Keep both if you extend it. - It never overwrites an existing .gitignore. ghl-knowledge-mcp kept its own (excludes regenerable search artifacts), which is why it went 7,194 files → 38. That is correct, not data loss. - Chatham-Kent had TWO PDFs over 100 MB (107 MB + 112 MB municipal budgets in CK-Docs/raw/). GitHub hard-rejects those. CK-Docs/raw/ is gitignored — it is a re-downloadable public corpus, and the files remain on disk. Revisit if that corpus must be versioned (needs LFS). - ⚠ PrivateClaudeCode/claude-code is a GITLINK, not content. It is a nested clone of github.com/tanbiralam/claude-code.git committed as mode 160000 with NO .gitmodules, so a fresh clone gets an EMPTY directory and submodule update will not fix it. Either register it properly as a submodule or drop the gitlink and note the upstream. Not resolved. - Naming: Sequents → Cogneris/sequents-workspace, because Cogneris/sequents already exists and is a different thing.
  • [x] S6 · Class B DONE — 10 of 11 committed and pushed. 2026-08-05 · Opus 5. esgm itself included: this session's work landed as 5 grouped commits (v2 portal · diagrams+scripts · docs · console/field remainder · stage-of-work), not one lump. dirty=0, unpushed=0. - [!] Rivetly is the ONE not committed. Its commit-msg hook REQUIRES a Jira Issue ID (RIVT-nnn / SEQT-n) and I will not invent one — a wrong ID pollutes traceability in a repo that enforces it deliberately. 4 files wait: 3 build-ledger/mobile edits + the .env.example the relocation created. Pete must supply the ticket ID. - FOUR remote/push traps, all real, all now fixed: 1. Foreman's remote is named github, not origin. 2. Brilliantz__web_v2 pointed at SSH alias github-cogneris which does not resolve here, and at incogneris/brilliantz which is not accessible. Correct repo is Cogneris/brilliantz, pushed over HTTPS to branch app-review-improvements. Its main shares NO ancestor with local — compare against the SAME-NAMED branch, never main. 3. CognerisDocs upstream pointed at a laptop remote (ssh to .253), so it looked 15 commits ahead while being in sync with origin. Repointed to origin/main. Any $(git remote | head -1) check is unreliable here. 4. SideHustles was 8 behind — rebase before push. - TWO 3-GIGABYTE-CLASS TRAPS: - TurboCivics/management-console is an embedded clone of TurboCivics ITSELF (3.1 GB, same upstream) that git add -A staged as a gitlink. Removed from the index and ignored. Its pack is already 1.44 GB. - TurboCivics carries the same CK-Docs/raw/ corpus as Chatham-Kent, with the same two >100 MB budget PDFs. Ignored in both. - CORRECTION to an earlier claim: the TSD EXISTS. It is CognerisDocs/ESG/TSD_ESG_Environmental_Compliance_Inspection_Platform.md — a different repo, which is why the esgm-only search missed it. The packages that cite TSD 2.1 etc. are NOT citing a phantom.
  • [x] S5 · Plans written — docs/PLAN-repos-and-sites.md and docs/PLAN-secrets-secauth-sovereignty.md. - THE CONTRADICTION TO RESOLVE (SEC-4/SEC-5): the estate deploys to Cloudflare, a US company. Under the CLOUD Act a US provider can be compelled regardless of where bytes sit, so "data sovereignty from the US" is not achievable by picking an EU/CA region. Recommended answer is zero-knowledge (host holds only ciphertext, keys with the subject via VEP pods) + localisation for regulatory alignment. Accept the consequence early: no server-side analytics over sovereign data. - SecAuth should be built on VEP, which already specifies keys-as-identity, signed events and portable pods. A second identity model repeats the exact failure PORTAL-ROLES.md warns about. - SMS is fine for notification and WRONG for authentication (SS7, SIM-swap, US-routed aggregators, NIST-deprecated). Passkeys are the factor. - Recovery must be decided BEFORE enrolment ships — if the platform can recover a key it can impersonate the user, and the sovereignty claim fails.

  • [~] R2 · Approval vocabulary + role and access model. The role and access model is now specified — docs/PORTAL-ROLES.md (R4 below), written 2026-08-03 · Claude Opus 5 (Claude Code). Nothing is implemented. The remaining blockers, named: - The approval vocabulary itself (PORTAL-proposal P3) is still unwritten — approve/reject-with-a-reason as an appended decision event. - RD-1 — the signed session claim carries project singular (workers/esg-query/src/authz.ts:23), so the environmental director cannot be expressed at all. Widen to projects: string[] while the pilot is one project and the migration is trivial. - RD-2 / PT-2 — Cloudflare Access as front door vs the portal minting its own session. Decides whether external auditors and client reps can exist. - The store decision (E11 / CONSOLE-IA §6) — a sign-off is a write, and the deployed host has no bindings. Build order in R1 §8 puts this at step 2, not in a later hardening pass.
  • [x] R5 · Portal users, roles and role requirements — docs/PORTAL-ROLES.md. Written 2026-08-03 · Claude Opus 5 (Claude Code). The specification half of R2. 16 actors — 10 roles that sign in, 4 parties, 2 non-human — 4 bands, 10 separation-of-duty rules, 18 FR-ROLE requirements, 8 open decisions (RD-1..RD-8). - Keep the enum that already ships. inspector · reviewer · manager · admin is a closed enum enforced on the read plane (workers/esg-query/src/authz.ts:50, :325, :346). The portal invents no second enum — everything is expressible as band × scope × grants plus party attributes (organisation, employmentRelation, engagementWindow). A second enum guarantees the read and write planes disagree about who someone is. - admin is not the top of the ladder — it is a different ladder. It holds platform authority and no compliance signature (SoD-5). The most privileged compliance role is manager. - A role is not a job title, and a title is not an identity. The console stores assignee: "Site super" / "HSE lead" (titles, app/lib/ncr.ts:211) but signedBy: "D. Osei · Environmental Manager" (a person, app/lib/ledger.ts:55). BR-CA4 overdue-against-an-owner and BR-CA7 self-verification disclosure are both impossible while an assignee is a title. - Every actor in the field app is the literal string "device" (apps/esg-field/screens/inspect/TaskFlow.tsx:262, and app/api/ncrs/route.ts:90 defaults the same way). Replacing it is step 1 of everything; nothing else in the document is testable first. - PT-3 is answered (RD-8): ONE portal surface with role-scoped views, not separate director / manager / inspector portals. - Cheapest place roles become real: the five dead governance buttons at app/my-work/page.tsx:151 — right verbs, right rows, no onClick. - SCOPE CORRECTION — Pete, 2026-08-03, applied the same day. All current activity is OPERATIONAL: environmental review, inspection, NCR, incident and investigation, audit. No planning, no costing, no bidding. The doc's §4.1 now lists operational sign-offs only (inspection report · not-reached acceptance · NCR closure · self-verified countersignature · retraction · investigation conclusion · notifiable escalation · audit conclusion · external release), and the three pre-operational gates (bid · budget · mobilisation) are parked and granted to nobody. Do not re-derive them into a role. R1's four-phase remit stands as a persona statement; it is not the scope of the role model. - R1 was updated to agree literally (Pete, same day): PERSONA-...md gains a §0 scope note that does NOT retract §2 — the remit is still four phases, the scope of work is phase 4. §4's phases 1–3 and the first four rows of §6's authority table are marked PARKED, build-order steps 4 and 7 are struck, CG-6/7/8 are marked not-urgent, and CG-9 is added: widen the session claim to projects: string[] — the one live blocker on the persona.
  • [x] R6 · Per-role portal briefs — docs/roles/ (12 files). Written 2026-08-03 · Claude Opus 5 (Claude Code). One markdown per role: who they are, why they open the portal (trigger → question → what good looks like), the screens, and a numbered F-<ROLE>-n feature table with an honest ✅/⚠️/❌ per feature, then what they are denied and what "done" means. - Written to be handed to a builder. Every ⚠️ is the same missing thing — an appended decision event naming a person and the grounds — and every feature cites the derivation that already exists (ncrsNeedingManager(), selfVerified(), ncrClosureQuality(), ncrHistory(), isOverdue()). - The field inspector barely uses the portal, and the file says so. Four narrow reasons, all receipts. An inspector being asked to work in the portal has the wrong tool. - Denials are load-bearing, not garnish. Inspector is excluded from OVERSIGHT scores by design; supervisor gets a queue and not a console; auditor raises and never closes; admin signs nothing. - Ten files, sixteen actors. Only the ten roles that sign in get a feature file; the 4 parties + Rita + the device share parties-and-non-human-actors.md (F-PTY-1..18) because they impose requirements without ever opening the portal. An identity in the record is not a login — requiring one is how the system ended up recording "device". - Rita is PER PERSON (Pete, 2026-08-03): not one system agent but one instance per user, so every role file carries a "Their Rita" section. The model consequence is PORTAL-ROLES §3.4 + FR-ROLE-19/20: an instance inherits its principal's scope and none of its grants, and memory is per-identity — app/lib/conversations.ts is currently ONE SHARED HISTORY, which would leak an unreleased finding to a client rep's agent. Do not build her with a service token. - Agents research, collaborate and ask permission (Pete, 2026-08-03): instances interrogate the institutional memory, liaise with colleague agents, and work unbidden — docs/roles/agent-collaboration.md (F-AGT-1..23, FR-ROLE-21..25). The one rule: an agent-to-agent answer may contain only what the REQUESTING PRINCIPAL could have read themselves; anything more is a disclosure the responding agent's human sponsor approves, as a release decision naming the sponsor. Corollaries that are easy to get wrong and expensive to fix: transitive requests are evaluated against the ORIGINAL requester (else scope launders through a chain), silence is refusal (no timeout ever grants), external principals' agents may not initiate liaison inward, and cross-agent information is hearsay — never a record or a reported figure. workers/esg-memory ALREADY implements the hardest part (scope derived from verified claims, never the request body). - Operational scope only — no bid, budget or mobilisation feature anywhere in the folder.

  • [x] R7 · HTML overview viewer — esg-overview.html (repo root). Written 2026-08-03 · Claude Opus 5 (Claude Code). Single self-contained page — no external CSS, JS, fonts or CDN — in the diagrams' dark house style (#0e1524, ink #c9d4e6, green/amber/red status). - Nine sections: industry · the four processes · the four platform components · requirement families · roles & agents · diagram gallery (all 35 SVGs, filterable + lightbox) · demos & decks · document index · "what is real". - It uses the diagrams' own colour law — green built · amber exists but does not meet its rule · red absent. Nothing is coloured by intent, so the page cannot flatter the build. - Paths are relative from the repo root; every src/href was verified to resolve and every SVG on disk is listed (0 missed, 0 broken). - Open it with open esg-overview.html. If it is ever moved out of the root, every diagram and doc link must be re-based.
  • [x] R8 · The library, hosted in the console — /v2/library. Written 2026-08-03 · Claude Opus 5 (Claude Code). Pete: "i want this site to be a definitive site for all documentation and demos." - Routes: /v2/library (overview) · /docs + /docs/[slug] (39 documents, rendered) · /diagrams (35 SVGs, filter + lightbox) · /demos (11 decks and mocks, each labelled current/superseded/reference) · /view/[page] (iframe viewer that keeps the console chrome). All prerendered — next build emits 39 doc pages and 11 viewer pages. - THE WORKER HAS NO FILESYSTEM. Nothing is read from disk at request time. scripts/build-library.mjs converts docs/*.md to HTML at BUILD time into app/lib/library.generated.ts, and COPIES diagrams + standalone HTML into public/library/ (gitignored — the originals are the source of truth). It runs first in dev, build, cf:build, cf:deploy, so it cannot go stale. pnpm library runs it alone. - No markdown dependency was added. The converter in the script handles exactly what these documents use (tables, lists, code, quotes, rules). - Source citations are deliberately NOT links. app/lib/ncr.ts#L211 becomes <code>app/lib/ncr.ts:211</code> — the site cannot open a repo file, and a link that 404s is worse than a citation that reads as one. Doc-to-doc links ARE rewritten to library routes (17 verified 200). - The gallery cannot silently drop a diagram: the script warns when an SVG on disk has no entry in scripts/library-diagrams.json, or an entry has no file. Currently 35/35 described, 0 ghosts. - Verified: tsc --noEmit clean, next build green, every route and every asset 200 (including the 9.1 MB value-proposition deck). - esg-overview.html at the repo root still exists as the standalone single-file version, and is served in the library as "Overview — standalone file" for sending to someone.

P · Presentation (docs/deck/)

  • [x] P1 · Introduction deck — docs/deck/introducing-esg.html. 17 slides, self-contained (diagrams inlined, no external assets), for a client / prospect exec audience and written fully candid: it carries the built / partial / absent colour convention through to a scorecard slide, and states plainly that no process completes end to end because captured work does not yet reach the office. Arrow keys / click to navigate; @media print renders one 1600×900 page per slide. Content is drawn from BRD-field-processes.md (§2 as-is, §3 objectives), ARCHITECTURE-and-process-models.md and FIELD-INTELLIGENCE-app-rita-and-processes.md. Nine diagrams are inlined from diagrams/SDMS/ESG/. Done 2026-08-02 · Claude Opus 5 (Claude Code). - The sample project is the ONTARIO LINE (diagram 15), and the site walked in it is ONxpress CJV · Woodbine (UTS) — which is what diagram 15 itself says the register holds. An earlier pass rewrote that site name to an Ontario Line station and was reverted: it would have put a real place in front of a client that this program does not inspect. Do not re-apply it. Diagram text is inlined verbatim, so the deck and the diagram set cannot disagree. - The HTML is GENERATED. Edit docs/deck/build_deck.py and re-run it; editing the HTML directly loses the change on the next build. - Inlined SVG ids are namespaced per slide (d1_, d2_, …) because several diagrams share marker ids (a, ag); in one document the first definition would otherwise win for every url(#a) reference and the arrowheads would take the wrong colour. - introducing-esg.pdf is a Chrome --print-to-pdf export of the same file, committed for people who will not open HTML. It is a snapshot — re-export it whenever the deck changes (command in the builder docstring), or it will quietly disagree with the HTML.
  • [x] P3 · Markdown deck source — docs/deck/introducing-esg.md. The same 17 slides as the HTML deck, one ## heading per slide, diagrams as relative image links into diagrams/SDMS/ESG/. Renders in git and in any markdown-to-slides tool. All 9 image paths and every cross-link verified to resolve. Done 2026-08-02 · Claude Opus 5 (Claude Code). - It is a PARALLEL COPY, not generated from build_deck.py. The HTML deck is built from Python; this file is maintained by hand. Editing one without the other is how the two start disagreeing about what the platform does — a warning to that effect is at the top of the markdown. If they drift more than once, fold both outputs into the builder.
  • [x] P4 · As-is / to-be deck — docs/deck/today-vs-proposed.html. 14 slides, self-contained, for a client / prospect exec audience. Two acts: how the weekly environmental inspection is done today on paper (written at the truck, one observation in five places, four processes on one form, the year-later question), and what we propose (capture · confirm · send · know it arrived). Slide 12 is the failure-by-failure comparison; slide 13 states plainly what is running, what is built-but-unproven, and what is absent. Done 2026-08-02 · Claude Opus 5 (Claude Code) with Codex (OpenAI, codex-cli 0.144.6): Codex drafted the slide narrative and then reviewed the built deck; structure, house style and build by Claude Code. - It inlines NO diagram from diagrams/SDMS/ESG/, deliberately. Codex's review caught it: that set is authored for an engineering audience and carries requirement codes (BR-AU5), module paths (deliverSoon(log), cloudWhisper.ts), an internal defect report quoted from a handset, and — in 22_frontier_model_boundary — an unresolved live exposure stating that raw field transcripts leave verbatim with nothing anonymising or logging it. Correct in front of our own engineers, wrong in front of a prospect. Every visual is composed from the deck's own CSS instead. Do not "restore the diagrams" without re-reading their text first. - The HTML is GENERATED by build_today_vs_proposed.py. Editing the HTML loses the change on the next build. today-vs-proposed.pdf is a Chrome --print-to-pdf snapshot (command in the builder docstring) — re-export it whenever the deck changes. - today-vs-proposed.md is a PARALLEL COPY, not generated, on the same terms as P3: change one and you must change the other. - Revised 2026-08-02 (same day), second pass · Claude Opus 5 (Claude Code) with Codex. Now 15 slides in three parts, light theme, and no em or en dashes anywhere. Changes: (a) a Steve Jobs style review by Codex rewrote every slide title from the system's point of view to the person's, e.g. "Delivery state reporting" became "The inspector always knows whether the office received it"; (b) section title slides open each part; (c) the deck now opens and closes on spoken words (the 7:10 / 4:40 story), and the "one observation, five places" slide was cut as Jobs recommended; (d) three sentences of specification language were deleted outright. Jobs's full review said cut to three slides and demo the rest. That was not applied, because a sectioned deck was asked for and because the side-by-side comparison is the requested deliverable. The unapplied advice is worth reading before the next revision: scratchpad/collab/jobs-review.md was session-local, so the substance is recorded here instead: the three load-bearing slides are 3 (the 7:10 / 4:40 gap), 7 (record it while standing there) and 15 (the ask). Everything else is supporting material, and a live demo would outperform slides 8 to 11. - The em / en dash ban is enforced, not trusted. build_today_vs_proposed.py refuses to write the HTML if it finds either character. The only two of each left in the repo are the guard's own literals in that check. - Revised 2026-08-02 (same day), third pass: presentation layer only · Claude Opus 5 (Claude Code). NOT ONE WORD OF SLIDE PROSE CHANGED. Every edit is in CSS, JS and the page template of the builder; the SLIDES list was not touched, which is why the prose is safe by construction rather than by diffing. Five changes, now house rules 4 to 8 in the builder docstring: (a) Staggered reveals. JS numbers each revealable element in reading order and CSS turns that index into a delay; slides arrive from the direction of travel. The opacity:0 base is gated behind html.js, so a browser with scripting off still shows every word, and prefers-reduced-motion disables the lot. (b) Title and section slides now share one background, a single .slide.title,.slide.section rule. They were white and grey before. (c) Both themes are first class. Light still opens (house rule 2), the footer button or the t key flips it, and the choice survives a reload. Dark is a complete palette, not a filter. (d) Cogneris branding, built in rather than linked: the wordmark is an inlined SVG symbol using currentColor so it inverts with the theme, the insignia is ONE base64 data URI in a CSS custom property, and both are read from public/ at BUILD time. Full lockup on the title and section slides, a quiet corner mark on the fifteen content slides, and a mark in the footer. Nothing references public/ at runtime, so the file still survives being emailed on its own. (e) Type scales with the display. Pete: "the font is too small to read". Root size is now clamp(15px, min(1.3vw, 2.25vh), 32px) and every size below it is in rem, so body copy goes from a fixed 16.5px to about 21px on a 1600x900 window and keeps growing on a larger one. Using min(vw,vh) rather than vw is what stops a short window overflowing. Verified by screenshot on the four densest slides (5, 9, 10, 13) in both themes: no overflow, and the deck still exports as exactly 15 PDF pages. The HTML grew from 25 KB to 68 KB, all of it the insignia data URI. - Revised 2026-08-02 (same day), fourth pass: two notes from Pete · Claude Opus 5 (Claude Code). Again NO slide prose touched. (a) The watermark insignia is off the act break slides, and stays on the two title bookends only. An act break is read in two seconds on the way past and a watermark behind three words is noise. This is the one agreed exception to house rule 5 and is commented as such in the CSS, so a later pass does not "restore" it for consistency. (b) Content is now stepped, not auto revealed (house rule 7, rewritten). The act label, heading and standfirst still arrive with the slide; every box, list item, table row and closing line waits for the space bar, one press per beat. Counts: 5 fragments on the four step slides, 12 on the two lists, 8 on the comparison table, 6 on the five delivery states, 0 on the title and act break slides so space runs straight through them. The footer counter shows 4 / 15 · 2/12, which is what tells a presenter mid slide how many beats are left. The down arrow skips the fragments and jumps a whole slide, for when a question sends you forwards. Going BACKWARDS hands a slide back finished rather than replaying it. Print and PDF force every fragment visible, so the exported deck is unaffected: still exactly 15 pages. - Revised 2026-08-02 (same day), fifth pass: three notes plus a new brand asset · Claude Opus 5 (Claude Code). No slide prose touched. (a) Contrast. Pete could not see the boxes on the closure slide. The cause was real and palette wide, not one slide: --panel (#f5f8fc) sat almost on top of --bg (#ffffff), and .step, .state and .lane drew their border from --edge2, the faintest line in the palette, while only .card used --edge. Fixed at the token level in BOTH themes and every box now takes --edge. Do not reintroduce --edge2 as a box border; it is for internal dividers and table rules. (b) The watermark insignia is gone everywhere, bookends included. At any opacity that made it visible it competed with the headline, and at any opacity that did not it was noise in the export. (c) Title and act break slides lost the blue wash and now use plain --bg like every other slide (house rule 5, rewritten). Mid deck the tint read as a different paper stock. (d) NEW BRAND ASSET, supplied by Pete as cogneris-logo-01.svg and copied into the repo as public/cogneris-logo.svg so the build stays reproducible. It is the WHOLE lockup, waveform mark plus a mixed case "Cogneris" wordmark, in ONE FLAT COLOUR (#231f20), which replaces BOTH previous assets: cogneris-insignia.png and the all caps cogneris-wordmark.svg. Because it is single colour it inlines as one <symbol fill="currentColor"> and needs no dark variant at all. Its <defs><style>.cls-1{...}</style></defs> MUST be stripped on inlining, because an inline <svg> puts that rule in the HOST document stylesheet and it would both leak .cls-1 into the deck and defeat currentColor. The builder asserts the stripped markup carries no hard coded colour. Losing the PNG data URI took the HTML from 71 KB to 39 KB. The console app still uses the two OLD assets (app/components/ConsoleShell.tsx); they were left alone deliberately, so the repo now carries both the old and new marks on purpose. (e) The corner mark on content slides is gone, on Pete's note. The footer already carries the brand on every slide, so a top right lockup was branding the same slide twice and competing with the heading. The lockup now appears on the title and act break slides and in the footer, and nowhere else (house rule 6, amended). - Revised 2026-08-02 (same day), sixth pass: ONE PRESS IS ONE BEAT · Claude Opus 5 (Claude Code). No slide prose touched. New house rule 10. The fifth pass made every box, line and row its own press, which Pete found made him tap a clicker through a list while talking. A BEAT is now a GROUP of fragments that plays itself, staggered at 90ms, off a single press. Verified live beat map, dumped from the built page rather than assumed: 3:[1,1,1,2] 4:[6,6] 5:[5] 7:[1,1,1,2] 8:[6] 9:[5] 10:[6] 11:[4] 13:[8,8] 14:[4], which is Pete's request slide for slide. - The grouping is DERIVED, never hard coded to slide numbers. Four rules in beatsOf(): comparison table one beat per column; four step slides a beat per step with the closing line riding the last one; cards with lists a beat per card plus its own lines; everything else one beat for the slide. Index or slide number tables were rejected because they shift silently the moment a line of prose is edited and nothing fails. Re-dump the beat map after any content change; the rule is in the docstring with the expected output beside it. - The comparison slide is the one place a fragment is a CELL, not a row, ordered all the way down column one then column two. It argues in columns, eight failures then eight answers, and revealing it row by row made the room flick left and right sixteen times across an argument that has two halves. This is fragmentsOf(), separate from beatsOf(). - Print and PDF still force every fragment visible: 15 pages, unchanged. - Light is the default theme, with a dark toggle in the footer, because the rest of the diagram set is dark. The PDF exports in whichever theme is active, and a headless Chrome export gets light. - Slide 13 inherits P2's re-verification requirement. It repeats that voice has never completed a transcription on a device, that captured work does not reach the office, and that audit is unbuilt — all true on 2026-07-30, none re-checked on 2026-08-02. It also now states the no-model-in-the-compliance- path check does not run on every build, which follows the FR-SEC guard-script finding (no CI job wires them into the fence). Re-check before presenting.
  • [ ] P2 · The deck asserts two things nobody has re-verified today. It repeats "eleven of the twelve backend services are unpublished" and the Cloudflare Access blocker from the 2026-07-29 assessment, and it says voice capture has never completed a transcription on a device. All three were true on 2026-07-30. Re-check before presenting; the candid framing is only worth anything if the facts are current.

E · ESG web console (app/)

  • [x] E1 · One field app in the sidebar. SURFACES listed /demoapp twice — "Field app · On-site phone capture" and "Field App · Mobile · scripted demo" — so the nav claimed two surfaces over one route and isActive lit both rows at once. One entry now, phone icon, so it reads distinctly from /vui. Done 2026-07-30 · Claude Opus 5 (Claude Code).
  • [x] E2 · NCR submissions on /compliance. The console had no NCR concept at all: the field app raises tickets (apps/esg-field/lib/ncr) and the manager had nowhere to see one. Added app/lib/ncr.ts (the ticket shape, folded status, overdue/self-verified/awaiting-action derivations) and an "NCR submissions" section with its own register and case detail — lifecycle stepper, evidence as captured, folded history, traces-to. Status is DERIVED here exactly as on the device, never stored. Done 2026-07-30 · Claude Opus 5 (Claude Code).
  • [ ] E3 · The NCR rows are console-side mock data — NOT the field app's tickets. app/lib/ncr.ts invents seven illustrative submissions for the ONxpress scenario. Nothing carries a real NcrRaised from a device into the console: /api/inspections takes inspections, not NCR tickets, and no projection reads the NCR aggregate. Do not claim this surface shows live field submissions until that path exists.
  • [x] E4 · NCRs wired through the other surfaces. Every figure is DERIVED from NCR_SUBMISSIONS, never restated, so no surface can disagree with the register. Done 2026-07-30 · Claude Opus 5 (Claude Code). - My Work — ncrWorkItems() folds tickets into the same needs-you / waiting-on / closed queue, with an "NCR ticket" tag linking to the register. A LOW non-conformance maps to "At risk", never "Confirmed": no open ticket is a green row. - Live Brief — a fifth standing tile (NCR tickets open), two new "what moved" lines, a scripted "NCR submissions" answer, and an on-device branch so free text mentioning a ticket, an id or an area is answered from the tickets rather than the register. New ncrs widget in dashboard-widgets.tsx — kept separate from the obligations widget so the brief cannot imply an obligation where there is a ticket. - Reporting — an NCR roll-up card: raised / live / overdue / awaiting signature, tickets by area, and closures split by REASON (corrected & verified vs retracted vs superseded) plus repeat-work and self-verified counts, because a close rate that hides those flatters the program. - Field-app surface (/demoapp) picks the tickets up through the same NEEDS_ME / WAITING lists.
  • [ ] E5 · One thing the NCR roll-up cannot show yet: trend. TREND and CATEGORY_MIX in mock.ts are obligation-era series with no NCR dimension, so "new vs closed" on /dashboard still counts findings only. Needs a dated ticket series before it can claim otherwise.
  • [x] E6 · The site map is the console home page. / redirected to /brief; it now renders a plan of a place. "What is going on at this site" is a spatial question long before it is a tabular one — a register says four open NCRs, a plan says three of them are in the service yard. New app/lib/sitePlans.ts (LOCATION / ASSET / the join, plus two hand-drawn plans: a shopping centre and the Woodbine rail site) and app/components/siteMap.tsx (zones, assets, pins; click a zone for its history, an asset for its own; start an inspection and click the plan to plot findings, incidents and NCRs). Pure client data, so it works on the deployed host, which has no DB bindings. Done 2026-07-30 · Claude Opus 5 (Claude Code). - The file is sitePlans.ts and NOT sitemap.ts: every directory under app/ is a route segment, so app/lib/sitemap.ts is read as the sitemap.xml metadata convention and the build fails on a missing default export. Do not rename it back.
  • [x] E9 · Three real projects, seeded on BOTH sides. Eglinton Crosstown (Line 5), the Ontario Line and Lakeshore Centre now exist as projects with locations, assets and plotted history. Console: app/lib/sitePlans.ts holds the plans (the two corridors are FOLDED into a west rank and an east rank, in chainage order, because ten segments across one screen leaves 140px a label — the plan says it is folded and that position is order, not scale). Device: apps/esg-field/data/sites.ts holds the same locations and assets under the SAME ids, minus geometry it cannot draw. Both project registries and the device work queue are seeded to match. Zone content is taken from diagrams 14 and 15, so the map and the diagrams agree. Done 2026-07-31 · Claude Opus 5 (Claude Code).
  • [x] E10 · Projects listing and detail. The console had no answer to "which sites are we running, and how is each doing" — every other surface is a lens on one slice. /projects lists the portfolio and states which projects have a plan behind them and which do not; /projects/[id] is one site in the order someone asks for it: status, the plan live and interactive (the map locked to that project, switcher hidden), the activity feed, then the location and asset registers with per-row record counts. A project with no plan renders an honest empty state, not a blank frame — a blank plan reads as "a site with nothing on it", which is a different claim. Done 2026-07-31 · Claude Opus 5 (Claude Code). - params is a Promise in Next 16 and must be awaited; all six detail pages pre-render via generateStaticParams.
  • [!] E11 · None of the console work is on esg.cogneris.com. BLOCKED ON A DECISION, not on code. That hostname serves main; origin/main still has app/page.tsx redirecting to /brief and has no siteMap/sitePlans at all. feat/rn-app-parity is 91 commits ahead. There is also NO deploy automation — .github/workflows/ has ci, golden-fixture and security-guards, none of which deploy, and package.json has no deploy script. Deployment is a manual opennextjs-cloudflare build + wrangler deploy against the single esg-web worker, which is production. Someone must choose: merge the branch, or cut a console-only PR to main. - CORRECTION, 2026-07-31 (session 141a2db4): this is now PARTLY STALE and was quoted as current in conversation before being checked. PR #10 ("console: Submissions inbox, site maps, and a store that works on Cloudflare") merged to main and was deployed, so app/lib/sitePlans.ts and the maps ARE on esg.cogneris.com. What remains true: the rest of this branch is not, and there is still no deploy automation. Verify with git cat-file -e origin/main:<path> before repeating the claim.
  • [x] E14 · Both corridors have a street-overlay reference sheet. The set was asymmetric: the Ontario Line had a sheet over real street geometry and the Eglinton Crosstown had only the chainage schematic, which made the two sites look different in kind when the only difference was which drawing had happened to be made. New scripts/build-corridor-sheet.mts generates the sheet for EVERY corridor from the same geometry the console draws — alignment and control areas from corridorGeo, streets from the same pre-projected basemap, plan box from CORRIDOR_BOX — so a sheet on a site office wall cannot disagree with the screen it was printed from. It refuses to run if the basemap and the plan box disagree. Emits to both diagrams/SDMS/ESG/ (20, 21) and public/maps/, and /maps now leads with both street sheets. Done 2026-08-01 · Claude Opus 5 (Claude Code).
  • [ ] E15 · Console information architecture — PROPOSED, NOT BUILT. Written up in docs/CONSOLE-IA-proposal.md at Pete's request: the full route table (portfolio surfaces kept function-first, plus a new project workspace at /projects/[id]/*), URL-held map state so a plan is linkable, the create-a-project process, and what "every diagram for a project" means in four labelled kinds. Phased 1-5 with the fork named: a create flow needs a store, and the deployed host has NO database bindings, so D1-vs-event-log is a decision that gates step 4. NOT BUILT. Nothing in sections 3-8 of that document exists.
  • [x] E13 · The site map has three modes, named zoom levels, and layers. DONE 2026-08-01 · Claude Opus 5 (Claude Code). Pete: the planimetric shape is what an environmental consultant and an engineer work in, the simplified one is "the shape the TTC uses inside a train car", and tabular is for features/functions/processes. All three, with layers over each. THE TERMS, SO THEY ARE NOT RE-ARGUED. Planimetric = true position, to scale, georeferenced. Schematic (a.k.a. topological) = true order and extent, geometrically distorted. Tabular = aspatial. The UI uses exactly these words with a plain-English gloss underneath. IDENTITY IS SPLIT FROM PER-VIEW GEOMETRY (app/lib/sitePlans.ts). Zone/Asset/Plotted carry what a thing IS and hold no coordinates; a PlanView holds only where it is drawn. A zone cannot be in two places because there is only one of it. This is deliberately the bridge to the topological model Pete specified: identity is the base space, a view is a section over it. THE SCHEMATIC IS DERIVED, NOT DRAWN TWICE. corridorGeo.spine() + kmAlong() reduce every stop and zone to its CHAINAGE and re-lay it out along a simplified spine — linear referencing. Order, extent and overlap are therefore true in both views BY CONSTRUCTION. The only hand-authored thing in the schematic is the spine polyline (Eglinton: one straight run; Ontario: the L, with a 45-degree elbow). ZOOM / LOD / DRILL-DOWN ARE THREE DIFFERENT MOVES, and are built as three things. Zoom = three NAMED levels (Corridor/District/Street, or Site/Wing/Unit indoors) so the visibility rules are predictable. LOD = semantic: at Corridor level a zone carries ONE badge with its record count in the WORST tone present, and the pins themselves appear at District. Nothing is silently hidden — what is not drawn at a level is summarised at it. Drill-down = the containment hierarchy with a breadcrumb (Site > Control area > Asset). LOD is gated to the planimetric view only: a transit diagram that needs zooming has failed at its own job. LAYERS are the diagram 17 legend as a real dimension: ZoneCategory on every corridor zone (water/vegetation/erosion/air/waste/noise/heritage/ groundwater), toggled per layer, and the TABULAR view honours the same toggles because a layer is a question about the site, not about the drawing. FOUR BUGS FIXED ON THE WAY, each worth not re-learning: (a) the basemap referenced --base-* CSS tokens that did not exist, so every street rendered black on black — that is why the planimetric view looked empty, NOT a missing basemap; (b) setPointerCapture on the <svg> retargets all later pointer events to it, so nothing inside the plan would have been clickable — pan uses a consumed flag instead; (c) schematic label boxes were REJECTED for overhanging the frame rather than clamped, so the zones at each end of the line (Mount Dennis MSF, Kennedy portal) were drawn off the drawing and vanished; (d) twenty stop names on one straight run need ROTATING, which the old chainage view knew and the first cut of the new one forgot. THE LEFT NAV was sixteen flat entries containing two called "Site map". Now five groups by question asked (Where / Work / Record / Insight / Capture), and /maps is "Reference sheets — printable corridor drawings", which is what it actually is. THREE REGRESSIONS FOUND AND FIXED AFTER FIRST REVIEW (Pete, 2026-08-01): (a) the corridor LOD ladder was applied to the Lakeshore Centre FLOOR PLAN, which hid every asset and every pin at the default level — the mall opened as a set of empty boxes. LOD now applies only where the problem it solves exists: plan.kind === "corridor". A floor plan fits on one screen; the levels there only magnify, and the level hint now says so per plan kind instead of claiming records were aggregated when they were not. (b) THE BASEMAPS WERE IN THE WRONG COORDINATE SPACE. They are pre-projected at build time, and the plan boxes were retuned (Eglinton 620→640 h, Ontario 880×1120 → 1120×1080) without rebuilding them — so the streets were drawn in a different projection from the alignment on top of them, and NOTHING ABOUT THE PICTURE SAID SO. Fixed three ways: CORRIDOR_BOX is now exported from sitePlans and IMPORTED by the builder (a comment saying "must match" is not a mechanism), both basemaps rebuilt, and the canvas now REFUSES to draw a basemap whose w/h disagrees with the view. (c) zone labels were de-collided vertically only, so a long name on a zone near a frame edge was drawn half off the plan. Now clamped horizontally too, with the leader line carrying the binding. NOTE: rebuilding Eglinton needed a fresh Overpass extract — the archived one in a prior session's scratchpad was the ALIGNMENT extract, not the road extract, and running it produced an empty basemap over the good file. The road extract is at scratchpad/eg_roads.backup.json for this session only; it is NOT in the repo, so a future rebuild needs a fresh Overpass fetch. tsc clean, next build green, every mode screenshotted. WRITTEN UP in docs/SPATIAL-MODEL-purpose-and-views.md — the argument for the model rather than a feature list, including the terminology, why the schematic is derived, the zoom/LOD/drill-down distinction, and where the topological model and the sheaf/fiber-bundle framing fit. NOT DONE, and NOT claimed: no free-form zoom (named levels only, by choice); "elevation" exists only as the tunnelled/elevated spans and "stages of work" has NO data anywhere in this repo, so neither is offered as a layer; nothing here is persisted or reaches the field app; and none of it is on esg.cogneris.com — see E11.
  • [x] E12 · The Ontario Line was drawn as a straight line. It is an L. DONE 2026-07-31 (session 141a2db4). band() puts every zone at x = KM0 + km × PX_PER_KM and the renderer drew one horizontal <line>. That is honest for Eglinton, which really does run east–west along one street. The Ontario Line runs west to east across downtown to East Harbour and then turns NORTH up the Don — so the plan put the Science Centre far east of downtown instead of well north of it, and every "what is near me" question the map exists to answer got a false answer. diagrams/SDMS/ESG/17_ontario_line_osm_overlay is the reference of record for this line, confirmed by Pete for both the alignment AND the environmental layer. It is drawn from OpenStreetMap in Web Mercator, so its pixel space IS a projection: the alignment was recovered by solving that projection from its 15 station markers, inverting it, chaining the 33 OSM railway=construction ways, and cutting the twin-track loop back to one centreline. New app/lib/ontarioLineGeo.ts holds the result — 38 points, the 15 stops snapped to the line, and 7 zones as circles at a real centre with a real radius in metres. WHY IT IS BELIEVED: the recovered centreline measures 15.81 km against a published 15.6 (1.3%), ends 18 m from Exhibition and 47 m from the Science Centre, and spans the real corridor extent. The length is the check that matters — a straight line between the same terminals would also start and end correctly, and only a line that follows the route measures right. An earlier cut measured 17.0 km; the excess was a western spur past Exhibition, since removed. Zones went from 10 to 7, which is what BOTH diagram 15 and diagram 17 carry. z-ol-thorncliffe, z-ol-flemingdon and z-ol-lakeshore existed only in the console and are dropped rather than given invented coordinates. The last of them, "Lakeshore East corridor · live rail adjacency", sat at chainage 9.0–12.4 km, which on the real line is the Pape segment running underground nowhere near the GO corridor; its spill kit re-homes to East Harbour, where the adjacency actually is. The Thorncliffe wheel wash re-homes to Don valley · TRCA, whose circle genuinely contains Thorncliffe Park (~550 m from centre). Eglinton is UNTOUCHED and keeps the chainage spine — it is a straight line, so the straight drawing is true. Zone.r and SitePlan.route/ stops are additive; every existing consumer, hit-test and label works unchanged. tsc clean, next build green, all six project pages prerender. NOT DONE: station labels crowd the zone labels through the downtown cluster, where six stops fall inside two circles. Legible, not tidy.
  • [ ] E7 · The site map is seeded data and stops at the console. Plans are hand-drawn schematics, not surveys or CAD. Plotting a pin lives in React state: it does not persist, does not reach the field app, and does not survive a refresh. Do not claim this surface reflects live site state.
  • [ ] E8 · Nothing BINDS a record to a location or an asset. This is the remaining gap, and it is now the only one. The register exists on both sides with matching ids (E9), and the GPS fix is already captured honestly — but no capture screen offers a location or asset picker, no event payload carries an assetId, and no report prints one. What exists is a vocabulary, not a binding. Needed, in order: (a) a picker in the capture and inspection flows, (b) assetId / locationId on the event payloads, (c) the report printing them, (d) the console reading real rows instead of the seeded ones. See diagrams/SDMS/ESG/13. - Deliberately NOT started here: apps/esg-field/screens/ is being edited by a concurrent session, so this pass changed device DATA files only.
  • [ ] E16 · The inspection is walked category by category; it should be walked area by area. Reviewed 2026-08-04 · Claude Opus 5 (Claude Code). Full argument and sequencing in INSPECTION-AREA-FIRST-proposal.md. The short of it: "area" means a FORM SECTION in the template, the field app and @esg/events-inspection, and a PLACE in both site registers — and areasClean on /projects already renders the two denominators under one label (5/8 = sections for Woodbine, 6/10 = places for Eglinton). TaskFlow iterates SECTIONS, so a verdict is site × section: "spill kits accessible" is one pass/fail across 15.8 km. Proposed: the observation coordinate becomes (locationId, checkId); SiteLocation.binds gets a machine-readable sections[] sibling so each place shows only its own checks; the walk iterates places and the SIGNED REPORT still prints section-shaped, both folded from one event stream (the same "one register, more than one drawing" argument as E13). REVIEWED 2026-08-05 by Codex (codex-cli) — the proposal was re-verified against source and revised in place. Two of the original claims were WRONG and are corrected there: the template is 34 checklist items, not 41, and inline capture from a walk is not merely repetitive but NOT WIRED AT ALL (CaptureFlow is rendered only from the app shell, never from TaskFlow). Codex also replaced the unsafe sections[] derivation with a governed, versioned CHECK-LEVEL applicability map, added the no-register fallback for the three projects that have no plan, and added the append-only/dual-read migration requirements the first draft waved at. SLICES 1-3 OF 8 DONE 2026-08-05 · Claude Opus 5 (Claude Code, session d44cfa8b). What landed: - Slice 1 — the denominator is named. areasClean is gone from both app/lib/projects.ts and apps/esg-field/data/projects.ts, replaced by a typed coverage: { basis, clean, total } with basis one of locations / sections / unsourced, and labels derived from it. Scarborough's "6/6" is declared unsourced because nothing in this repo can produce a 6 for it. coverageFraction returns null for an unsourced basis, so HomeTab draws NO progress bar rather than one from an unknown whole. Consumers updated: /projects, /projects/[id], portfolio.ts, /demoapp, HomeTab. - Slice 2 — one register, and a gate that bites. New import-free app/lib/siteRegister.ts is the canonical list of places (35 across the three plan-backed sites) with REGISTER_VERSION. sitePlans.ts now takes Ontario's location list and the mall's zone LABELS from it instead of deriving identity from the geometry tables. apps/esg-field/data/ sites.ts is generated from it and pins the same version. Two real defects fixed, not just described: the console believed the Ontario Line had SEVEN locations because OL_ZONES_GEO holds seven circles — z-ol-lakeshore, z-ol-thorncliffe and z-ol-flemingdon did not exist console-side at all; and Lakeshore was 15 zones console-side against 10 device-side. UNDRAWN_ON_PLAN now DECLARES the three the planimetric view cannot place, and a test asserts that declaration matches what the geometry tables actually lack. - Slice 3 — governed applicability, pilot site only. New import-free app/lib/applicability.ts binds CHECK ids (not sections) to each of Eglinton's ten locations, plus a siteWide set for the four checks whose subject is the site itself. Completeness is asserted against the TEMPLATE, so removing the last binding for a check fails a test rather than silently shortening the form. - The gate guards the gate. tests/registers.test.ts (16 tests) was run against six seeded mutations — a dropped device location, a renamed label, a coverage denominator drifting from the register, a dropped sole binding for well-1, a check id not in the template, and a registered location with nothing bound to it. Every one failed the suite; restoring made it green again. VERIFIED 2026-08-05: tsc --noEmit clean on the console tree · root node --test 55/55 · jest in apps/esg-field 151/151 (14 suites). TWO FAILURES ON THIS TREE THAT ARE NOT FROM THIS WORK. Session 0add9fc1 was writing to the same worktree throughout, and both belong to its in-flight, untracked files: (a) next build does not complete — Turbopack reports exactly ONE error, node:sqlite reaching the app-client chunk via the untracked app/lib/arrivals.ts. The project pages were therefore NOT prerender-checked. (b) tsc --noEmit in apps/esg-field reports exactly one error, in the untracked lib/sync/__tests__/outbox.test.ts. The field tree was clean before that file appeared and no file in this work is in the trace. The one runtime risk this work adds — sitePlans.ts throwing at module load if a registered mall location has no drawn shape — was checked directly instead: all 15 registered ids have a shape, so the guard cannot fire today. SLICES 4-7 DONE 2026-08-05 · Claude Opus 5 (Claude Code, session d44cfa8b), same session, continued. What landed: - Slice 4 — the location-bound generation exists. Three additive event kinds in lib/store/events.ts: LocationInspected (one place, its applicable checks answered, as ONE event), LocationNotReached (reason REQUIRED) and SiteChecksRecorded. SCHEMA_VERSION stays 1 — the row layout is untouched and no existing row changes meaning. New lib/store/decode.ts DECODES these payloads at read time instead of casting, because they are the first in this log that can arrive from somewhere other than this app. The legacy kinds are deliberately left untightened: rejecting rows already durable on a handset would be data loss dressed up as a correctness fix. - Slice 4 — the dual-read fold. New lib/inspection/coverage.ts folds both generations SIDE BY SIDE and refuses to blend them: a legacy AreaInspected is never overwritten by a location response, a mixed stream reports generation: "mixed" and declines to call itself complete, and a legacy-only record reports NO location coverage rather than "0 of 10 covered", which would state a failure that never happened. It also computes the canonical per-item projection §4.4 requires — any deficient occurrence makes the item deficient; satisfactory only when every applicable occurrence is answered; a place not reached leaves its checks UNANSWERED, never a quiet pass. - Slice 5 — the walk is area by area. New screens/inspect/LocationWalk.tsx: one card per registered place in register order, each asking ONLY the checks bound there (the tunnelled span asks 2, not 34), "not reached" with a required reason as a first-class outcome, and progress counted in PLACES. Wired into TaskFlow as an additive branch — WalkView is untouched and still serves every site without an approved map, which today is five of six. InspectionCreated gained an optional siteId, set only when the site name matches exactly one register entry; a typed site stays unbound rather than loosely matched. - Slice 6 — the device copy. data/applicability.ts generated from the console's, guarded by a deep-equality test. - Slice 7 — the console stops omitting places silently. /projects/[id] now DECLARES the three Ontario Line locations the planimetric view cannot place, states that they still count towards coverage, and the Locations panel lists all ten. VERIFIED 2026-08-05 (second pass): console tsc clean · root node --test 63/63 · jest in apps/esg-field 191/191 (17 suites) · node scripts/verify-golden-fixture-digest.mjs OK (Test_Aecon.pdf sha256 ddb779c9…, 5p) · the four lib/report suites 33/33 unchanged. The durability round-trip asserts a sample for EVERY event kind, so the three new ones are proven to survive a restart THROUGH the new decoder. - SLICE 8 NOT DONE, AND DELIBERATELY SO. The report still cannot print an area-by-area record. foldInspection keys off AreaInspected, so a location-bound walk folds to zero areas; the per-item projection exists and is tested, but ReportArea's status vocabulary is pass / fail / not-applicable with NO way to say UNANSWERED. Printing the ONxpress form from this record today would mean back-filling a tick nobody gave or inventing a section verdict the form has no field for — the two failures §4.4 exists to prevent. So makeReport REFUSES for a location-bound record with a stated reason rather than rendering an empty form that reads as an inspection where nothing was found, and the walk screen says the same thing on its face. The next ticket is an approved encoding for "unanswered" in the report IR. - ALSO STILL NOT TRUE: raising an NCR from inside the walk is still not wired. LocationWalk binds photo evidence to (place, check) via the existing in-walk capture, but CaptureFlow remains reachable only from the app shell — seeding it with a site and category would contradict a deliberate decision recorded in that file. ReviewInspection still counts SECTIONS, so it under-reports a location-bound walk. The applicability bindings remain a READING, not an approval. - SLICES 4-8 NOT ATTEMPTED at first pass. No location-bound event exists, no dual-read fold, and the walk in TaskFlow.tsx is still section-first for every site including Eglinton. applicability.ts is governed data with NO consumer — nothing reads it to decide what to ask, and there is no device copy of it yet. The bindings in it are a READING derived from each location's binds line and the check text; they have not been approved by anyone who has stood on the ground, and no walk should be driven from them until they are. - NOT STARTED at review time. The review itself changed no code. - Found while reviewing: apps/esg-field/data/sites.ts is exported from the data barrel and imported by NO screen — the device location register is dead code today. And the two Lakeshore registers disagree (console 15 zones, device 10), which E9 claims they do not.

A · Development environment

The loop today is: edit → guess whether a reload is enough → maybe rebuild for ten minutes → find out on the handset. Every item here removes one guess.

  • [ ] A1 · One command to start the day. npm run dev in apps/esg-field: starts Metro, tails the device log, prints the debugger URL and the LAN address. Today these are three commands and one of them is a URL nobody can remember.
  • [ ] A2 · Device logs where you can see them. JS console and native (xcrun devicectl device console) into one tailable file, timestamped, so "it didn't work" has an answer without opening Chrome.
  • [ ] A3 · Preflight. One check that answers: is the phone connected, is Metro up, is the app installed, do the speech models verify, is the branch clean. Run it before a build instead of discovering the answer during one.
  • [ ] A4 · Reload vs rebuild, stated. A script that inspects the diff and says which is needed — JS only → reload; native/config/assets → rebuild. The ten-minute rebuild is only sometimes necessary and it is currently guessed at.
  • [ ] A5 · Watch mode for the gate. tsc --noEmit + jest on save, one pane, so a break is found in seconds rather than at commit.
  • [ ] A6 · verify script. typecheck + test + Metro bundle fetch in one command — the bundle fetch is the step that catches what tsc cannot (a bad import surfaces only when Metro resolves it).

B · Antigravity plugin

tools/agent-console/ exists and packages to a .vsix (built 2026-07-30). It is a VS Code extension using only stable APIs, so a fork should take it.

  • [x] B1 · Two-pane console. Conversation webview + activity OutputChannel, one continuous session, stop button. Packaged as tools/agent-console/agent-console-0.1.0.vsix.
  • [ ] B2 · Confirm Antigravity installs it. Sideload the vsix; if the engines.vscode range is rejected, widen it. UNTESTED — do not claim it works until it has been installed there once.
  • [ ] B3 · Activity as a real terminal. Swap the OutputChannel for a pseudo-terminal so output is coloured and scrollback behaves like a terminal. Decide only after using the OutputChannel version for a day.
  • [ ] B4 · Handoff file. .claude/handoff.md both sessions read and write, so the console session can leave instructions for a terminal session. This is the substitute for shared context, which is NOT possible: two UIs cannot attach to one running agent session.
  • [ ] B5 · Install docs. One paragraph in the README: install, open, where the activity pane is, what cwd the agent gets.

D · Agent identification and activity tracking

Several agents and sessions now touch this repo — terminal, Agent Console, and whatever runs next. Attribution stops being optional the moment two of them disagree about what happened.

  • [ ] D1 · Who did this. Every worklist entry and commit says which agent or session made it. Today a commit says "Claude Opus 5" and nothing about WHICH session, so two concurrent sessions are indistinguishable in the log.
  • [ ] D2 · Activity trail. A durable, append-only record of what each session did: turns started, tools run, files touched, background tasks and whether they finished. Distinguishing an abandoned run from a running one is currently impossible after the window closes.
  • [ ] D3 · Concurrency safety. Two sessions editing the same file is unhandled — last write wins, silently. At minimum, detect it and say so.
  • [ ] D4 · Surface it in the Agent Console. The activity pane already sees every tool call for its own session; D2 makes it possible to see the others too.
  • [x] D5 · The ESG diagrams re-cut against the code. Diagrams 10 (app IA) and 11 (Rita) were REWRITTEN — they still showed Today / My Work / Records behind a + sheet, and claimed Rita read her answers aloud. 01, 02, 03, 07, 09 and 12 were corrected: an NCR raise now crosses the delivery boundary, and only the raise. 13 is new (assets, locations, geotagging, the site map). diagrams/SDMS/ESG/README.md is a new index stating what changed and why. Done 2026-07-30 · Claude Opus 5 (Claude Code).

C · ESG field app

Carried out of the 2026-07-30 session. Ordered by what blocks the most.

  • [~] C1 · Prove voice works on device. Dictation is now its own screen (screens/capture/NoteCapture.tsx) which narrates every state, so the next run answers the question instead of failing silently. The 99 MB tiny model verifies on disk against its pinned SHA-256; what is unproven is whether it reaches the handset — on a DEBUG build it arrives over the LAN from Metro the first time, which is the leading explanation for "the note doesn't work". A release build embeds it. ORIGINAL: The Note button now narrates itself (25cd40d); the open question is whether the failure was a slow ~103 MB model load over Metro or a real fault. Run it once and read the status line. Everything voice-shaped waits on this answer.
  • [~] C12 · TestFlight distribution — a build a tester can install without a cable. Raised and scaffolded 2026-08-01 (session 29fab90b). Until now the ONLY install path was xcodebuild + devicectl to the one registered iPhone in §2 of the field-app HANDOFF. Landed: ITSAppUsesNonExemptEncryption + env-driven buildNumber in app.config.js, apps/esg-field/scripts/ ExportOptions.plist, and apps/esg-field/scripts/testflight.sh (prebuild → archive → export, upload behind an explicit --upload). HANDOFF §2a documents the whole route. UPDATE 2026-08-03 (session 29fab90b): the BUILD path is proven. ** ARCHIVE SUCCEEDED ** then ** EXPORT SUCCEEDED **, producing a signed ~229 MB FieldIntelligenceAgency.ipa. The export first failed with the opaque exportArchive Copy failed; cause was Homebrew's rsync 3.4.4 ahead of openrsync on PATH (Xcode's CreateIPA passes -E, meaning --extended-attributes to openrsync and nothing at all to Homebrew's). The script now pins PATH=/usr/bin:/bin:$PATH for the export. Signing is CLOUD-MANAGED, so the distribution cert is in the account, not the local keychain — security find-identity showing only a development identity is expected. STILL NOT DONE — no link exists yet: no explicit App ID registered, no App Store Connect record, nothing uploaded, no tester invited. The exported .ipa is also STALE — it is the 2026-08-01 archive, predating the HomeTab rewrite, the breadcrumb ✕ move and the SubmissionsTab portal merge. Blocked on browser steps only Pete can do: register the explicit App ID for com.cogneris.esgfield, create the App Store Connect app record, and decide whether the tester is internal (no review, but they join the team) or external (email/public link, ~1 day Beta App Review on the first build). Ad-hoc itms-services:// was considered and rejected — it needs the tester's UDID up front, and Cloudflare Access fronts every *.advancedsequents.com hostname, which iOS's install daemon cannot authenticate through.
  • [ ] C2 · Identity. Every actor written to the log is the literal string "device". Approvals, assignment and BR-CA7 (disclosing self-verification) are all meaningless until a signature names a person. This unblocks C3–C5.
  • [ ] C3 · Notifications. Inbox is honest about being empty because nothing can reach the handset. Needs a channel; blocked on C2 and on sync.
  • [ ] C4 · Approvals. Approve/reject with a reason, as an appended decision event. Blocked on C2.
  • [ ] C5 · Audits. The largest scope gap — a walk against a standard, with graded findings (major/minor/observation/OFI) where major and minor raise NCRs and observations must not. BR-AU1…AU7, none of it built.
  • [ ] C6 · Save-for-later on a capture. Closing a half-written NCR offers only "discard", because a draft has nowhere durable to live. Needs a draft record before the prompt can honestly offer to keep it.
  • [ ] C9 · Streaming ASR for live partials (parked). Engine vendored, model absent, SHA pins empty. See the Decided note — accuracy was chosen over the live-text feel. Needs the Zipformer transducer sourced and pinned (~350MB resident) before it is more than a code path.
  • [ ] C8 · Two views on a walk: list and MAP. The item list answers "what is left"; a site plan answers "where am I and what is near me", which the list cannot. Needs, in order: a coordinate per section (the schema has none), a site plan or basemap to draw on, and a decision on what to do offline where no tiles can be fetched. NOT started — raised 2026-07-30.
  • [x] C10 · The PTT crash — measured, then hardened. DONE 2026-07-30 (session b5c75eb7). Root cause proven on the handset with devicectl device process launch --console: every tier resolved to whisper-small (374 MB of weights), and the kill landed inside transcription — Transcribe → TRIM_MEMORY_RUNNING_CRITICAL → signal 9. All tiers now map to tiny (14280ab). Since then, three more defects named by the 2026-07-30 audit are closed: the recognizer load is SINGLE-FLIGHT (warm-up and a mic press no longer each create a native engine, with the loser destroyed rather than leaked), a failed recorder start rolls back the audio session instead of holding it for the rest of the session, and a system memory warning now releases an IDLE recognizer. Regression tests in lib/audio/__tests__/recognizerSingleFlight.test.ts; the concurrency test was verified to FAIL against the pre-fix code.
  • [!] C11 · No jetsam/.ips report has ever been read. Blocked on nothing but doing it — xcrun devicectl device info files --domain-type systemCrashLogs was run and found no JetsamEvent for the app, which is NOT the same as proving there was none. The console capture is weaker evidence than the audit's acceptance gate requires. Until one is read and explained, the crash is mitigated, NOT closed.
  • [ ] C12 · The recognizer still holds its memory for the app's lifetime. Audit P1-2. The memory-warning release is a reaction, not a policy: there is still no idle timeout, no release on long background, and no measured cold-load cost to weigh a more aggressive policy against.
  • [ ] C13 · Chime ordering contradicts its own contract. Audit P1-4, NOT fixed. chimeOpen() is fired without being awaited, so the cue can land inside the recording; chimeClose is imported in ui/voice.tsx and never called, so a turn ends with no cue at all. Sequencing belongs in the recording state machine, not in the gesture handler.
  • [ ] C14 · The streaming model is bundled into every build that cannot use it. Audit P2-1, half fixed: the comment that claimed streaming was the default has been corrected, but app.config.js still ships the 73 MB zipformer into an IPA where sherpaMode() returns batch. Bundle what the build profile can reach.
  • [x] C15 · Voice accuracy — the chime and the model. DONE 2026-07-30 (session b5c75eb7). TWO causes, both from the on-device log rather than inference. (1) chimeOpen() fired AFTER startRecording and unawaited, so the activation tone was recorded and transcribed — the log literally reads [ptt] sent — "[Bell". It is awaited BEFORE the recorder starts now, and chimeClose (imported and never called) plays after it stops. (2) The model was multilingual tiny, the weakest in the set at English: "Testing 1-2-3" came back as "So, I think I'm 133". Bundled default is now base.en (160MB), with tiny as the low-tier floor. small is unbundled AND removed from the fallback list — it was still first there, which would have resurrected the SIGKILL through that path. UNVERIFIED ON DEVICE AT TIME OF WRITING: the build was installing. Do not claim the accuracy is better until a real dictation has been read back.
  • [!] C16 · NCR delivery to the console is UNPROVEN end to end. The chain is built and every link is verified EXCEPT the last: app.config carries portalUrl: http://192.168.50.95:3000, the console answers on that LAN address, /api/submissions returns {"items":[]}, and the Submissions inbox renders. What has never happened is a handset actually posting a ticket that appears there. Blocked on nothing but doing it — raise an NCR on the phone and send it while the dev server is up. NOTE: app/lib/db.ts had backticks inside a template literal, so the receiver module did not parse AT ALL from b5aa49b until 23dd957. Any earlier belief that delivery "should have worked" was wrong.
  • [ ] C17 · The console fix for the duplicate Field app entry is not deployed. esg.cogneris.com serves main, which still has TWO nav rows pointing at /app. Fixed on feat/rn-app-parity since b5aa49b. Needs a PR to main; the nav change is standalone and independently mergeable.
  • [x] C16 · NCR delivery, proven in production. DONE 2026-07-31 (session b5c75eb7). The whole chain now exists and every link is verified: D1 esg-ncr-db (363d5bad-5e1f-4ed2-8657-78ad52ec88da) provisioned on the Cogneris account with migrations/0001_ncrs.sql applied REMOTELY and read back from sqlite_master; PR #10 merged to main; the console deployed via opennextjs-cloudflare; GET /api/submissions answers {"receiver":"d1"}; and a POST of the handset's own ticket returned {"ok":true,"duplicate":false} and reads back on esg.cogneris.com/submissions. NOT YET PROVEN: the HANDSET posting it itself. The payload was replayed by hand. The app was rebuilt with EXPO_PUBLIC_PORTAL_URL=https://esg.cogneris.com to close that last gap.
  • [!] C18 · esg.cogneris.com is PUBLIC and /api/ncrs is unauthenticated. Cloudflare Access app "ESG Web" kept its "Only Pete" allow policy, but a second policy — "Open — no gating (added 2026-07-31 at operator request)", decision=bypass, include=everyone, precedence 2 — makes the domain open. Deleting that ONE policy restores the wall; nothing else was changed and the Access app was deliberately not deleted. While it stands, anyone who learns the URL can write a ticket into D1. The fix is not to re-gate blindly: the endpoint needs its own authentication (device identity, C2) so Access can stay off the API path deliberately rather than by accident.
  • [!] C19 · main's CI is red, and was BEFORE PR #10. 36 isolation-fence violations, all pre-existing worker manifests binding D1/R2/Vectorize ids not declared in their esg-resources.json, plus the rule that no root wrangler.jsonc may exist (CONVENTIONS §4.3) — which the esg-web deploy config violates by existing. PR #10 was merged with those checks red; it added no new violation, but that was not checked BEFORE merging, which it should have been.
  • [ ] C20 · wrangler is not a dependency. opennextjs-cloudflare build fails without it (ERR_MODULE_NOT_FOUND). It was installed with --no-save to get today's deploy out, so the next clean checkout cannot deploy.
  • [x] C21 · The recording was kept in reclaimable storage, and one mic was still throwing it away. DONE 2026-07-31 (session 141a2db4). TWO faults, both found while answering "are sound recordings visible and accessible". 1. expo-av records into the CACHE directory and sherpaOnDevice handed that uri straight back, so 60312f6 put a CACHE uri into an APPEND-ONLY log. iOS and Android may both reclaim the cache under storage pressure, without asking and without telling the app — so the note plays back all afternoon and the recording is gone by the time anyone disputes the transcript. New lib/audio/retain.ts copies the bytes into the document directory first, the same move lib/camera has always made for a photo. 2. CaptureSheet's OWN bar mic never read result.audioUri at all. The note screen has kept its recording since 60312f6; a finding dictated at the sheet's mic still reached the ticket as a transcript with no audio behind it. It now retains it on the same path. retainRecording never throws and never lies: a failed retention hands the cache uri back with durable: false and a reason, so the operator keeps a playable recording and the log is not told a cache uri is safe. It proves the copy landed (getInfoAsync) rather than trusting a copyAsync that resolved. 12 tests, filesystem injected via RecordingFileStore — a jest.mock of expo-file-system/legacy is SILENTLY IGNORED here, because this package's own moduleNameMapper remaps that specifier and the factory registers under a key production never resolves to. Do not "simplify" the seam back to a module mock. NOT PROVEN ON DEVICE: no handset run has confirmed a retained file survives a cache eviction. The eviction itself has never been observed — it is a documented platform right, not a measured event here.
  • [x] C27 · Home is two decisions wide; the four lists are two. DONE 2026-08-01 (session e038f9b9, Claude Opus 5). Home opened with four counted tiles (Inbox / Tasks / In prog / Submissions) over four outlined 48pt action chips, under three shouted section headings. Now: - Work = Inbox | Tasks (what is owed) and Activity = In progress | Completed (what has been touched), as two counted tiles that open a switched screen (ui/segmented.tsx, screens/WorkTabs.tsx). Submissions is renamed Completed — same list, same fold. Both counts print separately and are NEVER added: an inbox item is also a task. - Actions are 112pt slabs filled with their own type colour, glyph and title only. A documented break from the theme's "type colour is an outline, severity owns fills" rule, valid only while nothing on Home carries a severity. "NCR" is NCR Ticket everywhere it is visible. - No section headings, no Running now. A half-finished walk is a row under Activity › In progress, which is where every other unfinished thing already was. - The bar stays two destinations — Home and Chat. Four destinations plus the microphone were built and reverted in the same session: the label under the button was clipped by the button. There is no Messages destination; Chat is the messaging surface. - openSegment() is the single place a list maps to the screen holding it, used by speech, the legacy nav seam and the post-flow redirect. "My work" by voice opens Work, not Home. - The Five Questions glyphs were redrawn (ui/icons.tsx): the old consequence icon was the DOWNLOAD glyph in all but name, cause was a plausible heart-rate trace, and intent/reality were two near-identical rings. Now arrow-into-target, map pin, dimensioned gap, marked step, weight on the ground, forked arrows. Rasterised and eyeballed at size — the first cut of intent read as the Mars symbol ♂ and was redrawn. tsc clean, 12 suites / 132 tests pass; inspectionLifecycle.test.tsx rewritten to the new IA. - A SECOND ICON WEIGHT (ui/appIcons.tsx). The Home slabs were wearing 1.7pt UI hairlines blown up to 40pt — the mark was the smallest thing on the largest object on the screen. They now wear filled silhouettes with a mid-tone and a KNOCKOUT (a hole showing the slab colour through), so detail costs no hairlines. The hairline set still owns the bar, lists and breadcrumbs; the two are NOT interchangeable and that is stated in the new file's header. - The Five Questions redrawn again, against the operator's own navigation vocabulary: intent = COMPASS (a bearing you set), 01 = the waypoint pin, 02 drift = the target and the pin with the gap dashed between them, 03 cause = DOMINOES, 04 consequence = a splash, 05 response = a SIGNPOST. Every candidate was rasterised and looked at rather than reasoned about — which is how the first intent was caught reading as the Mars symbol ♂, the first consequence as DOWNLOAD, the second consequence as the WIFI glyph, and the first dominoes as "III". STILL WEAK, said plainly: 02 drift is three small elements and is fiddly at 22pt, and 04 consequence now reads a little like a sunrise. - BUTTON TREATMENT: A GRADIENT, AND NOTHING ELSE. Chosen off a 34-treatment sample sheet (docs/design/action-buttons-and-palette.html). ui/gradient.tsx — one vertical gradient over one solid hue, drawn with react-native-svg (already a dependency; expo-linear-gradient is a native module and would force a prebuild). Deliberately shallow: the hue is a CODE, so the gradient may change how a colour is lit, never which colour it is. - TWO RICHER MATERIALS WERE BUILT AND REJECTED ON THE HANDSET. Do not rebuild them without new evidence. · GLASS (ui/glass.tsx, deleted) — asymmetric bevel, raking sheen, rim light, and a coloured backdrop for the panes to sit in front of. Reads well over something colourful; this app's ground is not, and without transmission it was three gradients of effort for a box with shiny edges. A backdrop was tried and rejected separately. · NEUMORPHIC (ui/neu.tsx, deleted) — the bars as soft extrusions in the bar's own colour. On a near-black surface the light half needs so little white that it reads as a smudge, not a shape. Both were built WITHOUT a native module (RN has no backdrop-filter, no inset shadows, no pseudo-elements, and one shadow per view of which Android honours only the dark half) — that constraint held; the look did not. - A REAL BUG WORTH REMEMBERING: style={StyleSheet.absoluteFill} plus width="100%" height="100%" on an <Svg> resolves against two different boxes in react-native-svg, so every overlay rendered at the wrong size with a visible hard-edged rectangle inside the control. Use a viewBox="0 0 100 100" with preserveAspectRatio="none". - THE GROUND IS SLATE, NOT BLACK. paper #0f1722 -> #182231, and the whole ramp moved with it (card #222e40, line #2f3d54, line2 #43546f). Lifting the page alone would have left the panel three units above it and every card on every screen would have vanished. - Action fills are DEEP now, marks are WHITE: #6f5600 / #137a3d / #1160c4 / #a8500a at 0.82 alpha, measured 5.4:1–7:1 against white where the bright hues were 1.4:1–2.8:1. typeColors() gained a third member, deep; never use fg as a fill under white text. - THE NCR FLOW WAS RE-CUT AROUND THE CAPTURE. It ran Site → Classify → Notes → Photos → Summary → Confirm: four questions before the operator was allowed to say what they were looking at. Two steps now — 1 Record (a Voice | Photo switch, not two steps) and 2 Classify (category, site, severity, with the pinned fix shown) — then review. NCR_STEPS is ["Record","Classify","Review"]. - PUSH-TO-TALK IN PLACE. Holding the mic used to open a full-screen recorder: the finger was already down, the screen changed under it, and the words landed two screens from the sheet. It is onPressIn / onPressOut on the sheet itself now — hold, speak, release, and the transcript is on screen with its recording beside it. NoteCapture is no longer reachable from this flow (the file remains). - MANY RECORDINGS, EACH DELETABLE. New VoiceNote type: one entry per pass of the mic, each keeping its own words, file and length. The transcript is DERIVED from the list, never stored beside it — held as its own state it drifts the moment one is deleted and the ticket then says something no recording backs up. CapturedEvidence.audioUri stays as the FIRST kept file because the ticket's evidence payload has one audio slot and that is an append-only event vocabulary; recordings travels beside it. - Review: dropdowns, not chips. Nine category chips and four severity chips were most of a handset screen spent re-asking two answers already made. Two Selects in labelled rows. NOT STARTED, and asked for: inspection / investigation / audit should OPEN ON THE SITE MAP. Nothing was built for this. The field app has no map of any kind — no react-native-maps, no expo-maps, no renderer, and no map component anywhere under apps/esg-field. The console's site map (app/components/siteMap.tsx) is web React over SVG basemaps and does not port. This needs a decision on the renderer before any of it is work: a native map SDK (a dependency and a prebuild), or the console's approach — pre-built SVG basemaps per corridor, drawn with react-native-svg, which is already a dependency and already how every icon in the app is drawn. NOT DONE, and asked for: a light/dark theme toggle (sun/moon). NOT STARTED — ui/theme.ts is a module-scope constant read by 714 call sites inside 32 module-scope StyleSheet.create blocks across 35 files, all of which capture their colours at import time. A working in-app toggle means converting every one of them to a hook; it is not a button.
  • [x] C26 · The submissions row was a four-line card about plumbing. DONE 2026-08-01 (session 434226a7). Reported from a handset showing "Send to portal" buttons three hours AFTER C23 removed them — the bundle on the phone predated the commit, so nothing was wrong with the code and the whole complaint was a stale build. The card underneath it was genuinely too busy though: kind/date, a title wrapping to two lines, the site line, and then a whole sentence of delivery state. Now three lines. Delivery is a two-word coloured tail on the line that already names the site — amber sending / device only, green at the portal — because where a ticket got to is a footnote, not a paragraph. BR-X5 unchanged: only a receipt this device observed reads as at the portal. Titles are raw dictation and run long, so numberOfLines 2 -> 1; three tickets used to fill the screen. Header dropped "reports regenerate from the log", which is a mechanism note and not the operator's business. Deleted the tickets map (only the removed button read it) and the orphaned sendBtn/sentBad styles. tsc clean, 12 suites / 132 tests pass. STILL NOT DONE, unchanged by this: no connectivity listener (C23's own note), and delivery to esg.cogneris.com has STILL never been observed arriving from a handset.
  • [x] C25 · The trust boundary, drawn. DONE 2026-08-01 (session 141a2db4). Diagram 22 draws what the policy states: three tiers, and only the third is a control. The device-to-console hop is shown crossing NOTHING, because it does not — both are one company. Carries the four exposures (client confidentiality, personal data, legal exposure, PROPRIETARY METHODOLOGY), the five-part decomposition of what may be submitted, and the return contract. FM-1 is drawn as an OPEN question with a dashed border: whether Cloudflare Workers AI is inside or outside tier 3 is undecided, and the diagram must not resolve by drawing what nobody has agreed. Companion to docs/FM-BOUNDARY-and-submission-policy.md. Numbered 22 because a concurrent session holds 18 and 19.
  • [x] C24 · Two diagrams for delivery. DONE 2026-08-01 (session 141a2db4). 20_what_leaves_the_handset is the inventory: every capture action by what is committed on the device, what is actually sent, what stays, and what the console accepts. Three things it establishes that were not written down anywhere: submitFinding/submitSummary/sealInspection exist in lib/ncr/api.ts and NOTHING CALLS THEM; the sign-off outbox is enqueued and NOTHING EVER DRAINS IT (no drain/flush/run-sync call exists); and no binary has ever left the app — no FormData, no uploadAsync, photos travel as a count and audio has no field at all. The right-hand column is not read from the source, it is GET /api/submissions returning its own accepts map, verified against esg.cogneris.com. 21_ncr_delivery is the mechanism behind C23 — the local commit, the automatic sweep, and which single outcome may be called delivered. Numbers 20 and 21 because a concurrent session holds 18 and 19; its diagrams are deliberately NOT indexed by me. PNGs at 2x in docs/diagrams/png.
  • [x] C23 · "Send to portal" should never have existed. DONE 2026-08-01 (session 141a2db4). Raising an NCR wrote it to the device log and stopped. Delivery was a SECOND, MANUAL act — open Submissions, find the row, press "Send to portal" — so an operator who finished an NCR had every reason to believe they had finished while the office never saw it. Reported by Pete from a handset: "you shouldnt have to send to portal... simply completing the NCR is saving to database". That was not a step someone forgot; it was a step that should not have been there. New lib/ncr/delivery.ts. Both raise sites (NcrRaise, CaptureFlow) call deliverSoon(log) the instant the ticket is committed, and the Submissions list sweeps again on mount. The button is GONE — the row now states position and offers no action, because there is no decision there for a person to make. HONEST ABOUT WHAT "SAVED" CAN MEAN ON A SITE: the local commit is durable and immediate and never needs a network; delivery follows as soon as there is one. BR-X5 is intact — a receipt is written ONLY on a 2xx this device observed, and everything else leaves the ticket pending and retried. Safe to retry by construction, because the device's own ncrId is the primary key at the far end. Receipts persist to ncr-receipts.json; losing them costs a re-send, never a ticket. NOT DONE: no connectivity/foreground listener yet, so a sweep happens on raise and on opening Submissions but not the moment signal returns while the app sits on another screen. And this is UNVERIFIED ON A HANDSET — the delivery that prompted it has still never been observed arriving.
  • [ ] C22 · A multi-turn note keeps only the LAST recording. audioMs accumulates across turns (prev + ms) but audioUri is a single field and each turn replaces it. Record twice and the evidence claims 30s while playing back only the final 15s — a duration that does not match its own audio is exactly the kind of small dishonesty a hearing turns on. Fixing it means NcrEvidence.audioUri becomes a LIST, which is a change to the event vocabulary the console receiver also reads, so it is NOT independently mergeable with C21 and was deliberately left. Until then, neither screen should be described as keeping "the recording" plural.
  • [ ] C7 · Investigation ends. The middle stage exists; the incident record that opens it and the root-cause method that closes it do not.

Decided, so it is not re-argued

  • Two UIs cannot share one agent session. No attach API exists. A second window is always a second session; .claude/handoff.md (B4) is the bridge.
  • Rita is not a language model and must not become one without an explicit decision to send site data off-device.
  • No invented progress numbers. expo-asset reports no byte progress for the model download, so the launch strip is indeterminate with a stage in words. A bar filling at a rate unrelated to the work teaches the operator to distrust every other number the app shows them. If a real byte count becomes available, a percentage may replace it — not before.
  • Batch Whisper, not streaming — accuracy over responsiveness. The repo vendors a streaming Zipformer engine (lib/audio/sherpaStreaming.ts) that emits live partial words as you speak, which is the Hey Brian feel. Its model was dropped from the manifest and its SHA pins are empty, so the path exists with nothing to load. Deliberately parked 2026-07-30: streaming trades word accuracy for latency, and an inspection note is a legal record. Revisit as C9 if the live-text feel is wanted back — a two-pass (stream for feel, batch for the record) is what tandem.ts was reaching for.
  • No whole-section attestation. "All N items satisfactory" was one tap that marked every row in a section as inspected. It is removed: an inspector answers every item, and the record says so because it is true. Do not reintroduce it as a convenience — it costs taps and buys the only thing the document is for, a verdict per item that stands up a year later. BR-S3 still applies to the METHOD recorded; there is now only one method.
  • Voice capture is PUSH-TO-TALK, never silence-detected. Endpointing on a site is guessing: plant noise, wind and a radio read as speech, while a pause to look at something reads as finished. You get turns that stop mid-sentence and turns that never stop, and no threshold works at both the yard and the portal. The finger is the endpoint — deterministic, nothing to tune. It also means only the BATCH recogniser is needed; no VAD or streaming endpointer, which matches the model manifest as shipped. Do not add auto-stop.
  • The summary on capture is composition, not generation — first sentence of what was said plus the chosen category. It can be instant precisely because it invents nothing.

Code review — Codex deep pass, 2026-08-06

Session e36ef25c (Claude Code / Opus 5), driving Codex CLI 0.145.0. Started and finished 2026-08-06 afternoon.

  • [x] In-depth review of the feat/rn-app-parity working diff (37 modified + 13 untracked files). Full findings: docs/REVIEW-codex-2026-08-06.md — 60 findings, 6 independently re-verified.

Measured, not claimed: tsc --noEmit clean on BOTH the console and apps/esg-field (this corrects the older "~56 pre-existing esg-field tsc errors" note). Console npm test 68/68.

  • [!] lib/store/__tests__/durability.test.ts FAILING — INSPECTION_EVENT_TYPES gained DisciplineAssessed but sampleDrafts() has no draft for it (17 expected, 16 got). The new event type therefore has NO persistence coverage.
  • [!] lib/inspection/__tests__/disciplines.test.ts 2 FAILING — the safety lane reason string was reworded; the specs still assert /safety item/i and /no safety event/i. The new string has DROPPED the admission that no safety event exists to record into. Decide which is true.
  • [!] Console tsconfig.json does NOT extend tsconfig.base.json — exactOptionalPropertyTypes and the rest of the base strictness are OFF for all of app/. The clean console typecheck above is weaker than it looks. One "extends" line fixes it.
  • [!] NoteCapture.stop() NEVER STOPS THE MICROPHONE (verified). No stopRecording, no offData detach, no session release; engineRef is then nulled, discarding the only handle. Hot mic behind an idle screen. Highest-severity finding in the review.
  • [!] The field map renders Ontario Line geometry for EVERY project — an Eglinton walk shows Ontario Line streets and reports all its own locations "not on this plan."
  • [!] Device knows 10 Ontario Line zones, console knows 7 (z-ol-lakeshore, z-ol-thorncliffe, z-ol-flemingdon are device-only). tests/registers.test.ts asserts SUBSET, not equality, so this passes by design.

Decided, so it is not re-argued

  • AST-OL-WASH-3 living at z-ol-donvalley (console) and z-ol-thorncliffe (device) is a KNOWN, DELIBERATE divergence, recorded at app/lib/sitePlans.ts:897. Moving an asset between control areas changes what a past inspection was about. It is a register-owner decision, NOT a code tidy-up. Do not "fix" it in a refactor.

Caveat on this review

Another Claude Code session was writing to this working tree DURING the review — disciplines.ts (210→265 lines), events.ts (DisciplineAssessed), and a new screens/inspect/DisciplineAssess.tsx all landed mid-run at ~16:31. Line numbers touching those files may be stale, and the two failing suites above may be work-in-progress rather than landed defects. Everything else was reviewed against a stable tree.


§T · Handset defect pass — 2026-08-06

Session 0add9fc1 (Claude Code / Opus 5). Started and finished 2026-08-06 evening. Raised from four screenshots taken on minime (iPhone 12 mini, Field Agent com.cogneris.esgfield) after the 2026-08-06 install. Every item below is the operator's own words, and what was actually wrong underneath them.

Voice — the headline capability, and it had never loaded once

  • [x] "voice model is not working" — bundledStreamingModelDir() returned file:///var/.../sherpa-bundled/zipformer-en-stream/ and handed that URI straight to sherpa-onnx, which opens paths with native file APIs and does not understand a URI scheme. Every model file read as absent, createStreamingSTT threw, prepare() swallowed the throw. The sibling bundledWhisperModelDir() and ensureFilesDir() have both stripped the scheme since they were written; this was the ONLY path that did not — which is why the BATCH engine worked and the STREAMING engine, the one dictation actually uses, never loaded on any build. apps/esg-field/lib/audio/bundledModel.ts.
  • [x] The error message was the same sentence for four different faults. SherpaStreamingEngine.prepare() was declared prepare() — no arguments — while NoteCapture calls prepare({ onStatus }) and prints the last status as the reason. The callback went nowhere, so the generic fallback ("The speech model could not be loaded on this device") was the only string the operator could ever see. prepare now takes the callback, ensureEngine names the file / the path / the native error, and the screen prints it.
  • [x] "downloading model (first run, ~100MB)…" removed as the opening status. The model is inside the app; saying it is arriving over the network sends people to look at the WiFi.

The capture sheet (screenshot 3)

  • [x] "it needs padding at the top, i cant see the title (hidden by island)" — raised from inside a walk, CaptureFlow renders CaptureSheet inside a full-screen Modal, at the ROOT of the view hierarchy: no safe-area inset, no horizontal padding, and no background, so it drew as a white page in a dark app with the text against the edge of the glass. It now draws its own frame when — and only when — nothing else is hosting it.
  • [x] "have no functionality for voice or photo" — literally true. The sheet borrows the shell's centre microphone and says "hold the microphone at the bottom of the screen"; a full-screen modal COVERS the tab bar, so it was pointing at a control that was not on the screen. The sheet now draws its own push-to-talk slab and camera button in that case (showOwnControls).

The walk (screenshot 2)

  • [x] "selecting deficient and added a photo but do not see what I added" — the shot was captured, GPS-stamped and appended as PhotoCaptured correctly, and the walk never read it back. Photos are now folded by itemId and shown as thumbnails on the check they belong to. Regression test in screens/inspect/__tests__/LocationWalk.test.tsx.
  • [x] "there is a button that is redundant Raise NCR" — it opened the three-screen capture journey as a modal, which asked AGAIN for the evidence, the category, the severity and the site: every one of them answered on that card one tap earlier, with the camera and microphone directly above it. The button is gone. See "Decided" below.

The map (screenshot 1)

  • [x] "the names are too small to read" / "there is no streets displayed" — one bug, and it made both true. Every width and font size was divided by scale (the zoom) and then drawn inside a group scaled by fit * scale, where fit ≈ 0.3 on a phone. A 2.6-unit expressway rendered at 0.8 of a point; a 7.5-unit zone label rendered at 2.3 points. The data was all there and none of it was visible. Sizes are now divided by k — the full transform — so they are constant in SCREEN points at every zoom, and the road colours were lifted off the card background.
  • [x] The scale bar was lying — same class of error, found while fixing the above: it converted plan units with scale instead of k, so the "1 km" rule was about three times too long at the opening view.
  • [x] "i dont understand Corridor, Distric, and Street" → Whole site · Work areas · Close up, each labelled with what it draws.
  • [x] "the areas should be overlayedd on the map / those should be the drill dowwn" — they always were the drill-down; they did not look like anything. Named at EVERY level now, with a halo so the name survives being drawn over a road, a badge at 13pt, and a ring never smaller than a thumb.
  • [x] "the zoom in it not very functional, add + and - buttons" — done, 44pt, over the corner of the plan. Pinch still works.
  • [x] "when i drill down i should be able to see more info overlay of items to review" — the card gave a count ("9 checks apply here") and nothing else. It now names every check owed at that place, grouped by section.

Decided, so it is not re-argued

  • A deficiency recorded on a walk is NOT automatically an NCR ticket, and the walk no longer offers to raise one. The old reasoning — "two different acts, so two buttons" — was right that recording what was seen and committing somebody to a fix are different acts. It was wrong about how to offer the second one: a full-screen modal that re-asks the site, the category, the severity and the evidence is not a second act, it is the same act typed twice. Raising a ticket stays deliberate and stays at Home › NCR Tickets. Auto-raising was considered and rejected: NcrRaised requires a severity, the walk never asks for one, and inventing it would put a grade nobody chose on a ticket somebody has to action.
  • Map sizes are in SCREEN points, divided by k, never by scale. Anything drawn inside the transformed group and divided by scale will be invisible on a phone. This is the second time it has bitten; it is written down now.

Not fixed, and stated rather than implied

  • [!] Street NAMES are still not drawn. data/basemaps/*.json carries geometry and a class per way and no name tag at all — build-corridor-basemap.mts never kept one. Named streets need the basemap regenerating from an OSM extract with names retained. The roads themselves are now visible, which is what "geospatial referencing" needed first.
  • [!] Work areas are still CIRCLES, not surveyed polygons. corridorGeo.ts holds a centre and a radius per zone; there is no boundary geometry to draw. The plan says so on its face rather than implying a survey it does not have.

Measured 2026-08-06: tsc --noEmit clean, jest 233/233 green in apps/esg-field (was 230 — three added for the photo/NCR regressions).


§U · The night delivery actually worked — 2026-08-07

Session 0add9fc1 (Claude Code / Opus 5). 2026-08-06 evening → 2026-08-07 early. Continues §T. Everything below is measured on the handset or against production, never inferred.

The one that mattered

  • [x] FIRST OBSERVED END-TO-END DELIVERY FROM THE HANDSET. Three tickets raised on minime, held through three failed builds, delivered themselves unprompted within three seconds of launch: 03:35:46 996ccfe2 · 03:35:49 09e8d5a9 · 03:35:49 63a71a86, all Ontario Line, in production D1. Every previous row in that table had been replayed by hand. The delivery code was correct the whole time — see below for what was not.

Three faults that were mine, and the guard that ends them

  • [!] I shipped a build with no portal configured, THREE TIMES. The portal URL and device credential are inlined at BUILD time from EXPO_PUBLIC_PORTAL_URL / EXPO_PUBLIC_DEVICE_TOKEN. Every xcodebuild ran in a fresh shell, so an export from an earlier command was gone. The result is an app that works perfectly and is deliberately, correctly unable to talk to anything — visible only as one line nobody reads: [ncr] delivery skipped: no portal configured in this build. Each time, the obvious conclusion was that delivery was broken. It was never attempted.
  • [x] apps/esg-field/scripts/build-ios-device.sh — the guard. Reads the credential from the operator env file rather than from memory, then GREPS the built main.jsbundle for both values in ASCII and UTF-16 and REFUSES TO INSTALL if either is absent. A build that cannot prove it carries its configuration now fails at the desk instead of on a phone. Use it. Do not call xcodebuild directly.
  • [!] The deployed ESG_DEVICE_TOKENS did not match ~/foreman/.env. Production answered "That device credential is not recognised." to the recorded credential. Set from the env file 2026-08-07 (verified 200); the previously deployed value is gone and unrecoverable. Nothing was using it — the handset's build carried no token at all.
  • [x] The sweep now runs at launch. It ran in exactly two places: after a raise, and on mounting Submissions. So a ticket raised with no signal waited for someone to open one particular screen, and a phone that regained signal in a truck delivered nothing.

Voice: the crash, from the crash report rather than from a theory

  • [x] Root cause: the bundled streaming model was a zipformer2 and the binding can only load a zipformer (v1). react-native-sherpa-onnx@0.4.3 hardcodes config.model_config.model_type = "zipformer" for every transducer (ios/online_stt/sherpa-onnx-online-stt-wrapper.mm:165), overriding the model's own metadata. The v1 InitEncoder looks for attention_dims, does not find it, and sherpa-onnx's fatal path is a bare exit() — no exception, nothing to catch, the process simply leaves. Read off FieldIntelligenceAgency-2026-08-06-221833.ips: SIGABRT, faulting thread inside OnlineZipformerTransducerModel::InitEncoder. The Whisper teardown in that stack is collateral, not cause — exit() ran static destructors over a live recognizer and ReleaseEnv threw inside one.
  • [x] Swapped to sherpa-onnx-streaming-zipformer-en-2023-02-21 (v1, 127MB), generation verified by reading the encoder's own ONNX metadata, digests computed from the downloaded bytes, manifest re-pinned and verified against the files on disk.
  • [x] Chose the SMALLER v1 over en-2023-06-21 (187MB), deliberately. The streaming model drives the LIVE DISPLAY only; the accurate Whisper re-read of the same audio is what enters the record. 60MB of extra resident memory on a handset that raises memory warnings buys accuracy where it counts least. Four pinned constants to move up if the live text reads badly.
  • [x] Every streaming file now pins its byte length — and this nearly shipped broken. bundledModel.placeOne treats an already-unpacked file as good when the descriptor carries no bytes, and the streaming descriptors carried none. The phone had already unpacked the OLD model under exactly the filenames the new one uses, so the new build would have skipped the copy and loaded the crashing zipformer2 out of the cache with a bundle that was correct in every other respect.
  • [x] One resident recognizer, enforced (lib/audio/slot.ts). The launch warm-up held the batch Whisper for the life of the app and dictation loaded a second model on top. Registered engines release before a load; a live turn refuses, because a recording interrupted to free memory loses the evidence the memory was for.
  • [x] NoteCapture.stop() never stopped the microphone on the streaming path — it called finishNoteCapture and never stopAndTranscribe. The mic stayed open, the native stream was never released, and a third model was then loaded on top. finishNoteCapture now stops, releases, re-reads, releases again, in that order, in the one place that knows the order.

Evidence — the bytes now leave the handset

  • [x] R2 bucket esg-evidence created and bound to esg-web. Probed against production: store → duplicate:true on repeat with the same key → content type survives the listing → a browser can GET the object.
  • [x] include: ["httpMetadata"] is not optional. R2 omits it from a listing unless asked, so every object read contentType: null — and the console sorts evidence into photographs and recordings BY CONTENT TYPE. Every photo would have rendered as an untyped file link, looking like damaged evidence rather than a missing list option. Caught by probing, not by reading.
  • [x] NCR photos were being kept as Library/Caches/Camera/… — storage iOS reclaims from apps that are not running. The ticket's only photograph was one memory-pressure event away from being a path to nothing while the record still claimed a photo existed. retainPhoto() copies into Documents/ first, as the walk's photo path always has.

The outbound queue is now one queue

  • [!] The defect that forced it: evidence uploaded only in the branch where a ticket was delivered IN THAT SAME SWEEP. Every already-delivered ticket was filtered out of pending before the upload code was reached, so its files could never be sent. Four delivered tickets, zero objects in the bucket, no [evidence] line in the device log at all. The cause was not the branch. Evidence had no state of its own — "delivered ticket, undelivered photograph" was a state the system could not represent and therefore could not recover from.
  • [x] lib/sync/outbound.ts — one row per outbound act, dispatched by kind (ncr · evidence · inspection) over the sync_queue that was already polymorphic. One row PER FILE, with its own attempts, backoff and error.
  • [x] defer — a third outcome, and the one that was missing. A file waiting for its ticket to be acknowledged has not FAILED at anything; charging it an attempt would back it off to five-minute intervals for a reason that has nothing to do with the file. Deferring costs no attempt.
  • [x] reconcileOutbound repairs history. It enqueues a row for every file of every ticket that lacks one, whatever the ticket's state — which is what fixes the tickets already on the handset. Nothing is migrated; the sweep finds them.

In-progress inspections now reach the portal

  • [x] A walk is delivered while it is still being walked. It only reached the portal at sign-off, so a walk abandoned at six of ten places existed nowhere but on the handset, and a console reader could not tell that from nobody having gone.
  • [x] The receiver's insert-once rule grew a revision. Accept an update only when the incoming revision is STRICTLY GREATER. A replay carries the same revision and still returns the original receipt, so the retry-safety the device depends on is untouched. received_at and receipt_id are never restamped — first arrival owns them.
  • [x] A signed record is terminal. Nothing later moves it back to in-progress. Pinned in tests/inspectionRevision.test.ts.
  • [x] The console says so. An unfinished record leads with "This inspection is not finished… anything not yet recorded is NOT YET VISITED — it is not a pass", and shows first-received against last-updated so a live walk is distinguishable from an abandoned one.

Decided, so it is not re-argued

  • Never call xcodebuild directly for a device build. Use scripts/build-ios-device.sh. Three silent config-less builds in one evening is the evidence; the guard is cheap and it fails loudly.
  • Map sizes are in SCREEN points, divided by k, never by scale (§T, and it bit twice).
  • The streaming model's GENERATION is a checkable fact, not a filename. SHERPA_STREAMING_MODEL.family vs BINDING_TRANSDUCER_FAMILY, compared at runtime by streamingCanLoad(). A model the binding cannot load takes the app down with exit(), which no try can catch — so it must be refused BEFORE the native call, on facts about the artefacts.
  • Evidence is uploaded, never moved. The handset keeps its own copy; an upload is a second home. Deleting after upload is a separate decision nobody has made.
  • Both ends of evidence are WRITE-ONCE. A repeat returns duplicate: true and the same key. The inline fast path in lib/ncr/delivery.ts and the queue row can therefore race at most to one wasted request, never to a double store.

Open, and stated rather than implied

  • [!] Chain of custody does not exist. Events carry no hash and no signature; one shared credential identifies the BUILD, not the handset; authorship is a display string. Append-only is true of the code's behaviour and is not enforceable against database access. "Tamper-proof" must not be claimed. Decision docs written 2026-08-07: CognerisDocs/ESG/Chain_of_Custody_Decision_2026-08-07.md and two CognerisDocs-IP/Sequents-IP/ companions. CC-1 (key recovery) blocks enrolment and cannot be retrofitted onto issued keys.
  • [!] A missing evidence file retries for ever. The queue has no terminal state, and inventing one here would be a schema change in the wrong place. The error text is honest; an abandoned status belongs to the queue's own slice.
  • [ ] Portal-side sign-off is not built. Delivery of an in-progress walk is; signing it from the console is a separate piece with its own authority question — see the chain-of-command doc.
  • [ ] Dictated notes still do not reach the portal in the submission payload.
  • [!] bpe.model is still inside the built .app though deleted from the tree — Xcode's incremental copy does not remove it. Nothing reads it; a clean build clears it.

Measured 2026-08-07: tsc --noEmit clean on both; apps/esg-field jest 259/259; console npm test 74/74.


Review remediation — executing docs/REVIEW-codex-2026-08-06.md, 2026-08-07

Session e36ef25c (Claude Code / Opus 5). Started and finished 2026-08-07 morning.

Verified green at the end of this work: console tsc 0 errors · console npm test 74/74 · apps/esg-field tsc 0 errors · apps/esg-field jest 290/290.

Done by this session

  • [x] B5 — the console now inherits the project's strictness. tsconfig.json extends tsconfig.base.json. exactOptionalPropertyTypes was OFF for all of app/; turning it on surfaced 29 real errors, all fixed by widening the declarations where "absent" and "undefined" genuinely mean one thing (Infraction.audioUrl/audioMs/summary/locationId, ConvTurn.tone, PageHeader.subtitle, Stat.hint/tone, VoiceNotePlayer.ms, AgentConsole.questions, QueryResult, dashboard filter props, ChatTurn, agent-console sessionId).
  • [x] A10 — a walk no longer shows another inspection's notes. The note fold filtered on event type alone; control-area ids are stable across walks, so the second inspection of any site replayed the first one's recordings under its own places. Regression test added AND PROVEN to fail without the fix ("2 notes here", foreign text, playback button).
  • [x] A2 — the closing tone no longer lands in the recording. It was played before the call that stops the mic, under a comment claiming the mic was already released. The engine now fires an onMicStopped seam at the only correct moment, and the screen chimes from there.
  • [x] A3 — unmounting mid-preparation cannot leave a hot microphone. New preparingRef claims the engine the instant it exists (engineRef is only set after four awaits), tear-down clears heldRef, and every await re-checks mounted/held.
  • [x] C1 — a failed startRecording puts everything back. New releaseCaptureResources() shared by the failure path, cancel() and the note teardown.
  • [x] C2 — a recorder opened for a mic that never started is now closed, on both the !ok and throwing paths.
  • [x] C3 — cancel() closes the note recorder. New discardNoteCapture() finalises the WAV header so an abandoned turn is a short recording, not a file needing rescue at next launch.
  • [x] F1 — "Refined by…" can actually appear. setRefinedBy(null) in the finally erased the provenance in the same tick it was set, so the panel the worklist claimed this screen shows could never render. Cleared at the START of the next turn instead.
  • [x] A7 — re-recording a legacy section no longer erases its deficiencies. The draft is cleared on commit while answeredIn still counts committed items, so a second press serialised an empty list and derived pass. Committed answers are now the base, the draft the overlay.
  • [x] E6 — slide-to-lock sets lockedRef synchronously, so an immediate release no longer stops the turn the operator just locked.
  • [x] E4 — notePlayer rewritten around a generation counter. stopNote() cleared onEnd before firing it, so a note taken over by another never told its row to stop saying "playing" — the exact case its own doc comment promised. Overlapping plays also raced through the shared globals.
  • [x] A15 — withObservedStages uses has, not ??. An observed-but-unknown stage is a present key holding null; ?? fell through it to the seeded guess the walk was correcting.
  • [x] F8 — the false LIVE badge is gone. PROJECTS is authored data in data/projects.ts; a green dot, the word LIVE and "Updated just now" were three trust signals over a static register. Now reads the client name + "Project register", in muted, not pass-green.
  • [x] F10 — an unclassified finding is recorded as unclassified. Two capture paths wrote severity: "medium" under a comment saying severity was a later pass that does not exist. IssueLogged.severity is now optional (additive on disk: an omitted key), and the report prints "Unclassified" instead of a judgement nobody made.
  • [x] G2 — the console site map's discipline filter now applies to zone and asset focus lists, not just the all-site list.
  • [x] D5 — the audio lifecycle has tests at last. New screens/capture/__tests__/noteLifecycle.test.tsx: a fake engine with an observable call order and deferred promises. 3 of its 5 specs were proven to fail against the pre-fix code, and the chime-ordering spec was proven to fail against the pre-fix chime placement.

Already fixed by a peer session before this one started — verified, not re-done

  • [x] The two red suites from the review (durability missing a DisciplineAssessed draft; disciplines asserting the old safety wording).
  • [x] A5 — SiteMapView geometry and basemap are keyed by projectId (CORRIDORS[projectId]), with an honest empty state instead of somebody else's alignment.
  • [x] A9 — sign-off coverage folds foldCoverage for location records instead of SECTIONS.length, so a completed walk no longer presents as 0/9.
  • [x] C8 — the sync endpoint is resolved and has its own spec (lib/sync/__tests__/syncEndpoint.test.ts).

[!] NOT done — open, with the reason

  • [!] noUncheckedIndexedAccess is OFF for the console, deliberately and in writing. It is ON in tsconfig.base.json and explicitly disabled in app/'s config with a comment saying why. Turning it on surfaces 160 real errors — every one a genuine unguarded index. That is its own piece of work, not a side effect of the tsconfig change, and doing it as a bulk rewrite while other sessions are editing this tree would have collided with them. Deleting that line without doing the work is the same as deciding the 160 do not matter.
  • [!] B1/B2/B3 (discipline fold contracts) — the fold still ignores frameworkId/frameworkVersion and accepts any itemId, asset items still collapse to one shared verdict, and the development lane still passes an empty asset-kind list. These need a register-shaped decision, not a patch.
  • [!] B6 (10 device zones vs 7 console zones) and G1 (one canonical geometry/asset registry) — untouched. tests/registers.test.ts still asserts SUBSET rather than equality, which is what let the drift through and will let the next one through.
  • [!] A12 (D1 idempotency check-then-insert race) and B9 (persisted JSON trusted after Array.isArray) — untouched.
  • [!] A6 (photos discard locationId), A8 (legacy voice grammar on location walks), A11 (multi-turn notes overwrite audioUri), A13/F5 (console finding saved with no place), A14, A16, A17, A18 — untouched.
  • [!] E1 (SiteMapView re-renders up to 3,803 SVG paths per pan/zoom) — untouched, and the most likely thing to be VISIBLE on a handset.
  • [!] D2/D3 (subset-not-equality register test; the "concurrent" persistence test that is not concurrent) — untouched.
  • [!] F2/F3/F4/F6/F7 worklist honesty items — the earlier entries in this file still overstate what works. Not rewritten here: several were already overtaken by peer sessions during the review itself, and rewriting another session's entries is against the convention at the top of this file. They need their authors.

Decided, so it is not re-argued

  • Optional props were widened to ?: T | undefined rather than conditionally spread at every call site. Under exactOptionalPropertyTypes the flag's value is catching the cases where absent and undefined are DIFFERENT. For a UI prop like hint or ms, or a database row that yields undefined for a null column, they are the same fact, and writing that out keeps the compiler useful everywhere it still matters.
  • IssueLogged.severity was made OPTIONAL rather than adding "unclassified" to IssueSeverity. That union is the vocabulary a human picks from; adding a value nobody can choose would push the same untruth into every severity picker and rank table in the app.

Caveat

This tree is being edited by several sessions at once. The reviewed work was committed as fa1e7c8 at 10:14 on 2026-08-07, and peer sessions added ReviewInspectionGate.test.tsx, syncEndpoint.test.ts, ProjectSummary.tsx and InProgressTab.tsx while this remediation ran. Nothing here was committed — the changes are in the working tree for review.


Review remediation, round 2 — 2026-08-07 (same session e36ef25c)

Verified green at the end: console tsc 0 · console tests 76/76 · apps/esg-field tsc 0 · apps/esg-field jest 306/306.

Done

  • [x] A12 — the D1 delivery race no longer answers from local variables. SELECT then INSERT OR IGNORE is not atomic; two racing deliveries could both miss the select, and the loser returned stored: true with a received_at matching no row in the table. The insert is now followed by a canonical read-back, and the answer names the filing that actually exists. (receipt_id is derived from the id, so both racers always agreed on it — which is why this hid for so long.)
  • [x] A6 — a photograph can say where it was taken. PhotoCaptured gains locationId (additive), threaded through the camera stage and savePhoto. The walk's read-back is keyed by place AND check, so a check binding at four places no longer shows all four sets of evidence at every one. Unplaced photos are still shown everywhere they bind — hiding old evidence because it cannot prove its location would be the worse trade. Spec added.
  • [x] A8 — the legacy voice grammar is no longer reachable on a location-bound walk. It writes AreaInspected; a location walk writes LocationInspected. One spoken "pass" mixed the generations, foldCoverage reported mixed, and the walk could never be completed — with nothing on screen explaining why. The mic is simply not offered there, which is the honest version of "this does not work yet".
  • [x] A13/F5 — the console enforces its own invariants at save. A finding could be saved with no place at a site that has a place register, and with a category the current place does not carry. Changing place now re-derives the category; save() checks both rather than trusting what the chips happen to render.
  • [x] A14 — a correction inside one walk is no longer a permanent regression. Every observation was folded, so a mis-entry fixed a minute later left a regressed signal its own correction could not clear; the stall detector also read find — the FIRST observation. Collapsed to the last observation per walk, in BOTH copies (a code-for-code mirror test binds them). Spec added and proven to fail against the old fold; a genuine regression across two walks still fires.
  • [x] B6/F4 — the console draws all ten Ontario Line zones. The three it could not place are brought across from the device register, which had already solved them from real published station points rather than the chainage guesses that got them removed. UNDRAWN_ON_PLAN for PRJ-ontario is now empty, and that emptiness is checked rather than asserted.
  • [x] D2 — the register test asserts geometry EQUALITY, not a subset. A smaller table is a valid subset, which is precisely why 7-vs-10 stayed green for weeks while this file was cited as proof the copies agreed. Proven: deleting one console zone now fails the new test while the old subset test stays green.
  • [x] B9 — persisted and delivered JSON is validated element by element. Array.isArray proved only the container: a signatures array holding [null] or [{}] produced signers with no name, duplicate undefined React keys, and — worst — a malformed element that COUNTED toward "this record was signed". The delivered-record page likewise filtered walked/notReached, and now states how many entries it could not read instead of quietly shrinking the count.
  • [x] C9 — a broken local store is no longer indistinguishable from an empty one. Any failure became [], so a corrupt database told the arrivals page that nothing had been submitted. "Nothing arrived" is the most dangerous wrong answer this console can give, because it looks like a quiet day. Absence of a store is still silent; a store that is present and failing is reported.
  • [x] C10 — a 500 is no longer read as a first run. res.json() succeeds on an error body, so a failing server emptied the findings list with no indication anything was wrong — on the one screen whose job is "what have we recorded here". Status and shape are both checked now.
  • [x] D3 — the "real concurrent inserts" test no longer claims to be concurrent. insertFinding is synchronous, so twelve Promise.resolve().then(...) calls run one after another; the same assertions pass against a plain for loop. Renamed to what it actually proves, with the uncovered case (two processes writing one database) stated plainly.

[!] Still open — with the reason

  • [!] noUncheckedIndexedAccess OFF for the console — 160 real errors. Unchanged from round 1, still documented in tsconfig.json. Its own piece of work.
  • [!] A11 — a multi-turn note keeps only the last turn's recording. DEFERRED DELIBERATELY, not forgotten: the fix needs NoteCapture + events.ts + TaskFlow.tsx changed together, and TaskFlow.tsx was being written by another session throughout this work. A half-applied multi-file change across a file in flight is worse than none. Pick this up when the tree is quiet.
  • [!] B1/B2/B3 — the discipline fold ignores frameworkId/frameworkVersion, accepts any itemId, collapses asset items to one shared verdict, and passes an empty asset-kind list. Needs a register-shaped decision, not a patch.
  • [!] G1 — geometry and assets are still two hand-maintained copies. B6 fixed the instance; the duplication is the defect. Equality is now asserted for geometry, so the next divergence fails a build — that is a guard, not a fix.
  • [!] B7 — AST-OL-WASH-3 device/console divergence remains a deliberate register decision awaiting an owner (see "Decided" in the previous entry). The register test's honest-limits note now names it explicitly rather than leaving it as an unexplained gap.
  • [!] E1 — SiteMapView re-renders up to 3,803 SVG paths per pan/zoom. Untouched. The most likely finding to be VISIBLE on a handset.
  • [!] A16, A17, A18 — untouched.
  • [!] F2/F3/F6/F7 worklist honesty items — still need their authors; F4 is resolved by B6 above.

Note on working alongside other sessions

apps/esg-field/screens/inspect/{TaskFlow,LocationWalk}.tsx and lib/sync/outbox.ts were being edited by another session throughout. At one point the tree typechecked with six errors that were neither mine nor in HEAD — call sites written before their import. I stopped editing those two files, verified my own changes survived, and moved to console-side work; the peer's edit landed clean and the full suite is green. Nothing here has been committed.


Review remediation, round 3 — the outstanding list closed, 2026-08-07

Session e36ef25c (Claude Code / Opus 5). The tree was quiet throughout this round.

Verified green at the end: console tsc 0 with noUncheckedIndexedAccess ON · console tests 78/78 · pnpm check:mirrors clean · apps/esg-field tsc 0 · apps/esg-field jest 313/313.

Done

  • [x] A11 — a multi-turn note keeps every turn's recording. NoteRecorded gains audioUris (additive; audioUri stays as the first element for readers that know one). The words already accumulated across turns and the audio did not, so a two-turn note carried both turns' words and evidence for only the last — which is the first turn, spoken before the operator had settled on their words, and therefore the one most likely to need checking. The walk offers one control per turn. Two specs, including one for notes written before the field existed.
  • [x] A16 — the shell can see a newly created aggregate. New onTaskCreated seam. flowHasWritten read the shell's taskId, which stays null for a NEW task, so a walk that had opened a record, walked three places and photographed two still offered "abandon" over durable events.
  • [x] A17 — the spoken exit goes through the same confirmation as the ✕. "Close the inspection" called closeFlow() directly: the one exit that cannot be undone was the one with no question attached.
  • [x] A18 — the site-wide card shows draft progress beside committed. The hardcoded 0/N was already gone; three-of-four answered and collapsed still showed no trace of the three.
  • [x] B1 — the discipline fold honours framework id AND version, and only planned items. A stale answer counted toward today's coverage, and an unplanned itemId counted too — which is how "10 of 9 answered" was reachable. Neither is silently dropped: both are counted and stated.
  • [x] B2 — an asset item is one question PER ASSET, in the fold and on the screen. East Harbour has two fuel-storage assets; hs-7 was one row and one shared verdict, so checking one reported both. Coverage is keyed by item AND asset, the screen renders a row per asset with its tag, and the response carries assetId.
  • [x] B3 — the development lane sees the same asset register the screen does. It passed [], so a pm-* item scoped to an asset kind was offered, recorded, and then left out of the lane's denominator: the answer existed and the question did not.
  • [x] C4 — the assessment sheet closes only after the append lands. It closed first, so a failed write returned the assessor to the walk with every answer gone.
  • [x] C5 — a deficiency cannot be recorded without a description. The screen said so in a comment and enforced nothing.
  • [x] Last-answer-wins in the fold (>=, not >): an assessor who corrected themselves before pressing Record had the correction discarded and the mistake kept.
  • [x] E1 — the map no longer rebuilds the city on every frame. The PanResponder depended on [zoom, pan] and was rebuilt on every gesture frame; the 3,803-path basemap was rebuilt on every render, including every frame of a pan. The responder now reads the view from a ref (deps []), and the ground layer is memoised on [level, k] — a pan changes one transform attribute and nothing else, because everything sits inside one <G transform>.
  • [x] noUncheckedIndexedAccess IS ON for the console, with 0 errors. All 160 fixed, and deliberately NOT with 160 assertions: · registers whose [0] is a documented fallback are typed non-empty (SITE_PLANS, SitePlan.views, LEVELS, CATEGORIES, CAPTURE_SITES, the label tries); · provably in-bounds geometry loops go through nth(), which THROWS — a corridor drawn from a wrong index is worse than a crash; · genuinely fallible lookups are guarded and state the absence (caseFor returns null and the compliance page renders "not opened", because an obligation with no case is not an obligation with a clean one); · dev-ip-bypass.ts and admin-access.ts fail CLOSED — these decide whether a request bypasses authentication, and "cannot tell" must never read as "yes".
  • [x] G1 — scripts/sync-device-mirrors.mjs makes "GENERATED" true. Both device data files claimed to be generated and nothing generated them. pnpm sync:mirrors rewrites the mirrored array bodies from the console; pnpm check:mirrors fails when they part. Comments are compared as comments, not data, so each surface keeps its own prose. Proven: a one-digit edit to the device file fails both the check and the register test, and the generator repairs it.
  • [x] B7 — asset placement is reconciled, with divergences PINNED rather than decided. Pete's call (2026-08-07): leave the values, add the guard. Two new tests; the second asserts every pin still describes the files, because a stale pin is worse than no pin.

[!] Two asset divergences are PINNED and need a register owner

Neither is a code defect and neither may be "tidied up" in a refactor — both decide which control area a thing belongs to, and therefore what a past inspection of that area was taken to cover.

  • [!] AST-OL-WASH-3 — console z-ol-donvalley, device z-ol-thorncliffe. Deliberate and documented at app/lib/sitePlans.ts. INS-0519 references it under Don valley.
  • [!] AST-OL-SK-6 — console z-ol-eastharbour, device z-ol-lakeshore. UNDOCUMENTED, and found by the new test the first time it ran. Nothing anywhere argues for either value. The label is "Spill kit 6, rail adjacency" and z-ol-lakeshore IS the rail-adjacency zone, so the CONSOLE is the likely error — but that is a reading, not a decision.

Still not covered, stated plainly

  • The two registers are not required to hold the same SET of assets; the console carries some the device does not. Whether it should is a separate question from where they stand, and is unchecked.
  • A single shared geometry module (rather than a generator) needs Metro watchFolders — the device's projectRoot is apps/esg-field and an import reaching into app/ does not resolve. That is a build change that has to be proved on a real device build, not asserted here.
  • Nothing in this session has been run on a handset. Every finding and every fix is static analysis plus the local suites above.

Nothing in rounds 1–3 has been committed. The changes are in the working tree.


Round 4 — the asset registers reconciled, 2026-08-07

Session e36ef25c. Green: console tsc 0 (noUncheckedIndexedAccess ON) · console tests 79/79 · check:mirrors clean · apps/esg-field tsc 0 · jest 313/313.

  • [x] The two registers now hold the SAME SET of assets, and it is asserted. Placement was reconciled in round 3; membership was not. Two assets existed on the device and not on the console — AST-OL-SILT-4 and AST-OL-NEST-1, both at Flemingdon Park. That is the control area the console could not draw at all until earlier today, so its asset table had never been extended there: the same place showed a silt fence and a nesting-bird survey point on a handset and neither on the console. Two things somebody is meant to inspect, invisible on the surface a director reads. Both added to app/lib/sitePlans.ts with the device's ids, tags, labels and kinds unchanged; like every other asset there they have no surveyed position and fall back to the control-area centre. Proven: deleting one console asset fails the new test. The test also asserts its own parse is complete, so it cannot pass by matching a subset.

CORRECTION to round 3's note

Round 3 recorded that "the console carries assets the device does not". That was backwards — it was the device that carried two the console lacked, and the count was 61 console / 63 device. The statement is superseded by the reconciliation above; the earlier line stays in place rather than being edited, per the convention at the top of this file.

[!] Still open, and genuinely not mine to close

  • [!] AST-OL-SK-6 needs a register owner. Console z-ol-eastharbour, device z-ol-lakeshore, undocumented — found by the round-3 test on its first run. The label is "Spill kit 6, rail adjacency" and z-ol-lakeshore IS the rail-adjacency zone, so the console looks like the error. Pinned and tracked; NOT corrected, because which control area a spill kit belongs to decides what a past inspection of either area was taken to cover.
  • [!] AST-OL-WASH-3 — the documented divergence, decided by Pete on 2026-08-07: leave the values, add the guard. Pinned.
  • [!] One shared geometry MODULE (rather than a generator) is deliberately NOT done. It needs Metro watchFolders pointing at the repo root, and this repo has node_modules at the root AND in apps/esg-field — the standard hazard there is the bundle resolving two copies of React. That is a build change that can only be proved by a real device build, and the drift it would prevent is already prevented by scripts/sync-device-mirrors.mjs plus an equality test, both proven. Removing a working guard to take on an unverifiable build risk is the wrong trade; revisit when someone can run the bundle.
  • [!] Nothing in rounds 1–4 has been run on a handset. Every fix is static analysis plus the local suites named above.

§V · Close-out — 2026-08-07

Session 0add9fc1 (Claude Code / Opus 5). Continues §T and §U. Written at the end of the session so the next one starts from what is TRUE, not from what was intended.

Proven in production, by reading it rather than trusting the write path

  • [x] NCR delivery from the handset. 12 tickets in D1; three of them posted by the phone itself, unprompted, within three seconds of launch. Previously every row had been replayed by hand.
  • [x] Inspection delivery, and it arrives IN PROGRESS. 2 records, state = in-progress, revisions 4 and 9. A walk now reaches the portal while it is still being walked, which is what was asked for.
  • [x] Evidence chain live end to end — bucket bound, upload/serve routes, write-once verified, content-type survives the listing, browser can read the object. Real evidence has still never been uploaded — see below.

Two defects found by reading production, not by reasoning

  • [x] Column defaults froze two live records. state/revision were added by ALTER with DEFAULT 'signed'/0 — correct for rows delivered before in-progress existed, WRONG for rows written by a Worker predating the new INSERT. Those wrote only the original twelve columns, so the defaults landed on bodies whose own payload read "state":"in-progress". Because the supersede rule treats signed as TERMINAL, both half-walked inspections could never be updated again — the device would keep delivering and the console would keep refusing, silently and for ever. Both displayed as completed inspections with zero findings. The payload now wins where it speaks, in the reader AND the supersede comparison. Columns stay as a queryable projection, not an authority. The two rows repaired in place from their own payloads. 9c027ef.
  • [x] A stored file path outlives the sandbox that named it. The evidence sweep reported ten files "not on this device any more"; all ten were intact in the current container under the same names. iOS changes the app's data-container UUID on reinstall, and the log holds ABSOLUTE paths — four different container ids in one evening. Re-rooted at READ time, permanently, because the log is append-only and those events are history. It never searches and never matches on filename alone. bc7c5ac.

The build script earned its keep twice, and then failed for a third reason

  • [x] It caught a build with no JS bundle. ** BUILD SUCCEEDED ** followed by FAIL: no main.jsbundle. The guard refused to install. The cause was that the script HARDCODED FieldIntelligenceAgency.app and the product had been renamed to FieldAgent.app — so it was checking a path that no longer existed. It now FINDS the .app rather than naming it, and echoes the path it found. A script that knows the product name breaks the day the name changes.
  • [!] TWO "Field Agent" APPS ON THE PHONE AGAIN, and this is a divergence worth watching. app.config.js declares the inspect variant DELETED and the bundle id com.cogneris.esgfield; the native Xcode project still carried PRODUCT_BUNDLE_IDENTIFIER = com.cogneris.esginspect. So a device build installed a SECOND app wearing the same display name. The pbxproj is repointed to esgfield; the stray esginspect install should be removed from the handset. app.config.js and the pbxproj are two sources of truth for one fact. Prebuild regenerates the native project from the config; a hand-edited native project silently disagrees. Decide which is authoritative.

NOT DONE, and this is the part to read first

  • [!] NO REAL PHOTOGRAPH OR RECORDING HAS EVER REACHED R2. Everything is built, deployed and probed; the resolver build was never launched on an unlocked handset. The ten files are intact on the phone and the queue rows exist. One launch of a build containing lib/files/resolve should send them. This is the single outstanding action.
  • [!] NOTHING ON THE HANDSET IS HUMAN-VERIFIED. Live dictation after the v1 model swap, the Classify→Record reorder, the map fixes — all confirmed only from bundles, logs and production reads. Nobody has used it.
  • [!] Chain of custody does not exist. No hashes, no signatures on events; one shared credential identifies the BUILD not the handset; authorship is a display string. Append-only is true of the code's behaviour and is not enforceable against database access. "Tamper-proof" must not be claimed. Blocked on CC-1 (key recovery) and CC-5 (does a signature name the handset or the inspector) — neither can be retrofitted onto issued keys. Docs: CognerisDocs/ESG/Chain_of_Custody_Decision_2026-08-07.md, CognerisDocs-IP/Sequents-IP/Chain_of_Custody_Signed_Ledger_and_Device_Identity_2026-08-07.md, CognerisDocs-IP/Sequents-IP/Chain_of_Command_and_Multi_Level_Security_2026-08-07.md, CognerisDocs/Strategic/Classified_Handling_Ladder_and_Sovereign_Hardware_Partnerships_2026-08-07.md.
  • [ ] Dictated notes still absent from the submission payload.
  • [ ] Portal-side sign-off not built — needs CC-5 answered first.
  • [?] A health inspection row appeared and vanished. Seen at 22:38:13Z with site_name = "health"; minutes later the count went 3 → 2 and no trace remained in either table. Something wrote it and removed it. Unexplained — worth knowing whether a monitor posts to /api/inspections.

The next session's first move

cd apps/esg-field && ./scripts/build-ios-device.sh   # refuses to install a config-less build
xcrun devicectl device install app --device <id> "<the APP= path it echoes>"
xcrun devicectl device process launch --device <id> --terminate-existing com.cogneris.esgfield

Then read Documents/diag.log off the device and count objects in R2. Expect [evidence] re-rooted … lines and ten objects. Do not call xcodebuild directly — three config-less builds shipped that way in one evening.

Measured 2026-08-07: tsc --noEmit clean on both; apps/esg-field jest 313/313; console npm test 83/83; console deployed e63c3239.


§W · The four open items, closed or named — 2026-08-08

Session 0add9fc1 (Claude Code / Opus 5). Addresses §V's "read this first".

1 · EVIDENCE REACHES THE PORTAL. PROVEN.

  • [x] Ten real objects in R2, uploaded 2026-08-08T00:40:52–57Z across four tickets. Verified as bytes, not as a status: 1920x888 JPEG, JFIF, Exif · 323,586 bytes · served image/jpeg RIFF (little-endian) WAVE audio · 364,724 bytes · served audio/wav Readable by a browser with no credential (behind Access, by design).
  • [!] MY VERIFICATION WAS WRONG, NOT THE APP. I reported "R2 OBJECTS: 0" three times. The shell loop swallowed an empty id list and printed zero, so I told the operator evidence had never arrived while it had already uploaded. The app was right and the check was broken. Both times something misled me tonight it was a log line or a probe; both times the fix was querying the thing itself. Query the object, not the counter.
  • [x] last_error is now cleared on success. Ten rows that had uploaded perfectly still read "…is not on this device any more" — the stale text of a previous attempt. Anyone reading the queue would have concluded the evidence failed. A row that succeeded has no error.
  • [x] The stale-sandbox resolver is what made it work: the log's absolute paths named four dead containers. [stt]/[evidence] breadcrumbs confirmed it.

2 · VOICE LOADS. The v1 swap is confirmed on the handset.

  • [x] [stt] streaming init: dir=…/sherpa-bundled/zipformer-en-stream/ provider=cpu threads=4 → [stt] streaming recognizer ready in 0.65s. The exit() crash is gone and streaming is the warm-up engine.
  • [!] Still not human-verified: whether live partial words actually appear while speaking. The model loading is necessary, not sufficient.

3 · THE health ROW — explained as far as it can be, and it exposed a real gap

  • [x] Nothing in the code can delete a delivered inspection. No DELETE FROM delivered_inspections exists anywhere; /api/admin is read-only. So the row was removed BY HAND — almost certainly the parallel session clearing a test record. Not reproducible and not a defect. Recorded rather than explained away.
  • [!] THE REAL FINDING: every delivered inspection has an EMPTY site_id. Both surviving rows read site_id = ''. The receiver does siteId: typeof payload.siteId === "string" ? payload.siteId : "" — and the device's InspectionSubmission has no siteId field at all. It carries siteName and templateId only, because (correctly, per the note in lib/sync/outbox.ts) the log genuinely holds no site id for an inspection — InspectionCreated records a name and a template, and putting the template id in a field called siteId would be a fabrication. Consequence: no delivered inspection is tied to a project. The console can only match on a display name, which is unvalidated and can be typed. A row named health with no project is exactly what that permits. This is a log-vocabulary gap, not a receiver bug, and it has to be fixed in InspectionCreated — which is an append-only event, so the change is additive and old events stay site-id-less for ever.

4 · CHAIN OF CUSTODY — still blocked, and only on decisions

  • [!] Unchanged and unchangeable by engineering alone: CC-1 (key recovery) and CC-5 (does a signature name the handset or the inspector). Neither can be retrofitted onto issued keys. Everything else in the four decision docs follows from them. "Tamper-proof" must not be claimed.

Also done

  • [x] The duplicate app is gone. com.cogneris.esginspect uninstalled; the handset carries one Field Agent (com.cogneris.esgfield), and the pbxproj now agrees with app.config.js.
  • [x] ui/__tests__/oscilloscope.test.tsx typecheck repaired — indexed access is number | undefined under noUncheckedIndexedAccess. Asserted rather than cast: a missing bar means the scope drew fewer than it claims, which is a real failure and should report as one.

Measured 2026-08-08: tsc --noEmit clean on both; apps/esg-field jest 334/334; console npm test 83/83. Ten evidence objects live in R2.


Enterprise conformance — the domain freeze — 2026-08-10

Claude Opus 5 (Claude Code, session 6329d011). Audit and plan of record: CognerisDocs/ESG/ESG_Enterprise_Conformance_and_Execution_Plan_2026-08-10.md. That document specifies no architecture — the TSD already does, in 16 sections, and writing a second would repeat an error this estate has paid for twice. It is a conformance picture and an execution sequence, nothing more.

The finding

The root console imports @esg/* exactly zero times. app/lib holds 40 domain-bearing files; packages/ holds 16 packages; the same concepts — obligation, inspection, evidence, capture, report — are implemented on both sides with no shared code. The console is the reference web app the packages are ported from (several manifests say so), and it is also what is deployed as esg-web. That is the actual condition: not two rival lines, but a port that stalled with the source still in production.

Everything TSD §10 asks for exists — the repo, 16 packages, 12 isolated workers, the RN field app, turbo, isolation CI — except the Vite manager module on the shared console platform (decision #9), which does not exist at all.

  • [x] E-1 · Freeze app/lib. scripts/verify-domain-freeze.mjs + app/lib/domain-debt.json, wired into the CI fence job (e099e32). A ratchet, not a snapshot: an unlisted file in app/lib fails, and a ledger entry whose file is gone also fails, so the count cannot drift in the flattering direction. Deleting a line is not a way around it — the file is then unlisted and fails. 40 files owed, 26 without a decided target. Verified by adding a file to the real tree and watching CI fail.

Corrections to this session's own audit — both found by verifying

  • app/v2, app/demoapp and app/vui are NOT dead weight. The audit listed them as removable iterations (~6,000 lines). They are live and cross-linked: /v2/library is the documentation surface scripts/build-library.mjs generates, /v2/roles is reachable from it, and /vui is linked from app/my-work. Deleting them would have removed working product. The finding was wrong; nothing was deleted.
  • The migrations were NOT renumbered. The plan called the two 0001_* files a cheap fix. They are not: there is no migrations_dir in wrangler.jsonc and no d1 migrations apply anywhere in the repo or CI, so the schema is applied by hand and nothing records what is live. Renaming a migration that has already been applied is how a working database breaks. Left alone deliberately — the safe fix is a uniqueness guard for future migrations plus a note recording that both 0001s are applied, not a rename.

NOT true — do not claim otherwise

  • Nothing has been ported. E-1 changes no domain code and moves no file. It makes the number honest and stops it rising. The 40 files are the work.
  • The audit was entirely static. The app was not run, no deployment was inspected, no D1 was queried, and the 12 workers were sized but not assessed.
  • "Zero @esg/* imports" is a grep result. Well-supported, not exhaustive: a dynamic import or re-export chain would not have been caught.
  • The event store is still unwired — 29 KB of schema across 0001_event_store.sql and 0002_event_chains.sql, queried once, in a generated file. TSD §8's defensibility chain rests on it. Until it is wired, those claims must not be made to a client.
  • Tenancy is still near-absent — 4 files reference tenant/org against TSD §8's session-JWT with tenant claims and per-project/site query scoping.
  • This branch is 148 commits ahead of main, because it was cut from feat/rn-app-parity. A PR to main from here carries all of that work too.

_Signed: Claude Opus 5 (1M context), session 6329d011, 2026-08-10._