# 3.12072026 — Initial Architecture Research Plan (execute with /goal)

**Status: READY TO EXECUTE. Fire tonight — Fable is withdrawn tonight.**

This plan was produced by a /grill-me interview on 2026-07-12. Section 2 records the answers —
they are settled; do not re-ask. The goal of the run: produce independent deep-dive reports plus
one BIG FAT synthesis with references and MANY mermaid diagrams, describing the full architecture
of the future product. This is **raw planning material for humans**, NOT ralph-loop-ready specs.

---

## 0. How to run this plan (driver instructions)

1. **Model: Fable for everything.** The driving session runs on Fable. EVERY subagent spawned —
   researcher, reconciler, verifier, critic, diagrammer, synthesizer — MUST be launched with
   `model: "fable"` explicitly set on the Agent call. No exceptions, no fallbacks to other models.
2. **The driver orchestrates; subagents do the work.** The main context must stay lean so the run
   can last all night. Every research / reconciliation / verification / writing step is a subagent.
   Subagents **write their full output to disk themselves** and return only a ≤15-line summary +
   the file path. The driver never pastes full reports into its own context.
3. **Tick checkboxes in THIS FILE immediately** after each step completes (Edit the box to `[x]`
   and append a one-line result note + output file path on the same line). If the session dies,
   the next /goal run reads this file and resumes from the first unchecked box.
4. **Parallelize.** Researcher A and B of a workstream always run concurrently. Run 2–4
   workstreams' researcher pairs at a time. Reconciliation of WS-n can run while WS-n+1
   researchers are still out (pipeline, don't barrier).
5. **Web research is required.** Subagents use WebSearch/WebFetch. Every load-bearing claim needs
   a source URL + access date. Unverifiable claims are marked `[UNVERIFIED]` in reports.
6. **File naming** (per folder CLAUDE.md): `<next_incremented_number>.<DDMMYYYY> - <title>.md`.
   - Raw researcher reports + reconciliation notes → `subagent-research/`
     (e.g. `1.12072026 - WS1A Prophia teardown.md`, `2.12072026 - WS1B Prophia teardown.md`,
     `3.12072026 - WS1 reconciled.md`, …continue incrementing).
   - Final deep dives + the synthesis → this folder, numbered from `4.<date>` upward, synthesis last.
7. **Read before researching.** Prior art already on disk (subagents get pointed at the relevant
   ones per workstream; do not redo this work — extend it):
   - `1.09072026-prophia-tech-stack-research.md` (Prophia teardown, extraction tech, backend sketch)
   - `2.10072026-Replacing Claude Opus with a Self-Hosted Open-Weight Model for Swedish Lease Extraction.md`
   - `AI-Info/architecture-spec.md` (§7 locked decisions D1–D13 for prototype 0.2)
   - `AI-Info/software-architecture.md` (current module map + seams)
   - `workflow/0.2-prototype/2026-07-10-data-extraction-pipeline-learnings.md` and
     `workflow/0.2-prototype/pdf-and-image-text-extraction-finding.md` (grounding/pipeline learnings)
8. **Scale expectation:** ~15 workstreams × (2 researchers + 1 reconcile/verify) + ~8 cross-cutting
   agents ≈ 50–60 Fable subagents. That is intended. Exhaustive was explicitly chosen.

---

## 1. What we're building (product brief — locked)

A SaaS for the Swedish commercial real-estate market: a Prophia superset localized to Sweden.
Working name: the product. Target customers: **förvaltare (property managers) and landlords
managing ≥1 bn SEK in property value** (initial customers likely 1–5 bn SEK), with an explicit
plan to scale to very large organizations quickly.

**Domain model (user's own words, normalized):**
- A company has employees. Some employees manage other employees' access and can see what data they have.
- A company owns buildings. Each building has lease contracts.
- A company has maintenance contracts — some span multiple buildings, some one.
- A company has tenants. Invoices are sent to tenants.
- Förvaltare manage buildings **on behalf of other companies** → cross-org delegation is first-class.
- An employee uploads documents → documents are mined → extracted data is auto-connected to the
  right companies / buildings / tenants / contracts.
- A user with a certain role sees relevant data and does NOT see irrelevant data.
- Users with right access should be able to analyze, get insights, and act on them, from the SAAS product.
- Research Prophia for full feature inspection of what to build

**Document universe (all Swedish, no standard format guaranteed):** leases (lokalhyresavtal —
Fastighetsägarna forms AND custom), invoices, bills, legal documents, drawings, tenants' annual
reports, maintenance contracts, amendments (tillägg), besittningsskydd waivers, etc.

**The two products:**
1. **Core product: the data + tools.** Deterministic, typed tool functions over verified extracted
   data — queries, reports, computations. Examples (canonical): all contracts < 100 sqm; how many
   distinct maintenance subcontractors are used; which subcontractor is most expensive per sqm; list all my contractors based and sort on cost per year, click to see which building contractor A is working on and in what contract their job and cost is specified + compare to actual invoices sent; 
   rent roll; indexation recompute; critical-date alerts; at end of year: calculate invoiced maintenance fees and compare to real costs to send money back or to invoice more. 
2. **Second product: the chat interface.** A chatbot with access to the same tool registry, able
   to answer questions about leases and generate reports. Chat is *just an interface* — cleanly
   isolated code, thin, replaceable.

**Canonical end-to-end flow (the cleaning example):** a lease stipulates the tenant is responsible
for cleaning costs with a preliminary cost of X SEK → the platform sees incoming cleaning invoices
→ calculates (or asks a human if unclear) how much belongs to each tenant → the SaaS produces the
outgoing invoice line to that tenant. Send/receive invoices, connected to the systems the big
Swedish real-estate companies actually use.

**Onboarding/FDE reality:** a new customer arrives with ~1000–2000 mixed documents (leases,
invoices, annual reports, maintenance contracts). The product must have a repeatable onboarding
pipeline (bulk ingest → classify → extract → sample-QA → eval → possibly train) that works for
customer #1 and customer #200.

---

## 2. Decisions already made (from the 2026-07-12 grilling — do NOT re-open)

| # | Decision |
|---|----------|
| G1 | **SAFE = three deployment profiles**: (a) US-APIs-OK, (b) EU, (c) fully self-hosted open-source on rented servers. One product architecture supports all three; the LLM/extraction module is a pluggable API with three profile implementations. |
| G2 | **Segment**: förvaltare + landlords ≥1 bn SEK under management; initial 1–5 bn; architecture must scale to very large orgs quickly. Cross-org delegation (förvaltare ↔ owner orgs) is in scope from day 1. |
| G3 | **Deliverable**: independent deep dives + one BIG FAT summary with references. MANY mermaid diagrams (systems, internals, data flows, ERDs, sequences, deployments). NOT ralph-loop-ready — this is planning raw material. |
| G4 | **Prophia**: re-research fresh tonight (don't just reuse the July 9 teardown; use it as a starting point). |
| G5 | **Topology**: monolith + workers is acceptable as *deployment* shape, but the code must be **very obviously split codebases / microservices inside this one repo** — cleanly separated services developed independently. |
| G6 | **Chat/tools**: one tool registry inside the core platform; webapp calls tools as REST endpoints, chat agent calls the SAME functions as LLM tools. Chat is a second product — an interface — maximally isolated from the core. |
| G7 | **Training**: starting hypothesis is shared base fine-tune + per-customer LoRA only when eval shows a gap — but WS6 must research this properly across the whole document universe (not just leases) and find what works at 1 customer and at 200. Always eval before training on customer data. |
| G8 | **Invoicing**: architecture-first. An extensible integration/connector structure that can take on *whatever system the next customer uses* matters more than covering every rail now. Map: property/ERP systems, accounting software, banks/Bankgirot, Peppol/e-invoice operators — prioritizing the most-used software of mid-to-large Swedish RE managers/landlords. |
| G9 | **Run scale**: exhaustive. **At least two Fable researchers per workstream, reconcile hallucinations between them.** One main Fable driver orchestrates. Checkbox tracker in this file. |
| G10 | **Frontend**: dedicated workstream — **React + Vite + TS + Tailwind + shadcn/ui**; React-native picks (TanStack, shadcn/ui + Base UI, echarts-for-react, TanStack Router). Full WS12 architecture in `34`–`36`. |
| G11 | **Execution**: user fires this later with /goal. Extensive checkboxes per step (research, reconciliation, cross-verification, seams, adversary, mermaid, synthesis). Subagents for each step to preserve main context. **Fable for ALL subagents.** |
| G12 | **No Supabase / no BaaS.** Robust, boring, proven infrastructure. |
| G13 | **Agentic developability is a hard constraint**: the ENTIRE stack (all services, DB, storage, queue, stub inference) must spin up in one Linux VM (docker-compose / dev-up.sh style) with deterministic tests and recorded fixtures — the only exception is GPU LoRA training. |

---

## 3. Working hypotheses (subagents HOLD these or EXPLICITLY REFUTE with evidence)

- H1: One logical architecture; three deployment profiles realized via a **substitution matrix**
  (LLM API ↔ EU endpoint ↔ self-hosted vLLM; S3 ↔ EU bucket ↔ MinIO; managed PG ↔ EU-managed ↔ self-run PG; managed IdP ↔ self-hosted IdP…).
- H2: Monorepo with cleanly split service codebases: platform/core API, mining/ingestion workers,
  inference service, chat service, frontend. Deployed as monolith+workers early; boundaries allow later split.
- H3: **Single PostgreSQL** as system of record (+ S3-compatible object storage for blobs;
  pgvector if embeddings needed) with **RLS shared-schema multi-tenancy** as the baseline.
- H4: Tool registry (typed, deterministic functions) is the core product seam; both webapp and chat consume it.
- H5: Extraction inference sits behind one internal API; profiles swap the backend, never the callers
  (mirrors the prototype's ENGINES registry and ports pattern).
- H6: Deterministic logic in code, not LLM: indexation (SCB October KPI), notice deadlines,
  effective-terms precedence, cost allocation math. LLMs extract; code computes.
- H7: Quote→coordinate grounding pipeline from prototype 0.2 carries into production unchanged in
  concept (value + verbatim quote + page → fuzzy match to word boxes → normalized rects).

---

## 4. Method: dual-researcher + reconciliation protocol (per workstream)

Every workstream WS-n executes these steps, each as a **separate Opus subagent**:

1. **Researcher A** and **Researcher B** — spawned in parallel, *identical mission brief*, blind to
   each other. Both do full web research + read the listed prior-art files, write complete reports
   to `subagent-research/` (naming per §0.6), return ≤15-line summary + path.
2. **Reconciler/Verifier** — reads both reports. Produces a reconciled report in
   `subagent-research/`: agreements (high confidence), disagreements (each resolved via fresh
   targeted web search — this is the hallucination filter), claims only one researcher made
   (verify or mark `[UNVERIFIED]`), and a merged source list. Flags anything load-bearing that
   could not be verified.
3. **Deep-dive writer** — turns the reconciled report into the final deep dive in the parent
   folder: decision-oriented, with mermaid diagrams for anything structural, explicit
   recommendations, per-profile notes (US/EU/self-hosted) where applicable, and a references section.
   (Steps 2 and 3 may be one subagent if context allows; prefer two.)

---

## 5. Workstreams

### WS1 — Prophia fresh teardown + feature catalog + competitor scan
Re-scrape Prophia's current site/docs/reviews (2026 state — tiers, data points, integrations,
pricing signals, new features since July 9). Convert into an explicit **feature/requirements
catalog** for our product mapped to Swedish equivalents, plus our additions (invoicing,
maintenance contracts, multi-doc-type mining, chat). Brief scan of adjacent competitors
(lease-abstraction / proptech in Nordics + US: e.g. Leverton/MRI, Kira, Ocrolus-class, Vitec's own
AI moves). Output: feature catalog table with priority tiers.

### WS2 — Domain model & data architecture
Full ERD for: orgs (landlord vs förvaltare + delegation), users/roles, properties/buildings/units
(fastighetsbeteckning), tenants, lease documents + extracted fields + **effective-terms
materialization** (amendments/tillägg precedence), maintenance contracts (multi-building),
invoices (in/out), documents of all types + classification taxonomy, provenance/grounding data,
review states, critical dates, audit log. Validate against the July 9 schema sketch and extend to
the full document universe. Swedish legal specifics (indexklausul, besittningsskydd,
uppsägningstid, moms) as data. Output: mermaid ERDs + table-by-table rationale.

### WS3 — Multi-tenancy, authN/authZ, access control
RLS shared-schema vs ReBAC engines (OpenFGA, SpiceDB, Oso) vs hybrid — specifically for the
**förvaltare cross-org delegation** case ("employee of org A works on org B's buildings") and
"manager sees/manages other employees' access". SSO (Entra ID/Azure AD is table stakes for the
segment), SCIM, per-profile IdP choice (managed: Clerk/Auth0/WorkOS vs self-hosted: Keycloak,
Zitadel, Ory). Internal admin-for-us console pattern. Audit logging. Output: recommended access
model + mermaid diagrams of the authz flow, per profile.

### WS4 — Document ingestion & mining pipeline (the "mine data from PDF" service)
End-to-end architecture: upload → virus/format checks → classification (doc type + form type,
e.g. Fastighetsägarna 12B.3) → parse/OCR (born-digital vs scan) → extraction (schema per doc type)
→ grounding (carry prototype learnings: citations → value-grounding → re-rank tiers) → confidence
scoring → human-review routing → **entity linking** (connect extracted data to the right
building/tenant/contract — how? deterministic matching + LLM assist + human confirm) →
effective-terms recompute. Queue/worker design, retry semantics, idempotency, throughput for
2000-doc onboarding batches. Output: component + sequence mermaid diagrams, contract with WS5.

### WS5 — Inference module: three profiles
The pluggable extraction-LLM API and its three implementations: (a) US: Anthropic API (citations,
structured outputs, batch API); (b) EU: EU-resident options in 2026 — Anthropic/OpenAI/Google EU
regions or Bedrock/Vertex EU, Mistral (EU-native), EU inference hosts; verify what actually
guarantees EU processing; (c) self-hosted: vLLM + open weights per the July 10 research —
**extend that doc, do not redo it** — including on-demand GPU orchestration and a queue-based
batch design. Substitution matrix + per-profile cost table + what callers see (one internal API).
Output: profile matrix, mermaid deployment diagrams per profile.

### WS6 — Open-model training strategy & data flywheel
Beyond leases: what does extraction across the whole Swedish document universe (invoices, annual
reports, maintenance contracts, legal docs, drawings) need? Which doc types are served by one
shared model / off-the-shelf VLM / per-type fine-tunes / per-customer LoRA adapters? Eval-first
discipline: gold-label pipeline from the human-review workflow, per-customer eval sets built
during onboarding BEFORE any training on customer data. Training ops at scale: adapter registry,
versioning, regression evals, serving N adapters (vLLM multi-LoRA), what breaks at 200 customers.
GPU rental + Unsloth/Axolotl specifics from July 10 doc as the base. Output: decision tree
(when to prompt / fine-tune shared / adapter per customer), flywheel mermaid diagram, cost model.

### WS7 — FDE / customer onboarding playbook (the 1000–2000-document problem)
Repeatable pipeline for a new customer dump: bulk ingest → auto-classify → shadow extraction →
stratified sampling QA → per-customer eval score → decision: ship as-is / prompt-tune / adapter →
data migration from their existing systems (rent rolls, tenant registers) → go-live checklist.
Labor model (how many human-review hours per 1000 docs at which accuracy), timeline, tooling the
FDE needs (dashboards, bulk-correction UI). Must work identically under all three profiles.
Output: playbook + swimlane mermaid diagram + effort/cost table.

### WS8 — Platform/core backend architecture
The monorepo service layout (G5): proposed split — `services/platform` (API, domain, tool
registry), `services/mining` (WS4 workers), `services/inference` (WS5), `services/chat` (WS9),
`frontend/`. Inter-service contracts (REST/queue/events?), shared-code policy (what may be shared:
schemas? nothing?), job orchestration choice (Celery/Redis vs Dramatiq vs Postgres-based queue —
robustness bias, no BaaS), config/profile switching, migrations (Alembic), API versioning,
observability baseline. **Tool registry design in detail** (H4): typed function catalog,
permission-aware execution, REST exposure + LLM-tool exposure from one definition. Output:
mermaid container/component diagrams, repo tree proposal, contracts table.

### WS9 — Chat product architecture (interface #2)
Thin, isolated chat service consuming the WS8 tool registry with the **user's own permissions**
(no privilege escalation via chat). Agent loop design: which LLM per profile (Anthropic API / EU /
self-hosted), tool-calling patterns, MCP as an option (tool registry exposed as MCP server?),
conversation persistence, streaming, "ask a human if unclear" escalation (the cleaning-example
clarification flow), report generation/export. What keeps chat replaceable (G6). Output: sequence
diagrams (question → tools → grounded answer with citations back to source documents).

### WS10 — Deterministic analytics & report flows catalog
Enumerate and specify the deterministic tools (input → computation → output, all in code per H6):
rent roll; indexation recompute (SCB oktober-KPI); critical-date alerts (uppsägning windows);
area/term queries (contracts < 100 sqm); maintenance-subcontractor analytics (count, cost per sqm,
per building); **the cleaning-cost allocation flow end-to-end** (lease clause → invoice matching →
per-tenant allocation → outgoing invoice line, with ask-if-unclear branches); vacancy/stacking
views; CAM-like reconciliation Swedish-style (drift/fastighetsskatt pass-throughs). For each: data
needed from WS2, tool signature, webapp surface + chat surface. Output: tool catalog table +
2–3 flow mermaid diagrams.

### WS11 — Invoicing & integrations architecture
**Connector/adapter architecture first** (G8): an integration layer where each external system is
a self-contained connector with a stable internal contract — designed so the next customer's
system is a new connector, not a redesign. Then map the Swedish landscape with usage data where
findable: property/ERP (Vitec Fastighet, Momentum Fastighet, Fenix/Fasad?, Yardi, Unit4, Datscha
for data), accounting (Fortnox, Visma), banks/Bankgirot (OCR references, camt.053/054, autogiro),
e-invoicing (Peppol BIS Billing 3, operators: InExchange, Pagero, Crediflow, Scancloud;
send/receive as a platform). Which rails do 1–5 bn SEK förvaltare actually run today? Output:
connector architecture mermaid + landscape table + build-order recommendation.

### WS12 — Frontend architecture
React + Vite SPA: monorepo placement, module structure, state management, auth/session per WS3,
PDF viewer with click-to-source highlight overlays (normalized bboxes — carry prototype pattern),
human-review/validation UI (Rossum-style color states), dashboards + report builder over the WS10
tool registry, chat UI embedding (product #2 kept separate), i18n (Swedish/English UI). Component
inventory + which existing OSS components to use (pdf.js wrappers, table/chart libs). Output:
frontend component mermaid diagram + key-screen inventory.

### WS13 — Security & compliance (per profile)
GDPR posture (leases contain personnummer + personal data; customers' tenants are data subjects):
DPAs, subprocessor lists per profile, data-residency guarantees (verify vendor claims), retention/
deletion, encryption at rest/in transit, secrets management, backup/DR strategy, SOC 2 / ISO 27001
path and what the 1–5 bn segment actually demands in procurement, pen-test readiness, tenant-data
isolation testing (RLS verification), LLM-specific risks (prompt injection via uploaded documents
into the chat product — mitigations). Output: threat model + compliance roadmap table per profile.

### WS14 — Infra, deployment & the agentic dev environment
Per-profile deployment targets (US: AWS/GCP; EU: AWS-EU/Hetzner/Scaleway/Elastx/Safespring;
self-hosted: rented bare metal/VMs + GPU rental for inference), IaC choice, container
orchestration (compose → what at scale? K8s or simpler), CI. **The G13 constraint in detail**: the
whole stack in one Linux VM via docker-compose; dev-up.sh evolution for multi-service (port
offsets per RALPH_LOOP_ID exist today); stub/fake inference service for deterministic dev+tests
(recorded-fixture pattern D7 scaled up); seeding; test strategy across service boundaries;
observability (logs/metrics/traces) that also works locally. Output: deployment mermaid diagrams
per profile + dev-environment design + docker-compose sketch.

### WS15 — Cost model & scaling economics
Per profile at 1 / 10 / 50 / 200 customers: infra, inference (API vs GPU rental), training,
storage, human-review labor (the real cost center per July 9 doc), integration operator fees
(Peppol operators charge per invoice), support/FDE labor. Unit economics per document and per
customer; where each profile's break-even sits; pricing-model implications (per-building?
per-document? per-seat? Prophia charges no per-seat). Output: cost tables + break-even analysis.

---

## 6. Cross-cutting phases (after all WS deep dives exist)

1. **Seam/consistency check** — one subagent reads ALL deep dives and verifies the contracts line
   up: WS2 data model supports WS10 tools? WS4 pipeline writes what WS2 defines? WS8 registry
   serves both WS9 and WS12? WS5 API satisfies WS4? Profiles consistent across WS5/WS13/WS14/WS15?
   Output: mismatch list → driver dispatches fix-up edits to the affected deep dives.
2. **Adversarial review** — 2 parallel red-team subagents attack the synthesized architecture:
   failure modes, scaling bottlenecks, security holes (esp. cross-org delegation + chat prompt
   injection), vendor lock-in per profile, "what kills this company" scenarios. Output: findings
   report; driver folds material findings into the synthesis.
3. **Completeness critic** — one subagent: what's missing? (modality not researched, claim
   unverified, Prophia feature unmapped, Swedish reg unhandled, cost line absent). Material gaps →
   driver spawns targeted patch researchers.
4. **Mermaid/diagram pass** — dedicated subagent produces the canonical diagram set for the
   synthesis: C4 context + container diagrams; per-service component diagrams; full ERD; sequence
   diagrams (upload→mine→link→review, chat question→tools→cited answer, invoice in/out +
   cleaning-allocation, FDE onboarding, training flywheel); deployment diagram per profile;
   connector-layer diagram. Consistent naming across ALL diagrams (take names from WS8's repo tree).
5. **BIG FAT SYNTHESIS** — final subagent(s) write the master document in this folder (highest
   number): executive summary; the one architecture + three profiles; every diagram from phase 4;
   per-area summaries linking to deep dives; consolidated decision list + open questions;
   build-order sketch (phases, not ralph-issues); full reference list. This is the primary
   deliverable. Then one final verifier subagent checks every internal file link + spot-checks 10
   random citations.

---

## 7. Execution tracker (tick immediately; append `→ <output file>` on completion)

### Phase 0 — Setup
- [x] 0.1 Driver reads this plan + folder CLAUDE.md files; confirms Fable is the active model → driver session runs on claude-fable-5; both folder CLAUDE.md files read; subagent-research/ empty (numbering starts at 1)
- [x] 0.2 Driver skims the 5 prior-art docs (§0.7) — titles/TLDRs only, keep context lean → all 6 prior-art files confirmed on disk at expected paths; TLDRs ingested

> **Driver note (2026-07-12):** the session was launched via the `cdv` alias which sets
> `CLAUDE_CODE_SUBAGENT_MODEL=sonnet`, silently forcing all subagents to Sonnet despite
> `model: "fable"` on each Agent call. Fixed by adding `"env": {"CLAUDE_CODE_SUBAGENT_MODEL": "fable"}`
> to `.claude/settings.local.json` — verified with a probe subagent (reports claude-fable-5).
> Every researcher brief carries a self-check ("if not Fable, stop") as a guard. Subagent file
> numbering is driver-assigned: WSn → A=3n-2, B=3n-1, R=3n in subagent-research/; deep dives → (n+3).12072026 in this folder.
>

IMPORTANT: ~~Only fire off 5 subagents at a time.~~ **Updated by CA 2026-07-14: up to 20 subagents
at a time — as many as the data flow allows (only real input dependencies gate launches).**

### Phase 1 — Workstreams (per WS: A ∥ B → reconcile → deep dive; pipeline them)
- [x] WS1-A Prophia researcher A → subagent-research/ → `subagent-research/1.12072026 - WS1A Prophia teardown.md` (tiers + scale metrics; new AI Assistant + Yardi Audit + 2026-06 funding; 40+-row catalog A–H; ERP-native abstraction trend)
- [x] WS1-B Prophia researcher B → subagent-research/ → `subagent-research/2.12072026 - WS1B Prophia teardown.md` (3 tiers confirmed; new AI Assistant since July 9; Vitec Evo Connect window; 28-row feature catalog P0–P3)
- [x] WS1-R reconcile + verify → subagent-research/ → `subagent-research/3.12072026 - WS1 reconciled.md` (all shared claims verified live; caught A's fabricated $320→$40 figure; $27.85M funding claim refuted → [UNVERIFIED]; merged 52-row catalog CAT-01…52; 59 refs)
- [x] WS1-D deep dive → parent folder → `4.12072026 - WS1 deep dive - Prophia feature catalog and competitive landscape.md` (CAT-01…52 canonical catalog: 27 P0/17 P1/4 P2/4 P3; 3 competitive clocks; per-WS demand table; 10 recommendations; 5 render-validated diagrams; 62 refs)
- [x] WS2-A domain-model researcher A → `subagent-research/4.12072026 - WS2A domain model.md` (~48 tables / 7 ERDs; corrects July 9 unit-attached docs → leases aggregate + temporal effective terms; management_assignments delegation; 24-class doc taxonomy + FA form catalog; JB 12:4/12:19 as deterministic rules)
- [x] WS2-B domain-model researcher B → `subagent-research/5.12072026 - WS2B domain model.md` (~45 tables / 8 ERDs; evidence-vs-curated two-layer split; delegation edges keep single-column RLS; KPI 2020=100 base-year change is load-bearing; bs_waivers as HN-3 doc type)
- [x] WS2-R reconcile + verify → `subagent-research/6.12072026 - WS2 reconciled.md` (9 structural calls unanimous; 25 shape disagreements → one ~60-table canonical schema + 2 merged ERDs; refuted B's JB 12:56 boundary + corrected A's HFD date; KPI/form numbers verified; 5 items flagged for legal/WS11 follow-up)
- [x] WS2-D deep dive → `5.12072026 - WS2 deep dive - domain model and data architecture.md` (61 tables / 11 subject areas; 11 render-validated diagrams; evidence-vs-curated two-layer split; temporal effective terms; 33-leaf taxonomy; KPI 2020=100; 79 refs; 10 open questions)
- [x] WS3-A access-control researcher A → `subagent-research/7.12072026 - WS3A access control.md` (3-layer hybrid: IdP port + PG authz data + authz.check module; delegation as förvaltningsavtal object; no ReBAC day 1, OpenFGA contingency; Keycloak 26+ self-hosted)
- [x] WS3-B access-control researcher B → `subagent-research/8.12072026 - WS3B access control.md` (hybrid grants-in-PG + RLS backstop; delegation as first-class object; H3 held w/ refinement; IdP per profile: WorkOS/Zitadel/Zitadel)
- [x] WS3-R reconcile + verify → `subagent-research/9.12072026 - WS3 reconciled.md` (grants-in-PG + effective_access + RLS backstop confirmed by both; IdP resolved: US=WorkOS, EU=self-hosted Keycloak (Auth0 EU fallback), self-hosted=Keycloak 26+; nothing load-bearing failed verification)
- [x] WS3-D deep dive → `6.12072026 - WS3 deep dive - multi-tenancy authn authz and access control.md` (grants-in-PG model, GDAP delegation, OpenFGA contingency T1–T5, IdP per profile, staff plane + audit; 10 diagrams, 62 refs)
- [x] WS4-A mining-pipeline researcher A → `subagent-research/10.12072026 - WS4A mining pipeline.md` (presigned upload→ClamAV→tiered classification→3-tier grounding→multi-signal confidence; PG-backed queue (procrastinate/SKIP LOCKED); WS5 contract w/ capability flags; auto-accept rate = KPI)
- [x] WS4-B mining-pipeline researcher B → `subagent-research/11.12072026 - WS4B mining pipeline.md` (PG state-machine + SKIP LOCKED queue; 3-tier grounding portable core; deterministic→probabilistic→LLM entity linking; 7-op WS5 contract; batch-lane design)
- [x] WS4-R reconcile + verify → `subagent-research/12.12072026 - WS4 reconciled.md` (spine unanimous: PG queue, 3-tier grounding, linking funnel, multi-signal confidence; merged 8-op WS5 contract; corrected: arXiv miscite (self-report confidence weight→0), Surya license, Docling benchmark, Rossum page deprecated; Batches NOT ZDR verified)
- [x] WS4-D deep dive → `7.12072026 - WS4 deep dive - document ingestion and mining pipeline.md` (PG-native queue behind TaskQueue port; 3-tier grounding portable core; 4-tier linking funnel; 8-op WS5 contract w/ capability flags; idempotency doctrine; 2000-doc batch: $100–650 machine, review labor is bottleneck; 5 render-validated diagrams)
- [x] WS5-A inference-profiles researcher A → `subagent-research/13.12072026 - WS5A inference profiles.md` (capability flags as profile seam; EU primary = Claude via Bedrock EU incl. Stockholm w/ citations+structured outputs intact; OpenAI EU ZDR-gated; scale-to-zero H100 via SkyPilot/dstack; onboarding inference $23–220 all profiles)
- [x] WS5-B inference-profiles researcher B → `subagent-research/14.12072026 - WS5B inference profiles.md` (InferenceBackend contract w/ quote-in-schema portable grounding; EU splits B1 GDPR-resident (Bedrock EU/Vertex) vs B2 EU-sovereign (Mistral/Scaleway); Anthropic 1P API has no EU option; SkyPilot+vLLM run-batch for profile C)
- [x] WS5-R reconcile + verify → `subagent-research/15.12072026 - WS5 reconciled.md` (structural agreement total; corrected both on Bedrock EU model lineup (sync vs batch lanes differ); B1/B2 EU split adopted; merged 8-op API + substitution matrix + cost table; Vertex-EU coverage = biggest open EU risk)
- [x] WS5-D deep dive → `8.12072026 - WS5 deep dive - inference module three profiles.md` (two-layer seam: 8-op REST + InferenceBackend registry; capability flags drive all forks; B1/B2 EU split, Vertex-EU = biggest open EU risk; 17-row substitution matrix; onboarding ~$23–220 all profiles; 5 render-validated diagrams)
- [x] WS6-A training-strategy researcher A → `subagent-research/16.12072026 - WS6A training strategy.md` (3 lanes: structured-at-source (Peppol/iXBRL) vs CV-defer (drawings) vs trainable (leases/contracts); G7 refined: shared per-doc-type LoRA on one base, per-customer only on eval gap; capture-never-author eval data; Anthropic ToS bans training on outputs)
- [x] WS6-B training-strategy researcher B → `subagent-research/17.12072026 - WS6B training strategy.md` (structured-data bypass + retrieval few-shot before any training; OpenAI winding down self-serve fine-tuning → moat is self-hosted; adapter registry = PG table + MinIO; base-upgrade invalidation is what breaks at 200)
- [x] WS6-R reconcile + verify → `subagent-research/18.12072026 - WS6 reconciled.md` (spine unanimous: one base + shared per-doc-type LoRA + eval-gated per-customer adapters; 12 fresh verifications survived; Mistral-EU-fine-tuning disagreement resolved (exists, new customization service); F1–F9 flags — per-customer adapter rate has no public data, planning estimate ≤10%)
- [x] WS6-D deep dive → `9.12072026 - WS6 deep dive - open-model training strategy and data flywheel.md` (refined G7 spine: one base + shared per-doc-type LoRA + eval-gated per-customer ≤10%; 3-lane doc triage; 5-rung decision ladder + flywheel as mermaid; what breaks at 200 = ops/base-upgrade cascade; 5 render-validated diagrams; 15 recommendations)
- [x] WS7-A FDE/onboarding researcher A → `subagent-research/19.12072026 - WS7A FDE onboarding.md` (OB-0…OB-8 playbook, 15 business days; two-tier review policy (census leases / sampled invoices); fastAPI (Fi2) migration doubles as cross-validation; 220–330 h/1000 docs @92–95%; corpus-map + missing-doc detection deliverable)
- [x] WS7-B FDE/onboarding researcher B → `subagent-research/20.12072026 - WS7B FDE onboarding.md` (10-phase playbook, live in 3–4 wks; ISO 2859-1 QA sample doubles as frozen eval set; registers-first migration = noisy oracle; EU-vs-BPO reviewer cost asymmetry 5–10×; ship/tune/adapter gates at 95/85%)
- [x] WS7-R reconcile + verify → `subagent-research/21.12072026 - WS7 reconciled.md` (16 agreements, playbook spine unanimous; labor merged: 130–220 review-h + 100–160 FDE-h /1000 docs @92–95%; timeline 3–4 wks; EU-vs-BPO corrected ~3–7×; flagged: doc-mix assumption is biggest labor sensitivity, ISO 2859-1 Ac/Re must be checked vs official table)
- [x] WS7-D deep dive → `10.12072026 - WS7 deep dive - FDE customer onboarding playbook.md` (P0–P9 playbook w/ owners + entry/exit criteria; 5-lane swimlane + 4 more render-validated diagrams; census-leases/AQL-invoices review; 130–220 review-h + 100–160 FDE-h /1000 docs; ≈130–270k SEK early → 70–180k mature; labor >95% of cost; gates as proposals to calibrate)
- [x] WS8-A platform-backend researcher A → `subagent-research/22.12072026 - WS8A platform backend.md` (uv workspace + import-linter makes G5 a CI build failure; procrastinate ratified; chat DB role gets zero domain grants; @tool → REST+LLM-schema+MCP from one definition; 42 refs)
- [x] WS8-B platform-backend researcher B → `subagent-research/23.12072026 - WS8B platform backend.md` (5 deployables + ONE shared contracts package; tool-first ToolSpec via single execute_tool choke point; 3-way versioning split; Dramatiq disqualified (no PG broker); flags 9th inference op for chat lane)
- [x] WS8-R reconcile + verify → `subagent-research/24.12072026 - WS8 reconciled.md` (spine unanimous; TWO shared packages (contracts+runtime); per-service Alembic envs + PG grants; 9th op POST /v1/converse ADOPTED; caught `platform` stdlib shadow → platform_svc; nothing load-bearing failed; MCP spec re-verify 2026-07-28)
- [x] WS8-D deep dive → `11.12072026 - WS8 deep dive - platform core backend architecture.md` (recovered-on-disk tick 13/07 — file present, session died before tick)
- [x] WS9-A chat-product researcher A → `subagent-research/25.12072026 - WS9A chat product.md` (chat owns only loop+persistence+SSE; user-JWT-per-tool-call, no escalation; ChatBackend w/ capability flags; MCP rejected internally (facade later); search_result citations on Claude profiles; proposes converse op on services/inference; 6 render-validated diagrams)
- [x] WS9-B chat-product researcher B → `subagent-research/26.12072026 - WS9B chat product.md` (chat = thin client of platform REST + LLM; 8-rule replaceability contract w/ CI kill test; deterministic refs[]→[ref:N] citation validator; lethal-trifecta broken structurally; MCP = phase-2 external adapter; H5 held-with-extension: converse op)
- [x] WS9-R reconcile + verify → `subagent-research/27.12072026 - WS9 reconciled.md` (spine unanimous; universal refs[] validator + native search_result as (a)/(b1) elicitation tier; corrections: WeasyPrint v69, vLLM hermes bugs closed, NSA AISC; converse op proposed 3× independently → flagged for ratification; nothing load-bearing failed)
- [x] WS9-D deep dive → `12.12072026 - WS9 deep dive - chat product architecture.md` (chat owns only loop+chat.*+SSE; R1–R8 replaceability contract w/ CI kill test; ratified 9th op POST /v1/converse; user-JWT per tool call, zero authz in chat; universal refs[] validator + search_result on (a)/(b1); platform-held confirmation gates; MCP = phase-2 external facade; M1–M7 injection defense; 13 render-validated diagrams; flags: profile-(c) chat quality → WS7/WS15, conversation-privacy default = open product call)
- [x] WS10-A analytics-tools researcher A → `subagent-research/28.12072026 - WS10A analytics tools.md` (14-tool catalog, 9 query + 5 command; extracted official 12B.3 handledning PDF verbatim — resolves driftskostnadsklausul = formulär 82; 6E/6F two-floor formula; 5 schema demands on WS2 incl. units.floor_label; 3 render-tested flows)
- [x] WS10-B analytics-tools researcher B → `subagent-research/29.12072026 - WS10B analytics tools.md` (20-tool catalog / 6 groups, zero new tables beyond WS2; read_only vs proposal_write side-effect classes, chat dry-run only; 6E/6F + JB 12:4/12:58 + form 82 computation specs; found formulär 82 + 100; 3 render-validated flows incl. cleaning allocation)
- [x] WS10-R reconcile + verify → `subagent-research/30.12072026 - WS10 reconciled.md` (nothing load-bearing failed; independently re-extracted FA Handledning 12B.3 PDF to verify A's verbatim quotes; merged tool catalog; recovered-on-disk tick 13/07 — session died before tick)
- [x] WS10-D deep dive → `13.12072026 - WS10 deep dive - deterministic analytics and report flows catalog.md` (23-tool catalog: 15 read_only / 5 proposal_write / 3 approve_write, chat dry-run on PW & no AW exposure; primary-source computation specs: 6E/6F, KPI 2020=100 factor 3.3592, JB 12:4/12:58, form 82 ladder, 7B alt-2 floor; golden fixtures from printed worked examples; X6 provenance-ids contract ratified + X5 answered; 8 render-validated diagrams incl. cleaning-allocation w/ triggers a–g; D-1…D-7 column demands filed to WS2; T22 blocked on WS11 snapshot contract)
- [x] WS11-A invoicing/integrations researcher A → `subagent-research/31.12072026 - WS11A invoicing integrations.md` (connector SPI w/ manifest + capability flags; 4 stable public contracts first (fastAPI/fi2xml, SIE4, Peppol BIS 3, camt.053/054); fastAPI certified across all 4 major systems — resolves WS2 fi2xml flag; buy operator API, own Peppol AP deferred; Visma operator merger 2026-10-01)
- [x] WS11-B invoicing/integrations researcher B → `subagent-research/32.12072026 - WS11B invoicing integrations.md` (hexagonal connector contract, 6 capability interfaces; Vitec dominates + Evo Connect June 2026; Bankgirot payment rails cease autumn 2026 → per-bank ISO 20022; Peppol ~3.40 kr/inv; B2B-mandate inquiry due 2027; corrects plan: no Fenix, Fasad is brokerage CRM)
- [x] WS11-R reconcile + verify → `subagent-research/33.12072026 - WS11 reconciled.md` (nothing load-bearing failed; Bankgirot rail retirement, fastAPI 4-system certification, Visma operator merger 2026-10-01, OpenPeppol AP €4,150/yr all re-verified fresh; recovered-on-disk tick 13/07)
- [x] WS11-D deep dive → `14.12072026 - WS11 deep dive - invoicing and integrations architecture.md` (hexagonal connector layer in services/integrations, 6 capability interfaces + manifest; 4 stable public contracts first (fastAPI/fi2xml certified across Vitec/FAST2/Momentum/Xpand, SIE4, Peppol BIS 3, camt.053/054); build order P0→P4; Vitec Evo Connect = channel #1; 13 render-validated diagrams; 61 refs; flag: WS15 needs real operator quotes)
- [x] WS12-A frontend researcher A → `subagent-research/34.12072026 - WS12A frontend architecture.md` (React/Vite module structure, bbox_norm highlight overlays, Rossum-style review UI, OSS component picks; H2/H4/H6/H7 held)
- [x] WS12-B frontend researcher B → `subagent-research/35.12072026 - WS12B frontend architecture.md` (one `frontend/` pnpm workspace, TWO Vite apps: apps/platform + apps/chat, chat embedded same-origin iframe; TanStack Router pick)
- [x] WS12-R reconcile + verify → `subagent-research/36.12072026 - WS12 reconciled.md` (spine: pnpm workspace, Zustand + @tanstack/react-query, BFF auth, bbox_norm overlay H7 HELD; chat = two-app workspace + same-origin iframe; own pdf-viewer pkg on pdfjs-dist; shadcn/ui + Base UI + Tailwind; echarts-for-react v3.0.6; nothing load-bearing failed; X1–X9 cross-WS seam requests logged)
- [x] WS12-D deep dive **(build from `36.12072026`)** → `15.12072026 - WS12 deep dive - frontend architecture.md` (FD-1…FD-20: pnpm workspace, two Vite apps + same-origin iframe w/ kill-test, hey-api clients, TanStack Query v5 + Zustand + URL-state, TanStack Router, BFF zero-token auth + X4 SSE heartbeat rule; own packages/pdf-viewer on pdfjs-dist v6.1.200, bbox_norm H7 HELD; Rossum-grammar review UI; S1–S26 screen inventory; 16 render-validated diagrams; X1–X9 seam requests reproduced §17 for Phase 2)
- [x] WS13-A security/compliance researcher A → `subagent-research/37.12072026 - WS13A security compliance.md` (legal ground under profile (a)/B1 moving in 2026; extends WS3/WS5/WS6 reconciled; recovered-on-disk tick 13/07)
- [x] WS13-B security/compliance researcher B → `subagent-research/38.12072026 - WS13B security compliance.md` (incl. WS6 F2 training-data erasure cascade; [DESIGN TARGET]/[ESTIMATE] tagging discipline; recovered-on-disk tick 13/07)
- [x] WS13-R reconcile + verify → `subagent-research/39.12072026 - WS13 reconciled.md` (recovered-on-disk tick 13/07 — file present, session died before tick)
- [x] WS13-D deep dive → `16.12072026 - WS13 deep dive - security and compliance.md` (SEC-1…16; 2026 moving legal ground covered incl. Bedrock retention-mode + SCP pinning; WS9 M1–M7 adopted w/ enforcement mapping, NE-1..3 no-escalation CI tests; per-profile P0–P3 roadmaps; threat model TB1–5/T1–T14; RLS assurance = launch requirement; WS6 F2 erasure cascade w/ pseudonymize-before-pool; WAL-G primary; 15 render-validated diagrams (driver independently re-verified 15/15); NEW flags → 2.2: WS5-D Bedrock retention-mode fix-up; SeaweedFS WORM maturity [UNVERIFIED] → WS14 drill-verify)
- [x] WS14-A infra/dev-env researcher A → `subagent-research/40.12072026 - WS14A infra deployment dev environment.md` (G13 one-VM compose in detail, dev-up.sh evolution, orchestration ladder; recovered-on-disk tick 13/07)
- [x] WS14-B infra/dev-env researcher B → `subagent-research/41.12072026 - WS14B infra deployment dev environment.md` (per-profile targets, IaC, stub inference + recorded fixtures scaled up; recovered-on-disk tick 13/07)
- [x] WS14-R reconcile + verify → `subagent-research/42.12072026 - WS14 reconciled.md` (spine unanimous: compose ladder/OpenTofu/GHA G13 gate/SOPS→OpenBao/WAL-G/StubBackend record-replay/otel-lgtm; **FAILED verification: MinIO CE archived read-only 2026-04-25 → SeaweedFS adopted; WS5/WS8 need fix-up**; Safespring DOES sell managed PG; Elastx prices [UNVERIFIED] → direct quote; PG pin → 18.4; port scheme keeps 8000+RALPH_LOOP_ID)
- [x] WS14-D deep dive → `17.12072026 - WS14 deep dive - infra deployment and dev environment.md` (ID-1…ID-20; prod shape = dev shape: one VM + one compose per env all profiles; G13 = executable CI compose-boot gate; venues (a) AWS / (b1) eu-north-1+Bedrock EU / (b2) Elastx-flagship+Safespring / (c) Hetzner+SkyPilot→Verda GPU; SeaweedFS + PG 18.4 stated plainly; dev-up.sh v2 keeps 8000+RALPH_LOOP_ID; StubBackend record/replay; L0–L4 test layers; ladders R0→R4 / SOPS→OpenBao / WAL-G + drills; 7 render-validated diagrams; 11 open questions → WS15/WS9/WS13)
- [x] WS15-A cost-model researcher A → `subagent-research/43.12072026 - WS15A cost model.md` (recovered-on-disk tick 13/07 — file present, session died before tick)
- [x] WS15-B cost-model researcher B → `subagent-research/44.12072026 - WS15B cost model.md` (SEK-primary per-profile cost model at 1/10/50/200 customers, extends WS5/WS6/WS7/WS11 cost tables; recovered-on-disk tick 13/07)
- [x] WS15-R reconcile + verify → `subagent-research/45.12072026 - WS15 reconciled.md` (spine unanimous: labor dominates COGS; profiles converge ≈22 MSEK run-rate at 200; (c)≈2×(a) at N=1; break-even ~30–50 customers @500k ACV; caught B's SEK/doc arithmetic slip → ~120–270 SEK/doc early; Elastx FAILED primary verification → dropped, Safespring = Swedish-sovereign anchor; H100 spot > on-demand July 2026 → plan on-demand; LOAD-BEARING UNVERIFIED: per-customer doc volume 3k–8k & invoice traffic ±40%, operator fees quote-gated, BPO GDPR gate)
- [x] WS15-D deep dive → `18.12072026 - WS15 deep dive - cost model and scaling economics.md` (COGS central at 1/10/50/200: (a) 500/2,800/7,200/22,000 kSEK, convergence ±2% at 200, (c)≈2×(a) at N=1 — cost never decides the profile; labor 75–85% of COGS; 120–270 SEK/doc early → 65–180 mature; break-even ≈30–50 customers @500k ACV; three-part tariff no per-seat; WorkOS→Keycloak ~customer 15; ±40% until customer #1 instrumented; R1–R15; 4 render-validated diagrams; 36 refs)

### Phase 2 — Cross-cutting

> **Driver fix-up queue (feed into 2.1/2.2):** (1) ~~MinIO CE archived read-only 2026-04-25 →
> SeaweedFS ratified by WS14-R; WS5-D (`8.12072026`) and any other deep dive naming MinIO need a
> correction pass (WS8-D was warned in-flight).~~ **DONE 14/07: fix-up subagent corrected deep
> dives 5–11 (39 edits: MinIO→SeaweedFS + PG pin 18.4; WS1/WS7 clean; 5 touched diagrams
> re-render clean; deep dives 12+ already correct at write time).** (2) PG pin: 16/17 stale → pin newest major
> supported across all profiles (18.4 as of 2026-07-13). (3) Elastx price figures aggregator-grade
> `[UNVERIFIED]` → flag in WS15. (4) Safespring DOES offer managed PG (strengthens B2 bench).
> (5) WS12-R logged 6 cross-WS seam requests (reground op → WS4/WS5/WS8; persist re-rank candidate
> windows → WS4; label_sv/label_en → WS2; provenance-ids contract → WS10; saved-report versioning
> → WS8/WS10; SSE+BFF session-refresh rule → WS8/WS9) — see `36.12072026 - WS12 reconciled.md`.
> (6) NEW from WS13-D 14/07: WS5-D (`8.12072026`) needs Bedrock retention-mode fix-up per WS13
> reconciled §8.1; SeaweedFS Object-Lock/WORM maturity is [UNVERIFIED] → WS14 restore-drill must
> verify, WORM stays provider-native at second provider until then. (7) WS11-D flag: WS15 still
> needs real operator quotes + Evo Connect partner terms (vendor contact — open question for CA).

- [x] 2.1 Seam/consistency check across all deep dives → **done TWICE independently** (my batch
      SC1–SC5 = files `46–50`; a prior-session batch running in parallel = `54–59` incl. an S6
      handoff ledger). The two passes corroborate on every blocker. Consolidated blocking/major
      findings for 2.2 are listed in the **Driver fix-up queue v2** below.
- [x] 2.2 Fix-up edits dispatched for every mismatch found → **12 parallel Fable fix-up subagents
      (14/07, one per affected deep dive), all landed; every touched mermaid re-render-validated:**
      B-1→WS4-D §3.10 (per-validity-period effective-terms rows, `as_of` reads for T01/T04/T05);
      B-2+B-3→WS2-D (WS10 D-1…D-7 + proposal lifecycle + `rent_roll` leaf + open-Q2 closed
      (driftskostnadsklausul = formulär 82, re-verified live); Area-1 re-based on WS3 §2.2 canonical,
      `audit_events` + surface discriminator → NE-2 satisfiable; count stays 61 tables, 11/11 ERDs OK);
      **B-4 RATIFIED by driver per queue recommendation (CA may override):** ONE taxonomy
      read_only/proposal_write/approve_write; chat = dry-run on PW only, AW never exposed to chat,
      approvals webapp-only v1 — applied in WS8-D (enforced at `execute_tool` by surface
      discriminator, confirm-gate → proposal→approval lifecycle), WS9-D §7.3 (in-chat approve arm
      deleted, kept as CAT-39/P3 path), WS10-D (T17 chat cell fixed);
      B-5→WS5-D (Bedrock retention modes none/default/provider_data_share/inherit, Fable/Mythos
      pinned provider_data_share ≤30d fail-closed, SCP keys, destination-region caveat — AWS doc
      re-verified 14/07; API now TEN ops: `converse` #9, `reground` #10);
      B-6→WS14-D (WorkOS out of (b1) everywhere → self-hosted Keycloak 26+ default, Auth0-EU fallback);
      B-7→WS11-D §2.8 canonical snapshot contract (`connector_snapshots`, `RentRollSnapshotRow` v1,
      provenance kind `snapshot_row`, mirror zone owned by services/integrations) + WS10-D T22
      unblocked (`connector_instance_id` + `snapshot_ref`, vendor enum gone);
      Should-fixes: WS3-D §4.8 = canonical BFF cookie→token exchange (RFC 8693-style, ≤5-min JWT,
      `via` surface claim) referenced by WS8-D §4.3 + WS9-D; X1 `reground` in WS4/WS5/WS8; X2
      candidate windows persisted (WS4-D §3.6); X4 SSE heartbeat/`session_expired` annex (WS8-D §4.4);
      SC3-10 GPU costing → on-demand basis; SC3-04 b1/b2 multi-LoRA bridge (WS5-D §4.4 ↔ WS6-D §9,
      b2 = full parity with (c)); S4-M4 subprocessor annexes completed; S4-M5 BPO gate now explicit
      in WS13-D §3.4/SEC-18 ↔ WS15-D re-pointed; M4 → WS8-D §7.7 + WS14-D §9.1/ID-21;
      Security red-team a–g folded in as WS13-D T15–T21 + SEC-17 (fail-closed residency guard) with
      enforcement in WS2/WS3/WS4/WS9/WS10: building-scoped delegation grants (RT-B C1), linking
      authz at building granularity, `FOR UPDATE` revocation lock, transcript read-time re-check +
      24h purge, preimage-bound approvals (audit stores preimage), money-field visibility
      cross-check tier, egress gate re-keyed on `network_egress`.
      Driver post-pass: X7 handoff renumbered 60→62 (+2 refs in WS11-D); WS4-D op ordinals aligned
      to converse #9/reground #10; WS15-D BPO cite pinned to WS13-D §3.4/SEC-18.
- [x] 2.3 Adversarial red-team pass → business/scaling = `51.…Red-team A`; security/isolation =
      `52.…Red-team B` (+ a third prior-session security red-team, findings folded into 52's set).
      Findings feed 2.2 + synthesis open-questions.
- [x] 2.4 Completeness critic → `53.12072026 - Completeness critic gaps.md` (6 material gaps M1–M6,
      8 minor, 30 load-bearing UNVERIFIED collated). M1/M2/M3 are the candidate 2.5 patch researchers.
- [x] 2.5 Patch researchers for material gaps → **both landed 14/07:**
      M1+M2 → `subagent-research/60.12072026 - Patch M1 M2 notification delivery and machine credentials.md`
      (notifications = module in services/platform, NO sixth service; SES (a) / Scaleway TEM (b) /
      Postal-or-smarthost (c), Mailpit in dev; deadline-ladder alerts unmutable below org-admin floor,
      digest split honors 2026 Gmail/Yahoo RFC 8058 rules; effectively-once via dedup_key; machine
      principals = org-scoped service accounts as third grant subject in WS3 model, API keys day 1 +
      OAuth2 client-credentials (WorkOS M2M / Keycloak), ≤30-min JWTs, quotas at execute_tool,
      Standard-Webhooks HMAC; ~40 refs, 6 render-validated diagrams);
      M3 → `subagent-research/61.12072026 - Patch M3 Swedish addressable market.md`
      (~650 Swedish orgs ≥1 bn SEK (range 520–850): ~430 in 1–5 bn / ~160 in 5–20 bn / ~55 in >20 bn;
      commercial-focus SAM ≈ 380 logos; TAM ≈ 300–400 MSEK ARR, SAM ≈ 200–300 MSEK; WS15 break-even
      30–50 customers = 8–13 % of SAM → feasible at ≥500 kSEK ACV, comfortable at 800k; "customer 200"
      = Sweden + first geography, not Sweden-only; 1–5 bn count ±40 % — hardening needs a
      Datscha/MSCI ownership query).

> **DRIVER FIX-UP QUEUE v2 (feeds 2.2 — consolidated from both seam passes + red-teams, 14/07):**
> *Blocking edits (both passes agree):*
> B-1 **WS4-D** effective-terms engine is latest-wins keyed `(contract_stack, field_key)`; WS2/WS10
>   `as_of` need per-validity-period rows → historical reads (T01/T04/T05) break. (SC1-08 / S1-M1)
> B-2 **WS2-D** honor WS10 D-1…D-7 + proposal lifecycle: `units.floor_label/floor_sort` (D-1),
>   `lease_charges.passthrough_model/included_base_amount` (D-2) + **`status`** column, `invoices.draft`,
>   `cost_allocations.superseded|rejected`, `review_tasks.kind=finding`, `rent_roll` taxonomy leaf,
>   close open-Q2 (driftskostnadsklausul = formulär 82). (SC1-09/10/11 / S1-M2/3/4)
> B-3 **WS2-D** re-base Area-1 authz schema onto WS3 §2.2 canonical: closed role set (not per-org DB
>   roles), delegation `valid_until` mandatory + dual-approval cols, `access_grants.via_delegation_id`,
>   `teams` table, per-user `effective_access` RLS (not per-acting-org), `actor_type` → user+surface
>   discriminator so WS13 NE-2 is satisfiable. (SC4-03…07)
> B-4 **WS8-D + WS9-D + WS10-D** unify ONE side-effect taxonomy (adopt WS10 read_only/proposal_write/
>   approve_write) AND resolve the write-doctrine conflict: **chat = dry-run only on PW, approvals
>   webapp-only for v1** (recommended). (SC2-15/16) — *this one needs a CA ratify; recommend adopt.*
> B-5 **WS5-D** apply the Bedrock retention-mode fix (modes none/default/provider_data_share/inherit;
>   Fable 5/Mythos 5 require provider_data_share ≤30d; SCP-pin `bedrock:DataRetentionMode`; allow-list;
>   destination-region caveat) + add the ratified 9th op `converse` (§2.2 still says "eight ops").
>   (SC3-09/02 / S3-M2 / S2-14) — closes driver fix-up queue item (6).
> B-6 **WS14-D** move WorkOS OUT of the (b1) IdP cell → self-hosted Keycloak default (WS3/WS13/WS5/WS15
>   all say Keycloak; WorkOS is US-residency-only → breaks b1). (S4-M1 / SC3-12)
> B-7 **WS11-D + WS10-D** define the T22 connector **snapshot contract**: `connector_snapshots` +
>   versioned `RentRollSnapshotRow` + `snapshot_row` provenance kind + external-mirror table home;
>   fix T22 vendor-enum → `connector_instance_id`. (SC5-01/02 / S5-M1)
> *Should-fix (single-pass or minor):* SC2-M2/S2-M2 BFF cookie→short-lived user-token exchange for chat
>   (spec it, WS8/WS9/WS3); X1 reground op absent from WS4/WS5/WS8; X4 SSE heartbeat/`session_expired`
>   unratified in WS8; X2 candidate-window persistence in WS4; WS5-D stale spot prices → on-demand basis
>   (SC3-10); WS13 subprocessor annexes omit OCR/Google/IONOS (S4-M4); WS15 BPO option cites a WS13 GDPR
>   call WS13 never makes (S4-M5); WS6-D multi-LoRA "n/a on EU" vs WS5-D b2 serving bridge (SC3-04);
>   M4 API rate-limiting/chat spend ceilings unowned → note into WS14-D/WS8-D.
> *Security red-team → security-hardening backlog (fold into synthesis + WS13 controls, some are 2.2):*
>   delegation org-granularity leak on org-scoped RLS (RT-B C1); entity-linking authorizes at org not
>   building (confused-deputy write); recompute-on-write revocation race (lock the delegation row);
>   chat transcripts outlive delegation revocation; confirmation card authorizes actor not params +
>   audit stores param hash not preimage; hidden-text-with-valid-quote passes grounding on money fields;
>   residency has no per-org fail-closed runtime guard (RT-B C2); M1 egress gate keyed on write not
>   network-egress (read-only fetch tool is trifecta leg 3).

### Phase 3 — Synthesis
- [x] 3.1 Mermaid/diagram pass → `subagent-research/63.12072026 - Canonical diagram set for synthesis.md`
      (D1–D19: C4 context, container (5 deployables C1–C12), 6 per-service component diagrams (incl.
      patch-60 notifications module + connector SPI/snapshot mirror), 4 subject-area ERDs, 5 sequences
      (upload→effective-terms, chat token-exchange lane, invoice+cleaning ask-if-unclear, FDE P0–P9
      swimlane, WS6 flywheel), deployment pairs (a)+(b1) and (b2)+(c); naming locked to WS8-D §2;
      19/19 render-validated + re-extracted re-render clean; conflicts resolved toward fixed-up deep
      dives and flagged in captions — connector home = platform_svc/integrations per WS8-D)
- [x] 3.2 BIG FAT SYNTHESIS → `19.12072026 - BIG FAT SYNTHESIS - full product architecture.md`
      (1,916 lines; §1 exec summary w/ 10 load-bearing decisions + economics + kill risks; §2 one
      architecture / four profile columns (a)/(b1)/(b2)/(c) + substitution matrix; §3 per-area
      summaries 3.1–3.16 all linked; §4 decision list G1–G13 + ~70 ratified run calls in 7 tables;
      §5 38 open questions for CA in 7 groups (incl. B-4 override, conversation privacy, vendor
      quotes, ±40 % volume bands, 3 flagged unreconciled items in §5.7); §6 build-order Phases 0–4;
      §7 references; D1–D19 embedded byte-identical to file 63; 126 internal links, 23 unique
      targets verified on disk at write time)
- [x] 3.3 Final verification → `subagent-research/64.12072026 - Phase 3.3 final verification.md`
      — **PASS-WITH-NOTES**: 126/126 internal links resolve (0 fixed), all per-area links point at
      the right deep dives; 10/10 citation spot-checks across 8 areas: 8 CONFIRMED, 2
      CONFIRMED-WITH-NUANCE (Safespring 4vCPU/8GB live price €67.64 vs WS15's €76.54 — not cited in
      the synthesis itself; noyb page doesn't name Humphrey's Executor, the court opinion does);
      19/19 mermaid blocks re-render clean; stale-term sweep (MinIO/WorkOS-b1/8-ops/spot/Elastx/T22
      vendor-enum) — all hits innocent, 0 edits needed
- [x] 3.4 Tracker all-green + closing note (below)

> **CLOSING NOTE (driver, 2026-07-14) — RUN COMPLETE, all boxes green.**
> **Primary deliverable:** `19.12072026 - BIG FAT SYNTHESIS - full product architecture.md`
> (1,916 lines, D1–D19 embedded, verified by 3.3). Deep dives 4–18 are current as fixed up 14/07;
> raw material + checks live in `subagent-research/` (files 1–64; note 62 = renumbered X7 handoff).
> **Agent count:** ~94 top-level Fable subagents across the run — Phase 1: 60 (15 WS × A/B/R/D);
> Phase 0 probe: 1; Phase 2.1 seam checks: 11 (SC1–5 + S1–6); 2.3 red-teams: 3; 2.4 critic: 1;
> MinIO fix-up: 1; 2.2 fix-ups: 12; 2.5 patches: 2; 3.1/3.2/3.3: 3 — plus ≥5 nested reader
> subagents inside 3.1/3.2. All verified running claude-fable-5 (settings.local.json env pin).
> **Open questions for CA** — full consolidated list = synthesis §5 (38 items, 7 groups). Headliners:
> 1. **B-4 ratify/override**: driver adopted the queue's recommendation (one taxonomy; chat =
>    dry-run only on proposal_write; approve_write never in chat; approvals webapp-only v1).
> 2. Conversation-privacy default for chat transcripts (WS9-D flagged, still an open product call).
> 3. Vendor contacts only CA can do: Peppol operator quotes + Vitec Evo Connect partner terms (WS11/WS15).
> 4. Per-customer doc-volume/invoice-traffic bands are ±40 % until customer #1 is instrumented (WS15).
> 5. M3 market count hardening needs a Datscha/MSCI Property Intel ownership query (~650 orgs ≥1 bn,
>    SAM ≈ 380 logos — break-even feasible ≥500 kSEK ACV, comfortable at 800k).
> 6. §5.7 residual disagreements (not silently resolved): connector-layer deployable home (WS11 vs
>    WS8 `platform_svc/integrations`), WS12 §14 pre-final tool ids vs WS10 T01–T23, self-hosted
>    tool-catalog scaling design (WS8 O4) — plus commissioned legal work: klart-motiverat
>    personnummer analysis + venue TIA behind the WS13-D §3.4 BPO gate.

---

## 8. Mission-brief template for researcher subagents (driver: fill the ⟨⟩ and dispatch)

> You are a research subagent (model: Fable) for the RealEstateAI future-product architecture
> research. Read `workflow/research/1.initial-architecture-research/3.12072026 - Architecture
> Research Plan (execute with goal).md` sections 1–3 for product context, settled decisions (§2 —
> do not contradict without evidence), and working hypotheses (§3 — hold or explicitly refute).
> Your workstream: ⟨WS-n title + full §5 text⟩. Also read: ⟨relevant prior-art files⟩.
> Do exhaustive web research. Every load-bearing claim gets a source URL + access date; mark
> unverifiable claims `[UNVERIFIED]`. Cover all three deployment profiles where applicable.
> Write your COMPLETE report to `workflow/research/1.initial-architecture-research/
> subagent-research/⟨next-number⟩.12072026 - WS⟨n⟩⟨A|B⟩ ⟨short title⟩.md` (check the folder for
> the next free number). Include mermaid diagrams for anything structural. End the file with a
> references list. Return to the driver ONLY: the file path + a ≤15-line summary + your 3 most
> load-bearing claims with sources.

Reconciler brief: same context; inputs = the two report paths; job = agreements / disagreements
(resolve each with fresh targeted web searches) / single-source claims (verify or mark) / merged
references; output file `…WS⟨n⟩R reconciled…`; return path + ≤15-line summary flagging anything
load-bearing that failed verification.
