Skip to content

[CLI] weaver-kernel audit — inspect, filter, and verify action traces from the terminal #147

@dgenio

Description

@dgenio

Summary

Add an audit subcommand to the package CLI that reads a persisted trace store and lets operators answer audit questions from the terminal: list and filter traces (by principal, capability, decision, time window), show one action in full (explain), tail a live log, export a filtered set, and verify log integrity.

Why this matters

The audit trail is the product's payoff, but today the only way to read it is Python code in the same process. The moment traces persist (pluggable stores) and chain (verifiable log), the obvious next question is "how do I look at this?" — and the answer should be one command. This is also the natural companion to the planned doctor command (#124): doctor checks the setup, audit operates the result.

Proposed scope

Implementation notes

  • Coordinate with cli: add doctor for examples, environment, secret configuration, and test vectors #124 (doctor): one console entry point (weaver-kernel) with subcommands; whichever lands first creates the CLI skeleton (argparse is sufficient — stdlib-only keeps the minimal-deps rule intact).
  • Depends on persistent trace stores for real value; against an in-memory store the command should fail with a clear typed error pointing at the persistence docs.
  • Output must remain redaction-safe by construction — the CLI renders only what ActionTrace already contains; no flag may surface raw driver output.
  • Tests: CLI invocations as subprocess or via the argparse entry function, against a SQLite/JSONL fixture store; verify command tested against a deliberately tampered fixture.

Acceptance criteria

  • list, show, verify, and export work against a persisted trace store with documented filters.
  • Every subcommand supports --json; human output readable without third-party deps.
  • verify detects a tampered fixture and exits non-zero with the divergent record id.
  • Clear typed error when no persistent store is configured.
  • docs/cli.md covers all subcommands; CHANGELOG updated.

Out of scope

References


Priority: P2 · Effort: M · Impact: High

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions