Skip to content

Festusali/contextdump

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

ContextDump

Turn source code into clean, AI-ready Markdown context for ChatGPT, Claude, Gemini, and other LLMs.

ContextDump is a lightweight command-line utility and Python library that transforms an entire source code project into clean, structured Markdown optimized for Large Language Models (LLMs).

Instead of manually copying files into ChatGPT, Claude, Gemini, or another AI assistant, ContextDump scans your project, filters relevant files, detects languages, generates a directory tree, collects useful project statistics, and produces a single well-formatted Markdown document ready to share or prompt against.

The generated output is designed to preserve project structure while remaining easy for both humans and language models to understand.


Features

Current capabilities include:

  • πŸ“ Recursive project scanning
  • 🌳 Project directory tree generation
  • πŸ“ AI-friendly Markdown output
  • 🎨 Automatic language detection for syntax highlighting
  • 🎯 Include and exclude glob patterns
  • πŸ“Š Project statistics and token estimation
  • βš™οΈ Configurable rendering behaviour
  • πŸ”Š Verbosity-aware context generation
  • πŸ“‹ Optional clipboard integration
  • 🧩 Importable Python API

Requirements

  • Python 3.11 or newer

Installation

Basic installation

pip install contextdump

Clipboard support

Install the optional clipboard dependency if you want generated output copied directly to your system clipboard.

pip install "contextdump[clipboard]"

Quick Start

Generate a Markdown snapshot of the current directory.

contextdump

Generate context for a specific project.

contextdump path/to/project

Write the generated document to a file.

contextdump -o context.md

Copy the generated output to the clipboard.

contextdump --clipboard

Only include Python files.

contextdump --extensions py

Exclude additional files or directories.

contextdump --exclude .venv/** tests/**

Generate richer contextual output.

contextdump -v

Command-Line Help

For the complete list of supported command-line options, run:

contextdump --help

Example Output

# ContextDump

Generated: 2026-07-07 15:08 UTC

Project Root
/home/user/example-project

---

## Directory Tree

example-project
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ contextdump/
β”‚   β”‚   β”œβ”€β”€ application.py
β”‚   β”‚   β”œβ”€β”€ cli.py
β”‚   β”‚   └── templates/
β”‚   └── tests/
β”œβ”€β”€ README.md
└── pyproject.toml

---

## Summary

- Files: 27
- Lines: 2,145
- Bytes: 54,183
- Estimated tokens: 13,529
- Languages:
  - python: 20
  - markdown: 3
  - toml: 1

---

## src/contextdump/application.py

```python
class ContextDump:
    ...

Python API

ContextDump is both a command-line utility and an importable Python library.

from pathlib import Path

from contextdump import ContextDump
from contextdump import ContextDumpConfig

config = ContextDumpConfig(
    root=Path("my_project"),
)

document = ContextDump(config).generate()

print(document)

Architecture

ContextDump is intentionally organised as a simple processing pipeline. Each stage has a single responsibility and communicates using strongly typed domain models.

Configuration
      β”‚
      β–Ό
ProjectScanner
      β”‚
      β–Ό
 Source Files
      β”‚
      β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
      β–Ό             β”‚
Statistics          β”‚
      β”‚             β”‚
      β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜
             β–Ό
      Renderer Registry
             β”‚
             β–Ό
         Renderer
             β”‚
             β–Ό
     Generated Output

The application layer coordinates the pipeline without owning the implementation details of scanning, filtering, statistics generation, or rendering.

Renderers are selected through a registry based on the configured output format, making additional formats straightforward to introduce in future releases without changing the application layer.


Output Formats

Currently available

  • Markdown

Planned

  • JSON
  • XML

Verbosity

ContextDump can generate progressively richer context depending on the requested verbosity level.

Command Output
contextdump Standard project context
contextdump -v Includes additional per-file metadata
contextdump -vv Reserved for future structural summaries

The default output is intentionally concise while remaining useful for most LLM workflows. Higher verbosity levels provide additional context without changing the underlying project structure.


Configuration

Configuration is currently provided through the Python API and command-line arguments.

Support for project configuration files is planned for a future release, allowing projects to define default scanning and rendering behaviour.

Configuration precedence will be:

  1. Built-in defaults
  2. Project configuration
  3. Command-line arguments

Roadmap

The architecture introduced in v0.1.0 is designed to support richer project analysis without requiring major structural changes.

Planned improvements include:

  • Additional output formats (JSON, XML)
  • Project configuration files
  • Git-aware project scanning
  • Structural source summaries
  • Language-aware context enrichers
  • Project symbol indexes
  • Dependency summaries
  • Chunked output for large repositories

Future releases will primarily focus on generating increasingly useful AI-oriented project context while maintaining a stable public API.


Contributing

Contributions are welcome.

Whether you're fixing a bug, improving documentation, adding language support, or proposing a new feature, pull requests and discussions are appreciated.

If you're planning a significant architectural change, please open an issue first so the approach can be discussed before implementation begins.


Development

Clone the repository and install it in editable mode.

git clone <repository-url>
cd contextdump

pip install -e .

Install the optional clipboard dependency during development if required.

pip install -e ".[clipboard]"

Run the command-line interface directly from the source tree.

contextdump --help

Design Principles

ContextDump is guided by a few core principles.

  • Simple by default. Useful output should require little or no configuration.

  • Composable architecture. Scanning, filtering, statistics, and rendering are isolated components that can evolve independently.

  • LLM-first output. Generated documents should be readable by humans while remaining optimized for large language models.

  • Predictable behaviour. Identical inputs should produce identical output whenever practical.

  • Extensible foundation. New renderers, enrichers, and output formats should be easy to add without redesigning the application.


License

This project is licensed under the MIT License.

See the LICENSE file for details.

About

Turn source code into clean, AI-ready Markdown context for ChatGPT, Claude, Gemini, and other LLMs.

Resources

License

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages