NanoClaw Customization
This skill helps users add capabilities or modify behavior. Use AskUserQuestion to understand what they want before making changes.
Workflow
- Understand the request - Ask clarifying questions
- Plan the changes - Identify files to modify. If a skill exists for the request (e.g.,
/add-telegram for adding Telegram), invoke it instead of implementing manually.
- Implement - Make changes directly to the code
- Test guidance - Tell user how to verify
Key Files
| File |
Purpose |
src/index.ts |
Orchestrator: state, message loop, agent invocation |
src/channels/whatsapp.ts |
WhatsApp connection, auth, send/receive |
src/ipc.ts |
IPC watcher and task processing |
src/router.ts |
Message formatting and outbound routing |
src/types.ts |
TypeScript interfaces (includes Channel) |
src/config.ts |
Assistant name, trigger pattern, directories |
src/db.ts |
Database initialization and queries |
src/whatsapp-auth.ts |
Standalone WhatsApp authentication script |
groups/CLAUDE.md |
Global memory/persona |
Common Customization Patterns
Adding a New Input Channel (e.g., Telegram, Slack, Email)
Questions to ask:
- Which channel? (Telegram, Slack, Discord, email, SMS, etc.)
- Same trigger word or different?
- Same memory hierarchy or separate?
- Should messages from this channel go to existing groups or new ones?
Implementation pattern:
- Create
src/channels/{name}.ts implementing the Channel interface from src/types.ts (see src/channels/whatsapp.ts for reference)
- Add the channel instance to
main() in src/index.ts and wire callbacks (onMessage, onChatMetadata)
- Messages are stored via the
onMessage callback; routing is automatic via ownsJid()
Adding a New MCP Integration
Questions to ask:
- What service? (Calendar, Notion, database, etc.)
- What operations needed? (read, write, both)
- Which groups should have access?
Implementation:
- Add MCP server config to the container settings (see
src/container-runner.ts for how MCP servers are mounted)
- Document available tools in
groups/CLAUDE.md
Changing Assistant Behavior
Questions to ask:
- What aspect? (name, trigger, persona, response style)
- Apply to all groups or specific ones?
Simple changes → edit src/config.ts
Persona changes → edit groups/CLAUDE.md
Per-group behavior → edit specific group's CLAUDE.md
Adding New Commands
Questions to ask:
- What should the command do?
- Available in all groups or main only?
- Does it need new MCP tools?
Implementation:
- Commands are handled by the agent naturally — add instructions to
groups/CLAUDE.md or the group's CLAUDE.md
- For trigger-level routing changes, modify
processGroupMessages() in src/index.ts
Changing Deployment
Questions to ask:
- Target platform? (Linux server, Docker, different Mac)
- Service manager? (systemd, Docker, supervisord)
Implementation:
- Create appropriate service files
- Update paths in config
- Provide setup instructions
After Changes
Always tell the user:
# Rebuild and restart
npm run build
# macOS:
launchctl unload ~/Library/LaunchAgents/com.nanoclaw.plist
launchctl load ~/Library/LaunchAgents/com.nanoclaw.plist
# Linux:
# systemctl --user restart nanoclaw
Example Interaction
User: "Add Telegram as an input channel"
- Ask: "Should Telegram use the same @Andy trigger, or a different one?"
- Ask: "Should Telegram messages create separate conversation contexts, or share with WhatsApp groups?"
- Create
src/channels/telegram.ts implementing the Channel interface (see src/channels/whatsapp.ts)
- Add the channel to
main() in src/index.ts
- Tell user how to authenticate and test
1---2name: customize3description: Add new capabilities or modify NanoClaw behavior. Use when user wants to add channels (Telegram, Slack, email input), change triggers, add integrations, modify the router, or make any other customizations. This is an interactive skill that asks questions to understand what the user wants.4---56# NanoClaw Customization78This skill helps users add capabilities or modify behavior. Use AskUserQuestion to understand what they want before making changes.910## Workflow11121. **Understand the request** - Ask clarifying questions133. **Plan the changes** - Identify files to modify. If a skill exists for the request (e.g., `/add-telegram` for adding Telegram), invoke it instead of implementing manually.144. **Implement** - Make changes directly to the code155. **Test guidance** - Tell user how to verify1617## Key Files1819| File | Purpose |20|------|---------|21| `src/index.ts` | Orchestrator: state, message loop, agent invocation |22| `src/channels/whatsapp.ts` | WhatsApp connection, auth, send/receive |23| `src/ipc.ts` | IPC watcher and task processing |24| `src/router.ts` | Message formatting and outbound routing |25| `src/types.ts` | TypeScript interfaces (includes Channel) |26| `src/config.ts` | Assistant name, trigger pattern, directories |27| `src/db.ts` | Database initialization and queries |28| `src/whatsapp-auth.ts` | Standalone WhatsApp authentication script |29| `groups/CLAUDE.md` | Global memory/persona |3031## Common Customization Patterns3233### Adding a New Input Channel (e.g., Telegram, Slack, Email)3435Questions to ask:36- Which channel? (Telegram, Slack, Discord, email, SMS, etc.)37- Same trigger word or different?38- Same memory hierarchy or separate?39- Should messages from this channel go to existing groups or new ones?4041Implementation pattern:421. Create `src/channels/{name}.ts` implementing the `Channel` interface from `src/types.ts` (see `src/channels/whatsapp.ts` for reference)432. Add the channel instance to `main()` in `src/index.ts` and wire callbacks (`onMessage`, `onChatMetadata`)443. Messages are stored via the `onMessage` callback; routing is automatic via `ownsJid()`4546### Adding a New MCP Integration4748Questions to ask:49- What service? (Calendar, Notion, database, etc.)50- What operations needed? (read, write, both)51- Which groups should have access?5253Implementation:541. Add MCP server config to the container settings (see `src/container-runner.ts` for how MCP servers are mounted)552. Document available tools in `groups/CLAUDE.md`5657### Changing Assistant Behavior5859Questions to ask:60- What aspect? (name, trigger, persona, response style)61- Apply to all groups or specific ones?6263Simple changes → edit `src/config.ts`64Persona changes → edit `groups/CLAUDE.md`65Per-group behavior → edit specific group's `CLAUDE.md`6667### Adding New Commands6869Questions to ask:70- What should the command do?71- Available in all groups or main only?72- Does it need new MCP tools?7374Implementation:751. Commands are handled by the agent naturally — add instructions to `groups/CLAUDE.md` or the group's `CLAUDE.md`762. For trigger-level routing changes, modify `processGroupMessages()` in `src/index.ts`7778### Changing Deployment7980Questions to ask:81- Target platform? (Linux server, Docker, different Mac)82- Service manager? (systemd, Docker, supervisord)8384Implementation:851. Create appropriate service files862. Update paths in config873. Provide setup instructions8889## After Changes9091Always tell the user:92```bash93# Rebuild and restart94npm run build95# macOS:96launchctl unload ~/Library/LaunchAgents/com.nanoclaw.plist97launchctl load ~/Library/LaunchAgents/com.nanoclaw.plist98# Linux:99# systemctl --user restart nanoclaw100```101102## Example Interaction103104User: "Add Telegram as an input channel"1051061. Ask: "Should Telegram use the same @Andy trigger, or a different one?"1072. Ask: "Should Telegram messages create separate conversation contexts, or share with WhatsApp groups?"1083. Create `src/channels/telegram.ts` implementing the `Channel` interface (see `src/channels/whatsapp.ts`)1094. Add the channel to `main()` in `src/index.ts`1105. Tell user how to authenticate and test