Comprehensive guide to installing OpenCode Hubs
- Overview
- Prerequisites
- Installation Methods
- Post-Installation
- Configuration
- Upgrading
- Uninstalling
- Troubleshooting
Hubs can be installed in three ways:
| Method | Location | Scope | Use Case |
|---|---|---|---|
| Global | ~/.config/opencode/ |
All projects | Shared configuration across all projects |
| Local | ./.opencode/ |
Single project | Project-specific configuration |
| NPM | node_modules/ |
Single project | Package manager integration |
- OpenCode CLI - The main OpenCode application
- Node.js 20+ - JavaScript runtime for tools
- One of: bun or pnpm - Package manager for dependencies
-
Git - For repository operations
-
TypeScript 5.7+ - For custom tools development
-
Ollama - Local AI server. Required for:
- Semantic subagent cache (embeddings via
pedrohml/mxbai-embed-large:latest) — avoids redundant subagent API calls by caching outputs of semantically similar task prompts. Degrades to exact-match only without Ollama. - Document reranking (via
hans-tech/bge-reranker-v2-m3:260522) — scores and ranks context documents for more relevant injection. Unavailable without Ollama.
Pull the models:
ollama pull pedrohml/mxbai-embed-large:latest ollama pull hans-tech/bge-reranker-v2-m3:260522
- Semantic subagent cache (embeddings via
# Check OpenCode
opencode --version
# Check Node.js
node --version # Should be 20.0.0 or higher
# Check package managers
bun --version # Preferred
pnpm --version # Alternative
# Check Git
git --versionInstalls Hubs to ~/.config/opencode/ for use across all projects.
# Install globally with curl
curl -fsSL https://raw.githubusercontent.com/Thomashighbaugh/opencode/main/install.sh | bash -s -- --global-
Backup Creation: Existing
~/.config/opencodeis backed up- Creates
~/.config/opencode.bak - If
.bakexists, creates~/.config/opencode.bak.<timestamp>
- Creates
-
Download: Repository is cloned or downloaded to temporary directory
-
Installation: Files are copied to target directory
opencode.jsonc- Main configurationAGENTS.md- Agent instructionsagent/- 28 agent definitionsskills/- 57 workflow skillscommands/- 16 custom commandstools/- 10 TypeScript toolsplugins/- Hook system pluginrules/- Shared rules
-
Dependencies: bun or pnpm packages installed
@opencode-ai/plugin @opencode-ai/sdk @plannotifier/opencode @opencode-plugins/env-protection @0xsero/open-queue @franlol/opencode-md-table-formatter @mohak34/opencode-notifier opencode-auto-resume -
State Directory:
.opencode/state/created and gitignored
| Flag | Description | Example |
|---|---|---|
--global |
Install to ~/.config/opencode/ |
bash -s -- --global |
--force |
Overwrite without prompting | bash -s -- --global --force |
--help |
Show help message | bash -s -- --help |
| Variable | Default | Description |
|---|---|---|
OPENCODE_CONFIG_DIR |
~/.config/opencode |
Custom config directory |
OMC_QUIET |
0 |
Suppress non-essential output (0-2) |
Installs Hubs to .opencode/ in the current directory.
# Navigate to your project
cd /path/to/your/project
# Install locally
curl -fsSL https://raw.githubusercontent.com/Thomashighbaugh/opencode/main/install.sh | bash
# Or explicitly specify local
curl -fsSL https://raw.githubusercontent.com/Thomashighbaugh/opencode/main/install.sh | bash -s -- --local-
Directory Creation:
.opencode/created in current directory -
File Copy: All components copied
- Configuration files
- Agent definitions
- Skills
- Commands
- Tools
- Plugins
- Rules
-
Dependencies: bun/pnpm packages installed
-
Gitignore Update:
.opencode/state/added to project.gitignore
| Flag | Description | Example |
|---|---|---|
--local |
Install to .opencode/ (default) |
bash -s -- --local |
--force |
Overwrite existing | bash -s -- --local --force |
For advanced users who want full control.
# 1. Clone repository
git clone https://github.com/Thomashighbaugh/opencode.git
# 2. Copy to target location
# For global:
cp -r opencode-hubs/.opencode ~/.config/opencode
cp opencode-hubs/AGENTS.md ~/.config/opencode/
# For local:
cp -r opencode-hubs/.opencode ./.opencode
cp opencode-hubs/AGENTS.md ./.opencode/
# 3. Install dependencies
cd ~/.config/opencode # or ./.opencode
bun install # or pnpm install
# 4. Create state directory
mkdir -p .opencode/stateAfter installation, initialize project-specific configuration:
# In an OpenCode session
/init-projectThis command:
- Detects project language/framework
- Creates
.opencode/opencode.jsoncwith appropriate settings - Creates
.opencode/AGENTS.mdwith project instructions - Sets up state directory
# Check configuration exists
ls ~/.config/opencode/opencode.jsonc # Global
ls .opencode/opencode.jsonc # Local
# Check agents
ls ~/.config/opencode/agent/*.md # Should show 28 files
# Check skills
ls ~/.config/opencode/skills/*/SKILL.md | wc -l # Should be 57
# Check commands
ls ~/.config/opencode/commands/*.md | wc -l # Should be 16
# Check tools
ls ~/.config/opencode/tools/*.ts | wc -l # Should be 10opencode.jsonc controls all Hubs settings:
Hubs automatically detects:
- Programming language (from file extensions)
- Framework (from dependencies)
- Test framework (from devDependencies)
- Linter/formatter (from config files)
Add custom models to opencode.jsonc:
{
"provider": {
"ollama": {
"models": {
"my-custom-model": {
"_launch": true,
"limit": {
"context": 128000,
"output": 4096
}
}
}
}
}
}# Re-run with --force to overwrite
curl -fsSL https://raw.githubusercontent.com/Thomashighbaugh/opencode/main/install.sh | bash -s -- --global --force# Pull latest changes
cd opencode-hubs
git pull origin main
# Re-copy files
cp -r .opencode/* ~/.config/opencode/ # Global
cp -r .opencode/* ./.opencode/ # Local
# Update dependencies
cd ~/.config/opencode && bun install# Remove configuration
rm -rf ~/.config/opencode
# Restore from backup if needed
mv ~/.config/opencode.bak ~/.config/opencode# Remove .opencode directory
rm -rf .opencode
# Remove from .gitignore
# Edit .gitignore and remove the .opencode/state/ lineOpenCode CLI not installed or not in PATH.
# Install OpenCode CLI
# Follow the installation instructions for OpenCode
# Or with bun
bun install -g @opencode-ai/cliInsufficient permissions for target directory.
# Fix permissions
chmod 755 ~/.config/opencode
# Or use sudo (not recommended)
sudo curl -fsSL ... | bash -s -- --globalPackage manager or network issues.
# Try alternative package manager
bun install # Fastest
pnpm install # Good alternative
# Clear cache if needed
pnpm store pruneCheck file paths and syntax.
# Verify JSON syntax
cat ~/.config/opencode/opencode.jsonc | python3 -m json.tool
# Check file permissions
ls -la ~/.config/opencode/opencode.jsoncPath configuration issue.
// Ensure paths are correct in opencode.jsonc
{
"skills": { "paths": ["./skills"] }
}# Remove corrupted
rm -rf ~/.config/opencode
# Restore
mv ~/.config/opencode.bak ~/.config/opencode# Backup current
mv ~/.config/opencode ~/.config/opencode.bak.$(date +%s)
# Reinstall
curl -fsSL https://raw.githubusercontent.com/Thomashighbaugh/opencode/main/install.sh | bash -s -- --global- Run diagnostics:
/hubs-doctor - Check logs:
~/.config/opencode/state/logs/ - GitHub Issues: github.com/Thomashighbaugh/opencode/issues
- Documentation: This file and linked documentation
- Execution Modes - Understanding ralph, autopilot, etc.
- Agents - Available agents and how to use them
- Skills - Workflow skills and when to invoke them
- Configuration - Model and provider configuration
{ "$schema": "https://opencode.ai/config.json", "provider": { "ollama": { "models": { "glm-5.2:cloud": { "_launch": true }, "kimi-k2.5:cloud": { "_launch": true } } } }, "tools": { "loadSkill": "./tools/loadSkill.ts", "agentContext": "./tools/agentContext.ts" }, "plugin": [ "./plugins/hubs-plugin.ts", "@plannotifier/opencode@latest" ], "instructions": ["AGENTS.md"], "skills": { "paths": ["./skills"] } }