Context
AMS (packages/gittensory-miner) already maintains an append-only event ledger in packages/gittensory-miner/lib/event-ledger.js, exposed today only via a ledger list CLI command that returns eventType, repoFullName, outcome, actor, detail, createdAt (metadata only). ORB already ships an equivalent read surface over MCP — gittensory_get_agent_audit_feed in src/mcp/server.ts — but AMS has no MCP-exposed equivalent, so an operator or an MCP-connected coding agent driving the miner autonomously has no way to read its own audit trail short of shelling out to the CLI. This issue adds the missing read-only MCP mirror.
Dependencies
Requires the AMS MCP server scaffold (the gittensory-miner mcp bin entry that hosts these tool handlers) to already exist — this tool is registered against that server, it does not stand up a new one. Otherwise independently shippable: it is unrelated to #4834, which is about ledger durability/integrity/retention, not visibility.
Requirements
- Add a new MCP tool,
gittensory_miner_get_audit_feed, registered on the AMS MCP server alongside the other packages/gittensory-miner/lib tool handlers.
- The tool's read path must call into
packages/gittensory-miner/lib/event-ledger.js's existing ledger list query accessor — reuse it, do not duplicate the SQL/query logic inside the MCP handler.
- The response shape must be metadata-only and must match the CLI's existing fields exactly:
eventType, repoFullName, outcome, actor, detail, createdAt. Do not add or infer new fields.
- Support the same filtering/pagination the CLI's
ledger list already supports (e.g. limit, repo filter) as tool input parameters, translated 1:1 — do not invent new filter semantics.
- The tool must be strictly read-only: it must never write to the ledger, mutate any other AMS state, or trigger any side effect.
- Mirror the response shape/conventions of ORB's
gittensory_get_agent_audit_feed (src/mcp/server.ts) as closely as the two ledger schemas allow, so a caller already familiar with the ORB tool needs no relearning.
- The tool's MCP-facing description must state explicitly that it is read-only and metadata-only.
Deliverables / Acceptance Criteria
Test Coverage Requirements
This PR must ship with full test coverage for every changed line and branch — the repo's Codecov patch gate requires 99%+ coverage and the house standard is to aim for 100%, including both sides of every conditional/nullish-coalescing branch introduced. Add: (1) unit tests covering the new/changed logic's success and failure paths (valid filters, empty ledger, missing/malformed input), (2) an invariant test asserting the MCP tool never returns a field beyond eventType/repoFullName/outcome/actor/detail/createdAt (i.e. it can never leak whatever columns get added to the ledger later), and (3) no regression test is required since this is new functionality, not a bug fix.
Codecov visibility note: packages/gittensory-miner/**, apps/gittensory-miner-ui/**, and apps/gittensory-miner-extension/** currently sit entirely outside vitest's coverage.include glob, so codecov/patch cannot measure changes there yet — closing that gap is exactly what #4864 and #4865 (in this same milestone) do. Any part of this change under packages/gittensory-engine/src/** or the repo's own src/** remains fully Codecov-instrumented as usual. Either way, this does not lower the bar: treat the 100%-including-invariants-and-regression target above as the enforced house standard regardless of what Codecov can currently see, and it becomes gate-enforced for real once #4864/#4865 ship.
Expected Outcome
An AMS operator or an MCP-connected coding agent can query the miner's own audit trail (what happened, on which repo, with what outcome) over MCP, without shelling into the CLI — matching the visibility ORB already provides for its own audit feed.
Links & Resources
Context
AMS (
packages/gittensory-miner) already maintains an append-only event ledger inpackages/gittensory-miner/lib/event-ledger.js, exposed today only via aledger listCLI command that returnseventType,repoFullName,outcome,actor,detail,createdAt(metadata only). ORB already ships an equivalent read surface over MCP —gittensory_get_agent_audit_feedinsrc/mcp/server.ts— but AMS has no MCP-exposed equivalent, so an operator or an MCP-connected coding agent driving the miner autonomously has no way to read its own audit trail short of shelling out to the CLI. This issue adds the missing read-only MCP mirror.Dependencies
Requires the AMS MCP server scaffold (the
gittensory-miner mcpbin entry that hosts these tool handlers) to already exist — this tool is registered against that server, it does not stand up a new one. Otherwise independently shippable: it is unrelated to #4834, which is about ledger durability/integrity/retention, not visibility.Requirements
gittensory_miner_get_audit_feed, registered on the AMS MCP server alongside the otherpackages/gittensory-miner/libtool handlers.packages/gittensory-miner/lib/event-ledger.js's existingledger listquery accessor — reuse it, do not duplicate the SQL/query logic inside the MCP handler.eventType,repoFullName,outcome,actor,detail,createdAt. Do not add or infer new fields.ledger listalready supports (e.g. limit, repo filter) as tool input parameters, translated 1:1 — do not invent new filter semantics.gittensory_get_agent_audit_feed(src/mcp/server.ts) as closely as the two ledger schemas allow, so a caller already familiar with the ORB tool needs no relearning.Deliverables / Acceptance Criteria
gittensory_miner_get_audit_feedtool implemented and registered on the AMS MCP serverevent-ledger.jsquery path (no duplicated SQL)event-ledger.js's existing CLI output exactly (eventType,repoFullName,outcome,actor,detail,createdAt)ledger listcommandevent-ledger.js's write path or to any governor/decision logicTest Coverage Requirements
This PR must ship with full test coverage for every changed line and branch — the repo's Codecov patch gate requires 99%+ coverage and the house standard is to aim for 100%, including both sides of every conditional/nullish-coalescing branch introduced. Add: (1) unit tests covering the new/changed logic's success and failure paths (valid filters, empty ledger, missing/malformed input), (2) an invariant test asserting the MCP tool never returns a field beyond
eventType/repoFullName/outcome/actor/detail/createdAt(i.e. it can never leak whatever columns get added to the ledger later), and (3) no regression test is required since this is new functionality, not a bug fix.Codecov visibility note:
packages/gittensory-miner/**,apps/gittensory-miner-ui/**, andapps/gittensory-miner-extension/**currently sit entirely outside vitest'scoverage.includeglob, socodecov/patchcannot measure changes there yet — closing that gap is exactly what #4864 and #4865 (in this same milestone) do. Any part of this change underpackages/gittensory-engine/src/**or the repo's ownsrc/**remains fully Codecov-instrumented as usual. Either way, this does not lower the bar: treat the 100%-including-invariants-and-regression target above as the enforced house standard regardless of what Codecov can currently see, and it becomes gate-enforced for real once #4864/#4865 ship.Expected Outcome
An AMS operator or an MCP-connected coding agent can query the miner's own audit trail (what happened, on which repo, with what outcome) over MCP, without shelling into the CLI — matching the visibility ORB already provides for its own audit feed.
Links & Resources
packages/gittensory-miner/lib/event-ledger.jssrc/mcp/server.ts(ORB'sgittensory_get_agent_audit_feed, for shape reference)