settld 0.1.5 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/README.md +32 -0
  2. package/SETTLD_VERSION +1 -1
  3. package/bin/settld.js +58 -0
  4. package/docs/CIRCLE_SANDBOX_E2E.md +12 -0
  5. package/docs/QUICKSTART_MCP.md +41 -1
  6. package/docs/QUICKSTART_MCP_HOSTS.md +156 -89
  7. package/docs/QUICKSTART_POLICY_PACKS.md +65 -0
  8. package/docs/QUICKSTART_PROFILES.md +198 -0
  9. package/docs/README.md +18 -0
  10. package/docs/RELEASE_CHECKLIST.md +26 -0
  11. package/docs/RELEASING.md +1 -0
  12. package/docs/SLO.md +62 -1
  13. package/docs/SUMMARY.md +1 -0
  14. package/docs/gitbook/README.md +13 -1
  15. package/docs/gitbook/quickstart.md +57 -58
  16. package/docs/integrations/README.md +1 -0
  17. package/docs/integrations/openclaw/PUBLIC_QUICKSTART.md +95 -0
  18. package/docs/ops/DISPUTE_FINANCE_RECONCILIATION_PACKET.md +56 -0
  19. package/docs/ops/KERNEL_V0_SHIP_GATE.md +3 -1
  20. package/docs/ops/MCP_COMPATIBILITY_MATRIX.md +8 -6
  21. package/docs/ops/PRODUCTION_DEPLOYMENT_CHECKLIST.md +46 -9
  22. package/docs/ops/TRUST_CONFIG_WIZARD.md +37 -24
  23. package/docs/plans/2026-02-20-trust-os-v1-jira-backlog.md +348 -0
  24. package/docs/plans/2026-02-21-agent-economic-actor-operating-model.md +169 -0
  25. package/docs/plans/2026-02-21-trust-os-v1-strategy.md +241 -0
  26. package/docs/research/2026-02-21-agent-spend-host-landscape.md +57 -0
  27. package/docs/spec/ArbitrationOutcomeMapping.v1.md +62 -0
  28. package/docs/spec/DisputeCaseLifecycle.v1.md +51 -0
  29. package/docs/spec/OperatorAction.v1.md +90 -0
  30. package/docs/spec/PolicyDecision.v1.md +83 -0
  31. package/docs/spec/README.md +5 -0
  32. package/docs/spec/SettlementDecisionRecord.v2.md +2 -0
  33. package/docs/spec/schemas/OperatorAction.v1.schema.json +113 -0
  34. package/docs/spec/schemas/PolicyDecision.v1.schema.json +74 -0
  35. package/docs/spec/schemas/SettlementDecisionRecord.v2.schema.json +1 -0
  36. package/docs/spec/x402-error-codes.v1.txt +14 -0
  37. package/package.json +14 -1
  38. package/scripts/ci/build-launch-cutover-packet.mjs +177 -21
  39. package/scripts/ci/run-10x-throughput-drill.mjs +76 -4
  40. package/scripts/ci/run-10x-throughput-incident-rehearsal.mjs +49 -6
  41. package/scripts/ci/run-mcp-host-cert-matrix.mjs +201 -0
  42. package/scripts/ci/run-mcp-host-smoke.mjs +203 -5
  43. package/scripts/ci/run-offline-verification-parity-gate.mjs +762 -0
  44. package/scripts/ci/run-onboarding-host-success-gate.mjs +516 -0
  45. package/scripts/ci/run-onboarding-policy-slo-gate.mjs +537 -0
  46. package/scripts/ci/run-production-cutover-gate.mjs +540 -0
  47. package/scripts/ci/run-public-openclaw-npx-smoke.mjs +148 -0
  48. package/scripts/ci/run-release-promotion-guard.mjs +756 -0
  49. package/scripts/doctor/mcp-host.mjs +120 -0
  50. package/scripts/mcp/settld-mcp-server.mjs +330 -20
  51. package/scripts/ops/dispute-finance-reconciliation-packet.mjs +313 -0
  52. package/scripts/ops/hosted-baseline-evidence.mjs +286 -77
  53. package/scripts/ops/run-x402-hitl-smoke.mjs +607 -0
  54. package/scripts/policy/cli.mjs +600 -0
  55. package/scripts/profile/cli.mjs +1324 -0
  56. package/scripts/register-entity-secret.mjs +102 -0
  57. package/scripts/setup/circle-bootstrap.mjs +310 -0
  58. package/scripts/setup/host-config.mjs +617 -0
  59. package/scripts/setup/onboard.mjs +1337 -0
  60. package/scripts/setup/openclaw-onboard.mjs +423 -0
  61. package/scripts/setup/wizard.mjs +986 -0
  62. package/scripts/slo/check.mjs +123 -62
  63. package/scripts/spec/generate-protocol-vectors.mjs +88 -0
  64. package/scripts/test/run.sh +23 -9
  65. package/services/x402-gateway/src/server.js +147 -36
  66. package/src/api/app.js +2345 -267
  67. package/src/api/middleware/trust-kernel.js +114 -0
  68. package/src/api/openapi.js +598 -3
  69. package/src/api/persistence.js +184 -0
  70. package/src/api/store.js +277 -0
  71. package/src/core/agent-wallets.js +134 -0
  72. package/src/core/event-policy.js +21 -2
  73. package/src/core/operator-action.js +303 -0
  74. package/src/core/policy-decision.js +322 -0
  75. package/src/core/policy-packs.js +207 -0
  76. package/src/core/profile-fingerprint.js +27 -0
  77. package/src/core/profile-simulation-reasons.js +84 -0
  78. package/src/core/profile-templates.js +242 -0
  79. package/src/core/settlement-kernel.js +27 -1
  80. package/src/core/wallet-assignment-resolver.js +129 -0
  81. package/src/core/wallet-provider-bootstrap.js +365 -0
  82. package/src/db/store-pg.js +631 -0
@@ -0,0 +1,56 @@
1
+ # Dispute Finance Reconciliation Packet
2
+
3
+ This runbook generates a deterministic packet for dispute-driven settlement adjustments.
4
+
5
+ ## Purpose
6
+
7
+ - Produce a finance-reviewable packet for one `SettlementAdjustment.v1`.
8
+ - Include adjustment artifact + before/after wallet snapshots for payer/payee.
9
+ - Attach deterministic checksums and optional Ed25519 signature.
10
+
11
+ ## Command
12
+
13
+ ```bash
14
+ node scripts/ops/dispute-finance-reconciliation-packet.mjs \
15
+ --base-url http://127.0.0.1:3000 \
16
+ --tenant-id tenant_default \
17
+ --ops-token tok_finw \
18
+ --adjustment-id sadj_agmt_<agreementHash>_holdback \
19
+ --payer-agent-id <payerAgentId> \
20
+ --payee-agent-id <payeeAgentId> \
21
+ --out artifacts/finance/dispute-adjustment-packet.json
22
+ ```
23
+
24
+ Optional signing:
25
+
26
+ ```bash
27
+ node scripts/ops/dispute-finance-reconciliation-packet.mjs \
28
+ --base-url http://127.0.0.1:3000 \
29
+ --tenant-id tenant_default \
30
+ --ops-token tok_finw \
31
+ --adjustment-id sadj_agmt_<agreementHash>_holdback \
32
+ --payer-agent-id <payerAgentId> \
33
+ --payee-agent-id <payeeAgentId> \
34
+ --signing-key-file ./keys/finance-ops-ed25519.pem \
35
+ --signature-key-id finance_ops_k1 \
36
+ --out artifacts/finance/dispute-adjustment-packet.signed.json
37
+ ```
38
+
39
+ ## Packet contract
40
+
41
+ - `schemaVersion`: `DisputeFinanceReconciliationPacket.v1`
42
+ - `adjustment`: `SettlementAdjustment.v1` payload from `/ops/settlement-adjustments/{adjustmentId}`
43
+ - `balances.payer/payee.before|after`: wallet snapshots for reconciliation
44
+ - `checksums.packetHash`: canonical packet checksum (`sha256`)
45
+ - `checksums.adjustmentHash`: checksum carried by adjustment artifact
46
+ - `signature` (optional): Ed25519 signature over `checksums.packetHash`
47
+
48
+ ## Finance review workflow
49
+
50
+ 1. Generate the packet immediately after dispute verdict/adjustment application.
51
+ 2. Verify `checksums.adjustmentHash` matches the adjustment artifact.
52
+ 3. Verify `checksums.packetHash` and (if present) `signature`.
53
+ 4. Reconcile `before -> after` snapshots against expected adjustment kind:
54
+ - `holdback_release`: payer escrow decreases; payee available increases.
55
+ - `holdback_refund`: payer escrow decreases; payer available increases.
56
+ 5. Attach packet to incident/dispute record for immutable finance traceability.
@@ -21,7 +21,9 @@ Report output:
21
21
  ## CI enforcement
22
22
 
23
23
  1. `.github/workflows/tests.yml` runs `kernel_v0_ship_gate` on every `push` to `main`.
24
- 2. `.github/workflows/release.yml` blocks release unless that same commit has a successful `kernel_v0_ship_gate` result from `tests.yml`.
24
+ 2. `.github/workflows/tests.yml` also runs `production_cutover_gate` on every `push` to `main`.
25
+ 3. `.github/workflows/release.yml` blocks release unless that same commit has successful `kernel_v0_ship_gate` and `production_cutover_gate` results from `tests.yml`.
26
+ 4. `.github/workflows/production-cutover-gate.yml` provides manual live-environment validation using `production_cutover_gate` GitHub Environment secrets.
25
27
 
26
28
  ## Included checks
27
29
 
@@ -20,9 +20,11 @@ Track real host compatibility evidence here. Update on every major host release
20
20
 
21
21
  | Host | Host Version | Transport | Status | Last Verified (UTC) | Evidence Link | Notes |
22
22
  |---|---|---|---|---|---|---|
23
- | Claude | TBD | stdio | TBD | TBD | TBD | |
24
- | Cursor | TBD | stdio | TBD | TBD | TBD | |
25
- | Codex | TBD | stdio | TBD | TBD | TBD | |
26
- | OpenClaw | TBD | stdio | TBD | TBD | TBD | |
27
- | Generic MCP host bootstrap path | local CI smoke | stdio | green | 2026-02-20 | `npm run test:ci:mcp-host-smoke` | Boots API + magic-link, generates runtime MCP env, runs `mcp:probe`, and calls `settld.about`; report at `artifacts/ops/mcp-host-smoke.json`. |
28
- | Generic MCP HTTP client | local repo test harness | HTTP bridge | green | 2026-02-20 | `node --test test/mcp-stdio-spike.test.js test/mcp-http-gateway.test.js test/mcp-paid-exa-tool.test.js test/mcp-paid-weather-tool.test.js test/mcp-paid-llm-tool.test.js test/demo-mcp-paid-exa.test.js` | 9/9 passing in local CI-style run |
23
+ | Claude | local host-cert matrix harness | stdio | yellow | 2026-02-21 | `npm run test:ci:mcp-host-cert-matrix` | Validates host config write/idempotency for Claude MCP wiring; live interactive paid-tool validation in Claude desktop remains separate. |
24
+ | Cursor | local host-cert matrix harness | stdio | yellow | 2026-02-21 | `npm run test:ci:mcp-host-cert-matrix` | Validates host config write/idempotency for Cursor MCP wiring; live interactive paid-tool validation in Cursor app remains separate. |
25
+ | Codex | local host-cert matrix harness | stdio | yellow | 2026-02-21 | `npm run test:ci:mcp-host-cert-matrix` | Validates host config write/idempotency for Codex MCP wiring; live interactive paid-tool validation in Codex desktop remains separate. |
26
+ | OpenClaw | local host-cert matrix harness | stdio | yellow | 2026-02-21 | `npm run test:ci:mcp-host-cert-matrix` | Validates host config write/idempotency for OpenClaw MCP wiring; live interactive paid-tool validation in OpenClaw app remains separate. |
27
+ | Generic MCP host bootstrap path | local CI smoke | stdio | green | 2026-02-21 | `npm run test:ci:mcp-host-smoke` | Runs the MCP host smoke flow (API + magic-link + runtime bootstrap + MCP initialize/tools/list + `settld.about`) and writes `artifacts/ops/mcp-host-smoke.json`. |
28
+ | Host config write matrix (Codex/Claude/Cursor/OpenClaw) | local CI smoke | config bootstrap | green | 2026-02-21 | `npm run test:ci:mcp-host-cert-matrix` | Verifies `scripts/setup/host-config.mjs` writes valid Settld MCP entries and remains idempotent across all supported hosts. |
29
+ | Generic MCP HTTP client | local repo test harness | HTTP bridge | green | 2026-02-21 | `node --test test/mcp-stdio-spike.test.js test/mcp-paid-exa-tool.test.js test/mcp-paid-weather-tool.test.js test/mcp-paid-llm-tool.test.js test/x402-gateway-autopay.test.js` | 6/6 passing with paid-tool runtime metadata checks and x402 settlement header verification. |
30
+ | MCP paid runtime policy metadata gate | local repo test harness | stdio + x402 gateway | green | 2026-02-21 | `node --test test/mcp-paid-exa-tool.test.js test/mcp-paid-weather-tool.test.js test/mcp-paid-llm-tool.test.js test/x402-gateway-autopay.test.js` | Paid MCP tools now fail-closed if `x-settld-policy-decision`, `x-settld-policy-hash`, `x-settld-decision-id`, settlement, or verification headers are missing. |
@@ -4,10 +4,23 @@ Use this checklist to launch and verify a real hosted Settld environment.
4
4
 
5
5
  ## Phase 0: Preflight
6
6
 
7
- 1. Confirm branch protection includes `tests / kernel_v0_ship_gate`.
8
- 2. Confirm release workflow is blocked unless ship gate is green.
9
- 3. Confirm staging and production have separate domains, databases, secrets, and signer keys.
10
- 4. Confirm required services are deployable: `npm run start:prod`, `npm run start:maintenance`, `npm run start:x402-gateway`.
7
+ 1. Confirm branch protection includes:
8
+ - `tests / kernel_v0_ship_gate`
9
+ - `tests / production_cutover_gate`
10
+ - `tests / offline_verification_parity_gate` (NOO-50)
11
+ - `tests / onboarding_policy_slo_gate`
12
+ - `tests / onboarding_host_success_gate`
13
+ - `tests / deploy_safety_smoke` (hosted baseline evidence path)
14
+ 2. Confirm release workflow is blocked unless NOO-50 and the kernel/cutover gates are green for the release commit.
15
+ 3. Confirm release workflow runs NOO-65 promotion guard and blocks publish lanes if `release-promotion-guard.json` verdict is not pass/override-pass.
16
+ 4. Confirm staging and production have separate domains, databases, secrets, and signer keys.
17
+ 5. Confirm required services are deployable: `npm run start:prod`, `npm run start:maintenance`, `npm run start:x402-gateway`.
18
+ 6. Configure GitHub Environment `production_cutover_gate` with:
19
+ - `PROD_BASE_URL`
20
+ - `PROD_TENANT_ID`
21
+ - `PROD_OPS_TOKEN`
22
+ - optional `PROD_PROTOCOL` (`1.0`)
23
+ 7. Require manual reviewers on `production_cutover_gate` before workflow secret access.
11
24
 
12
25
  ## Phase 1: Environment + secrets
13
26
 
@@ -74,6 +87,19 @@ This emits a machine-readable report at:
74
87
 
75
88
  4. Update `docs/ops/MCP_COMPATIBILITY_MATRIX.md` with pass/fail + date.
76
89
 
90
+ 5. Run clean-env onboarding host success gate:
91
+
92
+ ```bash
93
+ npm run test:ops:onboarding-host-success-gate -- \
94
+ --base-url https://api.settld.work \
95
+ --tenant-id tenant_default \
96
+ --api-key "$SETTLD_API_KEY" \
97
+ --attempts 3 \
98
+ --min-success-rate-pct 90 \
99
+ --report artifacts/gates/onboarding-host-success-gate.json \
100
+ --metrics-dir artifacts/ops/onboarding-host-success
101
+ ```
102
+
77
103
  ## Phase 5: Paid call + receipt proof
78
104
 
79
105
  1. Run a paid demo flow:
@@ -90,11 +116,22 @@ npm run demo:mcp-paid-exa
90
116
 
91
117
  Ship only when all are true:
92
118
 
93
- 1. Kernel v0 ship gate is green.
94
- 2. Hosted baseline evidence is green.
95
- 3. MCP compatibility matrix is green for supported hosts.
96
- 4. Paid MCP run artifacts verify cleanly.
97
- 5. Rollback runbook has been rehearsed.
119
+ 1. Kernel v0 ship gate, production cutover gate, and NOO-50 parity gate are green.
120
+ 2. Onboarding/policy SLO gate is green (`artifacts/gates/onboarding-policy-slo-gate.json`).
121
+ 3. Onboarding host success gate is green (`artifacts/gates/onboarding-host-success-gate.json`).
122
+ 4. Hosted baseline evidence is green.
123
+ 5. Go-live gate and launch cutover packet reports are present:
124
+ - `artifacts/gates/s13-go-live-gate.json`
125
+ - `artifacts/gates/s13-launch-cutover-packet.json`
126
+ - generated from a successful `go-live-gate` workflow run for the release commit
127
+ 6. NOO-65 promotion guard passes with required artifact binding (`artifacts/gates/release-promotion-guard.json`).
128
+ 7. MCP compatibility matrix is green for supported hosts.
129
+ 8. Paid MCP run artifacts verify cleanly.
130
+ 9. Rollback runbook has been rehearsed.
131
+
132
+ Run the live environment cutover gate before opening traffic:
133
+
134
+ `Actions -> production-cutover-gate -> Run workflow`
98
135
 
99
136
  ## Phase 7: Post-release
100
137
 
@@ -1,33 +1,41 @@
1
1
  # Trust Config Wizard
2
2
 
3
- The Trust Config Wizard is a lightweight way to bootstrap SLA policy configuration for common autonomous workflows.
3
+ Use this when you want to create an SLA policy config from a template.
4
4
 
5
- ## What it provides
5
+ ## Fastest path for onboarding
6
6
 
7
- - Built-in SLA policy templates for `delivery` and `security` verticals.
8
- - Template rendering with override support for SLA and metrics fields.
9
- - A validation path for preflight checks before policy deployment.
7
+ If you want a ready starter policy during host setup, run:
10
8
 
11
- ## API endpoint
9
+ ```bash
10
+ settld setup --yes --mode manual --host codex --base-url http://127.0.0.1:3000 --tenant-id tenant_default --api-key sk_live_xxx.yyy --profile-id engineering-spend --smoke
11
+ ```
12
12
 
13
- - `GET /ops/sla-templates`
14
- - Scope: `ops_read`
15
- - Optional query: `vertical=delivery|security`
16
- - Response: `SlaPolicyTemplateCatalog.v1` template catalog
13
+ This sets up host MCP config and applies a starter policy profile in one run.
17
14
 
18
- Example:
15
+ ## New policy wizard flow (template-based)
19
16
 
20
- ```sh
21
- curl -sS "http://localhost:3000/ops/sla-templates?vertical=security" \
22
- -H "x-proxy-ops-token: <ops_read_token>" | jq
17
+ 1. List templates:
18
+
19
+ ```bash
20
+ npm run trust:wizard -- list --format text
23
21
  ```
24
22
 
25
- ## CLI usage
23
+ 2. Preview one template:
26
24
 
27
- Run via npm script:
25
+ ```bash
26
+ npm run trust:wizard -- show --template delivery_standard_v1 --format text
27
+ ```
28
+
29
+ 3. Render a policy config file:
28
30
 
29
- ```sh
30
- npm run trust:wizard -- list --format json
31
+ ```bash
32
+ npm run trust:wizard -- render --template delivery_standard_v1 --overrides-json '{"metrics":{"targetCompletionMinutes":60}}' --out ./policy.delivery.json --format json
33
+ ```
34
+
35
+ 4. Validate the same overrides:
36
+
37
+ ```bash
38
+ npm run trust:wizard -- validate --template delivery_standard_v1 --overrides-json '{"metrics":{"targetCompletionMinutes":60}}' --format json
31
39
  ```
32
40
 
33
41
  Supported commands:
@@ -37,11 +45,16 @@ Supported commands:
37
45
  - `render --template <templateId> [--overrides-json <json>] [--out <path>] [--format json|text]`
38
46
  - `validate --template <templateId> [--overrides-json <json>] [--format json|text]`
39
47
 
40
- Example render command:
48
+ ## API endpoint
41
49
 
42
- ```sh
43
- npm run trust:wizard -- render \
44
- --template delivery_standard_v1 \
45
- --overrides-json '{"metrics":{"targetCompletionMinutes":60}}' \
46
- --format json
50
+ - `GET /ops/sla-templates`
51
+ - Scope: `ops_read`
52
+ - Optional query: `vertical=delivery|security`
53
+ - Response: `SlaPolicyTemplateCatalog.v1`
54
+
55
+ Example:
56
+
57
+ ```bash
58
+ curl -sS "http://localhost:3000/ops/sla-templates?vertical=security" \
59
+ -H "x-proxy-ops-token: <ops_read_token>" | jq
47
60
  ```
@@ -0,0 +1,348 @@
1
+ # Trust OS v1 (Jira-Ready Backlog)
2
+
3
+ Date: 2026-02-20
4
+ Owner: CEO / Product / Platform
5
+ Release Name: `Trust OS v1`
6
+ Release Objective: Ship a production-grade, rail-agnostic inter-agent trust kernel with deterministic policy enforcement, dispute/reversal handling, auditable receipts, and operator controls.
7
+
8
+ ## Scope Boundaries (v1)
9
+
10
+ In scope:
11
+ - Runtime decisions: `allow`, `challenge`, `deny`, `escalate`.
12
+ - Request binding, policy hash pinning, deterministic evidence/receipt export.
13
+ - Dispute lifecycle + arbitration verdict + automatic settlement/reversal outcome.
14
+ - Operator inbox (approval/escalation controls).
15
+ - One hardened rail adapter path.
16
+ - Three starter vertical profiles.
17
+
18
+ Out of scope:
19
+ - Policy marketplace and monetization.
20
+ - Full open discovery network.
21
+ - Building a new wallet rail.
22
+
23
+ ## Program Milestones
24
+
25
+ - Milestone M1 (Sprint 1): Enforcement core + request binding + receipt schema freeze.
26
+ - Milestone M2 (Sprint 2): Dispute/reversal runtime + operator inbox MVP.
27
+ - Milestone M3 (Sprint 3): Rail adapter hardening + profile system + release gate.
28
+
29
+ ## Epics
30
+
31
+ - `STLD-E2401` Policy Runtime Enforcement
32
+ - `STLD-E2402` Execution Binding + Evidence + Receipts
33
+ - `STLD-E2403` Dispute Court + Reversal Engine
34
+ - `STLD-E2404` Operator Inbox + Controls
35
+ - `STLD-E2405` Rail Adapter Hardening
36
+ - `STLD-E2406` Vertical Policy Profiles
37
+ - `STLD-E2407` QA, Conformance, and Release Gates
38
+
39
+ ## Jira Ticket Backlog
40
+
41
+ ### Epic `STLD-E2401` Policy Runtime Enforcement
42
+
43
+ #### `STLD-T2401`
44
+ - Type: Story
45
+ - Priority: P0
46
+ - Summary: Implement canonical runtime policy decision point (`allow/challenge/deny/escalate`) for all paid action paths.
47
+ - Owner: Backend Platform
48
+ - Estimate: 5d
49
+ - Dependencies: None
50
+ - Acceptance Criteria:
51
+ - Every paid action path calls policy runtime before execution.
52
+ - Decision output includes `decision`, `reasonCode`, `policyHash`, `policyVersion`, `decisionId`.
53
+ - Deterministic decision output for same input and policy version.
54
+
55
+ #### `STLD-T2402`
56
+ - Type: Story
57
+ - Priority: P0
58
+ - Summary: Add stable reason code registry and API surface for denied/challenged/escalated actions.
59
+ - Owner: Backend Platform
60
+ - Estimate: 3d
61
+ - Dependencies: `STLD-T2401`
62
+ - Acceptance Criteria:
63
+ - Reason codes are schema-validated and documented.
64
+ - API responses expose reason code and remediation hints.
65
+ - CLI/SDK map reason codes consistently.
66
+
67
+ #### `STLD-T2403`
68
+ - Type: Story
69
+ - Priority: P0
70
+ - Summary: Enforce policy evaluation at MCP entry points and bridge paths.
71
+ - Owner: MCP / Integrations
72
+ - Estimate: 3d
73
+ - Dependencies: `STLD-T2401`
74
+ - Acceptance Criteria:
75
+ - MCP tool calls cannot bypass policy runtime.
76
+ - MCP responses return policy decision metadata.
77
+ - Integration tests cover allowed/challenged/denied flows.
78
+
79
+ #### `STLD-T2404`
80
+ - Type: Task
81
+ - Priority: P1
82
+ - Summary: Add policy decision metrics and latency SLO instrumentation.
83
+ - Owner: DevOps / Observability
84
+ - Estimate: 2d
85
+ - Dependencies: `STLD-T2401`
86
+ - Acceptance Criteria:
87
+ - Metrics emitted: decision count by type/reason, eval latency p50/p95.
88
+ - Dashboard and alert thresholds configured.
89
+
90
+ ### Epic `STLD-E2402` Execution Binding + Evidence + Receipts
91
+
92
+ #### `STLD-T2410`
93
+ - Type: Story
94
+ - Priority: P0
95
+ - Summary: Enforce request binding between authorization token and canonical request fingerprint.
96
+ - Owner: Backend Platform
97
+ - Estimate: 4d
98
+ - Dependencies: `STLD-T2401`
99
+ - Acceptance Criteria:
100
+ - Request mutation/replay attempts fail with deterministic error code.
101
+ - Fingerprint algorithm is stable and versioned.
102
+ - Test vectors added for strict and side-effecting modes.
103
+
104
+ #### `STLD-T2411`
105
+ - Type: Story
106
+ - Priority: P0
107
+ - Summary: Bind policy hash/version and request hash into settlement decision records.
108
+ - Owner: Backend Platform
109
+ - Estimate: 2d
110
+ - Dependencies: `STLD-T2410`
111
+ - Acceptance Criteria:
112
+ - Decision records include policy/version/request binding fields.
113
+ - Offline verifier validates these bindings.
114
+
115
+ #### `STLD-T2412`
116
+ - Type: Story
117
+ - Priority: P0
118
+ - Summary: Ship `ReceiptBundle.v1` export with deterministic manifest and verification output.
119
+ - Owner: Protocol / Backend
120
+ - Estimate: 4d
121
+ - Dependencies: `STLD-T2411`
122
+ - Acceptance Criteria:
123
+ - Receipt bundle includes decision, settlement, and verification artifacts.
124
+ - Bundle verifies offline with strict mode.
125
+ - Repeat export produces identical canonical hashes.
126
+
127
+ #### `STLD-T2413`
128
+ - Type: Task
129
+ - Priority: P1
130
+ - Summary: Add SDK helpers for receipt retrieval/export across JS and Python.
131
+ - Owner: SDK
132
+ - Estimate: 3d
133
+ - Dependencies: `STLD-T2412`
134
+ - Acceptance Criteria:
135
+ - JS and Python SDK expose receipt export APIs.
136
+ - SDK smoke tests cover end-to-end retrieval and verification.
137
+
138
+ ### Epic `STLD-E2403` Dispute Court + Reversal Engine
139
+
140
+ #### `STLD-T2420`
141
+ - Type: Story
142
+ - Priority: P0
143
+ - Summary: Implement dispute case state machine (`opened`, `evidence_collected`, `under_review`, `verdict_issued`, `closed`).
144
+ - Owner: Backend Platform
145
+ - Estimate: 4d
146
+ - Dependencies: `STLD-T2411`
147
+ - Acceptance Criteria:
148
+ - State transitions are deterministic and idempotent.
149
+ - Invalid transitions are blocked with stable error codes.
150
+ - Case timeline is append-only and signed.
151
+
152
+ #### `STLD-T2421`
153
+ - Type: Story
154
+ - Priority: P0
155
+ - Summary: Implement verdict application pipeline to trigger automatic release/refund/reversal outcomes.
156
+ - Owner: Backend Platform
157
+ - Estimate: 4d
158
+ - Dependencies: `STLD-T2420`
159
+ - Acceptance Criteria:
160
+ - Verdict maps to deterministic financial outcome.
161
+ - Reversal entries are balanced and idempotent.
162
+ - Duplicate verdict processing does not double-settle.
163
+
164
+ #### `STLD-T2422`
165
+ - Type: Story
166
+ - Priority: P0
167
+ - Summary: Add dispute APIs and SDK wrappers for open/attach evidence/issue verdict.
168
+ - Owner: API + SDK
169
+ - Estimate: 3d
170
+ - Dependencies: `STLD-T2420`
171
+ - Acceptance Criteria:
172
+ - APIs exposed with authz enforcement.
173
+ - SDK wrappers for JS/Python and MCP tool surface.
174
+ - Contract tests cover happy and failure cases.
175
+
176
+ #### `STLD-T2423`
177
+ - Type: Task
178
+ - Priority: P1
179
+ - Summary: Add dispute SLA timers and escalation triggers.
180
+ - Owner: Backend Platform
181
+ - Estimate: 2d
182
+ - Dependencies: `STLD-T2420`
183
+ - Acceptance Criteria:
184
+ - Time-window breaches emit escalation events.
185
+ - Alerts and dashboards for aging disputes.
186
+
187
+ ### Epic `STLD-E2404` Operator Inbox + Controls
188
+
189
+ #### `STLD-T2430`
190
+ - Type: Story
191
+ - Priority: P0
192
+ - Summary: Build operator inbox page for challenged/escalated actions with approve/deny actions.
193
+ - Owner: Frontend
194
+ - Estimate: 5d
195
+ - Dependencies: `STLD-T2401`, `STLD-T2422`
196
+ - Acceptance Criteria:
197
+ - Operators can view pending items with policy context and evidence refs.
198
+ - Approve/deny writes signed operator action events.
199
+ - Pagination/filtering by tenant and severity.
200
+
201
+ #### `STLD-T2431`
202
+ - Type: Story
203
+ - Priority: P0
204
+ - Summary: Implement emergency controls: pause agent, quarantine, revoke delegation, kill switch.
205
+ - Owner: Backend + Frontend
206
+ - Estimate: 4d
207
+ - Dependencies: `STLD-T2430`
208
+ - Acceptance Criteria:
209
+ - Emergency actions are auditable and idempotent.
210
+ - Paused/quarantined agents cannot execute paid actions.
211
+ - Recovery flow documented and tested.
212
+
213
+ #### `STLD-T2432`
214
+ - Type: Task
215
+ - Priority: P1
216
+ - Summary: Add operator decision audit export for finance and compliance.
217
+ - Owner: Backend
218
+ - Estimate: 2d
219
+ - Dependencies: `STLD-T2430`
220
+ - Acceptance Criteria:
221
+ - Export contains decision metadata, actor, timestamp, reason, linked receipt/case IDs.
222
+
223
+ ### Epic `STLD-E2405` Rail Adapter Hardening
224
+
225
+ #### `STLD-T2440`
226
+ - Type: Story
227
+ - Priority: P0
228
+ - Summary: Harden one production adapter lane (`x402 + Stripe` or `x402 + AWAL`) under Trust OS enforcement.
229
+ - Owner: Integrations
230
+ - Estimate: 5d
231
+ - Dependencies: `STLD-T2403`, `STLD-T2412`, `STLD-T2421`
232
+ - Acceptance Criteria:
233
+ - End-to-end flow uses adapter with Trust OS decisions.
234
+ - Settlement and receipts remain deterministic.
235
+ - Replay and mutation attacks are rejected in adapter path.
236
+
237
+ #### `STLD-T2441`
238
+ - Type: Task
239
+ - Priority: P1
240
+ - Summary: Add adapter conformance tests and CI gate.
241
+ - Owner: QA / Integrations
242
+ - Estimate: 2d
243
+ - Dependencies: `STLD-T2440`
244
+ - Acceptance Criteria:
245
+ - CI fails on adapter regressions.
246
+ - Conformance report artifact uploaded per run.
247
+
248
+ ### Epic `STLD-E2406` Vertical Policy Profiles
249
+
250
+ #### `STLD-T2450`
251
+ - Type: Story
252
+ - Priority: P0
253
+ - Summary: Implement profile schema and profile hashing/signing contract.
254
+ - Owner: Protocol + Backend
255
+ - Estimate: 3d
256
+ - Dependencies: `STLD-T2401`
257
+ - Acceptance Criteria:
258
+ - Profile schema supports limits, allowlists, approval tiers, dispute defaults, compliance toggles.
259
+ - Profile hash is embedded in decisions/receipts.
260
+
261
+ #### `STLD-T2451`
262
+ - Type: Story
263
+ - Priority: P0
264
+ - Summary: Add CLI commands: `settld profile init`, `validate`, `simulate`.
265
+ - Owner: CLI
266
+ - Estimate: 4d
267
+ - Dependencies: `STLD-T2450`
268
+ - Acceptance Criteria:
269
+ - `init` scaffolds profile manifest and rules.
270
+ - `validate` performs schema + semantic checks.
271
+ - `simulate` runs policy against provided scenarios and outputs deterministic results.
272
+
273
+ #### `STLD-T2452`
274
+ - Type: Story
275
+ - Priority: P0
276
+ - Summary: Ship three starter profiles: `engineering-spend`, `procurement`, `data-api-buyer`.
277
+ - Owner: Product + Backend
278
+ - Estimate: 3d
279
+ - Dependencies: `STLD-T2451`
280
+ - Acceptance Criteria:
281
+ - Profiles are packaged and documented.
282
+ - Simulation fixtures pass in CI.
283
+
284
+ #### `STLD-T2453`
285
+ - Type: Task
286
+ - Priority: P1
287
+ - Summary: Add profile docs and quickstart guides in MkDocs/GitBook.
288
+ - Owner: Docs
289
+ - Estimate: 2d
290
+ - Dependencies: `STLD-T2452`
291
+ - Acceptance Criteria:
292
+ - Docs include usage, simulation examples, and troubleshooting.
293
+
294
+ ### Epic `STLD-E2407` QA, Conformance, and Release Gates
295
+
296
+ #### `STLD-T2460`
297
+ - Type: Story
298
+ - Priority: P0
299
+ - Summary: Add security regression tests for replay, token mutation, bypass attempts, and unauthorized escalation actions.
300
+ - Owner: QA / Security
301
+ - Estimate: 3d
302
+ - Dependencies: `STLD-T2410`, `STLD-T2431`
303
+ - Acceptance Criteria:
304
+ - Automated test suite covers top abuse paths.
305
+ - CI blocks release on failures.
306
+
307
+ #### `STLD-T2461`
308
+ - Type: Story
309
+ - Priority: P0
310
+ - Summary: Add end-to-end deterministic test: challenge -> operator approve -> execute -> receipt -> dispute -> verdict -> reversal.
311
+ - Owner: QA
312
+ - Estimate: 3d
313
+ - Dependencies: `STLD-T2422`, `STLD-T2430`
314
+ - Acceptance Criteria:
315
+ - E2E test runs in CI and emits artifact traces.
316
+ - Idempotency and deterministic output asserted.
317
+
318
+ #### `STLD-T2462`
319
+ - Type: Task
320
+ - Priority: P0
321
+ - Summary: Enforce release gate checklist for Trust OS v1 (conformance, receipts, disputes, adapters, docs).
322
+ - Owner: DevOps
323
+ - Estimate: 2d
324
+ - Dependencies: `STLD-T2460`, `STLD-T2461`, `STLD-T2441`, `STLD-T2453`
325
+ - Acceptance Criteria:
326
+ - Release workflow blocks tag publish if any gate fails.
327
+ - Release artifact bundle includes proof of all required checks.
328
+
329
+ ## Sprint Plan (Suggested)
330
+
331
+ ### Sprint 1 (Weeks 1-2)
332
+ - `STLD-T2401`, `STLD-T2402`, `STLD-T2403`, `STLD-T2410`, `STLD-T2411`, `STLD-T2460`
333
+
334
+ ### Sprint 2 (Weeks 3-4)
335
+ - `STLD-T2412`, `STLD-T2420`, `STLD-T2421`, `STLD-T2422`, `STLD-T2430`, `STLD-T2431`
336
+
337
+ ### Sprint 3 (Weeks 5-6)
338
+ - `STLD-T2440`, `STLD-T2441`, `STLD-T2450`, `STLD-T2451`, `STLD-T2452`, `STLD-T2461`, `STLD-T2462`, `STLD-T2453`
339
+
340
+ ## Release Exit Criteria (Trust OS v1)
341
+
342
+ - Runtime policy enforcement is mandatory for all paid actions.
343
+ - Request binding enforcement blocks replay/mutation attempts.
344
+ - Receipt bundle export verifies offline in strict mode.
345
+ - Dispute->verdict->financial outcome is deterministic and replay-safe.
346
+ - Operator emergency controls are audited and tested.
347
+ - One rail adapter path is production-hardened and conformance-gated.
348
+ - Three vertical profiles are documented and simulation-tested.