Files
Regolith/CLAUDE.md
tanmay11k 4b2b22d044
Some checks failed
Update token count / update-tokens (push) Has been cancelled
feat: add regolith onboard CLI wizard with daemon installation
- Interactive setup wizard: deps check, env config, WhatsApp auth, daemon install, health check
- CLI entry point via yargs with bin registration (regolith onboard)
- Flags: --install-daemon, --non-interactive, --pairing-code, --json, --skip-*
- launchd (macOS) and systemd (Linux) service installation
- Refactored whatsapp-auth.ts to export authenticate() for programmatic use
- 72 tests across 6 test files
- Updated README.md and CLAUDE.md with onboard CLI docs
2026-02-19 14:05:18 -05:00

73 lines
3.1 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/cli/index.ts` | CLI entry point (`regolith onboard`) |
| `src/cli/wizard-runner.ts` | Onboard wizard step orchestrator |
| `src/cli/steps/*.ts` | Individual wizard steps (deps, env, whatsapp, daemon, health) |
| `src/cli/display.ts` | Progress indicators and summary output |
| `src/cli/types.ts` | Wizard types (WizardFlags, StepResult, WizardContext) |
| `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 |
| `AGENT_BACKEND` | container | Agent backend: "container" or "opencode" |
| `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 |
## Onboard CLI
```bash
regolith onboard # Interactive setup wizard
regolith onboard --install-daemon # Include daemon installation
regolith onboard --non-interactive # Use defaults, no prompts
regolith onboard --json # Output JSON summary
regolith onboard --skip-deps --skip-whatsapp # Skip specific steps
```
## 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
regolith onboard # Run the setup wizard
```