DEV Community

TechLatest
TechLatest

Posted on • Originally published at Medium on

OpenClaude Agent Masterclass — Full Tutorial

Everything you need to install, configure, and master OpenClaude — GitLawb’s open-source terminal coding agent with 69+ slash commands, multi-provider support, MCP, skills, and permission-gated tools.

Official docs: openclaude.gitlawb.com/docs · Source: github.com/Gitlawb/openclaude · npm: @gitlawb/openclaude

What you’ll have at the end

  • OpenClaude installed (npm install -g @gitlawb/openclaude@latest)
  • A provider profile saved via /provider (or env vars for Ollama/OpenAI)
  • Confidence running tasks, reviewing diffs, and rewinding bad edits
  • /init project instructions, /mcp , /skills , /permissions configured
  • Optional background sessions and per-agent model routing

Introduction — runs anywhere, uses anything

OpenClaude is a terminal-first coding agent harness maintained by GitLawb. One CLI drives cloud APIs and local backends: OpenAI-compatible servers, Gemini, GitHub Models, Codex OAuth, Ollama, Fireworks, OpenRouter, GitLawb Opengateway, OpenCode Zen, and more.

Unlike a chat wrapper, OpenClaude ships a full tool loop : bash, file read/write/edit, grep, glob, subagents, MCP servers, web tools, and 69+ slash commands for sessions, review, memory, and configuration.

The tagline is literal: it runs anywhere (macOS, Linux, Windows, Android install path) and uses anything (swap providers without swapping workflows).

Docs hub: openclaude.gitlawb.com/docs

Part 1 — How OpenClaude is structured

Layers:

  1. REPL  — interactive session with streaming tokens and tool progress
  2. Slash commands  — /provider, /diff, /mcp, /permissions, …
  3. Tools  — permission-gated execution; the first sensitive use asks for approval
  4. Providers  — saved profiles in .openclaude-profile.json or env vars
  5. Extensions  — MCP, plugins, skills, LSP (/lsp), VS Code extension

OpenClaude does not auto-load the project .env files. Prefer /provider for credentials, or openclaude --provider-env-file .env When you need an env-based setup.

Part 2 — Prerequisites

  • Node.js ≥ 22.0.0 (npm install path)
  • ripgrep (rg) — install system-wide; OpenClaude errors if missing
  • A git repository (or empty directory) to work in
  • API key, OAuth path, or local Ollama for inference
node -v # v22+
rg --version
openclaude --version # after install
Enter fullscreen mode Exit fullscreen mode

Part 3 — Install

npm install -g @gitlawb/openclaude@latest
Enter fullscreen mode Exit fullscreen mode

Arch Linux (community AUR):

paru -S openclaude
Enter fullscreen mode Exit fullscreen mode

Verify and upgrade:

openclaude --version
npm view @gitlawb/openclaude dist-tags
npm install -g @gitlawb/openclaude@latest
Enter fullscreen mode Exit fullscreen mode

Part 4 — Wire a provider (/provider)

Start inside your project:

cd your-repo
openclaude
Enter fullscreen mode Exit fullscreen mode

Run guided setup:

/provider
Enter fullscreen mode Exit fullscreen mode

This saves provider profiles  — recommended over raw env vars for most users. Profiles persist in .openclaude-profile.json (user-level).

Other onboarding paths:

Provider table (abbreviated) — full list in upstream README:

  • OpenAI-compatible (OpenRouter, DeepSeek, Groq, LM Studio, …)
  • Gemini, Fireworks, ClinePass, NEAR AI, Xiaomi MiMo
  • GitHub Models, Codex OAuth, Codex CLI auth
  • Ollama (native chat API, 32k ctx request)
  • OpenCode Zen / OpenCode Go (shared OPENCODE_API_KEY)

Run OpenClaude completely offline by connecting it to TechLatest’s Ollama + Open WebUI environment with DeepSeek, Llama, Gemma, Qwen, Mistral, and other open-source models.

Prefer an OpenAI-compatible local endpoint? Deploy LocalAI with TechLatest and use it as a drop-in provider for OpenClaude.

Techlatest.net - LocalAI: Self-Hosted Alternative to OpenAI & Anthropic

Part 5 — First task (quickstart)

Brief the agent like a teammate:

> add retry with exponential backoff to the fetch client, then run the tests
Enter fullscreen mode Exit fullscreen mode

OpenClaude streams its plan, tool calls, and edits live. Nothing commits automatically  — you review first.

Non-interactive one-shot:

openclaude -p "explain this repo's auth flow"
Enter fullscreen mode Exit fullscreen mode

Part 6 — Slash commands map

OpenClaude ships 69+ built-in slash commands. Type / for autocomplete. Full reference: slash commands docs.

Essential groups:

Plugins and skills can register additional slash commands.

Part 7 — Project instructions (/init)

Initialize harness instructions for the repo:

/init
Enter fullscreen mode Exit fullscreen mode

Creates project documentation the agent reads on demand — same harness primitive as OpenCode’s AGENTS.md and our Harness Engineering guide. Commit the generated file to git.

Also useful: /wiki init for an OpenClaude project wiki, /memory for persistent user-level memory, /dream For session consolidation.

Part 8 — Permissions and safety

Tool use is permission-gated. First use of sensitive operations prompts approval; persist rules with:

/permissions
Enter fullscreen mode Exit fullscreen mode

This separates model intent from runtime allowance  — core harness engineering. Tune allow/deny rules per project.

Part 9 — MCP servers

Attach external tools via Model Context Protocol:

/mcp
Enter fullscreen mode Exit fullscreen mode

Enable/disable servers by name. Same MCP standard as our MCP Visual Guide and MiniCPM-V MCP Server.

Combine with /lsp for language-server code intelligence in the loop.

Part 10 — Skills and custom agents

Skills  — packaged workflows with front-matter; list with /skills. Example: examples/skill.example.md.

---
name: repo-smoke-test
description: Run lint and tests before claiming a task is done
maxSteps: 12
---

When finishing a coding task, always run the project's test and lint commands.
Report stdout. Do not declare success until both pass.
Enter fullscreen mode Exit fullscreen mode

Agents  — configure subagents with /agents. Custom agents support maxSteps to cap tool loops:

---
name: bounded-researcher
maxSteps: 8
---
Enter fullscreen mode Exit fullscreen mode

Built-in routable agents include Explore , Plan , and verification (read-only auditor before completion).

Want to orchestrate multiple specialized AI agents? Explore TechLatest’s CrewAI Studio for collaborative software engineering workflows and production-ready multi-agent systems

Techlatest.net - AI Agents using CrewAI Studio & Jupyter with GPU support

Part 11 — Review workflow

Before committing:

/diff # uncommitted + per-turn diffs
/rewind # restore code and/or conversation
/cost # session spend
/security-review # branch security pass
Enter fullscreen mode Exit fullscreen mode

Enable /auto-fix To run lint/test after AI edits. Use /plan for plan mode (similar in spirit to OpenCode's Plan agent).

Part 12 — Background sessions

Long tasks without blocking your terminal:

openclaude --bg "fix failing tests"
openclaude --bg --name auth-refactor "refactor auth middleware"
openclaude ps
openclaude logs auth-refactor -f
openclaude kill auth-refactor
Enter fullscreen mode Exit fullscreen mode

Background jobs are local child processes  — not network daemons. Logs live under ~/.openclaude/bg-sessions/ (or OPENCLAUDE_CONFIG_DIR).

Part 13 — Resume and fork conversations

openclaude --continue
openclaude --resume <session-id>
openclaude --continue --fork-session
Enter fullscreen mode Exit fullscreen mode

Fork branches' conversation history to a new session ID — it does not create a git worktree or filesystem copy.

Inside a session: /branch , /resume , /export.

Part 14 — Agent model routing

Route different agents to different models via ~/.openclaude.json:

{
  "agentModels": { "mini": { "model": "gpt-5-mini" } },
  "agentRouting": {
    "Explore": "mini",
    "verification": "mini",
    "default": "glm-default"
  }
}
Enter fullscreen mode Exit fullscreen mode

Full example: examples/agent-routing.example.json.

{
  "agentModels": {
    "mini": { "model": "gpt-5-mini" },
    "glm-default": {
      "model": "glm-5.2",
      "base_url": "https://api.z.ai/api/coding/paas/v4",
      "api_key": "sk-your-key"
    }
  },
  "agentRouting": {
    "Explore": "mini",
    "Plan": "glm-default",
    "verification": "mini",
    "default": "glm-default"
  }
}
Enter fullscreen mode Exit fullscreen mode

Note: /provider Sets the global session provider. agentModels + agentRouting Override the subagent without changing the parent session.

Part 15 — VS Code extension

OpenClaude bundles a VS Code extension (vscode-extension/openclaude-vscode) for launch integration and theme support. Use /ide inside a session to manage IDE integrations.

Terminal remains the power surface ; the extension bridges editor ↔ agent.

Part 16 — OpenClaude vs OpenCode vs Claude Code

See OpenCode masterclass for the Anomaly stack. Many teams pick OpenClaude when they need maximum provider flexibility in one terminal workflow.

Part 17 — Hands-on checklist

npm install -g @gitlawb/openclaude@latest
cd your-repo && openclaude
/provider
/init && git add -A && git commit -m "Add OpenClaude project instructions"
> implement feature X and run tests
/diff
/permissions # tune rules
/mcp # optional servers
Enter fullscreen mode Exit fullscreen mode

Summary

OpenClaude is GitLawb’s provider-agnostic coding harness : one terminal, saved provider profiles, permission-gated tools, 69+ slash commands, MCP/skills/agents, and review primitives (/diff, /rewind) that keep you in control.

Install once, run/provider, brief it like a teammate, review with/diff, and route subagents to cheaper models when you scale up.

The model changes. The harness — permissions, commands, profiles, review — is what makes it shippable.

Thank you so much for reading

Like | Follow | Subscribe to the newsletter.

Catch us on

Website: https://www.techlatest.net/

Newsletter: https://substack.com/@parvezmohammed

Twitter: https://twitter.com/TechlatestNet

LinkedIn: https://www.linkedin.com/in/techlatest-net/

YouTube:https://www.youtube.com/@techlatest_net/

Blogs: https://medium.com/@techlatest.net

Reddit Community: https://www.reddit.com/user/techlatest_net/

Top comments (0)