agentcache-core 0.9.9__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 (62) hide show
  1. agentcache_core-0.9.9/LICENSE +190 -0
  2. agentcache_core-0.9.9/PKG-INFO +194 -0
  3. agentcache_core-0.9.9/README.md +155 -0
  4. agentcache_core-0.9.9/pyproject.toml +77 -0
  5. agentcache_core-0.9.9/setup.cfg +4 -0
  6. agentcache_core-0.9.9/src/agentcache/__init__.py +29 -0
  7. agentcache_core-0.9.9/src/agentcache/app.py +312 -0
  8. agentcache_core-0.9.9/src/agentcache/cli.py +346 -0
  9. agentcache_core-0.9.9/src/agentcache/connect.py +724 -0
  10. agentcache_core-0.9.9/src/agentcache/core/__init__.py +19 -0
  11. agentcache_core-0.9.9/src/agentcache/core/audit_log.py +104 -0
  12. agentcache_core-0.9.9/src/agentcache/core/config.py +51 -0
  13. agentcache_core-0.9.9/src/agentcache/core/context_builder.py +209 -0
  14. agentcache_core-0.9.9/src/agentcache/core/graph.py +120 -0
  15. agentcache_core-0.9.9/src/agentcache/core/image_store.py +111 -0
  16. agentcache_core-0.9.9/src/agentcache/core/infer.py +142 -0
  17. agentcache_core-0.9.9/src/agentcache/core/kv_scopes.py +86 -0
  18. agentcache_core-0.9.9/src/agentcache/core/lessons.py +242 -0
  19. agentcache_core-0.9.9/src/agentcache/core/llm.py +596 -0
  20. agentcache_core-0.9.9/src/agentcache/core/memory_store.py +207 -0
  21. agentcache_core-0.9.9/src/agentcache/core/observation_store.py +576 -0
  22. agentcache_core-0.9.9/src/agentcache/core/privacy.py +34 -0
  23. agentcache_core-0.9.9/src/agentcache/core/project_profile.py +625 -0
  24. agentcache_core-0.9.9/src/agentcache/core/search_service.py +444 -0
  25. agentcache_core-0.9.9/src/agentcache/core/session_store.py +382 -0
  26. agentcache_core-0.9.9/src/agentcache/core/slots.py +504 -0
  27. agentcache_core-0.9.9/src/agentcache/db.py +359 -0
  28. agentcache_core-0.9.9/src/agentcache/import_data.py +86 -0
  29. agentcache_core-0.9.9/src/agentcache/legacy.py +94 -0
  30. agentcache_core-0.9.9/src/agentcache/mcp_stdio.py +141 -0
  31. agentcache_core-0.9.9/src/agentcache/py.typed +0 -0
  32. agentcache_core-0.9.9/src/agentcache/replay_import.py +680 -0
  33. agentcache_core-0.9.9/src/agentcache/routes/__init__.py +29 -0
  34. agentcache_core-0.9.9/src/agentcache/routes/_deps.py +46 -0
  35. agentcache_core-0.9.9/src/agentcache/routes/auth.py +68 -0
  36. agentcache_core-0.9.9/src/agentcache/routes/graph.py +81 -0
  37. agentcache_core-0.9.9/src/agentcache/routes/health.py +149 -0
  38. agentcache_core-0.9.9/src/agentcache/routes/mcp.py +614 -0
  39. agentcache_core-0.9.9/src/agentcache/routes/memories.py +116 -0
  40. agentcache_core-0.9.9/src/agentcache/routes/migration.py +32 -0
  41. agentcache_core-0.9.9/src/agentcache/routes/observations.py +253 -0
  42. agentcache_core-0.9.9/src/agentcache/routes/search.py +80 -0
  43. agentcache_core-0.9.9/src/agentcache/search.py +935 -0
  44. agentcache_core-0.9.9/src/agentcache/storage/__init__.py +29 -0
  45. agentcache_core-0.9.9/src/agentcache/storage/images.py +102 -0
  46. agentcache_core-0.9.9/src/agentcache/storage/paths.py +116 -0
  47. agentcache_core-0.9.9/src/agentcache/storage/scopes.py +9 -0
  48. agentcache_core-0.9.9/src/agentcache/viewer/favicon.svg +1 -0
  49. agentcache_core-0.9.9/src/agentcache/viewer/index.html +4235 -0
  50. agentcache_core-0.9.9/src/agentcache/viewer_helpers.py +61 -0
  51. agentcache_core-0.9.9/src/agentcache/workers.py +192 -0
  52. agentcache_core-0.9.9/src/agentcache_core.egg-info/PKG-INFO +194 -0
  53. agentcache_core-0.9.9/src/agentcache_core.egg-info/SOURCES.txt +60 -0
  54. agentcache_core-0.9.9/src/agentcache_core.egg-info/dependency_links.txt +1 -0
  55. agentcache_core-0.9.9/src/agentcache_core.egg-info/entry_points.txt +2 -0
  56. agentcache_core-0.9.9/src/agentcache_core.egg-info/requires.txt +15 -0
  57. agentcache_core-0.9.9/src/agentcache_core.egg-info/top_level.txt +1 -0
  58. agentcache_core-0.9.9/tests/test_auth.py +162 -0
  59. agentcache_core-0.9.9/tests/test_legacy_reexports.py +149 -0
  60. agentcache_core-0.9.9/tests/test_observation_store.py +438 -0
  61. agentcache_core-0.9.9/tests/test_routes_auth_matrix.py +146 -0
  62. agentcache_core-0.9.9/tests/test_search_service.py +172 -0
@@ -0,0 +1,190 @@
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 the 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 the 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 any 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 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
+ Copyright 2026 Rohit Ghumare
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
@@ -0,0 +1,194 @@
1
+ Metadata-Version: 2.4
2
+ Name: agentcache-core
3
+ Version: 0.9.9
4
+ Summary: A Python REST + WebSocket + MCP cache server for AI agents, backed by SQLite
5
+ Author-email: Yashwant K <yashwantk0303@gmail.com>
6
+ Maintainer-email: Yashwant K <yashwantk0303@gmail.com>
7
+ License: MIT
8
+ Project-URL: Homepage, https://github.com/Yashwant00CR7/agentcache
9
+ Project-URL: Repository, https://github.com/Yashwant00CR7/agentcache.git
10
+ Project-URL: Bug Tracker, https://github.com/Yashwant00CR7/agentcache/issues
11
+ Project-URL: Documentation, https://github.com/Yashwant00CR7/agentcache#readme
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Operating System :: OS Independent
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: Topic :: Scientific/Engineering :: Artificial Intelligence
21
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
22
+ Requires-Python: >=3.10
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ Requires-Dist: flask>=3.0.0
26
+ Requires-Dist: flask-sock>=0.7.0
27
+ Requires-Dist: requests>=2.31.0
28
+ Requires-Dist: python-dateutil>=2.8.2
29
+ Requires-Dist: huggingface_hub>=0.20.0
30
+ Requires-Dist: websockets>=12.0
31
+ Provides-Extra: dev
32
+ Requires-Dist: pytest>=8.0.0; extra == "dev"
33
+ Requires-Dist: hypothesis>=6.100.0; extra == "dev"
34
+ Requires-Dist: ruff>=0.3.0; extra == "dev"
35
+ Requires-Dist: twine>=5.0.0; extra == "dev"
36
+ Provides-Extra: local-embeddings
37
+ Requires-Dist: sentence-transformers>=2.7.0; extra == "local-embeddings"
38
+ Dynamic: license-file
39
+
40
+ # agentcache
41
+
42
+ A Python REST + WebSocket + MCP cache server for AI agents, backed by SQLite.
43
+
44
+ `agentcache` gives coding agents (Claude Code, Cursor, Cline, Kiro, Antigravity, …) a persistent, searchable memory of what happened in a project — observations, sessions, long-term memories, and a folder-scoped knowledge graph — with hybrid BM25 + vector search, WebSocket live updates, and a Model Context Protocol (MCP) stdio bridge.
45
+
46
+ - **Server:** Flask + `flask-sock` (REST + WebSocket) on a single port
47
+ - **Storage:** SQLite in WAL mode (zero external services)
48
+ - **Search:** BM25 + optional local embeddings (`sentence-transformers`) or Hugging Face inference
49
+ - **MCP:** stdio bridge so any MCP-compatible client can `observe` / `remember` / `search` natively
50
+ - **CLI:** `agentcache serve|worker|migrate|export|context|connect`
51
+
52
+ Status: **Beta** (`Development Status :: 4 - Beta`). API is stable enough for daily use; internals may still shift before 1.0.
53
+
54
+ ---
55
+
56
+ ## Install
57
+
58
+ ```bash
59
+ pip install agentcache-core
60
+ ```
61
+
62
+ The package installs as `agentcache-core` on PyPI but imports and runs as `agentcache` (`import agentcache`, `agentcache serve`). The plain `agentcache` name on PyPI belongs to an unrelated project.
63
+
64
+ With optional local embeddings (adds `sentence-transformers`, ~1 GB of model weights on first use):
65
+
66
+ ```bash
67
+ pip install "agentcache-core[local-embeddings]"
68
+ ```
69
+
70
+ Requires Python 3.10+.
71
+
72
+ ---
73
+
74
+ ## Quickstart
75
+
76
+ Start the server:
77
+
78
+ ```bash
79
+ agentcache serve --port 3111
80
+ ```
81
+
82
+ Record an observation (any HTTP client works):
83
+
84
+ ```bash
85
+ curl -X POST http://localhost:3111/agentcache/observe \
86
+ -H "Content-Type: application/json" \
87
+ -d '{
88
+ "folderPath": "/abs/path/to/project",
89
+ "agentId": "coder-1",
90
+ "text": "Refactored auth into a decorator; see routes/auth.py",
91
+ "type": "refactor"
92
+ }'
93
+ ```
94
+
95
+ Search across a folder:
96
+
97
+ ```bash
98
+ curl "http://localhost:3111/agentcache/folder/observations?folderPath=/abs/path/to/project&q=auth"
99
+ ```
100
+
101
+ Health check:
102
+
103
+ ```bash
104
+ curl http://localhost:3111/agentcache/health
105
+ ```
106
+
107
+ Generate a live context file for your IDE:
108
+
109
+ ```bash
110
+ cd /abs/path/to/project
111
+ agentcache context --watch # writes .agentcache_context.md and re-writes on change
112
+ ```
113
+
114
+ ---
115
+
116
+ ## Programmatic use
117
+
118
+ ```python
119
+ from agentcache import create_app, StateKV, remember
120
+
121
+ app = create_app() # Flask app, ready for WSGI or app.run()
122
+ kv = StateKV() # direct KV access to the SQLite store
123
+ remember(kv, {"title": "auth decorator", "content": "…", "agentId": "coder-1"})
124
+ ```
125
+
126
+ Top-level exports: `create_app`, `StateKV`, `KV`, `ObservationStore`, `ObservationEvents`, `SearchService`, `remember`, `folder_graph_build`, `health_check`, `run_connect`.
127
+
128
+ ---
129
+
130
+ ## Wire it into your agent
131
+
132
+ ```bash
133
+ agentcache connect claude-code # or: cursor, cline, kiro, antigravity, codex
134
+ agentcache connect --all # detect and wire every supported client
135
+ ```
136
+
137
+ This registers the MCP stdio bridge (`agentcache.mcp_stdio`) and, with `--with-hooks`, installs workspace hook blocks that call `/agentcache/observe` on file events.
138
+
139
+ ---
140
+
141
+ ## Auth
142
+
143
+ Set `AGENTCACHE_SECRET` to require a shared secret on write routes:
144
+
145
+ ```bash
146
+ export AGENTCACHE_SECRET=your-long-random-string
147
+ agentcache serve
148
+ ```
149
+
150
+ Clients send it via `Authorization: Bearer <secret>` or `?secret=<secret>`. Unset = open (fine for `localhost`; **do not** expose an unauthenticated instance).
151
+
152
+ ---
153
+
154
+ ## Deployment
155
+
156
+ `Dockerfile` and `docker-compose.yml` are included. For multi-worker WSGI (Gunicorn + workers), run the server without background threads and use a dedicated worker process:
157
+
158
+ ```bash
159
+ agentcache serve --no-workers # web tier
160
+ agentcache worker --tasks=index,forget # sidecar
161
+ ```
162
+
163
+ Details and the ongoing hardening plan live in [`docs/publishing_roadmap.md`](docs/publishing_roadmap.md).
164
+
165
+ ---
166
+
167
+ ## Compatibility notes
168
+
169
+ - Routes are dual-mounted at both `/agentcache/*` and `/agentmemory/*` for backward compatibility with the previous package name.
170
+ - `agentcache.legacy` is a thin re-export shim retained for callers that imported from the pre-split module layout. It will be removed in **1.0** — migrate imports to `agentcache.core.*` when convenient. See [`docs/adr/`](docs/adr/) for the split rationale.
171
+
172
+ ---
173
+
174
+ ## Development
175
+
176
+ ```bash
177
+ git clone https://github.com/Yashwant00CR7/agentcache
178
+ cd agentcache
179
+ pip install -e ".[dev,local-embeddings]"
180
+
181
+ pytest # test suite
182
+ ruff check . # lint
183
+ ruff format . # format
184
+ python -m build # build sdist + wheel into dist/
185
+ twine check dist/* # validate metadata before upload
186
+ ```
187
+
188
+ ---
189
+
190
+ ## Links
191
+
192
+ - **Source:** https://github.com/Yashwant00CR7/agentcache
193
+ - **Issues:** https://github.com/Yashwant00CR7/agentcache/issues
194
+ - **License:** MIT — see [LICENSE](LICENSE)
@@ -0,0 +1,155 @@
1
+ # agentcache
2
+
3
+ A Python REST + WebSocket + MCP cache server for AI agents, backed by SQLite.
4
+
5
+ `agentcache` gives coding agents (Claude Code, Cursor, Cline, Kiro, Antigravity, …) a persistent, searchable memory of what happened in a project — observations, sessions, long-term memories, and a folder-scoped knowledge graph — with hybrid BM25 + vector search, WebSocket live updates, and a Model Context Protocol (MCP) stdio bridge.
6
+
7
+ - **Server:** Flask + `flask-sock` (REST + WebSocket) on a single port
8
+ - **Storage:** SQLite in WAL mode (zero external services)
9
+ - **Search:** BM25 + optional local embeddings (`sentence-transformers`) or Hugging Face inference
10
+ - **MCP:** stdio bridge so any MCP-compatible client can `observe` / `remember` / `search` natively
11
+ - **CLI:** `agentcache serve|worker|migrate|export|context|connect`
12
+
13
+ Status: **Beta** (`Development Status :: 4 - Beta`). API is stable enough for daily use; internals may still shift before 1.0.
14
+
15
+ ---
16
+
17
+ ## Install
18
+
19
+ ```bash
20
+ pip install agentcache-core
21
+ ```
22
+
23
+ The package installs as `agentcache-core` on PyPI but imports and runs as `agentcache` (`import agentcache`, `agentcache serve`). The plain `agentcache` name on PyPI belongs to an unrelated project.
24
+
25
+ With optional local embeddings (adds `sentence-transformers`, ~1 GB of model weights on first use):
26
+
27
+ ```bash
28
+ pip install "agentcache-core[local-embeddings]"
29
+ ```
30
+
31
+ Requires Python 3.10+.
32
+
33
+ ---
34
+
35
+ ## Quickstart
36
+
37
+ Start the server:
38
+
39
+ ```bash
40
+ agentcache serve --port 3111
41
+ ```
42
+
43
+ Record an observation (any HTTP client works):
44
+
45
+ ```bash
46
+ curl -X POST http://localhost:3111/agentcache/observe \
47
+ -H "Content-Type: application/json" \
48
+ -d '{
49
+ "folderPath": "/abs/path/to/project",
50
+ "agentId": "coder-1",
51
+ "text": "Refactored auth into a decorator; see routes/auth.py",
52
+ "type": "refactor"
53
+ }'
54
+ ```
55
+
56
+ Search across a folder:
57
+
58
+ ```bash
59
+ curl "http://localhost:3111/agentcache/folder/observations?folderPath=/abs/path/to/project&q=auth"
60
+ ```
61
+
62
+ Health check:
63
+
64
+ ```bash
65
+ curl http://localhost:3111/agentcache/health
66
+ ```
67
+
68
+ Generate a live context file for your IDE:
69
+
70
+ ```bash
71
+ cd /abs/path/to/project
72
+ agentcache context --watch # writes .agentcache_context.md and re-writes on change
73
+ ```
74
+
75
+ ---
76
+
77
+ ## Programmatic use
78
+
79
+ ```python
80
+ from agentcache import create_app, StateKV, remember
81
+
82
+ app = create_app() # Flask app, ready for WSGI or app.run()
83
+ kv = StateKV() # direct KV access to the SQLite store
84
+ remember(kv, {"title": "auth decorator", "content": "…", "agentId": "coder-1"})
85
+ ```
86
+
87
+ Top-level exports: `create_app`, `StateKV`, `KV`, `ObservationStore`, `ObservationEvents`, `SearchService`, `remember`, `folder_graph_build`, `health_check`, `run_connect`.
88
+
89
+ ---
90
+
91
+ ## Wire it into your agent
92
+
93
+ ```bash
94
+ agentcache connect claude-code # or: cursor, cline, kiro, antigravity, codex
95
+ agentcache connect --all # detect and wire every supported client
96
+ ```
97
+
98
+ This registers the MCP stdio bridge (`agentcache.mcp_stdio`) and, with `--with-hooks`, installs workspace hook blocks that call `/agentcache/observe` on file events.
99
+
100
+ ---
101
+
102
+ ## Auth
103
+
104
+ Set `AGENTCACHE_SECRET` to require a shared secret on write routes:
105
+
106
+ ```bash
107
+ export AGENTCACHE_SECRET=your-long-random-string
108
+ agentcache serve
109
+ ```
110
+
111
+ Clients send it via `Authorization: Bearer <secret>` or `?secret=<secret>`. Unset = open (fine for `localhost`; **do not** expose an unauthenticated instance).
112
+
113
+ ---
114
+
115
+ ## Deployment
116
+
117
+ `Dockerfile` and `docker-compose.yml` are included. For multi-worker WSGI (Gunicorn + workers), run the server without background threads and use a dedicated worker process:
118
+
119
+ ```bash
120
+ agentcache serve --no-workers # web tier
121
+ agentcache worker --tasks=index,forget # sidecar
122
+ ```
123
+
124
+ Details and the ongoing hardening plan live in [`docs/publishing_roadmap.md`](docs/publishing_roadmap.md).
125
+
126
+ ---
127
+
128
+ ## Compatibility notes
129
+
130
+ - Routes are dual-mounted at both `/agentcache/*` and `/agentmemory/*` for backward compatibility with the previous package name.
131
+ - `agentcache.legacy` is a thin re-export shim retained for callers that imported from the pre-split module layout. It will be removed in **1.0** — migrate imports to `agentcache.core.*` when convenient. See [`docs/adr/`](docs/adr/) for the split rationale.
132
+
133
+ ---
134
+
135
+ ## Development
136
+
137
+ ```bash
138
+ git clone https://github.com/Yashwant00CR7/agentcache
139
+ cd agentcache
140
+ pip install -e ".[dev,local-embeddings]"
141
+
142
+ pytest # test suite
143
+ ruff check . # lint
144
+ ruff format . # format
145
+ python -m build # build sdist + wheel into dist/
146
+ twine check dist/* # validate metadata before upload
147
+ ```
148
+
149
+ ---
150
+
151
+ ## Links
152
+
153
+ - **Source:** https://github.com/Yashwant00CR7/agentcache
154
+ - **Issues:** https://github.com/Yashwant00CR7/agentcache/issues
155
+ - **License:** MIT — see [LICENSE](LICENSE)
@@ -0,0 +1,77 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "agentcache-core"
7
+ version = "0.9.9"
8
+ description = "A Python REST + WebSocket + MCP cache server for AI agents, backed by SQLite"
9
+ readme = { file = "README.md", content-type = "text/markdown" }
10
+ authors = [
11
+ { name = "Yashwant K", email = "yashwantk0303@gmail.com" }
12
+ ]
13
+ maintainers = [
14
+ { name = "Yashwant K", email = "yashwantk0303@gmail.com" }
15
+ ]
16
+ license = { text = "MIT" }
17
+ requires-python = ">=3.10"
18
+ classifiers = [
19
+ "Development Status :: 4 - Beta",
20
+ "Intended Audience :: Developers",
21
+ "License :: OSI Approved :: MIT License",
22
+ "Operating System :: OS Independent",
23
+ "Programming Language :: Python :: 3",
24
+ "Programming Language :: Python :: 3.10",
25
+ "Programming Language :: Python :: 3.11",
26
+ "Programming Language :: Python :: 3.12",
27
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
28
+ "Topic :: Software Development :: Libraries :: Python Modules",
29
+ ]
30
+ dependencies = [
31
+ "flask>=3.0.0",
32
+ "flask-sock>=0.7.0",
33
+ "requests>=2.31.0",
34
+ "python-dateutil>=2.8.2",
35
+ "huggingface_hub>=0.20.0",
36
+ "websockets>=12.0",
37
+ ]
38
+
39
+ [project.optional-dependencies]
40
+ dev = [
41
+ "pytest>=8.0.0",
42
+ "hypothesis>=6.100.0",
43
+ "ruff>=0.3.0",
44
+ "twine>=5.0.0",
45
+ ]
46
+ local-embeddings = [
47
+ "sentence-transformers>=2.7.0",
48
+ ]
49
+
50
+ [project.urls]
51
+ Homepage = "https://github.com/Yashwant00CR7/agentcache"
52
+ Repository = "https://github.com/Yashwant00CR7/agentcache.git"
53
+ "Bug Tracker" = "https://github.com/Yashwant00CR7/agentcache/issues"
54
+ Documentation = "https://github.com/Yashwant00CR7/agentcache#readme"
55
+
56
+ [project.scripts]
57
+ agentcache = "agentcache.cli:main"
58
+
59
+ [tool.setuptools.packages.find]
60
+ where = ["src"]
61
+ include = ["agentcache*"]
62
+
63
+ [tool.setuptools.package-data]
64
+ "agentcache" = ["py.typed"]
65
+ "agentcache.viewer" = ["*.html", "*.svg", "*.js", "*.css"]
66
+
67
+ [tool.pytest.ini_options]
68
+ testpaths = ["tests"]
69
+ python_files = ["test_*.py"]
70
+
71
+ [tool.ruff]
72
+ line-length = 88
73
+ target-version = "py310"
74
+
75
+ [tool.ruff.lint]
76
+ select = ["E", "F", "I", "W"]
77
+ ignore = ["E501"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,29 @@
1
+ """
2
+ agentcache — A Python REST + WebSocket + MCP cache server for AI agents, backed by SQLite.
3
+ """
4
+
5
+ __version__ = "0.9.9"
6
+
7
+ from .app import create_app
8
+ from .connect import run_connect
9
+ from .core import KV, ObservationEvents, ObservationStore, SearchService
10
+ from .db import StateKV
11
+ from .legacy import (
12
+ folder_graph_build,
13
+ health_check,
14
+ remember,
15
+ )
16
+
17
+ __all__ = [
18
+ "__version__",
19
+ "create_app",
20
+ "StateKV",
21
+ "run_connect",
22
+ "KV",
23
+ "ObservationStore",
24
+ "ObservationEvents",
25
+ "SearchService",
26
+ "folder_graph_build",
27
+ "remember",
28
+ "health_check",
29
+ ]