Skip to main content

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 cdg instead of codigest for 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.txt (or stdout with -s)
  • 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.
  • Terminal Output (-s / --stdout): Output directly to stdout instead of saving to file.
# 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"

# Output directly to stdout
cdg scan -s

3. Incremental Changes (diff)

Tracks text-based changes between the last scan and the current working tree.

  • Output: .codigest/changes.diff (or stdout with -s)
  • 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

# Output directly to stdout
cdg diff -s

4. Semantic Analysis (semdiff)

Analyzes structural changes (AST-based) rather than line-by-line text differences.

  • Output: .codigest/semdiff.txt (or stdout with -s)
  • 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

# Output directly to stdout
cdg semdiff -s

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.txt (or stdout with -s)
  • Use Case: "Don't read the implementation details. Just understand the class hierarchy."
cdg digest

# Output directly to stdout
cdg digest -s

7. Environment Status (status)

Displays the health of .codigest, anchor snapshot baseline, pending working tree changes, and generated artifacts.

  • Use Case: "Check what files have changed since my last snapshot and inspect the state of generated context artifacts."
cdg status

8. Environment Cleanup (clean)

Removes the .codigest/ environment and resets all context anchors and artifacts.

  • Use Case: "Clean up context files and resets Codigest tracking."
# Interactive confirmation
cdg clean

# Force clean without prompt
cdg clean -y

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_git to 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

Metadata

Release files for codigest 0.3.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for codigest 0.3.7
File Size Uploaded
codigest-0.3.7.tar.gz 30.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for codigest 0.3.7
File Interpreter ABI Platform
codigest-0.3.7-py3-none-any.whl Python 3 none any Details

Total release size: 68.1 kB

Release files / codigest-0.3.7.tar.gz

Download URL codigest-0.3.7.tar.gz
Size 30.6 kB
Tags Source
SHA-256 checksum
How to use checksums
569288a0fd17276a5851bd8ac82652c5eb18c0f2507e975ea5bef510eb0a4e24
BLAKE2b-256 checksum
How to use checksums
535b237bd71a733dc63d6d5522ba2661eceea5313c15db9ee73421ff3fb12767
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 5, 2026.

Transparency log

Release files / codigest-0.3.7-py3-none-any.whl

Download URL codigest-0.3.7-py3-none-any.whl
Size 37.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
96ec506e163c1383a4f2a441912815e12918087685e261f16a8ca8e2e4d0c901
BLAKE2b-256 checksum
How to use checksums
3ffbd1f225546a0a83535ad03b30428d6f15849a537680c62541627c0d758182
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 5, 2026.

Transparency log

Release history Release notifications | RSS feed

0.5.0

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.9

2 release files

0.3.8

2 release files

This release

0.3.7 This release

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page