[SPRINT-V1][F] Недельная сводка (гигиена+развитие+доверие+задачи), эпизодическая память в RAG (журнал действий + отчёты агентов)

This commit is contained in:
root committed 2026-11-05 22:40:24 +03:00
1 parent cc551a66b1
commit c5e35f0b18
4 files changed
+201 -1

No files matched your search

+24 -1
View File
@@ -58,14 +58,37 @@ def collect_files():
if not os.path.isdir(base):
continue
for dirpath, dirnames, filenames in os.walk(base):
# исключаем только служебное; отчёты гигиены/развития/доверия — это ЭПИЗОДИЧЕСКАЯ память
dirnames[:] = [x for x in dirnames if x not in
(".git", "node_modules", "rag", "topology", "hygiene", "__pycache__")]
(".git", "node_modules", "__pycache__", "index.db")]
for fn in filenames:
if fn.endswith((".md", ".txt", ".yml", ".yaml")) and not fn.startswith("."):
p = os.path.join(dirpath, fn)
if os.path.getsize(p) < 200:
continue
files.append(p)
# эпизодическая память: журнал действий агента
journal = "/var/log/hermes/actions.jsonl"
if os.path.isfile(journal):
try:
eps = []
lines = open(journal, encoding="utf-8", errors="ignore").readlines()[-400:]
for ln in lines:
try:
e = json.loads(ln)
except Exception:
continue
if e.get("event") not in ("done", "failed", "denied"):
continue
eps.append("%s | %s | %s | %s" % (
e.get("ts", ""), e.get("rule", ""), e.get("event", ""),
str(e.get("reason") or e.get("detail") or "")[:200]))
if eps:
ep_path = ROOT + "/ops/rag/episodes-actions.txt"
open(ep_path, "w", encoding="utf-8").write("\n".join(eps))
files.append(ep_path)
except Exception:
pass
for f in EXTRA_FILES:
p = os.path.join(ROOT, f)
if os.path.isfile(p):