- Replace all ~/clawd and ~/.clawdbot paths with ~/echo-core equivalents in tools (git_commit, ralph_prd_generator, backup_config, lead-gen) - Update personality files: TOOLS.md repo/paths, AGENTS.md security audit cmd - Migrate HANDOFF.md architectural decisions to docs/architecture.md - Tighten credentials/ dir to 700, add to .gitignore - Add .claude/ and *.pid to .gitignore - Various adapter, router, and session improvements from prior work Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
62 lines
3.5 KiB
Markdown
62 lines
3.5 KiB
Markdown
# Echo Core — Architecture & Decisions
|
|
|
|
## Development History
|
|
|
|
| Stage | Commit | Description |
|
|
|-------|--------|-------------|
|
|
| 1 | f2973aa | Project Bootstrap — structura, git, venv |
|
|
| 2 | 010580b | Secrets Manager — keyring, CLI `eco secrets set/list/test` |
|
|
| 3 | 339866b | Claude CLI Wrapper — start/resume/clear sessions cu `claude --resume` |
|
|
| 4 | 6cd155b | Discord Bot Minimal — online, /ping, /channel add, /admin add, /setup |
|
|
| 5 | a1a6ca9 | Discord + Claude Chat — conversatii complete, typing indicator, message split |
|
|
| 6 | 5bdceff | Model Selection — /model opus/sonnet/haiku, default per canal |
|
|
| 7 | 09d3de0 | CLI Tool — eco status/doctor/restart/logs/sessions/channel/send |
|
|
| 8 | 24a4d87 | Cron Scheduler — APScheduler, /cron add/list/run/enable/disable |
|
|
| 9 | 0bc4b8c | Heartbeat — verificari periodice (email, calendar, kb index, git) |
|
|
| 10 | 0ecfa63 | Memory Search — Ollama all-minilm embeddings + SQLite semantic search |
|
|
| 10.5 | 85c72e4 | Rename secrets.py, enhanced /status, usage tracking |
|
|
| 11 | d1bb67a | Security Hardening — prompt injection, invocation/security logging, extended doctor |
|
|
| 12 | 2d8e56d | Telegram Bot — python-telegram-bot, commands, inline keyboards |
|
|
| 13 | 80502b7 + 624eb09 | WhatsApp Bridge — Baileys Node.js bridge + Python adapter |
|
|
| Systemd | 6454f0f | Echo Core + WhatsApp bridge as systemd user services |
|
|
| Setup | setup.sh | Interactive 10-step onboarding wizard |
|
|
|
|
## Architectural Decisions
|
|
|
|
- **Claude invocation**: Claude Code CLI cu `--resume` pentru sesiuni persistente
|
|
- **Credentials**: keyring (nu plain text pe disk), subprocess isolation
|
|
- **Discord**: slash commands (`/`), canale asociate dinamic
|
|
- **Telegram**: commands + inline keyboards, @mention/reply in groups
|
|
- **WhatsApp**: Baileys Node.js bridge + Python polling adapter, separate auth namespace
|
|
- **Cron**: APScheduler, sesiuni izolate per job, `--allowedTools` per job
|
|
- **Heartbeat**: verificari periodice, quiet hours (23-08), state tracking
|
|
- **Memory Search**: Ollama all-minilm (384 dim), SQLite, cosine similarity
|
|
- **Security**: prompt injection markers, separate security.log, extended doctor
|
|
- **Concurrency**: Discord + Telegram + WhatsApp in same asyncio event loop via gather
|
|
|
|
## Infrastructure
|
|
|
|
- **Ollama:** http://10.0.20.161:11434 (all-minilm, llama3.2, nomic-embed-text)
|
|
- **Services:** systemd user services (`echo-core`, `echo-whatsapp-bridge`)
|
|
- **CLI:** `eco` (installed at `~/.local/bin/eco` by setup.sh)
|
|
|
|
## Key Files
|
|
|
|
| File | Description |
|
|
|------|-------------|
|
|
| `src/main.py` | Entry point — Discord + Telegram + WhatsApp + scheduler + heartbeat |
|
|
| `src/claude_session.py` | Claude Code CLI wrapper cu --resume, injection protection |
|
|
| `src/router.py` | Message routing (command vs Claude) |
|
|
| `src/scheduler.py` | APScheduler cron jobs |
|
|
| `src/heartbeat.py` | Verificari periodice |
|
|
| `src/memory_search.py` | Semantic search — Ollama embeddings + SQLite |
|
|
| `src/credential_store.py` | Credential broker (keyring) |
|
|
| `src/config.py` | Config loader (config.json) |
|
|
| `src/adapters/discord_bot.py` | Discord bot cu slash commands |
|
|
| `src/adapters/telegram_bot.py` | Telegram bot cu commands + inline keyboards |
|
|
| `src/adapters/whatsapp.py` | WhatsApp adapter — polls Node.js bridge |
|
|
| `bridge/whatsapp/index.js` | Node.js WhatsApp bridge — Baileys + Express |
|
|
| `cli.py` | CLI tool (installed as `eco`) |
|
|
| `setup.sh` | Interactive setup wizard — 10-step onboarding |
|
|
| `config.json` | Runtime config (channels, telegram_channels, whatsapp, admins, models) |
|