Назад к каталогу
llm-context.py

llm-context.py

Сообщество

от cyberchitta

0.0
0 отзывов

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.

Описание

# LLM Context [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) [![PyPI version](https://img.shields.io/pypi/v/llm-context.svg)](https://pypi.org/project/llm-context/) [![Downloads](https://static.pepy.tech/badge/llm-context/week)](https://pepy.tech/project/llm-context) **Reduce friction when providing context to LLMs.** Share relevant project files instantly through smart selection and rule-based filtering. ## The Problem Getting project context into LLM chats is tedious: - Manually copying/pasting files takes forever - Hard to identify which files are relevant - Including too much hits context limits, too little misses important details - AI requests for additional files require manual fetching - Repeating this process for every conversation ## The Solution ```bash lc-select # Smart file selection lc-context # Instant formatted context # Paste and work - AI can access additional files seamlessly ``` **Result**: From "I need to share my project" to productive AI collaboration in seconds. > **Note**: This project was developed in collaboration with several Claude Sonnets (3.5, 3.6, 3.7 and 4.0), as well as Groks (3 and 4), using LLM Context itself to share code during development. All code in the repository is heavily human-curated (by me 😇, @restlessronin). ## Installation ```bash uv tool install "llm-context>=0.5.0" ``` ## Quick Start ### Basic Usage ```bash # One-time setup cd your-project lc-init # Daily usage lc-select lc-context ``` ### MCP Integration (Recommended) ```jsonc { "mcpServers": { "llm-context": { "command": "uvx", "args": ["--from", "llm-context", "lc-mcp"] } } } ``` With MCP, AI can access additional files directly during conversations. ### Project Customization ```bash # Create project-specific filters cat > .llm-context/rules/flt-repo-base.md << 'EOF' --- compose: filters: [lc/flt-base] gitignores: full-files: ["*.md", "/tests", "/node_modules"] --- EOF # Customize main development rule cat > .llm-context/rules/prm-code.md << 'EOF' --- instructions: [lc/ins-developer, lc/sty-python] compose: filters: [flt-repo-base] excerpters: [lc/exc-base] --- Additional project-specific guidelines and context. EOF ``` ## Deployment Patterns Choose based on your LLM environment: - **System Message**: `lc-context -p` (AI Studio, etc.) - **Single User Message**: `lc-context -p -m` (Grok, etc.) - **Separate Messages**: `lc-prompt` + `lc-context -m` - **Project/Files (included)**: `lc-context` (Claude Projects, etc.) - **Project/Files (searchable)**: `lc-context -m` (force into context) See [Deployment Patterns](docs/user-guide.md#deployment-patterns) in the user guide for details. ## Core Commands | Command | Purpose | | ----------------- | ------------------------------------------ | | `lc-init` | Initialize project configuration | | `lc-select` | Select files based on current rule | | `lc-context` | Generate and copy context | | `lc-context -p` | Generate context with prompt | | `lc-context -m` | Send context as separate message | | `lc-context -nt` | No tools (for Project/Files inclusion) | | `lc-context -f ` | Write context to file | | `lc-set-rule <n>` | Switch between rules | | `lc-missing` | Handle file and context requests (non-MCP) | ## Rule System Rules use a systematic five-category structure: - **Prompt Rules (`prm-`)**: Generate project contexts (e.g., `lc/prm-developer`, `lc/prm-rule-create`) - **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`, `lc/ins-rule-framework`) - **Style Rules (`sty-`)**: Enforce coding standards (e.g., `lc/sty-python`, `lc/sty-code`) - **Excerpt Rules (`exc-`)**: Configure extractions for context reduction (e.g., `lc/exc-base`) ### Example Rule ```yaml --- description: "Debug API authentication issues" 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. ``` ## AI-Assisted Rule Creation Let AI create focused rules for specific tasks. There are two approaches depending on your setup: ### Approach 1: Claude Skill (Recommended for Claude Desktop/Code) **How it works**: A global Claude Skill helps you create rules interactively. It requires project context (with overview) already shared via llm-context, and uses `lc-missing` to examine specific files as needed. **Setup**: ```bash lc-init # Installs skill to ~/.claude/skills/ # Restart Claude Desktop or Claude Code ``` **Workflow**: ```bash # 1. Share any project context (overview is required) lc-context # Can use any rule - overview will be included # 2. Pas

Отзывы (0)

Пока нет отзывов. Будьте первым!