I built a CLI that gives any AI instant context about your project
Source: Dev.to
Overview
Every time I start a new AI session I spend the first few minutes explaining the same things:
- “This is a FastAPI project”
- “We use SQLAlchemy for the ORM”
- “The main entry point is
src/api/main.py” - “Recent work has been on the auth module”
It’s tedious, and AI tools like Claude Code, ChatGPT, and Gemini start cold each session.
To solve this, I created ctx, a small CLI that builds a Markdown context pack for any project and injects it into an AI chat instantly.
Installation
pip install ctx
Creating a Context Pack
ctx save myproject # scan project, save as a context pack
ctx save automatically:
- Stack detection – finds
pyproject.toml,package.json,Cargo.toml,go.mod,Gemfile, etc. - Structure map – directory tree of
src/,tests/,api/folders - Git log – last 10 commits so the AI knows recent work
- README summary – first few lines as project context
- Your notes – optional extra information
The result is a clean Markdown file that any AI can parse immediately.
Example Pack (myproject.md)
# myproject
## Stack
- Python
- Detected from: pyproject.toml
## Structure
src/
api/
models/
tests/
## Recent commits
- feat: add user auth
- fix: resolve migration conflict
- refactor: extract service layer
## README
MyProject is a FastAPI app for managing...
## Notes
Main entry: src/api/main.py
Auth lives in src/auth/ — JWT-based, no sessions
Injecting the Context
ctx inject myproject # → clipboard (paste into ChatGPT, Gemini, etc.)
ctx inject myproject --target claude # → writes CLAUDE.md in current directory
ctx inject myproject --target chatgpt # → clipboard, formatted as a system prompt
- Claude Code reads
CLAUDE.mdautomatically when you open a project—no manual paste needed. - For ChatGPT, Gemini, or any other model, a single paste at the start of the session fully loads the context.
Scope Options
ctx save myproject --scope global # → ~/.ctx/packs/myproject.md (default, usable from any directory)
ctx save myproject --scope local # → .ctx/myproject.md (project‑specific, git‑committable)
Local packs take priority. Commit the .ctx/ directory to your repository and the whole team gets the same context.
CLI Reference
| Command | Description |
|---|---|
ctx save | Scan the current project and create a context pack |
ctx list | Show all available packs |
ctx show | Print a pack to the terminal |
ctx inject | Inject the pack (clipboard by default) |
ctx edit | Open the pack in $EDITOR |
ctx delete | Remove a pack |
ctx save --notes "…" | Add custom notes to the pack |
Why “Context Engineering”?
“Context engineering” is the new prompt engineering.
Models are powerful, but they’re limited when they lack sufficient context about your project—your conventions, current work, and architectural decisions.
ctx provides a local, zero‑dependency way to supply that context:
- No account required
- No sync service
- Pure Markdown files you control
Usage in Any Project
ctx save myproject --notes "Add anything you want the AI to know"
ctx inject myproject --target claude