synomem 0.5.3 → 0.6.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.
Files changed (77) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/README.md +30 -12
  3. package/dist/cli.d.ts +5 -3
  4. package/dist/cli.d.ts.map +1 -1
  5. package/dist/cli.js +245 -47
  6. package/dist/cli.js.map +1 -1
  7. package/dist/client.d.ts.map +1 -1
  8. package/dist/client.js +10 -0
  9. package/dist/client.js.map +1 -1
  10. package/dist/config.d.ts +1 -0
  11. package/dist/config.d.ts.map +1 -1
  12. package/dist/config.js +4 -0
  13. package/dist/config.js.map +1 -1
  14. package/dist/configure.d.ts.map +1 -1
  15. package/dist/configure.js +5 -4
  16. package/dist/configure.js.map +1 -1
  17. package/dist/discover.d.ts +9 -11
  18. package/dist/discover.d.ts.map +1 -1
  19. package/dist/discover.js +14 -15
  20. package/dist/discover.js.map +1 -1
  21. package/dist/import.d.ts +4 -4
  22. package/dist/index.d.ts +5 -1
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.js +3 -1
  25. package/dist/index.js.map +1 -1
  26. package/dist/mcp/index.d.ts.map +1 -1
  27. package/dist/mcp/index.js +46 -0
  28. package/dist/mcp/index.js.map +1 -1
  29. package/dist/mcp-server.js +26 -3
  30. package/dist/mcp-server.js.map +1 -1
  31. package/dist/ports/projections.d.ts +8 -0
  32. package/dist/ports/projections.d.ts.map +1 -1
  33. package/dist/project.d.ts +51 -0
  34. package/dist/project.d.ts.map +1 -0
  35. package/dist/project.js +143 -0
  36. package/dist/project.js.map +1 -0
  37. package/dist/projections.d.ts +14 -0
  38. package/dist/projections.d.ts.map +1 -1
  39. package/dist/projections.js +36 -1
  40. package/dist/projections.js.map +1 -1
  41. package/dist/remote.d.ts.map +1 -1
  42. package/dist/remote.js +9 -0
  43. package/dist/remote.js.map +1 -1
  44. package/dist/schemas.d.ts +18 -4
  45. package/dist/schemas.d.ts.map +1 -1
  46. package/dist/schemas.js +29 -2
  47. package/dist/schemas.js.map +1 -1
  48. package/dist/service.d.ts +1 -0
  49. package/dist/service.d.ts.map +1 -1
  50. package/dist/storage.d.ts +13 -0
  51. package/dist/storage.d.ts.map +1 -1
  52. package/dist/storage.js +24 -0
  53. package/dist/storage.js.map +1 -1
  54. package/dist/types.d.ts +1 -0
  55. package/dist/types.d.ts.map +1 -1
  56. package/dist/workspaces.d.ts +41 -0
  57. package/dist/workspaces.d.ts.map +1 -0
  58. package/dist/workspaces.js +96 -0
  59. package/dist/workspaces.js.map +1 -0
  60. package/package.json +1 -1
  61. package/src/cli.ts +305 -50
  62. package/src/client.ts +10 -0
  63. package/src/config.ts +4 -0
  64. package/src/configure.ts +5 -4
  65. package/src/discover.ts +18 -19
  66. package/src/index.ts +22 -1
  67. package/src/mcp/index.ts +62 -0
  68. package/src/mcp-server.ts +32 -5
  69. package/src/ports/projections.ts +9 -0
  70. package/src/project.ts +168 -0
  71. package/src/projections.ts +38 -1
  72. package/src/remote.ts +9 -0
  73. package/src/schemas.ts +44 -12
  74. package/src/service.ts +1 -0
  75. package/src/storage.ts +28 -0
  76. package/src/types.ts +1 -0
  77. package/src/workspaces.ts +107 -0
package/CHANGELOG.md CHANGED
@@ -3,6 +3,49 @@
3
3
  All notable changes will be documented here. The format follows
4
4
  [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and releases follow Semantic Versioning.
5
5
 
6
+ ## [0.6.0] - 2026-09-07
7
+
8
+ ### Added
9
+
10
+ - Local workspace isolation is now real. A local workspace used to be a
11
+ `--workspace` label with nothing behind it — only `events` carried
12
+ `workspace_id`, reads never filtered on it, and several tables had no such
13
+ column at all. A local workspace is now a separate SQLite database in its
14
+ own home, the safer design given SQLite has no row-level security: on
15
+ Postgres a query that forgets to filter by workspace returns nothing
16
+ instead of another workspace's rows, and separate files make the local
17
+ equivalent of that mistake unwritable rather than merely unlikely.
18
+ - A directory can now be bound to a local workspace: `synomem workspace use
19
+ <name> [--as <actor>]` writes `.synomem/config.json`, found by walking up
20
+ from the working directory the same way `.git` or `.nvmrc` is. Every command
21
+ and every stdio MCP server started in that directory afterward resolves the
22
+ workspace — and, unless overridden per launch, the default actor — with no
23
+ flag repeated. This is what makes several harnesses opened in the same
24
+ repository share one workspace while each still writes as its own actor:
25
+ `--workspace`, `SYNOMEM_WORKSPACE`, and `--home` all still win outright, in
26
+ that order, over the project file, and each harness's own `--agent-id` or
27
+ `--actor-id` always wins over the file's default actor.
28
+ - `synomem_agent_archive` and `synomem_agent_restore` MCP tools, closing the
29
+ gap where the CLI could archive or restore an agent identity but MCP could
30
+ not. Gated by a new `allowAgentArchiveViaMcp` capability
31
+ (`SYNOMEM_ALLOW_AGENT_ARCHIVE_VIA_MCP`), off by default and mirroring
32
+ `agentCreationViaMcp` exactly, so runtime agents cannot silently disable
33
+ each other unless an operator opts in.
34
+
35
+ ### Fixed
36
+
37
+ - An agent created before handles existed (schema 7) made every write in its
38
+ workspace fail with `UNSUPPORTED_EVENT`: its stored `agent.created` event
39
+ carries an id and no handle, and the compatibility check that runs before
40
+ each write refused the whole event stream on that missing field. The reader
41
+ now widens to accept it — the id is the correct handle for those records —
42
+ rather than the append-only log being rewritten.
43
+ - Renaming an agent's handle left its old projection directory behind,
44
+ stranding `NOTES.md`, the one file in there that belongs to the reader
45
+ rather than to Synomem and that a rebuild will never delete. The directory
46
+ is now moved to the new handle before projections are regenerated, so
47
+ hand-written notes arrive intact instead of being stranded.
48
+
6
49
  ## [0.5.3] - 2026-09-07
7
50
 
8
51
  ### Documentation
package/README.md CHANGED
@@ -38,9 +38,9 @@ Synomem gives humans and AI agents durable ways to coordinate beyond a disappear
38
38
  Traditional AI memory layers resemble an isolated file cabinet for one model. Synomem turns memory
39
39
  into a shared, transactional canvas: independently operating agents can retain private knowledge,
40
40
  deliver durable context, delegate work with consent, track commitments, and recognize good
41
- collaboration through one auditable protocol. V1 provides that substrate locally; its interfaces are
42
- designed so the same agent identities and semantics can later cross machines through an explicitly
43
- configured service.
41
+ collaboration through one auditable protocol. The same agent identities and semantics work on one
42
+ machine or across many: the local backend keeps everything on disk, and Synomem Cloud keeps it in a
43
+ hosted workspace reached over HTTPS.
44
44
 
45
45
  One append-only event store powers the TypeScript library, `synomem` CLI, actor-bound stdio MCP
46
46
  server, compact change feeds, and readable Markdown projections. On the local backend that store is
@@ -85,7 +85,7 @@ Everything below works the same on both backends.
85
85
 
86
86
  ```bash
87
87
  export SYNOMEM_HOME="$(mktemp -d)/.synomem"
88
- synomem init
88
+ synomem config init --backend local --yes
89
89
  synomem agent create codex --name "Codex"
90
90
  synomem agent create gracie --name "Gracie"
91
91
 
@@ -243,23 +243,41 @@ are `claude`, `codex`, `hermes`, `openclaw`, `cursor`, and `grok`; `grokbot` ali
243
243
 
244
244
  ## Storage
245
245
 
246
+ This is the local backend. On Synomem Cloud the canonical store is a hosted Postgres workspace and
247
+ nothing below is written to this machine.
248
+
246
249
  ```text
247
250
  ~/.synomem/
248
- ├── synomem/
249
- ├── config.json
250
- │ └── synomem.sqlite3
251
- └── <agent-id>/
251
+ ├── config.json
252
+ ├── synomem.sqlite3
253
+ ├── credentials/
254
+ └── installation.json # only when an access key is stored in a file
255
+ └── <handle>/ # one directory per agent, named by handle
252
256
  ├── profile.json
253
257
  ├── WINS.md
254
258
  ├── MEMORY.md
255
259
  ├── TASKS.md
256
- ├── inbox/{kudos,memos,tasks}/
257
- └── NOTES.md
260
+ ├── NOTES.md
261
+ └── inbox/{kudos,memos,tasks}/<record-id>.md
258
262
  ```
259
263
 
264
+ The home IS the storage directory: `config.json` and the database sit directly in it, with no
265
+ nested `synomem/` level.
266
+
267
+ Agent directories are named by HANDLE, because they exist to be read. The canonical agent ID is
268
+ what stored events reference, so renaming an agent leaves its history untouched.
269
+
270
+ Renaming moves the whole directory, `NOTES.md` included. That file is yours rather than Synomem's,
271
+ so a rebuild will never delete it — which is exactly why the rename moves the directory instead of
272
+ regenerating it somewhere new and leaving your notes behind.
273
+
260
274
  SQLite events are canonical and append-only. Markdown and current-state tables are rebuildable
261
- projections. `NOTES.md` is human-owned and is never overwritten; canonical agent notes project to
262
- `MEMORY.md`.
275
+ projections run `synomem rebuild` to regenerate them, and `synomem projection status` to see
276
+ whether they currently match the events. Posts and todos project no files: a post belongs to the
277
+ whole workspace rather than to one agent's directory, and a todo is private to its owner.
278
+
279
+ `NOTES.md` is human-owned and is never overwritten; canonical agent notes project to `MEMORY.md`.
280
+ Each projection can be turned off individually, in which case its file is not written at all.
263
281
 
264
282
  Override the root with `SYNOMEM_HOME`, `--home`, or the library's `home` option. Use
265
283
  `synomem backup` for a consistent snapshot and JSON or JSONL export for recovery. Never synchronize
package/dist/cli.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { Command } from 'commander';
3
+ import { type DiscoveredWorkspace } from './discover.js';
3
4
  import { type PromptIo } from './prompt.js';
4
5
  import { type CredentialStore } from './credentials.js';
5
6
  import { type OAuthLoginOptions } from './oauth.js';
@@ -23,11 +24,12 @@ export interface CliDependencies {
23
24
  reference: string;
24
25
  credentialStore: CredentialStore;
25
26
  }) => Promise<void>;
26
- discoverBoundWorkspace?: (options: {
27
+ discoverAccessKeyWorkspaces?: (options: {
27
28
  baseUrl: string;
28
29
  accessToken: string;
29
30
  }) => Promise<{
30
- workspaceId: string;
31
+ organizationId: string;
32
+ workspaces: DiscoveredWorkspace[];
31
33
  }>;
32
34
  createImportBundle?: (home: string) => Promise<ImportBundle>;
33
35
  remoteImport?: (options: {
@@ -38,6 +40,6 @@ export interface CliDependencies {
38
40
  planId?: string;
39
41
  }) => Promise<ImportPreview | ImportResult>;
40
42
  }
41
- export declare function createCli(io?: CliIo, serviceFactory?: SynomemServiceFactory, dependencies?: CliDependencies): Command;
43
+ export declare function createCli(io?: CliIo, serviceFactory?: SynomemServiceFactory, dependencies?: CliDependencies, argv?: string[]): Command;
42
44
  export declare function runCli(argv?: string[], io?: CliIo, serviceFactory?: SynomemServiceFactory, dependencies?: CliDependencies): Promise<number>;
43
45
  //# sourceMappingURL=cli.d.ts.map
package/dist/cli.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAKA,OAAO,EAAE,OAAO,EAA0B,MAAM,WAAW,CAAC;AAmB5D,OAAO,EAAmB,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAA0C,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAIhG,OAAO,EAA4C,KAAK,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE9F,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,YAAY,EAClB,MAAM,aAAa,CAAC;AASrB,OAAO,KAAK,EACV,aAAa,EASd,MAAM,YAAY,CAAC;AAEpB,OAAO,KAAK,EAAkB,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAE1E,MAAM,WAAW,KAAK;IACpB,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAChC;AAED,MAAM,WAAW,eAAe;IAC9B,yEAAyE;IACzE,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3D,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,sBAAsB,CAAC,EAAE,CAAC,OAAO,EAAE;QACjC,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,EAAE,MAAM,CAAC;QACpB,KAAK,EAAE,aAAa,CAAC;QACrB,SAAS,EAAE,MAAM,CAAC;QAClB,eAAe,EAAE,eAAe,CAAC;KAClC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAKpB,sBAAsB,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