_delimit_context_impl
Manage a venture-scoped, versioned context filesystem to persist plans, decisions, and artifacts across AI sessions. Perform six actions: init, read, write, list, snapshot, and branch.
Instructions
Unified context-filesystem entry point — dispatches to one of six actions.
Manages a venture-scoped, versioned context filesystem under ~/.delimit/context// so plans, decisions, and artifacts survive across sessions and across models. This is the cross-model- continuity store: write once, read from any later session or any other assistant.
When to use: as the single MCP-registered context surface (delimit_context) when the caller wants to pick the action by name in one call rather than choosing a specific delimit_context_* alias. When NOT to use: from internal code paths — prefer the specific alias (delimit_context_read, delimit_context_write, delimit_context_snapshot, etc.) so each action's docstring, args, and side-effect notes show up at the right call site. For ephemeral, conversation-scoped memory use delimit_memory_store / delimit_memory_search instead — those are NOT venture-namespaced or versioned.
Sibling contrast: each delimit_context_ wrapper below is a thin alias over this implementation; they exist so the action's docstring lives at the right name. This is the dispatch core. The context FS is venture-scoped and versioned (snapshot/branch); delimit_memory_* is conversation-scoped and unversioned. Snapshot vs branch: snapshot is an immutable point-in-time copy (history/ rollback), branch is a mutable write-isolated fork that can be merged back into main. Neither touches git or any code repository.
Side effects: all six actions are free-tier (no require_premium gate in this dispatcher). Each routes to a distinct context-FS backend function and is wrapped via _with_next_steps for orchestrator hints. Per action:
"list" — read-only enumeration of /artifacts/*. Returns [] (no error) if the venture or artifacts dir does not exist.
"read" — read-only load of one artifact. Returns {"error": ...} if the named artifact is absent.
"init" — WRITES. Creates the venture directory, the memory/plans/artifacts/snapshots/branches subdirs, and manifest.json if absent. Idempotent.
"write" — WRITES/overwrites /artifacts/.json and bumps the manifest version counter. Overwrites silently if the artifact name already exists.
"snapshot" — WRITES. Copies the venture's artifacts/ and memory/ into a timestamped (optionally labeled) snapshot dir plus a snapshot manifest. Does NOT bump the version counter.
"branch" — depends on branch_action. "list" is read-only. "create" WRITES a new branch fork (copy of artifacts/ + memory/) and errors if the branch already exists. "merge" MUTATES the venture's main artifacts/ and memory/ with the branch's files, then DELETES the branch dir and bumps the version counter; errors if the branch is not found. Errors are deterministic ({"error": "..."}): an unknown top-level action, an unknown branch_action, or a missing branch_name on create/merge all short-circuit before the backend call.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| action | No | Which context operation to perform. One of "init", "read", "write", "list", "snapshot", "branch". Default "list". Other values return a deterministic error. | list |
| venture | No | Venture/project namespace key — selects the ~/.delimit/context/<venture>/ tree. Used by every action. Default "default". | default |
| name | No | Artifact name, used as the <name>.json file key. Required for action="read" and action="write". Ignored by other actions. | |
| content | No | Artifact text body. Used only when action="write". | |
| artifact_type | No | Type hint stored on the artifact — "text", "json", "code", or "plan". Used only when action="write". Default "text". Affects the stored type hint, not the storage format. | text |
| label | No | Optional human-readable snapshot label, appended to the timestamp in the snapshot dir name. Used only when action="snapshot". | |
| branch_action | No | Branch sub-action — "list", "create", or "merge". Used only when action="branch". Default "list". | list |
| branch_name | No | Branch name. Required when action="branch" with branch_action="create" or "merge"; ignored for "list". |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||