ThatAIguyA world of ideas

THE CONSCIOUSNESS ATLAS
Read. Experiment. Follow the evidence.

ConsciousnessLearn · Explore · Joseph Anady

Janady13/missionmatch / BUILD_REPORT.md

Source identity, revision, and recovered contents.

GitHub sourceSource text recovered

Source identity

FieldRecorded value
Source typeGitHub source
Original recordJanady13/missionmatch / BUILD_REPORT.md
DateNot specified in source
RepositoryJanady13/missionmatch
Revision720d47fae476b0d38477ae4401697d372b1ea2bc
Branchfeature/opportunity-to-outcome
Path or archive memberBUILD_REPORT.md
Original SHA-256102081ab2f78d099e4950e1008c00078d56a554a4dd73a8724ccb88c7b19552f
Git blob SHAd1641a6fdba380fc5011be3fe95dae9d9d4d5d01
Reading-copy SHA-256102081ab2f78d099e4950e1008c00078d56a554a4dd73a8724ccb88c7b19552f

Original source ↗

Every recorded occurrence

These 21 records contain identical original source bytes. Their paths and revisions remain part of the archive.

Original recordBranch or archiveRevision / identifierOriginal location
Janady13/missionmatch / BUILD_REPORT.mdfeature/opportunity-to-outcome720d47fae476b0d38477ae4401697d372b1ea2bcOpen original
Janady13/missionmatch / BUILD_REPORT.mdcollision-deconfliction4ee5a09972608ed89f8377c6665542d5f450f0a6Open original
Janady13/missionmatch / BUILD_REPORT.mdws6-retrieval6c56e29231ec05735927fa265c97d517499dfeafOpen original
Janady13/missionmatch / BUILD_REPORT.mdm5-price-to-win41000ad30fff4129fdaf5ec84e15ba14c27d4890Open original
Janady13/missionmatch / BUILD_REPORT.mdws1-ontology-syncb596f449a32a1016fbd403c36505cc00a1ac9ee6Open original
Janady13/missionmatch / BUILD_REPORT.mdmaster1e9249840a4302ec82e123b9c9cb6f75badea3e4Open original
Janady13/missionmatch / BUILD_REPORT.mdws8-teaching-loopc823f0fb6bb2aba0f39001eb6de96f4000d9321fOpen original
Janady13/missionmatch / BUILD_REPORT.mdmag-substrateb82c7100a492dec67dfd1eda6b3f53def859be35Open original
Janady13/missionmatch / BUILD_REPORT.mdws3-clearance4b8e7ce594c068621867f9c9deed0ec64ae6c553Open original
Janady13/missionmatch / BUILD_REPORT.mdphase2-eval-fairnessd361af254701975fe239927656ababb56374655eOpen original
Janady13/missionmatch / BUILD_REPORT.mdtime-to-fill-survivalb66e1e505863d4f17741a4b9ede73509e45bd6c6Open original
Janady13/missionmatch / BUILD_REPORT.mdgraphrag-foundationb0ddeb9f633fd138d09309d1a17b7d13bc3a67f7Open original
Janady13/missionmatch / BUILD_REPORT.mdws9-bench-ingestionf585a9ef32fa554663ce1fba9a414a54b6e49cf0Open original
Janady13/missionmatch / BUILD_REPORT.mdws2-alias-relationshipe4dada4601c6eb101830f9d223a9655dfa120616Open original
Janady13/missionmatch / BUILD_REPORT.mdpresentation-readinesseb574acaa29d71ce4d0f852572e87c275c79fdb7Open original
Janady13/missionmatch / BUILD_REPORT.mdvendor-intelligencefe9796a19c261951d3f2565206c0c1b5ac294465Open original
Janady13/missionmatch / BUILD_REPORT.mdws7-federal-signal6a9f6ce9cfb13345ffb47770d4960e7c2d9c17c2Open original
Janady13/missionmatch / BUILD_REPORT.mdai-brain-liveaac32fc49c878cc5bca099459307611562d0bac1Open original
Janady13/missionmatch / BUILD_REPORT.mdphase2-connectorse038d4c687aec16f8bd9bc4d907eea14d91f8704Open original
Janady13/missionmatch / BUILD_REPORT.mdfeature/aioe-upgrade2178e7298d0e5d9af83afa12402fd587f0ba6ed8Open original
Janady13/missionmatch / BUILD_REPORT.mdcapture-readinessbae6af7cb2997e819174a9e9cfff5e16067a1975Open original

Recovered source transcript

# BUILD_REPORT.md — AI brain activation **Date:** 2026-06-29. **Branch:** `ai-brain-live` (off `w3-ai-staffing-recommendations`, which sits on the unmerged AI intelligence layer). **Build host:** M2. **Validated on:** M4 staging (`brain_staging`, goose v18, bge-small embeddings, the live MEGAMIND plane). This mission made the AI brain LIVE: the brain library in `internal/modules/ai` (orchestrator, TAG, RAG retrieval, memory, KAG SkillAdjacency, CAG rules) was built and tested but unreachable from the running app, and the vector layer was dead in the live path. It is now wired: the real embedder, backfilled vectors, the HNSW indexed skill matcher, the brain mounted as an authenticated tenant scoped route behind the faithfulness gate, the two scoring paths reconciled, proven end to end on staging. **Done means, and is proven:** a person can ask the brain a question through an authenticated route and get an explainable, faithfulness gated, tenant isolated answer. `TestBrainAnswersEndToEnd` exercises exactly that (RAG, TAG, CAG, and an EEO refusal, with the AEDT audits), and passes on M4 staging. ## Pre cutover hardening (four fixes, 2026-06-29) A close review before cutover found four things to fix. All four are now closed and re validated on M4 staging (`brain_staging`, goose v19). No feature was added; these are correctness and deploy safety. **FIX 1, the semantic threshold (the live correctness defect).** The engine's `DefaultSemanticThreshold` was 0.80, tuned for a different embedder. On the production bge-small vectors a clear synonym scores ~0.74, so true semantic matches fell under the live cutoff and were silently discarded: the brain shipped a semantic matcher the engine then ignored. A calibration harness on staging (`TestSemanticThresholdCalibration`) scored known synonym and adjacent skill pairs against known unrelated pairs on the stored bge vectors: - Genuine synonyms (11 of 12 pairs): cosine 0.678 to 0.944 (for example "Penetration Testing" to "Ethical Hacking" 0.678, "Threat Hunting" to "Threat Detection" 0.875, "Network Engineering" to "Network Infrastructure Engineering" 0.944). - Unrelated pairs (all 12): cosine 0.410 to 0.571 (mean 0.498), the highest being a noise spike "Amazon Web Services" to "Underwater Basket Weaving" 0.571. - The genuine groups separate in the gap [0.571, 0.678]. One acronym pair, "Signals Intelligence" to "SIGINT" (0.534), sits BELOW the unrelated ceiling, so no safe single threshold can capture it; acronym to expansion belongs to the skills ontology alias layer, not to a cosine cutoff. It is documented, not forced. Chosen threshold: **0.62**, in the separating gap with margin: 0.0486 above the unrelated ceiling (no invented match) and below every genuine synonym (no discarded match). At 0.62 the harness confirms 11 of 12 synonyms matched and 12 of 12 unrelated rejected. The threshold is a frozen engine contract, so one commit changed the constant, bumped the engine **ModelVersion to v1.1.0**, and updated the frozen test together; **migration 0019** registers v1.1.0 in `aedt_model_versions` (migrator only, since the app role has SELECT) so every decision stamped v1.1.0 has a registry row and a model card entry, with weights and band cuts unchanged from v1.0.0. `TestBrainSemanticSkillMatchEnginePath` proves the new threshold FIRES in the engine scoring path (not a read only compare): a candidate holding a synonym of a required skill scores Skills 100 through `engine.ScoreCandidate` over stored bge vectors, while an unrelated skill scores 0 with the required skill reported as a gap. The golden `TestSemanticBelowThresholdDoesNotMatch` moved its below threshold fixture from 0.79 to 0.55 (a deliberate shift, since 0.79 now matches). **FIX 2, the enforced re embed gate.** Production holds all-minilm vectors; bge and all-minilm are not comparable, so serving over a wrong model store silently mis ranks every retrieval with no error. A new boot self check (`ai.VerifyVectorModel`, behind `ai.VectorGate`) asserts the skills and candidates vector columns are vector(384) through the catalog (no RLS bypass, no PII), samples stored skill vectors, and re embeds them with the configured model to confirm the stored vectors were produced by that model (cosine within 0.98). It re embeds the SAME text the backfill wrote (skill name with category, via a shared `embeddings.SkillEmbedText`), so a categorized skill is not a false mismatch. On a proven mismatch, `POST /ai/query` returns a typed 503 `vector_model_mismatch` and the mismatch is logged, while the rest of the API serves normally; a boot time plane outage leaves the gate to self heal on the first query after the plane recovers. The comparison core and the gate state machine are unit tested for match, model swap, wrong width, permanent mismatch, transient retry, and the handler 503; a live staging test proves the gate OPENS on the bge store. DEPLOY_PLAN.md B2 is now a hard psql assertion (it RAISES unless every live candidate and every skill is embedded and a sampled vector is 384 wide) and states the gate in words: the brain stays dark until both the re embed is verified complete and the startup check passes. **FIX 3, the merge sequence.** DEPLOY_PLAN.md now enumerates the three branch merges as discrete, individually rollback able steps: M1 merge the AI intelligence layer (migration 0017, ai_memory, the foundation), M2 then merge W3 (0018, the two staffing tables), M3 then merge the brain (0019, the v1.1.0 registry row). Each has its own rollback (revert the merge commit, and the goose down already in the migration). The hard rule is stated: do not collapse the three, and do not run the cutover until all three are merged in order and the migrations through 0019 are applied to production. **FIX 4, the forecast test is pre existing (confirmed, not a regression).** `TestCommandCenterUpcomingIncumbentAdopt` requires a populated global forecast and contract award catalog (it does not seed them; it expects them as global reference data). On a fresh database with an empty catalog it fails by construction. Confirmed by a controlled experiment: - On the **ai-intelligence-layer** branch (neither W3 nor the brain present, head migration 0017), against a CLEAN M4 database (`fix4_ail_baseline`, goose v17, empty catalog), it FAILS at `command_center_d_integration_test.go:43` ("expected forecast records in upcoming opportunities"). - On the **ai-brain-live** branch (full stack, migrations to 0019), against a CLEAN M4 database (`fix4_brain_baseline`, goose v19, empty catalog), it FAILS at the SAME assertion, line 43. Identical failure on the foundation branch alone proves the cause is the empty reference catalog (environmental), NOT a regression introduced by W3 or the brain. The "passes on the AI layer, fails only with W3 or the brain" regression condition is NOT met. Both scratch databases were dropped after the run. **Re validation (all on M4 staging, nothing against production).** FIPS production build clean with the stamp present (`GOFIPS140=v1.0.0`), `sqlc generate` no drift, goose to v19. Full unit suite green under race and fips140=on; `go vet` and `gofmt` clean; `make ci-gates` green (backdoor and FIPS). Full integration suite on `brain_staging`: **49 pass, 1 skip, 1 fail**. The skip is `TestCrossTenantDatabaseIsolation` (per tenant pools, out of scope). The one fail is the same environmental `TestCommandCenterUpcomingIncumbentAdopt` (on `brain_staging` it now clears line 43 because two forecasts exist there, and fails one assertion later at line 62 on the empty contract award feed, the same missing reference data cause). Every mission critical brain test passes: the threshold fires in the engine path and the frozen test matches, the startup vector model check serves on a match, the brain answers end to end with the EEO refusal and audits, the reconciliation proves engine equals tag equals dashboard, and cross tenant memory isolation and erasure hold. ## Scope held - Mounted LIVE on the SHARED RLS database, exactly like matching and commandcenter. Per tenant database routing is a sequenced follow on and was NOT done; the live API was not switched to per tenant pools. - No branch merged, no production database or Bubbles host touched. Validated on M4 staging only. ## Non negotiable constraints, all held 1. **No Python, FIPS intact.** All ML runs out of process on the MEGAMIND plane over HTTP. The API binary stays `CGO_ENABLED=0 GOFIPS140=v1.0.0`; the stamp was verified after every build. No cgo, no new dependency. 2. **EEO isolation absolute.** No brain path names the eeo schema; the TAG layer runs ONLY curated, parameterized, read only intents over an allowlist that excludes eeo (never free form SQL); `safety.ForbidEEO` guards every string sent to the plane; and a new natural language guard (`MentionsProtectedAttribute`) refuses a question that asks to group people by a protected attribute even in plain words ("list candidates by race"). The EEO unreachability tripwire walks the ai package (21 ai and staffing files scanned, none reach eeo). 3. **Tenant isolation.** Every brain database read (HybridSearch, ExecuteIntent, memory Recall and Store, the audit) runs inside `RunInTenantTx`, RLS scoped, on the validated org. The skill matcher reads only the GLOBAL skills table (no org, no RLS). MEGAMIND stays stateless. `TestBrainMemoryCrossTenantIsolation` proves one tenant cannot recall another's memory. 4. **The deterministic engine is the floor.** The brain never recomputes or overrides `engine.ScoreCandidate`; the TAG intents read the frozen `candidate_evaluations` and `slate_members`, not the Command Center composite. No model is in any scoring or eligibility decision; the model only embeds a query, generates prose, and checks faithfulness. `TestBrainTAGReconciliation` proves the brain's answer equals the engine equals the dashboard read. 5. **Faithfulness gate plus deterministic fallback on every answer.** The model prose ships only when the gate confirms it; otherwise the brain returns the deterministic rendering of the same evidence (a 200, rationale_source deterministic), recording why. A plane outage degrades through the circuit breaker to a typed 503, never a hang. 6. **Every brain action audits** (`aedt.ai.answered`, `aedt.ai.refused`), carrying no PII, no names, no prose, no question text, no fallback reason. ## Research (primary sources, cited in code) A 3 agent research workflow verified each piece before wiring: - **pgvector 0.8 HNSW and RRF**: the repo is textbook correct (the cosine operator with vector_cosine_ops, RRF at k=60, SET LOCAL ef_search and iterative_scan in the tenant tx). One tightening applied: the vector arm of `SearchCandidatesHybrid` is now `AS MATERIALIZED` so the relaxed_order HNSW output is re-sorted by true distance before the LIMIT, preventing nearest neighbor mis ranking under the RLS post index filter at scale (pgvector 0.8 README; AWS pgvector 0.8 Aurora guidance). The critical rule, the SAME model and normalization for stored and query vectors, drove the embedder decision below. - **bge-small-en-v1.5 on Ollama**: it is NOT in the official Ollama library; `qllama/bge-small-en-v1.5` is the simplest stable 384 dim handle over the standard /api/embed (pulled and probed on M4). The optional query instruction prefix is query only and genuinely optional (BAAI: omitting it is a slight degradation only), so the adopted policy is NO prefix on either path, which keeps stored and query text consistent. - **NL2SQL safety and faithfulness**: a curated intent registry beats sanitizing generated SQL; the gate withholds unconfirmed prose and falls back to a deterministic answer while still returning a useful 200 (CRAG, Self RAG family). ## What was activated, by phase 1. **The real embedder.** bge-small-en-v1.5 (the `qllama` handle, 384 dim) is the configured default for the MEGAMIND plane; the gateway forwards the request model, so the API and the backfill name it. The fake deterministic embedder is GONE from the API binary (the embedder was removed from main.go and from the staffing cron) and remains only on the deterministic test path (`EmbeddingSkillMatcher`). 2. **The backfill and the live skill matcher.** `cmd/embed-backfill` (idempotent, resumable, batched) ran against `brain_staging`: **skills.embedding 32/32, candidates.resume_embedding 10/10**, all bge. The new `matching.NewStoredSkillMatcher` reads the backfilled, HNSW indexed `skills.embedding` column (a global, no RLS table) into a bounded cache and resolves a required skill against a candidate's skills by cosine over the STORED vectors, instead of embedding name strings at request time. `TestBrainSemanticSkillMatchLive` proves the engine's Skills component now resolves semantically (a synonym scores 0.74 versus an unrelated skill 0.57 on stored bge vectors). 3. **Reconciliation.** The brain consumes the one engine path: the TAG org level intents read `candidate_evaluations`, and `WhoCanSupport` reads the same frozen table, so the brain, the engine, and the dashboard agree by construction. `TestBrainTAGReconciliation` proves equality (engine = tag = support). 4. **The brain mounted live.** `POST /ai/query` is mounted under the tenant scoped group behind session, CSRF, the new `brain.query` RBAC capability (the search.run tier), rate limit, and audit. The orchestrator gained a top level dispatcher (`Answer`) and the CAG direct path (`AnswerDirect`); the faithfulness gate was upgraded to the deterministic fallback. The registry is validated at boot (an unsafe intent fails the boot). 5. **Per tenant memory live.** Memory writes are scoped by organization_id and recall is RLS scoped; RAG is memory augmented (the tenant's own recalled notes join the evidence). Memory is wiped on erasure in BOTH anonymize paths (the on demand `sourcing.Delete` and the governance retention sweep). Cross tenant non retrieval and erasure are tested. 6. **The contract** is in `docs/openapi.yaml`: the query request, the answer object (answer, path, rationale source, citations, faithful, fallback reason), and one typed error envelope with the 200/403/422/503 failure surface (a faithfulness fallback is a 200 deterministic; a demographic or unanswerable or unknown intent question is a 422; a plane outage is a 503; never a raw SQL error and never a hang). ## Live embedding counts on staging `brain_staging` after the pre cutover hardening was fully re embedded with bge (skills 38/38, live candidates 131/131), and the startup vector model check passes against it (the gate opens). (The shared production database holds all-minilm vectors today; the cutover re embeds everything with bge, now an enforced gate, see DEPLOY_PLAN.md and FIX 2, because mixing models silently corrupts ranking.) ## Test results - **Unit (race, no DB):** all pass, including the EEO tripwire over the ai package and the engine frozen and golden tests. - **Live integration on M4 staging:** the brain tests pass (semantic skill match via stored embeddings AND in the engine scoring path at the new threshold, the threshold calibration harness, the startup vector model check, the brain answering across RAG/TAG/CAG with the EEO refusal and the audits, the scoring reconciliation engine=tag=dashboard, memory cross tenant isolation with erasure). After the pre cutover hardening the full suite on `brain_staging` is **49 pass, 1 skip, 1 fail** (see the hardening section: the skip is per tenant database isolation, out of scope; the fail is the environmental `TestCommandCenterUpcomingIncumbentAdopt`, the empty global forecast and award catalog, confirmed pre existing on the AI layer branch alone in FIX 4). - **Build gates:** FIPS stamp present after every build, `make ci-gates` green (backdoor and FIPS), vet and gofmt clean, no Python, no cgo. ## What the adversarial review found and what was fixed A 5 dimension review (EEO safety, the engine floor, the live vector layer, tenancy, the failure surface), with every finding independently verified, confirmed six, all fixed: 1. **HIGH (erasure parity).** The governance retention sweep anonymized a candidate but skipped ai_memory, so a candidate de identified by the automatic sweep left recallable memory behind, unlike the on demand erasure. Fixed: the ai_memory delete was added to the sweep's purge loop, so both anonymize paths leave the same residue. 2. **MEDIUM (embed model drift).** The API defaulted to bge while the backfill, the gateway, and the env defaulted to all-minilm, the silent corruption mode (query bge versus stored all-minilm mis ranks every neighbor). Fixed: every default aligned to bge so write time and query time vectors share one model. 3. **MEDIUM (failure surface).** A transient plane failure that had not yet tripped the breaker mapped to a 4xx. Fixed: a typed `inference.ErrPlaneUnavailable` is returned on exhausted transient retries, mapped to 503. 4. **LOW.** The API now calls `ValidateRegistry` at boot so an unsafe TAG intent fails the boot. The `ForgetCandidate` comment was corrected (the transactional erasure paths inline the delete; ForgetCandidate is the standalone hook). ## What remains (genuine decisions or sequenced work) 1. **The production cutover** is the operator's manual step in DEPLOY_PLAN.md (merge the AI layer and W3, apply the migrations through 0018, pull bge on the production Ollama, switch the embedder, re embed all vectors with bge, deploy the brain binary, verify, roll back). Validated on M4 staging, NOT run against production. 2. **Per tenant database routing** for the brain is the sequenced follow on (out of scope here); the brain is born on the shared RLS database and isolation is enforced by RLS and the org GUC. 3. **The semantic threshold.** DONE in the pre cutover hardening above (FIX 1). The engine's 0.80 default was recalibrated to 0.62 on the bge-small vectors (engine ModelVersion v1.1.0, migration 0019), proven to fire in the engine scoring path; the old 0.80 silently discarded real synonym matches (cosine ~0.74). 4. **GraphRAG teaming and Foresight** stay scaffolded and degrade gracefully; the rule based router stays rule based, as directed. 5. **The Command Center SQL composite** still co exists for the org level dashboard (a different metric than the per candidate engine score); the brain consumes the engine path and agrees with both, so they cannot contradict. Merging the composite into the engine is a larger refactor, recommended but out of scope.

Search equations, builds, manuscript text, and recovered sources.