Skip to content

armgit / AiSOC

Public Imported from GitHub
0

Open-source AI Security Operations Center: alert fusion, LLM-agent triage, MITRE ATT&CK investigation, and a replayable decision ledger for every agent step. Self-hostable, runs with no API keys, MIT licensed. Ships an MCP server for Claude, Cursor and Continue.

docs(matrix): record the six PARTIAL rows that closed, and why two stay (#988)

Beenu Arorae16110b3d257
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c2869e985..8c439856b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,54 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
+### Changed
+
+- **Six of the eight `PARTIAL` rows in the claim-to-gate matrix closed, and
+ every one closed by building the gate it named.** The matrix goes from 236
+ rows — 228 GATED / 8 PARTIAL / 0 NO GATE to **236 rows — 234 GATED / 2
+ PARTIAL / 0 NO GATE**, recounted with `scripts/check_claim_gate_matrix.py`
+ rather than typed. The gates are `check_ledger_replay_contract.py` plus 37
+ API replay tests, `check_sdk_surface.py`, `check_default_egress.py` plus
+ `tests/test_no_default_egress.py`, `check_raw_sql_columns.py`,
+ `tests/isolation/test_backtest_lake_live.py`, and
+ `check_scanner_ratchet.py`; each landed in its own change with proof that
+ it goes red before it was trusted.
+
+ Four of the six found a live defect on the way in — four operations both
+ SDK clients called that the API does not serve, a `source` column three raw
+ INSERTs name that `detection_rule_proposals` has never had, a public CDN
+ default in `services/purple-team` that nothing in the service read, and a
+ payload expansion in the backtest that had never run on a real lake row
+ because the writer stores OCSF `raw_data` into a column named
+ `raw_payload`.
+
+ Three of the six rows also carried a **gap statement that was wrong in this
+ repository's favour**: they credited an "api integration" job and an
+ "integration gate" that do not run those paths. A `PARTIAL` row's caveat
+ has to be re-derived when it is closed, not merely deleted, or the file
+ records a deferral that was never what the row said it was.
+
+ The two rows that remain are the same deferral seen twice — a groundedness
+ floor, and promoting the live-agent eval to a pull-request gate. Neither is
+ blocked on code or on a funded provider key: `live-agent-eval.yml` serves a
+ local model through Ollama and needs no secret. It has simply never run, so
+ there is no distribution to derive a floor from, and a floor invented
+ before the measurement exists would publish a number nobody took. The
+ scorer and the production demotion it drives are already gated on every
+ pull request; what is not gated is the live agent's own output, and a
+ hand-written string cannot stand in for that.
+
+- **`project_stats.py` and the README no longer publish two numbers under one
+ label.** It counted every YAML under `detections/` and printed the result
+ as "Detection files on disk" — 7,016, against the 6,991 the README and the
+ generated truth table publish under the same words. Both were right and
+ they were counting different things: the extra 25 are the standalone
+ response playbooks under `detections/playbooks/`, which are not detection
+ rules. The rule count is now the one the truth table publishes, the wider
+ file count is printed beside it saying what it includes, and a test in
+ `tests/test_readme_figures_gate.py` pins the rule count to the truth
+ table's own row so the two cannot drift apart again.
+
### Added
- **`docker-compose.prod.yml`, the file the deployment page had always pointed
diff --git a/ROADMAP.md b/ROADMAP.md
index 6ef5213f9..17e896c43 100644
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@ -44,7 +44,7 @@ A proof-first, security-first program to make every README claim gate-backed, cl
- **Phase D (breadth):** D1 eight connectors (QRadar/Exabeam/Securonix/Devo/Netskope/Windows-Sysmon/Zeek-Suricata/syslog-CEF) · D2 AI/LLM-usage audit connector + `llm-*` detections + hot/cold lake tiering · D3 live-vendor mock-server smoke.
- **Phase E (prove it):** E1 CI-gated benchmark scoreboard tied to a deterministic live-agent MITRE-accuracy run.
-The claim-to-gate matrix stands at **236 rows — 228 GATED / 8 PARTIAL / 0 NO GATE** — **every product claim is backed by a failing test** and the ratchet (`MAX_NO_GATE=0`) forbids any regression. The 8 remaining PARTIAL rows are honest, named deferrals; none was relabelled without building the gate it names. Count the table rows with `python3 scripts/check_claim_gate_matrix.py` rather than trusting a figure quoted in prose — this line has gone stale before. The six lettered deferrals are scoped in [`docs/audit/DEFERRED_SUBPHASES.md`](docs/audit/DEFERRED_SUBPHASES.md).
+The claim-to-gate matrix stands at **236 rows — 234 GATED / 2 PARTIAL / 0 NO GATE** — **every product claim is backed by a failing test** and the ratchet (`MAX_NO_GATE=0`) forbids any regression. Six PARTIAL rows closed in one pass and every one was closed by building the gate it named, never by relabelling: the ledger's replay contract, the per-language SDK surface, the platform-wide egress default, the raw-SQL column contract, the live tenant-scoped lake fetch, and the scanner ratchet that gave `.security/allowlist.yml` its first reader. Four of the six found a live defect on the way in. The 2 that remain are the same deferral seen twice — a groundedness floor and the promotion of the live-agent eval to a pull-request gate — and neither is blocked on code or on a funded provider key: the workflow serves a local model, it has simply never run, so there is no distribution to derive a floor from and inventing one would publish a number nobody measured. Count the table rows with `python3 scripts/check_claim_gate_matrix.py` rather than trusting a figure quoted in prose — this line has gone stale before. The six lettered deferrals are scoped in [`docs/audit/DEFERRED_SUBPHASES.md`](docs/audit/DEFERRED_SUBPHASES.md).
## v4.0 — Shipped
diff --git a/apps/docs/docs/compliance/evidence-pack.md b/apps/docs/docs/compliance/evidence-pack.md
index a9de095bd..05cd5043b 100644
--- a/apps/docs/docs/compliance/evidence-pack.md
+++ b/apps/docs/docs/compliance/evidence-pack.md
@@ -33,8 +33,8 @@ and says so.
| Prompt-injection resistance | Three adversarial corpora: 32 payloads scanned in isolation and 71 incident pairs whose payloads are placed in attacker-controllable fields, both against a clean twin with a recall floor and a false-positive ceiling, plus 34 held-out pairs authored after the guard was frozen and carrying no floor at all, on which the guard measures 7.1% | `services/agents/tests/adversarial/` |
| Claim-to-gate traceability | Every product claim mapped to the CI job that fails when it stops being true | `docs/audit/CLAIM_TO_GATE_MATRIX.md` |
-The last row is the one worth reading first. It is the honest index: 228 rows
-`GATED`, 8 `PARTIAL` with the specific gap named, and a ratchet that refuses
+The last row is the one worth reading first. It is the honest index: 234 rows
+`GATED`, 2 `PARTIAL` with the specific gap named, and a ratchet that refuses
to let a row sit at `NO GATE`.
## Not covered, and not claimed
diff --git a/docs/audit/CLAIM_TO_GATE_MATRIX.md b/docs/audit/CLAIM_TO_GATE_MATRIX.md
index 06ad21ec2..f12438e1b 100644
--- a/docs/audit/CLAIM_TO_GATE_MATRIX.md
+++ b/docs/audit/CLAIM_TO_GATE_MATRIX.md
@@ -13,10 +13,10 @@ Statuses: `GATED` (a CI job fails when the claim stops being true) · `PARTIAL`
| 84 connectors | README L116, L168 | `ci.yml :: python-lint` (`generate_connector_count.py --check`) | GATED (count) | - |
| Connectors: schema-driven config + vault-encrypted secrets | README L168 | `ci.yml` connectors matrix (`test_schemas.py` + `test_conformance.py` — secret-shaped fields must be `type=secret`); vault tests + `test_live_vendor_smoke.py` (Phase D3 — mock-server drives each connector's real HTTP client + normalize) | GATED | - |
| Connectors: live Test connection | README L168 | `ci.yml` connectors matrix (`test_conformance.py` — every connector implements the async `test_connection` contract) + `connector_conformance.py --check` published matrix + `test_live_vendor_smoke.py` (Phase D3 — mock-server conformance: `test_connection()` + paginated `fetch_alerts()` HTTP path exercised against realistic vendor payloads) | GATED | - |
-| Investigation Ledger stores every step | README L61, L169 | `ci.yml :: api tests` (`audit_hash`, audit immutability) | PARTIAL (write path gated; UI replay only in hermetic e2e) | Phase 3.2 |
+| Investigation Ledger stores every step | README L61, L169 | `ci.yml :: Python — Lint & Type-check` (`check_ledger_replay_contract.py` — response model ↔ console type, client requests ↔ router decorators, and `seq` ordering/uniqueness, each in both directions) + `ci.yml :: Python — Tests` (`test_investigation_replay.py`, 37 cases over `/replay`, `/events`, `/explain`; removing `ORDER BY seq` fails five of them) | GATED | — |
| Public eval harness gates every PR | README L62, L77 | `ci.yml :: p1-eval` | GATED (but suites are self-consistency; see reality report) | Phase 4 |
| Alert-reduction is a real measurement | README / benchmark page | `ci.yml :: python-test` (fusion) runs `test_alert_reduction_real.py`, which groups a 1 000-alert stream with `RawAlert.correlation_key()` — the method `Correlator` actually calls — and bounds the ratio on both sides, because a floor alone is satisfied by a key that collapses everything into one incident | GATED | the legacy suite's 75.3% stays published for continuity and is labelled as not describing this product; the measurement is still a synthetic workload, as the benchmark page states |
-| Runs entirely on your infrastructure / no data exfiltration | README L63 | `ci.yml :: python-test` (agents) runs `test_privacy_redactor.py` (zero raw PII survives) | PARTIAL (redaction gated; the CLI now has no default telemetry endpoint and `telemetry.test.ts` pins that an enabled-but-unconfigured run makes zero network calls; **v9.0 adds the Helm egress default-deny** — `infra/helm/aisoc/templates/networkpolicy.yaml`, gated by `helm.yml` which asserts it denies by default, excludes `169.254.169.254/32` from every allowed CIDR, and stays opt-in because a CNI that does not enforce NetworkPolicy ignores it silently; platform-wide air-gapped egress-blocked CI still outstanding) | Phase 2 |
+| Runs entirely on your infrastructure / no data exfiltration | README L63 | `ci.yml :: python-test` (agents) runs `test_privacy_redactor.py` (zero raw PII survives) | GATED (redaction gated; the CLI now has no default telemetry endpoint and `telemetry.test.ts` pins that an enabled-but-unconfigured run makes zero network calls; **v9.0 adds the Helm egress default-deny** — `infra/helm/aisoc/templates/networkpolicy.yaml`, gated by `helm.yml` which asserts it denies by default, excludes `169.254.169.254/32` from every allowed CIDR, and stays opt-in because a CNI that does not enforce NetworkPolicy ignores it silently; **the platform-wide half landed with `check_default_egress.py`** — every service's declared settings defaults are read and a public host that no air-gap guard covers fails, with each exemption naming the guard that justifies it so deleting the guard withdraws the exemption — plus `tests/test_no_default_egress.py`, which patches the socket layer and drives each service's import and startup with a blank environment, covering 7 of 13 services in CI and naming the missing package for each of the other 6 rather than skipping silently. `services/purple-team` declared an ATT&CK CDN URL nothing in the service read, and it was deleted rather than exempted. Egress-blocked *container* integration is not built: both halves prove the declarations and the import path, not a running container) | — |
| Detection-as-Code rejects candidates that regress MITRE accuracy | README L170 | `ci.yml :: python-test` (`test_detection_eval.py` — candidate `rule_body` run through the real engine vs its own positive/negative fixtures; approval requires it) + `p1-eval` w2-dac baseline | GATED | - |
| 800+ native detection rules | README L78, L170 | `validate-detections.yml` (strict fixture replay) | GATED | - |
| 6000+ imported detection rules | README L78 | `validate-detections.yml` (parse/provenance + `detection_truth_table.py --check`); README cites the executable figure (2603) not the on-disk figure (6991) for coverage | GATED | - |
@@ -24,7 +24,7 @@ Statuses: `GATED` (a CI job fails when the claim stops being true) · `PARTIAL`
| Hunt-as-Code + `/hunt` | README L172 | `ci.yml :: p1-eval` (`hunt_corpus`) | GATED | - |
| Weekly benchmark scoreboard runs live against `main` | README L173 | `ci.yml` agents job (Phase E1 — `scripts/check_scoreboard.py` runs the deterministic live-agent MITRE-accuracy eval over the 200-incident corpus and fails if the published `scoreboard.json` substrate row drifts > 0.02, the schema is invalid, or a substrate row is mislabelled) + `wet-eval.yml` (weekly funded LLM rows) | GATED | - |
| MCP server exposes 18 tools | `services/mcp/README.md`; `apps/docs/docs/integrations/mcp.md`; `apps/docs/docs/intro.md`; `docs/architecture/SYSTEM_DESIGN.md` | `ci.yml :: mcp` (`tests/tools.test.ts` pins the exact tool set, and `tests/published-count.test.ts` compares the figure in each of the seven documents that publish it against `ALL_TOOLS.length`, failing in **both** directions: a figure that disagrees, and a document that has stopped carrying one, so deleting the claim is a finding rather than a pass. A floor refuses to let an empty registry make every document agree with zero) | GATED | The row previously read 13 and named `ci.yml :: mcp` as the gate. That job pins the tool *set* and had never read a document, so six published figures could have drifted with nothing to say so |
-| Plugin SDK Python/TS/Go | README L79, L193 | `ci.yml :: sdk-*` | PARTIAL (build/test gated; OpenAPI breaking-change now gated via `openapi-breaking.yml`, so a spec change that would break the generated SDKs is caught; per-language generated-client contract-drift is 11b) | Phase 11b |
+| Plugin SDK Python/TS/Go | README L79, L193 | `ci.yml :: sdk-*` (build/test per language) + `openapi-breaking.yml` (a spec change that would break the generated clients) + `ci.yml :: Python — Lint & Type-check` (`check_sdk_surface.py` — every endpoint a client calls must exist in `docs/openapi.yaml`, the three languages are held to a declared namespace manifest, and a declared codegen target must exist) | GATED (the three `sdk-*` jobs compiled each SDK in isolation and never compared a client to the API it claims to speak to: `packages/sdk-go` passed all three over a file of type declarations with no functions and no `net/http`, and `packages/sdk-ts` cited a codegen artefact that did not exist. Writing the gate found four operations both clients called that the API does not serve, two of them pinned by tests that mock the transport. The gate proves an endpoint *exists*; field-level response-shape parity is still hand-kept and the SDK headers now say so) | — |
| Prompt-injection resistance | (implied by agent claims) | `ci.yml :: python-test` (agents) runs `test_prompt_sanitizer.py`, `test_prompt_envelope.py` and `tests/adversarial/` — a 32-payload corpus grouped by attacker goal, enforcing a recall floor **and** a false-positive ceiling on real security content that reads adversarially. Action-trigger and exfiltration payloads are individually required rather than averaged, because an injected containment turns the SOC into a denial-of-service tool pointed at its own estate. Phase 3 adds a second, harder corpus at incident level (`test_injection_incidents.py`) whose payloads are written to fit the field they arrive in, enforcing a floor, a ceiling and an exact ratchet naming every current blind spot by id | GATED | obfuscation is an arms race and is recorded rather than individually required; no payload is xfail at present, the homoglyph and newline-flood payloads having been closed by confusable folding and by a rule reaching them. The two corpora measure the same guard and are **not comparable**: one asks whether the guard recognises a string, the other whether it recognises it where an attacker can put it, and the second scores materially lower. Neither measures a model |
| Prompt-injection payloads are graded against a clean twin, so a rate is attributable to the payload | `services/agents/tests/adversarial/injection_incidents.py` | `ci.yml :: python-test` (agents) runs `test_injection_incidents.py` (every pair differs in exactly **one** telemetry field, asserted by a structural diff rather than by inspection; the payload is present at that field in the injected twin and absent from the clean one; where a base incident lacks the field both twins gain the scaffold record so the injected twin never carries structure the clean twin lacks. A guard detection requires a signal at the injected field **and** no signal at that field in the clean twin, proven in the direction that broke by contaminating a base incident and asserting the pair stops counting) | GATED | The corpus is synthetic and labelled so at every record. It grades placement and phrasing, not whether a payload would be delivered: that a DNS name can carry an instruction is asserted, that an attacker controls that DNS name is assumed |
| The injection corpus is generated deterministically and cannot change silently | `services/agents/tests/adversarial/injection_incidents.py` | `ci.yml :: python-test` (agents) runs `test_injection_incidents.py` (the whole corpus is pinned by a SHA-256 digest that a payload, pairing or base-incident change moves, so an edit lands with the diff beside it; two builds in one process are compared, and the serialised record is asserted to carry no clock, uuid or random field, which is the shape that would survive a same-process comparison) | GATED | The digest pins the corpus, not the guard. A corpus change and a guard change move different numbers, which is why the ratchet names payload ids rather than only a rate |
@@ -41,7 +41,7 @@ Statuses: `GATED` (a CI job fails when the claim stops being true) · `PARTIAL`
| SAST | README badge (CodeQL) | `codeql.yml` (the scan) + `codeql-alert-gate.yml` (the invariant: `scripts/check_codeql_alerts.py` fails on any open CodeQL alert at any severity, `note` included, and refuses a ref whose declared languages were not analysed at the triggering commit — `analyze` never failed a build on findings, so this row named a scan and not a gate) | GATED | - |
| Dependency CVE scanning | (implied by security) | `security-audit.yml` | GATED | - |
| OpenSSF Scorecard | README badge L13 | `scorecard.yml` | GATED | - |
-| Container image / IaC / secret scanning (Trivy/checkov/tfsec/gitleaks/Semgrep) | (implied by security) | `security.yml` (claim-matrix ratchet HARD; gitleaks/Semgrep/Trivy/checkov/tfsec observe) | PARTIAL (matrix ratchet enforced; secret + code/IaC/container scanners report-and-ratchet, allowlist at `.security/allowlist.yml` / `.gitleaksignore`; GitHub push-protection is the always-on hard secret gate) | Phase 2 |
+| Container image / IaC / secret scanning (Trivy/checkov/tfsec/gitleaks/Semgrep) | (implied by security) | `security.yml` (claim-matrix ratchet, gitleaks and Trivy fail outright; Semgrep, checkov and tfsec fail on a changed finding count via `check_scanner_ratchet.py` against the ceilings in `.security/allowlist.yml`) + `ci.yml :: Python — Lint & Type-check` (the same gate's allow-list-schema and scanner-coverage half, which needs no scanner) | GATED (this row previously said the three observe scanners "report-and-ratchet" against `.security/allowlist.yml`, and neither half was true: nothing compared the printed counts to anything, and the allow-list had **no reader anywhere in the tree**. The ratchet now fails on more findings than the ceiling, on fewer (shrink-only, printing the measured number), on zero against a non-zero ceiling — a scanner that did not run — on a scanner version that is not the one the ceiling was measured with, on an expired or unreasoned suppression, and on a ceiling/scanner set mismatch in either direction. All three scanners are pinned exactly, because for a ratchet the scanner version is the behaviour. GitHub push-protection remains the always-on hard secret gate) | — |
| Signed / attested release artifacts | (implied by "run next to crown jewels") | `release.yml` + `publish-images.yml` (cosign keyless signatures, CycloneDX SBOM attestation, BuildKit SLSA provenance + SPDX SBOM per image; SHA-pinned actions), `build-extensions.yml` (extension cosign) | GATED | - |
| Insecure defaults hard-fail in production | (implied by self-host) | `ci.yml` api tests (`test_security_defaults.py::test_enforce_*`; `enforce_secure_defaults` raises at boot in production) | GATED | - |
| OpenAPI stability for 3 SDKs + MCP | (implied by SDKs) | `check-openapi.yml` (drift) + `openapi-breaking.yml` (`scripts/openapi_diff.py` — PR spec vs base fails on removed endpoint/schema/field, type change, tightened request, or dropped enum value). A deliberate break goes through the `breaking-change-approved` PR label, which still runs the detector and records every break it permits plus the CHANGELOG `### BREAKING` note that justified it; `--allow-breaking` requires that note as an argument, so the bypass cannot be wired up without the record. Four of the tests assert the *workflow* reaches the flag — it previously had no caller at all | GATED | - |
@@ -63,8 +63,8 @@ Statuses: `GATED` (a CI job fails when the claim stops being true) · `PARTIAL`
| Institutional memory nudges fuse-time confidence (bounded, per-tenant) | README (compounding memory) | `ci.yml` fusion job (`test_memory_nudge.py` — distilled per-signature priors nudge new alerts of that signature ±0.10 in `ConfidenceScorer`; unknown signatures unchanged; `MemoryPriorProvider` distils per-tenant priors from disposition history so one tenant never nudges another) | GATED | - |
| Scheduled hunt findings flow into governed detection proposals | README (proactive hunting → detections) | `ci.yml` api job (`test_wave1_loop_edges.py` — a scheduled hunt that returns hits opens a DRAFT `DetectionRuleProposal` (source `hunt-finding`) into the propose→review→eval-gate→promote lifecycle; zero-hit / flag-off paths open nothing) **plus `test_hunt_scheduler_execute.py` + `test_event_warehouse_providers.py`, which gate the executor the lifecycle depends on** | GATED | this row was previously proven only by `test_wave1_loop_edges.py`, which injects an `executor` stub (`runner = executor or _execute_hunt`). The real `_execute_hunt` could not return a hit on any deployment, so the gate passed against a path that could not run — see the row below |
| A scheduled hunt runs against the SIEM the tenant connected in the console | (implied by hunt scheduling + multi-tenant) | `ci.yml` api job (`test_event_warehouse_credentials.py` — credentials resolve from the tenant's vault-encrypted `connectors` row, the query is tenant + enabled + type scoped in compiled SQL, a pinned connector id is still tenant-filtered, and an undecryptable secret is distinguishable from an unconnected one; `test_event_warehouse_registry.py` — a Splunk-only tenant is routed to Splunk rather than to Elasticsearch; `test_event_warehouse_providers.py` — each driver runs against its connector's URL with its connector's auth, and the SSRF allow-list is that connector's own endpoint) | GATED | the drivers are exercised against mocked vendor HTTP, not a live Splunk or Elasticsearch; a vendor-sandbox integration job needs credentials nobody has provisioned |
-| Analyst disposition history drives human-approval-gated tuning proposals | README (self-improving detections) | `ci.yml` api job (`test_wave1_loop_edges.py` — the previously-orphaned `suggest_tuning` engine is wired to real per-rule disposition history via `/detection/tuning/auto-suggest`, opening DRAFT proposals; `test_detection_tuner.py` fixture-gates the engine) | PARTIAL (mapping + wiring gated; end-to-end proposal insert exercised in api integration, not a unit DB) | Phase 2 |
-| Detections can be backtested over historical lake data before promotion | README (detection engineering) | `ci.yml` api job (`test_backtest.py` — bounded/allow-listed SQL construction with injection-sanitised source filter, lake-row→event mapping with JSON payload expansion, exact would-fire count + hit-rate + samples; `test_backtest_gate.py` — opt-in `AISOC_BACKTEST_MAX_HIT_RATE` /decide gate) + web type-check (rule-editor backtest panel) | PARTIAL (pure backtest logic + gate gated; the live tenant-scoped ClickHouse fetch is exercised by the integration gate, not a unit) | Phase 2 |
+| Analyst disposition history drives human-approval-gated tuning proposals | README (self-improving detections) | `ci.yml` api job (`test_wave1_loop_edges.py` — the previously-orphaned `suggest_tuning` engine is wired to real per-rule disposition history via `/detection/tuning/auto-suggest`, opening DRAFT proposals; `test_detection_tuner.py` fixture-gates the engine) + `ci.yml :: Python — Lint & Type-check` (`check_raw_sql_columns.py` — every table and column a raw `text()` INSERT/UPDATE names must be one some migration creates) | GATED (the gap this row used to name was wrong in the repository's favour: no job ran `services/api/tests/` against a real database at all, and the only assertion on the insert was a substring test that would still have passed on the wrong table name, because the wrong name contains the right one. The structural gate caught what no mock could — `detection_rule_proposals` has never had a `source` column, so all three automated proposal paths raised on their first row on every deployment; migration 073 adds it) | — |
+| Detections can be backtested over historical lake data before promotion | README (detection engineering) | `ci.yml` api job (`test_backtest.py` — bounded/allow-listed SQL construction with injection-sanitised source filter, lake-row→event mapping with JSON payload expansion, exact would-fire count + hit-rate + samples; `test_backtest_gate.py` — opt-in `AISOC_BACKTEST_MAX_HIT_RATE` /decide gate) + web type-check (rule-editor backtest panel) + `isolation-live.yml` (`tests/isolation/test_backtest_lake_live.py` — the real `fetch_lake_events` against ClickHouse 23.8, table built from `clickhouse/001_init.sql` and rows seeded through the production `lake_writer.event_to_row`) | GATED (the gap this row used to name was wrong: nothing ran the live fetch, and the tenant-scoping path existed twice — `detection_rules.py` carried its own near-identical copy, now deleted, with a test asserting exactly one definition survives. The live path exposed a defect no unit could: the writer stores OCSF `raw_data` into a column named `raw_payload` and `rows_to_events` expanded neither, so the payload expansion its docstring promises had never run on a real lake row. `services/api/app/services/backtest.py` was also absent from the workflow's path filter, so a change to the function under test did not trigger the job) | — |
| Detections can be authored in Python (`def rule(event)`) with a fixture gate | README (detection engineering) | `python-detections.yml` (`aisoc_detections.runner` fails a blind rule that misses a positive or a noisy one that fires on a negative; every bundled detection must ship ≥1 positive + ≥1 negative case) + `test_framework.py` (fail-closed evaluate, metadata validation) | GATED | - |
| AI Detection Builder: NL → rule + AUTO-generated fixtures → non-circular eval-gate → governed proposal | README (detection engineering) | `ci.yml` api job (`test_ai_detection_builder.py` — fixtures are DERIVED from the generated rule's own selection, not invented, and genuinely pass the non-circular gate: fires on the positive, quiet on the negative) | GATED | - |
| No-code / simple detection builder compiles to a valid rule | README (detection engineering) | `ci.yml` web type-check + lint (`SimpleRuleBuilder.tsx` `buildSigma` compiles field/operator/value rows to Sigma, dropped into the governed editor) | GATED | - |
@@ -82,8 +82,8 @@ Statuses: `GATED` (a CI job fails when the claim stops being true) · `PARTIAL`
| Documentation links on the front door resolve | README / SUPPORT / CONTRIBUTING | `link-check.yml :: front-door` (hard gate over the five files a new visitor reads; `:: docs-tree` observes the wider documentation tree so pre-existing rot is burned down deliberately rather than blocking unrelated PRs) | GATED | - |
| The CLI makes no network call unless an endpoint is configured | `packages/aisoc-lite/TELEMETRY.md` | `ci.yml` aisoc-lite vitest (`telemetry.test.ts` — there is no default endpoint, and an enabled-but-unconfigured run is asserted to make zero `fetch` calls) | GATED | - |
| The visual assets the README embeds exist | README (console tiles + walkthrough) | `readme-gates.yml :: static` (`gate_demo_asset_references` covers `apps/web/public/screenshots/` as well as `demo/`, so a renamed or deleted tile fails instead of rendering as a broken image) | GATED | - |
-| Groundedness: the agent asserts no indicator absent from the evidence it was given | README (groundedness axis) | `live-agent-eval.yml` (scored per incident on the live path via `app.confidence.groundedness`; deliberately not scored on the dry-run path, where there is no agent text and a 1.0 would be flattering fiction) | PARTIAL (computed and published on a scheduled local-model run; not yet a PR gate because a blocking floor has to be derived from real runs rather than invented) | floor from scheduled runs |
-| A live-agent eval can run with no funded provider key | (implied by the public eval harness) | `live-agent-eval.yml` (Ollama-hosted local model reached through `OPENAI_BASE_URL`; `--wet-limit` keeps it inside a CI budget and `--wet-require-live` stops a degraded run publishing substrate numbers as live-agent performance) | PARTIAL (scheduled + on-demand; promotion to `pull_request` tracked with the floor above) | floor from scheduled runs |
+| Groundedness: the agent asserts no indicator absent from the evidence it was given | README (groundedness axis) | `live-agent-eval.yml` (scored per incident on the live path via `app.confidence.groundedness`; deliberately not scored on the dry-run path, where there is no agent text and a 1.0 would be flattering fiction) | PARTIAL (two of the three sub-claims are already PR-gated in `Python — Tests`: `test_groundedness_eval.py` proves the scorer, and `test_groundedness_gate.py` drives the real triage worker and proves an ungrounded `false_positive` at 0.97 confidence is demoted to `needs_review` rather than auto-closed. The third — that *the live agent* asserts no indicator absent from its evidence — is not gated, because a hand-written string proves the scorer and only a real model's output proves the agent. The blocker is a number, not code: `live-agent-eval.yml` is registered, active, needs no funded key (it serves Ollama locally), and as of this audit has **0 runs** — it landed on `main` after that week's Tuesday window. A floor invented before the distribution exists would be a number nobody measured, and a flaky blocking floor gets bypassed) | floor from scheduled runs |
+| A live-agent eval can run with no funded provider key | (implied by the public eval harness) | `live-agent-eval.yml` (Ollama-hosted local model reached through `OPENAI_BASE_URL`; `--wet-limit` keeps it inside a CI budget and `--wet-require-live` stops a degraded run publishing substrate numbers as live-agent performance) | PARTIAL (scheduled + on-demand, and **not yet observed to run** — the workflow has 0 runs, so the claim is designed-for rather than demonstrated. Nothing about it is blocked on a funded provider key, a vendor account or a paid registry: the obstacles to promoting it to `pull_request` are runner budget and the output variance of a 0.5b local model, which is why it follows the observe-then-ratchet convention `security.yml` already uses. Promotion lands with the floor above) | floor from scheduled runs |
| Response actions are verified against the vendor, not assumed from a 200 | README (verified response) | `ci.yml` actions matrix (`test_dispatch_verification.py` — asserts the dispatcher reaches the verifier on the live path, that an action which reported success with the effect absent is downgraded to FAILED, and that `unverified` is never upgraded to a confirmation) | GATED | - |
| Host isolation is confirmed by reading real containment state | (implied by verified response) | `ci.yml` actions matrix (`test_verification.py` — a resolvable-but-uncontained host must score FAILED; `containment_pending` must not count as verified) | GATED | - |
| Autonomy is governed per tenant, not per deployment | `apps/docs/docs/concepts/automation-maturity.md` (L0–L4) | `ci.yml` actions matrix (`test_tenant_policy.py` + `test_dispatch_tenant_governance.py` — two tenants get their own tiers, an unreadable policy falls to a conservative floor rather than inheriting a permissive env default, and the L4 whitelist reaches `decide()`) | GATED | - |
@@ -247,9 +247,9 @@ Statuses: `GATED` (a CI job fails when the claim stops being true) · `PARTIAL`
## Summary
-- GATED: 228
-- PARTIAL: 8
-- NO GATE: 0 (**every claim is backed by a failing test.** The last NO GATE — the weekly benchmark scoreboard running live against `main` — closed in Phase E1: `scripts/check_scoreboard.py` ties the published scoreboard to a deterministic per-PR live-agent MITRE-accuracy run, while the funded weekly `wet-eval.yml` appends the LLM-tier rows. The remaining PARTIAL rows are honest, named deferrals — each states the specific gap and what closes it — not unproven claims.)
+- GATED: 234
+- PARTIAL: 2
+- NO GATE: 0 (**every claim is backed by a failing test.** The last NO GATE — the weekly benchmark scoreboard running live against `main` — closed in Phase E1: `scripts/check_scoreboard.py` ties the published scoreboard to a deterministic per-PR live-agent MITRE-accuracy run, while the funded weekly `wet-eval.yml` appends the LLM-tier rows. The two remaining PARTIAL rows are honest, named deferrals — each states the specific gap and what closes it — not unproven claims.)
> **Counting note.** These figures previously read 46 / 9, which did not match
> what the ratchet script counted. `_parse_status_rows` stops at the first
@@ -282,11 +282,33 @@ Statuses: `GATED` (a CI job fails when the claim stops being true) · `PARTIAL`
### On the PARTIAL rows
They are not closed by editing this column. Each names a gate that does not
-exist yet — a hermetic ledger-replay e2e, a per-language SDK contract-drift
-check, a 150-payload adversarial eval, an egress-blocked air-gapped job.
-Relabelling any of them GATED without building the gate would make this file a
-liability rather than a control, since its whole value is that a reader can
-trust the Status column without reading the workflows.
+exist yet. Relabelling any of them GATED without building the gate would make
+this file a liability rather than a control, since its whole value is that a
+reader can trust the Status column without reading the workflows.
+
+Six of the eight closed in one pass, and every one was built rather than
+relabelled — the ledger's replay contract, the per-language SDK surface, the
+platform-wide egress default, the raw-SQL column contract, the live
+tenant-scoped lake fetch, and the scanner ratchet. Each was proven to fail
+before it was trusted, and four of them found a live defect on the way in: the
+SDKs called four operations the API does not serve; `detection_rule_proposals`
+had never had the `source` column three raw INSERTs name, so every automated
+proposal path raised on its first row; `services/purple-team` published a
+public CDN default nothing in the service read; and the writer stores OCSF
+`raw_data` into a column named `raw_payload`, so the backtest's payload
+expansion had never run on a real lake row. Three of the six rows also had a
+**gap statement that was wrong in the repository's favour** — they credited an
+"api integration" job and an "integration gate" that do not run those paths —
+which is its own lesson: a PARTIAL row's caveat needs re-deriving, not just
+clearing.
+
+The two that remain are both the same shape and neither is blocked on code.
+The live-agent eval workflow needs no funded provider key — it serves a local
+model — but it has never run, so there is no distribution to derive a
+groundedness floor from, and a floor invented before the measurement exists
+would be a number nobody took. The scorer and the production demotion it
+drives are already PR-gated; what is not gated is the live agent's own output,
+and a hand-written string cannot stand in for that.
"Cross-tenant isolation (Postgres)" left this list the only way it may: its gap
read "compiled-SQL not live DB", and `tests/isolation/test_postgres_rls.py` is
diff --git a/scripts/project_stats.py b/scripts/project_stats.py
index 6b854d48a..585efb331 100755
--- a/scripts/project_stats.py
+++ b/scripts/project_stats.py
@@ -81,13 +81,36 @@ def _executable_detections() -> int | None:
return total
+#: Directories under `detections/` holding YAML that is not a detection rule.
+#: Kept equal to `detection_truth_table.py`'s `SKIP_DIRS`, because a rule
+#: count and a file count published under the same words is how two surfaces
+#: come to disagree while both are right.
+_NON_RULE_DIRS = {"fixtures", "playbooks"}
+
+
def _detection_files_on_disk() -> int:
- """Every YAML under detections/, including the quarantine.
+ """Detection *rules* on disk, including the quarantine.
Reported alongside the executable count so the gap is visible rather than
conflated. The two numbers have been published interchangeably before.
+
+ This used to count every YAML under `detections/` and print the result as
+ "Detection files on disk", which put 7,016 against the README's 6,991
+ under the same label. Both were right and they were counting different
+ things: the extra 25 are the standalone response playbooks under
+ `detections/playbooks/`, which are not detection rules. The rule count is
+ now the one the truth table and the README publish, and the wider file
+ count is printed beside it saying what it includes.
"""
d = ROOT / "detections"
+ if not d.is_dir():
+ return 0
+ return sum(1 for p in d.rglob("*.yaml") if not _NON_RULE_DIRS & set(p.relative_to(d).parts))
+
+
+def _detection_yaml_files() -> int:
+ """Every YAML under detections/, rules and playbooks alike."""
+ d = ROOT / "detections"
return sum(1 for _ in d.rglob("*.yaml")) if d.is_dir() else 0
@@ -141,6 +164,7 @@ def collect() -> dict:
"connectors": _connectors(),
"detections_executable": _executable_detections(),
"detections_files_on_disk": _detection_files_on_disk(),
+ "detections_yaml_files": _detection_yaml_files(),
"services_in_repo": _python_services(),
"compose": _compose_services(),
"claim_gate": _claim_gate_rows(),
@@ -154,13 +178,15 @@ def collect() -> dict:
def _render(stats: dict) -> str:
c = stats["compose"]
g = stats["claim_gate"]
+ playbook_yaml = stats["detections_yaml_files"] - stats["detections_files_on_disk"]
lines = [
"",
f" AiSOC {stats.get('version', '?')} — figures recounted from the tree",
"",
f" Connectors (registered) {stats['connectors']}",
f" Detections (engine loads) {stats['detections_executable']}",
- f" Detection files on disk {stats['detections_files_on_disk']} (includes quarantined imports the engine never evaluates)",
+ f" Detection rules on disk {stats['detections_files_on_disk']} (includes quarantined imports the engine never evaluates)",
+ f" YAML files under detections/ {stats['detections_yaml_files']} (the extra {playbook_yaml} are response playbooks, not rules)",
f" Services in repo {stats['services_in_repo']}",
]
if c:
diff --git a/tests/test_readme_figures_gate.py b/tests/test_readme_figures_gate.py
index 12a41c251..e07d1e569 100644
--- a/tests/test_readme_figures_gate.py
+++ b/tests/test_readme_figures_gate.py
@@ -10,6 +10,7 @@ passes is indistinguishable from no gate.
from __future__ import annotations
import importlib.util
+import re
import sys
from pathlib import Path
@@ -301,3 +302,25 @@ def test_the_live_tree_presents_its_own_version(tmp_path: Path) -> None:
assert module.REPO_ROOT == REPO_ROOT
assert module._declared_version() == (REPO_ROOT / "VERSION").read_text().strip()
assert module.gate_current_version() == []
+
+
+def test_project_stats_rule_count_matches_the_truth_table() -> None:
+ """One label, one number.
+
+ `project_stats.py` printed every YAML under `detections/` as "Detection
+ files on disk" — 7,016 against the README's 6,991 under the same words.
+ Both counts were right and they counted different things; the extra 25
+ are response playbooks. Two surfaces using one label for two numbers is
+ how a reader concludes one of them is lying.
+ """
+ spec = importlib.util.spec_from_file_location("_project_stats_under_test", REPO_ROOT / "scripts" / "project_stats.py")
+ assert spec and spec.loader
+ stats = importlib.util.module_from_spec(spec)
+ sys.modules[spec.name] = stats
+ spec.loader.exec_module(stats)
+
+ table = (REPO_ROOT / "docs" / "detections" / "truth-table.md").read_text(encoding="utf-8")
+ match = re.search(r"\|\s*rules on disk \(total\)\s*\|\s*(\d+)\s*\|", table)
+ assert match, "the truth table no longer publishes a total rules-on-disk row"
+ assert stats._detection_files_on_disk() == int(match.group(1))
+ assert stats._detection_yaml_files() >= stats._detection_files_on_disk()