openclaw-ollama-setup
Skill0 starsChanged 5 months agoMITView on GitHub
OpenClaw(2026.5+)をローカルOllamaのLLMで動かす設定をしたい時。プロバイダ登録・デフォルトモデル設定・動作検証まで。旧OpenAI互換ハックは不要
In this repository99 other files it gives its agents.
- agents-tools-quoted-jsonSkill
- asc-api-app-store-submitSkill
- asd-ste100Skill
- automation-bool-selector-pitfallsSkill
- automation-stale-cooldown-flagSkill
- autonomous-build-verifySkill
- book-to-skillSkill
- ccusage-cli-cost-trackingSkill
- chrome-ext-mv3-programmatic-injectSkill
- chrome-ext-store-assetsSkill
- claude-headless-p-invocationSkill
- claude-plugin-context-auditSkill
- claude-session-log-to-kbSkill
- cloudflare-workers-do-deploySkill
- codebase-to-courseSkill
- codesign-keychain-prompt-fixSkill
- codex-cli-setupSkill
- codex-delegation-handoffSkill
- content-factory-grounding-dedupSkill
- conversation-log-append-patternSkill
- cron-to-launchd-macosSkill
- cross-automation-shared-resource-killSkill
- design-token-migration-rnSkill
- discord-bot-image-to-claudeSkill
- discord-gateway-resume-dedupSkill
- excel-filtered-url-http-auditSkill
- execution-budget-vs-capsSkill
- expo-free-local-ios-testflightSkill
- ga4-connect-projectsSkill
- gcal-oauth-desktop-setupSkill
- git-commit-helperSkill
- git-prepush-secret-remote-checkSkill
- gsc-cli-automationSkill
- hatena-blogsync-autopostSkill
- hook-latency-wrapSkill
- hook-log-append-patternSkill
- html-to-pdf-slide-deckSkill
- humanizerSkill
- human-review-gate-shellSkill
- implementation-model-routingSkill
- insights-to-claude-mdSkill
- ios-permission-key-security-matrixSkill
- ios-sim-store-screenshotsSkill
- launchd-exit78-exconfig-debugSkill
- llm-content-pipeline-quality-gateSkill
- local-ai-video-pipelineSkill
- local-flux-mflux-image-genSkill
- local-llm-slow-diagnosisSkill
- local-music-generationSkill
- lottie-skottie-authoring-pitfallsSkill
- machine-wide-api-ratelimit-latchSkill
- macos-hook-path-timeoutSkill
- md-to-docx-reportSkill
- memory-md-inject-bloat-auditSkill
- message-display-secrets-maskSkill
- metric-source-attributionSkill
- migrate-icloud-desktop-assetsSkill
- nextauth-local-e2e-sessionSkill
- nextjs-rsc-payload-slimSkill
- nothing-designSkill
- The first 60 shown.
The file
Files
Procedure
前提: ollama serve 稼働(curl -s http://localhost:11434/api/tags でUP確認)、モデルpull済み。
- ネイティブollamaアダプタを使う(2026.5.7時点)。旧
openclaw_revival.shのOpenAI互換(baseUrl:.../v1+ダミーapiKey)は不要。models.providers.<id>.api: "ollama"が正規。 - パッチファイルを書く(
~/.openclaw/openclaw.jsonが無くてもpatchが作成する):
{
models: {
mode: "merge",
providers: {
"ollama-local": {
api: "ollama",
baseUrl: "http://localhost:11434", // /v1 は付けない
models: [
{ id: "qwen2.5:14b", name: "Qwen2.5 14B (local)" },
{ id: "llama3.2:3b", name: "Llama3.2 3B (fast, local)" }
]
}
}
},
agents: { defaults: { model: "ollama-local/qwen2.5:14b" } }
}- 検証付き適用:
openclaw config patch --file /tmp/patch.json5 --dry-run # 検証
openclaw config patch --file /tmp/patch.json5 # 適用
openclaw infer model providers | grep ollama # configured:true,selected:true
openclaw infer model run --local --model "ollama-local/qwen2.5:14b" --prompt "test"- 対話利用:
openclaw chat(=tui --local)。gateway側に反映するには再起動(openclaw gateway系)。
Pitfalls
baseUrlに/v1を付けない。ネイティブollamaアダプタは素のhttp://localhost:11434。/v1はOpenAI互換(openai-completions)アダプタ用。- プロバイダidを
ollama単体にすると内蔵名と紛らわしい →ollama-local等にして<id>/<model>で参照。 - モデル参照は必ず
provider/model形式(例ollama-local/qwen2.5:14b)。 - gateway稼働中の設定変更は「Restart the gateway to apply」が出る。CLIワンショット(
infer model run --local)は即反映。 apiの有効enum: openai-completions / openai-responses / anthropic-messages / google-generative-ai / github-copilot / bedrock-converse-stream / ollama / azure-openai-responses。
Verification
openclaw infer model run --local --model "ollama-local/qwen2.5:14b" --prompt "一言返して" が実テキストを返せば成功(qwen2.5:14bで初回~12秒)。
Memory連携(Claudeと同じ知識をOllama版OpenClawに持たせる)
OpenClawのmemory-coreでObsidian vault+Claudeメモリをローカルollama埋め込みでインデックスする(外部送信ゼロ)。
- 埋め込みモデルをpull:
ollama pull nomic-embed-text(無料・768次元) mkdir -p ~/.openclaw/workspace/memory(無いとindexが"memory directory missing"で怒る)- patch適用:
{ agents: { defaults: { memorySearch: {
enabled: true,
provider: "ollama", // 既定はopenai=キー無で失敗するので必ず切替
model: "nomic-embed-text",
sources: ["memory", "sessions"], // sessions=過去会話もリコール対象
extraPaths: [ // ~展開されない→絶対パス必須
"~/Documents/claude-obsidian/wiki",
"~/.claude/projects/-Users-you/memory"
],
sync: { onSessionStart: true, onSearch: true, watch: true } // 自動再index・cron不要
}}}}- index構築:
openclaw memory status --index --agent main("Embeddings: ready" / "Indexed: N/N"を確認) - 検証:
openclaw memory search "就活トラッカー" --agent mainで実ヒット確認
Pitfalls(memory)
- 既定の埋め込みprovider=
openaiはAPIキー無しで失敗。ollamaへ必ず変更。 extraPathsは~非展開。絶対パスで書く。- 設定後は
openclaw chatを入り直さないと走行中セッションには効かない。
チャット中リコール+弱いローカルモデル対策(重要な実戦知見)
openclaw chat はプラグインを積まない
openclaw chat = tui --local = 埋め込みモード=プラグイン(active-memory等)非ロード。プラグインのリコールを効かせるには Gatewayを起動して openclaw tui(--local無し)で繋ぐ。
- Gateway起動の前提: configに
gateway.mode:"local",gateway.auth:{mode:"none"},gateway.bind:"loopback"(auth は文字列でなくオブジェクト)。openclaw gateway --forceで常駐。
qwen2.5:14bは丸腰にしないとエージェント機構で壊れる
ツール/スキルが多いと14Bは注入メモリを無視して web_search(要ollamaクラウド認証→失敗)/skill_workshop/memory_retrieve の生JSONを吐く。必須:
{ tools: { profile: "minimal", web: { search:{enabled:false}, x_search:{enabled:false} } },
agents: { defaults: { skills: [] } } }→ tool policyが23ツール除去。これで素直に答える。
確実なメモリ注入=静的bootstrap(active-memory RActより信頼できる)
~/.openclaw/workspace/USER.md(と main セッションの MEMORY.md)は埋め込み/Gateway両モードで毎ターン確実にプロンプト注入される。ここにユーザーの核(プロフィール・主要プロジェクト・stack・応答方針)を書くのが最も確実。
- active-memory(RAGサブエージェント)は: llama3.2:3b=
no_relevant_memory誤判定が出る/qwen2.5:14b=timeout(45s超)。flakyなので主役にしない。USER.md静的注入を baseline、active-memoryは Gateway時の上積みとして残す程度。 plugins.entries.active-memory.hooks.allowPromptInjection:trueを入れてもheadlessopenclaw agentターンにはruntimeContextChars=0(注入は主にライブ対話パス)。- 深い長尾の事実は
openclaw memory search "..."(CLI)で確実に引ける=これは常に効く。
検証
openclaw agent --local --session-key tNN --message "俺は誰?何作ってる人?" → USER.mdの内容で正しく答えればbaseline成立。
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

