chatstrata 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 (69) hide show
  1. chatstrata-0.1.0/.gitignore +62 -0
  2. chatstrata-0.1.0/CHANGELOG.md +13 -0
  3. chatstrata-0.1.0/CONTRIBUTING.md +70 -0
  4. chatstrata-0.1.0/LICENSE +201 -0
  5. chatstrata-0.1.0/PKG-INFO +227 -0
  6. chatstrata-0.1.0/README.md +184 -0
  7. chatstrata-0.1.0/SECURITY.md +31 -0
  8. chatstrata-0.1.0/chatstrata/__init__.py +7 -0
  9. chatstrata-0.1.0/chatstrata/analysis/__init__.py +24 -0
  10. chatstrata-0.1.0/chatstrata/analysis/cli.py +145 -0
  11. chatstrata-0.1.0/chatstrata/analysis/queries/activity.sql +12 -0
  12. chatstrata-0.1.0/chatstrata/analysis/queries/conversations.sql +11 -0
  13. chatstrata-0.1.0/chatstrata/analysis/queries/example_queries.sql +129 -0
  14. chatstrata-0.1.0/chatstrata/analysis/queries/models.sql +8 -0
  15. chatstrata-0.1.0/chatstrata/analysis/queries/projects.sql +11 -0
  16. chatstrata-0.1.0/chatstrata/analysis/queries/tools.sql +9 -0
  17. chatstrata-0.1.0/chatstrata/cli.py +584 -0
  18. chatstrata-0.1.0/chatstrata/core/__init__.py +24 -0
  19. chatstrata-0.1.0/chatstrata/core/db.py +115 -0
  20. chatstrata-0.1.0/chatstrata/core/ingest.py +271 -0
  21. chatstrata-0.1.0/chatstrata/core/migrations/0001_initial.sql +130 -0
  22. chatstrata-0.1.0/chatstrata/core/migrations/0002_fts_index.sql +11 -0
  23. chatstrata-0.1.0/chatstrata/core/migrations/0003_conversation_mtime.sql +2 -0
  24. chatstrata-0.1.0/chatstrata/core/migrations/__init__.py +28 -0
  25. chatstrata-0.1.0/chatstrata/core/models.py +87 -0
  26. chatstrata-0.1.0/chatstrata/core/search.py +151 -0
  27. chatstrata-0.1.0/chatstrata/embed/__init__.py +20 -0
  28. chatstrata-0.1.0/chatstrata/embed/base.py +26 -0
  29. chatstrata-0.1.0/chatstrata/embed/cli.py +134 -0
  30. chatstrata-0.1.0/chatstrata/embed/local_provider.py +30 -0
  31. chatstrata-0.1.0/chatstrata/embed/search.py +141 -0
  32. chatstrata-0.1.0/chatstrata/mcp/README.md +155 -0
  33. chatstrata-0.1.0/chatstrata/mcp/__init__.py +1 -0
  34. chatstrata-0.1.0/chatstrata/mcp/safety.py +92 -0
  35. chatstrata-0.1.0/chatstrata/mcp/server.py +247 -0
  36. chatstrata-0.1.0/chatstrata/redact/__init__.py +20 -0
  37. chatstrata-0.1.0/chatstrata/redact/base.py +58 -0
  38. chatstrata-0.1.0/chatstrata/redact/cli.py +310 -0
  39. chatstrata-0.1.0/chatstrata/redact/presidio_engine.py +183 -0
  40. chatstrata-0.1.0/chatstrata/redact/recognizers/__init__.py +20 -0
  41. chatstrata-0.1.0/chatstrata/redact/recognizers/api_keys.py +62 -0
  42. chatstrata-0.1.0/chatstrata/redact/recognizers/connection_strings.py +20 -0
  43. chatstrata-0.1.0/chatstrata/redact/recognizers/paths.py +33 -0
  44. chatstrata-0.1.0/chatstrata/redact/recognizers/tokens.py +29 -0
  45. chatstrata-0.1.0/chatstrata/sources/__init__.py +5 -0
  46. chatstrata-0.1.0/chatstrata/sources/base.py +67 -0
  47. chatstrata-0.1.0/chatstrata/sources/claude_code/__init__.py +3 -0
  48. chatstrata-0.1.0/chatstrata/sources/claude_code/adapter.py +253 -0
  49. chatstrata-0.1.0/chatstrata/sources/claude_code/manifest.yaml +10 -0
  50. chatstrata-0.1.0/chatstrata/sources/claude_export/__init__.py +3 -0
  51. chatstrata-0.1.0/chatstrata/sources/claude_export/adapter.py +239 -0
  52. chatstrata-0.1.0/chatstrata/sources/claude_export/manifest.yaml +10 -0
  53. chatstrata-0.1.0/chatstrata/sources/codex_cli/__init__.py +3 -0
  54. chatstrata-0.1.0/chatstrata/sources/codex_cli/adapter.py +315 -0
  55. chatstrata-0.1.0/chatstrata/sources/codex_cli/manifest.yaml +10 -0
  56. chatstrata-0.1.0/chatstrata/sources/opencode/__init__.py +3 -0
  57. chatstrata-0.1.0/chatstrata/sources/opencode/adapter.py +350 -0
  58. chatstrata-0.1.0/chatstrata/sources/opencode/manifest.yaml +10 -0
  59. chatstrata-0.1.0/docs/adapter-guide.md +160 -0
  60. chatstrata-0.1.0/docs/adr/0001-use-duckdb.md +46 -0
  61. chatstrata-0.1.0/docs/adr/0002-store-raw-alongside-normalized.md +37 -0
  62. chatstrata-0.1.0/docs/adr/0003-adapter-pattern-entry-points.md +35 -0
  63. chatstrata-0.1.0/docs/images/chatstrata.png +0 -0
  64. chatstrata-0.1.0/docs/redaction.md +65 -0
  65. chatstrata-0.1.0/docs/release.md +79 -0
  66. chatstrata-0.1.0/docs/schema.md +101 -0
  67. chatstrata-0.1.0/docs/sources/claude_export.md +54 -0
  68. chatstrata-0.1.0/docs/sources/codex_cli.md +74 -0
  69. chatstrata-0.1.0/pyproject.toml +113 -0
@@ -0,0 +1,62 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .Python
7
+ build/
8
+ develop-eggs/
9
+ dist/
10
+ downloads/
11
+ eggs/
12
+ .eggs/
13
+ lib/
14
+ lib64/
15
+ parts/
16
+ sdist/
17
+ var/
18
+ wheels/
19
+ *.egg-info/
20
+ .installed.cfg
21
+ *.egg
22
+ MANIFEST
23
+
24
+ # Virtual environments
25
+ .venv/
26
+ venv/
27
+ env/
28
+ ENV/
29
+
30
+ # Testing / coverage
31
+ .pytest_cache/
32
+ .coverage
33
+ .coverage.*
34
+ htmlcov/
35
+ .tox/
36
+
37
+ # Tooling
38
+ .ruff_cache/
39
+ .mypy_cache/
40
+
41
+ # IDEs
42
+ .idea/
43
+ .vscode/
44
+ *.swp
45
+ *.swo
46
+
47
+ # OS
48
+ .DS_Store
49
+ Thumbs.db
50
+
51
+ # chatstrata data (never commit user data)
52
+ *.duckdb
53
+ *.duckdb.wal
54
+ chatstrata_data/
55
+ local_test_data/
56
+
57
+ # Notebook checkpoints
58
+ .ipynb_checkpoints/
59
+
60
+ # Zensical docs
61
+ docs-site/site/
62
+ .zensical-venv/
@@ -0,0 +1,13 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0 - 2026-05-19
4
+
5
+ Initial public alpha.
6
+
7
+ - Ingest Claude Code, claude.ai exports, Codex CLI, and OpenCode conversations.
8
+ - Store normalized conversations, messages, content blocks, tool calls, and raw events in DuckDB.
9
+ - Query archives with SQL, keyword search, and bundled analysis commands.
10
+ - Support incremental re-ingestion for file-backed sources.
11
+ - Provide optional local redaction via Presidio and chatstrata-specific recognizers.
12
+ - Provide optional semantic and hybrid search through local embeddings.
13
+ - Provide an MCP server for read-only archive querying.
@@ -0,0 +1,70 @@
1
+ # Contributing to chatstrata
2
+
3
+ Thanks for your interest. The most valuable contributions right now are **new
4
+ source adapters** — anything that adds a new provider or tool to the supported
5
+ list.
6
+
7
+ ## Adding a source adapter
8
+
9
+ The full walkthrough lives in [docs/adapter-guide.md](docs/adapter-guide.md).
10
+ Quick version:
11
+
12
+ 1. Copy `chatstrata/sources/claude_code/` to `chatstrata/sources/your_source/`.
13
+ 2. Implement `discover()` and `parse()` against the canonical record types in
14
+ `chatstrata/core/models.py`.
15
+ 3. Add a fixture file (small, sanitized sample of your source's data) under
16
+ `tests/fixtures/`, and a test that asserts your parser produces the expected
17
+ normalized events.
18
+ 4. Register your adapter in `pyproject.toml` under
19
+ `[project.entry-points."chatstrata.sources"]`.
20
+ 5. Open a PR.
21
+
22
+ PRs are reviewed for:
23
+ - **Schema fidelity** — does the adapter produce well-formed canonical records?
24
+ - **Test coverage** — fixtures and tests demonstrate the parsing works.
25
+ - **Idempotency** — re-running ingest on the same source doesn't duplicate.
26
+
27
+ We do not review parsing logic line-by-line; your fixture tests are the proof
28
+ that it works.
29
+
30
+ ## Development setup
31
+
32
+ ```bash
33
+ git clone https://github.com/brandonbosch/chatstrata.git
34
+ cd chatstrata
35
+ uv venv
36
+ uv pip install -e ".[dev,redact]"
37
+ pytest
38
+ ruff check .
39
+ ```
40
+
41
+ ## Architecture decisions
42
+
43
+ We keep [Architecture Decision Records](docs/adr/) for significant design
44
+ choices. If you're proposing a change that affects the schema, the adapter
45
+ contract, or core data flow, please include an ADR in your PR explaining the
46
+ why.
47
+
48
+ ## Scope
49
+
50
+ In scope:
51
+ - Source adapters
52
+ - Schema improvements and migrations
53
+ - Analysis primitives and example queries
54
+ - Redaction recognizers
55
+ - CLI improvements
56
+ - Documentation
57
+
58
+ Out of scope (for now):
59
+ - GUIs / web UIs
60
+ - Hosted services
61
+ - Real-time / streaming ingestion
62
+ - Multi-user features
63
+
64
+ This may change as the project evolves. If you want to build something
65
+ out-of-scope, that's great — please do, as a separate project that depends on
66
+ chatstrata as a library.
67
+
68
+ ## Code of conduct
69
+
70
+ Be kind. Assume good faith. Critique ideas, not people.
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for describing the origin of the Work and
141
+ 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 Support. While redistributing the Work or
166
+ Derivative Works thereof, You may choose to offer, and charge a
167
+ fee for, acceptance of support, warranty, indemnity, or other
168
+ liability obligations and/or rights consistent with this License.
169
+ However, in accepting such obligations, You may act only on Your
170
+ own behalf and on Your sole responsibility, not on behalf of any
171
+ other Contributor, and only if You agree to indemnify, defend,
172
+ and hold each Contributor harmless for any liability incurred by,
173
+ or claims asserted against, such Contributor by reason of your
174
+ accepting any such warranty or support.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 chatstrata contributors
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,227 @@
1
+ Metadata-Version: 2.4
2
+ Name: chatstrata
3
+ Version: 0.1.0
4
+ Summary: A personal, queryable archive of your AI conversations across providers
5
+ Project-URL: Homepage, https://github.com/brandonbosch/chatstrata
6
+ Project-URL: Repository, https://github.com/brandonbosch/chatstrata
7
+ Project-URL: Issues, https://github.com/brandonbosch/chatstrata/issues
8
+ Project-URL: Documentation, https://github.com/brandonbosch/chatstrata#readme
9
+ Author: chatstrata contributors
10
+ License: Apache-2.0
11
+ License-File: LICENSE
12
+ Keywords: archive,chat,chatgpt,claude,duckdb,llm
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: Apache Software License
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Topic :: Database
22
+ Classifier: Topic :: Scientific/Engineering :: Information Analysis
23
+ Requires-Python: >=3.10
24
+ Requires-Dist: click>=8.1.0
25
+ Requires-Dist: duckdb>=1.0.0
26
+ Requires-Dist: platformdirs>=4.0
27
+ Requires-Dist: pydantic>=2.0
28
+ Requires-Dist: pytz>=2024.1
29
+ Provides-Extra: dev
30
+ Requires-Dist: pytest-cov>=5.0; extra == 'dev'
31
+ Requires-Dist: pytest>=8.0; extra == 'dev'
32
+ Requires-Dist: ruff>=0.4; extra == 'dev'
33
+ Provides-Extra: embeddings
34
+ Requires-Dist: sentence-transformers>=3.0; extra == 'embeddings'
35
+ Requires-Dist: torch>=2.0; extra == 'embeddings'
36
+ Provides-Extra: mcp
37
+ Requires-Dist: mcp[cli]>=1.12.0; extra == 'mcp'
38
+ Provides-Extra: redact
39
+ Requires-Dist: presidio-analyzer>=2.2; extra == 'redact'
40
+ Requires-Dist: presidio-anonymizer>=2.2; extra == 'redact'
41
+ Requires-Dist: spacy>=3.7; extra == 'redact'
42
+ Description-Content-Type: text/markdown
43
+
44
+ # chatstrata
45
+
46
+ <p align="center">
47
+ <img src="docs/images/chatstrata.png" alt="chatstrata" width="360">
48
+ </p>
49
+
50
+ A personal, queryable archive of your AI conversations across providers.
51
+
52
+ Every conversation you've had with Claude, ChatGPT, or any other LLM is a record of
53
+ how you think, what you're working on, and how that's changed over time. Most of
54
+ that record lives scattered across browser exports, hidden JSONL files, and SaaS
55
+ dashboards you don't fully control. chatstrata pulls it into one place, normalizes
56
+ it, and lets you actually query and analyze it.
57
+
58
+ The name is from "strata" — layers of conversation deposited over time, with the
59
+ deeper layers telling you who you were.
60
+
61
+ ## Why this exists
62
+
63
+ LLM providers collect rich data about how you interact with their models and use
64
+ it (in aggregate) to improve the experience for everyone. chatstrata is the same
65
+ idea, but for an audience of one: **you**. Your conversations, on your machine,
66
+ queryable on your terms.
67
+
68
+ Concretely, with chatstrata you can:
69
+
70
+ - Find every conversation where you discussed a topic, across providers.
71
+ - See how your prompting has changed over months or years.
72
+ - Audit every bash command you ran through Claude Code, grouped by project.
73
+ - Build a corpus that helps you brief a new model on who you are and what you care about.
74
+ - Identify abandoned projects, dropped threads, recurring patterns.
75
+
76
+ ## Status
77
+
78
+ **Early alpha.** v0 includes adapters for Claude Code, claude.ai exports, Codex
79
+ CLI, and OpenCode. The architecture is built so that adding more sources
80
+ (ChatGPT exports, Cursor, etc.) is the work of one adapter — see
81
+ [docs/adapter-guide.md](docs/adapter-guide.md).
82
+
83
+ ## Quickstart
84
+
85
+ Requires Python 3.10+. DuckDB is installed as a Python dependency; you do not
86
+ need to install a separate DuckDB server or CLI.
87
+
88
+ ```bash
89
+ uv tool install chatstrata
90
+ # or: pipx install chatstrata
91
+
92
+ # Create the local DuckDB archive and show detected sources
93
+ chatstrata init
94
+
95
+ # Ingest your Claude Code transcripts
96
+ chatstrata ingest claude_code --incremental
97
+
98
+ # See what's there
99
+ chatstrata stats
100
+
101
+ # Run a query
102
+ chatstrata query "SELECT model, COUNT(*) FROM messages GROUP BY model"
103
+ ```
104
+
105
+ The default database lives at a platform-appropriate user data directory
106
+ (e.g. `~/.local/share/chatstrata/chatstrata.duckdb` on Linux). Override with
107
+ `CHATSTRATA_DB` or `--db`. Run `chatstrata paths` to see the exact paths for
108
+ your machine.
109
+
110
+ ## MCP server
111
+
112
+ chatstrata ships an [MCP](https://modelcontextprotocol.io) server that exposes
113
+ your archive to MCP-aware clients (Claude Desktop, etc.) through a single
114
+ read-only `query` tool plus a `chatstrata://schema` resource. The client can
115
+ then write and run SQL against your conversations directly.
116
+
117
+ ### 1. Install with MCP support
118
+
119
+ ```bash
120
+ uv tool install "chatstrata[mcp]"
121
+ # or: pipx install "chatstrata[mcp]"
122
+ ```
123
+
124
+ ### 2. Create and populate the archive
125
+
126
+ The MCP server reads an existing database; make sure you've ingested something
127
+ first:
128
+
129
+ ```bash
130
+ chatstrata init
131
+ chatstrata ingest claude_code --incremental
132
+ chatstrata paths # note the database path for the next step
133
+ ```
134
+
135
+ ### 3. Point your MCP client at chatstrata
136
+
137
+ The installed `chatstrata-mcp` executable speaks MCP over stdio. If you use
138
+ `uvx`, clients can run the published package without needing the absolute path
139
+ to that executable.
140
+
141
+ For Claude Code, run:
142
+
143
+ ```bash
144
+ claude mcp add --transport stdio --scope user chatstrata -- uvx --from "chatstrata[mcp]" chatstrata-mcp
145
+ ```
146
+
147
+ Or ask chatstrata to print the command:
148
+
149
+ ```bash
150
+ chatstrata mcp config claude-code
151
+ ```
152
+
153
+ For Claude Desktop, add an entry to its `mcpServers` config (Settings →
154
+ Developer → Edit Config):
155
+
156
+ ```json
157
+ {
158
+ "mcpServers": {
159
+ "chatstrata": {
160
+ "type": "stdio",
161
+ "command": "uvx",
162
+ "args": ["--from", "chatstrata[mcp]", "chatstrata-mcp"]
163
+ }
164
+ }
165
+ }
166
+ ```
167
+
168
+ You can generate that JSON with:
169
+
170
+ ```bash
171
+ chatstrata mcp config claude-desktop
172
+ ```
173
+
174
+ If `CHATSTRATA_DB` is omitted, the server falls back to the default platform
175
+ path. To pin the MCP server to a specific database, pass `--db` when generating
176
+ the setup snippet:
177
+
178
+ ```bash
179
+ chatstrata mcp config claude-desktop --db /absolute/path/to/chatstrata.duckdb
180
+ ```
181
+
182
+ Restart the client. The `chatstrata` server should appear with a `query` tool
183
+ available; ask it something like "what topics have I discussed most this month?"
184
+ and it will query your archive.
185
+
186
+ ## Data model
187
+
188
+ chatstrata normalizes every conversation into the same shape regardless of source:
189
+
190
+ - **conversations** — one per session/thread
191
+ - **messages** — one per turn (user, assistant, system)
192
+ - **content_blocks** — one per content unit within a message (text, tool_use, tool_result, thinking, attachment)
193
+ - **tool_calls** — denormalized view of tool_use blocks for easy querying
194
+ - **raw_events** — the source data, line-for-line, for re-parsing without re-ingestion
195
+
196
+ See [docs/schema.md](docs/schema.md) for the full schema.
197
+
198
+ ## Adding a source
199
+
200
+ Each source (Claude Code, ChatGPT export, etc.) is an adapter that implements a
201
+ small protocol: `discover()` finds available conversations, `parse()` turns them
202
+ into the canonical record types. See [docs/adapter-guide.md](docs/adapter-guide.md)
203
+ for the worked example using Claude Code.
204
+
205
+ Adapters can be contributed as PRs to this repo or as standalone pip packages
206
+ that register via entry points.
207
+
208
+ ## Privacy
209
+
210
+ Your data stays on your machine. chatstrata makes no network calls during
211
+ ingestion or querying. Semantic search can optionally use DuckDB's VSS
212
+ extension; chatstrata only installs that extension when
213
+ `CHATSTRATA_INSTALL_DUCKDB_VSS=1` is set.
214
+
215
+ If you want to share queries or notebooks publicly, an optional redaction layer
216
+ (`uv tool install "chatstrata[redact]"`) wraps Microsoft Presidio with
217
+ chatstrata-specific recognizers for API keys, file paths, and other things that
218
+ commonly appear in LLM transcripts. See [docs/redaction.md](docs/redaction.md).
219
+
220
+ ## Contributing
221
+
222
+ Contributions welcome. Especially valuable: new source adapters. See
223
+ [CONTRIBUTING.md](CONTRIBUTING.md).
224
+
225
+ ## License
226
+
227
+ Apache 2.0. See [LICENSE](LICENSE).