> ## Documentation Index
> Fetch the complete documentation index at: https://quintsecurity.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# v0.9.0 — Behavioral Intelligence Engine

> P2-P4 complete. Behavioral scoring pipeline, multi-proxy sync, BI Service, flow-based redesign, threat signatures.

# Implementation Changelog

Cross-reference between the [GIM Architecture Spec](https://www.notion.so/33a0b8d3f13680dea99ceafb1505e052) and what's been built. Updated April 12, 2026.

**Coverage: \~70% of spec implemented, with significant beyond-spec additions.**

## Phase Status

| Phase | Name                  | Spec Status      | Implementation                                                                         |
| ----- | --------------------- | ---------------- | -------------------------------------------------------------------------------------- |
| P0    | Foundation            | 7/7              | Proto codegen, shared packages, DB migrations, 12 capability dimensions                |
| P1    | Runtime Tier 0        | 9/10             | Gate 0, classifier, security profiles, canaries, invariants. Dashboard UI remaining    |
| P2    | Endpoint Distribution | 9/9              | 18MB binary, install script, Docker, Tailscale, fleet, offline buffer, auto-update     |
| P3    | Behavioral Tier 1     | 11/12 + redesign | Fingerprint, Gates 1-3, flow sketches, group envelopes, shadow mode, threat detections |
| P4    | Multi-Proxy Sync      | 9/10             | Serialization, Redis, NATS, BI Service, drift detection. LLM classification deferred   |
| P5    | GNN Tier 2            | 10/10            | **Complete in v1.0.0** — Memgraph, VGAE, GNNScorer, signature distillation             |
| P6    | Compliance            | 0/7              | Not started                                                                            |
| P7    | Adaptive              | 0/7              | Not started                                                                            |

## Implemented — Matching Spec

| Component               | Spec                                | Actual                                                | Status      |
| ----------------------- | ----------------------------------- | ----------------------------------------------------- | ----------- |
| 3-Tier Architecture     | Tier 0/1 local, Tier 2 remote       | Proxy (Go) + BI Service (Python)                      | Exact match |
| AgentFingerprint        | \~3.1KB probabilistic struct        | \~6KB with flow sketches (v2)                         | Extended    |
| Capability Distribution | \[12]float32                        | \[12]float32                                          | Exact       |
| Tool Frequency          | CMS 4x256 uint16                    | CMS 4x256 uint16                                      | Exact       |
| Hierarchical Bloom      | 3 levels (domain/server/tool)       | 3 Bloom filters                                       | Exact       |
| Temporal Profile        | 24h EWMA + interval                 | HourlyActivity\[24] + IntervalEWMA                    | Exact       |
| Risk Baseline           | Welford's algorithm                 | WelfordStats (mean, m2, min, max)                     | Exact       |
| Sequence Model          | Markov chain                        | 32-slot hash-based MarkovChain                        | Exact       |
| Cardinality             | HyperLogLog                         | 3x HLL (tools, servers, IPs)                          | Exact       |
| Gate 1                  | Envelope membership                 | Bloom + CMS + JSD, 114ns                              | Exact       |
| Gate 2                  | 6 deviation signals                 | All 6 implemented, 433ns                              | Exact       |
| Gate 3                  | Corroboration + session             | Flow divergence + structural evidence                 | Redesigned  |
| Confidence Bands        | KNOWN\_SAFE / UNCERTAIN / ANOMALOUS | 3-band classification                                 | Exact       |
| Delta Flush             | 30s to Redis                        | DeltaFlusher, 30s periodic                            | Exact       |
| Session Export          | On session end                      | 60s periodic + session end                            | Extended    |
| Cold Start Bootstrap    | From Redis, \<5s                    | BootstrapFromRedis, \~230ms for 10K                   | Exceeds     |
| BI Service              | Single Tier 2 authority             | Python, NATS consumer, 780K events/sec                | Matches     |
| Correction Flow         | Baselines + corrections via NATS    | CorrectionReceiver with ApplyBaseline/ApplyCorrection | Matches     |
| Shadow Mode             | Observe-only before enforcement     | BehavioralConfig with shadow\_mode toggle             | Exact       |

## Implemented — Diverged from Spec

| Spec Said                                          | What Was Built                                    | Why                                                                                                                                                |
| -------------------------------------------------- | ------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| Session buffer with 4 hardcoded relationship types | Flow matrix accumulator (\[12]\[12]uint16)        | Hardcoded patterns required code changes for new attacks. Flow matrices detect structural divergence without enumerating specific capability pairs |
| Gate 0 in behavioral pipeline (\~200ns)            | Gate 0 logic lives in gateway/intercept layers    | Deny lists and rate limiting are pre-behavioral concerns. The behavioral pipeline starts at Gate 1                                                 |
| Redis Stack server-side merge (BF.ADD, CMS.INCRBY) | Go-side GET → unmarshal → MergeFingerprints → SET | Simpler, avoids Lua script complexity. Convergent structures (CMS, Bloom, HLL) tolerate last-write-wins                                            |
| Fingerprint deltas via dedicated NATS stream       | Deltas go directly to Redis via DeltaFlusher      | More efficient when the merge target is Redis — no intermediate NATS hop needed                                                                    |
| \~3.1KB per fingerprint                            | \~6KB per fingerprint                             | Flow sketches (FlowMatrix, ResourceFlowSketch, DepthProfile, TemporalFlow) added \~2.9KB. Still fits 21K agents in 128MB                           |

## Implemented — Beyond Spec

These features were NOT in the original GIM Architecture doc but were added during implementation:

| Feature                    | What It Does                                            | Why It Matters                                                                                   |
| -------------------------- | ------------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
| **Baseline Floors**        | Minimum thresholds that EWMA learning can never lower   | Anti-poisoning: prevents slow envelope corruption                                                |
| **Threat Signatures**      | 5 built-in structural FlowMatrix shapes matched via JSD | Detection at Tier 0 without cloud — exfiltration, credential relay, staging, recon, cover tracks |
| **Signature Scoping**      | AgentTypes + MinDepth fields per signature              | Different agents have different normal flows — sub-agent depth matters                           |
| **TightenFloors Protocol** | BI Service can only tighten floors, never relax         | Prevents compromised BI channel from weakening local defenses                                    |
| **Signature Validation**   | MaxJSD, Weight, FlowShape validated on Add/LoadFromJSON | Prevents crafted signatures from blinding detection                                              |
| **Flow Matrix EWMA**       | \[12]\[12]float32 capability transition tracking        | Structural behavioral shape beyond individual action statistics                                  |
| **Resource Flow Sketch**   | CMS64 tracking resource boundary crossings              | Detects data moving in unexpected directions                                                     |
| **Depth Profile**          | \[12]\[8]float32 capability × depth tracking            | Detects capabilities at unusual nesting depths                                                   |
| **Temporal Flow**          | Per-transition timing EWMA + variance                   | Detects timing anomalies on specific flow types (not just globally)                              |
| **Noise Budget Counters**  | Atomic band distribution tracking with health status    | "healthy" / "noisy" / "blind" classification for calibration                                     |
| **Session Reaper**         | TTL-based eviction of stale sessions (30min idle)       | Prevents unbounded memory growth in sessions sync.Map                                            |
| **GroupID Filtering**      | computeGroupEnvelope filters by agent type              | Correct group baselines instead of merging all agents                                            |
| **PeriodicWorker**         | Extracted shared ticker/goroutine lifecycle             | DRY pattern across DeltaFlusher, SessionExporter, DriftDetector                                  |
| **NATS Overflow Buffer**   | Disk-backed JSONL overflow when NATS backpressures      | Prevents event loss during network outages                                                       |
| **Agent Eviction (BI)**    | Stale agent stats evicted after 1hr idle                | Prevents unbounded memory growth in BI Service                                                   |
| **Calibrator Statistics**  | False negative/positive/agreement rate tracking         | Observability for shadow mode calibration                                                        |

## Not Yet Implemented (Spec'd)

| Spec Item                               | Phase | Dependency                   | Status                           |
| --------------------------------------- | ----- | ---------------------------- | -------------------------------- |
| GNN Structural Analysis                 | P5    | Memgraph + model training    | Not started                      |
| Graph Autoencoder                       | P5    | Memgraph                     | Not started                      |
| Memgraph Deployment                     | P5    | Infrastructure               | Not started                      |
| LLM Fallback (Tier 2)                   | P5    | BI Service + quint-graph RAG | Infrastructure exists, not wired |
| 5 Structural Invariant Detectors        | P5    | GNN                          | Not started                      |
| Predictive Detection                    | P5    | GNN                          | Not started                      |
| Contrastive Refinement                  | P5    | GNN + labeled data           | Not started                      |
| Threat Feed Integration (MITRE ATT\&CK) | P5    | External feeds               | Not started                      |
| Compliance Frameworks (SOC2, NIST, ISO) | P6    | Schema design                | Not started                      |
| Compliance Dashboard                    | P6    | API + frontend               | Not started                      |
| Audit Report Export                     | P6    | Compliance data              | Not started                      |
| Federated Intelligence                  | P7    | Global BI infrastructure     | Not started                      |
| Threat Simulation Engine                | P7    | GNN + LLM                    | Not started                      |
| Dynamic Confidence Thresholds           | P7    | Calibration data             | Not started                      |
| Active Learning Loop                    | P7    | Analyst feedback             | Not started                      |
| LLM Classification Pipeline             | P4    | Infrastructure design        | Deferred (QDEV-133)              |

## Performance vs Spec Targets

| Metric                | Spec Target               | Actual                                     | Verdict              |
| --------------------- | ------------------------- | ------------------------------------------ | -------------------- |
| Tier 0+1 Latency      | \<1-5ms                   | \~2-5μs (1000x faster)                     | Exceeds              |
| Tier 2 Latency        | 10-50ms async             | BI Service via NATS (non-blocking)         | Meets                |
| Fingerprint Update    | O(1)                      | 212ns, all O(1)                            | Meets                |
| Gate 1 Fast Path      | \~100ns                   | 114ns, 0 allocs                            | Meets                |
| Gate 2 Signals        | \~500ns                   | 433ns, 8 allocs                            | Meets                |
| Gate 3 Corroboration  | \~1μs                     | 293ns (no-evidence), 1.2μs (with flow JSD) | Meets                |
| Cold Start            | \<5s for 10K agents       | \~230ms                                    | Exceeds (20x)        |
| Delta Flush           | 30s interval              | 30s (exact)                                | Meets                |
| Memory per Agent      | \~3.1KB → \~6KB           | 5,990 bytes serialized                     | Meets revised        |
| Cache Budget          | Not specified             | 128MB default (\~21K agents)               | Reasonable           |
| Noise Budget          | 95% Band 1, \<0.5% Band 3 | Scale test: 85.6% Band 1, 2% Band 3        | Close (needs tuning) |
| False Positive Rate   | Not specified             | 0.04% (flow-based Gate 3)                  | Strong               |
| BI Service Throughput | Not specified             | 780K events/sec (batch)                    | Strong               |
| BI Service p99        | Not specified             | 0.002ms                                    | Strong               |

## Known Issues

| Issue                                                              | Severity | Status                                                              |
| ------------------------------------------------------------------ | -------- | ------------------------------------------------------------------- |
| AgentFingerprint data race (no per-instance mutex)                 | Medium   | Tracked — concurrent Score + ForEach can race on fingerprint fields |
| Noise budget not hitting 95% KNOWN\_SAFE target                    | Low      | Needs threshold tuning in production with real traffic              |
| Health tests fail on Python 3.14 (aiohttp compat)                  | Low      | aiohttp test client needs update                                    |
| Threat signatures: only recon (QT-SIG-004) fires reliably in tests | Low      | Other signatures need more diverse test scenarios                   |

## Codebase Statistics

| Component                     | Files                | LOC          | Tests     |
| ----------------------------- | -------------------- | ------------ | --------- |
| Proxy behavioral package (Go) | 31 source, 28 test   | 18,534       | 321       |
| BI Service (Python)           | 10 source, 9 test    | \~2,558      | 122       |
| API handlers + store          | 15 handler, 10 store | \~3,000      | \~50      |
| Pipeline writer               | 1                    | \~460        | \~20      |
| Migrations                    | 12                   | 1,115        | —         |
| Mintlify docs                 | 13 pages             | \~3,000      | —         |
| **Total**                     | **\~130 files**      | **\~28,700** | **\~513** |
