Agent-EA v2 — Reusable EA Engagement Engine

Agent-EA v2 — Reusable EA Engagement Engine

Lean, D1-first, client-agnostic. This is the factory-owned engine that turns the transgesco.jacksoncreektech.ca win into a repeatable Enterprise Architecture engagement: document objects, changement organisationnel, relationships, and gaps with SAP LeanIX v4, then publish Macroscope deliverables (A100–A270) as an editorial client portal.

The single source of truth is D1 — one database per client. Mandates/DAEs are tagged catalogs inside that DB. data.js and HTML are always generated and disposable.

Client data never lives here. Per TFD-0025 it lives in OneDrive/clients/{slug}/dae-NNNN/. This repo holds only the client-agnostic engine.

Layout

agent-ea/
  schema/leanix-v4.sql              one D1 schema (catalogs / objects / relations); kind ∈ {object, co}
  templates/macroscope/*.html       parameterized render templates (consume data.js)
  pipeline/*.mjs                     seed · export-datajs · publish · d1-export (thin scripts)
  playbook/engagement.md            stages, gates, per-page data contracts
  playbook/schema-migration-v1-to-v4.md   legacy CSV → v4 column mapping

Start a client engagement (quickstart)

  1. Read playbook/engagement.md. Lock the deliverable list (subset of A-codes) and sign per-page data contracts — Contract gate.

  2. Copy pipeline/examples/transgesco-dae-0007.manifest.json → edit client, seedDir, seeds, curatedDataJs, templates, out for the new client/mandate.

  3. Run the four stages (zero deps; node:sqlite needs Node ≥ 22.5):

    cd pipeline
    # Model gate — load + count
    node seed.mjs --schema ../schema/leanix-v4.sql --seed-dir <seedDir> --db <client>.sqlite
    # Publish — Layer-1 export + Layer-2 copy + token-filled templates
    node publish.mjs examples/<client>.manifest.json
    # Handover — portable bundle
    node d1-export.mjs --db <client>.sqlite --out <bundle-dir>
    

    Then git push the out/ folder to the client's Cloudflare Pages repo (jct-{client}). Corrections go back into the seed/D1, never the HTML — rerun publish for the delta.

Adding a mandate to an existing client = new catalog rows in the same DB + a new manifest reusing the templates.

Two layers (what's generated vs authored)

  • Layer 1 — catalog-data.js (generated by export-datajs/publish from D1 seeds): drives catalogue-architecture (A250), the queryable AS-IS object inventory.
  • Layer 2 — data.js (authored editorial craft, copied verbatim): drives A100, A230, A270, catalogue-changements, fiche-*, processes (FLOWS, roadmap, decision narrative). See playbook/architecture-findings.md.

Status

  • Phase A (engine home, schema, playbook, migration note) — built 2026-05-30.
  • Phase B (template pack + pipeline) — built & proven end-to-end 2026-05-30 against real DAE-0007 data: seed (3 catalogs / 273 objects / 265 relations) → publish (4 pages + generated catalog-data.js) → d1-export (CSV + .sqlite bundle). 5 unit tests green. Worked example: pipeline/examples/transgesco-dae-0007.manifest.json.
  • Remaining: reconcile the duplicate change-org model (D1 TES-CO vs editorial PROJ/CHG) and run a genuinely new mandate when its data lands. See docs/superpowers/plans/2026-05-30-agent-ea-v2-lean.md.

Spec: docs/superpowers/specs/2026-05-30-agent-ea-v2-lean-design.md. v1 assets indexed under production-lines/_archive/agent-ea-v1/.