How agnetacount/agentledger works
agentledger is a local, zero-dependency audit trail for AI-agent tool calls. Its main workflow is to capture a tool call, redact or omit sensitive payloads according to capture mode, hash and optionally sign the record, then append it to a JSONL ledger. Users can inspect the ledger through the API or CLI, compute statistics, create checkpoints, and verify integrity offline. The excerpts show the principal calls and file operations; README statements support documented capabilities such as wrapping tool functions and CLI tail/export commands.
Main entry points: ledger.ts Ledger and wrap · verify.ts Ledger verification · cli.ts CLI commands · index.ts Public API
Components 14
Entry points
- Public API
src/index.ts - CLI launcher
bin/agentledger.js - CLI commands
src/cli.ts
Record capture
- Ledger and wrap
src/ledger.ts - Secret redaction
src/redact.ts
Integrity and reporting
- Canonical JSON
src/canonical.ts - Hash and HMAC
src/crypto.ts - Ledger verification
src/verify.ts - Checkpoint creation
src/verify.ts - Ledger statistics
src/stats.ts
Local persistence
- Secure file I/O
src/fileio.ts - JSONL ledger
Other components
- API caller
- CLI user
Connections 21
- API caller → Public API: uses API
README.md - Public API → Ledger and wrap: creates ledger
src/index.ts - Public API → Ledger verification: exports verification
src/index.ts - Public API → Ledger statistics: exports statistics
src/index.ts - CLI user → CLI launcher: runs commands
README.md - CLI launcher → CLI commands: runs CLI
bin/agentledger.js - Ledger and wrap → Secret redaction: redacts payloads
src/ledger.ts - Ledger and wrap → Canonical JSON: canonicalizes records
src/ledger.ts - Ledger and wrap → Hash and HMAC: hashes records
src/ledger.ts - Ledger and wrap → Secure file I/O: reads and appends
src/ledger.ts - Secure file I/O → JSONL ledger: reads and writes
- Ledger and wrap → Ledger verification: verifies ledger
src/ledger.ts - Ledger and wrap → Ledger statistics: computes stats
src/ledger.ts - CLI commands → Secure file I/O: reads and writes
src/cli.ts - CLI commands → Ledger verification: verifies ledger
src/cli.ts - CLI commands → Ledger statistics: computes stats
src/cli.ts - CLI commands → Checkpoint creation: builds checkpoint
src/cli.ts - Ledger verification → Secure file I/O: reads ledger file
src/verify.ts - Ledger verification → Canonical JSON: canonicalizes for checks
src/verify.ts - Ledger verification → Hash and HMAC: checks hashes and signatures
src/verify.ts - Checkpoint creation → Hash and HMAC: signs checkpoint
src/verify.ts