Okf Generator logo

Okf Generator

Community
UmairBaig8
okf-generator

Generate OKF (Open Knowledge Format) v0.2 knowledge bundles from codebases, and look up exact concepts for AI agent context injection. Use this skill whenever the user wants to: index a codebase, generate OKF bundles, extract code knowledge into structured markdown, convert codebases into training data, look up functions/classes/modules by name, prime an AI agent with codebase context, or integrate codebase knowledge with OpenCode or other AI coding agents. Also trigger for phrases like "index my code", "generate knowledge bundle", "extract codebase concepts", "what does X class do", or "look up X in OKF".

Overview

PublisherUmairBaig8
Repositoryokf-generator
Skill nameokf-generator
Stars
110
Forks
10
Bundled files
178
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 178 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by UmairBaig8 on GitHub. Read the source before you install it.

Installation

Install the Okf Generator AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/UmairBaig8/okf-generator/tree/main
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/UmairBaig8/okf-generator.git \
  .claude/skills/okf-generator
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Okf Generator in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Okf Generator on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Okf Generator is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

OKF Generator & Lookup Skill

Generates structured OKF v0.2 knowledge bundles from codebases (18 languages via tree-sitter AST + stdlib ast), and provides fast concept lookup for AI agents like OpenCode.

Pipeline Overview

codebase
   |
   v
okf generate  -->  okf_bundle/          (domain/resource-path layout)
                       |
                okf lookup               (zero-LLM concept search)
                       |
                okf pairs          -->  okf_pairs.jsonl  (training data)

CLI Reference

All features via single okf CLI (installed from PyPI).

CommandPurpose
okf generateScan codebase and write OKF bundle
okf lookupSearch bundle and return exact concept
okf pairsConvert bundle to JSONL training pairs
okf summarizeRegenerate SUMMARY.md from existing bundle

Dependencies

bash
pip install okf-generator
# With LLM enrichment:
pip install "okf-generator[llm]"

Task: Generate OKF Bundle

When: user says "index my codebase", "generate OKF bundle", "extract knowledge from code"

Static extraction (no LLM — always run this first)

bash
okf generate <source_dir> <output_dir>

With LLM enrichment (fills missing docstrings and descriptions)

Configure enrichment in .okfconfig (JSON), then run:

bash
okf generate <source_dir> <output_dir> --enrich
# or run enrichment standalone on an existing bundle:
okf enrich <output_dir>
jsonc
// .okfconfig
{
  "llm": { "enabled": true, "base_url": "http://localhost:8080/v1", "api_key": "llamabarn" },
  "providers": {
    "default": { "model": "ggml-org/gemma-3-4b-it-qat-GGUF:Q4_0", "max_workers": 2 }
  }
}

Enrichment is resumable — rerun safely if interrupted. Already-enriched concepts are skipped automatically (checks disk on every run).

Output layout (mirrors source tree)

okf_bundle/
├── SUMMARY.md              <- bird's-eye view for AI agents
├── index.md                <- root index
├── log.md                  <- generation history
└── <domain>/
    └── <module>/
        ├── index.md        <- lists all concepts in folder
        ├── <module>.md     <- Module concept
        └── <ClassName>.md  <- Class / Function concepts

Task: Look Up a Concept

When: user asks "what does X do", "find class X", "look up X", or needs to prime OpenCode with exact concept context before editing code.

bash
# Full detail — signature, docstring, params, returns, related
okf lookup WorldBankConnector

# All concepts from one source file
okf lookup --file StockAI/RnD/python/connectors/economic_data.py

# Filter by type
okf lookup --type Class connector

# Filter by tag
okf lookup --tag lang:python --tag type:Function fetch

# Compact list (many results)
okf lookup --compact connector

# JSON output (programmatic / agent use)
okf lookup --json WorldBankConnector

# Custom bundle path
okf lookup --bundle ./Knowlege/okf_bundle WorldBankConnector

Default bundle path: ./okf_bundle. Also auto-tries ./Knowlege/okf_bundle and ./knowledge/okf_bundle.


Task: Generate Training Pairs

When: user wants JSONL training data from the OKF bundle.

bash
# Static only (instant, no LLM)
SKIP_SYNTH=1 okf pairs <bundle_dir> output.jsonl

# With LLM (QA, doc, summarize pairs)
SYNTH_BASE_URL="http://localhost:8080/v1" \
SYNTH_API_KEY="llamabarn" \
SYNTH_MODEL="ggml-org/gemma-3-4b-it-qat-GGUF:Q4_0" \
MAX_WORKERS=2 \
QA_PER_CONCEPT=3 \
okf pairs <bundle_dir> output.jsonl

# Specific pair types only
PAIR_TYPES="codegen,qa" okf pairs <bundle_dir> output.jsonl

Pair types

TypeStaticLLMCovers
codegenyesyesFunctions, Classes
qanoyesAll (purpose/params/return/edge)
docnoyesFunctions, Classes
summarizeyesyesModules, Classes
crosslinkyesnoAll with related concepts

Task: Regenerate SUMMARY.md Only

bash
okf summarize <bundle_dir>

Use after enrichment finishes to refresh the summary without re-scanning.


OpenCode Integration

See references/opencode-integration.md for full setup.

Quick setup:

bash
# 1. Add to AGENTS.md (auto-loaded by OpenCode)
echo "OKF bundle at ./okf_bundle — use: okf lookup <Name>" >> AGENTS.md

# 2. Add lookup command
mkdir -p .opencode/commands
echo "RUN okf lookup --bundle ./okf_bundle \$NAME" \
  > .opencode/commands/lookup.md

Supported Languages

LanguageParserExtracts
Pythonstdlib astfunctions, classes, params, return types, docstrings
JS / TStree-sitterfunctions, arrow fns, classes, JSDoc
Gotree-sitterfuncs, methods, structs, interfaces, GoDoc
Javatree-sitterclasses, methods, constructors, Javadoc
Rusttree-sitterfns, structs, enums, traits, impl blocks, doc comments
Rubytree-sitterdefs, classes, modules, hash comments
C / C++ / C#tree-sitterfuncs, structs, classes, headers, XML-doc
Swift / Kotlintree-sitterfuncs, classes, protocols, visibility
PHP / Darttree-sitterclasses, functions, docblocks
Scala / Juliatree-sitterdefs, classes, traits, objects
SQLtree-sittertables, views, functions
YAMLPyYAMLdocuments, keys, anchors

Troubleshooting

No concepts found: Check that source dir is not inside a SKIP_DIRS name (node_modules, .venv, dist, etc). Leading path components like /tmp are no longer skipped (fixed in v0.1.3).

Enrichment slow: Set max_workers: 1 in the provider config. Local models process ~1 request at a time. At 32 tok/sec expect ~3-5s per concept.

Enrichment interrupted: Rerun same command. Enriched files are skipped.

JS/TS concepts missing: Ensure tree-sitter-typescript is installed. TypeScript uses a separate grammar from JavaScript.

Lookup wrong result: Add --type or --file to narrow the search scope.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

and 118 more files.

Frequently asked questions

What does the Okf Generator AI skill do?

Generate OKF (Open Knowledge Format) v0.2 knowledge bundles from codebases, and look up exact concepts for AI agent context injection. Use this skill whenever the user wants to: index a codebase, generate OKF bundles, extract code knowledge into structured markdown, convert codebases into training data, look up functions/classes/modules by name, prime an AI agent with codebase context, or integrate codebase knowledge with OpenCode or other AI coding agents. Also trigger for phrases like "index my code", "generate knowledge bundle", "extract codebase concepts", "what does X class do", or "lo...

Why use Okf Generator on TypingMind?

Because you install it once and use it with any model. Okf Generator is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Okf Generator in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/UmairBaig8/okf-generator/tree/main. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Okf Generator?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Okf Generator?

As many as you like. As long as a model supports skills, you can use Okf Generator with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Okf Generator AI skill free?

Yes. It is published on GitHub by UmairBaig8 under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇