@rozek/nanoclaw 0.0.4 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/container/agent-runner/package-lock.json +1524 -0
- package/dist/cli.js +75 -4
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +34 -0
- package/dist/index.js.map +1 -1
- package/package.json +7 -1
- package/.claude/settings.json +0 -1
- package/.claude/skills/add-compact/SKILL.md +0 -135
- package/.claude/skills/add-discord/SKILL.md +0 -203
- package/.claude/skills/add-gmail/SKILL.md +0 -220
- package/.claude/skills/add-image-vision/SKILL.md +0 -94
- package/.claude/skills/add-ollama-tool/SKILL.md +0 -153
- package/.claude/skills/add-parallel/SKILL.md +0 -290
- package/.claude/skills/add-pdf-reader/SKILL.md +0 -104
- package/.claude/skills/add-reactions/SKILL.md +0 -117
- package/.claude/skills/add-slack/SKILL.md +0 -207
- package/.claude/skills/add-telegram/SKILL.md +0 -222
- package/.claude/skills/add-telegram-swarm/SKILL.md +0 -384
- package/.claude/skills/add-voice-transcription/SKILL.md +0 -148
- package/.claude/skills/add-whatsapp/SKILL.md +0 -372
- package/.claude/skills/convert-to-apple-container/SKILL.md +0 -175
- package/.claude/skills/customize/SKILL.md +0 -110
- package/.claude/skills/debug/SKILL.md +0 -349
- package/.claude/skills/get-qodo-rules/SKILL.md +0 -122
- package/.claude/skills/get-qodo-rules/references/output-format.md +0 -41
- package/.claude/skills/get-qodo-rules/references/pagination.md +0 -33
- package/.claude/skills/get-qodo-rules/references/repository-scope.md +0 -26
- package/.claude/skills/qodo-pr-resolver/SKILL.md +0 -326
- package/.claude/skills/qodo-pr-resolver/resources/providers.md +0 -329
- package/.claude/skills/setup/SKILL.md +0 -218
- package/.claude/skills/update-nanoclaw/SKILL.md +0 -235
- package/.claude/skills/update-skills/SKILL.md +0 -130
- package/.claude/skills/use-local-whisper/SKILL.md +0 -152
- package/.claude/skills/x-integration/SKILL.md +0 -417
- package/.claude/skills/x-integration/agent.ts +0 -243
- package/.claude/skills/x-integration/host.ts +0 -159
- package/.claude/skills/x-integration/lib/browser.ts +0 -148
- package/.claude/skills/x-integration/lib/config.ts +0 -62
- package/.claude/skills/x-integration/scripts/like.ts +0 -56
- package/.claude/skills/x-integration/scripts/post.ts +0 -66
- package/.claude/skills/x-integration/scripts/quote.ts +0 -80
- package/.claude/skills/x-integration/scripts/reply.ts +0 -74
- package/.claude/skills/x-integration/scripts/retweet.ts +0 -62
- package/.claude/skills/x-integration/scripts/setup.ts +0 -87
- package/.env.example +0 -1
- package/.github/CODEOWNERS +0 -10
- package/.github/PULL_REQUEST_TEMPLATE.md +0 -14
- package/.github/workflows/bump-version.yml +0 -32
- package/.github/workflows/ci.yml +0 -25
- package/.github/workflows/merge-forward-skills.yml +0 -160
- package/.github/workflows/update-tokens.yml +0 -42
- package/.husky/pre-commit +0 -1
- package/.mcp.json +0 -3
- package/.nvmrc +0 -1
- package/.prettierrc +0 -3
- package/CHANGELOG.md +0 -8
- package/CONTRIBUTING.md +0 -23
- package/CONTRIBUTORS.md +0 -15
- package/NanoClaw_with_Web-Support.md +0 -325
- package/README_zh.md +0 -200
- package/assets/nanoclaw-favicon.png +0 -0
- package/assets/nanoclaw-icon.png +0 -0
- package/assets/nanoclaw-logo-dark.png +0 -0
- package/assets/nanoclaw-logo.png +0 -0
- package/assets/nanoclaw-profile.jpeg +0 -0
- package/assets/nanoclaw-sales.png +0 -0
- package/assets/social-preview.jpg +0 -0
- package/config-examples/mount-allowlist.json +0 -25
- package/docs/APPLE-CONTAINER-NETWORKING.md +0 -90
- package/docs/DEBUG_CHECKLIST.md +0 -143
- package/docs/REQUIREMENTS.md +0 -196
- package/docs/SDK_DEEP_DIVE.md +0 -643
- package/docs/SECURITY.md +0 -122
- package/docs/SPEC.md +0 -785
- package/docs/docker-sandboxes.md +0 -359
- package/docs/nanoclaw-architecture-final.md +0 -1063
- package/docs/nanorepo-architecture.md +0 -168
- package/docs/skills-as-branches.md +0 -662
- package/groups/global/CLAUDE.md +0 -58
- package/groups/main/CLAUDE.md +0 -246
- package/launchd/com.nanoclaw.plist +0 -32
- package/repo-tokens/README.md +0 -113
- package/repo-tokens/action.yml +0 -186
- package/repo-tokens/badge.svg +0 -23
- package/repo-tokens/examples/green.svg +0 -14
- package/repo-tokens/examples/red.svg +0 -14
- package/repo-tokens/examples/yellow-green.svg +0 -14
- package/repo-tokens/examples/yellow.svg +0 -14
- package/scripts/run-migrations.ts +0 -105
- package/setup.sh +0 -161
- package/src/channels/index.ts +0 -15
- package/src/channels/registry.test.ts +0 -42
- package/src/channels/registry.ts +0 -32
- package/src/channels/web.ts +0 -1931
- package/src/cli.ts +0 -210
- package/src/config.ts +0 -73
- package/src/container-runner.test.ts +0 -210
- package/src/container-runner.ts +0 -768
- package/src/container-runtime.test.ts +0 -149
- package/src/container-runtime.ts +0 -127
- package/src/credential-proxy.test.ts +0 -192
- package/src/credential-proxy.ts +0 -125
- package/src/db.test.ts +0 -484
- package/src/db.ts +0 -803
- package/src/env.ts +0 -42
- package/src/formatting.test.ts +0 -256
- package/src/group-folder.test.ts +0 -43
- package/src/group-folder.ts +0 -44
- package/src/group-queue.test.ts +0 -484
- package/src/group-queue.ts +0 -379
- package/src/index.ts +0 -854
- package/src/ipc-auth.test.ts +0 -679
- package/src/ipc.ts +0 -461
- package/src/logger.ts +0 -16
- package/src/mount-security.ts +0 -419
- package/src/remote-control.test.ts +0 -397
- package/src/remote-control.ts +0 -224
- package/src/router.ts +0 -52
- package/src/routing.test.ts +0 -170
- package/src/sender-allowlist.test.ts +0 -216
- package/src/sender-allowlist.ts +0 -128
- package/src/session-commands.test.ts +0 -247
- package/src/session-commands.ts +0 -163
- package/src/task-scheduler.test.ts +0 -129
- package/src/task-scheduler.ts +0 -328
- package/src/timezone.test.ts +0 -29
- package/src/timezone.ts +0 -16
- package/src/types.ts +0 -109
- package/tsconfig.json +0 -20
- package/vitest.config.ts +0 -7
- package/vitest.skills.config.ts +0 -7
|
@@ -1,220 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: add-gmail
|
|
3
|
-
description: Add Gmail integration to NanoClaw. Can be configured as a tool (agent reads/sends emails when triggered from WhatsApp) or as a full channel (emails can trigger the agent, schedule tasks, and receive replies). Guides through GCP OAuth setup and implements the integration.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Add Gmail Integration
|
|
7
|
-
|
|
8
|
-
This skill adds Gmail support to NanoClaw — either as a tool (read, send, search, draft) or as a full channel that polls the inbox.
|
|
9
|
-
|
|
10
|
-
## Phase 1: Pre-flight
|
|
11
|
-
|
|
12
|
-
### Check if already applied
|
|
13
|
-
|
|
14
|
-
Check if `src/channels/gmail.ts` exists. If it does, skip to Phase 3 (Setup). The code changes are already in place.
|
|
15
|
-
|
|
16
|
-
### Ask the user
|
|
17
|
-
|
|
18
|
-
Use `AskUserQuestion`:
|
|
19
|
-
|
|
20
|
-
AskUserQuestion: Should incoming emails be able to trigger the agent?
|
|
21
|
-
|
|
22
|
-
- **Yes** — Full channel mode: the agent listens on Gmail and responds to incoming emails automatically
|
|
23
|
-
- **No** — Tool-only: the agent gets full Gmail tools (read, send, search, draft) but won't monitor the inbox. No channel code is added.
|
|
24
|
-
|
|
25
|
-
## Phase 2: Apply Code Changes
|
|
26
|
-
|
|
27
|
-
### Ensure channel remote
|
|
28
|
-
|
|
29
|
-
```bash
|
|
30
|
-
git remote -v
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
If `gmail` is missing, add it:
|
|
34
|
-
|
|
35
|
-
```bash
|
|
36
|
-
git remote add gmail https://github.com/qwibitai/nanoclaw-gmail.git
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
### Merge the skill branch
|
|
40
|
-
|
|
41
|
-
```bash
|
|
42
|
-
git fetch gmail main
|
|
43
|
-
git merge gmail/main || {
|
|
44
|
-
git checkout --theirs package-lock.json
|
|
45
|
-
git add package-lock.json
|
|
46
|
-
git merge --continue
|
|
47
|
-
}
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
This merges in:
|
|
51
|
-
- `src/channels/gmail.ts` (GmailChannel class with self-registration via `registerChannel`)
|
|
52
|
-
- `src/channels/gmail.test.ts` (unit tests)
|
|
53
|
-
- `import './gmail.js'` appended to the channel barrel file `src/channels/index.ts`
|
|
54
|
-
- Gmail credentials mount (`~/.gmail-mcp`) in `src/container-runner.ts`
|
|
55
|
-
- Gmail MCP server (`@gongrzhe/server-gmail-autoauth-mcp`) and `mcp__gmail__*` allowed tool in `container/agent-runner/src/index.ts`
|
|
56
|
-
- `googleapis` npm dependency in `package.json`
|
|
57
|
-
|
|
58
|
-
If the merge reports conflicts, resolve them by reading the conflicted files and understanding the intent of both sides.
|
|
59
|
-
|
|
60
|
-
### Add email handling instructions (Channel mode only)
|
|
61
|
-
|
|
62
|
-
If the user chose channel mode, append the following to `groups/main/CLAUDE.md` (before the formatting section):
|
|
63
|
-
|
|
64
|
-
```markdown
|
|
65
|
-
## Email Notifications
|
|
66
|
-
|
|
67
|
-
When you receive an email notification (messages starting with `[Email from ...`), inform the user about it but do NOT reply to the email unless specifically asked. You have Gmail tools available — use them only when the user explicitly asks you to reply, forward, or take action on an email.
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
### Validate code changes
|
|
71
|
-
|
|
72
|
-
```bash
|
|
73
|
-
npm install
|
|
74
|
-
npm run build
|
|
75
|
-
npx vitest run src/channels/gmail.test.ts
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
All tests must pass (including the new Gmail tests) and build must be clean before proceeding.
|
|
79
|
-
|
|
80
|
-
## Phase 3: Setup
|
|
81
|
-
|
|
82
|
-
### Check existing Gmail credentials
|
|
83
|
-
|
|
84
|
-
```bash
|
|
85
|
-
ls -la ~/.gmail-mcp/ 2>/dev/null || echo "No Gmail config found"
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
If `credentials.json` already exists, skip to "Build and restart" below.
|
|
89
|
-
|
|
90
|
-
### GCP Project Setup
|
|
91
|
-
|
|
92
|
-
Tell the user:
|
|
93
|
-
|
|
94
|
-
> I need you to set up Google Cloud OAuth credentials:
|
|
95
|
-
>
|
|
96
|
-
> 1. Open https://console.cloud.google.com — create a new project or select existing
|
|
97
|
-
> 2. Go to **APIs & Services > Library**, search "Gmail API", click **Enable**
|
|
98
|
-
> 3. Go to **APIs & Services > Credentials**, click **+ CREATE CREDENTIALS > OAuth client ID**
|
|
99
|
-
> - If prompted for consent screen: choose "External", fill in app name and email, save
|
|
100
|
-
> - Application type: **Desktop app**, name: anything (e.g., "NanoClaw Gmail")
|
|
101
|
-
> 4. Click **DOWNLOAD JSON** and save as `gcp-oauth.keys.json`
|
|
102
|
-
>
|
|
103
|
-
> Where did you save the file? (Give me the full path, or paste the file contents here)
|
|
104
|
-
|
|
105
|
-
If user provides a path, copy it:
|
|
106
|
-
|
|
107
|
-
```bash
|
|
108
|
-
mkdir -p ~/.gmail-mcp
|
|
109
|
-
cp "/path/user/provided/gcp-oauth.keys.json" ~/.gmail-mcp/gcp-oauth.keys.json
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
If user pastes JSON content, write it to `~/.gmail-mcp/gcp-oauth.keys.json`.
|
|
113
|
-
|
|
114
|
-
### OAuth Authorization
|
|
115
|
-
|
|
116
|
-
Tell the user:
|
|
117
|
-
|
|
118
|
-
> I'm going to run Gmail authorization. A browser window will open — sign in and grant access. If you see an "app isn't verified" warning, click "Advanced" then "Go to [app name] (unsafe)" — this is normal for personal OAuth apps.
|
|
119
|
-
|
|
120
|
-
Run the authorization:
|
|
121
|
-
|
|
122
|
-
```bash
|
|
123
|
-
npx -y @gongrzhe/server-gmail-autoauth-mcp auth
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
If that fails (some versions don't have an auth subcommand), try `timeout 60 npx -y @gongrzhe/server-gmail-autoauth-mcp || true`. Verify with `ls ~/.gmail-mcp/credentials.json`.
|
|
127
|
-
|
|
128
|
-
### Build and restart
|
|
129
|
-
|
|
130
|
-
Clear stale per-group agent-runner copies (they only get re-created if missing, so existing copies won't pick up the new Gmail server):
|
|
131
|
-
|
|
132
|
-
```bash
|
|
133
|
-
rm -r data/sessions/*/agent-runner-src 2>/dev/null || true
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
Rebuild the container (agent-runner changed):
|
|
137
|
-
|
|
138
|
-
```bash
|
|
139
|
-
cd container && ./build.sh
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
Then compile and restart:
|
|
143
|
-
|
|
144
|
-
```bash
|
|
145
|
-
npm run build
|
|
146
|
-
launchctl kickstart -k gui/$(id -u)/com.nanoclaw # macOS
|
|
147
|
-
# Linux: systemctl --user restart nanoclaw
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
## Phase 4: Verify
|
|
151
|
-
|
|
152
|
-
### Test tool access (both modes)
|
|
153
|
-
|
|
154
|
-
Tell the user:
|
|
155
|
-
|
|
156
|
-
> Gmail is connected! Send this in your main channel:
|
|
157
|
-
>
|
|
158
|
-
> `@Andy check my recent emails` or `@Andy list my Gmail labels`
|
|
159
|
-
|
|
160
|
-
### Test channel mode (Channel mode only)
|
|
161
|
-
|
|
162
|
-
Tell the user to send themselves a test email. The agent should pick it up within a minute. Monitor: `tail -f logs/nanoclaw.log | grep -iE "(gmail|email)"`.
|
|
163
|
-
|
|
164
|
-
Once verified, offer filter customization via `AskUserQuestion` — by default, only emails in the Primary inbox trigger the agent (Promotions, Social, Updates, and Forums are excluded). The user can keep this default or narrow further by sender, label, or keywords. No code changes needed for filters.
|
|
165
|
-
|
|
166
|
-
### Check logs if needed
|
|
167
|
-
|
|
168
|
-
```bash
|
|
169
|
-
tail -f logs/nanoclaw.log
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
## Troubleshooting
|
|
173
|
-
|
|
174
|
-
### Gmail connection not responding
|
|
175
|
-
|
|
176
|
-
Test directly:
|
|
177
|
-
|
|
178
|
-
```bash
|
|
179
|
-
npx -y @gongrzhe/server-gmail-autoauth-mcp
|
|
180
|
-
```
|
|
181
|
-
|
|
182
|
-
### OAuth token expired
|
|
183
|
-
|
|
184
|
-
Re-authorize:
|
|
185
|
-
|
|
186
|
-
```bash
|
|
187
|
-
rm ~/.gmail-mcp/credentials.json
|
|
188
|
-
npx -y @gongrzhe/server-gmail-autoauth-mcp
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
### Container can't access Gmail
|
|
192
|
-
|
|
193
|
-
- Verify `~/.gmail-mcp` is mounted: check `src/container-runner.ts` for the `.gmail-mcp` mount
|
|
194
|
-
- Check container logs: `cat groups/main/logs/container-*.log | tail -50`
|
|
195
|
-
|
|
196
|
-
### Emails not being detected (Channel mode only)
|
|
197
|
-
|
|
198
|
-
- By default, the channel polls unread Primary inbox emails (`is:unread category:primary`)
|
|
199
|
-
- Check logs for Gmail polling errors
|
|
200
|
-
|
|
201
|
-
## Removal
|
|
202
|
-
|
|
203
|
-
### Tool-only mode
|
|
204
|
-
|
|
205
|
-
1. Remove `~/.gmail-mcp` mount from `src/container-runner.ts`
|
|
206
|
-
2. Remove `gmail` MCP server and `mcp__gmail__*` from `container/agent-runner/src/index.ts`
|
|
207
|
-
3. Rebuild and restart
|
|
208
|
-
4. Clear stale agent-runner copies: `rm -r data/sessions/*/agent-runner-src 2>/dev/null || true`
|
|
209
|
-
5. Rebuild: `cd container && ./build.sh && cd .. && npm run build && launchctl kickstart -k gui/$(id -u)/com.nanoclaw` (macOS) or `systemctl --user restart nanoclaw` (Linux)
|
|
210
|
-
|
|
211
|
-
### Channel mode
|
|
212
|
-
|
|
213
|
-
1. Delete `src/channels/gmail.ts` and `src/channels/gmail.test.ts`
|
|
214
|
-
2. Remove `import './gmail.js'` from `src/channels/index.ts`
|
|
215
|
-
3. Remove `~/.gmail-mcp` mount from `src/container-runner.ts`
|
|
216
|
-
4. Remove `gmail` MCP server and `mcp__gmail__*` from `container/agent-runner/src/index.ts`
|
|
217
|
-
5. Uninstall: `npm uninstall googleapis`
|
|
218
|
-
6. Rebuild and restart
|
|
219
|
-
7. Clear stale agent-runner copies: `rm -r data/sessions/*/agent-runner-src 2>/dev/null || true`
|
|
220
|
-
8. Rebuild: `cd container && ./build.sh && cd .. && npm run build && launchctl kickstart -k gui/$(id -u)/com.nanoclaw` (macOS) or `systemctl --user restart nanoclaw` (Linux)
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: add-image-vision
|
|
3
|
-
description: Add image vision to NanoClaw agents. Resizes and processes WhatsApp image attachments, then sends them to Claude as multimodal content blocks.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Image Vision Skill
|
|
7
|
-
|
|
8
|
-
Adds the ability for NanoClaw agents to see and understand images sent via WhatsApp. Images are downloaded, resized with sharp, saved to the group workspace, and passed to the agent as base64-encoded multimodal content blocks.
|
|
9
|
-
|
|
10
|
-
## Phase 1: Pre-flight
|
|
11
|
-
|
|
12
|
-
1. Check if `src/image.ts` exists — skip to Phase 3 if already applied
|
|
13
|
-
2. Confirm `sharp` is installable (native bindings require build tools)
|
|
14
|
-
|
|
15
|
-
**Prerequisite:** WhatsApp must be installed first (`skill/whatsapp` merged). This skill modifies WhatsApp channel files.
|
|
16
|
-
|
|
17
|
-
## Phase 2: Apply Code Changes
|
|
18
|
-
|
|
19
|
-
### Ensure WhatsApp fork remote
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
git remote -v
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
If `whatsapp` is missing, add it:
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
git remote add whatsapp https://github.com/qwibitai/nanoclaw-whatsapp.git
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
### Merge the skill branch
|
|
32
|
-
|
|
33
|
-
```bash
|
|
34
|
-
git fetch whatsapp skill/image-vision
|
|
35
|
-
git merge whatsapp/skill/image-vision || {
|
|
36
|
-
git checkout --theirs package-lock.json
|
|
37
|
-
git add package-lock.json
|
|
38
|
-
git merge --continue
|
|
39
|
-
}
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
This merges in:
|
|
43
|
-
- `src/image.ts` (image download, resize via sharp, base64 encoding)
|
|
44
|
-
- `src/image.test.ts` (8 unit tests)
|
|
45
|
-
- Image attachment handling in `src/channels/whatsapp.ts`
|
|
46
|
-
- Image passing to agent in `src/index.ts` and `src/container-runner.ts`
|
|
47
|
-
- Image content block support in `container/agent-runner/src/index.ts`
|
|
48
|
-
- `sharp` npm dependency in `package.json`
|
|
49
|
-
|
|
50
|
-
If the merge reports conflicts, resolve them by reading the conflicted files and understanding the intent of both sides.
|
|
51
|
-
|
|
52
|
-
### Validate code changes
|
|
53
|
-
|
|
54
|
-
```bash
|
|
55
|
-
npm install
|
|
56
|
-
npm run build
|
|
57
|
-
npx vitest run src/image.test.ts
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
All tests must pass and build must be clean before proceeding.
|
|
61
|
-
|
|
62
|
-
## Phase 3: Configure
|
|
63
|
-
|
|
64
|
-
1. Rebuild the container (agent-runner changes need a rebuild):
|
|
65
|
-
```bash
|
|
66
|
-
./container/build.sh
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
2. Sync agent-runner source to group caches:
|
|
70
|
-
```bash
|
|
71
|
-
for dir in data/sessions/*/agent-runner-src/; do
|
|
72
|
-
cp container/agent-runner/src/*.ts "$dir"
|
|
73
|
-
done
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
3. Restart the service:
|
|
77
|
-
```bash
|
|
78
|
-
launchctl kickstart -k gui/$(id -u)/com.nanoclaw
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
## Phase 4: Verify
|
|
82
|
-
|
|
83
|
-
1. Send an image in a registered WhatsApp group
|
|
84
|
-
2. Check the agent responds with understanding of the image content
|
|
85
|
-
3. Check logs for "Processed image attachment":
|
|
86
|
-
```bash
|
|
87
|
-
tail -50 groups/*/logs/container-*.log
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
## Troubleshooting
|
|
91
|
-
|
|
92
|
-
- **"Image - download failed"**: Check WhatsApp connection stability. The download may timeout on slow connections.
|
|
93
|
-
- **"Image - processing failed"**: Sharp may not be installed correctly. Run `npm ls sharp` to verify.
|
|
94
|
-
- **Agent doesn't mention image content**: Check container logs for "Loaded image" messages. If missing, ensure agent-runner source was synced to group caches.
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: add-ollama-tool
|
|
3
|
-
description: Add Ollama MCP server so the container agent can call local models for cheaper/faster tasks like summarization, translation, or general queries.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Add Ollama Integration
|
|
7
|
-
|
|
8
|
-
This skill adds a stdio-based MCP server that exposes local Ollama models as tools for the container agent. Claude remains the orchestrator but can offload work to local models.
|
|
9
|
-
|
|
10
|
-
Tools added:
|
|
11
|
-
- `ollama_list_models` — lists installed Ollama models
|
|
12
|
-
- `ollama_generate` — sends a prompt to a specified model and returns the response
|
|
13
|
-
|
|
14
|
-
## Phase 1: Pre-flight
|
|
15
|
-
|
|
16
|
-
### Check if already applied
|
|
17
|
-
|
|
18
|
-
Check if `container/agent-runner/src/ollama-mcp-stdio.ts` exists. If it does, skip to Phase 3 (Configure).
|
|
19
|
-
|
|
20
|
-
### Check prerequisites
|
|
21
|
-
|
|
22
|
-
Verify Ollama is installed and running on the host:
|
|
23
|
-
|
|
24
|
-
```bash
|
|
25
|
-
ollama list
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
If Ollama is not installed, direct the user to https://ollama.com/download.
|
|
29
|
-
|
|
30
|
-
If no models are installed, suggest pulling one:
|
|
31
|
-
|
|
32
|
-
> You need at least one model. I recommend:
|
|
33
|
-
>
|
|
34
|
-
> ```bash
|
|
35
|
-
> ollama pull gemma3:1b # Small, fast (1GB)
|
|
36
|
-
> ollama pull llama3.2 # Good general purpose (2GB)
|
|
37
|
-
> ollama pull qwen3-coder:30b # Best for code tasks (18GB)
|
|
38
|
-
> ```
|
|
39
|
-
|
|
40
|
-
## Phase 2: Apply Code Changes
|
|
41
|
-
|
|
42
|
-
### Ensure upstream remote
|
|
43
|
-
|
|
44
|
-
```bash
|
|
45
|
-
git remote -v
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
If `upstream` is missing, add it:
|
|
49
|
-
|
|
50
|
-
```bash
|
|
51
|
-
git remote add upstream https://github.com/qwibitai/nanoclaw.git
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
### Merge the skill branch
|
|
55
|
-
|
|
56
|
-
```bash
|
|
57
|
-
git fetch upstream skill/ollama-tool
|
|
58
|
-
git merge upstream/skill/ollama-tool
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
This merges in:
|
|
62
|
-
- `container/agent-runner/src/ollama-mcp-stdio.ts` (Ollama MCP server)
|
|
63
|
-
- `scripts/ollama-watch.sh` (macOS notification watcher)
|
|
64
|
-
- Ollama MCP config in `container/agent-runner/src/index.ts` (allowedTools + mcpServers)
|
|
65
|
-
- `[OLLAMA]` log surfacing in `src/container-runner.ts`
|
|
66
|
-
- `OLLAMA_HOST` in `.env.example`
|
|
67
|
-
|
|
68
|
-
If the merge reports conflicts, resolve them by reading the conflicted files and understanding the intent of both sides.
|
|
69
|
-
|
|
70
|
-
### Copy to per-group agent-runner
|
|
71
|
-
|
|
72
|
-
Existing groups have a cached copy of the agent-runner source. Copy the new files:
|
|
73
|
-
|
|
74
|
-
```bash
|
|
75
|
-
for dir in data/sessions/*/agent-runner-src; do
|
|
76
|
-
cp container/agent-runner/src/ollama-mcp-stdio.ts "$dir/"
|
|
77
|
-
cp container/agent-runner/src/index.ts "$dir/"
|
|
78
|
-
done
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
### Validate code changes
|
|
82
|
-
|
|
83
|
-
```bash
|
|
84
|
-
npm run build
|
|
85
|
-
./container/build.sh
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
Build must be clean before proceeding.
|
|
89
|
-
|
|
90
|
-
## Phase 3: Configure
|
|
91
|
-
|
|
92
|
-
### Set Ollama host (optional)
|
|
93
|
-
|
|
94
|
-
By default, the MCP server connects to `http://host.docker.internal:11434` (Docker Desktop) with a fallback to `localhost`. To use a custom Ollama host, add to `.env`:
|
|
95
|
-
|
|
96
|
-
```bash
|
|
97
|
-
OLLAMA_HOST=http://your-ollama-host:11434
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
### Restart the service
|
|
101
|
-
|
|
102
|
-
```bash
|
|
103
|
-
launchctl kickstart -k gui/$(id -u)/com.nanoclaw # macOS
|
|
104
|
-
# Linux: systemctl --user restart nanoclaw
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
## Phase 4: Verify
|
|
108
|
-
|
|
109
|
-
### Test via WhatsApp
|
|
110
|
-
|
|
111
|
-
Tell the user:
|
|
112
|
-
|
|
113
|
-
> Send a message like: "use ollama to tell me the capital of France"
|
|
114
|
-
>
|
|
115
|
-
> The agent should use `ollama_list_models` to find available models, then `ollama_generate` to get a response.
|
|
116
|
-
|
|
117
|
-
### Monitor activity (optional)
|
|
118
|
-
|
|
119
|
-
Run the watcher script for macOS notifications when Ollama is used:
|
|
120
|
-
|
|
121
|
-
```bash
|
|
122
|
-
./scripts/ollama-watch.sh
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
### Check logs if needed
|
|
126
|
-
|
|
127
|
-
```bash
|
|
128
|
-
tail -f logs/nanoclaw.log | grep -i ollama
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
Look for:
|
|
132
|
-
- `Agent output: ... Ollama ...` — agent used Ollama successfully
|
|
133
|
-
- `[OLLAMA] >>> Generating` — generation started (if log surfacing works)
|
|
134
|
-
- `[OLLAMA] <<< Done` — generation completed
|
|
135
|
-
|
|
136
|
-
## Troubleshooting
|
|
137
|
-
|
|
138
|
-
### Agent says "Ollama is not installed"
|
|
139
|
-
|
|
140
|
-
The agent is trying to run `ollama` CLI inside the container instead of using the MCP tools. This means:
|
|
141
|
-
1. The MCP server wasn't registered — check `container/agent-runner/src/index.ts` has the `ollama` entry in `mcpServers`
|
|
142
|
-
2. The per-group source wasn't updated — re-copy files (see Phase 2)
|
|
143
|
-
3. The container wasn't rebuilt — run `./container/build.sh`
|
|
144
|
-
|
|
145
|
-
### "Failed to connect to Ollama"
|
|
146
|
-
|
|
147
|
-
1. Verify Ollama is running: `ollama list`
|
|
148
|
-
2. Check Docker can reach the host: `docker run --rm curlimages/curl curl -s http://host.docker.internal:11434/api/tags`
|
|
149
|
-
3. If using a custom host, check `OLLAMA_HOST` in `.env`
|
|
150
|
-
|
|
151
|
-
### Agent doesn't use Ollama tools
|
|
152
|
-
|
|
153
|
-
The agent may not know about the tools. Try being explicit: "use the ollama_generate tool with gemma3:1b to answer: ..."
|