Build intelligent context from codebases and URLs for LLMs
Project description
lmfetch
Effortlessly turn codebase into context for your LLMs.
lmfetch is a lightning-fast CLI tool that fetches, chunks, supports local files and remote GitHub repositories, and ranks code context. It's designed to fit the most relevant code into your token budget, so your LLM can understand the implementation details without the noise.
Install
Mac & Linux
curl -fsSL https://raw.githubusercontent.com/Abdulmumin1/lmfetch/main/install.sh | bash
Windows (PowerShell) Coming soon.
Usage
Fetch local code
lmfetch . "how does authentication work"
Fetch from GitHub
lmfetch https://github.com/vercel/ai "explain tool calling"
Common Options
# Set a token budget (default: 50k)
lmfetch . "query" -b 10k
# Force processing of large files
lmfetch . "query" --force-large
# Clear cache
lmfetch --clean-cache
# Output context to file
lmfetch . "query" -o context.md
How It Works
- Smart Chunking: Understands AST (classes, functions) for Python, TS, Go, Rust, and more.
- Hybrid Ranking: Combines keyword matching, vector embeddings, and dependency graph centrality.
- HyDE Reasoning: Generates hypothetical code to match your intent, not just your keywords.
- Privacy: Runs locally. Embeddings use your own API keys (OpenAI/Google).
Architecture
See ARCHITECTURE.md for a deep dive into the pipeline.
License
MIT
Project details
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 lmfetch-0.3.6.tar.gz.
File metadata
- Download URL: lmfetch-0.3.6.tar.gz
- Upload date:
- Size: 12.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
829fd60afb0312d61279aee405ce891f345f4ab1b355aa22fed30629889c84d2
|
|
| MD5 |
bc16729be86cbaae80d1f1ddcd2df6ce
|
|
| BLAKE2b-256 |
b7206263ba2911d6fa7319d58aee2c5cea8ef1fdbc2d22db17d1a7f6f4a0e460
|
Provenance
The following attestation bundles were made for lmfetch-0.3.6.tar.gz:
Publisher:
release.yml on Abdulmumin1/lmfetch
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lmfetch-0.3.6.tar.gz -
Subject digest:
829fd60afb0312d61279aee405ce891f345f4ab1b355aa22fed30629889c84d2 - Sigstore transparency entry: 833773716
- Sigstore integration time:
-
Permalink:
Abdulmumin1/lmfetch@f0ea5b9e1590077957fe891e97f0b9f0ccbb9219 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Abdulmumin1
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@f0ea5b9e1590077957fe891e97f0b9f0ccbb9219 -
Trigger Event:
push
-
Statement type:
File details
Details for the file lmfetch-0.3.6-py3-none-any.whl.
File metadata
- Download URL: lmfetch-0.3.6-py3-none-any.whl
- Upload date:
- Size: 13.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ccc4b619eaa94486366e667b69d44a3ed999fcbfffa55e176f94859a119dbaec
|
|
| MD5 |
d9b2a03a5fe49ad0f961d97a757c4b23
|
|
| BLAKE2b-256 |
96470e820ba85e1bc4fec558b276be284dfc10bf0b9fa3cc1db296b77ec78955
|
Provenance
The following attestation bundles were made for lmfetch-0.3.6-py3-none-any.whl:
Publisher:
release.yml on Abdulmumin1/lmfetch
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lmfetch-0.3.6-py3-none-any.whl -
Subject digest:
ccc4b619eaa94486366e667b69d44a3ed999fcbfffa55e176f94859a119dbaec - Sigstore transparency entry: 833773718
- Sigstore integration time:
-
Permalink:
Abdulmumin1/lmfetch@f0ea5b9e1590077957fe891e97f0b9f0ccbb9219 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Abdulmumin1
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@f0ea5b9e1590077957fe891e97f0b9f0ccbb9219 -
Trigger Event:
push
-
Statement type: