ThatAIguyA world of ideas

THE CONSCIOUSNESS ATLAS
Read. Experiment. Follow the evidence.

ConsciousnessLearn · Explore · Joseph Anady

Janady13/missionmatch / internal/modules/matching/skillmatcher.go

Source identity, revision, and recovered contents.

GitHub sourceSource text recovered

Source identity

FieldRecorded value
Source typeGitHub source
Original recordJanady13/missionmatch / internal/modules/matching/skillmatcher.go
DateNot specified in source
RepositoryJanady13/missionmatch
Revision1e9249840a4302ec82e123b9c9cb6f75badea3e4
Branchmaster
Path or archive memberinternal/modules/matching/skillmatcher.go
Original SHA-256e91912adb3c650321579a9d27842e4cfa818b369819244cb75e871a0c032c123
Git blob SHA6e39a65c673e3d1dc4bd64a3d372b3c3d0c5a69d
Reading-copy SHA-256e91912adb3c650321579a9d27842e4cfa818b369819244cb75e871a0c032c123

Original source ↗

Every recorded occurrence

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

Original recordBranch or archiveRevision / identifierOriginal location
Janady13/missionmatch / internal/modules/matching/skillmatcher.gomaster1e9249840a4302ec82e123b9c9cb6f75badea3e4Open original
Janady13/missionmatch / internal/modules/matching/skillmatcher.gom5-price-to-win41000ad30fff4129fdaf5ec84e15ba14c27d4890Open original
Janady13/missionmatch / internal/modules/matching/skillmatcher.gows3-clearance4b8e7ce594c068621867f9c9deed0ec64ae6c553Open original
Janady13/missionmatch / internal/modules/matching/skillmatcher.gocollision-deconfliction4ee5a09972608ed89f8377c6665542d5f450f0a6Open original
Janady13/missionmatch / internal/modules/matching/skillmatcher.gows7-federal-signal6a9f6ce9cfb13345ffb47770d4960e7c2d9c17c2Open original
Janady13/missionmatch / internal/modules/matching/skillmatcher.gows6-retrieval6c56e29231ec05735927fa265c97d517499dfeafOpen original
Janady13/missionmatch / internal/modules/matching/skillmatcher.goai-brain-liveaac32fc49c878cc5bca099459307611562d0bac1Open original
Janady13/missionmatch / internal/modules/matching/skillmatcher.gographrag-foundationb0ddeb9f633fd138d09309d1a17b7d13bc3a67f7Open original
Janady13/missionmatch / internal/modules/matching/skillmatcher.gows1-ontology-syncb596f449a32a1016fbd403c36505cc00a1ac9ee6Open original
Janady13/missionmatch / internal/modules/matching/skillmatcher.gotime-to-fill-survivalb66e1e505863d4f17741a4b9ede73509e45bd6c6Open original
Janady13/missionmatch / internal/modules/matching/skillmatcher.gomag-substrateb82c7100a492dec67dfd1eda6b3f53def859be35Open original
Janady13/missionmatch / internal/modules/matching/skillmatcher.gocapture-readinessbae6af7cb2997e819174a9e9cfff5e16067a1975Open original
Janady13/missionmatch / internal/modules/matching/skillmatcher.gows8-teaching-loopc823f0fb6bb2aba0f39001eb6de96f4000d9321fOpen original
Janady13/missionmatch / internal/modules/matching/skillmatcher.gophase2-eval-fairnessd361af254701975fe239927656ababb56374655eOpen original
Janady13/missionmatch / internal/modules/matching/skillmatcher.gophase2-connectorse038d4c687aec16f8bd9bc4d907eea14d91f8704Open original
Janady13/missionmatch / internal/modules/matching/skillmatcher.gows2-alias-relationshipe4dada4601c6eb101830f9d223a9655dfa120616Open original
Janady13/missionmatch / internal/modules/matching/skillmatcher.gopresentation-readinesseb574acaa29d71ce4d0f852572e87c275c79fdb7Open original
Janady13/missionmatch / internal/modules/matching/skillmatcher.gows9-bench-ingestionf585a9ef32fa554663ce1fba9a414a54b6e49cf0Open original
Janady13/missionmatch / internal/modules/matching/skillmatcher.govendor-intelligencefe9796a19c261951d3f2565206c0c1b5ac294465Open original
Janady13/missionmatch / internal/modules/matching/skillmatcher.gocollision-deconfliction4ee5a09972608ed89f8377c6665542d5f450f0a6Open original
Janady13/missionmatch / internal/modules/matching/skillmatcher.gows6-retrieval6c56e29231ec05735927fa265c97d517499dfeafOpen original
Janady13/missionmatch / internal/modules/matching/skillmatcher.gom5-price-to-win41000ad30fff4129fdaf5ec84e15ba14c27d4890Open original
Janady13/missionmatch / internal/modules/matching/skillmatcher.gows1-ontology-syncb596f449a32a1016fbd403c36505cc00a1ac9ee6Open original
Janady13/missionmatch / internal/modules/matching/skillmatcher.gomaster1e9249840a4302ec82e123b9c9cb6f75badea3e4Open original
Janady13/missionmatch / internal/modules/matching/skillmatcher.gows8-teaching-loopc823f0fb6bb2aba0f39001eb6de96f4000d9321fOpen original
Janady13/missionmatch / internal/modules/matching/skillmatcher.gomag-substrateb82c7100a492dec67dfd1eda6b3f53def859be35Open original
Janady13/missionmatch / internal/modules/matching/skillmatcher.gows3-clearance4b8e7ce594c068621867f9c9deed0ec64ae6c553Open original
Janady13/missionmatch / internal/modules/matching/skillmatcher.gophase2-eval-fairnessd361af254701975fe239927656ababb56374655eOpen original
Janady13/missionmatch / internal/modules/matching/skillmatcher.gotime-to-fill-survivalb66e1e505863d4f17741a4b9ede73509e45bd6c6Open original
Janady13/missionmatch / internal/modules/matching/skillmatcher.gographrag-foundationb0ddeb9f633fd138d09309d1a17b7d13bc3a67f7Open original
Janady13/missionmatch / internal/modules/matching/skillmatcher.gows9-bench-ingestionf585a9ef32fa554663ce1fba9a414a54b6e49cf0Open original
Janady13/missionmatch / internal/modules/matching/skillmatcher.gows2-alias-relationshipe4dada4601c6eb101830f9d223a9655dfa120616Open original
Janady13/missionmatch / internal/modules/matching/skillmatcher.gopresentation-readinesseb574acaa29d71ce4d0f852572e87c275c79fdb7Open original
Janady13/missionmatch / internal/modules/matching/skillmatcher.gows7-federal-signal6a9f6ce9cfb13345ffb47770d4960e7c2d9c17c2Open original
Janady13/missionmatch / internal/modules/matching/skillmatcher.goai-brain-liveaac32fc49c878cc5bca099459307611562d0bac1Open original
Janady13/missionmatch / internal/modules/matching/skillmatcher.gophase2-connectorse038d4c687aec16f8bd9bc4d907eea14d91f8704Open original
Janady13/missionmatch / internal/modules/matching/skillmatcher.gocapture-readinessbae6af7cb2997e819174a9e9cfff5e16067a1975Open original

Recovered source transcript

package matching import ( "context" "sync" "github.com/google/uuid" "github.com/pgvector/pgvector-go" "github.com/shopspring/decimal" "github.com/missionworkforce/missionmatch/internal/modules/matching/engine" "github.com/missionworkforce/missionmatch/internal/platform/embeddings" "github.com/missionworkforce/missionmatch/internal/platform/tenant" ) // EmbeddingSkillMatcher implements engine.SkillMatcher using the embedding provider: it embeds the // required skill name and each candidate skill name and picks the best cosine match at/above the // engine's threshold. Vectors from the provider are L2-normalized, so cosine == dot product. // // This is the semantic ("synonyms / adjacent skills") layer the engine defers to AFTER exact match. // With the deterministic offline embedder, unrelated skills score near zero, so it never invents a // false semantic match, exact matching still dominates. Determinism follows from the embedder's. type EmbeddingSkillMatcher struct { embedder embeddings.Embedder } // NewEmbeddingSkillMatcher wraps an embedder as an engine.SkillMatcher. func NewEmbeddingSkillMatcher(e embeddings.Embedder) *EmbeddingSkillMatcher { return &EmbeddingSkillMatcher{embedder: e} } // Match satisfies engine.SkillMatcher. It returns the candidate skill side and the similarity; the // engine owns the required-side identity and the match flags. ctx is the request context, so an // embedding provider call respects the request deadline and cancellation (it is never stored). // // The float dot product picks the single best candidate (ordering ties are astronomically unlikely // and never change the met/unmet outcome), but the at or above threshold DECISION is made in decimal // on the similarity rounded to a fixed scale, so the boundary outcome is reproducible across // architectures, on the engine's determinism path. func (m *EmbeddingSkillMatcher) Match(ctx context.Context, required engine.RequiredSkill, cands []engine.CandidateSkill, threshold decimal.Decimal) (engine.SkillMatch, bool) { if m == nil || m.embedder == nil || len(cands) == 0 { return engine.SkillMatch{}, false } rv, err := m.embedder.Embed(ctx, required.Name) if err != nil { return engine.SkillMatch{}, false } bestSim := -2.0 var best engine.CandidateSkill found := false for _, cs := range cands { cv, err := m.embedder.Embed(ctx, cs.Name) if err != nil || len(cv) != len(rv) { continue } if sim := dot(rv, cv); sim > bestSim { bestSim, best, found = sim, cs, true } } if !found { return engine.SkillMatch{}, false } sim := decimal.NewFromFloat(bestSim).Round(4) if sim.LessThan(threshold) { return engine.SkillMatch{}, false } return engine.SkillMatch{ CandidateSkillID: best.SkillID, CandidateName: best.Name, Similarity: sim, Matched: true, }, true } func dot(a, b []float32) float64 { var s float64 for i := range a { s += float64(a[i]) * float64(b[i]) } return s } // StoredSkillMatcher is the LIVE semantic skill matcher. It satisfies engine.SkillMatcher using the // BACKFILLED skill embeddings in the global skills table (the same vector(384) column the HNSW index // covers), instead of embedding skill name strings at request time. Embedding name strings at request time // was the dead live path: with the fake default embedder it produced fake similarities, and it ignored the // populated column entirely. This matcher reads the stored vectors once into an in memory cache (the skills // ontology is a small, global, bounded table) and resolves a required skill against a candidate's skills by // cosine over the stored vectors. // // The matcher's job is known skill to known skill (the required skill and the candidate's skills are both // ontology entries with ids), which is a direct cosine over two stored vectors, not a nearest neighbor // search; the HNSW index powers the UNBOUNDED adjacency search (ai.SkillAdjacency / KAG), which is already // live. Both read the same populated column, so the vector layer is now live across the board. // // The engine still does exact match first; this is only consulted for a required skill the candidate does // not hold exactly. A required or candidate skill with no stored embedding simply yields no semantic match // (exact matching is unaffected), so a partial backfill degrades gracefully rather than inventing matches. type StoredSkillMatcher struct { db *tenant.DB mu sync.RWMutex cache map[string][]float32 // skill id -> stored, L2 normalized embedding } // NewStoredSkillMatcher builds the matcher over the database that holds the global skills table. The // pgvector codec is registered on the pool, so the embedding column scans into a pgvector.Vector. func NewStoredSkillMatcher(db *tenant.DB) *StoredSkillMatcher { return &StoredSkillMatcher{db: db} } // Match resolves the required skill against the candidate's skills by cosine over the stored embeddings. func (m *StoredSkillMatcher) Match(ctx context.Context, required engine.RequiredSkill, cands []engine.CandidateSkill, threshold decimal.Decimal) (engine.SkillMatch, bool) { if m == nil || m.db == nil || m.db.Pool == nil || len(cands) == 0 { return engine.SkillMatch{}, false } cache := m.ensureLoaded(ctx) rv, ok := cache[required.SkillID] if !ok { return engine.SkillMatch{}, false // the required skill has no stored embedding; exact match still applies } bestSim := -2.0 var best engine.CandidateSkill found := false for _, cs := range cands { cv, ok := cache[cs.SkillID] if !ok || len(cv) != len(rv) { continue } if sim := dot(rv, cv); sim > bestSim { bestSim, best, found = sim, cs, true } } if !found { return engine.SkillMatch{}, false } sim := decimal.NewFromFloat(bestSim).Round(4) if sim.LessThan(threshold) { return engine.SkillMatch{}, false } return engine.SkillMatch{CandidateSkillID: best.SkillID, CandidateName: best.Name, Similarity: sim, Matched: true}, true } // ensureLoaded reads every embedded skill into the cache once. skills is a global, no RLS table, so a plain // pool read is correct and needs no tenant scope. A read failure or a missing embedding degrades to no // semantic match, never a fake one. Reload picks up a fresh backfill on a server restart. func (m *StoredSkillMatcher) ensureLoaded(ctx context.Context) map[string][]float32 { m.mu.RLock() if m.cache != nil { c := m.cache m.mu.RUnlock() return c } m.mu.RUnlock() m.mu.Lock() defer m.mu.Unlock() if m.cache != nil { return m.cache } cache := map[string][]float32{} rows, err := m.db.Pool.Query(ctx, "SELECT id, embedding FROM skills WHERE embedding IS NOT NULL") if err != nil { m.cache = cache // mark loaded; exact matching still works return cache } defer rows.Close() for rows.Next() { var id uuid.UUID var vec pgvector.Vector if err := rows.Scan(&id, &vec); err != nil { continue } cache[id.String()] = vec.Slice() } m.cache = cache return cache }

Mathematical records from this source

01

skillmatcher

This relation defines engine's threshold. Vectors from the provider are L2-normalized, so cosine == dot product. in the source section “skillmatcher”. It specifies the displayed…

02

skillmatcher

This relation defines engine's threshold. Vectors from the provider are L2-normalized, so cosine == dot product. in the source section “skillmatcher”. It specifies the displayed…

03

skillmatcher

This relation defines engine's threshold. Vectors from the provider are L2-normalized, so cosine == dot product. in the source section “skillmatcher”. It specifies the displayed…

04

skillmatcher

This relation defines engine's threshold. Vectors from the provider are L2-normalized, so cosine == dot product. in the source section “skillmatcher”. It specifies the displayed…

05

skillmatcher

This relation defines engine's threshold. Vectors from the provider are L2-normalized, so cosine == dot product. in the source section “skillmatcher”. It specifies the displayed…

06

skillmatcher

This relation defines engine's threshold. Vectors from the provider are L2-normalized, so cosine == dot product. in the source section “skillmatcher”. It specifies the displayed…

07

skillmatcher

This relation defines engine's threshold. Vectors from the provider are L2-normalized, so cosine == dot product. in the source section “skillmatcher”. It specifies the displayed…

08

skillmatcher

This relation defines engine's threshold. Vectors from the provider are L2-normalized, so cosine == dot product. in the source section “skillmatcher”. It specifies the displayed…

09

skillmatcher

This relation defines engine's threshold. Vectors from the provider are L2-normalized, so cosine == dot product. in the source section “skillmatcher”. It specifies the displayed…

10

skillmatcher

This relation defines engine's threshold. Vectors from the provider are L2-normalized, so cosine == dot product. in the source section “skillmatcher”. It specifies the displayed…

11

skillmatcher

This relation defines engine's threshold. Vectors from the provider are L2-normalized, so cosine == dot product. in the source section “skillmatcher”. It specifies the displayed…

12

skillmatcher

This relation defines engine's threshold. Vectors from the provider are L2-normalized, so cosine == dot product. in the source section “skillmatcher”. It specifies the displayed…

13

skillmatcher

This relation defines engine's threshold. Vectors from the provider are L2-normalized, so cosine == dot product. in the source section “skillmatcher”. It specifies the displayed…

14

skillmatcher

This relation defines engine's threshold. Vectors from the provider are L2-normalized, so cosine == dot product. in the source section “skillmatcher”. It specifies the displayed…

15

skillmatcher

This relation defines engine's threshold. Vectors from the provider are L2-normalized, so cosine == dot product. in the source section “skillmatcher”. It specifies the displayed…

16

skillmatcher

This relation defines engine's threshold. Vectors from the provider are L2-normalized, so cosine == dot product. in the source section “skillmatcher”. It specifies the displayed…

17

skillmatcher

This relation defines engine's threshold. Vectors from the provider are L2-normalized, so cosine == dot product. in the source section “skillmatcher”. It specifies the displayed…

18

skillmatcher

This relation defines engine's threshold. Vectors from the provider are L2-normalized, so cosine == dot product. in the source section “skillmatcher”. It specifies the displayed…

19

skillmatcher

This relation defines engine's threshold. Vectors from the provider are L2-normalized, so cosine == dot product. in the source section “skillmatcher”. It specifies the displayed…

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