fittok v0.3.0
fittok retrieves only the relevant source code for a question — instead of the model reading whole files — so an LLM answers codebase questions on a small, focused slice of context. Less input = fewer tokens, lower cost.
📦 PyPI: https://pypi.org/project/fittok/0.3.0/
Install
- MCP (recommended):
{ "mcpServers": { "fittok": { "command": "uvx", "args": ["fittok"] } } } - CLI:
pipx install fittok(or venv +pip install fittok) - Library:
from fittok import optimize
What it does
graphify (tree-sitter knowledge graph) → slurp (semantic + TF-IDF + PageRank selection within a relevance cliff) → readable code slice → the model answers from it. Graphs + embeddings cached on disk; only changed code re-embeds.
Token savings (honest)
~80–90% reduction on input context (deterministic, in the savings footer). On a thorough model, a broad question cost ~84k total tokens without fittok vs ~27k with it (it avoided a 58k-token file-exploration subagent). Measure by the footer or your API bill — not Claude Code's /context Messages, which excludes subagent tokens.
Supports Python, JS, JSX, TS, TSX, Java, Go, Rust. Requires Python ≥ 3.10.