@ixo/decision-oracle 0.2.0 → 0.2.2

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/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 IXO World
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md CHANGED
@@ -41,9 +41,9 @@ publishing a protocol and its rubric, and for anyone who needs a claim judged th
41
41
  its IID document and its Ed25519 verification key, creates its Matrix account, then the oracle
42
42
  entity with its full public identity — profile, domain card, Agent Card — the `#eval` service and
43
43
  the protocol links that make you discoverable in the IXO portal's marketplace.
44
- - **Drive all of it with the shipped Claude skills.** `init` copies six skills into
44
+ - **Drive all of it with the shipped Claude skills.** `init` copies eight skills into
45
45
  `.claude/skills/`: `create-oracle`, `write-facts`, `create-rubric`, `publish-protocol`,
46
- `create-collection`, `decision-api-oracle`.
46
+ `create-collection`, `decision-api-oracle`, `decision-api-client`, `add-openhands-support`.
47
47
 
48
48
  ## How it works
49
49
 
@@ -101,20 +101,9 @@ One `ClaimIngest` Workflow per claim; every step is checkpointed and retried ind
101
101
  | **A decision engine host** | defaults per `IXO_NETWORK` (see [Configuration](#configuration)); `EVAL_ENGINE_HOSTNAME` overrides it for a local engine or a tunnel |
102
102
  | **An AI provider** | only if the rubric you serve declares AI checks (or a `unique` rule with its judge on): the Cloudflare AI Gateway by default (the `ai` binding + `AI_GATEWAY_ID`, paid from your Cloudflare credits), or an OpenRouter key with `AI_PROVIDER=openrouter` |
103
103
 
104
- > **Not on npm yet.** `@ixo/decision-oracle` is `v0.1.0` and unpublished, so `bunx @ixo/decision-oracle …`
105
- > does not resolve. Until it ships, work from a clone:
106
- >
107
- > ```bash
108
- > git clone <this repo> && cd eval-oracle && bun install
109
- > bun packages/eval-oracle/src/cli/index.ts init ../my-oracle
110
- > ```
111
- >
112
- > Then point the new project's one dependency at the workspace — `"@ixo/decision-oracle":
113
- > "file:<path to>/eval-oracle/packages/eval-oracle"` in its `package.json` — or, to test what npm
114
- > would actually ship, build a tarball (`cd packages/eval-oracle && bun run build && bun pm pack`)
115
- > and depend on `"file:<path to>/ixo-decision-oracle-0.1.0.tgz"`. Inside the generated project, run the
116
- > CLI the same way: `bun <path to>/eval-oracle/packages/eval-oracle/src/cli/index.ts <command>`.
117
- > Everything below is written as `bunx decision-oracle …`, which is what it becomes once published.
104
+ Install from npm: `bunx @ixo/decision-oracle init <dir>` scaffolds a project that depends on
105
+ `@ixo/decision-oracle`, and inside it the CLI is `bunx decision-oracle …`. The customer-side SDK
106
+ and CLI is `@ixo/decision-oracle-client` (`npm i @ixo/decision-oracle-client`).
118
107
 
119
108
  ## Quick start
120
109
 
@@ -484,7 +473,7 @@ other MCP clients").
484
473
  | `publish-protocol --rubric <file> --form <file> [--entity <did>] [--phase entity\|resources\|room\|all] [--yes]` | anchors a claim form and rubric as a protocol entity on chain | once per protocol; resumable after a half-finished run |
485
474
  | `publish-protocol --phase rub --protocol <did> --rubric <file> --form <file> [--yes]` | anchors — or replaces, delete+add in one tx — `#rub` ALONE on a protocol that already carries its `#vct`; a no-op when the same rubric id is already anchored | adopting someone else's protocol, or publishing a new version of your rules |
486
475
  | `create-deed --protocol <did> --title "<name>" [--description <text>] [--type <type>] [--entity <did>] [--phase entity\|room\|claims\|all] [--yes]` | creates the deed entity that hosts claims and links it to the protocol | before a collection — a collection's entity is a deed, never the protocol |
487
- | `create-collection --entity <deed did> --protocol <did> --eval-amount <uixo> [--eval-denom <denom>] [--fund <amount>] [--evaluate <addr,…>] [--submit <addr,…>] [--max-custom-amount <amount><denom>] [--quota <n>] [--days <n>] [--phase collection\|fund\|grants\|all] [--yes]` | creates the claim collection, sets its evaluation payment, funds its admin account and grants the Evaluate/Submit roles (the evaluate grant's `MaxCustomAmount` is written explicitly: `0<eval-denom>` unless you pass more — claims that carry coins need at least the largest claim amount, or approvals fail) | standing up a collection, or hiring your own oracle to prove the loop |
476
+ | `create-collection --entity <deed did> --protocol <did> --eval-amount <uixo> [--eval-denom <denom>] [--fund <amount>] [--evaluate <addr,…>] [--submit <addr,…>] [--max-custom-amount <amount><denom>] [--quota <n>] [--days <n>] [--phase collection\|fund\|grants\|all] [--yes]` | creates the claim collection, sets its evaluation payment (`--eval-amount 0` leaves that leg empty, as a per-review or 0-minimum oracle registers), funds its admin account and grants the Evaluate/Submit roles (the evaluate grant's `MaxCustomAmount` is written explicitly: `0<eval-denom>` unless you pass more — claims that carry coins need at least the largest claim amount, or approvals fail) | standing up a collection, or hiring your own oracle to prove the loop |
488
477
  | `submit-claim --collection <id> --answers <file> [--file <question>=<path> …] [--yes]` | submits a claim as the logged-in wallet: media upload, claim-bot save, the chain message | putting a real claim through your deployed oracle |
489
478
 
490
479
  ## Configuration
@@ -741,7 +730,7 @@ packages/eval-oracle/ THE package — @ixo/decision-oracle
741
730
  src/ the Worker: routes, workflows, the facts lane, the CLI
742
731
  src/facts/ src/testing/ the two node-safe public subpaths
743
732
  migrations/ the D1 migrations — shipped, never hand-written by a consumer
744
- skills/ the six Claude skills `init` copies into a new project
733
+ skills/ the eight Claude skills `init` copies into a new project
745
734
  templates/project/ exactly what `decision-oracle init` generates
746
735
  dev/ engine-conformance harnesses (ours, not published)
747
736
  docs/ api.md (the API reference) + guide.md (the walkthrough)
@@ -789,7 +778,6 @@ symlinks are not packed). CI diffs them — change one, copy it to the other.
789
778
 
790
779
  ## Status
791
780
 
792
- `v0.1.0`. Not yet published to npm — install it from a clone or a `bun pm pack` tarball (see
793
- [Prerequisites](#prerequisites)).
781
+ Published on npm: `@ixo/decision-oracle` 0.2.2 and `@ixo/decision-oracle-client` 0.1.1.
794
782
 
795
- No LICENSE file yet; that is an owner decision.
783
+ Apache License 2.0: `LICENSE` at the repo root and in each package.
@@ -1 +1 @@
1
- {"version":3,"file":"create-collection.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/create-collection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAqQH,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CA+HzD"}
1
+ {"version":3,"file":"create-collection.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/create-collection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAwQH,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAgIzD"}
@@ -90,7 +90,10 @@ async function createCollection(signer, entityDid, protocolDid, admin, denom, am
90
90
  submission: leg(null),
91
91
  approval: leg(null),
92
92
  rejection: leg(null),
93
- evaluation: leg([{ denom, amount }]),
93
+ // `0` is an EMPTY leg — the chain refuses a zero coin ("amount is not positive"), and an
94
+ // empty evaluation leg is what a 0-minimum oracle (EVALUATION_MIN_AMOUNT "0", per-review
95
+ // billing) registers.
96
+ evaluation: leg(amount === "0" ? null : [{ denom, amount }]),
94
97
  }),
95
98
  }),
96
99
  };
@@ -102,7 +105,7 @@ async function createCollection(signer, entityDid, protocolDid, admin, denom, am
102
105
  `entity (deed): ${entityDid}`,
103
106
  `protocol: ${protocolDid}`,
104
107
  `admin account (the deed's): ${admin}`,
105
- `evaluation leg: ${amount}${denom} (no isOraclePayment flag)`,
108
+ `evaluation leg: ${amount === "0" ? "empty" : `${amount}${denom}`} (no isOraclePayment flag)`,
106
109
  `quota: ${quota}, window: ${days} days from now`,
107
110
  ],
108
111
  fee: STANDARD_FEE,
@@ -253,7 +256,7 @@ export async function run(argv) {
253
256
  const evalAmount = values["eval-amount"] ??
254
257
  (RUNS.collection(phase) ? fail("--eval-amount is required to create the collection") : "0");
255
258
  if (!/^[0-9]+$/.test(evalAmount))
256
- fail("--eval-amount must be a positive integer (uixo units)");
259
+ fail("--eval-amount must be a whole number of base units (0 = an empty evaluation leg)");
257
260
  const yes = values.yes === true;
258
261
  const quota = Number(values.quota ?? "100");
259
262
  const days = Number(values.days ?? "90");
@@ -1 +1 @@
1
- {"version":3,"file":"create-collection.js","sourceRoot":"","sources":["../../../src/cli/commands/create-collection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,EAAmB,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EACL,SAAS,EACT,OAAO,EACP,IAAI,EACJ,UAAU,EACV,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,YAAY,GACb,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,WAAW,EAAsB,MAAM,gBAAgB,CAAC;AAIjE,SAAS,YAAY,CAAC,KAAyB;IAC7C,MAAM,KAAK,GAAG,KAAK,IAAI,KAAK,CAAC;IAC7B,IAAI,KAAK,KAAK,YAAY,IAAI,KAAK,KAAK,MAAM,IAAI,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,KAAK,EAAE,CAAC;QACxF,IAAI,CAAC,oBAAoB,KAAK,gCAAgC,CAAC,CAAC;IAClE,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,IAAI,GAAG;IACX,UAAU,EAAE,CAAC,CAAQ,EAAE,EAAE,CAAC,CAAC,KAAK,YAAY,IAAI,CAAC,KAAK,KAAK;IAC3D,IAAI,EAAE,CAAC,CAAQ,EAAE,EAAE,CAAC,CAAC,KAAK,MAAM,IAAI,CAAC,KAAK,KAAK;IAC/C,MAAM,EAAE,CAAC,CAAQ,EAAE,EAAE,CAAC,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,KAAK;CACpD,CAAC;AAEF,4FAA4F;AAC5F,SAAS,SAAS,CAAC,KAAa;IAC9B,MAAM,CAAC,GAAG,6CAA6C,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACpE,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC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CAAC,CAAC;AACX,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@ixo/decision-oracle",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
+ "license": "Apache-2.0",
4
5
  "description": "Run an IXO evaluation oracle: pull claims, produce facts with your handlers, let the decision engine decide, sign on chain",
5
6
  "keywords": [
6
7
  "ixo",
@@ -49,7 +50,8 @@
49
50
  "openapi/decision-api.yaml",
50
51
  "skills",
51
52
  "templates",
52
- "README.md"
53
+ "README.md",
54
+ "LICENSE"
53
55
  ],
54
56
  "publishConfig": {
55
57
  "access": "public"
@@ -81,7 +83,7 @@
81
83
  "@cosmjs/proto-signing": "^0.39.0",
82
84
  "@cosmjs/stargate": "^0.39.0",
83
85
  "@hono/zod-validator": "^0.8.0",
84
- "@ixo/decision-oracle-client": "0.1.0",
86
+ "@ixo/decision-oracle-client": "0.1.1",
85
87
  "@ixo/impactxclient-sdk": "^3.0.1",
86
88
  "@ixo/matrixclient-sdk": "^3.0.0",
87
89
  "@ixo/ucan": "^2.1.0",
package/skills/README.md CHANGED
@@ -17,3 +17,5 @@ installed package (leaving any skill of your own in that directory alone).
17
17
 
18
18
  `reference/engine-contract.md` (here, beside the skills) is the decision engine's contract —
19
19
  background for all eight, not an interface anyone codes against.
20
+ `reference/linked-docs.md` is the linked-document rules: where an entity's documents are uploaded,
21
+ each proof's format, and how to read one.
@@ -21,7 +21,7 @@ and wait for their OK. Dry-run every chain step first (`create-oracle` step 8's
21
21
  ## The adapter (copy, don't rewrite)
22
22
 
23
23
  Source of truth: `examples/street-check-oracle` in the eval-oracle repo (an `init` project with
24
- the adapter added, deployed on devnet), itself ported from `ixoworld/openhands-oracle`. Copy:
24
+ the adapter added, deployed on devnet). Copy:
25
25
 
26
26
  | Path | What it is |
27
27
  | --- | --- |
@@ -48,20 +48,23 @@ bun run db:migrate:remote # must apply BOTH databases — copy th
48
48
  bun run cf-typegen && bun run check
49
49
  ```
50
50
 
51
- ## Pricing — never leave it at 0
51
+ ## Pricing — set it deliberately per env
52
52
 
53
53
  `src/pricing.ts` `CHECK_PRICE_DENOM` / `CHECK_PRICE_AMOUNT` feed `pricing.evaluation` AND the
54
- ceiling written on every minted grant. Denom = the app's `NEXT_PUBLIC_ASK_DENOM` (`uixo` on
55
- devnet, `upay` on testnet/mainnet). At 0 the oracle works for free while the engine bills its
56
- owner per decision. The picker shows the price from `/v1/info`, and the poster's escrow carries it;
57
- an ask escrowing less is refused 402 and never judged. Default, unless the provider names one:
58
- `350_000` base units — 0.35 IXO on devnet, 0.35 PAY ($0.35) on testnet/mainnet, Openhands' own
59
- check fee (`QI_CHECKER_BASE_UPAY`), which covers the engine's $0.30 per decision.
54
+ ceiling written on every minted grant. Denom = the app's ask denom (`uixo` on devnet, `upay` on
55
+ testnet/mainnet). In a template project the `EVALUATION_DENOM` / `EVALUATION_MIN_AMOUNT` vars in
56
+ `wrangler.jsonc` override `pricing.evaluation` for that env — so set `EVALUATION_DENOM=upay` and
57
+ `EVALUATION_MIN_AMOUNT=<the check price>` in the testnet AND mainnet envs (mainnet will not boot
58
+ without them), or `EVALUATION_MIN_AMOUNT=0` for an oracle IXO bills per review (its collections
59
+ carry an empty evaluation leg). Outside per-review billing, 0 means the oracle works for free while
60
+ the engine bills its owner per decision. The picker shows the price from `/v1/info`, and the
61
+ poster's escrow carries it; an ask escrowing less is refused 402 and never judged. Default, unless
62
+ the provider names one: `350_000` base units — 0.35 IXO on devnet, 0.35 PAY ($0.35) on
63
+ testnet/mainnet, Openhands' own check fee, which covers the engine's $0.30 per decision.
60
64
 
61
65
  ## Being listed and hired
62
66
 
63
- The app's picker (`packages/openhands-data/src/oracles.ts`, with `NEXT_PUBLIC_CHECKER_ADDRESS`
64
- UNSET) lists an oracle when its entity has: `#acard` with a **`check-openhands`** service (next to
67
+ The app's picker lists an oracle when its entity has: `#acard` with a **`check-openhands`** service (next to
65
68
  `check-measure`, priced in PAY — the app reads the service id, and `check-openhands` is what marks
66
69
  the oracle Openhands-compatible); `#orz` granting `ORACLE_ADDRESS`; `#eval` = an https base URL
67
70
  whose `/v1/info` answers that address, the ask denom, and `policies.allowAiChecks: true` (else it
@@ -77,10 +80,8 @@ bunx decision-oracle oracle init --protocol <any ask's protocol, or the app's cl
77
80
  --kit-url https://<host> --logo https://<host>/logo.svg --openhands --network <n> # dry run; then --yes
78
81
  ```
79
82
 
80
- Hire/scan nudges go to the PICKED oracle's `#eval`; that routing is the `demo/oracle-picker` change
81
- in openhands-network. The app build has it when `packages/openhands-data/src/oracles.ts` reads the
82
- `#eval` endpoint and `app/ask/post.ts` passes `checker.endpoint` to `notifyOracle` — and in use,
83
- when the hire nudge shows up in THIS oracle's logs after a post.
83
+ Hire/scan nudges go to the PICKED oracle's `#eval`; you know the app routes to you when the hire
84
+ nudge shows up in THIS oracle's logs after a post.
84
85
 
85
86
  Then, right after deploy: `bunx decision-oracle engine register --env <env> --env-file .dev.vars`.
86
87
  The Openhands app lists only registered oracles, and otherwise the engine (and the Decision
@@ -105,9 +106,9 @@ Console) learns the oracle only at its first decision.
105
106
  | --- | --- |
106
107
  | Hire nudge 404 | the adapter's routes are not wrapped in `src/index.ts` `fetch` |
107
108
  | Every claim rejected `weather` "unreachable" | `weather` left as a stub; copy `src/facts/weather.ts` (Open-Meteo, no key) |
108
- | Oracle missing from the picker | no `check-openhands` service on `#acard`, no `#orz`/https `#eval`, not `engine register`ed, price unreadable, or `NEXT_PUBLIC_CHECKER_ADDRESS` set (single-checker mode) |
109
- | Picker shows the oracle at 0 | `pricing.ts` still 0, or its denom ≠ the ask denom |
109
+ | Oracle missing from the picker | no `check-openhands` service on `#acard`, no `#orz`/https `#eval`, not `engine register`ed, or its price unreadable |
110
+ | Picker shows the oracle at 0 | `pricing.ts` / that env's `EVALUATION_MIN_AMOUNT` still 0 on an oracle not billed per review, or the denom ≠ the ask denom |
110
111
  | `withinRadius` fails for everyone | the ask's place was geocoded from a word ("You" → a village in Burkina Faso); set the place by name |
111
112
  | Console "Could not read this oracle's prices" | the console reads the Decision API price list; a chain-lane oracle has none (`API_LANE` off) — console-side, not an oracle fault |
112
- | Wrangler can't resolve `protobufjs/minimal.js` | inside the eval-oracle workspace there is one hoisted protobufjs; drop openhands-oracle's `alias` |
113
+ | Wrangler can't resolve `protobufjs/minimal.js` | inside the eval-oracle workspace there is one hoisted protobufjs; drop any protobufjs `alias` you copied in |
113
114
  | `chain.test.ts` fails after a denom change | the "foreign denom" fixtures used your new denom; give them one you are not paid in |
@@ -60,11 +60,13 @@ protocol.
60
60
  `create-deed` refuses a protocol without one)
61
61
  - the deed: an existing domain entity DID that already links the protocol, OR a title (+ optional
62
62
  description) for a new one — the title is what the portal's picker shows
63
- - evaluation payment: denom + amount. This is the oracle's income per decision AND the minimum
64
- that oracle's own `pricing.evaluation` accepts, so confirm the number with whoever owns the
65
- oracle rather than guessing
63
+ - evaluation payment: denom + amount. This is the oracle's income per decision AND must meet the
64
+ minimum that oracle accepts (its `EVALUATION_DENOM` / `EVALUATION_MIN_AMOUNT`), so confirm the
65
+ number with whoever owns the oracle rather than guessing
66
66
  - optional admin funding amount (`--fund`) — covers the first evaluation payouts, see the gotcha
67
67
  - the oracle address to grant Evaluate; the agent address(es) to grant Submit (comma-separated)
68
+ — `--submit addr1,addr2` is also how to restrict who may claim, e.g. a payouts collection only
69
+ two people may submit to
68
70
  - quota and window in days if the defaults (100, 90) aren't right — state them explicitly rather
69
71
  than silently applying them
70
72
 
@@ -94,6 +96,10 @@ protocol.
94
96
  [--max-custom-amount 0uixo] [--phase collection|fund|grants|all] [--yes]
95
97
  ```
96
98
 
99
+ `--eval-denom` must equal the oracle's `EVALUATION_DENOM` — on mainnet the USDC ibc denom or
100
+ `upay`, never `uixo`. `--eval-amount 0` writes an EMPTY evaluation leg (the chain refuses a zero
101
+ coin): that is what a collection for a per-review-billed or 0-minimum oracle registers with.
102
+
97
103
  `--max-custom-amount` is the evaluate grant's `MaxCustomAmount`, written explicitly (`0<eval
98
104
  denom>` by default). The chain holds EVERY non-empty evaluation amount to it (its denom must be
99
105
  listed), and the oracle sends an ordinary claim's own coins by default — so if the protocol's
@@ -161,6 +167,12 @@ protocol.
161
167
 
162
168
  7. **Report the run** — the output contract below.
163
169
 
170
+ Payout ASKS (a deed or request with its organisation links and `#payoutTerms`) are posted only
171
+ through OpenHands, not with these commands. A company paying people from its OWN collection runs
172
+ its own self-hosted payouts facilitator instead: enable the collection there
173
+ (`/v1/payouts/collections`) with a `fromDecision` rule on `$.<amount field>`, and name the same
174
+ amount field and currency in the oracle's `payouts` config.
175
+
164
176
  ## Output contract
165
177
 
166
178
  Always end with this block, verbatim, filled in from this run:
@@ -187,7 +199,8 @@ account, a phase that was dry-run but never confirmed, or a delegation nobody ha
187
199
  | Creating the collection before the deed links the protocol | run `create-deed --phase claims`; the picker reads `linkedClaim` → claims-config |
188
200
  | Granting Evaluate and expecting the oracle to pull claims | it also needs the claim-bot delegation (step 5) |
189
201
  | Leaving the admin account unfunded | every evaluation debits it, rejects included — pass `--fund` |
190
- | Guessing the evaluation amount | it must meet the oracle's `pricing.evaluation.minAmount`, or register 402s |
202
+ | Guessing the evaluation amount | it must meet the oracle's `EVALUATION_MIN_AMOUNT` in its `EVALUATION_DENOM`, or register 402s |
203
+ | `--eval-amount 0` expecting a zero coin | it writes an empty evaluation leg — right only for a per-review-billed or 0-minimum oracle |
191
204
  | Running with `--yes` first | dry-run, show the plan, then confirm |
192
205
  | Re-running `create-deed --phase claims` for no reason | it rewrites the doc under a new cid and adds a second `linkedClaim` — resume from `claims` only when that phase actually failed |
193
206
 
@@ -36,7 +36,8 @@ First the portal's gate: `--entity` must not be a protocol, must have a `linkedC
36
36
  the protocol, `startDate` = now − 1 day, `endDate` = now + `--days`, `quota`, and four payment legs
37
37
  (submission / approval / rejection / evaluation), each `Payment{ account: <deed admin>, amount,
38
38
  isOraclePayment: false }` — only `evaluation` carries a nonzero amount (`--eval-amount` /
39
- `--eval-denom`); the other three legs are empty. `isOraclePayment` is never turned on by this command
39
+ `--eval-denom`); the other three legs are empty. With `--eval-amount 0` all four are empty — the
40
+ chain refuses a zero coin, so `0` means no evaluation payment at all. `isOraclePayment` is never turned on by this command
40
41
  on ANY leg: the chain rule is that it is only ever legal on the approval leg, so setting it on
41
42
  evaluation would be a protocol violation. After signing, it polls Blocksync for a few seconds waiting
42
43
  for the new collection to index before moving on to fund/grants.
@@ -17,6 +17,33 @@ a protocol's rubric declares (`bunx decision-oracle protocol review <did>`); thi
17
17
  those names and nothing else. It never parses a rubric, never binds a form, never decides. If the
18
18
  manifest is `unusable`, there is nothing to build against yet — stop and say so.
19
19
 
20
+ ## Which skill do I need?
21
+
22
+ Run an oracle for a protocol → this skill. Write the code that answers each fact → `write-facts`.
23
+ Write the rules claims are judged by → `create-rubric`. Put a claim form and its rules on chain →
24
+ `publish-protocol`. Open a place for claims to be submitted and hire an oracle on it →
25
+ `create-collection`. Let apps and agents ask the oracle for decisions over HTTP →
26
+ `decision-api-oracle`; test that from the customer's side → `decision-api-client`. Be hireable from
27
+ the Openhands app → `add-openhands-support`.
28
+
29
+ **Words used throughout:**
30
+
31
+ - **Oracle** — the service this package is: it gathers the evidence for each claim and asks the
32
+ engine for a verdict.
33
+ - **Protocol** — a published kind of claim: the form people fill in plus the rules it is judged by.
34
+ - **Rubric** — those rules, written down: what counts as approve, reject or "needs a person".
35
+ - **Claim** — one submission: someone's answers (and files) on a protocol's form.
36
+ - **Collection** — a place on chain where claims for one protocol are submitted and paid for.
37
+ - **Engine** — IXO's decision engine: it reads the facts your oracle sends and gives the verdict.
38
+ - **Decision / receipt** — the engine's verdict, and its signed proof that it gave it; the oracle
39
+ records both and puts the proof on chain.
40
+ - **PAY / `upay`** — IXO's US-dollar token (1 PAY = 1 USD); `upay` is its smallest unit, a
41
+ millionth of a PAY.
42
+ - **did:web** — this oracle's web identity, a name tied to its domain; other services check its
43
+ signatures by fetching `https://<host>/.well-known/did.json`.
44
+ - **Delegation** — a signed permission one party gives another, such as the owner letting the engine
45
+ bill their subscription, or letting the oracle read their claims.
46
+
20
47
  ## When to use
21
48
 
22
49
  - "Build / set up / configure an oracle for protocol X", "what would my oracle need to produce"
@@ -86,11 +113,18 @@ and any `ERROR: this source will not be called` (the audience is not the endpoin
86
113
  the name shows as `refused: fix the rubric`, the command exits 1, and only the protocol owner can fix
87
114
  it; no handler stands in). Then fill in `src/index.ts` with the provider's answers (the interview
88
115
  table below):
89
- `supportedProtocols: ["<protocol did>"]`, `pricing.evaluation` (denom + `minAmount` in integer base
90
- units — the on-chain evaluation payment a collection must carry, or register refuses it; optionally
91
- `pricing.byProtocol` to charge a different fee per protocol DID — `minAmount: "0"` accepts a
92
- collection whose evaluation leg is empty, for a protocol whose income isn't the evaluation split),
93
- and `policies`: `allowAiChecks` true iff anything asks for a model (an `ai` check, or a `unique` rule
116
+ `supportedProtocols: ["<protocol did>"]`, the evaluation fee, and `policies`.
117
+
118
+ The fee is the on-chain evaluation payment a collection must carry, or register refuses it. Set it
119
+ per wrangler env with the `EVALUATION_DENOM` / `EVALUATION_MIN_AMOUNT` vars (both or neither; the
120
+ minimum in integer base units) — they replace `pricing.evaluation` from `defineOracle`, and they
121
+ are REQUIRED on mainnet: the worker refuses to start without them. A third-party oracle typically
122
+ charges Noble USDC (`ibc/6BBE9BD4246F8E04948D5A4EEE7164B2630263B9EBB5E7DC5F0A46C62A2FF97B`); an
123
+ IXO-managed oracle billed per review uses `upay` / `0`, which accepts a collection whose evaluation
124
+ leg is empty. `pricing.byProtocol` still wins for the protocols it names. The effective price is
125
+ what `GET /v1/info` shows as `pricing`.
126
+
127
+ The `policies`: `allowAiChecks` true iff anything asks for a model (an `ai` check, or a `unique` rule
94
128
  with its judge on), `allowImageChecks` true iff a check reads a photo and the provider wants C2PA
95
129
  screening, `autoSign` true only when unattended chain writes are deliberate (the `AUTO_SIGN` var
96
130
  gates it too — both must be on), and `allowStandingApprovals` — REQUIRED, no default: `true` lets a
@@ -158,6 +192,10 @@ printf 'OWNER_DELEGATION_CAR="%s"\n' "$(cat owner-delegation.car)" >> .dev.vars
158
192
  before it lapses.
159
193
  - Only the human can do the login. Run it in the background so the loopback callback lands, and tell
160
194
  them to finish in the browser.
195
+ - **The owner must hold an IXO subscription before `engine register`**, or it answers 402
196
+ `NO_SUBSCRIPTION`. A subscription created by the subscriptions workflow (not the portal) also
197
+ needs a Stripe customer: the owner calls the subscriptions API's `POST /api/v1/payments/intent`
198
+ once (a SetupIntent — nothing is charged).
161
199
  - **A 402 at register is the owner's credits, not a bug**: `NO_SUBSCRIPTION` (none at all) or
162
200
  `INSUFFICIENT_CREDITS` (below one decision's price, carrying `manageSubscriptionUrl`). Send the
163
201
  owner to that portal URL to buy credits, then register again — nothing here can fake it.
@@ -183,10 +221,11 @@ finds this oracle. One command does all of it:
183
221
 
184
222
  ```bash
185
223
  bunx decision-oracle oracle init --protocol <protocol did> --kit-url http://localhost:8787 \
186
- [--logo <url>] [--only <step>] [--relogin] [--network <n>] [--yes]
224
+ [--logo <url>] [--openhands [--price-pay <n>]] [--only <step>] [--relogin] \
225
+ [--network <n>] [--yes]
187
226
  ```
188
227
 
189
- **A full on-chain identity is mandatory** (owner, 2026-10-01): every oracle built with this kit gets
228
+ **A full on-chain identity is mandatory**: every oracle built with this kit gets
190
229
  its entity, its `#pro` profile, its `#dmn` domain card and its `#acard` Agent Card — this command
191
230
  does all four. `--logo <url>` is optional, but ASK the provider for one: without it the portal and
192
231
  the console show a placeholder, and every run prints `⚠ recommended: --logo`.
@@ -260,7 +299,8 @@ where a live token would have skipped (it mints a new Matrix device — not a ca
260
299
  ### 9. Deploy it
261
300
 
262
301
  ```bash
263
- bun run db:migrate:remote # BEFORE the first deploy of that environment
302
+ bun run db:migrate:remote # BEFORE the first deploy of the default env; for a named env:
303
+ # bunx wrangler d1 migrations apply DB --remote --env <env>
264
304
  bun run deploy # or deploy:testnet / deploy:production
265
305
  wrangler secret put ORACLE_MATRIX_ACCESS_TOKEN # the value step 8 wrote into .dev.vars
266
306
  ```
@@ -308,18 +348,20 @@ bunx decision-oracle register --collection <collection id> [--delegation delegat
308
348
  bunx decision-oracle scan --collection <collection id> # discover claims now, not at the next tick
309
349
  ```
310
350
 
311
- `--delegation` is the owner→oracle claim-bot CAR (`delegation --for bot --audience
312
- did:ixo:<ORACLE_ADDRESS>`): without it the oracle holds the on-chain grant but still cannot pull
313
- claim bodies from Matrix. A refusal names its gate — not the chain owner, no Evaluate grant for
314
- `ORACLE_ADDRESS`, or an evaluation payment below the required fee (`pricing.byProtocol` for that
315
- collection's protocol, else `pricing.evaluation.minAmount`).
351
+ Claim bodies are pulled from the VFS claims lane first (under the oracle's own Evaluate grant), then
352
+ the Matrix claim bot, then the IPFS gateway or a declared cellnode. `--delegation` is the
353
+ owner→oracle claim-bot CAR (`delegation --for bot --audience did:ixo:<ORACLE_ADDRESS>`); it matters
354
+ only for claims stored in Matrix — without it those bodies cannot be pulled. A refusal names its
355
+ gate — not the chain owner, no Evaluate grant for `ORACLE_ADDRESS`, or an evaluation payment below
356
+ the required fee (`pricing.byProtocol` for that collection's protocol, else the env's
357
+ `EVALUATION_MIN_AMOUNT`).
316
358
 
317
359
  ## Interview slots (ask, don't assume)
318
360
 
319
361
  | Slot | Ask | Lands in |
320
362
  | --- | --- | --- |
321
363
  | Protocol | the DID, and which network | `--protocol`, `supportedProtocols` |
322
- | Pricing | denom + minimum per-evaluation payment; any protocol priced differently (incl. free)? | `pricing.evaluation`, optionally `pricing.byProtocol` |
364
+ | Pricing | denom + minimum per-evaluation payment per network; any protocol priced differently (incl. free)? | `EVALUATION_DENOM` / `EVALUATION_MIN_AMOUNT` per env, optionally `pricing.byProtocol` |
323
365
  | AI / image policy | does the work order declare `ai` checks; do any read images | `policies.allowAiChecks` / `allowImageChecks` |
324
366
  | Auto-sign | should this oracle sign `MsgEvaluateClaim` unattended | `policies.autoSign` + the `AUTO_SIGN` var |
325
367
  | Standing approvals | may a signed-in AI app's own auto-approve limits pay without a per-claim approval (hosted MCP) — IXO's own oracles say yes | `policies.allowStandingApprovals` (required) |
@@ -352,7 +394,8 @@ collection's protocol, else `pricing.evaluation.minAmount`).
352
394
  | Register answers 402 and the agent retries | it is the owner's credits — send them to the printed portal URL, then re-run |
353
395
  | `.dev.vars` edited but the old value still in play | a running `wrangler dev` reloads source, not secrets — restart it |
354
396
  | `ORACLE_ADDRESS` typed by hand | must match the mnemonic exactly — asserted at first use |
355
- | Guessing `pricing.evaluation.minAmount` | ask what the collection's on-chain evaluation payment is (or will be) — too low and register 402s |
397
+ | Guessing `EVALUATION_MIN_AMOUNT` | ask what the collection's on-chain evaluation payment is (or will be) — set too high and register 402s |
398
+ | No `EVALUATION_DENOM` in the mainnet env | the worker refuses to start — set both vars in every env you deploy |
356
399
  | `allowAiChecks: false` while the work order declares AI checks | every `ai` fact freezes `error` and the rubric's `onError` decides — ask first |
357
400
  | `ORACLE_HOSTNAME` ≠ the deployed Custom Domain | callers resolve the did:web by fetching that host — they must be the same string |
358
401
  | `ORACLE_ENTITY_DID` left unset after `oracle init` (or set only at the top level) | the deployed oracle fails `/health/ready` (`identity`); the Matrix review card can't resolve it, so reviews only work from the portal page |
@@ -360,7 +403,7 @@ collection's protocol, else `pricing.evaluation.minAmount`).
360
403
  | Skipping `--logo` without asking | the identity is still complete, but the portal and the console show a placeholder — ask the provider for a logo URL and pass `--logo` |
361
404
  | Not re-running `oracle init` after the deploy | `#eval` and both cards still name `localhost` and `#pro` may be missing — re-run with the deployed `--kit-url` and `--yes` |
362
405
  | Treating `⚠ domain indexer …` as a failure | it is a warning and the exit code is 0 — the entity is on chain either way |
363
- | Registering with the on-chain grant but no claim-bot delegation | the oracle can't pull bodies — mint `delegation --for bot` and pass `--delegation` |
406
+ | Registering with the on-chain grant but no claim-bot delegation | Matrix-stored claims can't be pulled — mint `delegation --for bot` and pass `--delegation` |
364
407
 
365
408
  ## Worked example
366
409
 
@@ -389,6 +432,8 @@ restart, re-register. Restart both dev servers after any `.dev.vars` edit.
389
432
  default and cap; the routes, cron lanes, pause reasons and billing the package already owns).
390
433
  - `../reference/engine-contract.md` — the engine's side: register, the error table, billing,
391
434
  receipts, review folds. Background, not an interface.
435
+ - `../reference/linked-docs.md` — the linked-document rules: Vault first, the IXO IPFS gateway as
436
+ the fallback, each proof's format, and `readLinkedDoc`.
392
437
 
393
438
  ## Output contract
394
439
 
@@ -93,8 +93,9 @@ default here is the author's call — ask.
93
93
 
94
94
  ## Rules that bite (the engine's, not opinions)
95
95
 
96
- - `claimSchema.proof` is the chain's `#vct` proof copied verbatim (a CID, compared as a string) —
97
- never computed.
96
+ - `claimSchema.proof` is the chain's `#vct` proof copied verbatim, compared as a string — sha256 hex
97
+ for a protocol published with the CLI, a CID for one published through the Portal. Never
98
+ computed.
98
99
  - File content is never machine-judged: presence / type / size only. "Does the photo show X" is
99
100
  `ManualScore` + `ReviewTask`, `answer` boolean or enum, `map` covering every answer — or an
100
101
  `aiChecks` entry, which an oracle answers.
@@ -16,7 +16,7 @@ format still shows `constants` / `@const` refs; those do not exist (inline liter
16
16
  "@type": "Rubric",
17
17
  "title": "…", "description": "…", // display-only
18
18
  "claimSchema": { "@type": "ClaimSchemaBinding", "protocol": "did:ixo:entity:…", "resource": "#vct",
19
- "proof": "<the protocol's #vct LinkedResource proof, VERBATIM — a CID, compared as a string>" },
19
+ "proof": "<the protocol's #vct LinkedResource proof, VERBATIM — sha256 hex (CLI) or a CID (Portal), compared as a string>" },
20
20
  "derived": [ … ], "gates": [ … ], "scoring": { … }, "review": { … }, "settlement": { … },
21
21
  "sources": [ … ], "aiChecks": [ … ], "unique": { … }, "frequency": { … }
22
22
  }
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: decision-api-client
3
- description: Use when testing a Decision API oracle from the CUSTOMER side — minting a test source, API key and payment delegation on devnet, running the TypeScript SDK (@ixo/decision-oracle-client) or its CLI against a live oracle, connecting Claude Code to an oracle's hosted MCP server (/v1/mcp), running the docs agent test — or when debugging a client-side failure (402 not paid, SCOPE, DELEGATION_EXPIRED, terms_mismatch, a receipt that will not verify).
3
+ description: Use when testing a Decision API oracle from the CUSTOMER side — minting a test source, API key and payment delegation on devnet, running the TypeScript SDK (@ixo/decision-oracle-client) or its CLI against a live oracle, connecting Claude Code to an oracle's hosted MCP server (/v1/mcp), or when debugging a client-side failure (402 not paid, SCOPE, DELEGATION_EXPIRED, terms_mismatch, a receipt that will not verify).
4
4
  ---
5
5
 
6
6
  # The Decision API from the customer side, on devnet
@@ -10,17 +10,17 @@ description: Use when testing a Decision API oracle from the CUSTOMER side — m
10
10
  A Decision API oracle (`API_LANE` on; set one up with `decision-api-oracle`) is used by customers
11
11
  through three doors, all over the same `/v1/api` routes with an API key:
12
12
 
13
- - the SDK and CLI, `@ixo/decision-oracle-client` (`packages/client` in this repo);
13
+ - the SDK and CLI, `@ixo/decision-oracle-client` (on npm);
14
14
  - the hosted MCP server at `https://<oracle>/v1/mcp` (four tools, the same key, or a sign-in
15
15
  through AuthHub with an approval per submit);
16
- - plain HTTP, with the docs (`site`, and its `llms-full.txt` for agents).
16
+ - plain HTTP, with the Decision API docs (their `llms-full.txt` is written for agents).
17
17
 
18
18
  A source in billing mode `x402` answers a submit with `402`. The payer pays it with the
19
19
  customer's **payment delegation**, a UCAN to the facilitator carrying a `billing/pay` cap. The
20
20
  price is held when the claim is accepted and paid only on the engine's receipt.
21
21
 
22
22
  The worked target is IXO's devnet example: SwiftDrop, at `https://shipment-delivery-oracle.devnet.ixo.earth`,
23
- protocol `did:ixo:entity:c2f5a188d28f3d4bf6351873d3d268ea`, price 20¢. Its `/demo/orders?route=<id>`
23
+ protocol `did:ixo:entity:c2f5a188d28f3d4bf6351873d3d268ea`, price 60¢. Its `/demo/orders?route=<id>`
24
24
  issues a fresh courier route per id, with real order ids and delivery codes. Use a new route per
25
25
  test claim, so the duplicate lane never sees a repeat.
26
26
 
@@ -46,45 +46,42 @@ bunx decision-oracle login --network devnet # once; a browser step for the h
46
46
  ```
47
47
 
48
48
  The session's DID must be in the oracle's `ORACLE_ADMIN_DIDS` to set a source's billing mode and
49
- protocols. For IXO's example it already is. Its deed needs devnet PAY; top up in the console
49
+ protocols — on someone else's oracle, ask its operator to do those two steps. Its deed needs devnet PAY; top up in the console
50
50
  (`decision-console.devnet.ixo.earth`, Credits).
51
51
 
52
52
  ### 1. Credentials: a source, two keys and a delegation
53
53
 
54
- **In this repo** (one command; secrets are written to the file with mode 600 and never printed):
55
-
56
- ```bash
57
- cd packages/client
58
- bun run devnet:credentials -- --oracle https://shipment-delivery-oracle.devnet.ixo.earth \
59
- --protocol did:ixo:entity:c2f5a188d28f3d4bf6351873d3d268ea --out ~/.ixo/decision-api-devnet.env
60
- # --source src_… reuse an existing source; --max-pay 2 (PAY); --days 7
61
- ```
62
-
63
- It writes `IXO_ORACLE_URL`, `IXO_PROTOCOL_DID`, `IXO_SOURCE_ID`, `IXO_API_KEY` (claims:write,
64
- claims:read, webhooks:manage), `IXO_API_KEY_READONLY` (claims:read) and `IXO_PAYMENT_DELEGATION`.
65
-
66
- **Anywhere else:**
67
-
68
54
  ```bash
69
55
  eo() { bunx decision-oracle "$@" --kit https://<oracle> --network devnet --json; }
70
- eo api source create --name <n> --contact <email> # sourceId + webhookSecret, shown once
56
+ eo api source create --name <n> --contact <email> --entity <org did> # sourceId + webhookSecret, shown once
71
57
  eo api admin billing-mode <sourceId> x402 --yes # operator only
72
58
  eo api admin protocols <sourceId> <protocolDid> --yes # operator only
73
59
  eo api key create --source <sourceId> --scopes claims:write,claims:read --name test
74
60
  ```
75
61
 
76
- For the delegation, use the console's Keys page ("Payment delegation"), which shows
77
- `IXO_PAYMENT_DELEGATION` once.
62
+ `--entity` is required: the organisation the source belongs to, which the login must control (make
63
+ one with `decision-oracle org create --name …`). The source stays `pending-link` until
64
+ `eo api source link <sourceId> --yes`. For the delegation, use the console's Keys page ("Payment
65
+ delegation"), which shows `IXO_PAYMENT_DELEGATION` once.
66
+
67
+ Keep the values in a file of your own (mode 600), never printed: the client reads `IXO_ORACLE_URL`,
68
+ `IXO_API_KEY` and `IXO_PAYMENT_DELEGATION` from the environment. Mint a second, read-only key
69
+ (`--scopes claims:read`) for the `SCOPE` check.
78
70
 
79
71
  Revoke keys you no longer need: `eo api key revoke --source <id> <8-char prefix> --yes`.
80
72
 
81
- ### 2. The SDK smoke (this repo)
73
+ ### 2. The CLI and the SDK
74
+
75
+ With the `IXO_*` variables from step 1 in the environment:
82
76
 
83
77
  ```bash
84
- cd packages/client && bun run build && node dev/devnet-smoke.ts # --env <file> --photo <jpg>
78
+ npx @ixo/decision-oracle-client submit claim.json # waits up to 60 s; pays the 402
79
+ npx @ixo/decision-oracle-client watch apc_… # the timeline to the decision
80
+ npx @ixo/decision-oracle-client keys # the source's keys, masked
85
81
  ```
86
82
 
87
- It runs under plain node, through the BUILT dist. That is what a customer installs. It checks:
83
+ The SDK is the same package (`npm i @ixo/decision-oracle-client`; pass `paymentDelegation` to pay
84
+ 402s). A passing run shows:
88
85
 
89
86
  - the work order and its price;
90
87
  - an upload;
@@ -92,25 +89,12 @@ It runs under plain node, through the BUILT dist. That is what a customer instal
92
89
  - a decision, and a payment on the record;
93
90
  - `verifyReceipt` against the engine's did.json;
94
91
  - events;
95
- - a replay with the same key naming the same claim;
96
- - `SCOPE` for the read-only key;
97
- - the CLI reading the claim.
98
-
99
- It spends one claim. Every line must read `PASS`. Any verdict counts (`reject` is normal for a
100
- parcel photo that doesn't match).
92
+ - a replay with the same idempotency key naming the same claim;
93
+ - `SCOPE` for the read-only key.
101
94
 
102
- ### 3. The CLI by hand
103
-
104
- ```bash
105
- set -a; . ~/.ixo/decision-api-devnet.env; set +a
106
- node packages/client/dist/cli/index.js submit claim.json # waits up to 60 s; pays the 402
107
- node packages/client/dist/cli/index.js watch apc_… # the timeline to the decision
108
- node packages/client/dist/cli/index.js keys # the source's keys, masked
109
- ```
95
+ Any verdict counts (`reject` is normal for a parcel photo that doesn't match).
110
96
 
111
- Outside this repo: `npx @ixo/decision-oracle-client …` (once published).
112
-
113
- ### 4. MCP from Claude Code
97
+ ### 3. MCP from Claude Code
114
98
 
115
99
  The route ships with the oracle package, so the oracle must be deployed from a version that has
116
100
  `src/routes/v1/mcp`. Check with `curl -s -o /dev/null -w "%{http_code}" -X POST https://<oracle>/v1/mcp`:
@@ -159,55 +143,25 @@ the console) must make the next claim ask again. "Don't ask again" works only on
159
143
  `policies.allowStandingApprovals` is `true`; otherwise setting it is refused (`403`, reason
160
144
  `standing_approvals_off`) and every claim asks.
161
145
 
162
- ### 5. The docs agent test (this repo)
163
-
164
- ```bash
165
- (cd site && bun install && bun run build)
166
- set -a; . ~/.ixo/decision-api-devnet.env; set +a
167
- bun site/agent-test/run.ts # exit 0 pass · 1 fail · 2 skipped (no credentials)
168
- ```
169
-
170
- A Claude model gets only the site's `llms-full.txt`, the key, the delegation and one
171
- `http_request` tool locked to the oracle's origin. It must reach a decision it paid for itself.
172
- The script checks the result, not the model's word. It costs a few cents of model usage plus
173
- one claim.
174
-
175
- ### 6. Card scenarios (devnet, Stripe test mode)
146
+ ### 4. Card scenarios (devnet, Stripe test mode)
176
147
 
177
- Card needs an oracle whose protocol costs **≥ 50¢ per claim** (Stripe's minimum capture; SwiftDrop is
178
- 60¢ for this) and whose plan accepts `card`. Which scenario runs is set on the **facilitator side**:
179
- the payer's default saved card and default way to pay. Saving a test card and completing 3-D Secure
180
- need the facilitator's Stripe test key, so that half belongs to whoever owns the facilitator
181
- (ixo-pay-facilitator `.claude/skills/devnet-card-check`). This half pays:
148
+ Card needs an oracle whose protocol costs **≥ 50¢ per claim** (Stripe's minimum capture; the
149
+ example is 60¢ for this) and whose plan accepts `card`. Which scenario runs is set on the
150
+ **facilitator side**: the payer's default saved card and default way to pay. Saving a test card and
151
+ completing 3-D Secure need the facilitator's Stripe test key, so that half belongs to whoever runs
152
+ the facilitator. This half pays — an SDK submit with `prefer: "card"` (`"upay"` = PAY first; unset =
153
+ the payer's console default), and after a 3-D Secure confirm a resume with the SAME offer and key
154
+ (`{ idempotencyKey: err.idempotencyKey, resumePayment: err.paymentRequired }`):
182
155
 
183
- ```bash
184
- cd packages/client && bun run build
185
- node dev/devnet-card.ts submit card # prefer card; `upay` = PAY first; `none` = the console default
186
- node dev/devnet-card.ts resume # after a 3-D Secure confirm: the SAME offer, same key
187
- ```
188
-
189
- | Payer's default card (facilitator side) | Run | Expect |
156
+ | Payer's default card (facilitator side) | Submit with | Expect |
190
157
  | --- | --- | --- |
191
- | `pm_card_authenticationRequired` | `submit card` | `CARD_AUTHENTICATION_REQUIRED` + `confirmUrl`; once confirmed, `resume` → paid with the SAME PaymentIntent. Left unconfirmed, the facilitator cancels it ~17 min later, never charged |
192
- | `pm_card_chargeCustomerFail` | `submit card` | declined at authorize → paid with PAY for the same 402 |
193
- | `pm_card_createDispute` | `submit card`, then again once the dispute is open | paid by card; then `card_blocked` → PAY (no PaymentIntent created); after the dispute is won, card again |
194
- | `pm_card_visa`, preference `card` | `submit none` | the SDK reads `/v1/payer/preferences` with the delegation → card |
158
+ | `pm_card_authenticationRequired` | `prefer: "card"` | `CARD_AUTHENTICATION_REQUIRED` + `confirmUrl`; once confirmed, the resume → paid with the SAME PaymentIntent. Left unconfirmed, the facilitator cancels it ~17 min later, never charged |
159
+ | `pm_card_chargeCustomerFail` | `prefer: "card"` | declined at authorize → paid with PAY for the same 402 |
160
+ | `pm_card_createDispute` | `prefer: "card"`, then again once the dispute is open | paid by card; then `card_blocked` → PAY (no PaymentIntent created); after the dispute is won, card again |
161
+ | `pm_card_visa`, preference `card` | no `prefer` | the SDK reads `/v1/payer/preferences` with the delegation → card |
195
162
 
196
163
  Every claim's record names the rail: `stripe-manual-capture` / `usd` / cents, or `ixo-pay` / `upay`.
197
- A run that answers `SPEND_CAP` has used up the delegation's `maxAmount`: mint a new one. Proven end to
198
- end on 2026-10-01, pre-company-authority (2026-10-10) (SwiftDrop at 60¢; each card capture paid IXO
199
- its 20% fee).
200
-
201
- ## Working on the client in this repo (maintainers)
202
-
203
- - **`@ixo/x402-ixo-pay` comes from npm** (0.5.2, published from ixo-pay-facilitator
204
- `packages/x402-ixo-pay`) as an ordinary runtime dependency; the client's `dist/` imports it. A
205
- facilitator wire change means a new version published there, then a bump here.
206
- - **`packages/client/scripts/pack-test.sh`** (run first by `pack-smoke.sh`) proves the tarball
207
- stands alone: every dependency is a registry version (no git, `file:` or workspace spec), it
208
- installs with git turned off, and it pays and runs its bin under plain node.
209
- - **Types come from the OpenAPI.** Run `bun run generate` after the OpenAPI changes. It uses
210
- `npx` with TypeScript 5, because TS 7 has no JS compiler API and openapi-typescript needs one.
164
+ A run that answers `SPEND_CAP` has used up the delegation's `maxAmount`: mint a new one.
211
165
 
212
166
  ## When something fails
213
167
 
@@ -218,11 +172,11 @@ its 20% fee).
218
172
  | MCP `SUBMITTER_REQUIRED` | The protocol has a frequency rule (its work order says `facts.frequency: true`), so `submit_claim` needs `submitter`, your stable id for the person (e.g. the courier id). Without it the engine would reject the claim, so it is refused before any approval or charge. |
219
173
  | The AI asks you to upload a photo | There is no upload over sign-in. Give it an https link; `submit_claim` attaches `{ question, url }` and the oracle fetches it. No `mediaType` is needed: the oracle reads it from the URL's extension, else a `HEAD`, when it accepts the claim. |
220
174
  | Claude Code refuses `submit_claim` ("real-world transaction") | Its safety check is holding back a tool that may spend. Allow only this tool: `/permissions` › Allow › `mcp__<server>__submit_claim`. Never turn the safety check off. Every charge still needs the user's AuthHub approval or their auto-approve limits. |
221
- | `PaymentError DELEGATION_WRONG_ORACLE` | The delegation is bound to other oracles. Re-sign it naming this oracle's `did:web` (console Keys › Payment delegation; `devnet:credentials` binds to `--oracle`). |
175
+ | `PaymentError DELEGATION_WRONG_ORACLE` | The delegation is bound to other oracles. Re-sign it naming this oracle's `did:web` (console Keys › Payment delegation). |
222
176
  | `PaymentError CARD_NOT_SAVED` | The payer has no saved card and the 402 took card only (or `prefer: "card"` with no PAY to fall back to). Save a card on the console's card page, or pay with PAY. |
223
177
  | `PaymentError CARD_AUTHENTICATION_REQUIRED` | The bank wants 3-D Secure. Open `err.confirmUrl` and confirm within 15 min, then resubmit with `{ idempotencyKey: err.idempotencyKey, resumePayment: err.paymentRequired }` — never a fresh offer. `OFFER_EXPIRED` on the resume: the gate no longer takes that offer; submit afresh. `INVALID_RESUME`: the offer passed is not this oracle's card 402. |
224
178
  | `402 INSUFFICIENT_CREDITS` (+ `fundingUrl`) | The session's deed has too little devnet PAY. Top up in the console. |
225
- | `402 SPEND_CAP` | The key's daily cap or the delegation's `maxAmount` is spent. Mint a delegation with a higher `--max-pay`. |
179
+ | `402 SPEND_CAP` | The key's daily cap or the delegation's `maxAmount` is spent. Mint a new delegation with a higher cap (console Keys › Payment delegation). |
226
180
  | `403 PAYER_NOT_MEMBER` | The delegation's issuer isn't the source's owner or a member. Mint it from the owner's session. |
227
181
  | `409 IDEMPOTENCY_MISMATCH` | Same `Idempotency-Key`, different body. Use a new key per new claim. |
228
182
  | `terms_mismatch` on the paid resend | `accepted` wasn't the offer entry verbatim. Hand-built headers must copy it byte for byte. |
@@ -11,7 +11,9 @@ The Decision API (`API_LANE`) is an oracle's second intake: paid, off-chain clai
11
11
  `/v1/api`, decided by the same engine, never written to chain. The oracle holds the sources, keys,
12
12
  uploads, reviews and webhooks; the engine decides and bills per the oracle's **plan** (the Standard
13
13
  plan from the moment it registers, unless IXO sets another);
14
- the payments facilitator settles each claim in PAY; the Decision Console
14
+ the payments facilitator settles each claim the ways that plan allows — by card and/or USDC on Base
15
+ for a third-party oracle, PAY only for IXO-run ones — into the oracle's own earnings addresses
16
+ (`EARNINGS_ADDRESS` / `EARNINGS_BASE_WALLET`); the Decision Console
15
17
  (`decision-console.devnet.ixo.earth`) is the UI over all of it.
16
18
 
17
19
  The worked run is **`examples/shipment-delivery`** in this package's repo — SwiftDrop Express, a
@@ -44,18 +46,16 @@ is the package CLI.
44
46
  ### 0. Prerequisites
45
47
 
46
48
  ```bash
47
- bunx wrangler whoami # the Cloudflare account that owns the ixo.earth zone
49
+ bunx wrangler whoami # the Cloudflare account that owns your host's zone
48
50
  bunx decision-oracle login --network devnet # the OWNER's AuthHub session — once
49
51
  ```
50
52
 
51
53
  - `login` opens a browser: run it in the background and tell the human to finish there (**HUMAN**).
52
54
  The session is the owner: it publishes the protocol, owns the oracle entity, and is the operator.
53
- Put the session's OWN DID (`did:ixo:<address>` — `login` prints the address; the session file
54
- `~/.ixo/publish-session-<network>.json` has the `did`) in `ORACLE_ADMIN_DIDS` in every `vars` block
55
- of `wrangler.jsonc`. The example ships IXO's DID there — a copy of it must
56
- replace it with the owner's.
57
- - The account must hold the zone of the host (`*.ixo.earth` for IXO's deployments), or the Custom
58
- Domain cannot attach. If `whoami` shows another account, stop and say so (**HUMAN**).
55
+ Put the session's OWN DID (`did:ixo:<address>` — `login` prints the address) in
56
+ `ORACLE_ADMIN_DIDS` in every `vars` block of `wrangler.jsonc`. The example ships IXO's DID there —
57
+ a copy of it must replace it with the owner's.
58
+ - The account must hold the zone of the host, or the Custom Domain cannot attach. If `whoami` shows another account, stop and say so (**HUMAN**).
59
59
 
60
60
  ### 1. The protocol (example: publish `protocol/`; a provider: their protocol's DID)
61
61
 
@@ -160,15 +160,14 @@ If the engine already binds this did:web to a DIFFERENT address, it prints old
160
160
  that is an identity change — ask the owner before re-running with `--yes`.
161
161
 
162
162
  Registering is the whole step for a provider: an oracle with no plan of its own runs at the
163
- engine's **Standard** plan at once (payable in PAY, take 20%, paid to the owner's deed account,
164
- listed in the Decision Console). Nothing to request. Done when the oracle appears in the engine's
163
+ engine's **Standard** plan at once (payable by card and/or USDC on Base, into the oracle's earnings
164
+ addresses; listed in the Decision Console). PAY is for IXO-run oracles only. Nothing to request. Done when the oracle appears in the engine's
165
165
  `GET /v1/oracles` (the console's list).
166
166
 
167
- **Example only (IXO's own oracles):** IXO staff switch the oracle to the IXO-owned plan in the
168
- engine's admin plan editor (**HUMAN**, IXO staff) — the example's README names its terms. Done when
169
- IXO confirms the oracle's plan version is > 0 (Standard is version 0).
167
+ An oracle IXO runs for itself moves to an IXO plan only on IXO's side: ask IXO to move it
168
+ (**HUMAN**), and it is done when IXO confirms the plan.
170
169
 
171
- ### 7. On chain — the full identity (mandatory, owner 2026-10-01)
170
+ ### 7. On chain — the full identity (mandatory)
172
171
 
173
172
  Every oracle built with the kit has a full on-chain identity — the entity, its `#pro` profile, its
174
173
  `#dmn` domain card and its `#acard` Agent Card (which lists the `decision-api` service at the lane's published
@@ -191,9 +190,12 @@ The oracle is not done until readiness passes. A 503 there names nothing; the op
191
190
 
192
191
  ### 8. Operator: a source, its protocol, its billing, a key
193
192
 
194
- The smoke (step 9) does all of this itself; for a real partner:
193
+ The smoke (step 9) does all of this itself; for a real partner. A source belongs to an
194
+ organisation entity (`--entity`): the partner's, or one made with `org create` (`org balance` /
195
+ `org fund` check and top up its admin account):
195
196
 
196
197
  ```bash
198
+ bunx decision-oracle org create --name "<partner>" --network devnet --yes # → { entityDid } — once, idempotent by name
197
199
  K="--kit https://shipment-delivery-oracle.devnet.ixo.earth --network devnet"
198
200
  bunx decision-oracle api source create --name "<partner>" --contact <email> --entity <org did> $K # as a controller of the org; pending-link; secret shown ONCE
199
201
  bunx decision-oracle api admin protocols <sourceId> <protocol did> $K # dry run → --yes
@@ -205,7 +207,9 @@ bunx decision-oracle api review-billing disable --source <sourceId> $K
205
207
  ```
206
208
 
207
209
  `review-billing` exists only while IXO's plan bills the oracle's reviews per review (`/v1/info`
208
- `reviewBilling.mode: "x402"`; `enable` refuses otherwise). The login must be the organisation's
210
+ `reviewBilling.mode: "x402"`; `enable` refuses otherwise), and needs `API_LANE` AND `API_PAYMENTS`
211
+ on, a published `pricing.api` price, and the organisation's collections created with
212
+ `--eval-amount 0` (an empty evaluation leg — `create-collection`). The login must be the organisation's
209
213
  owner on chain — the reviews come out of ITS credits — and `--cap` (PAY) is a lifetime total,
210
214
  never refunded: raise it by running `enable` again with a higher `--cap`.
211
215
 
@@ -238,18 +242,16 @@ Three people, three keys — never the same account twice:
238
242
  `api admin billing-mode` and `api admin protocols`. It must NOT be the organisation's
239
243
  controller or the reviewer: the engine refuses any review grant chain through the oracle's
240
244
  identities, its owner included.
241
- - **the organisation's controller** (`--org-controller`, a test account's key file or its address in
242
- `~/.ixo/test-accounts-registry.json`; on devnet the default is SwiftDrop's admin Sara,
243
- `~/.config/ixo-payouts/test-accounts/swiftdrop-sara.json`, controller of `--entity`'s default,
244
- SwiftDrop's organisation `did:ixo:entity:2eeb3a4c03f3755872ada894734e47d2`): a source belongs to
245
- an organisation (D10), so the controller creates it (`POST /v1/api/sources { entityDid }` →
245
+ - **the organisation's controller** (`--org-controller`, a key file or an account address; pass
246
+ `--entity` with the organisation it controls — the smoke's defaults are the example's own
247
+ devnet accounts): a source belongs to an organisation, so the controller creates it (`POST /v1/api/sources { entityDid }` →
246
248
  `pending-link`), signs the `SourceCompanyLink` (kid = the did:key of the Ed25519 key on its IID,
247
249
  canonical payload) and PUTs it to the ENGINE (`PUT /v1/sources/:oracleDid/:sourceId/company`,
248
250
  UCAN `company/link`), syncs (`POST /v1/api/sources/:id/company/sync` → `active`), mints and
249
251
  revokes the keys, and invites the reviewer. Its key needs no chain write: it already controls the
250
252
  entity.
251
- - **the reviewer** (`--reviewer`, from `~/.ixo/test-accounts.json`; default the network's first
252
- account that is neither of the two — make one with the `ixo-test-account` skill): a MEMBER. The
253
+ - **the reviewer** (`--reviewer <address|did>`, a third account that is neither of the two): a
254
+ MEMBER. The
253
255
  controller invites it by DID with role `reviewer` and PUTs its role grant (≤ 30 days); the member
254
256
  registers a `did:key` reviewer key, grants it `claims/review` on the source and answers through
255
257
  the API with that two-link `reviewerGrant` (controller → member → key).
@@ -259,19 +261,18 @@ fixtures, decides one stop per row of the example's outcome table (approve prepa
259
261
  review cash short · review GPS far · partial refused · reject wrong code · reject unknown order ·
260
262
  review reused photo, held on `unique:SD-DUP-1` with its `duplicates[]` naming the earlier claim ·
261
263
  reject the same order claimed again by its courier (same `submitter`) · review dispatch down), answers the cash review (and the
262
- claim-level `SD-RT-CHECKS` asked beside it) as a member does in the Decision Console (devnet's
263
- reviewer is Dan — never an oracle operator's account, which the engine refuses in a reviewer grant), waits for the engine's fold (`decided partial`), walks
264
+ claim-level `SD-RT-CHECKS` asked beside it) as a member does in the Decision Console (never an
265
+ oracle operator's account, which the engine refuses in a reviewer grant), waits for the engine's fold (`decided partial`), walks
264
266
  the rest of the surface, then revokes its keys and DELETEs its sources as the controller (`--keep`
265
267
  keeps both). Each run spends ~13 engine decisions (and one review fold) of the owner's
266
268
  credits. Then, on the owner's OK:
267
269
 
268
270
  - `--frequency` — one courier over the daily limit (26 more decisions);
269
271
  - `--paid` — one x402 claim paid from the session's own devnet deed. Needs a **subscription deed**
270
- whose admin holds PAY and has granted the facilitator (`ixo173l540tvyu43ghmtstl2wu2lqztdt5e05e05c6`)
271
- a `SendAuthorization` — the subscriptions service's devnet purchase / top-up does both (**HUMAN**
272
- if absent). Check: `curl "https://devnet.ixo.earth/rest/cosmos/authz/v1beta1/grants?granter=<deed admin>&grantee=ixo173l540tvyu43ghmtstl2wu2lqztdt5e05e05c6&msg_type_url=/cosmos.bank.v1beta1.MsgSend"`.
273
- Spends one decision price of PAY (60¢ in the example). The next SwiftDrop smoke after the
274
- company-authority joint deploy runs with `--paid`.
272
+ whose admin holds PAY and has granted the payments facilitator's address a `SendAuthorization` —
273
+ the subscriptions service's devnet purchase / top-up does both (**HUMAN** if absent). Check:
274
+ `curl "https://devnet.ixo.earth/rest/cosmos/authz/v1beta1/grants?granter=<deed admin>&grantee=<facilitator address>&msg_type_url=/cosmos.bank.v1beta1.MsgSend"`.
275
+ Spends one decision price of PAY (60¢ in the example).
275
276
 
276
277
  ### 10. Verify — the six member / review emails
277
278
 
@@ -292,7 +293,8 @@ With the owner's email as the test inbox, in the console (**HUMAN** clicks; you
292
293
  ### 11. Payments on (a provider turning it on)
293
294
 
294
295
  `API_PAYMENTS: "true"`, `X402_FACILITATOR_URL`, `X402_NETWORK` (`cosmos:devnet-1` / `cosmos:pandora-8`
295
- / `cosmos:ixo-5`) and `EARNINGS_ADDRESS` (the operator's own `ixo1…`, each offer's `payTo`; unset ⇒ no PAY)
296
+ / `cosmos:ixo-5`) and the payees — `EARNINGS_ADDRESS` (your own `ixo1…`, each offer's `payTo` for
297
+ PAY and USDC on IXO; unset ⇒ no PAY) and `EARNINGS_BASE_WALLET` (your `0x…`, for USDC on Base) —
296
298
  in the env's vars, a price (`pricing.api` in `defineOracle`, whole cents), and the
297
299
  oracle registered with the engine (step 6) — the facilitator reads the oracle's terms from its plan
298
300
  (Standard unless IXO set another). `API_PAYMENTS:
@@ -316,7 +318,7 @@ Decision Console shows the price and card eligibility read-only.
316
318
  | `PROTOCOL_NOT_ALLOWED` on submit | the source's allow-list lacks it — empty means NONE; `api admin protocols <src> <did> --yes` |
317
319
  | 503 `SOURCE_PAUSED` `payments-disabled` | `API_PAYMENTS` is off and the source bills `x402` — turn payments on, or `api admin billing-mode <src> none` |
318
320
  | 402 again after a `PAYMENT-SIGNATURE` | the facilitator refused the payer: no deed / no `SendAuthorization` / not enough PAY — the fresh 402's error says which |
319
- | offers refused `plan_inactive`, `accepts: []` | the engine has nobody to pay: the oracle is not registered (step 6), or its owner has no oracle claims collection / deed account to receive the Standard payout (the owner's subscription sets that up — **HUMAN**); the refusal's reason says which |
321
+ | offers refused `plan_inactive`, `accepts: []` | the facilitator finds no active plan for the oracle: it is not registered with the engine (step 6 — registered, it runs on Standard at once), or, for an IXO-run oracle, IXO has not activated its plan (**HUMAN**: ask IXO). A way to pay whose payee is unset (`EARNINGS_ADDRESS` for PAY / USDC on IXO, `EARNINGS_BASE_WALLET` for USDC on Base) is simply not offered |
320
322
  | Not listed in the console | not registered with the engine (step 6), or not payable (the row above); or the host is not a `*.ixo.earth` Custom Domain; or `CORS_ORIGINS` lacks `https://decision-console.devnet.ixo.earth` |
321
323
  | Every API claim rejects with `frequency` | the caller sends no `submitter` — an uncountable window fails closed; send the courier id |
322
324
  | 409 `REVIEW_EXPIRED` on a review answer | the paid claim's `answerBy` (its x402 reservation's expiry: extended up to 30 days for the review, else 24 h after verify) has passed — it can no longer be paid, and nothing was written. Answer paid reviews before the date the emails state |
@@ -332,5 +334,5 @@ Decision Console shows the price and card eligibility read-only.
332
334
  Say plainly what is done and what is owed: the protocol DID and where it was written, the
333
335
  worker's host and did:web, the oracle entity DID (`/v1/info` `entityDid`) and the `/health/ready`
334
336
  answer, which ids and secrets were set (names only), the engine registration and
335
- billing status, whether the oracle is listed/payable (for IXO's own: the plan version IXO confirmed), the smoke's last line and
337
+ billing status, whether the oracle is listed/payable, the smoke's last line and
336
338
  any FAIL lines verbatim, the email rows seen, and every HUMAN step still open.
@@ -14,8 +14,9 @@ submissions against it. This skill composes two things:
14
14
 
15
15
  - **`create-rubric`** authors and validates the form + rubric pair. The decision engine owns the
16
16
  rubric format; `bunx decision-oracle rubric validate` is that engine over HTTP.
17
- - **`bunx decision-oracle publish-protocol`** does the chain authoring: `MsgCreateEntity` → Matrix
18
- upload → `MsgAddLinkedResource` (`#vct` + `#rub`) + `MsgAddService` → source the Matrix room.
17
+ - **`bunx decision-oracle publish-protocol`** does the chain authoring: `MsgCreateEntity` → upload
18
+ to the IXO Vault (else the IXO IPFS gateway; never Matrix media) → `MsgAddLinkedResource` (`#vct`
19
+ + `#rub`) + `MsgAddService` → source the Matrix room.
19
20
  Phases `entity` / `resources` / `room` (default `all`), resumable with `--entity <did> --phase <p>`.
20
21
  Plus `rub`, which is a different job — see below.
21
22
 
@@ -89,6 +90,17 @@ There are two jobs here, and picking the wrong one fails on chain:
89
90
  protocols are linked to this entity". `create-collection`'s `reference/claims-stack.md` has the
90
91
  model.
91
92
 
93
+ **Proofs.** Both proofs this command writes are the sha256 HEX of the exact uploaded bytes — the
94
+ engine string-compares them, and the `#rub` proof IS the rubric's id. A protocol published through
95
+ the Portal carries a CID as its `#vct` proof instead. Never recompute someone else's proof: read the
96
+ anchored value off chain and use it verbatim (`--phase rub` does exactly that).
97
+ `../reference/linked-docs.md` has the rules for every linked document in one place.
98
+
99
+ **No profile yet — the protocol shows as "Unnamed".** `publish-protocol` writes no `#pro` profile,
100
+ so Portals and Consoles list the protocol as "Unnamed" until one is anchored on it. The profile is a
101
+ `#pro` linked resource: type `Settings`, `application/ld+json`, its proof the CIDv1 of the uploaded
102
+ bytes. This CLI has no flag for it — tell the user it is still owed.
103
+
92
104
  ## Adopting a protocol that already has its form — `--phase rub`
93
105
 
94
106
  Use this when the protocol EXISTS and carries a `#vct` already: IXO's own oracle-service-claim
@@ -116,7 +128,7 @@ Three things to expect:
116
128
  prints `already anchored` and does nothing — no upload, no transaction, no fee.
117
129
  - **Only the protocol's owner can anchor.** If the session doesn't own it, the rubric is still
118
130
  uploaded and the exact messages are printed, composed for the owner to broadcast. Send them those
119
- lines; they sign them. (Same posture as `oracle init --phase backlink`.)
131
+ lines; they sign them. (Same posture as `oracle init --only backlink`.)
120
132
  - **The room is not this command's business.** A protocol that already has claims already has its
121
133
  room; `--phase rub` never touches it.
122
134
 
@@ -149,3 +161,6 @@ owed: a phase that failed, an un-invited bot, or a rubric change that would need
149
161
 
150
162
  `reference/publishing.md` — phase-by-phase detail (what each signs and uploads), resuming a partial
151
163
  run, the Matrix identity rule, and the network endpoints.
164
+
165
+ `../reference/linked-docs.md` — the linked-document rules: where uploads go, each proof's format,
166
+ and how to read one.
@@ -64,7 +64,7 @@ bunx decision-oracle publish-protocol --phase rub --protocol <did> \
64
64
  **Ownership.** The chain checks the signer against the DID's authentication relationship, so only
65
65
  the protocol's owner can anchor. When the session is not the owner the messages are composed for the
66
66
  owner, printed, and not broadcast — the upload has already happened, so all they have to do is sign
67
- the printed lines. Same behaviour as `oracle init --phase backlink`.
67
+ the printed lines. Same behaviour as `oracle init --only backlink`.
68
68
 
69
69
  `--form` stays required: it is what the engine's binder validates the rubric against before anything
70
70
  is written. Get it with `rubric fetch-form --protocol <did> --out form.json`, which downloads the
@@ -78,7 +78,7 @@ entries are exactly what a handler returns, after the runner normalized it.
78
78
  | 400 `INVALID_ADDRESS_PROOF` | register proof bad | non-retryable; `ORACLE_SECP_MNEMONIC` ≠ `ORACLE_ADDRESS` — a config bug |
79
79
  | 403 `NO_EVALUATE_GRANT` | not hired for this collection | retry once (a grant may have just landed), then pause the collection |
80
80
  | 402 `INSUFFICIENT_CREDITS` | the OWNER's credits are exhausted | pause every watched collection, log `details.manageSubscriptionUrl`; the cron resumes when `/me` says ok |
81
- | 402 `NO_SUBSCRIPTION` (register) | the delegated owner has no subscription | non-retryable; the owner subscribes in the portal, then register again |
81
+ | 402 `NO_SUBSCRIPTION` (register) | the delegated owner has no subscription | non-retryable; the owner subscribes in the portal, then register again. A subscription made by the subscriptions workflow (not the portal) also needs a Stripe customer: the owner calls the subscriptions API's `POST /api/v1/payments/intent` once (a SetupIntent, no charge) |
82
82
  | 403 `DELEGATION_NOT_FOR_ORACLE` (register) | the CAR's `billing/pay` names a different oracle | non-retryable; re-mint with `--oracle did:web:<this host>` |
83
83
  | 400 `BAD_REQUEST` (register, naming `ownerDelegation`) | the CAR is malformed, mis-addressed or expired | non-retryable; re-mint, then register again |
84
84
  | 409 `RUBRIC_PIN_MISMATCH` | our pin ≠ the chain's `#rub` proof | invalidate the cached manifest, re-read, rebuild, retry once |
@@ -0,0 +1,35 @@
1
+ # Linked documents (what an entity's LinkedResources point at)
2
+
3
+ Every public document an entity carries — a protocol's form (`#vct`) and rubric (`#rub`), an
4
+ oracle's `#orz`, `#pro` profile, `#dmn` domain card and `#acard` Agent Card, an ask's documents —
5
+ is a LinkedResource: an https URL (`serviceEndpoint`) plus a hash of the exact bytes (`proof`).
6
+ The CLI writes and reads them for you; these are the rules it follows, for anything you write or
7
+ read yourself.
8
+
9
+ ## Where the bytes go
10
+
11
+ 1. **The IXO Vault first** — `https://{devnet.|testnet.|}vfs.ixo.earth/public/cid/<cid>`, uploaded
12
+ under a UCAN signed by the document's OWNER (the AuthHub session). Public at once, no auth.
13
+ 2. **The IXO IPFS gateway as the fallback** — `https://ipfs.gateway.ixo.world/ipfs/<cid>`. Never a
14
+ public gateway (`ipfs.io` and friends rate-limit).
15
+ 3. **Never Matrix media for a new document.** Old documents keep their Matrix download URLs and stay
16
+ readable; nothing new is written there.
17
+
18
+ `serviceEndpoint` is always that full https URL — never a bare `ipfs:` or `mxc://`.
19
+
20
+ ## The proof, by resource
21
+
22
+ | Resource | `proof` |
23
+ | --- | --- |
24
+ | `#vct`, `#rub`, `#orz` (`application/json`) | **sha256 hex** of the bytes. The engine string-compares it: a rubric's `claimSchema.proof` must equal the `#vct` proof verbatim, and a `#rub` proof is the rubric's id |
25
+ | `#pro` (type `Settings`), `#dmn`, `#acard` (`application/ld+json`) | **CIDv1, raw, sha256** (`bafkrei…`) of the bytes |
26
+
27
+ A protocol published through the Portal has a CID as its `#vct` proof. **Never recompute someone
28
+ else's proof** — read the anchored value off chain and use it verbatim.
29
+
30
+ ## Reading one
31
+
32
+ `readLinkedDoc(resource)` from `@ixo/decision-oracle/facts` (node-safe): a plain GET with no auth.
33
+ It accepts Vault and gateway URLs, bare `ipfs:` / `ipfs://` CIDs (resolved through the IXO
34
+ gateway) and old Matrix download URLs, hashes the bytes the way the proof was made (hex or CID), and
35
+ fails closed on a mismatch. `linkedDocUrl(endpoint)` gives just the fetchable URL.
@@ -88,8 +88,8 @@ over whatever a handler put there. **A handler cannot turn its own failure into
88
88
  **A deterministic failure is a fact; a transient one is a retry.** Don't `catch` a transient
89
89
  engine/chain error yourself and turn it into `fact.error(...)` — that freezes a verdict over
90
90
  trouble that was never the claim's fault, and a claim is decided once, so it can never be re-run
91
- (task-14, 2026-09-14: a devnet claim was held for review on every fact because the engine's own 5xx
92
- got frozen this way). `tools.agreement()` and `tools.chain.*` already let a retryable failure
91
+ (a claim whose every fact froze over the engine's own 5xx this way is held for review on all of
92
+ them). `tools.agreement()` and `tools.chain.*` already let a retryable failure
93
93
  propagate instead of catching it — see below.
94
94
 
95
95
  ## One call, many facts
@@ -149,7 +149,7 @@ does: `readAnswer(answers, "$q.row.col")` and `rootQuestionName("$deliveryPhoto"
149
149
  answers `[]`. Blocksync being *unreachable* is a different thing and throws, which the runner passes
150
150
  through as the step's retry signal — so a chain outage retries instead of freezing a verdict. Catch
151
151
  it only if "could not read the chain" is genuinely the fact you mean, and then say so with
152
- `fact.error`. `tools.agreement()` follows the same rule against the eval engine (task-14): a real
152
+ `fact.error`. `tools.agreement()` follows the same rule against the eval engine: a real
153
153
  "no agreement on file" is `null`, a transient engine outage throws.
154
154
 
155
155
  **There is no GENERAL chain message-history read, and you must not build one.** The one thing an