prompt-enhancer-cli 1.5.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- prompt_enhancer_cli-1.5.0/LICENSE +21 -0
- prompt_enhancer_cli-1.5.0/PKG-INFO +215 -0
- prompt_enhancer_cli-1.5.0/README.md +191 -0
- prompt_enhancer_cli-1.5.0/pyproject.toml +36 -0
- prompt_enhancer_cli-1.5.0/setup.cfg +4 -0
- prompt_enhancer_cli-1.5.0/src/prompt_enhancer/__init__.py +2 -0
- prompt_enhancer_cli-1.5.0/src/prompt_enhancer/agents.py +205 -0
- prompt_enhancer_cli-1.5.0/src/prompt_enhancer/cli.py +930 -0
- prompt_enhancer_cli-1.5.0/src/prompt_enhancer/dashboard.py +380 -0
- prompt_enhancer_cli-1.5.0/src/prompt_enhancer/lint.py +140 -0
- prompt_enhancer_cli-1.5.0/src/prompt_enhancer/view.py +236 -0
- prompt_enhancer_cli-1.5.0/src/prompt_enhancer_cli.egg-info/PKG-INFO +215 -0
- prompt_enhancer_cli-1.5.0/src/prompt_enhancer_cli.egg-info/SOURCES.txt +15 -0
- prompt_enhancer_cli-1.5.0/src/prompt_enhancer_cli.egg-info/dependency_links.txt +1 -0
- prompt_enhancer_cli-1.5.0/src/prompt_enhancer_cli.egg-info/entry_points.txt +3 -0
- prompt_enhancer_cli-1.5.0/src/prompt_enhancer_cli.egg-info/top_level.txt +1 -0
- prompt_enhancer_cli-1.5.0/tests/test_all.py +484 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 hongphuc5497
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: prompt-enhancer-cli
|
|
3
|
+
Version: 1.5.0
|
|
4
|
+
Summary: Reverse-engineered from Auggie's Ctrl+P — transforms rough ideas into production system prompts for AI coding agents
|
|
5
|
+
Author-email: hongphuc5497 <hongphuc.dthp@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/hongphuc5497/prompt-enhancer
|
|
8
|
+
Project-URL: Repository, https://github.com/hongphuc5497/prompt-enhancer.git
|
|
9
|
+
Keywords: prompt-engineering,ai,llm,claude-code,codex,cursor,auggie,system-prompt,agent
|
|
10
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
18
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
20
|
+
Requires-Python: >=3.12
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Dynamic: license-file
|
|
24
|
+
|
|
25
|
+
# <img src="docs/logo.svg" alt="pe" height="60"> Prompt Enhancer
|
|
26
|
+
|
|
27
|
+
<p align="center">
|
|
28
|
+
<strong>Generate reusable 7-section agent system prompts from rough persona ideas.</strong><br>
|
|
29
|
+
<sub>With optional install helpers, benchmarking, and local history.</sub>
|
|
30
|
+
</p>
|
|
31
|
+
|
|
32
|
+
<p align="center">
|
|
33
|
+
<a href="https://github.com/hongphuc5497/prompt-enhancer/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-green" alt="License: MIT"></a>
|
|
34
|
+
<a href="https://github.com/hongphuc5497/prompt-enhancer/releases"><img src="https://img.shields.io/badge/version-1.5.0-blue" alt="Version"></a>
|
|
35
|
+
<a href="https://github.com/hongphuc5497/prompt-enhancer"><img src="https://img.shields.io/badge/python-3.12+-blue" alt="Python 3.12+"></a>
|
|
36
|
+
<a href="https://github.com/hongphuc5497/prompt-enhancer"><img src="https://img.shields.io/badge/dependencies-0-lightgrey" alt="Zero dependencies"></a>
|
|
37
|
+
</p>
|
|
38
|
+
|
|
39
|
+
Two CLI modes for two use cases:
|
|
40
|
+
- **`pe persona`** — Generate persistent 7-section system prompts (for saving, sharing, installing into agent configs)
|
|
41
|
+
- **`pe enhance-task`** — Inline task refinement with workspace context (like Auggie's Ctrl+P)
|
|
42
|
+
|
|
43
|
+
The CLI is `pe` (short) and `prompt-enhancer` (long). Both work identically.
|
|
44
|
+
|
|
45
|
+
## Install
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
pip install prompt-enhancer-cli
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Or install directly from source:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
pip install git+https://github.com/hongphuc5497/prompt-enhancer.git
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
> The PyPI distribution is `prompt-enhancer-cli` (the bare name `prompt-enhancer`
|
|
58
|
+
> was already taken). The command is still `pe` (or `prompt-enhancer`) — only
|
|
59
|
+
> the install line changes.
|
|
60
|
+
|
|
61
|
+
Set your API key:
|
|
62
|
+
```bash
|
|
63
|
+
echo "LLM_API_KEY=*** > ~/.prompt-enhancer.env
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Config (`~/.prompt-enhancer.env`):
|
|
67
|
+
```env
|
|
68
|
+
LLM_API_KEY=***i...ps://api.deepseek.com
|
|
69
|
+
LLM_MODEL=deepseek-chat
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Any OpenAI-compatible API works: DeepSeek, OpenAI, OpenRouter, Together, Groq, etc.
|
|
73
|
+
|
|
74
|
+
## Quick start
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
# Generate a 7-section system prompt
|
|
78
|
+
pe persona "a senior Rust developer who prefers functional programming"
|
|
79
|
+
|
|
80
|
+
# Inline task refinement (Auggie Ctrl+P style)
|
|
81
|
+
pe enhance-task "fix the login bug in the auth module"
|
|
82
|
+
|
|
83
|
+
# Safe install into agent config (creates backup if exists)
|
|
84
|
+
pe install "a security reviewer" --agent claude
|
|
85
|
+
|
|
86
|
+
# Benchmark before vs after
|
|
87
|
+
pe benchmark --enhance "a Go backend dev"
|
|
88
|
+
|
|
89
|
+
# Health check
|
|
90
|
+
pe doctor
|
|
91
|
+
|
|
92
|
+
# View analytics
|
|
93
|
+
pe store stats
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Two modes
|
|
97
|
+
|
|
98
|
+
| Command | Purpose | Output |
|
|
99
|
+
|---------|---------|--------|
|
|
100
|
+
| `pe persona` | Generate persistent system prompt | 7 sections: ROLE, CONTEXT, RULES, TECH, FORMAT, PITFALLS, EXAMPLES |
|
|
101
|
+
| `pe enhance-task` | Inline task refinement | 3-5 sentence focused task prompt with workspace context |
|
|
102
|
+
|
|
103
|
+
Both modes auto-discover workspace context (`AGENTS.md`, `CLAUDE.md`, `package.json`, `Cargo.toml`, etc.) from the current project.
|
|
104
|
+
|
|
105
|
+
## What `pe persona` generates
|
|
106
|
+
|
|
107
|
+
1. **ROLE** — Specific, well-scoped identity
|
|
108
|
+
2. **CONTEXT** — Project specs from workspace files
|
|
109
|
+
3. **BEHAVIORAL RULES** — Communication style, decision-making
|
|
110
|
+
4. **TECHNICAL GUIDELINES** — Testing, code style, architecture
|
|
111
|
+
5. **OUTPUT FORMAT** — Code blocks, explanation style
|
|
112
|
+
6. **PITFALLS / GUARDRAILS** — Anti-patterns, security warnings
|
|
113
|
+
7. **EXAMPLES** — 1-2 realistic interactions
|
|
114
|
+
|
|
115
|
+
Plus a "pro tip".
|
|
116
|
+
|
|
117
|
+
## Benchmark
|
|
118
|
+
|
|
119
|
+
7-dimension rubric scoring (SurePrompts): Role Clarity, Context Sufficiency, Instruction Specificity, Format Structure, Example Quality, Constraint Tightness, Output Validation. Each scored 1–5, max 35.
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
pe benchmark --before raw.txt --after enhanced.md
|
|
123
|
+
pe benchmark --enhance "a Go backend dev" # all-in-one
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
| Score | Verdict |
|
|
127
|
+
|-------|---------|
|
|
128
|
+
| 28-35 | Production-ready |
|
|
129
|
+
| 21-27 | Working draft |
|
|
130
|
+
| 14-20 | Needs major revision |
|
|
131
|
+
| 7-13 | Rewrite from scratch |
|
|
132
|
+
|
|
133
|
+
## Comparison with Auggie
|
|
134
|
+
|
|
135
|
+
Both this tool and Auggie's native `--enhance-prompt` have their strengths:
|
|
136
|
+
|
|
137
|
+
| | `pe persona` | `pe enhance-task` | Auggie `--enhance-prompt` |
|
|
138
|
+
|---|---|---|---|
|
|
139
|
+
| **Best for** | Persistent system prompts | Inline task refinement | Inline task refinement |
|
|
140
|
+
| **Output** | 7-section document | 3-5 sentences | 1-3 sentences |
|
|
141
|
+
| **Workspace aware** | Yes (auto-discovers context) | Yes | Yes (native) |
|
|
142
|
+
| **Installable** | Yes (`pe install`) | No | No |
|
|
143
|
+
| **Reusable** | Save, share, version | Session-scoped | Session-scoped |
|
|
144
|
+
| **Benchmark** | Built-in rubric | No | No |
|
|
145
|
+
| **Analytics** | Auto-store | Auto-store | No |
|
|
146
|
+
|
|
147
|
+
They are complementary tools, not competitors.
|
|
148
|
+
|
|
149
|
+
## Profiles
|
|
150
|
+
|
|
151
|
+
| Profile | Focus |
|
|
152
|
+
|---------|-------|
|
|
153
|
+
| `senior-dev` | Technical depth, testing, edge cases |
|
|
154
|
+
| `architect` | System design, trade-offs, scalability |
|
|
155
|
+
| `reviewer` | Security, performance, code smells |
|
|
156
|
+
| `sre` | Observability, reliability, incident response |
|
|
157
|
+
| `product` | User experience, feature prioritization |
|
|
158
|
+
| `mentor` | Teaching, onboarding, pair-programming |
|
|
159
|
+
|
|
160
|
+
## Agent integration
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
pe install "a Rust dev..." --agent claude # → CLAUDE.md
|
|
164
|
+
pe install "..." --agent codex # → .codex/system.md
|
|
165
|
+
pe install "..." --agent cursor # → .cursorrules
|
|
166
|
+
pe install "..." --agent all # → all compatible configs
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Safe by default — creates `.bak` backup of existing files. Use `--force` to skip backup, `--dry-run` to preview.
|
|
170
|
+
|
|
171
|
+
| Agent | Config file | Auto-loaded? |
|
|
172
|
+
|-------|------------|:---:|
|
|
173
|
+
| **Claude Code** | `CLAUDE.md` | ✅ |
|
|
174
|
+
| **Codex** | `.codex/system.md` | ✅ |
|
|
175
|
+
| **OpenCode** | `AGENTS.md` | ✅ |
|
|
176
|
+
| **Cursor** | `.cursorrules` | ✅ |
|
|
177
|
+
| **Auggie** | `AGENTS.md` | ✅ |
|
|
178
|
+
| **Copilot** | `.github/copilot-instructions.md` | ✅ |
|
|
179
|
+
| **Aider** | `.aider-persona.md` | `--system-prompt` flag |
|
|
180
|
+
|
|
181
|
+
## Analytics store
|
|
182
|
+
|
|
183
|
+
Every enhancement is auto-logged to `~/.prompt-enhancer/store.jsonl`:
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
pe store list # Recent enhancements
|
|
187
|
+
pe store stats # Analytics
|
|
188
|
+
pe store search "rust" # Search by keyword
|
|
189
|
+
pe store show <id> # Detailed view
|
|
190
|
+
pe store delete <id> # Remove a record
|
|
191
|
+
pe store clear # Wipe all data
|
|
192
|
+
pe store export --format csv # Export for analysis
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
First run shows a privacy notice. Use `--no-store` to opt out.
|
|
196
|
+
|
|
197
|
+
## Demo
|
|
198
|
+
|
|
199
|
+
See [docs/demo.tape](docs/demo.tape) for the VHS terminal recording script.
|
|
200
|
+
|
|
201
|
+
## Config
|
|
202
|
+
|
|
203
|
+
```env
|
|
204
|
+
# ~/.prompt-enhancer.env
|
|
205
|
+
LLM_API_KEY=***i...ps://api.deepseek.com # Default
|
|
206
|
+
LLM_MODEL=deepseek-chat # Default
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
## Contributing
|
|
210
|
+
|
|
211
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md). PRs welcome.
|
|
212
|
+
|
|
213
|
+
## License
|
|
214
|
+
|
|
215
|
+
MIT — see [LICENSE](LICENSE).
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
# <img src="docs/logo.svg" alt="pe" height="60"> Prompt Enhancer
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<strong>Generate reusable 7-section agent system prompts from rough persona ideas.</strong><br>
|
|
5
|
+
<sub>With optional install helpers, benchmarking, and local history.</sub>
|
|
6
|
+
</p>
|
|
7
|
+
|
|
8
|
+
<p align="center">
|
|
9
|
+
<a href="https://github.com/hongphuc5497/prompt-enhancer/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-green" alt="License: MIT"></a>
|
|
10
|
+
<a href="https://github.com/hongphuc5497/prompt-enhancer/releases"><img src="https://img.shields.io/badge/version-1.5.0-blue" alt="Version"></a>
|
|
11
|
+
<a href="https://github.com/hongphuc5497/prompt-enhancer"><img src="https://img.shields.io/badge/python-3.12+-blue" alt="Python 3.12+"></a>
|
|
12
|
+
<a href="https://github.com/hongphuc5497/prompt-enhancer"><img src="https://img.shields.io/badge/dependencies-0-lightgrey" alt="Zero dependencies"></a>
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
Two CLI modes for two use cases:
|
|
16
|
+
- **`pe persona`** — Generate persistent 7-section system prompts (for saving, sharing, installing into agent configs)
|
|
17
|
+
- **`pe enhance-task`** — Inline task refinement with workspace context (like Auggie's Ctrl+P)
|
|
18
|
+
|
|
19
|
+
The CLI is `pe` (short) and `prompt-enhancer` (long). Both work identically.
|
|
20
|
+
|
|
21
|
+
## Install
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pip install prompt-enhancer-cli
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Or install directly from source:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pip install git+https://github.com/hongphuc5497/prompt-enhancer.git
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
> The PyPI distribution is `prompt-enhancer-cli` (the bare name `prompt-enhancer`
|
|
34
|
+
> was already taken). The command is still `pe` (or `prompt-enhancer`) — only
|
|
35
|
+
> the install line changes.
|
|
36
|
+
|
|
37
|
+
Set your API key:
|
|
38
|
+
```bash
|
|
39
|
+
echo "LLM_API_KEY=*** > ~/.prompt-enhancer.env
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Config (`~/.prompt-enhancer.env`):
|
|
43
|
+
```env
|
|
44
|
+
LLM_API_KEY=***i...ps://api.deepseek.com
|
|
45
|
+
LLM_MODEL=deepseek-chat
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Any OpenAI-compatible API works: DeepSeek, OpenAI, OpenRouter, Together, Groq, etc.
|
|
49
|
+
|
|
50
|
+
## Quick start
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
# Generate a 7-section system prompt
|
|
54
|
+
pe persona "a senior Rust developer who prefers functional programming"
|
|
55
|
+
|
|
56
|
+
# Inline task refinement (Auggie Ctrl+P style)
|
|
57
|
+
pe enhance-task "fix the login bug in the auth module"
|
|
58
|
+
|
|
59
|
+
# Safe install into agent config (creates backup if exists)
|
|
60
|
+
pe install "a security reviewer" --agent claude
|
|
61
|
+
|
|
62
|
+
# Benchmark before vs after
|
|
63
|
+
pe benchmark --enhance "a Go backend dev"
|
|
64
|
+
|
|
65
|
+
# Health check
|
|
66
|
+
pe doctor
|
|
67
|
+
|
|
68
|
+
# View analytics
|
|
69
|
+
pe store stats
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Two modes
|
|
73
|
+
|
|
74
|
+
| Command | Purpose | Output |
|
|
75
|
+
|---------|---------|--------|
|
|
76
|
+
| `pe persona` | Generate persistent system prompt | 7 sections: ROLE, CONTEXT, RULES, TECH, FORMAT, PITFALLS, EXAMPLES |
|
|
77
|
+
| `pe enhance-task` | Inline task refinement | 3-5 sentence focused task prompt with workspace context |
|
|
78
|
+
|
|
79
|
+
Both modes auto-discover workspace context (`AGENTS.md`, `CLAUDE.md`, `package.json`, `Cargo.toml`, etc.) from the current project.
|
|
80
|
+
|
|
81
|
+
## What `pe persona` generates
|
|
82
|
+
|
|
83
|
+
1. **ROLE** — Specific, well-scoped identity
|
|
84
|
+
2. **CONTEXT** — Project specs from workspace files
|
|
85
|
+
3. **BEHAVIORAL RULES** — Communication style, decision-making
|
|
86
|
+
4. **TECHNICAL GUIDELINES** — Testing, code style, architecture
|
|
87
|
+
5. **OUTPUT FORMAT** — Code blocks, explanation style
|
|
88
|
+
6. **PITFALLS / GUARDRAILS** — Anti-patterns, security warnings
|
|
89
|
+
7. **EXAMPLES** — 1-2 realistic interactions
|
|
90
|
+
|
|
91
|
+
Plus a "pro tip".
|
|
92
|
+
|
|
93
|
+
## Benchmark
|
|
94
|
+
|
|
95
|
+
7-dimension rubric scoring (SurePrompts): Role Clarity, Context Sufficiency, Instruction Specificity, Format Structure, Example Quality, Constraint Tightness, Output Validation. Each scored 1–5, max 35.
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
pe benchmark --before raw.txt --after enhanced.md
|
|
99
|
+
pe benchmark --enhance "a Go backend dev" # all-in-one
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
| Score | Verdict |
|
|
103
|
+
|-------|---------|
|
|
104
|
+
| 28-35 | Production-ready |
|
|
105
|
+
| 21-27 | Working draft |
|
|
106
|
+
| 14-20 | Needs major revision |
|
|
107
|
+
| 7-13 | Rewrite from scratch |
|
|
108
|
+
|
|
109
|
+
## Comparison with Auggie
|
|
110
|
+
|
|
111
|
+
Both this tool and Auggie's native `--enhance-prompt` have their strengths:
|
|
112
|
+
|
|
113
|
+
| | `pe persona` | `pe enhance-task` | Auggie `--enhance-prompt` |
|
|
114
|
+
|---|---|---|---|
|
|
115
|
+
| **Best for** | Persistent system prompts | Inline task refinement | Inline task refinement |
|
|
116
|
+
| **Output** | 7-section document | 3-5 sentences | 1-3 sentences |
|
|
117
|
+
| **Workspace aware** | Yes (auto-discovers context) | Yes | Yes (native) |
|
|
118
|
+
| **Installable** | Yes (`pe install`) | No | No |
|
|
119
|
+
| **Reusable** | Save, share, version | Session-scoped | Session-scoped |
|
|
120
|
+
| **Benchmark** | Built-in rubric | No | No |
|
|
121
|
+
| **Analytics** | Auto-store | Auto-store | No |
|
|
122
|
+
|
|
123
|
+
They are complementary tools, not competitors.
|
|
124
|
+
|
|
125
|
+
## Profiles
|
|
126
|
+
|
|
127
|
+
| Profile | Focus |
|
|
128
|
+
|---------|-------|
|
|
129
|
+
| `senior-dev` | Technical depth, testing, edge cases |
|
|
130
|
+
| `architect` | System design, trade-offs, scalability |
|
|
131
|
+
| `reviewer` | Security, performance, code smells |
|
|
132
|
+
| `sre` | Observability, reliability, incident response |
|
|
133
|
+
| `product` | User experience, feature prioritization |
|
|
134
|
+
| `mentor` | Teaching, onboarding, pair-programming |
|
|
135
|
+
|
|
136
|
+
## Agent integration
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
pe install "a Rust dev..." --agent claude # → CLAUDE.md
|
|
140
|
+
pe install "..." --agent codex # → .codex/system.md
|
|
141
|
+
pe install "..." --agent cursor # → .cursorrules
|
|
142
|
+
pe install "..." --agent all # → all compatible configs
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Safe by default — creates `.bak` backup of existing files. Use `--force` to skip backup, `--dry-run` to preview.
|
|
146
|
+
|
|
147
|
+
| Agent | Config file | Auto-loaded? |
|
|
148
|
+
|-------|------------|:---:|
|
|
149
|
+
| **Claude Code** | `CLAUDE.md` | ✅ |
|
|
150
|
+
| **Codex** | `.codex/system.md` | ✅ |
|
|
151
|
+
| **OpenCode** | `AGENTS.md` | ✅ |
|
|
152
|
+
| **Cursor** | `.cursorrules` | ✅ |
|
|
153
|
+
| **Auggie** | `AGENTS.md` | ✅ |
|
|
154
|
+
| **Copilot** | `.github/copilot-instructions.md` | ✅ |
|
|
155
|
+
| **Aider** | `.aider-persona.md` | `--system-prompt` flag |
|
|
156
|
+
|
|
157
|
+
## Analytics store
|
|
158
|
+
|
|
159
|
+
Every enhancement is auto-logged to `~/.prompt-enhancer/store.jsonl`:
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
pe store list # Recent enhancements
|
|
163
|
+
pe store stats # Analytics
|
|
164
|
+
pe store search "rust" # Search by keyword
|
|
165
|
+
pe store show <id> # Detailed view
|
|
166
|
+
pe store delete <id> # Remove a record
|
|
167
|
+
pe store clear # Wipe all data
|
|
168
|
+
pe store export --format csv # Export for analysis
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
First run shows a privacy notice. Use `--no-store` to opt out.
|
|
172
|
+
|
|
173
|
+
## Demo
|
|
174
|
+
|
|
175
|
+
See [docs/demo.tape](docs/demo.tape) for the VHS terminal recording script.
|
|
176
|
+
|
|
177
|
+
## Config
|
|
178
|
+
|
|
179
|
+
```env
|
|
180
|
+
# ~/.prompt-enhancer.env
|
|
181
|
+
LLM_API_KEY=***i...ps://api.deepseek.com # Default
|
|
182
|
+
LLM_MODEL=deepseek-chat # Default
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
## Contributing
|
|
186
|
+
|
|
187
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md). PRs welcome.
|
|
188
|
+
|
|
189
|
+
## License
|
|
190
|
+
|
|
191
|
+
MIT — see [LICENSE](LICENSE).
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "prompt-enhancer-cli"
|
|
3
|
+
version = "1.5.0"
|
|
4
|
+
description = "Reverse-engineered from Auggie's Ctrl+P — transforms rough ideas into production system prompts for AI coding agents"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.12"
|
|
7
|
+
license = { text = "MIT" }
|
|
8
|
+
authors = [{ name = "hongphuc5497", email = "hongphuc.dthp@gmail.com" }]
|
|
9
|
+
keywords = ["prompt-engineering", "ai", "llm", "claude-code", "codex", "cursor", "auggie", "system-prompt", "agent"]
|
|
10
|
+
classifiers = [
|
|
11
|
+
"Development Status :: 5 - Production/Stable",
|
|
12
|
+
"Intended Audience :: Developers",
|
|
13
|
+
"License :: OSI Approved :: MIT License",
|
|
14
|
+
"Operating System :: OS Independent",
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"Programming Language :: Python :: 3.12",
|
|
17
|
+
"Programming Language :: Python :: 3.13",
|
|
18
|
+
"Programming Language :: Python :: 3.14",
|
|
19
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
20
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
[project.scripts]
|
|
24
|
+
prompt-enhancer = "prompt_enhancer.cli:main"
|
|
25
|
+
pe = "prompt_enhancer.cli:main"
|
|
26
|
+
|
|
27
|
+
[project.urls]
|
|
28
|
+
Homepage = "https://github.com/hongphuc5497/prompt-enhancer"
|
|
29
|
+
Repository = "https://github.com/hongphuc5497/prompt-enhancer.git"
|
|
30
|
+
|
|
31
|
+
[build-system]
|
|
32
|
+
requires = ["setuptools>=68"]
|
|
33
|
+
build-backend = "setuptools.build_meta"
|
|
34
|
+
|
|
35
|
+
[tool.setuptools.packages.find]
|
|
36
|
+
where = ["src"]
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Agent backends for prompt-enhancer — delegate enhancement to existing coding agents.
|
|
3
|
+
|
|
4
|
+
Each backend takes a seed prompt and returns an enhanced version by shelling out
|
|
5
|
+
to the agent's CLI. No API key needed — uses the agent's existing configuration.
|
|
6
|
+
|
|
7
|
+
Supported agents:
|
|
8
|
+
claude — Claude Code (claude -p)
|
|
9
|
+
codex — Codex CLI (codex)
|
|
10
|
+
auggie — Auggie (auggie --print)
|
|
11
|
+
opencode — OpenCode (opencode --print)
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
import subprocess
|
|
15
|
+
import sys
|
|
16
|
+
import os
|
|
17
|
+
from pathlib import Path
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
ENHANCEMENT_PROMPT_TEMPLATE = """Transform this rough idea into a 7-section system prompt for AI coding agents.
|
|
21
|
+
|
|
22
|
+
SECTIONS: ROLE → CONTEXT → BEHAVIORAL RULES → TECHNICAL GUIDELINES → OUTPUT FORMAT → PITFALLS/GUARDRAILS → EXAMPLES
|
|
23
|
+
|
|
24
|
+
RULES:
|
|
25
|
+
- Be concrete — reference actual tools, patterns, conventions
|
|
26
|
+
- Be actionable — rules translate directly into agent behavior
|
|
27
|
+
- Be concise — 2-4 bullets per section
|
|
28
|
+
- Include a "pro tip" at the end
|
|
29
|
+
- Output ONLY the system prompt markdown, start with "# System Prompt: <Role>"
|
|
30
|
+
|
|
31
|
+
## Rough idea
|
|
32
|
+
{seed}
|
|
33
|
+
|
|
34
|
+
## Output
|
|
35
|
+
# System Prompt:"""
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def _find_binary(names):
|
|
39
|
+
"""Find the first available binary from a list of names."""
|
|
40
|
+
for name in names:
|
|
41
|
+
# Check common locations
|
|
42
|
+
for prefix in ["", str(Path.home() / ".local/bin/"), str(Path.home() / ".nvm/versions/node/v26.1.0/bin/")]:
|
|
43
|
+
path = os.path.join(prefix, name)
|
|
44
|
+
if os.path.exists(path) and os.access(path, os.X_OK):
|
|
45
|
+
return path
|
|
46
|
+
# Try which
|
|
47
|
+
try:
|
|
48
|
+
result = subprocess.run(["which", name], capture_output=True, text=True, timeout=5)
|
|
49
|
+
if result.returncode == 0:
|
|
50
|
+
return result.stdout.strip()
|
|
51
|
+
except Exception:
|
|
52
|
+
pass
|
|
53
|
+
return None
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def enhance_via_claude(seed, config=None):
|
|
57
|
+
"""Enhance via Claude Code."""
|
|
58
|
+
binary = _find_binary(["claude"])
|
|
59
|
+
if not binary:
|
|
60
|
+
raise RuntimeError("Claude Code not found. Install: npm install -g @anthropic-ai/claude-code")
|
|
61
|
+
|
|
62
|
+
prompt = ENHANCEMENT_PROMPT_TEMPLATE.format(seed=seed)
|
|
63
|
+
result = subprocess.run(
|
|
64
|
+
[binary, "-p", prompt],
|
|
65
|
+
capture_output=True, text=True, timeout=120,
|
|
66
|
+
env={**os.environ, "CLAUDE_CODE_HEADLESS": "1"}
|
|
67
|
+
)
|
|
68
|
+
if result.returncode != 0:
|
|
69
|
+
raise RuntimeError(f"Claude Code failed: {result.stderr[:200]}")
|
|
70
|
+
return result.stdout.strip()
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def enhance_via_codex(seed, config=None):
|
|
74
|
+
"""Enhance via Codex CLI."""
|
|
75
|
+
binary = _find_binary(["codex"])
|
|
76
|
+
if not binary:
|
|
77
|
+
raise RuntimeError("Codex not found. Install: npm install -g @openai/codex")
|
|
78
|
+
|
|
79
|
+
prompt = ENHANCEMENT_PROMPT_TEMPLATE.format(seed=seed)
|
|
80
|
+
result = subprocess.run(
|
|
81
|
+
[binary, prompt],
|
|
82
|
+
capture_output=True, text=True, timeout=120,
|
|
83
|
+
env={**os.environ}
|
|
84
|
+
)
|
|
85
|
+
if result.returncode != 0:
|
|
86
|
+
raise RuntimeError(f"Codex failed: {result.stderr[:200]}")
|
|
87
|
+
return result.stdout.strip()
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def enhance_via_auggie(seed, config=None):
|
|
91
|
+
"""Enhance via Auggie (Augment)."""
|
|
92
|
+
binary = _find_binary(["auggie"])
|
|
93
|
+
if not binary:
|
|
94
|
+
raise RuntimeError("Auggie not found. Install: npm install -g @augmentcode/auggie")
|
|
95
|
+
|
|
96
|
+
prompt = ENHANCEMENT_PROMPT_TEMPLATE.format(seed=seed)
|
|
97
|
+
result = subprocess.run(
|
|
98
|
+
[binary, "--print", prompt],
|
|
99
|
+
capture_output=True, text=True, timeout=120,
|
|
100
|
+
env={**os.environ}
|
|
101
|
+
)
|
|
102
|
+
if result.returncode != 0:
|
|
103
|
+
raise RuntimeError(f"Auggie failed: {result.stderr[:200]}")
|
|
104
|
+
|
|
105
|
+
output = result.stdout.strip()
|
|
106
|
+
# Strip Auggie's thinking/exploration prefix
|
|
107
|
+
if "🤖" in output:
|
|
108
|
+
output = output.split("🤖")[-1].strip()
|
|
109
|
+
# Strip ANSI escape codes
|
|
110
|
+
import re
|
|
111
|
+
output = re.sub(r'\x1b\[[0-9;]*[a-zA-Z]', '', output)
|
|
112
|
+
return output
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
def enhance_via_opencode(seed, config=None):
|
|
116
|
+
"""Enhance via OpenCode."""
|
|
117
|
+
binary = _find_binary(["opencode"])
|
|
118
|
+
if not binary:
|
|
119
|
+
raise RuntimeError("OpenCode not found.")
|
|
120
|
+
|
|
121
|
+
prompt = ENHANCEMENT_PROMPT_TEMPLATE.format(seed=seed)
|
|
122
|
+
result = subprocess.run(
|
|
123
|
+
[binary, "--print", prompt],
|
|
124
|
+
capture_output=True, text=True, timeout=120,
|
|
125
|
+
env={**os.environ}
|
|
126
|
+
)
|
|
127
|
+
if result.returncode != 0:
|
|
128
|
+
raise RuntimeError(f"OpenCode failed: {result.stderr[:200]}")
|
|
129
|
+
return result.stdout.strip()
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
# Map agent names to enhancers
|
|
133
|
+
AGENT_ENHANCERS = {
|
|
134
|
+
"claude": enhance_via_claude,
|
|
135
|
+
"codex": enhance_via_codex,
|
|
136
|
+
"auggie": enhance_via_auggie,
|
|
137
|
+
"opencode": enhance_via_opencode,
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
# Invocation recipes for running an arbitrary prompt through an agent CLI.
|
|
142
|
+
# Used by the blind-judge path so the benchmark judge can differ from the generator.
|
|
143
|
+
AGENT_INVOKERS = {
|
|
144
|
+
"claude": {"binary": "claude", "args": ["-p"], "env": {"CLAUDE_CODE_HEADLESS": "1"}},
|
|
145
|
+
"codex": {"binary": "codex", "args": [], "env": {}},
|
|
146
|
+
"auggie": {"binary": "auggie", "args": ["--print"], "env": {}},
|
|
147
|
+
"opencode": {"binary": "opencode", "args": ["--print"], "env": {}},
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
def run_via_agent(prompt, via_agent, timeout=180):
|
|
152
|
+
"""Run a raw prompt through an agent CLI and return its stdout.
|
|
153
|
+
|
|
154
|
+
Unlike enhance_via_*, this passes the prompt verbatim — no enhancement
|
|
155
|
+
template wrapping. Used for blind judging in `pe benchmark --judge-via`.
|
|
156
|
+
"""
|
|
157
|
+
recipe = AGENT_INVOKERS.get(via_agent)
|
|
158
|
+
if not recipe:
|
|
159
|
+
raise RuntimeError(f"Unknown agent: {via_agent}. Supported: {', '.join(AGENT_INVOKERS.keys())}")
|
|
160
|
+
binary = _find_binary([recipe["binary"]])
|
|
161
|
+
if not binary:
|
|
162
|
+
raise RuntimeError(f"{via_agent} not found on PATH")
|
|
163
|
+
result = subprocess.run(
|
|
164
|
+
[binary, *recipe["args"], prompt],
|
|
165
|
+
capture_output=True, text=True, timeout=timeout,
|
|
166
|
+
env={**os.environ, **recipe["env"]},
|
|
167
|
+
)
|
|
168
|
+
if result.returncode != 0:
|
|
169
|
+
raise RuntimeError(f"{via_agent} failed: {result.stderr[:200]}")
|
|
170
|
+
output = result.stdout.strip()
|
|
171
|
+
if via_agent == "auggie":
|
|
172
|
+
if "🤖" in output:
|
|
173
|
+
output = output.split("🤖")[-1].strip()
|
|
174
|
+
import re
|
|
175
|
+
output = re.sub(r'\x1b\[[0-9;]*[a-zA-Z]', '', output)
|
|
176
|
+
return output
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
def enhance(seed, via_agent=None, config=None):
|
|
180
|
+
"""Enhance a seed prompt. If via_agent is set, delegate to that agent.
|
|
181
|
+
Otherwise, use the API key (legacy path).
|
|
182
|
+
"""
|
|
183
|
+
if via_agent:
|
|
184
|
+
enhancer = AGENT_ENHANCERS.get(via_agent)
|
|
185
|
+
if not enhancer:
|
|
186
|
+
raise RuntimeError(f"Unknown agent: {via_agent}. Supported: {', '.join(AGENT_ENHANCERS.keys())}")
|
|
187
|
+
return enhancer(seed, config)
|
|
188
|
+
|
|
189
|
+
# Fall through to API-key mode — caller must handle
|
|
190
|
+
raise RuntimeError("No enhancement method available. Use --via <agent> or set LLM_API_KEY.")
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
def get_available_agents():
|
|
194
|
+
"""Return list of agents with available binaries."""
|
|
195
|
+
available = []
|
|
196
|
+
for agent, enhancer in AGENT_ENHANCERS.items():
|
|
197
|
+
try:
|
|
198
|
+
binary = _find_binary([agent])
|
|
199
|
+
if binary:
|
|
200
|
+
available.append((agent, binary, "ready"))
|
|
201
|
+
else:
|
|
202
|
+
available.append((agent, None, "not found"))
|
|
203
|
+
except Exception:
|
|
204
|
+
available.append((agent, None, "error"))
|
|
205
|
+
return available
|