Generate structured context files (llms.txt) from your Python codebase — zero API keys, fully offline.
- AST-Level Parsing — Statically analyses Python source files using the built-in
astmodule. Extracts classes, functions, and docstrings without executing any code. - Recursive File Discovery — Walks project directories automatically, skipping
venv,.git,__pycache__,node_modules, and other noise directories. llms.txtGeneration — Produces a single, well-structured Markdown file that LLM tooling (Cursor, Copilot, Claude Code, opencode, etc.) can ingest as project context.- Zero Dependencies on AI Providers — No API keys, no network calls, no subscription. Runs entirely on your machine.
- Rich CLI Feedback — Progress spinners and clear terminal output via the
richlibrary.
# Install from source
cd contextforge-cli
pip install .
# Or install in editable mode for development
pip install -e .# Scan the current directory
contextforge generate --target .
# Scan a specific project
contextforge generate --target ./my-projectThe command produces an llms.txt file in the target directory. Example output:
## src/parser.py
### Classes
- **ASTParser** — Parses Python source into structured metadata
- `parse_file()` — Returns classes, functions, and docstrings
### Functions
- `walk_directory()` — Recursively finds all `.py` files
## src/generator.pyThe llms.txt convention (proposed by the llmstxt community) gives AI coding tools a standard place to look for project-level context. Instead of guessing which files to read or relying on token-wasteful file-tree scanning, tools can read a single llms.txt to understand your codebase's structure, key abstractions, and entry points.
This means:
- Fewer hallucinations — the model knows exactly which modules exist and what they do.
- Faster setup — no repetitive "read this file, now read that file" prompting.
- Offline-first — the context file lives in your repo, not on a remote server.
contextforge-cli/
├── contextforge/
│ ├── __init__.py
│ ├── cli.py # Click CLI entry point
│ ├── walker.py # Recursive .py file discovery
│ ├── parser.py # AST-based code analysis
│ └── generator.py # llms.txt generation
├── tests/ # Test suite (pytest)
├── setup.py # Package configuration
├── requirements.txt # Runtime dependencies
└── dev-requirements.txt# Development dependencies
Contributions are welcome. Please open an issue or submit a pull request on GitHub.
- Fork the repository.
- Create a feature branch (
git checkout -b feature/my-change). - Run the test suite (
pytest) to confirm nothing is broken. - Submit a pull request with a clear description of your changes.
MIT — see LICENSE.