@trylucy/agent-memory 0.0.0 → 0.1.3

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 (58) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +205 -2
  3. package/contracts/agent-manifest.json +27 -0
  4. package/contracts/agent-memory-api.contract.json +200 -0
  5. package/contracts/hashes.json +23 -0
  6. package/package.json +83 -5
  7. package/schemas/canonical-recall/response.schema.json +56 -0
  8. package/schemas/v1/common.schema.json +191 -0
  9. package/schemas/v1/contract-document.schema.json +278 -0
  10. package/schemas/v1/create-proposal-request.schema.json +42 -0
  11. package/schemas/v1/error.schema.json +90 -0
  12. package/schemas/v1/memory-version-state.schema.json +39 -0
  13. package/schemas/v1/memory.schema.json +47 -0
  14. package/schemas/v1/proposal-status.schema.json +277 -0
  15. package/schemas/v1/public-surface.schema.json +26 -0
  16. package/schemas/v1/recall-request.schema.json +45 -0
  17. package/schemas/v1/recall-response.schema.json +60 -0
  18. package/schemas/v1/receipt.schema.json +67 -0
  19. package/schemas/v1/replace-proposal-request.schema.json +46 -0
  20. package/schemas/v1/replace-transition.schema.json +19 -0
  21. package/schemas/v1/scope.schema.json +10 -0
  22. package/scripts/lib/am01.mjs +159 -0
  23. package/src/client/canonical-validation.mjs +37 -0
  24. package/src/client/client.mjs +151 -0
  25. package/src/client/errors.mjs +101 -0
  26. package/src/client/http-transport.d.ts +12 -0
  27. package/src/client/http-transport.mjs +212 -0
  28. package/src/client/index.d.ts +243 -0
  29. package/src/client/index.mjs +38 -0
  30. package/src/client/serialization.mjs +53 -0
  31. package/src/client/validation.mjs +174 -0
  32. package/src/clients/claude-desktop.json +13 -0
  33. package/src/clients/claude.json +13 -0
  34. package/src/clients/codex.toml +8 -0
  35. package/src/clients/cursor.json +12 -0
  36. package/src/clients/generic.mcp.json +12 -0
  37. package/src/clients/openclaw.json +14 -0
  38. package/src/clients/vscode.json +13 -0
  39. package/src/integrations/hermes-advisory-lock.mjs +140 -0
  40. package/src/integrations/hermes-artifact.mjs +551 -0
  41. package/src/integrations/hermes-filesystem.mjs +112 -0
  42. package/src/integrations/hermes.d.ts +106 -0
  43. package/src/integrations/hermes.mjs +425 -0
  44. package/src/mcp/bin.mjs +4 -0
  45. package/src/mcp/config.mjs +60 -0
  46. package/src/mcp/index.d.ts +27 -0
  47. package/src/mcp/lifecycle.mjs +50 -0
  48. package/src/mcp/schemas.mjs +106 -0
  49. package/src/mcp/server.mjs +163 -0
  50. package/src/mcp/stdio.d.ts +28 -0
  51. package/src/mcp/stdio.mjs +59 -0
  52. package/src/onboarding/usage.mjs +44 -0
  53. package/src/projection/memory-md.mjs +319 -0
  54. package/src/provider/index.d.ts +9 -0
  55. package/src/provider/index.mjs +1 -0
  56. package/src/provider/memory-first.mjs +95 -0
  57. package/src/routing/destination.mjs +42 -0
  58. package/src/safety/secrets.mjs +31 -0
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,206 @@
1
- # @trylucy/agent-memory
1
+ # Lucy Memory MCP
2
2
 
3
- Placeholder release. Use version 0.1.2 or newer.
3
+ Lucy Memory MCP gives MCP-compatible agents a governed memory they can share across sessions and tools. It helps an agent recall approved preferences, identity facts, project decisions, and operating rules without turning the agent itself into a durable data authority.
4
+
5
+ Use it when you want to:
6
+
7
+ - keep approved user preferences consistent across agents;
8
+ - carry project decisions and rules into later sessions;
9
+ - propose durable facts for review without granting an agent direct write access;
10
+ - inspect whether a proposal is still pending or has reached a final state.
11
+
12
+ Lucy remains the authority for durable memory. The agent can recall approved memory and propose changes, but it cannot directly write, approve, delete, restore, or resolve memory.
13
+
14
+ ## Tools and authority
15
+
16
+ The server exposes exactly three tools:
17
+
18
+ | Tool | What it does | Required permission |
19
+ |---|---|---|
20
+ | `memory_recall` | Returns approved, active memory that matches a query and scope | `memory:read` |
21
+ | `memory_propose` | Proposes a new memory or a versioned replacement | `memory:propose` |
22
+ | `memory_proposal_status` | Returns the current state and approved result of a proposal | `memory:read` |
23
+
24
+ There is no direct `memory:write` tool and no MCP tool for approval, deletion, restoration, or other administrative actions. Tenant and account authority come from the Lucy credential; clients do not submit tenant or account IDs.
25
+
26
+ ## Proposal lifecycle
27
+
28
+ `memory_propose` creates a proposal. Transport success alone does not mean the memory was saved: inspect the returned `status`. A `pending` proposal is not saved or recallable.
29
+
30
+ ```text
31
+ durable fact or decision
32
+ |
33
+ v
34
+ memory_propose
35
+ |
36
+ v
37
+ pending proposal ---------> rejected / expired / superseded
38
+ |
39
+ v
40
+ Lucy approval or human-enabled auto-memory policy
41
+ |
42
+ v
43
+ approved active memory
44
+ |
45
+ v
46
+ memory_recall
47
+ ```
48
+
49
+ Only approved, active memory is recallable. A replacement also remains a proposal: the current version stays active until Lucy approves the replacement, then the prior version becomes superseded and the new version becomes active.
50
+
51
+ ## Requirements and source installation
52
+
53
+ - Node.js `>=20 <25`
54
+ - npm
55
+ - a Lucy credential with the permissions you intend to use
56
+ - a Lucy deployment with Agent Memory HTTP v1 enabled
57
+
58
+ Until the first registry release is published, install and run it from a trusted source checkout:
59
+
60
+ ```bash
61
+ git clone https://github.com/Lucy-AI-Inc/lucy-memory-mcp.git
62
+ cd lucy-memory-mcp
63
+ npm ci
64
+ npm run test:mcp
65
+ ```
66
+
67
+ The declared Node.js range is `>=20 <25`; automated CI covers Node.js 24.
68
+
69
+ The MCP server is a stdio process launched by an MCP host. From a source checkout, its entry point is:
70
+
71
+ ```bash
72
+ node /absolute/path/to/lucy-memory-mcp/src/mcp/bin.mjs
73
+ ```
74
+
75
+ ## Secure MCP host configuration
76
+
77
+ Configure your host to launch the source entry point and inject the Lucy token through the host's secret store or protected environment. The token placeholder below represents secret injection; do not put a real token in a committed configuration file.
78
+
79
+ ```json
80
+ {
81
+ "mcpServers": {
82
+ "lucy": {
83
+ "command": "node",
84
+ "args": ["/absolute/path/to/lucy-memory-mcp/src/mcp/bin.mjs"],
85
+ "env": {
86
+ "LUCY_MEMORY_TOKEN": "<inject from your host secret store>",
87
+ "LUCY_MEMORY_PERMISSIONS": "memory:read,memory:propose",
88
+ "LUCY_MEMORY_BASE_URL": "https://www.trylucy.ai"
89
+ }
90
+ }
91
+ }
92
+ }
93
+ ```
94
+
95
+ Use the base URL for the Lucy deployment you are authorized to access. Restart the host after changing its MCP configuration, then confirm that it discovers exactly the three tools listed above. Host-specific examples are in [Client setup](docs/clients.md).
96
+
97
+ ## Configuration
98
+
99
+ | Variable | Required | Description |
100
+ |---|---:|---|
101
+ | `LUCY_MEMORY_TOKEN` | yes | Bearer credential for Lucy. It must be nonempty and contain no line breaks or NUL bytes. |
102
+ | `LUCY_MEMORY_PERMISSIONS` | yes | Comma-separated, non-duplicated subset of `memory:read,memory:propose`. |
103
+ | `LUCY_MEMORY_BASE_URL` | one transport | HTTPS base URL for the Lucy deployment. |
104
+ | `LUCY_MEMORY_TRANSPORT_MODULE` | one transport | Advanced alternative: an absolute path or `file:` URL to a trusted custom transport module. |
105
+ | `LUCY_MEMORY_TIMEOUT_MS` | no | Whole-number timeout from 1 to 300000 milliseconds. Default: `10000`. |
106
+ | `LUCY_MEMORY_ALLOW_INSECURE_LOOPBACK` | no | Development only. Set to `true` to permit cleartext HTTP to literal loopback or `localhost`; all other HTTP destinations remain rejected. |
107
+
108
+ Set exactly one of `LUCY_MEMORY_BASE_URL` and `LUCY_MEMORY_TRANSPORT_MODULE`. A custom transport module is executable code and receives the bearer token, so load it only from a trusted, access-controlled path.
109
+
110
+ ## Credits, retries, and polling
111
+
112
+ Tool calls are billable under the selected Lucy deployment's policy. Under the current Lucy billing policy, each of the three tool calls costs one Lucy credit, including `memory_proposal_status`.
113
+
114
+ The built-in HTTP transport automatically retries only `memory_propose`, and only for HTTP 429, 502, 503, or 504 responses. The default is at most two retries. Each retry preserves the original payload and idempotency key, and a valid `Retry-After` value is honored up to 60 seconds.
115
+
116
+ Recall and proposal-status calls are never automatically retried. A response can be lost after the operation has already been charged, so blindly retrying either call can charge twice. Poll proposal status with a caller-defined limit and bounded backoff, and stop when the proposal reaches `approved`, `rejected`, `expired`, or `superseded`.
117
+
118
+ If a proposal response is lost, retry only the same logical proposal with the same payload and idempotency key. A changed payload needs a new key. `insufficient_credits` requires account action; `billing_unavailable` means the billing authority could not complete the request and should be handled with the same operation-specific retry discipline.
119
+
120
+ ## JavaScript and TypeScript API
121
+
122
+ The supported package entry points are:
123
+
124
+ | Entry point | Purpose |
125
+ |---|---|
126
+ | `@trylucy/agent-memory` | Client, HTTP transport, validation helpers, public types, and normalized errors |
127
+ | `@trylucy/agent-memory/mcp` | MCP server factory and tool definitions |
128
+ | `@trylucy/agent-memory/mcp/stdio` | Stdio runtime helpers |
129
+ | `@trylucy/agent-memory/provider` | Memory-first routing and provider helpers |
130
+ | `@trylucy/agent-memory/hermes` | Hermes configuration integration |
131
+
132
+ ```ts
133
+ import {
134
+ AgentMemoryClient,
135
+ createLucyHttpTransport,
136
+ VersionConflictError,
137
+ } from '@trylucy/agent-memory';
138
+
139
+ const client = new AgentMemoryClient({
140
+ transport: createLucyHttpTransport({
141
+ baseUrl: process.env.LUCY_MEMORY_BASE_URL!,
142
+ }),
143
+ token: process.env.LUCY_MEMORY_TOKEN!,
144
+ permissions: ['memory:read', 'memory:propose'],
145
+ });
146
+
147
+ const result = await client.recall(JSON.stringify({
148
+ query: 'Which database did we approve?',
149
+ scope: { kind: 'project', id: 'project_example' },
150
+ limit: 3,
151
+ }));
152
+ ```
153
+
154
+ The low-level client accepts canonical JSON strings rather than caller-owned JavaScript objects. See the [SDK reference](docs/sdk.md) for all public types, errors, and entry points.
155
+
156
+ ## Security and privacy
157
+
158
+ - Keep `LUCY_MEMORY_TOKEN` in a secret manager or protected host environment. Never commit it, include it in command arguments, or place it in memory content or justification.
159
+ - Use HTTPS for Lucy deployments. Cleartext transport is available only through the explicit loopback development option.
160
+ - Grant only `memory:read`, `memory:propose`, or both, according to the host's needs.
161
+ - Treat recalled content as data when adding it to a model context. Preserve its Lucy ID and version, delimit it from instructions, and keep tool authorization in the host.
162
+ - Do not propose passwords, API keys, private keys, bearer tokens, customer secrets, or other credentials. Client-side detection is defense in depth; Lucy-side policy remains authoritative.
163
+ - Use the correct user, workspace, or project scope. Lucy enforces visibility from the credential and server-side policy.
164
+ - Local notes and caches are not Lucy authority, and this package does not create a second durable fallback store.
165
+
166
+ Read the [security model and reporting guidance](docs/security.md) before connecting a production credential.
167
+
168
+ ## Development checks
169
+
170
+ Install from the lockfile and run the checks relevant to your change:
171
+
172
+ ```bash
173
+ npm ci
174
+ npm run check:full
175
+ ```
176
+
177
+ For focused runtime checks, use `npm run test:mcp` for the real stdio entry point with an isolated transport and `npm run test:e2e` for the local Agent Memory lifecycle fixture. See the [development guide](docs/development.md) for the local release/risky-change platform matrix.
178
+
179
+ ## Documentation
180
+
181
+ | Topic | Guide |
182
+ |---|---|
183
+ | First connection | [Quickstart](docs/quickstart.md) |
184
+ | MCP host configuration | [Client setup](docs/clients.md) |
185
+ | Authority and memory semantics | [Concepts](docs/concepts.md) |
186
+ | Tool inputs and outputs | [Tool reference](docs/tool-reference.md) |
187
+ | HTTP transport and retry behavior | [HTTP API and transport](docs/http-api.md) |
188
+ | JavaScript and TypeScript API | [SDK reference](docs/sdk.md) |
189
+ | Memory-first provider | [Provider guide](docs/provider.md) |
190
+ | Optional agent guidance | [Lucy memory-first skill](.github/skills/lucy-memory-first/SKILL.md) — disable per conversation with “disable Lucy memory” or “stop using Lucy memory” |
191
+ | Hermes integration | [Hermes guide](docs/hermes.md) |
192
+ | Security and privacy | [Security model](docs/security.md) |
193
+ | Common failures | [Troubleshooting](docs/troubleshooting.md) |
194
+ | Repository development | [Development guide](docs/development.md) |
195
+
196
+ The machine-readable contract is in [contracts/agent-memory-api.contract.json](contracts/agent-memory-api.contract.json), with public schemas under [schemas/](schemas/).
197
+
198
+ ## Support and security
199
+
200
+ For setup questions and reproducible bugs, open a [GitHub issue](https://github.com/Lucy-AI-Inc/lucy-memory-mcp/issues). Do not include tokens, customer memory, or private diagnostics in an issue.
201
+
202
+ For a security concern, follow the private reporting guidance in the repository [security policy](SECURITY.md).
203
+
204
+ ## License
205
+
206
+ Licensed under the [Apache License, Version 2.0](LICENSE).
@@ -0,0 +1,27 @@
1
+ {
2
+ "schema_version": "1",
3
+ "name": "lucy-agent-manifest",
4
+ "sentence": "Lucy is where approved facts about you and your work live across agents. Your agent's local memory is only its private notebook.",
5
+ "tools": ["memory_recall", "memory_propose", "memory_proposal_status"],
6
+ "permissions": ["memory:read", "memory:propose"],
7
+ "forbidden": ["memory:write", "memory:resolve", "memory:approve", "memory:delete", "memory:restore"],
8
+ "laws": [
9
+ "PROPOSED != SAVED",
10
+ "EXISTS != RECALLABLE",
11
+ "Projection != authority",
12
+ "No silent dual-write",
13
+ "No local durable fallback"
14
+ ],
15
+ "http": [
16
+ "POST /api/lucy/agent-memory/v1/recall",
17
+ "POST /api/lucy/agent-memory/v1/proposals",
18
+ "GET /api/lucy/agent-memory/v1/proposals/{proposal_id}"
19
+ ],
20
+ "auto_memory": "Human Lucy policy only. Agent still only proposes.",
21
+ "local": [
22
+ "skills",
23
+ "machine paths",
24
+ "session transcripts",
25
+ "temporary state"
26
+ ]
27
+ }
@@ -0,0 +1,200 @@
1
+ {
2
+ "contract_name": "Lucy Agent Memory API Contract",
3
+ "contract_version": "2026-08-09",
4
+ "create": {
5
+ "approved_memory_version": 1,
6
+ "creates_new_memory_id": true,
7
+ "forbidden": [
8
+ "memory_id",
9
+ "expected_version"
10
+ ],
11
+ "may_replace_active": false,
12
+ "required": [
13
+ "operation",
14
+ "key",
15
+ "kind",
16
+ "scope",
17
+ "content",
18
+ "justification",
19
+ "idempotency_key"
20
+ ]
21
+ },
22
+ "error_codes": [
23
+ "unauthenticated",
24
+ "forbidden",
25
+ "not_found_or_not_visible",
26
+ "invalid_scope",
27
+ "invalid_request",
28
+ "unsupported_version",
29
+ "conflict",
30
+ "version_conflict",
31
+ "rate_limited",
32
+ "payload_too_large",
33
+ "service_unavailable",
34
+ "insufficient_credits",
35
+ "billing_unavailable"
36
+ ],
37
+ "forbidden_mcp_capabilities": [
38
+ "memory_list",
39
+ "memory_resolve",
40
+ "memory_approve",
41
+ "memory_reject",
42
+ "memory_delete",
43
+ "memory_restore"
44
+ ],
45
+ "forbidden_public_permissions": [
46
+ "memory:write",
47
+ "memory:approve",
48
+ "memory:resolve",
49
+ "memory:delete",
50
+ "memory:restore"
51
+ ],
52
+ "forgetting": {
53
+ "physical_deletion_everywhere_promised": false,
54
+ "supported_path_promise": "Once Lucy confirms a memory as forgotten, it is immediately ineligible for recall through supported Lucy Agent Memory paths."
55
+ },
56
+ "identity": {
57
+ "account_source": "server-derived",
58
+ "client_may_supply_account": false,
59
+ "client_may_supply_tenant": false,
60
+ "conflict_identity": [
61
+ "server-derived tenant",
62
+ "exact scope",
63
+ "exact key"
64
+ ],
65
+ "key_required": true,
66
+ "maximum_active_per_conflict_identity": 1,
67
+ "tenant_source": "server-derived"
68
+ },
69
+ "limits": {
70
+ "content_max_bytes": 8192,
71
+ "content_max_unicode_scalars": 2000,
72
+ "idempotency_key_format": "uuid",
73
+ "justification_max_bytes": 2048,
74
+ "justification_max_unicode_scalars": 500,
75
+ "key_max_characters": 128,
76
+ "proposal_request_max_bytes": 12288,
77
+ "recall_keys_maximum": 20,
78
+ "recall_limit_default": 3,
79
+ "recall_limit_maximum": 5,
80
+ "recall_limit_minimum": 1,
81
+ "recall_query_max_unicode_scalars": 1024,
82
+ "recall_request_max_bytes": 8192,
83
+ "recall_response_max_bytes": 65536,
84
+ "source_ref_max_characters": 256
85
+ },
86
+ "mcp_tools": [
87
+ "memory_recall",
88
+ "memory_propose",
89
+ "memory_proposal_status"
90
+ ],
91
+ "memory_kinds": [
92
+ "fact",
93
+ "preference",
94
+ "decision",
95
+ "rule",
96
+ "context"
97
+ ],
98
+ "memory_lifecycle": [
99
+ "active",
100
+ "superseded",
101
+ "revoked",
102
+ "forgotten"
103
+ ],
104
+ "proposal": {
105
+ "authority": "server-authoritative human approval",
106
+ "payload_immutable_after_acceptance": true,
107
+ "proposal_supersession_distinct_from_memory_version_supersession": true,
108
+ "terminal_states_reopen": false
109
+ },
110
+ "proposal_lifecycle": [
111
+ "pending",
112
+ "approved",
113
+ "rejected",
114
+ "expired",
115
+ "superseded"
116
+ ],
117
+ "proposal_version": 1,
118
+ "public_permissions": [
119
+ "memory:read",
120
+ "memory:propose"
121
+ ],
122
+ "public_schema_version": "1",
123
+ "recall": {
124
+ "asynchronous_index_is_not_authority": true,
125
+ "canonical_active_state_rejoin_required": true,
126
+ "historical_receipt_requires_fresh_recall": true,
127
+ "normally_recallable_lifecycle": [
128
+ "active"
129
+ ]
130
+ },
131
+ "receipts": {
132
+ "authority_types": [
133
+ "human_approved"
134
+ ],
135
+ "required_public_fields": [
136
+ "schema_version",
137
+ "id",
138
+ "memory_id",
139
+ "memory_version",
140
+ "key",
141
+ "kind",
142
+ "scope",
143
+ "lifecycle",
144
+ "authority",
145
+ "authoritative_at",
146
+ "issued_at",
147
+ "provenance",
148
+ "relations"
149
+ ],
150
+ "version_specific": true
151
+ },
152
+ "replace": {
153
+ "expected_version_maximum": 9007199254740990,
154
+ "expected_version_minimum": 1,
155
+ "forbidden": [
156
+ "kind"
157
+ ],
158
+ "may_change_key": false,
159
+ "may_change_kind": false,
160
+ "may_change_scope": false,
161
+ "may_create_missing": false,
162
+ "maximum_memory_version": 9007199254740991,
163
+ "new_version_rule": "expected_version + 1",
164
+ "prior_version_transition": "superseded atomically",
165
+ "required": [
166
+ "operation",
167
+ "memory_id",
168
+ "expected_version",
169
+ "key",
170
+ "scope",
171
+ "content",
172
+ "justification",
173
+ "idempotency_key"
174
+ ],
175
+ "retains_memory_id": true
176
+ },
177
+ "retryable_error_codes": [
178
+ "rate_limited",
179
+ "service_unavailable",
180
+ "billing_unavailable"
181
+ ],
182
+ "rule_non_authorities": [
183
+ "credentials",
184
+ "OAuth scopes",
185
+ "access",
186
+ "approval authority",
187
+ "tool authority",
188
+ "spending authority",
189
+ "policy exemptions",
190
+ "tenant changes",
191
+ "project visibility",
192
+ "deployment authority",
193
+ "publication authority"
194
+ ],
195
+ "scope_kinds": [
196
+ "user",
197
+ "workspace",
198
+ "project"
199
+ ]
200
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "algorithm": "sha256",
3
+ "contract": {
4
+ "path": "contracts/agent-memory-api.contract.json",
5
+ "sha256": "664b3a9e079f6173a8d779d88f6bcd9cae70b642d41124e4ff2d31ac71c93990"
6
+ },
7
+ "schemas": {
8
+ "schemas/v1/common.schema.json": "2b84bbb652bb5ea05e53b64eb81ce2f71eea6a038cf88b0c224c126493e55c02",
9
+ "schemas/v1/contract-document.schema.json": "b7371f43c493d69cf9d2599b1d376d8a9a679b2bfe7f48bcc2275f0419328fb9",
10
+ "schemas/v1/create-proposal-request.schema.json": "cc0c90de7243f9f1a7040831d0ddaa644d896747c567b79c340fb42a64fc3637",
11
+ "schemas/v1/error.schema.json": "07dac4fea8be5ce2c09ee2b5924e870d353645ff83fca66bf657018c57b43b23",
12
+ "schemas/v1/memory-version-state.schema.json": "09353978ddca519bc6238306c466be1ec6994248f04071562537658bac76567c",
13
+ "schemas/v1/memory.schema.json": "559c992d6041dd49f3a9fcc969f313ffaa318679f44fdac20ecf9a50242bdc29",
14
+ "schemas/v1/proposal-status.schema.json": "909d901ba9ab2bbcfe39e6b2e41b7828ed957fd1e877cbea2a3155a460804adb",
15
+ "schemas/v1/public-surface.schema.json": "fd0bda7dfbe4f3b779c79e7b1edc6cfc26ec0bde8709ccf7235eba81b30cce91",
16
+ "schemas/v1/recall-request.schema.json": "72f898f94dfd7ea77c8f56196725138193dcc85627a81a4162d3bc637f218e69",
17
+ "schemas/v1/recall-response.schema.json": "51c3fd68cd6157c07766144c2533edbd440eb7621727ea463c88910186c2458f",
18
+ "schemas/v1/receipt.schema.json": "16b2a739f3c4e175f69b9273f28541b51a5ba303c2f842a095487d773779911f",
19
+ "schemas/v1/replace-proposal-request.schema.json": "020c1a18017ce68897fae2b1edbe2dcae31bdb4aa1bab0445df137be6a499940",
20
+ "schemas/v1/replace-transition.schema.json": "333748cc95f4d70d68154c4afc08ea37b203ac16d5af1efec8f15d074527c671",
21
+ "schemas/v1/scope.schema.json": "45e726ced894b4def15ef8e054c950735766a47c460b502150aae52ccbe2a454"
22
+ }
23
+ }