Skip to content
meesakveldPublic

About

Turn your codebase into structured, AI-ready context. Fast, lightweight CLI for generating project context for ChatGPT, Claude, Gemini, and other AI tools | Mees Akveld

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation



Turn your codebase into AI-ready context.

A fast, lightweight CLI that turns your codebase into structured context for AI tools.


Installation · Usage · Configuration


GitHub Stars GitHub Downloads Go License


What is context?

context turns your project directory into a structured, AI-friendly representation.

Instead of manually copying files and explaining your project structure, run:

context

and 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.


Quick start

Install context:

brew install meesakveld/tap/context

Navigate to your project:

cd your-project

Generate your project context and copy it directly to your clipboard:

context --clipboard

Then paste it into your AI assistant.

That's it.


Why?

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 --clipboard

Then 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.

Built for AI agents

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.


Features

  • 🚀 Fast project scanning
  • 📁 Automatic directory tree generation
  • 📄 Collect relevant text files
  • 🚫 Built-in exclusions for dependencies and build output
  • 🔍 .contextignore support
  • ⚙️ 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

Installation

Homebrew

brew install meesakveld/tap/context

From source

Make sure you have Go installed.

go install [github.com/meesakveld/context/cmd/context@latest](https://github.com/meesakveld/context/cmd/context@latest)

Build locally

git clone [https://github.com/meesakveld/context.git](https://github.com/meesakveld/context.git)
cd context

go build -o context ./cmd/context

Usage

Run context from the root of your project:

context

This generates:

context.txt

with your project structure and relevant file contents.

Clipboard

Copy the generated context directly to your clipboard:

context --clipboard

This is useful when you want to paste your project context directly into an AI assistant.

Standard output

Print the generated context directly to stdout:

context --stdout

This is useful for piping the output into other tools.

Tree only

Only generate the project directory structure:

context --tree-only

Files only

Only include file contents:

context --files-only

Statistics

Show context statistics:

context --stats

Custom output

Write the generated context to a custom file:

context -o project-context.txt

Output formats & Automatic Extensions

context 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 txt

Generate Markdown (context.md):

context --format markdown
# or short flag:
context -f md

Generate JSON (context.json):

context --format json

Generate a filtered ZIP archive (context.zip) that respects all ignore rules and filters:

context --format zip
# or short flag:
context -f zip

File size limit

Limit the maximum size of individual files:

context --max-file-size 500KB

Configuration

Create the default configuration files with:

context --init

This creates:

.context.yaml
.contextignore

If a .gitignore already exists, context --init also adds context.txt to it.

.context.yaml

Example:

output: context.txt

format: txt

max_file_size: 1MB

include_env: false

tree_only: false

files_only: false

include_notes: true

exclude: []

include: []

.contextignore

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
*.pfx

Environment files

Environment 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-env

This helps prevent accidentally exposing secrets when generating context for AI tools.


Examples

Typical project

Running:

context

might 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 ---

How it works

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 reference

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

Development

Clone the repository:

git clone [https://github.com/meesakveld/context.git](https://github.com/meesakveld/context.git)
cd context

Run the CLI:

go run ./cmd/context

Build:

go build ./...

Format the code:

gofmt -w cmd internal

Contributing

Contributions, 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.


License

Apache 2.0 © Mees Akveld

About

Turn your codebase into structured, AI-ready context. Fast, lightweight CLI for generating project context for ChatGPT, Claude, Gemini, and other AI tools | Mees Akveld

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Contributors

Languages