feat: add 19 fast commands (no-LLM) + incremental embeddings indexing
Fast commands for git, email, calendar, notes, search, reminders, and diagnostics — all execute instantly without Claude CLI. Incremental embeddings indexing in heartbeat (1h cooldown) + inline indexing after /note, /jurnal, /email save. Fix Ollama URL (localhost → 10.0.20.161), fix email_process.py KB path (kb/ → memory/kb/). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -24,6 +24,7 @@ DEFAULT_CHECKS = {
|
||||
"calendar": True,
|
||||
"kb_index": True,
|
||||
"git": True,
|
||||
"embeddings": True,
|
||||
}
|
||||
|
||||
DEFAULT_COOLDOWNS = {
|
||||
@@ -31,6 +32,7 @@ DEFAULT_COOLDOWNS = {
|
||||
"calendar": 0, # every run
|
||||
"kb_index": 14400, # 4h
|
||||
"git": 14400, # 4h
|
||||
"embeddings": 3600, # 1h
|
||||
}
|
||||
|
||||
DEFAULT_QUIET_HOURS = [23, 8]
|
||||
@@ -84,6 +86,13 @@ def run_heartbeat(config: dict | None = None) -> str:
|
||||
results.append(git_result)
|
||||
checks["git"] = now.isoformat()
|
||||
|
||||
# Check 5: Incremental embeddings index
|
||||
if check_flags.get("embeddings") and _should_run("embeddings", checks, now, cooldowns):
|
||||
emb_result = _check_embeddings()
|
||||
if emb_result:
|
||||
results.append(emb_result)
|
||||
checks["embeddings"] = now.isoformat()
|
||||
|
||||
# Claude CLI: run if HEARTBEAT.md has extra instructions
|
||||
if not is_quiet:
|
||||
claude_result = _run_claude_extra(
|
||||
@@ -316,6 +325,24 @@ def _run_reindex() -> None:
|
||||
log.warning("KB reindex failed: %s", e)
|
||||
|
||||
|
||||
def _check_embeddings() -> str | None:
|
||||
"""Incremental re-index of memory/ embeddings for semantic search."""
|
||||
try:
|
||||
from src.memory_search import incremental_index
|
||||
result = incremental_index()
|
||||
indexed = result.get("indexed", 0)
|
||||
if indexed > 0:
|
||||
chunks = result.get("chunks", 0)
|
||||
return f"Embeddings: {indexed} fisiere reindexate ({chunks} chunks)"
|
||||
return None
|
||||
except ConnectionError:
|
||||
log.warning("Embeddings check skipped: Ollama unreachable")
|
||||
return None
|
||||
except Exception as e:
|
||||
log.warning("Embeddings check failed: %s", e)
|
||||
return None
|
||||
|
||||
|
||||
def _check_git() -> str | None:
|
||||
"""Check for uncommitted files in project."""
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user