Skip to content

LeoYeAI/agent-master-skills / skills/agent-decision-receipts

agent-decision-receipts

Verified

Use when an autonomous agent takes a side-effecting action (deploy, delete, pay, grant access) that may need proving later, or for EU AI Act Art. 12 record-keeping. Builds a tamper-evident signed receipt with build_action_manifest.py and verifies it.

FileKindSize
SKILL.mdskill md7.5 KB
references/receipt-fields.mdmarkdown4.5 KB
scripts/build_action_manifest.pyscript4.1 KB

scripts/build_action_manifest.py

View on GitHub
#!/usr/bin/env python3
"""build_action_manifest.py -- build + validate an agent action manifest for receipt minting.

Standard library only (argparse, hashlib, json, sys). No crypto, no network, no pip deps.
The actual signing is done by the OpenAgentOntology receipt primitive (pip install
"openagentontology[pq]"); this helper just assembles a well-formed, ASCII-safe action manifest
and prints the exact mint command, so the manifest can never be malformed when it reaches the
signer.

Usage:
  python build_action_manifest.py --agent A --operation deploy --target prod/api \\
      --policy "EU AI Act Art 12" --inputs "service=api;version=1.4.2" --out action.json
"""
from __future__ import annotations

import argparse
import hashlib
import json
import sys

# Side-effecting / consequential verbs. An action carrying one of these is the kind this
# skill exists to receipt. Used only to advise (never to block) -- the caller decides.
HIGH_SIGNAL = {
    "deploy", "release", "delete", "drop", "purge", "pay", "wire", "transfer", "refund",
    "grant", "grant_access", "export", "egress", "send", "approve", "deny", "decide",
    "provision", "migrate", "reconfigure", "escalate",
}

REQUIRED = ("agent_id", "operation", "target", "policy")


def _hash(s: str) -> str:
    return "sha256:" + hashlib.sha256(s.encode("utf-8")).hexdigest()[:16]


def _ascii_safe(obj) -> bool:
    """Evidence must be ASCII so the receipt hash reproduces in any language."""
    try:
        json.dumps(obj, ensure_ascii=True).encode("ascii")
        return True
    except (UnicodeEncodeError, TypeError):
        return False


def build(agent_id, operation, target, policy, inputs, decision) -> dict:
    manifest = {
        "agent_id": agent_id,
        "operation": operation,
        "target": target,
        "policy": policy,
        "inputs_hash": _hash(inputs or ""),
        "decision_label": decision,
    }
    missing = [k for k in REQUIRED if not manifest.get(k)]
    if missing:
        raise ValueError(f"missing required field(s): {', '.join(missing)}")
    if not _ascii_safe(manifest):
        raise ValueError("manifest contains non-ASCII; the receipt hash must be reproducible")
    return manifest


def main(argv=None) -> int:
    p = argparse.ArgumentParser(description="Build a validated agent action manifest for receipt minting.")
    p.add_argument("--agent", required=True, help="acting agent id")
    p.add_argument("--operation", required=True, help="the verb: deploy / delete / pay / decide / ...")
    p.add_argument("--target", required=True, help="what the action acts on")
    p.add_argument("--policy", required=True, help="the governing rule, e.g. 'EU AI Act Art 12'")
    p.add_argument("--inputs", default="", help="inputs to hash (kept as a hash, not stored in clear)")
    p.add_argument("--decision", default="ACTION_GOVERNED", help="the receipt decision label")
    p.add_argument("--out", default="action.json", help="output manifest path")
    a = p.parse_args(argv)

    try:
        manifest = build(a.agent, a.operation, a.target, a.policy, a.inputs, a.decision)
    except ValueError as e:
        print(f"REJECTED: {e}", file=sys.stderr)
        return 2

    with open(a.out, "w", encoding="ascii") as f:
        json.dump(manifest, f, indent=2)

    op = a.operation.lower()
    advice = "HIGH-SIGNAL: receipt this by default." if op in HIGH_SIGNAL else \
        "low-signal: receipt only if it is consequential + later-provable."
    print(f"manifest -> {a.out}")
    print(f"  operation: {a.operation}  ({advice})")
    print(f"  policy:    {a.policy}")
    print(f"  inputs_hash: {manifest['inputs_hash']}")
    print()
    print("Mint the receipt (Ed25519 + post-quantum legs):")
    print(f'  python -c "import json,openagentontology.receipt as r; '
          f"print(json.dumps(r.mint_receipt(json.load(open('{a.out}')), decision='{a.decision}')))\" > receipt.json")
    print("Verify it from the cert alone:")
    print('  python -c "import json,openagentontology.receipt as r; '
          "print(r.verify_receipt(json.load(open('receipt.json'))))\"")
    return 0


if __name__ == "__main__":
    raise SystemExit(main())
writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deploymentStars: 322kUpdated Claude CodeCodexVerifiedInstall
xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release.Stars: 118kUpdated Claude CodeCodexVerifiedInstall