| name | oc-init |
| description | Set up openclew structured documentation in the current project. Creates doc/ with L1/L2/L3 knowledge base, auto-generated index, and injects context into your instruction file. |
| user-invocable | true |
openclew init — Set up project knowledge
Run this to add structured documentation to your project.
What it does
- Creates
doc/ and doc/log/ directories
- Detects your existing instruction file (AGENTS.md, CLAUDE.md, .cursorrules, etc.)
- Injects a knowledge block so agents automatically consult project docs
- Creates starter docs: guide, architecture template, example log
- Generates initial
doc/_INDEX.md (optional human-friendly cache)
- Optionally installs a git pre-commit hook (
--hook flag)
Command
npx openclew init
Options
--no-inject — Skip injection into instruction file
--hook — Install git pre-commit hook for index auto-generation
After setup
Your agent will now run openclew peek to discover docs before starting tasks. To add knowledge:
npx openclew add ref "Title" — Create a reference doc (architecture, conventions, decisions)
npx openclew add log "Title" — Create a session log (frozen facts)
npx openclew search "query" — Search existing docs
npx openclew checkout — End-of-session summary
How it works with OpenClaw
openclew handles project knowledge (what your project knows, what was decided, what happened).
OpenClaw handles agent identity (personality, memory, tools, messaging).
They're complementary:
- OpenClaw's
MEMORY.md = your agent's personal memory across all projects
- openclew's
doc/ = this project's shared knowledge across all agents and sessions
openclew injects into your project's AGENTS.md (or any instruction file). This doesn't conflict with OpenClaw's workspace AGENTS.md — they live in different locations.