minnimemory 1.0.0-beta.1
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.
- package/LICENSE +39 -0
- package/README.md +824 -0
- package/dist/bench.d.ts +98 -0
- package/dist/bench.js +142 -0
- package/dist/benchReport.d.ts +12 -0
- package/dist/benchReport.js +128 -0
- package/dist/bounds.d.ts +40 -0
- package/dist/bounds.js +44 -0
- package/dist/cli.d.ts +15 -0
- package/dist/cli.js +503 -0
- package/dist/compile.d.ts +187 -0
- package/dist/compile.js +516 -0
- package/dist/discover.d.ts +125 -0
- package/dist/discover.js +520 -0
- package/dist/doctor.d.ts +9 -0
- package/dist/doctor.js +67 -0
- package/dist/episodic.d.ts +47 -0
- package/dist/episodic.js +130 -0
- package/dist/hook.d.ts +45 -0
- package/dist/hook.js +104 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +18 -0
- package/dist/init.d.ts +125 -0
- package/dist/init.js +475 -0
- package/dist/instructions.d.ts +60 -0
- package/dist/instructions.js +270 -0
- package/dist/mcp.d.ts +109 -0
- package/dist/mcp.js +252 -0
- package/dist/mcpServer.d.ts +136 -0
- package/dist/mcpServer.js +997 -0
- package/dist/paths.d.ts +25 -0
- package/dist/paths.js +47 -0
- package/dist/recall.d.ts +113 -0
- package/dist/recall.js +256 -0
- package/dist/recallDir.d.ts +50 -0
- package/dist/recallDir.js +187 -0
- package/dist/reorganize.d.ts +62 -0
- package/dist/reorganize.js +216 -0
- package/dist/report.d.ts +16 -0
- package/dist/report.js +204 -0
- package/dist/router.d.ts +141 -0
- package/dist/router.js +314 -0
- package/dist/rules.d.ts +32 -0
- package/dist/rules.js +651 -0
- package/dist/scan.d.ts +110 -0
- package/dist/scan.js +173 -0
- package/dist/text.d.ts +158 -0
- package/dist/text.js +395 -0
- package/dist/tokenizer.d.ts +26 -0
- package/dist/tokenizer.js +69 -0
- package/dist/types.d.ts +156 -0
- package/dist/types.js +17 -0
- package/dist/version.d.ts +7 -0
- package/dist/version.js +7 -0
- package/dist/writeProtocol.d.ts +19 -0
- package/dist/writeProtocol.js +45 -0
- package/examples/CLAUDE.md +75 -0
- package/examples/README.md +7 -0
- package/package.json +52 -0
package/dist/version.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The single source of the version string. Before this file, "0.1.0" was hand-typed in four
|
|
3
|
+
* places (cli.ts's own VERSION constant, and both McpServer constructors in mcpServer.ts), which
|
|
4
|
+
* is how they drift: a bump to one place with the others forgotten is silent, since nothing
|
|
5
|
+
* compares them.
|
|
6
|
+
*/
|
|
7
|
+
export const VERSION = "1.0.0-beta.1";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* O9, the memory write protocol, as an OnDemandMemory file the compiler emits.
|
|
3
|
+
*
|
|
4
|
+
* The protocol is the instruction text an agent follows when it writes to memory. It is
|
|
5
|
+
* long (eleven items), so it never rides in the always-loaded prefix: rule 26 in the routing
|
|
6
|
+
* profile carries its one-sentence summary, and this OnDemandMemory file carries the whole
|
|
7
|
+
* text, routed to by the OnDemandMemory list like any other long-term file so the agent opens
|
|
8
|
+
* it when a task is about saving, remembering, or updating memory (P4).
|
|
9
|
+
*
|
|
10
|
+
* The wording is the interface spec's, verbatim (Research/FlagShipInterfaces/MinniMemoryInterfaceV1.0.md, O9);
|
|
11
|
+
* tests/interface-parity.test.ts fails on any drift. Edit the doc, then this file.
|
|
12
|
+
*/
|
|
13
|
+
export declare const WRITE_PROTOCOL_FILE_NAME = "memory_write_protocol";
|
|
14
|
+
export declare const WRITE_PROTOCOL_HEADING = "Memory write protocol";
|
|
15
|
+
/** Triggers the OnDemandMemory list carries for this file: the words a memory-writing task uses. */
|
|
16
|
+
export declare const WRITE_PROTOCOL_TRIGGERS: string[];
|
|
17
|
+
export declare const WRITE_PROTOCOL_LINES: readonly string[];
|
|
18
|
+
/** The OnDemandMemory file's markdown: one heading, then the protocol text exactly as the doc states it. */
|
|
19
|
+
export declare function renderWriteProtocolFile(): string;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* O9, the memory write protocol, as an OnDemandMemory file the compiler emits.
|
|
3
|
+
*
|
|
4
|
+
* The protocol is the instruction text an agent follows when it writes to memory. It is
|
|
5
|
+
* long (eleven items), so it never rides in the always-loaded prefix: rule 26 in the routing
|
|
6
|
+
* profile carries its one-sentence summary, and this OnDemandMemory file carries the whole
|
|
7
|
+
* text, routed to by the OnDemandMemory list like any other long-term file so the agent opens
|
|
8
|
+
* it when a task is about saving, remembering, or updating memory (P4).
|
|
9
|
+
*
|
|
10
|
+
* The wording is the interface spec's, verbatim (Research/FlagShipInterfaces/MinniMemoryInterfaceV1.0.md, O9);
|
|
11
|
+
* tests/interface-parity.test.ts fails on any drift. Edit the doc, then this file.
|
|
12
|
+
*/
|
|
13
|
+
export const WRITE_PROTOCOL_FILE_NAME = "memory_write_protocol";
|
|
14
|
+
export const WRITE_PROTOCOL_HEADING = "Memory write protocol";
|
|
15
|
+
/** Triggers the OnDemandMemory list carries for this file: the words a memory-writing task uses. */
|
|
16
|
+
export const WRITE_PROTOCOL_TRIGGERS = ["memory", "remember", "save", "write", "note", "changelog"];
|
|
17
|
+
export const WRITE_PROTOCOL_LINES = [
|
|
18
|
+
"MEMORY WRITE PROTOCOL",
|
|
19
|
+
"1. Before writing, check whether a file already covers the fact. Update that file in",
|
|
20
|
+
" place; never create a duplicate. Delete a memory that turns out to be wrong.",
|
|
21
|
+
"2. A long-term file holds one topic and keeps its five parts: Current state, Locked-in",
|
|
22
|
+
" decisions, Gotchas, Open items, Changelog. A new fact goes into the section it belongs",
|
|
23
|
+
" to. It never goes at the end as narrative.",
|
|
24
|
+
"3. The Changelog takes one line per date: date, what changed, branch or commit, status.",
|
|
25
|
+
" Never a session diary. Never repeated verification boilerplate.",
|
|
26
|
+
"4. Dated status, open items, and changelogs never go into the short-term layer. A line",
|
|
27
|
+
" that carries a date or a status word belongs in a long-term file whatever its heading",
|
|
28
|
+
" says.",
|
|
29
|
+
"5. Convert relative dates to absolute dates. Write the fact, not the transcript.",
|
|
30
|
+
"6. A feedback rule records the rule, then Why, then How to apply.",
|
|
31
|
+
"7. When a file is restructured, its full prior text is archived verbatim first. The archive",
|
|
32
|
+
" is never indexed and is read only when a \"why\" is needed.",
|
|
33
|
+
"8. Every long-term file has exactly one OnDemandMemory list line: a hook of at most 120",
|
|
34
|
+
" characters that says when to open it, not what it says.",
|
|
35
|
+
"9. Link related files by name with [[name]]. A link to a file that does not exist yet",
|
|
36
|
+
" marks something worth writing, not an error.",
|
|
37
|
+
"10. Never write a credential, token, or key into memory.",
|
|
38
|
+
"11. Do not save what the repository already records (structure, git history, past fixes)",
|
|
39
|
+
" or what only matters to the current conversation. If asked to remember one of those,",
|
|
40
|
+
" ask what was non-obvious about it and save that instead.",
|
|
41
|
+
];
|
|
42
|
+
/** The OnDemandMemory file's markdown: one heading, then the protocol text exactly as the doc states it. */
|
|
43
|
+
export function renderWriteProtocolFile() {
|
|
44
|
+
return `## ${WRITE_PROTOCOL_HEADING}\n\n${WRITE_PROTOCOL_LINES.join("\n")}`;
|
|
45
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Ledger API
|
|
2
|
+
|
|
3
|
+
Ledger is a small double-entry bookkeeping service: a Fastify HTTP API over Postgres, with a
|
|
4
|
+
nightly reconciliation worker. Single package, TypeScript throughout.
|
|
5
|
+
|
|
6
|
+
## Current status
|
|
7
|
+
|
|
8
|
+
As of 2026-08-30 the billing rewrite is in progress and blocked on review of the new posting
|
|
9
|
+
rules. The flaky reconciliation test is still skipped. Next steps: land the posting rules, then
|
|
10
|
+
unskip the test, then cut 1.4.0.
|
|
11
|
+
|
|
12
|
+
## Conventions
|
|
13
|
+
|
|
14
|
+
- All money is stored as integer cents. Never use floats for currency anywhere.
|
|
15
|
+
- Every write goes through a repository function. Route handlers never touch the database.
|
|
16
|
+
- Errors thrown across a service boundary are typed. No bare `throw new Error`.
|
|
17
|
+
- Prefer small pull requests. One behaviour change per PR.
|
|
18
|
+
|
|
19
|
+
## Architecture
|
|
20
|
+
|
|
21
|
+
Requests enter through `src/http/`, which validates and hands off to `src/services/`. Services
|
|
22
|
+
compose repository calls from `src/repo/` inside a single transaction per request. The worker in
|
|
23
|
+
`src/worker/` reuses the same services and runs on a cron schedule. There is no message queue.
|
|
24
|
+
|
|
25
|
+
## Layout
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
src/
|
|
29
|
+
├── http/
|
|
30
|
+
│ ├── routes/
|
|
31
|
+
│ ├── schemas/
|
|
32
|
+
│ └── errorMap.ts
|
|
33
|
+
├── services/
|
|
34
|
+
├── repo/
|
|
35
|
+
├── worker/
|
|
36
|
+
└── errors.ts
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Authentication
|
|
40
|
+
|
|
41
|
+
Bearer tokens are verified against the auth service on every request, cached for sixty seconds
|
|
42
|
+
by token hash. Service-to-service calls use a signed header, not a bearer token. Never log a
|
|
43
|
+
token, even truncated.
|
|
44
|
+
|
|
45
|
+
## Error handling
|
|
46
|
+
|
|
47
|
+
Every service throws one of the typed errors in `src/errors.ts`. The HTTP layer maps them to
|
|
48
|
+
status codes in exactly one place, `src/http/errorMap.ts`. Unknown errors become a 500 with a
|
|
49
|
+
correlation id and are never surfaced to the client with their message.
|
|
50
|
+
|
|
51
|
+
## Testing
|
|
52
|
+
|
|
53
|
+
Unit tests run with `npm test`. Integration tests need a database: `npm run db:up` then
|
|
54
|
+
`npm run test:integration`. The reconciliation suite is slow and lives behind
|
|
55
|
+
`npm run test:reconcile`. Always run the integration suite before opening a pull request that
|
|
56
|
+
touches `src/repo/`.
|
|
57
|
+
|
|
58
|
+
## Deployment
|
|
59
|
+
|
|
60
|
+
Pushing to main builds a container and deploys to staging automatically. Production is a
|
|
61
|
+
manual promotion from the staging build. Migrations run before the new version starts; a
|
|
62
|
+
migration that cannot roll back must be split into two deploys.
|
|
63
|
+
|
|
64
|
+
## Common tasks
|
|
65
|
+
|
|
66
|
+
- Add an endpoint: schema in `src/http/schemas/`, handler in `src/http/routes/`, service call.
|
|
67
|
+
- Add a migration: `npm run migrate:new <name>`, then edit the generated file.
|
|
68
|
+
- Rotate the signing key: update the secret, deploy, then revoke the old key after one hour.
|
|
69
|
+
|
|
70
|
+
## Changelog
|
|
71
|
+
|
|
72
|
+
- 2026-08-28 posting rules draft merged behind a flag
|
|
73
|
+
- 2026-08-21 reconciliation worker moved to the shared services layer
|
|
74
|
+
- 2026-08-14 typed errors introduced, error map centralised
|
|
75
|
+
- 2026-08-07 v1.3.0 released
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# examples/
|
|
2
|
+
|
|
3
|
+
This folder holds fixtures shipped in the npm package. `CLAUDE.md` here is a fictional
|
|
4
|
+
project's memory file, used by the README walkthrough, the test suite, and the npm smoke test.
|
|
5
|
+
|
|
6
|
+
It is not instructions for this repo. Do not edit it without updating the tests that assert
|
|
7
|
+
on it.
|
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "minnimemory",
|
|
3
|
+
"version": "1.0.0-beta.1",
|
|
4
|
+
"description": "MinniMemoryMCP: an MCP server that gives an AI coding agent curated memory. Tools audit the agent's memory file, compile it into a small AlwaysOnMemory body plus OnDemandMemory files, serve it back on demand and keep it maintained. Deterministic, lossless, offline. Built by MinniAI.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
7
|
+
"author": "MinniAI",
|
|
8
|
+
"homepage": "https://minniai.com",
|
|
9
|
+
"publishConfig": {
|
|
10
|
+
"access": "public"
|
|
11
|
+
},
|
|
12
|
+
"engines": {
|
|
13
|
+
"node": ">=18"
|
|
14
|
+
},
|
|
15
|
+
"bin": {
|
|
16
|
+
"minnimemory": "./dist/cli.js"
|
|
17
|
+
},
|
|
18
|
+
"main": "./dist/index.js",
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"files": [
|
|
21
|
+
"dist",
|
|
22
|
+
"examples",
|
|
23
|
+
"README.md",
|
|
24
|
+
"LICENSE"
|
|
25
|
+
],
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "tsc -p tsconfig.json",
|
|
28
|
+
"prepublishOnly": "npm run typecheck && npm test && npm run build",
|
|
29
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
30
|
+
"test": "vitest run",
|
|
31
|
+
"test:watch": "vitest"
|
|
32
|
+
},
|
|
33
|
+
"keywords": [
|
|
34
|
+
"llm",
|
|
35
|
+
"agent",
|
|
36
|
+
"context",
|
|
37
|
+
"tokens",
|
|
38
|
+
"memory",
|
|
39
|
+
"claude",
|
|
40
|
+
"mcp",
|
|
41
|
+
"prompt-caching"
|
|
42
|
+
],
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@types/node": "^22.10.2",
|
|
45
|
+
"typescript": "^5.7.2",
|
|
46
|
+
"vitest": "^5.0.0"
|
|
47
|
+
},
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
50
|
+
"zod": "^3.25.0"
|
|
51
|
+
}
|
|
52
|
+
}
|