llm-context

by cyberchitta

Not rated
GitHub

About

Share code context with LLMs via Model Context Protocol or clipboard.

Details

Author
cyberchitta
Categories
Developer Tools, Community, Other

Setup

Install llm-context in your MCP client (Claude Desktop, Cursor, Windsurf, and others).

Repository: https://github.com/cyberchitta/llm-context.py

Follow the installation instructions in the repository README, then restart your MCP client.

Smart context management for LLM development workflows.Share relevant project files instantly through intelligent selection and rule-based filtering.

Getting the right context into LLM conversations is friction-heavy:

- Manually finding and copying relevant files wastes time
- Too much context hits token limits, too little misses important details
- AI requests for additional files require manual fetching
- Hard to track what changed during development sessions

llm-context provides focused, task-specific project context through composable rules.

lc-select # Smart file selection lc-context # Copy formatted context to clipboard # Paste and work - AI can access additional files via MCP
lc-preview tmp-prm-auth # Validate rule selects right files lc-context tmp-prm-auth # Get focused context for sub-agent

- lc_outlines- Generate excerpted context from current rule
- lc_preview- Validate rule effectiveness before use
- lc_missing- Fetch specific files/implementations on demand

Note: This project was developed in collaboration with several Claude Sonnets (3.5, 3.6, 3.7, 4.0) and Groks (3, 4), using LLM Context itself to share code during development. All code is heavily human-curated by @restlessronin.

uv tool install "llm-context>=0.6.0"

If you're an agent setting llm-context up to help curate task contexts, run this once per project:

uv tool install "llm-context>=0.6.0" # installs the lc- commands globally cd <project-root> lc-init # creates .llm-context/, copies the lc-curate-context skill to .claude/skills/

Afterlc-init, thelc-curate-contextskill loads in this project's Claude Code session. It teaches how to compose a minimal task rule and verify it withlc-previewbefore generating context.

To pick up a newer skill version, runuv tool upgrade llm-contextand re-runlc-init— it refreshes the skill files in place.

# One-time setup cd your-project lc-init # Daily usage lc-select lc-context # Paste into your LLM chat

Add to Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json):

{ "mcpServers": { "llm-context": { "command": "uvx", "args": ["--from", "llm-context", "lc-mcp"] } } }

Restart Claude Desktop. Now AI can access additional files during conversations without manual copying.

AI agents with shell access use llm-context to create focused contexts:

# Agent explores codebase lc-outlines # Agent creates focused rule for specific task # (via Skill or lc-rule-instructions) # Agent validates rule lc-preview tmp-prm-oauth-task # Agent uses context for sub-task lc-context tmp-prm-oauth-task

AI agents in chat environments use MCP tools:

# Explore codebase structure lc_outlines(root_path, rule_name) # Validate rule effectiveness lc_preview(root_path, rule_name) # Fetch specific files/implementations lc_missing(root_path, param_type, data, timestamp)

Rules: Task-Specific Context Descriptors

Rules are YAML+Markdown files that describe what context to provide for a task:

--- description: "Debug API authentication" compose: filters: [lc/flt-no-files] excerpters: [lc/exc-base] also-include: full-files: ["/src/auth/", "/tests/auth/"] --- Focus on authentication system and related tests.

- Prompt Rules (prm-): Generate project contexts (e.g.,lc/prm-developer)
- Filter Rules (flt-): Control file inclusion (e.g.,lc/flt-base,lc/flt-no-files)
- Instruction Rules (ins-): Provide guidelines (e.g.,lc/ins-developer)
- Style Rules (sty-): Enforce coding standards (e.g.,lc/sty-python)
- Excerpt Rules (exc-): Configure content extraction (e.g.,lc/exc-base)

--- instructions: [lc/ins-developer, lc/sty-python] compose: filters: [lc/flt-base, project-filters] excerpters: [lc/exc-base] ---

Let AI help create focused, task-specific rules. Two approaches depending on your environment:

Claude Skill (Interactive, Claude Desktop/Code)

How it works: Global skill guides you through creating rules interactively. Examines your codebase as needed using MCP tools.

lc-init # Installs skill to ~/.claude/skills/ # Restart Claude Desktop or Claude Code
# 1. Share project context lc-context # Any rule - overview included # 2. Paste into Claude, then ask: # "Create a rule for refactoring authentication to JWT" # "I need a rule to debug the payment processing"

- Use project overview already in context
- Examine specific files vialc-missingas needed
- Ask clarifying questions about scope
- Generate optimized rule (tmp-prm-<task>.md)
- Provide validation instructions

Skill documentation(progressively disclosed):

- Skill.md- Quick workflow, decision patterns
- PATTERNS.md- Common rule patterns
- SYNTAX.md- Detailed reference
- EXAMPLES.md- Complete walkthroughs
- TROUBLESHOOTING.md- Problem solving

How it works: Load comprehensive rule-creation documentation into context, work with any LLM.

# 1. Load framework lc-set-rule lc/prm-rule-create lc-select lc-context -nt # 2. Paste into any LLM # "I need a rule for adding OAuth integration" # 3. LLM generates focused rule using framework # 4. Use the new rule lc-set-rule tmp-prm-oauth lc-select lc-context

- lc/ins-rule-intro- Introduction and overview
- lc/ins-rule-framework- Complete decision framework

Both require sharing project context first. Both produce equivalent results.

cat > .llm-context/rules/flt-repo-base.md << 'EOF' --- description: "Repository-specific exclusions" compose: filters: [lc/flt-base] gitignores: full-files: [".md", "/tests", "/node_modules"] excerpted-files: ["*.md", "/tests"] --- EOF
cat > .llm-context/rules/prm-code.md << 'EOF' --- description: "Main development rule" instructions: [lc/ins-developer, lc/sty-python] compose: filters: [flt-repo-base] excerpters: [lc/exc-base] --- Additional project-specific guidelines and context. EOF lc-set-rule prm-code

Choose format based on your LLM environment:

- Intelligent Selection: Rules automatically include/exclude appropriate files
- Context Validation: Preview size and selection before generation
- Code Excerpting: Extract structure while reducing tokens (15+ languages)
- MCP Integration: AI accesses additional files without manual intervention
- Composable Rules: Build complex contexts from reusable patterns
- AI-Assisted Creation: Interactive skill or documentation-based approaches
- Agent-Friendly: CLI and MCP interfaces for autonomous operation

lc-set-rule prm-code lc-select lc-context # Paste into chat - AI accesses more files via MCP if needed
# Share project context first lc-context # Then create focused rule: # Via Skill: "Create a rule for [task]" # Via Instructions: lc-set-rule lc/prm-rule-create && lc-context -nt # Validate and use lc-preview tmp-prm-task lc-context tmp-prm-task
# Agent validates rule effectiveness lc-preview tmp-prm-refactor-auth # Agent generates context for sub-agent lc-context tmp-prm-refactor-auth > /tmp/context.md # Sub-agent reads context and executes task
# Agent validates rule preview = lc_preview(root_path="/path/to/project", rule_name="tmp-prm-task") # Agent generates context context = lc_outlines(root_path="/path/to/project") # Agent fetches additional files as needed files = lc_missing(root_path, "f", "['/proj/src/auth.py']", timestamp)

All paths use project-relative format with project name prefix:

/{project-name}/src/module/file.py /{project-name}/tests/test_module.py

This enables multi-project context composition without path conflicts.

In rules, patterns are project-relative without the prefix:

also-include: full-files: - "/src/auth/" # ✓ Correct - "/myproject/src/" # ✗ Wrong - don't include project name

- User Guide- Complete documentation with examples
-
Design Philosophy- Why llm-context exists
-
Real-world Examples- Using full context effectively

Apache License, Version 2.0. SeeLICENSEfor details.

This is a web browser that enables your coding agent, such as Claude Code, to visit websites on your behalf and assist you in identifying bugs or creating UI test cases.

A Model Context Protocol (MCP) server that enables AI assistants to integrate with Prometheus Alertmanager

A comprehensive MCP server for tooling interactions(40+) and resource accessibility(60+) plus many useful prompts to interact with Algorand Blockchain.

An MCP server that provides control over Android devices through ADB. Offers device screenshot capture, UI layout analysis, package management, and ADB command execution capabilities.

A Binary Ninja plugin, MCP server, and bridge that seamlessly integrates Binary Ninja with your favorite MCP client.

integration that connects BloodHound with AI through MCP, allowing security professionals to analyze Active Directory attack paths using natural language queries instead of Cypher.

A specialized MCP gateway for LLM enhancement prompts and jailbreaks with dynamic schema adaptation. Provides prompts for different LLMs using an enum-based approach.

Obtains latest dependency details for Clojure libraries.

A Model Context Protocol (MCP) server for CODESYS V3 programming environments.

Analyze large codebases and document collections using high-context models via OpenRouter, OpenAI, or Google AI -- very useful, e.g., with Claude Code

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.