@agenticprimitives/devkit 0.0.0-alpha.2 → 0.0.0-alpha.21

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.
Files changed (41) hide show
  1. package/README.md +50 -0
  2. package/bin/ap.mjs +645 -6
  3. package/dist/config.js +11 -11
  4. package/dist/config.js.map +1 -1
  5. package/dist/definitions.d.ts +85 -0
  6. package/dist/definitions.d.ts.map +1 -0
  7. package/dist/definitions.js +90 -0
  8. package/dist/definitions.js.map +1 -0
  9. package/dist/developer-mcp.d.ts +16 -0
  10. package/dist/developer-mcp.d.ts.map +1 -0
  11. package/dist/developer-mcp.js +215 -0
  12. package/dist/developer-mcp.js.map +1 -0
  13. package/dist/dispatch.d.ts +156 -0
  14. package/dist/dispatch.d.ts.map +1 -1
  15. package/dist/dispatch.js +55 -1
  16. package/dist/dispatch.js.map +1 -1
  17. package/dist/index.d.ts +8 -3
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/index.js +6 -2
  20. package/dist/index.js.map +1 -1
  21. package/dist/lock.d.ts +4 -0
  22. package/dist/lock.d.ts.map +1 -1
  23. package/dist/lock.js +2 -1
  24. package/dist/lock.js.map +1 -1
  25. package/dist/rules/no-cross-subject-vault-reads.d.ts.map +1 -1
  26. package/dist/rules/no-cross-subject-vault-reads.js +2 -1
  27. package/dist/rules/no-cross-subject-vault-reads.js.map +1 -1
  28. package/dist/rules/web-no-direct-mcp.d.ts.map +1 -1
  29. package/dist/rules/web-no-direct-mcp.js +2 -1
  30. package/dist/rules/web-no-direct-mcp.js.map +1 -1
  31. package/dist/rules-projection.d.ts.map +1 -1
  32. package/dist/rules-projection.js +5 -1
  33. package/dist/rules-projection.js.map +1 -1
  34. package/dist/upgrade.d.ts +10 -0
  35. package/dist/upgrade.d.ts.map +1 -1
  36. package/dist/upgrade.js +111 -4
  37. package/dist/upgrade.js.map +1 -1
  38. package/package.json +31 -8
  39. package/rules/hard-rules.md +3 -3
  40. package/rules/service-agent-birthrights.md +76 -0
  41. package/rules/vault-is-the-record-apps-hold-references.md +47 -0
package/dist/upgrade.js CHANGED
@@ -1,13 +1,85 @@
1
- // `ap upgrade --canary | --pin <version|tag>` — spec 399 §3.1 / §5.2. Rewrites every @agenticprimitives/* dependency
1
+ // `ap upgrade --canary | --pin <version|tag|newest>` — spec 399 §3.1 / §5.2. Rewrites every @agenticprimitives/* dependency
2
2
  // across the workspace manifests to ONE coherent exact set, then the caller installs, dedupes and runs doctor.
3
3
  // Planning is pure over an injected resolver; applying writes manifests and the lock. Stopping for review when a
4
- // contract's authority or effects change (398 §10.3) is NOT implemented in W0 — see CLAUDE.md, it is named there.
4
+ // contract's authority or effects change (398 §10.3) is `src/definitions.ts` + the CLI's definitions review, G3.
5
5
  import { readFileSync, writeFileSync } from 'node:fs';
6
6
  import { join } from 'node:path';
7
7
  import { execFileSync } from 'node:child_process';
8
8
  import { DevkitError, ERROR_CODES } from './errors.js';
9
9
  import { readLock, writeLock } from './lock.js';
10
10
  import { workspaceManifests } from './workspace.js';
11
+ export const npmVersions = async (pkg) => {
12
+ try {
13
+ const out = execFileSync('npm', ['view', pkg, 'versions', '--json'], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] });
14
+ const v = JSON.parse(out);
15
+ return Array.isArray(v) ? v : [v];
16
+ }
17
+ catch (e) {
18
+ throw new DevkitError(ERROR_CODES.E_RESOLVE, `npm view ${pkg} versions failed: ${e.message.split('\n')[0]}`);
19
+ }
20
+ };
21
+ /** `--pin newest`: the highest published version by semver — never a dist-tag, which can lag (`latest` sat on an
22
+ * older alpha and `--pin latest` moved a product BACKWARDS, 2026-10-08). Canary and stage builds are not candidates. */
23
+ export const NEWEST = 'newest';
24
+ export function newestOf(versions) {
25
+ const parse = (v) => {
26
+ const m = /^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?$/.exec(v);
27
+ if (!m)
28
+ return null;
29
+ const pre = m[4]?.split('.') ?? [];
30
+ if (pre.some((x) => /canary|stage/i.test(x)))
31
+ return null;
32
+ return { nums: [Number(m[1]), Number(m[2]), Number(m[3])], pre };
33
+ };
34
+ const cmpPre = (a, b) => {
35
+ if (a.length === 0 && b.length === 0)
36
+ return 0;
37
+ if (a.length === 0)
38
+ return 1; // a release outranks any prerelease of the same triple
39
+ if (b.length === 0)
40
+ return -1;
41
+ for (let i = 0; i < Math.max(a.length, b.length); i++) {
42
+ const x = a[i];
43
+ const y = b[i];
44
+ if (x === undefined)
45
+ return -1;
46
+ if (y === undefined)
47
+ return 1;
48
+ const nx = /^\d+$/.test(x) ? Number(x) : null;
49
+ const ny = /^\d+$/.test(y) ? Number(y) : null;
50
+ if (nx !== null && ny !== null) {
51
+ if (nx !== ny)
52
+ return nx - ny;
53
+ continue;
54
+ }
55
+ if (nx !== null)
56
+ return -1;
57
+ if (ny !== null)
58
+ return 1;
59
+ if (x !== y)
60
+ return x < y ? -1 : 1;
61
+ }
62
+ return 0;
63
+ };
64
+ let best = null;
65
+ for (const v of versions) {
66
+ const p = parse(v);
67
+ if (!p)
68
+ continue;
69
+ if (!best) {
70
+ best = { v, p };
71
+ continue;
72
+ }
73
+ let c = 0;
74
+ for (let i = 0; i < 3 && c === 0; i++)
75
+ c = p.nums[i] - best.p.nums[i];
76
+ if (c === 0)
77
+ c = cmpPre(p.pre, best.p.pre);
78
+ if (c > 0)
79
+ best = { v, p };
80
+ }
81
+ return best?.v ?? null;
82
+ }
11
83
  export const npmDistTags = async (pkg) => {
12
84
  try {
13
85
  const out = execFileSync('npm', ['view', pkg, 'dist-tags', '--json'], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] });
@@ -18,12 +90,16 @@ export const npmDistTags = async (pkg) => {
18
90
  }
19
91
  };
20
92
  const EXACT = /^\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?$/;
93
+ /** The change field for a root `pnpm.overrides` entry (a manifest field name, read and written in place). */
94
+ export const OVERRIDES_FIELD = 'pnpm.overrides';
95
+ const overridesOf = (json) => (json.pnpm?.overrides ?? {});
21
96
  export async function planUpgrade(opts) {
22
97
  const scope = opts.scope ?? '@agenticprimitives/';
23
98
  const target = opts.mode === 'canary' ? 'canary' : opts.pin ?? '';
24
99
  if (opts.mode === 'pin' && !target)
25
- throw new DevkitError(ERROR_CODES.E_USAGE, '--pin needs a version or a dist-tag (latest | alpha | canary | 1.2.3)');
100
+ throw new DevkitError(ERROR_CODES.E_USAGE, '--pin needs a version, a dist-tag or newest (newest | latest | alpha | canary | 1.2.3)');
26
101
  const resolve = opts.resolveDistTags ?? npmDistTags;
102
+ const resolveVersions = opts.resolveVersions ?? npmVersions;
27
103
  const manifests = workspaceManifests(opts.root);
28
104
  const deps = new Set();
29
105
  for (const m of manifests)
@@ -36,6 +112,13 @@ export async function planUpgrade(opts) {
36
112
  deps.add(dep);
37
113
  }
38
114
  }
115
+ // A root `pnpm.overrides` entry pins a package for EVERY workspace member — it is the one place a product keeps a
116
+ // cohort (verifiable-content-demo), and left alone it silently held service-host's a2a five alphas back on
117
+ // 2026-10-09. It is upgraded with the rest.
118
+ for (const m of manifests)
119
+ for (const dep of Object.keys(overridesOf(m.json)))
120
+ if (dep.startsWith(scope))
121
+ deps.add(dep);
39
122
  const resolved = {};
40
123
  const unresolved = [];
41
124
  const notes = [];
@@ -44,6 +127,23 @@ export async function planUpgrade(opts) {
44
127
  resolved[dep] = target;
45
128
  continue;
46
129
  }
130
+ if (opts.mode === 'pin' && target === NEWEST) {
131
+ let versions;
132
+ try {
133
+ versions = await resolveVersions(dep);
134
+ }
135
+ catch (e) {
136
+ unresolved.push(`${dep}: ${e.message}`);
137
+ continue;
138
+ }
139
+ const v = newestOf(versions);
140
+ if (!v) {
141
+ unresolved.push(`${dep}: no published release or prerelease version (${versions.length} version(s), canary/stage excluded)`);
142
+ continue;
143
+ }
144
+ resolved[dep] = v;
145
+ continue;
146
+ }
47
147
  let tags;
48
148
  try {
49
149
  tags = await resolve(dep);
@@ -69,6 +169,13 @@ export async function planUpgrade(opts) {
69
169
  changes.push({ manifest: m.file, field, dep, from: spec, to });
70
170
  }
71
171
  }
172
+ for (const m of manifests)
173
+ for (const [dep, spec] of Object.entries(overridesOf(m.json))) {
174
+ const to = resolved[dep];
175
+ if (!to || spec === to)
176
+ continue;
177
+ changes.push({ manifest: m.file, field: OVERRIDES_FIELD, dep, from: spec, to });
178
+ }
72
179
  let coherent = true;
73
180
  if (opts.mode === 'canary') {
74
181
  const shas = new Set(Object.values(resolved).map((v) => /-canary-([0-9a-f]+)$/.exec(v)?.[1] ?? v));
@@ -88,7 +195,7 @@ export function applyUpgradePlan(root, plan, opts = {}) {
88
195
  const abs = join(root, file);
89
196
  const json = JSON.parse(readFileSync(abs, 'utf8'));
90
197
  for (const c of changes) {
91
- const section = json[c.field];
198
+ const section = c.field === OVERRIDES_FIELD ? overridesOf(json) : json[c.field];
92
199
  if (section && section[c.dep] !== undefined)
93
200
  section[c.dep] = c.to;
94
201
  }
@@ -1 +1 @@
1
- {"version":3,"file":"upgrade.js","sourceRoot":"","sources":["../src/upgrade.ts"],"names":[],"mappings":"AAAA,qHAAqH;AACrH,+GAA+G;AAC/G,iHAAiH;AACjH,kHAAkH;AAClH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAsB,MAAM,WAAW,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAwB,MAAM,gBAAgB,CAAC;AAoB1E,MAAM,CAAC,MAAM,WAAW,GAAoB,KAAK,EAAE,GAAG,EAAE,EAAE;IACxD,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,YAAY,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,WAA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OAAO,CAAC,EAAE,CAAC,CAAC;IACnD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,15 @@
1
1
  {
2
2
  "name": "@agenticprimitives/devkit",
3
- "version": "0.0.0-alpha.2",
3
+ "version": "0.0.0-alpha.21",
4
4
  "description": "The Developer Kit core (spec 398 §10 / spec 399 §3): `ap doctor` runs the doctrine gates as data + pure rules over any tree, `ap doctor --rules` projects one pinned rules source into AGENTS.md / CLAUDE.md / .cursor/rules by digest, `ap upgrade` rewrites every @agenticprimitives/* pin to one coherent exact set, and `ap conform` / `ap test` dispatch to the packages that own conformance and live gates.",
5
+ "homepage": "https://agenticprimitives.dev",
6
+ "bugs": {
7
+ "url": "https://github.com/agentictrustlabs/agenticprimitives/issues"
8
+ },
9
+ "author": {
10
+ "name": "Agentic Trust Labs",
11
+ "url": "https://agenticprimitives.dev"
12
+ },
5
13
  "license": "MIT",
6
14
  "repository": {
7
15
  "type": "git",
@@ -32,12 +40,15 @@
32
40
  "access": "public"
33
41
  },
34
42
  "dependencies": {
35
- "@agenticprimitives/capability-claims": "0.0.0-alpha.20"
43
+ "@agenticprimitives/capability-claims": "0.0.0-alpha.33",
44
+ "@agenticprimitives/mcp-protocol": "0.0.0-alpha.4"
36
45
  },
37
46
  "peerDependencies": {
38
- "@agenticprimitives/a2a": "0.0.0-alpha.20",
39
- "@agenticprimitives/evaluation": "0.0.0-alpha.2",
40
- "@agenticprimitives/mcp-protocol": "0.0.0-alpha.2"
47
+ "@agenticprimitives/a2a": "^0.0.0-alpha.35",
48
+ "@agenticprimitives/evaluation": "^0.0.0-alpha.6",
49
+ "@agenticprimitives/harness": "^0.0.0-alpha.16",
50
+ "@agenticprimitives/orchestration": "^0.0.0-alpha.14",
51
+ "@agenticprimitives/provenance-node": "^0.0.0-alpha.10"
41
52
  },
42
53
  "peerDependenciesMeta": {
43
54
  "@agenticprimitives/a2a": {
@@ -46,12 +57,19 @@
46
57
  "@agenticprimitives/evaluation": {
47
58
  "optional": true
48
59
  },
49
- "@agenticprimitives/mcp-protocol": {
60
+ "@agenticprimitives/harness": {
61
+ "optional": true
62
+ },
63
+ "@agenticprimitives/orchestration": {
64
+ "optional": true
65
+ },
66
+ "@agenticprimitives/provenance-node": {
50
67
  "optional": true
51
68
  }
52
69
  },
53
70
  "devDependencies": {
54
- "vitest": "^4.1.8"
71
+ "vitest": "^4.1.11",
72
+ "@agenticprimitives/harness": "0.0.0-alpha.16"
55
73
  },
56
74
  "keywords": [
57
75
  "agentic",
@@ -59,7 +77,12 @@
59
77
  "devkit",
60
78
  "doctor",
61
79
  "developer-kit",
62
- "cli"
80
+ "cli",
81
+ "agentic-primitives",
82
+ "agenticprimitives",
83
+ "ai-agents",
84
+ "agent-authority",
85
+ "agentic-trust"
63
86
  ],
64
87
  "scripts": {
65
88
  "sync-rules": "node scripts/sync-rules.mjs",
@@ -1,8 +1,8 @@
1
1
  # Hard rules (root CLAUDE.md)
2
2
 
3
3
  - **Smart Agent address is the canonical identifier.** Every person, org, service agent, and treasury IS its ERC-4337 SA address. Names, profiles, ERC-8004 entries, ANS handles, HCS topics — all facets pointing AT the canonical address. Cross-package APIs take `Address`, not names. See [ADR-0010](docs/architecture/decisions/0010-smart-agent-canonical-identifier.md) + [spec 220](specs/220-agent-identity-bootstrap.md) for the bootstrap process (deploy → forced-unique name → custody → optional facets).
4
- - **Every Smart Agent is a Person, an Organization, or a Service — nothing else.** PROV-O's trichotomy (`prov:Person`/`prov:Organization`/`prov:SoftwareAgent`), mirrored by `AgentType = 'person' | 'org' | 'service'` in `@agenticprimitives/types`. Treasury, indexer, relay, marketplace, data-source are **Service roles** (profile `serviceType` / app-level kinds), never new classes; UI groups by class and labels by role; app kinds map DOWN to a class, never up into the enum ([ADR-0046](docs/architecture/decisions/0046-agent-classification-person-org-service.md), specs 217/225 §6). **A demo person SA is never also their org SA** — do not reuse “his own SA” as the organization ([agent-rules/demo-person-org-distinct.md](docs/architecture/agent-rules/demo-person-org-distinct.md), `pnpm check:demo-person-org-distinct`).
5
- - **Canonical identity persists; credentials rotate.** Passkeys, SIWE EOAs, hardware wallets are control credential facets — replaceable, not the identity. Credential add / replace / remove is a custody-policy-governed operation (trustee quorum, guardian quorum, multi-credential self-recovery, or multi-sig), NEVER a delegation. The SA address NEVER changes during credential recovery. Delegations issued by the SA remain valid after rotation. See [ADR-0011](docs/architecture/decisions/0011-credential-recovery-and-re-association.md) + [spec 221](specs/221-credential-recovery.md).
4
+ - **Every Smart Agent is a Person, an Organization, or a Service — nothing else.** PROV-O's trichotomy (`prov:Person`/`prov:Organization`/`prov:SoftwareAgent`), mirrored by `AgentType = 'person' | 'org' | 'service'` in `@agenticprimitives/types`. Treasury, indexer, relay, marketplace, data-source are **Service roles** (profile `serviceType` / app-level kinds), never new classes; UI groups by class and labels by role; app kinds map DOWN to a class, never up into the enum ([ADR-0046](docs/architecture/decisions/0046-agent-classification-person-org-service.md), specs 217/225 §6). **A demo person SA is never also their org SA** — do not reuse “his own SA” as the organization ([agent-rules/demo-person-org-distinct.md](docs/architecture/agent-rules/demo-person-org-distinct.md); enforced in the product repos by the `ap doctor` rule `demo-person-org-distinct`).
5
+ - **Canonical identity persists; credentials rotate.** Passkeys, SIWE EOAs, hardware wallets are control credential facets — replaceable, not the identity. Credential add / replace / remove is a custody-policy-governed operation (trustee quorum, guardian quorum, multi-credential self-recovery, or multi-sig), NEVER a delegation. The SA address NEVER changes during credential recovery. **Every standing grant is re-approved by the ROTATION ceremony under the new custody epoch, and never by recovery** (spec 410 §1; the pre-epoch sentence "delegations remain valid after rotation" is retired): a rotation is `add → retire → approveDigest×N` in one transaction, a recovery is `add → retire → revokeAll` and the person re-issues from a reviewed list; only the account computes an approved-hash key (`approveDigest`), the registry is never an execute target. See [ADR-0011](docs/architecture/decisions/0011-credential-recovery-and-re-association.md) + [spec 221](specs/221-credential-recovery.md).
6
6
  - **Specs precede non-trivial code.** New `specs/2XX-*.md` before architecture changes; the spec is the architect-of-record.
7
7
  - **Always check smart-agent first.** Before designing any non-trivial capability look at the analog in `/home/barb/smart-agent`. New specs MUST include a "Reference: smart-agent patterns to port" section. Deliberate divergence must say why.
8
8
  - **Package boundaries** are one-directional: `types ← identity-auth ← agent-account ← delegation ← mcp-runtime`, plus `key-custody → delegation`, `tool-policy → mcp-runtime`, and the custody-layer fork `types ← custody` (depended on by `agent-account` and `delegation`; see [spec 213](specs/213-custody-layer-carve-out.md) for the firewall). No back-edges. `tool-policy` and `types` are transport-agnostic (no MCP/A2A/LangChain/Vercel imports).
@@ -41,7 +41,7 @@
41
41
  - **Per-package context budget:** `CLAUDE.md` ≤ 60 lines, `AUDIT.md` ≤ 150 lines, `README.md` ≤ 1800 words. If you're tempted to bloat one, fix the package shape.
42
42
  - **No `eth_getLogs` in product read paths.** Package and app hot paths use `readContract` only; chain history and human-readable reverse strings come from on-chain storage, an explicit indexer, or app cache — never inline log scans ([ADR-0012](docs/architecture/decisions/0012-no-eth-getlogs-in-product-read-paths.md)). No exceptions: the last walker (`agent-naming` `reverseResolve` log fallback) was removed once spec/222 `reverseResolveString` landed.
43
43
  - **No silent fallbacks.** A read/auth path has exactly ONE mechanism. If the canonical path has no answer it returns `null`/empty or throws — it does NOT escalate to a second, different, more expensive mechanism (`try fast catch slow`, empty-result → log walk, strong-check → weak-check). Empty is an answer, not a trigger. Bounded retries of the *same* call and cache-first reads (cache holds the canonical answer) are fine; switching mechanism is not ([ADR-0013](docs/architecture/decisions/0013-no-silent-fallbacks.md)).
44
- - **The discovery knowledge base holds ONLY public, on-chain-derivable data.** The GraphDB A-box (projected by `demo-discovery-indexer`, read by `demo-discovery-mcp`/`-a2a`) is a world-readable read tier — populate it ONLY with facts any party could reproduce from on-chain state, transactions, or event logs (naming, registry entries, profile, relationships, attestations, custodian/passkey membership from `CustodianAdded`/`PasskeyAdded` logs). NEVER per-viewer state, session/credential secrets, off-chain/relying-app-local data, vault contents, PII, or private linkage ([ADR-0025](docs/architecture/decisions/0025-related-agents-are-private-vault-credentials.md)) — not even hashed, not even temporarily, not even to make a check faster. No secret-derived rows: any opaque form (e.g. custody membership as `sha256(credential‖smartAgent)`) MUST be a public, unsalted, on-chain-*reproducible* function — no server pepper. The indexer is the only writer; consumer services MUST NOT write viewer-/request-derived facts back. The claim: reading the whole KB reveals nothing reading the chain wouldn't ([ADR-0040](docs/architecture/decisions/0040-knowledge-base-only-public-onchain-data.md)).
44
+ - **The discovery knowledge base holds ONLY public, on-chain-derivable data.** The GraphDB A-box (projected by `demo-discovery-indexer`, read by `demo-discovery-mcp`/`-a2a`) is a world-readable read tier — populate it ONLY with facts any party could reproduce from on-chain state, transactions, or event logs (naming, registry entries, profile, relationships, attestations, custodian/passkey membership from `CustodianAdded`/`PasskeyAdded` logs). NEVER per-viewer state, session/credential secrets, off-chain/relying-app-local data, vault contents, PII, or private linkage ([ADR-0025](docs/architecture/decisions/0025-related-agents-are-private-vault-credentials.md)) — not even hashed, not even temporarily, not even to make a check faster. No secret-derived rows: any opaque form (e.g. custody membership as `sha256(credential‖smartAgent)`) MUST be a public, unsalted, on-chain-*reproducible* function — no server pepper. The indexer is the only writer; consumer services MUST NOT write viewer-/request-derived facts back. The claim: reading the whole KB reveals nothing reading the chain wouldn't ([ADR-0040](docs/architecture/decisions/0040-knowledge-base-only-public-onchain-data.md)). Amended carve-outs, each opt-in, signed or verified, and read the way a stranger would read it: A2A cards (286), signed Home manifests (323), and **public + owner-released shelf works** with their retrieval index (413; the index is never bound beside a vault, `check:no-vector-over-vault`).
45
45
  - **On the A2A→MCP hop, Web3 is the authority; MCP OAuth is only the ingress envelope.** When an A2A service agent calls an MCP service, the authorization decision is ALWAYS the Web3 chain — on-chain delegation + signature validation (ERC-1271/6492/ECDSA/WebAuthn via `UniversalSignatureValidator`) + entitlement + tool policy (+ key-release grant + audit for data) — re-run server-side against the principal SA. We ship MCP's OAuth (RFC 9728 bearer / protected-resource metadata) as a generic ingress *adapter* so external MCP clients interoperate, but the bearer is at most a transport envelope: it carries only `ap_principal` + a `ap_grant_ref`/`ap_grant_hash` to an encrypted grant bundle, NEVER delegation/entitlement payload or field-level authority. Do NOT let OAuth drift inward: field/record access is never encoded in scopes (`vault:read` ≠ "decrypt all PII"), OAuth claims (`scope`/`aud`/`client_id`) are never trusted *as* the grant, an inbound MCP token is never reused for the next hop (fresh token / RFC 8693 exchange), and the Web3 gates are never skipped because "OAuth already authenticated the caller." For internal A2A→MCP hops the public OAuth ingress may be absent/skipped (the A2A bridge handles MCP tokens server-side, never exposing them downstream) — the delegation+signature+entitlement+policy gates are not. One mechanism (ADR-0013): OAuth-fail rejects, it does not fall back to a weaker token-trust path. When the standard and the substrate conflict, the substrate wins. ERC-4337 SA-bound, signature-verified, on-chain-revocable delegation is our differentiator from OAuth — never trade it for an opaque issuer-granted scope ([ADR-0041](docs/architecture/decisions/0041-web3-authority-not-oauth-on-a2a-to-mcp.md) + [spec 277](specs/277-mcp-delegated-vault-authorization.md) + [spec 269](specs/269-async-delegation-authorized-a2a.md) + [spec 270](specs/270-del-001-activation.md)).
46
46
  - **Agentic architecture: first-party web expresses INTENTS to an A2A agent; it NEVER drives MCP directly.** A2A is the orchestration / intelligence / discovery layer — it discovers which capability satisfies a declarative goal, plans (planner/LLM/LangChain), assembles authority (delegation/entitlement), and composes MCP tools AS PRIMITIVES. A first-party UI (demo-web-pro, demo-sso-next) says "rebalance the treasury" / "read Alice's PII for purpose X" — a goal, not a tool name, payload, or call sequence — and posts it to an a2a agent. **`web → (edge) → MCP /tools|/mcp|/mcp/native` directly is the anti-pattern (RPC with extra steps) for first-party apps.** The public MCP ingress (`/mcp`, `/mcp/native`) is interop for EXTERNAL agents/clients only; the Act6 OAuth/Native panels are external-MCP-client *demonstrations of a primitive*, NOT a product-UX model (keep them labelled as such). **Orchestration is a Ring-0 primitive, not external** — the agentic loop (intent→plan→compose→observe→re-plan), the planner/reasoner PORT, and the tool/skill model live in a pure `packages/*` orchestration core; ONLY the concrete LLM-framework binding (LangChain/OpenAI/Anthropic SDK) lives in a dedicated in-repo adapter behind the port — the `chain-state` + `chain-state-viem` pattern (ADR-0037 exiles protocol-conformance + deployed-infra, NOT libraries). `service-agent` stays the deterministic compile/run target; the Ring-0 orchestration core PRODUCES its plans. Apps wire model creds/config; they don't re-implement the loop. The edge is orthogonal: it admits, it does not orchestrate (ADR-0043). Honest tension: the first-party web↔a2a surface is RPC-shaped TODAY (`/session/*`, `/account/*`, `/mcp/person/pii` — verbs); the intent layer (A2A messages/tasks against `A2aTaskDO` + `service-agent` plans) is the objective — build NEW first-party surfaces intent-first; the relayer verbs are legacy. Enforced by review + `check:no-direct-mcp-in-web` (browser-app source; allowlist the labelled external-client demo panels) ([ADR-0044](docs/architecture/decisions/0044-a2a-is-the-agentic-orchestration-layer.md) + [docs/architecture/principles.md](docs/architecture/principles.md)).
47
47
  - **Packages are GENERIC trust building blocks; white-label / vertical / deployment code lives in apps.** `packages/*` are reusable + vertical-agnostic. They MUST NOT contain (a) **branding / vertical content** — faith vocabulary (ministry, congregation, discipleship, parish, denomination, gospel, scripture — **`church`/`circle` are the one carve-out: Ring-0 derived AGENT TYPES since 2026-08-30, ADR-0061 amendment; the KIND is generic, the content is not**), white-label/product names, marketing copy, themes; (b) **vertical-specific flows** — faith onboarding steps, impact-portal features; (c) **deployment specifics** — concrete hostnames (`impact-agent.me`/`.io`), the `demo.agent` subregistry, hosting providers (`*.pages.dev`/`*.workers.dev`/`vercel`), host/subdomain parsing. All of that is the **app** layer's job, supplied as an **app-level white-label config object** (spec 234) the generic core consumes. The `.agent` TLD itself is the naming protocol (owned by `agent-naming`) and is allowed. Enforced by `pnpm check:no-domain-in-packages` (hostnames + `demo.agent` + faith vocab) + `check:forbidden-terms`; the rest is doctrine ([ADR-0021](docs/architecture/decisions/0021-generic-packages-vs-white-label-apps.md)). Each app centralizes its domain/white-label literals in one module (e.g. `src/lib/domain.ts`), never scattered.
@@ -0,0 +1,76 @@
1
+ # A service agent is born with its storage, its door, its playbook and its harness
2
+
3
+ **Applies to every path that creates a Service Agent** (`.svc`, `.treasury`, `.workspace`, `.registry`, and any
4
+ `prov:SoftwareAgent`): the Home's "Add an agent" ceremony, `createAgentWithBirthrights`, the KMS bootstrap, the
5
+ runtime's `child-agent.create` step, and **every charter script** in a product or demo repository
6
+ (`charter-services.mjs`, `mint-workspace-persona.mjs`, `provision-naming-service.mts`, the next one).
7
+
8
+ ## One sentence
9
+
10
+ **Chartering a service agent is not finished when the account is deployed and named.** It is finished when the
11
+ agent can be asked, can record what it did, and its Home can show it — the same four birthrights every person,
12
+ organization and treasury already receive at creation, applied to services with no exception for "it is only a script".
13
+
14
+ ## Why this keeps getting re-derived
15
+
16
+ A service "works" the moment its endpoint answers. Nobody notices that nothing lands until its steward opens
17
+ Activities and reads **"No runs yet"** — after a hundred asks. It happened to `ligonier.svc` (spec 386/387: stewardship
18
+ and the vault-key ceremony had to be run by hand before `assign-org-archetype` would even work) and again to
19
+ `scripture-resolver.svc` on 2026-10-08 (chartered 2026-09-21 under `ruth.me`; no vault key, a pre-widening grant, no
20
+ playbook, its own ask loop outside the harness; Ruth's Home empty). The Home's own ceremony has the same hole: in
21
+ `createAgentWithBirthrights` the storage enable runs only for `kind === 'org'`, the content-read grant only for a
22
+ team, and the default-playbook map has no entry for a service.
23
+
24
+ Every one of those is a working system honestly enforcing a birthright nobody gave.
25
+
26
+ ## The birthrights — all four, at charter, whoever charters
27
+
28
+ | # | Birthright | What it is | Without it |
29
+ | --- | --- | --- | --- |
30
+ | 1 | **Identity + standing** | the account deployed; its typed name bought or claimed; its public records written (`atl:agentType`, `a2aEndpoint`, `atl:cardUri`, `atl:mcpEndpoint` when it serves one, `siteUrl` when it has a site); the **stewardship link** from the service to its steward recorded in the steward's vault | nobody can reach it by name; its steward's Home does not list it; "only the agent's custodian…" |
31
+ | 2 | **Storage** | the **vault key binding** (spec 278: provision + bind, signed by the custodian, ERC-1271 against the service's account) and the **standing interactions grant** to its own door (spec 322 plane B, the scope list the Home builds today) | `vault_key_unauthorized` on every read; `record_scope_denied` on every write; nothing it does can be recorded |
32
+ | 3 | **Playbook** | the archetype assignment in its vault, by definition digest (spec 354 §4.3): the default for its kind, or the one its charter names (`content-catalog` for a catalog, `treasury-steward` for a treasury, the app's own for an app) | the bare harness — a service that moves value and tells nobody (spec 360's incident) |
33
+ | 4 | **Harness** | the agent runs **the** harness, not a loop of its own: hosted by the runtime (records name its MCP; nothing to deploy) or self-hosted with the Service Host embedded (spec 433) — either way runs, receipts and `run.provenance:<runRef>` land in **its** DO and **its** vault. **A self-hosted agent also issues its READ WIRE to its steward's Home** (spec 433 W2): a delegation from the agent to the Home runtime's interactions-session key, pinned `harness.read` only, signed by the custodian the way its storage grant is (`issue-self-host-read-wire.mts`) — the Home cannot verify its own session at another host, so the steward's Activities page reads the agent's runs under the agent's own wire, or not at all | an endpoint that answers and an estate that never saw it; runs kept at a host the steward's Home is refused at ("this host admits no Home session") |
34
+
35
+ A charter that cannot complete a birthright **says so and stops**, the way the Home's org-create says "storage
36
+ not enabled — Enable (steward)". It does not deploy, name and walk away. A script that mints a key, deploys and
37
+ prints "next, at the Home: …" has handed the operator a list it should have run.
38
+
39
+ ## The pattern (for a script or a ceremony)
40
+
41
+ ```
42
+ deploy → name + records → stewardship link
43
+ → vault-key bind (278) → interactions grant (322 §2 B, current scopes)
44
+ → archetype assignment (354 §4.3, by digest)
45
+ → the harness: records name the MCP (hosted) │ the app embeds the Service Host (433)
46
+ │ + the read wire to the steward's Home (433 W2: issue-self-host-read-wire.mts)
47
+ → verify: /harness/ask on the new agent answers; its steward's Home lists it with 0 runs, not "not enabled"
48
+ ```
49
+
50
+ Each leg is idempotent and re-runnable (`is-bound`, the grant's `current`, the assignment's digest); a repair is
51
+ the same script run again. The recovery scripts that exist today — `bind-vault-key.mts`, `reissue-service-grant.mts`,
52
+ `record-service-stewardship.mts`, `assign-org-archetype.mts` — are the legs of this one ceremony, and a charter
53
+ script calls them (or their library form) rather than leaving them for later.
54
+
55
+ ## What this rule does NOT say
56
+
57
+ - It does not make a service a person. Storage for a service holds **its** records (its runs, its catalog, its
58
+ receipts) and never a client's (the runtime refuses a service that files a client's study records in its own
59
+ cabinet). A client's data lives in the client's vault, under the client's grant.
60
+ - It does not grant authority. Every birthright is a precondition of being *accountable*; none of them lets the
61
+ agent do anything a mandate would not. A service with all four still parks on a step that needs its steward's
62
+ signature.
63
+ - It does not pick the hosting shape. Hosted (default; no app) or self-hosted (an app with the Service Host) are
64
+ both allowed; a self-hosted service that runs its own loop outside the harness is not.
65
+
66
+ ## Enforcement
67
+
68
+ - Product repos: `ap doctor` rule `service-birthrights` (spec 433 W3) — a charter path that deploys a service kind
69
+ without calling every leg, or a `.svc` app that mounts an A2A surface without the Service Host, is a finding.
70
+ - The runtime: a service with no vault key binding cannot start a run (`vault_key_unauthorized`, fail closed —
71
+ already true); the Service Host refuses to start for the same reason.
72
+ - The Home (spec 433 W3): `createAgentWithBirthrights` runs legs 2 and 3 for `kind === 'service'` and every service
73
+ kind, not only `org`; the default-playbook map gains the service kinds.
74
+
75
+ Related: spec 433 · spec 354 §3 (born with a playbook) · spec 321/322 (storage at create) · spec 278 (vault key) ·
76
+ spec 346 (typed names + `atl:agentType`) · ADR-0055 (the vault is the record) · [`demo-person-org-distinct.md`](./demo-person-org-distinct.md).
@@ -0,0 +1,47 @@
1
+ # The vault is the record; an app holds references, never copies
2
+
3
+ **Binding rule for every product app on the substrate (Source Publishing, Field, Skills, Gather, the Home's own
4
+ serving planes) and for the A2A runtime.** Canonical copy; Cursor has no `.mdc` for it yet.
5
+
6
+ ## The rule
7
+
8
+ 1. **A person's data lives in their vault, behind MCP, under their own key.** Name, email, phone, location, the
9
+ publisher card, a work's text, a profile of any kind — one record, in the owner's vault, reachable only through a
10
+ delegation the owner signed. Nothing about a person is authoritative anywhere else.
11
+ 2. **An app keeps REFERENCE facts and its own operational records — nothing that is the person's.** Reference: the Smart
12
+ Agent address, the handle the app assigned, the client's own wire (ask-as-me) and grants, ids of records it wrote
13
+ through the owner's agent. Operational: what the app itself produced and must serve (a public replica of a SIGNED,
14
+ PUBLIC artifact; an archive the product exists to keep; verification results). Never a copy of a private field
15
+ because it was convenient to have beside the id.
16
+ 3. **A copy that exists for speed is a cache with a source, never a second record.** The Home's KV Library cache is
17
+ rebuildable from the vault and says `source: cache` on the wire; the runtime's DO storage is a serving plane
18
+ (ADR-0055). If wiping it is a bereavement and not a rebuild, it belonged in the vault.
19
+ 4. **Reads are fast by GRANT, not by copying.** An app that needs a person's record at request latency holds a scoped,
20
+ revocable **read grant** the person signed at connect (registry `read_grant.resources`; spec 341 §4.3b) and reads
21
+ it in one call under its own bearer — no harness, no model. What is public is read through the owner's agent's
22
+ public lane (spec 412) — no credential at all. The one thing an app never does is answer speed by storing.
23
+ 5. **Writes go through the owner's agent, as the owner.** An app never writes a vault. It asks the person's agent
24
+ (`ask-as-me` → `harness.ask` → a self-acting capability such as `profile.contact.update`, `library.file.save`), and
25
+ the agent writes as the person, into the person's vault, leaving a run of theirs. A form in an app that collects a
26
+ person's name is a form that writes it to their Home — the app forgets it the moment the write lands.
27
+ 6. **The A2A runtime is the same.** It reads and writes the owner's records under the owner's grants; it holds serving
28
+ state, receipts, cursors and caches, never the person's data as its own.
29
+
30
+ ## Why
31
+
32
+ Every copy is a second enforcement point with a second authority model, and a record nobody can carry to another Home.
33
+ The publishing app kept a directory row with the person's name, organization, byline and topics beside their address,
34
+ and a profile document with their email — three copies of things the Home knew, each drifting the day the Home changed
35
+ (2026-09-21). The doctrine that made revocation real (per-app grants, ADR-0041) is undone by a copy that survives the
36
+ revoke.
37
+
38
+ ## How to apply
39
+
40
+ - Designing a table: for each column ask *whose fact is this?* A person's → not here; read it under a grant or through
41
+ the public lane. The app's own → fine.
42
+ - Designing a form: if it collects a person's fact, its submit is a write to their Home through their agent, and the
43
+ page re-reads it from there.
44
+ - Reviewing an app: `grep` its schema and browser storage for names, emails, phones, addresses, profile text. Each hit
45
+ is a finding unless it is inside a signed public artifact the app exists to serve.
46
+ - Performance complaint about a person's data: the answer is a read grant (private) or the public lane (public),
47
+ declared in the registry — never a local copy.