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.
Python agentic-aiai-securityalert-triageblue-teamcybersecuritydetection-engineeringincident-responselanggraphllm-agentsmcpmitre-attackmodel-context-protocolpurple-teamsecurity-operationsself-hostedsiemsoarsocthreat-detectionthreat-intelligence
docs(autonomy): say plainly that SIEM-side reconciliation has no scheduler yet (#909)
Beenu Arora4ab7c7b226d6
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 38e5872db..1f5f0fbbf 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -104,9 +104,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0approval raised, no outcome prior recorded, no escalation. It still writesthe ledger run, the `ai_*` columns and a decision row, and it still billsthe spend, because a shadow run is the product running rather than a- measurement the tenant asked for. When an analyst later closes the alert,- here or in the source SIEM, the closure is matched to the decision it- grades and the pair becomes evidence.+ measurement the tenant asked for. When an analyst later closes the alert in+ AiSOC, a bounded sweep matches the closure to the decision it grades and the+ pair becomes evidence. The reader and the matcher for closures made in the+ customer's own SIEM ship here too, reusing the Phase 1.1 readers unchanged,+ but **nothing calls them on a schedule yet**, so that half is not automatic+ and the documentation says so in those words rather than leaving an operator+ to work it out from an empty scorecard.**The property the whole thing rests on.** `alerts.disposition` is theanalyst's column and it is the column agreement is read back from. A shadowdiff --git a/GAP_CLOSURE_PROGRESS.md b/GAP_CLOSURE_PROGRESS.mdindex 9b3e31516..2f79123a2 100644--- a/GAP_CLOSURE_PROGRESS.md+++ b/GAP_CLOSURE_PROGRESS.md@@ -259,7 +259,7 @@ the decomposition and what each link rests on are in D8 above.## Phase 2: Live shadow mode and evidence-gated autonomy-- [x] **2.1 Shadow mode**, per tenant and per alert class. Shipped in [#906](https://github.com/beenuar/AiSOC/pull/906). The seam is Phase 1.2's: `FusedAlertTriageWorker` already routes every write through the `TriageWriter` port, so shadow mode is a wrapper around the tenant's live sink rather than a second code path. Chosen per alert, not per worker, because the class is not known until the alert is in hand; the constructor sinks are untouched, which is what keeps the Phase 1.2 AST test true. Migration **066** adds `aisoc_shadow_mode` and `aisoc_shadow_decisions`. Analyst closures arrive from two places: a bounded sweep over closed alerts in this console, and the five Phase 1.1 SIEM readers polled back out of the customer's own product and matched on the vendor finding id. See D9 for the one property everything else rests on.+- [~] **2.1 Shadow mode**, per tenant and per alert class. Shipped in [#906](https://github.com/beenuar/AiSOC/pull/906), with one half of the closure path still open (see D15). The seam is Phase 1.2's: `FusedAlertTriageWorker` already routes every write through the `TriageWriter` port, so shadow mode is a wrapper around the tenant's live sink rather than a second code path. Chosen per alert, not per worker, because the class is not known until the alert is in hand; the constructor sinks are untouched, which is what keeps the Phase 1.2 AST test true. Migration **066** adds `aisoc_shadow_mode` and `aisoc_shadow_decisions`. Analyst closures arrive from a bounded sweep over alerts closed in this console. The reader and matcher for closures made in the customer's own SIEM ship too, on the five Phase 1.1 readers unchanged, and nothing calls them on a schedule yet. See D9 for the one property everything else rests on.- [x] **2.2 Rolling agreement** per alert class, rule, source and model, on the operations dashboard and the autonomy scorecard. Shipped in [#906](https://github.com/beenuar/AiSOC/pull/906). The metrics are Phase 1.3's and "uses the Phase 1 metrics" is now a gate rather than a sentence: `check_replay_contract_parity.py` went from three trees to four and compares `GRADED_DISPOSITIONS`, `ABSTENTION_VERDICTS`, `MALICIOUS` and `UNLABELED` in both directions, proven capable of failing by drifting each collection in turn. Agreement is computed over *answered* decisions only so abstaining cannot inflate it, malicious recall counts an abstention as a miss, a rate with no denominator reads "not measured", and every rate travels with its count. Matrix 156 rows to 159, GATED 148 to 151.- [x] **2.3 Promotion gate**, with automatic demotion on drift and every transition written to the hash-chained audit log. Shipped in [#908](https://github.com/beenuar/AiSOC/pull/908). Migration **067** adds `aisoc_autonomy_grants`. The gate is pure and lives in the vendored rules module so `services/actions` enforces the same arithmetic at dispatch that `services/api` decides on at promotion time. Wired into all three modules the plan names: `unified_autonomy.unified_decision` gained an `earned_grant` argument that can only widen the reversible MEDIUM-blast branch, `tenant_policy.TenantPolicy` carries the earned verbs and never issues one, and `autonomy_policy.py` gained `GET`/`POST`/`DELETE /grants`. The dispatcher was also wired, because `unified_decision` turned out to have no production caller at all (see D12). The "Done when" runs against a real Postgres in `integration.yml`. See D13 for why the ceiling stops at L3.@@ -474,6 +474,40 @@ the five mirrors already in the tree, with`sync_vendored_autonomy_evidence.py --check` wired into `ci.yml`. Two copiesallowed to differ means the control is off in whichever one is more generous.+### D15. The SIEM half of reconciliation has no scheduled caller, and the docs said it did++Found by grepping for callers of the code this program had just written, which+is the check this repository's own history says to run before claiming+anything.++`services/actions/app/services/shadow_reconcile.py` exists, reuses the five+Phase 1.1 readers unchanged, matches a vendor closure to the decision it+grades on the vendor finding id, keeps `unmatched` and `already_resolved`+apart, and has eleven tests. **Nothing calls it.** The AiSOC-side half is+wired and runs on every read of the agreement endpoint; the SIEM-side half is+a library with no driver.++The docs page shipped in #906 said closures "are polled back out" of the five+vendors, which is a claim about a thing with no scheduler. An operator whose+analysts work entirely in Splunk would have waited for a scorecard that was+never going to fill in, and concluded the agent was not being evaluated rather+than that we were not looking.++**Resolution:** the claim is corrected rather than the code hurried. The page+now says in those words that this half is not automatic, names what exists and+what does not, and says agreement is measured on AiSOC closures until it+lands. 2.1 moves from `[x]` to `[~]`.++**What closes it,** in the shape the architecture already forces: `services/api`+owns the vault and the tenant session, so it resolves the connector's+credentials and posts them with a window to a new internal route on+`services/actions`, which calls the reader and then `reconcile_findings`. That+is the same round trip `siem_writeback` and `/connectors/{id}/normalize`+already take, and for the same reason: one process cannot hold two services+that both package their code as top-level `app`. It was not hurried into this+phase because a cross-service route added under time pressure is exactly the+half-wired feature the correction above is about.+### D12. `unified_decision` had no production caller, and the plan names it anywayThe plan says to wire the promotion gate intodiff --git a/apps/docs/docs/operations/shadow-mode.md b/apps/docs/docs/operations/shadow-mode.mdindex eebdeaaab..05731307b 100644--- a/apps/docs/docs/operations/shadow-mode.md+++ b/apps/docs/docs/operations/shadow-mode.md@@ -96,16 +96,23 @@ can be closed from the feedback endpoint, by a case being resolved, by a bulkaction or by a playbook, and a hook on one of those would silently grade thesubset of alerts closed the way the hook was written for.-**Closures made in your SIEM.** Most analysts evaluating AiSOC keep working-where they always have. The same readers that power-[replay evaluation](../evaluation/replay.md) poll closed findings back out of-Splunk ES, Microsoft Sentinel, Elastic Security, IBM QRadar and Microsoft-Defender XDR, and each closure is matched to the decision it grades by the-vendor's own finding id. A tenant whose analysts work entirely in Splunk will-still see their scorecard fill in.--Either way, a closure carrying a disposition this platform cannot name becomes-`unlabeled`. It is counted as resolved and excluded from every rate. Splunk ES+**Closures made in your SIEM. Not automatic yet.** Most analysts evaluating+AiSOC keep working where they always have, so a closure recorded in Splunk ES,+Microsoft Sentinel, Elastic Security, IBM QRadar or Microsoft Defender XDR+should count. The readers exist and are the same ones that power+[replay evaluation](../evaluation/replay.md), and+`services/actions/app/services/shadow_reconcile.py` matches each closure to the+decision it grades by the vendor's own finding id.++**What does not exist is a scheduler that calls them.** Nothing polls your SIEM+for shadow reconciliation on a timer today, so a tenant whose analysts work+entirely in their own console will see a scorecard that does not fill in. That+is a gap in this feature, not a property of your deployment, and it is recorded+as such rather than left for you to discover from an empty page. Until it+lands, agreement is measured on closures made in AiSOC.++Whichever route a closure arrives by, one carrying a disposition this platform+cannot name becomes `unlabeled`. It is counted as resolved and excluded from every rate. Splunk ESships two dispositions that literally mean "I do not know", and so do Sentineland Defender; folding those into a verdict because the finding happened to beclosed would manufacture agreement out of an analyst's uncertainty.diff --git a/docs/audit/CLAIM_TO_GATE_MATRIX.md b/docs/audit/CLAIM_TO_GATE_MATRIX.mdindex f30ce3efb..49f08ab50 100644--- a/docs/audit/CLAIM_TO_GATE_MATRIX.md+++ b/docs/audit/CLAIM_TO_GATE_MATRIX.md@@ -163,7 +163,7 @@ Statuses: `GATED` (a CI job fails when the claim stops being true) · `PARTIAL`| A report field the provider does not publish reads "unavailable", never zero or empty | `operations/sandbox-providers.md` (provider contract) | `ci.yml :: api tests` (`test_sandbox_providers.py`, driven against a **recorded** report whose `attackTechniques` is `[]` beside `behavior.analyzed: false`; the adapter must return `UNAVAILABLE` with the stage's own reason attached, and the same payload with the stage marked run must return a real empty tuple. A missing score must not read as 0 and a missing IOC section must not read as "none found") | GATED | the recorded payload covers one provider and one shape of absence; CAPEv2's equivalents are synthetic because no live CAPEv2 instance was available || Replay evaluation runs the production triage path, not a copy of it, and writes nothing while it does | `apps/docs/docs/evaluation/replay.md`; `services/agents/app/replay/runner.py` | `ci.yml` agents job (`test_replay_shadow_no_writes.py` — every durable write on the triage path is monkeypatched on the **real** module to raise a `BaseException`, then a replay is run: a `BaseException` because the worker wraps most of its writes in `contextlib.suppress(Exception)`, which is correct production behaviour and is exactly what would let a leaked write pass a gentler guard. Zero writes is asserted as a *count* rather than as an absence, since a replay that stopped replaying and a replay whose writes were suppressed both write nothing and only the counter tells them apart. That the path is production's is pinned two ways: the worker's default sinks are asserted to be `LiveTriageWriter`/`LiveTriageContextReader`, and an AST pass over `services/agents/app/main.py` asserts the deployed worker is constructed without overriding either. `test_escalation_cannot_change_the_graded_verdict` drives the real worker with a graph runner that rewrites the verdict and asserts the returned summary is unmoved, which is what makes declining escalation in shadow mode sound rather than convenient) | GATED | Triage only. Fusion's correlation, fused confidence score, narrative and entity resolution are absent from a replayed finding; `ENVELOPE_LIMITS` is published in every report's method section rather than left as a comment || The test window of a replay cannot influence its own triage | `apps/docs/docs/evaluation/replay.md` (point-in-time context); `services/agents/app/replay/shadow.py` | `ci.yml` agents job (`test_replay_leakage.py` — three routes from a test-window decision back into a later one, each with its own test because one combined assertion would not say which broke: the outcome-memory prior that auto-closes a repeat without re-triage, the cost governor's dedup cache that short-circuits earlier still and leaves no ledger row or prior behind, and organisation memory read live into the prompt. Each is checked for **sensitivity** as well as for the guard: the memory test runs the identical corpus twice, once with the shadow sinks and once with a live reader and a recording writer, and asserts the second leaks at tier `memory`; the statements test asserts the frozen reader hands the agent the snapshot and that the same worker with the live reader picks up the poison. `capture_context` drops rows recorded after the split in both stores, and a snapshot taken at any other instant is refused rather than used) | GATED | Organisation-memory statements as `GET /feedback/context-statements` serves them carry no creation time, so the split filter has nothing to test them against and they are kept. The count is published as `statements_without_timestamp` in the report's method section rather than the freeze being claimed tighter than it is |-| A shadow verdict never fills in the analyst column it will be graded against | `apps/docs/docs/operations/shadow-mode.md`; `services/agents/app/workers/shadow_mode.py` | `ci.yml` agents job (`test_shadow_mode.py`) - the shadow sink is asserted to decline every acting method against a delegate that *records* rather than performs, so a forwarded call shows up as a recorded one rather than as an absence; `persist_auto_triage` is asserted to force `auto_closed` off and the `shadow` flag on; and the ledger statement is read to confirm `disposition`, `status` and `resolved_at` are each guarded by that flag with `NOT $10` rather than by the caller remembering to pass `auto_closed=False`. Plus `ci.yml` api job (`test_shadow_agreement.py`) - reconciliation only reads closed alerts and only writes decisions with `resolved_at IS NULL`, so a later change of mind cannot rewrite evidence a promotion already rested on | GATED | The SQL guard is read, not executed: there is no Postgres in the unit suites, so what is proven is that the statement carries the guard and binds the flag, not that Postgres evaluates the CASE as written. A live replay of the statement belongs with the isolation suite |+| A shadow verdict never fills in the analyst column it will be graded against | `apps/docs/docs/operations/shadow-mode.md`; `services/agents/app/workers/shadow_mode.py` | `ci.yml` agents job (`test_shadow_mode.py`) - the shadow sink is asserted to decline every acting method against a delegate that *records* rather than performs, so a forwarded call shows up as a recorded one rather than as an absence; `persist_auto_triage` is asserted to force `auto_closed` off and the `shadow` flag on; and the ledger statement is read to confirm `disposition`, `status` and `resolved_at` are each guarded by that flag with `NOT $10` rather than by the caller remembering to pass `auto_closed=False`. Plus `ci.yml` api job (`test_shadow_agreement.py`) - reconciliation only reads closed alerts and only writes decisions with `resolved_at IS NULL`, so a later change of mind cannot rewrite evidence a promotion already rested on | GATED | Two limits. The SQL guard is read, not executed: there is no Postgres in the unit suites, so what is proven is that the statement carries the guard and binds the flag, not that Postgres evaluates the CASE as written. And this covers closures made in AiSOC only: the reader and matcher for closures made in the customer's own SIEM are tested (`test_shadow_reconcile.py`) but nothing calls them on a schedule, so a tenant whose analysts work entirely in their SIEM has no evidence flowing. Recorded as D15 in the progress tracker and stated on the docs page rather than left to be discovered from an empty scorecard || Agreement cannot be improved by declining to answer | `apps/docs/docs/operations/shadow-mode.md`; `services/actions/app/services/autonomy_evidence_rules.py` | `ci.yml` actions job (`test_autonomy_evidence_rules.py`) - the same ten right answers are scored with nothing declined and with ninety declined, and the agreement rate is asserted identical, because abstaining removes a decision from the numerator and the denominator together. The counterweight is asserted from the other side: a window where the agent answered ten of forty labelled cases posts a perfect agreement rate and a malicious recall of 8/30, since recall's denominator is every malicious case whether answered or not. The abstention rate is asserted to move where agreement does not, and `AgreementWindow` refuses to construct at all when its counts do not add up, so a miscounted aggregate raises instead of publishing a plausible rate | GATED | The metric is gated; what it is used *for* is Phase 2.3. This row proves the rate cannot be gamed, not that anything yet refuses a promotion on it || Live agreement is scored by the Phase 1 metrics rather than a second set | `plans/aisoc_gap_closure_plan.plan.md` (2.2, "using the Phase 1 metrics"); `apps/docs/docs/operations/shadow-mode.md` | `ci.yml :: python-lint` (`check_replay_contract_parity.py`, extended from three trees to four: `GRADED_DISPOSITIONS`, `ABSTENTION_VERDICTS` and the `MALICIOUS` spelling must be identical strings in `autonomy_evidence_rules.py` and in `aisoc_benchmark/replay.py`, compared in both directions, and `UNLABELED` must be spelled the same in all three. Proven capable of failing by drifting each of the two collections in turn and watching it fire, rather than only having never fired) + `ci.yml` (`sync_vendored_autonomy_evidence.py --check`, which byte-compares the API's copy, because a safety control defined twice is off in whichever copy is more generous) | GATED | Parity of the definitions is gated. That the two implementations compute the same number from the same rows is not: the grader scores a list of decision dicts and the live path aggregates in SQL, so they share a vocabulary rather than a code path || Autonomy is granted on a measured track record, and refused without one | `apps/docs/docs/operations/shadow-mode.md` (earning autonomy); `services/actions/app/services/autonomy_evidence_rules.py` | `ci.yml` actions job (`test_autonomy_promotion_gate.py`, which starts from one qualifying control and breaks one property per test, so a failure names the property rather than the file) + `integration.yml` (`tests/isolation/test_autonomy_promotion_live.py`, the phase's "Done when" run against a real Postgres: a tenant with 20 recorded shadow decisions is refused, the same tenant with 150 is granted, and injected disagreements demote it. The live half exists because the aggregate and the evaluator agree by convention and a convention is what drifts: only a real database executing the real statement over real rows proves the SQL counts what the gate expects. `AUTONOMY_PROMOTION_LIVE_REQUIRED=1` turns an unreachable database into a failure rather than a skip) | GATED | The four refusals are gated. What is not gated is whether the thresholds are the *right* numbers: 100 decisions and 30 malicious are the plan's, and 95% agreement and 90% recall are choices nobody has yet validated against an outcome. They are configurable per call and travel by value in every snapshot |