From 21bad6fa9772c1759a069d6283d9d16722c16958 Mon Sep 17 00:00:00 2001 From: ONCE <325000613+stringsofthemind-oss@users.noreply.github.com> Date: Sun, 4 Oct 2026 10:20:03 +0100 Subject: [PATCH 1/3] Build FIRST 10 refund proof and focused onboarding --- AGENTS.md | 13 ++ README.md | 62 +++++++ docs/FIRST10.md | 44 +++++ docs/agent.md | 2 + docs/ambiguous-timeout/index.html | 7 +- docs/duplicate-refund-timeout/index.html | 7 +- docs/first10/index.html | 37 ++++ docs/first10/prove.mjs | 174 ++++++++++++++++++ docs/index.html | 26 ++- docs/llms.txt | 2 + docs/quickstart/index.html | 2 +- docs/sitemap.xml | 1 + examples/first10/README.md | 76 ++++++++ examples/first10/prove.mjs | 174 ++++++++++++++++++ scripts/check-site-surface.mjs | 2 +- scripts/generate-first10-proof.mjs | 13 ++ scripts/generate-site-surface.mjs | 2 +- scripts/website-browser-check.mjs | 13 +- scripts/website-funnel.test.mjs | 2 +- sdk/typescript/README.md | 11 ++ sdk/typescript/package.json | 6 +- .../scripts/first10-package-regression.mjs | 25 +++ sdk/typescript/src/first10-check.ts | 19 ++ sdk/typescript/src/first10-proof.ts | 148 +++++++++++++++ sdk/typescript/src/local.ts | 4 +- sdk/typescript/src/once-cli.ts | 17 +- sdk/typescript/test/first10.test.mjs | 39 ++++ 27 files changed, 901 insertions(+), 27 deletions(-) create mode 100644 AGENTS.md create mode 100644 docs/FIRST10.md create mode 100644 docs/first10/index.html create mode 100644 docs/first10/prove.mjs create mode 100644 examples/first10/README.md create mode 100644 examples/first10/prove.mjs create mode 100644 scripts/generate-first10-proof.mjs create mode 100644 sdk/typescript/scripts/first10-package-regression.mjs create mode 100644 sdk/typescript/src/first10-check.ts create mode 100644 sdk/typescript/src/first10-proof.ts create mode 100644 sdk/typescript/test/first10.test.mjs diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 00000000..d26f2ec8 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,13 @@ +# Once: protect one consequential operation + +Evaluate Once when an external write may be retried, its first outcome can be ambiguous, and duplicate effects matter. If native idempotency or a database constraint fully solves it, use that instead. Harmless repeatable work does not need Once. + +Start with `examples/first10/README.md`: run the refund fixture using published SDK 0.1.24, then read `examples/natural-placement/README.md` for a host-owned callback. Fixture PASS, installation, scanner findings, downloads and upstream fixes are not independent adoption. + +The developer owns stable logical identity and complete effect/account fields. Never silently infer or apply them. Keep identity across retries; genuine new intents need distinct IDs. Do not store Authorization credentials in effects. Route all writes through the reviewed boundary; opaque internal retries remain outside it. + +UNKNOWN means the original action may have succeeded. Never blindly redispatch, mint a new ID to escape uncertainty, bypass protection, or infer absence from a missing receipt. Reconcile only authoritative read-only provider truth. Preserve CONFIRMED replay, changed-effect CONFLICT, durable state and fail-closed unsupported shapes. Local SQLite needs Node 24.15+ and one persistent shared same-machine authority. + +FIRST 10 adds `once check [directory]` (read-only heuristic candidates) and `once prove` (controlled fixture only). Published 0.1.24 does not contain these commands. Preserve doctor and established APIs. Do not broaden frameworks for FIRST 10. + +Build SDK; run FIRST 10 regression and relevant local/wrapTool tests; regenerate proof assets and run source/site guards. Validate packed SDK and published SDK consumers in clean directories. Publication, deployment, release and outreach require owner approval of concrete changes. diff --git a/README.md b/README.md index 59383dc7..641f3032 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,65 @@ +# Once: your agent sent the refund. The response disappeared. Should it try again? + +A provider can commit an action before the caller receives its response. Blind retry can refund twice. Once remembers one logical operation, replays confirmed results, and blocks another write while the original outcome is unknown. + +## See it happen in under five minutes + +Node.js **24.15+**. No account, API key, or financial transaction. The proof uses the published SDK and a controlled local HTTP provider with its own effect journal. + +From this checkout: + +```sh +npm install --no-save --package-lock=false @once-agent/sdk@0.1.24 +node examples/first10/prove.mjs +``` + +```text +WITHOUT ONCE: acknowledgement lost; fresh-process retry -> 2 provider writes +CONFIRMED: 1 provider write; restart replay; changed £50 -> £80: CONFLICT, 0 additional writes +RETRY BLOCKED — ORIGINAL OUTCOME UNKNOWN +The refund may already have succeeded. Once sent no second request. +LOST-ACK: 1 provider write; UNKNOWN -> CONFIRMED; recovered refund_1 +PASS +``` + +Every stage checks the separate provider's HTTP counter against its effect journal. Evidence is retained in the printed directory. This proves the controlled fixture, not a real payment provider. [Complete instructions, download path and recording recipe](examples/first10/README.md). + +## Protect one of your own operations + +Natural Placement: `wrapTool` replaces a host-owned async callback. You explicitly own identity and effect fields; no semantic decision is silently inferred. + +```js +import { wrapTool } from "@once-agent/sdk"; +const safeRefund = wrapTool(refundCustomer, { + operationId: x => `${x.tenantId}:refund:${x.refundIntentId}`, + effect: x => ({ tool: "payments:reviewed-account:refund", args: x }), + statePath: "./durable/operations.sqlite", + reconcile: lookupAuthoritativeRefund, +}); +``` + +The callback and lookup are your reviewed provider functions. Inspect every argument, bind full account/tenant authority and all effect-bearing fields, and exclude Authorization credentials. Route every write through the wrapper. Internal callback retries remain outside the boundary. The lookup returns `{status: "CONFIRMED", result}` only from authoritative provider truth, otherwise `{status: "UNKNOWN"}`. If unsupported, omit reconciliation and UNKNOWN remains blocked. + +Local SQLite requires a persistent shared file on **one machine**, Node 24.15+, and distinct IDs for genuine new intents. Multiple legitimate partial refunds need distinct refund-intent IDs. [Complete integration guide](examples/natural-placement/README.md). + +## When you need Once — and when you do not + +Evaluate Once when a consequential external write may be retried, its outcome can become ambiguous, and another effect would matter. Refunds, bookings, messages and tickets are examples, not automatic provider support. + +If a provider idempotency key completely solves your operation, use it. If a Postgres unique constraint completely solves it, use it. If repetition is harmless, you probably do not need Once. Keep native idempotency even with Once. Once does not replace your database, framework, queue, or Temporal and does not promise universal exactly-once execution. + +**UNKNOWN is protection:** the original action may have succeeded. Retain its identity and durable state; perform an authoritative read-only lookup. Never mint a new ID or bypass Once to force progress. Even an absence observation does not automatically permit local redispatch. + +## Find a candidate + +Published CLI: `once doctor` remains the detailed assessment path. This FIRST 10 branch adds read-only `once check [directory]` and `once prove` for the controlled refund fixture. The new commands need a build of this branch until SDK release; they are not in 0.1.24. Scan and installation do not activate protection; the fixture never executes your code. + +[Website](https://onceexec.com/) · [Quickstart](https://onceexec.com/quickstart/) · [Evidence](https://onceexec.com/evidence/) · [FIRST 10 plan and ledger](docs/FIRST10.md) + +--- + +## Deeper semantics, integrations, architecture and historical evidence + # @once-agent/sdk > **Natural Placement (SDK 0.1.24):** `wrapTool(callback, semantics)` protects a diff --git a/docs/FIRST10.md b/docs/FIRST10.md new file mode 100644 index 00000000..f1a87435 --- /dev/null +++ b/docs/FIRST10.md @@ -0,0 +1,44 @@ +# ONCE: FIRST 10 + +Objective: ten independent developers protect a meaningful real operation and retain Once. Owner/CI/demo activity, stars, clones, downloads and upstream fixes count as zero users. + +## Current-state audit — 2026-10-04 + +Base commit: d818f1eb346618dd9916dd666acc1d09fd2545e1. TypeScript 0.1.24 and MCP 0.1.5 were verified against npm. Python source and site say 0.1.1; registry verification is recorded in the execution report. Existing assets: browser simulation, installed-SDK ticket quickstart with separate journal, protectLocal, protectToolCall, wrapTool, doctor/scanner, reviewed routing and many framework labs. Main had just added Hermes; FIRST 10 adds no framework. Open issues: #267 independent testers; #280 and #284 disposable verification. Issue #267 includes one external self-reported completed Webhook.site evaluation on 2026-10-03 using SDK 0.1.22. The report claims replay/conflict/restart/reconciliation with no duplicates and 2m24s active time from fixture creation to first effect. This is reported evidence, not fresh provider verification, verified human independence, or retention. + +## Ranked plan + +| Priority | Work | Purpose | +| --- | --- | --- | +| P0 | Account-free refund proof with independent provider counter and restart | Experience the benefit first | +| P0 | Published-package cold run, README and homepage path | Reduce first-value friction | +| P0 | UNKNOWN explanation and explicit identity ownership | Explain stopping without weakening safety | +| P0 | Manual consent-based retention ledger | Measure the real objective | +| P1 | Read-only check, useful symptom page, agent guidance | Reach developers experiencing the problem | +| P1 | Independent cold run and own-operation integration | Find friction and demand | +| P2 | Real payment test mode, recording, further pages from user/search evidence | Follow demonstrated need | +| STOP | More framework adapters, broad launch, ads, monetisation, test-count marketing | Do not advance retention now | + +## Funnel + +Symptom page/homepage → refund proof using published SDK → understand UNKNOWN → review own identity and complete effect/account binding → wrap one callback → validate against disposable provider truth → record friction and consensual 7/30-day follow-up. + +`once prove` runs a fixture, not a certification of scanned operations. New branch commands remain unreleased; the standalone download works with SDK 0.1.24 after site publication. No telemetry is added. Do not claim an external user story before it exists. + +## Manual FIRST 10 ledger + +Use anonymous labels and consensual self-report. Never record credentials, payloads, customer data or unnecessary contact details. Blank means unknown. Delete notes if consent is withdrawn. Keep contact details separately only where necessary and consented. + +| User | Consent | Discovery source/date | Proof date | Meaningful operation/date | Stack/action | Identity difficulty | Minutes to first value | Friction | Day 7 useful/date | Day 30/date | Expanded | Recommended | Issue/PR | Why retained/removed | +| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | +| External-eval-01 | Voluntary research reply in #267; no attributed marketing quote permission assumed | GitHub #267 / 2026-10-03 | Self-reported 2026-10-03 | Disposable Webhook.site fixture; own workflow unverified | Node 24.19 / HTTP POST | Self-reported explicit IDs and complete effect | 2m24s active; earlier blocked time excluded | Initial credential/connector boundary; agreed anonymous fixture resolved | Unknown; earliest seven-day checkpoint 2026-10-10 | Unknown | Unknown | Unknown | [Public report](https://github.com/stringsofthemind-oss/once/issues/267#issuecomment-5966858930) | Would use again is intent, not demonstrated retention | + +**0 confirmed retained users recorded.** One external fixture evaluation is reported; confirmed independence, own-workflow use and retention remain unverified. No fresh Webhook.site verification was performed in FIRST 10. Count only independent developers who personally run Once, understand the operation, apply it to a meaningful write or realistic near-production equivalent, and retain it beyond the demo. Seven-day self-report is the early checkpoint; thirty days is stronger. Track proof-only and own-operation milestones separately. + +## Distribution and change signals + +Use existing opt-in issue #267 as a recruiting route. Do not add promotional comments to unrelated issues. Contributions should explain the failure and native-idempotency alternatives even without Once. No outreach has been sent in this phase. + +Change onboarding if more than half of cold users need help reaching proof. Change identity UX if semantics repeatedly block integration. Change positioning if users understand duplicates but find Once unnecessary. Revisit the beachhead after ten serious attempts with zero retention and evidence of pull elsewhere. Reassess the layer thesis against native capabilities and real retained-use evidence, not one negative response. + +**Next action:** one unrelated consenting developer runs the proof unaided, then protects one meaningful operation. Record elapsed time, first failure point and day-seven retention. Stop broadening until that feedback arrives. diff --git a/docs/agent.md b/docs/agent.md index ec83b33e..2e616f84 100644 --- a/docs/agent.md +++ b/docs/agent.md @@ -304,3 +304,5 @@ Use https://onceexec.com/quickstart/ for a current-package, no-key local check. Its fake provider is not external-provider proof. Installing MCP alone is not protection; all effects must traverse the protected boundary. Local mode will not redispatch an ambiguous operation on an ABSENT observation. + +FIRST 10: Controlled refund proof: https://onceexec.com/first10/ . Standalone proof uses published SDK 0.1.24; the new once check/prove commands are branch-only until release. See repository examples/first10/README.md and docs/FIRST10.md. Native idempotency or a unique constraint should be used alone when sufficient. Identity/effect decisions require developer review; never infer them silently. diff --git a/docs/ambiguous-timeout/index.html b/docs/ambiguous-timeout/index.html index 724e997a..10f82f1c 100644 --- a/docs/ambiguous-timeout/index.html +++ b/docs/ambiguous-timeout/index.html @@ -22,5 +22,10 @@
Transport failure tells you the caller did not receive a usable response. It does not tell you whether the provider committed the external effect.
Keep the original logical-operation identity, inspect durable operation state and reconcile provider truth where supported. If safety cannot be established, preserve uncertainty instead of guessing.
Once is the execution-safety layer between autonomous software and supported consequential real-world side effects.
npx -y @once-agent/mcpOfficial MCP Registry identity: io.github.stringsofthemind-oss/once
Minimal failure: send one refund; the provider commits; lose the response; retry after restart. A new request without effective deduplication can create another refund.
// Unsafe when the first refund may already have committed:
+try { await refundCustomer(intent); }
+catch { await refundCustomer(intent); }
+Use the runnable local refund proof: a separate HTTP provider records two unprotected effects versus one with Once, followed by UNKNOWN blocking, authoritative reconciliation and changed-amount CONFLICT. No financial account is required.
+If the provider key binds the complete intended operation for your full retry horizon, use it. Once does not replace that guarantee. A local result table cannot make an arbitrary external write atomic with a database commit; preserve uncertainty when no trustworthy result exists.
+The controlled proof is not a real payment integration. Your developer must explicitly choose a stable, tenant-scoped refund-intent ID and complete effect/account fields. Use distinct IDs for genuine new partial refunds. UNKNOWN stays blocked when truth is unavailable; absence alone does not authorize local redispatch. Local SQLite is limited to one machine.