Turn your codebase into AI-ready context.
A fast, lightweight CLI that turns your codebase into structured context for AI tools.
Installation · Usage · Configuration
context turns your project directory into a structured, AI-friendly representation.
Instead of manually copying files and explaining your project structure, run:
contextand get a single context file containing:
- Project directory structure
- Relevant source files
- File contents
- Project context notes
- Configurable exclusions
- File size limits
It is designed to make working with AI coding tools faster and more consistent.
Install context:
brew install meesakveld/tap/contextNavigate to your project:
cd your-projectGenerate your project context and copy it directly to your clipboard:
context --clipboardThen paste it into your AI assistant.
That's it.
AI coding tools work much better when they understand the structure and relevant parts of a project.
But getting an entire codebase into an AI assistant isn't always convenient. Depending on the tool, uploading a project archive may not be supported, practical, or the best way to provide context.
context turns your codebase into a single, structured text representation that you can paste directly into AI tools such as Claude, ChatGPT, Gemini, and other AI coding assistants.
context --clipboardThen paste the generated context directly into your AI assistant.
No manual file selection. No copying files one by one. No need to manually create or upload a project archive.
context can also act as a simple bridge between your local codebase and AI agents that work primarily with text input.
Your project
│
▼
context
│
├── Remove irrelevant files
├── Apply .contextignore
├── Skip binaries
├── Respect file size limits
└── Handle environment files safely
│
▼
Structured project context
│
├── ChatGPT
├── Claude
├── Gemini
└── Other AI agents
The goal is simple:
Less context preparation. More building.
- 🚀 Fast project scanning
- 📁 Automatic directory tree generation
- 📄 Collect relevant text files
- 🚫 Built-in exclusions for dependencies and build output
- 🔍
.contextignoresupport - ⚙️ YAML configuration
- 📋 Clipboard support
- 🖥️ Stdout support
- 📊 Context statistics
- 🌳 Tree-only mode
- 📄 Files-only mode
- 🖲️ macOS Finder right-click quick action integration
- 🔐 Safe handling of environment files
- 🎨 Text, Markdown (
.md), JSON (.json) and ZIP (.zip) output formats - 💻 Cross-platform
- 🪶 Single binary with no runtime required
brew install meesakveld/tap/contextMake sure you have Go installed.
go install [github.com/meesakveld/context/cmd/context@latest](https://github.com/meesakveld/context/cmd/context@latest)git clone [https://github.com/meesakveld/context.git](https://github.com/meesakveld/context.git)
cd context
go build -o context ./cmd/contextRun context from the root of your project:
contextThis generates:
context.txt
with your project structure and relevant file contents.
Copy the generated context directly to your clipboard:
context --clipboardThis is useful when you want to paste your project context directly into an AI assistant.
Print the generated context directly to stdout:
context --stdoutThis is useful for piping the output into other tools.
Only generate the project directory structure:
context --tree-onlyOnly include file contents:
context --files-onlyShow context statistics:
context --statsWrite the generated context to a custom file:
context -o project-context.txtcontext supports multiple output formats. When no custom output path is provided, the tool automatically selects the correct default file extension based on the chosen format:
Generate plain text (context.txt):
context --format txtGenerate Markdown (context.md):
context --format markdown
# or short flag:
context -f mdGenerate JSON (context.json):
context --format jsonGenerate a filtered ZIP archive (context.zip) that respects all ignore rules and filters:
context --format zip
# or short flag:
context -f zipLimit the maximum size of individual files:
context --max-file-size 500KBCreate the default configuration files with:
context --initThis creates:
.context.yaml
.contextignore
If a .gitignore already exists, context --init also adds context.txt to it.
Example:
output: context.txt
format: txt
max_file_size: 1MB
include_env: false
tree_only: false
files_only: false
include_notes: true
exclude: []
include: []Use .contextignore to exclude files or directories:
# Dependencies
node_modules/
venv/
.venv/
# Build output
.next/
dist/
build/
# Generated files
coverage/
.cache/
.tmp/
# Secrets
*.pem
*.key
*.p12
*.pfxEnvironment files are handled carefully by default.
These example files are safe to include:
.env.example
.env.template
.env.sample
Actual environment files such as:
.env
.env.local
.env.production
are not included unless explicitly enabled:
context --include-envThis helps prevent accidentally exposing secrets when generating context for AI tools.
Running:
contextmight produce:
PROJECT DIRECTORY STRUCTURE
├── app/
│ ├── components/
│ │ ├── Button.tsx
│ │ └── Header.tsx
│ ├── page.tsx
│ └── layout.tsx
├── package.json
├── README.md
└── tsconfig.json
FILE CONTENTS
--- START FILE: app/components/Button.tsx ---
export function Button() {
...
}
--- END FILE: app/components/Button.tsx ---
context scans your project and builds a structured representation while filtering out files that are unlikely to be useful to an AI assistant.
Project
│
▼
Scan files
│
├── Apply exclusions
├── Apply .contextignore
├── Check file types
├── Check file size
└── Handle environment files
│
▼
Build project tree
│
▼
Collect file contents
│
▼
Format output
│
▼
context.txt / context.md / context.json / context.zip
The generated context contains both the structure of your project and the contents of relevant files, making it easier for AI tools to understand how your project is organised.
| Command | Description |
|---|---|
context |
Generate project context |
context -o file.txt |
Write to a custom file |
context --clipboard |
Copy context to clipboard |
context --stdout |
Print context to stdout |
context --tree-only |
Generate only the directory tree |
context --files-only |
Generate only file contents |
context --stats |
Show context statistics |
context --format txt |
Generate plain text (context.txt) |
context --format markdown |
Generate Markdown (context.md) |
context --format json |
Generate JSON (context.json) |
context --format zip |
Generate a filtered ZIP archive (context.zip) |
context --include-env |
Include environment files |
context --init |
Create project configuration |
context --install-finder |
Install macOS Finder right-click |
context --version |
Show version |
Clone the repository:
git clone [https://github.com/meesakveld/context.git](https://github.com/meesakveld/context.git)
cd contextRun the CLI:
go run ./cmd/contextBuild:
go build ./...Format the code:
gofmt -w cmd internalContributions, ideas and feedback are welcome.
If you find a bug or have an idea for a feature, open an issue or submit a pull request.
Apache 2.0 © Mees Akveld