AI coding assistants are becoming increasingly capable, but they still suffer from one major limitation: they repeatedly consume thousands of tokens re-reading the same source code to answer relatively simple questions. OKF-RS, a new open-source project written in Rust, takes a different approach by converting any repository into a structured knowledge base that AI agents can query directly through the Model Context Protocol (MCP), eliminating the need to repeatedly scan source files.

OKF-RS in 20 seconds

  • Converts software projects into a structured knowledge base built with Markdown and YAML.
  • Supports 11 programming languages, including Rust, Python, JavaScript, Go, Java, and C++.
  • Includes an MCP server so assistants like Claude Code can query relationships without re-reading source code.
  • Its developer claims certain queries can reduce context consumption by up to 400×.

Unlike many code analysis platforms that rely on proprietary graph databases or AI-specific indexes, OKF-RS generates an entirely open Open Knowledge Format (OKF) bundle. The output consists of standard Markdown files with YAML front matter and cross-linked concepts that can be viewed on GitHub, version-controlled with Git, or consumed by any compatible tool.

From Source Code to a Knowledge Graph

Running the generate command analyzes a project using Tree-sitter and creates a knowledge/ directory containing one document for every module, function, method, struct, and enum discovered.

Each document includes the function signature, source location, and relationships to other symbols, forming a navigable knowledge graph that can be explored by both developers and AI assistants.

The goal is to eliminate one of the most repetitive tasks performed by coding assistants today: opening dozens of files just to determine which functions call another function or how modules depend on each other.

Supports Eleven Languages with Optional LSP Resolution

Although originally focused on Rust, OKF-RS now supports eleven programming languages:

  • Rust
  • Python
  • TypeScript
  • JavaScript
  • Go
  • Java
  • C#
  • PHP
  • Kotlin
  • C/C++
  • Swift

Beyond Tree-sitter parsing, it can optionally integrate with Language Server Protocol (LSP) implementations such as rust-analyzer and pyright to resolve ambiguous function calls whenever multiple symbols share the same name. This capability is enabled through the optional --lsp parameter.

MCP Lets AI Agents Stop Re-Reading Code

Perhaps the most compelling component for developers using AI assistants is okf-mcp.

It is an MCP server compatible with the Model Context Protocol, allowing AI coding assistants to query the generated knowledge graph directly.

Instead of repeatedly opening source files, assistants can use structured graph queries such as:

  • graph_callers
  • graph_callees
  • graph_api
  • graph_cycles
  • graph_modules
  • graph_path
  • explore

According to the project’s developer, a question that would normally require reading roughly 6,000 tokens worth of source code can sometimes be answered with approximately 15 tokens using a graph query. In the project’s own benchmark, answering “Who calls cmd_generate?” required about 6,000 tokens through traditional source inspection versus around 15 tokens through graph_callers, representing an estimated 400× reduction for that specific query. This figure is the author’s estimate based on that particular example.

Much More Than a Call Graph

Recent releases have significantly expanded the project’s capabilities.

Current features include:

  • Incremental indexing using content hashes.
  • Continuous watch mode for live updates.
  • CI-ready validation.
  • Semantic search powered by OpenAI-compatible embedding APIs.
  • Documentation generation in HTML, PDF, GraphML, and Obsidian formats.
  • Change impact analysis between Git revisions.
  • Pull request review automation through GitHub Actions.
  • DITA documentation import and export.

The toolkit can also detect architectural communities, identify dependency cycles, locate isolated components, and recognize common software design patterns such as Builder, Factory, Singleton, and Visitor through deterministic structural analysis rather than AI inference.

An Open Approach to AI Coding Assistants

One of OKF-RS’s distinguishing characteristics is that artificial intelligence is not required to generate the knowledge base.

The core bundle is produced entirely through static code analysis. AI can optionally enrich descriptions using OpenAI-compatible APIs, Ollama, LocalAI, or LM Studio, but these enhancements are completely optional and are not required to build the underlying knowledge graph.

The project is released under a dual MIT / Apache 2.0 license. Its roadmap includes a REST and GraphQL server for serving multiple repositories, LSP server capabilities, and an interactive graph visualization interface for exploring larger knowledge bases.

Frequently Asked Questions

What is OKF-RS?

OKF-RS is an open-source Rust toolkit that converts software repositories into structured knowledge bases using the Open Knowledge Format (OKF).

Which programming languages does it support?

It currently supports Rust, Python, TypeScript, JavaScript, Go, Java, C#, PHP, Kotlin, C/C++, and Swift.

What is the MCP server used for?

The MCP server allows Model Context Protocol-compatible coding assistants to query the generated knowledge graph directly instead of repeatedly reading source code.

Does it require AI to analyze code?

No. The core analysis relies on static parsing with Tree-sitter and related technologies. AI is only used optionally to enrich descriptions if desired.

Sources:

Scroll to Top