Skip to main content

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

  1. Smart Chunking: Understands AST (classes, functions) for Python, TS, Go, Rust, and more.
  2. Hybrid Ranking: Combines keyword matching, vector embeddings, and dependency graph centrality.
  3. HyDE Reasoning: Generates hypothetical code to match your intent, not just your keywords.
  4. Privacy: Runs locally. Embeddings use your own API keys (OpenAI/Google).

Architecture

See ARCHITECTURE.md for a deep dive into the pipeline.

License

MIT

Metadata

Release files for lmfetch 0.3.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lmfetch 0.3.6
File Size Uploaded
lmfetch-0.3.6.tar.gz 12.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lmfetch 0.3.6
File Interpreter ABI Platform
lmfetch-0.3.6-py3-none-any.whl Python 3 none any Details

Total release size: 25.9 kB

Release files / lmfetch-0.3.6.tar.gz

Download URL lmfetch-0.3.6.tar.gz
Size 12.6 kB
Tags Source
SHA-256 checksum
How to use checksums
829fd60afb0312d61279aee405ce891f345f4ab1b355aa22fed30629889c84d2
BLAKE2b-256 checksum
How to use checksums
b7206263ba2911d6fa7319d58aee2c5cea8ef1fdbc2d22db17d1a7f6f4a0e460
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 18, 2026.

Transparency log

Release files / lmfetch-0.3.6-py3-none-any.whl

Download URL lmfetch-0.3.6-py3-none-any.whl
Size 13.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ccc4b619eaa94486366e667b69d44a3ed999fcbfffa55e176f94859a119dbaec
BLAKE2b-256 checksum
How to use checksums
96470e820ba85e1bc4fec558b276be284dfc10bf0b9fa3cc1db296b77ec78955
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 18, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.3.6 This release

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page