session-preserve 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 (91) hide show
  1. session_preserve-0.2.0/LICENSE +202 -0
  2. session_preserve-0.2.0/MANIFEST.in +12 -0
  3. session_preserve-0.2.0/PKG-INFO +268 -0
  4. session_preserve-0.2.0/README.md +241 -0
  5. session_preserve-0.2.0/examples/README.md +66 -0
  6. session_preserve-0.2.0/examples/fail/ConversationExport.receipt.json +295 -0
  7. session_preserve-0.2.0/examples/fail/package.manifest.json +47 -0
  8. session_preserve-0.2.0/examples/fail//345/257/271/350/257/235/350/256/260/345/275/225.md +132 -0
  9. session_preserve-0.2.0/examples/fail//350/276/223/345/207/272/346/226/207/344/273/266//350/276/223/345/207/272/347/264/242/345/274/225.md +5 -0
  10. session_preserve-0.2.0/examples/pass/ConversationExport.receipt.json +295 -0
  11. session_preserve-0.2.0/examples/pass/package.manifest.json +47 -0
  12. session_preserve-0.2.0/examples/pass//345/257/271/350/257/235/350/256/260/345/275/225.md +132 -0
  13. session_preserve-0.2.0/examples/pass//350/276/223/345/207/272/346/226/207/344/273/266//350/276/223/345/207/272/347/264/242/345/274/225.md +5 -0
  14. session_preserve-0.2.0/examples/run_examples.sh +46 -0
  15. session_preserve-0.2.0/examples/unverifiable/ConversationExport.receipt.json +295 -0
  16. session_preserve-0.2.0/examples/unverifiable/package.manifest.json +47 -0
  17. session_preserve-0.2.0/examples/unverifiable//345/257/271/350/257/235/350/256/260/345/275/225.md +132 -0
  18. session_preserve-0.2.0/examples/unverifiable//350/276/223/345/207/272/346/226/207/344/273/266//350/276/223/345/207/272/347/264/242/345/274/225.md +5 -0
  19. session_preserve-0.2.0/pyproject.toml +51 -0
  20. session_preserve-0.2.0/setup.cfg +4 -0
  21. session_preserve-0.2.0/src/codex_preserve/__init__.py +12 -0
  22. session_preserve-0.2.0/src/codex_preserve/__main__.py +8 -0
  23. session_preserve-0.2.0/src/codex_preserve/_claude_payload.py +146 -0
  24. session_preserve-0.2.0/src/codex_preserve/_claude_readable.py +203 -0
  25. session_preserve-0.2.0/src/codex_preserve/_claude_source.py +507 -0
  26. session_preserve-0.2.0/src/codex_preserve/_claude_v3.py +82 -0
  27. session_preserve-0.2.0/src/codex_preserve/_codex_v3.py +142 -0
  28. session_preserve-0.2.0/src/codex_preserve/_kimi_source.py +371 -0
  29. session_preserve-0.2.0/src/codex_preserve/_kimi_v3.py +84 -0
  30. session_preserve-0.2.0/src/codex_preserve/_shared_core.py +77 -0
  31. session_preserve-0.2.0/src/codex_preserve/_v3_package.py +523 -0
  32. session_preserve-0.2.0/src/codex_preserve/_zcode_source.py +380 -0
  33. session_preserve-0.2.0/src/codex_preserve/_zcode_v3.py +55 -0
  34. session_preserve-0.2.0/src/codex_preserve/cli.py +341 -0
  35. session_preserve-0.2.0/src/codex_preserve/exporter.py +6295 -0
  36. session_preserve-0.2.0/src/codex_preserve/verify.py +512 -0
  37. session_preserve-0.2.0/src/session_preserve.egg-info/PKG-INFO +268 -0
  38. session_preserve-0.2.0/src/session_preserve.egg-info/SOURCES.txt +89 -0
  39. session_preserve-0.2.0/src/session_preserve.egg-info/dependency_links.txt +1 -0
  40. session_preserve-0.2.0/src/session_preserve.egg-info/entry_points.txt +2 -0
  41. session_preserve-0.2.0/src/session_preserve.egg-info/top_level.txt +1 -0
  42. session_preserve-0.2.0/tests/__init__.py +1 -0
  43. session_preserve-0.2.0/tests/fixtures/claude/README.md +103 -0
  44. session_preserve-0.2.0/tests/fixtures/claude/branching_cli.jsonl +7 -0
  45. session_preserve-0.2.0/tests/fixtures/claude/compaction_cli.jsonl +5 -0
  46. session_preserve-0.2.0/tests/fixtures/claude/duplicate_replay_cli.jsonl +4 -0
  47. session_preserve-0.2.0/tests/fixtures/claude/fallback_cli.jsonl +3 -0
  48. session_preserve-0.2.0/tests/fixtures/claude/known_ignored_cli.jsonl +6 -0
  49. session_preserve-0.2.0/tests/fixtures/claude/linear_cli.jsonl +3 -0
  50. session_preserve-0.2.0/tests/fixtures/claude/mixed_entrypoint.jsonl +3 -0
  51. session_preserve-0.2.0/tests/fixtures/claude/parallel_stale_leaf_cli.jsonl +8 -0
  52. session_preserve-0.2.0/tests/fixtures/claude/persisted_ui_lag_possible_cli.jsonl +4 -0
  53. session_preserve-0.2.0/tests/fixtures/claude/phantom_parent_after_resume_cli.jsonl +5 -0
  54. session_preserve-0.2.0/tests/fixtures/claude/rewound_last_prompt_cli.jsonl +5 -0
  55. session_preserve-0.2.0/tests/fixtures/claude/sensitive_canaries_cli.jsonl +5 -0
  56. session_preserve-0.2.0/tests/fixtures/claude/stale_last_prompt_cli.jsonl +5 -0
  57. session_preserve-0.2.0/tests/fixtures/claude/truncated_tail_cli.jsonl +3 -0
  58. session_preserve-0.2.0/tests/fixtures/claude/unknown_attachment_cli.jsonl +3 -0
  59. session_preserve-0.2.0/tests/fixtures/claude/unknown_block_cli.jsonl +3 -0
  60. session_preserve-0.2.0/tests/fixtures/claude/unknown_record_cli.jsonl +3 -0
  61. session_preserve-0.2.0/tests/fixtures/claude/unsupported_sdk_cli.jsonl +2 -0
  62. session_preserve-0.2.0/tests/fixtures/kimi/README.md +50 -0
  63. session_preserve-0.2.0/tests/fixtures/kimi/compaction_cli/agents/main/wire.jsonl +6 -0
  64. session_preserve-0.2.0/tests/fixtures/kimi/compaction_cli/state.json +1 -0
  65. session_preserve-0.2.0/tests/fixtures/kimi/linear_cli/agents/main/wire.jsonl +6 -0
  66. session_preserve-0.2.0/tests/fixtures/kimi/linear_cli/state.json +1 -0
  67. session_preserve-0.2.0/tests/fixtures/kimi/privacy_tool_cli/agents/main/wire.jsonl +7 -0
  68. session_preserve-0.2.0/tests/fixtures/kimi/privacy_tool_cli/state.json +1 -0
  69. session_preserve-0.2.0/tests/fixtures/kimi/unknown_record_cli/agents/main/wire.jsonl +3 -0
  70. session_preserve-0.2.0/tests/fixtures/kimi/unknown_record_cli/state.json +1 -0
  71. session_preserve-0.2.0/tests/fixtures/zcode/README.md +45 -0
  72. session_preserve-0.2.0/tests/fixtures/zcode/linear_visible.sql +58 -0
  73. session_preserve-0.2.0/tests/fixtures/zcode/privacy_hidden_tool.sql +86 -0
  74. session_preserve-0.2.0/tests/fixtures/zcode/unknown_part.sql +50 -0
  75. session_preserve-0.2.0/tests/test_claude_contract_fixtures.py +94 -0
  76. session_preserve-0.2.0/tests/test_claude_payload.py +169 -0
  77. session_preserve-0.2.0/tests/test_claude_readable.py +193 -0
  78. session_preserve-0.2.0/tests/test_claude_source_parser.py +344 -0
  79. session_preserve-0.2.0/tests/test_cli_and_verify.py +931 -0
  80. session_preserve-0.2.0/tests/test_codex_conversation_export.py +4002 -0
  81. session_preserve-0.2.0/tests/test_examples.py +126 -0
  82. session_preserve-0.2.0/tests/test_kimi_source_parser.py +152 -0
  83. session_preserve-0.2.0/tests/test_kimi_zcode_contract_fixtures.py +146 -0
  84. session_preserve-0.2.0/tests/test_public_hygiene.py +301 -0
  85. session_preserve-0.2.0/tests/test_public_multprovider_cli.py +175 -0
  86. session_preserve-0.2.0/tests/test_schema_lifecycle.py +271 -0
  87. session_preserve-0.2.0/tests/test_v3_package.py +232 -0
  88. session_preserve-0.2.0/tests/test_v3_provider_adapters.py +158 -0
  89. session_preserve-0.2.0/tests/test_zcode_source_parser.py +205 -0
  90. session_preserve-0.2.0/tools/g3_golden_regression.py +188 -0
  91. session_preserve-0.2.0/tools/public_hygiene_scan.py +310 -0
@@ -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 [yyyy] [name of copyright owner]
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,12 @@
1
+ # The sdist is meant to be a source distribution you can actually verify:
2
+ # unpack it, run the test suite, run the hygiene scan, run the examples.
3
+ # Without these grafts setuptools ships a partial `tests/` directory whose
4
+ # fixtures, scanner and package marker are all missing, so the suite it
5
+ # carries cannot run at all.
6
+ graft tests
7
+ graft examples
8
+ graft tools
9
+
10
+ global-exclude *.py[cod]
11
+ global-exclude .DS_Store
12
+ prune **/__pycache__
@@ -0,0 +1,268 @@
1
+ Metadata-Version: 2.4
2
+ Name: session-preserve
3
+ Version: 0.2.0
4
+ Summary: Local-first preservation and integrity verification for persisted coding-agent sessions from Codex, Claude Code, Kimi Code, and ZCode.
5
+ License-Expression: Apache-2.0
6
+ Project-URL: Homepage, https://github.com/davidqyc/session-preserve
7
+ Project-URL: Repository, https://github.com/davidqyc/session-preserve
8
+ Project-URL: Issues, https://github.com/davidqyc/session-preserve/issues
9
+ Project-URL: Release notes, https://github.com/davidqyc/session-preserve/releases
10
+ Keywords: coding-agent,codex,claude-code,kimi-code,zcode,session,backup,export,transcript,audit,provenance,integrity,verification,local-first
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3 :: Only
16
+ Classifier: Programming Language :: Python :: 3.9
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 :: Software Development :: Version Control
22
+ Classifier: Topic :: System :: Archiving
23
+ Requires-Python: >=3.9
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ Dynamic: license-file
27
+
28
+ # Session Preserve
29
+
30
+ **English** | [简体中文](README.zh-CN.md)
31
+
32
+ Session Preserve keeps an independent, readable copy of coding-agent sessions that are already persisted on your machine.
33
+
34
+ v0.2.0 supports four local sources: OpenAI Codex, Claude Code, Kimi Code, and ZCode.
35
+
36
+ The exported package records where its readable content came from, what the adapter could and could not establish, and a manifest of the package files. Later, session-preserve verify can check whether those manifest-attested files are still present and byte-identical to their recorded SHA-256 and size.
37
+
38
+ Source sessions are read-only. Session Preserve does not restore, resume, import, sync, reindex, repair, archive, or delete them.
39
+
40
+ > If you only need a readable transcript, use the product's built-in export surface when one is available. Session Preserve is for keeping an **independent preservation package** with provenance, coverage information, and later manifest-relative integrity verification.
41
+
42
+ ## Install
43
+
44
+ ~~~bash
45
+ python -m pip install session-preserve
46
+ ~~~
47
+
48
+ Python 3.9 or newer. The runtime has no third-party Python dependencies.
49
+
50
+ ~~~bash
51
+ session-preserve --help
52
+ session-preserve --version
53
+ ~~~
54
+
55
+ Project pages: [GitHub](https://github.com/davidqyc/session-preserve) · [Releases](https://github.com/davidqyc/session-preserve/releases) · [Issues](https://github.com/davidqyc/session-preserve/issues)
56
+
57
+ ## Quick start
58
+
59
+ Every new export uses package schema 3.0.
60
+
61
+ ### Codex
62
+
63
+ List sanitized candidates:
64
+
65
+ ~~~bash
66
+ session-preserve export codex --list-candidates
67
+ ~~~
68
+
69
+ Export one exact persisted session:
70
+
71
+ ~~~bash
72
+ session-preserve export codex --session-id <uuid> --output-dir ./exports
73
+ ~~~
74
+
75
+ You can also select an exact rollout file with --rollout.
76
+
77
+ ### Claude Code
78
+
79
+ Select one top-level session JSONL explicitly:
80
+
81
+ ~~~bash
82
+ session-preserve export claude --source ~/.claude/projects/.../<session>.jsonl --output-dir ./exports
83
+ ~~~
84
+
85
+ The default Claude Code store is under ~/.claude/projects, or $CLAUDE_CONFIG_DIR/projects when configured.
86
+
87
+ ### Kimi Code
88
+
89
+ Select one current-format Kimi Code session directory:
90
+
91
+ ~~~bash
92
+ session-preserve export kimi --source ~/.kimi-code/sessions/.../<session-id> --output-dir ./exports
93
+ ~~~
94
+
95
+ The first adapter reads that session's state.json and agents/main/wire.jsonl. If KIMI_CODE_HOME is configured, use its sessions directory instead.
96
+
97
+ ### ZCode
98
+
99
+ Select one persisted ZCode session from the local conversation database:
100
+
101
+ ~~~bash
102
+ session-preserve export zcode --session-id <session-id> --output-dir ./exports
103
+ ~~~
104
+
105
+ The default database is ~/.zcode/cli/db/db.sqlite. Use --database PATH to point at another ZCode data root.
106
+
107
+ ### Verify and make a transfer ZIP
108
+
109
+ ~~~bash
110
+ session-preserve verify ./exports/<package-dir>
111
+ session-preserve verify ./exports/<package-dir> --json
112
+ session-preserve pack ./exports/<package-dir>
113
+ ~~~
114
+
115
+ pack first verifies a schema-3 package and then writes the derived session-package.zip beside its canonical members. The ZIP excludes itself and does not become a canonical package dependency.
116
+
117
+ Verifier exit codes are stable:
118
+
119
+ | exit | meaning |
120
+ | ---: | --- |
121
+ | 0 | every manifest-attested member is present and matches |
122
+ | 1 | at least one attested member is missing or altered |
123
+ | 2 | the package cannot be verified safely; the verifier fails closed |
124
+
125
+ ## What a schema-3 package contains
126
+
127
+ The physical names are provider-neutral:
128
+
129
+ ~~~text
130
+ <package>/
131
+ ├── conversation.md
132
+ ├── export.receipt.json
133
+ ├── package.manifest.json
134
+ ├── attachments/ # optional
135
+ └── artifacts/ # optional
136
+ └── index.md # present when artifacts exist
137
+ ~~~
138
+
139
+ An on-demand transfer ZIP, when supported by the release surface, is named session-package.zip and is a derived transfer artifact, not a canonical package dependency.
140
+
141
+ conversation.md is the human-readable preservation view. export.receipt.json records provider-specific coverage, provenance, privacy, lifecycle/graph facts, and diagnostics. package.manifest.json records canonical package members, byte sizes, and SHA-256 values.
142
+
143
+ The shared package layer does not force the four providers into one artificial conversation model. Each provider adapter keeps its own source semantics.
144
+
145
+ ## Provider boundaries
146
+
147
+ ### Codex
148
+
149
+ Session Preserve reuses the mature Codex parser that shipped in codex-preserve 0.1.x, then projects the result into schema 3.
150
+
151
+ It may read the selected rollout, ~/.codex/session_index.jsonl read-only for a display name, local read-only Git metadata unless --no-git-probe is used, and explicitly selected attachments/artifacts within the existing safety limits.
152
+
153
+ It never calls codex archive and never changes Codex session state.
154
+
155
+ ### Claude Code
156
+
157
+ The first Claude adapter reads one explicitly selected top-level local session JSONL.
158
+
159
+ It is deliberately loss-averse. Safe persisted text on parallel branches is retained. A last-prompt or rewind marker does not make other persisted text disappear. Missing parent links and duplicate persisted records are reported rather than guessed away. Raw thinking signatures, tool payloads, environment/context bodies, account identifiers, and unknown raw values are not exported.
160
+
161
+ A critical boundary: **a stable Claude JSONL does not prove that every message already visible in the Claude UI has been flushed to disk.** The receipt therefore never attests UI completeness or session terminality.
162
+
163
+ Subagent and tool-result sidecar bodies are outside the first v0.2 adapter.
164
+
165
+ ### Kimi Code
166
+
167
+ The first Kimi adapter targets the current Kimi Code session layout:
168
+
169
+ ~~~text
170
+ <session>/
171
+ ├── state.json
172
+ └── agents/
173
+ └── main/
174
+ └── wire.jsonl
175
+ ~~~
176
+
177
+ It keeps recognized user/assistant text and bounded tool structure while excluding raw thinking, model-request/debug material, tool arguments/results, and unknown record bodies.
178
+
179
+ Subagent bodies are not included in the first adapter. The older Python-era ~/.kimi storage family is not claimed by v0.2.0.
180
+
181
+ ### ZCode
182
+
183
+ The first ZCode adapter reads one explicit session from the local SQLite conversation store in read-only mode.
184
+
185
+ It uses the selected session's structured session, message, and part rows. Visible text is preserved; hidden/model-only messages, reasoning bodies, and raw tool bodies are not.
186
+
187
+ ~/.zcode/cli/rollout/model-io-*.jsonl is diagnostic model-I/O data and is **not** treated as the canonical conversation source.
188
+
189
+ ## Coverage is not the same as the whole UI conversation
190
+
191
+ Session Preserve only makes claims it can support from persisted local data.
192
+
193
+ A package can state whether the selected source snapshot was stable while it was read, whether recognized persisted records fit the adapter contract, how much safe readable content was preserved, and whether unknown schema, graph gaps, unsupported entrypoints, or other limitations were observed.
194
+
195
+ It does not infer that every message currently visible in an app UI has already been persisted, that the session has ended, that hidden model state has been reconstructed, or that excluded sidecars are somehow covered.
196
+
197
+ When the adapter sees unsupported or unknown persisted structure, it marks coverage NON_COMPLETE rather than silently inventing certainty.
198
+
199
+ ## What verification proves
200
+
201
+ session-preserve verify checks manifest-relative integrity:
202
+
203
+ > Are the files attested by this package's manifest present, with the same byte length and SHA-256 recorded in that manifest?
204
+
205
+ That detects missing, truncated, corrupted, or independently edited package members.
206
+
207
+ It does **not** prove authenticity. The manifest travels with the package and is not independently signed. A coordinated rewrite of both a payload and its manifest can still verify. There is no certificate, trust root, authorship attestation, or transparency log.
208
+
209
+ If you need authenticity, sign or timestamp the package with a separate trust mechanism.
210
+
211
+ ## Legacy compatibility
212
+
213
+ codex-preserve 0.1.3 remains published and is not yanked.
214
+
215
+ Session Preserve's verifier permanently retains support for legacy Codex package schemas 2.1 and 2.2. New Session Preserve exports use schema 3.0.
216
+
217
+ The old distribution is not currently a compatibility shim for the new one.
218
+
219
+ The repository was renamed from davidqyc/codex-preserve to davidqyc/session-preserve; GitHub's repository redirect preserves old links.
220
+
221
+ ## 30-second verifier demo
222
+
223
+ The repository still carries three synthetic legacy packages specifically to prove backward-compatible verification:
224
+
225
+ ~~~bash
226
+ git clone --depth 1 https://github.com/davidqyc/session-preserve.git
227
+ cd session-preserve
228
+ ./examples/run_examples.sh
229
+ ~~~
230
+
231
+ The script expects PASS / exit 0, FAIL / exit 1, and UNVERIFIABLE / exit 2. Schema-3 provider exports are covered by the synthetic test suite as well.
232
+
233
+ ## Privacy and local behavior
234
+
235
+ Session Preserve is local-first and makes no model call or network call during export or verification.
236
+
237
+ Provider parsers are allowlist-based. Unknown raw values are not copied just because they exist in a local session store.
238
+
239
+ The project includes a deterministic public-hygiene scan to prevent real session payloads, private machine coordinates, and credential-shaped literals from entering the public repository.
240
+
241
+ ## Non-goals
242
+
243
+ Session Preserve is not a cloud-chat importer, transcript viewer, restore/resume/import/sync tool, history repair/reindex tool, background daemon, provider-conversion layer, generic provider/plugin SDK, or authenticity/forensic chain-of-custody system.
244
+
245
+ The v0.2.0 provider scope is intentionally limited to Codex, Claude Code, Kimi Code, and ZCode.
246
+
247
+ ## Development
248
+
249
+ ~~~bash
250
+ PYTHONPATH=src python3 -m unittest discover -t . -s tests
251
+ python3 tools/public_hygiene_scan.py .
252
+ python3 tools/g3_golden_regression.py
253
+ ./examples/run_examples.sh
254
+ ~~~
255
+
256
+ All committed provider fixtures are hand-authored synthetic data. Tests do not copy real user transcripts into the repository.
257
+
258
+ ## License
259
+
260
+ Apache License 2.0. See [LICENSE](LICENSE).
261
+
262
+ ~~~text
263
+ SPDX-License-Identifier: Apache-2.0
264
+ ~~~
265
+
266
+ ## Independence
267
+
268
+ Session Preserve is an independent, unofficial open-source project. It is not affiliated with, endorsed by, sponsored by, or certified by OpenAI, Anthropic, Moonshot AI, or Z.ai. Product and company names are used only to identify the local session formats the adapters read.