manicure 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.
- manicure-0.1.0/.gitignore +50 -0
- manicure-0.1.0/LICENSE +190 -0
- manicure-0.1.0/PKG-INFO +86 -0
- manicure-0.1.0/README.md +54 -0
- manicure-0.1.0/pyproject.toml +169 -0
- manicure-0.1.0/src/manicure/__init__.py +21 -0
- manicure-0.1.0/src/manicure/__main__.py +15 -0
- manicure-0.1.0/src/manicure/_version.py +24 -0
- manicure-0.1.0/src/manicure/adapters/__init__.py +27 -0
- manicure-0.1.0/src/manicure/adapters/anthropic.py +506 -0
- manicure-0.1.0/src/manicure/adapters/base.py +40 -0
- manicure-0.1.0/src/manicure/adapters/test_anthropic.py +338 -0
- manicure-0.1.0/src/manicure/addon.py +436 -0
- manicure-0.1.0/src/manicure/api/__init__.py +0 -0
- manicure-0.1.0/src/manicure/api/v1/__init__.py +0 -0
- manicure-0.1.0/src/manicure/api/v1/breakpoint_routes.py +104 -0
- manicure-0.1.0/src/manicure/api/v1/exchanges.py +49 -0
- manicure-0.1.0/src/manicure/api/v1/router.py +11 -0
- manicure-0.1.0/src/manicure/api/v1/rules.py +87 -0
- manicure-0.1.0/src/manicure/api/v1/stream.py +29 -0
- manicure-0.1.0/src/manicure/api/v1/test_breakpoint.py +139 -0
- manicure-0.1.0/src/manicure/api/v1/test_exchanges.py +157 -0
- manicure-0.1.0/src/manicure/api/v1/test_rules.py +101 -0
- manicure-0.1.0/src/manicure/breakpoint.py +99 -0
- manicure-0.1.0/src/manicure/broadcast.py +30 -0
- manicure-0.1.0/src/manicure/cli.py +521 -0
- manicure-0.1.0/src/manicure/config.py +35 -0
- manicure-0.1.0/src/manicure/exceptions.py +11 -0
- manicure-0.1.0/src/manicure/ir.py +176 -0
- manicure-0.1.0/src/manicure/logging.py +23 -0
- manicure-0.1.0/src/manicure/main.py +97 -0
- manicure-0.1.0/src/manicure/pipeline.py +112 -0
- manicure-0.1.0/src/manicure/rules.py +322 -0
- manicure-0.1.0/src/manicure/storage/__init__.py +53 -0
- manicure-0.1.0/src/manicure/storage/base.py +132 -0
- manicure-0.1.0/src/manicure/storage/disk.py +216 -0
- manicure-0.1.0/src/manicure/storage/test_disk.py +231 -0
- manicure-0.1.0/src/manicure/test_addon_phases.py +322 -0
- manicure-0.1.0/src/manicure/test_breakpoint.py +148 -0
- manicure-0.1.0/src/manicure/test_broadcast.py +33 -0
- manicure-0.1.0/src/manicure/test_cli.py +370 -0
- manicure-0.1.0/src/manicure/test_ir.py +154 -0
- manicure-0.1.0/src/manicure/test_pipeline.py +134 -0
- manicure-0.1.0/src/manicure/test_rules.py +208 -0
- manicure-0.1.0/src/manicure/www/assets/index-BXyMZWg7.css +2 -0
- manicure-0.1.0/src/manicure/www/assets/index-CONHSDM2.js +10 -0
- manicure-0.1.0/src/manicure/www/index.html +17 -0
- manicure-0.1.0/tests/__init__.py +0 -0
- manicure-0.1.0/tests/integration/__init__.py +0 -0
- manicure-0.1.0/tests/integration/test_health.py +7 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.egg-info/
|
|
6
|
+
build/
|
|
7
|
+
dist/
|
|
8
|
+
wheels/
|
|
9
|
+
|
|
10
|
+
# Virtual environments
|
|
11
|
+
.venv/
|
|
12
|
+
|
|
13
|
+
# IDE
|
|
14
|
+
.vscode/
|
|
15
|
+
.idea/
|
|
16
|
+
*.swp
|
|
17
|
+
*.swo
|
|
18
|
+
|
|
19
|
+
# FMM
|
|
20
|
+
.fmm.db
|
|
21
|
+
.fmm.db-shm
|
|
22
|
+
.fmm.db-wal
|
|
23
|
+
|
|
24
|
+
# Vite build output (served by the Python addon)
|
|
25
|
+
api/src/manicure/www/
|
|
26
|
+
|
|
27
|
+
# hatch-vcs generated version file
|
|
28
|
+
api/src/manicure/_version.py
|
|
29
|
+
|
|
30
|
+
# Testing
|
|
31
|
+
.pytest_cache/
|
|
32
|
+
.coverage
|
|
33
|
+
htmlcov/
|
|
34
|
+
|
|
35
|
+
# Linting / Type checking
|
|
36
|
+
.ruff_cache/
|
|
37
|
+
.mypy_cache/
|
|
38
|
+
|
|
39
|
+
# Environment
|
|
40
|
+
.env
|
|
41
|
+
|
|
42
|
+
# Database
|
|
43
|
+
*.db
|
|
44
|
+
|
|
45
|
+
# OS
|
|
46
|
+
.DS_Store
|
|
47
|
+
Thumbs.db
|
|
48
|
+
|
|
49
|
+
# Nancy
|
|
50
|
+
.nancy/
|
manicure-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
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 Support. While redistributing the Work or
|
|
166
|
+
Derivative Works thereof, You may choose to offer, and charge a
|
|
167
|
+
fee for, 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,
|
|
172
|
+
and hold each Contributor harmless for any liability incurred by,
|
|
173
|
+
or claims asserted against, such Contributor by reason of your
|
|
174
|
+
accepting any such warranty or support.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
Copyright 2026 Stuart Robinson
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|
manicure-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: manicure
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Provider-neutral context control plane for coding agents
|
|
5
|
+
Project-URL: Homepage, https://github.com/srobinson/manicure
|
|
6
|
+
Project-URL: Repository, https://github.com/srobinson/manicure
|
|
7
|
+
Project-URL: Issues, https://github.com/srobinson/manicure/issues
|
|
8
|
+
Project-URL: Changelog, https://github.com/srobinson/manicure/releases
|
|
9
|
+
Author-email: Stuart Robinson <stuart@alphab.io>
|
|
10
|
+
License-Expression: Apache-2.0
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: anthropic,claude,coding-agents,context,debugging,inspector,llm,mitmproxy,proxy
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Topic :: Internet :: Proxy Servers
|
|
21
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
22
|
+
Classifier: Topic :: Software Development :: Debuggers
|
|
23
|
+
Classifier: Typing :: Typed
|
|
24
|
+
Requires-Python: >=3.12
|
|
25
|
+
Requires-Dist: aiofiles>=24.0
|
|
26
|
+
Requires-Dist: fastapi[standard]>=0.115.0
|
|
27
|
+
Requires-Dist: httpx>=0.28
|
|
28
|
+
Requires-Dist: mitmproxy<13,>=12.2
|
|
29
|
+
Requires-Dist: pydantic-settings>=2.6
|
|
30
|
+
Requires-Dist: typer>=0.15
|
|
31
|
+
Description-Content-Type: text/markdown
|
|
32
|
+
|
|
33
|
+
# manicure
|
|
34
|
+
|
|
35
|
+
> **mani**fest + **cur**at**e**. Care for the cargo your coding agent carries.
|
|
36
|
+
|
|
37
|
+
A provider-neutral context control plane for coding agents. Sits as a reverse proxy in front of Claude, captures every `/v1/messages` exchange, normalises payloads into an internal representation, runs them through a deterministic curation pipeline, and optionally pauses for manual editing in a schema-aware editor.
|
|
38
|
+
|
|
39
|
+
No cert install. No system proxy settings. No sudo.
|
|
40
|
+
|
|
41
|
+
## Install
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
uv tool install manicure # recommended
|
|
45
|
+
pipx install manicure # alternative
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Or via the bootstrap script (installs uv first if missing):
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
curl -fsSL https://github.com/srobinson/manicure/releases/latest/download/install.sh | bash
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Quick start
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
# Start the workbench (proxy + web UI)
|
|
58
|
+
manicure start
|
|
59
|
+
|
|
60
|
+
# In another terminal, point your coding agent at it
|
|
61
|
+
ANTHROPIC_BASE_URL=http://localhost:8787 claude
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Open `http://localhost:8788` to see the live log, the rules UI, and the breakpoint editor.
|
|
65
|
+
|
|
66
|
+
## What it does
|
|
67
|
+
|
|
68
|
+
Every `/v1/messages` request your agent sends gets:
|
|
69
|
+
|
|
70
|
+
1. **Captured** — full request and response, logged to `~/.manicure/exchanges/`.
|
|
71
|
+
2. **Curated** — a deterministic pipeline applies your rules (strip tools, truncate system parts, rewrite descriptions, drop thinking blocks).
|
|
72
|
+
3. **Paused** (optional) — arm the breakpoint to edit the next request in a schema-aware editor before it forwards upstream.
|
|
73
|
+
|
|
74
|
+
All visible in a web UI at `http://localhost:8788`.
|
|
75
|
+
|
|
76
|
+
## Why
|
|
77
|
+
|
|
78
|
+
A single Claude Code session routinely sends 285 KB payloads: 147 tools, 3 system parts, 5 message turns. Tools alone account for 67% of that. Manicure gives you visibility into what's being sent, a pipeline to strip and rewrite it, and a breakpoint to intervene before it hits the API.
|
|
79
|
+
|
|
80
|
+
## Documentation
|
|
81
|
+
|
|
82
|
+
Full docs, architecture, and contributing guide: <https://github.com/srobinson/manicure>
|
|
83
|
+
|
|
84
|
+
## License
|
|
85
|
+
|
|
86
|
+
Apache 2.0. See [LICENSE](LICENSE).
|
manicure-0.1.0/README.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# manicure
|
|
2
|
+
|
|
3
|
+
> **mani**fest + **cur**at**e**. Care for the cargo your coding agent carries.
|
|
4
|
+
|
|
5
|
+
A provider-neutral context control plane for coding agents. Sits as a reverse proxy in front of Claude, captures every `/v1/messages` exchange, normalises payloads into an internal representation, runs them through a deterministic curation pipeline, and optionally pauses for manual editing in a schema-aware editor.
|
|
6
|
+
|
|
7
|
+
No cert install. No system proxy settings. No sudo.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
uv tool install manicure # recommended
|
|
13
|
+
pipx install manicure # alternative
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Or via the bootstrap script (installs uv first if missing):
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
curl -fsSL https://github.com/srobinson/manicure/releases/latest/download/install.sh | bash
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Quick start
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# Start the workbench (proxy + web UI)
|
|
26
|
+
manicure start
|
|
27
|
+
|
|
28
|
+
# In another terminal, point your coding agent at it
|
|
29
|
+
ANTHROPIC_BASE_URL=http://localhost:8787 claude
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Open `http://localhost:8788` to see the live log, the rules UI, and the breakpoint editor.
|
|
33
|
+
|
|
34
|
+
## What it does
|
|
35
|
+
|
|
36
|
+
Every `/v1/messages` request your agent sends gets:
|
|
37
|
+
|
|
38
|
+
1. **Captured** — full request and response, logged to `~/.manicure/exchanges/`.
|
|
39
|
+
2. **Curated** — a deterministic pipeline applies your rules (strip tools, truncate system parts, rewrite descriptions, drop thinking blocks).
|
|
40
|
+
3. **Paused** (optional) — arm the breakpoint to edit the next request in a schema-aware editor before it forwards upstream.
|
|
41
|
+
|
|
42
|
+
All visible in a web UI at `http://localhost:8788`.
|
|
43
|
+
|
|
44
|
+
## Why
|
|
45
|
+
|
|
46
|
+
A single Claude Code session routinely sends 285 KB payloads: 147 tools, 3 system parts, 5 message turns. Tools alone account for 67% of that. Manicure gives you visibility into what's being sent, a pipeline to strip and rewrite it, and a breakpoint to intervene before it hits the API.
|
|
47
|
+
|
|
48
|
+
## Documentation
|
|
49
|
+
|
|
50
|
+
Full docs, architecture, and contributing guide: <https://github.com/srobinson/manicure>
|
|
51
|
+
|
|
52
|
+
## License
|
|
53
|
+
|
|
54
|
+
Apache 2.0. See [LICENSE](LICENSE).
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
#:schema https://json.schemastore.org/pyproject.json
|
|
2
|
+
|
|
3
|
+
[project]
|
|
4
|
+
name = "manicure"
|
|
5
|
+
dynamic = ["version"]
|
|
6
|
+
description = "Provider-neutral context control plane for coding agents"
|
|
7
|
+
readme = "README.md"
|
|
8
|
+
requires-python = ">=3.12"
|
|
9
|
+
license = "Apache-2.0"
|
|
10
|
+
license-files = ["LICENSE"]
|
|
11
|
+
authors = [
|
|
12
|
+
{ name = "Stuart Robinson", email = "stuart@alphab.io" },
|
|
13
|
+
]
|
|
14
|
+
keywords = [
|
|
15
|
+
"mitmproxy",
|
|
16
|
+
"llm",
|
|
17
|
+
"claude",
|
|
18
|
+
"anthropic",
|
|
19
|
+
"context",
|
|
20
|
+
"inspector",
|
|
21
|
+
"proxy",
|
|
22
|
+
"debugging",
|
|
23
|
+
"coding-agents",
|
|
24
|
+
]
|
|
25
|
+
classifiers = [
|
|
26
|
+
"Development Status :: 4 - Beta",
|
|
27
|
+
"Intended Audience :: Developers",
|
|
28
|
+
"Programming Language :: Python :: 3",
|
|
29
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
30
|
+
"Programming Language :: Python :: 3.12",
|
|
31
|
+
"Programming Language :: Python :: 3.13",
|
|
32
|
+
"Operating System :: OS Independent",
|
|
33
|
+
"Topic :: Software Development :: Debuggers",
|
|
34
|
+
"Topic :: Internet :: Proxy Servers",
|
|
35
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
36
|
+
"Typing :: Typed",
|
|
37
|
+
]
|
|
38
|
+
dependencies = [
|
|
39
|
+
"fastapi[standard]>=0.115.0",
|
|
40
|
+
"pydantic-settings>=2.6",
|
|
41
|
+
"httpx>=0.28",
|
|
42
|
+
"mitmproxy>=12.2,<13",
|
|
43
|
+
"aiofiles>=24.0",
|
|
44
|
+
"typer>=0.15",
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
[project.scripts]
|
|
48
|
+
manicure = "manicure.cli:main"
|
|
49
|
+
|
|
50
|
+
[project.urls]
|
|
51
|
+
Homepage = "https://github.com/srobinson/manicure"
|
|
52
|
+
Repository = "https://github.com/srobinson/manicure"
|
|
53
|
+
Issues = "https://github.com/srobinson/manicure/issues"
|
|
54
|
+
Changelog = "https://github.com/srobinson/manicure/releases"
|
|
55
|
+
|
|
56
|
+
[dependency-groups]
|
|
57
|
+
dev = [
|
|
58
|
+
"pytest>=8.0",
|
|
59
|
+
"pytest-asyncio>=1.0",
|
|
60
|
+
"pytest-cov>=6.0",
|
|
61
|
+
"ruff>=0.15",
|
|
62
|
+
"mypy>=1.14",
|
|
63
|
+
"pre-commit>=4.0",
|
|
64
|
+
"types-aiofiles>=25.1.0.20260409",
|
|
65
|
+
]
|
|
66
|
+
|
|
67
|
+
# ---- uv ----
|
|
68
|
+
# Mitmproxy 12.2.1 pins upper bounds that exclude every patched version of
|
|
69
|
+
# its own transitive deps:
|
|
70
|
+
#
|
|
71
|
+
# flask <=3.1.2 (CVE fixed in 3.1.3)
|
|
72
|
+
# tornado <=6.5.2 (CVEs fixed in 6.5.5)
|
|
73
|
+
# pyOpenSSL <=25.3.0 (CVEs fixed in 26.0.0)
|
|
74
|
+
#
|
|
75
|
+
# Mitmproxy's `main` branch has already relaxed the flask and tornado
|
|
76
|
+
# bounds; pyOpenSSL is still pinned upstream but 26.0.0 is a clean
|
|
77
|
+
# upgrade (no API removals, only a behavioural change to SNI callback
|
|
78
|
+
# exception handling). Overriding here closes the six Dependabot alerts
|
|
79
|
+
# against `api/uv.lock` ahead of the next mitmproxy release. Drop these
|
|
80
|
+
# entries once mitmproxy ships a release with relaxed pins.
|
|
81
|
+
[tool.uv]
|
|
82
|
+
override-dependencies = [
|
|
83
|
+
"tornado>=6.5.5",
|
|
84
|
+
"flask>=3.1.3",
|
|
85
|
+
"pyOpenSSL>=26.0.0",
|
|
86
|
+
]
|
|
87
|
+
|
|
88
|
+
[build-system]
|
|
89
|
+
requires = ["hatchling", "hatch-vcs"]
|
|
90
|
+
build-backend = "hatchling.build"
|
|
91
|
+
|
|
92
|
+
[tool.hatch.version]
|
|
93
|
+
source = "vcs"
|
|
94
|
+
raw-options = { root = "..", version_scheme = "no-guess-dev" }
|
|
95
|
+
|
|
96
|
+
[tool.hatch.build.hooks.vcs]
|
|
97
|
+
version-file = "src/manicure/_version.py"
|
|
98
|
+
|
|
99
|
+
[tool.hatch.build.targets.wheel]
|
|
100
|
+
packages = ["src/manicure"]
|
|
101
|
+
exclude = ["**/test_*.py"]
|
|
102
|
+
artifacts = ["src/manicure/_version.py", "src/manicure/www/**"]
|
|
103
|
+
|
|
104
|
+
[tool.hatch.build.targets.sdist]
|
|
105
|
+
only-include = ["src/manicure", "tests", "README.md", "LICENSE"]
|
|
106
|
+
artifacts = ["src/manicure/_version.py"]
|
|
107
|
+
|
|
108
|
+
# ---- Ruff ----
|
|
109
|
+
[tool.ruff]
|
|
110
|
+
target-version = "py312"
|
|
111
|
+
line-length = 88
|
|
112
|
+
|
|
113
|
+
[tool.ruff.lint]
|
|
114
|
+
select = [
|
|
115
|
+
"E", # pycodestyle errors
|
|
116
|
+
"W", # pycodestyle warnings
|
|
117
|
+
"F", # pyflakes
|
|
118
|
+
"I", # isort
|
|
119
|
+
"UP", # pyupgrade
|
|
120
|
+
"B", # flake8-bugbear
|
|
121
|
+
"SIM", # flake8-simplify
|
|
122
|
+
"C4", # flake8-comprehensions
|
|
123
|
+
"RET", # flake8-return
|
|
124
|
+
"PTH", # flake8-use-pathlib
|
|
125
|
+
"TCH", # flake8-type-checking
|
|
126
|
+
]
|
|
127
|
+
ignore = [
|
|
128
|
+
"E501", # line too long (handled by formatter)
|
|
129
|
+
"B008", # function call in default arg (required by FastAPI Depends)
|
|
130
|
+
]
|
|
131
|
+
|
|
132
|
+
[tool.ruff.lint.per-file-ignores]
|
|
133
|
+
"tests/**/*.py" = [
|
|
134
|
+
"E402", # imports after os.environ setup in conftest
|
|
135
|
+
]
|
|
136
|
+
|
|
137
|
+
[tool.ruff.lint.isort]
|
|
138
|
+
known-first-party = ["manicure"]
|
|
139
|
+
|
|
140
|
+
[tool.ruff.lint.flake8-type-checking]
|
|
141
|
+
runtime-evaluated-base-classes = ["pydantic.BaseModel"]
|
|
142
|
+
|
|
143
|
+
[tool.ruff.format]
|
|
144
|
+
quote-style = "double"
|
|
145
|
+
indent-style = "space"
|
|
146
|
+
|
|
147
|
+
# ---- mypy ----
|
|
148
|
+
[tool.mypy]
|
|
149
|
+
python_version = "3.12"
|
|
150
|
+
strict = true
|
|
151
|
+
warn_return_any = true
|
|
152
|
+
warn_unused_configs = true
|
|
153
|
+
exclude = ["tests/", ".venv/"]
|
|
154
|
+
plugins = ["pydantic.mypy"]
|
|
155
|
+
|
|
156
|
+
# ---- pytest ----
|
|
157
|
+
[tool.pytest.ini_options]
|
|
158
|
+
testpaths = ["src", "tests"]
|
|
159
|
+
asyncio_mode = "auto"
|
|
160
|
+
addopts = "-v --tb=short"
|
|
161
|
+
|
|
162
|
+
# ---- coverage ----
|
|
163
|
+
[tool.coverage.run]
|
|
164
|
+
source = ["manicure"]
|
|
165
|
+
omit = ["*/test_*"]
|
|
166
|
+
|
|
167
|
+
[tool.coverage.report]
|
|
168
|
+
show_missing = true
|
|
169
|
+
fail_under = 80
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"""Manicure — provider-neutral context control plane for coding agents."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
# Version resolution order:
|
|
6
|
+
# 1. The file generated by hatch-vcs during `uv build` / `pip install` (always
|
|
7
|
+
# accurate for shipped artifacts, including editable installs).
|
|
8
|
+
# 2. Python package metadata (for environments where the file is missing but
|
|
9
|
+
# the package is installed through some other path).
|
|
10
|
+
# 3. A sentinel string so imports never crash during bare source checkouts.
|
|
11
|
+
try:
|
|
12
|
+
from ._version import __version__
|
|
13
|
+
except ImportError: # pragma: no cover — exercised only on pristine checkouts
|
|
14
|
+
try:
|
|
15
|
+
from importlib.metadata import PackageNotFoundError, version
|
|
16
|
+
|
|
17
|
+
__version__ = version("manicure")
|
|
18
|
+
except PackageNotFoundError:
|
|
19
|
+
__version__ = "0.0.0+unknown"
|
|
20
|
+
|
|
21
|
+
__all__ = ["__version__"]
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""Dev server entry point. Run with: uv run python -m manicure"""
|
|
2
|
+
|
|
3
|
+
import uvicorn
|
|
4
|
+
|
|
5
|
+
from manicure.config import get_settings
|
|
6
|
+
from manicure.main import LOG_CONFIG
|
|
7
|
+
|
|
8
|
+
settings = get_settings()
|
|
9
|
+
uvicorn.run(
|
|
10
|
+
"manicure.main:app",
|
|
11
|
+
host="127.0.0.1",
|
|
12
|
+
port=settings.web_port,
|
|
13
|
+
reload=True,
|
|
14
|
+
log_config=LOG_CONFIG,
|
|
15
|
+
)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# file generated by vcs-versioning
|
|
2
|
+
# don't change, don't track in version control
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
__all__ = [
|
|
6
|
+
"__version__",
|
|
7
|
+
"__version_tuple__",
|
|
8
|
+
"version",
|
|
9
|
+
"version_tuple",
|
|
10
|
+
"__commit_id__",
|
|
11
|
+
"commit_id",
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
version: str
|
|
15
|
+
__version__: str
|
|
16
|
+
__version_tuple__: tuple[int | str, ...]
|
|
17
|
+
version_tuple: tuple[int | str, ...]
|
|
18
|
+
commit_id: str | None
|
|
19
|
+
__commit_id__: str | None
|
|
20
|
+
|
|
21
|
+
__version__ = version = '0.1.0'
|
|
22
|
+
__version_tuple__ = version_tuple = (0, 1, 0)
|
|
23
|
+
|
|
24
|
+
__commit_id__ = commit_id = None
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"""Adapter registry.
|
|
2
|
+
|
|
3
|
+
Adapters are checked in registration order; the first whose
|
|
4
|
+
``matches(flow)`` returns True wins.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
from typing import Any # Any: mitmproxy flow object, untyped
|
|
10
|
+
|
|
11
|
+
from manicure.adapters.anthropic import AnthropicAdapter
|
|
12
|
+
from manicure.adapters.base import ProviderAdapter
|
|
13
|
+
|
|
14
|
+
_adapters: list[ProviderAdapter] = [
|
|
15
|
+
AnthropicAdapter(),
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def get_adapter(flow: Any) -> ProviderAdapter | None: # Any: mitmproxy flow object
|
|
20
|
+
"""Return the first adapter whose ``matches(flow)`` is True, or None."""
|
|
21
|
+
for adapter in _adapters:
|
|
22
|
+
if adapter.matches(flow):
|
|
23
|
+
return adapter
|
|
24
|
+
return None
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
__all__ = ["ProviderAdapter", "get_adapter"]
|