Skip to main content

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

  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

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

lmfetch-0.3.2.tar.gz (12.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lmfetch-0.3.2-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

Details for the file lmfetch-0.3.2.tar.gz.

File metadata

  • Download URL: lmfetch-0.3.2.tar.gz
  • Upload date:
  • Size: 12.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for lmfetch-0.3.2.tar.gz
Algorithm Hash digest
SHA256 f2f2070946d6e6ebd257d84bffb5c192a7d14f053cfd5dac1554f6819c0558dd
MD5 3153ecc728d250db10131c9c004e17d0
BLAKE2b-256 8f3971c7f639c3caa240985cfeff488614706a6719591f4b81bafa0111d7c16b

See more details on using hashes here.

Provenance

The following attestation bundles were made for lmfetch-0.3.2.tar.gz:

Publisher: release.yml on Abdulmumin1/lmfetch

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lmfetch-0.3.2-py3-none-any.whl.

File metadata

  • Download URL: lmfetch-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 12.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for lmfetch-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 eca74a7d5dc7d1fa7e3e273d0b19dd9563a5f9bdf09c49fc4bee0360d4f2fee3
MD5 71c8c72a4aa8d21fa5b624c0960f37bb
BLAKE2b-256 91b7503ec04adf74cf34fbfdc6fa19b6ca7aca22924d84a209eed0f95c502a84

See more details on using hashes here.

Provenance

The following attestation bundles were made for lmfetch-0.3.2-py3-none-any.whl:

Publisher: release.yml on Abdulmumin1/lmfetch

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page