refactor(heartbeat): config-driven checks, channel delivery, remove hardcoded values

Heartbeat system overhaul:
- Fix email/calendar checks to parse JSON output correctly
- Add per-check cooldowns and quiet hours config
- Send findings to Discord channel instead of just logging
- Auto-reindex KB when stale files detected
- Claude CLI called only if HEARTBEAT.md has extra instructions
- All settings configurable via config.json heartbeat section

Move hardcoded values to config.json:
- allowed_tools list (claude_session.py)
- Ollama URL/model (memory_search.py now reads ollama.url from config)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
MoltBot Service
2026-02-14 23:46:04 +00:00
parent ad31b25af3
commit 9c1f9f94e7
6 changed files with 588 additions and 141 deletions

View File

@@ -26,8 +26,46 @@
},
"heartbeat": {
"enabled": true,
"interval_minutes": 30
"interval_minutes": 30,
"channel": "echo-core",
"model": "haiku",
"quiet_hours": [23, 8],
"checks": {
"email": true,
"calendar": true,
"kb_index": true,
"git": true
},
"cooldowns": {
"email": 1800,
"calendar": 0,
"kb_index": 14400,
"git": 14400
}
},
"allowed_tools": [
"Read", "Edit", "Write", "Glob", "Grep",
"WebFetch", "WebSearch",
"Bash(python3 *)", "Bash(.venv/bin/python3 *)",
"Bash(pip *)", "Bash(pytest *)",
"Bash(git add *)", "Bash(git commit *)",
"Bash(git push)", "Bash(git push *)",
"Bash(git pull)", "Bash(git pull *)",
"Bash(git status)", "Bash(git status *)",
"Bash(git diff)", "Bash(git diff *)",
"Bash(git log)", "Bash(git log *)",
"Bash(git checkout *)",
"Bash(git branch)", "Bash(git branch *)",
"Bash(git stash)", "Bash(git stash *)",
"Bash(npm *)", "Bash(node *)", "Bash(npx *)",
"Bash(systemctl --user *)",
"Bash(trash *)", "Bash(mkdir *)", "Bash(cp *)",
"Bash(mv *)", "Bash(ls *)", "Bash(cat *)", "Bash(chmod *)",
"Bash(docker *)", "Bash(docker-compose *)", "Bash(docker compose *)",
"Bash(ssh *@10.0.20.*)", "Bash(ssh root@10.0.20.*)",
"Bash(ssh echo@10.0.20.*)",
"Bash(scp *10.0.20.*)", "Bash(rsync *10.0.20.*)"
],
"ollama": {
"url": "http://localhost:11434"
},