@staix/vault-mem 0.3.3 → 0.5.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/CHANGELOG.md +56 -0
- package/README.md +45 -20
- package/bin/vmem.js +9 -3
- package/package.json +2 -2
- package/src/analysis-commands.ts +22 -13
- package/src/analysis-input.ts +2 -2
- package/src/analysis-types.ts +2 -0
- package/src/cli-output.ts +140 -0
- package/src/cli.ts +91 -45
- package/src/commands-table.ts +85 -43
- package/src/config.ts +22 -3
- package/src/links.ts +2 -0
- package/src/log-commands.ts +10 -5
- package/src/log-format.ts +3 -0
- package/src/log-types.ts +5 -1
- package/src/mcp-spec.ts +10 -4
- package/src/mcp-vault.ts +27 -15
- package/src/org-commands.ts +5 -3
- package/src/org-promote.ts +3 -0
- package/src/promote-command.ts +6 -4
- package/src/read-commands.ts +12 -2
- package/src/read-output.ts +99 -0
- package/src/registry.ts +3 -2
- package/src/setup.ts +58 -12
- package/src/skills-mine.ts +3 -2
- package/src/spec-git.ts +7 -4
- package/src/spec-output.ts +119 -0
- package/src/sync.ts +62 -18
- package/src/text-output.ts +120 -0
- package/src/ui/panel.css +1 -5
- package/src/ui/panel.js +60 -70
- package/src/ui/plugin.ts +33 -2
- package/src/vault-files.ts +74 -0
- package/src/vault-graph.ts +21 -2
- package/src/vault-index.ts +121 -19
- package/src/vault-lint.ts +8 -2
- package/src/vault-log.ts +109 -1
- package/src/vault-stats.ts +50 -0
- package/src/workspace-graph.ts +9 -1
- package/src/write-commands.ts +32 -9
- package/src/write-operations.ts +48 -8
- package/src/write-output.ts +151 -0
- package/src/write-types.ts +3 -1
- package/src/write-validation.ts +30 -8
- package/src/writer.ts +19 -7
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,62 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.5.0] - 2026-11-04
|
|
6
|
+
|
|
7
|
+
- Git timeouts and signals are named accurately: `timed out after 60 s` for `vmem sync` and `1 s` for the console check (from Bun's `exitedDueToTimeout`), else `killed by <signal>`, each with its own next step (`check git -C <vault> status, then rerun vmem sync`, the same for `vmem doctor`, or `inspect the vault Git state in System`). `vmem sync` FETCH and PUSH issues with an empty stderr now say why and name a next step. The console sync alert names the staged paths from the same list sync stages (#143).
|
|
8
|
+
|
|
9
|
+
- Docs: the README says an older agent-console loads the plugin but the panel fails with a TypeError on `host.ui`, fixed by upgrading agent-console, and the spec fixture README says the files need only be tracked, with a commit required only for verification-stamp cases (#142).
|
|
10
|
+
|
|
11
|
+
- The org sync inbox alert counts only paths `vmem sync` would stage (notes/, reports/, log), with a rename counted once. Other dirty paths are named in the detail but not counted, and a vault with no usable upstream drops the "ahead of upstream" clause. A git call that times out or is killed now logs the signal (`git status failed: timed out (SIGTERM) under the 1 s budget`) and the next step, instead of an empty cause (#138).
|
|
12
|
+
|
|
13
|
+
- Spec schema fixtures validate every error/warning class in separate default-budget tests and skip unused commit/HEAD setup, avoiding the aggregate macOS timeout. Git inspection failures now name the termination signal and 10-second inspection budget, including shorter parent/test timeouts (#137).
|
|
14
|
+
|
|
15
|
+
- The console panel's "shown" and "selected" chips use the neutral tone, because they mark a selection and not a state. Two unused panel CSS rules are removed, and the README states that the panel needs agent-console 0.1.0 or later (#129).
|
|
16
|
+
|
|
17
|
+
- The console `log` snapshot returns an opaque string `cursor`; passing it back as `since` returns only the rows appended since, oldest first up to 100 per poll with `more: true` when rows remain, identical lines included. A rewritten, truncated or far-behind log answers with the latest rows and `reset: true`. The cursor travels as `since` because the console reserves the numeric `after`. Each poll reads a 256 KiB tail or at most 1 MiB forward, plus a back-scan of at most 1 MiB when the tail sits inside one long line. The Log panel keeps re-reading the latest rows, because the shell's poll already refreshes it and skips unchanged data (#48).
|
|
18
|
+
|
|
19
|
+
- **Behaviour change:** citekey uniqueness now ignores ASCII case while preserving the stored case; retained legacy duplicates warn only on unrelated edits. Reference metadata enforces year-specific arXiv widths, names how to fix reference-only keys, and skips redundant DOI-normalization parsing without changing output (#134).
|
|
20
|
+
|
|
21
|
+
- Inbox alerts show each org vault's uncommitted paths plus local commits ahead of its tracking ref, with a stable first-seen time and an Overview link. Checks stay local, bounded and cached for 60 seconds; one vault's Git failure is logged and skipped (#48).
|
|
22
|
+
|
|
23
|
+
- `vmem setup codex` reads TOML table headers quote-aware, so a table such as `[mcp_servers."x]y"]` after the vmem table is no longer swallowed by apply. When the planned file would not parse, the refusal names the right fix: convert a root inline `mcp_servers = { ... }` to `[mcp_servers.<name>]` tables, and on undo rerun `vmem setup codex --undo` (#133).
|
|
24
|
+
|
|
25
|
+
- Missing or invalid domain ids get a direct set-domain hint without echoing the value; undeclared ids keep their named refusal. L02 domain findings use the neighbouring Korean form, list the selected vault's allowed ids and point to its domains config (#128).
|
|
26
|
+
|
|
27
|
+
- The console panel uses the kit's `ui.button` and `ui.notice(text, "err")`, which screen readers announce assertively, instead of its own button and error helpers; the truncated-body note is a polite warning. `@staix/agent-console` moves to 4c4c1e0 (#122).
|
|
28
|
+
|
|
29
|
+
- The console panel builds every view from the agent-console panel kit (`host.ui`): lists use `ui.rows`/`ui.row`, so `j`/`k`/`Enter` work on them, and a note opens in `ui.detail`. The panel CSS uses only the kit's public classes and `--acon-*` tokens, and the `@staix/agent-console` devDependency moves to 5af4dcc, which has `ConsoleUi` (#57).
|
|
30
|
+
|
|
31
|
+
- `vmem lint` and `vmem graph build` / `graph neighbors` name an option they do not take and where it applies (`graph build: --relation applies only to graph neighbors`) instead of `requires one vault id`. `graph neighbors` now refuses `--dry-run`, which it used to accept and ignore. A wrong positional count keeps its message (#121, #127).
|
|
32
|
+
|
|
33
|
+
- `vmem graph build` keeps the relation of `- [[x]] (relation)` lines from `vmem link --relation` as `rel` on the `wiki_link` edge, and `vmem graph neighbors --relation` / `vmem_graph_neighbors` `relation` follow only edges of one relation (`wiki_link` for untyped links); an unknown relation is refused. Node and edge sets are unchanged (#74).
|
|
34
|
+
|
|
35
|
+
- Vault entries accept up to 16 extra domain ids; writers, lint and promotion use the selected target set alongside the six built-ins, and status/list report the effective domains. Malformed declarations fail closed; registry writes with domains use config format 3 (#72).
|
|
36
|
+
|
|
37
|
+
- Reference notes accept typed citekey, DOI, arXiv id, authors, year and venue metadata with offline syntax checks, lowercase DOI assignments and vault-wide citekey uniqueness. Search includes reference DOI/citekey text; the first run rebuilds the index once in a separate schema3 derived cache without modifying existing notes (#73).
|
|
38
|
+
|
|
39
|
+
- `vmem setup codex` replaces a vmem entry whose table header uses quoted or spaced keys (`["mcp_servers".vmem]`, `[mcp_servers."vmem"]`, `[ mcp_servers . vmem ]`) and its subtables in place instead of adding a second table and refusing. The dry run now renders and parses the planned file, so a refusal shows in the preview as it does on apply (#116).
|
|
40
|
+
|
|
41
|
+
- Every CLI command prints text for people by default, following agent-hub's conventions: tables, field blocks, LEVEL/CHECK/FINDING checks with a verdict, one result line per write, and the exact confirm or next-page command after a preview or a cut-off read. Help is grouped into sections with a description per command, and `vmem help <command>` prints one command. `--color=auto|always|never` works everywhere and honors `NO_COLOR` and `TERM=dumb`. **Breaking for scripts:** the default output was pretty JSON and is now text, so pass `--json`, which prints the same compact JSON as before (#114).
|
|
42
|
+
|
|
43
|
+
- N-1: Against 0.4.0, the derived index moves to `<sha>-links2-schema3.sqlite` (spec caches likewise), so each version keeps its own cache and the first 0.5.0 run builds it once. Configs with vault `domains` use format 3; 0.4.0 reads and preserves those newer-format fields but refuses to create or explicitly set an extra domain id, warning only when an existing value is retained on an unrelated edit. In 0.5.0, `vmem lint`/`vmem_lint` reports an L02 error for a `domain` outside the vault's effective set; 0.4.0 lint had no domain check, so a hand-edited note can pass lint there and fail in 0.5.0. CLI status and `vmem_status` add the effective `domains` field per vault. Note files remain Markdown/YAML, with new reference-only citekey/DOI/arXiv/authors/year/venue fields that 0.4.0 does not validate or author; use 0.5.0 for this metadata and extra-domain writes. Citekey uniqueness is ASCII case-insensitive in 0.5.0; retained legacy duplicates warn only on unrelated edits. Log line format is unchanged. CLI output now defaults to text: scripts must pass `--json` for structured output. Existing MCP tools remain available; reference metadata and the optional `vmem_graph_neighbors` `relation` parameter are additive, and graph wiki-link edges may add `rel`. The console `log` snapshot adds `cursor` and accepts `since`; older callers can omit `since` for the latest rows. These CLI and validation behavior changes require a minor release.
|
|
44
|
+
|
|
45
|
+
## [0.4.0] - 2026-11-04
|
|
46
|
+
|
|
47
|
+
- Search, `vmem_search`, spec grep and writer duplicate hints match a Hangul or other CJK term of 2+ characters inside particle and compound forms (`사업단` finds `사업단은`, `사업단장`, `해외사업단`) through a side FTS5 bigram table. Latin terms keep token matching and their ranking; standalone-word and title/description hits rank before substring-only body hits. The index file name gains a schema version (`-links2-schema2.sqlite`), so the first run builds a new index once and older vmem versions keep their own file (#59).
|
|
48
|
+
|
|
49
|
+
- `vmem_patch` takes `edits` (1 to 32 `{oldString, newString}` pairs) as an alternative to the single pair, and `vmem patch --edits file|-` takes the same JSON array. Each `oldString` must match exactly once in the original note, edits must not overlap or start in frontmatter, and all apply or none do, with one receipt, one log event and the 256 KiB bound checked on the combined result. Several rows of one note no longer need one SHA round trip per edit (#63).
|
|
50
|
+
|
|
51
|
+
- Every MCP write tool takes the optional `log` event: `vmem_patch`, `vmem_append`, `vmem_set_frontmatter`, `vmem_move` and `vmem_delete` join `vmem_create`, `vmem_link` and `vmem_supersede` (move and delete use it on the confirm call). CLI writers keep `--log JSON` as the one form, now shown in each command's usage and checked against the same closed schema as the MCP field. A given event is validated and screened like `log append` before any note changes, so an invalid event (bad JSON, unknown key, bad type, unknown project, screened secret) refuses the whole write instead of saving the note and logging nothing; the event is no longer part of the move/delete fingerprint (#60).
|
|
52
|
+
|
|
53
|
+
- `vmem_list` takes a `cursor` and returns the filtered `total`, a per-row `mtime` from the index and `nextCursor`, so a full vault can be paged in stable path order. New read-only `vmem stats <vault>` and `vmem_stats` count notes by type, domain and status, notes modified in the last 7 and 30 days, and log events by type over a bounded window (default 30 days), without writing or locking the vault or its log. `vmem status` and `vmem doctor` no longer print the obsolete `stage: "foundation"` field; scripts that read it should drop that check (#62).
|
|
54
|
+
|
|
55
|
+
- `vmem manifest --json` lists read-only MCP tools as `{name, readOnly: true}` (taken from each tool's `readOnlyHint`), so installers can approve new read tools without a hard-coded list; other tools stay plain names. The release workflow states N-1 per minor line; patch releases carry no N-1 line (#106).
|
|
56
|
+
|
|
57
|
+
- Add MCP `vmem_read_file` and `vmem_list_files`, bounded read-only access to `ops/`, `reports/`, `self/`, `templates/`, `AGENTS.md` and `README.md` with `vmem_read` paging and limits; `notes/`, `log`, dot paths, symlinked components, non-UTF-8 and over-limit files are refused with the tool to use instead. Add `vmem_report`, the MCP form of `vmem report` with the same receipt and log event (#61).
|
|
58
|
+
|
|
59
|
+
- N-1: 0.3.3 runs beside this release. The derived index moves to `<sha>-links2-schema2.sqlite` (spec caches likewise), so 0.3.3 keeps its own `-links2.sqlite` and the first 0.4.0 run builds its index once. The config format, note format and log line format are unchanged, so each version reads what the other writes. MCP and CLI changes are additive for 0.3.3 clients: new tools (`vmem_read_file`, `vmem_list_files`, `vmem_report`, `vmem_stats`), optional `log` and `edits` arguments, and `vmem_list` adds `total`, `nextCursor` and per-row `mtime` beside `notes`. Two behaviors differ: `vmem status` no longer prints `stage`, and a write with an invalid log event is refused instead of saved without its event.
|
|
60
|
+
|
|
5
61
|
## [0.3.3] - 2026-11-02
|
|
6
62
|
|
|
7
63
|
- Polish the spec read surface: scope fish parent completions to the first subcommand, preserve positional help tokens after `--`, document spec MCP tools and startup source registration, clarify shared field/error guidance, reuse body section helpers, and keep literal snippets on code-point boundaries (#103).
|
package/README.md
CHANGED
|
@@ -17,6 +17,8 @@ bun bin/vmem.js recover --confirm
|
|
|
17
17
|
bun run check
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
+
Output: every command prints text for people by default, following agent-hub's CLI style. Lists are tables with uppercase headers, single objects are a title line and aligned fields, checks (`doctor`, `check`, `lint`, `spec validate`) print LEVEL/CHECK/FINDING rows and a verdict, and writes print what changed or would change. A preview prints the exact confirm command with its fingerprint; a truncated read or full page prints the command for the next one. `--json` prints compact JSON objects for scripts and agents; existing fields keep their shape; status and vaults list additionally report effective `domains`. `--color=auto|always|never` is accepted by every command: auto colors only a terminal, and `NO_COLOR` or `TERM=dumb` turn it off. Text wraps to the terminal width, or to `COLUMNS` when output is not a terminal. Errors stay `vmem: <message>` on stderr, and exit codes are unchanged. `vmem help <command>` or `<command> --help` prints one command's entries.
|
|
21
|
+
|
|
20
22
|
The first remove prints a preview; `--confirm` unregisters the vault. It never deletes vault files. Commands work without a TTY and in agent environments. Add requires an existing `notes/` directory, stores the canonical vault path, and rejects duplicate ids and paths. Doctor returns a nonzero status when a registered vault becomes unavailable or its notes directory is replaced by a symlink.
|
|
21
23
|
|
|
22
24
|
Home precedence: `VMEM_HOME` (the pointer is not consulted), else a `home` pointer in the default home's `vmem.config.json`, else the default home itself. The default home is `$AGENTHUB_HOME/vmem` when `AGENTHUB_HOME` is set, otherwise `~/.agenthub/vmem`. Home paths are reported absolute and lexically normalized (`.`, `..` and trailing slashes removed, symlinks not resolved); registered vault paths are stored and reported canonical (symlinks resolved). Environment paths and configured paths must be absolute. A redirect file contains only `home`; the target contains the registry and policy, and cannot redirect again. Missing config means an empty registry. Malformed, oversized, linked or nonregular config files fail closed.
|
|
@@ -25,7 +27,9 @@ Home precedence: `VMEM_HOME` (the pointer is not consulted), else a `home` point
|
|
|
25
27
|
{"vaults":[{"id":"personal","path":"/absolute/vault","kind":"personal","write":"mcp"}],"denyPaths":[],"piiPatterns":[]}
|
|
26
28
|
```
|
|
27
29
|
|
|
28
|
-
Configuration is limited to 64 KiB both on read and after serialization (a change whose pretty-printed result exceeds the limit is refused and the file is unchanged), rejects unknown keys, and is updated under an exclusive lock using a flushed temporary file and atomic rename. An optional top-level `version` (positive integer, absent means 1) names the config format; this build supports format
|
|
30
|
+
Configuration is limited to 64 KiB both on read and after serialization (a change whose pretty-printed result exceeds the limit is refused and the file is unchanged), rejects unknown keys, and is updated under an exclusive lock using a flushed temporary file and atomic rename. An optional top-level `version` (positive integer, absent means 1) names the config format; this build supports format 3. Registry writes add `version: 3` when a vault declares `domains`, or at least `version: 2` when `specs` is present. Configurations without either keep their existing version field (or its absence). A config whose `version` is newer than this build's format is read tolerantly: unknown keys at the top level, in vaults and in PII policies are kept and written back unchanged by registry commands, while the keys this build knows are still validated. A PII policy with members this build does not know cannot be enforced, so it fails closed: every write on that vault (note writes and `check`, two-step previews and confirms, tidy, `promote-from-amem`, `promote` and log appends) is refused with `PII_POLICY`, naming the members, until the newer vmem that wrote the policy does the write. Reads and `vaults pii` show are unaffected. `vaults pii --set` refuses to replace a policy that carries such members, since the replacement would drop them; change it with the newer vmem. Versions that add a key bump the format. Errors name the config file or vault id and path but never echo config or note contents.
|
|
31
|
+
|
|
32
|
+
A vault entry may declare `"domains": ["finance", "health", "household"]` in `vmem.config.json` (or in the object passed to `addVault`). This adds at most 16 ids matching `[a-z][a-z0-9-]{0,31}` to the built-ins `research`, `projects`, `teaching`, `operations`, `people`, `ai-practice`; an empty or omitted array leaves the built-ins available. Duplicate ids count toward the 16-entry declaration bound and appear once in the effective set. `status --json`, MCP `vmem_status` and `vaults list` report the effective set as `domains` (the text list has a DOMAINS column). Reads do not rewrite config. Writers and lint check domain values against the selected vault; missing-domain lint behavior is unchanged. `promote` and `promote-from-amem` check the target vault's set and name an undeclared domain with how to fix it; a personal-only domain is refused by an org vault that does not declare it. The existing per-vault PII policy applies to every domain; note types remain fixed.
|
|
29
33
|
|
|
30
34
|
Durability: the temporary file is fsynced before the rename and the home directory is fsynced after it. On Linux this makes the new config durable once the command returns. On macOS directory fsync succeeds but does not flush the drive cache (no `F_FULLFSYNC`), so a power loss right after a change can revert to the previous complete config, never to a partial one. Windows is not a supported platform for durability claims; the rename stays atomic.
|
|
31
35
|
|
|
@@ -87,9 +91,9 @@ bun bin/vmem.js links personal "Note or alias" --limit 50 --json
|
|
|
87
91
|
|
|
88
92
|
All four commands require a registered vault id. They read only flat, regular `notes/*.md` files (case-sensitive `.md` extension), skip subdirectories and symlink files, and refuse a replaced vault/notes directory. Notes are limited to 2 MiB each. They never write note content, registry configuration or `.obsidian/`. `rebuild` rebuilds the derived cache; other commands scan metadata on every invocation and rehash new or metadata-changed files. Content-identical changes only update metadata; deleted/renamed paths leave the index. SQLite transactions make each scan atomic. A concurrently changing note aborts that scan, so retry after its writer finishes. No watcher, model calls or embeddings run.
|
|
89
93
|
|
|
90
|
-
The cache is `$VMEM_HOME/indexes/<canonical-vault-path-sha256>-links<N>.sqlite` using the resolved home, not necessarily the environment variable. `N` is the link-resolution version (currently 2), so two installed vmem versions that resolve links differently keep separate caches instead of rebuilding each other's
|
|
94
|
+
The cache is `$VMEM_HOME/indexes/<canonical-vault-path-sha256>-links<N>-schema<S>.sqlite` using the resolved home, not necessarily the environment variable. `N` is the link-resolution version (currently 2) and `S` the index schema version (currently 2, which added the CJK bigram table), so two installed vmem versions that resolve links or store the index differently keep separate caches instead of rebuilding each other's; 0.2.4 and older use the unversioned `<sha256>.sqlite`, 0.3.0 through 0.3.3 use `<sha256>-links2.sqlite`, and a first run after upgrading builds the new file once with no manual step. Cache files use mode 0600 on creation. The location must be outside every registered vault, including through symlinks; linked cache directories/files are refused. It contains note text and is disposable private derived state. Removing it while commands are stopped allows the next read to build it again. SQLite uses its own transaction lock and a five-second busy timeout. There is no automatic migration or live vault cutover.
|
|
91
95
|
|
|
92
|
-
Search uses FTS5 `unicode61` over title, description and body with BM25 weights 5:2:1, ascending score and path tie-breaking. Whitespace-separated query terms are literal AND terms, not a raw FTS expression; quote the query as one shell argument. `--type` and `--domain` are exact scalar frontmatter filters. Results include a bounded snippet and metadata, not the full body. Search queries and note targets accept at most 1024 UTF-8 bytes. Search/links default to 50 results, with an enforced 1..500 range. Show defaults to 16384 UTF-8 bytes and permits 1..65536, returning `truncated` and the full note SHA-256. `--section "Exact H2"` selects one real H2 through the next H1/H2, including its H3 children; code-fenced headings are ignored and duplicate/missing names refuse. Truncated reads include bounded `headings` (at most 64 names/8KiB metadata; `headingsTruncated` when omitted) and `nextOffset`. `--offset N` is a UTF-8 byte offset within the selected section or whole note; use the returned `nextOffset` to page even a single section larger than 64 KiB, and compare note hashes across pages. Invalid UTF-8 boundaries and zero-progress byte budgets refuse. Link string fields are capped at 1024 bytes in command results. Oversized arguments fail instead of silently raising a bound.
|
|
96
|
+
Search uses FTS5 `unicode61` over title, description and body with BM25 weights 5:2:1, ascending score and path tie-breaking. Whitespace-separated query terms are literal AND terms, not a raw FTS expression; quote the query as one shell argument. A term whose letters and digits form one run of 2 or more Hangul, Han, Hiragana or Katakana characters (surrounding punctuation is ignored) matches wherever it occurs in the title, description or body, including particle and compound forms: `사업단` finds `사업단은`, `사업단장` and `해외사업단`. That matching uses a side FTS5 table of overlapping character bigrams (Unicode NFC), so a 2-character term is one indexed lookup and a longer term a phrase of consecutive bigrams; it is substring matching, not morphological analysis. Every other term, including Latin words, single CJK characters and terms mixing CJK with Latin letters or digits (`AI교육`), keeps `unicode61` token matching, and a query without CJK terms ranks exactly as before. With a CJK term, notes where every CJK term is a standalone word or occurs in the title or description rank before notes that contain it only inside a longer body word; within each group BM25 over the bigram table (5:2:1) and path break ties, and the snippet is a body window around the first CJK term. `--type` and `--domain` are exact scalar frontmatter filters. Results include a bounded snippet and metadata, not the full body. Search queries and note targets accept at most 1024 UTF-8 bytes. Search/links default to 50 results, with an enforced 1..500 range. Show defaults to 16384 UTF-8 bytes and permits 1..65536, returning `truncated` and the full note SHA-256. `--section "Exact H2"` selects one real H2 through the next H1/H2, including its H3 children; code-fenced headings are ignored and duplicate/missing names refuse. Truncated reads include bounded `headings` (at most 64 names/8KiB metadata; `headingsTruncated` when omitted) and `nextOffset`. `--offset N` is a UTF-8 byte offset within the selected section or whole note; use the returned `nextOffset` to page even a single section larger than 64 KiB, and compare note hashes across pages. Invalid UTF-8 boundaries and zero-progress byte budgets refuse. Link string fields are capped at 1024 bytes in command results. Oversized arguments fail instead of silently raising a bound.
|
|
93
97
|
|
|
94
98
|
Link resolution uses NFC and case-insensitive filename stems only, as Obsidian and `vmem lint` L01 do. Frontmatter `aliases` (string or string array; legacy `alias` accepted) are not link targets; `show`, `links <target>` and `vmem_read` still find a note by alias. A link that only an alias matches is a missing-note link, so the writer refuses a new one and org promotion drops it to text. An optional `notes/` prefix and `.md` suffix are accepted. `[[target|label]]`, `[[target#heading]]`, `[[target#^block]]`, `![[target]]` and same-note anchors work. ATX/Setext headings and end-of-line block ids are checked; fenced code is skipped. Missing/ambiguous targets and missing anchors remain explicit with a reason. Stems that differ only by case or Unicode normalization are ambiguous. Links returns outgoing links in source order, with one-based body-relative `line` values (frontmatter excluded); it does not write backlinks or repair dead links.
|
|
95
99
|
|
|
@@ -104,6 +108,7 @@ All mutations use `applyWrite(home, request)`: per-vault `mutation.lock`, curren
|
|
|
104
108
|
vmem new personal example-finding --type insight --domain research --topics research --description "A distinct supporting observation."
|
|
105
109
|
vmem new personal another-finding --type insight --domain research --topics research --description "An independently sourced result." --body body.md
|
|
106
110
|
vmem patch personal example-finding --old "This note argues that" --new "This finding states that" --expected-sha <sha256>
|
|
111
|
+
vmem patch personal example-finding --edits edits.json --expected-sha <sha256> # [{"oldString": "...", "newString": "..."}, ...]
|
|
107
112
|
vmem append personal example-finding --section Evidence --markdown "Additional evidence."
|
|
108
113
|
vmem frontmatter personal example-finding --set '{"confidence":"likely"}'
|
|
109
114
|
vmem link personal example-finding another-finding --relation supports
|
|
@@ -117,11 +122,13 @@ vmem tidy personal --connections
|
|
|
117
122
|
vmem tidy personal --all --json # migration sanitize preview (see Migration tidy)
|
|
118
123
|
```
|
|
119
124
|
|
|
120
|
-
Syntax follows indexed reads: the vault id comes first. `new` supports `--title`, `--source`, `--confidence`, `--status`, `--extra JSON` and `--body file|-`; omitted body gets an H1/Relevant Notes/Topics skeleton. Patch accepts nonempty old/new strings up to 8192 bytes and requires exactly one occurrence (including overlapping occurrences). Append uses an existing section or inserts it before Topics; it refuses targeting or introducing a Topics H2. `frontmatter` supports `--set JSON`, `--unset key,key` and `--expected-sha`; changing `topics` also replaces only the body Topics wiki-list items in the same write, preserving other content and line endings; setting an equal topics value leaves the body unchanged; append also supports `--expected-sha`. Link relations are `supports`, `contradicts`, `extends`, `applies-to`, `context-for`; links are bidirectional unless `--one-way`. Supersede sets `status`/`superseded_by` on the old note and adds a reverse link in the next note. Report permits plain paths below `reports/` or `ops/`, is schema-exempt and still screened. Inputs are bounded to 256 KiB, follow no file symlinks and accept stdin with `-`.
|
|
125
|
+
Syntax follows indexed reads: the vault id comes first. `new` supports `--title`, `--source`, `--confidence`, `--status`, `--extra JSON` and `--body file|-`; omitted body gets an H1/Relevant Notes/Topics skeleton. Patch accepts nonempty old/new strings up to 8192 bytes and requires exactly one occurrence (including overlapping occurrences). `--edits file|-` (MCP `edits`) instead takes a JSON array of 1 to 32 `{oldString, newString}` pairs with the same bounds: each `oldString` must match exactly once in the original note, edits must not overlap and none may start in frontmatter. They apply all-or-nothing, so any failing edit (or a stale `--expected-sha`) refuses the whole patch; a success gives one receipt and one log event, and the 256 KiB bound applies to the combined result. Use exactly one form per call; both or neither is refused. Append uses an existing section or inserts it before Topics; it refuses targeting or introducing a Topics H2. `frontmatter` supports `--set JSON`, `--unset key,key` and `--expected-sha`; changing `topics` also replaces only the body Topics wiki-list items in the same write, preserving other content and line endings; setting an equal topics value leaves the body unchanged; append also supports `--expected-sha`. Link relations are `supports`, `contradicts`, `extends`, `applies-to`, `context-for`; links are bidirectional unless `--one-way`. Supersede sets `status`/`superseded_by` on the old note and adds a reverse link in the next note. Report permits plain paths below `reports/` or `ops/`, is schema-exempt and still screened. Inputs are bounded to 256 KiB, follow no file symlinks and accept stdin with `-`.
|
|
126
|
+
|
|
127
|
+
Reference notes may optionally hold `citekey` (`[A-Za-z0-9_:-]{1,64}`, unique vault-wide ignoring ASCII case (stored case is preserved)), `doi` (`10.` plus a 4..9-digit registrant, `/` and a nonempty suffix without whitespace or control characters), `arxiv_id` (`YYMM.NNNN` for YY < 15, `YYMM.NNNNN` for YY >= 15, or `archive/YYMMNNN`, optionally `vN` with N >= 1 and month 01..12), `authors` (1..100 nonempty strings), `year` (integer 1000..2100) and `venue` (1..200 Unicode characters). These keys are refused on other note types. Create and explicit DOI assignments store lowercase; body-only edits preserve legacy metadata. Identifier validation is offline syntax only, with no existence lookup or model call. `vmem search <vault> "10.1234/example" --type reference` (MCP `vmem_search` with `type: "reference"`) searches DOI and citekey as well as title, description and body. The derived cache uses `-links2-schema3.sqlite`, rebuilt once independently of older versions; stored note bodies and lint input stay unchanged.
|
|
121
128
|
|
|
122
129
|
`--dry-run` plans and validates any writer without creating locks, temporary files, directories or caches. `check` always takes this path, even without `--dry-run`. Move, delete and tidy first return a preview with planned path/hash changes and a fingerprint; confirmation requires that fingerprint. It covers canonical operation input, the canonical vault path/identity and policy, expected SHAs, every scanned note and all touched files, so even a new inbound reference after preview forces another preview. Move rewrites visible wiki/heading/block/embed targets and wiki references in frontmatter across the vault, preserving explicit `|label` text, anchors and code. Alias-only links resolve to no note and are left as written. The move source may be an existing note with a legacy file name (lint L13, for example a dot in the stem); the destination must be a valid stem. Tidy folds Connections sections into Relevant Notes. Delete refuses when it would newly break inbound links or MOC topics; fix those references first.
|
|
123
130
|
|
|
124
|
-
Validation returns named issues with severity and no matched secret text: V01 schema/enums/description; V02 existing MOC topics; V03 newly unresolved links; V04 flat ASCII note paths (maximum 200 bytes) and safe report paths; V05 final Topics placement/content (error when the write introduces a placement or content problem the note did not already have, or on create; warning when every problem was already present), with explicit append-to-Topics refusal; V06 pinned agent-mem secret regex parity and denied sources/input/snapshot paths; V07 email/phone/configured PII patterns when denied; V08 create duplicates (stem/NFKC H1); V09 256 KiB prospective note size / 16 MiB report size, exact patch and expected-SHA/drift; V10 supersession target integrity. Unchanged pre-existing broken links warn, including after a move. `possibleDuplicates` lists candidate paths for warnings from a disposable in-memory FTS5 query of title terms, with BM25 <= -0.000001, up to three paths; no disk cache is written for that check. `LOCKED`, `IO`, `ROLLBACK`, `INDEX` and `CLEANUP` identify operational failures. CLI returns exit 1 when `ok` is false.
|
|
131
|
+
Validation returns named issues with severity and no matched secret text: V01 schema/enums/description; V02 existing MOC topics; V03 newly unresolved links; V04 flat ASCII note paths (maximum 200 bytes) and safe report paths; V05 final Topics placement/content (error when the write introduces a placement or content problem the note did not already have, or on create; warning when every problem was already present), with explicit append-to-Topics refusal; V06 pinned agent-mem secret regex parity and denied sources/input/snapshot paths; V07 email/phone/configured PII patterns when denied; V08 create duplicates (stem/NFKC H1); V09 256 KiB prospective note size / 16 MiB report size, exact patch and expected-SHA/drift; V10 supersession target integrity. Unchanged pre-existing broken links warn, including after a move. `possibleDuplicates` lists candidate paths for warnings from a disposable in-memory FTS5 query of title terms, matched like search terms (CJK substrings included), with BM25 <= -0.000001, up to three paths; no disk cache is written for that check. `LOCKED`, `IO`, `ROLLBACK`, `INDEX` and `CLEANUP` identify operational failures. CLI returns exit 1 when `ok` is false.
|
|
125
132
|
|
|
126
133
|
A successful receipt reports `applied`, planned path/hash/byte changes, issues and `indexUpdated`. Unrelated malformed legacy YAML is skipped by duplicate hints and by writer index refresh, with a V01 warning naming the unchanged note; normal read/rebuild commands retain strict parsing. Move/tidy still require parseable inputs and name the offending path on refusal. Reads allocate each note's stat size plus one growth-probe byte, capped at the 2 MiB read limit plus one. A failed index refresh rolls back the file changes. Rollback first verifies each file still equals this operation's committed result; external edits are preserved. Failed/refused rollback retains the original backup and reports its relative recovery path. All files are staged before replacement and backups permit rollback of caught multi-file failures. Each individual rename is atomic; a machine/process crash between multiple renames can leave a partially completed batch. The retained lock and `.vmem-<uuid>.tmp` files require inspection and manual recovery after confirming the writer stopped. They are never automatically removed by registry recovery. Uncoordinated editors do not honor the lock; the pipeline rechecks SHAs before replacement, but this does not provide a filesystem transaction against concurrent external edits. Existing notes may be read up to the index's 2 MiB limit; prospective notes are limited to 256 KiB; report operations under `reports/` and `ops/` allow up to 16 MiB for both prospective content and existing-file reads (including staging and rollback rechecks), with at most 10000 flat notes per mutation snapshot. File/directory fsync has the platform guarantees described above. Successful changed mutations now append an event as described below; log failure is reported separately from note success.
|
|
127
134
|
|
|
@@ -132,6 +139,7 @@ A successful receipt reports `applied`, planned path/hash/byte changes, issues a
|
|
|
132
139
|
vmem log append personal EXTRACT - synthetic:source "A synthetic event" --dest notes/example.md
|
|
133
140
|
vmem log tail personal --limit 50 --json
|
|
134
141
|
vmem log grep personal "EXTRACT|CONNECT" --type EXTRACT --limit 20
|
|
142
|
+
vmem patch personal example-finding --old "argues" --new "states" --log '{"type":"EXTRACT","project":"-","source":"synthetic:source","note":"Reworded claim"}'
|
|
135
143
|
```
|
|
136
144
|
|
|
137
145
|
Events keep the canonical local-time format `YYYY-MM-DD HH:MM TYPE project source → dest — note` (two spaces between fields, one LF at the end). Destination is optional. Allowed new types: `INGEST ROUTE EXTRACT CONNECT DIGEST LEARN LINT TASK GRAPH SYNC RETHINK SOURCE`. Project must be `-` or a lowercase alphanumeric/hyphen id; when `registry` is configured, ids must exist in its bounded YAML `projects`/nested `sub_projects` arrays. Registry files are limited to 1 MiB, eight nesting levels and 10000 unique ids; invalid or unavailable configuration fails closed. Invalid types/fields/projects use L09 issues, the 1000-byte line bound uses V09, and secret/PII refusals use V06/V07. Fields cannot inject pipes, control characters or two-space/column separators. Validation and screening run before a file or lock is created. The 1000 UTF-8-byte bound includes the LF and attribution.
|
|
@@ -140,10 +148,21 @@ Every MCP log append and CLI call with a nonempty `AGENTHUB_PEER_ID`, `CLAUDECOD
|
|
|
140
148
|
|
|
141
149
|
`appendLog` validates the registered canonical vault and write/channel policy, acquires a separate `log.lock` (bounded two-second contention wait), then makes one O_APPEND write and fsyncs the log. New log files are mode 0600 and their parent directory is flushed. Linked/nonregular files and an incomplete existing final line are refused. Cooperating appenders share the lock; a short write is truncated back only when the same file still has the expected size, and its tail still equals our exact prefix, then flushed. Error-after-write cases inspect at most one event's bytes. Failed/ambiguous writes or cleanup are explicit; the receipt reports `appended` (possibly null when unknown), `synced`, `bytesWritten` (possibly null) and `rolledBack` when a partial append was removed. Before reporting sync, the current log and vault identities are rechecked; rotation produces LOG_DRIFT and an unknown current-path append state. A synced event can coexist with a cleanup error. No existing event is rewritten. A crash can retain `log.lock`, and failed short-write recovery can retain an incomplete line; inspect the file and stopped writer before manual recovery. There is no automatic cleanup or new TTY requirement.
|
|
142
150
|
|
|
143
|
-
Successful changed mutations default to EXTRACT, link to CONNECT, move to ROUTE, and supersede/tidy to RETHINK. Default events use project `-`, affected paths and the operation name rather than note text. Library callers can supply `WriteRequest.log` to override the event or `false` to disable it; CLI writers
|
|
151
|
+
Successful changed mutations default to EXTRACT, link to CONNECT, move to ROUTE, and supersede/tidy to RETHINK. Default events use project `-`, affected paths and the operation name rather than note text. Library callers can supply `WriteRequest.log` to override the event or `false` to disable it. Every MCP write tool (`vmem_create`, `vmem_patch`, `vmem_append`, `vmem_set_frontmatter`, `vmem_link`, `vmem_supersede`, `vmem_move`, `vmem_delete`) takes the same optional `log` object (`type`, `project`, `source`, `note`, optional `dest`); move and delete use it on the confirm call. The CLI writers `new`, `patch`, `append`, `frontmatter`, `link`, `supersede`, `move`, `delete` and `report` take the same object as `--log JSON`, checked against the same closed schema (unknown keys, a missing field or a bad type are refused); omitting it keeps the default event. `tidy --log` is the unrelated redaction rule. Preview/check/no-op/refused mutations never append. The append is bound to the mutation's resolved vault identity/policy, so re-registration cannot route its event to another vault; the same binding covers the tidy LINT event and both SYNC events of org promotion, which are refused with LOG_DRIFT instead. A bound append compares the registry before any policy or path check, so a re-registration always reads as LOG_DRIFT. Tidy and org promotion also bind every note write to the vaults resolved at the start of the run: if a vault id is re-registered before a write, that write is refused with VAULT_DRIFT and nothing is written to either vault. After a committed mutation, log append is independent: `ok`/`applied` describe the note operation, `log` holds its append receipt, and `logged` is true only when the event was appended and synced. A log error does not roll back a successfully saved note. CLI exits 1 for a log failure even when the note receipt says `ok: true`; inspect the receipt before retrying to avoid duplicate mutations/events. A given event is validated and screened like `log append` (type, registry project id, fields, secret/PII screening, line bound) before any lock or note change, also on dry runs and previews: an invalid event refuses the whole write with its L09/V06/V07/V09 issue and nothing changes. The event is not part of the move/delete fingerprint.
|
|
144
152
|
|
|
145
153
|
Readers never create a home, log or lock, and work with `write: none`. They skip blank/comment lines, return the last matching 1..200 records (default 50), accept an optional canonical TYPE and non-backtracking regex subset up to 256 characters (`|`, `^`, `$`, `.`, character classes, `\d`/`\s`/`\w` and their inverses, escaped literals, and atom `*`/`+`/`?`; groups, backreferences and brace quantifiers are refused), and scan a fixed descriptor-size snapshot. Streaming is capped at 32 MiB; individual historical lines over 4096 bytes and incomplete final lines are omitted with warnings, and the serialized line array stays within 128 KiB. Above 20000 data lines, the manual-archival warning is preserved. Read failure returns `dataLines: null` rather than claiming a count. Golden synthetic fixtures and concurrent/fault persistence tests cover the format and actual append state; no live vault log was read or modified for this increment.
|
|
146
154
|
|
|
155
|
+
# Vault statistics
|
|
156
|
+
|
|
157
|
+
```sh
|
|
158
|
+
vmem stats personal --json # log window: last 30 days
|
|
159
|
+
vmem stats personal --days 7 --json
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
`vmem stats <vault>` and `vmem_stats` report note counts (total, by `type`, `domain` and frontmatter `status`; empty values count as `(none)`), notes whose indexed mtime falls in the last 7 and 30 local calendar days (today included), and log event counts by type dated on or after `log.since`, the first local date of the `--days` window (1..3650, default 30). Known types always appear, unknown ones count as `(other)`. The derived index cache is refreshed as by every read command and the log is streamed with the bounded log reader; no vault file or log is written and no vault or log lock is taken. When the log cannot be read, `log.total` and `log.byType` are null, `log.issues` names the cause and the CLI exits 1.
|
|
163
|
+
|
|
164
|
+
`vmem_list` pages the whole vault: pass the returned `nextCursor` as `cursor` to get the next page in path order. The cursor is the previous page's last path (exclusive), so a note added or removed between pages does not repeat or skip the others; a cursor outside the `prefix` filter is refused.
|
|
165
|
+
|
|
147
166
|
# MCP server
|
|
148
167
|
|
|
149
168
|
`vmem mcp` serves newline-delimited JSON-RPC 2.0 (MCP tools, protocol 2025-06-18 and earlier) on stdio. stdout carries protocol messages only; it needs no TTY and runs in agent sessions. Requests are limited to 64 KiB per frame and results to 256 KiB (a larger result becomes a structured `LIMIT` refusal). Arguments are validated against each tool's bounded schema (`additionalProperties: false`, string/array/integer caps); invalid arguments or unknown tools return JSON-RPC `-32602`, unknown methods `-32601`, malformed frames `-32700`/`-32600`. At startup it loads every module a tool can run, the `@staix/agent-mem` root included, so a server keeps its own code and tool list when its install is replaced or a newer release is installed beside it; restart the host session to pick up the new release.
|
|
@@ -160,26 +179,32 @@ The vault set is read once at startup: every tool's `vault` property is an enum
|
|
|
160
179
|
| `vmem_search` | `query`<=1000, `vault`, `limit`<=50, `type`, `domain` |
|
|
161
180
|
| `vmem_read` | `path` (stem, alias or `notes/` path), `vault`, `maxBytes`<=65536; returns `{path, frontmatter, body, sha256, truncated}` |
|
|
162
181
|
| `vmem_read_many` | `paths`<=20 (8 KiB each), `vault` |
|
|
163
|
-
| `vmem_list` | `vault`, `prefix`, `limit`<=500 |
|
|
182
|
+
| `vmem_list` | `vault`, `prefix`, `limit`<=500, `cursor`; rows in path order with `mtime`, the filtered `total` and `nextCursor` while more remain |
|
|
164
183
|
| `vmem_links` | `path`, `vault`, `direction` out/in/both, `limit`<=200; returns `{out, dead, in}` |
|
|
165
184
|
| `vmem_mocs` | `vault`; MOC notes with incoming link counts |
|
|
166
185
|
| `vmem_check` | `vault`, `path`, `text`<=256 KiB; validation only |
|
|
167
186
|
| `vmem_log_tail` | `vault`, `n`<=200, `type`, `grep`<=256 |
|
|
168
187
|
| `vmem_create` | `stem`, `type`, `domain`, `description`, `topics[]`<=32, `title`, `body`<=65536, `source`, `confidence`, `status`, `extra`, `log` |
|
|
169
|
-
| `vmem_patch` | `path`, `oldString`<=8192
|
|
170
|
-
| `vmem_append` | `path`, `section`<=120, `markdown`<=16384, `expectedSha` |
|
|
171
|
-
| `vmem_set_frontmatter` | `path`, `set`, `unset[]`, `expectedSha` |
|
|
188
|
+
| `vmem_patch` | `path`, `oldString`<=8192 and `newString`<=8192, or `edits[]` 1..32 of `{oldString, newString}` (all-or-nothing), `expectedSha`, `log` |
|
|
189
|
+
| `vmem_append` | `path`, `section`<=120, `markdown`<=16384, `expectedSha`, `log` |
|
|
190
|
+
| `vmem_set_frontmatter` | `path`, `set`, `unset[]`, `expectedSha`, `log` |
|
|
172
191
|
| `vmem_link` | `from`, `to`, `relation`, `context`, `bidirectional` (default true), `log` |
|
|
173
192
|
| `vmem_supersede` | `old`, `next`, `log` |
|
|
174
193
|
| `vmem_log_append` | `type`, `project`, `source`, `dest`, `note`<=500 |
|
|
175
|
-
| `vmem_move` | `from`, `to`, `confirm`, `fingerprint` (two-step) |
|
|
176
|
-
| `vmem_delete` | `path`, `confirm`, `fingerprint` (two-step; the preview lists backlinks) |
|
|
194
|
+
| `vmem_move` | `from`, `to`, `confirm`, `fingerprint` (two-step), `log` (on confirm) |
|
|
195
|
+
| `vmem_delete` | `path`, `confirm`, `fingerprint` (two-step; the preview lists backlinks), `log` (on confirm) |
|
|
177
196
|
| `vmem_promote` | `path` (in the personal vault), `to` (enum of org vaults), `topics[]`, `again`, `confirm`, `fingerprint` (two-step; never pushes) |
|
|
178
197
|
| `vmem_skills_mine` | `vault`, `days`, `project`, `allProjects`, `vocab`, `skills[]`, `minSize`, `minNovelty` (read-only; see Skill mining) |
|
|
198
|
+
| `vmem_stats` | `vault`, `days`<=3650 (default 30); read-only counts, see Vault statistics |
|
|
179
199
|
| `vmem_promote_from_amem` | `id`, `project`, `stem`, `type`, `domain`, `topics[]`, `description`, `title`, `body`<=65536, `linkTo`, `confirm`, `fingerprint` (two-step) |
|
|
200
|
+
| `vmem_read_file` | `path`, `vault`, `maxBytes`<=65536, `offset`<=2097152; returns `{path, sha256, truncated, body, offset?, nextOffset?}` (read-only; allowed roots below the table) |
|
|
201
|
+
| `vmem_list_files` | `dir`, `vault`; one level, <=500 entries `{name, path, type, bytes?}` (read-only) |
|
|
202
|
+
| `vmem_report` | `path` under `reports/` or `ops/`, `body`<=65536, `dryRun`, `log`; the receipt of `vmem report` |
|
|
180
203
|
|
|
181
204
|
Move and delete without `confirm` write nothing and return the preview and `fingerprint`; `confirm: true` requires the fingerprint recomputed on the current state, otherwise the call is refused with `V09`. `vmem_promote_from_amem` is described under Promotion from agent-mem. `vmem_promote` is described under Org promotion and sync. Graph/lint tools are listed below. Note paths in read results are relative to `notes/`.
|
|
182
205
|
|
|
206
|
+
File reads and reports: `vmem_read_file` and `vmem_list_files` read only these roots: `ops/`, `reports/`, `self/`, `templates/`, `AGENTS.md` and `README.md`. They refuse `notes/` (use `vmem_read`), `log` (use `vmem_log_tail`), absolute paths, `.` or `..` segments, dot paths such as `.git`, any symlinked component, denied paths, non-UTF-8 files and files over 2 MiB. Paging, `maxBytes` and `offset` match `vmem_read`; listings leave out dot, linked, special and denied entries. Neither tool takes a lock, touches the index or writes a file. `vmem_report` is `vmem report` over MCP: the same path rules, screening, receipt and default `EXTRACT` event (a `log` override sets another event, for example `LINT` or `GRAPH`), with `write: mcp` required; MCP events always carry the agent attribution.
|
|
207
|
+
|
|
183
208
|
# Host setup
|
|
184
209
|
|
|
185
210
|
```sh
|
|
@@ -196,7 +221,7 @@ Apply is idempotent and touches only the `vmem` entry: other servers and setting
|
|
|
196
221
|
|
|
197
222
|
`vmem completion bash|zsh|fish` prints a completion script generated from the same command table as `--help`.
|
|
198
223
|
|
|
199
|
-
`vmem manifest --json` prints `{name, version, configVersion, mcp: {server, tools}, commands}`: the package version, the config format it writes, the MCP
|
|
224
|
+
`vmem manifest --json` prints `{name, version, configVersion, mcp: {server, tools}, commands}`: the package version, the config format it writes, the MCP tools and the CLI command names from the same table, for tools that would otherwise hard-code them. A read-only tool (its `readOnlyHint` annotation) is listed as `{name, readOnly: true}`, every other tool as its plain name.
|
|
200
225
|
|
|
201
226
|
# Promotion from agent-mem
|
|
202
227
|
|
|
@@ -218,10 +243,10 @@ vmem promote-from-amem personal mem:<id> --link-to existing-note # link an exis
|
|
|
218
243
|
|
|
219
244
|
## Console plugin
|
|
220
245
|
|
|
221
|
-
`vmem setup <target> --apply` also writes `$AGENTHUB_HOME/console/plugins/vmem.json` (default `~/.agenthub`; directory 0700, file 0600) with the absolute path and sha256 of `src/ui/plugin.ts`. `acon ui` then shows a Vault area. Re-run setup after upgrading vmem: acon refuses a module whose hash changed.
|
|
246
|
+
`vmem setup <target> --apply` also writes `$AGENTHUB_HOME/console/plugins/vmem.json` (default `~/.agenthub`; directory 0700, file 0600) with the absolute path and sha256 of `src/ui/plugin.ts`. `acon ui` then shows a Vault area. The panel needs agent-console 0.1.0 or later, the first release with the `host.ui` panel kit and `ui.button`. An older acon still loads the plugin, but the panel then fails with a TypeError on `host.ui`; upgrade agent-console to fix it. Re-run setup after upgrading vmem: acon refuses a module whose hash changed.
|
|
222
247
|
|
|
223
248
|
- Panels: Overview (vaults, maps, recent log), Search, Note (body, links, actions), Promote (agent-mem candidates), Lint (typed findings linked to notes) and Log (parsed rows).
|
|
224
|
-
- Inbox: promotion candidates (group `candidate`), lint errors
|
|
249
|
+
- Inbox: promotion candidates (group `candidate`), lint errors, a stale graph report and org-vault sync pending (group `alert`). Sync pending counts uncommitted paths plus local commits ahead of the upstream tracking ref; without an upstream it counts only uncommitted paths. It reads local Git state only (no fetch or credential prompt), caches each vault result or failure for 60 seconds, and opens Overview with that vault, with no one-key sync verb. The palette searches notes.
|
|
225
250
|
- Actions: `delete`, `move`, `promote` (to an org vault) and `promote-from-amem` reuse the two-step MCP tools. Each first answers a preview with the planned changes; the write happens only after the console's confirm dialog, and only while the fingerprint still matches.
|
|
226
251
|
- The provider calls the `vmem mcp` handlers in process, so the console has exactly the MCP rights: writes need a vault with `write: mcp`, and log lines carry the agent attribution.
|
|
227
252
|
- The module is exported as `@staix/vault-mem/ui-plugin`. Lint results are cached for 60 seconds per vault.
|
|
@@ -230,7 +255,7 @@ vmem promote-from-amem personal mem:<id> --link-to existing-note # link an exis
|
|
|
230
255
|
|
|
231
256
|
`vmem lint <vault>` checks L01/L02/L03/L09/L10/L11/L12 and L13 (lowercase ASCII kebab-case filenames). `--note notes/example.md` limits note findings. Section names and `SUMMARY errors=N warnings=N` follow the Python reference. `--write` writes a screened lint report and LINT event; `--dry-run` previews without persistence. Findings may identify paths, link targets and malformed log prefixes. Note bodies are never included in analysis results.
|
|
232
257
|
|
|
233
|
-
`vmem graph build <vault> [--dry-run]` writes `reports/vault-graph.json`, a dated graph report, graph trend history and GRAPH events through `applyWrite`. Old dated reports are preserved. Trend history appends one row per build, including repeated builds on the same date. Output receipts expose partial report/log failure; these separate writes are not a single transaction. `vmem graph neighbors <vault> <stem> [--hops 1..2] [--limit 1..500]` reads a bounded neighborhood. Matching MCP tools are `vmem_lint`, `vmem_graph_build`, and `vmem_graph_neighbors`; MCP report writes require `write=mcp`.
|
|
258
|
+
`vmem graph build <vault> [--dry-run]` writes `reports/vault-graph.json`, a dated graph report, graph trend history and GRAPH events through `applyWrite`. Old dated reports are preserved. Trend history appends one row per build, including repeated builds on the same date. Output receipts expose partial report/log failure; these separate writes are not a single transaction. A `- [[x]] (relation)` line written by `vmem link --relation` keeps its relation as `rel` on the `wiki_link` edge (`supports`, `contradicts`, `extends`, `applies-to`, `context-for`); other links carry no `rel`. Edges stay undirected, so `rel` does not say which note supports which, and when a pair carries different relations the first in note path order is kept. `vmem graph neighbors <vault> <stem> [--hops 1..2] [--limit 1..500] [--relation REL]` reads a bounded neighborhood; `--relation` (MCP `relation`) follows only edges of that relation, `wiki_link` meaning untyped links, and an unknown relation is refused. Matching MCP tools are `vmem_lint`, `vmem_graph_build`, and `vmem_graph_neighbors`; MCP report writes require `write=mcp`.
|
|
234
259
|
|
|
235
260
|
**Communities** come from a deterministic, dependency-free Leiden (Traag, Waltman and van Eck 2019) optimizing modularity with resolution γ = 1.0: fast local moving with a node queue, refinement that merges only well-connected nodes inside each community (the greedy variant, so no random step), and aggregation on the refined partition initialized from the unrefined one, repeated while modularity improves. Nodes are processed in code-point id order and gain ties go to the lowest community id, so the same graph gives byte-identical output whatever the input order. Every community induces a connected subgraph. MOC (and, in the workspace graph, `bu`) nodes are excluded and get `community: null`; an isolated note is its own community. Community ids are numbered by size (descending), then by smallest member id; they are build-local, so cite a member, not the id. `vault-graph.json` records `graph.partitioner: "leiden"`, `resolution`, the achieved `modularity` and the number of levels, and the report Overview prints the partitioner, resolution and modularity. Modularity has a resolution limit: communities smaller than a size that grows with the whole graph cannot be separated, so a very small cluster may merge into a neighbor. There is no resolution setting yet. Skill mining (`vmem skills mine`) and the workspace graph use the same function. `bun scripts/leiden-live.ts <vault-id>` prints counts only: modularity, community count, largest share, connectivity, clustering time and NMI against the Python reference's Leiden partition.
|
|
236
261
|
|
|
@@ -245,7 +270,7 @@ vmem promote-from-amem personal mem:<id> --link-to existing-note # link an exis
|
|
|
245
270
|
|
|
246
271
|
Analysis consumes note sources from the derived SQLite index, including invalid-frontmatter rows retained separately from searchable notes. Normal scans also retain note sources in `analysis_notes`, roughly doubling cached source storage outside the vault; the cache remains derived and can be rebuilt. Read-only analysis and dry runs clone any existing derived cache through a readonly connection, then refresh changed notes in memory. A missing cache is built in memory. They create no cache, locks, reports or events. Auxiliary log, registry and report inputs use bounded plain-file reads. Snapshot limits are 10,000 notes / 64 MiB source, 1,000 reports / 16 MiB per file and combined, and 32 MiB log; oversized inputs fail explicitly. Graph limits are 100,000 edges. MOCs are excluded from clustering; ties sort by node id. Graph extraction intentionally retains the reference's body-only legacy wiki-link semantics, distinct from the richer navigation resolver.
|
|
247
272
|
|
|
248
|
-
`bun scripts/lint-parity.ts` and `bun scripts/graph-parity.ts` compare the synthetic corpus against frozen Python reference oracles. Use `--reference /absolute/path/to/lint.py` or `--reference /absolute/path/to/build-graph.py` to run the unchanged Python tools directly (`PYTHON` selects an interpreter with PyYAML/networkx). Keep those references until a separate retirement decision after two consecutive zero-diff runs. Fixture parity does not establish private-corpus parity or authorize a live vault cutover. Private corpus evidence stays private; no note bodies belong in public fixtures.
|
|
273
|
+
`bun scripts/lint-parity.ts` and `bun scripts/graph-parity.ts` compare the synthetic corpus against frozen Python reference oracles. Use `--reference /absolute/path/to/lint.py` or `--reference /absolute/path/to/build-graph.py` to run the unchanged Python tools directly (`PYTHON` selects an interpreter with PyYAML/networkx). `graph-parity.ts` compares node attributes and edge pairs only; `workspace-parity.ts` also compares edge `relation`, `field` and `rel`, but ignores `rel` on `wiki_link` edges, so the vmem-only link relation stays outside both comparisons. Keep those references until a separate retirement decision after two consecutive zero-diff runs. L02 additionally validates explicitly present `domain` values against the selected vault's effective domain set; this is a vmem-only check that the Python reference never performed. An undeclared domain can therefore add L02 findings in a live-corpus comparison as an intentional extension, not parser drift; the frozen legacy fixture does not trigger this additional check. Fixture parity does not establish private-corpus parity or authorize a live vault cutover. Private corpus evidence stays private; no note bodies belong in public fixtures.
|
|
249
274
|
|
|
250
275
|
Analysis uses YAML 1.1 scalar compatibility for Python parity, including implicit booleans, octal/sexagesimal numbers, floats and timestamps, while preserving quoted/block strings and merge keys. Explicit tags, complex/non-string mapping keys, recursive aliases and nesting beyond 64 levels are refused explicitly instead of reporting misleading findings. These bounded-parser refusals require manual resolution before parity can be established for an affected corpus.
|
|
251
276
|
# Org promotion and sync
|
|
@@ -291,7 +316,7 @@ vmem sync team --confirm --fingerprint <sha>
|
|
|
291
316
|
|
|
292
317
|
- `bun run parity:release` checks same-snapshot frontmatter bytes, incremental notes/FTS/links against clean rebuild, and two consecutive synthetic Python-oracle lint/graph comparisons. External Python reference paths can be supplied with `--lint-reference` and `--graph-reference`; `--output` records aggregate evidence.
|
|
293
318
|
- `bun run release:verify` enforces committed runtime/method/external-parity evidence freshness and the declared synthetic thresholds at the explicit release gate. Ordinary tests validate evidence shape and internal sample consistency; routine source edits and version bumps do not require fresh benchmark evidence until release validation.
|
|
294
|
-
- `bun run bench:release --output <file.json>` measures a generated 5000-note corpus in the authorized Linux dgx02 container. It records actual MCP search round-trip timings (including metadata refresh), kernel RSS high-water, raw samples and environment; it exits nonzero when a synthetic threshold fails. Synthetic write timings are diagnostic and do not establish representative private-vault acceptance.
|
|
319
|
+
- `bun run bench:release --output <file.json>` measures a generated 5000-note corpus in the authorized Linux dgx02 container. It records actual MCP search round-trip timings (including metadata refresh), kernel RSS high-water, the derived index size after rebuild (`indexBytes`), raw samples and environment; it exits nonzero when a synthetic threshold fails. Synthetic write timings are diagnostic and do not establish representative private-vault acceptance.
|
|
295
320
|
- [Readiness evidence](docs/release-readiness.md), [release workflow](docs/release-workflow.md) and [cutover checklist](docs/cutover-checklist.md) distinguish verified results from outstanding private/native/integration/deployment gates. Live cutover remains blocked.
|
|
296
321
|
|
|
297
322
|
|
|
@@ -345,7 +370,7 @@ vmem specs remove project-specs --confirm
|
|
|
345
370
|
|
|
346
371
|
The config `specs` array holds `id`, canonical git working-tree root `path`, `write` (`mcp|cli|none`, default `none`) and `pii` (`allow|deny`, default `deny`). IDs are unique across vaults and spec sources. A spec source does not need a `notes/` directory. Registration and removal reuse the vault registry lock and atomic config write. Removal previews first, then `--confirm` unregisters only; repository files remain in place.
|
|
347
372
|
|
|
348
|
-
Config writes containing `specs` use format 2;
|
|
373
|
+
Config writes containing `specs` use at least format 2; vault `domains` requires format 3. A config without either keeps its existing serialization and version field. `status` lists spec entries under a separate `specs` key, and `doctor` checks that every registered path is still its canonical git working-tree root. An unavailable or changed root makes doctor exit 1 with a per-source issue. Existing vault entries remain valid; `vaults list` also reports each effective domain set.
|
|
349
374
|
|
|
350
375
|
The registry, read-only MCP tools and CLI commands are implemented. `resolveSpecWorktree` checks the registered git common directory; `discoverSpecs` discovers nested Markdown specs in memory; `SpecIndex` reuses the vault scanner and BM25 with a separate `spec-` cache prefix per canonical worktree. Call `scan()` to refresh a `SpecIndex`; its `snapshot()` uses the last completed scan and `search()` admits only shared-cache rows matching that snapshot's paths and hashes. Call `scan()` again to see documents another index instance inserted or replaced. A failed scan invalidates the instance snapshot; the next read refreshes it or propagates the original failure. `buildSpecGraph` resolves typed links by frontmatter id, and `specSlice` returns bounded subtree/ancestor/neighbor slices (depth 0..3, at most 500 nodes). Discovery uses Git's tracked/untracked non-ignored Markdown list, reports skipped symlinks/missing/nonregular paths, accepts NFC/NFD and filesystem case aliases, and keeps the first duplicate id in NFC path order with a diagnostic. Root device/inode identity and per-file physical containment remain checked while accepting these spelling aliases. Unknown type/status strings remain readable. To exclude large or vendored untracked Markdown, add it to `.gitignore`; already-tracked ignored files must also be untracked with `git rm --cached`. Discovery/indexing is bounded to 10000 Markdown inputs, 2 MiB each and 64 MiB total; graphs allow 10000 inputs and 100000 unique edges. Graph results omit raw note sources. Library validation (`validateSpecs`), introduced-error comparison (`introducedSpecErrors`), computed freshness (`specFreshness`), tracked-file ownership (`specsCoveringPath`) and registry-free CI logic (`validateSpecRepo`) are implemented. The read tools are `vmem_spec_get`, `vmem_spec_graph`, `vmem_spec_grep` and `vmem_spec_validate`. Spec content tools `vmem_spec_create`, `vmem_spec_update` and `vmem_spec_delete` are not implemented (T4, #97); `write` stores a policy for later capabilities. Commands do not edit repository content or run git commit, branch or push.
|
|
351
376
|
|
|
@@ -362,7 +387,7 @@ vmem spec validate --repo /absolute/checkout --require-fresh --json
|
|
|
362
387
|
|
|
363
388
|
`get` returns frontmatter, resolved outgoing links, backlinks, children, path, SHA-256 and computed freshness. Body reads are optional (`--body`, or body paging/section options) and use byte offsets with bounded UTF-8 pages. `graph` accepts subtree, ancestors or neighbors and an optional edge kind. `grep` searches FTS terms by default or a literal substring with `--literal`; filters are type, status, tag, parent, depends-on and covers-path. Use `--` before a positional id/query beginning with a hyphen, for example `vmem spec grep --literal -- "- [ ]"`. Results carry a continuation `nextOffset` when more matching hits exist. Snapshot path/hash filtering occurs before search limit/offset, so another scanner's cache rows cannot shorten pages. Rerun a command to refresh its snapshot. Large responses refuse with guidance or mark bounded collections as truncated.
|
|
364
389
|
|
|
365
|
-
`validate` exits 1 on validation errors; stale scopes become errors only with `--require-fresh`. `--repo` validates a checkout without consulting a home/config file or creating a registry/cache, and cannot be combined with `--source` or `--worktree`. The four read tools are listed by `vmem manifest --json`;
|
|
390
|
+
`validate` exits 1 on validation errors; stale scopes become errors only with `--require-fresh`. `--repo` validates a checkout without consulting a home/config file or creating a registry/cache, and cannot be combined with `--source` or `--worktree`. The four read tools are listed by `vmem manifest --json` as `{name, readOnly: true}`; hosts that approve from a frozen allow-list instead of the manifest need to add their names separately.
|
|
366
391
|
|
|
367
392
|
# Spec validation and freshness library
|
|
368
393
|
|
package/bin/vmem.js
CHANGED
|
@@ -5,8 +5,14 @@ if (!version || Number(version[1]) < 1 || (Number(version[1]) === 1 && (Number(v
|
|
|
5
5
|
process.exit(1);
|
|
6
6
|
}
|
|
7
7
|
const { main, mainAsync, runMcp } = await import("../src/cli.ts");
|
|
8
|
-
|
|
8
|
+
const { resolveColor, takeColorFlag } = await import("../src/text-output.ts");
|
|
9
|
+
const argv = process.argv.slice(2);
|
|
10
|
+
// `--color=` may stand anywhere, so the dispatch looks at the words without it; main/mainAsync take it off again.
|
|
11
|
+
let words;
|
|
12
|
+
try { const taken = takeColorFlag(argv); resolveColor(taken.color, { isTTY: false }); words = taken.args; }
|
|
13
|
+
catch (error) { console.error(`vmem: ${error instanceof Error ? error.message : "invalid --color"}`); process.exit(1); }
|
|
14
|
+
if (words.length === 1 && words[0] === "mcp") {
|
|
9
15
|
try { await runMcp(); }
|
|
10
16
|
catch (error) { console.error(`vmem mcp: ${error instanceof Error ? error.message : "failed"}`); process.exitCode = 1; }
|
|
11
|
-
} else if (
|
|
12
|
-
else process.exitCode = main(
|
|
17
|
+
} else if (words[0] === "promote-from-amem" || words[0] === "skills") process.exitCode = await mainAsync(argv);
|
|
18
|
+
else process.exitCode = main(argv);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@staix/vault-mem",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Validated Obsidian-compatible knowledge vaults for agents and people",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"@staix/agent-mem": "0.17.0"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@staix/agent-console": "github:STAIxBWLB/agent-console#
|
|
18
|
+
"@staix/agent-console": "github:STAIxBWLB/agent-console#4c4c1e0",
|
|
19
19
|
"@types/bun": "^1.3.0",
|
|
20
20
|
"typescript": "^5.8.0"
|
|
21
21
|
},
|
package/src/analysis-commands.ts
CHANGED
|
@@ -1,36 +1,45 @@
|
|
|
1
1
|
import { analysisInput } from "./analysis-input.ts";
|
|
2
|
-
import {
|
|
2
|
+
import { lintDetails } from "./vault-lint.ts";
|
|
3
|
+
import { analysisWriteText, lintText, neighborsText } from "./read-output.ts";
|
|
3
4
|
import { buildGraph, graphNeighbors } from "./vault-graph.ts";
|
|
4
5
|
import { writeAnalysisReports } from "./analysis-reports.ts";
|
|
6
|
+
import { PLAIN, type TextOptions } from "./text-output.ts";
|
|
5
7
|
|
|
6
|
-
|
|
8
|
+
const OPTION_SCOPE: Record<string, string> = {
|
|
9
|
+
"--hops": "graph neighbors", "--limit": "graph neighbors", "--relation": "graph neighbors",
|
|
10
|
+
"--note": "lint", "--write": "lint", "--workspace": "graph build", "--dry-run": "lint --write and graph build",
|
|
11
|
+
};
|
|
12
|
+
export function runAnalysisCommand(command: string, args: string[], home: string, env: NodeJS.ProcessEnv = process.env, text: TextOptions = PLAIN): { text: string; code: number } {
|
|
7
13
|
const values: Record<string,string> = {}, flags = new Set<string>(), positional: string[] = [];
|
|
8
14
|
for (let i=0;i<args.length;i++) {
|
|
9
15
|
const word = args[i]!;
|
|
10
16
|
if (!word.startsWith("-")) { positional.push(word); continue; }
|
|
11
17
|
if (word in values || flags.has(word)) throw new Error("analysis: repeated option");
|
|
12
18
|
if (["--json","--dry-run","--write","--workspace"].includes(word)) flags.add(word);
|
|
13
|
-
else if (["--note","--hops","--limit"].includes(word)) { const value = args[++i]; if (!value || value.startsWith("--")) throw new Error(`${word}: requires value`); values[word]=value; }
|
|
19
|
+
else if (["--note","--hops","--limit","--relation"].includes(word)) { const value = args[++i]; if (!value || value.startsWith("--")) throw new Error(`${word}: requires value`); values[word]=value; }
|
|
14
20
|
else throw new Error(`analysis: unknown option ${word}`);
|
|
15
21
|
}
|
|
22
|
+
// An option the subcommand does not take is named with where it applies, before any positional check.
|
|
23
|
+
const subcommand = command === "lint" ? "lint" : `graph ${positional[0] ?? ""}`.trim();
|
|
24
|
+
const accepted = command === "lint" ? ["--json", "--dry-run", "--write", "--note"] : positional[0] === "build" ? ["--json", "--dry-run", "--workspace"] : positional[0] === "neighbors" ? ["--json", "--hops", "--limit", "--relation"] : undefined;
|
|
25
|
+
if (accepted) for (const option of [...flags, ...Object.keys(values)]) if (!accepted.includes(option)) throw new Error(`${subcommand}: ${option} applies only to ${OPTION_SCOPE[option]}`);
|
|
16
26
|
if (command === "lint") {
|
|
17
|
-
if (positional.length !== 1
|
|
18
|
-
if (flags.has("--write")) { const result = writeAnalysisReports(home,{vault:positional[0]!,kind:"lint",note:values["--note"],dryRun:flags.has("--dry-run")},env); return {text:JSON.stringify(result),code:result.ok && (result.summary as {errors?:number}).errors === 0 ? 0 : 1}; }
|
|
27
|
+
if (positional.length !== 1) throw new Error("lint: requires one vault id");
|
|
28
|
+
if (flags.has("--write")) { const result = writeAnalysisReports(home,{vault:positional[0]!,kind:"lint",note:values["--note"],dryRun:flags.has("--dry-run")},env); return {text:flags.has("--json") ? JSON.stringify(result) : analysisWriteText(result,text,{kind:"lint",dryRun:flags.has("--dry-run")}),code:result.ok && (result.summary as {errors?:number}).errors === 0 ? 0 : 1}; }
|
|
19
29
|
const {snapshot} = analysisInput(home,positional[0]!);
|
|
20
|
-
const
|
|
21
|
-
return {text:flags.has("--json") ? JSON.stringify(report) :
|
|
30
|
+
const details = lintDetails(snapshot,values["--note"]), report = details.report;
|
|
31
|
+
return {text:flags.has("--json") ? JSON.stringify(report) : lintText(details,text,{vault:positional[0]!,note:values["--note"]}),code:report.errors ? 1 : 0};
|
|
22
32
|
}
|
|
23
33
|
const action = positional.shift();
|
|
24
|
-
if (values["--note"] || flags.has("--write")) throw new Error("graph: unsupported option");
|
|
25
34
|
if (action === "build") {
|
|
26
|
-
if (positional.length !== 1
|
|
35
|
+
if (positional.length !== 1) throw new Error("graph build: requires one vault id");
|
|
27
36
|
const result = writeAnalysisReports(home,{vault:positional[0]!,kind:"graph",workspace:flags.has("--workspace"),dryRun:flags.has("--dry-run")},env);
|
|
28
|
-
return {text:JSON.stringify(result),code:result.ok ? 0 : 1};
|
|
37
|
+
return {text:flags.has("--json") ? JSON.stringify(result) : analysisWriteText(result,text,{kind:"graph",dryRun:flags.has("--dry-run")}),code:result.ok ? 0 : 1};
|
|
29
38
|
}
|
|
30
|
-
if (action !== "neighbors" || positional.length !== 2
|
|
39
|
+
if (action !== "neighbors" || positional.length !== 2) throw new Error("graph: use build <vault> or neighbors <vault> <stem>");
|
|
31
40
|
const hops = Number(values["--hops"] ?? 1), limit = Number(values["--limit"] ?? 50);
|
|
32
41
|
if ((hops !== 1 && hops !== 2) || !Number.isInteger(limit) || limit < 1 || limit > 500) throw new Error("graph neighbors: hops 1..2, limit 1..500");
|
|
33
42
|
const {snapshot} = analysisInput(home,positional[0]!);
|
|
34
|
-
const result = graphNeighbors(buildGraph(snapshot),positional[1]!,hops,limit);
|
|
35
|
-
return {text:JSON.stringify(result),code:0};
|
|
43
|
+
const result = graphNeighbors(buildGraph(snapshot),positional[1]!,hops,limit,values["--relation"]);
|
|
44
|
+
return {text:flags.has("--json") ? JSON.stringify(result) : neighborsText(result,text,{vault:positional[0]!,limit,relation:values["--relation"]}),code:0};
|
|
36
45
|
}
|
package/src/analysis-input.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { sourceWorkspaceRoot, missingSourceWarnings, sourceReferences } from "./
|
|
|
5
5
|
import { parseAnalysisYaml } from "./analysis-yaml.ts";
|
|
6
6
|
import { closeSync, constants, fstatSync, lstatSync, openSync, readSync, readdirSync, realpathSync } from "node:fs";
|
|
7
7
|
import { dirname, join, resolve } from "node:path";
|
|
8
|
-
import type
|
|
8
|
+
import { effectiveDomains, type VaultSpec, type VmemConfig } from "./config.ts";
|
|
9
9
|
import type { AnalysisSnapshot } from "./analysis-types.ts";
|
|
10
10
|
import { canonicalPath, isDenied } from "./platform.ts";
|
|
11
11
|
import { loadRegistry } from "./registry.ts";
|
|
@@ -64,7 +64,7 @@ export function analysisInput(home: string, id: string, options: { today?: strin
|
|
|
64
64
|
registryIds = (registry?.projects ?? []).filter(v => v && typeof v === "object").map(v => v.id).filter((v): v is string => typeof v === "string");
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
|
-
const inputs = { today, logPath, log: analysisRead(logPath, 32 * 1024 * 1024), registryIds, reports };
|
|
67
|
+
const inputs = { ...(vault.domains !== undefined ? { domains: effectiveDomains(vault) } : {}), today, logPath, log: analysisRead(logPath, 32 * 1024 * 1024), registryIds, reports };
|
|
68
68
|
const index = new VaultIndex(home,vault,config.vaults.map(v => v.path),{ memory: options.memory ?? true });
|
|
69
69
|
try {
|
|
70
70
|
index.scan(false,{captureInvalidFrontmatter:true});
|
package/src/analysis-types.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/** Private provider input. Never serialize a snapshot into CLI/MCP results or public evidence. */
|
|
2
2
|
export interface AnalysisSnapshot {
|
|
3
|
+
/** Effective selected-vault domain set; standalone snapshots default to the built-ins. */
|
|
4
|
+
domains?: string[];
|
|
3
5
|
notes: { path: string; source: string }[];
|
|
4
6
|
today: string;
|
|
5
7
|
logPath: string;
|