Import the AGT audit log

kya import --from agt reads the audit log written by the Claude Code plugin of Microsoft’s Agent Governance Toolkit (AGT) and adds it to the KYA record (trail). AGT enforces; KYA reports and proves. After an import, kya receipt, kya certify and kya investigate see AGT’s allow, review and deny decisions next to everything else in the record.

kya import --from agt                          # ~/.claude/agt/audit-log.json (or $AGT_CLAUDE_AUDIT_PATH)
kya import --from agt --file ./audit-log.json  # a copy, e.g. from another machine or CI

What lands in the record

AGT logs {timestamp, agentId, action, decision, previousHash, hash} per decision and never records tool arguments, so neither does the import: no args, no argsHash, no diff, no target path.

AGT field KYA event field
decision: allow verdict: ALLOW, reasonCode: IMPORTED_AGT_ALLOW
decision: deny verdict: DENY, reasonCode: IMPORTED_AGT_DENY
decision: review (or ask) verdict: REQUIRE_APPROVE, reasonCode: IMPORTED_AGT_REVIEW
action: tool.Bash toolId: Bash (the tool. prefix is stripped; prompt.submit stays as is)
agentId: claude-code:<session> sessionId: <session>
timestamp ts
recomputed SHA-256 of the entry sourceHash (used to skip duplicates; never the stored hash field)

Every row is host: import, mode: observe, summary: "AGT decision for <tool>", importedFrom: "agt" and carries chainVerified. Text fields have control characters (newlines, ESC, NUL) replaced by spaces and whitespace collapsed. Entries are skipped and counted in the errors: line (the rest import) when they have an unknown decision (only allow, deny, review, ask are accepted), an empty tool name or session id, a hash that is not 64 lowercase hex characters, or a timestamp that is not ISO 8601 or falls outside 2000-01-01 .. now + 1 day.

Hash-chain verification

AGT chains its entries with an unkeyed SHA-256 (a checksum with no secret key) over {timestamp, agentId, action, decision, previousHash}. The import re-checks that chain exactly as AGT does (bare array anchored to a zero genesis hash, or {seamHash, entries} after AGT rolled over its 10,000-entry cap).

The chain is unkeyed, so it detects accidental damage and naive edits, not an attacker who recomputes every hash. chainVerified: true means “internally consistent”, not “authentic”. Two cases are undetectable by design of AGT’s format: cutting entries off the tail, and cutting the head of a {seamHash, entries} log and setting seamHash to the first kept previousHash.

Re-importing

Imports are idempotent (no duplicates). Rows are matched by the AGT entry hash (sourceHash), so importing the same file twice, or a log that has grown since the last import, adds only the new entries. The summary shows already imported: N record(s) for the rest.

Known limitations

Notes