Skip to main content

Bundle any codebase into a single LLM-ready context file.

Project description

Context Engine Raja

Bundle any codebase into a single LLM-ready context file.

Features

  • LLM-ready output with directory tree and clearly separated file sections
  • Fast directory traversal with os.scandir
  • Concurrent file reading with ThreadPoolExecutor
  • Memory-safe streaming — writes directly to disk
  • .gitignore and .contextignore support
  • Precompiled ignore rules for fast repeated matching
  • Token estimation using 1 token ≈ 4 characters
  • Token budget control with --max-tokens
  • Colored terminal output with scan feedback and summary
  • Default exclusions for binaries, caches, and build artifacts

Installation

pip install context-engine-raja

After installation, the context-engine command is available globally:

context-engine --help

Usage

Basic usage:

context-engine ./my-project

Custom output file:

context-engine ./my-project -o context.txt

Ignore extra extensions:

context-engine ./my-project -i .csv,.sqlite,.bak

Limit token budget:

context-engine ./my-project --max-tokens 100000

Combine options:

context-engine ./my-project -o llm_context.txt -i .png,.jpg --max-tokens 100000

Output Format

CODEBASE CONTEXT
================================================================================
Generated by Context Engine Raja v1.0.0
================================================================================
Directory Tree
================================================================================
my-project
|-- main.py
`-- utils/
    `-- helpers.py

================================================================================
File: main.py
================================================================================
[file content here]

Ignore Rules

Context Engine Raja reads ignore patterns from:

  • Built-in defaults (binaries, caches, build artifacts)
  • .gitignore
  • .contextignore (for LLM-specific exclusions)
  • --ignore flag

Use .contextignore for LLM-specific exclusions without changing Git behavior.

CLI Reference

context-engine TARGET_DIR [-o OUTPUT] [-i EXTENSIONS] [--max-tokens N]
  • TARGET_DIR — directory to scan
  • -o, --output — output file (default: codebase_context.txt)
  • -i, --ignore — extra comma-separated extensions to skip
  • --max-tokens — stop after estimated token count exceeds N

Development

Install locally in editable mode:

pip install -e .

Run from source:

python -m codepack.main ./my-project

Package Info

  • Package: context-engine-raja
  • Command: context-engine
  • Python: >=3.10
  • Dependencies: none

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

context_engine_raja-1.0.0.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

context_engine_raja-1.0.0-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file context_engine_raja-1.0.0.tar.gz.

File metadata

  • Download URL: context_engine_raja-1.0.0.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for context_engine_raja-1.0.0.tar.gz
Algorithm Hash digest
SHA256 59a70e509a820643020244b2e9eeb2ed666acffbadb2e94ef0510e29aac08757
MD5 b65447bdd0b09afa7d6bc8212c9eaf8f
BLAKE2b-256 03ad98db7f0f019345b97425fc9832013e9b5d6d9979ca4798b62e53892ad553

See more details on using hashes here.

File details

Details for the file context_engine_raja-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for context_engine_raja-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3f0a129ea7166192cbee7351263b70f65c4c490ddd9cc816de178514c3384110
MD5 5b4089f6cdb13a21795e28951721b7ac
BLAKE2b-256 c1338232c8c4830823decd1e0351baca900959c841389005db241b3490b4ca82

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page