signed-audit-trails-recipe
ما الذي تفعله
تنشئ هذه المهارة سجلاً آمناً وقابلاً للتحقق لكل الإجراءات التي يتخذها وكيل الذكاء الاصطناعي. يُفحص كل إجراء وفق قواعد أمنية، ثم يُوقَّع رقمياً، فيستطيع أي شخص التحقق من أنه لم يُعبث به.
متى تستخدمها
- ✓في الصناعات المنظمة (المالية، والرعاية الصحية) لإثبات سلوك الوكيل.
- ✓في عمليات التطوير الآلية (CI/CD) للتأكد من الالتزام بالقواعد.
- ✓عندما تحتاج إلى أن يتحقق شخص آخر من إجراءات وكيلك دون أن يضطر إلى الثقة بك مباشرة.
رابط المهارة
https://github.com/wshobson/agents/blob/main/plugins/signed-audit-trails/skills/signed-audit-trails-recipe/SKILL.mdانسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.
طريقة الاستخدام
أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.
رسالة جاهزة للصق
لـ Claude Code أو Codex أو Cursor: شغّله داخل مجلد مشروعك وستُثبَّت المهارة.
نزّل ملف SKILL.md وضعه في مجلد مهارات وكيلك.
مثال على ما تطلبه من الذكاء الاصطناعي
“أعدّ سجلات تدقيق موقّعة لاستدعاءات الأدوات الخاصة بي.”
5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.
كيف تعمل
تستخدم هذه المهارة إضافة تفحص أولاً كل أمر وفق سياسة أمنية (Cedar)، ثم تُنشئ توقيعاً رقمياً (Ed25519) للنتيجة. يتيح هذا التوقيع التحقق لاحقاً دون الحاجة إلى اتصال بالإنترنت أو الثقة بالمشغّل.
المحتوى التقني (ملف SKILL.md الأصلي)
النص الأصلي من المؤلف، مباشرة من GitHub.
Signed Audit Trails for Claude Code Tool Calls
Cookbook-style walkthrough for cryptographically signed receipts on every
Claude Code tool call. This is the teaching skill. For the runtime
implementation, install the protect-mcp plugin.
What this gives you
Every tool call (Bash, Edit, Write, WebFetch) is:
- Evaluated against a Cedar policy before execution. If the policy denies the call, the tool does not run.
- Signed as an Ed25519 receipt after execution. Receipts are JCS-canonical and verifiable offline by anyone with the public key.
An auditor, regulator, or counterparty can verify every receipt later (Step 5). No network call, no vendor lookup, no trust in the operator.
When to use the pattern
- Regulated environments (finance, healthcare, critical infrastructure) where you need tamper-evident evidence of agent behavior
- CI/CD pipelines where you want to prove that a policy gate held for every automated build step
- Multi-party collaboration where a counterparty wants to verify your agent's behavior without trusting your operator
- Compliance contexts (EU AI Act Article 12, SLSA provenance for agent-built software) where standard logging is not sufficient
Step 1: Install the hook configuration
Install the protect-mcp plugin with /plugin install protect-mcp. Its hooks
run evaluate.sh before each tool call and sign.sh after it. Both scripts
read the hook event from stdin, because Claude Code sets no TOOL_NAME or
TOOL_INPUT variables. See
references/hook-wiring.md for the hook
configuration and what each script passes to protect-mcp.
protect-mcp 0.7.4 does not create the signing key, and without a key the
receipts are unsigned. Create ./protect-mcp.key once. The command never
replaces an existing key:
if [ ! -e ./protect-mcp.key ]; then
d=$(mktemp -d) && npx protect-mcp@0.7.4 init --dir "$d" && mv "$d/keys/gateway.json" ./protect-mcp.key
fi
Give auditors the publicKey value from that file. Do not commit the file,
because it also holds the private key.
Add the private key and receipt directory to .gitignore:
echo "/protect-mcp.key" >> .gitignore
echo "/receipts/" >> .gitignore
Step 2: Write a Cedar policy
Create ./protect.cedar from the example in
references/cedar-policy.md. It allows read-only
tools and a short list of Bash commands, denies shell chaining and destructive
commands, and limits writes to the project with .. segments denied.
Step 3: Use Claude Code normally
Start Claude Code. Every tool call goes through both hooks:
You: Please read the README and summarize it.
Claude: I will read README.md.
[PreToolUse: Read ./README.md -> allow]
[Tool: Read executes]
[PostToolUse: receipt rcpt-a8f3c9d2 signed to ./receipts/]
... summary of README ...
A session of 20 tool calls appends 20 receipts to ./receipts/receipts.jsonl.
Step 4: Inspect a receipt
protect-mcp 0.7.4 appends each receipt as one line of
./receipts/receipts.jsonl. Print the newest one:
tail -n 1 ./receipts/receipts.jsonl | python3 -m json.tool
The receipt is a signed v2 envelope that names the tool, and it holds no
public key. See references/receipt-format.md
for a sample and the signed fields.
Step 5: Verify the receipts
Pass the publicKey value from ./protect-mcp.key to the verifier:
PUB=$(node -p 'JSON.parse(require("fs").readFileSync("./protect-mcp.key")).publicKey')
npx @veritasacta/verify@0.9.2 --replay-chain ./receipts/receipts.jsonl --key "$PUB"
Exit codes:
| Code | Meaning |
|---|---|
0 |
Every receipt verified |
1 |
A receipt failed verification (tampered, wrong key, or malformed line) |
2 |
The receipts file could not be read |
Step 6: Demonstrate tamper detection
Change the newest receipt's decision from allow to deny:
python3 -c "
import json
path = './receipts/receipts.jsonl'
lines = open(path).read().splitlines()
r = json.loads(lines[-1])
r['payload']['decision'] = 'deny'
lines[-1] = json.dumps(r)
open(path, 'w').write('\n'.join(lines) + '\n')
"
npx @veritasacta/verify@0.9.2 --replay-chain ./receipts/receipts.jsonl --key "$PUB"
The verifier exits with code 1 and reports which line failed. The
Ed25519 signature no longer matches the JCS-canonical bytes of the
…
الأسئلة الشائعة
ما هو سجل التدقيق الموقّع؟
هو سجل للإجراءات وُقّع تشفيرياً، مما يضمن أنه لم يتغير منذ إنشائه، ويستطيع أي شخص يملك المفتاح العام التحقق منه.
لماذا نستخدم Cedar؟
Cedar لغة سياسات تتيح لك تحديد قواعد أمنية تتحكم فيما يستطيع الوكيل فعله، لضمان بقائه ضمن حدود متوقعة.
كيف يتحقق شخص ما من الإجراءات؟
يستطيع أي شخص استخدام المفتاح العام المتاح للتحقق من التوقيعات الرقمية في السجلات. وإذا نجح التحقق، فهذا يعني أن السجل أصلي ولم يُعدَّل.
التفاصيل
الوصف الأصلي من المؤلف
Step-by-step cookbook for setting up cryptographically signed audit trails on Claude Code tool calls. Use when explaining, evaluating, or demonstrating the pattern before committing to the protect-mcp runtime hooks. Covers Cedar policy, Ed25519 receipts, offline verification, tamper detection, CI/CD integration, and SLSA composition.
repo: wshobson/agents
الشعبية
- نجوم GitHub
- 41k
- الترتيب
- #6787
- الترخيص
- MIT
- آخر تحديث
- 15/10/2026
التعليقات
- …
المزيد من المهارات من هذا المستودع
screen-reader-testing
41kيجعل وكيلك يختبر مواقع الويب باستخدام قارئات الشاشة للتأكد من أنها سهلة الوصول.
wcag-audit-patterns
41kيساعد وكيلك على تدقيق مواقع الويب من حيث إمكانية الوصول، وإصلاح المشكلات وفق إرشادات WCAG.
multi-reviewer-patterns
41kيمكّن وكيلك من تنسيق مراجعات الشيفرة المتوازية، مع إزالة التكرار في الملاحظات ودمج التقارير.
parallel-debugging
41kيتيح للوكيل تصحيح الأخطاء المعقدة عبر تحقيقات متوازية وتحليل السبب الجذري.
مهارات مشابهة
reverse-engineer-anything
422kيساعد وكيلك على فحص التطبيقات والحزم المنشورة من الداخل ليشرح الميزات ويقارن الإصدارات ويرشد إلى إعادة البناء، باستخدام أداة REA.
1password
394kيساعد وكيلك على إعداد واجهة سطر أوامر 1Password وتسجيل الدخول، وقراءة الأسرار أو حقنها دون طباعة قيمها في المحادثة.
healthcheck
394kيساعد وكيلك على تدقيق جهاز OpenClaw أو خادمه أمنيًا، مثل SSH والجدار الناري والتحديثات، ويقترح إصلاحات آمنة قابلة للتراجع.