Skip to content

About

Turn any repository into one LLM-ready context file, with secrets redacted. Zero dependencies.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

ContextPack

Turn any repository into one LLM-ready context file — with secrets redacted.

Tests Python Dependencies License

The AI developer toolkit

This repo is the home of five small, original, dependency-free AI + dev engines:

Tool Purpose Tests
contextpack Repository → LLM context, secrets redacted, token budgeted 23
pocket-rag Local RAG: chunking, BM25 from scratch, [file:line] citations 16
agentkit Agent runtime: tools, guardrails, budgets, memory, traces 22
flowforge Workflow engine: DAGs, branches, retries, safe expressions, traces 21
promptforge Prompt templates, linting, versioning and offline A/B scoring 25

All five run on the Python standard library. Together: 107 unit tests.

See FLAGSHIP_ROADMAP.md for the 90-day plan for this toolkit.

python -m unittest discover -s tests                  # contextpack
(cd pocket-rag && python -m unittest discover -s tests)
(cd agentkit && python -m unittest discover -s tests)
(cd flowforge && python -m unittest discover -s tests)
(cd promptforge && python -m unittest discover -s tests)

Inspired by the popular AI platforms of today (AutoGPT, OpenClaw, Dify, Firecrawl, LlamaIndex) — implemented independently from scratch, with no vendored code, no API key and no network calls.

Why

Pasting a repository into an AI assistant is tedious and risky. You copy files by hand, blow through the context window, and sometimes leak an API key.

ContextPack does the boring part properly:

  • walks a project and emits one ordered text bundle (file tree + contents),
  • redacts API keys, GitHub/AWS tokens and private-key blocks by default,
  • respects a rough token budget and tells you what it skipped,
  • skips binaries, dependencies and cache directories,
  • uses only the Python standard library.

Install

Just clone it — there are no dependencies to install:

git clone https://github.com/Sakibpedia/contextpack.git
cd contextpack
python -m contextpack /path/to/repo --max-tokens 8000 --out context.md

To install it as a command in your environment:

pip install .
contextpack /path/to/repo --max-tokens 8000 --out context.md

(Not published on PyPI yet — install from source for now.)

Usage

# Full bundle to stdout
contextpack .

# Stay inside a context window and save the result
contextpack . --max-tokens 12000 --out context.md

# Only source files, skip generated code
contextpack . --include '*.py' --exclude 'tests/*'

# Machine-readable output
contextpack . --json > context.json

Example output:

# Repository context: my-project

## File tree

- README.md
- app.py
- pkg/mod.py

## File contents

### README.md

...

As a library

from contextpack import build_context, redact_secrets

pack = build_context(".", max_tokens=8000, exclude=["tests/*"])
print(pack.text)
print(pack.files, pack.estimated_tokens, pack.truncated)

What gets skipped

node_modules, __pycache__, .git, virtualenvs, build/dist folders, caches, hidden directories, non-text files, and files over 200 KB. Override with --include / --exclude globs.

Redaction

By default ContextPack replaces values assigned to credential-looking names (including OPENAI_API_KEY, DATABASE_PASSWORD and MY_APP_TOKEN), plus GitHub ghp_… tokens, AWS AKIA… keys, OpenAI sk-…, Google AIza…, Slack xox…, Stripe sk_live_…, JWTs and PEM private-key blocks. find_secrets(text) reports which patterns were found without exposing their values. Credential files (.env, .npmrc, .netrc, id_rsa) are never bundled.

Redaction is a best-effort safety net, not a security boundary: regex matching can miss novel formats and can flag harmless code such as token = os.environ.get("TOKEN"). Use --no-redact only when you are certain the target is trusted.

Tests

python -m unittest discover -s tests

23 tests, no test dependencies. CI runs them on Python 3.10–3.12.

License

MIT — see LICENSE.

About

Turn any repository into one LLM-ready context file, with secrets redacted. Zero dependencies.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages