prpt 0.1.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.
- prpt-0.1.0/LICENSE +201 -0
- prpt-0.1.0/PKG-INFO +350 -0
- prpt-0.1.0/README.md +309 -0
- prpt-0.1.0/prpt/__init__.py +33 -0
- prpt-0.1.0/prpt/__main__.py +5 -0
- prpt-0.1.0/prpt/_subprocess.py +168 -0
- prpt-0.1.0/prpt/adapters/__init__.py +4 -0
- prpt-0.1.0/prpt/adapters/anthropic_adapter.py +246 -0
- prpt-0.1.0/prpt/adapters/echo.py +16 -0
- prpt-0.1.0/prpt/adapters/factory.py +40 -0
- prpt-0.1.0/prpt/adapters/openai_adapter.py +72 -0
- prpt-0.1.0/prpt/adapters/shell.py +209 -0
- prpt-0.1.0/prpt/cli.py +664 -0
- prpt-0.1.0/prpt/compress/__init__.py +4 -0
- prpt-0.1.0/prpt/compress/tool_output.py +725 -0
- prpt-0.1.0/prpt/core/__init__.py +11 -0
- prpt-0.1.0/prpt/core/constants.py +89 -0
- prpt-0.1.0/prpt/core/dotenv.py +63 -0
- prpt-0.1.0/prpt/core/spec.py +93 -0
- prpt-0.1.0/prpt/core/types.py +88 -0
- prpt-0.1.0/prpt/core/utils.py +133 -0
- prpt-0.1.0/prpt/handoff.py +260 -0
- prpt-0.1.0/prpt/hooks/__init__.py +0 -0
- prpt-0.1.0/prpt/hooks/optimize_prompt.py +129 -0
- prpt-0.1.0/prpt/judges/__init__.py +28 -0
- prpt-0.1.0/prpt/judges/judge.py +447 -0
- prpt-0.1.0/prpt/judges/slm.py +91 -0
- prpt-0.1.0/prpt/normalizers/__init__.py +13 -0
- prpt-0.1.0/prpt/normalizers/base.py +333 -0
- prpt-0.1.0/prpt/normalizers/heuristic.py +210 -0
- prpt-0.1.0/prpt/normalizers/slm_anthropic.py +476 -0
- prpt-0.1.0/prpt/normalizers/slm_openai.py +278 -0
- prpt-0.1.0/prpt/normalizers/slm_openai_v2.py +185 -0
- prpt-0.1.0/prpt/normalizers/slm_subscription.py +310 -0
- prpt-0.1.0/prpt/repo/__init__.py +4 -0
- prpt-0.1.0/prpt/repo/collector.py +81 -0
- prpt-0.1.0/prpt/repo/loader.py +619 -0
- prpt-0.1.0/prpt/session.py +138 -0
- prpt-0.1.0/prpt/stats.py +250 -0
- prpt-0.1.0/prpt/ui.py +233 -0
- prpt-0.1.0/prpt.egg-info/PKG-INFO +350 -0
- prpt-0.1.0/prpt.egg-info/SOURCES.txt +54 -0
- prpt-0.1.0/prpt.egg-info/dependency_links.txt +1 -0
- prpt-0.1.0/prpt.egg-info/entry_points.txt +2 -0
- prpt-0.1.0/prpt.egg-info/requires.txt +23 -0
- prpt-0.1.0/prpt.egg-info/top_level.txt +1 -0
- prpt-0.1.0/pyproject.toml +50 -0
- prpt-0.1.0/setup.cfg +4 -0
- prpt-0.1.0/tests/test_adapters.py +765 -0
- prpt-0.1.0/tests/test_cli.py +408 -0
- prpt-0.1.0/tests/test_compress.py +723 -0
- prpt-0.1.0/tests/test_heuristic.py +157 -0
- prpt-0.1.0/tests/test_loader.py +910 -0
- prpt-0.1.0/tests/test_slm.py +750 -0
- prpt-0.1.0/tests/test_smoke_chain.py +213 -0
- prpt-0.1.0/tests/test_stats.py +168 -0
prpt-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for describing the origin of the Work and
|
|
141
|
+
reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may accept and charge a
|
|
167
|
+
fee for the acceptance of support, warranty, indemnity, or other
|
|
168
|
+
liability obligations and/or rights consistent with this License.
|
|
169
|
+
However, in accepting such obligations, You may act only on Your
|
|
170
|
+
own behalf and on Your sole responsibility, not on behalf of any
|
|
171
|
+
other Contributor, and only if You agree to indemnify, defend, and
|
|
172
|
+
hold each Contributor harmless for any liability incurred by, or
|
|
173
|
+
claims asserted against, such Contributor by reason of your accepting
|
|
174
|
+
any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 PromptPilot contributors
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
prpt-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: prpt
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: PromptPilot — prompt-optimizing wrapper for AI coding CLIs; uses a cheap SLM to reduce token consumption on expensive models
|
|
5
|
+
Author: PromptPilot contributors
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/steyangdot/PromptPilot
|
|
8
|
+
Project-URL: Issues, https://github.com/steyangdot/PromptPilot/issues
|
|
9
|
+
Project-URL: Repository, https://github.com/steyangdot/PromptPilot
|
|
10
|
+
Keywords: llm,prompt-optimization,token-savings,claude,openai,codex
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
20
|
+
Requires-Python: >=3.9
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Provides-Extra: claude
|
|
24
|
+
Requires-Dist: anthropic>=0.39.0; extra == "claude"
|
|
25
|
+
Provides-Extra: codex
|
|
26
|
+
Requires-Dist: openai>=1.0.0; extra == "codex"
|
|
27
|
+
Requires-Dist: tiktoken>=0.7.0; extra == "codex"
|
|
28
|
+
Provides-Extra: anthropic
|
|
29
|
+
Requires-Dist: anthropic>=0.39.0; extra == "anthropic"
|
|
30
|
+
Provides-Extra: openai
|
|
31
|
+
Requires-Dist: openai>=1.0.0; extra == "openai"
|
|
32
|
+
Requires-Dist: tiktoken>=0.7.0; extra == "openai"
|
|
33
|
+
Provides-Extra: all
|
|
34
|
+
Requires-Dist: anthropic>=0.39.0; extra == "all"
|
|
35
|
+
Requires-Dist: openai>=1.0.0; extra == "all"
|
|
36
|
+
Requires-Dist: tiktoken>=0.7.0; extra == "all"
|
|
37
|
+
Provides-Extra: dev
|
|
38
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
39
|
+
Requires-Dist: pytest-cov>=4.0; extra == "dev"
|
|
40
|
+
Dynamic: license-file
|
|
41
|
+
|
|
42
|
+
# PromptPilot
|
|
43
|
+
|
|
44
|
+
Prompt-optimizing wrapper for AI coding CLIs. Uses a cheap SLM (Claude Haiku or GPT-4o-mini) to rewrite developer prompts before they hit expensive models, reducing token consumption.
|
|
45
|
+
|
|
46
|
+
> **First-time user?** Start with **[QUICKSTART.md](QUICKSTART.md)** — five-minute onboarding covering install, auth, and the `handoff.md` workflow.
|
|
47
|
+
|
|
48
|
+
## Install
|
|
49
|
+
|
|
50
|
+
Pick the extra that matches your coding agent:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
pip install prpt[claude] # for use with claude-code (Claude Haiku SLM)
|
|
54
|
+
pip install prpt[codex] # for use with codex (GPT-4o-mini SLM)
|
|
55
|
+
pip install prpt[all] # both
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
`[anthropic]` / `[openai]` are kept as aliases for backward compatibility.
|
|
59
|
+
|
|
60
|
+
## Auth: which path to pick
|
|
61
|
+
|
|
62
|
+
**Recommended for Max/Pro users:** `claude auth login --claudeai`. PromptPilot
|
|
63
|
+
auto-detects the OAuth session and routes the SLM via the official `claude`
|
|
64
|
+
CLI subprocess. No API key needed, no incremental charges — calls bill against
|
|
65
|
+
your subscription's monthly quota (which Anthropic doubled for Pro/Max in
|
|
66
|
+
2026).
|
|
67
|
+
|
|
68
|
+
**Alternative:** drop `ANTHROPIC_API_KEY` (or `OPENAI_API_KEY`) into `.env`.
|
|
69
|
+
The SDK paths run faster (~1-2s/call vs ~5-7s for subprocess) and use prompt
|
|
70
|
+
caching. Billed per-call against your API credits.
|
|
71
|
+
|
|
72
|
+
### Compliance posture (worth understanding before relying on subscription routing)
|
|
73
|
+
|
|
74
|
+
Anthropic clarified on **Feb 20, 2026** that subscription OAuth credentials are
|
|
75
|
+
"intended exclusively to support ordinary use of Claude Code and other native
|
|
76
|
+
Anthropic applications." On **Apr 4, 2026**, technical enforcement landed
|
|
77
|
+
against third-party tools (OpenClaw, OpenCode, etc.) that extracted OAuth
|
|
78
|
+
tokens and made direct API calls while spoofing Claude Code's request shape.
|
|
79
|
+
|
|
80
|
+
**PromptPilot is structurally different from those tools:**
|
|
81
|
+
|
|
82
|
+
| Axis | OpenClaw / OpenCode | PromptPilot |
|
|
83
|
+
|---|---|---|
|
|
84
|
+
| OAuth token handling | Read `~/.claude/.credentials.json`, sent bearer directly | Never touches the token; official `claude` binary owns it |
|
|
85
|
+
| API endpoint | Direct calls to `api.anthropic.com/v1/messages` | No direct API calls — the binary makes them |
|
|
86
|
+
| Request shape | Spoofed Claude Code's headers, system prompt, tool defs | The real `claude` binary builds the request |
|
|
87
|
+
| Client identity | Client *replacement* impersonating Claude Code | Single local user invoking their own CLI as a child process |
|
|
88
|
+
| Fan-out | Shared service across many accounts | Runs locally with the user's own logged-in CLI |
|
|
89
|
+
|
|
90
|
+
When PromptPilot calls `claude -p`, Anthropic's server logs see a request from the
|
|
91
|
+
real `claude` binary with the real user-agent and request shape — because
|
|
92
|
+
that's what made the call. The literal token-clause prohibition does not apply.
|
|
93
|
+
|
|
94
|
+
**What's still interpretive:** the Feb 20 ToS phrase "ordinary use of Claude
|
|
95
|
+
Code" is broader than the token clause. Whether driving `claude -p` from a
|
|
96
|
+
programmatic loop counts as "ordinary use" depends on Anthropic's
|
|
97
|
+
interpretation. Interactive single-shot use is clearly ordinary; high-volume
|
|
98
|
+
batched chain runs are harder to characterize. The risk is much lower than
|
|
99
|
+
the OpenClaw pattern but not zero.
|
|
100
|
+
|
|
101
|
+
A separate monthly credit pool for Agent SDK / `claude -p` is expected
|
|
102
|
+
**Jun 15, 2026**, which may formalize programmatic subscription use under a
|
|
103
|
+
sanctioned billing model. This note will be updated then.
|
|
104
|
+
|
|
105
|
+
### On the codex / OpenAI side
|
|
106
|
+
|
|
107
|
+
`CodexCliJudge` is the symmetric path for users with a ChatGPT subscription
|
|
108
|
+
(`codex login`). Auto-detected after Max OAuth in the priority order
|
|
109
|
+
`max > codex > anthropic > openai`. Same compliance posture as MaxHaikuJudge:
|
|
110
|
+
we invoke the official `codex` binary; the OAuth token stays inside the
|
|
111
|
+
codex process.
|
|
112
|
+
|
|
113
|
+
Two operational caveats specific to codex:
|
|
114
|
+
1. **Heavier per-call overhead.** ~20k input tokens of subscription quota per
|
|
115
|
+
call due to the agent-loop spin-up (~6.5k of which are cached) — vs
|
|
116
|
+
MaxHaikuJudge's lighter `claude -p --model haiku` path. Suitable for
|
|
117
|
+
light SLM use within quota; not great for high-volume chain experiments.
|
|
118
|
+
2. **Model name follows the codex naming scheme.** ChatGPT-auth codex
|
|
119
|
+
accepts current-gen names like `gpt-5.4-mini`, `gpt-5.4`, `gpt-5.3-codex`,
|
|
120
|
+
`gpt-5.2` (and the unspecified default `gpt-5.5`). Legacy names like
|
|
121
|
+
`gpt-4o-mini` return a 400. The judge defaults to `gpt-5.4-mini` — the
|
|
122
|
+
smallest SLM-tier model available on ChatGPT-subscription auth. Override
|
|
123
|
+
via the constructor if you have an `OPENAI_API_KEY` backing codex (no
|
|
124
|
+
such restriction applies on API-keyed codex).
|
|
125
|
+
|
|
126
|
+
`OPENAI_API_KEY` remains the supported per-call API path for codex users
|
|
127
|
+
who want predictable, cached, per-token billing — and is the cheapest path
|
|
128
|
+
overall (gpt-5.4-nano at $0.20/M input via SDK vs the ~19k-token subscription
|
|
129
|
+
quota burn per CodexCliJudge call).
|
|
130
|
+
|
|
131
|
+
## Pick a setup
|
|
132
|
+
|
|
133
|
+
PromptPilot supports four auth paths. Any one of them works on its own — you do
|
|
134
|
+
**not** need to set up multiple. The list is in rough order of how much setup
|
|
135
|
+
work they involve.
|
|
136
|
+
|
|
137
|
+
### 1. Max subscription only (Claude users)
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
claude auth login --claudeai
|
|
141
|
+
prpt "fix the flaky test in payments"
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
No API key, no `.env` editing. SLM routes via `MaxHaikuJudge` (`claude -p
|
|
145
|
+
--model haiku --tools ""` subprocess); LLM routes via `claude` CLI. Both bill
|
|
146
|
+
against your Max subscription quota; zero incremental $.
|
|
147
|
+
|
|
148
|
+
### 2. ChatGPT subscription only (Codex users)
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
codex login
|
|
152
|
+
prpt --tool codex "fix the flaky test in payments"
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
SLM routes via `CodexCliJudge` (`codex exec -m gpt-5.4-mini` subprocess); LLM
|
|
156
|
+
routes via `codex` CLI. Both bill against your ChatGPT subscription. Caveat:
|
|
157
|
+
each SLM call consumes ~19k tokens of subscription quota due to codex's
|
|
158
|
+
agent-loop overhead — fine for interactive use, heavy for chain experiments.
|
|
159
|
+
See "Advanced: hybrid" below if this becomes a quota concern.
|
|
160
|
+
|
|
161
|
+
### 3. API key only
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
echo 'ANTHROPIC_API_KEY=sk-ant-...' >> .env # Claude users
|
|
165
|
+
# or
|
|
166
|
+
echo 'OPENAI_API_KEY=sk-proj-...' >> .env # Codex users
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Fully supported, fastest per-call (~1-2s SDK round-trips), prompt caching
|
|
170
|
+
active. Bills against API credits per call. Use this if you don't have a
|
|
171
|
+
relevant subscription or want predictable per-call billing.
|
|
172
|
+
|
|
173
|
+
### 4. Advanced: hybrid auth (API SLM + subscription LLM)
|
|
174
|
+
|
|
175
|
+
**Optional optimization.** If you have *both* a subscription *and* a
|
|
176
|
+
matching API key, you can route the cheap SLM work through the API and the
|
|
177
|
+
expensive LLM work through the subscription. This is the most
|
|
178
|
+
cost-efficient configuration but requires both auths to be set up.
|
|
179
|
+
|
|
180
|
+
#### Hybrid for codex / ChatGPT users
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
# .env:
|
|
184
|
+
OPENAI_API_KEY=sk-proj-...
|
|
185
|
+
|
|
186
|
+
# Plus:
|
|
187
|
+
codex login
|
|
188
|
+
|
|
189
|
+
# Invocation (the --normalizer slm-openai flag is required to force the SDK path):
|
|
190
|
+
prpt --normalizer slm-openai --tool codex "fix the flaky test in payments"
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
- **SLM normalizer** → `OPENAI_API_KEY` via SDK + `gpt-5.4-nano` ($0.20/M
|
|
194
|
+
input, $1.25/M output). Each rewrite call ~$0.0001-0.0003. Fast,
|
|
195
|
+
prompt-cached.
|
|
196
|
+
- **Downstream agent** → ChatGPT subscription via `codex exec`. Free
|
|
197
|
+
incremental.
|
|
198
|
+
|
|
199
|
+
The big win over codex-subscription-for-everything: codex inflates every SLM
|
|
200
|
+
call to ~19k input tokens (agent-loop overhead). At gpt-5.4-mini's $0.75/M
|
|
201
|
+
input rate inside codex that's $0.015 real-$ equivalent / call (or 30% of
|
|
202
|
+
GPT-5.4 quota on the subscription side). The SDK path sends only ~400
|
|
203
|
+
tokens. Same SLM work, ~100× cheaper per call. Plus nano is 3.6–3.75×
|
|
204
|
+
cheaper than mini per token.
|
|
205
|
+
|
|
206
|
+
#### Hybrid for claude-code / Max users
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
# .env:
|
|
210
|
+
ANTHROPIC_API_KEY=sk-ant-...
|
|
211
|
+
|
|
212
|
+
# Plus:
|
|
213
|
+
claude auth login --claudeai
|
|
214
|
+
|
|
215
|
+
# Invocation:
|
|
216
|
+
prpt --normalizer slm-anthropic --tool claude-code "fix the flaky test in payments"
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
- **SLM normalizer** → `ANTHROPIC_API_KEY` via SDK + Haiku. ~$0.001/call.
|
|
220
|
+
Fast, prompt-cached.
|
|
221
|
+
- **Downstream agent** → claude-code via Max OAuth subscription. Free
|
|
222
|
+
incremental.
|
|
223
|
+
|
|
224
|
+
The gain is smaller than the codex case — `MaxHaikuJudge`'s subprocess uses
|
|
225
|
+
`--tools ""` which strips the agent loop, so it's ~20× more expensive than
|
|
226
|
+
SDK Haiku per call (not 100× like codex). Still a real win: SDK is faster
|
|
227
|
+
(~4s vs ~7s) and prompt caching is active. **Bonus:** moves the SLM layer
|
|
228
|
+
to a fully-supported API path, leaving only the LLM layer in the
|
|
229
|
+
subscription-routing gray zone discussed above.
|
|
230
|
+
|
|
231
|
+
#### When hybrid is worth setting up
|
|
232
|
+
|
|
233
|
+
- You're running high-volume work (chain tests, long sessions, batched edits)
|
|
234
|
+
where per-call overhead compounds
|
|
235
|
+
- You already have an API key from your provider account (often included
|
|
236
|
+
with codex/ChatGPT or Anthropic developer accounts)
|
|
237
|
+
- You want SLM walltime to stay sub-2-seconds per call
|
|
238
|
+
- You want to reduce subscription-routing surface area (claude case)
|
|
239
|
+
|
|
240
|
+
#### When standalone subscription is fine
|
|
241
|
+
|
|
242
|
+
- Light interactive use (a handful of calls per session)
|
|
243
|
+
- You don't want to manage an API key in `.env`
|
|
244
|
+
- Your subscription quota is comfortably larger than your usage
|
|
245
|
+
|
|
246
|
+
The auto-detect order is **`max > codex > anthropic > openai`** — a fallback
|
|
247
|
+
priority, not a setup requirement. You pick which auth(s) to configure; the
|
|
248
|
+
auto-detect chooses among what's available.
|
|
249
|
+
|
|
250
|
+
## Usage
|
|
251
|
+
|
|
252
|
+
```bash
|
|
253
|
+
prpt --dry-run "fix flaky test in payments"
|
|
254
|
+
prpt --normalizer slm --dry-run "refactor auth, no API changes"
|
|
255
|
+
prpt --normalizer slm --tool anthropic "add dark mode"
|
|
256
|
+
prpt --theme dark --dry-run "add dark mode"
|
|
257
|
+
prpt install-hook # wire into Claude Code as a UserPromptSubmit hook
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
With `--normalizer slm-openai-v2`, the SLM can route prompts to **clarify**
|
|
261
|
+
(ask a question and exit), **passthrough** (run the raw prompt unmodified),
|
|
262
|
+
or **answer** (respond directly without invoking the agent) instead of the
|
|
263
|
+
default **act** path. See `promptpilot/core/spec.py` for the routing schema.
|
|
264
|
+
|
|
265
|
+
## Tool-output compression
|
|
266
|
+
|
|
267
|
+
PromptPilot ships a `PostToolUse` hook that intercepts `Bash` tool responses
|
|
268
|
+
and shrinks them before the LLM sees them. Targets the dominant token-bleed
|
|
269
|
+
in agent sessions: pytest tracebacks, grep floods, deep `find` results,
|
|
270
|
+
verbose `git diff`, linter spew, installer logs. The compressor is
|
|
271
|
+
command-type-aware ([promptpilot/compress/tool_output.py](promptpilot/compress/tool_output.py)).
|
|
272
|
+
|
|
273
|
+
**Install for Claude Code:**
|
|
274
|
+
|
|
275
|
+
Add a hooks block to your project-level `.claude/settings.json` (or global
|
|
276
|
+
`~/.claude/settings.json`):
|
|
277
|
+
|
|
278
|
+
```json
|
|
279
|
+
{
|
|
280
|
+
"hooks": {
|
|
281
|
+
"PostToolUse": [{
|
|
282
|
+
"matcher": "Bash",
|
|
283
|
+
"hooks": [{
|
|
284
|
+
"type": "command",
|
|
285
|
+
"command": "python /path/to/PromptPilot/.claude/hooks/compress_tool_output.py",
|
|
286
|
+
"timeout": 10
|
|
287
|
+
}]
|
|
288
|
+
}]
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
**Install for codex:**
|
|
294
|
+
|
|
295
|
+
codex picks up `.codex/hooks.json` automatically when run inside a PromptPilot
|
|
296
|
+
checkout. No manual wiring needed.
|
|
297
|
+
|
|
298
|
+
**Telemetry:**
|
|
299
|
+
|
|
300
|
+
Each compression event is appended to `~/.promptpilot/compress_stats.jsonl`
|
|
301
|
+
(disable with `PROMPTPILOT_COMPRESS_LOG_DISABLE=1`). Surface aggregate stats
|
|
302
|
+
with:
|
|
303
|
+
|
|
304
|
+
```bash
|
|
305
|
+
prpt stats # includes "--- Tool-output compression ---" section
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
**Kill switch:**
|
|
309
|
+
|
|
310
|
+
```bash
|
|
311
|
+
PROMPTPILOT_COMPRESS_DISABLE=1 claude # bypass compression for this session
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
## License
|
|
315
|
+
|
|
316
|
+
PromptPilot is licensed under the [Apache License 2.0](LICENSE).
|
|
317
|
+
|
|
318
|
+
PromptPilot wraps multiple LLM vendors' tools (Claude, Codex, OpenAI) in an
|
|
319
|
+
area where patent claims are unsettled, and the explicit patent grant in
|
|
320
|
+
Apache §3 protects both users and contributors. It keeps every permissive
|
|
321
|
+
freedom MIT offers (commercial use, modification, redistribution) and adds a
|
|
322
|
+
patent grant plus a termination clause that discourages frivolous patent
|
|
323
|
+
litigation. For a control-plane tool meant to slot into other people's
|
|
324
|
+
production setups, that protection felt like the wrong corner to cut.
|
|
325
|
+
|
|
326
|
+
### License FAQ
|
|
327
|
+
|
|
328
|
+
**Why not MIT?**
|
|
329
|
+
MIT is simpler and works for most projects, but has no patent provision.
|
|
330
|
+
Apache 2.0 explicitly grants patent rights from every contributor (§3) and
|
|
331
|
+
terminates the license for anyone who sues for patent infringement — useful
|
|
332
|
+
insurance when the legal landscape around LLM tooling is still moving.
|
|
333
|
+
|
|
334
|
+
**Can I use this commercially?**
|
|
335
|
+
Yes. Commercial use, modification, private use, and redistribution are all
|
|
336
|
+
allowed. No royalties, no copyleft. You don't owe anything back.
|
|
337
|
+
|
|
338
|
+
**What are my obligations if I redistribute it?**
|
|
339
|
+
Keep the `LICENSE` file with the copy, note any files you modified, and
|
|
340
|
+
preserve the `NOTICE` file's contents (when one exists). That's it. No
|
|
341
|
+
share-alike requirement.
|
|
342
|
+
|
|
343
|
+
**Can I fork and rename?**
|
|
344
|
+
Yes, but you can't use "PromptPilot" or related marks to imply your fork is
|
|
345
|
+
the official project (§6 trademark clause). Pick a new name for
|
|
346
|
+
substantially-changed forks.
|
|
347
|
+
|
|
348
|
+
Contributions are accepted under the same license per Apache 2.0 §5 — by
|
|
349
|
+
opening a PR you agree your work is contributed under Apache 2.0 unless
|
|
350
|
+
explicitly stated otherwise.
|