# Developer Intelligence Knowledge Graph This project contains a knowledge graph of LLM-generated documentation for a Go codebase. Instead of reading raw source files, query the knowledge graph via MCP tools. ## How to use **Always prefer the knowledge graph over reading raw files.** The graph contains pre-generated English documentation for every file and relationship in the codebase. ### Query patterns - "What does X do?" → `get_file_doc("path/to/file.go")` - "How do X and Y interact?" → `get_relationship("file_a.go", "file_b.go")` - "What's this project about?" → `get_repo_overview()` - "What depends on X?" → `get_dependents("path/to/file.go")` - "What does X depend on?" → `get_dependencies("path/to/file.go")` - "Find anything about routing" → `search_docs("routing")` - "What's outdated?" → `get_stale_docs()` - "How big is the graph?" → `get_graph_stats()` ### Schema The knowledge graph has three entity types: - **File** — one per source file. Has `documentation` (English description of what the file does), `staleness` (fresh or stale), `prev_documentation` (previous version after a merge). - **Repo** — one per repository. Has `documentation` (project-level summary composed from file docs). - **Relationship** — import edges between files. Has `documentation` (how the two files interact), `staleness`. ### Staleness When a file changes, its documentation is regenerated immediately. All downstream relationships and the repo summary are marked **stale** — meaning the code has changed but the doc hasn't been regenerated yet. Stale docs are still returned but flagged with `[STALE]`. ### Tips - Start broad (`get_repo_overview`) then drill into specifics (`get_file_doc`, `get_dependents`). - Use `search_docs` for concept-level queries ("middleware", "authentication", "error handling"). - If a doc says `[STALE]`, the underlying code changed since it was generated. Mention this to the user. - `get_dependents` is the impact analysis tool — "what breaks if I change this file?" - File paths are relative to the repo root (e.g., `echo.go`, `middleware/compress.go`).