codemem-mcp 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- codemem_mcp-0.1.0/LICENSE +201 -0
- codemem_mcp-0.1.0/NOTICE +5 -0
- codemem_mcp-0.1.0/PKG-INFO +209 -0
- codemem_mcp-0.1.0/README.md +179 -0
- codemem_mcp-0.1.0/codemem/__init__.py +2 -0
- codemem_mcp-0.1.0/codemem/cli.py +126 -0
- codemem_mcp-0.1.0/codemem/config.py +62 -0
- codemem_mcp-0.1.0/codemem/db.py +199 -0
- codemem_mcp-0.1.0/codemem/describe.py +71 -0
- codemem_mcp-0.1.0/codemem/discover.py +180 -0
- codemem_mcp-0.1.0/codemem/discover_core.py +258 -0
- codemem_mcp-0.1.0/codemem/gitsync.py +191 -0
- codemem_mcp-0.1.0/codemem/knowledge.py +62 -0
- codemem_mcp-0.1.0/codemem/review.py +200 -0
- codemem_mcp-0.1.0/codemem/scan.py +188 -0
- codemem_mcp-0.1.0/codemem/search.py +189 -0
- codemem_mcp-0.1.0/codemem/server.py +845 -0
- codemem_mcp-0.1.0/codemem/store.py +265 -0
- codemem_mcp-0.1.0/codemem/trust.py +213 -0
- codemem_mcp-0.1.0/codemem/web/index.html +143 -0
- codemem_mcp-0.1.0/codemem/web/marked.min.js +69 -0
- codemem_mcp-0.1.0/codemem_mcp.egg-info/PKG-INFO +209 -0
- codemem_mcp-0.1.0/codemem_mcp.egg-info/SOURCES.txt +27 -0
- codemem_mcp-0.1.0/codemem_mcp.egg-info/dependency_links.txt +1 -0
- codemem_mcp-0.1.0/codemem_mcp.egg-info/entry_points.txt +3 -0
- codemem_mcp-0.1.0/codemem_mcp.egg-info/requires.txt +1 -0
- codemem_mcp-0.1.0/codemem_mcp.egg-info/top_level.txt +1 -0
- codemem_mcp-0.1.0/pyproject.toml +51 -0
- codemem_mcp-0.1.0/setup.cfg +4 -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
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for 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.
|
codemem_mcp-0.1.0/NOTICE
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: codemem-mcp
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: One MCP memory for every coding project on every machine: projects, reusable assets, sessions, commits, search
|
|
5
|
+
Author: Jeff Angelcyk
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/jeang42/codemem
|
|
8
|
+
Project-URL: Repository, https://github.com/jeang42/codemem
|
|
9
|
+
Project-URL: Issues, https://github.com/jeang42/codemem/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/jeang42/codemem/blob/main/CHANGELOG.md
|
|
11
|
+
Keywords: mcp,mcp-server,claude-code,model-context-protocol,ai-agents
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Environment :: Web Environment
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
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
|
|
22
|
+
Classifier: Topic :: Software Development :: Version Control :: Git
|
|
23
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
24
|
+
Requires-Python: >=3.11
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
License-File: LICENSE
|
|
27
|
+
License-File: NOTICE
|
|
28
|
+
Requires-Dist: mcp<2,>=1.10
|
|
29
|
+
Dynamic: license-file
|
|
30
|
+
|
|
31
|
+
# codemem
|
|
32
|
+
|
|
33
|
+
<!-- mcp-name: io.github.jeang42/codemem -->
|
|
34
|
+
|
|
35
|
+
**Your coding agents keep rebuilding what you already have. codemem remembers what they built,
|
|
36
|
+
across every project and every machine, and scores each piece on evidence of whether it worked.**
|
|
37
|
+
|
|
38
|
+
It is an MCP server for Claude Code and other MCP clients. It knows what projects exist, where
|
|
39
|
+
they live, what reusable pieces they contain, what each session did and decided, every commit
|
|
40
|
+
pushed to the git host, and how to do recurring things. Everything is searchable from any
|
|
41
|
+
machine, from an agent, or from the web UI. It is written to *during* work, not after.
|
|
42
|
+
|
|
43
|
+
One Python process, SQLite, no external services required.
|
|
44
|
+
|
|
45
|
+
## What makes it different
|
|
46
|
+
|
|
47
|
+
Inventory scripts snapshot a directory and you read the report once. Registries list what people
|
|
48
|
+
published. codemem does neither.
|
|
49
|
+
|
|
50
|
+
- **Trust from evidence, not from stars.** Every project and asset gets a computed score from
|
|
51
|
+
how recently it changed, how much work went into it, whether it is actually deployed and
|
|
52
|
+
running, whether anything else imports it, and whether a human vouched for it. `verify` records
|
|
53
|
+
"I ran it today and it works" and restarts the freshness clock. Scores are recomputed on
|
|
54
|
+
every sync, so they decay when you stop touching something.
|
|
55
|
+
- **It finds the copies you forgot.** Discovery mines every repo at HEAD for scripts, modules,
|
|
56
|
+
service units, Dockerfiles and MCP servers, hashes their functions, and links repos that share
|
|
57
|
+
code. It will tell you that you wrote the same retry wrapper in three places.
|
|
58
|
+
- **Agents feed it automatically.** A session hook records what each Claude Code session did,
|
|
59
|
+
and gives the next session a brief on the project it just opened. The catalogue builds itself.
|
|
60
|
+
- **Maturity is a first-class label.** `authoritative`, `usable`, `experimental`, `antiquated`,
|
|
61
|
+
`sunset`, `broken`, `junk`, each with a reason. Search ranks by it, and you can exclude the
|
|
62
|
+
ratings you should not build on.
|
|
63
|
+
- **Your code stays where it is.** codemem stores metadata: names, descriptions, imports,
|
|
64
|
+
symbols, function hashes, commit records. It does not copy your source anywhere.
|
|
65
|
+
|
|
66
|
+
## Endpoints
|
|
67
|
+
|
|
68
|
+
| Endpoint | What |
|
|
69
|
+
|---|---|
|
|
70
|
+
| `http://<host>:8055/mcp` | MCP (streamable HTTP) for Claude Code and other MCP clients |
|
|
71
|
+
| `http://<host>:8055/` | Web UI: search, projects, assets, notes, activity, docs. Dark mode. |
|
|
72
|
+
| `http://<host>:8055/api/…` | JSON API used by the UI (see docs/architecture.md) |
|
|
73
|
+
| `http://<host>:8055/health` | liveness |
|
|
74
|
+
|
|
75
|
+
Normally runs on the git host, the machine holding the bare repos, so it can read them directly.
|
|
76
|
+
|
|
77
|
+
> **Security: codemem has no authentication.** It is built for a trusted network, and anyone who
|
|
78
|
+
> can reach the port can read and write everything. Do not expose it to the internet without an
|
|
79
|
+
> authenticating proxy in front of it. See docs/architecture.md.
|
|
80
|
+
|
|
81
|
+
## Requirements
|
|
82
|
+
|
|
83
|
+
Python 3.11 or newer, and git. Optional: a git host with bare repos for the commit feed, Gitea
|
|
84
|
+
for descriptions and web links, and [Ollama](https://ollama.com) for semantic search, drafted
|
|
85
|
+
descriptions and the review pass. Everything works without the optional pieces; search falls
|
|
86
|
+
back to BM25 alone.
|
|
87
|
+
|
|
88
|
+
## Why
|
|
89
|
+
|
|
90
|
+
A developer with many project folders across several machines has no way for a new Claude Code
|
|
91
|
+
session to know that a retry wrapper, a Gradio helper, a GPU monitor or a data pipeline already
|
|
92
|
+
exists somewhere. So they get rebuilt. Snapshot inventory scripts (run, read, forget) do not fix
|
|
93
|
+
that. codemem is the live, writable layer: it is written to during work, not after.
|
|
94
|
+
|
|
95
|
+
The content is whatever is there. codemem does not filter or judge. Each project carries an
|
|
96
|
+
`audience`: `unrestricted` (the default), `professional`, or `employer`, so a search or a view can
|
|
97
|
+
exclude one when the context calls for it. Nothing is hidden unless asked, with one exception:
|
|
98
|
+
cloned third-party repos are marked `origin = vendor` and stay out of search and lists until you
|
|
99
|
+
ask for them. See docs/USER_GUIDE.md.
|
|
100
|
+
|
|
101
|
+
## Install from PyPI
|
|
102
|
+
|
|
103
|
+
The package is `codemem-mcp`; the command it installs is `codemem`.
|
|
104
|
+
|
|
105
|
+
pip install codemem-mcp # or: uv tool install codemem-mcp / pipx install codemem-mcp
|
|
106
|
+
codemem serve # MCP at http://localhost:8055/mcp, web UI at http://localhost:8055/
|
|
107
|
+
|
|
108
|
+
uvx codemem-mcp serve # or run it without installing
|
|
109
|
+
|
|
110
|
+
Data goes to `~/.codemem/` unless `CODEMEM_DB` or `CODEMEM_DATA` says otherwise. Register it with
|
|
111
|
+
Claude Code:
|
|
112
|
+
|
|
113
|
+
claude mcp add --transport http --scope user codemem http://localhost:8055/mcp
|
|
114
|
+
|
|
115
|
+
That is the server alone. For the systemd units, the commit feed and the session hooks, use the
|
|
116
|
+
quick start below from a clone of the repository.
|
|
117
|
+
|
|
118
|
+
## Quick start
|
|
119
|
+
|
|
120
|
+
Server (once, on the git host):
|
|
121
|
+
|
|
122
|
+
./install.sh # venv, user-scope systemd units, seed, backfill, gitea, scan, embed
|
|
123
|
+
|
|
124
|
+
Client (each machine, once):
|
|
125
|
+
|
|
126
|
+
CODEMEM_URL=http://<host>:8055 client/install-client.sh # Linux/macOS: MCP server + SessionStart/SessionEnd hooks
|
|
127
|
+
client\install-client.ps1 # Windows PowerShell (set $env:CODEMEM_URL first)
|
|
128
|
+
|
|
129
|
+
Then in any Claude Code session the `codemem` tools are available and every session starts with a
|
|
130
|
+
brief of the current project (if codemem knows it) and ends with an automatic session record.
|
|
131
|
+
|
|
132
|
+
## What Claude sees
|
|
133
|
+
|
|
134
|
+
| Tool | Use |
|
|
135
|
+
|---|---|
|
|
136
|
+
| `search` | hybrid BM25 + embedding search over everything. First call before building anything |
|
|
137
|
+
| `project_brief` | everything about one project, by name or working directory |
|
|
138
|
+
| `list_projects` | filter by status, tag, machine, audience, visibility |
|
|
139
|
+
| `update_project` | description, purpose, status, tags, audience, origin (own/vendor), visibility, maturity |
|
|
140
|
+
| `register_asset` | record a reusable script/module/prompt/skill/service with a one-line usage |
|
|
141
|
+
| `find_assets` | search or list assets by kind/tag/project, or by imported library |
|
|
142
|
+
| `log_session` | what was done, decided, used, abandoned, and what is next |
|
|
143
|
+
| `add_note` | decision, howto, resource, issue, idea |
|
|
144
|
+
| `delete_note` | remove a note written by mistake, with its index and embedding rows |
|
|
145
|
+
| `link_items` | project uses / could-reuse / supersedes / derived-from another |
|
|
146
|
+
| `rate` | maturity: authoritative, usable, experimental, antiquated, sunset, broken, junk, with a why |
|
|
147
|
+
| `verify` | "I ran it today and it works": restarts the computed trust score's freshness clock |
|
|
148
|
+
| `handoff` / `list_handoffs` | track one implementation replacing another through candidate, shadow, verified, promoted |
|
|
149
|
+
| `howto` | how to publish, add a machine, use codemem, plus whatever docs are ingested |
|
|
150
|
+
| `activity` | commits and sessions across all machines, last N days |
|
|
151
|
+
| `add_scan_root` / `scan_path` | register a directory to scan; scan now (server machine) |
|
|
152
|
+
| `stats` | counts, machines, index coverage |
|
|
153
|
+
| `help` | workflow, tool list, label vocabularies. Also `/codemem` in Claude Code, `/codemem <query>` searches |
|
|
154
|
+
|
|
155
|
+
## Where the data comes from
|
|
156
|
+
|
|
157
|
+
- **Git host**: every bare repo in `GIT_ROOT` is backfilled; a post-receive hook posts each push to
|
|
158
|
+
`/ingest/push` so new commits appear within seconds. See docs/git-commit-feed.md.
|
|
159
|
+
- **Gitea** (optional): descriptions, topics and web URLs, via its API with a read token.
|
|
160
|
+
- **Local scan**: project directories under registered roots, per machine. On the server this
|
|
161
|
+
is automatic; other machines run `client/codemem_agent.py` once a root is registered.
|
|
162
|
+
- **Discovery**: every own repo is mined at HEAD for scripts, modules, units, Dockerfiles,
|
|
163
|
+
prompts and MCP servers, recorded as `auto-discovered` assets, with shared-code links between repos.
|
|
164
|
+
- **Docs**: markdown from `CODEMEM_DOC_SOURCES` (this repo by default), re-hashed every sync.
|
|
165
|
+
- **Claude Code**: session records from the hook, plus whatever Claude writes with the tools.
|
|
166
|
+
- **Local model** (optional, via Ollama): embeddings for semantic search, drafted descriptions,
|
|
167
|
+
and a targeted review of near-duplicate functions and thinly described code.
|
|
168
|
+
|
|
169
|
+
## Layout
|
|
170
|
+
|
|
171
|
+
codemem/ the server package
|
|
172
|
+
config.py every tunable, env-overridable
|
|
173
|
+
db.py schema, connection, single FTS5 index
|
|
174
|
+
store.py all writes (keeps the index in step)
|
|
175
|
+
search.py BM25 + Ollama embeddings, reciprocal rank fusion
|
|
176
|
+
gitsync.py bare-repo backfill, push ingest, push.log, Gitea
|
|
177
|
+
scan.py project discovery + location records
|
|
178
|
+
discover*.py asset discovery, shared-code linking (core is shared with the remote agent)
|
|
179
|
+
trust.py computed trust scores
|
|
180
|
+
review.py targeted model review
|
|
181
|
+
describe.py model-drafted project descriptions
|
|
182
|
+
knowledge.py doc ingest, howto/asset seed
|
|
183
|
+
server.py MCP tools, HTTP routes, JSON API
|
|
184
|
+
cli.py serve | backfill | gitea | docs | seed | scan | embed | reindex | backup | sync | discover | review | trust | describe | purge
|
|
185
|
+
web/ the single-file web UI (+ vendored marked.js)
|
|
186
|
+
client/ hook, remote scan agent, slash command, per-OS installers
|
|
187
|
+
systemd/ user-scope units: service, sync timer (6h), backup timer (02:45)
|
|
188
|
+
docs/ user guide, architecture, git-commit-feed, clients, operations, python-vs-typescript
|
|
189
|
+
|
|
190
|
+
Storage: `$CODEMEM_DB` (default `~/.codemem/codemem.db`, SQLite, WAL). Backups: `$CODEMEM_BACKUP_DIR`
|
|
191
|
+
(default `~/.codemem/backups/`).
|
|
192
|
+
|
|
193
|
+
## Status and contributing
|
|
194
|
+
|
|
195
|
+
Extracted from a system that has been running daily against 165 projects, 735 assets and 2,000+
|
|
196
|
+
commits across three machines. It is stable for that use, but it has had one operator, so expect
|
|
197
|
+
rough edges the moment your layout differs from that one. Issues and pull requests welcome;
|
|
198
|
+
please open an issue before a large change so we can agree on the shape. See
|
|
199
|
+
[CONTRIBUTING.md](CONTRIBUTING.md) for how to run it locally and the two rules that are not
|
|
200
|
+
negotiable, and [SECURITY.md](SECURITY.md) for what it stores and how to report a vulnerability.
|
|
201
|
+
|
|
202
|
+
Run `scripts/smoke.sh` before pushing: it boots the server against a throwaway database and
|
|
203
|
+
checks that health, the web UI, the JSON API and the schema all come up.
|
|
204
|
+
|
|
205
|
+
## License
|
|
206
|
+
|
|
207
|
+
Apache License 2.0. See LICENSE.
|
|
208
|
+
|
|
209
|
+
Copyright © 2026 Jeff Angelcyk.
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
# codemem
|
|
2
|
+
|
|
3
|
+
<!-- mcp-name: io.github.jeang42/codemem -->
|
|
4
|
+
|
|
5
|
+
**Your coding agents keep rebuilding what you already have. codemem remembers what they built,
|
|
6
|
+
across every project and every machine, and scores each piece on evidence of whether it worked.**
|
|
7
|
+
|
|
8
|
+
It is an MCP server for Claude Code and other MCP clients. It knows what projects exist, where
|
|
9
|
+
they live, what reusable pieces they contain, what each session did and decided, every commit
|
|
10
|
+
pushed to the git host, and how to do recurring things. Everything is searchable from any
|
|
11
|
+
machine, from an agent, or from the web UI. It is written to *during* work, not after.
|
|
12
|
+
|
|
13
|
+
One Python process, SQLite, no external services required.
|
|
14
|
+
|
|
15
|
+
## What makes it different
|
|
16
|
+
|
|
17
|
+
Inventory scripts snapshot a directory and you read the report once. Registries list what people
|
|
18
|
+
published. codemem does neither.
|
|
19
|
+
|
|
20
|
+
- **Trust from evidence, not from stars.** Every project and asset gets a computed score from
|
|
21
|
+
how recently it changed, how much work went into it, whether it is actually deployed and
|
|
22
|
+
running, whether anything else imports it, and whether a human vouched for it. `verify` records
|
|
23
|
+
"I ran it today and it works" and restarts the freshness clock. Scores are recomputed on
|
|
24
|
+
every sync, so they decay when you stop touching something.
|
|
25
|
+
- **It finds the copies you forgot.** Discovery mines every repo at HEAD for scripts, modules,
|
|
26
|
+
service units, Dockerfiles and MCP servers, hashes their functions, and links repos that share
|
|
27
|
+
code. It will tell you that you wrote the same retry wrapper in three places.
|
|
28
|
+
- **Agents feed it automatically.** A session hook records what each Claude Code session did,
|
|
29
|
+
and gives the next session a brief on the project it just opened. The catalogue builds itself.
|
|
30
|
+
- **Maturity is a first-class label.** `authoritative`, `usable`, `experimental`, `antiquated`,
|
|
31
|
+
`sunset`, `broken`, `junk`, each with a reason. Search ranks by it, and you can exclude the
|
|
32
|
+
ratings you should not build on.
|
|
33
|
+
- **Your code stays where it is.** codemem stores metadata: names, descriptions, imports,
|
|
34
|
+
symbols, function hashes, commit records. It does not copy your source anywhere.
|
|
35
|
+
|
|
36
|
+
## Endpoints
|
|
37
|
+
|
|
38
|
+
| Endpoint | What |
|
|
39
|
+
|---|---|
|
|
40
|
+
| `http://<host>:8055/mcp` | MCP (streamable HTTP) for Claude Code and other MCP clients |
|
|
41
|
+
| `http://<host>:8055/` | Web UI: search, projects, assets, notes, activity, docs. Dark mode. |
|
|
42
|
+
| `http://<host>:8055/api/…` | JSON API used by the UI (see docs/architecture.md) |
|
|
43
|
+
| `http://<host>:8055/health` | liveness |
|
|
44
|
+
|
|
45
|
+
Normally runs on the git host, the machine holding the bare repos, so it can read them directly.
|
|
46
|
+
|
|
47
|
+
> **Security: codemem has no authentication.** It is built for a trusted network, and anyone who
|
|
48
|
+
> can reach the port can read and write everything. Do not expose it to the internet without an
|
|
49
|
+
> authenticating proxy in front of it. See docs/architecture.md.
|
|
50
|
+
|
|
51
|
+
## Requirements
|
|
52
|
+
|
|
53
|
+
Python 3.11 or newer, and git. Optional: a git host with bare repos for the commit feed, Gitea
|
|
54
|
+
for descriptions and web links, and [Ollama](https://ollama.com) for semantic search, drafted
|
|
55
|
+
descriptions and the review pass. Everything works without the optional pieces; search falls
|
|
56
|
+
back to BM25 alone.
|
|
57
|
+
|
|
58
|
+
## Why
|
|
59
|
+
|
|
60
|
+
A developer with many project folders across several machines has no way for a new Claude Code
|
|
61
|
+
session to know that a retry wrapper, a Gradio helper, a GPU monitor or a data pipeline already
|
|
62
|
+
exists somewhere. So they get rebuilt. Snapshot inventory scripts (run, read, forget) do not fix
|
|
63
|
+
that. codemem is the live, writable layer: it is written to during work, not after.
|
|
64
|
+
|
|
65
|
+
The content is whatever is there. codemem does not filter or judge. Each project carries an
|
|
66
|
+
`audience`: `unrestricted` (the default), `professional`, or `employer`, so a search or a view can
|
|
67
|
+
exclude one when the context calls for it. Nothing is hidden unless asked, with one exception:
|
|
68
|
+
cloned third-party repos are marked `origin = vendor` and stay out of search and lists until you
|
|
69
|
+
ask for them. See docs/USER_GUIDE.md.
|
|
70
|
+
|
|
71
|
+
## Install from PyPI
|
|
72
|
+
|
|
73
|
+
The package is `codemem-mcp`; the command it installs is `codemem`.
|
|
74
|
+
|
|
75
|
+
pip install codemem-mcp # or: uv tool install codemem-mcp / pipx install codemem-mcp
|
|
76
|
+
codemem serve # MCP at http://localhost:8055/mcp, web UI at http://localhost:8055/
|
|
77
|
+
|
|
78
|
+
uvx codemem-mcp serve # or run it without installing
|
|
79
|
+
|
|
80
|
+
Data goes to `~/.codemem/` unless `CODEMEM_DB` or `CODEMEM_DATA` says otherwise. Register it with
|
|
81
|
+
Claude Code:
|
|
82
|
+
|
|
83
|
+
claude mcp add --transport http --scope user codemem http://localhost:8055/mcp
|
|
84
|
+
|
|
85
|
+
That is the server alone. For the systemd units, the commit feed and the session hooks, use the
|
|
86
|
+
quick start below from a clone of the repository.
|
|
87
|
+
|
|
88
|
+
## Quick start
|
|
89
|
+
|
|
90
|
+
Server (once, on the git host):
|
|
91
|
+
|
|
92
|
+
./install.sh # venv, user-scope systemd units, seed, backfill, gitea, scan, embed
|
|
93
|
+
|
|
94
|
+
Client (each machine, once):
|
|
95
|
+
|
|
96
|
+
CODEMEM_URL=http://<host>:8055 client/install-client.sh # Linux/macOS: MCP server + SessionStart/SessionEnd hooks
|
|
97
|
+
client\install-client.ps1 # Windows PowerShell (set $env:CODEMEM_URL first)
|
|
98
|
+
|
|
99
|
+
Then in any Claude Code session the `codemem` tools are available and every session starts with a
|
|
100
|
+
brief of the current project (if codemem knows it) and ends with an automatic session record.
|
|
101
|
+
|
|
102
|
+
## What Claude sees
|
|
103
|
+
|
|
104
|
+
| Tool | Use |
|
|
105
|
+
|---|---|
|
|
106
|
+
| `search` | hybrid BM25 + embedding search over everything. First call before building anything |
|
|
107
|
+
| `project_brief` | everything about one project, by name or working directory |
|
|
108
|
+
| `list_projects` | filter by status, tag, machine, audience, visibility |
|
|
109
|
+
| `update_project` | description, purpose, status, tags, audience, origin (own/vendor), visibility, maturity |
|
|
110
|
+
| `register_asset` | record a reusable script/module/prompt/skill/service with a one-line usage |
|
|
111
|
+
| `find_assets` | search or list assets by kind/tag/project, or by imported library |
|
|
112
|
+
| `log_session` | what was done, decided, used, abandoned, and what is next |
|
|
113
|
+
| `add_note` | decision, howto, resource, issue, idea |
|
|
114
|
+
| `delete_note` | remove a note written by mistake, with its index and embedding rows |
|
|
115
|
+
| `link_items` | project uses / could-reuse / supersedes / derived-from another |
|
|
116
|
+
| `rate` | maturity: authoritative, usable, experimental, antiquated, sunset, broken, junk, with a why |
|
|
117
|
+
| `verify` | "I ran it today and it works": restarts the computed trust score's freshness clock |
|
|
118
|
+
| `handoff` / `list_handoffs` | track one implementation replacing another through candidate, shadow, verified, promoted |
|
|
119
|
+
| `howto` | how to publish, add a machine, use codemem, plus whatever docs are ingested |
|
|
120
|
+
| `activity` | commits and sessions across all machines, last N days |
|
|
121
|
+
| `add_scan_root` / `scan_path` | register a directory to scan; scan now (server machine) |
|
|
122
|
+
| `stats` | counts, machines, index coverage |
|
|
123
|
+
| `help` | workflow, tool list, label vocabularies. Also `/codemem` in Claude Code, `/codemem <query>` searches |
|
|
124
|
+
|
|
125
|
+
## Where the data comes from
|
|
126
|
+
|
|
127
|
+
- **Git host**: every bare repo in `GIT_ROOT` is backfilled; a post-receive hook posts each push to
|
|
128
|
+
`/ingest/push` so new commits appear within seconds. See docs/git-commit-feed.md.
|
|
129
|
+
- **Gitea** (optional): descriptions, topics and web URLs, via its API with a read token.
|
|
130
|
+
- **Local scan**: project directories under registered roots, per machine. On the server this
|
|
131
|
+
is automatic; other machines run `client/codemem_agent.py` once a root is registered.
|
|
132
|
+
- **Discovery**: every own repo is mined at HEAD for scripts, modules, units, Dockerfiles,
|
|
133
|
+
prompts and MCP servers, recorded as `auto-discovered` assets, with shared-code links between repos.
|
|
134
|
+
- **Docs**: markdown from `CODEMEM_DOC_SOURCES` (this repo by default), re-hashed every sync.
|
|
135
|
+
- **Claude Code**: session records from the hook, plus whatever Claude writes with the tools.
|
|
136
|
+
- **Local model** (optional, via Ollama): embeddings for semantic search, drafted descriptions,
|
|
137
|
+
and a targeted review of near-duplicate functions and thinly described code.
|
|
138
|
+
|
|
139
|
+
## Layout
|
|
140
|
+
|
|
141
|
+
codemem/ the server package
|
|
142
|
+
config.py every tunable, env-overridable
|
|
143
|
+
db.py schema, connection, single FTS5 index
|
|
144
|
+
store.py all writes (keeps the index in step)
|
|
145
|
+
search.py BM25 + Ollama embeddings, reciprocal rank fusion
|
|
146
|
+
gitsync.py bare-repo backfill, push ingest, push.log, Gitea
|
|
147
|
+
scan.py project discovery + location records
|
|
148
|
+
discover*.py asset discovery, shared-code linking (core is shared with the remote agent)
|
|
149
|
+
trust.py computed trust scores
|
|
150
|
+
review.py targeted model review
|
|
151
|
+
describe.py model-drafted project descriptions
|
|
152
|
+
knowledge.py doc ingest, howto/asset seed
|
|
153
|
+
server.py MCP tools, HTTP routes, JSON API
|
|
154
|
+
cli.py serve | backfill | gitea | docs | seed | scan | embed | reindex | backup | sync | discover | review | trust | describe | purge
|
|
155
|
+
web/ the single-file web UI (+ vendored marked.js)
|
|
156
|
+
client/ hook, remote scan agent, slash command, per-OS installers
|
|
157
|
+
systemd/ user-scope units: service, sync timer (6h), backup timer (02:45)
|
|
158
|
+
docs/ user guide, architecture, git-commit-feed, clients, operations, python-vs-typescript
|
|
159
|
+
|
|
160
|
+
Storage: `$CODEMEM_DB` (default `~/.codemem/codemem.db`, SQLite, WAL). Backups: `$CODEMEM_BACKUP_DIR`
|
|
161
|
+
(default `~/.codemem/backups/`).
|
|
162
|
+
|
|
163
|
+
## Status and contributing
|
|
164
|
+
|
|
165
|
+
Extracted from a system that has been running daily against 165 projects, 735 assets and 2,000+
|
|
166
|
+
commits across three machines. It is stable for that use, but it has had one operator, so expect
|
|
167
|
+
rough edges the moment your layout differs from that one. Issues and pull requests welcome;
|
|
168
|
+
please open an issue before a large change so we can agree on the shape. See
|
|
169
|
+
[CONTRIBUTING.md](CONTRIBUTING.md) for how to run it locally and the two rules that are not
|
|
170
|
+
negotiable, and [SECURITY.md](SECURITY.md) for what it stores and how to report a vulnerability.
|
|
171
|
+
|
|
172
|
+
Run `scripts/smoke.sh` before pushing: it boots the server against a throwaway database and
|
|
173
|
+
checks that health, the web UI, the JSON API and the schema all come up.
|
|
174
|
+
|
|
175
|
+
## License
|
|
176
|
+
|
|
177
|
+
Apache License 2.0. See LICENSE.
|
|
178
|
+
|
|
179
|
+
Copyright © 2026 Jeff Angelcyk.
|