agent-proofchain
v0.1.0
Published
Tamper-evident action journal for AI agents with hash-linked proofs.
Maintainers
Readme
agent-proofchain
Tamper-evident action journal for AI agents using hash-linked entries and signed run manifests.
Features
- Deterministic canonical JSON serialization
- SHA-256 hash-linked journal entries (
prevHash+ entry hash) - Strong runtime validation with built-in assertion guards
- Ed25519 manifest signing and verification
- Replay verification for full chain integrity and policy consistency
- Action adapters for tool calls and blockchain transactions
Install
npm install agent-proofchainQuickstart
import { createJournal, createEd25519KeyPair, signManifest, verifyManifestSignature } from "agent-proofchain";
import { createToolCallAction } from "agent-proofchain/adapters/tool-call";
const journal = createJournal({
policySnapshot: {
id: "policy-1",
version: "2026-02-28",
capturedAt: "2026-02-28T00:00:00.000Z",
rules: { allowTools: ["search"] }
}
});
journal.append(
createToolCallAction({
toolName: "search",
args: { q: "agent-proofchain" },
success: true
})
);
const verifyResult = journal.verify({ requireConsistentPolicyHash: true });
if (!verifyResult.ok) throw new Error(verifyResult.error);
const keys = createEd25519KeyPair();
const manifest = signManifest(
{
runId: "run-123",
agentId: "agent-alpha",
startedAt: "2026-02-28T12:00:00.000Z",
journalHash: journal.journalHash()!
},
keys.secretKey,
keys.publicKey
);
console.log("manifest valid:", verifyManifestSignature(manifest));Verification Example
import { createJournal, replayVerify } from "agent-proofchain";
const journal = createJournal();
// append entries...
const exported = journal.export();
const replay = replayVerify(exported.entries, {
requireConsistentPolicyHash: true
});
if (!replay.ok) {
console.error("tamper detected at index", replay.invalidIndex, replay.error);
}Blockchain Adapter Example
import { createJournal } from "agent-proofchain";
import { createBlockchainTxAction } from "agent-proofchain/adapters/blockchain-tx";
const journal = createJournal();
journal.append(
createBlockchainTxAction({
chainId: 1,
txHash: "0x123...",
from: "0xfrom",
to: "0xto",
value: "1000000000000000000",
status: "confirmed"
})
);Development
npm install
npm run build
npm run test
npm run lint
npm run typecheckLicense
MIT
