@mono-agent/memory-md 0.1.0

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/README.md ADDED
@@ -0,0 +1,42 @@
1
+ # @mono-agent/memory-md
2
+
3
+ ## Category
4
+
5
+ Category: `context`
6
+
7
+ ## Responsibility
8
+
9
+ Optional Markdown memory store for agent hosts. It reads capped memory blocks and appends host-owned summaries to either one shared file or safe per-conversation files.
10
+
11
+ ## Install / Usage
12
+
13
+ ```bash
14
+ pnpm --filter @mono-agent/memory-md run build
15
+ ```
16
+
17
+ ```ts
18
+ import { createMarkdownMemoryStore } from "@mono-agent/memory-md";
19
+ ```
20
+
21
+ ## Public API
22
+
23
+ - `createMarkdownMemoryStore`, `MarkdownMemoryStore`
24
+ - `safeConversationFileName`
25
+ - `MarkdownMemoryError`
26
+ - `MemoryStore`, `MemoryBlock`, `MemoryWriteResult`, `MarkdownMemoryStoreOptions`
27
+
28
+ ## Dependency Boundary
29
+
30
+ This package depends only on local filesystem behavior. It is optional and host-wired; the harness can run without memory.
31
+
32
+ ## What This Package Does Not Own
33
+
34
+ It does not summarize conversations, decide what should be remembered, call a model, expose a database, or rewrite memory autonomously.
35
+
36
+ ## Verification
37
+
38
+ ```bash
39
+ pnpm --filter @mono-agent/memory-md run build
40
+ pnpm --filter @mono-agent/memory-md run typecheck
41
+ pnpm --filter @mono-agent/memory-md run test
42
+ ```
@@ -0,0 +1,4 @@
1
+ export { createMarkdownMemoryStore, MarkdownMemoryError, MarkdownMemoryStore, safeConversationFileName, } from "./memory-store.js";
2
+ export type { MarkdownMemoryErrorCode } from "./memory-store.js";
3
+ export type { MarkdownMemoryScope, MarkdownMemoryStoreOptions, MemoryBlock, MemoryStore, MemoryWriteResult, } from "./types.js";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,EACzB,mBAAmB,EACnB,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AACjE,YAAY,EACV,mBAAmB,EACnB,0BAA0B,EAC1B,WAAW,EACX,WAAW,EACX,iBAAiB,GAClB,MAAM,YAAY,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { createMarkdownMemoryStore, MarkdownMemoryError, MarkdownMemoryStore, safeConversationFileName, } from "./memory-store.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,EACzB,mBAAmB,EACnB,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,20 @@
1
+ import type { MarkdownMemoryStoreOptions, MemoryBlock, MemoryStore, MemoryWriteResult } from "./types.js";
2
+ export type MarkdownMemoryErrorCode = "invalid_memory_options" | "invalid_conversation_id" | "invalid_memory_summary" | "memory_read_failed" | "memory_write_failed";
3
+ export declare class MarkdownMemoryError extends Error {
4
+ readonly code: MarkdownMemoryErrorCode;
5
+ readonly details: Record<string, unknown>;
6
+ constructor(code: MarkdownMemoryErrorCode, message: string, details?: Record<string, unknown>);
7
+ }
8
+ export declare class MarkdownMemoryStore implements MemoryStore {
9
+ private readonly rootPath;
10
+ private readonly maxBytes;
11
+ private readonly scope;
12
+ private readonly clock;
13
+ constructor(options: MarkdownMemoryStoreOptions);
14
+ load(conversationId: string): Promise<MemoryBlock | undefined>;
15
+ appendHostSummary(conversationId: string, summary: string): Promise<MemoryWriteResult>;
16
+ private resolveMemoryPath;
17
+ }
18
+ export declare function createMarkdownMemoryStore(options: MarkdownMemoryStoreOptions): MarkdownMemoryStore;
19
+ export declare function safeConversationFileName(conversationId: string): string;
20
+ //# sourceMappingURL=memory-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory-store.d.ts","sourceRoot":"","sources":["../src/memory-store.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAuB,0BAA0B,EAAE,WAAW,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE/H,MAAM,MAAM,uBAAuB,GAAG,wBAAwB,GAAG,yBAAyB,GAAG,wBAAwB,GAAG,oBAAoB,GAAG,qBAAqB,CAAC;AAErK,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,QAAQ,CAAC,IAAI,EAAE,uBAAuB,CAAC;IACvC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;gBAE9B,IAAI,EAAE,uBAAuB,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM;CAMlG;AAED,qBAAa,mBAAoB,YAAW,WAAW;IACrD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAsB;IAC5C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAa;gBAEvB,OAAO,EAAE,0BAA0B;IAkBzC,IAAI,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC;IAuC9D,iBAAiB,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAqB5F,OAAO,CAAC,iBAAiB;CAO1B;AAED,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,0BAA0B,GAAG,mBAAmB,CAElG;AAED,wBAAgB,wBAAwB,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CAYvE"}
@@ -0,0 +1,136 @@
1
+ import { createHash } from "node:crypto";
2
+ import { mkdir, readFile, stat, appendFile } from "node:fs/promises";
3
+ import { dirname, join, resolve } from "node:path";
4
+ export class MarkdownMemoryError extends Error {
5
+ code;
6
+ details;
7
+ constructor(code, message, details = {}) {
8
+ super(message);
9
+ this.name = "MarkdownMemoryError";
10
+ this.code = code;
11
+ this.details = { ...details, code };
12
+ }
13
+ }
14
+ export class MarkdownMemoryStore {
15
+ rootPath;
16
+ maxBytes;
17
+ scope;
18
+ clock;
19
+ constructor(options) {
20
+ if (typeof options.path !== "string" || options.path.trim().length === 0) {
21
+ throw new MarkdownMemoryError("invalid_memory_options", "Memory path must be a non-empty string.");
22
+ }
23
+ if (!Number.isInteger(options.maxBytes) || options.maxBytes < 1) {
24
+ throw new MarkdownMemoryError("invalid_memory_options", "maxBytes must be a positive integer.");
25
+ }
26
+ const scope = options.scope ?? "single-file";
27
+ if (scope !== "single-file" && scope !== "per-conversation") {
28
+ throw new MarkdownMemoryError("invalid_memory_options", "Memory scope must be single-file or per-conversation.");
29
+ }
30
+ this.rootPath = resolve(options.path);
31
+ this.maxBytes = options.maxBytes;
32
+ this.scope = scope;
33
+ this.clock = options.clock ?? (() => new Date());
34
+ }
35
+ async load(conversationId) {
36
+ const source = this.resolveMemoryPath(conversationId);
37
+ let fileStat;
38
+ try {
39
+ fileStat = await stat(source);
40
+ }
41
+ catch (error) {
42
+ if (isNodeError(error, "ENOENT")) {
43
+ return undefined;
44
+ }
45
+ throw new MarkdownMemoryError("memory_read_failed", "Unable to inspect memory file.", {
46
+ source,
47
+ cause: error instanceof Error ? error.message : String(error),
48
+ });
49
+ }
50
+ if (!fileStat.isFile()) {
51
+ throw new MarkdownMemoryError("memory_read_failed", "Memory path must resolve to a file.", { source });
52
+ }
53
+ try {
54
+ const buffer = await readFile(source);
55
+ const truncated = buffer.byteLength > this.maxBytes;
56
+ const content = truncated
57
+ ? `<!-- memory truncated to last ${this.maxBytes} bytes -->\n${buffer.subarray(buffer.byteLength - this.maxBytes).toString("utf8")}`
58
+ : buffer.toString("utf8");
59
+ return {
60
+ kind: "markdown",
61
+ content,
62
+ source,
63
+ truncated,
64
+ };
65
+ }
66
+ catch (error) {
67
+ throw new MarkdownMemoryError("memory_read_failed", "Unable to read memory file.", {
68
+ source,
69
+ cause: error instanceof Error ? error.message : String(error),
70
+ });
71
+ }
72
+ }
73
+ async appendHostSummary(conversationId, summary) {
74
+ const source = this.resolveMemoryPath(conversationId);
75
+ const normalizedSummary = normalizeSummary(summary);
76
+ const timestamp = this.clock().toISOString();
77
+ const entry = `\n\n## Host Summary — ${timestamp}\n\nConversation: \`${conversationId}\`\n\n${normalizedSummary}\n`;
78
+ try {
79
+ await mkdir(dirname(source), { recursive: true });
80
+ await appendFile(source, entry, "utf8");
81
+ return {
82
+ conversationId,
83
+ source,
84
+ bytesWritten: Buffer.byteLength(entry, "utf8"),
85
+ };
86
+ }
87
+ catch (error) {
88
+ throw new MarkdownMemoryError("memory_write_failed", "Unable to append memory summary.", {
89
+ source,
90
+ cause: error instanceof Error ? error.message : String(error),
91
+ });
92
+ }
93
+ }
94
+ resolveMemoryPath(conversationId) {
95
+ assertConversationId(conversationId);
96
+ if (this.scope === "single-file") {
97
+ return this.rootPath;
98
+ }
99
+ return join(this.rootPath, `${safeConversationFileName(conversationId)}.memory.md`);
100
+ }
101
+ }
102
+ export function createMarkdownMemoryStore(options) {
103
+ return new MarkdownMemoryStore(options);
104
+ }
105
+ export function safeConversationFileName(conversationId) {
106
+ assertConversationId(conversationId);
107
+ const hash = createHash("sha256").update(conversationId).digest("hex").slice(0, 10);
108
+ const base = conversationId
109
+ .trim()
110
+ .toLowerCase()
111
+ .replace(/\.+/gu, "-")
112
+ .replace(/[^a-z0-9_-]+/gu, "-")
113
+ .replace(/-+/gu, "-")
114
+ .replace(/^-+|-+$/gu, "")
115
+ .slice(0, 80);
116
+ return `${base.length === 0 ? "conversation" : base}-${hash}`;
117
+ }
118
+ function normalizeSummary(summary) {
119
+ if (typeof summary !== "string") {
120
+ throw new MarkdownMemoryError("invalid_memory_summary", "Memory summary must be a string.");
121
+ }
122
+ const normalized = summary.replace(/\r\n?/gu, "\n").trim();
123
+ if (normalized.length === 0) {
124
+ throw new MarkdownMemoryError("invalid_memory_summary", "Memory summary must not be empty.");
125
+ }
126
+ return normalized;
127
+ }
128
+ function assertConversationId(conversationId) {
129
+ if (typeof conversationId !== "string" || conversationId.trim().length === 0) {
130
+ throw new MarkdownMemoryError("invalid_conversation_id", "Conversation id must be a non-empty string.");
131
+ }
132
+ }
133
+ function isNodeError(error, code) {
134
+ return typeof error === "object" && error !== null && "code" in error && error.code === code;
135
+ }
136
+ //# sourceMappingURL=memory-store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory-store.js","sourceRoot":"","sources":["../src/memory-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMnD,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IACnC,IAAI,CAA0B;IAC9B,OAAO,CAA0B;IAE1C,YAAY,IAA6B,EAAE,OAAe,EAAE,UAAmC,EAAE;QAC/F,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;QAClC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,EAAE,GAAG,OAAO,EAAE,IAAI,EAAE,CAAC;IACtC,CAAC;CACF;AAED,MAAM,OAAO,mBAAmB;IACb,QAAQ,CAAS;IACjB,QAAQ,CAAS;IACjB,KAAK,CAAsB;IAC3B,KAAK,CAAa;IAEnC,YAAY,OAAmC;QAC7C,IAAI,OAAO,OAAO,CAAC,IAAI,KAAK,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,MAA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AAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,MAAM,IAAI,KAAK,IAAK,KAAqC,CAAC,IAAI,KAAK,IAAI,CAAC;AAChI,CAAC"}
@@ -0,0 +1,23 @@
1
+ export type MarkdownMemoryScope = "single-file" | "per-conversation";
2
+ export interface MemoryBlock {
3
+ readonly kind: "markdown";
4
+ readonly content: string;
5
+ readonly source: string;
6
+ readonly truncated: boolean;
7
+ }
8
+ export interface MemoryWriteResult {
9
+ readonly conversationId: string;
10
+ readonly source: string;
11
+ readonly bytesWritten: number;
12
+ }
13
+ export interface MemoryStore {
14
+ load(conversationId: string): Promise<MemoryBlock | undefined>;
15
+ appendHostSummary(conversationId: string, summary: string): Promise<MemoryWriteResult>;
16
+ }
17
+ export interface MarkdownMemoryStoreOptions {
18
+ readonly path: string;
19
+ readonly maxBytes: number;
20
+ readonly scope?: MarkdownMemoryScope;
21
+ readonly clock?: () => Date;
22
+ }
23
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,GAAG,aAAa,GAAG,kBAAkB,CAAC;AAErE,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;CAC7B;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC,CAAC;IAC/D,iBAAiB,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;CACxF;AAED,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,KAAK,CAAC,EAAE,mBAAmB,CAAC;IACrC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,IAAI,CAAC;CAC7B"}
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "@mono-agent/memory-md",
3
+ "version": "0.1.0",
4
+ "description": "Optional Markdown memory store for agent hosts.",
5
+ "type": "module",
6
+ "license": "UNLICENSED",
7
+ "private": false,
8
+ "main": "./dist/index.js",
9
+ "types": "./dist/index.d.ts",
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/index.d.ts",
13
+ "import": "./dist/index.js"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist",
18
+ "README.md"
19
+ ],
20
+ "publishConfig": {
21
+ "access": "public"
22
+ },
23
+ "scripts": {
24
+ "build": "tsc -p tsconfig.build.json",
25
+ "typecheck": "tsc -p tsconfig.json --noEmit",
26
+ "test": "vitest run --passWithNoTests"
27
+ }
28
+ }