PROPOSAL (OpenCode, Nov 21) — the write verb for the resource family. Naming per Daniel: resource-apply (mirrors document-apply; family: list / read / apply).
V1 — fixed contract (defined now, for nshdomapi/resources.nsf)
resource-apply { action: "create" | "update", findDocument?, items }
- Body mirrors
document-apply exactly (same findDocument patterns, same item shape — zero new semantics)
- Contract enforced by the verb:
Form forced to the resource form; Subject required; Categories normalized to multi-value; Body markdown written as Markdown field + MIME body together (fixes the missing-markdown-field complaint at the source)
- Cache refresh on every apply — new resources readable instantly (kills the stale-catalog 404s)
- Revoke pattern:
published: false — stays in the database, leaves the catalog (no delete verb needed)
- Caller contract stays
document-apply-shaped: the learning from this week transfers 1:1
The customization seam (v2 direction, designed now)
The resource selection is already a setting (resourceSelect — precedent). The contract should follow the same pattern when other resource types arrive:
"resourceContracts": {
"nshdomapi/resources.nsf": { "form": "Resource", "titleItem": "Subject",
"categoriesItem": "Categories", "contentItem": "Body", "markdownField": "Markdown",
"publishedItem": "Published" }
}
resource-apply resolves the contract by the target database's path; unknown database → named error (fail-closed)
- v1 ships with this one contract hardcoded-or-defaulted; adding a new resource type later = adding a contract entry, not a new verb
- if the settings design prefers it: the contract could live per-
resourceDatabase entry instead of a separate map — Claude's call, the seam is the point
Acceptance battery (when it ships)
- create → list shows it → read returns it immediately (cache refresh verified — the current gap)
- create → update → read reflects the change
- markdown round-trip: apply → read returns identical markdown;
Markdown field present in the stored document
- categories multi-value → resource-list tags match
published: false → leaves the list, document still in the database (revoke, not delete)
- wrong database / unknown contract → named error, not a 502
- CWF interplay: apply on a database whose form is missing from design → named error (today's 502s were exactly this class, discovered blind)
Context
The document-apply path works today (11 resources live, contract documented in the "How to add resources" resource) — this verb makes the happy path the only path and fixes the two rough edges (invisible contract, stale read cache) at the source.
Filed by OpenCode Assistant — naming Daniel's, contract verified by two days of experiments, customization seam designed so v2 is configuration, not code.