tracecite 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 (136) hide show
  1. tracecite-0.1.0/.gitignore +56 -0
  2. tracecite-0.1.0/LICENSE +22 -0
  3. tracecite-0.1.0/MANIFEST.in +8 -0
  4. tracecite-0.1.0/PKG-INFO +159 -0
  5. tracecite-0.1.0/README.md +135 -0
  6. tracecite-0.1.0/README.zh-CN.md +101 -0
  7. tracecite-0.1.0/docs/adr/README.md +46 -0
  8. tracecite-0.1.0/docs/agent-integration.md +602 -0
  9. tracecite-0.1.0/docs/agent-integration.zh-CN.md +568 -0
  10. tracecite-0.1.0/docs/architecture-governance.md +35 -0
  11. tracecite-0.1.0/docs/architecture.md +339 -0
  12. tracecite-0.1.0/docs/architecture.zh-CN.md +413 -0
  13. tracecite-0.1.0/docs/extension-contract.md +75 -0
  14. tracecite-0.1.0/docs/investigation-compare.md +83 -0
  15. tracecite-0.1.0/docs/investigation-compare.zh-CN.md +77 -0
  16. tracecite-0.1.0/docs/investigation-summary.md +32 -0
  17. tracecite-0.1.0/docs/investigation-summary.zh-CN.md +26 -0
  18. tracecite-0.1.0/docs/knowledge-governance.md +86 -0
  19. tracecite-0.1.0/docs/knowledge-governance.zh-CN.md +52 -0
  20. tracecite-0.1.0/docs/migrations/README.md +10 -0
  21. tracecite-0.1.0/docs/migrations/filter-provenance.md +21 -0
  22. tracecite-0.1.0/docs/migrations/filter-provenance.zh-CN.md +11 -0
  23. tracecite-0.1.0/docs/migrations/regex-resource-gate.md +18 -0
  24. tracecite-0.1.0/docs/migrations/regex-resource-gate.zh-CN.md +12 -0
  25. tracecite-0.1.0/docs/migrations/schema-compatibility.md +55 -0
  26. tracecite-0.1.0/docs/migrations/schema-compatibility.zh-CN.md +44 -0
  27. tracecite-0.1.0/docs/validation-checklist.md +100 -0
  28. tracecite-0.1.0/pyproject.toml +42 -0
  29. tracecite-0.1.0/scripts/check_architecture.py +612 -0
  30. tracecite-0.1.0/scripts/check_schema_compat.py +44 -0
  31. tracecite-0.1.0/setup.cfg +4 -0
  32. tracecite-0.1.0/src/tracecite/__init__.py +137 -0
  33. tracecite-0.1.0/src/tracecite/core/__init__.py +7 -0
  34. tracecite-0.1.0/src/tracecite/extension/__init__.py +104 -0
  35. tracecite-0.1.0/src/tracecite/integrations/__init__.py +3 -0
  36. tracecite-0.1.0/src/tracecite/integrations/agent_profile.py +195 -0
  37. tracecite-0.1.0/src/tracecite/integrations/agent_projection.py +173 -0
  38. tracecite-0.1.0/src/tracecite/integrations/cli.py +1225 -0
  39. tracecite-0.1.0/src/tracecite/integrations/evidence_ledger.py +293 -0
  40. tracecite-0.1.0/src/tracecite/knowledge/__init__.py +1286 -0
  41. tracecite-0.1.0/src/tracecite/output_layout.py +77 -0
  42. tracecite-0.1.0/src/tracecite/runtime/__init__.py +157 -0
  43. tracecite-0.1.0/src/tracecite/runtime/assertions.py +358 -0
  44. tracecite-0.1.0/src/tracecite/runtime/cli.py +9 -0
  45. tracecite-0.1.0/src/tracecite/runtime/investigation.py +2735 -0
  46. tracecite-0.1.0/src/tracecite/runtime/investigation_compare.py +902 -0
  47. tracecite-0.1.0/src/tracecite/runtime/investigation_summary.py +826 -0
  48. tracecite-0.1.0/src/tracecite/runtime/reporting.py +168 -0
  49. tracecite-0.1.0/src/tracecite/runtime/runtime.py +161 -0
  50. tracecite-0.1.0/src/tracecite/runtime/scenario.py +1940 -0
  51. tracecite-0.1.0/src/tracecite/runtime/schema.py +273 -0
  52. tracecite-0.1.0/src/tracecite/runtime/schema_compat.py +602 -0
  53. tracecite-0.1.0/src/tracecite/runtime/tools.py +1463 -0
  54. tracecite-0.1.0/src/tracecite.egg-info/PKG-INFO +159 -0
  55. tracecite-0.1.0/src/tracecite.egg-info/SOURCES.txt +134 -0
  56. tracecite-0.1.0/src/tracecite.egg-info/dependency_links.txt +1 -0
  57. tracecite-0.1.0/src/tracecite.egg-info/entry_points.txt +3 -0
  58. tracecite-0.1.0/src/tracecite.egg-info/requires.txt +4 -0
  59. tracecite-0.1.0/src/tracecite.egg-info/top_level.txt +2 -0
  60. tracecite-0.1.0/src/tracecite_core/__init__.py +158 -0
  61. tracecite-0.1.0/src/tracecite_core/cli.py +139 -0
  62. tracecite-0.1.0/src/tracecite_core/events.py +257 -0
  63. tracecite-0.1.0/src/tracecite_core/format_probe.py +629 -0
  64. tracecite-0.1.0/src/tracecite_core/immutable.py +19 -0
  65. tracecite-0.1.0/src/tracecite_core/live_cut.py +150 -0
  66. tracecite-0.1.0/src/tracecite_core/log_filter.py +2 -0
  67. tracecite-0.1.0/src/tracecite_core/matcher.py +745 -0
  68. tracecite-0.1.0/src/tracecite_core/output_layout.py +84 -0
  69. tracecite-0.1.0/src/tracecite_core/plugin_sdk.py +164 -0
  70. tracecite-0.1.0/src/tracecite_core/preprocess.py +121 -0
  71. tracecite-0.1.0/src/tracecite_core/records.py +63 -0
  72. tracecite-0.1.0/src/tracecite_core/run.py +379 -0
  73. tracecite-0.1.0/src/tracecite_core/sample.py +555 -0
  74. tracecite-0.1.0/src/tracecite_core/segment_store.py +157 -0
  75. tracecite-0.1.0/src/tracecite_core/segmenter.py +597 -0
  76. tracecite-0.1.0/src/tracecite_core/source.py +557 -0
  77. tracecite-0.1.0/src/tracecite_core/state_file.py +66 -0
  78. tracecite-0.1.0/src/tracecite_core/survey.py +605 -0
  79. tracecite-0.1.0/src/tracecite_core/text_filter.py +1441 -0
  80. tracecite-0.1.0/tests/fixtures/loghub/Android.log +4 -0
  81. tracecite-0.1.0/tests/fixtures/loghub/HDFS.log +4 -0
  82. tracecite-0.1.0/tests/fixtures/loghub/Hadoop.log +4 -0
  83. tracecite-0.1.0/tests/fixtures/loghub/HealthApp.log +4 -0
  84. tracecite-0.1.0/tests/fixtures/loghub/Linux.log +4 -0
  85. tracecite-0.1.0/tests/fixtures/loghub/Mac.log +4 -0
  86. tracecite-0.1.0/tests/fixtures/loghub/OpenSSH.log +4 -0
  87. tracecite-0.1.0/tests/fixtures/loghub/Spark.log +4 -0
  88. tracecite-0.1.0/tests/fixtures/loghub/Windows.log +4 -0
  89. tracecite-0.1.0/tests/fixtures/loghub/Zookeeper.log +4 -0
  90. tracecite-0.1.0/tests/fixtures/schema_compat/agent-result-v1.json +15 -0
  91. tracecite-0.1.0/tests/fixtures/schema_compat/budget-policy-v1.json +3 -0
  92. tracecite-0.1.0/tests/fixtures/schema_compat/filter-hits-unversioned.jsonl +1 -0
  93. tracecite-0.1.0/tests/fixtures/schema_compat/filter-records-unversioned.jsonl +1 -0
  94. tracecite-0.1.0/tests/fixtures/schema_compat/investigation-cache-v1.json +6 -0
  95. tracecite-0.1.0/tests/fixtures/schema_compat/investigation-compare-v1.json +27 -0
  96. tracecite-0.1.0/tests/fixtures/schema_compat/investigation-state-v1.json +21 -0
  97. tracecite-0.1.0/tests/fixtures/schema_compat/investigation-summary-v1.json +21 -0
  98. tracecite-0.1.0/tests/fixtures/schema_compat/investigation-timeline-v1.json +24 -0
  99. tracecite-0.1.0/tests/fixtures/schema_compat/knowledge-governance-v1.json +11 -0
  100. tracecite-0.1.0/tests/fixtures/schema_compat/knowledge-governance-v2.json +11 -0
  101. tracecite-0.1.0/tests/fixtures/schema_compat/run-manifest-v2.json +10 -0
  102. tracecite-0.1.0/tests/fixtures/schema_compat/scenario-document-v2.json +14 -0
  103. tracecite-0.1.0/tests/test_agent_profile.py +135 -0
  104. tracecite-0.1.0/tests/test_agent_projection.py +90 -0
  105. tracecite-0.1.0/tests/test_architecture_governance.py +136 -0
  106. tracecite-0.1.0/tests/test_budget_cache.py +440 -0
  107. tracecite-0.1.0/tests/test_cli.py +20 -0
  108. tracecite-0.1.0/tests/test_core_boundary.py +140 -0
  109. tracecite-0.1.0/tests/test_evidence_ledger.py +98 -0
  110. tracecite-0.1.0/tests/test_evidence_primitives.py +257 -0
  111. tracecite-0.1.0/tests/test_extension_contract.py +76 -0
  112. tracecite-0.1.0/tests/test_format_probe.py +338 -0
  113. tracecite-0.1.0/tests/test_format_segmenter.py +160 -0
  114. tracecite-0.1.0/tests/test_investigation.py +284 -0
  115. tracecite-0.1.0/tests/test_investigation_compare.py +288 -0
  116. tracecite-0.1.0/tests/test_investigation_summary.py +335 -0
  117. tracecite-0.1.0/tests/test_knowledge_candidate_integration.py +246 -0
  118. tracecite-0.1.0/tests/test_knowledge_governance.py +442 -0
  119. tracecite-0.1.0/tests/test_matcher.py +305 -0
  120. tracecite-0.1.0/tests/test_plugin_sdk.py +98 -0
  121. tracecite-0.1.0/tests/test_preprocess_streaming.py +27 -0
  122. tracecite-0.1.0/tests/test_preset_provenance.py +216 -0
  123. tracecite-0.1.0/tests/test_regex_safety_integration.py +31 -0
  124. tracecite-0.1.0/tests/test_run_events.py +107 -0
  125. tracecite-0.1.0/tests/test_runtime_boundary.py +36 -0
  126. tracecite-0.1.0/tests/test_runtime_cli.py +273 -0
  127. tracecite-0.1.0/tests/test_runtime_schema_tools.py +190 -0
  128. tracecite-0.1.0/tests/test_sample.py +195 -0
  129. tracecite-0.1.0/tests/test_scenario_cli_base_dir.py +42 -0
  130. tracecite-0.1.0/tests/test_scenario_pattern.py +42 -0
  131. tracecite-0.1.0/tests/test_schema_compat.py +101 -0
  132. tracecite-0.1.0/tests/test_source_safety.py +119 -0
  133. tracecite-0.1.0/tests/test_survey.py +142 -0
  134. tracecite-0.1.0/tests/test_survey_brief.py +44 -0
  135. tracecite-0.1.0/tests/test_text_filter_enhancements.py +477 -0
  136. tracecite-0.1.0/tests/test_text_filter_time_scope.py +179 -0
@@ -0,0 +1,56 @@
1
+ # OS, editor, and local graph data
2
+ .DS_Store
3
+ .code-review-graph/
4
+ .device-debug/
5
+ .workbuddy/
6
+
7
+ # Local environment and signing credentials
8
+ .env
9
+ .env.*
10
+ !.env.example
11
+ *.pem
12
+ *.key
13
+ *.p12
14
+ *.mobileprovision
15
+
16
+ # Python environments, caches, and build outputs
17
+ __pycache__/
18
+ *.py[cod]
19
+ *.egg-info/
20
+ .venv/
21
+ venv/
22
+ build/
23
+ dist/
24
+ .pytest_cache/
25
+ .mypy_cache/
26
+ .ruff_cache/
27
+ .tox/
28
+ .nox/
29
+ .cache/
30
+ .coverage
31
+ .coverage.*
32
+ coverage.xml
33
+ htmlcov/
34
+
35
+ # Crash reports, Apple build bundles, and local databases
36
+ *.ips
37
+ *.crash
38
+ *.xcresult
39
+ *.xcarchive
40
+ *.dSYM/
41
+ *.sqlite
42
+ *.db
43
+
44
+ # TraceCite runtime evidence and filter sidecars
45
+ /.tracecite/
46
+ .filtered/
47
+ *.records.jsonl
48
+ *.hits.jsonl
49
+ *.templates.jsonl
50
+ filter_history.jsonl
51
+ filter_history.jsonl.lock
52
+ *.log
53
+ !tests/fixtures/loghub/*.log
54
+ *.trace
55
+ *.trace.zip
56
+ experiments
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 TraceCite Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
@@ -0,0 +1,8 @@
1
+ include LICENSE
2
+ include .gitignore
3
+ include README.md
4
+ include README.zh-CN.md
5
+ recursive-include docs *.md
6
+ recursive-include scripts *.py
7
+ recursive-include tests *.py
8
+ recursive-include tests/fixtures *.json *.jsonl *.log
@@ -0,0 +1,159 @@
1
+ Metadata-Version: 2.4
2
+ Name: tracecite
3
+ Version: 0.1.0
4
+ Summary: Extensible evidence runtime for AI agents.
5
+ Author: TraceCite Contributors
6
+ License-Expression: MIT
7
+ Keywords: text,evidence,filter,agents,log-analysis
8
+ Classifier: Development Status :: 3 - Alpha
9
+ Classifier: Operating System :: MacOS
10
+ Classifier: Operating System :: POSIX :: Linux
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.10
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Programming Language :: Python :: 3.14
17
+ Requires-Python: >=3.10
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE
20
+ Provides-Extra: dev
21
+ Requires-Dist: build>=1; extra == "dev"
22
+ Requires-Dist: pytest>=7; extra == "dev"
23
+ Dynamic: license-file
24
+
25
+ # TraceCite
26
+
27
+ **Agent context gateway for AI debugging agents.**
28
+
29
+ TraceCite controls what log evidence enters the agent's context window.
30
+ It freezes inputs, returns line-addressable evidence pointers, verifies their
31
+ provenance, and keeps the full record on disk for on-demand expansion.
32
+ Domain packages add collection and semantics without modifying the gateway kernel.
33
+
34
+ TraceCite is **not a replacement for grep** and is **not a token optimizer**.
35
+ Against skilled `grep | head` usage it is typically not cheaper in tokens — it
36
+ is **bounded, auditable, and resistant to over-inference**.
37
+
38
+ ```text
39
+ Raw data -> Core evidence -> Runtime tools -> Your Agent
40
+ ^
41
+ |
42
+ Domain extensions
43
+ Mobile / CI / third-party
44
+ ```
45
+
46
+ TraceCite is infrastructure **for** Codex, Claude, ChatGPT, or a custom agent.
47
+ It does not embed another LLM agent.
48
+
49
+ ## Install
50
+
51
+ ```bash
52
+ pip install tracecite
53
+ ```
54
+
55
+ The package has no runtime dependencies outside the Python standard library.
56
+ Python 3.10 or newer on Linux and macOS is supported. Windows is not currently
57
+ supported because TraceCite's atomic state locking relies on POSIX `flock`.
58
+
59
+ ## Agent-facing tools
60
+
61
+ ```bash
62
+ tracecite probe ./logs --glob "*.log" --recursive
63
+ tracecite search app.log "timeout|OOM" --regex --snapshot
64
+ tracecite expand .tracecite/snapshots/app.log 120 --before 5 --after 10
65
+ tracecite verify .tracecite/runs/<run-id>/manifest.json
66
+ tracecite run scenario.json
67
+ ```
68
+
69
+ Every command returns deterministic JSON. `status` describes whether execution
70
+ succeeded; `outcome` separately describes what the evidence supports. A valid
71
+ zero-match search is not an execution error and does not prove absence.
72
+
73
+ Before connecting Codex, Claude, or another host, read the
74
+ [external Agent integration guide](docs/agent-integration.md). It includes the
75
+ tool loop, Result JSON contract, exit codes, safety rules, and a reusable test
76
+ prompt.
77
+
78
+ The normative [architecture design](docs/architecture.md) defines the common
79
+ investigation protocol, evidence and knowledge model, extension boundaries,
80
+ implementation status, and the rules for future architectural evolution.
81
+
82
+ The lower-level evidence CLI remains available as `tracecite-core`.
83
+
84
+ ## Stable kernel, public extension boundary
85
+
86
+ One main distribution contains four logical layers:
87
+
88
+ - `tracecite_core`: evidence, source, segment, transform, snapshot, manifest,
89
+ verification, and the low-level plugin SDK.
90
+ - `tracecite.runtime`: scenario, assertion, reporting, result schema, budgets,
91
+ stop/safety gates, and agent-facing tools.
92
+ - `tracecite.extension`: the versioned third-party registration contract.
93
+ - `tracecite.integrations`: CLI now; MCP and agent-platform adapters later.
94
+
95
+ Domain semantics do not belong in the main package. The official
96
+ `tracecite-mobile` project is an extension and a contract dogfood project.
97
+
98
+ ## Build an extension without forking TraceCite
99
+
100
+ ```toml
101
+ [project]
102
+ name = "my-company-tracecite"
103
+ dependencies = ["tracecite>=0.1,<0.2"]
104
+
105
+ [project.entry-points."tracecite.extensions"]
106
+ my_domain = "my_tracecite.extension"
107
+ ```
108
+
109
+ ```python
110
+ from tracecite.extension import ExtensionAPI
111
+ from tracecite.runtime import ScenarioRuntime
112
+
113
+ TRACECITE_EXTENSION_API = "1"
114
+ MY_RUNTIME = ScenarioRuntime(
115
+ load_profile=load_profile,
116
+ resolve_scenario_pattern=resolve_pattern,
117
+ )
118
+
119
+ def register(api: ExtensionAPI) -> None:
120
+ api.register_runtime("my-domain", MY_RUNTIME)
121
+ ```
122
+
123
+ Loading third-party code is explicit:
124
+
125
+ ```bash
126
+ tracecite extension load
127
+ tracecite run scenario.json --runtime my-domain --load-extensions
128
+ ```
129
+
130
+ Importing `tracecite` alone never executes installed extension registration
131
+ code. Registration conflicts fail by default, API versions are checked, and
132
+ the default Runtime does not grant live-source or action capabilities.
133
+
134
+ See [the extension contract](docs/extension-contract.md) and the
135
+ [pending domain-validation checklist](docs/validation-checklist.md). Agent
136
+ knowledge uses the separate
137
+ [proposal, verification, and promotion lifecycle](docs/knowledge-governance.md).
138
+
139
+ ## Design principles
140
+
141
+ - **Bounded output, not bounded cost** — search caps evidence count (agent default 30, configurable via `--max-evidence`); `--max-line-chars` and `--max-output-chars` cap agent-facing text; full artifacts remain on disk.
142
+ - Evidence is traceable, not automatically complete or true.
143
+ - `unknown` and `missing_evidence` are first-class results.
144
+ - Agent conclusions never promote themselves into trusted knowledge.
145
+ - Extensions add capabilities and semantics; Runtime retains execution,
146
+ evidence, verification, budget, and safety control.
147
+ - Core never imports Runtime or domain packages; Runtime never imports domains.
148
+
149
+ ## Status
150
+
151
+ The internal Runtime consolidation and compatibility layer are implemented.
152
+ Mobile's public-extension and PlatformBackend contracts pass offline iOS and
153
+ Android fixtures; real-device acceptance and the CI domain pilot remain
154
+ pending. MCP and other agent-platform adapters follow only after those
155
+ contracts are validated.
156
+
157
+ ## License
158
+
159
+ MIT
@@ -0,0 +1,135 @@
1
+ # TraceCite
2
+
3
+ **Agent context gateway for AI debugging agents.**
4
+
5
+ TraceCite controls what log evidence enters the agent's context window.
6
+ It freezes inputs, returns line-addressable evidence pointers, verifies their
7
+ provenance, and keeps the full record on disk for on-demand expansion.
8
+ Domain packages add collection and semantics without modifying the gateway kernel.
9
+
10
+ TraceCite is **not a replacement for grep** and is **not a token optimizer**.
11
+ Against skilled `grep | head` usage it is typically not cheaper in tokens — it
12
+ is **bounded, auditable, and resistant to over-inference**.
13
+
14
+ ```text
15
+ Raw data -> Core evidence -> Runtime tools -> Your Agent
16
+ ^
17
+ |
18
+ Domain extensions
19
+ Mobile / CI / third-party
20
+ ```
21
+
22
+ TraceCite is infrastructure **for** Codex, Claude, ChatGPT, or a custom agent.
23
+ It does not embed another LLM agent.
24
+
25
+ ## Install
26
+
27
+ ```bash
28
+ pip install tracecite
29
+ ```
30
+
31
+ The package has no runtime dependencies outside the Python standard library.
32
+ Python 3.10 or newer on Linux and macOS is supported. Windows is not currently
33
+ supported because TraceCite's atomic state locking relies on POSIX `flock`.
34
+
35
+ ## Agent-facing tools
36
+
37
+ ```bash
38
+ tracecite probe ./logs --glob "*.log" --recursive
39
+ tracecite search app.log "timeout|OOM" --regex --snapshot
40
+ tracecite expand .tracecite/snapshots/app.log 120 --before 5 --after 10
41
+ tracecite verify .tracecite/runs/<run-id>/manifest.json
42
+ tracecite run scenario.json
43
+ ```
44
+
45
+ Every command returns deterministic JSON. `status` describes whether execution
46
+ succeeded; `outcome` separately describes what the evidence supports. A valid
47
+ zero-match search is not an execution error and does not prove absence.
48
+
49
+ Before connecting Codex, Claude, or another host, read the
50
+ [external Agent integration guide](docs/agent-integration.md). It includes the
51
+ tool loop, Result JSON contract, exit codes, safety rules, and a reusable test
52
+ prompt.
53
+
54
+ The normative [architecture design](docs/architecture.md) defines the common
55
+ investigation protocol, evidence and knowledge model, extension boundaries,
56
+ implementation status, and the rules for future architectural evolution.
57
+
58
+ The lower-level evidence CLI remains available as `tracecite-core`.
59
+
60
+ ## Stable kernel, public extension boundary
61
+
62
+ One main distribution contains four logical layers:
63
+
64
+ - `tracecite_core`: evidence, source, segment, transform, snapshot, manifest,
65
+ verification, and the low-level plugin SDK.
66
+ - `tracecite.runtime`: scenario, assertion, reporting, result schema, budgets,
67
+ stop/safety gates, and agent-facing tools.
68
+ - `tracecite.extension`: the versioned third-party registration contract.
69
+ - `tracecite.integrations`: CLI now; MCP and agent-platform adapters later.
70
+
71
+ Domain semantics do not belong in the main package. The official
72
+ `tracecite-mobile` project is an extension and a contract dogfood project.
73
+
74
+ ## Build an extension without forking TraceCite
75
+
76
+ ```toml
77
+ [project]
78
+ name = "my-company-tracecite"
79
+ dependencies = ["tracecite>=0.1,<0.2"]
80
+
81
+ [project.entry-points."tracecite.extensions"]
82
+ my_domain = "my_tracecite.extension"
83
+ ```
84
+
85
+ ```python
86
+ from tracecite.extension import ExtensionAPI
87
+ from tracecite.runtime import ScenarioRuntime
88
+
89
+ TRACECITE_EXTENSION_API = "1"
90
+ MY_RUNTIME = ScenarioRuntime(
91
+ load_profile=load_profile,
92
+ resolve_scenario_pattern=resolve_pattern,
93
+ )
94
+
95
+ def register(api: ExtensionAPI) -> None:
96
+ api.register_runtime("my-domain", MY_RUNTIME)
97
+ ```
98
+
99
+ Loading third-party code is explicit:
100
+
101
+ ```bash
102
+ tracecite extension load
103
+ tracecite run scenario.json --runtime my-domain --load-extensions
104
+ ```
105
+
106
+ Importing `tracecite` alone never executes installed extension registration
107
+ code. Registration conflicts fail by default, API versions are checked, and
108
+ the default Runtime does not grant live-source or action capabilities.
109
+
110
+ See [the extension contract](docs/extension-contract.md) and the
111
+ [pending domain-validation checklist](docs/validation-checklist.md). Agent
112
+ knowledge uses the separate
113
+ [proposal, verification, and promotion lifecycle](docs/knowledge-governance.md).
114
+
115
+ ## Design principles
116
+
117
+ - **Bounded output, not bounded cost** — search caps evidence count (agent default 30, configurable via `--max-evidence`); `--max-line-chars` and `--max-output-chars` cap agent-facing text; full artifacts remain on disk.
118
+ - Evidence is traceable, not automatically complete or true.
119
+ - `unknown` and `missing_evidence` are first-class results.
120
+ - Agent conclusions never promote themselves into trusted knowledge.
121
+ - Extensions add capabilities and semantics; Runtime retains execution,
122
+ evidence, verification, budget, and safety control.
123
+ - Core never imports Runtime or domain packages; Runtime never imports domains.
124
+
125
+ ## Status
126
+
127
+ The internal Runtime consolidation and compatibility layer are implemented.
128
+ Mobile's public-extension and PlatformBackend contracts pass offline iOS and
129
+ Android fixtures; real-device acceptance and the CI domain pilot remain
130
+ pending. MCP and other agent-platform adapters follow only after those
131
+ contracts are validated.
132
+
133
+ ## License
134
+
135
+ MIT
@@ -0,0 +1,101 @@
1
+ # TraceCite
2
+
3
+ **面向 AI 调试 Agent 的可扩展证据运行时。**
4
+
5
+ TraceCite 为大体量、持续变化的日志提供有界且可校验来源的证据视图。它会冻结输入、返回证据引用、校验证据来源,并允许第三方在不修改 TraceCite 源码的情况下增加领域能力。
6
+
7
+ ```text
8
+ 原始数据 -> Core 证据层 -> Runtime 工具层 -> 外部 Agent
9
+ ^
10
+ |
11
+ 领域扩展包
12
+ Mobile / CI / 第三方
13
+ ```
14
+
15
+ TraceCite 是给 Codex、Claude、ChatGPT 或自研 Agent 使用的基础设施,内部不再套一层 LLM Agent。
16
+
17
+ ## 安装与使用
18
+
19
+ ```bash
20
+ pip install tracecite
21
+
22
+ tracecite probe ./logs --glob "*.log" --recursive
23
+ tracecite search app.log "timeout|OOM" --regex --snapshot
24
+ tracecite expand .tracecite/snapshots/app.log 120 --before 5 --after 10
25
+ tracecite verify .tracecite/runs/<run-id>/manifest.json
26
+ tracecite run scenario.json
27
+ ```
28
+
29
+ 运行环境为 Python 3.10 及以上版本,支持 Linux 和 macOS。当前暂不支持 Windows,
30
+ 因为 TraceCite 的原子状态锁依赖 POSIX `flock`。除 Python 标准库外无运行时依赖。
31
+
32
+ 所有命令返回确定性的 JSON。`status` 表示执行是否成功,`outcome` 单独表示证据支持什么。零命中是合法结果,不等于“问题没有发生”。
33
+
34
+ 准备让 Codex、Claude 或其他自研 Agent 直接测试时,请先阅读[外部 Agent 接入指南](docs/agent-integration.zh-CN.md)。其中包含调用顺序、Result JSON、退出码、安全规则和可复制的测试 Prompt。
35
+
36
+ 规范性的[架构设计](docs/architecture.zh-CN.md)定义了通用调查协议、证据与知识模型、扩展边界、当前实现状态以及后续架构演进的维护规则。
37
+
38
+ 低层证据命令仍可通过 `tracecite-core` 使用。
39
+
40
+ ## 一个主项目,清晰的逻辑边界
41
+
42
+ - `tracecite_core`:Source、Segment、Transform、Evidence、Snapshot、Manifest、Verify 与底层 Plugin SDK。
43
+ - `tracecite.runtime`:Scenario、Assertion、Reporting、Result schema、预算、安全门禁和 Agent 工具。
44
+ - `tracecite.extension`:有版本的第三方扩展契约。
45
+ - `tracecite.integrations`:目前提供 CLI;MCP、Codex Skill 等适配器后续再接。
46
+
47
+ 领域语义不进入主包。`tracecite-mobile` 是独立的官方扩展,也是 Extension API 的真实验证项目。
48
+
49
+ ## 不改主库,增加自己的能力
50
+
51
+ 第三方包只依赖一个公开发行包:
52
+
53
+ ```toml
54
+ [project]
55
+ name = "my-company-tracecite"
56
+ dependencies = ["tracecite>=0.1,<0.2"]
57
+
58
+ [project.entry-points."tracecite.extensions"]
59
+ my_domain = "my_tracecite.extension"
60
+ ```
61
+
62
+ ```python
63
+ from tracecite.extension import ExtensionAPI
64
+ from tracecite.runtime import ScenarioRuntime
65
+
66
+ TRACECITE_EXTENSION_API = "1"
67
+ MY_RUNTIME = ScenarioRuntime(
68
+ load_profile=load_profile,
69
+ resolve_scenario_pattern=resolve_pattern,
70
+ )
71
+
72
+ def register(api: ExtensionAPI) -> None:
73
+ api.register_runtime("my-domain", MY_RUNTIME)
74
+ ```
75
+
76
+ 加载第三方代码是显式动作:
77
+
78
+ ```bash
79
+ tracecite extension load
80
+ tracecite run scenario.json --runtime my-domain --load-extensions
81
+ ```
82
+
83
+ 仅仅 `import tracecite` 不会执行第三方注册代码。API 版本会校验,注册冲突默认失败,默认 Runtime 不授权 live source 和 action。
84
+
85
+ 详细约束见[扩展契约](docs/extension-contract.md);第 7 步已完成 Mobile 离线契约验证,真机与 CI 试点仍待执行,具体流程见[领域验证清单](docs/validation-checklist.md)。Agent 知识写入遵循独立的[提案、验证与晋升流程](docs/knowledge-governance.zh-CN.md)。
86
+
87
+ ## 核心原则
88
+
89
+ - Evidence 可追溯,但不自动等于完整事实或真相。
90
+ - `unknown` 和 `missing_evidence` 是一等结果。
91
+ - Agent 自己生成的结论不能自动晋升为可信 Knowledge。
92
+ - Extension 提供能力和领域语义;Runtime 保留执行、预算、验证和安全控制权。
93
+ - Core 不导入 Runtime 或领域;Runtime 不导入 Mobile/CI。
94
+
95
+ ## 当前状态
96
+
97
+ 主项目 Runtime 合并与旧 API 兼容层已实现。Mobile 公共扩展和 PlatformBackend 契约已通过 iOS/Android 离线 fixture;真机验收与 CI 领域试点仍待执行,通过前不推进 MCP 或其他 Agent 平台 Adapter。
98
+
99
+ ## License
100
+
101
+ MIT
@@ -0,0 +1,46 @@
1
+ # Architecture Decision Records
2
+
3
+ Use an Architecture Decision Record (ADR) for an incompatible architectural change or a decision with a long-lived trade-off. Small internal refactors that preserve the contracts in `docs/architecture.md` do not require an ADR.
4
+
5
+ Name records `NNNN-short-title.md`. ADRs are immutable after acceptance except for status and links; superseding decisions create a new ADR.
6
+
7
+ Required template:
8
+
9
+ ```markdown
10
+ # NNNN: Decision title
11
+
12
+ - Status: proposed | accepted | superseded | rejected
13
+ - Date: YYYY-MM-DD
14
+ - Owners:
15
+ - Supersedes:
16
+ - Superseded by:
17
+
18
+ ## Context
19
+
20
+ What problem, constraints, and evidence require a decision?
21
+
22
+ ## Decision
23
+
24
+ What is changing, and which architectural invariant or public contract is affected?
25
+
26
+ ## Alternatives considered
27
+
28
+ What credible alternatives were evaluated and why were they not selected?
29
+
30
+ ## Consequences
31
+
32
+ Positive effects, costs, risks, compatibility impact, and operational impact.
33
+
34
+ ## Migration and validation
35
+
36
+ Schema/API versioning, rollout, rollback, tests, and at least two domain cases when a main-package boundary changes.
37
+
38
+ ## Documentation updates
39
+
40
+ List the architecture, integration, extension, knowledge, and validation documents updated with this decision.
41
+ ```
42
+
43
+ Both [`docs/architecture.md`](../architecture.md) and
44
+ [`docs/architecture.zh-CN.md`](../architecture.zh-CN.md) remain the current
45
+ architecture contract. ADRs explain why that contract changed; they do not
46
+ replace it.