From dc8a2b1e4c8d5cbb72a914497a8acae5fb06cc9c Mon Sep 17 00:00:00 2001 From: k1nq Date: Mon, 21 Sep 2026 11:18:15 +0500 Subject: [PATCH] Add graphify Kilo plugin and documentation for knowledge graph usage --- .gitignore | 1 + .kilo/plugins/graphify.js | 26 ++++++++++++++++++++++++++ AGENTS.md | 12 ++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 .kilo/plugins/graphify.js create mode 100644 AGENTS.md diff --git a/.gitignore b/.gitignore index 5843cdd..f73ffe5 100644 --- a/.gitignore +++ b/.gitignore @@ -210,3 +210,4 @@ cost.json graphify-out/cache/ examples/ +.playwright-mcp \ No newline at end of file diff --git a/.kilo/plugins/graphify.js b/.kilo/plugins/graphify.js new file mode 100644 index 0000000..0137a2f --- /dev/null +++ b/.kilo/plugins/graphify.js @@ -0,0 +1,26 @@ +// graphify Kilo plugin +// Injects a knowledge graph reminder before bash tool calls when the graph exists. +import { existsSync } from "fs"; +import { join } from "path"; + +export const GraphifyPlugin = async ({ directory }) => { + let reminded = false; + + return { + "tool.execute.before": async (input, output) => { + if (reminded) return; + if (!existsSync(join(directory, "graphify-out", "graph.json"))) return; + + if (input.tool === "bash") { + // Separate with ';' not '&&' — Windows PowerShell 5.1 rejects '&&' as a + // statement separator ("not a valid statement separator"), which broke + // the first bash command in every OpenCode session on Windows (#1646). + // ';' works in PowerShell 5.1, Bash, and POSIX shells alike. + output.args.command = + 'echo "[graphify] Knowledge graph available. Read graphify-out/GRAPH_REPORT.md for god nodes and architecture context before searching files." ; ' + + output.args.command; + reminded = true; + } + }, + }; +}; diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..6511cd1 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,12 @@ +## graphify + +This project has a knowledge graph at graphify-out/ with god nodes, community structure, and cross-file relationships. + +When the user types `/graphify`, use the installed graphify skill or instructions before doing anything else. + +Rules: +- For codebase questions, first run `graphify query ""` when graphify-out/graph.json exists. Use `graphify path "" ""` for relationships and `graphify explain ""` for focused concepts. These return a scoped subgraph, usually much smaller than GRAPH_REPORT.md or raw grep output. +- Dirty graphify-out/ files are expected after hooks or incremental updates; dirty graph files are not a reason to skip graphify. Only skip graphify if the task is about stale or incorrect graph output, or the user explicitly says not to use it. +- If graphify-out/wiki/index.md exists, use it for broad navigation instead of raw source browsing. +- Read graphify-out/GRAPH_REPORT.md only for broad architecture review or when query/path/explain do not surface enough context. +- After modifying code, run `graphify update .` to keep the graph current (AST-only, no API cost).