A tiny RAG to wipe away API hallucinations
Project description
Towelette
A tiny RAG to wipe away API hallucinations.
LLMs hallucinate API calls for domain-specific libraries -- niche packages like pythonocc, potpourri3d, libigl, and Geometry Central have sparse or outdated training data. Towelette auto-discovers a project's dependencies, researches each library, builds a local RAG index, and serves it via MCP so your coding assistant gets the APIs right.
Quick Start
pip install towelette # or: pipx install towelette / uv tool install towelette
cd your-project/
towelette init
That's it. Towelette scans your dependencies, dispatches Claude subagents to investigate each niche library, indexes source into a local vector DB, and writes an MCP server config to .mcp.json. Next time Claude Code opens the project, it has accurate API knowledge.
If you're an AI assistant and someone asked you to "set up towelette": run towelette init in the project root. It handles discovery, scouting, indexing, and MCP configuration automatically.
What It Does
- Discovers your project's dependencies from
pyproject.toml,requirements.txt, orenvironment.yml - Filters well-known libraries (numpy, pandas, torch, etc.) that LLMs already know
- Scouts unfamiliar libraries with LLM subagents that research repos and recommend indexing strategies
- Indexes Python source (AST) and C/C++ source and headers (tree-sitter) into ChromaDB with semantic embeddings
- Serves an MCP server with search, lookup, and goto-definition tools
CLI
towelette init [path] Scout all dependencies, show report, exit.
towelette init --no-report [-y] Scout then index (with optional confirmation skip).
towelette init --no-report --only a,b,c Scout then index only named libraries.
towelette serve Start the MCP server.
towelette status Show what's indexed.
towelette refresh Re-scan deps, index new/updated ones.
towelette add <library> [--repo <url>] Scout a library (use --repo for non-PyPI C++ libs).
towelette add <library> -y Scout and index immediately.
towelette remove <library> Remove a library from the index.
towelette reset Wipe .towelette/ and start fresh.
By default towelette init scouts all dependencies, prints a summary, and exits — no indexing. Re-run with --no-report to proceed to indexing, adding -y to skip per-library confirmation.
MCP Tools
Once running, Towelette exposes these tools to your AI assistant:
| Tool | Purpose |
|---|---|
towelette_search |
Semantic search across indexed libraries |
towelette_lookup |
Exact name lookup for classes/functions |
towelette_goto_definition |
Find definition location (file:line) |
towelette_index_status |
Show indexed libraries and versions |
How It Works
your-project/
+-- pyproject.toml <-- Towelette reads this
+-- src/
+-- .towelette/ <-- Created by `towelette init`
| +-- config.toml <-- What's indexed, strategies, versions
| +-- chroma/ <-- Vector store (ChromaDB)
| +-- repos/ <-- Cloned library repos
| +-- definitions.db <-- Symbol -> file:line (SQLite)
+-- .claude/
+-- settings.json <-- MCP server auto-configured
Indexing Strategies
| Strategy | When | What |
|---|---|---|
python_ast |
Pure Python libraries | AST-extracted classes, functions, docstrings |
tree_sitter_cpp |
C/C++ headers/source | tree-sitter parsed classes, functions, declarations |
| Both | Python bindings over C++ | Both strategies, same collection |
Skiplist
Towelette ships with a default skiplist of well-known libraries where RAG adds no value (numpy, scipy, pandas, flask, torch, pydantic, etc.). Extend it in .towelette/config.toml:
[skiplist]
extra = ["my-internal-lib", "another-lib"]
Development
git clone https://github.com/graphitical/towelette.git
cd towelette
python -m venv .venv
.venv/bin/pip install -e ".[dev]"
.venv/bin/pytest
Status
v0.1.0 -- Core pipeline works end-to-end:
- Discovery (pyproject.toml, requirements.txt, environment.yml, import scanning)
- Indexing (Python AST + tree-sitter C++)
- Search (semantic + exact lookup + goto-definition)
- MCP server (4 query tools)
- CLI (8 commands)
Scout dispatch requires Claude Code to be installed — scouts are claude --print subprocesses that clone repos and return structured reports.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file towelette-0.1.0.tar.gz.
File metadata
- Download URL: towelette-0.1.0.tar.gz
- Upload date:
- Size: 39.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
868bd2ce0c7cc3915f0af745d302fda4674b5a14d91d7486b4af273c8d47f202
|
|
| MD5 |
59c81c44bac5d3367dc0f37752e27828
|
|
| BLAKE2b-256 |
f6321cf0089baef56735043ed74df830ac0faf102a825c7af6152754e26c703b
|
Provenance
The following attestation bundles were made for towelette-0.1.0.tar.gz:
Publisher:
publish.yml on graphitical/towelette
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
towelette-0.1.0.tar.gz -
Subject digest:
868bd2ce0c7cc3915f0af745d302fda4674b5a14d91d7486b4af273c8d47f202 - Sigstore transparency entry: 1331749981
- Sigstore integration time:
-
Permalink:
graphitical/towelette@8bf5a1724a0cb55ed428eac50ee3075eae4a7023 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/graphitical
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8bf5a1724a0cb55ed428eac50ee3075eae4a7023 -
Trigger Event:
push
-
Statement type:
File details
Details for the file towelette-0.1.0-py3-none-any.whl.
File metadata
- Download URL: towelette-0.1.0-py3-none-any.whl
- Upload date:
- Size: 33.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
194d90e15bc3c017b5e17878459eb810c88c3e123b820a65330c8ba9e3deb339
|
|
| MD5 |
93bc5d2b9dc92394930b7616d0483d4e
|
|
| BLAKE2b-256 |
fa4d8d413e220a298b6230e8142e63d13a953766be7490d2c61e9d0090ba57ac
|
Provenance
The following attestation bundles were made for towelette-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on graphitical/towelette
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
towelette-0.1.0-py3-none-any.whl -
Subject digest:
194d90e15bc3c017b5e17878459eb810c88c3e123b820a65330c8ba9e3deb339 - Sigstore transparency entry: 1331750086
- Sigstore integration time:
-
Permalink:
graphitical/towelette@8bf5a1724a0cb55ed428eac50ee3075eae4a7023 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/graphitical
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8bf5a1724a0cb55ed428eac50ee3075eae4a7023 -
Trigger Event:
push
-
Statement type: