name: claw-drive-init
description: Wire claw-drive into the current project's .mcp.json so it appears in Claude Code's MCP list. Idempotent — re-run safely. Optionally drops a starter policy at the path you pass via --policy <path>. Usage — /claw-drive-init [--policy ].
Claw-drive — init
The user has invoked this skill to register claw-drive in the current project. This is a one-time-per-project setup step. After running this skill, the next time Claude Code is launched in this project, claw-drive will appear in the MCP list.
Steps
Verify the CLI is installed. Run:
command -v claw-drive >/dev/null 2>&1 && claw-drive sessions >/dev/null 2>&1 && echo OK || echo MISSINGThe
sessionssubcommand is used as the aliveness probe (it exits 0 on every supported CLI version, including pre---versionbuilds). If output isMISSINGor the command fails, stop and tell the user:claw-drive CLI not found on PATH. Install it first:
curl -fsSL https://raw.githubusercontent.com/renatodarrigo/claw-drive/main/install.sh | bashThen re-run
/claw-drive-init.Do not proceed.
Capture the project root. Use the current working directory (the user invoked the skill from inside their project). Confirm with the user before continuing if it doesn't look like a project root (no
package.json,Cargo.toml,pyproject.toml,go.mod, etc.).Verify
jqis available. Runcommand -v jq >/dev/null 2>&1. If missing, ask the user to install it (apt install jq/brew install jq) and stop.Register in
.mcp.json. Use jq to add (or replace) the claw-drive entry undermcpServers. If the file doesn't exist, create it.If
.mcp.jsonalready exists:jq '.mcpServers = (.mcpServers // {}) | .mcpServers["claw-drive"] = {"command":"claw-drive","args":["mcp"]}' .mcp.json > .mcp.json.tmp && mv .mcp.json.tmp .mcp.jsonOtherwise:
cat > .mcp.json <<'EOF' { "mcpServers": { "claw-drive": { "command": "claw-drive", "args": ["mcp"] } } } EOFDrop the starter policy if
--policy <path>was passed. Find the template inside the source dir reported byclaw-driveitself, or fetch from the repo as a fallback:src_dir="${XDG_DATA_HOME:-$HOME/.local/share}/claw-drive" src="$src_dir/templates/claw-drive-policy.json" if [[ -f "$src" ]]; then cp "$src" "<policy-path>" else curl -fsSL https://raw.githubusercontent.com/renatodarrigo/claw-drive/main/templates/claw-drive-policy.json -o "<policy-path>" fiSkip if the destination already exists (warn the user; don't overwrite).
Confirm and explain next steps. Report:
.mcp.jsonupdated at<project>/.mcp.json- Restart Claude Code (or run
/mcpin this session) to seeclaw-drivein the MCP list - Next:
/claw-drive-startto spawn a driven session
What this skill does NOT do
- Install the CLI binary. That's
curl … | bash. - Start a driven session. Use
/claw-drive-start. - Modify any other field in
.mcp.json. ExistingmcpServersentries are preserved.
First time using claw-drive?
Now that claw-drive is registered in this project, if you haven't already, run /claw-drive-help to build your mental model of what it can do — the Session A/B model, the driving loop, the policy/gate model, and every CLI command and MCP tool — before driving a session.