Open-Source Tool Turns Codebases into Agent Knowledge
UmairBaig7 · reddit · 2026-07-16
The author open-sourced okf-generator, a tool that transforms codebases into structured knowledge for LLM agents to query.
The Problem
Traditionally, for an agent to understand a function, it often has to read the entire file or rely on grep. While RAG can retrieve information, chunking by text breaks syntax boundaries, leading to inaccurate context and even causing agents to misjudge call relationships.
Core Solution
Instead of text chunking, it directly parses the AST:
- Uses tree-sitter to cover 18 languages
- Generates typed concept cards for functions / classes / modules
- Parses edges like calls, callers, and imports
- Reduces the cost of a single lookup from 14K tokens down to 140 tokens
Features and Limitations
- Core extraction is fully offline and deterministic, requiring no LLM, API key, or vector DB
- Optional okf enrich --llm for natural language summaries
- Optional okf enrich --lsp leverages LSP for more accurate call graphs
- Built-in MCP server for direct agent queries
- Limitations: Struggles with dynamic dispatch and reflection-heavy code; language maturity varies
The author provided the repository, docs, and current test status (313 tests passing, v0.1.49, MIT)
More from coding & agent
- Codex helps build Valdiluce, an open-world game with climbing, gliding and gondolas — Dimillian · 2026-07-22
- HeyGen adds a media-sourcing skill for coding agents with 75k images and 10k tracks — HeyGen · 2026-07-22
- Agent search bottlenecks are now about variance, not raw latency — rohanpaul_ai · 2026-07-22
- LangSmith adds tracing for Pipecat, LiveKit, OpenAI Realtime, and Gemini Live — LangChain · 2026-07-22
- An MCP server signs every AI agent tool call into a verifiable Merkle chain — Funky_Chicken_22 · 2026-07-22
- Annotated transcript of a Claude Code team interview is now available — trq212 · 2026-07-22