Source identity
| Field | Recorded value |
|---|---|
| Source type | GitHub source |
| Original record | Janady13/missionmatch / docs/superpowers/specs/2026-07-27-opportunity-to-outcome-execution-design.md |
| Date | Not specified in source |
| Repository | Janady13/missionmatch |
| Revision | 720d47fae476b0d38477ae4401697d372b1ea2bc |
| Branch | feature/opportunity-to-outcome |
| Path or archive member | docs/superpowers/specs/2026-07-27-opportunity-to-outcome-execution-design.md |
| Original SHA-256 | 2b66d4cd1588bf875d1a314e0a8bdc4d760291403dc4638f26969dc9bdb3fc68 |
| Git blob SHA | 13810333174ee86db8792fb1a76c218ea20fb116 |
| Reading-copy SHA-256 | 2b66d4cd1588bf875d1a314e0a8bdc4d760291403dc4638f26969dc9bdb3fc68 |
Recovered source transcript
Download complete source text ↓154 lines · 7.9 KB
# Opportunity to Outcome, missionMATCH Execution Design
Date: 27 July 2026
Branch: feature/opportunity-to-outcome (created off 462eb81)
Product spec and phase plan: CLAUDE_CODE_BUILD_DIRECTIVE.md (the single source of truth)
This is the EXECUTION design. It does not redesign the product. The directive already
fixes the architecture, data model, API routes, binaries, phases, and gates. This
document records how the build runs safely against the live federation, and the
decisions Joseph approved on 27 July 2026.
## Approved decisions (27 July 2026)
1. Verification target: there is no separate staging. Joseph's decision on 27 July 2026
supersedes the staging amendment. The build extends the existing application directly
and verifies against the live database per directive Section 0 item 7, with a connected
database name assertion and a pg_dump snapshot before every schema change, additive and
transactional migrations, and down migrations that refuse to destroy application rows.
2. Cadence: autonomous through the phases. Surface only at a failing gate or a human
blocker.
3. OpenAI scope: a two lane AI layer. The OpenAI lane sees PUBLIC data only. Private
tenant, candidate, resume, scoring, slate, and EEO data stays on the local plane,
always.
4. Deploy to BOTH API nodes on every release, closing the single node gap in
scripts/deploy.sh.
## Federation and source of truth
Canonical source of truth is this Mac repo, /Users/josephanady/missionmatch, HEAD
462eb81, which matches the live deployed mm-api binary and the architecture document.
The Mac has the Go 1.26.4 toolchain and direct tailnet reach to both databases and both
API nodes, so it builds, migrates, verifies, and deploys.
Live topology in play:
Bubbles 100.90.97.104 nginx ingress, mm-api node one, /home/user/missionmatch
megamind-agi 100.77.114.40 mm-api node two, control plane Postgres :5433
M4 mini 100.94.8.94 tenant Postgres :5432, megamind-gateway :8090 (inference)
Tenancy is per_tenant in production. Tenants seen today: acme business plus
acme_compliance. Identity and tenant_directory live in the control plane. New tenant
tables live inside each tenant database.
## Pipeline: build, migrate, deploy, verify
Baseline is scripts/deploy.sh, which is trusted for its staged sha256 swap that avoids
ETXTBSY, its stop before swap, its preservation of the injected SEO lines in index.html,
and its five second boot wait. Two gaps are closed by this build.
Gap one: deploy.sh ships only to Bubbles. Both nodes must run the same binary or the two
node failover drifts. Every release also ships to the megamind-agi replica.
Gap two: deploy.sh runs migrations as single DSN goose. Production is per_tenant, so new
tenant tables fan out through cmd/migrate-all-tenants across every tenant database, and
control plane changes apply to the control plane. Never the single DSN path for tenant
tables.
Safety rails, building into the existing application (no separate staging):
1. Assert the connected database is the intended production database before any write, so a
wrong DSN cannot hit the wrong database on the shared M4 server.
2. A pg_dump snapshot of each target database immediately before any migration batch, so
every schema change is reversible.
3. Every migration additive and transactional. Down migrations refuse with a count rather
than destroy application authored rows, per directive section three.
4. The tenant fields survive a source refresh byte for byte test, from directive section
four item twelve, runs and passes before any sam-sync write path is trusted.
5. New binaries deploy to both API nodes, and every item is verified end to end through the
live authenticated API and the rendered screen.
Build flags stay FIPS and Linux: CGO_ENABLED=0 GOOS=linux GOARCH=amd64
GOFIPS140=v1.0.0 go build -trimpath. New job binaries cross compile the same way, ship to
/home/user/missionmatch on both nodes, and run as idempotent, bounded, observable,
audited systemd timers safe to rerun.
Verification method, unchanged: reproduce against the live database first, implement,
verify against the same database, verify end to end through the live authenticated API,
then look at the rendered screen. Concurrency is proven by racing it.
## Ledger and frozen set
docs/BUILD_STATE.md is the append only ledger. One line per verified gate item: phase,
item, verification evidence (the command run, the rows observed, the screen checked),
commit hash, and date. Only verified items enter. Aspirations never enter.
Commit convention: "phaseN itemM: short description", one logical change per commit.
Frozen and untouchable: internal/modules/matching/engine, db/migrations_eeo, every
existing migration file, generated sqlc output (regenerate, never hand edit), and the
append only audit semantics. Final acceptance check twenty three, an empty diff of the
candidate scoring engine against the starting commit, is a hard invariant guarded every
phase.
## Two lane AI
OpenAI lane, public data only, off until the key is rotated:
- Compliance matrix and scope extraction from PUBLIC solicitation text.
- Opportunity triage summaries and go or no go analysis over PUBLIC opportunity and
market data.
- Behind the internal/platform/scrub egress gate, verifier gated exactly as local models
are, recorded in the model registry and AEDT inventory as outside the FIPS boundary,
restricted to non regulated tasks. Every external call audits backend name, payload
class, byte count, and content hash, never content.
Local lane, never leaves the machine:
- The in app assistant over the tenant candidates, slates, scores, and recruiting
pipeline, extended through the existing RouteRAG and RouteGraph orchestrator on
megamind-gateway to be materially smarter. No external API, ever.
The scrub gate fails closed to the local plane. Forbidden external, enforced by the gate
and by tests: candidate rows, resume text, names, emails, phone numbers, tenant
identifiers, anything from the eeo schema, RouteRAG and RouteGraph over tenant data,
scoring inputs, scoring outputs, and slate contents.
## Knowledge feeding
Knowledge enters only as cited, provenance tracked curated cards through curation.curate,
plus licensed ontologies, each traceable to an ingest_manifest row. No arbitrary document
dumping into a model. When the build reaches Phases two and four, Joseph designates which
documents are the canonical knowledge (candidates include the Owner's Manual, the complete
manual, and the SAM solicitation packages), and they are ingested with provenance and zero
fabrication.
## Phase order and human blockers
Execute Phases zero through six autonomously, each gate verified and recorded before the
next begins. Pause and surface on these human steps only:
- Phase 0 item 1: revoke the OpenAI key exposed in chat on 27 July 2026. Immediate.
- Phase 0 item 2: create a fresh project scoped key under Mission Workforce Technologies
with a monthly cap and budget alerts, placed in internal/platform/secrets as
openai_api_key, root owned 0600 on M4, nowhere else.
- Phase 0 item 3: begin the SAM.gov system account application. Weeks of lead time, needed
in Phase 4.
- Phase 6 item 1: enable MFA and set MM_ENV to production. The go live decision.
Everything that does not depend on these proceeds without waiting.
## Phase 0 concrete work, this session, no human dependency
1. Build branch feature/opportunity-to-outcome. Done.
2. docs/BUILD_STATE.md created with the ledger format.
3. Move INTELLIGENCE_EXPANSION_SPEC.md into docs/archive so exactly one work order exists.
4. Implement the scrub gate egress payload classes and the external call audit rows, with
the OpenAI backend enabled flag still false.
5. Add the OpenAI backend to megamind-gateway with the boot guard: enabled plus no secret
refuses to boot.
Gate 0: the gateway with openai enabled and no secret refuses to boot, proven against a
live gateway instance. Scrub tests pass. BUILD_STATE exists. The archive move is
committed.