atif-sql 0.2.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 (189) hide show
  1. atif_sql-0.2.0/.gitignore +54 -0
  2. atif_sql-0.2.0/.vale/styles/Google/LICENSE +21 -0
  3. atif_sql-0.2.0/.vale/styles/proselint/LICENSE +29 -0
  4. atif_sql-0.2.0/.vale/styles/proselint/README.md +12 -0
  5. atif_sql-0.2.0/LICENSE +202 -0
  6. atif_sql-0.2.0/PKG-INFO +272 -0
  7. atif_sql-0.2.0/README.md +231 -0
  8. atif_sql-0.2.0/docs/README.md +92 -0
  9. atif_sql-0.2.0/packages/atif-analytics/LICENSE +1 -0
  10. atif_sql-0.2.0/packages/atif-analytics/README.md +29 -0
  11. atif_sql-0.2.0/packages/atif-analytics/pyproject.toml +48 -0
  12. atif_sql-0.2.0/packages/atif-analytics/src/atif_analytics/__init__.py +9 -0
  13. atif_sql-0.2.0/packages/atif-analytics/src/atif_analytics/application/__init__.py +3 -0
  14. atif_sql-0.2.0/packages/atif-analytics/src/atif_analytics/application/analyze.py +158 -0
  15. atif_sql-0.2.0/packages/atif-analytics/src/atif_analytics/application/prompts.py +750 -0
  16. atif_sql-0.2.0/packages/atif-analytics/src/atif_analytics/application/use_cases/__init__.py +3 -0
  17. atif_sql-0.2.0/packages/atif-analytics/src/atif_analytics/application/use_cases/_shared.py +264 -0
  18. atif_sql-0.2.0/packages/atif-analytics/src/atif_analytics/application/use_cases/classify.py +430 -0
  19. atif_sql-0.2.0/packages/atif-analytics/src/atif_analytics/application/use_cases/conflicts.py +448 -0
  20. atif_sql-0.2.0/packages/atif-analytics/src/atif_analytics/application/use_cases/friction.py +634 -0
  21. atif_sql-0.2.0/packages/atif-analytics/src/atif_analytics/application/use_cases/perceived.py +451 -0
  22. atif_sql-0.2.0/packages/atif-analytics/src/atif_analytics/domain/__init__.py +3 -0
  23. atif_sql-0.2.0/packages/atif-analytics/src/atif_analytics/domain/authorship.py +166 -0
  24. atif_sql-0.2.0/packages/atif-analytics/src/atif_analytics/domain/config.py +30 -0
  25. atif_sql-0.2.0/packages/atif-analytics/src/atif_analytics/domain/costs.py +50 -0
  26. atif_sql-0.2.0/packages/atif-analytics/src/atif_analytics/domain/friction.py +117 -0
  27. atif_sql-0.2.0/packages/atif-analytics/src/atif_analytics/domain/layout.py +94 -0
  28. atif_sql-0.2.0/packages/atif-analytics/src/atif_analytics/domain/models.py +385 -0
  29. atif_sql-0.2.0/packages/atif-analytics/src/atif_analytics/domain/ports.py +100 -0
  30. atif_sql-0.2.0/packages/atif-analytics/src/atif_analytics/domain/transcript.py +359 -0
  31. atif_sql-0.2.0/packages/atif-analytics/src/atif_analytics/infrastructure/__init__.py +3 -0
  32. atif_sql-0.2.0/packages/atif-analytics/src/atif_analytics/infrastructure/corpus_reader.py +546 -0
  33. atif_sql-0.2.0/packages/atif-analytics/src/atif_analytics/infrastructure/parquet_cache.py +186 -0
  34. atif_sql-0.2.0/packages/atif-analytics/src/atif_analytics/infrastructure/settings.py +114 -0
  35. atif_sql-0.2.0/packages/atif-analytics/src/atif_analytics/infrastructure/sqlite_state/__init__.py +3 -0
  36. atif_sql-0.2.0/packages/atif-analytics/src/atif_analytics/infrastructure/sqlite_state/checkpointer.py +326 -0
  37. atif_sql-0.2.0/packages/atif-analytics/src/atif_analytics/infrastructure/sqlite_state/retry_queue.py +296 -0
  38. atif_sql-0.2.0/packages/atif-analytics/src/atif_analytics/py.typed +0 -0
  39. atif_sql-0.2.0/packages/atif-cli/LICENSE +1 -0
  40. atif_sql-0.2.0/packages/atif-cli/README.md +35 -0
  41. atif_sql-0.2.0/packages/atif-cli/pyproject.toml +65 -0
  42. atif_sql-0.2.0/packages/atif-cli/src/atif_cli/__init__.py +3 -0
  43. atif_sql-0.2.0/packages/atif-cli/src/atif_cli/__main__.py +8 -0
  44. atif_sql-0.2.0/packages/atif-cli/src/atif_cli/app.py +2459 -0
  45. atif_sql-0.2.0/packages/atif-cli/src/atif_cli/converter_adapter.py +151 -0
  46. atif_sql-0.2.0/packages/atif-cli/src/atif_cli/corpus.py +409 -0
  47. atif_sql-0.2.0/packages/atif-cli/src/atif_cli/cron.py +311 -0
  48. atif_sql-0.2.0/packages/atif-cli/src/atif_cli/duck_errors.py +97 -0
  49. atif_sql-0.2.0/packages/atif-cli/src/atif_cli/embed_lake.py +101 -0
  50. atif_sql-0.2.0/packages/atif-cli/src/atif_cli/errors.py +89 -0
  51. atif_sql-0.2.0/packages/atif-cli/src/atif_cli/lake.py +373 -0
  52. atif_sql-0.2.0/packages/atif-cli/src/atif_cli/lake_sessions.py +270 -0
  53. atif_sql-0.2.0/packages/atif-cli/src/atif_cli/output.py +297 -0
  54. atif_sql-0.2.0/packages/atif-cli/src/atif_cli/py.typed +0 -0
  55. atif_sql-0.2.0/packages/atif-converter/LICENSE +1 -0
  56. atif_sql-0.2.0/packages/atif-converter/README.md +72 -0
  57. atif_sql-0.2.0/packages/atif-converter/pyproject.toml +45 -0
  58. atif_sql-0.2.0/packages/atif-converter/src/atif_converter/__init__.py +3 -0
  59. atif_sql-0.2.0/packages/atif-converter/src/atif_converter/application/__init__.py +3 -0
  60. atif_sql-0.2.0/packages/atif-converter/src/atif_converter/application/convert_and_audit.py +294 -0
  61. atif_sql-0.2.0/packages/atif-converter/src/atif_converter/application/convert_codex.py +210 -0
  62. atif_sql-0.2.0/packages/atif-converter/src/atif_converter/domain/__init__.py +9 -0
  63. atif_sql-0.2.0/packages/atif-converter/src/atif_converter/domain/agents.py +40 -0
  64. atif_sql-0.2.0/packages/atif-converter/src/atif_converter/domain/atif/__init__.py +55 -0
  65. atif_sql-0.2.0/packages/atif-converter/src/atif_converter/domain/atif/agent.py +37 -0
  66. atif_sql-0.2.0/packages/atif-converter/src/atif_converter/domain/atif/content.py +161 -0
  67. atif_sql-0.2.0/packages/atif-converter/src/atif_converter/domain/atif/final_metrics.py +45 -0
  68. atif_sql-0.2.0/packages/atif-converter/src/atif_converter/domain/atif/metrics.py +49 -0
  69. atif_sql-0.2.0/packages/atif-converter/src/atif_converter/domain/atif/observation.py +21 -0
  70. atif_sql-0.2.0/packages/atif-converter/src/atif_converter/domain/atif/observation_result.py +47 -0
  71. atif_sql-0.2.0/packages/atif-converter/src/atif_converter/domain/atif/step.py +144 -0
  72. atif_sql-0.2.0/packages/atif-converter/src/atif_converter/domain/atif/subagent_trajectory_ref.py +90 -0
  73. atif_sql-0.2.0/packages/atif-converter/src/atif_converter/domain/atif/tool_call.py +36 -0
  74. atif_sql-0.2.0/packages/atif-converter/src/atif_converter/domain/atif/trajectory.py +211 -0
  75. atif_sql-0.2.0/packages/atif-converter/src/atif_converter/domain/atif/trajectory_validator.py +299 -0
  76. atif_sql-0.2.0/packages/atif-converter/src/atif_converter/domain/blobs.py +510 -0
  77. atif_sql-0.2.0/packages/atif-converter/src/atif_converter/domain/claude_code_conversion.py +1077 -0
  78. atif_sql-0.2.0/packages/atif-converter/src/atif_converter/domain/codex_conversion.py +1036 -0
  79. atif_sql-0.2.0/packages/atif-converter/src/atif_converter/domain/codex_edges.py +192 -0
  80. atif_sql-0.2.0/packages/atif-converter/src/atif_converter/domain/codex_enrichment.py +419 -0
  81. atif_sql-0.2.0/packages/atif-converter/src/atif_converter/domain/codex_fidelity.py +124 -0
  82. atif_sql-0.2.0/packages/atif-converter/src/atif_converter/domain/codex_nested_calls.py +165 -0
  83. atif_sql-0.2.0/packages/atif-converter/src/atif_converter/domain/edges.py +113 -0
  84. atif_sql-0.2.0/packages/atif-converter/src/atif_converter/domain/enrichment.py +412 -0
  85. atif_sql-0.2.0/packages/atif-converter/src/atif_converter/domain/errors.py +60 -0
  86. atif_sql-0.2.0/packages/atif-converter/src/atif_converter/domain/fidelity.py +171 -0
  87. atif_sql-0.2.0/packages/atif-converter/src/atif_converter/domain/model_prices.json +8538 -0
  88. atif_sql-0.2.0/packages/atif-converter/src/atif_converter/domain/pricing.py +790 -0
  89. atif_sql-0.2.0/packages/atif-converter/src/atif_converter/domain/result_signals.py +774 -0
  90. atif_sql-0.2.0/packages/atif-converter/src/atif_converter/domain/schema_version.py +90 -0
  91. atif_sql-0.2.0/packages/atif-converter/src/atif_converter/domain/session_events.py +408 -0
  92. atif_sql-0.2.0/packages/atif-converter/src/atif_converter/infrastructure/__init__.py +3 -0
  93. atif_sql-0.2.0/packages/atif-converter/src/atif_converter/infrastructure/census.py +89 -0
  94. atif_sql-0.2.0/packages/atif-converter/src/atif_converter/infrastructure/claude_code_converter.py +127 -0
  95. atif_sql-0.2.0/packages/atif-converter/src/atif_converter/infrastructure/codex_adapter.py +132 -0
  96. atif_sql-0.2.0/packages/atif-converter/src/atif_converter/infrastructure/codex_census.py +100 -0
  97. atif_sql-0.2.0/packages/atif-converter/src/atif_converter/infrastructure/codex_converter.py +82 -0
  98. atif_sql-0.2.0/packages/atif-converter/src/atif_converter/infrastructure/harbor_adapter.py +187 -0
  99. atif_sql-0.2.0/packages/atif-converter/src/atif_converter/infrastructure/raw_records.py +426 -0
  100. atif_sql-0.2.0/packages/atif-converter/src/atif_converter/infrastructure/source_archive.py +154 -0
  101. atif_sql-0.2.0/packages/atif-converter/src/atif_converter/py.typed +0 -0
  102. atif_sql-0.2.0/packages/atif-corpus/LICENSE +1 -0
  103. atif_sql-0.2.0/packages/atif-corpus/README.md +31 -0
  104. atif_sql-0.2.0/packages/atif-corpus/pyproject.toml +37 -0
  105. atif_sql-0.2.0/packages/atif-corpus/src/atif_corpus/__init__.py +13 -0
  106. atif_sql-0.2.0/packages/atif-corpus/src/atif_corpus/application/__init__.py +7 -0
  107. atif_sql-0.2.0/packages/atif-corpus/src/atif_corpus/application/materialize.py +1826 -0
  108. atif_sql-0.2.0/packages/atif-corpus/src/atif_corpus/domain/__init__.py +9 -0
  109. atif_sql-0.2.0/packages/atif-corpus/src/atif_corpus/domain/agents.py +33 -0
  110. atif_sql-0.2.0/packages/atif-corpus/src/atif_corpus/domain/generation.py +34 -0
  111. atif_sql-0.2.0/packages/atif-corpus/src/atif_corpus/domain/layout.py +168 -0
  112. atif_sql-0.2.0/packages/atif-corpus/src/atif_corpus/domain/ports.py +175 -0
  113. atif_sql-0.2.0/packages/atif-corpus/src/atif_corpus/domain/session_id.py +68 -0
  114. atif_sql-0.2.0/packages/atif-corpus/src/atif_corpus/domain/sessions.py +228 -0
  115. atif_sql-0.2.0/packages/atif-corpus/src/atif_corpus/domain/slug.py +72 -0
  116. atif_sql-0.2.0/packages/atif-corpus/src/atif_corpus/domain/source_layout.py +143 -0
  117. atif_sql-0.2.0/packages/atif-corpus/src/atif_corpus/domain/watermark.py +76 -0
  118. atif_sql-0.2.0/packages/atif-corpus/src/atif_corpus/infrastructure/__init__.py +7 -0
  119. atif_sql-0.2.0/packages/atif-corpus/src/atif_corpus/infrastructure/atomic.py +266 -0
  120. atif_sql-0.2.0/packages/atif-corpus/src/atif_corpus/infrastructure/compress_artifacts.py +161 -0
  121. atif_sql-0.2.0/packages/atif-corpus/src/atif_corpus/infrastructure/fake_converter.py +174 -0
  122. atif_sql-0.2.0/packages/atif-corpus/src/atif_corpus/infrastructure/scanner.py +316 -0
  123. atif_sql-0.2.0/packages/atif-corpus/src/atif_corpus/infrastructure/settings.py +130 -0
  124. atif_sql-0.2.0/packages/atif-corpus/src/atif_corpus/infrastructure/source_archive.py +202 -0
  125. atif_sql-0.2.0/packages/atif-corpus/src/atif_corpus/py.typed +0 -0
  126. atif_sql-0.2.0/packages/atif-duck/LICENSE +1 -0
  127. atif_sql-0.2.0/packages/atif-duck/README.md +134 -0
  128. atif_sql-0.2.0/packages/atif-duck/pyproject.toml +51 -0
  129. atif_sql-0.2.0/packages/atif-duck/src/atif_duck/__init__.py +43 -0
  130. atif_sql-0.2.0/packages/atif-duck/src/atif_duck/domain/__init__.py +32 -0
  131. atif_sql-0.2.0/packages/atif-duck/src/atif_duck/domain/artifacts.py +66 -0
  132. atif_sql-0.2.0/packages/atif-duck/src/atif_duck/domain/authorship.py +165 -0
  133. atif_sql-0.2.0/packages/atif-duck/src/atif_duck/domain/catalog.py +626 -0
  134. atif_sql-0.2.0/packages/atif-duck/src/atif_duck/domain/columnar.py +149 -0
  135. atif_sql-0.2.0/packages/atif-duck/src/atif_duck/domain/embedding_guard.py +88 -0
  136. atif_sql-0.2.0/packages/atif-duck/src/atif_duck/domain/examples.py +265 -0
  137. atif_sql-0.2.0/packages/atif-duck/src/atif_duck/domain/lake.py +427 -0
  138. atif_sql-0.2.0/packages/atif-duck/src/atif_duck/domain/lake_sessions.py +97 -0
  139. atif_sql-0.2.0/packages/atif-duck/src/atif_duck/domain/raw_readers.py +140 -0
  140. atif_sql-0.2.0/packages/atif-duck/src/atif_duck/domain/session_id.py +69 -0
  141. atif_sql-0.2.0/packages/atif-duck/src/atif_duck/domain/sql_literal.py +50 -0
  142. atif_sql-0.2.0/packages/atif-duck/src/atif_duck/infrastructure/__init__.py +34 -0
  143. atif_sql-0.2.0/packages/atif-duck/src/atif_duck/infrastructure/analytics.py +469 -0
  144. atif_sql-0.2.0/packages/atif-duck/src/atif_duck/infrastructure/authorship.py +139 -0
  145. atif_sql-0.2.0/packages/atif-duck/src/atif_duck/infrastructure/columnar.py +641 -0
  146. atif_sql-0.2.0/packages/atif-duck/src/atif_duck/infrastructure/lake.py +1383 -0
  147. atif_sql-0.2.0/packages/atif-duck/src/atif_duck/infrastructure/lake_sessions.py +194 -0
  148. atif_sql-0.2.0/packages/atif-duck/src/atif_duck/infrastructure/lake_settings.py +63 -0
  149. atif_sql-0.2.0/packages/atif-duck/src/atif_duck/infrastructure/lake_steps.py +225 -0
  150. atif_sql-0.2.0/packages/atif-duck/src/atif_duck/infrastructure/projections.py +221 -0
  151. atif_sql-0.2.0/packages/atif-duck/src/atif_duck/infrastructure/registry.py +2194 -0
  152. atif_sql-0.2.0/packages/atif-duck/src/atif_duck/infrastructure/stored_artifacts.py +115 -0
  153. atif_sql-0.2.0/packages/atif-duck/src/atif_duck/py.typed +0 -0
  154. atif_sql-0.2.0/packages/atif-embed/LICENSE +1 -0
  155. atif_sql-0.2.0/packages/atif-embed/README.md +232 -0
  156. atif_sql-0.2.0/packages/atif-embed/pyproject.toml +61 -0
  157. atif_sql-0.2.0/packages/atif-embed/src/atif_embed/__init__.py +12 -0
  158. atif_sql-0.2.0/packages/atif-embed/src/atif_embed/application/__init__.py +3 -0
  159. atif_sql-0.2.0/packages/atif-embed/src/atif_embed/application/embed.py +293 -0
  160. atif_sql-0.2.0/packages/atif-embed/src/atif_embed/application/prune.py +80 -0
  161. atif_sql-0.2.0/packages/atif-embed/src/atif_embed/domain/__init__.py +3 -0
  162. atif_sql-0.2.0/packages/atif-embed/src/atif_embed/domain/discovery.py +70 -0
  163. atif_sql-0.2.0/packages/atif-embed/src/atif_embed/domain/embedding_guard.py +83 -0
  164. atif_sql-0.2.0/packages/atif-embed/src/atif_embed/domain/errors.py +94 -0
  165. atif_sql-0.2.0/packages/atif-embed/src/atif_embed/domain/ports.py +223 -0
  166. atif_sql-0.2.0/packages/atif-embed/src/atif_embed/domain/sql_literal.py +49 -0
  167. atif_sql-0.2.0/packages/atif-embed/src/atif_embed/domain/text_stamp.py +71 -0
  168. atif_sql-0.2.0/packages/atif-embed/src/atif_embed/infrastructure/__init__.py +3 -0
  169. atif_sql-0.2.0/packages/atif-embed/src/atif_embed/infrastructure/cohere_bedrock.py +433 -0
  170. atif_sql-0.2.0/packages/atif-embed/src/atif_embed/infrastructure/corpus_text_rows.py +273 -0
  171. atif_sql-0.2.0/packages/atif-embed/src/atif_embed/infrastructure/gemma_local.py +355 -0
  172. atif_sql-0.2.0/packages/atif-embed/src/atif_embed/infrastructure/lake_text_rows.py +203 -0
  173. atif_sql-0.2.0/packages/atif-embed/src/atif_embed/infrastructure/lance_store.py +440 -0
  174. atif_sql-0.2.0/packages/atif-embed/src/atif_embed/infrastructure/providers.py +30 -0
  175. atif_sql-0.2.0/packages/atif-embed/src/atif_embed/infrastructure/settings.py +154 -0
  176. atif_sql-0.2.0/packages/atif-embed/src/atif_embed/py.typed +0 -0
  177. atif_sql-0.2.0/packages/atif-models/LICENSE +1 -0
  178. atif_sql-0.2.0/packages/atif-models/README.md +25 -0
  179. atif_sql-0.2.0/packages/atif-models/pyproject.toml +43 -0
  180. atif_sql-0.2.0/packages/atif-models/src/atif_models/__init__.py +14 -0
  181. atif_sql-0.2.0/packages/atif-models/src/atif_models/domain/__init__.py +9 -0
  182. atif_sql-0.2.0/packages/atif-models/src/atif_models/domain/ports.py +143 -0
  183. atif_sql-0.2.0/packages/atif-models/src/atif_models/domain/registry.py +151 -0
  184. atif_sql-0.2.0/packages/atif-models/src/atif_models/domain/schema.py +109 -0
  185. atif_sql-0.2.0/packages/atif-models/src/atif_models/infrastructure/__init__.py +8 -0
  186. atif_sql-0.2.0/packages/atif-models/src/atif_models/infrastructure/openai_bedrock.py +314 -0
  187. atif_sql-0.2.0/packages/atif-models/src/atif_models/infrastructure/settings.py +85 -0
  188. atif_sql-0.2.0/packages/atif-models/src/atif_models/py.typed +0 -0
  189. atif_sql-0.2.0/pyproject.toml +854 -0
@@ -0,0 +1,54 @@
1
+ .venv/
2
+ __pycache__/
3
+ *.pyc
4
+ .pytest_cache/
5
+ .ruff_cache/
6
+ .coverage
7
+ coverage.xml
8
+ htmlcov/
9
+ .mise/
10
+ dist/
11
+ release/
12
+ build/
13
+ *.egg-info/
14
+ .DS_Store
15
+ .env
16
+ .env.local
17
+ .erpaval/
18
+ .sarif/
19
+ .sbom/
20
+ planning/
21
+ repomix-output.xml
22
+ docs/.repomix/
23
+ docs/parity/
24
+ .import_linter_cache/
25
+ .codegraph/
26
+ experiments/**/out/
27
+ scripts/.run/
28
+
29
+ # Node dependencies for the docs site under site/, which is its own pnpm workspace.
30
+ node_modules/
31
+
32
+ # Astro's generated type and content cache.
33
+ site/.astro/
34
+
35
+ # The Starlight content collection is GENERATED on every build: site/scripts/sync-ccu.mjs
36
+ # writes the docs/ tree into it and site/scripts/authored-pages.mjs writes the site's own
37
+ # pages beside them. The authored sources live in site/authored/. Committing a copy would let
38
+ # a reader edit a page the next build silently overwrites.
39
+ site/src/content/docs/
40
+
41
+ # Agent work logs from the docs fan-out. Each packet carries the Work log and Validation that
42
+ # produced one document, which is provenance rather than documentation — the tree under docs/
43
+ # is the artifact. lychee.toml's exclusion comment asserts this path is ignored.
44
+ docs/.packets/
45
+
46
+ # Session handoff notes and salvaged scratch. Working state for whoever picks this up next,
47
+ # not part of the release.
48
+ .handoff/
49
+
50
+ # lychee request cache; links.yml carries it between runs via actions/cache
51
+ .lycheecache
52
+
53
+ # Atheris fuzz runs: the inputs libFuzzer kept, crash artifacts and logs (mise run fuzz).
54
+ fuzz/out/
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018 - 2019 Joseph Kato
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.
@@ -0,0 +1,29 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2019, errata.ai
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ 1. Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+
12
+ 2. Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ 3. Neither the name of the copyright holder nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,12 @@
1
+ Copyright © 2014–2015, Jordan Suchow, Michael Pacer, and Lara A. Ross
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
5
+
6
+ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7
+
8
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9
+
10
+ 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
11
+
12
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
atif_sql-0.2.0/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2026 Laith Al-Saadoon
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,272 @@
1
+ Metadata-Version: 2.5
2
+ Name: atif-sql
3
+ Version: 0.2.0
4
+ Summary: ATIF-native analytics over Claude Code agent trajectories: convert, materialize, and query agent sessions with DuckDB.
5
+ Project-URL: Homepage, https://github.com/laithalsaadoon/atif-sql
6
+ Project-URL: Repository, https://github.com/laithalsaadoon/atif-sql
7
+ Project-URL: Issues, https://github.com/laithalsaadoon/atif-sql/issues
8
+ Project-URL: Changelog, https://github.com/laithalsaadoon/atif-sql/blob/main/CHANGELOG.md
9
+ Author: Laith Al-Saadoon
10
+ License-Expression: Apache-2.0
11
+ License-File: LICENSE
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Topic :: Software Development
18
+ Classifier: Typing :: Typed
19
+ Requires-Python: >=3.13
20
+ Requires-Dist: anyio>=4.11.0
21
+ Requires-Dist: boto3>=1.42.91
22
+ Requires-Dist: cyclopts>=5.1.1
23
+ Requires-Dist: duckdb<2,>=1.5.2
24
+ Requires-Dist: imagesize>=2.0
25
+ Requires-Dist: lancedb<0.40,>=0.30
26
+ Requires-Dist: loguru>=0.7.3
27
+ Requires-Dist: polars>=1.40.0
28
+ Requires-Dist: pyarrow>=23.0.1
29
+ Requires-Dist: pydantic-settings>=2.13.1
30
+ Requires-Dist: pydantic>=2.13.2
31
+ Requires-Dist: pytz>=2024.1
32
+ Requires-Dist: tenacity>=9.1.4
33
+ Requires-Dist: zstandard>=0.25.0
34
+ Provides-Extra: local
35
+ Requires-Dist: pillow>=12.3.0; extra == 'local'
36
+ Requires-Dist: sentence-transformers>=6.1.0; extra == 'local'
37
+ Requires-Dist: torch>=2.14; extra == 'local'
38
+ Requires-Dist: torchvision>=0.29; extra == 'local'
39
+ Requires-Dist: transformers>=5.19.0; extra == 'local'
40
+ Description-Content-Type: text/markdown
41
+
42
+ # atif-sql
43
+
44
+ [![CI](https://github.com/laithalsaadoon/atif-sql/actions/workflows/check.yml/badge.svg?branch=main)](https://github.com/laithalsaadoon/atif-sql/actions/workflows/check.yml)
45
+ [![security](https://github.com/laithalsaadoon/atif-sql/actions/workflows/security.yml/badge.svg?branch=main)](https://github.com/laithalsaadoon/atif-sql/actions/workflows/security.yml)
46
+ [![CodeQL](https://github.com/laithalsaadoon/atif-sql/actions/workflows/codeql.yml/badge.svg?branch=main)](https://github.com/laithalsaadoon/atif-sql/actions/workflows/codeql.yml)
47
+ [![Scorecard](https://github.com/laithalsaadoon/atif-sql/actions/workflows/scorecard.yml/badge.svg?branch=main)](https://github.com/laithalsaadoon/atif-sql/actions/workflows/scorecard.yml)
48
+ [![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/laithalsaadoon/atif-sql/badge)](https://scorecard.dev/viewer/?uri=github.com/laithalsaadoon/atif-sql)
49
+ ![Python 3.13+](https://img.shields.io/badge/python-3.13%2B-blue.svg)
50
+ [![License Apache-2.0](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE)
51
+
52
+ ATIF-native analytics over agent trajectories.
53
+
54
+ Claude Code sessions (`~/.claude/projects/**/*.jsonl`) and Codex CLI rollouts
55
+ (`~/.codex/sessions/**/rollout-*.jsonl`) are converted to ATIF (Harbor's Agent
56
+ Trajectory Interchange Format, see the Harbor ATIF RFC: RFC-0001 in
57
+ <https://github.com/laude-institute/harbor>), materialized as a corpus, and
58
+ queried through DuckDB views. Converting once at the boundary (with an
59
+ explicit, tested fidelity policy for what upstream drops) beats re-deriving
60
+ trajectory semantics inside every SQL view. Both agents land in the same views,
61
+ and `sessions.agent` says which one a row came from.
62
+
63
+ ## Install
64
+
65
+ One command, one package, every capability. Conversion, materialization, the DuckDB surface,
66
+ the LLM analytics pipelines, and semantic search are all in the box, and nothing has to be
67
+ installed afterwards to make a command work.
68
+
69
+ ```bash
70
+ uv tool install atif-sql # the CLI on PATH
71
+ uvx atif-sql schema # or run it without installing
72
+ ```
73
+
74
+ To keep semantic search on your own machine, add the one optional extra, `local`. It runs
75
+ Google's EmbeddingGemma 2 for `embed` and `search` in place of Cohere on Bedrock (see
76
+ [Search without sending text off the machine](#search-without-sending-text-off-the-machine)).
77
+ On Linux, `--torch-backend cpu` installs PyTorch's CPU build rather than PyPI's CUDA build and
78
+ its gigabytes of NVIDIA libraries:
79
+
80
+ ```bash
81
+ uv tool install 'atif-sql[local]' --torch-backend cpu
82
+ ```
83
+
84
+ Python 3.13 or newer. The install is substantial and deliberately so, because the analytics and
85
+ vector paths carry `polars`, `pyarrow`, `lancedb`, and `duckdb`. Conversion itself needs none of
86
+ that weight: the ATIF models are vendored from Harbor and step pricing reads a vendored copy of
87
+ litellm's price data, so neither `harbor` nor `litellm` is installed. Prebuilt wheels cover CPython
88
+ 3.13 on manylinux x86_64 and aarch64, macOS arm64, and Windows x86_64. Alpine and other musl targets
89
+ are not supported. [RELEASING.md](RELEASING.md) says how to measure the install.
90
+
91
+ `atif-sql analyze`, `atif-sql embed`, and `atif-sql search` call Amazon Bedrock and cost money.
92
+ `analyze` is a dry run until you pass `--no-dry-run`, `embed` refuses to run without `--limit` or
93
+ `--all` (and `--dry-run` previews it), and `search` embeds one query per call. With
94
+ `ATIF_SQL_EMBED_PROVIDER=gemma`, `embed` and `search` run on this machine instead and cost
95
+ nothing. Nothing else in the tool needs a credential.
96
+
97
+ ## What you can do
98
+
99
+ Start with the question you want to answer or the work you want to keep. Each command links
100
+ to its flags and exit codes in [the CLI reference](docs/reference/cli.md).
101
+
102
+ Analysis, embedding, and text search use Amazon Bedrock. `analyze` previews by default;
103
+ `embed` needs `--dry-run` to preview an explicit scope; `search` charges for a query embedding
104
+ on each successful call. Rows marked **costs money** describe paid execution; embedding and
105
+ search on this machine are free.
106
+
107
+ | Task | Command | Outcome |
108
+ | --- | --- | --- |
109
+ | Keep a history of your Claude Code work | [`atif-sql materialize`](docs/reference/cli.md#materialize) | Saves quiet sessions for later queries and keeps them when source transcripts disappear. Re-runs update changed sessions and those with an older converter generation. |
110
+ | Bring your Codex work into the same analysis workflow | [`atif-sql materialize --agent codex`](docs/reference/cli.md#materialize) | Saves Codex rollouts in a separate corpus with the same query surface as Claude Code. |
111
+ | Inspect or share one conversation as ATIF | [`atif-sql convert <session.jsonl>`](docs/reference/cli.md#convert) | Prints its trajectory and loss report. Add `--trajectory-out` to save the trajectory and adjacent `edges.jsonl` file. |
112
+ | Know whether your recent work is included | [`atif-sql status`](docs/reference/cli.md#status) | Shows corpus freshness, session counts, and what another `materialize` pass would update, without changing data. |
113
+ | Query a large history without rereading every transcript | [`atif-sql lake rebuild`](docs/reference/cli.md#lake-rebuild) | Builds the shared DuckLake query store. Later `materialize` passes keep it current. |
114
+ | Check that query results match your saved conversations | [`atif-sql lake verify`](docs/reference/cli.md#lake-verify) | Compares stored rows with session artifacts and exits 65 if they differ. |
115
+ | Diagnose missing or stale query data | [`atif-sql lake status`](docs/reference/cli.md#lake-status) | Shows whether the lake exists, is current, and contains the expected corpora, plus its last write. |
116
+ | Recover disk space from query storage | [`atif-sql lake compact`](docs/reference/cli.md#lake-compact) | Merges small files, expires old snapshots, and removes unreferenced files while keeping current rows. |
117
+ | Find the fields you need to answer a question | [`atif-sql schema`](docs/reference/cli.md#schema) | Lists columns and macro signatures, tagged by required data: `core`, `analytics`, or `vss`. No corpus needed. |
118
+ | Start with a query that already works | [`atif-sql examples`](docs/reference/cli.md#examples) | Gives tested queries to copy or adapt. Filters select the required data and query type. |
119
+ | Answer your own question about past sessions | [`atif-sql query '<sql>'`](docs/reference/cli.md#query) | Returns a table to read or JSON to pipe into another tool, through a read-only sandboxed connection. |
120
+ | Compare work across Claude Code and Codex | [`atif-sql query --all-corpora 'SELECT agent, count(*) FROM sessions GROUP BY agent'`](docs/reference/cli.md#query) | Counts sessions by agent across all corpora in the lake. Other queries can use `sessions.corpus` to identify each source. Needs the lake. |
121
+ | See which tools your agents rely on most | [`atif-sql query 'SELECT * FROM tool_rank(30) LIMIT 10'`](docs/reference/cli.md#query) | Ranks tool use by call count over the last 30 days. |
122
+ | Estimate the cost of a session | [`atif-sql query 'SELECT * FROM cost_estimate((SELECT session_id FROM sessions LIMIT 1)) LIMIT 10'`](docs/reference/cli.md#query) | Gives a lower-bound USD estimate and priced/unpriced step counts. Unpriced steps and cache-read charges are excluded. Replace the subquery to choose a session. |
123
+ | Find recurring moments when you correct your agents | [`atif-sql query 'SELECT * FROM friction_counts(30) LIMIT 10'`](docs/reference/cli.md#query) | Counts detected friction labels over the last 30 days, after paid analysis has run. |
124
+ | Plan a review of agent interactions before paying | [`atif-sql analyze`](docs/reference/cli.md#analyze) | Previews the work and estimated cost. **Costs money** with `--no-dry-run`, which fills the classifications, conflicts, user friction, and perceived errors views. |
125
+ | Preview how much history to prepare for semantic search | [`atif-sql embed --limit 100 --dry-run`](docs/reference/cli.md#embed) | Previews embedding up to 100 steps. Removing `--dry-run` **costs money** and prepares those steps for search. |
126
+ | Find prior work when you remember the topic, not the words | [`atif-sql search '<text>'`](docs/reference/cli.md#search) | **Costs money** for one query embedding. Finds similar steps with session identifiers and snippets. Needs existing embeddings from `embed`. |
127
+ | Search your sessions without sending text off the machine | [`atif-sql embed --limit 200`](docs/reference/cli.md#embed) | With `ATIF_SQL_EMBED_PROVIDER=gemma` and the `local` extra, embeds 200 steps with EmbeddingGemma 2 on this machine, free, into a store of its own; `search` then reads that store. The first run downloads 1.5 GB. |
128
+ | Find related work across both agent histories | [`atif-sql search --all-corpora '<text>'`](docs/reference/cli.md#search) | **Costs money.** Searches all corpora's embedding stores and identifies each result's corpus. Needs the lake and existing embeddings. |
129
+ | Free space in a corpus from an older version | [`atif-sql corpus slim`](docs/reference/cli.md#corpus-slim) | Previews byte savings. `--no-dry-run` compresses JSON and removes old parquet only after lake verification succeeds. |
130
+ | Keep your history refreshed without remembering each run | [`atif-sql cron install --script <refresh-script>`](docs/reference/cli.md#cron-install) | Prints a schedule to review and install manually. The schedule includes paid embedding and analytics. Obtain `scripts/atif-sql-refresh.sh` from a repo checkout; packaged installs need its explicit path. |
131
+ | Check whether scheduled refreshes ran | [`atif-sql cron status --script <refresh-script>`](docs/reference/cli.md#cron-status) | Shows each lane's last completion, skip, and current lock holder from the refresh script's logs. |
132
+
133
+ ## How the source is organized
134
+
135
+ The directories under `packages/` are internal structure, not separate installs. They
136
+ exist so `import-linter` can enforce the layer and independence contracts at the source level;
137
+ the only thing documented as installable is the `atif-sql` CLI above.
138
+
139
+ | Directory | What |
140
+ | --- | --- |
141
+ | `atif-converter` | Claude Code and Codex CLI transcript → ATIF converters (ours, built on Harbor's ATIF models, vendored) + per-agent fidelity policy (loss accounting per session) |
142
+ | `atif-corpus` | Corpus materialization: discovery, watermarks, quiescence, atomic artifact writes |
143
+ | `atif-duck` | DuckDB views + macros over the materialized corpus (core surface plus the v2 analytics surface) |
144
+ | `atif-models` | Model alias registry + structured-output LLM client; no other package hardcodes a model id |
145
+ | `atif-analytics` | the LLM pipelines `atif-sql analyze` runs: classify, conflicts, friction, and perceived |
146
+ | `atif-embed` | Cohere Embed v4 on Bedrock or EmbeddingGemma 2 on this machine + LanceDB vector store + embedding backfill |
147
+ | `atif-cli` | the composition root, and the source of the `atif-sql` command (see [What you can do](#what-you-can-do)) |
148
+
149
+ ## Quick start
150
+
151
+ Build the corpus from the local transcripts, then query it:
152
+
153
+ ```bash
154
+ atif-sql materialize # discover sessions, convert, write the corpus
155
+ atif-sql lake rebuild # load every corpus into the DuckLake once
156
+ atif-sql status # corpus and lake freshness, read-only
157
+ atif-sql query 'SELECT * FROM sessions LIMIT 5'
158
+ ```
159
+
160
+ The lake lives at `~/.atif-sql/lake/` (`ATIF_SQL_LAKE_ROOT` moves it) and holds every corpus. Without
161
+ one, `query` warns once and reads the per-session files.
162
+
163
+ Each session is stored once. `materialize` writes the ATIF document as `trajectory.json.zst`,
164
+ and `edges.jsonl` and `session_events.jsonl` compressed the same way, beside a plain `meta.json`,
165
+ `loss_report.json`, and the raw source archive. The lake holds the queryable rows, and it loads a
166
+ session from its compressed trajectory. `zstd -dc trajectory.json.zst` prints the plain ATIF
167
+ document. Without a lake, `query --no-lake` still works, but it parses every session's trajectory
168
+ on each run, so it's slow on a large corpus.
169
+
170
+ A corpus written by an earlier version keeps working as it is; `status` counts its sessions under
171
+ `layout`, and `atif-sql corpus slim` converts it.
172
+
173
+ `materialize` converts sessions across a process pool, `min(8, cpu_count)` workers by default.
174
+ `--workers N` (or `ATIF_SQL_MATERIALIZE_WORKERS`) sets the size, and `--workers 1` runs the
175
+ single-process path. The pool doesn't change a byte of output: every worker writes the same
176
+ artifacts through the same per-session staging directory and atomic rename.
177
+
178
+ ### Codex CLI transcripts
179
+
180
+ `convert`, `materialize`, and `status` all take `--agent claude-code|codex`,
181
+ defaulting to `claude-code`. Pick `codex` and both roots move with it: the source
182
+ becomes `$CODEX_HOME` (default `~/.codex`) `/sessions`, and the corpus becomes
183
+ `~/.atif-sql/corpus/codex`. An explicit `--source-root`, `--corpus-root`, or the
184
+ matching `ATIF_SQL_*` env var still wins.
185
+
186
+ ```bash
187
+ atif-sql materialize --agent codex
188
+ atif-sql status --agent codex
189
+ atif-sql query "SELECT agent, count(*) FROM sessions GROUP BY 1"
190
+ ```
191
+
192
+ One corpus holds one agent, so a Codex corpus and a Claude Code corpus stay
193
+ separate directories, and one `query` reads one of them. Pass `--corpus-root` to
194
+ pick which, or `--agent codex` to get the Codex default. `--all-corpora` reads
195
+ every corpus the lake holds at once, and `sessions.corpus` says which one a
196
+ row came from.
197
+
198
+ ### Search without sending text off the machine
199
+
200
+ Set `ATIF_SQL_EMBED_PROVIDER=gemma` and `embed` and `search` use Google's
201
+ [EmbeddingGemma 2](https://huggingface.co/google/embeddinggemma-2) on this machine: step text
202
+ and queries stay local, and nothing bills an AWS account. It needs the `local` extra (see
203
+ [Install](#install)); in a checkout, `uv sync --all-packages --extra local`.
204
+
205
+ ```bash
206
+ export ATIF_SQL_EMBED_PROVIDER=gemma
207
+ atif-sql embed --limit 200 --dry-run # the plan names the provider, model, width and store
208
+ atif-sql embed --limit 200 # downloads the model on first use, then embeds
209
+ atif-sql search 'the flaky watermark test'
210
+ ```
211
+
212
+ - **The first run downloads about 1.5 GB.** The model goes into the Hugging Face cache once,
213
+ and later runs read it from there; `HF_HUB_OFFLINE=1` keeps every run off the network. Only
214
+ the 270M-parameter text tower loads, in about 4 GB of memory on a CPU.
215
+ - **A CPU embeds about one step a second on a real corpus.** 200 steps of a Claude Code corpus
216
+ took 156 s on a shared 16-core machine: short steps run at about 30 a second, and the few
217
+ long ones (up to the model's 8,192-token window) take most of the time. A CUDA GPU with
218
+ bfloat16 is faster; the lockfile installs PyTorch's CPU build, so install a CUDA torch build
219
+ to use one.
220
+ - **Each provider keeps its own store.** Gemma writes `<corpus_root>/embeddings_lance_gemma`
221
+ beside Cohere's `embeddings_lance`, so switching back and forth never mixes the two vector
222
+ spaces, and `search` reads the store of the provider selected when it runs.
223
+ - **The width is 768 by default.** `ATIF_SQL_OUTPUT_DIMENSION` takes 512, 256, or 128 for a
224
+ smaller store at some cost in ranking quality; a store keeps the width it was written at.
225
+
226
+ Working on `atif-sql` itself is a different setup: a clone, `mise`, and `mise run check` as the
227
+ definition of done. `CONTRIBUTING.md` has it.
228
+
229
+ ## Agent workflow: schema → examples → query
230
+
231
+ ```bash
232
+ atif-sql schema # every view + macro signature (<50 ms)
233
+ atif-sql examples # tested example queries, grouped core/analytics/vss
234
+ atif-sql query 'SELECT * FROM tool_rank(30) LIMIT 10'
235
+ ```
236
+
237
+ `atif-sql examples` (or `atif-sql query --examples`) emits runnable queries
238
+ derived from the catalog, not hardcoded strings, and every one is executed
239
+ by the test suite against a fixture corpus, so the listing cannot rot.
240
+ Piped output is JSON; filter with `--requires core|analytics|vss` and
241
+ `--category view|table-macro|scalar-macro`.
242
+
243
+ ## Contributing
244
+
245
+ Setup, the gates `mise run check` runs, the import-linter contracts you will trip, and the
246
+ Conventional Commit rule the `commit-msg` hook enforces: **[CONTRIBUTING.md](CONTRIBUTING.md)**.
247
+
248
+ Releases are cut by commitizen and published to PyPI over OIDC Trusted Publishing;
249
+ **[RELEASING.md](RELEASING.md)** covers the flow, the versioning model, and the install-weight
250
+ measurements.
251
+
252
+ ## Security
253
+
254
+ Report a vulnerability privately through
255
+ [GitHub's advisory form](https://github.com/laithalsaadoon/atif-sql/security/advisories/new),
256
+ not in a public issue. Supported versions, the disclosure expectations, and what counts as a
257
+ vulnerability in a tool that reads local transcripts are in
258
+ **[SECURITY.md](SECURITY.md)**.
259
+
260
+ `atif-sql query` runs agent-composed SQL, so it runs it in a box: sized to the host before the
261
+ corpus is registered (override with `ATIF_SQL_QUERY_MEMORY_LIMIT` and `ATIF_SQL_QUERY_THREADS`),
262
+ a private spill directory outside the corpus that's removed on exit, no extension installs at
263
+ query time (`atif-sql embed --install-extension` is where the lance extension comes from), file
264
+ facing statements (`COPY`, `EXPORT`, `ATTACH`, `INSTALL`, `LOAD`, `PREPARE`, `EXECUTE`) refused
265
+ before they run, and a refusal to run as root unless `ATIF_SQL_ALLOW_ROOT=1` says so. The details
266
+ and the one accepted disclosure (`duckdb_settings()` lists the granted paths) are in
267
+ [docs/reference/cli.md](docs/reference/cli.md#query).
268
+
269
+ ## License
270
+
271
+ [Apache License 2.0](LICENSE). Each module directory carries the same license
272
+ file, so a published distribution ships it too.