feat: add Discord channel, OpenCode runtime, rename to Regolith
Some checks failed
Update token count / update-tokens (push) Has been cancelled
Some checks failed
Update token count / update-tokens (push) Has been cancelled
- Discord channel integration (discord.js) with mention stripping, attachment tagging, reply context, message chunking - OpenCode runtime with CLI and SDK modes, SQLite session persistence, idle timeout cleanup - Multi-channel architecture: WhatsApp + Discord simultaneous or independent via DISCORD_ONLY/DISCORD_BOT_TOKEN - Config additions: DISCORD_BOT_TOKEN, DISCORD_ONLY, OPENCODE_MODE, OPENCODE_MODEL, OPENCODE_TIMEOUT, OPENCODE_SESSION_TTL_HOURS - Updated README and CLAUDE.md documentation - Renamed project to Regolith in package.json
This commit is contained in:
54
CLAUDE.md
54
CLAUDE.md
@@ -1,25 +1,41 @@
|
||||
# NanoClaw
|
||||
# Regolith
|
||||
|
||||
Personal Claude assistant. See [README.md](README.md) for philosophy and setup. See [docs/REQUIREMENTS.md](docs/REQUIREMENTS.md) for architecture decisions.
|
||||
Personal AI assistant with multi-channel support (WhatsApp + Discord) and multi-runtime backends (Claude Agent SDK + OpenCode). See [README.md](README.md) for setup.
|
||||
|
||||
## Quick Context
|
||||
|
||||
Single Node.js process that connects to WhatsApp, routes messages to Claude Agent SDK running in Apple Container (Linux VMs). Each group has isolated filesystem and memory.
|
||||
Single Node.js process that connects to WhatsApp and/or Discord, routes messages to Claude Agent SDK (in containers) or OpenCode runtime. Each group has isolated filesystem and memory.
|
||||
|
||||
## Key Files
|
||||
|
||||
| File | Purpose |
|
||||
|------|---------|
|
||||
| `src/index.ts` | Orchestrator: state, message loop, agent invocation |
|
||||
| `src/index.ts` | Orchestrator: multi-channel setup, 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/config.ts` | Trigger pattern, paths, intervals |
|
||||
| `src/channels/discord.ts` | Discord bot connection, mention handling, attachments, reply context |
|
||||
| `src/channels/chunk-text.ts` | Message chunking (2000-char Discord limit) |
|
||||
| `src/router.ts` | Message formatting, outbound routing, `findChannel` |
|
||||
| `src/config.ts` | Trigger pattern, paths, intervals, Discord/OpenCode config |
|
||||
| `src/opencode/runtime.ts` | OpenCode AI backend (CLI + SDK modes) |
|
||||
| `src/opencode/session-store.ts` | SQLite session persistence for OpenCode |
|
||||
| `src/opencode/live-sessions.ts` | In-memory session manager with idle cleanup |
|
||||
| `src/opencode/types.ts` | OpenCode type definitions |
|
||||
| `src/container-runner.ts` | Spawns agent containers with mounts |
|
||||
| `src/task-scheduler.ts` | Runs scheduled tasks |
|
||||
| `src/db.ts` | SQLite operations |
|
||||
| `groups/{name}/CLAUDE.md` | Per-group memory (isolated) |
|
||||
| `container/skills/agent-browser.md` | Browser automation tool (available to all agents via Bash) |
|
||||
|
||||
## Configuration
|
||||
|
||||
| Variable | Default | Purpose |
|
||||
|----------|---------|---------|
|
||||
| `ASSISTANT_NAME` | Andy | Trigger word for the bot |
|
||||
| `DISCORD_BOT_TOKEN` | (empty) | Discord bot token; set to enable Discord |
|
||||
| `DISCORD_ONLY` | false | Skip WhatsApp when true |
|
||||
| `OPENCODE_MODE` | cli | OpenCode mode: "cli" or "sdk" |
|
||||
| `OPENCODE_MODEL` | (unset) | Model name for OpenCode |
|
||||
| `OPENCODE_TIMEOUT` | 120 | Timeout in seconds |
|
||||
| `OPENCODE_SESSION_TTL_HOURS` | 24 | Session TTL in hours |
|
||||
|
||||
## Skills
|
||||
|
||||
@@ -31,27 +47,9 @@ Single Node.js process that connects to WhatsApp, routes messages to Claude Agen
|
||||
|
||||
## Development
|
||||
|
||||
Run commands directly—don't tell the user to run them.
|
||||
|
||||
```bash
|
||||
npm run dev # Run with hot reload
|
||||
npm run build # Compile TypeScript
|
||||
./container/build.sh # Rebuild agent container
|
||||
npm test # Run tests
|
||||
npm run typecheck # Type check without emitting
|
||||
```
|
||||
|
||||
Service management:
|
||||
```bash
|
||||
launchctl load ~/Library/LaunchAgents/com.nanoclaw.plist
|
||||
launchctl unload ~/Library/LaunchAgents/com.nanoclaw.plist
|
||||
```
|
||||
|
||||
## Container Build Cache
|
||||
|
||||
Apple Container's buildkit caches the build context aggressively. `--no-cache` alone does NOT invalidate COPY steps — the builder's volume retains stale files. To force a truly clean rebuild:
|
||||
|
||||
```bash
|
||||
container builder stop && container builder rm && container builder start
|
||||
./container/build.sh
|
||||
```
|
||||
|
||||
Always verify after rebuild: `container run -i --rm --entrypoint wc nanoclaw-agent:latest -l /app/src/index.ts`
|
||||
|
||||
Reference in New Issue
Block a user