-
Navigate to your project's root directory. The project must have a
.gitignore
file. -
Initialize LLM Context:
lc-init
This creates the
.llm-context
directory with default configuration files. -
The default "code" profile is ready to use. For specialized needs, you can customize settings in
.llm-context/config.toml
.
-
Select files to include in your context:
lc-sel-files
This uses your
.gitignore
and profile settings to choose relevant files. -
Generate and copy context to clipboard:
lc-context
-
Paste the context into your LLM chat interface:
- For Claude Projects/Custom GPTs: Use the knowledge section
- For regular chats: Use
lc-profile code-prompt
first to include guiding instructions
-
When the LLM requests additional files:
- Copy the file list from the LLM
- Run
lc-read-cliplist
- Paste the new content back to the LLM
Core commands you'll use frequently:
lc-init
: Set up LLM Context in your projectlc-set-profile <name>
: Switch between different profile configurationslc-sel-files
: Select files for full content inclusionlc-sel-outlines
: Select files for structural outline generationlc-context
: Generate and copy context to clipboardlc-read-cliplist
: Process file requests from the LLM
-
Code Projects:
- Use default "code" profile
- Run
lc-sel-files
to include source code - Optional: Use
lc-sel-outlines
for structural overview
-
Documentation Projects:
- Switch to documentation focus:
lc-profile copy
- Select content:
lc-sel-files
- Good for markdown/text collections
- Switch to documentation focus:
-
Web Projects:
- Works well with both frontend and backend code
- Can include HTML, JavaScript, and content files
- Useful for reviewing site structure and content
LLM Context uses a layered configuration approach:
-
Project Root
- Must contain
.gitignore
- All paths are relative to this directory
- Must contain
-
Configuration Directory (
.llm-context/
)config.toml
: Main configuration filelc-project-notes.md
: Project-specific noteslc-prompt.md
: Prompttemplates/
: Template filescurr_ctx.toml
: Current context state
-
User Configuration
~/.llm-context/lc-user-notes.md
: User specific notes
Standard project layout:
your-project/
├── .llm-context/
│ ├── config.toml # Main configuration
│ ├── lc-project-notes.md # Project notes
│ ├── lc-prompt.md # LLM Instructions
│ ├── curr_ctx.toml # Current state
│ └── templates/ # Template files
│ ├── lc-context.j2
│ ├── lc-files.j2
│ └── lc-highlights.j2
├── .gitignore # Required
└── [project files]
LLM Context maintains state in curr_ctx.toml
:
- Tracks selected files per profile
- Preserves selections between sessions
- Updates automatically with commands
- Records timestamp when context is generated to track file changes
Profiles control how LLM Context handles your project:
-
File Selection
- Which files to include/exclude
- Full content vs outline selection
- Media file handling
-
Presentation
- Template selection
- Notes inclusion
- Output formatting
-
Built-in Profiles
code
: Default for software projectscode-prompt
: Adds LLM instructions
Primary configuration file containing:
# Template mappings
[templates]
context = "lc-context.j2"
files = "lc-files.j2"
highlights = "lc-highlights.j2"
# Profile definitions
[profiles.code]
gitignores = {
full_files = [".git", ".gitignore", ".llm-context/", "*.lock"],
outline_files = [".git", ".gitignore", ".llm-context/", "*.lock"]
}
settings = {
no_media = true,
with_user_notes = false
}
only-include = {
full_files = ["**/*"],
outline_files = ["**/*"]
}
-
Project Notes (
lc-project-notes.md
)- Project-specific documentation
- Created at initialization
- User-maintained
- Included in context by default
-
User Notes (
~/.llm-context/lc-user-notes.md
)- Personal/global notes
- Optional inclusion via profile settings
- Not project-specific
Contains Jinja2 templates controlling output format:
lc-context.j2
: Main context formatlc-files.j2
: File content formatlc-highlights.j2
: Code outline format
Warning: Files prefixed with lc-
may be overwritten during updates. For customization:
- Create new files with different prefixes
- Update references in
config.toml
- Keep original files as reference
Profiles control how files are selected and context is generated. Each profile combines:
- Repository .gitignore patterns (always active)
- Additional exclusion patterns from profile's gitignores
- Optional inclusion patterns to restrict file selection
Important: The .git
directory should always be included in your profile's gitignores patterns since it isn't typically in .gitignore files but should always be excluded from context generation.
Here's a complete example:
[profiles.code] # Default profile included with LLM Context
gitignores = {
full_files = [".git", ".gitignore", ".llm-context/", "*.lock"],
outline_files = [".git", ".gitignore", ".llm-context/", "*.lock"]
}
settings = {
no_media = true,
with_user_notes = false
}
only-include = {
full_files = ["**/*"],
outline_files = ["**/*"]
}
[profiles.code-prompt] # Built-in profile that adds LLM instructions
base = "code" # Inherits from code profile
prompt = "lc-prompt.md" # Adds prompt template to output
Profile settings control behavior:
settings = {
# Exclude binary/media files from folder structure
no_media = true,
# Include user notes from ~/.llm-context/lc-user-notes.md
with_user_notes = false,
# Write lc-context to file (relative to current directory) in addition to clipboard
context_file = "context.md.tmp"
}
Two types of pattern collections:
- Additional Exclusions (gitignores):
gitignores = {
# Files excluded from full content
full_files = [".git", "*.lock"],
# Files excluded from outlines
outline_files = [".git", "*.lock"]
}
- Optional Restrictions (only-include):
only-include = {
# Only include these in full content
full_files = ["**/*"], # Include everything not excluded
# Only include these in outlines
outline_files = ["**/*.py", "**/*.js"] # Restrict outlines to Python and JS
}
- Documentation Focus:
[profiles.docs]
gitignores = {
full_files = [".git", ".llm-context/", "*.lock"]
}
settings = {
no_media = true,
with_user_notes = true # Include personal notes
}
only-include = {
full_files = [
"**/*.md", "**/*.txt", # Documentation files
"README*", "LICENSE*" # Project info
]
}
- Source Files Only:
[profiles.source]
gitignores = {
full_files = [".git", ".llm-context/", "*.lock"]
}
settings = {
no_media = true,
}
only-include = {
full_files = [
"src/**/*.py", # Python source
"tests/**/*.py", # Test files
"pyproject.toml" # Project configuration
]
}
prompt = "lc-prompt.md"
Profiles can extend others using the base
field:
[profiles.base-docs]
gitignores = {
full_files = [".git", ".llm-context/", "*.lock"]
}
settings = { no_media = true }
only-include = {
full_files = ["**/*.md"]
}
[profiles.docs-with-notes]
base = "base-docs"
settings = {
no_media = true,
with_user_notes = true # Add personal notes
}
[profiles.with-file]
base = "code"
settings = {
no_media = true,
with_user_notes = false,
context_file = "context.md.tmp" # Save to file as well as clipboard
}
The inheritance system allows you to:
- Create base profiles for common settings
- Override specific fields in derived profiles
- Mix and match configurations for different use cases
- Context Template (
lc-context.j2
) Controls overall output structure:
{% if prompt %}
{{ prompt }}
{% endif %}
# Repository Content: **{{ project_name }}**
## Structure
{{ folder_structure_diagram }}
{% if files %}
## Files
{% include 'lc-files.j2' %}
{% endif %}
- Prompt Template (
lc-prompt.md
) Sets LLM behavior:
## Persona
[LLM role definition]
## Guidelines
[Behavior instructions]
## Response Structure
[Output format]
To customize templates:
- Create new template with different prefix:
cp .llm-context/templates/lc-context.j2 .llm-context/templates/my-context.j2
- Update config.toml:
[templates]
context = "my-context.j2"
- Modify new template as needed
Available in templates:
project_name
: Repository namefolder_structure_diagram
: Directory treefiles
: List of file contentshighlights
: Code outlinesprompt
: Prompt template contentproject_notes
: Project notes contentuser_notes
: User notes content
Initializes LLM Context in your project.
- Creates
.llm-context
directory - Sets up default configuration files
- Requires
.gitignore
file in project root - Safe to run multiple times
Switches the active profile.
lc-profile code # Switch to default code profile
lc-profile code-prompt # Switch to code profile with prompt
lc-profile web # Switch to web profile (if configured)
Selects files for full content inclusion.
- Uses active profile's configuration
- Respects
.gitignore
patterns - Updates
curr_ctx.toml
with selections
Selects files for structural outline generation.
- Only available with [outline] extra
- Limited to supported languages
- Excludes files already selected for full content
Generates context and copies to clipboard.
- Combines full content and outlines
- Applies active profile's templates
- Includes file structure diagram
Generates project-specific instructions suitable for "System Prompts" or "Custom Instructions" sections in LLM chat interfaces.
- Outputs formatted instructions from your profile's prompt template
- Includes user notes if enabled in profile settings
- Designed for:
- Claude Projects' "Project Instructions" section
- Custom GPT "System Prompts"
- Similar "Custom Instruction" sections in other LLM interfaces
- Setting up consistent project-specific LLM behavior
Processes file requests from clipboard.
- Reads file paths from clipboard
- Generates formatted content
- Copies result to clipboard
Lists files that have been modified since the context was generated:
- Uses timestamp from when context was generated
- Helps track changes during conversation
- Useful for reviewing changes before updates
- Respects current profile's file selection patterns
Requires Python ≤ 3.12 due to dependencies:
uv tool install --python 3.12 "llm-context[outline]"
Control outline behavior in profiles:
[profiles.with-outlines]
gitignores = {
full_files = [".git", "*.lock"],
outline_files = [".git", "*.lock"]
}
only-include = {
full_files = ["**/*"],
outline_files = ["**/*.py", "**/*.js"]
}
Currently supported languages:
- C, C++, C#
- Elisp, Elixir, Elm
- Go
- Java, JavaScript
- OCaml
- PHP, Python
- QL
- Ruby, Rust
- TypeScript
- Python version restriction (≤ 3.12)
- Language support is fixed
- Unsupported files are excluded
- May impact context size
-
Balance full content and outlines:
- Use outlines for large files
- Select key files for full content
- Consider LLM context limits
-
File Selection Strategies:
- Start with core files
- Add related files as needed
- Use outlines for context
- Efficient Patterns:
# Optimize pattern matching
gitignores = {
full_files = ["node_modules/**", "*.min.*"],
outline_files = ["node_modules/**"]
}
- Language-Specific Profiles:
# Python project optimization
[profiles.python-opt]
only-include = {
full_files = ["**/main.py", "**/core/*.py"],
outline_files = ["**/*.py"]
}
- Custom Combinations:
# Mixed content optimization
[profiles.web-opt]
only-include = {
full_files = [
"**/index.html",
"**/main.js",
"**/*.md"
],
outline_files = ["**/*.js", "**/*.ts"]
}
- Configure Claude Desktop:
{
"mcpServers": {
"CyberChitta": {
"command": "uvx",
"args": ["--from", "llm-context", "lc-mcp"]
}
}
}
-
Start working with your project in two simple ways:
-
Say: "I would like to work with my project" Claude will ask you for the project root path.
-
Or directly specify: "I would like to work with my project /path/to/your/project" Claude will automatically load the project context.
-
-
Usage:
- Files requested via MCP are automatically processed
- No manual clipboard operations needed
- Maintains conversation context
- Standard Chat:
lc-set-profile code-prompt # Include instructions
lc-context # Generate and copy
# Paste into chat
- File Requests:
# Copy file list from LLM
lc-read-cliplist
# Paste result back
-
Claude Projects:
- Use
lc-set-profile code
- Generate context with
lc-context
- Paste into knowledge section
- Update as project evolves
- Use
-
Knowledge Maintenance:
- Regular context updates
- Consistent profile usage
- Documentation in project notes
-
Initial Setup:
- Generate context with
lc-context
- Add to GPT knowledge base
- Include prompt if needed
- Generate context with
-
Ongoing Usage:
- Update knowledge as needed
- Use
lc-read-cliplist
for new files - Maintain consistent context
- Keep
.llm-context/config.toml
in version control - Ignore
curr_ctx.toml
in git - Document any custom templates you create
- Start with built-in profiles, customize as needed
- Document profile purposes in a comment in config.toml
- Share working profiles with your team
-
Monitor and Optimize File Selection:
- Review actual selected files after
lc-sel-files
- Remove large generated files, logs, etc.
- Adjust profile patterns based on what you see
- Review actual selected files after
-
Check Context Size:
- Review the actual context after pasting into chat
- Look for unnecessary large files or duplicates
- Consider using outlines for large files
-
Efficient Updates:
- Use
lc-read-cliplist
for targeted file access - Update context when project structure changes
- Switch profiles based on your current task
- Use
-
"GITIGNORE_NOT_FOUND" Error:
- Create a
.gitignore
file in your project root - Even an empty file will work
- Create a
-
Template Errors:
- Don't modify files starting with
lc-
- Create your own templates with different names
- Update references in config.toml
- Don't modify files starting with
-
No Files Selected:
- Check your profile's gitignores and only-include patterns
- Review
.gitignore
patterns - Try
lc-profile code
to use default profile
-
Outline Generation Not Working:
- Ensure you installed with
uv tool install --python 3.12 "llm-context[outline]"
- Check if your files are in supported languages
- Make sure files aren't already selected for full content
- Ensure you installed with
-
Context Too Large:
- Review selected files with
cat .llm-context/curr_ctx.toml
- Adjust profile patterns to exclude large files
- Use outlines instead of full content where possible
- Review selected files with