audit-log
Skill0 starsChanged 4 months agoMITView on GitHub
Add a tamper-evident, hash-chained HMAC audit log to an agent
7 other projects use a version of this.
Adopted by
Most recently taken up by
- berriosb/data-analytics-agentstheir own version, first seen Oct 20, 2026
- EmeaAppGbb/spec2cloudtheir own version, first seen Oct 9, 2026
- BuilderIO/agent-nativetheir own version, first seen Oct 8, 2026
- crgarcia12/Liliputtheir own version, first seen Jul 14, 2026
- Pradnyeshp/Claude-Skillstheir own version, first seen Jul 6, 2026
- SAQLAINAP/GitClaw-Agenttheir own version, first seen Apr 5, 2026
Used with
Projects with it also use error-handling.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
MicrosoftSkillerror-handling
统一错误处理系统。在添加 API 端点、修改错误处理、添加前端 API 调用、编写错误相关测试时使用。
Also in 3 projects that use this
Other versions7 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 7
- BuilderIO/agent-native★ 7.6ksame name
- EmeaAppGbb/spec2cloud★ 100same name
- crgarcia12/Liliput★ 4same name
- Pradnyeshp/Claude-Skills★ 2same name
- SAQLAINAP/GitClaw-Agent★ 1same name
- berriosb/data-analytics-agents★ 0same name
- PalmCoast/clawlock-plugin★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository3 other files it gives its agents.
- agent-eval-scaffoldSkill
- otel-agent-tracingSkill
- trace-triageSkill
The file
We split this skill into the rules it gives an agent
2 rules. 0 are common, 0 are distinctive, and 2 are very specific to this project.
0
Common
Most of the 5 edited versions we read keep these.
0
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 32
Ensure AUDIT_CHAIN_KEY is set in the environment.
- Very specific: line 50
If no anchor file is present, verification still runs but prints a prominent warning that truncation cannot be ruled out.
“Common” is measured: kept by at least 6 in 10 of the 5 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Audit Log
Gives an agent project an append-only audit trail where every entry is HMAC-chained to the previous one. Any modification, deletion, insertion, or reordering of past entries breaks the chain. A head anchor, written on every append by default, makes truncation from the tail detectable too.
Record format
One JSONL file per run (default audit/<run_id>.jsonl). Entry fields:
seq, ts, run_id, actor, action, payload, prev_hash,
entry_hash. The hash covers every field except entry_hash itself:
entry_hash = HMAC_SHA256(key, prev_hash + canonical_json(body))Canonical JSON: sorted keys, compact separators, default=str. Genesis
prev_hash is 64 zeros. Each append also rewrites <log>.head.json
({"count": N, "head_hash": "..."}), the anchor used to detect truncation.
Procedure
- Copy
scripts/chained_log.pyinto the target project (for example<project>/audit/chained_log.py). It is stdlib-only, no dependencies. - Ensure
AUDIT_CHAIN_KEYis set in the environment. Never hardcode it. The script falls back to a built-in dev key with a loud stderr warning; tell the user that key is for local experiments only. - Integrate at the points where the agent acts:
- LangGraph: follow
templates/langgraph_integration.py. Create oneChainedLoggerper run before graph invocation, log one entry per node withactor=<node name>,action=<what happened>, and a payload containing the inputs and outputs worth auditing. - Plain Python: follow
templates/plain_python.py. Log one entry per tool call or state change, including failures.
- LangGraph: follow
- Smoke test: run the agent once, confirm the JSONL file and the
.head.jsonanchor exist and that the anchor count matches the line count. - Prove integrity:
python scripts/verify_chain.py audit/<run_id>.jsonl. It recomputes every hash and checks the anchor. Exit 0 means intact; exit 1 means a broken chain with a line-numbered diagnosis; exit 2 means an anchor mismatch. To demonstrate detection, run--demo-tamperon a COPY of the log and show the failure output. - If no anchor file is present, verification still runs but prints a
prominent warning that truncation cannot be ruled out; it never passes
silently. Use
--require-anchorto turn that into a hard failure. - Explain the trust model to the user (below). Do not overclaim.
Trust model
Detected: any edit to a logged entry, deleted or inserted entries,
reordering, and truncation from the tail (via the head anchor). Not
detected: an attacker who has both write access to the log and the HMAC
key can rebuild the whole chain. Keep the key out of the repo, and for
strong truncation protection store the head anchor (or just its
head_hash) somewhere log writers cannot touch, such as a CI artifact or
a separate store.
Files
scripts/chained_log.py:ChainedLoggerclass,append(), head anchor.scripts/verify_chain.py: CLI verifier and importableverify(). Flags:--key-env,--require-anchor,--demo-tamper.templates/langgraph_integration.py: per-node logging in a LangGraph app.templates/plain_python.py: logging around plain tool calls.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

