Skip to content

Commit 15efdbb

Browse files
authored
Merge pull request #3 from 1broseidon/claude/readme-github-tags-011CUqTezBNHUHHZonyPyfPM
Improve README and GitHub tags for discoverability
2 parents bb23387 + 12b8fee commit 15efdbb

File tree

1 file changed

+57
-62
lines changed

1 file changed

+57
-62
lines changed

README.md

Lines changed: 57 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# promptext
22

3-
Converts codebases to token-efficient formats for AI context windows.
3+
Convert your codebase into AI-ready prompts - a fast, token-efficient alternative to code2prompt for Claude, ChatGPT, and other LLMs.
44

55
[![Go Report Card](https://goreportcard.com/badge/github.com/1broseidon/promptext?prx=v0.4.5)](https://goreportcard.com/report/github.com/1broseidon/promptext)
66
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
@@ -15,14 +15,26 @@ AI assistants need code context. Sending entire repositories exceeds token limit
1515

1616
promptext filters files, ranks by relevance, and serializes to token-efficient formats within specified budgets.
1717

18+
## Why promptext?
19+
20+
Unlike other tools like code2prompt, codebase-digest, or manual copy-pasting:
21+
- **Faster**: Written in Go, processes large codebases in seconds
22+
- **Smarter**: Relevance scoring automatically finds the most important files
23+
- **Token-aware**: Built-in tiktoken counting prevents LLM context overflow
24+
- **Format-flexible**: PTX, TOON, Markdown, or XML output for any AI assistant
25+
- **Budget-conscious**: Enforce token limits before sending to expensive API calls
26+
1827
## Features
1928

20-
- **PTX format**: 25-30% token reduction vs JSON (TOON v1.3-based hybrid with multiline code blocks)
29+
- **PTX format**: promptext's hybrid TOON format - 25-30% token reduction with explicit paths and multiline code blocks
2130
- **Token budgeting**: Hard limits with relevance-based file selection
2231
- **Relevance scoring**: Keyword matching in paths (10×), directories (5×), imports (3×), content (1×)
2332
- **Standard exclusions**: `.gitignore` patterns, `node_modules/`, lock files, binaries
2433
- **Accurate counting**: tiktoken cl100k_base tokenizer (GPT-3.5/4, Claude compatible)
2534
- **Format options**: PTX (default), TOON-strict, Markdown, XML
35+
- **LLM-optimized**: Works with ChatGPT, Claude, GPT-4, Gemini, and any AI assistant
36+
- **Context window aware**: Respect token limits for Claude Haiku/Sonnet/Opus, GPT-3.5/4
37+
- **AI-friendly formatting**: Structured output for better AI code comprehension
2638

2739
Format reference: [johannschopplich/toon](https://github.com/johannschopplich/toon)
2840

@@ -59,84 +71,65 @@ prx --update
5971

6072
promptext automatically checks for new releases once per day and notifies you when updates are available. Network failures are silently ignored to avoid disrupting normal operation.
6173

62-
## Basic Usage
74+
## Use Cases
6375

64-
```bash
65-
# Current directory to clipboard (PTX format)
66-
prx
76+
- **AI Code Review**: Feed entire projects to Claude/ChatGPT for comprehensive code analysis
77+
- **Context Engineering**: Build optimized prompts within LLM token limits for better AI responses
78+
- **AI Pair Programming**: Provide full codebase context to AI assistants like GitHub Copilot, Cursor, or Windsurf
79+
- **Documentation Generation**: Help AI understand your complete project structure for accurate docs
80+
- **Code Migration**: Give LLMs full legacy codebase context for refactoring suggestions
81+
- **Prompt Engineering**: Create consistent, repeatable AI prompts from code for development workflows
82+
- **Bug Investigation**: Let AI analyze related files together with proper context
83+
- **API Integration**: Generate structured code context for AI-powered development tools
6784

68-
# Specific directory
69-
prx /path/to/project
85+
## Usage
7086

71-
# Filter by extensions
72-
prx -e .go,.js,.ts
73-
74-
# Summary only (file list, token counts)
75-
prx -i
87+
### Smart Context Building (The Power Features)
7688

77-
# Output to file (format auto-detected from extension)
78-
prx -o context.ptx # PTX format
79-
prx -o context.toon # PTX format (backward compatibility)
80-
prx -o context.md # Markdown
81-
prx -o project.xml # XML
82-
83-
# Explicit format specification
84-
prx -f ptx -o context.txt # PTX: readable code blocks
85-
prx -f toon-strict -o small.txt # TOON v1.3: maximum compression
86-
prx -f markdown -o context.md # Standard Markdown
87-
prx -f xml -o project.xml # XML structure
89+
```bash
90+
# Find authentication-related files within token budget
91+
prx -r "auth login OAuth session" --max-tokens 10000
8892

89-
# Exclude patterns (comma-separated)
90-
prx -x "test/,vendor/" --verbose
93+
# Get database layer for Claude Haiku (8K limit)
94+
prx -r "database SQL postgres migration" --max-tokens 8000 -o db-context.ptx
9195

92-
# Preview file selection without processing
93-
prx --dry-run -e .go
96+
# API routes for GPT-4 analysis
97+
prx -r "api routes handlers middleware" --max-tokens 15000
9498

95-
# Suppress output (useful in scripts)
96-
prx -q -o output.ptx
99+
# Bug investigation: error handling code only
100+
prx -r "error exception handler logging" --max-tokens 5000 -e .go,.js
97101
```
98102

99-
## Advanced Usage
100-
101-
### Relevance Filtering
103+
**How relevance scoring works:**
104+
- Filename match: 10 points
105+
- Directory path match: 5 points
106+
- Import statement match: 3 points
107+
- Content match: 1 point
102108

103-
Rank files by keyword frequency:
109+
### Quick Commands
104110

105111
```bash
106-
# Authentication-related files
107-
prx --relevant "auth login OAuth session"
108-
109-
# Database layer
110-
prx -r "database SQL postgres migration"
111-
112-
# API endpoints
113-
prx -r "api routes handlers middleware"
114-
```
115-
116-
**Scoring algorithm:**
117-
- Filename match: 10 points per occurrence
118-
- Directory path match: 5 points per occurrence
119-
- Import statement match: 3 points per occurrence
120-
- Content match: 1 point per occurrence
121-
122-
Files ranked by total score. Ties broken by file size (smaller first).
123-
124-
### Token Budget Control
112+
# Current directory to clipboard
113+
prx
125114

126-
Enforce context window limits:
115+
# Specific directory with extension filter
116+
prx /path/to/project -e .go,.js,.ts
127117

128-
```bash
129-
# Claude 3 Haiku limit
130-
prx --max-tokens 8000
118+
# Output to file (format auto-detected)
119+
prx -o context.ptx # PTX (default)
120+
prx -o context.md # Markdown
121+
prx -o project.xml # XML
131122

132-
# Combined relevance + budget
133-
prx -r "api routes handlers" --max-tokens 5000
123+
# Summary only (file list, token counts)
124+
prx -i
134125

135-
# Cost optimization for iterative queries
136-
prx --max-tokens 3000 -o quick-context.ptx
126+
# Preview file selection
127+
prx --dry-run -r "auth"
137128
```
138129

139-
When budget exceeded, output shows inclusion/exclusion breakdown:
130+
### Token Budget Output
131+
132+
When `--max-tokens` is set and exceeded, promptext shows exactly what was included and excluded:
140133

141134
```
142135
╭───────────────────────────────────────────────╮
@@ -156,6 +149,8 @@ Files included in priority order until budget exhausted.
156149

157150
## Output Formats
158151

152+
**About PTX**: PTX is a hybrid TOON format specifically created for promptext. It balances the extreme compression of TOON-strict with human readability by using explicit file paths as keys and preserving multiline code blocks. This gives you ~25-30% token savings without sacrificing clarity - perfect for AI assistants that need both efficiency and accurate file path context.
153+
159154
| Format | Token Efficiency | File Path Clarity | Code Preservation | Use Case |
160155
|--------|-----------------|-------------------|-------------------|----------|
161156
| **PTX** (default) | 25-30% reduction | ✅ Explicit quoted paths | Multiline blocks preserved | Code analysis, debugging |

0 commit comments

Comments
 (0)