o11y-reflect 0.0.1__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.
Files changed (37) hide show
  1. o11y_reflect-0.0.1/CHANGELOG.md +53 -0
  2. o11y_reflect-0.0.1/LICENSE +190 -0
  3. o11y_reflect-0.0.1/MANIFEST.in +4 -0
  4. o11y_reflect-0.0.1/PKG-INFO +191 -0
  5. o11y_reflect-0.0.1/README.md +157 -0
  6. o11y_reflect-0.0.1/pyproject.toml +73 -0
  7. o11y_reflect-0.0.1/setup.cfg +4 -0
  8. o11y_reflect-0.0.1/src/o11y_reflect.egg-info/PKG-INFO +191 -0
  9. o11y_reflect-0.0.1/src/o11y_reflect.egg-info/SOURCES.txt +35 -0
  10. o11y_reflect-0.0.1/src/o11y_reflect.egg-info/dependency_links.txt +1 -0
  11. o11y_reflect-0.0.1/src/o11y_reflect.egg-info/entry_points.txt +2 -0
  12. o11y_reflect-0.0.1/src/o11y_reflect.egg-info/requires.txt +12 -0
  13. o11y_reflect-0.0.1/src/o11y_reflect.egg-info/top_level.txt +1 -0
  14. o11y_reflect-0.0.1/src/reflect/__init__.py +8 -0
  15. o11y_reflect-0.0.1/src/reflect/core.py +1464 -0
  16. o11y_reflect-0.0.1/src/reflect/dashboard.py +1417 -0
  17. o11y_reflect-0.0.1/src/reflect/data/demo-traces.json +13 -0
  18. o11y_reflect-0.0.1/src/reflect/data/index.html +5229 -0
  19. o11y_reflect-0.0.1/src/reflect/data/skills/reflect/SKILL.md +295 -0
  20. o11y_reflect-0.0.1/src/reflect/graph.py +211 -0
  21. o11y_reflect-0.0.1/src/reflect/insights.py +687 -0
  22. o11y_reflect-0.0.1/src/reflect/models.py +80 -0
  23. o11y_reflect-0.0.1/src/reflect/parsing.py +790 -0
  24. o11y_reflect-0.0.1/src/reflect/processing.py +613 -0
  25. o11y_reflect-0.0.1/src/reflect/report.py +421 -0
  26. o11y_reflect-0.0.1/src/reflect/terminal.py +600 -0
  27. o11y_reflect-0.0.1/src/reflect/utils.py +126 -0
  28. o11y_reflect-0.0.1/tests/test_analyze_telemetry.py +161 -0
  29. o11y_reflect-0.0.1/tests/test_calculations.py +198 -0
  30. o11y_reflect-0.0.1/tests/test_cli.py +395 -0
  31. o11y_reflect-0.0.1/tests/test_dashboard_json.py +383 -0
  32. o11y_reflect-0.0.1/tests/test_graph_analysis.py +256 -0
  33. o11y_reflect-0.0.1/tests/test_helpers.py +115 -0
  34. o11y_reflect-0.0.1/tests/test_parsing.py +165 -0
  35. o11y_reflect-0.0.1/tests/test_process_span.py +300 -0
  36. o11y_reflect-0.0.1/tests/test_skill_integration.py +47 -0
  37. o11y_reflect-0.0.1/tests/test_terminal_rendering.py +164 -0
@@ -0,0 +1,53 @@
1
+ # Changelog
2
+
3
+ ## 0.3.0 (unreleased)
4
+
5
+ ### Added
6
+ - Chat-style conversation UI in hosted dashboard (prompts/responses as bubbles, tool events as compact chips)
7
+ - Auto-load session detail on selection (no manual button click)
8
+ - Google Tag Manager analytics on all web assets
9
+ - `reflect update` command with package drift detection
10
+ - Ruff linting enforced in CI (lint job runs before test matrix)
11
+ - Coverage gate at 65% via pytest-cov
12
+ - `__all__` public API surface in `__init__.py`
13
+ - Compact stats bar replacing 4-card grid in conversation view
14
+
15
+ ### Fixed
16
+ - Mutable default argument bug in `_process_span` (shared `Counter` across calls)
17
+ - Double `webbrowser.open` on `--publish` (removed redundant call in `core.py`)
18
+ - Ruff violations (E731, E701, B007, SIM108, F841, W293) across codebase
19
+ - Replaced `print(file=sys.stderr)` with stdlib `logging` in library code
20
+
21
+ ### Changed
22
+ - PyPI publish workflow uses API token auth (`CD` environment) instead of OIDC trusted publishing
23
+ - Test workflow reusable via `workflow_call` trigger
24
+ - Playwright moved from `test` to separate `e2e` optional dependency group
25
+
26
+ ## 0.2.0
27
+
28
+ ### Added
29
+ - `--demo` flag for instant terminal dashboard with bundled sample data
30
+ - Apache-2.0 license
31
+ - GitHub Actions CI and PyPI publishing workflows
32
+ - Published to PyPI as `o11y-reflect`
33
+
34
+ ### Changed
35
+ - Package renamed from `reflect` to `o11y-reflect` for PyPI uniqueness (CLI command stays `reflect`)
36
+ - README rewritten for launch: hero promise, 3-step quickstart, support matrix
37
+
38
+ ## 0.1.0
39
+
40
+ ### Added
41
+ - Local-first CLI for AI coding agent telemetry analysis
42
+ - Terminal dashboard with Rich (token usage, tool efficiency, activity heatmaps, MCP tracking)
43
+ - Markdown report generation
44
+ - JSON dashboard artifact for hosted dashboards
45
+ - `--publish` flag to open hosted dashboard at reflect.o11y.dev
46
+ - `reflect setup` command: installs opentelemetry-hooks, wires agent configs, distributes skills
47
+ - `reflect doctor` command: agent discovery, telemetry status, recommendations
48
+ - Multi-agent support: Claude Code, GitHub Copilot, Gemini CLI, Cursor
49
+ - OTLP JSON trace parsing with rich session/log fallback adapters
50
+ - Subagent delegation tracking
51
+ - MCP server availability gap detection
52
+ - Tool failure rate analysis
53
+ - Token economy analysis (input, output, cache hits)
@@ -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 the 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 the 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 any 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
+ Copyright 2025 o11y.dev contributors
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.
@@ -0,0 +1,4 @@
1
+ include LICENSE
2
+ include CHANGELOG.md
3
+ include README.md
4
+ recursive-include src/reflect/data *.json *.md
@@ -0,0 +1,191 @@
1
+ Metadata-Version: 2.4
2
+ Name: o11y-reflect
3
+ Version: 0.0.1
4
+ Summary: See why your AI coding agents fail, stall, or burn budget — local-first telemetry for Claude, Copilot, Gemini, and Cursor
5
+ License-Expression: Apache-2.0
6
+ Project-URL: Homepage, https://o11y.dev
7
+ Project-URL: Repository, https://github.com/o11y-dev/reflect
8
+ Project-URL: Documentation, https://github.com/o11y-dev/reflect#readme
9
+ Project-URL: Issues, https://github.com/o11y-dev/reflect/issues
10
+ Project-URL: Changelog, https://github.com/o11y-dev/reflect/blob/main/CHANGELOG.md
11
+ Keywords: observability,opentelemetry,ai-agents,claude,copilot,gemini,telemetry
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Topic :: Software Development :: Quality Assurance
19
+ Classifier: Topic :: System :: Monitoring
20
+ Requires-Python: >=3.11
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Requires-Dist: click>=8.0
24
+ Requires-Dist: rich>=13.0
25
+ Requires-Dist: orjson>=3.0
26
+ Requires-Dist: fastapi>=0.100
27
+ Requires-Dist: uvicorn>=0.20
28
+ Provides-Extra: test
29
+ Requires-Dist: pytest>=7.0; extra == "test"
30
+ Requires-Dist: pytest-cov>=4.0; extra == "test"
31
+ Provides-Extra: e2e
32
+ Requires-Dist: playwright>=1.40; extra == "e2e"
33
+ Dynamic: license-file
34
+
35
+ # reflect
36
+
37
+ [![PyPI](https://img.shields.io/pypi/v/o11y-reflect)](https://pypi.org/project/o11y-reflect/)
38
+ [![Python](https://img.shields.io/pypi/pyversions/o11y-reflect)](https://pypi.org/project/o11y-reflect/)
39
+ [![License](https://img.shields.io/github/license/o11y-dev/reflect)](LICENSE)
40
+ [![CI](https://github.com/o11y-dev/reflect/actions/workflows/test.yml/badge.svg)](https://github.com/o11y-dev/reflect/actions/workflows/test.yml)
41
+
42
+ **See why your AI coding agents fail, stall, or burn budget.**
43
+
44
+ Local-first telemetry for Claude Code, GitHub Copilot, Gemini CLI, and Cursor. One install, real insight, no cloud required.
45
+
46
+ ## Quickstart
47
+
48
+ ```bash
49
+ pipx install o11y-reflect
50
+ reflect setup
51
+ # use your AI tool normally, then:
52
+ reflect
53
+ ```
54
+
55
+ That's it. `reflect setup` installs hooks, wires your agents, and starts capturing telemetry to `~/.reflect/state/`. `reflect` renders an interactive terminal dashboard.
56
+
57
+ **No telemetry yet?** Try the demo:
58
+
59
+ ```bash
60
+ reflect --demo
61
+ ```
62
+
63
+ ## What you get
64
+
65
+ - **Token economy** — input, output, cache hits, largest-session concentration
66
+ - **Tool efficiency** — failure rates, latency percentiles (p50/p90/p95/p99), tool-to-prompt ratio
67
+ - **Agent comparison** — side-by-side across Claude, Copilot, Gemini, Cursor
68
+ - **Model breakdown** — which models you're actually using and how much
69
+ - **MCP server tracking** — usage counts and availability gaps
70
+ - **Subagent patterns** — delegation frequency and types
71
+ - **Activity heatmaps** — by hour and day of week
72
+ - **Actionable recommendations** — based on your actual usage patterns
73
+
74
+ ## Output modes
75
+
76
+ ```bash
77
+ reflect # interactive terminal dashboard (default)
78
+ reflect --no-terminal # markdown report
79
+ reflect --dashboard-artifact out.json # JSON for hosted dashboards
80
+ reflect --publish # open hosted dashboard in browser
81
+ reflect --demo # instant demo with sample data
82
+ ```
83
+
84
+ ## Health check
85
+
86
+ ```bash
87
+ reflect doctor
88
+ reflect update
89
+ ```
90
+
91
+ `reflect doctor` includes an update advisor for package drift, live pipx drift, skill-copy drift, and hook wiring drift. `reflect update --apply` upgrades the pipx package when a newer release is available.
92
+
93
+ ## Supported agents
94
+
95
+ | Agent | Path | Confidence |
96
+ |---|---|---|
97
+ | Claude Code | Native logs + hooks | High |
98
+ | GitHub Copilot CLI | Native OTel + hooks | High |
99
+ | VS Code Copilot | Native OTel | High |
100
+ | Gemini CLI | Native OTel + hooks | High |
101
+ | Codex | Native OTel + hooks | Medium |
102
+ | Cursor | Session/log adapters | Medium |
103
+ | OpenCode | Hooks/plugin | Medium |
104
+
105
+ When hook spans and OTLP traces are absent, `reflect` falls back to rich local session stores:
106
+
107
+ - Cursor: `~/.cursor/projects/**/agent-transcripts/**/*.jsonl`
108
+ - Copilot: `~/.copilot/session-state/*/events.jsonl`
109
+ - Claude Code: `~/.claude/projects/**/*.jsonl`
110
+ - Gemini: `~/.gemini/tmp/**/chats/session-*.json`
111
+
112
+ ## Advanced usage
113
+
114
+ ### Direct OTLP traces
115
+
116
+ If you already have OTLP JSON traces from a collector, skip setup:
117
+
118
+ ```bash
119
+ reflect --otlp-traces path/to/otel-traces.json
120
+ ```
121
+
122
+ A sibling `otel-logs.json` file is used automatically for enrichment when present.
123
+
124
+ ### Hosted dashboard
125
+
126
+ Write a JSON artifact for GitHub Pages or a local server:
127
+
128
+ ```bash
129
+ reflect --dashboard-artifact docs/reports/latest.json --publish
130
+ ```
131
+
132
+ For a safe public example, this repo also ships a curated GitHub Pages demo:
133
+
134
+ - `https://reflect.o11y.dev/showcase.html`
135
+ - direct dashboard view: `https://reflect.o11y.dev/demo.html`
136
+
137
+ ### All options
138
+
139
+ ```
140
+ reflect [OPTIONS] [COMMAND]
141
+
142
+ Options:
143
+ --sessions-dir PATH Session metadata JSON directory
144
+ --spans-dir PATH Local span JSONL directory
145
+ --otlp-traces PATH OTLP JSON traces file
146
+ --output PATH Markdown report output path
147
+ --terminal / --no-terminal Terminal dashboard (default) or markdown report
148
+ --dashboard-artifact PATH Write dashboard JSON artifact
149
+ --publish Open dashboard in browser
150
+ --demo Run with bundled sample data
151
+ --help Show help
152
+
153
+ Commands:
154
+ setup Install hooks, wire agents, configure telemetry
155
+ doctor Check installation health and agent status
156
+ update Check release drift and optional package upgrade
157
+ ```
158
+
159
+ ## Data flow
160
+
161
+ ```
162
+ reflect setup
163
+ ├── installs opentelemetry-hooks
164
+ ├── wires agent configs (Claude, Copilot, Gemini)
165
+ ├── distributes skill packages
166
+ └── enables local span export to ~/.reflect/state/
167
+
168
+ Your AI tool → hooks capture spans → ~/.reflect/state/
169
+
170
+ reflect → reads traces → terminal dashboard / report / hosted view
171
+ ```
172
+
173
+ ## Skill package
174
+
175
+ `reflect` ships with a portable skill at `skills/reflect/SKILL.md` for Claude Code. After `reflect setup`, the `/reflect` skill is available in your AI tool for in-session telemetry analysis.
176
+
177
+ ## Analysis schema
178
+
179
+ See [`docs/ai-observability-schema.md`](docs/ai-observability-schema.md) for the canonical cross-tool analysis schema.
180
+
181
+ ## Part of o11y.dev
182
+
183
+ `reflect` is the entry point to the [o11y.dev](https://o11y.dev) ecosystem:
184
+
185
+ - **[opentelemetry-hooks](https://github.com/o11y-dev/opentelemetry-hooks)** — instrumentation engine for AI coding agents
186
+ - **[opentelemetry-skill](https://github.com/o11y-dev/opentelemetry-skill)** — observability knowledge layer for AI assistants
187
+ - **[gateway](https://github.com/o11y-dev/gateway)** — optional OTLP gateway for team/hosted telemetry
188
+
189
+ ## License
190
+
191
+ [Apache-2.0](LICENSE)
@@ -0,0 +1,157 @@
1
+ # reflect
2
+
3
+ [![PyPI](https://img.shields.io/pypi/v/o11y-reflect)](https://pypi.org/project/o11y-reflect/)
4
+ [![Python](https://img.shields.io/pypi/pyversions/o11y-reflect)](https://pypi.org/project/o11y-reflect/)
5
+ [![License](https://img.shields.io/github/license/o11y-dev/reflect)](LICENSE)
6
+ [![CI](https://github.com/o11y-dev/reflect/actions/workflows/test.yml/badge.svg)](https://github.com/o11y-dev/reflect/actions/workflows/test.yml)
7
+
8
+ **See why your AI coding agents fail, stall, or burn budget.**
9
+
10
+ Local-first telemetry for Claude Code, GitHub Copilot, Gemini CLI, and Cursor. One install, real insight, no cloud required.
11
+
12
+ ## Quickstart
13
+
14
+ ```bash
15
+ pipx install o11y-reflect
16
+ reflect setup
17
+ # use your AI tool normally, then:
18
+ reflect
19
+ ```
20
+
21
+ That's it. `reflect setup` installs hooks, wires your agents, and starts capturing telemetry to `~/.reflect/state/`. `reflect` renders an interactive terminal dashboard.
22
+
23
+ **No telemetry yet?** Try the demo:
24
+
25
+ ```bash
26
+ reflect --demo
27
+ ```
28
+
29
+ ## What you get
30
+
31
+ - **Token economy** — input, output, cache hits, largest-session concentration
32
+ - **Tool efficiency** — failure rates, latency percentiles (p50/p90/p95/p99), tool-to-prompt ratio
33
+ - **Agent comparison** — side-by-side across Claude, Copilot, Gemini, Cursor
34
+ - **Model breakdown** — which models you're actually using and how much
35
+ - **MCP server tracking** — usage counts and availability gaps
36
+ - **Subagent patterns** — delegation frequency and types
37
+ - **Activity heatmaps** — by hour and day of week
38
+ - **Actionable recommendations** — based on your actual usage patterns
39
+
40
+ ## Output modes
41
+
42
+ ```bash
43
+ reflect # interactive terminal dashboard (default)
44
+ reflect --no-terminal # markdown report
45
+ reflect --dashboard-artifact out.json # JSON for hosted dashboards
46
+ reflect --publish # open hosted dashboard in browser
47
+ reflect --demo # instant demo with sample data
48
+ ```
49
+
50
+ ## Health check
51
+
52
+ ```bash
53
+ reflect doctor
54
+ reflect update
55
+ ```
56
+
57
+ `reflect doctor` includes an update advisor for package drift, live pipx drift, skill-copy drift, and hook wiring drift. `reflect update --apply` upgrades the pipx package when a newer release is available.
58
+
59
+ ## Supported agents
60
+
61
+ | Agent | Path | Confidence |
62
+ |---|---|---|
63
+ | Claude Code | Native logs + hooks | High |
64
+ | GitHub Copilot CLI | Native OTel + hooks | High |
65
+ | VS Code Copilot | Native OTel | High |
66
+ | Gemini CLI | Native OTel + hooks | High |
67
+ | Codex | Native OTel + hooks | Medium |
68
+ | Cursor | Session/log adapters | Medium |
69
+ | OpenCode | Hooks/plugin | Medium |
70
+
71
+ When hook spans and OTLP traces are absent, `reflect` falls back to rich local session stores:
72
+
73
+ - Cursor: `~/.cursor/projects/**/agent-transcripts/**/*.jsonl`
74
+ - Copilot: `~/.copilot/session-state/*/events.jsonl`
75
+ - Claude Code: `~/.claude/projects/**/*.jsonl`
76
+ - Gemini: `~/.gemini/tmp/**/chats/session-*.json`
77
+
78
+ ## Advanced usage
79
+
80
+ ### Direct OTLP traces
81
+
82
+ If you already have OTLP JSON traces from a collector, skip setup:
83
+
84
+ ```bash
85
+ reflect --otlp-traces path/to/otel-traces.json
86
+ ```
87
+
88
+ A sibling `otel-logs.json` file is used automatically for enrichment when present.
89
+
90
+ ### Hosted dashboard
91
+
92
+ Write a JSON artifact for GitHub Pages or a local server:
93
+
94
+ ```bash
95
+ reflect --dashboard-artifact docs/reports/latest.json --publish
96
+ ```
97
+
98
+ For a safe public example, this repo also ships a curated GitHub Pages demo:
99
+
100
+ - `https://reflect.o11y.dev/showcase.html`
101
+ - direct dashboard view: `https://reflect.o11y.dev/demo.html`
102
+
103
+ ### All options
104
+
105
+ ```
106
+ reflect [OPTIONS] [COMMAND]
107
+
108
+ Options:
109
+ --sessions-dir PATH Session metadata JSON directory
110
+ --spans-dir PATH Local span JSONL directory
111
+ --otlp-traces PATH OTLP JSON traces file
112
+ --output PATH Markdown report output path
113
+ --terminal / --no-terminal Terminal dashboard (default) or markdown report
114
+ --dashboard-artifact PATH Write dashboard JSON artifact
115
+ --publish Open dashboard in browser
116
+ --demo Run with bundled sample data
117
+ --help Show help
118
+
119
+ Commands:
120
+ setup Install hooks, wire agents, configure telemetry
121
+ doctor Check installation health and agent status
122
+ update Check release drift and optional package upgrade
123
+ ```
124
+
125
+ ## Data flow
126
+
127
+ ```
128
+ reflect setup
129
+ ├── installs opentelemetry-hooks
130
+ ├── wires agent configs (Claude, Copilot, Gemini)
131
+ ├── distributes skill packages
132
+ └── enables local span export to ~/.reflect/state/
133
+
134
+ Your AI tool → hooks capture spans → ~/.reflect/state/
135
+
136
+ reflect → reads traces → terminal dashboard / report / hosted view
137
+ ```
138
+
139
+ ## Skill package
140
+
141
+ `reflect` ships with a portable skill at `skills/reflect/SKILL.md` for Claude Code. After `reflect setup`, the `/reflect` skill is available in your AI tool for in-session telemetry analysis.
142
+
143
+ ## Analysis schema
144
+
145
+ See [`docs/ai-observability-schema.md`](docs/ai-observability-schema.md) for the canonical cross-tool analysis schema.
146
+
147
+ ## Part of o11y.dev
148
+
149
+ `reflect` is the entry point to the [o11y.dev](https://o11y.dev) ecosystem:
150
+
151
+ - **[opentelemetry-hooks](https://github.com/o11y-dev/opentelemetry-hooks)** — instrumentation engine for AI coding agents
152
+ - **[opentelemetry-skill](https://github.com/o11y-dev/opentelemetry-skill)** — observability knowledge layer for AI assistants
153
+ - **[gateway](https://github.com/o11y-dev/gateway)** — optional OTLP gateway for team/hosted telemetry
154
+
155
+ ## License
156
+
157
+ [Apache-2.0](LICENSE)
@@ -0,0 +1,73 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "o11y-reflect"
7
+ version = "0.0.1"
8
+ description = "See why your AI coding agents fail, stall, or burn budget — local-first telemetry for Claude, Copilot, Gemini, and Cursor"
9
+ requires-python = ">=3.11"
10
+ readme = "README.md"
11
+ license = "Apache-2.0"
12
+ keywords = ["observability", "opentelemetry", "ai-agents", "claude", "copilot", "gemini", "telemetry"]
13
+ classifiers = [
14
+ "Development Status :: 4 - Beta",
15
+ "Environment :: Console",
16
+ "Intended Audience :: Developers",
17
+ "Programming Language :: Python :: 3",
18
+ "Programming Language :: Python :: 3.11",
19
+ "Programming Language :: Python :: 3.12",
20
+ "Topic :: Software Development :: Quality Assurance",
21
+ "Topic :: System :: Monitoring",
22
+ ]
23
+ dependencies = [
24
+ "click>=8.0",
25
+ "rich>=13.0",
26
+ "orjson>=3.0",
27
+ "fastapi>=0.100",
28
+ "uvicorn>=0.20",
29
+ ]
30
+
31
+ [project.urls]
32
+ Homepage = "https://o11y.dev"
33
+ Repository = "https://github.com/o11y-dev/reflect"
34
+ Documentation = "https://github.com/o11y-dev/reflect#readme"
35
+ Issues = "https://github.com/o11y-dev/reflect/issues"
36
+ Changelog = "https://github.com/o11y-dev/reflect/blob/main/CHANGELOG.md"
37
+
38
+ [project.scripts]
39
+ reflect = "reflect.core:main"
40
+
41
+ [project.optional-dependencies]
42
+ test = ["pytest>=7.0", "pytest-cov>=4.0"]
43
+ e2e = ["playwright>=1.40"]
44
+
45
+ [tool.pytest.ini_options]
46
+ addopts = "--cov=reflect --cov-report=term-missing --cov-fail-under=65"
47
+ testpaths = ["tests"]
48
+
49
+ [tool.ruff]
50
+ target-version = "py311"
51
+ line-length = 100
52
+ exclude = ["serve.py"]
53
+
54
+ [tool.ruff.lint]
55
+ select = ["E", "F", "W", "I", "UP", "B", "C4", "SIM"]
56
+ ignore = ["E501"]
57
+
58
+ [tool.ruff.lint.per-file-ignores]
59
+ "tests/*" = ["S101"]
60
+ "src/reflect/core.py" = ["E402"] # re-exports placed after conditional setup block
61
+
62
+ [tool.semantic_release]
63
+ version_toml = ["pyproject.toml:project.version"]
64
+ version_variables = []
65
+ major_on_zero = false
66
+ allow_zero_version = true
67
+ tag_format = "v{version}"
68
+
69
+ [tool.setuptools.packages.find]
70
+ where = ["src"]
71
+
72
+ [tool.setuptools.package-data]
73
+ reflect = ["data/demo-traces.json", "data/index.html", "data/skills/reflect/SKILL.md"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+