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
Agentmetry ingest template: AI coding-agent activity and detections (Discussion #1577) (#1580)
Beenu Aroraf958621fc714
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 46d5d8810..1da3a80dd 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -9,6 +9,36 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0### Added+- **Agentmetry ingest template: AI coding-agent activity as an input**+ (GitHub Discussion #1577). [Agentmetry](https://github.com/blitzcrieg1/agentmetry)+ records the tool calls Claude Code, Cursor, Codex and Copilot make through+ their own hooks and correlates them into ATT&CK/ATLAS-mapped detections;+ its webhook sink posts one canonical JSON event per request, routine+ activity and detections down one URL. The discussion asked whether+ generic-json "should land" them — checked against the real template with+ real captured events: they land, but severity flattens to Unknown on every+ event including critical detections (generic-json reads a top-level+ `severity`; theirs lives at `action.outcome` / `detection.severity`),+ every routine tool call is promoted to an alert (class 2001 is always+ promoted — one busy agent is a queue flood), and titles, technique ids and+ the event timestamp are lost. The bundled `agentmetry` template fixes+ exactly that: the template language gains `class_field`/`class_map` (one+ URL, per-event-kind class: tool calls stay 6003 API Activity in the lake,+ `action.type: detection` routes to 2001 Security Finding, always promoted)+ and `technique_fields` (vendor-supplied ATT&CK ids carried as supplied+ through the same `mitre_attck` block the connector path emits, shared via+ the newly exported `EnrichTechniqueIDs`/`TechniqueIDsFromPaths`; ATLAS+ `AML.T****` ids are preserved in evidence fields and refused from+ ATT&CK-typed ones, matching Agentmetry's own warning). The five-tier+ severity ladder survives end to end — critical maps to its own tier,+ never high. Agentmetry-observed coding agents feed the AI-estate+ inventory and graph (`agentmetry` joins the `ai-runtime`/`ai-finding`+ source-type branch in both consumers), the template is mintable from the+ console catalog, and the docs page states plainly what was verified+ against captured events versus what remains unexercised live. Also fixes+ the `ai-estate.md` table row that claimed `ai-finding` is class 6003 —+ the template is and was 2001.+- **Asset criticality reaches fusion confidence and action approval —tighten-only.** Fusion stamps what each alert landed on at fuse time(`enrichments["asset_context"]`, resolved from the tenant's own `assets`diff --git a/ROADMAP.md b/ROADMAP.mdindex e5c815046..3b7081b86 100644--- a/ROADMAP.md+++ b/ROADMAP.md@@ -45,7 +45,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 **329 rows — 324 GATED / 5 PARTIAL / 0 NO GATE**. Five rows are PARTIAL, each naming what closes it: "Cloud-native collection" until a capture recorded from a live Event Hub replaces the fixture synthesised from the Avro specification; "the retention window a tenant chooses is the one the lake honours" until a live ClickHouse test watches a row survive past the old 90-day boundary; "the AI estate is discovered on the endpoint" until a containerised osquery runs the shipped pack end to end; and "a reported phishing message can be purged across its recipients" until a maintainer-supplied Microsoft 365 or Google Workspace tenant lets the documented request shapes be exercised for real; and "every automatic closure of a production alert is checked against the current policy, grant and stop controls" until the live suite that proves it against real Postgres has been observed to pass on `main` rather than only in the pull request that added it. "SSO completes a sign-in" closed the way the programme requires — by building the gate it named: `sso-live.yml` stands up a containerised Keycloak and both legs have been observed to pass. Every other product claim is backed by a failing test, none is a named deferral either, and the ratchet (`MAX_NO_GATE=0`) forbids any regression. Every PARTIAL row was closed by building the gate it named, never by relabelling. 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 **330 rows — 325 GATED / 5 PARTIAL / 0 NO GATE**. Five rows are PARTIAL, each naming what closes it: "Cloud-native collection" until a capture recorded from a live Event Hub replaces the fixture synthesised from the Avro specification; "the retention window a tenant chooses is the one the lake honours" until a live ClickHouse test watches a row survive past the old 90-day boundary; "the AI estate is discovered on the endpoint" until a containerised osquery runs the shipped pack end to end; and "a reported phishing message can be purged across its recipients" until a maintainer-supplied Microsoft 365 or Google Workspace tenant lets the documented request shapes be exercised for real; and "every automatic closure of a production alert is checked against the current policy, grant and stop controls" until the live suite that proves it against real Postgres has been observed to pass on `main` rather than only in the pull request that added it. "SSO completes a sign-in" closed the way the programme requires — by building the gate it named: `sso-live.yml` stands up a containerised Keycloak and both legs have been observed to pass. Every other product claim is backed by a failing test, none is a named deferral either, and the ratchet (`MAX_NO_GATE=0`) forbids any regression. Every PARTIAL row was closed by building the gate it named, never by relabelling. 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 — Shippeddiff --git a/apps/docs/docs/compliance/evidence-pack.md b/apps/docs/docs/compliance/evidence-pack.mdindex 7dc8562e0..878c98759 100644--- a/apps/docs/docs/compliance/evidence-pack.md+++ b/apps/docs/docs/compliance/evidence-pack.md@@ -33,7 +33,7 @@ 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: 324 rows+The last row is the one worth reading first. It is the honest index: 325 rows`GATED`, 5 `PARTIAL`, and a ratchet that refuses to let a row sit at`NO GATE`. Re-read the figure from the table rather than from here — a countcopied into prose goes stale in silence, which is whydiff --git a/apps/docs/docs/concepts/ai-estate.md b/apps/docs/docs/concepts/ai-estate.mdindex d9191f1e3..04a7297e5 100644--- a/apps/docs/docs/concepts/ai-estate.md+++ b/apps/docs/docs/concepts/ai-estate.md@@ -33,7 +33,8 @@ different things and collapsing them loses the distinction:| Template | OCSF class | Carries ||----------|-----------|---------|| `ai-runtime` | `6003` | Routine model and tool activity: which model, which tool, token counts, latency, the requesting principal. |-| `ai-finding` | `6003` | A guardrail or classifier fired: injection attempt, jailbreak, refusal, sensitive-data match. Promoted to an alert. |+| `ai-finding` | `2001` | A guardrail or classifier fired: injection attempt, jailbreak, refusal, sensitive-data match. Promoted to an alert. |+| `agentmetry` | `6003` / `2001` | [Agentmetry](../connectors/agentmetry.md) coding-agent telemetry — one URL for both kinds, split per event: routine tool calls land at `6003`, its correlated detections at `2001`. |Routine activity is not alerted on. It is the baseline that makes a findinginterpretable — a single refused prompt means little; a refused prompt from a@@ -54,6 +55,11 @@ Dependency-free, so adding it does not change your dependency tree.**The inbox webhook** takes whatever your platform already emits, mappedthrough a template. See [universal capture](../connectors/universal-capture.md).+For AI *coding* agents specifically — Claude Code, Cursor, Codex, Copilot and+the MCP servers behind them — the open-source+[Agentmetry](../connectors/agentmetry.md) sensor captures tool calls through+the agents' own hooks and pushes them here through its bundled template,+correlated detections included.### Prompts are hashed by defaultdiff --git a/apps/docs/docs/connectors/agentmetry.md b/apps/docs/docs/connectors/agentmetry.mdnew file mode 100644index 000000000..a84b0c863--- /dev/null+++ b/apps/docs/docs/connectors/agentmetry.md@@ -0,0 +1,115 @@+---+title: Agentmetry (AI coding agents)+description: Ingest AI coding-agent activity and correlated detections from Agentmetry via the universal-capture inbox.+---++# Agentmetry (AI coding agents)++[Agentmetry](https://github.com/blitzcrieg1/agentmetry) (Apache-2.0) is an+open-source sensor for AI coding agents. It records each tool call Claude+Code, Cursor, Codex and Copilot make through their own hooks, and every call+through MCP servers wrapped by its proxy; it correlates sequences into+detections mapped to MITRE ATT&CK and ATLAS — for example a session that+pulled in an issue comment or web page and then touched credentials. It runs+on the developer machine and forwards canonical JSON events to whatever the+team already runs.++AiSOC ingests that stream through the bundled `agentmetry` inbox template.+No connector to install: Agentmetry pushes, AiSOC maps, and the events join+the same pipeline as every other source — lake, detections, correlation,+triage, and the [AI estate inventory](../concepts/ai-estate.md), which+records each coding agent with the person and device behind it.++- **Template id:** `agentmetry`+- **Category:** ai+- **Path:** `POST /v1/inbox/{tenant_token}` ([universal capture](universal-capture.md))++## Setup++1. In the console, mint an inbox token with the **Agentmetry (AI coding+ agents)** template (Settings → Data sources → Universal capture). Copy+ the URL — it is shown once.+2. Point Agentmetry's webhook sink at it:++ ```text+ AGENTMETRY_AUDIT_SINK=webhook # or a list that includes webhook+ AGENTMETRY_AUDIT_WEBHOOK_URL=https://ingest.example.com/v1/inbox/aitnb_...+ ```++3. Keep `AGENTMETRY_AUDIT_WEBHOOK_FORMAT` at its default, `canonical` — one+ canonical JSON event per POST, which is what the template maps. The+ `batch` and `cloudevents` formats wrap the record in an envelope the+ template does not unwrap.++The token authenticates by being in the URL; mint it without a signing+secret, since Agentmetry's sink does not sign request bodies. Treat the URL+as a credential.++## What lands where++One URL carries two event kinds, and they deliberately land in different+OCSF classes — the same split the `ai-runtime` / `ai-finding` templates+encode:++| Event kind | OCSF class | What happens |+|---|---|---|+| Routine activity (`action.type: tool_called`, `session_start`, `approval_request`, `mcp_schema`, …) | `6003` API Activity | Archived to the event lake for hunting. Not promoted to an alert — a coding agent emits an event per tool call, and promoting each one floods the queue with its normal operation. |+| Correlated detections (`action.type: detection`) | `2001` Security Finding | Always promoted to an alert, whatever the severity — Agentmetry's rule engine already judged the sequence worth attention, the same reasoning that promotes a Splunk notable. |++Detection severity is read from `detection.severity`+(`critical | high | medium | low`) and preserved tier for tier — a critical+detection arrives as a critical alert, never collapsed into high. Routine+activity carries no vendor severity and surfaces as Unknown, which is the+honest value: the detections are the severity-bearing stream.++ATT&CK technique ids the sensor supplies (`detection.technique_ids`,+`tool.mitre.technique_id`) are carried as supplied, never re-inferred, and+marked `verified: true` only when AiSOC's own ATT&CK corpus confirms them.+ATLAS ids (`AML.T****`) are preserved in evidence fields and deliberately+kept out of ATT&CK-typed fields — Agentmetry's own documentation warns that+an ATLAS id there corrupts any rollup that groups by technique.++The agent, operator and host land on the same OCSF slots the AI SDK+templates use, so Agentmetry-observed coding agents appear in the AI estate+inventory and the entity graph with `(:User)-[:OPERATES]->` and+`(:Endpoint)-[:HOSTS]->` links.++## Why not the generic-json template?++Agentmetry's events do land through `generic-json` — the POST is accepted+and events reach the lake. What the generic mapping loses, verified against+real captured events in `services/ingest`'s test suite:++- **Severity flattens to Unknown on every event, including critical+ detections.** `generic-json` reads a top-level `severity` field;+ Agentmetry carries severity at `action.outcome` / `detection.severity`.+- **Every routine tool call becomes an alert.** `generic-json` maps+ everything to class `2001`, which is always promoted — one busy coding+ agent is an alert flood.+- **Titles, descriptions, ATT&CK technique ids and the event timestamp are+ lost** (`detection.title` and friends are nested fields `generic-json`+ does not map, and `timestamp_utc` is not its time field).++The bundled template exists to fix exactly those five things.++## What was verified, and what was not++**Verified:** real canonical events (schema v1.2.0, captured from+`agentmetry demo` on PyPI release 0.10.4) driven through the real embedded+template and the real registry in Go tests — class routing per event kind,+the full severity ladder including the critical tier, ATT&CK carry,+ATLAS exclusion, malformed-event handling, and the generic-json comparison+above. The promotion outcomes stated here follow the fusion promoter's+policy (category 2 always promoted; otherwise `severity_id >= 4`), which is+pinned by its own cross-service test.++**Not verified:** a live Agentmetry orchestrator POSTing to a live AiSOC+deployment over the network. The template maps the documented, captured+canonical shape; if a future Agentmetry schema release moves a field, the+unmapped half degrades exactly as the malformed-event test describes+(template defaults, severity Unknown) rather than being dropped.++**Agentmetry's own stated non-coverage**, so nobody expects otherwise: it+does not see browser chat use, model providers, or anything an agent does+with its hooks disabled. Hook removal shows up as a heartbeat change, not+as prevention.diff --git a/apps/docs/docs/connectors/universal-capture.md b/apps/docs/docs/connectors/universal-capture.mdindex d3a7d593f..4856185b3 100644--- a/apps/docs/docs/connectors/universal-capture.md+++ b/apps/docs/docs/connectors/universal-capture.md@@ -132,6 +132,7 @@ The bundled templates ship with the `services/ingest` binary and are loaded at s| `email-forwarded` | Inbound-email relays + the Email Inbox connector || `microsoft-defender-email` | Defender for Office 365 alert emails forwarded as text || `github-security-advisory` | GitHub security advisory webhooks |+| `agentmetry` | [Agentmetry](agentmetry.md) AI coding-agent telemetry — routine tool calls stay in the lake, its correlated detections are promoted with severity and ATT&CK ids preserved |Adding a template is a single YAML file plus an entry in `ALLOWED_TEMPLATE_IDS` on the API service — see `services/api/app/api/v1/inbox.py`. Templates are validated at load time; a bad map blocks startup rather than silently dropping events.diff --git a/apps/docs/sidebars.ts b/apps/docs/sidebars.tsindex 48b78c60f..518cc4ae8 100644--- a/apps/docs/sidebars.ts+++ b/apps/docs/sidebars.ts@@ -90,6 +90,7 @@ const sidebars: SidebarsConfig = {"connectors/otlp-logs","connectors/kafka-input","connectors/osquery-extensions",+ "connectors/agentmetry","connectors/abnormal_security","connectors/ai-gateway","connectors/auditd",diff --git a/docs/audit/CLAIM_TO_GATE_MATRIX.md b/docs/audit/CLAIM_TO_GATE_MATRIX.mdindex 957982ab9..867d7631d 100644--- a/docs/audit/CLAIM_TO_GATE_MATRIX.md+++ b/docs/audit/CLAIM_TO_GATE_MATRIX.md@@ -123,6 +123,7 @@ Statuses: `GATED` (a CI job fails when the claim stops being true) · `PARTIAL`| Vendor fields nested under `raw_event` are visible to detections | (implied by the detection corpus) | `ci.yml` fusion tests (`test_detection_field_namespace.py` — 663 of 825 loaded rules referenced an invisible field before this; both the stateless and windowed engines now merge the payload identically) | core | GATED | - || A connector's alerts are attributed to that connector, not to Splunk | `apps/docs/docs/connectors/` | `ci.yml` ingest tests (`TestUnknownConnectorFallbackIsVendorNeutralAndPromotable` — the lenient fallback borrowed the `splunk_enterprise` profile, mis-attributing 26 connectors and, being category 4 with an empty severity map, making their events unpromotable) | core | GATED | - || Customer AI estate: routine agent activity is not auto-promoted to an alert | README (AI estate), `packages/aisoc-ai-sdk/README.md` | `ci.yml` ingest tests (`TestAiRuntimeActivityIsNotAFinding` + `TestAiGuardrailFindingIsAlwaysPromotable` — asserts the 6003/2001 split in both directions, since all-2001 floods the queue with an agent's normal operation and all-6003 leaves a detected injection silent in the lake) | core | GATED | - |+| Agentmetry coding-agent telemetry lands split — routine tool calls in the lake, correlated detections as alerts with severity and ATT&CK ids preserved | `apps/docs/docs/connectors/agentmetry.md`; GitHub Discussion #1577 | `ci.yml` ingest tests (`agentmetry_test.go` — real captured canonical v1.2.0 events through the real embedded template: class_map routes `action.type: detection` onto 2001 while tool calls stay 6003; the critical tier maps to severity_id 5 and never collapses into high; supplied technique ids are carried as supplied and ATLAS ids are refused from ATT&CK-typed fields while preserved in evidence; `TestGenericJsonLandsAgentmetryEventsButFlattensThem` pins what the generic-json path loses, which is the template's reason to exist) + `ci.yml` fusion tests (`test_ai_asset_recorder.py` — an agentmetry event yields a coding-agent sighting with person and device) + `ci.yml` ingest tests (graph `ai_estate_test.go` — the agentmetry source_type produces an AIAsset node with OPERATES and HOSTS edges) | core | GATED | the live leg (a running Agentmetry orchestrator POSTing to a running AiSOC over the network) is stated as unverified in the docs page rather than claimed || AI prompt content does not leave the customer's process by default | `packages/aisoc-ai-sdk/README.md` | `ai-sdk.yml` (`test_ai_sdk.py` — hashed capture asserts no content is transmitted while still reporting which secret shapes were present; masked/full are opt-in per client) | core | GATED | - || The AI SDK never breaks or blocks the host application | `packages/aisoc-ai-sdk/README.md` | `ai-sdk.yml` (transport failure, full queue and unconfigured endpoint all assert a dropped span rather than a raise; a zero-runtime-dependency check stops the package pulling a transport library into a customer's resolution) | core | GATED | - || Every MCP tool call is accounted for | `services/mcp/README.md` | `ci.yml` MCP vitest (`telemetry.test.ts` — records successes and refusals, transmits argument keys but never values, bounds its buffer, and never raises on an unreachable inbox; the README previously claimed an audit trail the server did not emit and the API's audit middleware does not cover for read tools) | core | GATED | - |@@ -340,8 +341,8 @@ Statuses: `GATED` (a CI job fails when the claim stops being true) · `PARTIAL`## Summary-- Total: 329-- GATED: 324+- Total: 330+- GATED: 325- PARTIAL: 5- NO GATE: 0diff --git a/scripts/generate_connector_docs.py b/scripts/generate_connector_docs.pyindex 61498e751..a350364b7 100644--- a/scripts/generate_connector_docs.py+++ b/scripts/generate_connector_docs.py@@ -425,6 +425,11 @@ SIDEBAR_PREAMBLE = ("connectors/kafka-input",# Not a connector, so the generated list below does not cover it."connectors/osquery-extensions",+ # A push-side inbox template rather than a connector: Agentmetry's own+ # webhook sink POSTs to /v1/inbox/{token}, so there is no schema() for+ # the generated list below to pick up and the page has to be named here+ # or it drops out of navigation on the next regeneration.+ "connectors/agentmetry",)SIDEBAR_START = "// BEGIN GENERATED CONNECTOR LIST"diff --git a/services/api/app/api/v1/endpoints/inbox.py b/services/api/app/api/v1/endpoints/inbox.pyindex 784a5f2f7..1a1c00e2b 100644--- a/services/api/app/api/v1/endpoints/inbox.py+++ b/services/api/app/api/v1/endpoints/inbox.py@@ -99,6 +99,11 @@ ALLOWED_TEMPLATE_IDS: tuple[str, ...] = (# and the SDK had no reachable endpoint to point at."ai-runtime","ai-finding",+ # Agentmetry (github.com/blitzcrieg1/agentmetry) — coding-agent tool+ # calls and correlated detections through one webhook sink. One+ # template for both kinds: its class_map routes action.type=detection+ # onto 2001 while routine activity stays at 6003 (Discussion #1577).+ "agentmetry",# Kubernetes apiserver audit, inbox path. The dedicated route# POST /v1/ingest/k8s-audit/{tenant_id} is preferred and is what the# connector docs lead with, but both those docs and@@ -360,6 +365,17 @@ _TEMPLATE_CATALOG: dict[str, dict[str, str]] = {),"category": "ai",},+ "agentmetry": {+ "label": "Agentmetry (AI coding agents)",+ "description": (+ "Canonical events from Agentmetry, the open-source sensor for AI coding agents "+ "(Claude Code, Cursor, Codex, Copilot and MCP servers behind its proxy). One URL "+ "carries both routine tool calls (kept in the lake for hunting) and its correlated "+ "detections, which are always promoted to alerts with their severity and "+ "ATT&CK technique ids preserved. Point AGENTMETRY_AUDIT_WEBHOOK_URL at the minted URL."+ ),+ "category": "ai",+ },"k8s-audit": {"label": "Kubernetes audit (webhook fallback)","description": (diff --git a/services/fusion/app/services/ai_asset_recorder.py b/services/fusion/app/services/ai_asset_recorder.pyindex b79f265f0..94e31bc7e 100644--- a/services/fusion/app/services/ai_asset_recorder.py+++ b/services/fusion/app/services/ai_asset_recorder.py@@ -13,6 +13,11 @@ rather than by guessing from field presence:* ``ai-runtime`` and ``ai-finding`` — the SDK and gateway telemetry. Thesename the agent, the model, the MCP server and the human it acted for.+ ``agentmetry`` rides the same branch: its inbox template maps the coding+ agent onto the identical slots (``agent.name`` → ``actor.process.name``,+ ``actor.id`` → ``actor.user.name``, ``host_id`` →+ ``src_endpoint.hostname``) precisely so this recorder and the graph+ projection read one shape.* ``llm_usage`` provider audit events — these name a provider key and theaccount that minted it, and nothing about any device.* OCSF Process Activity (class 1007) carrying a known coding-agent or MCP@@ -372,7 +377,7 @@ def classify(message: dict[str, Any]) -> list[_Sighting]:source_type = _text(ocsf.get("source_type")) or _text(_nested(ocsf, "metadata", "product", "name")) or ""out: list[_Sighting] = []- if source_type in ("ai-runtime", "ai-finding", "AI Runtime", "AI Guardrail"):+ if source_type in ("ai-runtime", "ai-finding", "agentmetry", "AI Runtime", "AI Guardrail"):out.extend(_from_ai_telemetry(tenant_id, ocsf, now))elif source_type in ("llm_usage", "AI / LLM Usage Audit"):out.extend(_from_provider_audit(tenant_id, ocsf, now))diff --git a/services/fusion/tests/test_ai_asset_recorder.py b/services/fusion/tests/test_ai_asset_recorder.pyindex 2a0ca302a..0ee450671 100644--- a/services/fusion/tests/test_ai_asset_recorder.py+++ b/services/fusion/tests/test_ai_asset_recorder.py@@ -110,6 +110,43 @@ def ocsf_native_process_event(name: str, hostname: str = "ada-mbp") -> dict[str,# ---------------------------------------------------------------------------+def agentmetry_event(**overrides: Any) -> dict[str, Any]:+ """An ``agentmetry`` event as its inbox template emits it.++ Field placement follows ``agentmetry.yaml`` (Discussion #1577):+ ``agent.name`` lands on ``actor.process.name``, ``actor.id`` on+ ``actor.user.name``, ``host_id`` on ``src_endpoint.hostname`` and+ ``model.id`` on ``metadata.product.feature.name`` — the same slots the+ AI SDK templates use, which is what lets one recorder branch serve both.+ """+ ocsf: dict[str, Any] = {+ "class_uid": 6003,+ "class_name": "API Activity",+ "source_type": "agentmetry",+ "activity_name": "Read",+ "severity_id": 0,+ "actor": {"process": {"name": "claude"}, "user": {"name": "dev_01"}},+ "src_endpoint": {"hostname": "dev-mbp-7.local"},+ "metadata": {"product": {"vendor_name": "Agentmetry", "name": "Agentmetry", "feature": {"name": "claude"}}},+ "cloud": {"provider": "claude"},+ }+ ocsf.update(overrides)+ return {"tenant_id": TENANT, "ocsf_event": ocsf}+++def test_agentmetry_event_yields_a_coding_agent_linked_to_person_and_device():+ # Discussion #1577: coding-agent telemetry pushed through the+ # agentmetry inbox template must reach the AI-estate inventory, or the+ # console stays blind to exactly the activity source the template adds.+ sightings = classify(agentmetry_event())+ agents = [s for s in sightings if s.kind == "coding_agent"]+ assert len(agents) == 1, f"want one coding agent, got {sightings}"+ agent = agents[0]+ assert agent.vendor == "Anthropic"+ assert agent.principal == "dev_01"+ assert agent.device == "dev-mbp-7.local"++def test_runtime_event_yields_a_coding_agent_linked_to_person_and_device():sightings = classify(runtime_event())agents = [s for s in sightings if s.kind == "coding_agent"]diff --git a/services/ingest/internal/graph/ai_estate_test.go b/services/ingest/internal/graph/ai_estate_test.goindex 46767ac32..47c1282a8 100644--- a/services/ingest/internal/graph/ai_estate_test.go+++ b/services/ingest/internal/graph/ai_estate_test.go@@ -47,6 +47,52 @@ func hasEdge(ev *Event, relType RelType, from, to NodeLabel) bool {return false}+// agentmetryEvent is built from the field map in+// internal/normalizer/templates/agentmetry.yaml, the same way aiRuntimeEvent+// mirrors ai-runtime.yaml: agent.name lands on actor.process.name, actor.id+// on actor.user.name, host_id on src_endpoint.hostname.+func agentmetryEvent() map[string]interface{} {+ return map[string]interface{}{+ "class_uid": float64(6003),+ "source_type": "agentmetry",+ "actor": map[string]interface{}{+ "process": map[string]interface{}{"name": "claude"},+ "user": map[string]interface{}{"name": "dev_01"},+ },+ "src_endpoint": map[string]interface{}{"hostname": "dev-mbp-7.local"},+ "metadata": map[string]interface{}{+ "product": map[string]interface{}{"feature": map[string]interface{}{"name": "claude"}},+ },+ }+}++func TestAgentmetryEventProducesAnAssetLinkedToPersonAndDevice(t *testing.T) {+ // Discussion #1577: Agentmetry telemetry arrives through its inbox+ // template, and the AI-estate projection must see those coding agents+ // or the inventory stays blind to exactly the activity source the+ // template adds.+ ev := ExtractFromOCSF("evt-agt", "tenant-a", "inbox:agentmetry", agentmetryEvent())+ if ev == nil {+ t.Fatal("expected a graph projection, got nil")+ }+ asset := findNode(ev, NodeAIAsset)+ if asset == nil {+ t.Fatal("no AIAsset node emitted for an agentmetry event")+ }+ if got := asset.Properties["kind"]; got != "coding_agent" {+ t.Errorf("kind = %v, want coding_agent (claude is in the match table)", got)+ }+ if got := asset.Properties["vendor"]; got != "Anthropic" {+ t.Errorf("vendor = %v, want Anthropic", got)+ }+ if !hasEdge(ev, RelOperates, NodeUser, NodeAIAsset) {+ t.Error("no (:User)-[:OPERATES]->(:AIAsset) edge")+ }+ if !hasEdge(ev, RelHosts, NodeEndpoint, NodeAIAsset) {+ t.Error("no (:Endpoint)-[:HOSTS]->(:AIAsset) edge")+ }+}+func TestAIRuntimeEventProducesAnAssetLinkedToPersonAndDevice(t *testing.T) {ev := ExtractFromOCSF("evt-1", "tenant-a", "ai_gateway", aiRuntimeEvent())if ev == nil {diff --git a/services/ingest/internal/graph/extractor.go b/services/ingest/internal/graph/extractor.goindex 3ed6ad0ca..70451c171 100644--- a/services/ingest/internal/graph/extractor.go+++ b/services/ingest/internal/graph/extractor.go@@ -754,8 +754,12 @@ func extractAIEstate(ev *Event, ocsf map[string]interface{}) {kind, externalID, displayName, vendor := "", "", "", ""switch sourceType {- case "ai-runtime", "ai-finding":- // The SDK and gateway path: actor.process.name is the agent id.+ case "ai-runtime", "ai-finding", "agentmetry":+ // The SDK and gateway path, plus the Agentmetry inbox template,+ // which maps the coding agent's name onto the same slots+ // (agent.name → actor.process.name, actor.id → actor.user.name,+ // host_id → src_endpoint.hostname) precisely so this projection+ // and the fusion asset recorder see one shape.externalID = getString(ocsf, "actor.process.name")displayName = getString(ocsf, "actor.process.path")base := processBaseName(displayName)diff --git a/services/ingest/internal/inbox/agentmetry_test.go b/services/ingest/internal/inbox/agentmetry_test.gonew file mode 100644index 000000000..df4fd61de--- /dev/null+++ b/services/ingest/internal/inbox/agentmetry_test.go@@ -0,0 +1,376 @@+package inbox++import (+ "testing"+)++// The Agentmetry template (GitHub Discussion #1577).+//+// Agentmetry (github.com/blitzcrieg1/agentmetry) records the tool calls AI+// coding agents make and correlates them into detections. Its webhook sink+// POSTs one canonical JSON event per request — routine activity and+// correlated detections down the same pipe — so one template serves both+// kinds and splits them by OCSF class via class_map, the same 6003/2001+// split ai-runtime.yaml / ai-finding.yaml encode.+//+// Every fixture here is the real canonical shape (schema v1.2.0), captured+// by running `agentmetry demo` (PyPI agentmetry 0.10.4) locally and reading+// the trail it wrote. Host and operator identity values were replaced with+// neutral ones; every key, nesting level and vocabulary word is as captured.+// A hand-invented fixture is how a template passes its tests against events+// no sensor ever sends.++func agentmetryRegistry(t *testing.T) *Registry {+ t.Helper()+ r := NewRegistry()+ if err := r.LoadEmbedded(); err != nil {+ t.Fatalf("LoadEmbedded failed: %v", err)+ }+ return r+}++func agentmetryTemplate(t *testing.T) *Template {+ t.Helper()+ tmpl, err := agentmetryRegistry(t).Get("agentmetry")+ if err != nil {+ t.Fatalf("agentmetry template not embedded: %v", err)+ }+ return tmpl+}++// agentmetryToolCall is a captured `run/tool_called` event: Cursor's Read+// tool touching a private key, with the sensor's own ATT&CK mapping on the+// tool block and an ATLAS block beside it.+func agentmetryToolCall() map[string]any {+ return map[string]any{+ "schema_version": "1.2.0",+ "event_id": "5779eeaa-2844-492a-b3ad-9808b0dab20a",+ "session_id": "",+ "correlation_id": "demo-session-1",+ "timestamp_utc": "2026-10-31T21:13:17.091378+00:00",+ "host_id": "dev-mbp-7.local",+ "source_topic": "external/cursor/tool_called",+ "source": map[string]any{"tier": "external", "app": "cursor", "adapter": "cursor_hook"},+ "initiator": map[string]any{+ "actor_type": "human", "trigger": "manual",+ "operator_id": "dev_01", "operator_source": "orchestrator_os",+ },+ "actor": map[string]any{"type": "user", "id": "dev_01", "role": "operator"},+ "action": map[string]any{"type": "tool_called", "outcome": "success", "reason": ""},+ "agent": map[string]any{"name": "cursor", "skill_id": ""},+ "model": map[string]any{"id": "cursor", "provider": "cursor"},+ "tool": map[string]any{+ "name": "Read",+ "qualified": "cursor.Read",+ "server": "cursor",+ "input_redaction": "hash+command",+ "input_hash": "",+ "parameters_redacted": false,+ "command": "cat ~/.ssh/id_rsa",+ "mitre": map[string]any{+ "tactic_id": "TA0006", "tactic": "Credential Access",+ "technique_id": "T1552.004", "technique": "Private Keys",+ },+ "atlas": map[string]any{+ "framework": "MITRE ATLAS", "tactic_id": "AML.TA0013",+ "tactic": "Credential Access", "technique_id": "AML.T0098",+ "technique": "AI Agent Tool Credential Harvesting", "atlas_version": "2026.07",+ },+ },+ }+}++// agentmetryDetection is the captured `credential-exfil` correlated finding:+// action.type "detection", the severity in action.outcome AND in+// detection.severity, ATT&CK technique ids as a list on the detection block.+func agentmetryDetection() map[string]any {+ return map[string]any{+ "schema_version": "1.2.0",+ "event_id": "58a23195-e035-44bd-a0d4-09b3bd3d9ac5",+ "session_id": "",+ "correlation_id": "demo-session-1",+ "timestamp_utc": "2026-10-31T21:13:17.104370+00:00",+ "host_id": "dev-mbp-7.local",+ "source_topic": "detection/credential-exfil",+ "source": map[string]any{"tier": "external", "app": "claude", "adapter": "claude_hook"},+ "initiator": map[string]any{+ "actor_type": "human", "trigger": "manual",+ "operator_id": "dev_01", "operator_source": "orchestrator_os",+ },+ "actor": map[string]any{"type": "user", "id": "dev_01", "role": "operator"},+ "action": map[string]any{+ "type": "detection", "outcome": "critical",+ "reason": "cursor.Read accessed credentials, then WebFetch egressed to the network in the same session.",+ },+ "agent": map[string]any{"name": "claude", "skill_id": ""},+ "detection": map[string]any{+ "rule_id": "credential-exfil",+ "title": "Credential access followed by network egress",+ "severity": "critical",+ "summary": "cursor.Read accessed credentials, then WebFetch egressed to the network in the same session.",+ "correlation_id": "demo-session-1",+ "tactic_ids": []any{"TA0006", "TA0011"},+ "technique_ids": []any{"T1552.004", "T1071.001"},+ "event_ids": []any{"5779eeaa-2844-492a-b3ad-9808b0dab20a", "68b649c5-b086-4606-8679-b1731b9689ae"},+ "first_seen_utc": "2026-10-31T21:13:17.091378+00:00",+ "last_seen_utc": "2026-10-31T21:13:17.104370+00:00",+ "disposition": nil,+ },+ }+}++func techniqueIDs(t *testing.T, out map[string]any) []string {+ t.Helper()+ block, ok := out["mitre_attck"].([]map[string]any)+ if !ok {+ // Also accept []interface{} in case the block shape evolves.+ raw, rawOK := out["mitre_attck"].([]any)+ if !rawOK {+ return nil+ }+ for _, item := range raw {+ if m, mOK := item.(map[string]any); mOK {+ block = append(block, m)+ }+ }+ }+ var ids []string+ for _, entry := range block {+ if tid, tidOK := entry["technique_id"].(string); tidOK {+ ids = append(ids, tid)+ }+ }+ return ids+}++func TestAgentmetryActivityStaysInTheLake(t *testing.T) {+ // Routine agent activity must land in category 6 so should_promote()+ // leaves it in the lake: a coding agent emits an event per tool call,+ // and promoting each one floods the queue with its normal operation.+ out := agentmetryTemplate(t).Apply(agentmetryToolCall(), "tenant-1", "inbox:agentmetry", "2026-10-31T21:13:18Z")++ if got := out["class_uid"]; got != 6003 {+ t.Errorf("class_uid = %v, want 6003 (API Activity)", got)+ }+ if got := out["category_uid"]; got != 6 {+ t.Errorf("category_uid = %v, want 6 so routine activity is not auto-promoted", got)+ }+ // Activity events carry no vendor severity — action.outcome is an+ // outcome word, not a severity — so the honest value is Unknown, which+ // sits below the promoter's severity floor.+ if got := out["severity_id"]; got != 0 {+ t.Errorf("severity_id = %v, want 0 (no vendor severity on activity)", got)+ }+ if got := out["activity_name"]; got != "Read" {+ t.Errorf("activity_name = %v, want the tool name", got)+ }+ if got := out["status_detail"]; got != "success" {+ t.Errorf("status_detail = %v, want action.outcome", got)+ }++ actor, _ := out["actor"].(map[string]any)+ proc, _ := actor["process"].(map[string]any)+ user, _ := actor["user"].(map[string]any)+ if proc["name"] != "cursor" {+ t.Errorf("actor.process.name = %v, want the agent name", proc["name"])+ }+ if user["name"] != "dev_01" {+ t.Errorf("actor.user.name = %v, want the operator account", user["name"])+ }+ src, _ := out["src_endpoint"].(map[string]any)+ if src["hostname"] != "dev-mbp-7.local" {+ t.Errorf("src_endpoint.hostname = %v, want host_id", src["hostname"])+ }++ // The event time is the sensor's timestamp_utc, not the receipt time.+ if got, _ := out["time"].(string); got == "2026-10-31T21:13:18Z" {+ t.Errorf("time fell back to receivedAt; timestamp_utc was not parsed")+ }++ // The sensor's own ATT&CK mapping on the tool block is carried.+ ids := techniqueIDs(t, out)+ if len(ids) != 1 || ids[0] != "T1552.004" {+ t.Errorf("mitre_attck technique ids = %v, want [T1552.004]", ids)+ }+ // The ATLAS id beside it must NOT be lifted into an ATT&CK-typed+ // field: Agentmetry's own docs warn an AML.T**** id there corrupts any+ // rollup that groups by technique.+ for _, id := range ids {+ if id == "AML.T0098" {+ t.Errorf("ATLAS id leaked into mitre_attck: %v", ids)+ }+ }+ // It is preserved, though — the inbox path retains no unmapped+ // payload, so the template carries it in an evidence field.+ finding, _ := out["finding"].(map[string]any)+ evidence, _ := finding["evidence"].(map[string]any)+ if evidence["tool_atlas_technique_id"] != "AML.T0098" {+ t.Errorf("finding.evidence.tool_atlas_technique_id = %v, want AML.T0098 preserved outside ATT&CK fields", evidence["tool_atlas_technique_id"])+ }+}++func TestAgentmetryDetectionIsAlwaysPromotable(t *testing.T) {+ // A correlated detection has already passed the sensor's own rule+ // engine — the same reasoning that puts a Splunk notable at 2001. It+ // must land in category 2, which the fusion promoter promotes+ // regardless of severity, so a medium detection is never dropped.+ out := agentmetryTemplate(t).Apply(agentmetryDetection(), "tenant-1", "inbox:agentmetry", "2026-10-31T21:13:18Z")++ if got := out["class_uid"]; got != 2001 {+ t.Errorf("class_uid = %v, want 2001 (Security Finding) via class_map", got)+ }+ if got := out["category_uid"]; got != 2 {+ t.Errorf("category_uid = %v, want 2 so the promoter always promotes it", got)+ }+ if got := out["severity_id"]; got != 5 {+ t.Errorf("severity_id = %v, want 5 — the critical tier must survive end-to-end", got)+ }+ if got := out["severity"]; got != "Critical" {+ t.Errorf("severity = %v, want Critical", got)+ }+ if got := out["message"]; got != "Credential access followed by network egress" {+ t.Errorf("message = %v, want the detection title", got)+ }++ finding, _ := out["finding"].(map[string]any)+ if finding["title"] != "Credential access followed by network egress" {+ t.Errorf("finding.title = %v", finding["title"])+ }+ if finding["desc"] != "cursor.Read accessed credentials, then WebFetch egressed to the network in the same session." {+ t.Errorf("finding.desc = %v, want the detection summary", finding["desc"])+ }+ if finding["uid"] != "58a23195-e035-44bd-a0d4-09b3bd3d9ac5" {+ t.Errorf("finding.uid = %v, want the vendor event_id", finding["uid"])+ }+ related, _ := finding["related_events"].(map[string]any)+ if related["id"] != "credential-exfil" {+ t.Errorf("finding.related_events.id = %v, want the rule id", related["id"])+ }++ // Both supplied technique ids are carried, as supplied, exactly once.+ ids := techniqueIDs(t, out)+ if len(ids) != 2 || ids[0] != "T1552.004" || ids[1] != "T1071.001" {+ t.Errorf("mitre_attck technique ids = %v, want [T1552.004 T1071.001]", ids)+ }+ // Tactic ids (TA####) have their own slot in the enrichment and must+ // not be misread as techniques.+ for _, id := range ids {+ if id == "TA0006" || id == "TA0011" {+ t.Errorf("tactic id misread as a technique: %v", ids)+ }+ }+}++func TestAgentmetrySeverityLadderPreservesEveryTier(t *testing.T) {+ // The five-tier house ladder, driven through the real template. The+ // critical case is the repo rule this pins: critical must map to its+ // own tier, never collapse into high.+ tmpl := agentmetryTemplate(t)+ for _, tc := range []struct {+ vendor string+ id int+ label string+ }{+ {"critical", 5, "Critical"},+ {"high", 4, "High"},+ {"medium", 3, "Medium"},+ {"low", 2, "Low"},+ } {+ payload := agentmetryDetection()+ det := payload["detection"].(map[string]any)+ det["severity"] = tc.vendor+ action := payload["action"].(map[string]any)+ action["outcome"] = tc.vendor++ out := tmpl.Apply(payload, "tenant-1", "inbox:agentmetry", "2026-10-31T21:13:18Z")+ if out["severity_id"] != tc.id {+ t.Errorf("severity %q → severity_id %v, want %d", tc.vendor, out["severity_id"], tc.id)+ }+ if out["severity"] != tc.label {+ t.Errorf("severity %q → label %v, want %q", tc.vendor, out["severity"], tc.label)+ }+ }+}++func TestAgentmetryUnknownKindKeepsTheDefaultClass(t *testing.T) {+ // An event kind with no class_map entry (mcp_schema, session_start,+ // a kind a future schema adds) degrades to the template's declared+ // class rather than vanishing or being promoted.+ payload := agentmetryToolCall()+ payload["action"] = map[string]any{"type": "mcp_schema", "outcome": "changed", "reason": ""}+ out := agentmetryTemplate(t).Apply(payload, "tenant-1", "inbox:agentmetry", "2026-10-31T21:13:18Z")+ if got := out["class_uid"]; got != 6003 {+ t.Errorf("class_uid = %v, want the 6003 default for an unmapped kind", got)+ }+}++func TestAgentmetryMalformedEventStillLands(t *testing.T) {+ // Over-deliver, never lose: an empty object and an event whose action+ // is a bare string must both land with the template defaults rather+ // than panic or drop.+ tmpl := agentmetryTemplate(t)+ for name, payload := range map[string]map[string]any{+ "empty object": {},+ "action not a map": {"action": "detection", "detection": "critical"},+ } {+ out := tmpl.Apply(payload, "tenant-1", "inbox:agentmetry", "2026-10-31T21:13:18Z")+ if got := out["class_uid"]; got != 6003 {+ t.Errorf("%s: class_uid = %v, want the 6003 default", name, got)+ }+ if got := out["severity_id"]; got != 0 {+ t.Errorf("%s: severity_id = %v, want 0 (Unknown)", name, got)+ }+ if got := out["severity"]; got != "Unknown" {+ t.Errorf("%s: severity = %v, want Unknown", name, got)+ }+ }+}++// ---------------------------------------------------------------------------+// Discussion #1577 asked whether generic-json "should land" Agentmetry+// events, severity in action.outcome — stated as a claim to check, not a+// result. This is the check, against the real embedded generic-json+// template. The events land; what the claim misses is what the bundled+// template exists to fix.+// ---------------------------------------------------------------------------++func TestGenericJsonLandsAgentmetryEventsButFlattensThem(t *testing.T) {+ generic, err := agentmetryRegistry(t).Get("generic-json")+ if err != nil {+ t.Fatalf("generic-json not embedded: %v", err)+ }++ // 1. A critical detection lands — but generic-json reads severity from+ // a top-level `severity` field, and Agentmetry carries it at+ // action.outcome / detection.severity, so the critical tier flattens+ // to Unknown and the five-tier ladder is lost.+ det := generic.Apply(agentmetryDetection(), "tenant-1", "inbox:generic-json", "2026-10-31T21:13:18Z")+ if got := det["severity_id"]; got != 0 {+ t.Errorf("generic-json severity_id = %v for a critical detection; the claim's severity path is not read", got)+ }+ // The detection's own title is nested at detection.title, which+ // generic-json does not map, so the alert renders a fallback title.+ if _, ok := det["finding"].(map[string]any); ok {+ t.Errorf("finding block unexpectedly populated: %v", det["finding"])+ }+ // The supplied ATT&CK technique ids are dropped entirely.+ if _, ok := det["mitre_attck"]; ok {+ t.Errorf("mitre_attck unexpectedly populated by generic-json")+ }+ // timestamp_utc is not generic-json's time field, so the event time+ // falls back to receipt time.+ if got, _ := det["time"].(string); got != "2026-10-31T21:13:18Z" {+ t.Errorf("time = %v, expected the receivedAt fallback documenting the lost event time", got)+ }++ // 2. The deeper problem runs the other way: generic-json is class 2001+ // for every event, and category 2 is always promoted — so each routine+ // tool call becomes an alert. One coding agent is an alert flood.+ act := generic.Apply(agentmetryToolCall(), "tenant-1", "inbox:generic-json", "2026-10-31T21:13:18Z")+ if got := act["class_uid"]; got != 2001 {+ t.Fatalf("generic-json class_uid = %v; this test documents the always-promoted path", got)+ }+ if got := act["category_uid"]; got != 2 {+ t.Fatalf("generic-json category_uid = %v, want 2 (always promoted)", got)+ }+}diff --git a/services/ingest/internal/inbox/apply.go b/services/ingest/internal/inbox/apply.goindex b2ac940bb..aa92fa2d7 100644--- a/services/ingest/internal/inbox/apply.go+++ b/services/ingest/internal/inbox/apply.go@@ -3,6 +3,8 @@ package inboximport ("strings""time"++ "github.com/beenuar/aisoc/services/ingest/internal/normalizer")// Apply projects a vendor JSON payload onto an OCSF event using the@@ -20,6 +22,23 @@ func (t *Template) Apply(payload map[string]any, tenantID, connectorRef, receiveif t.ClassUID > 0 {ocsf["category_uid"] = t.ClassUID / 1000}++ // Per-event class override. A sensor that pushes routine activity and+ // correlated findings through one URL needs them in different OCSF+ // categories — the promoter always promotes category 2 and leaves+ // category 6 in the lake — and the event kind is a payload field, not+ // a property of the token. An event whose kind has no entry keeps the+ // template's declared class, so an unknown kind degrades to the+ // default rather than vanishing.+ if t.ClassField != "" && len(t.ClassMap) > 0 {+ if kind := getNestedString(payload, t.ClassField); kind != "" {+ if o, ok := t.ClassMap[strings.ToLower(strings.TrimSpace(kind))]; ok {+ ocsf["class_uid"] = o.ClassUID+ ocsf["class_name"] = o.ClassName+ ocsf["category_uid"] = o.ClassUID / 1000+ }+ }+ }if t.ActivityID != 0 {ocsf["activity_id"] = t.ActivityID} else {@@ -98,6 +117,19 @@ func (t *Template) Apply(payload map[string]any, tenantID, connectorRef, receivesetNested(ocsf, k, v)}+ // MITRE ATT&CK technique ids the vendor supplied, carried as supplied.+ // Same block and same contract as the connector path in+ // normalizer.Normalize: shape-validated ids only (an ATLAS AML.T****+ // or a tactic TA#### id never enters an ATT&CK-typed field), enriched+ // with name/tactics when the corpus confirms them and carried+ // verified:false when it cannot.+ if len(t.TechniqueFields) > 0 {+ ids := normalizer.TechniqueIDsFromPaths(payload, t.TechniqueFields)+ if enriched := normalizer.EnrichTechniqueIDs(ids); len(enriched) > 0 {+ ocsf["mitre_attck"] = enriched+ }+ }+ocsf["tenant_uid"] = tenantIDocsf["source_connector_id"] = connectorRefdiff --git a/services/ingest/internal/inbox/apply_test.go b/services/ingest/internal/inbox/apply_test.goindex df789dc3d..5d6c6eb91 100644--- a/services/ingest/internal/inbox/apply_test.go+++ b/services/ingest/internal/inbox/apply_test.go@@ -4,6 +4,8 @@ import ("strings""testing""time"++ "github.com/beenuar/aisoc/services/ingest/internal/attck")// Apply is the workhorse of the universal-capture path: every webhook@@ -267,6 +269,138 @@ func TestApply_MetadataAlwaysCarriesProductIdentity(t *testing.T) {}}+func TestApply_ClassMapRoutesEventKindsToDifferentClasses(t *testing.T) {+ // One webhook URL can carry routine activity and correlated findings+ // (Agentmetry posts both through one sink). The class split is what+ // decides promotion — category 2 is always promoted, category 6 stays+ // in the lake — so it has to be per event, keyed on a payload field.+ tmpl := &Template{+ ID: "split",+ ClassUID: 6003,+ ClassName: "API Activity",+ ClassField: "action.type",+ ClassMap: map[string]ClassOverride{+ "detection": {ClassUID: 2001, ClassName: "Security Finding"},+ },+ }++ finding := tmpl.Apply(map[string]any{+ "action": map[string]any{"type": "detection"},+ }, "tenant", "ref", "2026-05-08T12:30:00Z")+ if finding["class_uid"] != 2001 || finding["class_name"] != "Security Finding" {+ t.Errorf("detection kind not rerouted: class_uid=%v class_name=%v", finding["class_uid"], finding["class_name"])+ }+ if finding["category_uid"] != 2 {+ t.Errorf("category_uid = %v, want 2 — the override must move the category too", finding["category_uid"])+ }++ activity := tmpl.Apply(map[string]any{+ "action": map[string]any{"type": "tool_called"},+ }, "tenant", "ref", "2026-05-08T12:30:00Z")+ if activity["class_uid"] != 6003 || activity["category_uid"] != 6 {+ t.Errorf("unmapped kind must keep the default class: class_uid=%v category_uid=%v",+ activity["class_uid"], activity["category_uid"])+ }+}++func TestApply_ClassMapMatchesCaseInsensitively(t *testing.T) {+ // Same contract as SeverityMap: the registry lowercases keys at load+ // time and Apply folds the payload value, so a vendor that capitalises+ // the kind still routes.+ tmpl := &Template{+ ID: "split",+ ClassUID: 6003,+ ClassName: "API Activity",+ ClassField: "kind",+ ClassMap: map[string]ClassOverride{+ "detection": {ClassUID: 2001, ClassName: "Security Finding"},+ },+ }+ out := tmpl.Apply(map[string]any{"kind": " Detection "}, "tenant", "ref", "2026-05-08T12:30:00Z")+ if out["class_uid"] != 2001 {+ t.Errorf("class_uid = %v, want 2001 (case-insensitive kind match)", out["class_uid"])+ }+}++func TestApply_ClassMapIgnoresMissingAndNonStringKinds(t *testing.T) {+ tmpl := &Template{+ ID: "split",+ ClassUID: 6003,+ ClassName: "API Activity",+ ClassField: "action.type",+ ClassMap: map[string]ClassOverride{+ "detection": {ClassUID: 2001, ClassName: "Security Finding"},+ },+ }+ for name, payload := range map[string]map[string]any{+ "field absent": {},+ "field not a map": {"action": "detection"},+ "kind not string": {"action": map[string]any{"type": 7}},+ } {+ out := tmpl.Apply(payload, "tenant", "ref", "2026-05-08T12:30:00Z")+ if out["class_uid"] != 6003 {+ t.Errorf("%s: class_uid = %v, want the 6003 default", name, out["class_uid"])+ }+ }+}++func TestApply_TechniqueFieldsPublishTheConnectorPathBlock(t *testing.T) {+ // technique_fields is the inbox counterpart of the connector path's+ // technique carry: shape-validated ids only, list and scalar sources,+ // deduplicated, ATLAS and tactic ids refused. Entries carry the+ // issue #1244 contract — an unconfirmed vendor assertion is carried+ // with verified:false, never dropped; a corpus-confirmed one reads+ // verified:true. Nothing in this package loads the corpus today, but+ // the assertion branches on its state rather than assuming, so a+ // future test that loads it cannot make this one order-dependent.+ tmpl := &Template{+ ID: "techniques",+ ClassUID: 2001,+ ClassName: "Security Finding",+ TechniqueFields: []string{+ "detection.technique_ids",+ "tool.mitre.technique_id",+ },+ }+ out := tmpl.Apply(map[string]any{+ "detection": map[string]any{+ "technique_ids": []any{"T1552.004", "T1071.001", "TA0006", "AML.T0098", "T1552.004", 42},+ },+ "tool": map[string]any{"mitre": map[string]any{"technique_id": "t1071.001"}},+ }, "tenant", "ref", "2026-05-08T12:30:00Z")++ block, ok := out["mitre_attck"].([]map[string]any)+ if !ok {+ t.Fatalf("mitre_attck missing or wrong type: %T", out["mitre_attck"])+ }+ var ids []string+ for _, entry := range block {+ id, _ := entry["technique_id"].(string)+ ids = append(ids, id)+ verified, vOK := entry["verified"].(bool)+ if !vOK {+ t.Errorf("entry %v: verified missing or not a bool: %#v", id, entry)+ continue+ }+ if verified != attck.Loaded() {+ t.Errorf("entry %v: verified = %v with corpus loaded = %v", id, verified, attck.Loaded())+ }+ }+ if len(ids) != 2 || ids[0] != "T1552.004" || ids[1] != "T1071.001" {+ t.Errorf("ids = %v, want [T1552.004 T1071.001] — deduplicated, shape-validated, no tactic or ATLAS ids", ids)+ }+}++func TestApply_NoTechniqueFieldsMeansNoBlock(t *testing.T) {+ // Templates that declare no technique paths keep their exact previous+ // behaviour: nothing scans the payload.+ tmpl := newTestTemplate()+ out := tmpl.Apply(map[string]any{"techniques": []any{"T1059.001"}}, "tenant", "ref", "2026-05-08T12:30:00Z")+ if _, ok := out["mitre_attck"]; ok {+ t.Errorf("mitre_attck populated without technique_fields: %v", out["mitre_attck"])+ }+}+// ---------------------------------------------------------------------------// Helper coverage. These are tiny but they're load-bearing for the field map// language so we exercise them directly.diff --git a/services/ingest/internal/inbox/template.go b/services/ingest/internal/inbox/template.goindex 93bf02f78..95481eb4a 100644--- a/services/ingest/internal/inbox/template.go+++ b/services/ingest/internal/inbox/template.go@@ -22,6 +22,14 @@ import (// a different template.var ErrTemplateNotFound = errors.New("inbox template not registered")+// ClassOverride redirects an event onto a different OCSF class when the+// template's ClassField carries a matching value. Both halves travel+// together so the published event stays self-describing.+type ClassOverride struct {+ ClassUID int `yaml:"class_uid"`+ ClassName string `yaml:"class_name"`+}+// Template defines how a vendor-specific JSON payload maps onto an OCSF// event. Each YAML file in services/ingest/internal/normalizer/templates/// produces one Template; the filename stem (without .yaml) is the@@ -50,6 +58,36 @@ type Template struct {// for auth events where vendor traffic is mostly login/logout.ActivityID int `yaml:"activity_id,omitempty"`+ // ClassField / ClassMap route individual events onto a different OCSF+ // class by the value at one payload path. They exist for sensors that+ // push routine activity and correlated findings through one webhook+ // URL (Agentmetry posts both to one sink): the activity belongs in a+ // non-Findings class the promoter leaves in the lake, while a finding+ // belongs at category 2, which is always promoted. Without the split a+ // single-class template either floods the alert queue with the+ // sensor's normal operation or leaves its detections silent in the+ // lake — the exact pair of failure modes the ai-runtime / ai-finding+ // template split documents.+ //+ // ClassUID / ClassName above remain the default for any event whose+ // ClassField value has no ClassMap entry, so an unrecognised or absent+ // kind degrades to the template's declared class rather than being+ // dropped. Keys are normalised to lower-case at load time, the same+ // contract as SeverityMap.+ ClassField string `yaml:"class_field,omitempty"`+ ClassMap map[string]ClassOverride `yaml:"class_map,omitempty"`++ // TechniqueFields — payload dot-paths that may carry MITRE ATT&CK+ // technique ids, as a single string or a list of strings. Ids are+ // validated by shape, deduplicated, and published as the same+ // `mitre_attck` block the connector path emits (corpus-confirmed ids+ // verified:true, well-formed unconfirmed ids carried verified:false).+ // The inbox path maps only declared fields — it never scans the+ // payload — so a template has to name where its vendor carries+ // technique ids or they are dropped, which is how every inbox+ // template behaved before this field existed.+ TechniqueFields []string `yaml:"technique_fields,omitempty"`+// FieldMap projects vendor JSON paths onto OCSF JSON paths. Both// sides use dot notation; arrays are addressed with `[N]`.FieldMap map[string]string `yaml:"field_map"`@@ -115,6 +153,21 @@ func (r *Registry) parse(name string, raw []byte) bool {}t.SeverityMap = normalised}+ // Normalise class-map keys the same way, and drop an override that+ // names no class: silently stamping class_uid 0 would publish an event+ // no promoter branch can ever reach, which is worse than falling back+ // to the template's declared default.+ if len(t.ClassMap) > 0 {+ normalised := make(map[string]ClassOverride, len(t.ClassMap))+ for k, v := range t.ClassMap {+ if v.ClassUID <= 0 {+ log.Warn().Str("template", name).Str("class_map_key", k).Msg("inbox: class_map entry without a positive class_uid ignored")+ continue+ }+ normalised[strings.ToLower(strings.TrimSpace(k))] = v+ }+ t.ClassMap = normalised+ }r.mu.Lock()r.templates[t.ID] = tdiff --git a/services/ingest/internal/inbox/template_test.go b/services/ingest/internal/inbox/template_test.goindex 2dbcb4e46..b0d9671b3 100644--- a/services/ingest/internal/inbox/template_test.go+++ b/services/ingest/internal/inbox/template_test.go@@ -127,6 +127,40 @@ severity_map:}}+func TestRegistry_Load_NormalisesClassMapKeysAndDropsClasslessOverrides(t *testing.T) {+ // class_map keys get the SeverityMap treatment (lowercase, trimmed),+ // and an override that names no positive class_uid is dropped at load:+ // stamping class_uid 0 would publish an event no promoter branch can+ // reach, which is worse than falling back to the declared default.+ dir := t.TempDir()+ writeTemplate(t, dir, "split.yaml", `+class_uid: 6003+class_name: API Activity+class_field: action.type+class_map:+ " Detection ":+ class_uid: 2001+ class_name: Security Finding+ broken:+ class_name: No Class UID+field_map: {}+`)+ r := NewRegistry()+ if err := r.Load(dir); err != nil {+ t.Fatalf("Load failed: %v", err)+ }+ tmpl, err := r.Get("split")+ if err != nil {+ t.Fatalf("Get(split) failed: %v", err)+ }+ if got, ok := tmpl.ClassMap["detection"]; !ok || got.ClassUID != 2001 {+ t.Errorf("' Detection ' not folded to lowercase key: %#v", tmpl.ClassMap)+ }+ if _, ok := tmpl.ClassMap["broken"]; ok {+ t.Errorf("override without class_uid should be dropped: %#v", tmpl.ClassMap)+ }+}+func TestRegistry_Load_SkipsMalformedYAMLWithoutFailingTheRest(t *testing.T) {// One typo in pagerduty.yaml must not take down opsgenie.yaml — that's// what makes the registry safe to populate from a community-contributeddiff --git a/services/ingest/internal/normalizer/normalizer.go b/services/ingest/internal/normalizer/normalizer.goindex 003202ef5..4300e7aef 100644--- a/services/ingest/internal/normalizer/normalizer.go+++ b/services/ingest/internal/normalizer/normalizer.go@@ -922,25 +922,7 @@ func (n *Normalizer) Normalize(raw *RawEvent) (*NormalizedEvent, error) {// it up loses information we were handed. `verified` says which is which// so a reader is never told an unconfirmed id was confirmed.if techIDs := extractTechniqueIDs(raw.Payload); len(techIDs) > 0 {- var enriched []map[string]interface{}- for _, tid := range techIDs {- if tech := attck.Lookup(tid); tech != nil {- enriched = append(enriched, map[string]interface{}{- "technique_id": tech.ID,- "technique_name": tech.Name,- "tactic_ids": tech.TacticIDs,- "tactic_names": tech.TacticNames,- "url": tech.URL,- "verified": true,- })- continue- }- enriched = append(enriched, map[string]interface{}{- "technique_id": tid,- "verified": false,- })- }- if len(enriched) > 0 {+ if enriched := EnrichTechniqueIDs(techIDs); len(enriched) > 0 {ocsf["mitre_attck"] = enriched}}@@ -986,6 +968,75 @@ func (n *Normalizer) Normalize(raw *RawEvent) (*NormalizedEvent, error) {}, nil}+// EnrichTechniqueIDs builds the `mitre_attck` block from already-validated+// technique ids. Corpus-confirmed ids carry the technique name, tactics and+// URL with verified:true; a well-formed id the corpus cannot confirm is+// carried with verified:false, because dropping a vendor's assertion over a+// failed lookup loses information we were handed (issue #1244). Factored out+// of Normalize so the inbox template path publishes the identical block —+// one shape for fusion's _mitre() to read, however the event arrived.+func EnrichTechniqueIDs(ids []string) []map[string]interface{} {+ var enriched []map[string]interface{}+ for _, tid := range ids {+ if tech := attck.Lookup(tid); tech != nil {+ enriched = append(enriched, map[string]interface{}{+ "technique_id": tech.ID,+ "technique_name": tech.Name,+ "tactic_ids": tech.TacticIDs,+ "tactic_names": tech.TacticNames,+ "url": tech.URL,+ "verified": true,+ })+ continue+ }+ enriched = append(enriched, map[string]interface{}{+ "technique_id": tid,+ "verified": false,+ })+ }+ return enriched+}++// TechniqueIDsFromPaths collects ATT&CK technique ids from the given payload+// dot-paths, each holding a single string or a list of strings, validated by+// shape and deduplicated in encounter order.+//+// This is the inbox-template counterpart of extractTechniqueIDs below: the+// template path maps only fields a template declares, so the template names+// the exact paths its vendor uses (Agentmetry carries a list at+// detection.technique_ids and a single id at tool.mitre.technique_id) rather+// than scanning the flat candidate-key list a pushed payload uses. The shape+// check is the same one, which is what keeps a MITRE ATLAS id (AML.T****) or+// a tactic id (TA####) out of an ATT&CK-typed field on both paths.+func TechniqueIDsFromPaths(payload map[string]interface{}, paths []string) []string {+ seen := map[string]struct{}{}+ var results []string+ appendID := func(candidate string) {+ tid := normalizeTechniqueID(candidate)+ if tid == "" {+ return+ }+ if _, dup := seen[tid]; dup {+ return+ }+ seen[tid] = struct{}{}+ results = append(results, tid)+ }+ for _, path := range paths {+ switch v := getNestedField(payload, path).(type) {+ case string:+ appendID(v)+ case []interface{}:+ for _, item := range v {+ if s, ok := item.(string); ok {+ appendID(s)+ }+ }+ }+ }+ return results+}+// extractTechniqueIDs scans common fields in a raw payload for ATT&CK technique IDs.func extractTechniqueIDs(payload map[string]interface{}) []string {seen := map[string]struct{}{}diff --git a/services/ingest/internal/normalizer/normalizer_test.go b/services/ingest/internal/normalizer/normalizer_test.goindex 8895f11a7..fe14a9394 100644--- a/services/ingest/internal/normalizer/normalizer_test.go+++ b/services/ingest/internal/normalizer/normalizer_test.go@@ -7,6 +7,7 @@ import ("strings""testing"+ "github.com/beenuar/aisoc/services/ingest/internal/attck""github.com/beenuar/aisoc/services/ingest/internal/config")@@ -957,3 +958,79 @@ func TestSplunkEnterpriseIsNotAFindingClass(t *testing.T) {t.Errorf("splunk is class %d; a notable has already passed Splunk's correlation and must always promote", sp.classUID)}}++// ---------------------------------------------------------------------------+// Exported technique helpers (Discussion #1577). TechniqueIDsFromPaths feeds+// the inbox template path (technique_fields), EnrichTechniqueIDs is the one+// block-builder both paths share — so these tests pin the contract the+// Agentmetry template depends on: carry vendor-supplied ATT&CK ids as+// supplied, refuse anything that is not an ATT&CK technique id.+// ---------------------------------------------------------------------------++func TestTechniqueIDsFromPathsValidatesShapeAndDeduplicates(t *testing.T) {+ payload := map[string]interface{}{+ "detection": map[string]interface{}{+ // A tactic id, an ATLAS id and a non-string must all be+ // refused; the duplicate and the lowercase spelling must fold.+ "technique_ids": []interface{}{"T1552.004", "TA0006", "AML.T0098", "T1552.004", 42, "t1071.001"},+ },+ "tool": map[string]interface{}{+ "mitre": map[string]interface{}{"technique_id": "T1071.001"},+ },+ }+ ids := TechniqueIDsFromPaths(payload, []string{"detection.technique_ids", "tool.mitre.technique_id"})+ if len(ids) != 2 || ids[0] != "T1552.004" || ids[1] != "T1071.001" {+ t.Errorf("ids = %v, want [T1552.004 T1071.001]", ids)+ }+}++func TestTechniqueIDsFromPathsToleratesMissingAndMisshapenPaths(t *testing.T) {+ payload := map[string]interface{}{+ "detection": "not-a-map",+ }+ if ids := TechniqueIDsFromPaths(payload, []string{"detection.technique_ids", "absent.path"}); len(ids) != 0 {+ t.Errorf("ids = %v, want none from misshapen payloads", ids)+ }+}++func TestEnrichTechniqueIDsSaysWhichIdsTheCorpusConfirmed(t *testing.T) {+ // The issue #1244 contract, now shared with the inbox path: a+ // well-formed id is always carried, and `verified` says whether the+ // corpus confirmed it. TestNewLoadsTheCatalogueAtBoot loads the real+ // corpus into this process when the CDN is reachable, so both corpus+ // states are legitimate here — each branch asserts its own contract+ // rather than skipping (the connector-path skip variant already+ // exists in issue_1244_test.go).+ enriched := EnrichTechniqueIDs([]string{"T1552.004"})+ if len(enriched) != 1 {+ t.Fatalf("enriched = %v, want one entry", enriched)+ }+ if enriched[0]["technique_id"] != "T1552.004" {+ t.Errorf("technique_id = %v", enriched[0]["technique_id"])+ }+ verified, ok := enriched[0]["verified"].(bool)+ if !ok {+ t.Fatalf("verified missing or not a bool: %#v", enriched[0])+ }+ if attck.Loaded() {+ if !verified {+ t.Errorf("corpus is loaded but T1552.004 (Private Keys) was not confirmed: %#v", enriched[0])+ }+ if name, _ := enriched[0]["technique_name"].(string); name == "" {+ t.Errorf("confirmed entry carries no technique_name: %#v", enriched[0])+ }+ } else {+ if verified {+ t.Errorf("verified = true without a loaded corpus: %#v", enriched[0])+ }+ if _, present := enriched[0]["technique_name"]; present {+ t.Errorf("unconfirmed entry must not invent a technique_name: %#v", enriched[0])+ }+ }+}++func TestEnrichTechniqueIDsEmptyInputYieldsNoBlock(t *testing.T) {+ if enriched := EnrichTechniqueIDs(nil); len(enriched) != 0 {+ t.Errorf("enriched = %v, want empty", enriched)+ }+}diff --git a/services/ingest/internal/normalizer/templates/agentmetry.yaml b/services/ingest/internal/normalizer/templates/agentmetry.yamlnew file mode 100644index 000000000..5edf54fe5--- /dev/null+++ b/services/ingest/internal/normalizer/templates/agentmetry.yaml@@ -0,0 +1,106 @@+# Agentmetry — AI coding-agent activity and correlated detections.+#+# Agentmetry (github.com/blitzcrieg1/agentmetry, Apache-2.0) is an open-source+# sensor for AI coding agents: it records each tool call Claude Code, Cursor,+# Codex and Copilot make through their own hooks, plus every call through MCP+# servers wrapped by its proxy, correlates sequences into detections mapped to+# MITRE ATT&CK and ATLAS, and forwards one canonical JSON event per POST+# (schema v1.2.0, AGENTMETRY_AUDIT_WEBHOOK_FORMAT=canonical, the default).+#+# One template for both event kinds, because their webhook sink has one URL —+# and the kinds deliberately land in different OCSF classes, the same split+# ai-runtime.yaml / ai-finding.yaml encode:+#+# * Routine activity (action.type: tool_called, session_start, ...) is 6003+# API Activity. Category 6, so should_promote() leaves it in the lake to+# be hunted — a coding agent emits an event per tool call, and promoting+# each one floods the queue with the agent's normal operation.+# * A correlated detection (action.type: detection) is 2001 Security+# Finding via class_map. Category 2, always promoted: Agentmetry's own+# rule engine already judged the sequence worth a human's attention, the+# same reasoning that puts a Splunk notable at 2001 — a medium detection+# must not be silently dropped for missing a severity bar.+#+# Severity reads detection.severity, not action.outcome. On detection events+# the two carry the same word (critical | high | medium | low); on activity+# events action.outcome is an outcome (success | denied | error | pending),+# and routing it through the severity ladder would stamp "success" into a+# severity column. Activity events carry no vendor severity and surface as+# Unknown, which is honest — the detections are the severity-bearing stream.+#+# ATT&CK technique ids arrive pre-mapped by the sensor (detection.technique_ids+# on findings, tool.mitre.technique_id on tool calls) and are carried as+# supplied via technique_fields, never re-inferred. ATLAS ids (AML.T****) are+# deliberately NOT lifted into mitre_attck: the shape check admits only+# T####(.###), and Agentmetry's own docs warn that an ATLAS id in an+# ATT&CK-typed field corrupts any rollup that groups by technique. The inbox+# path retains no unmapped payload, so each ATLAS id is carried in its own+# evidence field instead — preserved for the analyst, invisible to ATT&CK+# rollups.+id: agentmetry+vendor_name: Agentmetry+product_name: Agentmetry+class_uid: 6003+class_name: API Activity+activity_id: 1+class_field: action.type+class_map:+ detection:+ class_uid: 2001+ class_name: Security Finding+field_map:+ # Identity. agent.name is the AI tool itself (cursor, claude, codex) —+ # actor.process.name is where the AI-estate inventory and graph read the+ # agent from; actor.id is the human account the agent acted for.+ agent.name: actor.process.name+ actor.id: actor.user.name+ host_id: src_endpoint.hostname+ source.app: finding.evidence.source_app+ # What was invoked (absent on detection events, present on activity).+ tool.name: activity_name+ tool.qualified: finding.evidence.tool_qualified+ action.outcome: status_detail+ model.id: metadata.product.feature.name+ model.provider: cloud.provider+ # Correlation and dedup. event_id is Agentmetry's per-event UUID — the+ # stable vendor id; correlation_id groups one agent session.+ event_id: finding.uid+ correlation_id: finding.evidence.session_id+ # The correlated finding (action.type: detection only).+ detection.title: finding.title+ detection.summary: finding.desc+ detection.rule_id: finding.related_events.id+ # Provenance without content: the tool-argument digest, the DLP rule that+ # matched, and the raw command when the operator opted into command logging.+ tool.input_hash: finding.evidence.input_sha256+ tool.command: finding.evidence.command+ dlp.rule_id: finding.evidence.dlp_rule_id+ # MITRE ATLAS ids, in evidence fields — never in mitre_attck (see header).+ # Two sources, two destinations, because a field map with two sources on+ # one destination resolves in Go map iteration order, which is random.+ detection.atlas.technique_id: finding.evidence.atlas_technique_id+ tool.atlas.technique_id: finding.evidence.tool_atlas_technique_id+severity_field: detection.severity+severity_map:+ # Agentmetry's detection ladder is exactly critical | high | medium | low+ # (SEVERITY_RANK in their detection/models.py). The extra keys are the+ # house five-tier ladder so a future vendor value maps instead of+ # surfacing Unknown. critical stays a distinct fifth tier — it must never+ # collapse into high.+ info: 1+ informational: 1+ low: 2+ medium: 3+ warning: 3+ high: 4+ critical: 5+ fatal: 6+technique_fields:+ - detection.technique_ids+ - tool.mitre.technique_id+time_field: timestamp_utc+message_field: detection.title+constants:+ source_type: agentmetry+ metadata.product.vendor_name: Agentmetry+ metadata.product.name: Agentmetry