Repository files navigation

@aip-protocol/aip

Status: v1.1.0 (wire-breaking alignment with the AIP whitepaper). The whitepaper is canonical. Anything tagged NORMATIVE in docs/aip-v1.0-spec.md is locked; the spec is the authority of record. See KNOWN-LIMITS.md for the documented v1.1.0 scope boundaries (Groth16 as a permitted proving-system variant, single-party ceremony PENDING, no production Halo2 tooling yet, aip-attest-v1 is a real Poseidon-Merkle-in-circuit).

The Agent Interoperability Protocol (AIP) is an open-source, embeddable set of primitives for cognitive workflows between software agents: W3C-style did:aip:<AGENT_TYPE>:<base32> identifiers, Ed25519 signing, a hash-chained signed audit log, a §4 MessageEnvelope contract, a §6 handshake (capability intersection), the §13 OPAL cycle (ORIENT → PLAN → EXECUTE → LEARN), and a §5.3 use-once ZK attestation (Halo2 / BN254 normative, Groth16 as a permitted variant).

The AIP module is brand-neutral at the contract level: it refuses to construct a DID, sign an envelope, or write an audit entry until the host application supplies a DIDProvider at startup. The brand-neutrality of the implementation is what makes the open-source protocol credible - any host, any deployment, any founder can use these primitives without leaking their identity.


What's new in v1.1.0

v1.1.0 is a wire-breaking release that aligns the code to the canonical AIP whitepaper. The v1.0.1 → v1.1.0 migration is summarized below; for the full list see CHANGELOG.md.

  • Envelope wire format: messageIdenvelopeId, sender.didfrom, recipient.didto, timestampissuedAt. New required fields: expiresAt (default: issuedAt + 5 min) and previousHash (SHA-256 chain anchor; null on the first envelope of a session).
  • Audit entry wire format: auditIdentryId, actorDIDactorAgentType, timestampissuedAt, previousEntryHashpreviousHash. New required field: aipVersion: "1.1.0".
  • DID method: did:aip:<AGENT_TYPE>:<base32> (was the v1.0.1 did:aip:<namespace>:<uuid-prefix>). The AIP_NAMESPACE env var is gone.
  • DID document: W3C verificationMethod (was v1.0.1 publicKey). The dropped v1.0.1 fields (version, owner, controller, delegationScope.allowedDelegators, auditEndpoint) are not in the whitepaper and are not in v1.1.0.
  • Handshake state machine: INIT → OFFER_SENT → REPLY_SENT → ESTABLISHED → CLOSED (with OFFER_REJECTED branch). v1.0.1 collapsed REPLY_SENT into ESTABLISHED/REJECTED and did not have a CLOSED state. Body field renames: requestedCapabilitiesrequestedCaps, matchedCapabilitiesmatchedCaps, missingCapabilitiesunsupportedCapabilities, sessionPurposepurpose, principalProofprincipalAttestation, agentDIDagentDid. Default rejection reason is AIP_ERR_021 CAPABILITY_VECTOR_MISMATCH (was CAPABILITY_NOT_MET).
  • Trust levels: numeric 0..3 per spec §12.2 (SELF_DECLARED=0, HANDSHAKE_SIGNED=1, ZKP_ATTESTED=2, MULTI_ISSUER=3). v1.0.1's string enum is kept as TRUST_LEVEL_NAMES for one release.
  • Workflow state machine: dropped v1.0.1's AWAITING_APPROVAL / VETOED (not in the spec). New canonical enum: PENDING → RUNNING → COMPLETE | FAILED | CANCELLED.
  • Error codes: expanded from 26 to 50 per spec §16, with corrected names (e.g. AIP_ERR_001 HANDSHAKE_OFFER_EXPIRED).
  • Defaults: MAX_DELEGATION_DEPTH 2 → 5; SESSION_TTL 3600s → 86400s; key-rotation grace 24h → 30d.
  • Capability vectors: canonical <domain>.<verb>[.<modifier>] form per spec §12.1 (e.g. build.code, review.code, deploy.activate). v1.0.1's mixed forms (synthesize.code, analyze.code, delegate.activate) are gone.
  • Env vars: removed AIP_NAMESPACE and AIP_CALLBACK_ENDPOINT from the AIP module. The module is fully brand-neutral; the host supplies these values via explicit parameters or the DIDProvider seam.

Upgrade path. v1.1.0 is not wire-compatible with v1.0.1. Host applications need to update their envelope/audit consumers to the v1.1.0 field names and to register a DIDProvider for the getOrCreateAgentDID calls. v1.0.1 audit logs can still be verified by verifyChain (it tolerates the legacy field names); v1.0.1 envelopes cannot be re-verified as v1.1.0.


Install

The package is not yet published to the public npm registry. Install directly from the source repository:

npm install github:githubscum/aip-protocol#v1.1.0

Or pin to a specific commit:

npm install github:githubscum/aip-protocol#<commit-sha>

Once the package is published to npm, replace with:

npm install @aip-protocol/aip

Quick start

import{setDIDProvider,getDIDProvider,createMessageEnvelope,verifyMessageEnvelope,writeAuditEntry,getOrCreateAgentDID,AIP_VERSION,}from'@aip-protocol/aip';// 1. Wire identity. The host application decides where keys live.setDIDProvider({getDID: (agentType)=>getOrCreateAgentDID(agentType),sign: (agentType,bytes)=>/* your local key */,verify: (agentType,sig,bytes)=>/* verify */,getPrincipal: ()=>({id: '...',commitment: '...'}),});// 2. Build a signed envelope.constenv=createMessageEnvelope({fromAgentType: 'BUILDER',toDid: 'did:aip:REVIEWER:abc...',sessionId: 'sess-001',messageType: 'TASK',body: {/* task body */},});// env now has: envelopeId, aipVersion='1.1.0', from, to, sessionId,// issuedAt, expiresAt (issuedAt+5min), body, signature,// previousHash (null on the first envelope of a session)// 3. Audit it.writeAuditEntry({sessionId: 'sess-001',eventType: 'TASK_SUBMITTED',actorAgentType: 'BUILDER',summary: 'sent TASK to reviewer-7',payload: {envelopeId: env.envelopeId},});

DIDProvider

The AIP module never reads host-prefixed environment variables or hardcodes a default controller. Identity comes from the host application via setDIDProvider({...}). The required shape:

typeDIDProvider={getDID(agentType: string): AgentDIDRecord;sign(agentType: string,payload: Buffer|Uint8Array|string): string;verify(agentType: string,sig: string,payload: Buffer|Uint8Array|string): boolean;getPrincipal?(): {id: string;commitment: string};};

getPrincipal() is optional. The handshake (§6) uses it to build the principalAttestation's public inputs; providers that don't need ZK attestation can omit it and the handshake falls back to the LIGHTWEIGHT_HANDSHAKE interop mode (§6.5).

DataStore (forward direction)

A DataStore seam is defined but optional. AIP modules currently write to package-internal JSONL/JSON paths. A future version will route all reads/writes through getDataStore().

Circuits

The aip-attest-v1 circuit (spec §5.3) ships as a real Poseidon- Merkle-in-circuit with 3 public inputs (commitmentRoot, nullifier, epoch) and 2 private inputs (principalId, nonce). Both hashes are constrained in-circuit - the verifier needs only the Groth16 proof check, not an external Poseidon re-computation. The trusted-setup transcript is at circuits/aip-attest-v1.pots-transcript.txt.

Hosts that want to pin their own build can override the artifacts directory:

import{setCircuitsDir}from'@aip-protocol/aip';setCircuitsDir('/path/to/host/circuits');// or via env: AIP_CIRCUITS_DIR=/path/to/host/circuits

If you override, you MUST also update EXPECTED_VKEY_SHA256 in src/attestation.js to the SHA-256 of your aip-attest-v1.verification_key.json. The fingerprint is checked lazily on the first attest() call; a mismatch throws a descriptive error instead of running a circuit you did not expect.

The package ships build outputs only (.wasm, .zkey, verification_key.json, .circom source, pots-transcript.txt). A rebuild-circuit script is included for hosts that want to re-run the trusted setup; see package.json.

Test

npm test# node:test - 24 cases (8 envelope + 5 audit + 5 handshake + 6 attestation)
npm run smoke # brand-neutrality + barrel-export + smoke

License

Apache License 2.0 - see LICENSE.

Spec

Spec sections: §3 conventions, §4 message envelope, §5 identity & attestation, §6 handshake & session lifecycle, §7 task envelopes, §8 result envelopes, §9 error envelopes, §10 audit log, §11 routing, §12 trust levels & capability vectors, §13 workflow & OPAL, §14 key management, §15 conformance, §16 error code registry, §17 change log.

Citation

If you use AIP in a paper, product, or downstream project, please cite the v1.1.0 release. Each GitHub release gets a Zenodo DOI; the v1.1.0 DOI is below.

@software{aip_v1_1_0,
author = {Liem, Isaac},
orcid = {0009-0006-2476-1615},
title = {{AIP v1.1.0: Privacy-first audit protocol for autonomous agents}},
version = {1.1.0},
month = jul,
year = 2026,
publisher = {Zenodo},
doi = {10.5281/zenodo.21267380},
url = {https://zenodo.org/records/21267380},
note = {Reference implementation of the Agent Interoperability Protocol. Wire-level primitives: did:aip identifiers, Ed25519 signing, hash-chained signed audit log, capability-based handshake, use-once ZK attestation.}
}

DOI badge:

DOI

About

Agent Interoperability Protocol — brand-neutral cognitive workflow primitives (DID, Ed25519, ZK, audit chain, OPAL)

Resources

Contributing

Security policy

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

Repository files navigation

@aip-protocol/aip

Status: v1.1.0 (wire-breaking alignment with the AIP whitepaper). The whitepaper is canonical. Anything tagged NORMATIVE in docs/aip-v1.0-spec.md is locked; the spec is the authority of record. See KNOWN-LIMITS.md for the documented v1.1.0 scope boundaries (Groth16 as a permitted proving-system variant, single-party ceremony PENDING, no production Halo2 tooling yet, aip-attest-v1 is a real Poseidon-Merkle-in-circuit).

The Agent Interoperability Protocol (AIP) is an open-source, embeddable set of primitives for cognitive workflows between software agents: W3C-style did:aip:<AGENT_TYPE>:<base32> identifiers, Ed25519 signing, a hash-chained signed audit log, a §4 MessageEnvelope contract, a §6 handshake (capability intersection), the §13 OPAL cycle (ORIENT → PLAN → EXECUTE → LEARN), and a §5.3 use-once ZK attestation (Halo2 / BN254 normative, Groth16 as a permitted variant).

The AIP module is brand-neutral at the contract level: it refuses to construct a DID, sign an envelope, or write an audit entry until the host application supplies a DIDProvider at startup. The brand-neutrality of the implementation is what makes the open-source protocol credible - any host, any deployment, any founder can use these primitives without leaking their identity.


What's new in v1.1.0

v1.1.0 is a wire-breaking release that aligns the code to the canonical AIP whitepaper. The v1.0.1 → v1.1.0 migration is summarized below; for the full list see CHANGELOG.md.

  • Envelope wire format: messageIdenvelopeId, sender.didfrom, recipient.didto, timestampissuedAt. New required fields: expiresAt (default: issuedAt + 5 min) and previousHash (SHA-256 chain anchor; null on the first envelope of a session).
  • Audit entry wire format: auditIdentryId, actorDIDactorAgentType, timestampissuedAt, previousEntryHashpreviousHash. New required field: aipVersion: "1.1.0".
  • DID method: did:aip:<AGENT_TYPE>:<base32> (was the v1.0.1 did:aip:<namespace>:<uuid-prefix>). The AIP_NAMESPACE env var is gone.
  • DID document: W3C verificationMethod (was v1.0.1 publicKey). The dropped v1.0.1 fields (version, owner, controller, delegationScope.allowedDelegators, auditEndpoint) are not in the whitepaper and are not in v1.1.0.
  • Handshake state machine: INIT → OFFER_SENT → REPLY_SENT → ESTABLISHED → CLOSED (with OFFER_REJECTED branch). v1.0.1 collapsed REPLY_SENT into ESTABLISHED/REJECTED and did not have a CLOSED state. Body field renames: requestedCapabilitiesrequestedCaps, matchedCapabilitiesmatchedCaps, missingCapabilitiesunsupportedCapabilities, sessionPurposepurpose, principalProofprincipalAttestation, agentDIDagentDid. Default rejection reason is AIP_ERR_021 CAPABILITY_VECTOR_MISMATCH (was CAPABILITY_NOT_MET).
  • Trust levels: numeric 0..3 per spec §12.2 (SELF_DECLARED=0, HANDSHAKE_SIGNED=1, ZKP_ATTESTED=2, MULTI_ISSUER=3). v1.0.1's string enum is kept as TRUST_LEVEL_NAMES for one release.
  • Workflow state machine: dropped v1.0.1's AWAITING_APPROVAL / VETOED (not in the spec). New canonical enum: PENDING → RUNNING → COMPLETE | FAILED | CANCELLED.
  • Error codes: expanded from 26 to 50 per spec §16, with corrected names (e.g. AIP_ERR_001 HANDSHAKE_OFFER_EXPIRED).
  • Defaults: MAX_DELEGATION_DEPTH 2 → 5; SESSION_TTL 3600s → 86400s; key-rotation grace 24h → 30d.
  • Capability vectors: canonical <domain>.<verb>[.<modifier>] form per spec §12.1 (e.g. build.code, review.code, deploy.activate). v1.0.1's mixed forms (synthesize.code, analyze.code, delegate.activate) are gone.
  • Env vars: removed AIP_NAMESPACE and AIP_CALLBACK_ENDPOINT from the AIP module. The module is fully brand-neutral; the host supplies these values via explicit parameters or the DIDProvider seam.

Upgrade path. v1.1.0 is not wire-compatible with v1.0.1. Host applications need to update their envelope/audit consumers to the v1.1.0 field names and to register a DIDProvider for the getOrCreateAgentDID calls. v1.0.1 audit logs can still be verified by verifyChain (it tolerates the legacy field names); v1.0.1 envelopes cannot be re-verified as v1.1.0.


Install

The package is not yet published to the public npm registry. Install directly from the source repository:

npm install github:githubscum/aip-protocol#v1.1.0

Or pin to a specific commit:

npm install github:githubscum/aip-protocol#<commit-sha>

Once the package is published to npm, replace with:

npm install @aip-protocol/aip

Quick start

import{setDIDProvider,getDIDProvider,createMessageEnvelope,verifyMessageEnvelope,writeAuditEntry,getOrCreateAgentDID,AIP_VERSION,}from'@aip-protocol/aip';// 1. Wire identity. The host application decides where keys live.setDIDProvider({getDID: (agentType)=>getOrCreateAgentDID(agentType),sign: (agentType,bytes)=>/* your local key */,verify: (agentType,sig,bytes)=>/* verify */,getPrincipal: ()=>({id: '...',commitment: '...'}),});// 2. Build a signed envelope.constenv=createMessageEnvelope({fromAgentType: 'BUILDER',toDid: 'did:aip:REVIEWER:abc...',sessionId: 'sess-001',messageType: 'TASK',body: {/* task body */},});// env now has: envelopeId, aipVersion='1.1.0', from, to, sessionId,// issuedAt, expiresAt (issuedAt+5min), body, signature,// previousHash (null on the first envelope of a session)// 3. Audit it.writeAuditEntry({sessionId: 'sess-001',eventType: 'TASK_SUBMITTED',actorAgentType: 'BUILDER',summary: 'sent TASK to reviewer-7',payload: {envelopeId: env.envelopeId},});

DIDProvider

The AIP module never reads host-prefixed environment variables or hardcodes a default controller. Identity comes from the host application via setDIDProvider({...}). The required shape:

typeDIDProvider={getDID(agentType: string): AgentDIDRecord;sign(agentType: string,payload: Buffer|Uint8Array|string): string;verify(agentType: string,sig: string,payload: Buffer|Uint8Array|string): boolean;getPrincipal?(): {id: string;commitment: string};};

getPrincipal() is optional. The handshake (§6) uses it to build the principalAttestation's public inputs; providers that don't need ZK attestation can omit it and the handshake falls back to the LIGHTWEIGHT_HANDSHAKE interop mode (§6.5).

DataStore (forward direction)

A DataStore seam is defined but optional. AIP modules currently write to package-internal JSONL/JSON paths. A future version will route all reads/writes through getDataStore().

Circuits

The aip-attest-v1 circuit (spec §5.3) ships as a real Poseidon- Merkle-in-circuit with 3 public inputs (commitmentRoot, nullifier, epoch) and 2 private inputs (principalId, nonce). Both hashes are constrained in-circuit - the verifier needs only the Groth16 proof check, not an external Poseidon re-computation. The trusted-setup transcript is at circuits/aip-attest-v1.pots-transcript.txt.

Hosts that want to pin their own build can override the artifacts directory:

import{setCircuitsDir}from'@aip-protocol/aip';setCircuitsDir('/path/to/host/circuits');// or via env: AIP_CIRCUITS_DIR=/path/to/host/circuits

If you override, you MUST also update EXPECTED_VKEY_SHA256 in src/attestation.js to the SHA-256 of your aip-attest-v1.verification_key.json. The fingerprint is checked lazily on the first attest() call; a mismatch throws a descriptive error instead of running a circuit you did not expect.

The package ships build outputs only (.wasm, .zkey, verification_key.json, .circom source, pots-transcript.txt). A rebuild-circuit script is included for hosts that want to re-run the trusted setup; see package.json.

Test

npm test# node:test - 24 cases (8 envelope + 5 audit + 5 handshake + 6 attestation)
npm run smoke # brand-neutrality + barrel-export + smoke

License

Apache License 2.0 - see LICENSE.

Spec

Spec sections: §3 conventions, §4 message envelope, §5 identity & attestation, §6 handshake & session lifecycle, §7 task envelopes, §8 result envelopes, §9 error envelopes, §10 audit log, §11 routing, §12 trust levels & capability vectors, §13 workflow & OPAL, §14 key management, §15 conformance, §16 error code registry, §17 change log.

Citation

If you use AIP in a paper, product, or downstream project, please cite the v1.1.0 release. Each GitHub release gets a Zenodo DOI; the v1.1.0 DOI is below.

@software{aip_v1_1_0,
author = {Liem, Isaac},
orcid = {0009-0006-2476-1615},
title = {{AIP v1.1.0: Privacy-first audit protocol for autonomous agents}},
version = {1.1.0},
month = jul,
year = 2026,
publisher = {Zenodo},
doi = {10.5281/zenodo.21267380},
url = {https://zenodo.org/records/21267380},
note = {Reference implementation of the Agent Interoperability Protocol. Wire-level primitives: did:aip identifiers, Ed25519 signing, hash-chained signed audit log, capability-based handshake, use-once ZK attestation.}
}

DOI badge:

DOI

About

Agent Interoperability Protocol — brand-neutral cognitive workflow primitives (DID, Ed25519, ZK, audit chain, OPAL)

Resources

Contributing

Security policy

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Repository files navigation

@aip-protocol/aip

Status: v1.1.0 (wire-breaking alignment with the AIP whitepaper). The whitepaper is canonical. Anything tagged NORMATIVE in docs/aip-v1.0-spec.md is locked; the spec is the authority of record. See KNOWN-LIMITS.md for the documented v1.1.0 scope boundaries (Groth16 as a permitted proving-system variant, single-party ceremony PENDING, no production Halo2 tooling yet, aip-attest-v1 is a real Poseidon-Merkle-in-circuit).

The Agent Interoperability Protocol (AIP) is an open-source, embeddable set of primitives for cognitive workflows between software agents: W3C-style did:aip:<AGENT_TYPE>:<base32> identifiers, Ed25519 signing, a hash-chained signed audit log, a §4 MessageEnvelope contract, a §6 handshake (capability intersection), the §13 OPAL cycle (ORIENT → PLAN → EXECUTE → LEARN), and a §5.3 use-once ZK attestation (Halo2 / BN254 normative, Groth16 as a permitted variant).

The AIP module is brand-neutral at the contract level: it refuses to construct a DID, sign an envelope, or write an audit entry until the host application supplies a DIDProvider at startup. The brand-neutrality of the implementation is what makes the open-source protocol credible - any host, any deployment, any founder can use these primitives without leaking their identity.


What's new in v1.1.0

v1.1.0 is a wire-breaking release that aligns the code to the canonical AIP whitepaper. The v1.0.1 → v1.1.0 migration is summarized below; for the full list see CHANGELOG.md.

  • Envelope wire format: messageIdenvelopeId, sender.didfrom, recipient.didto, timestampissuedAt. New required fields: expiresAt (default: issuedAt + 5 min) and previousHash (SHA-256 chain anchor; null on the first envelope of a session).
  • Audit entry wire format: auditIdentryId, actorDIDactorAgentType, timestampissuedAt, previousEntryHashpreviousHash. New required field: aipVersion: "1.1.0".
  • DID method: did:aip:<AGENT_TYPE>:<base32> (was the v1.0.1 did:aip:<namespace>:<uuid-prefix>). The AIP_NAMESPACE env var is gone.
  • DID document: W3C verificationMethod (was v1.0.1 publicKey). The dropped v1.0.1 fields (version, owner, controller, delegationScope.allowedDelegators, auditEndpoint) are not in the whitepaper and are not in v1.1.0.
  • Handshake state machine: INIT → OFFER_SENT → REPLY_SENT → ESTABLISHED → CLOSED (with OFFER_REJECTED branch). v1.0.1 collapsed REPLY_SENT into ESTABLISHED/REJECTED and did not have a CLOSED state. Body field renames: requestedCapabilitiesrequestedCaps, matchedCapabilitiesmatchedCaps, missingCapabilitiesunsupportedCapabilities, sessionPurposepurpose, principalProofprincipalAttestation, agentDIDagentDid. Default rejection reason is AIP_ERR_021 CAPABILITY_VECTOR_MISMATCH (was CAPABILITY_NOT_MET).
  • Trust levels: numeric 0..3 per spec §12.2 (SELF_DECLARED=0, HANDSHAKE_SIGNED=1, ZKP_ATTESTED=2, MULTI_ISSUER=3). v1.0.1's string enum is kept as TRUST_LEVEL_NAMES for one release.
  • Workflow state machine: dropped v1.0.1's AWAITING_APPROVAL / VETOED (not in the spec). New canonical enum: PENDING → RUNNING → COMPLETE | FAILED | CANCELLED.
  • Error codes: expanded from 26 to 50 per spec §16, with corrected names (e.g. AIP_ERR_001 HANDSHAKE_OFFER_EXPIRED).
  • Defaults: MAX_DELEGATION_DEPTH 2 → 5; SESSION_TTL 3600s → 86400s; key-rotation grace 24h → 30d.
  • Capability vectors: canonical <domain>.<verb>[.<modifier>] form per spec §12.1 (e.g. build.code, review.code, deploy.activate). v1.0.1's mixed forms (synthesize.code, analyze.code, delegate.activate) are gone.
  • Env vars: removed AIP_NAMESPACE and AIP_CALLBACK_ENDPOINT from the AIP module. The module is fully brand-neutral; the host supplies these values via explicit parameters or the DIDProvider seam.

Upgrade path. v1.1.0 is not wire-compatible with v1.0.1. Host applications need to update their envelope/audit consumers to the v1.1.0 field names and to register a DIDProvider for the getOrCreateAgentDID calls. v1.0.1 audit logs can still be verified by verifyChain (it tolerates the legacy field names); v1.0.1 envelopes cannot be re-verified as v1.1.0.


Install

The package is not yet published to the public npm registry. Install directly from the source repository:

npm install github:githubscum/aip-protocol#v1.1.0

Or pin to a specific commit:

npm install github:githubscum/aip-protocol#<commit-sha>

Once the package is published to npm, replace with:

npm install @aip-protocol/aip

Quick start

import{setDIDProvider,getDIDProvider,createMessageEnvelope,verifyMessageEnvelope,writeAuditEntry,getOrCreateAgentDID,AIP_VERSION,}from'@aip-protocol/aip';// 1. Wire identity. The host application decides where keys live.setDIDProvider({getDID: (agentType)=>getOrCreateAgentDID(agentType),sign: (agentType,bytes)=>/* your local key */,verify: (agentType,sig,bytes)=>/* verify */,getPrincipal: ()=>({id: '...',commitment: '...'}),});// 2. Build a signed envelope.constenv=createMessageEnvelope({fromAgentType: 'BUILDER',toDid: 'did:aip:REVIEWER:abc...',sessionId: 'sess-001',messageType: 'TASK',body: {/* task body */},});// env now has: envelopeId, aipVersion='1.1.0', from, to, sessionId,// issuedAt, expiresAt (issuedAt+5min), body, signature,// previousHash (null on the first envelope of a session)// 3. Audit it.writeAuditEntry({sessionId: 'sess-001',eventType: 'TASK_SUBMITTED',actorAgentType: 'BUILDER',summary: 'sent TASK to reviewer-7',payload: {envelopeId: env.envelopeId},});

DIDProvider

The AIP module never reads host-prefixed environment variables or hardcodes a default controller. Identity comes from the host application via setDIDProvider({...}). The required shape:

typeDIDProvider={getDID(agentType: string): AgentDIDRecord;sign(agentType: string,payload: Buffer|Uint8Array|string): string;verify(agentType: string,sig: string,payload: Buffer|Uint8Array|string): boolean;getPrincipal?(): {id: string;commitment: string};};

getPrincipal() is optional. The handshake (§6) uses it to build the principalAttestation's public inputs; providers that don't need ZK attestation can omit it and the handshake falls back to the LIGHTWEIGHT_HANDSHAKE interop mode (§6.5).

DataStore (forward direction)

A DataStore seam is defined but optional. AIP modules currently write to package-internal JSONL/JSON paths. A future version will route all reads/writes through getDataStore().

Circuits

The aip-attest-v1 circuit (spec §5.3) ships as a real Poseidon- Merkle-in-circuit with 3 public inputs (commitmentRoot, nullifier, epoch) and 2 private inputs (principalId, nonce). Both hashes are constrained in-circuit - the verifier needs only the Groth16 proof check, not an external Poseidon re-computation. The trusted-setup transcript is at circuits/aip-attest-v1.pots-transcript.txt.

Hosts that want to pin their own build can override the artifacts directory:

import{setCircuitsDir}from'@aip-protocol/aip';setCircuitsDir('/path/to/host/circuits');// or via env: AIP_CIRCUITS_DIR=/path/to/host/circuits

If you override, you MUST also update EXPECTED_VKEY_SHA256 in src/attestation.js to the SHA-256 of your aip-attest-v1.verification_key.json. The fingerprint is checked lazily on the first attest() call; a mismatch throws a descriptive error instead of running a circuit you did not expect.

The package ships build outputs only (.wasm, .zkey, verification_key.json, .circom source, pots-transcript.txt). A rebuild-circuit script is included for hosts that want to re-run the trusted setup; see package.json.

Test

npm test# node:test - 24 cases (8 envelope + 5 audit + 5 handshake + 6 attestation)
npm run smoke # brand-neutrality + barrel-export + smoke

License

Apache License 2.0 - see LICENSE.

Spec

Spec sections: §3 conventions, §4 message envelope, §5 identity & attestation, §6 handshake & session lifecycle, §7 task envelopes, §8 result envelopes, §9 error envelopes, §10 audit log, §11 routing, §12 trust levels & capability vectors, §13 workflow & OPAL, §14 key management, §15 conformance, §16 error code registry, §17 change log.

Citation

If you use AIP in a paper, product, or downstream project, please cite the v1.1.0 release. Each GitHub release gets a Zenodo DOI; the v1.1.0 DOI is below.

@software{aip_v1_1_0,
author = {Liem, Isaac},
orcid = {0009-0006-2476-1615},
title = {{AIP v1.1.0: Privacy-first audit protocol for autonomous agents}},
version = {1.1.0},
month = jul,
year = 2026,
publisher = {Zenodo},
doi = {10.5281/zenodo.21267380},
url = {https://zenodo.org/records/21267380},
note = {Reference implementation of the Agent Interoperability Protocol. Wire-level primitives: did:aip identifiers, Ed25519 signing, hash-chained signed audit log, capability-based handshake, use-once ZK attestation.}
}

DOI badge:

DOI

About

Agent Interoperability Protocol — brand-neutral cognitive workflow primitives (DID, Ed25519, ZK, audit chain, OPAL)

Resources

Contributing

Security policy

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Repository files navigation

@aip-protocol/aip

Status: v1.1.0 (wire-breaking alignment with the AIP whitepaper). The whitepaper is canonical. Anything tagged NORMATIVE in docs/aip-v1.0-spec.md is locked; the spec is the authority of record. See KNOWN-LIMITS.md for the documented v1.1.0 scope boundaries (Groth16 as a permitted proving-system variant, single-party ceremony PENDING, no production Halo2 tooling yet, aip-attest-v1 is a real Poseidon-Merkle-in-circuit).

The Agent Interoperability Protocol (AIP) is an open-source, embeddable set of primitives for cognitive workflows between software agents: W3C-style did:aip:<AGENT_TYPE>:<base32> identifiers, Ed25519 signing, a hash-chained signed audit log, a §4 MessageEnvelope contract, a §6 handshake (capability intersection), the §13 OPAL cycle (ORIENT → PLAN → EXECUTE → LEARN), and a §5.3 use-once ZK attestation (Halo2 / BN254 normative, Groth16 as a permitted variant).

The AIP module is brand-neutral at the contract level: it refuses to construct a DID, sign an envelope, or write an audit entry until the host application supplies a DIDProvider at startup. The brand-neutrality of the implementation is what makes the open-source protocol credible - any host, any deployment, any founder can use these primitives without leaking their identity.


What's new in v1.1.0

v1.1.0 is a wire-breaking release that aligns the code to the canonical AIP whitepaper. The v1.0.1 → v1.1.0 migration is summarized below; for the full list see CHANGELOG.md.

  • Envelope wire format: messageIdenvelopeId, sender.didfrom, recipient.didto, timestampissuedAt. New required fields: expiresAt (default: issuedAt + 5 min) and previousHash (SHA-256 chain anchor; null on the first envelope of a session).
  • Audit entry wire format: auditIdentryId, actorDIDactorAgentType, timestampissuedAt, previousEntryHashpreviousHash. New required field: aipVersion: "1.1.0".
  • DID method: did:aip:<AGENT_TYPE>:<base32> (was the v1.0.1 did:aip:<namespace>:<uuid-prefix>). The AIP_NAMESPACE env var is gone.
  • DID document: W3C verificationMethod (was v1.0.1 publicKey). The dropped v1.0.1 fields (version, owner, controller, delegationScope.allowedDelegators, auditEndpoint) are not in the whitepaper and are not in v1.1.0.
  • Handshake state machine: INIT → OFFER_SENT → REPLY_SENT → ESTABLISHED → CLOSED (with OFFER_REJECTED branch). v1.0.1 collapsed REPLY_SENT into ESTABLISHED/REJECTED and did not have a CLOSED state. Body field renames: requestedCapabilitiesrequestedCaps, matchedCapabilitiesmatchedCaps, missingCapabilitiesunsupportedCapabilities, sessionPurposepurpose, principalProofprincipalAttestation, agentDIDagentDid. Default rejection reason is AIP_ERR_021 CAPABILITY_VECTOR_MISMATCH (was CAPABILITY_NOT_MET).
  • Trust levels: numeric 0..3 per spec §12.2 (SELF_DECLARED=0, HANDSHAKE_SIGNED=1, ZKP_ATTESTED=2, MULTI_ISSUER=3). v1.0.1's string enum is kept as TRUST_LEVEL_NAMES for one release.
  • Workflow state machine: dropped v1.0.1's AWAITING_APPROVAL / VETOED (not in the spec). New canonical enum: PENDING → RUNNING → COMPLETE | FAILED | CANCELLED.
  • Error codes: expanded from 26 to 50 per spec §16, with corrected names (e.g. AIP_ERR_001 HANDSHAKE_OFFER_EXPIRED).
  • Defaults: MAX_DELEGATION_DEPTH 2 → 5; SESSION_TTL 3600s → 86400s; key-rotation grace 24h → 30d.
  • Capability vectors: canonical <domain>.<verb>[.<modifier>] form per spec §12.1 (e.g. build.code, review.code, deploy.activate). v1.0.1's mixed forms (synthesize.code, analyze.code, delegate.activate) are gone.
  • Env vars: removed AIP_NAMESPACE and AIP_CALLBACK_ENDPOINT from the AIP module. The module is fully brand-neutral; the host supplies these values via explicit parameters or the DIDProvider seam.

Upgrade path. v1.1.0 is not wire-compatible with v1.0.1. Host applications need to update their envelope/audit consumers to the v1.1.0 field names and to register a DIDProvider for the getOrCreateAgentDID calls. v1.0.1 audit logs can still be verified by verifyChain (it tolerates the legacy field names); v1.0.1 envelopes cannot be re-verified as v1.1.0.


Install

The package is not yet published to the public npm registry. Install directly from the source repository:

npm install github:githubscum/aip-protocol#v1.1.0

Or pin to a specific commit:

npm install github:githubscum/aip-protocol#<commit-sha>

Once the package is published to npm, replace with:

npm install @aip-protocol/aip

Quick start

import{setDIDProvider,getDIDProvider,createMessageEnvelope,verifyMessageEnvelope,writeAuditEntry,getOrCreateAgentDID,AIP_VERSION,}from'@aip-protocol/aip';// 1. Wire identity. The host application decides where keys live.setDIDProvider({getDID: (agentType)=>getOrCreateAgentDID(agentType),sign: (agentType,bytes)=>/* your local key */,verify: (agentType,sig,bytes)=>/* verify */,getPrincipal: ()=>({id: '...',commitment: '...'}),});// 2. Build a signed envelope.constenv=createMessageEnvelope({fromAgentType: 'BUILDER',toDid: 'did:aip:REVIEWER:abc...',sessionId: 'sess-001',messageType: 'TASK',body: {/* task body */},});// env now has: envelopeId, aipVersion='1.1.0', from, to, sessionId,// issuedAt, expiresAt (issuedAt+5min), body, signature,// previousHash (null on the first envelope of a session)// 3. Audit it.writeAuditEntry({sessionId: 'sess-001',eventType: 'TASK_SUBMITTED',actorAgentType: 'BUILDER',summary: 'sent TASK to reviewer-7',payload: {envelopeId: env.envelopeId},});

DIDProvider

The AIP module never reads host-prefixed environment variables or hardcodes a default controller. Identity comes from the host application via setDIDProvider({...}). The required shape:

typeDIDProvider={getDID(agentType: string): AgentDIDRecord;sign(agentType: string,payload: Buffer|Uint8Array|string): string;verify(agentType: string,sig: string,payload: Buffer|Uint8Array|string): boolean;getPrincipal?(): {id: string;commitment: string};};

getPrincipal() is optional. The handshake (§6) uses it to build the principalAttestation's public inputs; providers that don't need ZK attestation can omit it and the handshake falls back to the LIGHTWEIGHT_HANDSHAKE interop mode (§6.5).

DataStore (forward direction)

A DataStore seam is defined but optional. AIP modules currently write to package-internal JSONL/JSON paths. A future version will route all reads/writes through getDataStore().

Circuits

The aip-attest-v1 circuit (spec §5.3) ships as a real Poseidon- Merkle-in-circuit with 3 public inputs (commitmentRoot, nullifier, epoch) and 2 private inputs (principalId, nonce). Both hashes are constrained in-circuit - the verifier needs only the Groth16 proof check, not an external Poseidon re-computation. The trusted-setup transcript is at circuits/aip-attest-v1.pots-transcript.txt.

Hosts that want to pin their own build can override the artifacts directory:

import{setCircuitsDir}from'@aip-protocol/aip';setCircuitsDir('/path/to/host/circuits');// or via env: AIP_CIRCUITS_DIR=/path/to/host/circuits

If you override, you MUST also update EXPECTED_VKEY_SHA256 in src/attestation.js to the SHA-256 of your aip-attest-v1.verification_key.json. The fingerprint is checked lazily on the first attest() call; a mismatch throws a descriptive error instead of running a circuit you did not expect.

The package ships build outputs only (.wasm, .zkey, verification_key.json, .circom source, pots-transcript.txt). A rebuild-circuit script is included for hosts that want to re-run the trusted setup; see package.json.

Test

npm test# node:test - 24 cases (8 envelope + 5 audit + 5 handshake + 6 attestation)
npm run smoke # brand-neutrality + barrel-export + smoke

License

Apache License 2.0 - see LICENSE.

Spec

Spec sections: §3 conventions, §4 message envelope, §5 identity & attestation, §6 handshake & session lifecycle, §7 task envelopes, §8 result envelopes, §9 error envelopes, §10 audit log, §11 routing, §12 trust levels & capability vectors, §13 workflow & OPAL, §14 key management, §15 conformance, §16 error code registry, §17 change log.

Citation

If you use AIP in a paper, product, or downstream project, please cite the v1.1.0 release. Each GitHub release gets a Zenodo DOI; the v1.1.0 DOI is below.

@software{aip_v1_1_0,
author = {Liem, Isaac},
orcid = {0009-0006-2476-1615},
title = {{AIP v1.1.0: Privacy-first audit protocol for autonomous agents}},
version = {1.1.0},
month = jul,
year = 2026,
publisher = {Zenodo},
doi = {10.5281/zenodo.21267380},
url = {https://zenodo.org/records/21267380},
note = {Reference implementation of the Agent Interoperability Protocol. Wire-level primitives: did:aip identifiers, Ed25519 signing, hash-chained signed audit log, capability-based handshake, use-once ZK attestation.}
}

DOI badge:

DOI

About

Agent Interoperability Protocol — brand-neutral cognitive workflow primitives (DID, Ed25519, ZK, audit chain, OPAL)

Resources

Contributing

Security policy

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

Repository files navigation

@aip-protocol/aip

Status: v1.1.0 (wire-breaking alignment with the AIP whitepaper). The whitepaper is canonical. Anything tagged NORMATIVE in docs/aip-v1.0-spec.md is locked; the spec is the authority of record. See KNOWN-LIMITS.md for the documented v1.1.0 scope boundaries (Groth16 as a permitted proving-system variant, single-party ceremony PENDING, no production Halo2 tooling yet, aip-attest-v1 is a real Poseidon-Merkle-in-circuit).

The Agent Interoperability Protocol (AIP) is an open-source, embeddable set of primitives for cognitive workflows between software agents: W3C-style did:aip:<AGENT_TYPE>:<base32> identifiers, Ed25519 signing, a hash-chained signed audit log, a §4 MessageEnvelope contract, a §6 handshake (capability intersection), the §13 OPAL cycle (ORIENT → PLAN → EXECUTE → LEARN), and a §5.3 use-once ZK attestation (Halo2 / BN254 normative, Groth16 as a permitted variant).

The AIP module is brand-neutral at the contract level: it refuses to construct a DID, sign an envelope, or write an audit entry until the host application supplies a DIDProvider at startup. The brand-neutrality of the implementation is what makes the open-source protocol credible - any host, any deployment, any founder can use these primitives without leaking their identity.


What's new in v1.1.0

v1.1.0 is a wire-breaking release that aligns the code to the canonical AIP whitepaper. The v1.0.1 → v1.1.0 migration is summarized below; for the full list see CHANGELOG.md.

  • Envelope wire format: messageIdenvelopeId, sender.didfrom, recipient.didto, timestampissuedAt. New required fields: expiresAt (default: issuedAt + 5 min) and previousHash (SHA-256 chain anchor; null on the first envelope of a session).
  • Audit entry wire format: auditIdentryId, actorDIDactorAgentType, timestampissuedAt, previousEntryHashpreviousHash. New required field: aipVersion: "1.1.0".
  • DID method: did:aip:<AGENT_TYPE>:<base32> (was the v1.0.1 did:aip:<namespace>:<uuid-prefix>). The AIP_NAMESPACE env var is gone.
  • DID document: W3C verificationMethod (was v1.0.1 publicKey). The dropped v1.0.1 fields (version, owner, controller, delegationScope.allowedDelegators, auditEndpoint) are not in the whitepaper and are not in v1.1.0.
  • Handshake state machine: INIT → OFFER_SENT → REPLY_SENT → ESTABLISHED → CLOSED (with OFFER_REJECTED branch). v1.0.1 collapsed REPLY_SENT into ESTABLISHED/REJECTED and did not have a CLOSED state. Body field renames: requestedCapabilitiesrequestedCaps, matchedCapabilitiesmatchedCaps, missingCapabilitiesunsupportedCapabilities, sessionPurposepurpose, principalProofprincipalAttestation, agentDIDagentDid. Default rejection reason is AIP_ERR_021 CAPABILITY_VECTOR_MISMATCH (was CAPABILITY_NOT_MET).
  • Trust levels: numeric 0..3 per spec §12.2 (SELF_DECLARED=0, HANDSHAKE_SIGNED=1, ZKP_ATTESTED=2, MULTI_ISSUER=3). v1.0.1's string enum is kept as TRUST_LEVEL_NAMES for one release.
  • Workflow state machine: dropped v1.0.1's AWAITING_APPROVAL / VETOED (not in the spec). New canonical enum: PENDING → RUNNING → COMPLETE | FAILED | CANCELLED.
  • Error codes: expanded from 26 to 50 per spec §16, with corrected names (e.g. AIP_ERR_001 HANDSHAKE_OFFER_EXPIRED).
  • Defaults: MAX_DELEGATION_DEPTH 2 → 5; SESSION_TTL 3600s → 86400s; key-rotation grace 24h → 30d.
  • Capability vectors: canonical <domain>.<verb>[.<modifier>] form per spec §12.1 (e.g. build.code, review.code, deploy.activate). v1.0.1's mixed forms (synthesize.code, analyze.code, delegate.activate) are gone.
  • Env vars: removed AIP_NAMESPACE and AIP_CALLBACK_ENDPOINT from the AIP module. The module is fully brand-neutral; the host supplies these values via explicit parameters or the DIDProvider seam.

Upgrade path. v1.1.0 is not wire-compatible with v1.0.1. Host applications need to update their envelope/audit consumers to the v1.1.0 field names and to register a DIDProvider for the getOrCreateAgentDID calls. v1.0.1 audit logs can still be verified by verifyChain (it tolerates the legacy field names); v1.0.1 envelopes cannot be re-verified as v1.1.0.


Install

The package is not yet published to the public npm registry. Install directly from the source repository:

npm install github:githubscum/aip-protocol#v1.1.0

Or pin to a specific commit:

npm install github:githubscum/aip-protocol#<commit-sha>

Once the package is published to npm, replace with:

npm install @aip-protocol/aip

Quick start

import{setDIDProvider,getDIDProvider,createMessageEnvelope,verifyMessageEnvelope,writeAuditEntry,getOrCreateAgentDID,AIP_VERSION,}from'@aip-protocol/aip';// 1. Wire identity. The host application decides where keys live.setDIDProvider({getDID: (agentType)=>getOrCreateAgentDID(agentType),sign: (agentType,bytes)=>/* your local key */,verify: (agentType,sig,bytes)=>/* verify */,getPrincipal: ()=>({id: '...',commitment: '...'}),});// 2. Build a signed envelope.constenv=createMessageEnvelope({fromAgentType: 'BUILDER',toDid: 'did:aip:REVIEWER:abc...',sessionId: 'sess-001',messageType: 'TASK',body: {/* task body */},});// env now has: envelopeId, aipVersion='1.1.0', from, to, sessionId,// issuedAt, expiresAt (issuedAt+5min), body, signature,// previousHash (null on the first envelope of a session)// 3. Audit it.writeAuditEntry({sessionId: 'sess-001',eventType: 'TASK_SUBMITTED',actorAgentType: 'BUILDER',summary: 'sent TASK to reviewer-7',payload: {envelopeId: env.envelopeId},});

DIDProvider

The AIP module never reads host-prefixed environment variables or hardcodes a default controller. Identity comes from the host application via setDIDProvider({...}). The required shape:

typeDIDProvider={getDID(agentType: string): AgentDIDRecord;sign(agentType: string,payload: Buffer|Uint8Array|string): string;verify(agentType: string,sig: string,payload: Buffer|Uint8Array|string): boolean;getPrincipal?(): {id: string;commitment: string};};

getPrincipal() is optional. The handshake (§6) uses it to build the principalAttestation's public inputs; providers that don't need ZK attestation can omit it and the handshake falls back to the LIGHTWEIGHT_HANDSHAKE interop mode (§6.5).

DataStore (forward direction)

A DataStore seam is defined but optional. AIP modules currently write to package-internal JSONL/JSON paths. A future version will route all reads/writes through getDataStore().

Circuits

The aip-attest-v1 circuit (spec §5.3) ships as a real Poseidon- Merkle-in-circuit with 3 public inputs (commitmentRoot, nullifier, epoch) and 2 private inputs (principalId, nonce). Both hashes are constrained in-circuit - the verifier needs only the Groth16 proof check, not an external Poseidon re-computation. The trusted-setup transcript is at circuits/aip-attest-v1.pots-transcript.txt.

Hosts that want to pin their own build can override the artifacts directory:

import{setCircuitsDir}from'@aip-protocol/aip';setCircuitsDir('/path/to/host/circuits');// or via env: AIP_CIRCUITS_DIR=/path/to/host/circuits

If you override, you MUST also update EXPECTED_VKEY_SHA256 in src/attestation.js to the SHA-256 of your aip-attest-v1.verification_key.json. The fingerprint is checked lazily on the first attest() call; a mismatch throws a descriptive error instead of running a circuit you did not expect.

The package ships build outputs only (.wasm, .zkey, verification_key.json, .circom source, pots-transcript.txt). A rebuild-circuit script is included for hosts that want to re-run the trusted setup; see package.json.

Test

npm test# node:test - 24 cases (8 envelope + 5 audit + 5 handshake + 6 attestation)
npm run smoke # brand-neutrality + barrel-export + smoke

License

Apache License 2.0 - see LICENSE.

Spec

Spec sections: §3 conventions, §4 message envelope, §5 identity & attestation, §6 handshake & session lifecycle, §7 task envelopes, §8 result envelopes, §9 error envelopes, §10 audit log, §11 routing, §12 trust levels & capability vectors, §13 workflow & OPAL, §14 key management, §15 conformance, §16 error code registry, §17 change log.

Citation

If you use AIP in a paper, product, or downstream project, please cite the v1.1.0 release. Each GitHub release gets a Zenodo DOI; the v1.1.0 DOI is below.

@software{aip_v1_1_0,
author = {Liem, Isaac},
orcid = {0009-0006-2476-1615},
title = {{AIP v1.1.0: Privacy-first audit protocol for autonomous agents}},
version = {1.1.0},
month = jul,
year = 2026,
publisher = {Zenodo},
doi = {10.5281/zenodo.21267380},
url = {https://zenodo.org/records/21267380},
note = {Reference implementation of the Agent Interoperability Protocol. Wire-level primitives: did:aip identifiers, Ed25519 signing, hash-chained signed audit log, capability-based handshake, use-once ZK attestation.}
}

DOI badge:

DOI

About

Agent Interoperability Protocol — brand-neutral cognitive workflow primitives (DID, Ed25519, ZK, audit chain, OPAL)

Resources

Contributing

Security policy

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Repository files navigation

@aip-protocol/aip

Status: v1.1.0 (wire-breaking alignment with the AIP whitepaper). The whitepaper is canonical. Anything tagged NORMATIVE in docs/aip-v1.0-spec.md is locked; the spec is the authority of record. See KNOWN-LIMITS.md for the documented v1.1.0 scope boundaries (Groth16 as a permitted proving-system variant, single-party ceremony PENDING, no production Halo2 tooling yet, aip-attest-v1 is a real Poseidon-Merkle-in-circuit).

The Agent Interoperability Protocol (AIP) is an open-source, embeddable set of primitives for cognitive workflows between software agents: W3C-style did:aip:<AGENT_TYPE>:<base32> identifiers, Ed25519 signing, a hash-chained signed audit log, a §4 MessageEnvelope contract, a §6 handshake (capability intersection), the §13 OPAL cycle (ORIENT → PLAN → EXECUTE → LEARN), and a §5.3 use-once ZK attestation (Halo2 / BN254 normative, Groth16 as a permitted variant).

The AIP module is brand-neutral at the contract level: it refuses to construct a DID, sign an envelope, or write an audit entry until the host application supplies a DIDProvider at startup. The brand-neutrality of the implementation is what makes the open-source protocol credible - any host, any deployment, any founder can use these primitives without leaking their identity.


What's new in v1.1.0

v1.1.0 is a wire-breaking release that aligns the code to the canonical AIP whitepaper. The v1.0.1 → v1.1.0 migration is summarized below; for the full list see CHANGELOG.md.

  • Envelope wire format: messageIdenvelopeId, sender.didfrom, recipient.didto, timestampissuedAt. New required fields: expiresAt (default: issuedAt + 5 min) and previousHash (SHA-256 chain anchor; null on the first envelope of a session).
  • Audit entry wire format: auditIdentryId, actorDIDactorAgentType, timestampissuedAt, previousEntryHashpreviousHash. New required field: aipVersion: "1.1.0".
  • DID method: did:aip:<AGENT_TYPE>:<base32> (was the v1.0.1 did:aip:<namespace>:<uuid-prefix>). The AIP_NAMESPACE env var is gone.
  • DID document: W3C verificationMethod (was v1.0.1 publicKey). The dropped v1.0.1 fields (version, owner, controller, delegationScope.allowedDelegators, auditEndpoint) are not in the whitepaper and are not in v1.1.0.
  • Handshake state machine: INIT → OFFER_SENT → REPLY_SENT → ESTABLISHED → CLOSED (with OFFER_REJECTED branch). v1.0.1 collapsed REPLY_SENT into ESTABLISHED/REJECTED and did not have a CLOSED state. Body field renames: requestedCapabilitiesrequestedCaps, matchedCapabilitiesmatchedCaps, missingCapabilitiesunsupportedCapabilities, sessionPurposepurpose, principalProofprincipalAttestation, agentDIDagentDid. Default rejection reason is AIP_ERR_021 CAPABILITY_VECTOR_MISMATCH (was CAPABILITY_NOT_MET).
  • Trust levels: numeric 0..3 per spec §12.2 (SELF_DECLARED=0, HANDSHAKE_SIGNED=1, ZKP_ATTESTED=2, MULTI_ISSUER=3). v1.0.1's string enum is kept as TRUST_LEVEL_NAMES for one release.
  • Workflow state machine: dropped v1.0.1's AWAITING_APPROVAL / VETOED (not in the spec). New canonical enum: PENDING → RUNNING → COMPLETE | FAILED | CANCELLED.
  • Error codes: expanded from 26 to 50 per spec §16, with corrected names (e.g. AIP_ERR_001 HANDSHAKE_OFFER_EXPIRED).
  • Defaults: MAX_DELEGATION_DEPTH 2 → 5; SESSION_TTL 3600s → 86400s; key-rotation grace 24h → 30d.
  • Capability vectors: canonical <domain>.<verb>[.<modifier>] form per spec §12.1 (e.g. build.code, review.code, deploy.activate). v1.0.1's mixed forms (synthesize.code, analyze.code, delegate.activate) are gone.
  • Env vars: removed AIP_NAMESPACE and AIP_CALLBACK_ENDPOINT from the AIP module. The module is fully brand-neutral; the host supplies these values via explicit parameters or the DIDProvider seam.

Upgrade path. v1.1.0 is not wire-compatible with v1.0.1. Host applications need to update their envelope/audit consumers to the v1.1.0 field names and to register a DIDProvider for the getOrCreateAgentDID calls. v1.0.1 audit logs can still be verified by verifyChain (it tolerates the legacy field names); v1.0.1 envelopes cannot be re-verified as v1.1.0.


Install

The package is not yet published to the public npm registry. Install directly from the source repository:

npm install github:githubscum/aip-protocol#v1.1.0

Or pin to a specific commit:

npm install github:githubscum/aip-protocol#<commit-sha>

Once the package is published to npm, replace with:

npm install @aip-protocol/aip

Quick start

import{setDIDProvider,getDIDProvider,createMessageEnvelope,verifyMessageEnvelope,writeAuditEntry,getOrCreateAgentDID,AIP_VERSION,}from'@aip-protocol/aip';// 1. Wire identity. The host application decides where keys live.setDIDProvider({getDID: (agentType)=>getOrCreateAgentDID(agentType),sign: (agentType,bytes)=>/* your local key */,verify: (agentType,sig,bytes)=>/* verify */,getPrincipal: ()=>({id: '...',commitment: '...'}),});// 2. Build a signed envelope.constenv=createMessageEnvelope({fromAgentType: 'BUILDER',toDid: 'did:aip:REVIEWER:abc...',sessionId: 'sess-001',messageType: 'TASK',body: {/* task body */},});// env now has: envelopeId, aipVersion='1.1.0', from, to, sessionId,// issuedAt, expiresAt (issuedAt+5min), body, signature,// previousHash (null on the first envelope of a session)// 3. Audit it.writeAuditEntry({sessionId: 'sess-001',eventType: 'TASK_SUBMITTED',actorAgentType: 'BUILDER',summary: 'sent TASK to reviewer-7',payload: {envelopeId: env.envelopeId},});

DIDProvider

The AIP module never reads host-prefixed environment variables or hardcodes a default controller. Identity comes from the host application via setDIDProvider({...}). The required shape:

typeDIDProvider={getDID(agentType: string): AgentDIDRecord;sign(agentType: string,payload: Buffer|Uint8Array|string): string;verify(agentType: string,sig: string,payload: Buffer|Uint8Array|string): boolean;getPrincipal?(): {id: string;commitment: string};};

getPrincipal() is optional. The handshake (§6) uses it to build the principalAttestation's public inputs; providers that don't need ZK attestation can omit it and the handshake falls back to the LIGHTWEIGHT_HANDSHAKE interop mode (§6.5).

DataStore (forward direction)

A DataStore seam is defined but optional. AIP modules currently write to package-internal JSONL/JSON paths. A future version will route all reads/writes through getDataStore().

Circuits

The aip-attest-v1 circuit (spec §5.3) ships as a real Poseidon- Merkle-in-circuit with 3 public inputs (commitmentRoot, nullifier, epoch) and 2 private inputs (principalId, nonce). Both hashes are constrained in-circuit - the verifier needs only the Groth16 proof check, not an external Poseidon re-computation. The trusted-setup transcript is at circuits/aip-attest-v1.pots-transcript.txt.

Hosts that want to pin their own build can override the artifacts directory:

import{setCircuitsDir}from'@aip-protocol/aip';setCircuitsDir('/path/to/host/circuits');// or via env: AIP_CIRCUITS_DIR=/path/to/host/circuits

If you override, you MUST also update EXPECTED_VKEY_SHA256 in src/attestation.js to the SHA-256 of your aip-attest-v1.verification_key.json. The fingerprint is checked lazily on the first attest() call; a mismatch throws a descriptive error instead of running a circuit you did not expect.

The package ships build outputs only (.wasm, .zkey, verification_key.json, .circom source, pots-transcript.txt). A rebuild-circuit script is included for hosts that want to re-run the trusted setup; see package.json.

Test

npm test# node:test - 24 cases (8 envelope + 5 audit + 5 handshake + 6 attestation)
npm run smoke # brand-neutrality + barrel-export + smoke

License

Apache License 2.0 - see LICENSE.

Spec

Spec sections: §3 conventions, §4 message envelope, §5 identity & attestation, §6 handshake & session lifecycle, §7 task envelopes, §8 result envelopes, §9 error envelopes, §10 audit log, §11 routing, §12 trust levels & capability vectors, §13 workflow & OPAL, §14 key management, §15 conformance, §16 error code registry, §17 change log.

Citation

If you use AIP in a paper, product, or downstream project, please cite the v1.1.0 release. Each GitHub release gets a Zenodo DOI; the v1.1.0 DOI is below.

@software{aip_v1_1_0,
author = {Liem, Isaac},
orcid = {0009-0006-2476-1615},
title = {{AIP v1.1.0: Privacy-first audit protocol for autonomous agents}},
version = {1.1.0},
month = jul,
year = 2026,
publisher = {Zenodo},
doi = {10.5281/zenodo.21267380},
url = {https://zenodo.org/records/21267380},
note = {Reference implementation of the Agent Interoperability Protocol. Wire-level primitives: did:aip identifiers, Ed25519 signing, hash-chained signed audit log, capability-based handshake, use-once ZK attestation.}
}

DOI badge:

DOI

About

Agent Interoperability Protocol — brand-neutral cognitive workflow primitives (DID, Ed25519, ZK, audit chain, OPAL)

Resources

Contributing

Security policy

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Repository files navigation

@aip-protocol/aip

Status: v1.1.0 (wire-breaking alignment with the AIP whitepaper). The whitepaper is canonical. Anything tagged NORMATIVE in docs/aip-v1.0-spec.md is locked; the spec is the authority of record. See KNOWN-LIMITS.md for the documented v1.1.0 scope boundaries (Groth16 as a permitted proving-system variant, single-party ceremony PENDING, no production Halo2 tooling yet, aip-attest-v1 is a real Poseidon-Merkle-in-circuit).

The Agent Interoperability Protocol (AIP) is an open-source, embeddable set of primitives for cognitive workflows between software agents: W3C-style did:aip:<AGENT_TYPE>:<base32> identifiers, Ed25519 signing, a hash-chained signed audit log, a §4 MessageEnvelope contract, a §6 handshake (capability intersection), the §13 OPAL cycle (ORIENT → PLAN → EXECUTE → LEARN), and a §5.3 use-once ZK attestation (Halo2 / BN254 normative, Groth16 as a permitted variant).

The AIP module is brand-neutral at the contract level: it refuses to construct a DID, sign an envelope, or write an audit entry until the host application supplies a DIDProvider at startup. The brand-neutrality of the implementation is what makes the open-source protocol credible - any host, any deployment, any founder can use these primitives without leaking their identity.


What's new in v1.1.0

v1.1.0 is a wire-breaking release that aligns the code to the canonical AIP whitepaper. The v1.0.1 → v1.1.0 migration is summarized below; for the full list see CHANGELOG.md.

  • Envelope wire format: messageIdenvelopeId, sender.didfrom, recipient.didto, timestampissuedAt. New required fields: expiresAt (default: issuedAt + 5 min) and previousHash (SHA-256 chain anchor; null on the first envelope of a session).
  • Audit entry wire format: auditIdentryId, actorDIDactorAgentType, timestampissuedAt, previousEntryHashpreviousHash. New required field: aipVersion: "1.1.0".
  • DID method: did:aip:<AGENT_TYPE>:<base32> (was the v1.0.1 did:aip:<namespace>:<uuid-prefix>). The AIP_NAMESPACE env var is gone.
  • DID document: W3C verificationMethod (was v1.0.1 publicKey). The dropped v1.0.1 fields (version, owner, controller, delegationScope.allowedDelegators, auditEndpoint) are not in the whitepaper and are not in v1.1.0.
  • Handshake state machine: INIT → OFFER_SENT → REPLY_SENT → ESTABLISHED → CLOSED (with OFFER_REJECTED branch). v1.0.1 collapsed REPLY_SENT into ESTABLISHED/REJECTED and did not have a CLOSED state. Body field renames: requestedCapabilitiesrequestedCaps, matchedCapabilitiesmatchedCaps, missingCapabilitiesunsupportedCapabilities, sessionPurposepurpose, principalProofprincipalAttestation, agentDIDagentDid. Default rejection reason is AIP_ERR_021 CAPABILITY_VECTOR_MISMATCH (was CAPABILITY_NOT_MET).
  • Trust levels: numeric 0..3 per spec §12.2 (SELF_DECLARED=0, HANDSHAKE_SIGNED=1, ZKP_ATTESTED=2, MULTI_ISSUER=3). v1.0.1's string enum is kept as TRUST_LEVEL_NAMES for one release.
  • Workflow state machine: dropped v1.0.1's AWAITING_APPROVAL / VETOED (not in the spec). New canonical enum: PENDING → RUNNING → COMPLETE | FAILED | CANCELLED.
  • Error codes: expanded from 26 to 50 per spec §16, with corrected names (e.g. AIP_ERR_001 HANDSHAKE_OFFER_EXPIRED).
  • Defaults: MAX_DELEGATION_DEPTH 2 → 5; SESSION_TTL 3600s → 86400s; key-rotation grace 24h → 30d.
  • Capability vectors: canonical <domain>.<verb>[.<modifier>] form per spec §12.1 (e.g. build.code, review.code, deploy.activate). v1.0.1's mixed forms (synthesize.code, analyze.code, delegate.activate) are gone.
  • Env vars: removed AIP_NAMESPACE and AIP_CALLBACK_ENDPOINT from the AIP module. The module is fully brand-neutral; the host supplies these values via explicit parameters or the DIDProvider seam.

Upgrade path. v1.1.0 is not wire-compatible with v1.0.1. Host applications need to update their envelope/audit consumers to the v1.1.0 field names and to register a DIDProvider for the getOrCreateAgentDID calls. v1.0.1 audit logs can still be verified by verifyChain (it tolerates the legacy field names); v1.0.1 envelopes cannot be re-verified as v1.1.0.


Install

The package is not yet published to the public npm registry. Install directly from the source repository:

npm install github:githubscum/aip-protocol#v1.1.0

Or pin to a specific commit:

npm install github:githubscum/aip-protocol#<commit-sha>

Once the package is published to npm, replace with:

npm install @aip-protocol/aip

Quick start

import{setDIDProvider,getDIDProvider,createMessageEnvelope,verifyMessageEnvelope,writeAuditEntry,getOrCreateAgentDID,AIP_VERSION,}from'@aip-protocol/aip';// 1. Wire identity. The host application decides where keys live.setDIDProvider({getDID: (agentType)=>getOrCreateAgentDID(agentType),sign: (agentType,bytes)=>/* your local key */,verify: (agentType,sig,bytes)=>/* verify */,getPrincipal: ()=>({id: '...',commitment: '...'}),});// 2. Build a signed envelope.constenv=createMessageEnvelope({fromAgentType: 'BUILDER',toDid: 'did:aip:REVIEWER:abc...',sessionId: 'sess-001',messageType: 'TASK',body: {/* task body */},});// env now has: envelopeId, aipVersion='1.1.0', from, to, sessionId,// issuedAt, expiresAt (issuedAt+5min), body, signature,// previousHash (null on the first envelope of a session)// 3. Audit it.writeAuditEntry({sessionId: 'sess-001',eventType: 'TASK_SUBMITTED',actorAgentType: 'BUILDER',summary: 'sent TASK to reviewer-7',payload: {envelopeId: env.envelopeId},});

DIDProvider

The AIP module never reads host-prefixed environment variables or hardcodes a default controller. Identity comes from the host application via setDIDProvider({...}). The required shape:

typeDIDProvider={getDID(agentType: string): AgentDIDRecord;sign(agentType: string,payload: Buffer|Uint8Array|string): string;verify(agentType: string,sig: string,payload: Buffer|Uint8Array|string): boolean;getPrincipal?(): {id: string;commitment: string};};

getPrincipal() is optional. The handshake (§6) uses it to build the principalAttestation's public inputs; providers that don't need ZK attestation can omit it and the handshake falls back to the LIGHTWEIGHT_HANDSHAKE interop mode (§6.5).

DataStore (forward direction)

A DataStore seam is defined but optional. AIP modules currently write to package-internal JSONL/JSON paths. A future version will route all reads/writes through getDataStore().

Circuits

The aip-attest-v1 circuit (spec §5.3) ships as a real Poseidon- Merkle-in-circuit with 3 public inputs (commitmentRoot, nullifier, epoch) and 2 private inputs (principalId, nonce). Both hashes are constrained in-circuit - the verifier needs only the Groth16 proof check, not an external Poseidon re-computation. The trusted-setup transcript is at circuits/aip-attest-v1.pots-transcript.txt.

Hosts that want to pin their own build can override the artifacts directory:

import{setCircuitsDir}from'@aip-protocol/aip';setCircuitsDir('/path/to/host/circuits');// or via env: AIP_CIRCUITS_DIR=/path/to/host/circuits

If you override, you MUST also update EXPECTED_VKEY_SHA256 in src/attestation.js to the SHA-256 of your aip-attest-v1.verification_key.json. The fingerprint is checked lazily on the first attest() call; a mismatch throws a descriptive error instead of running a circuit you did not expect.

The package ships build outputs only (.wasm, .zkey, verification_key.json, .circom source, pots-transcript.txt). A rebuild-circuit script is included for hosts that want to re-run the trusted setup; see package.json.

Test

npm test# node:test - 24 cases (8 envelope + 5 audit + 5 handshake + 6 attestation)
npm run smoke # brand-neutrality + barrel-export + smoke

License

Apache License 2.0 - see LICENSE.

Spec

Spec sections: §3 conventions, §4 message envelope, §5 identity & attestation, §6 handshake & session lifecycle, §7 task envelopes, §8 result envelopes, §9 error envelopes, §10 audit log, §11 routing, §12 trust levels & capability vectors, §13 workflow & OPAL, §14 key management, §15 conformance, §16 error code registry, §17 change log.

Citation

If you use AIP in a paper, product, or downstream project, please cite the v1.1.0 release. Each GitHub release gets a Zenodo DOI; the v1.1.0 DOI is below.

@software{aip_v1_1_0,
author = {Liem, Isaac},
orcid = {0009-0006-2476-1615},
title = {{AIP v1.1.0: Privacy-first audit protocol for autonomous agents}},
version = {1.1.0},
month = jul,
year = 2026,
publisher = {Zenodo},
doi = {10.5281/zenodo.21267380},
url = {https://zenodo.org/records/21267380},
note = {Reference implementation of the Agent Interoperability Protocol. Wire-level primitives: did:aip identifiers, Ed25519 signing, hash-chained signed audit log, capability-based handshake, use-once ZK attestation.}
}

DOI badge:

DOI

About

Agent Interoperability Protocol — brand-neutral cognitive workflow primitives (DID, Ed25519, ZK, audit chain, OPAL)

Resources

Contributing

Security policy

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

Repository files navigation

@aip-protocol/aip

Status: v1.1.0 (wire-breaking alignment with the AIP whitepaper). The whitepaper is canonical. Anything tagged NORMATIVE in docs/aip-v1.0-spec.md is locked; the spec is the authority of record. See KNOWN-LIMITS.md for the documented v1.1.0 scope boundaries (Groth16 as a permitted proving-system variant, single-party ceremony PENDING, no production Halo2 tooling yet, aip-attest-v1 is a real Poseidon-Merkle-in-circuit).

The Agent Interoperability Protocol (AIP) is an open-source, embeddable set of primitives for cognitive workflows between software agents: W3C-style did:aip:<AGENT_TYPE>:<base32> identifiers, Ed25519 signing, a hash-chained signed audit log, a §4 MessageEnvelope contract, a §6 handshake (capability intersection), the §13 OPAL cycle (ORIENT → PLAN → EXECUTE → LEARN), and a §5.3 use-once ZK attestation (Halo2 / BN254 normative, Groth16 as a permitted variant).

The AIP module is brand-neutral at the contract level: it refuses to construct a DID, sign an envelope, or write an audit entry until the host application supplies a DIDProvider at startup. The brand-neutrality of the implementation is what makes the open-source protocol credible - any host, any deployment, any founder can use these primitives without leaking their identity.


What's new in v1.1.0

v1.1.0 is a wire-breaking release that aligns the code to the canonical AIP whitepaper. The v1.0.1 → v1.1.0 migration is summarized below; for the full list see CHANGELOG.md.

  • Envelope wire format: messageIdenvelopeId, sender.didfrom, recipient.didto, timestampissuedAt. New required fields: expiresAt (default: issuedAt + 5 min) and previousHash (SHA-256 chain anchor; null on the first envelope of a session).
  • Audit entry wire format: auditIdentryId, actorDIDactorAgentType, timestampissuedAt, previousEntryHashpreviousHash. New required field: aipVersion: "1.1.0".
  • DID method: did:aip:<AGENT_TYPE>:<base32> (was the v1.0.1 did:aip:<namespace>:<uuid-prefix>). The AIP_NAMESPACE env var is gone.
  • DID document: W3C verificationMethod (was v1.0.1 publicKey). The dropped v1.0.1 fields (version, owner, controller, delegationScope.allowedDelegators, auditEndpoint) are not in the whitepaper and are not in v1.1.0.
  • Handshake state machine: INIT → OFFER_SENT → REPLY_SENT → ESTABLISHED → CLOSED (with OFFER_REJECTED branch). v1.0.1 collapsed REPLY_SENT into ESTABLISHED/REJECTED and did not have a CLOSED state. Body field renames: requestedCapabilitiesrequestedCaps, matchedCapabilitiesmatchedCaps, missingCapabilitiesunsupportedCapabilities, sessionPurposepurpose, principalProofprincipalAttestation, agentDIDagentDid. Default rejection reason is AIP_ERR_021 CAPABILITY_VECTOR_MISMATCH (was CAPABILITY_NOT_MET).
  • Trust levels: numeric 0..3 per spec §12.2 (SELF_DECLARED=0, HANDSHAKE_SIGNED=1, ZKP_ATTESTED=2, MULTI_ISSUER=3). v1.0.1's string enum is kept as TRUST_LEVEL_NAMES for one release.
  • Workflow state machine: dropped v1.0.1's AWAITING_APPROVAL / VETOED (not in the spec). New canonical enum: PENDING → RUNNING → COMPLETE | FAILED | CANCELLED.
  • Error codes: expanded from 26 to 50 per spec §16, with corrected names (e.g. AIP_ERR_001 HANDSHAKE_OFFER_EXPIRED).
  • Defaults: MAX_DELEGATION_DEPTH 2 → 5; SESSION_TTL 3600s → 86400s; key-rotation grace 24h → 30d.
  • Capability vectors: canonical <domain>.<verb>[.<modifier>] form per spec §12.1 (e.g. build.code, review.code, deploy.activate). v1.0.1's mixed forms (synthesize.code, analyze.code, delegate.activate) are gone.
  • Env vars: removed AIP_NAMESPACE and AIP_CALLBACK_ENDPOINT from the AIP module. The module is fully brand-neutral; the host supplies these values via explicit parameters or the DIDProvider seam.

Upgrade path. v1.1.0 is not wire-compatible with v1.0.1. Host applications need to update their envelope/audit consumers to the v1.1.0 field names and to register a DIDProvider for the getOrCreateAgentDID calls. v1.0.1 audit logs can still be verified by verifyChain (it tolerates the legacy field names); v1.0.1 envelopes cannot be re-verified as v1.1.0.


Install

The package is not yet published to the public npm registry. Install directly from the source repository:

npm install github:githubscum/aip-protocol#v1.1.0

Or pin to a specific commit:

npm install github:githubscum/aip-protocol#<commit-sha>

Once the package is published to npm, replace with:

npm install @aip-protocol/aip

Quick start

import{setDIDProvider,getDIDProvider,createMessageEnvelope,verifyMessageEnvelope,writeAuditEntry,getOrCreateAgentDID,AIP_VERSION,}from'@aip-protocol/aip';// 1. Wire identity. The host application decides where keys live.setDIDProvider({getDID: (agentType)=>getOrCreateAgentDID(agentType),sign: (agentType,bytes)=>/* your local key */,verify: (agentType,sig,bytes)=>/* verify */,getPrincipal: ()=>({id: '...',commitment: '...'}),});// 2. Build a signed envelope.constenv=createMessageEnvelope({fromAgentType: 'BUILDER',toDid: 'did:aip:REVIEWER:abc...',sessionId: 'sess-001',messageType: 'TASK',body: {/* task body */},});// env now has: envelopeId, aipVersion='1.1.0', from, to, sessionId,// issuedAt, expiresAt (issuedAt+5min), body, signature,// previousHash (null on the first envelope of a session)// 3. Audit it.writeAuditEntry({sessionId: 'sess-001',eventType: 'TASK_SUBMITTED',actorAgentType: 'BUILDER',summary: 'sent TASK to reviewer-7',payload: {envelopeId: env.envelopeId},});

DIDProvider

The AIP module never reads host-prefixed environment variables or hardcodes a default controller. Identity comes from the host application via setDIDProvider({...}). The required shape:

typeDIDProvider={getDID(agentType: string): AgentDIDRecord;sign(agentType: string,payload: Buffer|Uint8Array|string): string;verify(agentType: string,sig: string,payload: Buffer|Uint8Array|string): boolean;getPrincipal?(): {id: string;commitment: string};};

getPrincipal() is optional. The handshake (§6) uses it to build the principalAttestation's public inputs; providers that don't need ZK attestation can omit it and the handshake falls back to the LIGHTWEIGHT_HANDSHAKE interop mode (§6.5).

DataStore (forward direction)

A DataStore seam is defined but optional. AIP modules currently write to package-internal JSONL/JSON paths. A future version will route all reads/writes through getDataStore().

Circuits

The aip-attest-v1 circuit (spec §5.3) ships as a real Poseidon- Merkle-in-circuit with 3 public inputs (commitmentRoot, nullifier, epoch) and 2 private inputs (principalId, nonce). Both hashes are constrained in-circuit - the verifier needs only the Groth16 proof check, not an external Poseidon re-computation. The trusted-setup transcript is at circuits/aip-attest-v1.pots-transcript.txt.

Hosts that want to pin their own build can override the artifacts directory:

import{setCircuitsDir}from'@aip-protocol/aip';setCircuitsDir('/path/to/host/circuits');// or via env: AIP_CIRCUITS_DIR=/path/to/host/circuits

If you override, you MUST also update EXPECTED_VKEY_SHA256 in src/attestation.js to the SHA-256 of your aip-attest-v1.verification_key.json. The fingerprint is checked lazily on the first attest() call; a mismatch throws a descriptive error instead of running a circuit you did not expect.

The package ships build outputs only (.wasm, .zkey, verification_key.json, .circom source, pots-transcript.txt). A rebuild-circuit script is included for hosts that want to re-run the trusted setup; see package.json.

Test

npm test# node:test - 24 cases (8 envelope + 5 audit + 5 handshake + 6 attestation)
npm run smoke # brand-neutrality + barrel-export + smoke

License

Apache License 2.0 - see LICENSE.

Spec

Spec sections: §3 conventions, §4 message envelope, §5 identity & attestation, §6 handshake & session lifecycle, §7 task envelopes, §8 result envelopes, §9 error envelopes, §10 audit log, §11 routing, §12 trust levels & capability vectors, §13 workflow & OPAL, §14 key management, §15 conformance, §16 error code registry, §17 change log.

Citation

If you use AIP in a paper, product, or downstream project, please cite the v1.1.0 release. Each GitHub release gets a Zenodo DOI; the v1.1.0 DOI is below.

@software{aip_v1_1_0,
author = {Liem, Isaac},
orcid = {0009-0006-2476-1615},
title = {{AIP v1.1.0: Privacy-first audit protocol for autonomous agents}},
version = {1.1.0},
month = jul,
year = 2026,
publisher = {Zenodo},
doi = {10.5281/zenodo.21267380},
url = {https://zenodo.org/records/21267380},
note = {Reference implementation of the Agent Interoperability Protocol. Wire-level primitives: did:aip identifiers, Ed25519 signing, hash-chained signed audit log, capability-based handshake, use-once ZK attestation.}
}

DOI badge:

DOI

About

Agent Interoperability Protocol — brand-neutral cognitive workflow primitives (DID, Ed25519, ZK, audit chain, OPAL)

Resources

Contributing

Security policy

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages