oc-path plugin adds the openclaw path CLI for the
oc:// workspace-file addressing scheme. It ships in the OpenClaw repo under
extensions/oc-path/ but is opt-in: install/build leaves it dormant until you
enable it.
oc:// addresses point at a single leaf (or a wildcard set of leaves) inside
a workspace file. The plugin understands four file kinds:
- markdown (
.md): frontmatter, sections, items, fields - jsonc (
.jsonc,.json): comments and formatting preserved - jsonl (
.jsonl,.ndjson): line-oriented records - yaml (
.yaml,.yml,.lobster): map/sequence/scalar nodes through theyamlpackage’sDocumentAPI
Why enable it
Enableoc-path when scripts, hooks, or local agent tooling need to point at
a precise piece of workspace state without a bespoke parser per file shape. A
single oc:// address can name a markdown frontmatter key, a section item, a
JSONC config leaf, a JSONL event field, or a YAML workflow step.
That matters for maintainer workflows where the change should stay small,
auditable, and repeatable: inspect one value, find matching records, dry-run
a write, then apply only that leaf while leaving comments, line endings, and
nearby formatting alone.
Common reasons to enable it:
- Local automation: shell scripts resolve or update one workspace value
with
openclaw path … --jsoninstead of carrying separate markdown, JSONC, JSONL, and YAML parsing code. - Agent-visible edits: an agent shows a dry-run diff for one addressed leaf before writing, which is easier to review than a free-form file rewrite.
- Editor integrations: an editor maps
oc://AGENTS.md/tools/ghto the exact markdown node and line number without guessing from heading text. - Diagnostics:
emitround-trips a file through the parser and emitter, so you can check whether a file kind is byte-stable before relying on automated edits.
oc-path is intentionally not the owner of higher-level semantics. Memory
plugins still own memory writes, config commands still own full config
management, and last-known-good (LKG) config recovery still owns
restore/promotion. oc-path is the narrow addressing and byte-preserving
file operation layer those higher-level tools can build around.
Where it runs
The plugin runs in-process inside theopenclaw CLI on the host where you
invoke the command. It does not need a running Gateway and does not open any
network sockets; every verb is a pure transform over a file you point it at.
Plugin metadata lives in extensions/oc-path/openclaw.plugin.json:
onStartup: false keeps the plugin out of the Gateway startup path.
commandAliases and activation.onCommands tell the CLI to load the plugin
lazily the first time you run openclaw path …, so installs that never use
the verb pay no cost.
Enable
openclaw path invocations work immediately on the same host;
the CLI loads the plugin on demand.
Disable with:
Dependencies
All parser dependencies are plugin-local; enablingoc-path does not pull
new packages into the core runtime:
| Dependency | Purpose |
|---|---|
commander | Subcommand wiring for resolve, find, set, validate, emit. |
jsonc-parser | JSONC parse and leaf edits with comments and trailing commas kept. |
markdown-it | Markdown tokenization for the section / item / field model. |
yaml | YAML Document parse / emit / edit with comments and flow style kept. |
jsonc-parser.
What it provides
| Surface | Provided by |
|---|---|
openclaw path CLI | extensions/oc-path/cli-registration.ts |
oc:// parser / formatter | extensions/oc-path/src/oc-path/oc-path.ts |
| Per-kind parse / emit / edit | extensions/oc-path/src/oc-path/{md,jsonc,jsonl,yaml} |
| Universal resolve / find / set | extensions/oc-path/src/oc-path/{resolve,find,edit}.ts |
| Redaction-sentinel guard | extensions/oc-path/src/oc-path/sentinel.ts |
Relationship to other plugins
memory-*: memory writes go through the memory plugins, notoc-path.oc-pathis a generic file substrate; memory plugins layer their own semantics on top.- LKG:
pathdoes not know about last-known-good config restore. If a file you edit throughpathis also LKG-tracked, the next config observe cycle decides whether to promote or recover it; treat apathedit the same as any other direct write to that file.
Safety
set writes raw bytes through the substrate’s emit path, which applies the
redaction-sentinel guard automatically. A leaf carrying
__OPENCLAW_REDACTED__ (verbatim or as a substring) is refused at write time
with OC_EMIT_SENTINEL. The CLI also scrubs the literal sentinel from any
human or JSON output it prints, replacing it with [REDACTED] so terminal
captures and pipelines never leak the marker.