Context Packages let you capture a project's accumulated knowledge — facts, graph structures, session findings, gotchas, and patterns — into a portable, versioned bundle. Export packages for teammates, import domain knowledge from shared libraries, or auto-load project conventions on every session start.
Package Layers
Each package can contain one or more layers. Only include what you need — from targeted knowledge facts to comprehensive project snapshots.
Knowledge
Persisted facts, constraints, and domain knowledge extracted from your project.
Graph
Property graph nodes and edges capturing code structure, dependencies, and call relationships.
Session
Session findings and decisions from previous coding sessions.
Patterns
Shell compression patterns and output formatting rules tuned for your stack.
Gotchas
Known pitfalls, edge cases, and warnings that agents should be aware of.
CLI Commands
Manage context packages entirely from the command line. All operations support JSON output for CI/CD integration.
| Command | Description |
|---|---|
lean-ctx pack create --name my-pkg --layers knowledge,graph | Create a package from the current project's context |
lean-ctx pack list | List all installed packages with version and auto-load status |
lean-ctx pack info my-pkg | Show package metadata, layers, stats, and integrity hash |
lean-ctx pack export my-pkg -o my-pkg.lctxpkg | Export a package to a portable .lctxpkg file for sharing |
lean-ctx pack import my-pkg.lctxpkg | Import a package from a .lctxpkg file into your local registry |
lean-ctx pack install my-pkg | Install and merge package context into the current project |
lean-ctx pack remove my-pkg | Remove a package from the local registry |
lean-ctx pack auto-load my-pkg on | Enable or disable auto-loading on session start |
Quick Start
# Create a package with knowledge and graph layers
lean-ctx pack create --name my-project-ctx --layers knowledge,graph
# Export for sharing
lean-ctx pack export my-project-ctx -o my-project-ctx.lctxpkg
# Teammate imports and installs
lean-ctx pack import my-project-ctx.lctxpkg
lean-ctx pack install my-project-ctx
# Enable auto-load for future sessions
lean-ctx pack auto-load my-project-ctx on Auto-Load
Mark packages for automatic loading. When ctx_overview runs at session start, all auto-load enabled packages are merged into the active project context — knowledge facts, graph data, and gotchas become immediately available.
Integrity & Safety
Every package includes a SHA-256 content hash computed from canonical JSON serialization. Import operations verify integrity before merging. All file operations use atomic writes (tmp + rename) to prevent corruption.
Integration
Imported knowledge facts merge with confidence capping. Graph nodes and edges are added to the property graph. Gotchas are deduplicated by ID. Session findings enrich the history. Everything integrates with the existing LeanCTX pipeline.
Start Packaging Context
Install LeanCTX and create your first context package in under a minute.
Get Started →