Setup
Clone the repo and install:
Against the hosted app, that looks like:
Run example 02 first. It seeds the record type and records that the other five read.
The scripts
01. Pull records
01. Pull records
spaces.list, search.metadataKeys, records.types, records.query, pages.get, pages.getMarkdown, pages.links.02. Write back
02. Write back
deal-memo page template with a metadata schema), creates deal records from it, then shows the write primitives: schema-validated metadata patches with set and idempotent appendUnique, optimistic-concurrency body updates, revision notes, and the per-key metadata audit trail.The interesting moment is step 3, where a bad stage value is rejected with a 400 before it ever lands. Safe to re-run: the template upserts a new revision, existing records are skipped, and appendUnique never duplicates.Key calls: pages.upsert, records.create, pages.patchMetadata, pages.update with expectedVersion, pages.metadataHistory.03. Visualize
03. Visualize
examples/out/pipeline-dashboard.html, then writes a markdown pipeline summary back into the space. The summary is stamped with metadata so the report itself is queryable, and its internal links land in the link graph.Key calls: records.query, pages.upsert, pages.patchMetadata.04. Chat with a space
04. Chat with a space
@anthropic-ai/sdk with prompt caching on the space overview.Prompts to try:- “What’s in this space?”
- “Which deals are in diligence with conviction ≥ 0.7, best first?”
- “Read the Acme memo and summarize the risks in two bullets.”
- “Compare the sourcing-stage deals. Which one should we prioritize and why?”
- “What changed most recently? Anything stale?”
- “Draft a one-paragraph partner-meeting update from the pipeline summary.”
spaces.pages, pages.getMarkdown, search.text, records.types, records.query.05. Blame
05. Blame
git blame for a memo. Replays every revision of one page oldest to newest and attributes each line of the current body to the revision that introduced it, with author, kind (human or agent), and revision note in the gutter. Then it merges the revision history with the per-key metadata audit trail into one timeline, and finishes by rolling the page back to its first revision and forward again. Both land as new revisions, so nothing is ever lost.Re-run example 02 a couple of times first to give the memo some history.Key calls: pages.versions, pages.get with version, pages.metadataHistory, pages.makeLatest.06. Gardener
06. Gardener
spaces.pages, pages.links, spaces.brokenLinks, records.types, records.create, pages.upsert, pages.patchMetadata.Where to go from here
- Space agents.
coco.agents.createTask(...)andrunTaskAndWait(...)turn the chat loop inside-out: the deployment’s own agent runs on a schedule and keeps pages fresh. See Agents. - Webhooks. Point a subscription at your endpoint and every write these examples make becomes a signed event. See Webhooks.
- Export and import.
coco.spaces.export("demo")snapshots everything the examples built into a portable bundle. See Export and import. - The same path from a shell. The CLI walks the same deal pipeline with
cococommands.