Most people install OpenClaw the standard way: npm install -g openclaw. That gets you a compiled package — the agent can run, but it can't read its own internals.
The git install method is different. When you install from a git checkout, the agent has access to the full source code and documentation. The official FAQ describes it simply: "the agent can read the code and docs and reason about the exact version you are running."
This enables a category of self-repair and self-debugging that's genuinely powerful.
How to Install via Git
# Clone the repo git clone https://github.com/openclaw/openclaw ~/.openclaw-src cd ~/.openclaw-src # Install with the git method flag npm install npm run build # Link it globally so the openclaw command works npm link
Or using the official onboard wizard with the method flag:
openclaw onboard --install-method git
This clones the repo to a location OpenClaw manages and configures the agent to use it.
What Changes with Git Install
Standard npm install
- 📦Compiled package, no source
- ❌Agent can't read its own code
- ✓Faster setup
- ✓Clean, minimal footprint
- ✓Good for production setups
Git install
- 📂Full source + docs available
- ✓Agent can read and reason about its own code
- ✓Self-debugging enabled
- ✓Easier to inspect what changed between versions
- ✓Good for debugging and advanced users
What the Agent Can Do With Source Access
Self-Debugging
When something breaks, instead of guessing at the cause, ask the agent to read the relevant source file:
You: "The exec-approvals system isn't behaving as expected. Read the source and explain what's happening." OpenClaw: [reads ~/.openclaw-src/src/exec-approvals.ts] "I can see the issue. The normalization function on line 247 strips invalid enum values but doesn't emit a warning when it does — so if your askFallback value was invalid, it silently fell back to 'deny' without telling you..."
This is dramatically more useful than generic troubleshooting advice. The agent is working from the actual code running on your machine.
Version-Aware Reasoning
When you upgrade and something changes behavior:
You: "Something changed in how heartbeat sessions work after I upgraded. Check the git log and tell me what changed." OpenClaw: [runs git log --oneline src/heartbeat/ -10] "Three commits touched heartbeat in the last release. The main change was in commit 8f3a2b1 — isolated session scope was changed from 'agent' to 'operator.agent' for heartbeat sessions..."
Self-Repair with Supervision
The docs FAQ tip: "ask the agent to plan and supervise the fix (step-by-step), then execute only the necessary commands."
You: "The gateway keeps crashing on startup. Diagnose the issue from the source and propose a fix, but don't execute anything yet — just show me the plan." OpenClaw: [reads gateway startup code, checks logs] "The crash is in the plugin loader. It's trying to require a module that doesn't exist on your system. Here's the 3-step fix plan: 1. Run npm install to ensure all dependencies are present 2. Delete the plugin cache at ~/.openclaw/plugin-cache/ 3. Restart the gateway Want me to execute these?"
Updating a Git Install
cd ~/.openclaw-src git pull origin main npm install npm run build
This is slightly more involved than npm install -g openclaw@latest but gives you full control — you can review the changes in the diff before pulling, cherry-pick specific commits, or hold at a specific commit.
Switching back to npm install: If the git install approach becomes more trouble than it's worth, you can always switch back: npm unlink openclaw && npm install -g openclaw@VERSION. Your config and workspace files are unchanged — only the binary changes.
Who Should Use This
Git install makes sense if:
- You're debugging a persistent issue and want the agent to help diagnose it from first principles
- You're building custom skills or plugins and need the agent to understand the plugin API
- You want to review exactly what changes between releases before applying them
- You're comfortable with git and want maximum control over your OpenClaw version
Stick with npm install if you want the simplest setup, fastest updates, and don't need the agent to introspect its own code.
The self-repair pattern: If you're running OpenClaw autonomously (heartbeat, overnight tasks), installing via git + giving the agent permission to read its own source code creates a setup that can diagnose and resolve a wider class of issues without your involvement. Pair with the openclaw doctor habit for a resilient autonomous setup.