ontomics
Extract domain knowledge from codebases to reduce LLM token consumption by 20x and time in agentic search by 10x — gathers and makes concepts, naming conventions, and vocabulary queryable via MCP.
README
ontomics
ontomics gives Claude Code instant knowledge of your codebase. One tool call instead of 19. ~20x fewer tokens.
Benchmark
Tested with Claude Sonnet — same question, with and without ontomics.
"What does 'transform' mean in this codebase?" on voxelmorph (full transcript):
| With ontomics | Without | |
|---|---|---|
| Tool calls | 1 | 19 |
| Tokens | ~3.7k | ~76k |
| Time | 5s | 1m 15s |
| Answer quality | Complete | Complete |
"What are the main domain concepts in this codebase?" on ScribblePrompt (full transcript):
| With ontomics | Without | |
|---|---|---|
| Tool calls | 1 | 26 |
| Tokens | ~3.7k | ~61.6k |
| Time | ~5s | 56s |
| Answer quality | Complete | Complete |
Both conditions produced complete, correct answers. ontomics got there in one call.
What it does that search can't
Search tells you where a string appears. An LSP tells you where a symbol is defined and referenced. Neither answers: what are the domain concepts in this codebase? How do they relate? What naming conventions emerged? What changed in the domain vocabulary since last release? Which functions behave similarly, regardless of what they're named?
ontomics builds a semantic index of your project's domain — clustering related symbols into concepts, detecting naming conventions from usage frequency, resolving abbreviations, grouping functions by behavioral similarity, and tracking how the vocabulary evolves over time. That index can be exported as a portable artifact to bootstrap conventions in other repos.
Behavioral similarity
Beyond naming and concepts, ontomics embeds raw function bodies using CodeRankEmbed (768-dim, contrastive code retrieval) and clusters them by behavioral similarity. This surfaces relationships that neither naming nor call graphs expose:
❯ What functions behave like spatial_transform()?
random_transform() nn/functional.py:352 0.80
spatial_transform() functional.py:596 0.69
random_transform() functional.py:1399 0.67
random_disp() nn/functional.py:275 0.65
integrate_disp() functional.py:764 0.65
compose() nn/functional.py:216 0.63
disp_to_trf() functional.py:343 0.62
The result also reveals that random_transform appears at two locations with different similarity scores — a sign of implementation duplication that concept-level search would miss entirely.
Install
Install once, available in every project. No configuration needed — ontomics auto-detects the repo and indexes it on first run.
ontomics requires a git repository (.git/ directory). It will refuse to index home, root, or temp directories. To index a non-git directory, pass --force.
1. Install the binary
npm (macOS/Linux):
npm install -g @ontomics/ontomics
macOS (Homebrew):
brew install EtienneChollet/tap/ontomics
Shell installer (macOS/Linux):
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/EtienneChollet/ontomics/releases/latest/download/ontomics-installer.sh | sh
From source:
git clone https://github.com/EtienneChollet/ontomics.git
cd ontomics
cargo build --release
2. Register with your harness
Claude Code:
claude mcp add -s user ontomics -- ontomics
Codex:
codex mcp add ontomics -- ontomics
OpenClaw:
openclaw mcp set ontomics '{"command":"ontomics"}'
pi-coding-agent:
pi install npm:@ontomics/ontomics
Share with your team — drop an .mcp.json in your repo root:
{
"mcpServers": {
"ontomics": {
"command": "npx",
"args": ["-y", "@ontomics/ontomics", "--repo", "."]
}
}
}
Supported languages
Python, TypeScript, JavaScript, Rust. Auto-detected from file extensions.
Tools
Concepts and vocabulary
| Tool | What it does |
|---|---|
query_concept |
Find all variants, related concepts, and occurrences of a term |
locate_concept |
Find the key signatures, classes, and files for a concept |
describe_symbol |
Get the signature, docstring, and relationships for a function or class |
trace_concept |
Trace how a concept flows through the codebase via call chains |
list_concepts |
List the top domain concepts by frequency |
list_conventions |
List all detected naming patterns (prefixes, suffixes, conversions) |
list_entities |
List code entities (classes, functions) filtered by concept, role, or kind |
check_naming |
Check an identifier against project conventions; suggests the canonical form |
suggest_name |
Generate an identifier name that fits the project's vocabulary |
vocabulary_health |
Measure convention coverage, naming consistency, and cluster cohesion |
ontology_diff |
Show new, changed, or removed domain concepts since a git ref |
export_domain_pack |
Export domain knowledge as portable YAML for use in other repos |
Behavioral similarity
| Tool | What it does |
|---|---|
find_similar_logic |
Find functions with behaviorally similar implementations, ranked by embedding similarity |
describe_logic |
Get the behavioral description, body text, and logic cluster membership for a function |
compact_context |
Assemble tiered context (concepts + logic) for a symbol, optimized for LLM consumption |
Codebase structure
| Tool | What it does |
|---|---|
describe_file |
Overview of a file's entities, concepts, and relationships |
concept_map |
Show which modules contain which domain concepts |
type_flows |
Show dominant types and how data flows through the codebase |
trace_type |
Trace how a specific type propagates across files and call sites |
Resources
| Resource | What it does |
|---|---|
ontomics://briefing |
Session briefing: top conventions, abbreviations, key concepts, contrastive pairs, and vocabulary warnings. Also available via ontomics briefing CLI. |
How it works
ontomics runs a multi-stage pipeline entirely on your machine — no API keys required:
- Parse — tree-sitter extracts every identifier, signature, and call site from your source files
- Analyze — TF-IDF scoring identifies domain-specific concepts and detects naming conventions
- Embed (concepts) — BGE-small (384-dim) clusters related concepts by semantic similarity
- Embed (logic) — CodeRankEmbed (768-dim) embeds raw function bodies and clusters them by behavioral similarity
- Centrality — PageRank scores entities by structural importance
Both embedding models are downloaded once on first run and cached locally. The index lives at <repo>/.ontomics/index.db — subsequent startups load from cache and watch for file changes.
Configuration via .ontomics/config.toml in the repo root. All fields have sensible defaults. See SPEC.md for the full design contract.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。