Skip to content

Preflight v2: correlate preflight with recorded sessions via workspace digest (schema 1.3.0) - #526

Merged
blitzcrieg1 merged 1 commit into
masterfrom
feat/preflight-trail-correlation
Nov 28, 2026
Merged

blitzcrieg1 merged 1 commit into
masterfrom
feat/preflight-trail-correlation

Conversation

@blitzcrieg1

Copy link
Copy Markdown
Owner

Step 3 of preflight v2: join the static report with what the recorder observed, without ever storing the workspace path.

Recorder side (additive schema 1.2.0 to 1.3.0): hooks compute workspace_sha256 (SHA-256 of the normalized absolute cwd) in-process in map_hook, before hashing; ExternalIngestBody declares the field; canonical.py (outbox path) and external.py (adapter path) pass it through as an optional event field. Older events simply lack it; 1.2.0 consumers ignore the unknown key per the documented additive rule. The path itself is never sent, stored, or printed.

Scanner side: agentmetry scan --preflight PATH --with-trail matches recorded sessions by workspace digest and reports aggregate counts only: events, sessions, first/last timestamps, and detection rule names that fired in those sessions. Event contents, commands and arguments are never read into the report. Read-only SQLite (mode=ro).

This is the blue-team view: what was declared at open versus what actually ran in that workspace.

Verification: 303 tests pass across scanner, ingest, roundtrip, audit, atlas, identity, sentinel suites (incl. new hook test asserting the path string never appears in the payload, and a roundtrip test asserting the digest survives the HTTP model); ruff clean; collected count 3150 (README updated). Detection-frozen files untouched, ruleset fingerprint unmoved.

Note: the live recorder emits workspace_sha256 only after upgrading to a release with this change; until then --with-trail reports zero matched sessions on existing trails. Stacks on #524 and #525.

…digest

Step 3 of preflight v2, privacy-preserving by construction. Hooks now
compute workspace_sha256, the SHA-256 of the normalized absolute cwd,
in-process before anything crosses the wire; the canonical event schema
bump is additive (1.2.0 to 1.3.0, optional field, older events simply
lack it). The workspace path itself is never stored or sent.

`scan --preflight PATH --with-trail` joins the static report with the
recorder's trail: it matches sessions by workspace digest and reports
aggregate counts only (events, sessions, first/last timestamps, and the
detection rule names that fired in those sessions). Event contents,
commands and arguments are never read into the report.

Touches both sides deliberately and is reviewable as one unit: hook
(agentmetry/hooks/ingest.py map_hook), ingest model (ExternalIngestBody),
canonical mapping (canonical.py outbox path, external.py adapter path),
schema doc, and the new scanner correlate module. Detection-frozen files
are untouched, so the ruleset fingerprint does not move.

Note: the live recorder emits workspace_sha256 only after it is upgraded
to a release carrying this change; until then --with-trail reports zero
matched sessions. Tests: 303 pass across scanner, ingest, roundtrip and
audit suites; ruff clean.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <[email protected]>
@blitzcrieg1
blitzcrieg1 force-pushed the feat/preflight-trail-correlation branch from a13a47e to 720c94b Compare November 28, 2026 19:51
@blitzcrieg1
blitzcrieg1 merged commit 1961d25 into master Nov 28, 2026
10 checks passed
blitzcrieg1 added a commit that referenced this pull request Nov 28, 2026
Preflight v2 ships as one release: preflight follows referenced scripts
(#524), a read-only GitHub preflight at a pinned commit (#525), and
preflight correlation with recorded sessions (#526). The canonical event
schema moves to 1.3.0 with the additive workspace_sha256 field. Version
and changelog move together per the version provenance tests.

Generated by Mistral Vibe.

Co-authored-by: Mistral Vibe <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant