feat: Athena OS Фаза 2 — generic chezmoi-канон Мозга

chezmoi-source (чистая пересборка, не дамп 1.2 ГБ):
- dot_claude: CLAUDE.md лин-роутер, AGENTS.md.tmpl (VPS вычищен),
  settings.json.tmpl (deny-щит 20 + security-guard hook), rules
  (structure + ECC 21 язык), 30 generic ECC-агентов, health-check
- dot_codex: symlink-паритет; dot_agents: registry 13 скриптов
  HOME-генерик + методология docs
- плагины: plugins.manifest + bootstrap Слой 1b (marketplace+install)
- launchd: health.plist (PATH-фикс 127) + session-reaper.example
- smoke++: secret-токен guard + канон-проверки (зелёный)
- 0 hard личных данных; cut личного (kb/references/gsd/owner) → Ф4
This commit is contained in:
Зарубин Филипп
2026-06-15 16:59:09 +03:00
parent 25a7005f5d
commit f219b1fc67
188 changed files with 16165 additions and 5 deletions
@@ -0,0 +1,66 @@
#!/usr/bin/env node
// Surface standing capability gaps from the auto-captured routing log.
//
// Reads ~/.claude/references/routing-auto.log (TSV: date, cwd, level, top, route_score, task)
// written by capability-plan.mjs --log on weak/none matches. Buckets rows by task signature;
// a signature seen >= MIN times is a STANDING GAP worth filling proactively (find + vet + adopt)
// instead of falling back to the external ecosystem every single time.
//
// Silent (no output, exit 0) when there are no standing gaps — safe to wire into a
// SessionStart hook once the log has accumulated data.
//
// Usage: node routing-gaps.mjs (GAP_MIN env overrides the >=2 threshold)
import { promises as fs } from "node:fs";
import path from "node:path";
const HOME = process.env.HOME;
const LOG = path.join(HOME, ".claude/references/routing-auto.log");
const MIN = Number(process.env.GAP_MIN || 2);
const STOP = new Set([
"the","a","an","for","with","and","to","of","in","on","my","me","that","this",
"is","be","it","how","do","i","using","use","from","new","app","code","please",
]);
function signature(task) {
return [...new Set(
task.toLowerCase()
.replace(/[^0-9a-zа-яё\s-]/gi, " ")
.split(/\s+/)
.filter((w) => w.length > 3 && !STOP.has(w)),
)].sort().slice(0, 6).join(" ");
}
let raw = "";
try {
raw = await fs.readFile(LOG, "utf8");
} catch {
process.exit(0); // no log yet -> nothing to report
}
const groups = new Map();
for (const line of raw.split("\n")) {
if (!line.trim()) continue;
const [date, , level, , , ...rest] = line.split("\t");
const task = rest.join("\t");
const sig = signature(task || "");
if (!sig) continue;
if (!groups.has(sig)) groups.set(sig, { n: 0, last: "", sample: task, levels: {} });
const g = groups.get(sig);
g.n += 1;
if ((date || "") > g.last) g.last = date || "";
g.levels[level] = (g.levels[level] || 0) + 1;
}
const gaps = [...groups.values()]
.filter((g) => g.n >= MIN)
.sort((a, b) => b.n - a.n);
if (!gaps.length) process.exit(0); // silent when nothing actionable
console.log(`Standing capability gaps (weak/none local matches seen >= ${MIN}x):`);
for (const g of gaps.slice(0, 15)) {
const lv = Object.entries(g.levels).map(([k, v]) => `${k}:${v}`).join(",");
console.log(`- ${g.n}x [${lv}] "${(g.sample || "").slice(0, 60)}" (last ${g.last})`);
}
console.log("Fill these: find + vet (mcp-scan) + adopt -> they become Tier-0 local hits, gap closes.");