cat project | LLM | patch and repeat.
"Finally, a tool that realizes my clipboard is the most important part of my AI workflow." — Nobody
kopipasta is a CLI tool for taking full, transparent control of your prompt context. No black boxes, no hidden RAG, no "magic" that breaks your build.
➜ ~ kopipasta
📁 Project Files
|-- 📂 src/
| |-- ● 📄 main.py (4.2 KB)
| |-- ◐ 📄 utils.py (1.5 KB)
| |-- ○ 📄 server.py
|-- ● 📄 AI_SESSION.md (0.8 KB)
[j/k]: Nav [Space]: Toggle [m]: Map [p]: Patch [e]: Extend [q]: Copy & Quit
Context: 2 files | ~5,000 chars | ~1,400 tokens
I built kopipasta on the principle of explicit context control. You are in the driver's seat. You decide exactly what files, functions, and snippets go into the prompt.
The workflow is a fast, iterative cycle:
- Context: Run
kopipastato select files and define your task. - Generate: Paste the prompt into your LLM (ChatGPT, Claude, Gemini etc.).
- Patch: Press
pinkopipastaand paste the LLM's response to apply changes or import new files. - Iterate: Review with
git diff, then repeat for the next step.
kopipasta tracks file state to distinguish between background context, active focus, and structural hints:
- Unselected (White/Dim): File is not included in the prompt.
- Base (Cyan): "Synced Context." Files that have already been sent to the LLM in a previous turn.
- Delta (Green): "Active Focus." Newly selected files, files found via path scanning, or applied patches.
- Map (Yellow): "Skeleton Context." Includes only top-level class and function signatures (Python only) to save tokens.
Transitions:
- Space: Toggles a file between Unselected and Delta (Green).
- Map (
m): Toggles a file between Unselected and Map (Yellow). - Extend (
e): Copies only Delta files to the clipboard, then promotes them to Base. - Patch (
p): Promotes patched files to Delta (marking them as the current focus).
Note on External Agents: You can also use the Ralph Loop (r) to expose this selection state to an MCP-capable agent (like Claude Desktop). The agent gets Write Access to Delta files and Read Access to the entire project.
kopipasta uses a Quad-Memory Architecture to prevent context drift in long tasks.
Instead of re-explaining the task in every prompt, use a Session to maintain state.
- Start (
n): CreatesAI_SESSION.md(a scratchpad) and snapshots your git commit. - Work: The session file is pinned to your prompt. The LLM updates it (via patches) to track progress.
- Update (
u): Generates a handover prompt to compress the session state for the next LLM window. - Finish (
f): Harvests architectural learnings intoAI_CONTEXT.md(Constitution), deletes the session file, and offers to squash your work into a clean commit.
The "Laws of Physics" for your project. This file is always pinned to the prompt if it exists. Use it for architecture decisions and tech stack constraints.
Your global preferences (e.g., "I use VS Code", "Always use TypeScript"). Injected into every prompt automatically.
The interactive workflow (Start -> Update -> Finish) that harvests fleeting session knowledge into permanent project context.
Press p to paste any text from your LLM. kopipasta intelligently decides how to handle it:
- Code Patches: If markdown code blocks are found (Full files or Unified Diffs), it applies them to your local files.
- Intelligent Import: If no code is found, it scans the text for valid project paths.
- Example: Paste a traceback or a list of "Files to analyze" suggested by the LLM.
- The tool will find the paths and ask if you want to [A]ppend them to your selection (as Delta/Green) or [R]eplace your selection entirely.
Mid-conversation, you often need to show the LLM one or two new files without regenerating the entire context.
- Select the new file(s) in the tree (they will turn Green/Delta).
- Press
e. kopipastacopies a minimal prompt containing only the Green files.- The files are automatically promoted to Cyan/Base (synced) for future turns.
"If success is just a passing shell script, why are you doing the work?" — mkorpela
Turn kopipasta into a secure, verifiable sandbox for AI agents (like Claude Desktop).
- Select Scope:
- Green (Delta): The only files the agent is allowed to EDIT.
- Read Access: The agent can see your whole project (to understand context).
- Set the Goal:
Press
r. Enter a verification command (e.g.,pytest,npm test,./check.sh). This becomes the agent's definition of "done." - Auto-Connect:
kopipastagenerates the configuration and automatically registers the local MCP server in Claude Desktop. - Delegate: The agent wakes up, reads the context, makes edits, and runs your verification command to self-correct.
| Key | Action | Description |
|---|---|---|
↑/↓ or k/j
|
Navigate | Move cursor up/down. |
←/→ or h/l
|
Collapse/Expand | Open/close directory branches. |
Space |
Toggle | Cycle selection: Unselected Delta (Green). |
m |
Map | Cycle selection: Unselected Map (Yellow skeleton). |
p |
Process | Universal Intake. Applies patches OR imports file paths from text. |
e |
Extend | Copy only Delta (Green) files to clipboard -> Promote to Base. |
c |
Clear | Open Clear/Reset menu (Selection, Task, or All). |
s |
Snippet | Toggle Snippet Mode (include only first 50 lines, marked with ◐). |
a |
Add All | Add all files in the current directory. |
r |
Ralph | Configure MCP Server for Agentic workflows (Claude Desktop). |
n |
Start | Initialize AI_SESSION.md. |
u |
Update | Generate "Handover" prompt to update session state. |
f |
Finish | Generate "Harvest" prompt, delete session, and squash. |
Enter |
Expand | Expand or collapse directory. |
q |
Quit | Finalize selection, copy full context (Base + Delta), and exit. |
# Using uv (recommended)
uv tool install kopipasta
# For development
uv sync- Automatically respects
.gitignore. - Detects secrets in
.envfiles and asks to mask/redact them. - Heuristic protection against "snippet hallucinations" (prevents accidental file wipes).