lacuna-mse 1.0.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 (57) hide show
  1. lacuna_mse-1.0.0/.gitignore +24 -0
  2. lacuna_mse-1.0.0/LICENSE +202 -0
  3. lacuna_mse-1.0.0/NOTICE +18 -0
  4. lacuna_mse-1.0.0/PKG-INFO +254 -0
  5. lacuna_mse-1.0.0/README.md +215 -0
  6. lacuna_mse-1.0.0/docs/GUIDE.md +414 -0
  7. lacuna_mse-1.0.0/pyproject.toml +111 -0
  8. lacuna_mse-1.0.0/src/lacuna/__init__.py +1 -0
  9. lacuna_mse-1.0.0/src/lacuna/agents/__init__.py +1 -0
  10. lacuna_mse-1.0.0/src/lacuna/agents/llm.py +230 -0
  11. lacuna_mse-1.0.0/src/lacuna/agents/scripted.py +91 -0
  12. lacuna_mse-1.0.0/src/lacuna/cli.py +411 -0
  13. lacuna_mse-1.0.0/src/lacuna/core/__init__.py +5 -0
  14. lacuna_mse-1.0.0/src/lacuna/core/records.py +41 -0
  15. lacuna_mse-1.0.0/src/lacuna/core/tables.py +107 -0
  16. lacuna_mse-1.0.0/src/lacuna/coverage.py +103 -0
  17. lacuna_mse-1.0.0/src/lacuna/envs/__init__.py +1 -0
  18. lacuna_mse-1.0.0/src/lacuna/envs/base.py +61 -0
  19. lacuna_mse-1.0.0/src/lacuna/envs/bypass.py +464 -0
  20. lacuna_mse-1.0.0/src/lacuna/envs/churn.py +309 -0
  21. lacuna_mse-1.0.0/src/lacuna/envs/infra.py +287 -0
  22. lacuna_mse-1.0.0/src/lacuna/envs/infra_tasks.py +228 -0
  23. lacuna_mse-1.0.0/src/lacuna/envs/infra_tools.py +139 -0
  24. lacuna_mse-1.0.0/src/lacuna/envs/kernel.py +241 -0
  25. lacuna_mse-1.0.0/src/lacuna/envs/prompts.py +12 -0
  26. lacuna_mse-1.0.0/src/lacuna/envs/registry.py +55 -0
  27. lacuna_mse-1.0.0/src/lacuna/envs/service.py +215 -0
  28. lacuna_mse-1.0.0/src/lacuna/envs/tasks.py +148 -0
  29. lacuna_mse-1.0.0/src/lacuna/envs/tools.py +160 -0
  30. lacuna_mse-1.0.0/src/lacuna/episode.py +89 -0
  31. lacuna_mse-1.0.0/src/lacuna/estimators/__init__.py +32 -0
  32. lacuna_mse-1.0.0/src/lacuna/estimators/baselines.py +297 -0
  33. lacuna_mse-1.0.0/src/lacuna/estimators/bounds.py +86 -0
  34. lacuna_mse-1.0.0/src/lacuna/estimators/diagnostics.py +83 -0
  35. lacuna_mse-1.0.0/src/lacuna/estimators/latent_class.py +100 -0
  36. lacuna_mse-1.0.0/src/lacuna/estimators/loglinear.py +542 -0
  37. lacuna_mse-1.0.0/src/lacuna/estimators/sa_hom.py +108 -0
  38. lacuna_mse-1.0.0/src/lacuna/estimators/selection.py +182 -0
  39. lacuna_mse-1.0.0/src/lacuna/estimators/stratified.py +238 -0
  40. lacuna_mse-1.0.0/src/lacuna/histories.py +53 -0
  41. lacuna_mse-1.0.0/src/lacuna/ingest/__init__.py +5 -0
  42. lacuna_mse-1.0.0/src/lacuna/ingest/jsonl.py +23 -0
  43. lacuna_mse-1.0.0/src/lacuna/ingest/otlp.py +103 -0
  44. lacuna_mse-1.0.0/src/lacuna/linkage.py +118 -0
  45. lacuna_mse-1.0.0/src/lacuna/mapfile.py +556 -0
  46. lacuna_mse-1.0.0/src/lacuna/rig/__init__.py +7 -0
  47. lacuna_mse-1.0.0/src/lacuna/rig/front.py +149 -0
  48. lacuna_mse-1.0.0/src/lacuna/rig/integrity.py +131 -0
  49. lacuna_mse-1.0.0/src/lacuna/rig/manifest.py +99 -0
  50. lacuna_mse-1.0.0/src/lacuna/rig/record.py +126 -0
  51. lacuna_mse-1.0.0/src/lacuna/rig/replay.py +208 -0
  52. lacuna_mse-1.0.0/src/lacuna/rig/sessions.py +194 -0
  53. lacuna_mse-1.0.0/src/lacuna/rig/stress.py +124 -0
  54. lacuna_mse-1.0.0/src/lacuna/rig/witnesses.py +361 -0
  55. lacuna_mse-1.0.0/src/lacuna/sim.py +175 -0
  56. lacuna_mse-1.0.0/src/lacuna/thinning.py +397 -0
  57. lacuna_mse-1.0.0/src/lacuna/witnesses.py +122 -0
@@ -0,0 +1,24 @@
1
+ .venv/
2
+ __pycache__/
3
+ .ruff_cache/
4
+ .pytest_cache/
5
+ .env
6
+ *.egg-info/
7
+ artifacts/*.log
8
+ .worktrees/
9
+ paper/*.pdf
10
+ paper/*.aux
11
+ paper/*.log
12
+ paper/*.bbl
13
+ paper/*.blg
14
+ paper/*.out
15
+ # Built by scripts/build_dataset.py; the builder is committed, not its output.
16
+ dataset/
17
+ .dataset-build-*/
18
+ .dataset-old-*/
19
+ .claude/
20
+ # Hand-run rig spikes: outputs are measurements, summarised in docs/RIG-FINDINGS.md.
21
+ rig/spikes/*/out/
22
+ # Raw rig runs: large, and they hold container addresses. Summaries are committed.
23
+ artifacts/rig/runs/
24
+ rig/spikes/*/out-sweep/
@@ -0,0 +1,202 @@
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.
202
+
@@ -0,0 +1,18 @@
1
+ lacuna
2
+ Copyright 2026 Caio Theodoro
3
+
4
+ Licensed under the Apache License, Version 2.0 (see LICENSE).
5
+
6
+ Exception: the `transcript` fields in artifacts/episodes/*/episodes.jsonl hold
7
+ messages, including reasoning text, generated by the models the live runs used
8
+ (DeepSeek, and Qwen in study 4), served through OpenCode Go. That model output is not licensed under
9
+ Apache-2.0 by this repository; the model provider's terms apply to it. The
10
+ Hugging Face dataset built from this repository withholds those fields.
11
+
12
+ Exception: study 5's recorded sessions. The files
13
+ artifacts/study5/pools/*/transcripts.jsonl, the tool arguments inside
14
+ artifacts/study5/pools/*/sessions.json, and the copies of those arguments in
15
+ the raw runs deposited with a release hold text generated by the models the
16
+ sessions were recorded from (deepseek-v4-1-flash-1017 and zai-glm-5-3, served
17
+ through api.mistral.ai). That model output is not licensed under Apache-2.0 by
18
+ this repository; the model provider's terms apply to it.
@@ -0,0 +1,254 @@
1
+ Metadata-Version: 2.4
2
+ Name: lacuna-mse
3
+ Version: 1.0.0
4
+ Summary: Estimates how many agent actions no log recorded, by capture-recapture over several logs of the same system.
5
+ Project-URL: Homepage, https://github.com/caiotheodoro/lacuna
6
+ Project-URL: Repository, https://github.com/caiotheodoro/lacuna
7
+ Project-URL: Documentation, https://github.com/caiotheodoro/lacuna/blob/main/docs/GUIDE.md
8
+ Project-URL: Issues, https://github.com/caiotheodoro/lacuna/issues
9
+ Project-URL: Changelog, https://github.com/caiotheodoro/lacuna/blob/main/docs/DECISIONS.md
10
+ Project-URL: Dataset, https://huggingface.co/datasets/caiotheodoro/lacuna-capture-histories
11
+ Author: Caio Theodoro
12
+ License-Expression: Apache-2.0
13
+ License-File: LICENSE
14
+ License-File: NOTICE
15
+ Keywords: agents,audit,capture-recapture,logs,multiple systems estimation,observability,opentelemetry,telemetry
16
+ Classifier: Development Status :: 4 - Beta
17
+ Classifier: Environment :: Console
18
+ Classifier: Intended Audience :: Developers
19
+ Classifier: Intended Audience :: Science/Research
20
+ Classifier: Intended Audience :: System Administrators
21
+ Classifier: Operating System :: OS Independent
22
+ Classifier: Programming Language :: Python :: 3
23
+ Classifier: Programming Language :: Python :: 3 :: Only
24
+ Classifier: Programming Language :: Python :: 3.11
25
+ Classifier: Programming Language :: Python :: 3.12
26
+ Classifier: Programming Language :: Python :: 3.13
27
+ Classifier: Topic :: Scientific/Engineering :: Information Analysis
28
+ Classifier: Topic :: System :: Logging
29
+ Classifier: Topic :: System :: Monitoring
30
+ Requires-Python: >=3.11
31
+ Requires-Dist: numpy>=1.26
32
+ Provides-Extra: agents
33
+ Requires-Dist: httpx>=0.27; extra == 'agents'
34
+ Provides-Extra: rig
35
+ Requires-Dist: mcp<2,>=1.30; extra == 'rig'
36
+ Requires-Dist: opentelemetry-exporter-otlp-proto-http<2,>=1.45; extra == 'rig'
37
+ Requires-Dist: opentelemetry-sdk<2,>=1.45; extra == 'rig'
38
+ Description-Content-Type: text/markdown
39
+
40
+ # lacuna
41
+
42
+ How many consequential actions did an AI agent take that no log shows? lacuna
43
+ estimates that count with capture-recapture (the method for counting casualties nobody
44
+ recorded): each log sees part of what the agent did, and the overlaps between logs
45
+ estimate what none of them saw.
46
+
47
+ ## Status: what holds
48
+
49
+ *Coverage* is the share of simulated replicates whose 95% interval contains the true
50
+ count; the bar is 0.90. In study 5 nothing is simulated: coverage is a share of rig runs
51
+ and the bar is on the lower end of its Wilson interval.
52
+
53
+ | Claim | Evidence | Status |
54
+ |---|---|---|
55
+ | Counting unlogged actions works in the back-office environment | Pre-registered. Passed at its registered loss seed (coverage 0.94) but covers 0.893 over 3000 replicates, below the 0.90 bar. A second model (`qwen3.8-flash`) on plain back-office covers 0.942; loss is simulated, so that tests another action mix, not a model family | scoped |
56
+ | The registered record matching transfers to a second (infra) environment | Pre-registered, predicted to fail. T1 failed: 0.3 at the registered seed, 0.401 over 20 seeds. Linking the trace and the gateway by a shared call id lifts back-office to 0.946 and infra to 0.859 | fail |
57
+ | The count is bounded when a channel is itemised by no counted log | Pre-registered bypass study. The agent ran 0.856 of its actions through a batch tool that the trace and the gateway log as one call (predicted 0.05 to 0.30). Coverage 0.759 against 0.946 with no bypass. The estimator still detects a gap in 0.995 of replicates (also 1.0 with no bypass, so it does not say which channel is unseen); counting the union covers 0.0. Post hoc, one record per bypassed action, taken from the ledger, restores 0.949. The second model ran 0.97 of its actions through the batch tool and covered 0.20 | fail |
58
+ | Itemising a channel is enough | No. An auditor that parses the scripts but loses a script's lines together covers 0.469 on the neutral pool (the same records lost one by one: 0.952), 0.61 under the adversary prompt (0.94) and 0.335 on the second model (0.941). Against not parsing, that is worse on the neutral pool (0.655) and better on the second model (0.20). The intervals are too narrow, not biased: the lines of one script are not independent. No dispersion correction was tried on it | fail |
59
+ | It survives loss that depends on the action, comes in bursts or drifts | Fails silently: 0.647 at a tenth more loss on the operations the env diff cannot see, 0.187 at a fifth more; 0.559 under bursts; 0.742 under a drifting loss rate | fail |
60
+ | In one rig, the interval covers when a real telemetry pipeline loses the records and two originators share no counter | Pre-registered study 5 (`docs/PREREG-STUDY5.md`; D92, corrected by D93), one rig, no loss simulated. `ll_sa_hom` covered 269 of the 277 runs left (Wilson 0.944 to 0.985) with no interval unbounded, so the criterion as registered is met; the registered prediction that it would not be was wrong. 23 of the 300 planned runs were set aside on integrity, and with those counted as not covered it is 269 of 300 (0.857 to 0.926), which straddles the 0.90 bar: not shown. The point was closer to the truth than a sequence-gap count in 223 of the 277 runs and than the union in 261: a pass against both, the second weak by construction (below). Without the end state (`chapman_sa`) 10 of 277 are covered: missed | scoped |
61
+
62
+ The thesis the first five rows support: capture-recapture bounds the unlogged actions
63
+ when every channel is itemised by at least two logs and records are lost action by
64
+ action; when a channel is itemised by none, no log-based count can see it, and only
65
+ design review, not the estimator, detects that.
66
+
67
+ Study 5 is the only row where the loss is not simulated. Two originators replay recorded
68
+ agent sessions, one through an unmodified gateway, and the collectors that relay their
69
+ spans and access logs are killed together and restarted 15 to 45 s later. Scope, in the
70
+ registration's terms: where a trusted counter exists at the source or the sink, use it;
71
+ this is the case of originators that share no counter (two here) and loss from a real
72
+ telemetry pipeline, in one rig, at those outage lengths. What goes with the row:
73
+
74
+ - The caveats the registration puts on the coverage figures: the bounds treat runs as
75
+ independent and they replay shared sessions; one rig; an interval with no upper end
76
+ would have counted as covering (none occurred in the runs left).
77
+ - The runs set aside were bunched in time and the cause is not established.
78
+ - Against the union the comparison shows that the amount added is the right order, not
79
+ that it is accurate; the informative comparison is the sequence-gap one
80
+ (`seq_gap_tail`). That baseline is never shown the end state, so the comparison is of
81
+ information as much as of method.
82
+ - The point is the two-list estimate. A plain Chapman interval on the same two lists
83
+ (`chapman_te`, no criterion registered) covers 250 of the 277 runs: what the registered
84
+ estimator adds on these runs is its interval.
85
+ - Two descriptions made after the verdicts were read (`artifacts/study5/posthoc.json`,
86
+ D98; no criterion). The lower end of coverage stays at the bar up to a design effect
87
+ of 4.05 from the shared sessions; the design effect itself is not estimated. And
88
+ against the larger of the sequence-gap count and the union, a baseline that does read
89
+ the end state, the point was closer in 219 of the 277 runs (exact lower bound 0.738).
90
+ - What the end state hides is by the author's design: the author wrote the task mix and
91
+ its weights, and chose the estimator and the condition after a pilot on the same rig.
92
+ - Floors on the runs left: `union_count` covers 2 and `trust_trace` none; `union_bound`
93
+ covers all with no upper end on any; `seq_gap_tail` covers 34. The median absolute error
94
+ is 3.9 actions for `ll_sa_hom` and 22.0 for the union. On average 0.068 of a run's
95
+ actions were in no log.
96
+ - Unstressed control: 58 of 60 runs in the test, no interval above the truth. A defect:
97
+ in one of them (`s5-s0-021`), where no log lost anything, the registered `ll_sa_hom`
98
+ gave an infinite point and no upper end. By the registered rule that counts as
99
+ covering; it changes no verdict. The library's `ll_sa_hom` was fixed after the
100
+ verdicts were read (D94, post hoc) and the registered figures were not recomputed.
101
+ - A second stressed condition (each relay on its own outage, one originator killed) has no
102
+ criterion and no prediction: 49 of the 51 runs left were covered (Wilson 0.868 to
103
+ 0.989), with 9 of the 60 planned set aside.
104
+ - No claim is made for or against the estimator by outage length, pool, band or time
105
+ window.
106
+
107
+ Terms:
108
+ - Channel, itemised: a channel is a route an action can take, a direct tool call or
109
+ `run_script`, a batch tool that runs a script of many operations in one call. A log
110
+ itemises a channel if it holds one record per action taken through it.
111
+ - Witnesses: W1 `trace` (the agent's own log), W2 `gateway` (calls through an
112
+ interception proxy), W3 `env` (state diff plus a network sink). An LLM auditor as a
113
+ fourth was dropped: it is not independent (D20). In study 5 the logs are each
114
+ originator's OpenTelemetry spans, its receiver's access log, and the end state.
115
+ - `ll_bic`: Poisson log-linear model of the three-log capture table, pairwise
116
+ interactions chosen by BIC, 95% profile-likelihood interval.
117
+ - `ll_sa_hom` (study 5): two-list estimate between any telemetry log (spans or access)
118
+ and the end state; 95% profile-likelihood interval widened by the dispersion between
119
+ sessions. `chapman_sa` is the two-list estimate between spans and access alone.
120
+ - `fin_mid`: back-office loss setting where the trace and the gateway each drop half
121
+ their lines at random and the env diff sees only financial operations; `transfer_mid`
122
+ is the same loss in the infra environment.
123
+ - Linkage: *signature* matches records on operation, resource and sometimes value, in
124
+ order (the registered headline); *call id* matches trace and gateway on the provider's
125
+ tool-call id the harness writes into both; *ledger id* matches on the environment's
126
+ ledger id, which no auditor has.
127
+
128
+ ## Quickstart
129
+
130
+ ```bash
131
+ pip install lacuna-mse # once 1.0.0 is on PyPI; until then, from a clone: pip install .
132
+ # the command and the import package are both `lacuna`
133
+ W=tests/fixtures/rig/run/witnesses
134
+ lacuna lint --map rig/map.toml
135
+ lacuna table --map rig/map.toml --in spans=$W/spans.jsonl --in logs=$W/logs.jsonl --in env=$W/env.jsonl
136
+ lacuna estimate --map rig/map.toml --in spans=$W/spans.jsonl --in logs=$W/logs.jsonl --in env=$W/env.jsonl
137
+ ```
138
+
139
+ `lint` checks a map file, `table` counts what each combination of logs recorded,
140
+ `estimate` adds an estimate of what no log recorded. Maps for your own logs, reading the
141
+ output and the assumptions: [docs/GUIDE.md](docs/GUIDE.md).
142
+
143
+ From a clone:
144
+
145
+ ```bash
146
+ make install # needs uv
147
+ make validate # lint + tests + privacy gate; no key, no network
148
+ make paper # tables, figures and the PDFs (needs tectonic)
149
+ ```
150
+
151
+ ## What the results mean
152
+
153
+ Numbers here are quoted from artifacts through `tests/claims_map.json`; the full tables
154
+ are in `paper/lacuna.tex`, the short version in `paper/lacuna-v1.tex` (`paper/lacuna-workshop.tex` is the earlier short paper, written before study 5), the decision
155
+ trail in `docs/DECISIONS.md` (D44–D54, D61–D73, D92–D95).
156
+
157
+ - **Linkage broke the first two, not the estimator.** Signature matching merges distinct
158
+ actions and manufactures false overlaps; matching by ledger id is nominal in both
159
+ environments. The call id fixes back-office only, because the env diff carries no id.
160
+ The call id is only as good as the lines: a twentieth of lines duplicated in all three
161
+ logs takes `ll_bic` to 0.094, and a twentieth forged as phantoms to 0.0.
162
+ - **Bypass is the lead negative result** (`docs/PREREG-BYPASS.md`, write-up in D63, post
163
+ hoc follow-up in D64). The environment gets a `run_script` batch tool; no witness
164
+ parses the script (a stipulation), and the env diff sees only the effects. Intervals
165
+ are 333.6 wide against 39.0 with no bypass, about 8.6 times in absolute terms. Under the
166
+ registered view, 317.8 of the 330.7 actions a replicate hides (96%) are bypassed customer
167
+ updates that no witness can record, so the estimator extrapolates to actions with zero
168
+ capture probability. One record per bypassed action, taken from the ledger, restores
169
+ coverage (0.949), so the failure is the stipulation that no counted log itemises the
170
+ channel, not the pool or the tool; study 4 shows that itemising is not enough. When
171
+ the env diff also sees the bypassed updates, coverage is 0.008, so the registered
172
+ cell's apparent tolerance is partly a cancellation.
173
+ - **The audit-warning prompt** raised the bypass share from 0.87 to 0.99 on the same 12
174
+ seeds, but two neutral episodes carry the difference (without them it is +0.013), so it
175
+ does not show the prompt changed behaviour. No share threshold is established.
176
+ - **Study 4** (`docs/PREREG-STUDY4.md`, D70, corrected in D73) ran a second model, an
177
+ adversary prompt and an auditor that parses the scripts. Its main finding is clustered
178
+ loss: one witness record standing for many actions breaks the independence the estimator
179
+ assumes, so itemising a channel is necessary, not sufficient. Compare within pools, never
180
+ across them (table above). The adversary prompt told the agent how it is counted and asked
181
+ it to undercount. It split the pool: 11 of 23 episodes did not batch at all (neutral: 1)
182
+ and the rest batched as much as neutral, at least two explicitly to undercount (read by
183
+ hand, D73). No action escaped the trace and the gateway by any route but the one channel.
184
+ The adversary was weak (one episode, black box, channel not named), so this does not test
185
+ a determined one.
186
+ - **Scope.** The method is for settings where every action reaches at least one counted
187
+ log under independent-enough loss. Bypass tests the boundary where a channel reaches
188
+ none, and there the estimator cannot bound the count.
189
+ - **Loss the estimator does not expect.** Bursts of consecutive lost actions leave the
190
+ plain interval too narrow (0.559), mostly because the agent works one kind of ticket at
191
+ a time and a lost block lands where the env diff is blind. Reporting the
192
+ dispersion-corrected `ll_bic_hom` beside it restores 0.952 (back-office) and 0.994
193
+ (infra). A loss rate that ramps over the episode with the same mean gives 0.742 and
194
+ 0.471. Session quality shared by all three logs defeats the pooled intervals, and the
195
+ repairs tried (`tier_bic`: 0.838 and 0.907) are not defaults.
196
+ - **Cheaper checks** (simulated loss, exact matching): a tail-corrected gateway sequence
197
+ counter covers 0.952 where `ll_bic` covers 0.254 (a fifth more loss on unseen
198
+ operations), but covers 0.0 under bursts and in the bypass study; planted canary
199
+ actions cover 0.922 or more where exchangeable with real actions, at wider intervals.
200
+ - **Main limitation.** The agents were benign and, outside study 5, all log loss is
201
+ simulated afterwards on complete logs, in two environments and a batch-tool variant of
202
+ one. One adversary prompt was run live (study 4): the pool routed 0.502 of its actions
203
+ through the batch tool against 0.925 under the neutral prompt, about half the episodes
204
+ declined and the rest batched as before, and none found a route beyond the stipulated
205
+ channel. No stronger adversary (several episodes, feedback, the channel named) was run
206
+ (D10, D70, D73).
207
+
208
+ ## Layout
209
+
210
+ - `src/lacuna/sim.py`: capture-history simulator across the threat ladder
211
+ - `src/lacuna/estimators/`: floor baselines, log-linear MSE with profile-likelihood
212
+ intervals, latent-class model, env-anchored Γ bounds
213
+ - `src/lacuna/envs/`: back-office kernel with a hidden ground-truth ledger, tools, gateway
214
+ log, harness trace; `bypass.py` adds the `run_script` batch tool (D61)
215
+ - `src/lacuna/thinning.py`: post-hoc logging loss over recorded episodes
216
+ - `scripts/`: simulation, episode running, thinning, and the table renderers the docs quote
217
+
218
+ ## Run
219
+
220
+ Needs `uv` and `Python >= 3.11`. `make sim` is a 500-rep coverage sweep (~6 min).
221
+
222
+ The registered confirmatory analysis needs `--bootstrap-episodes`; without it `ll_bic` at
223
+ `fin_mid` covers 0.90, not 0.94 (`artifacts/thinning/confirm-heldout-fixed-episodes.json`).
224
+ At 100 replicates the two are not distinguishable. `make repro-headline` reruns the
225
+ registered replay and fails if `confirm.json` or `hypotheses.json` differ.
226
+
227
+ ```bash
228
+ uv run python scripts/thin_episodes.py --run confirm --pool heldout --bootstrap-episodes
229
+ uv run python scripts/test_hypotheses.py --run confirm
230
+ ```
231
+
232
+ `scripts/thin_episodes.py` overwrites `artifacts/thinning/` unless given `--out`. The same
233
+ cell can read differently across tables because it was run on more than one set of loss
234
+ seeds; the report's appendix lists each.
235
+
236
+ ## Data and license
237
+
238
+ - The capture histories, ledgers and results are also a Hugging Face dataset,
239
+ [`caiotheodoro/lacuna-capture-histories`](https://huggingface.co/datasets/caiotheodoro/lacuna-capture-histories),
240
+ built by `scripts/build_dataset.py`. It withholds the episode transcripts.
241
+ - Code and data are `Apache-2.0` (`LICENSE`, `NOTICE`). The `transcript` fields in
242
+ `artifacts/episodes/*/episodes.jsonl` hold the reasoning text of the DeepSeek and qwen
243
+ models the live runs used (served through OpenCode Go), which that license does not cover;
244
+ the provider's terms apply.
245
+ - Terms such as `ll_bic`, `fin_mid` and the linkages are defined in the dataset card's
246
+ glossary.
247
+ - The live runs cost $11.47 in all (summed from `artifacts/episodes/*/receipt.json` into
248
+ `artifacts/derived.json`; study 4 at the `deepseek-v4.1-flash` rates the runner applied to
249
+ every run, so its two qwen figures overstate the provider's cost). Study 5's recorded
250
+ sessions are not in that figure: each pool's `spent_usd` is in
251
+ `artifacts/study5/pools/*/pool.json`, 1.38 to 1.53 for each of the three confirmatory
252
+ pools and 0.49 to 0.77 for each pilot pool, in tokens at an assumed price (D89); the
253
+ provider's real price for those models was not found. The 420 runs replay those
254
+ sessions and made no paid call.