casetrace 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.
Files changed (38) hide show
  1. casetrace-0.1.0/.github/workflows/ci.yml +37 -0
  2. casetrace-0.1.0/.github/workflows/publish.yml +50 -0
  3. casetrace-0.1.0/.gitignore +11 -0
  4. casetrace-0.1.0/LICENSE +201 -0
  5. casetrace-0.1.0/PKG-INFO +257 -0
  6. casetrace-0.1.0/README.md +220 -0
  7. casetrace-0.1.0/SECURITY.md +33 -0
  8. casetrace-0.1.0/casetrace_attribution_protocol.md +136 -0
  9. casetrace-0.1.0/casetrace_execution_plan.md +142 -0
  10. casetrace-0.1.0/examples/sample_clean_trace.jsonl +1 -0
  11. casetrace-0.1.0/examples/sample_fault_trace.jsonl +1 -0
  12. casetrace-0.1.0/project_overview.md +36 -0
  13. casetrace-0.1.0/pyproject.toml +86 -0
  14. casetrace-0.1.0/src/casetrace/__init__.py +5 -0
  15. casetrace-0.1.0/src/casetrace/__main__.py +6 -0
  16. casetrace-0.1.0/src/casetrace/adapters.py +93 -0
  17. casetrace-0.1.0/src/casetrace/attributor.py +185 -0
  18. casetrace-0.1.0/src/casetrace/baselines.py +54 -0
  19. casetrace-0.1.0/src/casetrace/cli.py +361 -0
  20. casetrace-0.1.0/src/casetrace/data/sample_clean_trace.jsonl +1 -0
  21. casetrace-0.1.0/src/casetrace/data/sample_fault_trace.jsonl +1 -0
  22. casetrace-0.1.0/src/casetrace/graph.py +279 -0
  23. casetrace-0.1.0/src/casetrace/metrics.py +108 -0
  24. casetrace-0.1.0/src/casetrace/providers/__init__.py +47 -0
  25. casetrace-0.1.0/src/casetrace/providers/anthropic.py +58 -0
  26. casetrace-0.1.0/src/casetrace/providers/base.py +49 -0
  27. casetrace-0.1.0/src/casetrace/providers/gemini.py +61 -0
  28. casetrace-0.1.0/src/casetrace/providers/openai.py +60 -0
  29. casetrace-0.1.0/src/casetrace/providers/stub.py +58 -0
  30. casetrace-0.1.0/src/casetrace/py.typed +0 -0
  31. casetrace-0.1.0/src/casetrace/runlog.py +68 -0
  32. casetrace-0.1.0/src/casetrace/schemas.py +245 -0
  33. casetrace-0.1.0/tests/test_adapters.py +50 -0
  34. casetrace-0.1.0/tests/test_cli.py +101 -0
  35. casetrace-0.1.0/tests/test_graph.py +117 -0
  36. casetrace-0.1.0/tests/test_metrics.py +69 -0
  37. casetrace-0.1.0/tests/test_schemas.py +63 -0
  38. casetrace-0.1.0/uv.lock +2040 -0
@@ -0,0 +1,37 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ verify:
13
+ runs-on: ubuntu-latest
14
+ strategy:
15
+ fail-fast: false
16
+ matrix:
17
+ python-version: ["3.11", "3.13"]
18
+ steps:
19
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
20
+ - name: Install uv (pinned)
21
+ run: python -m pip install --disable-pip-version-check "uv==0.11.7"
22
+ - name: Sync locked dependencies
23
+ run: uv sync --locked --python ${{ matrix.python-version }}
24
+ - name: Lint
25
+ run: uv run ruff check .
26
+ - name: Type check
27
+ run: uv run mypy src
28
+ - name: Dependency audit
29
+ run: |
30
+ uv export --format requirements-txt --no-hashes --no-emit-project \
31
+ -o "$RUNNER_TEMP/requirements.txt"
32
+ uv run pip-audit --strict --disable-pip --no-deps \
33
+ -r "$RUNNER_TEMP/requirements.txt"
34
+ - name: Tests
35
+ run: uv run pytest
36
+ - name: Offline smoke test
37
+ run: uv run casetrace demo --json
@@ -0,0 +1,50 @@
1
+ name: Publish
2
+
3
+ on:
4
+ push:
5
+ tags: ["v*"]
6
+ workflow_dispatch:
7
+ inputs:
8
+ ref:
9
+ description: "Tag or ref to build and publish"
10
+ required: true
11
+ default: "v0.1.0"
12
+
13
+ permissions:
14
+ contents: read
15
+
16
+ jobs:
17
+ build-and-publish:
18
+ runs-on: ubuntu-latest
19
+ environment: pypi
20
+ permissions:
21
+ id-token: write # required for PyPI Trusted Publishing and attestations
22
+ steps:
23
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
24
+ with:
25
+ ref: ${{ inputs.ref || github.ref }}
26
+ - name: Install uv (pinned)
27
+ run: python -m pip install --disable-pip-version-check "uv==0.11.7"
28
+ - name: Sync locked dependencies
29
+ run: uv sync --locked
30
+ - name: Verify tag matches package version
31
+ if: startsWith(github.ref, 'refs/tags/')
32
+ run: |
33
+ PACKAGE_VERSION=$(uv run python -c "import casetrace; print(casetrace.__version__)")
34
+ TAG_VERSION="${GITHUB_REF_NAME#v}"
35
+ if [ "$PACKAGE_VERSION" != "$TAG_VERSION" ]; then
36
+ echo "Tag v$TAG_VERSION does not match package version $PACKAGE_VERSION"
37
+ exit 1
38
+ fi
39
+ - name: Re-run release gate
40
+ run: |
41
+ uv run ruff check .
42
+ uv run mypy src
43
+ uv run pytest
44
+ uv run casetrace demo --json
45
+ - name: Build distributions
46
+ run: uv build
47
+ - name: Publish with Trusted Publishing
48
+ uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3
49
+ with:
50
+ attestations: true
@@ -0,0 +1,11 @@
1
+ .venv/
2
+ __pycache__/
3
+ *.py[cod]
4
+ .pytest_cache/
5
+ .mypy_cache/
6
+ .ruff_cache/
7
+ .hypothesis/
8
+ dist/
9
+ build/
10
+ *.egg-info/
11
+ .casetrace/
@@ -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 2026 CaseTrace contributors
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,257 @@
1
+ Metadata-Version: 2.5
2
+ Name: casetrace
3
+ Version: 0.1.0
4
+ Summary: Flight recorder for multi-agent AI systems: deterministic root-cause attribution for agent failures
5
+ Project-URL: Homepage, https://github.com/ammarfitwalla/casetrace
6
+ Project-URL: Repository, https://github.com/ammarfitwalla/casetrace
7
+ Project-URL: Issues, https://github.com/ammarfitwalla/casetrace/issues
8
+ Project-URL: Releases, https://github.com/ammarfitwalla/casetrace/releases
9
+ Project-URL: Changelog, https://github.com/ammarfitwalla/casetrace/releases
10
+ Author: CaseTrace contributors
11
+ License-Expression: Apache-2.0
12
+ License-File: LICENSE
13
+ Keywords: agents,attribution,debugging,evaluation,llm,multi-agent,root-cause
14
+ Classifier: Development Status :: 3 - Alpha
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Topic :: Software Development :: Debuggers
22
+ Classifier: Topic :: Software Development :: Quality Assurance
23
+ Classifier: Typing :: Typed
24
+ Requires-Python: >=3.11
25
+ Requires-Dist: pydantic>=2.8
26
+ Requires-Dist: rich>=13.7
27
+ Requires-Dist: typer>=0.12
28
+ Provides-Extra: anthropic
29
+ Requires-Dist: anthropic>=0.39; extra == 'anthropic'
30
+ Provides-Extra: gemini
31
+ Requires-Dist: google-genai>=1.0; extra == 'gemini'
32
+ Provides-Extra: openai
33
+ Requires-Dist: openai>=1.40; extra == 'openai'
34
+ Provides-Extra: tokens
35
+ Requires-Dist: tiktoken>=0.7; extra == 'tokens'
36
+ Description-Content-Type: text/markdown
37
+
38
+ # CaseTrace
39
+
40
+ [![CI](https://github.com/ammarfitwalla/casetrace/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/ammarfitwalla/casetrace/actions/workflows/ci.yml)
41
+ [![PyPI](https://img.shields.io/pypi/v/casetrace.svg)](https://pypi.org/project/casetrace/)
42
+ [![Python](https://img.shields.io/pypi/pyversions/casetrace.svg)](https://pypi.org/project/casetrace/)
43
+ [![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE)
44
+
45
+ **A flight recorder for multi-agent AI systems.** CaseTrace reads a multi-agent
46
+ execution trace, builds a deterministic map of agent handoffs and tool
47
+ dependencies, prunes unreferenced noise, and then asks a structured judge:
48
+ *which agent, at which step, and what kind of error caused this run to fail?*
49
+ It can also answer **NO_FAULT** on healthy runs and **ABSTAIN** when the
50
+ evidence is insufficient.
51
+
52
+ > **Status: v0.1.0 (MVP).** This release ships the deterministic graph/pruning
53
+ > core, a generic JSONL adapter, a structure-first judge, an `all_at_once`
54
+ > baseline, metrics, and the offline CLI. Benchmark numbers on Who&When and
55
+ > Who&When Pro are **not** part of v0.1.0 — see [Scope](#scope-of-v010). The
56
+ > project framing is engineering and evaluation quality, not research novelty.
57
+
58
+ For the plain-language overview see [`project_overview.md`](project_overview.md).
59
+ For the frozen evaluation contract see
60
+ [`casetrace_attribution_protocol.md`](casetrace_attribution_protocol.md).
61
+
62
+ ## Install
63
+
64
+ Python 3.11+ is required. Install from PyPI:
65
+
66
+ ```bash
67
+ python -m pip install casetrace
68
+ ```
69
+
70
+ With an optional model provider:
71
+
72
+ ```bash
73
+ python -m pip install "casetrace[gemini]"
74
+ python -m pip install "casetrace[openai]"
75
+ python -m pip install "casetrace[anthropic]"
76
+ ```
77
+
78
+ Using [uv](https://docs.astral.sh/uv/):
79
+
80
+ ```bash
81
+ uv tool install casetrace
82
+ uv tool install "casetrace[gemini]"
83
+ ```
84
+
85
+ Exact token counting (instead of the built-in estimate) is optional:
86
+
87
+ ```bash
88
+ python -m pip install "casetrace[tokens]"
89
+ ```
90
+
91
+ ## Quickstart
92
+
93
+ The offline demo uses the deterministic `stub` judge, so it needs no API key
94
+ and no network:
95
+
96
+ ```bash
97
+ casetrace demo # faulted sample: prints the graph + verdict
98
+ casetrace demo --trace clean # healthy sample: prints NO_FAULT
99
+ ```
100
+
101
+ Run it on your own trace:
102
+
103
+ ```bash
104
+ casetrace graph path/to/trace.jsonl
105
+ casetrace analyze path/to/trace.jsonl --mode structure_first --provider stub
106
+ ```
107
+
108
+ Against a real model:
109
+
110
+ ```bash
111
+ export GOOGLE_API_KEY="..."
112
+ casetrace analyze path/to/trace.jsonl --provider gemini --model gemini-2.5-flash
113
+ ```
114
+
115
+ Append a protocol-shaped JSONL log for later reporting:
116
+
117
+ ```bash
118
+ casetrace analyze path/to/trace.jsonl --out results/runs.jsonl
119
+ ```
120
+
121
+ From a source clone:
122
+
123
+ ```bash
124
+ uv sync
125
+ uv run casetrace demo
126
+ uv run pytest
127
+ ```
128
+
129
+ ## How it works
130
+
131
+ ```
132
+ trace JSONL ──▶ normalize ──▶ build handoff/tool graph ──▶ prune unreferenced payloads
133
+ │
134
+ ▼
135
+ structured judge ──▶ verdict
136
+ (agent, step,
137
+ error_mode,
138
+ evidence,
139
+ confidence)
140
+ ```
141
+
142
+ 1. **Normalize** the trace into a `Trajectory` with indexed `Step`s.
143
+ 2. **Build a deterministic graph**: consecutive-agent handoffs, tool-call →
144
+ tool-result edges, and explicit `references` between steps.
145
+ 3. **Prune** tool outputs that no later step references, while preserving every
146
+ step index, agent, status, and causal edge.
147
+ 4. **Judge** the pruned context (or the full context for the `all_at_once`
148
+ baseline) and validate the response into a strict `Verdict`.
149
+
150
+ The graph and pruning steps never call a model, so `casetrace graph` is fully
151
+ reproducible and free.
152
+
153
+ ## Trace format
154
+
155
+ The generic adapter accepts a single JSON object, a JSON array of objects, or
156
+ JSONL with one object per line:
157
+
158
+ ```json
159
+ {
160
+ "id": "trace-001",
161
+ "dataset": "generic_jsonl",
162
+ "steps": [
163
+ {"index": 0, "agent": "planner", "kind": "plan", "content": "Fetch prices, then total."},
164
+ {"index": 1, "agent": "tool_executor", "kind": "tool_call", "tool_name": "http_get"},
165
+ {"index": 2, "agent": "tool_executor", "kind": "tool_result", "tool_name": "http_get", "tool_output": "{...}", "references": [1]},
166
+ {"index": 3, "agent": "verifier", "kind": "verify", "content": "Checked the total.", "references": [2], "status": "error", "error_type": "invalid_tool_argument"}
167
+ ],
168
+ "final_output": "Total: 100 USD",
169
+ "metadata": {"ground_truth": {"is_clean": false, "agent": "verifier", "step": 3, "error_mode": "invalid_tool_argument"}}
170
+ }
171
+ ```
172
+
173
+ `references` is optional but is what lets the graph recover causal edges from a
174
+ flat log. `metadata.ground_truth` is only read by the offline `stub` and by
175
+ metric scoring; a real judge never sees it.
176
+
177
+ ## CLI reference
178
+
179
+ | Command | What it does |
180
+ | --- | --- |
181
+ | `casetrace graph TRACE [--json] [--max-chars N]` | Print the handoff/tool graph and pruning savings. No LLM call. |
182
+ | `casetrace analyze TRACE [--mode structure_first\|all_at_once] [--provider stub\|gemini\|openai\|anthropic] [--model ID] [--out FILE] [--json]` | Attribute one trace and optionally append a JSONL run log. |
183
+ | `casetrace demo [--trace fault\|clean] [--json]` | Run the bundled offline samples with the stub judge. |
184
+ | `casetrace version` | Print the installed version. |
185
+
186
+ `--provider stub` is the default and is deterministic. Real providers are
187
+ **experimental** in v0.1.0 and are not exercised by CI.
188
+
189
+ ## Run log
190
+
191
+ `--out` appends one JSON line per run, matching section 5 of the frozen
192
+ protocol (`run_id`, `dataset`, `config`, `model`, `trace_*`, `ground_truth`,
193
+ `prediction`, `metrics`, `systems_cost`). Metrics include agent match, exact and
194
+ within-1 step match, error-mode match, joint match, false alarm, and abstention.
195
+
196
+ ## Scope of v0.1.0
197
+
198
+ Included:
199
+
200
+ - Deterministic handoff/tool-dependency graph and token-budgeted pruning.
201
+ - Generic JSONL/JSON adapter.
202
+ - `structure_first` judge and `all_at_once` baseline.
203
+ - Offline `stub` judge, optional Gemini/OpenAI/Anthropic providers.
204
+ - Metrics and protocol-shaped run logs.
205
+ - `graph`, `analyze`, `demo`, `version` CLI commands.
206
+
207
+ Deferred to later releases:
208
+
209
+ - Who&When v1 and Who&When Pro adapters and benchmark reproduction.
210
+ - `casetrace eval` and `casetrace report` table generation.
211
+ - Controlled fault-injected + clean evaluation suite.
212
+ - Calibrated abstention and split-conformal ablation.
213
+ - `binary_search` and `step_by_step` baselines.
214
+
215
+ ## Limitations
216
+
217
+ - **The `stub` judge is not a real judge.** It reads an explicit error flag,
218
+ then a clean-run marker, and otherwise abstains. It exists for offline demos
219
+ and tests, never as an evaluation baseline.
220
+ - **Token counts are estimates** (~4 characters/token) unless the optional
221
+ `[tokens]` extra is installed. README and CLI output label them as token
222
+ counts, not exact tokenizer totals, unless `tiktoken` is active.
223
+ - **No benchmark numbers in v0.1.0.** Published Who&When/Pro results are
224
+ planned; none are claimed here.
225
+ - **Real providers are experimental.** They share one JSON-parsing path and are
226
+ not run in CI because that would require live keys and network access.
227
+ - **No calibrated abstention yet.** `ABSTAIN` is a valid verdict but its
228
+ confidence threshold is not calibrated on a dev split in this release.
229
+ - Best-effort generic adapter only; framework-specific adapters (OpenTelemetry,
230
+ LangGraph) are planned.
231
+
232
+ ## Prior art
233
+
234
+ CaseTrace is an applied engineering and evaluation toolkit, not a novel method.
235
+ It builds on and must credit: *Who&When*, *Who&When Pro*, *FALAT*, *FAMAS*,
236
+ *TraceElephant*, *Aegis*, *AgenTracer*, *AgentDebugX*, and conformal agent error
237
+ attribution work.
238
+
239
+ ## Development
240
+
241
+ ```bash
242
+ uv sync
243
+ uv run ruff check .
244
+ uv run mypy src
245
+ uv run pytest
246
+ uv run casetrace demo
247
+ uv run casetrace graph examples/sample_fault_trace.jsonl
248
+ ```
249
+
250
+ CI runs lint, strict type checking, a dependency audit, tests, and an offline
251
+ smoke test on Python 3.11 and 3.13. Releases are published to PyPI from a
252
+ protected environment using PyPI Trusted Publishing with PEP 740 attestations;
253
+ no token is stored in the repository.
254
+
255
+ ## License
256
+
257
+ Apache-2.0. See [`LICENSE`](LICENSE).