Learning HubACFS Academy
Progress
0%
0 of 3333 remaining
  • 1
    Welcome & Overview5 min
  • 2
    Linux Navigation8 min
  • 3
    SSH & Persistence6 min
  • 4
    tmux Basics7 min
  • 5
    Git Essentials10 min
  • 6
    GitHub CLI8 min
  • 7
    Agent Commands10 min
  • 8
    NTM Command Center8 min
  • 9
    NTM Prompt Palette6 min
  • 10
    The Flywheel Loop10 min
  • 11
    Keeping Updated4 min
  • 12
    UBS: Code Quality Guardrails8 min
  • 13
    Agent Mail Coordination10 min
  • 14
    CASS: Learning from History8 min
  • 15
    The Memory System8 min
  • 16
    Beads: Issue Tracking8 min
  • 17
    Safety Tools: SLB & CAAM6 min
  • 18
    The Art of Agent Direction12 min
  • 19
    Case Study: cass-memory15 min
  • 20
    Case Study: SLB12 min
  • 21
    RU: Multi-Repo Mastery10 min
  • 22
    DCG: Pre-Execution Safety8 min
  • 23
    Meta Skill: Local Skills10 min
  • 24
    SRPS: System Protection8 min
  • 25
    JFP: Prompt Library6 min
  • 26
    APR: Automated Plan Reviser8 min
  • 27
    PT: Process Triage6 min
  • 28
    XF: X Archive Search6 min
  • 29
    RCH: Remote Compilation8 min
  • 30
    WA: WezTerm Automata8 min
  • 31
    Brenner Bot: Research10 min
  • 32
    GIIL: Cloud Image Downloads6 min
  • 33
    S2P: Source to Prompt6 min
    NOW
Back to Home
Back
33/33
Lesson 33
6 min

S2P: Source to Prompt

Combine source code into LLM-ready prompts with token counting

New to ACFS?

Complete the setup wizard first to get the most from these lessons.

Go to Choose Your OS
Goal

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

Launch interactive TUI in current directory
Open specific directory
Show all options
Note
S2P is built with React and Ink, giving you a beautiful terminal UI. Use arrow keys to navigate, Space to toggle files, and Enter to confirm your selection.

TUI Navigation

Once you launch S2P, you get an interactive file browser. Here are the key controls:

bash
# Keyboard Controls
↑/↓ Navigate between files
Space Toggle file selection
Enter Expand/collapse directories
a Select all files
n Deselect all files
c Copy to clipboard
q / 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

bash
# Navigate to your project
cd /data/projects/my-app
# Launch S2P
s2p
# 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..."
Pro Tip
S2P formats the output with clear file path headers and syntax-appropriate code blocks, making it easy for LLMs to understand the code structure.

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.

Ready to level up?

Mark complete to track your learning progress.

Previous
GIIL: Cloud Image Downloads