Combine source code files into LLM-ready prompts with interactive file selection and token counting.
What Is S2P?
S2P (Source to Prompt TUI) is a terminal-based tool for combining source code files into a single, LLM-ready prompt. It provides an interactive file browser where you can select exactly which files to include, see the combined output in real-time, and track your token count as you go.
Crafting prompts with code context is tedious when done manually. S2P lets you interactively navigate your codebase, toggle files on/off, preview the combined output, and copy everything to your clipboard in one keystroke. It respects your .gitignore automatically.
Interactive Selection
Browse and toggle files visually
Token Counting
tiktoken-accurate, real-time
Clipboard Copy
One keystroke to copy output
Gitignore-Aware
Respects .gitignore automatically
Essential Commands
TUI Navigation
Once you launch S2P, you get an interactive file browser. Here are the key controls:
# Keyboard Controls↑/↓ Navigate between filesSpace Toggle file selectionEnter Expand/collapse directoriesa Select all filesn Deselect all filesc Copy to clipboardq / Esc Quit
The interface shows you the total token count in real-time as you select files. This helps you stay within Claude's or GPT's context window limits.
Example Workflow
# Navigate to your projectcd /data/projects/my-app# Launch S2Ps2p# In the TUI:# 1. Navigate to src/ directory# 2. Select relevant TypeScript files# 3. Watch token count update# 4. Press 'c' to copy to clipboard# Now paste into Claude/GPT with your question:# "Here's my source code. Can you help me..."
Synergies with Other Tools
S2P works great alongside other flywheel tools:
- CASS: The prompts you create with S2P can be searched later in your agent session history.
- CM (CASS Memory): Use S2P outputs as reference material when extracting rules for your memory playbook.
- NTM: Launch S2P in a dedicated tmux pane while your agent works in another.