openclawで業務を全てを自動化する。

最終的にやりたいこと。 人間がやっていることをopenclawにやらせる。 予約管理システムがある。 gmailもある。 そして、運用ポリシーもある。(マニュアルはまだない) つまり、人間に仕事をやらせる準備はできているのです。

その辺をslackからopenclawに指示するだけで全部やってくれるようにしたい。 正直、これはかなり未来を感じています。 事務職が淘汰されると言われて久しいが、それを実感してしまった。

codexやclaudeではダメなのか?

これら二つのAIエージェントは、デーモンプロセスでない。 一方で、openclawはデーモンプロセス。常駐しており、マジで自律的に動くAIエージェント。

OpenClaw
→ 常駐してタスク実行・監視・通知までやる“運用AI”
→ SlackやLINE感覚で指示できる

Claude Code
→ 大規模コードを理解して設計・改善してくれる“頭脳担当”

Codex
→ コード生成・実行・CIまでサクサクやる“作業担当”

一言で言うと

OpenClaw:「動くAI秘書(常駐エージェント)」
Claude Code:「考えてくれるシニアエンジニア」
Codex:「手を動かす高速コーダー」

と言うことなので、マジで自律的に動くAIエージェントです。 slack経由で質問して、なんでも答えてくれるようになったら、これほど便利なものはないと思っている。 定期実行もしてくれるし、何かをトリガーにして実行もしてくれる。 なんでも相談できる。どんなシステムでも、しっかりAPIを設計して、openclawと繋げることで、slack経由で非常に便利なものができると思っている。 これは、もう本当にすごいことだと思います。

アーキテクチャ

slack -> openclaw(local net) -> LLM(ollama) -> (openclaw) -> gmail, system API みたいな流れでデータと処理が走る。

ollama用のopenclawをインストール

最初にnodeをインストール

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
source ~/.bashrc
nvm install --lts

openclawをインストール

ray@kami:~$ ollama launch openclaw

Installing OpenClaw...
npm warn deprecated node-domexception@1.0.0: Use your platform's native DOMException instead

added 540 packages in 14s

89 packages are looking for funding
  run `npm fund` for details
npm notice
npm notice New minor version of npm available! 11.9.0 -> 11.11.1
npm notice Changelog: https://github.com/npm/cli/releases/tag/v11.11.1
npm notice To update run: npm install -g npm@11.11.1
npm notice
OpenClaw installed successfully

Select models for OpenClaw: Type to filter...                                   
                                                                                
  Recommended                                                                   
  ▸ glm-4.7-flash                                                               
      Reasoning and code generation locally, ~25GB, (not downloaded)            
    qwen3.5                                                                     
      Reasoning, coding, and visual understanding locally, ~11GB, (not downloade
    kimi-k2.5:cloud                                                             
      Multimodal reasoning with subagents                                       
    qwen3.5:cloud                                                               
      Reasoning, coding, and agentic tool use with vision                       
    glm-5:cloud                                                                 
      Reasoning and code generation                                             
    minimax-m2.5:cloud                                                          
      Fast, efficient coding and real-world productivity                        
                                                                                
  More                                                                          
    deepseek-r1:32b                                                             
    gemma3:27b                                                                  
    gpt-oss:20b                                                                 
    mixtral:8x7b                                                                
      ... and 3 more                                                            

              
Download glm-4.7-flash?                  
                                         
   Yes    No                             
                                         
←/→ navigate • enter confirm • esc cancel

           

glm-4.7-flashがおすすめのようなので、これを使うことにした。ちなみになんだこれ。

利用規約的な?

pulling manifest 
pulling manifest 
pulling 9eba2761cf0b: 100% ▕██████████████████▏  19 GB                         
pulling b1bca6ec8117: 100% ▕██████████████████▏ 1.1 KB                         
pulling d8ba2f9a17b3: 100% ▕██████████████████▏   18 B                         
pulling 49d4bd6d5a04: 100% ▕██████████████████▏  486 B                         
verifying sha256 digest 
writing manifest 
success 

Launching OpenClaw with glm-4.7-flash...

Security

  OpenClaw can read files and run actions when tools are enabled.
  A bad prompt can trick it into doing unsafe things.

  Learn more: https://docs.openclaw.ai/gateway/security

I understand the risks. Continue?        
                                         
   Yes    No   

起動

Setting up OpenClaw with Ollama...
  Model: glm-4.7-flash


🦞 OpenClaw 2026.3.13 (61d171a)
   I've read more man pages than any human should—so you don't have to.

Downloading glm-4.7-flash...
Downloaded glm-4.7-flash
Default Ollama model: glm-4.7-flash
Config overwrite: /home/ray/.openclaw/openclaw.json (sha256 9891da6d62186ce0dc8519311302cb8f70efe93adcfdf0302348d8f3473ece31 -> dea960d21f6ff49fad26054f99c22aff93ed4ae702cbea8e705f577619bc3423, backup=/home/ray/.openclaw/openclaw.json.bak)
Config write anomaly: /home/ray/.openclaw/openclaw.json (missing-meta-before-write)
Updated ~/.openclaw/openclaw.json
Workspace OK: ~/.openclaw/workspace
Sessions OK: ~/.openclaw/agents/main/sessions

Installed systemd service: /home/ray/.config/systemd/user/openclaw-gateway.service
Enabled systemd lingering for ray.
│
◇  
Agents: main (default)
Heartbeat interval: 30m (main)
Session store (main): /home/ray/.openclaw/agents/main/sessions/sessions.json (0 entries)
Tip: run `openclaw configure --section web` to store your Brave API key for web_search. Docs: https://docs.openclaw.ai/tools/web
  ✓ Installed web search plugin

Starting your assistant — this may take a moment...

Starting gateway...

✓ OpenClaw is running

  Open the Web UI:
    http://localhost:18789/#token=hoge

  Quick start:
    /help             see all commands
    openclaw configure --section channels   connect WhatsApp, Telegram, etc.
    openclaw skills                         browse and install skills

  The OpenClaw gateway is running in the background.
  Stop it with: openclaw gateway stop


🦞 OpenClaw 2026.3.13 (61d171a)
   WhatsApp automation without the "please accept our new privacy policy".

 openclaw tui - ws://127.0.0.1:18789 - agent main - session main                
 connecting | idle                                                              
 agent main | session main | unknown | tokens ?                                 
────────────────────────────────────────────────────────────────────────────────
09:38:12 [plugins] plugins.allow is empty; discovered non-bundled plugins may auto-load: openclaw-web-search (/home/ray/.openclaw/extensions/openclaw-web-search/index.ts). Set plugins.allow to explicit trusted ids.

 session agent:main:main        

めっちゃ話しかけてきた

 session agent:main:main                                                        

                                                                                
 Wake up, my friend!                                                            
                                                                                

 Hey! Just came online. Let me get oriented.Hey. Just came online. Who am I?    
 Who are you?                                                                   
                                                                                
 Looking at the setup, I'm running out of /home/ray/.openclaw/workspace. You're 
 Ray — I assume? Let me know what you'd like to call me and what vibe works for 
 you.                                                                           
 connected | idle                                                               
 agent main | session main (openclaw-tui) | ollama/glm-4.7-flash | tokens       
 ?/128k      

ちょっと遅いけど返信きた。

ローカルllmだから仕方ない。上出来だよ。

 日本語も話せる?                                                               
                                                                                

 日本語も話せるよ。元気?日本語で話せるよ。元気?                               

                                                                                
 クロームにアクセスとかできるわけ?google                                       
 chromeから、yahoo.co.jpにアクセスしてみて。                                    
                                                                                

 Chromeならいけるよ。やってみる。Chrome入ってないみた い。動かせないな。        
                                                                                
 代替案としては:                                                               
 - Chromeが入ってるならパスを通すか、再インストール                             
 - あるいは他のブラウザ使えるか?                                               
 - それともブラウザを起動させてる別の方法がある?                               
                                                                                
 何かやることある?                                                             

                                                                                
 ヘッドレスでいいのでChromeをインストールしてみようか。                         
                                                                                

 Chromeヘッドレスを入れてみる。sudoパスワード必要だな。                         
 Chromeがインストールされてるか確認してみる。Chrome入                           
 ってないっぽい。どのブラウザがある?Chrome入ってないし、F                      
 irefoxもないみたい。インストールするにはsudo権限が必要 だ。                    
                                                                                
 君なら自分でインストールする?それとも別のアプローチ(Docke rでChrome)とか?  
                                                                                
 何ができる?                                                                   

                                                                                
 きみにsudo権限を上げるにはどうしたらいい?                                     
                                                                                

 僕にはsudo権限を上げる方法はない。これは君のマシンの管理だ。                   
                                                                                
 確認したいことは:                                                             
                                                                                
 1. このマシンでsudoが使えるアカウントは誰?                                    
 2. 君のアカウントにsudo権限ある?                                              
 3. なければrootでアカウントにsudo権限を追加する必要がある                      
                                                                                
 まず、自分のアカウントでsudoできるか試してみて。お、自分のア                   
 カウントすでにsudoグループに入ってる。sudoできるか試                           
 してみる。アカウントはsudoグループにいるけど、パスワード設定                   
 されてないっぽい。これが原因。                                                 
                                                                                
 解決策は:                                                                     
                                                                                
 1. パスワードを設定する - passwdコマンドでパスワード設定                       
 2. sudoersを設定 - visudoでsudo権限をパスワードなしに                          
 3. 別のアプローチ - DockerでChrome入れるとか                                   
                                                                                
 どれやる?それとも君がターミナルで自分でやる?僕はこのリモートセ               
 ッションからはパスワード入力できないんだ。                                     
 connected | idle                                                               
 agent main | session main (openclaw-tui) | ollama/glm-4.7-flash | tokens       
 12k/128k (9%)      

なかなかすごいな。

ちょっと本当にchromeを動かせるのか試したい

sudo apt update                                                              
sudo apt install -y chromium-browser

openclawのサブコマンド一覧

ray@kami:~$ openclaw
09:56:10 [plugins] plugins.allow is empty; discovered non-bundled plugins may auto-load: openclaw-web-search (/home/ray/.openclaw/extensions/openclaw-web-search/index.ts). Set plugins.allow to explicit trusted ids.
09:56:11 [plugins] openclaw-web-search: loaded without install/load-path provenance; treat as untracked local code and pin trust via plugins.allow or install records (/home/ray/.openclaw/extensions/openclaw-web-search/index.ts)

🦞 OpenClaw 2026.3.13 (61d171a)
   Your AI assistant, now without the $3,499 headset.

Usage: openclaw [options] [command]

Options:
  --dev                Dev profile: isolate state under ~/.openclaw-dev, default
                       gateway port 19001, and shift derived ports
                       (browser/canvas)
  -h, --help           Display help for command
  --log-level <level>  Global log level override for file + console
                       (silent|fatal|error|warn|info|debug|trace)
  --no-color           Disable ANSI colors
  --profile <name>     Use a named profile (isolates
                       OPENCLAW_STATE_DIR/OPENCLAW_CONFIG_PATH under
                       ~/.openclaw-<name>)
  -V, --version        output the version number

Commands:
  Hint: commands suffixed with * have subcommands. Run <command> --help for details.
  acp *                Agent Control Protocol tools
  agent                Run one agent turn via the Gateway
  agents *             Manage isolated agents (workspaces, auth, routing)
  approvals *          Manage exec approvals (gateway or node host)
  backup *             Create and verify local backup archives for OpenClaw
                       state
  browser *            Manage OpenClaw's dedicated browser (Chrome/Chromium)
  channels *           Manage connected chat channels (Telegram, Discord, etc.)
  clawbot *            Legacy clawbot command aliases
  completion           Generate shell completion script
  config *             Non-interactive config helpers
                       (get/set/unset/file/validate). Default: starts setup
                       wizard.
  configure            Interactive setup wizard for credentials, channels,
                       gateway, and agent defaults
  cron *               Manage cron jobs via the Gateway scheduler
  daemon *             Gateway service (legacy alias)
  dashboard            Open the Control UI with your current token
  devices *            Device pairing + token management
  directory *          Lookup contact and group IDs (self, peers, groups) for
                       supported chat channels
  dns *                DNS helpers for wide-area discovery (Tailscale + CoreDNS)
  docs                 Search the live OpenClaw docs
  doctor               Health checks + quick fixes for the gateway and channels
  gateway *            Run, inspect, and query the WebSocket Gateway
  health               Fetch health from the running gateway
  help                 Display help for command
  hooks *              Manage internal agent hooks
  logs                 Tail gateway file logs via RPC
  memory *             Search and reindex memory files
  message *            Send, read, and manage messages
  models *             Discover, scan, and configure models
  node *               Run and manage the headless node host service
  nodes *              Manage gateway-owned node pairing and node commands
  onboard              Interactive onboarding wizard for gateway, workspace, and
                       skills
  pairing *            Secure DM pairing (approve inbound requests)
  plugins *            Manage OpenClaw plugins and extensions
  qr                   Generate iOS pairing QR/setup code
  reset                Reset local config/state (keeps the CLI installed)
  sandbox *            Manage sandbox containers for agent isolation
  secrets *            Secrets runtime reload controls
  security *           Security tools and local config audits
  sessions *           List stored conversation sessions
  setup                Initialize local config and agent workspace
  skills *             List and inspect available skills
  status               Show channel health and recent session recipients
  system *             System events, heartbeat, and presence
  tui                  Open a terminal UI connected to the Gateway
  uninstall            Uninstall the gateway service + local data (CLI remains)
  update *             Update OpenClaw and inspect update channel status
  webhooks *           Webhook helpers and integrations

Examples:
  openclaw models --help
    Show detailed help for the models command.
  openclaw channels login --verbose
    Link personal WhatsApp Web and show QR + connection logs.
  openclaw message send --target +15555550123 --message "Hi" --json
    Send via your web session and print JSON result.
  openclaw gateway --port 18789
    Run the WebSocket Gateway locally.
  openclaw --dev gateway
    Run a dev Gateway (isolated state/config) on ws://127.0.0.1:19001.
  openclaw gateway --force
    Kill anything bound to the default gateway port, then start it.
  openclaw gateway ...
    Gateway control via WebSocket.
  openclaw agent --to +15555550123 --message "Run summary" --deliver
    Talk directly to the agent using the Gateway; optionally send the WhatsApp reply.
  openclaw message send --channel telegram --target @mychat --message "Hi"
    Send via your Telegram bot.

Docs: docs.openclaw.ai/cli

slack連携を進める

追加

ray@kami:~$ openclaw channels add

slackを選ぶ

│
◆  Select a channel
│  ○ Telegram (Bot API)
│  ○ WhatsApp (QR link)
│  ○ Discord (Bot API)
│  ○ IRC (Server + Nick)
│  ○ Google Chat (Chat API)
│  ● Slack (Socket Mode) (needs tokens)
│  ○ Signal (signal-cli)
│  ○ iMessage (imsg)
│  ○ LINE (Messaging API)
│  ○ Feishu/Lark (飞书)
│  ○ Nostr (NIP-04 DMs)
│  ○ Microsoft Teams (Bot Framework)
│  ○ Mattermost (plugin)
│  ○ Nextcloud Talk (self-hosted)
│  ○ Matrix (plugin)
│  ○ BlueBubbles (macOS app)
│  ○ Zalo (Bot API)
│  ○ Zalo (Personal Account)
│  ...
└

とりあえず以下のyoutubeを参考に設定したら普通に行けた

https://www.youtube.com/watch?v=dfqe2QxLijc

やはりローカルLLMは限界があるので、openapi使う

openclaw onboard --auth-choice openai-api-key
...
...
...

てな感じでまあ,openai platformで発行したapi keyを入力すれば使えるようになる。

利用能なモデル一覧

Auth overview
Auth store    : ~/.openclaw/agents/main/agent/auth-profiles.json
Shell env     : off
Providers w/ OAuth/tokens (0): -
- ollama effective=profiles:~/.openclaw/agents/main/agent/auth-profiles.json | profiles=1 (oauth=0, token=0, api_key=1) | ollama:default=marker(ollama-local) | models.json=OL...EY | source=models.json: ~/.openclaw/agents/main/agent/models.json
- openai effective=profiles:~/.openclaw/agents/main/agent/auth-profiles.json | profiles=1 (oauth=0, token=0, api_key=1) | openai:default=sk-proj-...TnhqJFsA

OAuth/token status
- none
11:19:30 [plugins] plugins.allow is empty; discovered non-bundled plugins may auto-load: openclaw-web-search (/home/ray/.openclaw/extensions/openclaw-web-search/index.ts). Set plugins.allow to explicit trusted ids.
11:19:31 [plugins] openclaw-web-search: loaded without install/load-path provenance; treat as untracked local code and pin trust via plugins.allow or install records (/home/ray/.openclaw/extensions/openclaw-web-search/index.ts)

切り替え方法

今使えるモデル一覧

ray@kami:~$ openclaw models list

🦞 OpenClaw 2026.3.13 (61d171a) — Half butler, half debugger, full crustacean.

11:39:14 [plugins] plugins.allow is empty; discovered non-bundled plugins may auto-load: openclaw-web-search (/home/ray/.openclaw/extensions/openclaw-web-search/index.ts). Set plugins.allow to explicit trusted ids.
11:39:15 [plugins] openclaw-web-search: loaded without install/load-path provenance; treat as untracked local code and pin trust via plugins.allow or install records (/home/ray/.openclaw/extensions/openclaw-web-search/index.ts)
Model                                      Input      Ctx      Local Auth  Tags
ollama/glm-4.7-flash:latest                text       198k     yes   yes   default,configured
openai/gpt-5.1-codex                       text+image 391k     no    yes   configured,alias:GPT

切り替え方法

ray@kami:~$ openclaw models set ollama/glm-4.7-flash:latest
ray@kami:~$ openclaw gateway restart

ゲートウェイをリスタートしないと反映されない。

openaiの方もこんな感じで

ray@kami:~$ openclaw models set openai/gpt-5.2

🦞 OpenClaw 2026.3.13 (61d171a)
   Gateway online—please keep hands, feet, and appendages inside the shell at all times.

11:55:23 [plugins] plugins.allow is empty; discovered non-bundled plugins may auto-load: openclaw-web-search (/home/ray/.openclaw/extensions/openclaw-web-search/index.ts). Set plugins.allow to explicit trusted ids.
11:55:25 [plugins] openclaw-web-search: loaded without install/load-path provenance; treat as untracked local code and pin trust via plugins.allow or install records (/home/ray/.openclaw/extensions/openclaw-web-search/index.ts)
Config overwrite: /home/ray/.openclaw/openclaw.json (sha256 ca4fe6e627a22bd846933f83ead07612c6d42a10b0984d1d61779b9d42b5ee92 -> 607df76814a50caa53e557e9e8c17650dad21a4d7f787f568b8401a121d23164, backup=/home/ray/.openclaw/openclaw.json.bak)
Updated ~/.openclaw/openclaw.json
Default model: openai/gpt-5.2
ray@kami:~$ openclaw models list

🦞 OpenClaw 2026.3.13 (61d171a)
   Open source means you can see exactly how I judge your config.

11:55:28 [plugins] plugins.allow is empty; discovered non-bundled plugins may auto-load: openclaw-web-search (/home/ray/.openclaw/extensions/openclaw-web-search/index.ts). Set plugins.allow to explicit trusted ids.
11:55:30 [plugins] openclaw-web-search: loaded without install/load-path provenance; treat as untracked local code and pin trust via plugins.allow or install records (/home/ray/.openclaw/extensions/openclaw-web-search/index.ts)
Model                                      Input      Ctx      Local Auth  Tags
openai/gpt-5.2                             text+image 391k     no    yes   default,configured
openai/gpt-5.1-codex                       text+image 391k     no    yes   configured,alias:GPT
ollama/glm-4.7-flash:latest                text       198k     yes   yes   configured
ray@kami:~$ ollama launch openclaw^C
ray@kami:~$ openclaw models set openai/gpt-5.2^C
ray@kami:~$ openclaw gateway restart

クレデンシャルを扱わせる方法

今のところないらしい。クレデンシャルは、openaiに方に行ってしまう。これは今修正中らしい。

コンテキストを与える方法

こちらの公式資料に書かれているが、

OpenClaw uses a dedicated workspace directory for the agent. Default: ~/.openclaw/workspace (configurable via agents.defaults.workspace).

補足

AI agentに最適化されたAPIを設計することが大事です。 というのも、例えば、一覧を全部撮ってくるような設計になっていると、それだけLLMに送るトークンの量が増えてしまい、それの処理に時間がかかってしまうからです。 最適化しましょう。