feat(kvb-agent-optimize): initialise the code graph by default
graph.py indexes a repository into codebase-memory-mcp on first use and keeps auto_index on, so every session starts with a graph; agents.py reports its state. Tests run once on unify/skills-20261114 after the merge (operator order 2026-11-14). 🎯 Fix: 88 % 💥 Break: 5 % 💸 Tokens: – ⏱️ Velocity: – 🛡️ Security: 100 % 🏆 Score: 84 🚦 Gate: ⛔ fix 88 % < 90 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a2a03995cb
commit
911eb521b9
12 files changed
+1982
-15
No files matched your search
@@ -127,6 +127,7 @@ const SCRIPT_HOOKS = [
|
||||
["kvb-org-queue/scripts/queue.py", "PreToolUse", "Bash", "block", {}],
|
||||
["kvb-org-perform/scripts/log.py", "PreToolUse", "Agent|Task", "spawn", {}],
|
||||
["kvb-org-perform/scripts/log.py", "PostToolUse", "Bash", "persist", {}],
|
||||
["kvb-agent-optimize/scripts/graph.py", "PreToolUse", null, "hook", { timeout: 30 }],
|
||||
];
|
||||
for (const [script, event, matcher, sub, extra] of SCRIPT_HOOKS) {
|
||||
data.hooks[event] = data.hooks[event] || [];
|
||||
@@ -142,4 +143,4 @@ for (const [script, event, matcher, sub, extra] of SCRIPT_HOOKS) {
|
||||
}
|
||||
|
||||
fs.writeFileSync(settingsPath, JSON.stringify(data, null, 2) + "\n");
|
||||
console.log(`skills: enabled the caveman and ponytail plugins (plugin skill copies dropped from this .claude), the ${REMINDERS.join(" + ")} reminders, the kvb-org-organize claim gate and resource watch, the kvb-org-radio hooks, the kvb-org-queue gate, and the kvb-org-perform log in ${settingsPath}`);
|
||||
console.log(`skills: enabled the caveman and ponytail plugins (plugin skill copies dropped from this .claude), the ${REMINDERS.join(" + ")} reminders, the kvb-org-organize claim gate and resource watch, the kvb-org-radio hooks, the kvb-org-queue gate, the kvb-org-perform log, and the kvb-agent-optimize code graph hook in ${settingsPath}`);
|
||||
+23
-2
@@ -92,11 +92,32 @@ if [[ "${TARGET}" == "${HOME}" ]]; then
|
||||
if ! curl -fsSL --proto '=https' https://raw.githubusercontent.com/DeusData/codebase-memory-mcp/main/install.sh | bash; then
|
||||
warn "skills: the codebase-memory-mcp installer failed; the code graph keeps its previous setup."
|
||||
fi
|
||||
if (ulimit -c 0; codebase-memory-mcp config set auto_index true); then
|
||||
log "skills: auto-indexing every repository a session opens into the code graph"
|
||||
if (ulimit -c 0; codebase-memory-mcp config set auto_index false); then
|
||||
log "skills: daemon auto_index off; the kvb-agent-optimize graph.py hook indexes every git root a session touches, the session root included, through its size and memory gates"
|
||||
else
|
||||
warn "skills: codebase-memory-mcp is not runnable from PATH; the code graph stays off (see kvb-agent-optimize)."
|
||||
fi
|
||||
graph_config="${XDG_CONFIG_HOME:-${HOME}/.config}/kvb-code-graph/config.json"
|
||||
graph_settings=""
|
||||
if [[ -f "${graph_config}" ]]; then
|
||||
graph_settings="$(<"${graph_config}")"
|
||||
fi
|
||||
if [[ "${graph_settings}" != *'"queue_file_threshold"'* || "${graph_settings}" != *'"queue_task"'* ]]; then
|
||||
warn "skills: kvb-code-graph: no config at ${graph_config} with queue_file_threshold and queue_task; the graph.py hook indexes nothing until the operator sets both (see kvb-agent-optimize)."
|
||||
fi
|
||||
if command -v systemctl &>/dev/null && systemctl --user show-environment &>/dev/null && [[ -x "${HOME}/.local/bin/codebase-memory-mcp" ]]; then
|
||||
log "skills: enabling kvb-code-graph.service, which keeps a permanent codebase-memory-mcp daemon so every graph stays watched"
|
||||
mkdir -p "${HOME}/.config/systemd/user"
|
||||
cp -f "${REPO_ROOT}/skills/kvb-agent-optimize/systemd/kvb-code-graph.service" "${HOME}/.config/systemd/user/"
|
||||
systemctl --user daemon-reload
|
||||
systemctl --user try-restart kvb-code-graph.service || true
|
||||
if ! systemctl --user enable --now kvb-code-graph.service; then
|
||||
systemctl --user enable kvb-code-graph.service || true
|
||||
log "skills: kvb-code-graph.service enabled; it did not start now and takes effect at next login."
|
||||
fi
|
||||
else
|
||||
warn "skills: no systemd user session or no ~/.local/bin/codebase-memory-mcp; graphs keep their watch only while a session runs."
|
||||
fi
|
||||
if command -v medusa &>/dev/null; then
|
||||
log "skills: the MEDUSA security scanner is installed"
|
||||
elif ! command -v pipx &>/dev/null; then
|
||||
|
||||
Reference in new issue
Block a user