GitHub - cyberchitta/llm-context.py: Share code with LLMs via Model Context Protocol or clipboard. Rule-based customization enables easy switching between different tasks (like code review and documentation). Includes smart code outlining. (original) (raw)

LLM Context

License PyPI version Downloads

LLM Context is a tool that helps developers quickly inject relevant content from code/text projects into Large Language Model chat interfaces. It leverages .gitignore patterns for smart file selection and provides both a streamlined clipboard workflow using the command line and direct LLM integration through the Model Context Protocol (MCP).

Note: This project was developed in collaboration with several Claude Sonnets - 3.5, 3.6 and 3.7 (and more recently Grok-3 as well), using LLM Context itself to share code during development. All code in the repository is human-curated (by me 😇, @restlessronin).

Breaking Changes in v0.3.0

We've switched to a Markdown (+ YAML front matter)-based rules system replacing the previous TOML/YAML-based profiles. This is a breaking change that affects configuration. See the User Guide for details on the new rule format and how to use it.

Why LLM Context?

For an in-depth exploration of the reasoning behind LLM Context and its approach to AI-assisted development, check out our article: LLM Context: Harnessing Vanilla AI Chats for Development

To see LLM Context in action with real-world examples and workflows, read: Full Context Magic - When AI Finally Understands Your Entire Project

Current Usage Patterns

Installation

Install LLM Context using uv:

uv tool install "llm-context>=0.3.0"

To upgrade to the latest version:

uv tool upgrade llm-context

Warning: LLM Context is under active development. Updates may overwrite configuration files prefixed with lc-. We recommend all configuration files be version controlled for this reason.

Quickstart

MCP with Claude Desktop

Add to 'claude_desktop_config.json':

Once configured, you can start working with your project in two simple ways:

  1. Say: "I would like to work with my project" Claude will ask you for the project root path.
  2. Or directly specify: "I would like to work with my project /path/to/your/project" Claude will automatically load the project context.

Preferred Workflow: Combining Project UI with MCP

For optimal results, combine initial context through Claude's Project Knowledge UI with dynamic code access via MCP. This provides both comprehensive understanding and access to latest changes. See Full Context Magic for details and examples.

CLI Quick Start and Typical Workflow

  1. Navigate to your project's root directory
  2. Initialize repository: lc-init (only needed once)
  3. Select files: lc-sel-files
  4. (Optional) Review selected files in .llm-context/curr_ctx.yaml
  5. Generate context: lc-context (with optional flags: -p for prompt, -u for user notes)
  6. Use with your preferred interface:
  1. When the LLM requests additional files:
    • Copy the file list from the LLM
    • Run lc-clip-files
    • Paste the contents back to the LLM

Core Commands

Features & Advanced Usage

LLM Context provides advanced features for customizing how project content is captured and presented:

See our User Guide for detailed documentation of these features.

Similar Tools

Check out our comprehensive list of alternatives - the sheer number of tools tackling this problem demonstrates its importance to the developer community.

Acknowledgments

LLM Context evolves from a lineage of AI-assisted development tools:

I am grateful for the open-source community's innovations and the AI assistance that have shaped this project's evolution.

I am grateful for the help of Claude-3.5-Sonnet in the development of this project.

License

This project is licensed under the Apache License, Version 2.0. See the LICENSE file for details.