Human-Centered Codebase Context Manager for LLMs
Project description
Codigest
Codigest is a standalone CLI tool designed to extract, structure, and track the context of your codebase for Large Language Models (LLMs).
Unlike simple copy-paste tools, Codigest employs a Context Anchor system (Shadow Git) to track changes locally without polluting your main version control history. It also features Semantic Analysis to detect structural changes in your code.
Note: You can use the short alias
cdginstead ofcodigestfor faster typing.
Core Philosophy
- Read-Only & Safe: Codigest never modifies your source code. It only reads, analyzes, and formats context.
- Context-Aware: Instead of dumping raw text, it structures code into XML snapshots designed for LLM comprehension.
- Session-Based Tracking: It maintains an internal anchor to track "work-in-progress" changes independently of your Git commits.
- Environment Isolated: Runs in its own isolated Python 3.14 environment via
uv, ensuring it never conflicts with your project's dependencies.
Installation
Codigest runs as a global tool. You don't need to add it to your project's requirements.txt.
We strongly recommend using uv for the best experience.
Step 1: Install uv
If you don't have uv installed, use Winget (Windows) or curl (macOS/Linux).
# Windows (via Winget)
winget install --id astral-sh.uv
# macOS/Linux
curl -LsSf [https://astral.sh/uv/install.sh](https://astral.sh/uv/install.sh) | sh
Step 2: Install codigest
Install Codigest globally. uv will automatically manage the required Python 3.14 environment for you.
uv tool install codigest
Step 3: Update Path (Important!)
To run codigest (or cdg) from any terminal, ensure your tools directory is in your PATH.
uv tool update-shell
> Note: Restart your terminal (or VS Code) after this step to apply changes.
Workflow & Commands
Once installed, use the cdg command anywhere.
1. Initialization
Sets up the .codigest directory and captures the initial baseline anchor.
cdg init
2. Full Context Snapshot (scan)
Scans the codebase and generates a structured XML snapshot. Includes a Pre-flight Check to prevent accidental token overflow.
- Output:
.codigest/snapshot.xml - Features:
- Smart Confirmation: Automatically skips confirmation for small contexts, but warns you for large ones (>30k tokens).
- Dependency Resolution (
-r): Automatically finds and includes local files imported by your target files. - Scope Control: You can specify folders or files to scan.
# Basic scan (Interactive confirmation if large)
cdg scan
# Scan specific folder with dependency resolution (Smart Context)
cdg scan src/main.py -r
# Force execution without confirmation (Good for CI/CD)
cdg scan -y --message "Automated snapshot"
3. Incremental Changes (diff)
Tracks text-based changes between the last scan and the current working tree.
- Output:
.codigest/changes.diff - Use Case: "I modified 3 files. Here is exactly what changed since the last snapshot."
- Note: Checks against the internal Shadow Git, enabling tracking without committing to the real Git.
cdg diff
4. Semantic Analysis (semdiff)
Analyzes structural changes (AST-based) rather than line-by-line text differences.
- Output:
.codigest/semdiff.xml - Use Case: "I refactored the API. Show me added/removed functions or signature changes."
- Benefit: Reduces token usage by ignoring formatting/comment changes.
cdg semdiff
5. Project Tree (tree)
Visualizes the project structure. Respects .gitignore.
- Style: Professional, cleaner output without emojis for better readability.
- Use Case: Quickly verifying which files are being tracked.
cdg tree
6. Architecture Digest (digest)
Generates a high-level outline of the project structure (Classes, Functions, Methods only).
- Output:
.codigest/digest.xml - Use Case: "Don't read the implementation details. Just understand the class hierarchy."
cdg digest
Configuration
You can customize behavior in .codigest/config.toml.
[filter]
# Target extensions
extensions = [".py", ".ts", ".rs", ".md", ".json"]
# Exclude patterns (Gitignore syntax)
exclude_patterns = [
"*.lock",
"tests/data/",
"legacy_code/"
]
[output]
format = "xml"
Architecture Details
Context Anchor (Shadow Git)
Codigest maintains a hidden, lightweight Git repository inside .codigest/anchor/.shadow_git.
- It is renamed to
.shadow_gitto prevent VS Code and other IDEs from confusing it with your project's actual repository. - When you run
scan, the current state is committed to this anchor. - When you run
diff, the tool compares your working directory against this anchor.
Safety Mechanisms
- Pre-flight Check: Calculates estimated token count before processing to prevent context overflow errors.
- Structure-Aware Dedent: Ensures XML tags are perfectly aligned (flush-left) to prevent indentation artifacts in LLM prompts.
- XML Injection Protection: Automatically escapes content within XML tags.
License
MIT License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file codigest-0.3.3.tar.gz.
File metadata
- Download URL: codigest-0.3.3.tar.gz
- Upload date:
- Size: 25.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d7469ee1c0f343c1a956fc111800284e5f2cd535807e63e21ba370b9d6d05c05
|
|
| MD5 |
62aae121c1f88202984f5c073c1c2330
|
|
| BLAKE2b-256 |
7cedc709a3b020b71d5f44e93bdea7db59703f9df3867b724f54be39f76bb3fc
|
Provenance
The following attestation bundles were made for codigest-0.3.3.tar.gz:
Publisher:
publish.yml on SJB7777/codigest
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
codigest-0.3.3.tar.gz -
Subject digest:
d7469ee1c0f343c1a956fc111800284e5f2cd535807e63e21ba370b9d6d05c05 - Sigstore transparency entry: 774125288
- Sigstore integration time:
-
Permalink:
SJB7777/codigest@2ba531d025affca0a7cb611ff023be17a9ce9ba9 -
Branch / Tag:
refs/tags/v0.3.3 - Owner: https://github.com/SJB7777
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2ba531d025affca0a7cb611ff023be17a9ce9ba9 -
Trigger Event:
push
-
Statement type:
File details
Details for the file codigest-0.3.3-py3-none-any.whl.
File metadata
- Download URL: codigest-0.3.3-py3-none-any.whl
- Upload date:
- Size: 29.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c01b8572104398b18db5412ed9fd1b43990e15dd47646c05c68dfc8226f1edf1
|
|
| MD5 |
048149e86f0b298d8d9f994150570e5c
|
|
| BLAKE2b-256 |
6ba21bada937d25e10b9f5e1fb79d7e3e5788e407b2592c941dc8c749b3743c5
|
Provenance
The following attestation bundles were made for codigest-0.3.3-py3-none-any.whl:
Publisher:
publish.yml on SJB7777/codigest
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
codigest-0.3.3-py3-none-any.whl -
Subject digest:
c01b8572104398b18db5412ed9fd1b43990e15dd47646c05c68dfc8226f1edf1 - Sigstore transparency entry: 774125290
- Sigstore integration time:
-
Permalink:
SJB7777/codigest@2ba531d025affca0a7cb611ff023be17a9ce9ba9 -
Branch / Tag:
refs/tags/v0.3.3 - Owner: https://github.com/SJB7777
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2ba531d025affca0a7cb611ff023be17a9ce9ba9 -
Trigger Event:
push
-
Statement type: