ctxpack

command module
v0.1.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 24, 2026 License: MIT Imports: 11 Imported by: 0

README

ctxpack

Task-aware context bundler for AI coding tools


You open a new AI chat. You paste in your project structure. You explain what the codebase does. Again. You do this every single session because the AI has no memory of what you built or why.

ctxpack fixes this. Give it a task description; it scans your repo, ranks every file by relevance using TF-IDF, and bundles the top matches into a ready-to-paste context block — within a ~8 000-token budget.


Install

go install github.com/ctxpackhq/ctxpack@latest

Usage

ctxpack "add rate limiting to the API handler"
Scanning /home/user/myapp...
Scoring 43 files...
Copied to clipboard.

--- Summary ---
Files scanned:  43
Files selected: 6
Token estimate: 3821 / 8000

The formatted context is written to stdout and copied to your clipboard:

# Context for: add rate limiting to the API handler

## internal/handler/api.go

​```
package handler
...
​```

## internal/middleware/middleware.go

​```
package middleware
...
​```

Paste it directly into Claude, ChatGPT, or any chat interface — no manual file hunting.

Scan a different directory:

ctxpack "fix the auth bug" -d ~/projects/backend

Pipe to a file instead of clipboard:

ctxpack "refactor database layer" > context.md

How it works

  • Walks your repo, skipping node_modules, .git, vendor, lock files, and binaries.
  • Scores every file against your task description with TF-IDF — files whose content and path share the most terms with your task rank highest.
  • Greedily packs the top-scoring files into a single Markdown block, stopping at ~8 000 tokens.

License

MIT

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL