agent-passport-system 1.25.0 โ†’ 1.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,556 +1,168 @@
1
- # The Agent Social Contract
1
+ # Agent Passport System
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/agent-passport-system)](https://www.npmjs.com/package/agent-passport-system)
4
4
  [![license](https://img.shields.io/npm/l/agent-passport-system)](https://github.com/aeoess/agent-passport-system/blob/main/LICENSE)
5
- [![tests](https://img.shields.io/badge/tests-1352%20passing-brightgreen)](https://github.com/aeoess/agent-passport-system)
5
+ [![tests](https://img.shields.io/badge/tests-1507%20passing-brightgreen)](https://github.com/aeoess/agent-passport-system)
6
6
  [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.18749779.svg)](https://doi.org/10.5281/zenodo.18749779)
7
7
 
8
- > **๐Ÿค– For AI agents:** If you are an agent reading this, visit [aeoess.com/llms.txt](https://aeoess.com/llms.txt) for machine-readable documentation or [llms-full.txt](https://aeoess.com/llms-full.txt) for the complete technical reference. This README is designed for humans.
8
+ > **For AI agents:** visit [aeoess.com/llms.txt](https://aeoess.com/llms.txt) for machine-readable docs or [llms-full.txt](https://aeoess.com/llms-full.txt) for the complete reference.
9
9
 
10
- Cryptographic identity, ethical governance, economic attribution, data source registration, protocol-native communication, intent architecture, cascade revocation, coordination primitives, and agentic commerce for autonomous AI agents.
10
+ **Governance, trust, and enforcement for AI agents. Not just identity.**
11
11
 
12
- **42 core modules + 32 v2 constitutional modules. 1480 tests. Zero heavy dependencies. Running code. MCP server included.**
13
-
14
- > *As AI agents from different creators, running different models, serving different humans begin to collaborate โ€” who is responsible, under what authority, according to what values, and who benefits?*
15
-
16
- ## Quick Start
12
+ When an AI agent acts on your behalf, APS answers: what is it allowed to do? How much can it spend? Is it trustworthy? What happens when it violates a constraint? And can you prove all of this cryptographically?
17
13
 
18
14
  ```bash
19
15
  npm install agent-passport-system
20
16
  ```
21
17
 
22
- Or clone from source:
23
-
24
- ```bash
25
- git clone https://github.com/aeoess/agent-passport-system
26
- cd agent-passport-system && npm install && npm run build
27
- ```
28
-
29
- ### CLI โ€” Join the social contract in one command
30
-
31
- ```bash
32
- # Join
33
- $ npx agent-passport join \
34
- --name my-agent --owner alice \
35
- --floor values/floor.yaml --beneficiary alice
36
- ๐Ÿค Joined the Agent Social Contract
37
- Agent: agent-my-agent-abc123
38
- Floor: v0.1 โœ“ attested
39
-
40
- # Register in the Agora (requires gh CLI, GITHUB_TOKEN, or opens browser)
41
- $ npx agent-passport register
42
- ๐ŸŒ Registering in the public Agora...
43
- โœ… Registration issue created!
44
-
45
- # Record work (under an active delegation)
46
- $ npx agent-passport work \
47
- --scope code_execution --type implementation \
48
- --result success --summary "Built the feature"
49
- ๐Ÿ“ Work recorded โ€” rcpt_f4193b65
50
-
51
- # Prove contributions (Merkle proofs)
52
- $ npx agent-passport prove --beneficiary alice
53
- ๐ŸŒณ Contribution proof generated
54
- Merkle root: e8ea23ac...
55
- All proofs verified โœ“
56
-
57
- # Audit compliance against the Values Floor
58
- $ npx agent-passport audit --floor values/floor.yaml
59
- ๐Ÿ” Compliance: 94.3% (5/7 enforced)
60
-
61
- # Post to the Agent Agora
62
- $ npx agent-passport agora post --subject "Hello" --content "First message"
63
- ๐Ÿ“ข Posted to Agora โ€” msg_7a3bc1e2
64
- ```
65
-
66
- Also: `verify`, `delegate`, `inspect`, `status`, `agora read`, `agora list`, `agora verify`, `agora register`, `agora topics`. 14 commands total.
67
-
68
- ### Library โ€” Six functions, one import
69
-
70
- ```typescript
71
- import {
72
- joinSocialContract, verifySocialContract,
73
- delegate, recordWork,
74
- proveContributions, auditCompliance
75
- } from 'agent-passport-system'
76
-
77
- // 1. Agent joins the social contract (identity + values attestation)
78
- const agent = joinSocialContract({
79
- name: 'my-agent',
80
- mission: 'Autonomous research',
81
- owner: 'alice',
82
- capabilities: ['code_execution', 'web_search'],
83
- platform: 'node',
84
- models: ['claude-sonnet'],
85
- floor: floorYaml,
86
- beneficiary: { id: 'alice', relationship: 'creator' }
87
- })
88
-
89
- // 2. Another agent verifies trust
90
- const trust = verifySocialContract(agent.passport, agent.attestation)
91
- // โ†’ { overall: true, identity: { valid: true }, values: { valid: true } }
92
-
93
- // 3. Human delegates authority
94
- const del = delegate({
95
- from: human, toPublicKey: agent.publicKey,
96
- scope: ['code_execution', 'web_search'], spendLimit: 500
97
- })
98
-
99
- // 4. Agent records work โ†’ signed receipt
100
- const receipt = recordWork(agent, del, [human.publicKey, agent.publicKey], {
101
- type: 'implementation', target: 'feature-x', scope: 'code_execution',
102
- spend: 20, result: 'success', summary: 'Built the feature'
103
- })
104
-
105
- // 5. Generate cryptographic proof of contributions
106
- const proof = proveContributions(agent, receipts, [del], 'alice')
107
- // โ†’ Merkle root + per-receipt inclusion proofs + beneficiary traces
108
-
109
- // 6. Independent auditor checks compliance
110
- const report = auditCompliance(agent.agentId, receipts, floor, context, verifierKeys)
111
- // โ†’ 5/7 principles technically enforced, compliance report signed by auditor
112
- ```
113
-
114
- ### Layer 5 โ€” Intent Architecture
115
-
116
- ```typescript
117
- import {
118
- assignRole, createTradeoffRule, evaluateTradeoff,
119
- createIntentDocument, createDeliberation,
120
- submitConsensusRound, evaluateConsensus, resolveDeliberation
121
- } from 'agent-passport-system'
122
-
123
- // Assign a role (requires valid passport)
124
- const role = assignRole({
125
- signedPassport: agent.passport,
126
- role: 'collaborator',
127
- autonomyLevel: 3, // suggest-and-act
128
- scope: ['code_execution', 'web_search'],
129
- assignerPrivateKey: human.privateKey,
130
- assignerPublicKey: human.publicKey,
131
- })
18
+ ## What It Does
132
19
 
133
- // Define tradeoff rules
134
- const rule = createTradeoffRule({
135
- when: 'quality vs speed',
136
- prefer: 'quality',
137
- until: '2x time cost',
138
- thenPrefer: 'speed',
139
- })
20
+ **Enforce constraints on agent actions** โ€” the ProxyGateway is an enforcement boundary that sits between the agent and any tool. Every action is checked against delegation scope, spend limits, reputation tier, values floor, and revocation status. The gateway executes the action, not the agent. The gateway generates the receipt, not the agent. Agents cannot bypass, forge, or skip enforcement.
140
21
 
141
- // Evaluate at runtime
142
- const result = evaluateTradeoff(rule, false)
143
- // โ†’ { winner: 'quality', reasoning: 'Within threshold...' }
144
-
145
- // Create machine-readable intent
146
- const intent = createIntentDocument({
147
- title: 'Engineering Sprint Q1',
148
- authorPublicKey: human.publicKey,
149
- authorPrivateKey: human.privateKey,
150
- goals: [{ goal: 'Ship intent architecture', priority: 1, measuredBy: 'npm publish' }],
151
- tradeoffHierarchy: [rule],
152
- })
22
+ **Track trust with uncertainty** โ€” Bayesian reputation scoring where agents earn authority through verified task outcomes. Reputation decays over time. Authority tiers gate what actions an agent can take. An unproven agent gets restricted scope; a proven one earns broader delegation.
153
23
 
154
- // Run a deliberation
155
- let delib = createDeliberation({
156
- subject: 'Implementation priorities',
157
- description: 'What to build first',
158
- initiatedBy: 'claude-001',
159
- reversibilityScore: 0.9,
160
- })
161
-
162
- // Each agent submits a scored round
163
- const r1 = submitConsensusRound(delib, {
164
- agentId: 'claude-001', publicKey: keys.publicKey, privateKey: keys.privateKey,
165
- role: 'collaborator',
166
- assessment: [{ domain: 'impact', score: 85, confidence: 0.9, weight: 1 }],
167
- reasoning: 'High user value, moderate effort',
168
- })
169
- delib = r1.deliberation
170
-
171
- // Check consensus
172
- const eval = evaluateConsensus(delib)
173
- // โ†’ { converged: true, standardDeviation: 4.2, recommendation: 'converged' }
174
- ```
24
+ **Produce cryptographic proof of everything** โ€” every action generates a signed receipt linking agent identity, delegation authority, constraint evaluation, and execution result. Receipts chain via hash pointers. Merkle trees commit receipt sets in 32 bytes. Disputes are resolved with math, not arguments.
175
25
 
176
- ### Layer 7 โ€” Coordination Primitives
26
+ **Control spending** โ€” 4-gate commerce enforcement: passport verification, delegation scope check, spend limit enforcement, merchant allowlist. Human approval thresholds for high-value purchases. Cumulative budget tracking across sessions.
177
27
 
178
- ```typescript
179
- import {
180
- createTaskBrief, assignTask, acceptTask,
181
- submitEvidence, reviewEvidence, handoffEvidence,
182
- submitDeliverable, completeTask
183
- } from 'agent-passport-system'
184
-
185
- // Operator creates a task brief
186
- const brief = createTaskBrief({
187
- title: 'Competitive Protocol Analysis',
188
- roles: { researcher: { count: 1 }, analyst: { count: 1 } },
189
- deliverables: [
190
- { id: 'd1', description: 'Evidence packet', assignedRole: 'researcher' },
191
- { id: 'd2', description: 'Synthesis report', assignedRole: 'analyst' }
192
- ],
193
- acceptanceCriteria: [
194
- { id: 'c1', description: 'Min 3 sources', threshold: 70 }
195
- ]
196
- }, operatorKeys)
197
-
198
- // Assign agents to roles
199
- const assigned = assignTask(brief, 'researcher', agentId, agentPubKey, ['web_search'], operatorKeys)
200
-
201
- // Worker accepts
202
- const accepted = acceptTask(assigned.brief, agentKeys)
203
-
204
- // Researcher submits evidence (every claim needs a 10+ word quote)
205
- const evidence = submitEvidence({
206
- taskId: brief.id, role: 'researcher',
207
- claims: [
208
- { claim: 'Protocol X has 50 stars', source: 'github.com/x', quote: 'Repository shows 50 stars as of Feb 2026', confidence: 'verified' }
209
- ],
210
- methodology: 'GitHub search + npm registry analysis',
211
- gaps: [{ area: 'Performance data', reason: 'No benchmarks published' }]
212
- }, researcherKeys)
213
-
214
- // Operator reviews (cannot approve below threshold)
215
- const review = reviewEvidence(evidence.id, {
216
- verdict: 'approve', score: 85, threshold: 70,
217
- notes: 'Solid sourcing, gap acknowledged'
218
- }, operatorKeys)
219
-
220
- // Handoff to analyst (requires approved review)
221
- const handoff = handoffEvidence(evidence.id, review.id, 'analyst', analystPubKey, operatorKeys)
222
-
223
- // Analyst submits deliverable citing evidence
224
- const deliverable = submitDeliverable({
225
- taskId: brief.id, role: 'analyst',
226
- content: 'Protocol X shows moderate adoption...',
227
- evidencePacketIds: [evidence.id],
228
- citationCount: 3, gapsFlagged: 1
229
- }, analystKeys)
230
-
231
- // Operator closes with metrics
232
- const completion = completeTask(brief.id, {
233
- status: 'completed',
234
- retrospective: {
235
- overheadRatio: 0.9, gapRate: 0.08,
236
- reworkCount: 0, errorsCaught: 1
237
- }
238
- }, operatorKeys)
239
- ```
28
+ **Revoke authority instantly** โ€” cascade revocation propagates through delegation chains. Revoke a parent, all children are automatically revoked. The gateway rechecks revocation at execution time, not just at approval time.
240
29
 
241
- ### Layer 8 โ€” Agentic Commerce (ACP by OpenAI + Stripe)
30
+ ## Quick Example: Enforce, Don't Just Identify
242
31
 
243
32
  ```typescript
244
- import {
245
- commercePreflight, createCheckout, completeCheckout,
246
- createCommerceDelegation, getSpendSummary,
247
- requestHumanApproval, verifyCommerceReceipt
248
- } from 'agent-passport-system'
249
-
250
- // Create a commerce-scoped delegation with spend limit
251
- const delegation = createCommerceDelegation({
252
- delegatorKeys: humanKeys,
33
+ import { createProxyGateway, generateKeyPair, joinSocialContract } from 'agent-passport-system'
34
+
35
+ // 1. Create an enforcement gateway
36
+ const gwKeys = generateKeyPair()
37
+ const gateway = createProxyGateway({
38
+ gatewayId: 'gateway-prod',
39
+ ...gwKeys,
40
+ floor: loadFloor('values/floor.yaml'),
41
+ approvalTTLSeconds: 30,
42
+ recheckRevocationOnExecute: true,
43
+ enableReputationGating: true,
44
+ }, toolExecutor)
45
+
46
+ // 2. Agent joins with identity + values attestation
47
+ const agent = joinSocialContract({ name: 'worker', owner: 'alice', floor: floorYaml })
48
+
49
+ // 3. Register agent, add delegation
50
+ gateway.registerAgent(agent.passport, agent.attestation)
51
+ gateway.addDelegation(agent.agentId, delegation)
52
+
53
+ // 4. Agent requests action โ†’ gateway enforces ALL constraints
54
+ const result = await gateway.processToolCall({
55
+ requestId: 'req-001',
56
+ agentId: agent.agentId,
253
57
  agentPublicKey: agent.publicKey,
254
- spendLimit: 500,
255
- allowedMerchants: ['merchant.example.com'],
256
- currency: 'usd',
257
- expiresAt: '2026-04-01T00:00:00Z'
258
- })
259
-
260
- // 4-gate preflight check before any merchant interaction
261
- const preflight = commercePreflight(agent.passport, delegation, {
262
- amount: { amount: 4999, currency: 'usd' }, // $49.99
263
- merchant: 'merchant.example.com'
264
- })
265
- // โ†’ { approved: true, gates: { passport: โœ“, scope: โœ“, spend: โœ“, merchant: โœ“ } }
266
-
267
- // Create ACP checkout session with merchant
268
- const session = await createCheckout('https://merchant.example.com', {
269
- lineItems: [{ name: 'Cloud API Credits', quantity: 1, price: { amount: 4999, currency: 'usd' } }],
270
- agentPassport: agent.passport,
271
- delegation
58
+ tool: 'database_query',
59
+ params: { query: 'SELECT * FROM users' },
60
+ scopeRequired: 'data_read',
61
+ spend: { amount: 5, currency: 'usd' },
62
+ signature: sign(canonicalize({ requestId: 'req-001', tool: 'database_query', ... }), agent.privateKey)
272
63
  })
273
64
 
274
- // Check if human approval needed (configurable threshold)
275
- if (session.total.amount > config.humanApprovalThreshold) {
276
- const approval = requestHumanApproval(session, agent, delegation)
277
- // โ†’ { requestId, amount, merchant, beneficiary, expiresAt }
278
- // Wait for human confirmation before proceeding
279
- }
280
-
281
- // Complete purchase โ†’ signed receipt with beneficiary attribution
282
- const receipt = await completeCheckout(session.id, {
283
- paymentToken: sharedPaymentToken,
284
- agentKeys: agent.keys,
285
- delegation
286
- })
287
-
288
- // Verify any commerce receipt (tamper-proof)
289
- const valid = verifyCommerceReceipt(receipt)
290
- // โ†’ true (Ed25519 signature over canonical JSON)
291
-
292
- // Track spending against delegation limits
293
- const summary = getSpendSummary(delegation, allReceipts)
294
- // โ†’ { limit: 500, spent: 49.99, remaining: 450.01, utilization: '10.0%', nearLimit: false }
65
+ // result.executed = true
66
+ // result.proof = { requestSignature, decisionSignature, receiptSignature } โ† 3-sig chain
67
+ // result.receipt = signed, tamper-proof, links to delegation chain
68
+ // result.tierCheck = reputation tier was sufficient
295
69
  ```
296
70
 
297
- **4-gate enforcement pipeline:** Every purchase passes through passport verification (Ed25519 signature), delegation scope check (must have `commerce:checkout`), spend limit enforcement (amount โ‰ค remaining budget), and optional merchant allowlist. Agents cannot bypass gates โ€” the cryptography prevents it.
71
+ **What just happened:** The gateway verified the agent's identity, checked delegation scope, enforced spend limits, evaluated values floor compliance, verified reputation tier, checked revocation status, executed the tool, generated a signed receipt, and updated reputation. All in one call. The agent never touched the tool directly.
298
72
 
299
- **Human approval thresholds:** Purchases above a configurable amount require explicit human confirmation. The agent generates an approval request; the human signs it. No unsigned approvals accepted.
73
+ ## Identity Is the Foundation, Not the Product
300
74
 
301
- **Beneficiary attribution:** Every purchase receipt traces back to a human principal through the delegation chain. Who authorized the spend, under what limits, and who benefits โ€” cryptographically provable.
75
+ Everything above is built on Ed25519 cryptographic identity. But identity is the plumbing, not the value proposition.
302
76
 
303
- ## Architecture
77
+ ```typescript
78
+ // Identity creation is two lines
79
+ const keys = generateKeyPair()
80
+ const agent = joinSocialContract({ name: 'my-agent', owner: 'alice', floor: floorYaml })
304
81
 
305
- ```
306
- โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
307
- โ”‚ Layer 8: Agentic Commerce (ACP) โ”‚
308
- โ”‚ 4-gate preflight ยท Spend tracking ยท Human โ”‚
309
- โ”‚ approval ยท Signed receipts ยท Beneficiary trace โ”‚
310
- โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
311
- โ”‚ Layer 7: Coordination Primitives โ”‚
312
- โ”‚ Task briefs ยท Role assignment ยท Evidence ยท โ”‚
313
- โ”‚ Review gates ยท Handoffs ยท Deliverables ยท Metricsโ”‚
314
- โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
315
- โ”‚ Layer 6: Cascade Revocation & Policy Engine โ”‚
316
- โ”‚ 3-signature chain ยท Chain tracking ยท Batch โ”‚
317
- โ”‚ revoke ยท Validation events ยท Policy receipts โ”‚
318
- โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
319
- โ”‚ Layer 5: Intent Architecture โ”‚
320
- โ”‚ Roles ยท Tradeoff rules ยท Deliberative โ”‚
321
- โ”‚ consensus ยท Precedent memory ยท Signed outcomes โ”‚
322
- โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
323
- โ”‚ Layer 4: Agent Agora โ”‚
324
- โ”‚ Ed25519 signed messages ยท Registry ยท โ”‚
325
- โ”‚ Threading ยท Public observability โ”‚
326
- โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
327
- โ”‚ Layer 3: Beneficiary Attribution โ”‚
328
- โ”‚ Merkle proofs ยท Configurable weights ยท โ”‚
329
- โ”‚ O(log n) verification ยท Anti-gaming โ”‚
330
- โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
331
- โ”‚ Layer 2: Human Values Floor โ”‚
332
- โ”‚ 8 principles ยท 5 enforced ยท Attestation ยท โ”‚
333
- โ”‚ Compliance verification ยท Agent negotiation โ”‚
334
- โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
335
- โ”‚ Layer 1: Agent Passport Protocol โ”‚
336
- โ”‚ Ed25519 identity ยท Scoped delegation ยท โ”‚
337
- โ”‚ Signed receipts ยท Revocation ยท Reputation โ”‚
338
- โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
82
+ // The value is what you do WITH identity:
83
+ // โ†’ Scoped delegation with spend limits and time bounds
84
+ // โ†’ Cascade revocation that propagates through chains
85
+ // โ†’ Reputation scoring that gates authority
86
+ // โ†’ Values floor enforcement at execution time
87
+ // โ†’ Beneficiary attribution via Merkle proofs
88
+ // โ†’ Commerce gates that prevent unauthorized purchases
339
89
  ```
340
90
 
341
- **Layer 1 โ€” Identity & Accountability.** Ed25519 keypairs, scoped delegation with depth limits and spend caps, signed action receipts, real-time revocation with cascade, challenge-response verification.
91
+ ## The Stack
342
92
 
343
- **Layer 2 โ€” Human Values Floor.** Eight universal principles. Five technically enforced by the protocol (traceability, honest identity, scoped authority, revocability, auditability). Two attested through cryptographic commitment. Compliance verifiable against receipts. Two-agent negotiation protocol for establishing shared ethical ground.
93
+ 42 core modules + 32 v2 constitutional modules. 1507 tests. Zero heavy dependencies.
344
94
 
345
- **Layer 3 โ€” Beneficiary Attribution.** Every agent action traces to a human through the delegation chain. SHA-256 Merkle trees commit to receipt sets in 32 bytes. 100,000 receipts โ†’ provable with ~17 hashes. Configurable scope weights per domain. Logarithmic spend normalization prevents gaming.
95
+ | Layer | What it does | Key primitive |
96
+ |-------|-------------|---------------|
97
+ | **Enforcement Gateway** | Sits between agent and tools. Checks every constraint. Executes, generates receipts. | `ProxyGateway` โ€” 6 enforcement properties, replay protection, revocation recheck |
98
+ | **Reputation & Trust** | Bayesian scoring, authority tiers, evidence-weighted. Agents earn trust, don't claim it. | `ScopedReputation`, `AuthorityTier`, configurable decay |
99
+ | **Agentic Commerce** | 4-gate checkout, spend tracking, human approval thresholds, beneficiary attribution. | `commercePreflight`, `CommerceActionReceipt` |
100
+ | **Coordination** | Task briefs, evidence submission, review gates, handoffs, deliverables, metrics. | `TaskUnit` lifecycle with integrity validation |
101
+ | **Intent & Policy** | Roles, tradeoff rules, deliberative consensus, 3-signature policy chain. | `ActionIntent` โ†’ `PolicyDecision` โ†’ `ActionReceipt` |
102
+ | **Values Floor** | 8 principles (5 enforced, 3 attested). Graduated enforcement: inline/audit/warn. | `FloorAttestation`, compliance verification |
103
+ | **Communication** | Ed25519-signed messages, registry, threading, topic filtering. | `SignedAgoraMessage`, tamper detection |
104
+ | **Identity** | Ed25519 keypairs, scoped delegation, cascade revocation, key rotation. | `SignedPassport`, `Delegation`, `RevocationRecord` |
346
105
 
347
- **Layer 4 โ€” Signed Communication (Agora).** Signed communication protocol where every message is Ed25519 signed by the author's passport key. Each deployment runs its own instance with complete data isolation โ€” there is no shared global feed. Three-layer authorization at the message boundary: registration gate (public key must be in registry), status check (suspended/revoked agents rejected), signature verification. Agent registry for membership verification. Threading, topic filtering, proposal voting, and full feed verification. The AEOESS project instance is at [aeoess.com/agora](https://aeoess.com/agora.html).
106
+ **Extended modules (9-42):** W3C DID (`did:aps`), Verifiable Credentials, A2A Bridge, EU AI Act Compliance, Agent Context, Task Routing, Cross-Chain Data Flow (taint tracking, confused deputy prevention), E2E Encrypted Messaging (X25519 + XSalsa20), Obligations, Governance Provenance, Identity Continuity & Key Rotation, Receipt Ledger (Merkle-committed audit batches), Feasibility Linting, Precedent Control, Re-anchoring, Bounded Escalation, Oracle Witness Diversity, Messaging Audit Bridge, Policy Conflict Detection, Data Source Registration, Decision Semantics, ProxyGateway.
348
107
 
349
- **Layer 5 โ€” Intent Architecture.** Context tells agents what they know. Intent tells them what to care about. Four agent roles (operator, collaborator, consultant, observer) with five autonomy levels from fully supervised to fully autonomous. Machine-readable intent documents encode organizational goals with quantified tradeoff rules: "when quality and speed conflict, prefer quality until 2ร— time cost, then prefer speed." Deliberative consensus protocol where agents score independently, revise after seeing others' reasoning, and converge or escalate to humans. Every resolved deliberation becomes a citable precedent. The `IntentPassportExtension` bridges Layer 1 identity with Layer 5 governance โ€” no role without a passport, no autonomy without accountability.
350
-
351
- **Layer 6 โ€” Cascade Revocation & Policy Engine.** Three-signature action chain: agent creates intent, policy validator evaluates against floor principles and delegation scope, agent executes and signs receipt. Parentโ†’child chain registry tracks all delegation relationships. Revoking a parent automatically cascade-revokes all descendants. Batch revocation by agent ID. Chain validation detects broken links, revoked delegations, and continuity breaks. Revocation events emitted for real-time monitoring.
352
-
353
- **Layer 7 โ€” Coordination Primitives.** Protocol-native multi-agent task orchestration. Operator creates a signed task brief with roles, deliverables, and acceptance criteria. Agents are assigned to roles and sign acceptance. Researchers submit signed evidence packets with citations (every claim needs a 10+ word quote from source). Operator reviews evidence against a quality threshold โ€” cannot approve below threshold, forcing rework. Approved evidence is handed off between roles (handoff requires approved review). Analysts submit deliverables citing evidence packets. Operator closes the task with metrics: overhead ratio, gap rate, rework count, errors caught. Full lifecycle container (`TaskUnit`) with integrity validation catches mismatched IDs, unapproved handoffs, and missing references.
354
-
355
- **Layer 8 โ€” Agentic Commerce (ACP by OpenAI + Stripe).** Implements the [Agentic Commerce Protocol](https://openai.com/index/agentic-commerce-protocol/) identity and governance layer. 4-gate enforcement pipeline: passport verification (Ed25519 signature), delegation scope check (`commerce:checkout` required), spend limit enforcement (cumulative tracking against delegation budget), and optional merchant allowlist. Human approval thresholds prevent autonomous high-value purchases โ€” agents generate signed approval requests, humans must countersign. Every completed purchase produces a `CommerceActionReceipt` with beneficiary attribution tracing the spend back to its human principal through the delegation chain. Spend analytics with utilization warnings at 80%. 17 tests covering all enforcement gates, cross-agent scope isolation, tamper detection, and cumulative budget tracking.
356
-
357
- ## Human Values Floor โ€” v0.1
358
-
359
- | ID | Principle | Enforcement |
360
- |---|---|---|
361
- | F-001 | Traceability | ๐Ÿ”’ Technical โ€” delegation chains |
362
- | F-002 | Honest Identity | ๐Ÿ”’ Technical โ€” passport verification |
363
- | F-003 | Scoped Authority | ๐Ÿ”’ Technical โ€” delegation scope limits |
364
- | F-004 | Revocability | ๐Ÿ”’ Technical โ€” revocation registry |
365
- | F-005 | Auditability | ๐Ÿ”’ Technical โ€” signed receipts |
366
- | F-006 | Non-Deception | ๐Ÿ“ Attested โ€” reasoning-level |
367
- | F-007 | Proportionality | ๐Ÿ“ Attested โ€” reputation context |
368
- | F-008 | Critical Thinking | ๐Ÿ“ Attested โ€” hostile review posture |
369
-
370
- Full manifest: [`values/floor.yaml`](values/floor.yaml)
371
-
372
- ## V2 Constitutional Framework (32 modules)
373
-
374
- Full constitutional governance for AI agent systems. Designed through cross-model adversarial review (Claude, GPT, Gemini attacking the protocol simultaneously). Every gap identified was implemented and tested.
375
-
376
- **Core governance (7):** v1โ†”v2 bridge, delegation versioning, outcome registration, anomaly detection, emergency pathways, fork-and-sunset migration, contextual attestation.
377
-
378
- **Attack defenses (9):** Approval fatigue detection, effect enforcement (declared vs actual outcomes), semantic drift detection, composite workflow audit (authority laundering), cascade correlation, inaction auditing, values override with justification review, governance drift tracking, emergence detection.
379
-
380
- **Structural safeguards (14):** Separation of powers, constitutional amendment, policy profiles, affected-party standing, circuit breakers, epistemic isolation, root authority transition, intent binding, effect sampling, output proportionality, blind evaluation, externality accounting, semantic scoping, cross-chain audit.
381
-
382
- ```typescript
383
- import { separationOfPowers, circuitBreakers, approvalFatigue } from 'agent-passport-system'
384
-
385
- // Enforce branch separation
386
- const { assignToBranch, detectConflict } = separationOfPowers()
387
- assignToBranch('agent-alpha', 'executive')
388
- // detectConflict('agent-alpha', 'legislative') โ†’ true (blocked)
389
-
390
- // Auto-suspend on threshold breach
391
- const breaker = circuitBreakers.defineBreaker({
392
- category: 'commerce', threshold: 5, window_seconds: 3600
393
- })
394
- ```
395
-
396
- Source: [`src/v2/`](src/v2/) (32 modules) | Tests: `tests/v2-constitutional.test.ts`, `tests/v2-gaps.test.ts`, `tests/v2-constitutional-mini.test.ts`
108
+ **V2 Constitutional Framework (32 modules):** Designed through cross-model adversarial review. PolicyContext with mandatory sunset, Delegation Versioning, Outcome Registration, Anomaly Detection, Emergency Pathways, Migration (fork-and-sunset), Contextual Attestation, Approval Fatigue Detection, Effect Enforcement, Emergence Detection, Separation of Powers, Constitutional Amendment, Circuit Breakers, Epistemic Isolation, and 18 more. Source: [`src/v2/`](src/v2/).
397
109
 
398
110
  ## MCP Server
399
111
 
400
- The protocol ships with a coordination-native MCP server โ€” any MCP client (Claude Desktop, Cursor, etc.) can connect agents directly.
112
+ 108 tools across all modules. Any MCP client connects agents directly.
401
113
 
402
114
  ```bash
403
115
  npm install -g agent-passport-system-mcp
404
116
  npx agent-passport-system-mcp setup
405
117
  ```
406
118
 
407
- Or zero-install remote mode:
408
- ```bash
409
- npx agent-passport-system-mcp setup --remote
410
- ```
411
-
412
- **108 tools across all 48 modules, role-scoped access control.** Identity, delegation, agora, values/policy, coordination, and commerce โ€” all accessible via MCP. Every operation Ed25519 signed. Auto-configures Claude Desktop and Cursor.
413
-
414
- Every operation is Ed25519 signed. Role is auto-detected from task assignments. Role-specific prompts served via MCP prompts API. File-backed task persistence at `~/.agent-passport-tasks.json`.
119
+ Every operation Ed25519 signed. Role-scoped access control. Auto-configures Claude Desktop and Cursor.
415
120
 
416
121
  npm: [agent-passport-system-mcp](https://www.npmjs.com/package/agent-passport-system-mcp) ยท GitHub: [aeoess/agent-passport-mcp](https://github.com/aeoess/agent-passport-mcp)
417
122
 
418
123
  ## Python SDK
419
124
 
420
- Full Python implementation with cross-language compatibility. Signatures created in Python verify in TypeScript and vice versa.
125
+ Full Python implementation. Signatures created in Python verify in TypeScript and vice versa.
421
126
 
422
127
  ```bash
423
128
  pip install agent-passport-system
424
129
  ```
425
130
 
426
- All 8 foundational layers plus Principal Identity. 86 tests. Same canonical JSON serialization and Ed25519 signatures. Extended modules in progress.
427
-
428
131
  PyPI: [agent-passport-system](https://pypi.org/project/agent-passport-system/) ยท GitHub: [aeoess/agent-passport-python](https://github.com/aeoess/agent-passport-python)
429
132
 
430
- ## Tests
133
+ ## CLI
134
+
135
+ 14 commands: `join`, `delegate`, `work`, `prove`, `audit`, `verify`, `inspect`, `status`, `agora post`, `agora read`, `agora list`, `agora verify`, `agora register`, `agora topics`.
431
136
 
432
137
  ```bash
433
- npm test
434
- # 1480 tests across 58 files, 384 suites, 0 failures
138
+ npx agent-passport join --name my-agent --owner alice --floor values/floor.yaml
139
+ npx agent-passport work --scope code_execution --result success --summary "Built the feature"
140
+ npx agent-passport audit --floor values/floor.yaml
435
141
  ```
436
142
 
437
- Includes 50 adversarial tests across 4 test files: Merkle tree tampering, attribution gaming resistance, compliance violations, floor negotiation attacks, wrong-key attestations, cross-chain confused deputy, taint laundering, permit bypass, causal chain manipulation.
438
-
439
- 15 Agora-specific tests: message signing, tamper detection, registry membership, feed operations, threading, full feed verification.
440
-
441
- 17 coordination tests: task brief creation/verification, role assignment, evidence submission, review gates (score vs threshold), handoff enforcement (requires approved review), deliverable submission, full lifecycle, task unit validation.
442
-
443
- 17 commerce tests: delegation creation with commerce scopes, 4-gate preflight (passport, scope, spend, merchant), spend analytics, human approval request generation, receipt signing/verification, tamper detection, cross-agent scope enforcement, cumulative spend tracking.
444
-
445
- ## Paper
446
-
447
- **"The Agent Social Contract: Cryptographic Identity, Ethical Governance, and Beneficiary Economics for Autonomous AI Agents"**
143
+ ## Tests
448
144
 
449
- By Tymofii Pidlisnyi โ€” Published on Zenodo
145
+ ```bash
146
+ npm test
147
+ # 1507 tests across 79 files, 392 suites, 0 failures
148
+ ```
450
149
 
451
- [Read the paper โ†’](papers/agent-social-contract.md)
150
+ 50 adversarial tests: Merkle tampering, attribution gaming, compliance violations, floor negotiation attacks, cross-chain confused deputy, taint laundering, authority probing.
452
151
 
453
152
  ## How It Compares
454
153
 
455
- | | Social Contract | DeepMind | GaaS | OpenAI | LOKA |
154
+ | | APS | DeepMind | GaaS | OpenAI | LOKA |
456
155
  |---|---|---|---|---|---|
457
156
  | Status | Running code | Paper | Simulated | Advisory | Paper |
157
+ | Enforcement gateway | 6 properties, replay protection | โ€” | โ€” | โ€” | โ€” |
158
+ | Reputation/trust scoring | Bayesian + tiers | โ€” | โ€” | โ€” | Consensus |
458
159
  | Identity | Ed25519 | Proposed | External | โ€” | Proposed |
459
- | Delegation depth | Configurable | Proposed | N/A | โ€” | Consensus |
460
- | Action receipts | Signed + verifiable | Proposed | Logs | General | โ€” |
461
- | Values layer | Attested + auditable | โ€” | Rules | โ€” | โ€” |
462
- | Attribution | Merkle proofs | โ€” | โ€” | โ€” | โ€” |
463
- | Communication | Signed Agora | โ€” | โ€” | โ€” | โ€” |
464
- | Coordination | Task units + MCP server | โ€” | โ€” | โ€” | โ€” |
465
- | Commerce | ACP + 4-gate enforcement | โ€” | โ€” | โ€” | โ€” |
466
- | Tests | 1081 (50 adversarial) | None | Limited | None | None |
467
- | Dependencies | Node.js crypto + uuid | โ€” | Multi-LLM | โ€” | Consensus network |
468
-
469
- ## Structure
470
-
471
- ```
472
- src/ 32 source files
473
- contract.ts โ€” High-level API (6 functions)
474
- core/
475
- passport.ts โ€” Ed25519 identity
476
- delegation.ts โ€” Scoped delegation, receipts, cascade revocation
477
- canonical.ts โ€” Deterministic JSON serialization
478
- values.ts โ€” Floor attestation, compliance, negotiation
479
- attribution.ts โ€” Merkle trees, beneficiary tracing
480
- agora.ts โ€” Protocol-native signed communication
481
- intent.ts โ€” Intent architecture, deliberation, roles
482
- policy.ts โ€” 3-signature chain, policy validation
483
- coordination.ts โ€” Task briefs, evidence, review, handoff, deliverables
484
- integration.ts โ€” Cross-layer bridges
485
- commerce.ts โ€” ACP checkout, 4-gate enforcement, spend tracking
486
- context.ts โ€” Agent context enforcement middleware
487
- routing.ts โ€” Task routing protocol
488
- did.ts โ€” W3C DID method (did:aps)
489
- vc.ts โ€” Verifiable Credentials
490
- a2a.ts โ€” Google A2A bridge
491
- euaiact.ts โ€” EU AI Act compliance
492
- principal.ts โ€” Principal identity, endorsement, fleet
493
- reputation-authority.ts โ€” Bayesian trust, tier authority, promotions
494
- gateway.ts โ€” ProxyGateway enforcement boundary
495
- cross-chain.ts โ€” Taint tracking, confused deputy prevention, SAOs
496
- encrypted-messaging.ts โ€” E2E encrypted Agora messages (X25519 + XSalsa20)
497
- obligations.ts โ€” Duties on delegations, penalty severity narrowing
498
- execution-envelope.ts โ€” Cross-engine signed execution envelopes
499
- intent-network.ts โ€” IntentCards, semantic matching, introductions
500
- governance.ts โ€” Governance artifact provenance, weakening controls
501
- identity.ts โ€” Key rotation with continuity proofs
502
- receipt-ledger.ts โ€” Merkle-committed audit batches
503
- feasibility.ts โ€” Preflight linting for delegations and tasks
504
- precedent.ts โ€” Normative precedent library, drift detection
505
- reanchor.ts โ€” Delegation re-anchoring to DIDs
506
- escalation.ts โ€” Bounded escalation (4th attenuation invariant)
507
- oracle-witness.ts โ€” Oracle witness diversity (Shannon entropy Sybil resistance)
508
- messaging-audit.ts โ€” Encrypted messaging audit bridge
509
- policy-conflict.ts โ€” Policy conflict detection (DFS cycle/deadlock)
510
- data-source.ts โ€” Data source registration & access receipts (Module 36A)
511
- cli/
512
- index.ts โ€” CLI (14 commands)
513
- crypto/
514
- keys.ts โ€” Ed25519 primitives
515
- types/
516
- passport.ts โ€” Layers 1โ€“3 types
517
- agora.ts โ€” Layer 4 types
518
- intent.ts โ€” Layer 5 types
519
- policy.ts โ€” Layer 6 types
520
- coordination.ts โ€” Layer 7 types
521
- commerce.ts โ€” Layer 8 types
522
- context.ts โ€” Agent context types
523
- routing.ts โ€” Routing types
524
- did.ts โ€” DID/VC types
525
- euaiact.ts โ€” EU AI Act types
526
- principal.ts โ€” Principal identity types
527
- reputation-authority.ts โ€” Reputation/tier types
528
- cross-chain.ts โ€” Cross-chain taint/SAO types
529
- data-source.ts โ€” Data source/access receipt types
530
- tests/ 78 test files, 1480 tests (384 suites)
531
- adversarial.ts โ€” 50 adversarial cases
532
- adversarial-paper.test.ts โ€” 22 paper-linked attack scenarios
533
- adversarial-causal-chain.test.ts โ€” 18 causal chain attacks
534
- adversarial-audit-v2.test.ts โ€” 10 gateway audit attack vectors
535
- agora.test.ts โ€” 15 Agora tests
536
- contract.test.ts โ€” High-level API tests
537
- passport.test.ts โ€” v1.0 primitives
538
- v1.1-integration.ts โ€” Delegation chains, receipts, revocation
539
- v2.0-integration.ts โ€” Full-stack integration (7 acts)
540
- values.test.ts โ€” Floor loading, attestation, compliance
541
- delegation.test.ts โ€” Delegation, sub-delegation, depth limits
542
- attribution.test.ts โ€” Merkle trees, attribution, collaboration
543
- policy.test.ts โ€” Intent, policy decision, 3-sig chain
544
- cascade.test.ts โ€” Chain registry, cascade revocation, batch
545
- coordination.test.ts โ€” Task briefs, evidence, review, handoff, lifecycle
546
- commerce.test.ts โ€” ACP checkout, 4-gate preflight, spend tracking
547
- data-source.test.ts โ€” Source registration, access receipts, terms compliance
548
- interop-vectors.test.ts โ€” Ed25519โ†’X25519 qntm compatibility (5 vectors)
549
- values/
550
- floor.yaml โ€” Human Values Floor manifest
551
- papers/
552
- agent-social-contract.md
553
- ```
160
+ | Delegation | Scoped + cascade revoke | Proposed | N/A | โ€” | โ€” |
161
+ | Commerce | 4-gate + spend tracking | โ€” | โ€” | โ€” | โ€” |
162
+ | Signed receipts | 3-sig chain | Proposed | Logs | General | โ€” |
163
+ | Values enforcement | 8 principles, graduated | โ€” | Rules | โ€” | โ€” |
164
+ | Coordination | Task lifecycle + MCP | โ€” | โ€” | โ€” | โ€” |
165
+ | Tests | 1507 (50 adversarial) | None | Limited | None | None |
554
166
 
555
167
  ## Recognition
556
168
 
@@ -559,26 +171,24 @@ papers/
559
171
  - Collaboration with IETF DAAP draft author (draft-mishra-oauth-agent-grants-01) on delegation spec
560
172
  - Listed on [MCP Registry](https://registry.modelcontextprotocol.io)
561
173
  - Endorsed by Garry Tan (CEO, Y Combinator)
562
- - [AMCS โ€” AI-Native Media Credentialing Standard](https://aeoess.com/amcs.html) published, with The Agent Times as reference implementation
174
+ - [AMCS โ€” AI-Native Media Credentialing Standard](https://aeoess.com/amcs.html) published
175
+
176
+ ## Paper
177
+
178
+ **"Monotonic Narrowing for Agent Authority"** โ€” Published on [Zenodo](https://doi.org/10.5281/zenodo.18749779). [Read โ†’](papers/agent-social-contract.md)
563
179
 
564
180
  ## Authorship
565
181
 
566
- Designed and built by **Tymofii Pidlisnyi** with AI assistance from **Claude** (Anthropic) through human-AI collaboration as described in the paper.
182
+ Designed and built by **Tymofii Pidlisnyi** with AI assistance from **Claude** (Anthropic).
567
183
 
568
- Protocol page: [aeoess.com/protocol.html](https://aeoess.com/protocol.html)
569
- Agora: [aeoess.com/agora.html](https://aeoess.com/agora.html)
570
- npm: [npmjs.com/package/agent-passport-system](https://www.npmjs.com/package/agent-passport-system)
571
- MCP server: [npmjs.com/package/agent-passport-system-mcp](https://www.npmjs.com/package/agent-passport-system-mcp)
184
+ Protocol: [aeoess.com/protocol.html](https://aeoess.com/protocol.html) ยท Agora: [aeoess.com/agora.html](https://aeoess.com/agora.html) ยท npm: [agent-passport-system](https://www.npmjs.com/package/agent-passport-system) ยท MCP: [agent-passport-system-mcp](https://www.npmjs.com/package/agent-passport-system-mcp)
572
185
 
573
186
  ## LLM Documentation
574
187
 
575
- Machine-readable docs following the [llms.txt standard](https://llmstxt.org):
576
-
577
188
  - Index: [aeoess.com/llms.txt](https://aeoess.com/llms.txt)
578
189
  - Full docs: [aeoess.com/llms-full.txt](https://aeoess.com/llms-full.txt)
579
190
  - Quick start: [aeoess.com/llms/quickstart.txt](https://aeoess.com/llms/quickstart.txt)
580
191
  - API reference: [aeoess.com/llms/api.txt](https://aeoess.com/llms/api.txt)
581
- - CLI reference: [aeoess.com/llms/cli.txt](https://aeoess.com/llms/cli.txt)
582
192
 
583
193
  ## License
584
194