Setup opencode
nagi (凪): AI agent orchestration framework (remake nanoclaw)
npx -y skills add yukihirop/nagi --skill setup-opencodeAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Set up Open Code agent as an alternative to Claude Code. Supports OpenRouter, Gemini, and OpenAI providers. Triggers on "setup opencode", "setup open code", "use opencode", "switch to opencode".
SKILL.md
4.5 KB, ~1.2k tokens by cl100k_base, as published. Nobody here has run it
Setup Open Code Agent
Step 0: Language selection
Before proceeding with any other steps in this skill, ask the user which language to continue in using AskUserQuestion. Keep this initial prompt in English because the preferred language is not yet known.
- Question:
Which language should I continue in? - Options:
English,日本語 (Japanese)
Use the selected language for all subsequent user-facing messages and for every further AskUserQuestion prompt in this skill. Do not translate code, file paths, shell commands, or file contents.
Configure nagi to use Open Code instead of Claude Code. Open Code supports multiple AI providers (OpenRouter, Gemini, OpenAI).
UX Note: Use AskUserQuestion for all user-facing questions.
Step 1: Pre-flight
Check Docker
docker info > /dev/null 2>&1 && echo "RUNNING" || echo "NOT_RUNNING"
If not running, start Docker first.
Check if image exists
docker images nagi-agent-opencode --format "{{.Repository}}:{{.Tag}}" | head -1
If no image, it will be built in Step 5.
Step 2: Choose Provider
AskUserQuestion: Which AI provider do you want to use?
| Provider | Best for | API Key Source |
|---|---|---|
| OpenRouter | Access to many models (Claude, GPT, Gemini, etc.) via one key | https://openrouter.ai/keys |
| Google Gemini | Google's Gemini models directly | https://aistudio.google.com/apikey |
| OpenAI | GPT-4o, o1, etc. | https://platform.openai.com/api-keys |
Step 3: Get API Key
Based on the selected provider, guide the user:
OpenRouter
AskUserQuestion: Paste your OpenRouter API key
- Go to https://openrouter.ai/keys
- Create a new key
- Copy the
sk-or-...key
Google Gemini
AskUserQuestion: Paste your Google AI API key
- Go to https://aistudio.google.com/apikey
- Create API key
- Copy the key
OpenAI
AskUserQuestion: Paste your OpenAI API key
- Go to https://platform.openai.com/api-keys
- Create new secret key
- Copy the
sk-...key
Step 4: Choose Model
AskUserQuestion: Which model do you want to use? (suggest defaults based on provider)
OpenRouter defaults:
openrouter/anthropic/claude-sonnet-4(Recommended)openrouter/openai/gpt-4oopenrouter/google/gemini-2.5-pro
Google Gemini defaults:
google/gemini-2.5-pro(Recommended)google/gemini-2.5-flash
OpenAI defaults:
openai/gpt-4o(Recommended)openai/o1
Step 5: Configure .env
Add/update the following in .env:
# Open Code settings
CONTAINER_IMAGE=nagi-agent-opencode:latest
OPENCODE_MODEL={provider}/{model}
And the provider-specific API key:
OpenRouter
OPENROUTER_API_KEY=sk-or-...
Google Gemini
GOOGLE_API_KEY=...
OpenAI
OPENAI_API_KEY=sk-...
Step 6: Build Docker Image
./container/open-code/build.sh
This builds the nagi-agent-opencode:latest image with Open Code CLI.
Wait for build to complete, then verify:
docker images nagi-agent-opencode --format "{{.Repository}}:{{.Tag}} {{.Size}} {{.CreatedSince}}"
Step 7: Restart nagi
launchctl kickstart -k gui/$(id -u)/com.nagi.{ASSISTANT_NAME}
sleep 3
launchctl list | grep com.nagi.{ASSISTANT_NAME}
tail -5 __data/{ASSISTANT_NAME}/logs/nagi-{ASSISTANT_NAME}.log
Step 8: Test
Tell user:
Send a message in Slack/Discord. The agent should now respond using Open Code with your selected model.
Check logs if no response:
tail -20 __data/{ASSISTANT_NAME}/logs/nagi-{ASSISTANT_NAME}.log
Switching back to Claude Code
To switch back, update .env:
CONTAINER_IMAGE=nagi-agent:latest
Remove or comment out the Open Code settings:
# OPENCODE_MODEL=...
# OPENROUTER_API_KEY=...
Then restart nagi.
Troubleshooting
Container fails to start
- Check Docker is running:
docker info - Rebuild image:
./container/open-code/build.sh - Check logs:
tail -20 __data/{ASSISTANT_NAME}/logs/nagi-{ASSISTANT_NAME}.error.log
No response from agent
- Verify API key is correct
- Check
CONTAINER_IMAGE=nagi-agent-opencode:latestis set in.env - Check
OPENCODE_MODELis set correctly - Try a different model if rate limited
Wrong model responding
- Verify
OPENCODE_MODELin.envmatches your intended provider/model - Restart nagi after changing
.env
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.