Files
Regolith/CLAUDE.md
tanmay11k a3a7e7a480
Some checks failed
Update token count / update-tokens (push) Has been cancelled
feat: add Discord channel, OpenCode runtime, rename to Regolith
- 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
2026-02-19 02:30:14 -05:00

56 lines
2.3 KiB
Markdown

# Regolith
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 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: multi-channel setup, state, message loop, agent invocation |
| `src/channels/whatsapp.ts` | WhatsApp connection, auth, send/receive |
| `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) |
## 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
| Skill | When to Use |
|-------|-------------|
| `/setup` | First-time installation, authentication, service configuration |
| `/customize` | Adding channels, integrations, changing behavior |
| `/debug` | Container issues, logs, troubleshooting |
## Development
```bash
npm run dev # Run with hot reload
npm run build # Compile TypeScript
npm test # Run tests
npm run typecheck # Type check without emitting
```