priorstates 0.1.13__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. priorstates-0.1.13/LICENSE +201 -0
  2. priorstates-0.1.13/NOTICE +8 -0
  3. priorstates-0.1.13/PKG-INFO +220 -0
  4. priorstates-0.1.13/README.md +181 -0
  5. priorstates-0.1.13/priorstates/__init__.py +13 -0
  6. priorstates-0.1.13/priorstates/__main__.py +6 -0
  7. priorstates-0.1.13/priorstates/agents/__init__.py +9 -0
  8. priorstates-0.1.13/priorstates/agents/adapters.py +218 -0
  9. priorstates-0.1.13/priorstates/agents/install.py +311 -0
  10. priorstates-0.1.13/priorstates/cli.py +1286 -0
  11. priorstates-0.1.13/priorstates/cockpit/ptybridge.py +83 -0
  12. priorstates-0.1.13/priorstates/cockpit/ptybridge_win.py +331 -0
  13. priorstates-0.1.13/priorstates/cockpit/public/app.js +407 -0
  14. priorstates-0.1.13/priorstates/cockpit/public/index.html +40 -0
  15. priorstates-0.1.13/priorstates/cockpit/public/style.css +52 -0
  16. priorstates-0.1.13/priorstates/cockpit/public/vendor/xterm-addon-fit.js +2 -0
  17. priorstates-0.1.13/priorstates/cockpit/public/vendor/xterm.css +209 -0
  18. priorstates-0.1.13/priorstates/cockpit/public/vendor/xterm.js +2 -0
  19. priorstates-0.1.13/priorstates/cockpit/server.py +753 -0
  20. priorstates-0.1.13/priorstates/core/__init__.py +1 -0
  21. priorstates-0.1.13/priorstates/core/ai.py +174 -0
  22. priorstates-0.1.13/priorstates/core/capture.py +95 -0
  23. priorstates-0.1.13/priorstates/core/config.py +332 -0
  24. priorstates-0.1.13/priorstates/core/embedder.py +213 -0
  25. priorstates-0.1.13/priorstates/core/format.py +154 -0
  26. priorstates-0.1.13/priorstates/core/identity.py +122 -0
  27. priorstates-0.1.13/priorstates/core/indexer.py +304 -0
  28. priorstates-0.1.13/priorstates/core/journal.py +437 -0
  29. priorstates-0.1.13/priorstates/core/outcomes.py +99 -0
  30. priorstates-0.1.13/priorstates/core/plugins.py +172 -0
  31. priorstates-0.1.13/priorstates/core/preview.py +49 -0
  32. priorstates-0.1.13/priorstates/core/scan.py +68 -0
  33. priorstates-0.1.13/priorstates/core/share.py +371 -0
  34. priorstates-0.1.13/priorstates/core/store.py +182 -0
  35. priorstates-0.1.13/priorstates/data/demo.pspack +0 -0
  36. priorstates-0.1.13/priorstates/gui/__init__.py +1 -0
  37. priorstates-0.1.13/priorstates/gui/app.py +2112 -0
  38. priorstates-0.1.13/priorstates/mcp/__init__.py +1 -0
  39. priorstates-0.1.13/priorstates/mcp/server.py +105 -0
  40. priorstates-0.1.13/priorstates/mcp/tools.py +78 -0
  41. priorstates-0.1.13/priorstates/mdlab/__init__.py +9 -0
  42. priorstates-0.1.13/priorstates/mdlab/parser.py +137 -0
  43. priorstates-0.1.13/priorstates/mdlab/runner.py +162 -0
  44. priorstates-0.1.13/priorstates/memory/__init__.py +5 -0
  45. priorstates-0.1.13/priorstates/memory/api.py +407 -0
  46. priorstates-0.1.13/priorstates/memory/pinned.py +91 -0
  47. priorstates-0.1.13/priorstates/memory/writer.py +380 -0
  48. priorstates-0.1.13/priorstates.egg-info/PKG-INFO +220 -0
  49. priorstates-0.1.13/priorstates.egg-info/SOURCES.txt +67 -0
  50. priorstates-0.1.13/priorstates.egg-info/dependency_links.txt +1 -0
  51. priorstates-0.1.13/priorstates.egg-info/entry_points.txt +5 -0
  52. priorstates-0.1.13/priorstates.egg-info/requires.txt +37 -0
  53. priorstates-0.1.13/priorstates.egg-info/top_level.txt +1 -0
  54. priorstates-0.1.13/pyproject.toml +56 -0
  55. priorstates-0.1.13/setup.cfg +4 -0
  56. priorstates-0.1.13/tests/test_agents_wiring.py +76 -0
  57. priorstates-0.1.13/tests/test_ai_local.py +54 -0
  58. priorstates-0.1.13/tests/test_areas.py +64 -0
  59. priorstates-0.1.13/tests/test_gui_services.py +101 -0
  60. priorstates-0.1.13/tests/test_gui_smoke.py +138 -0
  61. priorstates-0.1.13/tests/test_hub_trust.py +82 -0
  62. priorstates-0.1.13/tests/test_plugins.py +60 -0
  63. priorstates-0.1.13/tests/test_plugins_services.py +27 -0
  64. priorstates-0.1.13/tests/test_promotion_gate.py +108 -0
  65. priorstates-0.1.13/tests/test_relay_tools.py +43 -0
  66. priorstates-0.1.13/tests/test_trust_graph_phase0.py +116 -0
  67. priorstates-0.1.13/tests/test_trust_graph_phase1.py +132 -0
  68. priorstates-0.1.13/tests/test_trust_graph_phase2.py +121 -0
  69. priorstates-0.1.13/tests/test_trust_graph_phase3.py +109 -0
@@ -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 Derivative
95
+ 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 do
117
+ not modify the License. You may add Your own attribution notices
118
+ within Derivative Works that You distribute, alongside or as an
119
+ addendum to the NOTICE text from the Work, provided that such
120
+ additional attribution notices cannot be construed as modifying
121
+ the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,8 @@
1
+ PriorStates
2
+ Copyright 2026 Zhendong Qin
3
+
4
+ This product is licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License. A copy of the
6
+ License is provided in the LICENSE file and at:
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
@@ -0,0 +1,220 @@
1
+ Metadata-Version: 2.4
2
+ Name: priorstates
3
+ Version: 0.1.13
4
+ Summary: Shared memory & research journal for your AI agents โ€” memory + journal + cockpit + runnable-markdown (mdlab) for Claude, Codex, and Gemini.
5
+ Author: Zhendong Qin
6
+ License: Apache-2.0
7
+ Keywords: ai,memory,journal,mcp,claude,codex,gemini,mdlab
8
+ Requires-Python: >=3.10
9
+ Description-Content-Type: text/markdown
10
+ License-File: LICENSE
11
+ License-File: NOTICE
12
+ Requires-Dist: numpy>=1.21
13
+ Provides-Extra: onnx
14
+ Requires-Dist: onnxruntime>=1.16; extra == "onnx"
15
+ Requires-Dist: tokenizers>=0.15; extra == "onnx"
16
+ Provides-Extra: mcp
17
+ Requires-Dist: mcp>=1.2; extra == "mcp"
18
+ Provides-Extra: extras
19
+ Requires-Dist: pyyaml>=6; extra == "extras"
20
+ Requires-Dist: pandas>=2; extra == "extras"
21
+ Provides-Extra: kernel
22
+ Requires-Dist: jupyter_client>=8; extra == "kernel"
23
+ Requires-Dist: ipykernel>=6; extra == "kernel"
24
+ Provides-Extra: winterm
25
+ Requires-Dist: pywinpty>=2; sys_platform == "win32" and extra == "winterm"
26
+ Provides-Extra: sign
27
+ Requires-Dist: cryptography>=41; extra == "sign"
28
+ Provides-Extra: full
29
+ Requires-Dist: onnxruntime>=1.16; extra == "full"
30
+ Requires-Dist: tokenizers>=0.15; extra == "full"
31
+ Requires-Dist: mcp>=1.2; extra == "full"
32
+ Requires-Dist: pyyaml>=6; extra == "full"
33
+ Requires-Dist: pandas>=2; extra == "full"
34
+ Requires-Dist: jupyter_client>=8; extra == "full"
35
+ Requires-Dist: ipykernel>=6; extra == "full"
36
+ Requires-Dist: pywinpty>=2; sys_platform == "win32" and extra == "full"
37
+ Requires-Dist: cryptography>=41; extra == "full"
38
+ Dynamic: license-file
39
+
40
+ <div align="center">
41
+
42
+ # ๐Ÿ”ญ PriorStates
43
+
44
+ ### Shared memory &amp; a research journal for your AI agents
45
+
46
+ [![License: Apache-2.0](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE)
47
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://www.python.org/)
48
+ [![MCP-native](https://img.shields.io/badge/MCP-native-3fb950.svg)](https://modelcontextprotocol.io/)
49
+ [![100% local](https://img.shields.io/badge/100%25-local-3fb950.svg)](#private-by-default)
50
+ [![Stars](https://img.shields.io/github/stars/zqin2012/priorstates?style=social)](https://github.com/zqin2012/priorstates)
51
+
52
+ **Coding agents are amnesiacs** โ€” every session starts cold, re-deriving what you
53
+ already taught them and re-running experiments a past session already concluded.
54
+ PriorStates gives **Claude, Codex &amp; Gemini** one **local** memory and a searchable
55
+ **research journal**, so what one session learns, the next one remembers.
56
+
57
+ Runs entirely on your machine ยท CPU-only ยท no API keys ยท no cloud calls.
58
+
59
+ ๐ŸŒ **[priorstates.com](https://priorstates.com)** ยท ๐ŸŽฌ **[80-second demo](https://priorstates.com)** ยท ๐Ÿ“– **[Docs](docs/USER_GUIDE.md)**
60
+
61
+ <img src="docs/img/demo.gif" alt="PriorStates in action: save a memory, then recall it by meaning in a brand-new agent session" width="760">
62
+
63
+ </div>
64
+
65
+ ## Install โ€” in one sentence
66
+
67
+ Already using Claude, Codex, or Gemini? Hand it one line:
68
+
69
+ > **Install PriorStates: fetch https://priorstates.com/install.md and follow it.**
70
+
71
+ The agent reads [`AGENT_INSTALL.md`](AGENT_INSTALL.md), installs the package, wires
72
+ itself over MCP, and verifies with `priorstates doctor` โ€” then restart it to load
73
+ the new tools.
74
+
75
+ **Prefer to do it yourself?** Pick your platform:
76
+
77
+ <details open>
78
+ <summary><b>๐Ÿง Linux (Debian / Ubuntu) โ€” the <code>.deb</code> (recommended)</b></summary>
79
+
80
+ Apt pulls in `python3` + `numpy`, and you get the desktop app, an icon, the
81
+ `priorstates` CLI and man pages โ€” nothing else to install:
82
+
83
+ ```bash
84
+ curl -fSLO https://github.com/zqin2012/priorstates/releases/latest/download/priorstates_0.1.0_all.deb
85
+ sudo apt install -y ./priorstates_0.1.0_all.deb # resolves python3 (>= 3.10) + python3-numpy
86
+ ```
87
+
88
+ Then just **open โ€œPriorStatesโ€ from your application menu** (or run
89
+ `priorstates-gui`). The desktop control panel does the rest โ€” initialize your
90
+ memory, wire Claude / Codex / Gemini over MCP, and launch the cockpit, all with a
91
+ click. No further commands needed. (For agent integration it needs the MCP support
92
+ package once โ€” `pip3 install --user mcp`; the app flags it if it's missing.)
93
+
94
+ `sudo apt remove priorstates` uninstalls. Re-running the same `apt install`
95
+ upgrades in place.
96
+ </details>
97
+
98
+ <details>
99
+ <summary><b>๐ŸชŸ Windows โ€” the one-click installer (easiest of all)</b></summary>
100
+
101
+ Download and run
102
+ **[PriorStates-Windows-Setup.exe](https://github.com/zqin2012/priorstates/releases/latest/download/PriorStates-Windows-Setup.exe)**
103
+ โ€” it auto-installs Python if you don't have it, then installs PriorStates and adds
104
+ Start Menu + Desktop shortcuts. Nothing else required.
105
+ </details>
106
+
107
+ <details>
108
+ <summary><b>๐ŸŽ macOS / any OS with Python 3.10+ โ€” pip</b></summary>
109
+
110
+ ```bash
111
+ pip install --user --no-cache-dir "priorstates @ git+https://github.com/zqin2012/priorstates.git"
112
+ priorstates init # create ~/.priorstates + per-project .priorstates/
113
+ priorstates agents install # wire Claude / Codex / Gemini over MCP
114
+ priorstates cockpit # open the web cockpit โ†’ http://127.0.0.1:7700
115
+ ```
116
+
117
+ macOS also has a native `.pkg` / Homebrew formula โ€” see
118
+ [docs/QUICKSTART.md](docs/QUICKSTART.md).
119
+ </details>
120
+
121
+ Full install matrix (`.deb` / macOS `.pkg` / Windows / source) is in
122
+ **[docs/QUICKSTART.md](docs/QUICKSTART.md)**. No model download is required โ€” a
123
+ built-in CPU hashing embedder works out of the box.
124
+
125
+ ## What's inside
126
+
127
+ | | Subsystem | What it does |
128
+ |---|---|---|
129
+ | ๐Ÿง  | **memory** | A local semantic store. Save a fact once โ€” any future session recalls it *by meaning*. Pinned facts are injected into every session. |
130
+ | ๐Ÿ““ | **journal** | An append-only research log. Every winner, loser, bug &amp; decision becomes a searchable entry, so no experiment is run twice. |
131
+ | ๐Ÿ›ฐ๏ธ | **cockpit** | A **pure-Python** (stdlib-only) local web app that maps your memory, journal &amp; docs โ€” search, group, dashboards. Embedded **terminal** (on by default for a local cockpit; `--no-terminal` to disable) to run your agent CLIs right in the browser. No Node.js, no npm, no build step. |
132
+ | ๐Ÿ“ | **mdlab** | Runnable Markdown: interleave prose, code &amp; results in one file and splice output back in. |
133
+
134
+ All of it is wired into your agents over the open **[MCP](https://modelcontextprotocol.io/)**
135
+ protocol by `priorstates agents install` โ€” so they *recall* before acting and
136
+ *record* durable conclusions back, automatically.
137
+
138
+ ## MCP server
139
+
140
+ `priorstates agents install` registers the server into Claude / Codex / Gemini for
141
+ you; to run it directly over stdio: **`priorstates mcp`**. It exposes 10 tools:
142
+
143
+ - **memory** โ€” `memory_add` ยท `memory_search` ยท `memory_get` ยท `memory_list_pinned` ยท `memory_pin` ยท `memory_delete`
144
+ - **journal** โ€” `journal_add` ยท `journal_search` ยท `journal_regen`
145
+ - **mdlab** โ€” `mdlab_run`
146
+
147
+ ## See it in action
148
+
149
+ The **cockpit** maps your whole research surface; the **CLI** captures and recalls from your terminal.
150
+
151
+ <img src="docs/img/cockpit.png" alt="The PriorStates cockpit โ€” search and manage memory, journal and docs in one local web view" width="820">
152
+
153
+ <img src="docs/img/cli.png" alt="PriorStates CLI โ€” capture a memory in plain English, list pinned memories, search the journal by outcome" width="720">
154
+
155
+ ## Agent-neutral
156
+
157
+ One memory store and one journal, surfaced to **Claude Code ยท Claude Desktop ยท Codex ยท
158
+ Gemini ยท Antigravity** through MCP and a pinned context block โ€” no lock-in, no
159
+ rewrites. Switch agents without losing a thing. The **VS Code / JetBrains
160
+ extensions** for Claude Code and Codex share their CLI's MCP config, so they're
161
+ covered automatically; **Claude Desktop** (its own app) is wired into
162
+ `claude_desktop_config.json` too. Every client on the machine reads the *same*
163
+ local store, so a memory saved in one is instantly recalled in all the others.
164
+
165
+ ## Private by default
166
+
167
+ Everything lives under `~/.priorstates/` and per-project `.priorstates/`. The
168
+ default embedder is **CPU-only and offline** โ€” no API keys, no telemetry, no cloud
169
+ calls. Upgrade to semantic recall with a single optional ~127&nbsp;MB model download
170
+ whenever you want.
171
+
172
+ ## Share a pack
173
+
174
+ Export your memory + journal as a portable bundle and hand it to a teammate (or
175
+ host it anywhere โ€” any file or URL works):
176
+
177
+ ```bash
178
+ priorstates pack export --name my-project # โ†’ my-project.pspack
179
+ priorstates pack import ./my-project.pspack # on the other machine (or a URL)
180
+ ```
181
+
182
+ Imported memory surfaces through the same MCP tools โ€” no extra wiring. Imports are
183
+ **checksum-verified, shown for confirmation before ingest, and tagged with their
184
+ source** (and never auto-pinned). The **cockpit** has **Export** / **Import**
185
+ buttons too (Import needs the cockpit started with `--allow-write`).
186
+
187
+ **New here?** Load a ready-made sample to see PriorStates populated instantly:
188
+
189
+ ```bash
190
+ priorstates pack import --demo
191
+ ```
192
+
193
+ ## Docs
194
+
195
+ - **[docs/USER_GUIDE.md](docs/USER_GUIDE.md)** โ€” the everyday-use manual. **Start here.**
196
+ - **[docs/PROJECTS_AND_AREAS.md](docs/PROJECTS_AND_AREAS.md)** โ€” Projects vs Areas: the two scoping axes + the GUI Area selector.
197
+ - **[docs/QUICKSTART.md](docs/QUICKSTART.md)** โ€” install + first run.
198
+ - **[docs/RESEARCH_WORKFLOW.md](docs/RESEARCH_WORKFLOW.md)** โ€” research folders + how agents log to the journal.
199
+ - **[docs/DATA_MODEL.md](docs/DATA_MODEL.md)** โ€” on-disk schemas + the `.psmem` layout.
200
+ - One-click native installers (the free **Hub edition**) โ€” macOS / Windows / Linux โ€” at **https://priorstates.com/download**.
201
+
202
+ ## Status
203
+
204
+ **v0.1 โ€” working end-to-end:** memory, journal, mdlab, MCP server (10 tools),
205
+ agent wiring (Claude / Codex / Gemini / Antigravity), the web cockpit, and the
206
+ desktop launcher are all built and tested. Optional semantic model downloads on
207
+ demand; the hashing fallback needs zero setup. A background embedder daemon and
208
+ an autonomous `priorstates research` runner are next.
209
+
210
+ Issues and PRs welcome.
211
+
212
+ ## Get in touch
213
+
214
+ Questions, ideas, or feedback โ€” **[service@priorstates.com](mailto:service@priorstates.com)**.
215
+ Bug reports and feature requests are welcome as GitHub issues.
216
+
217
+ ## License
218
+
219
+ **Apache-2.0** (permissive + patent grant). See [LICENSE](LICENSE) and [NOTICE](NOTICE).
220
+ Copyright 2026 Zhendong Qin.
@@ -0,0 +1,181 @@
1
+ <div align="center">
2
+
3
+ # ๐Ÿ”ญ PriorStates
4
+
5
+ ### Shared memory &amp; a research journal for your AI agents
6
+
7
+ [![License: Apache-2.0](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE)
8
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://www.python.org/)
9
+ [![MCP-native](https://img.shields.io/badge/MCP-native-3fb950.svg)](https://modelcontextprotocol.io/)
10
+ [![100% local](https://img.shields.io/badge/100%25-local-3fb950.svg)](#private-by-default)
11
+ [![Stars](https://img.shields.io/github/stars/zqin2012/priorstates?style=social)](https://github.com/zqin2012/priorstates)
12
+
13
+ **Coding agents are amnesiacs** โ€” every session starts cold, re-deriving what you
14
+ already taught them and re-running experiments a past session already concluded.
15
+ PriorStates gives **Claude, Codex &amp; Gemini** one **local** memory and a searchable
16
+ **research journal**, so what one session learns, the next one remembers.
17
+
18
+ Runs entirely on your machine ยท CPU-only ยท no API keys ยท no cloud calls.
19
+
20
+ ๐ŸŒ **[priorstates.com](https://priorstates.com)** ยท ๐ŸŽฌ **[80-second demo](https://priorstates.com)** ยท ๐Ÿ“– **[Docs](docs/USER_GUIDE.md)**
21
+
22
+ <img src="docs/img/demo.gif" alt="PriorStates in action: save a memory, then recall it by meaning in a brand-new agent session" width="760">
23
+
24
+ </div>
25
+
26
+ ## Install โ€” in one sentence
27
+
28
+ Already using Claude, Codex, or Gemini? Hand it one line:
29
+
30
+ > **Install PriorStates: fetch https://priorstates.com/install.md and follow it.**
31
+
32
+ The agent reads [`AGENT_INSTALL.md`](AGENT_INSTALL.md), installs the package, wires
33
+ itself over MCP, and verifies with `priorstates doctor` โ€” then restart it to load
34
+ the new tools.
35
+
36
+ **Prefer to do it yourself?** Pick your platform:
37
+
38
+ <details open>
39
+ <summary><b>๐Ÿง Linux (Debian / Ubuntu) โ€” the <code>.deb</code> (recommended)</b></summary>
40
+
41
+ Apt pulls in `python3` + `numpy`, and you get the desktop app, an icon, the
42
+ `priorstates` CLI and man pages โ€” nothing else to install:
43
+
44
+ ```bash
45
+ curl -fSLO https://github.com/zqin2012/priorstates/releases/latest/download/priorstates_0.1.0_all.deb
46
+ sudo apt install -y ./priorstates_0.1.0_all.deb # resolves python3 (>= 3.10) + python3-numpy
47
+ ```
48
+
49
+ Then just **open โ€œPriorStatesโ€ from your application menu** (or run
50
+ `priorstates-gui`). The desktop control panel does the rest โ€” initialize your
51
+ memory, wire Claude / Codex / Gemini over MCP, and launch the cockpit, all with a
52
+ click. No further commands needed. (For agent integration it needs the MCP support
53
+ package once โ€” `pip3 install --user mcp`; the app flags it if it's missing.)
54
+
55
+ `sudo apt remove priorstates` uninstalls. Re-running the same `apt install`
56
+ upgrades in place.
57
+ </details>
58
+
59
+ <details>
60
+ <summary><b>๐ŸชŸ Windows โ€” the one-click installer (easiest of all)</b></summary>
61
+
62
+ Download and run
63
+ **[PriorStates-Windows-Setup.exe](https://github.com/zqin2012/priorstates/releases/latest/download/PriorStates-Windows-Setup.exe)**
64
+ โ€” it auto-installs Python if you don't have it, then installs PriorStates and adds
65
+ Start Menu + Desktop shortcuts. Nothing else required.
66
+ </details>
67
+
68
+ <details>
69
+ <summary><b>๐ŸŽ macOS / any OS with Python 3.10+ โ€” pip</b></summary>
70
+
71
+ ```bash
72
+ pip install --user --no-cache-dir "priorstates @ git+https://github.com/zqin2012/priorstates.git"
73
+ priorstates init # create ~/.priorstates + per-project .priorstates/
74
+ priorstates agents install # wire Claude / Codex / Gemini over MCP
75
+ priorstates cockpit # open the web cockpit โ†’ http://127.0.0.1:7700
76
+ ```
77
+
78
+ macOS also has a native `.pkg` / Homebrew formula โ€” see
79
+ [docs/QUICKSTART.md](docs/QUICKSTART.md).
80
+ </details>
81
+
82
+ Full install matrix (`.deb` / macOS `.pkg` / Windows / source) is in
83
+ **[docs/QUICKSTART.md](docs/QUICKSTART.md)**. No model download is required โ€” a
84
+ built-in CPU hashing embedder works out of the box.
85
+
86
+ ## What's inside
87
+
88
+ | | Subsystem | What it does |
89
+ |---|---|---|
90
+ | ๐Ÿง  | **memory** | A local semantic store. Save a fact once โ€” any future session recalls it *by meaning*. Pinned facts are injected into every session. |
91
+ | ๐Ÿ““ | **journal** | An append-only research log. Every winner, loser, bug &amp; decision becomes a searchable entry, so no experiment is run twice. |
92
+ | ๐Ÿ›ฐ๏ธ | **cockpit** | A **pure-Python** (stdlib-only) local web app that maps your memory, journal &amp; docs โ€” search, group, dashboards. Embedded **terminal** (on by default for a local cockpit; `--no-terminal` to disable) to run your agent CLIs right in the browser. No Node.js, no npm, no build step. |
93
+ | ๐Ÿ“ | **mdlab** | Runnable Markdown: interleave prose, code &amp; results in one file and splice output back in. |
94
+
95
+ All of it is wired into your agents over the open **[MCP](https://modelcontextprotocol.io/)**
96
+ protocol by `priorstates agents install` โ€” so they *recall* before acting and
97
+ *record* durable conclusions back, automatically.
98
+
99
+ ## MCP server
100
+
101
+ `priorstates agents install` registers the server into Claude / Codex / Gemini for
102
+ you; to run it directly over stdio: **`priorstates mcp`**. It exposes 10 tools:
103
+
104
+ - **memory** โ€” `memory_add` ยท `memory_search` ยท `memory_get` ยท `memory_list_pinned` ยท `memory_pin` ยท `memory_delete`
105
+ - **journal** โ€” `journal_add` ยท `journal_search` ยท `journal_regen`
106
+ - **mdlab** โ€” `mdlab_run`
107
+
108
+ ## See it in action
109
+
110
+ The **cockpit** maps your whole research surface; the **CLI** captures and recalls from your terminal.
111
+
112
+ <img src="docs/img/cockpit.png" alt="The PriorStates cockpit โ€” search and manage memory, journal and docs in one local web view" width="820">
113
+
114
+ <img src="docs/img/cli.png" alt="PriorStates CLI โ€” capture a memory in plain English, list pinned memories, search the journal by outcome" width="720">
115
+
116
+ ## Agent-neutral
117
+
118
+ One memory store and one journal, surfaced to **Claude Code ยท Claude Desktop ยท Codex ยท
119
+ Gemini ยท Antigravity** through MCP and a pinned context block โ€” no lock-in, no
120
+ rewrites. Switch agents without losing a thing. The **VS Code / JetBrains
121
+ extensions** for Claude Code and Codex share their CLI's MCP config, so they're
122
+ covered automatically; **Claude Desktop** (its own app) is wired into
123
+ `claude_desktop_config.json` too. Every client on the machine reads the *same*
124
+ local store, so a memory saved in one is instantly recalled in all the others.
125
+
126
+ ## Private by default
127
+
128
+ Everything lives under `~/.priorstates/` and per-project `.priorstates/`. The
129
+ default embedder is **CPU-only and offline** โ€” no API keys, no telemetry, no cloud
130
+ calls. Upgrade to semantic recall with a single optional ~127&nbsp;MB model download
131
+ whenever you want.
132
+
133
+ ## Share a pack
134
+
135
+ Export your memory + journal as a portable bundle and hand it to a teammate (or
136
+ host it anywhere โ€” any file or URL works):
137
+
138
+ ```bash
139
+ priorstates pack export --name my-project # โ†’ my-project.pspack
140
+ priorstates pack import ./my-project.pspack # on the other machine (or a URL)
141
+ ```
142
+
143
+ Imported memory surfaces through the same MCP tools โ€” no extra wiring. Imports are
144
+ **checksum-verified, shown for confirmation before ingest, and tagged with their
145
+ source** (and never auto-pinned). The **cockpit** has **Export** / **Import**
146
+ buttons too (Import needs the cockpit started with `--allow-write`).
147
+
148
+ **New here?** Load a ready-made sample to see PriorStates populated instantly:
149
+
150
+ ```bash
151
+ priorstates pack import --demo
152
+ ```
153
+
154
+ ## Docs
155
+
156
+ - **[docs/USER_GUIDE.md](docs/USER_GUIDE.md)** โ€” the everyday-use manual. **Start here.**
157
+ - **[docs/PROJECTS_AND_AREAS.md](docs/PROJECTS_AND_AREAS.md)** โ€” Projects vs Areas: the two scoping axes + the GUI Area selector.
158
+ - **[docs/QUICKSTART.md](docs/QUICKSTART.md)** โ€” install + first run.
159
+ - **[docs/RESEARCH_WORKFLOW.md](docs/RESEARCH_WORKFLOW.md)** โ€” research folders + how agents log to the journal.
160
+ - **[docs/DATA_MODEL.md](docs/DATA_MODEL.md)** โ€” on-disk schemas + the `.psmem` layout.
161
+ - One-click native installers (the free **Hub edition**) โ€” macOS / Windows / Linux โ€” at **https://priorstates.com/download**.
162
+
163
+ ## Status
164
+
165
+ **v0.1 โ€” working end-to-end:** memory, journal, mdlab, MCP server (10 tools),
166
+ agent wiring (Claude / Codex / Gemini / Antigravity), the web cockpit, and the
167
+ desktop launcher are all built and tested. Optional semantic model downloads on
168
+ demand; the hashing fallback needs zero setup. A background embedder daemon and
169
+ an autonomous `priorstates research` runner are next.
170
+
171
+ Issues and PRs welcome.
172
+
173
+ ## Get in touch
174
+
175
+ Questions, ideas, or feedback โ€” **[service@priorstates.com](mailto:service@priorstates.com)**.
176
+ Bug reports and feature requests are welcome as GitHub issues.
177
+
178
+ ## License
179
+
180
+ **Apache-2.0** (permissive + patent grant). See [LICENSE](LICENSE) and [NOTICE](NOTICE).
181
+ Copyright 2026 Zhendong Qin.
@@ -0,0 +1,13 @@
1
+ """PriorStates โ€” local memory + research journal + cockpit + runnable-markdown
2
+ for Claude, Codex, and Gemini.
3
+
4
+ See docs/DESIGN.md for the architecture. Subpackages:
5
+ core/ shared engine (config, .psmem store, embedder, indexer, journal)
6
+ memory/ semantic memory (write path, pinned-block render, high-level API)
7
+ mdlab/ headless runnable-Markdown (parser + runner + result regions)
8
+ agents/ Claude / Codex / Gemini adapters + installer
9
+ mcp/ one MCP server exposing memory_* / journal_* / mdlab tools
10
+ gui/ Tkinter desktop control panel
11
+ cli `priorstates` entrypoint
12
+ """
13
+ __version__ = "0.1.0"
@@ -0,0 +1,6 @@
1
+ """Enable `python -m priorstates ...` as a PATH-independent entry point
2
+ (equivalent to the `priorstates` console script)."""
3
+ from .cli import main
4
+
5
+ if __name__ == "__main__":
6
+ main()
@@ -0,0 +1,9 @@
1
+ """pm-agents โ€” Claude / Codex / Gemini adapters + installer.
2
+
3
+ All three agents speak MCP for tools, so the memory/journal/mdlab logic is
4
+ written once (priorstates.mcp.server) and each agent differs only in (a) where its
5
+ MCP registration lives and (b) which context file the pinned block goes into.
6
+ That whole per-agent surface is the ADAPTERS table in adapters.py.
7
+ """
8
+ from .adapters import ADAPTERS, detect_installed, pinned_targets # noqa: F401
9
+ from .install import install, uninstall, status, protocol # noqa: F401