为 AI 代理提供防篡改、仅附加、哈希链审计日志,通过单调排序和完整性检查来验证操作。
数据来源:ClawHub。 在 ClawSkills 查看
选择你使用的 Agent
方法一:命令行安装(推荐)
推荐(无需提前安装 clawhub)
npx clawhub@latest --dir ~/.claude/skills install agent-audit-trail或使用 clawhub CLI(需提前安装)
clawhub --dir ~/.claude/skills install agent-audit-trail⚠️ 需要 Node.js 18+,没有 Node?请使用下方方法二直接下载 ZIP。 安装 Node.js →
方法二:手动下载安装(无需 Node)
下载 ZIP,解压后将文件夹放到以下路径,重启 Agent 即可:
安装路径
~/.claude/skills/agent-audit-trail/💡解压后将文件夹放到上方路径,重启 Agent 即可生效
--- name: Agent Audit Trail version: 2.1.0 description: > Append-only, hash-chained audit log for AI agents. Records agent actions, tool calls, decisions, and external writes with provenance, timestamps, and sha256 chain integrity. Designed for compliance with EU AI Act Article 12 automatic event recording requirements for high-risk AI systems. author: name: Justin Roosch url: https://github.com/roosch269 license: MIT-0 tags: - audit - compliance - logging - eu-ai-act - article-12 - governance - provenance - security keywords: - audit trail - agent logging - hash chain - event log - compliance logging ---
An append-only, hash-chained audit log for AI agents. Every significant action, decision, tool call, and external write is recorded with a sha256 chain linking entries together — making tampering detectable and providing an authoritative compliance record.
This skill provides:
audit/atlas-actions.ndjsonord field ensures strict sequenceaudit/atlas-actions.ndjson
The file is append-only. Never truncate, overwrite, or reorder entries.
Each line is a valid JSON object:
{
"ts": "2026-04-02T18:00:00.000+01:00",
"kind": "tool-call",
"actor": "atlas",
"domain": "agirails",
"plane": "action",
"gate": "external-write",
"ord": 42,
"provenance": "session:agent:main:discord:channel:1472016988741177520",
"target": "audit/atlas-actions.ndjson",
"summary": "Appended audit log entry",
"prev_hash": "sha256:abc123...",
"hash": "sha256:def456..."
}
| Field | Type | Description | |-------|------|-------------| | ts | ISO-8601 | Timestamp with timezone offset (Europe/London) | | kind | string | Event type (see below) | | actor | string | Agent or component that triggered the event | | domain | string | Domain partition (agirails, client-lab, personal) | | plane | string | Four-plane label (ingress, interpretation, decision, action) | | gate | string | Truth gate applied (see SOUL.md) | | ord | integer | Monotonically increasing sequence number | | provenance | string | Source session or external identity | | target | string | File, URL, or resource affected | | summary | string | Human-readable description of the event | | prev_hash | string | sha256 of the previous log entry (hex, prefixed sha256:) | | hash | string | sha256 of this entry excluding the hash field itself |
| Kind | Plane | Description | |------|-------|-------------| | tool-call | action | Any tool invocation | | external-write | action | Write to external system (file, API, DB) | | credential-access | action | Secret or key accessed | | install-extend | action | Package install or skill activation | | decision | decision | Agent decision with reasoning | | override | decision | Safety override applied | | ingress | ingress | External input received | | session-start | ingress | Agent session initialised | | session-end | ingress | Agent session terminated | | state-transition | decision | Behaviour surface change | | payment | action | ACTP/x402 payment event (amount, counterparty, txhash) |
mkdir -p audit
touch audit/atlas-actions.ndjson
Add to your workspace TOOLS.md:
## Audit Log
- Path: `audit/atlas-actions.ndjson`
- Format: append-only NDJSON, hash-chained (sha256), monotonic `ord`
- Timestamps: Europe/London ISO-8601 with offset
- Fields: ts, kind, actor, domain, plane, gate, ord, provenance, target, summary
Add to your workspace SOUL.md invariants:
4. Append-only, hash-chained audit log with monotonic ordering
10. Behavior surface changes logged as state transitions
And to Truth Gates:
- external-write: provenance + intent + approval + tool-log + ordering
- credential-access: domain scope + justification + audit + human approval
- install-extend: integrity proof + scope + rollback ref + human approval
# scripts/audit_append.py
import json, hashlib, time, sys
from datetime import datetime, timezone, timedelta
from pathlib import Path
LOG = Path("audit/atlas-actions.ndjson")
TZ = timezone(timedelta(hours=1)) # Europe/London BST; adjust for GMT
def last_hash():
lines = LOG.read_text().strip().splitlines() if LOG.exists() else []
if not lines:
return "sha256:0" * 1 # genesis
last = json.loads(lines[-1])
return last.get("hash", "sha256:genesis")
def last_ord():
lines = LOG.read_text().strip().splitlines() if LOG.exists() else []
if not lines:
return 0
return json.loads(lines[-1]).get("ord", 0)
def append(kind, actor, domain, plane, gate, provenance, target, summary):
entry = {
"ts": datetime.now(TZ).isoformat(),
"kind": kind,
"actor": actor,
"domain": domain,
"plane": plane,
"gate": gate,
"ord": last_ord() + 1,
"provenance": provenance,
"target": target,
"summary": summary,
"prev_hash": last_hash(),
}
raw = json.dumps({k: v for k, v in entry.items()}, separators=(",", ":"))
digest = "sha256:" + hashlib.sha256(raw.encode()).hexdigest()
entry["hash"] = digest
with LOG.open("a") as f:
f.write(json.dumps(entry) + "\n")
return entry
if __name__ == "__main__":
# Example: python3 scripts/audit_append.py
append("session-start", "atlas", "personal", "ingress", "none",
"manual", "audit/atlas-actions.ndjson", "Session initialised")
To check chain integrity:
python3 - <<'EOF'
import json, hashlib
from pathlib import Path
LOG = Path("audit/atlas-actions.ndjson")
lines = LOG.read_text().strip().splitlines()
prev = "sha256:genesis"
for i, line in enumerate(lines):
entry = json.loads(line)
stored_hash = entry.pop("hash")
raw = json.dumps(entry, separators=(",", ":"))
computed = "sha256:" + hashlib.sha256(raw.encode()).hexdigest()
if stored_hash != computed:
print(f"CHAIN BROKEN at entry {i} (ord={entry.get('ord')})")
break
if entry.get("prev_hash") != prev:
print(f"PREV_HASH MISMATCH at entry {i}")
break
prev = stored_hash
else:
print(f"Chain OK — {len(lines)} entries verified")
EOF
append(
kind="external-write",
actor="atlas",
domain="agirails",
plane="action",
gate="external-write",
provenance="session:agent:main:discord:...",
target="https://api.agirails.xyz/v1/escrow",
summary="Created ACTP escrow 0xabc... for 10 USDC"
)
append(
kind="credential-access",
actor="atlas",
domain="agirails",
plane="action",
gate="credential-access",
provenance="session:agent:main",
target=".env:ACTP_KEY_PASSWORD",
summary="Accessed ACTP wallet key for testnet payment"
)
append(
kind="payment",
actor="atlas",
domain="agirails",
plane="action",
gate="external-write",
provenance="session:agent:main",
target="base-sepolia:0xabc...def",
summary="x402 payment: 5 USDC → counterparty 0x123, txhash 0xdef..."
)
---
EU AI Act Article 12 mandates that providers of high-risk AI systems must ensure their systems can automatically record events ("logging") throughout their operational lifetime. Requirements include:
August 2026 deadline — High-risk AI systems must be compliant by the enforcement date under the EU AI Act transition schedule.
| Article 12 Requirement | This Skill's Implementation | |------------------------|----------------------------| | Automatic event recording | audit_append.py — every tool call, decision, ingress | | Period of use (timestamps) | ts field — ISO-8601 with timezone offset | | Input data traceability | provenance + ingress kind entries | | Decision traceability | decision kind entries with reasoning summary | | Identity of actors | actor + provenance fields | | Tamper detection | sha256 hash chain — prev_hash + hash fields | | Ordering guarantees | Monotonic ord field |
Assess whether your agent deployment qualifies as high-risk under Annex III of the EU AI Act. If operating in:
…then Article 12 logging is mandatory, not optional. Run the Agent Compliance & Security Assessment skill first to determine your risk classification.
---
agent-self-assessment (v2.2.1)> Run the assessment first, then set up logging for ongoing compliance.
The self-assessment skill provides a 14-check compliance and security framework with RED/AMBER/GREEN ratings. Use it to determine your EU AI Act risk classification before configuring this audit trail.
Install:
clawhub install agent-self-assessment
Or if already available in your workspace:
Read ~/.openclaw/workspace/skills/agent-self-assessment/SKILL.md
Workflow:
agent-self-assessment → identify gaps + risk tieragent-audit-trail → implement logging for ongoing compliance---
agirails (v3.0.0)> Enable payment tracking in your audit trail.
AGIRAILS provides ACTP escrow and x402 instant payment primitives for AI agents. All payments should be logged using the payment kind in this audit trail.
Install:
clawhub install agirails
Or if already available in your workspace:
Read ~/.openclaw/workspace/skills/agirails/SKILL.md
Payment logging integration:
external-write entrypayment entry with txhashstate-transition entrysummarySee TOOLS.md → Audit Log and SOUL.md invariant #4 for the full integration.
---
The following features are planned for upcoming releases:
export commandGenerate a structured compliance report from the NDJSON log:
python3 scripts/audit_export.py --from 2026-01-01 --to 2026-04-01 --domain agirailsstats commandEvent counts, domain breakdown, and time-range queries:
python3 scripts/audit_stats.py --range 7d --by domainA formal JSON Schema (audit/log-schema.json) to validate entries:
Ship log entries to an append-only remote bucket for disaster recovery:
A structured report template covering:
---
This skill is part of the Atlas workspace compliance stack. See also: SOUL.md (invariants), TOOLS.md (audit log config), agent-self-assessment (risk classification).
安装 代理审计追踪 后,可以对 AI 说这些话来触发它
Help me get started with Agent Audit Trail
Explains what Agent Audit Trail does, walks through the setup, and runs a quick demo based on your current project
Use Agent Audit Trail to append-only, hash-chained audit log for AI agents
Invokes Agent Audit Trail with the right parameters and returns the result directly in the conversation
What can I do with Agent Audit Trail in my developer & devops workflow?
Lists the top use cases for Agent Audit Trail, with example commands for each scenario
将技能文件夹放到 ~/.claude/skills/agent-audit-trail/ 目录(个人级,所有项目可用),或 .claude/skills/agent-audit-trail/(项目级)。重启 AI 客户端后,用 /agent-audit-trail 主动调用,或让 AI 根据上下文自动发现并使用。
代理审计追踪 支持 Claude、Cursor、OpenClaw,可与这些 AI 平台无缝集成,扩展其能力。
代理审计追踪 可免费安装使用。请查阅仓库了解许可证信息。
为 AI 代理提供防篡改、仅附加、哈希链审计日志,通过单调排序和完整性检查来验证操作。
代理审计追踪 属于「Developer & DevOps」分类,该分类的技能帮助 AI 智能体在此领域执行专业任务。
Automate my developer & devops tasks using Agent Audit Trail
Identifies repetitive steps in your workflow and sets up Agent Audit Trail to handle them automatically