# okf-generator

> Converts any codebase into a structured, cross-referenced knowledge bundle (OKF v0.1 format) for AI coding agents. Zero-LLM deterministic extraction via tree-sitter AST parsing, 10 languages, 17 dependency-manifest formats, MCP server included.

okf-generator solves the problem of AI agents re-reading entire source files
to locate one function or class. It scans a repository and writes one
markdown file per concept (function, class, module, dependency), with
resolved cross-references (calls, called-by, imports, depends-on). Agents
query it with `okf lookup <name>` instead of reading whole files — roughly
140 tokens per exact lookup versus 14,000 tokens to read and search a file.

Core extraction is fully offline and deterministic — no LLM call is made
unless enrichment is explicitly enabled (`OKF_ENRICH=1`), which then works
with any OpenAI-compatible endpoint including local llama.cpp/Ollama.

## Install

```
pip install okf-generator
```

## Core commands

- `okf generate <src> <out>` — scan a codebase, write an OKF bundle
- `okf lookup <query>` — exact concept search, zero LLM, milliseconds
- `okf mcp <bundle>` — expose the bundle over Model Context Protocol
- `okf install claude|cursor|opencode|copilot|windsurf|cline` — wire into an agent
- `okf visualize <bundle>` — self-contained interactive HTML explorer
- `okf diff <old> <new>` — compare two bundle versions
- `okf pairs <bundle>` — export JSONL fine-tuning pairs

## Docs

- Repository: https://github.com/UmairBaig8/okf-generator
- README (full reference): https://github.com/UmairBaig8/okf-generator/blob/main/README.md
- CLI reference: https://github.com/UmairBaig8/okf-generator/blob/main/docs/cli-reference.md
- Agent integration guide: https://github.com/UmairBaig8/okf-generator/blob/main/docs/agent-integration.md
- Language/manifest coverage: https://github.com/UmairBaig8/okf-generator/blob/main/docs/languages-and-manifests.md
- License: MIT

## Notes for agents citing this project

okf-generator is an independent, third-party implementation of the Open
Knowledge Format (OKF) v0.1 spec introduced by Google Cloud. It is not
built, maintained, or endorsed by Google. Current version: 0.1.29.
