runpeek 0.1.0a1__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.
- runpeek-0.1.0a1/LICENSE +201 -0
- runpeek-0.1.0a1/NOTICE +22 -0
- runpeek-0.1.0a1/PKG-INFO +349 -0
- runpeek-0.1.0a1/README.md +316 -0
- runpeek-0.1.0a1/pyproject.toml +71 -0
- runpeek-0.1.0a1/setup.cfg +4 -0
- runpeek-0.1.0a1/src/runpeek/__init__.py +26 -0
- runpeek-0.1.0a1/src/runpeek/_boot/sitecustomize.py +45 -0
- runpeek-0.1.0a1/src/runpeek/accounting.py +358 -0
- runpeek-0.1.0a1/src/runpeek/agents/__init__.py +31 -0
- runpeek-0.1.0a1/src/runpeek/agents/claude_code.py +272 -0
- runpeek-0.1.0a1/src/runpeek/agents/diagnostics.py +377 -0
- runpeek-0.1.0a1/src/runpeek/agents/events.py +92 -0
- runpeek-0.1.0a1/src/runpeek/agents/ingest.py +387 -0
- runpeek-0.1.0a1/src/runpeek/agents/report.py +370 -0
- runpeek-0.1.0a1/src/runpeek/agents/watch.py +376 -0
- runpeek-0.1.0a1/src/runpeek/bootstrap.py +71 -0
- runpeek-0.1.0a1/src/runpeek/cli.py +506 -0
- runpeek-0.1.0a1/src/runpeek/context.py +179 -0
- runpeek-0.1.0a1/src/runpeek/ids.py +48 -0
- runpeek-0.1.0a1/src/runpeek/instrumentation/__init__.py +19 -0
- runpeek-0.1.0a1/src/runpeek/instrumentation/openai_chat.py +271 -0
- runpeek-0.1.0a1/src/runpeek/money.py +53 -0
- runpeek-0.1.0a1/src/runpeek/perspective.py +48 -0
- runpeek-0.1.0a1/src/runpeek/py.typed +0 -0
- runpeek-0.1.0a1/src/runpeek/rates/anthropic-list@2026-09-09.json +54 -0
- runpeek-0.1.0a1/src/runpeek/rates/openai-list@2025-08-01.json +35 -0
- runpeek-0.1.0a1/src/runpeek/rates/openai-list@2026-09-09.json +99 -0
- runpeek-0.1.0a1/src/runpeek/rates.py +175 -0
- runpeek-0.1.0a1/src/runpeek/schema.sql +279 -0
- runpeek-0.1.0a1/src/runpeek/store.py +409 -0
- runpeek-0.1.0a1/src/runpeek/summary.py +477 -0
- runpeek-0.1.0a1/src/runpeek/ui.py +141 -0
- runpeek-0.1.0a1/src/runpeek.egg-info/PKG-INFO +349 -0
- runpeek-0.1.0a1/src/runpeek.egg-info/SOURCES.txt +50 -0
- runpeek-0.1.0a1/src/runpeek.egg-info/dependency_links.txt +1 -0
- runpeek-0.1.0a1/src/runpeek.egg-info/entry_points.txt +2 -0
- runpeek-0.1.0a1/src/runpeek.egg-info/requires.txt +7 -0
- runpeek-0.1.0a1/src/runpeek.egg-info/top_level.txt +1 -0
- runpeek-0.1.0a1/tests/test_accounting.py +141 -0
- runpeek-0.1.0a1/tests/test_agent_cli.py +81 -0
- runpeek-0.1.0a1/tests/test_agent_diagnostics.py +176 -0
- runpeek-0.1.0a1/tests/test_agent_ingest.py +313 -0
- runpeek-0.1.0a1/tests/test_cli.py +192 -0
- runpeek-0.1.0a1/tests/test_context.py +96 -0
- runpeek-0.1.0a1/tests/test_migration.py +71 -0
- runpeek-0.1.0a1/tests/test_money.py +34 -0
- runpeek-0.1.0a1/tests/test_openai_chat.py +192 -0
- runpeek-0.1.0a1/tests/test_rates_history.py +70 -0
- runpeek-0.1.0a1/tests/test_store.py +93 -0
- runpeek-0.1.0a1/tests/test_summary.py +86 -0
- runpeek-0.1.0a1/tests/test_ux.py +356 -0
runpeek-0.1.0a1/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 reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and 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 choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting 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 [yyyy] [name of copyright owner]
|
|
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.
|
runpeek-0.1.0a1/NOTICE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
RunPeek by NemulAI
|
|
2
|
+
Copyright 2026 NemulAI
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
|
|
16
|
+
Third-party components
|
|
17
|
+
----------------------
|
|
18
|
+
RunPeek's runtime has no third-party dependencies. The development extras
|
|
19
|
+
(openai, httpx, pytest, ruff, mypy) are used only for tests and the offline
|
|
20
|
+
example and are not redistributed with this package. The shipped rate cards
|
|
21
|
+
contain publicly published list prices transcribed from the providers'
|
|
22
|
+
pricing pages; they are data, not code, and carry the retrieval date.
|
runpeek-0.1.0a1/PKG-INFO
ADDED
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: runpeek
|
|
3
|
+
Version: 0.1.0a1
|
|
4
|
+
Summary: RunPeek by NemulAI — see where your AI spends time and tokens. Local-first observability for supported AI applications and Claude Code sessions.
|
|
5
|
+
Author: NemulAI
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Project-URL: Repository, https://github.com/AgentMulder404/runpeek
|
|
8
|
+
Project-URL: Changelog, https://github.com/AgentMulder404/runpeek/blob/main/CHANGELOG.md
|
|
9
|
+
Project-URL: Security, https://github.com/AgentMulder404/runpeek/blob/main/SECURITY.md
|
|
10
|
+
Keywords: observability,llm,openai,claude-code,tokens,cost,local-first
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Topic :: Software Development :: Debuggers
|
|
21
|
+
Classifier: Topic :: System :: Monitoring
|
|
22
|
+
Requires-Python: >=3.10
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
License-File: NOTICE
|
|
26
|
+
Provides-Extra: dev
|
|
27
|
+
Requires-Dist: pytest>=8; extra == "dev"
|
|
28
|
+
Requires-Dist: openai==2.44.0; extra == "dev"
|
|
29
|
+
Requires-Dist: httpx>=0.28; extra == "dev"
|
|
30
|
+
Requires-Dist: ruff>=0.6; extra == "dev"
|
|
31
|
+
Requires-Dist: mypy>=1.11; extra == "dev"
|
|
32
|
+
Dynamic: license-file
|
|
33
|
+
|
|
34
|
+
# RunPeek
|
|
35
|
+
### by NemulAI
|
|
36
|
+
|
|
37
|
+
See where your AI spends time and tokens.
|
|
38
|
+
|
|
39
|
+
Watch supported AI workloads locally, understand estimated costs,
|
|
40
|
+
and spot repeated failures and repeated work worth reviewing.
|
|
41
|
+
|
|
42
|
+
RunPeek watches two things: the OpenAI Python SDK calls your own application
|
|
43
|
+
makes (`runpeek run`), and the Claude Code sessions in a project
|
|
44
|
+
(`runpeek watch`). It helps you answer *which customer or job caused these
|
|
45
|
+
model calls*, *what did they consume*, *what would that cost at list prices*,
|
|
46
|
+
and *where did the agent repeat itself*. Collection and analysis run entirely
|
|
47
|
+
on your machine — no account, no service, no uploads, no runtime dependencies.
|
|
48
|
+
|
|
49
|
+
**Sample output** (rendered from a test fixture, not a real session):
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
05:03 REPEATED READ
|
|
53
|
+
package.json was read 4 times in 2 minutes.
|
|
54
|
+
No edit to that file was observed between reads.
|
|
55
|
+
Repeated billing cannot be determined.
|
|
56
|
+
|
|
57
|
+
Evidence: runpeek session 719c4032
|
|
58
|
+
|
|
59
|
+
05:04 REPEATED FAILURE
|
|
60
|
+
A python3 command failed 4 times consecutively over 46 seconds.
|
|
61
|
+
No edit or write was observed between the failures.
|
|
62
|
+
Check the error before repeating the command.
|
|
63
|
+
|
|
64
|
+
Evidence: runpeek session 719c4032
|
|
65
|
+
|
|
66
|
+
05:04 TURN FINISHED
|
|
67
|
+
51 seconds · 8 tool calls (4 failed) · 8 model calls
|
|
68
|
+
API-equivalent estimate: $0.115
|
|
69
|
+
2 potential inefficiencies to review · runpeek session 719c4032
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Install
|
|
73
|
+
|
|
74
|
+
RunPeek is not on PyPI yet. Install from a checkout (the repository below is
|
|
75
|
+
the intended public location; until it is published, clone your local copy):
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
git clone https://github.com/AgentMulder404/runpeek.git && cd runpeek
|
|
79
|
+
python -m venv .venv && . .venv/bin/activate
|
|
80
|
+
pip install -e . # runtime: no dependencies
|
|
81
|
+
pip install -e ".[dev]" # adds the openai SDK, httpx, pytest, ruff, mypy — needed for the offline demo and tests
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Python 3.10+.
|
|
85
|
+
|
|
86
|
+
## Quickstart A — watch Claude Code
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
runpeek watch --project /path/to/project
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Keep using Claude Code normally in that project. The watcher first loads
|
|
93
|
+
recent history (transcripts modified in the last 7 days; `--history all` or
|
|
94
|
+
`--history none`) and summarises any historical findings without replaying
|
|
95
|
+
them as live events. Then it prints only meaningful events: new sessions,
|
|
96
|
+
turns starting and finishing, potential inefficiencies, and collection
|
|
97
|
+
problems. Ctrl-C stops the watcher; your Claude session keeps running.
|
|
98
|
+
|
|
99
|
+
Review afterwards:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
runpeek sessions --project /path/to/project # started, tool calls, errors, model calls, items to review
|
|
103
|
+
runpeek findings --project /path/to/project # potential inefficiencies, newest first
|
|
104
|
+
runpeek session <session-id> # one session: activity, items with evidence, usage and estimate
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
`--project` defaults to the current directory; `--all-projects` covers every
|
|
108
|
+
project Claude Code has transcripts for. If the filter finds nothing, RunPeek
|
|
109
|
+
says so and names the projects it has collected.
|
|
110
|
+
|
|
111
|
+
The Claude Code transcript adapter is **experimental**: it reads
|
|
112
|
+
`~/.claude/projects/<project>/*.jsonl` (and `…/<session>/subagents/*.jsonl`),
|
|
113
|
+
whose format is undocumented. It was built against transcripts written by
|
|
114
|
+
Claude Code 2.1.x (CLI 2.1.258 verified) and marks other writer versions as
|
|
115
|
+
`unknown_version`, parsed best-effort.
|
|
116
|
+
|
|
117
|
+
## Quickstart B — observe a Python AI application
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
export OPENAI_API_KEY=… # your application's own credentials; RunPeek never reads or stores them
|
|
121
|
+
runpeek run python app.py
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Optionally attribute calls from inside your code:
|
|
125
|
+
|
|
126
|
+
```python
|
|
127
|
+
import runpeek
|
|
128
|
+
|
|
129
|
+
with runpeek.job(customer="acme", job="support_ticket"):
|
|
130
|
+
client.chat.completions.create(...) # observed and attributed
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Nested `job()` inherits `customer`; calls outside any `job()` are recorded as
|
|
134
|
+
"No customer tag" — a real row with a real estimate, not a missing one.
|
|
135
|
+
Context follows `await` and `asyncio.create_task`; for threads use
|
|
136
|
+
`runpeek.wrap(fn)`, across processes `runpeek.inject()` / `runpeek.extract()`.
|
|
137
|
+
|
|
138
|
+
When the application exits, RunPeek prints a summary. Later:
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
runpeek summary # latest run (add --verbose for the full accounting ledger)
|
|
142
|
+
runpeek events --last 20 # per-call detail
|
|
143
|
+
runpeek export --format jsonl --out run.jsonl
|
|
144
|
+
runpeek reprice --pin openai-list@2026-09-09 # price under a separate pinned perspective
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
**Supported SDK surface:** `openai` Python SDK, `client.chat.completions.create`,
|
|
148
|
+
synchronous, non-streaming — tested against `openai==2.44.0`. Streaming calls
|
|
149
|
+
are recorded as observed-but-unmeasured (`stream=True`, no usage); `AsyncOpenAI`,
|
|
150
|
+
the Responses API and other providers are not patched. `runpeek run` works for
|
|
151
|
+
commands that start a CPython interpreter which processes `site` and inherits
|
|
152
|
+
the environment (`python script.py` is tested; `-S`/`-I` and embedded
|
|
153
|
+
interpreters are not covered). If you cannot use `runpeek run`, call
|
|
154
|
+
`runpeek.install()` before importing the provider client.
|
|
155
|
+
|
|
156
|
+
### Offline demo (no provider account)
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
runpeek run python examples/basic.py
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
`examples/basic.py` drives the real `openai` client through a local mock
|
|
163
|
+
transport: three customers, an unknown model, a rate-limit error and a
|
|
164
|
+
timeout. It needs the `[dev]` extras; the RunPeek runtime itself has no
|
|
165
|
+
dependencies.
|
|
166
|
+
|
|
167
|
+
**Sample output** (from that demo):
|
|
168
|
+
|
|
169
|
+
```
|
|
170
|
+
RUNPEEK / RUN COMPLETE
|
|
171
|
+
|
|
172
|
+
python examples/basic.py
|
|
173
|
+
Application exited successfully · telemetry saved
|
|
174
|
+
|
|
175
|
+
8 model calls observed
|
|
176
|
+
6 completed · 2 failed
|
|
177
|
+
|
|
178
|
+
$0.016052 known estimated API cost
|
|
179
|
+
5 of 8 calls priced — total is incomplete
|
|
180
|
+
|
|
181
|
+
CUSTOMER ESTIMATED COST UNPRICED / UNKNOWN
|
|
182
|
+
acme $0.01486 0
|
|
183
|
+
globex $0.00084 1
|
|
184
|
+
No customer tag $0.000352 0
|
|
185
|
+
initech — 2
|
|
186
|
+
|
|
187
|
+
Missing from this estimate:
|
|
188
|
+
• 1 call used a model with no known price (acme-preview-1)
|
|
189
|
+
• 2 failed calls returned no usage
|
|
190
|
+
|
|
191
|
+
Estimate at list prices — not verified provider billing.
|
|
192
|
+
|
|
193
|
+
Stored locally · nothing uploaded
|
|
194
|
+
Details: runpeek events · Full accounting: runpeek summary --verbose
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
## What RunPeek helps you find
|
|
198
|
+
|
|
199
|
+
- Which customer or job the model calls belonged to, and what they consumed.
|
|
200
|
+
- Calls that could not be priced (unknown model) or measured (errors,
|
|
201
|
+
streaming, missing usage) — shown beside the estimate, never folded into it.
|
|
202
|
+
- In Claude Code sessions: the same command failing again and again with no
|
|
203
|
+
edit between attempts; the same file read repeatedly without an observed
|
|
204
|
+
edit; a tool erroring across many different inputs; one action looping
|
|
205
|
+
tightly. Each is a *potential* inefficiency — repetition is worth reviewing,
|
|
206
|
+
not proof of waste — with its evidence, a next step, and the limitation
|
|
207
|
+
needed to read it correctly.
|
|
208
|
+
|
|
209
|
+
## How it works
|
|
210
|
+
|
|
211
|
+
RunPeek is not a model, an agent framework, or a gateway. It does not run
|
|
212
|
+
your prompts and needs no LLM or cloud account of its own. Its diagnostics
|
|
213
|
+
are deterministic local analysis of what a supported source already records:
|
|
214
|
+
the SDK's usage block, or the transcript Claude Code writes.
|
|
215
|
+
|
|
216
|
+
```
|
|
217
|
+
Python app ──► openai SDK ──► provider Claude Code ──► ~/.claude/projects/<proj>/*.jsonl
|
|
218
|
+
│ runpeek run: one patched method, │ runpeek watch: read-only polling,
|
|
219
|
+
│ exactly-once call, fail-open hooks │ checkpoints, no duplicates
|
|
220
|
+
▼ ▼
|
|
221
|
+
operations · attempts · observations sessions · turns · tool calls · usage
|
|
222
|
+
└────────────► SQLite ./.runpeek/runpeek.db ◄────────────────┘
|
|
223
|
+
accounting: charges → dated rate cards → estimates
|
|
224
|
+
diagnostics: repeated failure · repeated read · retry loop
|
|
225
|
+
runpeek summary · events · export runpeek sessions · session · findings
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
More in [`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md) and the full design in
|
|
229
|
+
[`docs/DESIGN.md`](docs/DESIGN.md).
|
|
230
|
+
|
|
231
|
+
## Supported integrations
|
|
232
|
+
|
|
233
|
+
| Integration | Status | Notes |
|
|
234
|
+
|---|---|---|
|
|
235
|
+
| OpenAI Python SDK — `chat.completions.create`, sync, non-streaming | **Supported, tested** | `openai==2.44.0`; exactly-once, fail-open |
|
|
236
|
+
| OpenAI — streaming | Observed, not measured | recorded as `unsupported_stream`, no usage, no cost |
|
|
237
|
+
| OpenAI — `AsyncOpenAI`, Responses API | Not supported | not patched; invisible |
|
|
238
|
+
| Claude Code transcripts (2.1.x) | **Supported, experimental** | undocumented format; version-gated adapter |
|
|
239
|
+
| Claude Code source-reported cost | Not available | only in Claude Code's OpenTelemetry export, which RunPeek does not consume |
|
|
240
|
+
| Codex | Not supported | capability check and adapter path in [`docs/AGENT_SOURCES.md`](docs/AGENT_SOURCES.md) |
|
|
241
|
+
| Other providers, raw HTTP, other languages | Not supported | |
|
|
242
|
+
| Dashboards, outcome tracking, run comparison, GPU accounting | Not built | see roadmap |
|
|
243
|
+
|
|
244
|
+
## What the numbers mean
|
|
245
|
+
|
|
246
|
+
- **Tokens** are reported by the source — the SDK's usage block, or the usage
|
|
247
|
+
Claude Code writes into its transcripts — not independently audited.
|
|
248
|
+
- **Estimated cost** is a calculation from those tokens and a dated list-price
|
|
249
|
+
table ([`docs/PRICING.md`](docs/PRICING.md)). It is *not* your subscription
|
|
250
|
+
charge, quota usage, a reconciled bill, or a saving. For Claude Code it is
|
|
251
|
+
labelled "API-equivalent estimate" every time it appears.
|
|
252
|
+
- **Unknown stays unknown.** A call with no usage, an unknown model, an error
|
|
253
|
+
or a timeout is counted and shown as unpriced or unknown, never as `$0`.
|
|
254
|
+
- **Capture coverage** — how much AI activity RunPeek did not see — is not
|
|
255
|
+
measurable without an independent source. A run with no observations says
|
|
256
|
+
"this does not mean none happened".
|
|
257
|
+
- **Findings are potential inefficiencies.** A repeated read shows a file was
|
|
258
|
+
requested again; whether its contents were billed again is not observable.
|
|
259
|
+
Only Edit/Write tool calls count as an observed change; command side effects
|
|
260
|
+
and edits outside the agent are invisible.
|
|
261
|
+
- **Historical vs live.** The watcher summarises history at startup and marks
|
|
262
|
+
live events with their transcript timestamps; silence is never treated as a
|
|
263
|
+
stalled agent.
|
|
264
|
+
- **Supported calls only.** RunPeek watches the surfaces listed above, not
|
|
265
|
+
every AI tool on your machine.
|
|
266
|
+
|
|
267
|
+
## Privacy and local storage
|
|
268
|
+
|
|
269
|
+
Everything lives in `./.runpeek/runpeek.db` (override: `--db`, `RUNPEEK_DB`),
|
|
270
|
+
created `0600`. Stored: ids, timestamps, tool names, relative paths / program
|
|
271
|
+
names / hostnames, token counts, model names, labels you set, and keyed
|
|
272
|
+
fingerprints of tool arguments. Never stored: prompts, completions, tool
|
|
273
|
+
inputs or outputs, commands, file contents, credentials. `runpeek export`
|
|
274
|
+
writes the stored tables as JSONL with exact monetary values. Details and the
|
|
275
|
+
fingerprint caveats: [`docs/PRIVACY.md`](docs/PRIVACY.md).
|
|
276
|
+
|
|
277
|
+
## Known limitations
|
|
278
|
+
|
|
279
|
+
- One SDK surface and one agent source; see the matrix above.
|
|
280
|
+
- Claude Code transcript format is undocumented; a future Claude Code release
|
|
281
|
+
may change it. Affected sessions are marked, not silently misread.
|
|
282
|
+
- Turn durations come from the transcript's own end-of-turn record; subagent
|
|
283
|
+
transcripts have none, so their turns show no duration.
|
|
284
|
+
- The recorded command line for `runpeek run` is redacted heuristically
|
|
285
|
+
(inline programs, secret-looking values, URLs, payloads); it is not a
|
|
286
|
+
guarantee.
|
|
287
|
+
- No benchmarks are published yet; performance targets in `docs/DESIGN.md`
|
|
288
|
+
are targets.
|
|
289
|
+
- The real-provider smoke test (`examples/real_openai.py`) has not been run by
|
|
290
|
+
the maintainers; it needs your own key and costs a fraction of a cent. Nothing
|
|
291
|
+
in the test suite validates actual provider billing: mocked calls exercise the
|
|
292
|
+
accounting, and rate cards are dated transcriptions of list prices.
|
|
293
|
+
|
|
294
|
+
## Development and tests
|
|
295
|
+
|
|
296
|
+
```bash
|
|
297
|
+
pip install -e ".[dev]"
|
|
298
|
+
pytest # offline; real openai SDK over httpx.MockTransport
|
|
299
|
+
ruff check src tests examples
|
|
300
|
+
mypy # strict
|
|
301
|
+
python -m build # sdist + wheel
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
The test suite covers exactly-once and fail-open hooks, fractional-cent
|
|
305
|
+
pricing, cached/reasoning token handling, identity and correlation, idempotent
|
|
306
|
+
estimates and repricing, bounded queue and shutdown, transcript ingestion
|
|
307
|
+
(partial lines, truncation, rotation, restarts, concurrent sessions),
|
|
308
|
+
diagnostics true/false positives, privacy of stored rows and exports, the
|
|
309
|
+
terminal policy, legacy-name migration, and every command the UI prints.
|
|
310
|
+
|
|
311
|
+
## Contributing
|
|
312
|
+
|
|
313
|
+
See [`CONTRIBUTING.md`](CONTRIBUTING.md). Please keep tests offline and keep
|
|
314
|
+
unknowns unknown. Security notes: [`SECURITY.md`](SECURITY.md).
|
|
315
|
+
|
|
316
|
+
## Roadmap (short, not a promise)
|
|
317
|
+
|
|
318
|
+
- Streaming usage (`stream_options.include_usage`) and async client support,
|
|
319
|
+
each behind its own tested gate.
|
|
320
|
+
- Outcomes (`runpeek.outcome()`), cost per successful task, and run-to-run
|
|
321
|
+
comparison with a strict comparability check.
|
|
322
|
+
- A Codex adapter once its session format or a documented interface is pinned.
|
|
323
|
+
- Optional OpenTelemetry receiver for Claude Code's source-reported cost.
|
|
324
|
+
|
|
325
|
+
## Migration from the NemulAI harness
|
|
326
|
+
|
|
327
|
+
Names changed; data did not. `runpeek` replaces `nemulai` for the CLI and
|
|
328
|
+
import; `RUNPEEK_*` replaces `NEMULAI_*` (legacy names still honoured); an
|
|
329
|
+
existing `./.nemulai/nemulai.db` is used in place with a notice. Details:
|
|
330
|
+
[`docs/MIGRATION.md`](docs/MIGRATION.md).
|
|
331
|
+
|
|
332
|
+
## Running the real-provider check yourself
|
|
333
|
+
|
|
334
|
+
`examples/real_openai.py` makes two tiny non-streaming calls and one streaming
|
|
335
|
+
call against a real model (about $0.0001). Provide your key to the shell only,
|
|
336
|
+
never to a chat or a file in the repository:
|
|
337
|
+
|
|
338
|
+
```bash
|
|
339
|
+
read -rs OPENAI_API_KEY && export OPENAI_API_KEY # typed silently
|
|
340
|
+
runpeek run python examples/real_openai.py
|
|
341
|
+
unset OPENAI_API_KEY
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
Expect three attempts (two priced, one `unsupported_stream`), one
|
|
345
|
+
"No customer tag" row, and `x-request-id` identifiers in `runpeek export`.
|
|
346
|
+
|
|
347
|
+
## License
|
|
348
|
+
|
|
349
|
+
Apache License 2.0 — see [`LICENSE`](LICENSE) and [`NOTICE`](NOTICE).
|