Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -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.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ Historical SDK change notes are recorded here. For current published versions an
changes after the entries below, see the [public release history](https://github.com/stringsofthemind-oss/once/releases).
Website-only changes do not alter SDK execution semantics.

## 0.1.25 - 2026-10-04

- Add `once prove`: account-free local HTTP refund fixture with separate provider journal, acknowledgement loss, fresh processes, replay, CONFLICT and authoritative recovery. It never invokes arbitrary application code.
- Add read-only `once check [directory]` using the existing heuristic scanner; no identity/effect inference or activation. Existing doctor and APIs remain available.
- Clarify UNKNOWN error wording without changing the safety engine, state schema, bindings or reconciliation authority.
- Add symptom-first onboarding and FIRST 10 evidence/retention guidance. See [release notes](docs/RELEASE_0_1_25.md).

## 0.1.24 - 2026-10-03

- Add public `wrapTool(callback, semantics)` over `protectToolCall` and `protectLocal`; no new safety engine.
Expand Down
62 changes: 62 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
44 changes: 44 additions & 0 deletions docs/FIRST10.md
Original file line number Diff line number Diff line change
@@ -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.
13 changes: 13 additions & 0 deletions docs/RELEASE_0_1_25.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# SDK 0.1.25 — FIRST 10

This patch adds `once prove` (a controlled local refund fixture) and `once check [directory]` (read-only heuristic candidate assessment). Existing doctor and SDK APIs remain unchanged. Node 24.15+ is required for the local SQLite proof; the package's other paths retain their existing runtime contracts.

The proof starts a separate loopback HTTP provider with a flushed effect journal and starts a fresh caller process at each stage. It independently observes provider counts: two effects after an unprotected retry; one after protected replay, acknowledgement loss, blocked restarted retry, changed-effect conflict, unavailable/negative truth, authoritative reconciliation and recovered replay.

The fixture demonstrates this controlled provider, not an arbitrary application or real financial integration. `once prove` never calls user application code. `once check` uploads no source, changes no application files and cannot establish complete semantics or safety from absence of findings.

No state machine, durable schema, identity/fingerprint algorithm, provider authority or redispatch rule changed. UNKNOWN remains unresolved uncertainty. Only authoritative positive confirmation enables recovery; unavailable truth and absence do not permit local redispatch. Developers own identity and complete effect/account bindings. Preserve provider-native idempotency. No new framework adapter was added.

Publication gates: complete release and Linux CI matrix, source/standalone parity, packed ESM/CommonJS/types and new CLI consumers, package-content inspection and matching tested tarball integrity. Website installation pins are synchronized only after registry verification. MCP and Python versions and historical evidence pins remain independent.

FIRST 10 engineering readiness is not adoption: unaided independent proof, meaningful own-operation use and seven-day retention remain to be measured.
2 changes: 2 additions & 0 deletions docs/agent.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
7 changes: 6 additions & 1 deletion docs/ambiguous-timeout/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,10 @@ <h2>Why timeout handling matters</h2>
<p>Transport failure tells you the caller did not receive a usable response. It does not tell you whether the provider committed the external effect.</p><h2>Safer recovery</h2>
<p>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.</p>
<div class="claim"><strong>Claim boundary:</strong> Once does not claim universal exactly-once execution. Safety depends on stable operation identity, durable Once state, the provider integration and sufficiently authoritative provider truth. When the outcome cannot be established safely, Once can preserve uncertainty rather than assume another external execution is safe.</div>
<div class="cta"><h2>Use Once for this failure mode</h2><p>Once is the execution-safety layer between autonomous software and supported consequential real-world side effects.</p><pre><code>npx -y @once-agent/mcp</code></pre><p>Official MCP Registry identity: <code>io.github.stringsofthemind-oss/once</code></p><p><a href="../demo/">Run the retry simulation</a> · <a href="https://www.npmjs.com/package/@once-agent/mcp">MCP package</a> · <a href="https://github.com/stringsofthemind-oss/once">Source</a></p></div>
<h2>Run the failure yourself</h2><p>Minimal failure: send one refund; the provider commits; lose the response; retry after restart. A new request without effective deduplication can create another refund.</p><pre><code>// Unsafe when the first refund may already have committed:
try { await refundCustomer(intent); }
catch { await refundCustomer(intent); }</code></pre>
<p>Use the <a href="../first10/">runnable local refund proof</a>: 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.</p>
<h2>When an idempotency key solves it</h2><p>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.</p>
<h2>Limits and next action</h2><p>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.</p><p><a href="../first10/">Run the proof and apply the wrapper pattern →</a></p>
</article></main><footer class="footer"><div class="wrap"><a href="../">Once</a><a href="../llms.txt">llms.txt</a><a href="../agent.md">Agent guide</a><span>AI agent execution safety · MCP idempotency · safe retries</span></div></footer></body></html>
Loading
Loading