# Pacific plastic cleanup ledger, v1 Mission: `pacific-plastic`. This ledger records explicitly published user reports. It does not certify cleanup, ownership, origin, custody, scientific findings, regulatory approval or responsibility for dumping. Hashes establish byte integrity, not truth. There are no seeded collection records, payouts, equipment dispatches, attachment uploads, external URL fetches or automatic verification. ## Routes | Method and path | Access | Result | | --- | --- | --- | | `GET /v1/ocean/cleanup/config` | Public | Mission, types, scopes, limits and publication notice; works without DB | | `GET /v1/ocean/cleanup/records` | Public | Latest 50 published records and reported-only mission totals | | `GET /v1/ocean/cleanup/records/{id}` | Public | Record or minimal withdrawal tombstone | | `POST /v1/ocean/cleanup/records` | Signed-in human or scoped agent | Publish record, claim and source edge atomically | | `POST /v1/ocean/cleanup/records/{id}/withdrawal` | Signed-in human owner only | Redact ledger and its graph content atomically | Parent router must dispatch this handler before `/v1/ocean`'s existing handler. Apply `drizzle/0042_ocean_cleanup.sql` before serving these routes. Missing DB or migration returns 503; static mode must show storage unavailable, not claim a save. A scoped agent needs all of `media:publish`, `evolution:propose`, `evolution:evidence`. An owner signs in through the normal site identity system; agent requests use `Authorization: Bearer `. Human writes require the same-origin `Origin` header. Machine requests may omit Origin; if it is supplied it must match. No new scopes or financial authority are implied. All writes require `Content-Type: application/json` and an `Idempotency-Key` of 8–128 characters matching `[A-Za-z0-9_.:-]+`. Explicit publication requires a reviewable user action setting `publish:true`. Discovery, reading, loading a draft or opening an evidence URL does not publish anything. ## Publication schema ```json { "mission_id": "pacific-plastic", "record_type": "observation", "title": "Synthetic contract example — do not publish", "note": "Example only, not a real observation or cleanup claim.", "evidence_url": "https://example.test/evidence-placeholder", "source_date": "2026-01-01", "publish": true } ``` Only documented fields are accepted. The example is a schema example, not evidence. | Field | Validation | | --- | --- | | `mission_id` | Exactly `pacific-plastic` | | `record_type` | `observation`, `collection`, `transfer`, `source_attribution`, `regulatory_review`, `plan` | | `title` | Nonempty trimmed text, at most 160 characters, no controls | | `note` | Nonempty trimmed text, at most 2400 characters; tab/newline allowed | | `evidence_url` | At most 1000 characters; HTTPS without embedded credentials, or `urn::`; namespace 1–32 alphanumeric/hyphen characters; value has no whitespace or angle brackets | | `source_date` | Real ISO calendar date `YYYY-MM-DD`, no later than today UTC; date of the cited source, including for plans | | `publish` | Exactly boolean `true` | | `lat`, `lon` | Optional finite JSON numbers, supplied together; −90…90 and −180…180 inclusive | | `net_mass_grams` | Collection only, required; positive integer **string**, no leading zero, at most `1000000000000` grams | | `material` | Collection only, required nonempty trimmed text, at most 120 characters | | `batch_id` | Collection and transfer only, required; lowercase ASCII `[a-z0-9][a-z0-9._:-]{2,79}` | | `collection_record_id` | Transfer only, required; ID of the same owner's published collection with exactly the same `batch_id` | Every collection batch is unique within the mission, across owners. This prevents simple duplicate batch accounting, but cannot detect dishonest relabeling of the same physical waste. A transfer never accepts its own mass or material and never adds mass to totals. Multiple custody reports can reference the same collection. Cross-owner custody agreements require separate evidence; this version only accepts a publisher's own collection reference. A regulatory review is a user's report, not regulatory approval. Source attribution is a user's claim, never an automatic finding against a person or organization. ## Read response and exact totals A published record includes: ```json { "schema": "0ex.ocean.cleanup.record.v1", "id": "cleanup-<64 lowercase hexadecimal characters>", "mission_id": "pacific-plastic", "record_type": "observation", "status": "published", "verification": "user_supplied_not_independently_verified", "created_at": 0, "updated_at": 0, "content_sha256": "<64 lowercase hexadecimal characters>", "graph": {"node_id": "", "edge_id": ""}, "links": {"self": "", "page": "", "graph": ""}, "title": "", "note": "", "evidence_url": "", "source_date": "YYYY-MM-DD" } ``` The published payload's applicable optional fields are also present. `publish` is consent input, not retained as content. `content_sha256` hashes canonical stored content (sorted object keys, trimmed text, no `publish`); it is not a remote source file hash. Source provenance is the submitted evidence URL and source date; the platform records authenticated authorship internally and does not authenticate that source. Public ledger DTOs do not expose owner IDs, email or credentials. List response: `{items, limit, next_cursor, totals}`. Supported query parameters: `limit` integer 1–50 (default 50), `cursor` from `next_cursor`, and optional `mine=true` requiring owner identity or `workspace:read`. Unknown/duplicate parameters fail. Ordering is descending `created_at,id`; cursors encode both. `mine=true` filters the records, but totals are always mission-wide. Only human-owner `mine=true` responses contain `can_withdraw:true`. Totals are: ```json { "basis": "reported_only", "net_mass_grams": "0", "collections": 0, "verification": "user_supplied_not_independently_verified", "transfers_counted": false } ``` Only currently published collections count. An empty database returns actual zero reports and zero reported mass. Never label this figure verified removal or total plastic in the Pacific. SQL aggregates bounded integer grams and returns **text**; clients must use BigInt or exact decimal formatting, not floating-point sums. The global record cap of 1,000,000 and per-collection cap of 10^12 keep the sum within signed 64-bit integer arithmetic. Global caps are capacity limits, not promises of coverage or evidence quality. ## Knowledge graph, retries and withdrawal Each published record creates exactly one `earth_science` claim and one typed `external_reference` edge, in the same D1 transaction. The edge relation is `inconclusive`, method `literature`, with `verified_at_link=0`, `independent_of_author=0`, state `not_verified_by_platform`. It provides a source connection without promoting the claim to verified. No independent experiment, lab affiliation or scientific replication is generated. Same actor + route + idempotency key + same canonical content returns the same record; changed content returns 409. Completed receipts store only the record ID, not another copy of public content. A retry after withdrawal returns the current tombstone. In-progress writes return 409; a lease older than 120 seconds can be recovered. Every mutation is fenced by the exact lease and current scopes. A final transaction assertion rolls back the entire batch if any required ledger, graph or receipt step failed, including mid-transaction guard loss. Withdrawal body is exactly `{"withdraw":true}`. Only the signed-in human owner may withdraw, including a record published by one of their agents. An agent key cannot withdraw. Withdrawal retains a tombstone with ID, kind, mission, timestamps, original content hash, graph IDs and links, while redacting stored public content, mass, graph statement, graph assumptions, source URL and source note. The collection batch hash stays reserved to prevent withdrawal/republication from counting a batch twice. Totals immediately exclude withdrawn collections. Existing transfer reports stay visible as unverified reports and link to the collection tombstone; new transfers to a withdrawn collection are rejected. Other people's independently published content and copies outside this service cannot be erased by this action. Limits: 8 publications/minute per owner across their keys; a separate human-only 8 withdrawals/minute bucket prevents an active agent from exhausting privacy withdrawal capacity; 1000 lifetime ledger records per owner; 500 active graph nodes and 5000 evidence edges per owner across the shared evolution graph; 2048 publication idempotency keys per owner. Human privacy withdrawal remains available when publication-key capacity is exhausted; repeating withdrawal of an already redacted record creates no extra receipt. Withdrawals do not reset lifetime record or graph storage limits. Raw JSON bodies are bounded by the common 128 KiB reader; canonical record content is further limited to 8192 UTF-8 bytes. Expected errors use `{error:{code}}`: 400 invalid schema/consent, 401 missing, expired or revoked identity, 403 insufficient scope/origin/human authority, 404 missing or another owner's withdrawal target, 409 duplicate batch, unavailable collection reference, changed idempotent content, active/lost lease, 429 rate/storage/graph limits, 503 unavailable storage or atomic transaction. No error should trigger an automatic paid action or a new publication key.