You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .memory/decisions.md
+2-4Lines changed: 2 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,12 +34,10 @@ Memories stored by HackLM Memory.
34
34
35
35
-[docs-site-zensical] Docs site uses Zensical (pip install zensical). Config in zensical.toml at repo root. Serve: .venv/Scripts/zensical.exe serve. Build: zensical build → site/. Deploys to GitHub Pages via .github/workflows/docs.yml on push to main.
36
36
37
-
38
37
-[globalstate-keys-file] All globalState keys live in extension/src/globalStateKeys.ts as named exports. Never use bare string literals for globalState keys elsewhere.
39
38
40
39
-[category-limits-source] CATEGORY_LIMITS constant removed from markdownStore.ts. Category limits come from VS Code config only (package.json defaults via config.get). Default fallback is hardcoded as 20 in utils.ts.
41
40
42
-
-[stale-slug-pruner-removed] pruneStaleEntries removed from cleanupMemory.ts. Stale slugs last-cleanup and last-session-debrief no longer exist. ADRs 0001 and 0013 deleted from docs/decisions/ as they documented completed migration periods.
43
-
44
-
45
41
-[adr-location] ADRs live in docs/decisions.md but are NOT in the Zensical nav. The nav has an ADR page (docs/adr.md) instead. That page links back to docs/decisions.md on GitHub.
42
+
43
+
-[category-limits-defaults] Category defaults doubled: Instruction/Security = 30, Quirk/Preference/Decision = 40. Schema maximum raised to 100. Fallback in utils.ts and UI validation cap updated to match.
Copy file name to clipboardExpand all lines: .memory/quirks.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,3 +9,5 @@ Memories stored by HackLM Memory.
9
9
-[empty-justification] Passing an empty options object to sendRequest suppresses the justification string in the VS Code permission prompt. The user sees a blank reason. Always pass a justification.
10
10
11
11
-[adr-location] ADRs live in docs/decisions.md (a single flat file, not a directory). No separate per-ADR files. Add new ADRs as new H2 sections at the bottom of that file.
12
+
13
+
-[wx-flag-advisory-lock] The outer cross-process lock uses fs.open with the wx flag to create the lockfile exclusively. If the file already exists the open fails, signaling another process holds the lock. Never use a different open mode for this file.
Also published to [Open VSX](https://open-vsx.org/extension/hacklm/hacklm-memory) for editors that use the Open VSX registry.
25
23
26
-
> **Note:** The memory LM tools (`storeMemory`, `queryMemory`) require the editor to implement the VS Code LM Tool API. Editors that do not implement this API will install the extension but the tools will not be available in chat.
24
+
### Open VSX editors
25
+
26
+
In Open VSX-compatible editors the extension installs and activates. What works depends on whether the editor implements the VS Code LM Tool API:
27
+
28
+
| Feature | Available |
29
+
|---------|----------|
30
+
|`.memory/*.md` files created on first open | Always |
|`storeMemory` / `queryMemory` LM tools | VS Code LM Tool API required |
33
+
| Tree view, status bar, control panel | VS Code only |
34
+
| LM deduplication and gap analysis | VS Code LM Tool API required |
35
+
36
+
The `.memory/` files and `copilot-instructions.md` pointer are set up regardless of editor. Once those exist, any AI agent that reads instruction files can access the memory store directly — even without the LM tools.
37
+
38
+
The full experience (LM tools, UI) requires VS Code 1.99+.
39
+
40
+
Support for additional editors via MCP is planned — see the [Roadmap](docs/roadmap.md).
27
41
28
42
## Architecture
29
43
@@ -78,7 +92,7 @@ npm run build
78
92
|`hacklm-memory.lmFamily`|`gpt-5-mini`| Copilot model family for LM operations |
79
93
|`hacklm-memory.autoApproveStore`|`false`| Skip confirmation prompt when saving memories |
80
94
|`hacklm-memory.manageInstructionFile`|`true`| Allow the extension to manage `.github/copilot-instructions.md`|
81
-
|`hacklm-memory.categoryLimit.*`| varies | Per-category max entry counts |
95
+
|`hacklm-memory.categoryLimit.*`| varies (30–40) | Per-category max entry counts |
82
96
83
97
## Privacy
84
98
@@ -94,7 +108,7 @@ Contributions are welcome. Please read [CONTRIBUTING.md](CONTRIBUTING.md) before
94
108
-[Architecture](docs/architecture.md) — module map, data flow, key design decisions
95
109
-[API Reference](docs/api-reference.md) — LM tool schemas, memory file format
96
110
-[Developer Guide](docs/contributing.md) — how to add categories, tools, and tests
97
-
-[Architecture Decision Records](docs/decisions.md) — 16 ADRs covering every major decision
111
+
-[Architecture Decision Records](docs/decisions.md) — 17 ADRs covering every major decision
98
112
-[Roadmap](docs/roadmap.md) — planned work and open contribution areas
Copy file name to clipboardExpand all lines: docs/adr.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,9 +32,9 @@ This makes the codebase predictable. When LM behaviour changes, you edit one fil
32
32
33
33
## 4. Editor-agnostic storage
34
34
35
-
The `.memory/*.md` file format is the stable contract — not VS Code, not TypeScript, not this extension. A future JetBrains plugin or Neovim integration must read and write the same format for memory to be shareable across editors.
35
+
The `.memory/*.md` file format is the stable contract — not VS Code, not TypeScript, not this extension. Any future port (JetBrains plugin, Neovim integration, MCP server for Google Antigravity) must read and write the same format for memory to be shareable across editors.
36
36
37
-
The storage layer (`dedup.ts`, `scoring.ts`, `search.ts`, `markdownStore.ts`) has no VS Code dependency and must stay that way.
37
+
The storage layer (`dedup.ts`, `scoring.ts`, `search.ts`, `markdownStore.ts`) has no VS Code dependency and must stay that way. When additional editor support is built, this layer is extracted to `packages/storage` and shared — not copied.
Copy file name to clipboardExpand all lines: docs/architecture.md
+11-3Lines changed: 11 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -69,9 +69,17 @@ flowchart TD
69
69
70
70
## Key Design Decisions
71
71
72
-
### Per-file Mutex Locks
72
+
### Two-tier Write Locks
73
73
74
-
`markdownStore.ts` maintains a `Map<filePath, Promise<void>>` as a chained promise queue. Every read-then-write operation on a `.memory/*.md` file acquires the lock for that specific file. This prevents concurrent `storeMemory` calls and background cleanup from corrupting the same file simultaneously.
74
+
Every write to `.memory/*.md` goes through two stacked locks:
75
+
76
+
1.**Outer — cross-process advisory lockfile** (`crossProcessLock.ts`): `withCrossProcessLock(memoryDir, fn)` creates `.memory/.lock` with an exclusive `fs.open('wx')` — an atomic OS primitive that works on POSIX and NTFS. Only one process can hold this file at a time. All other processes spin (with linear back-off, max 20 retries) until the holder removes it. Stale locks (dead PID or age > 10 s) are automatically removed, including on extension startup via `clearStaleLockOnStartup()`.
77
+
78
+
2.**Inner — per-file in-process promise queue** (`markdownStore.ts`): `withFileLock(filePath, fn)` chains a `Promise<void>` per file path. This serialises concurrent async calls within the same extension host process (e.g. `storeMemory` + background cleanup hitting the same category file).
79
+
80
+
Callers outside `markdownStore.ts` never interact with either lock directly. The combined wrapper `withMemoryWriteLock(filePath, fn)` is the only entry point used by `appendMemory`, `upsertMemory`, `deleteMemory`, and `migrateFiles`.
81
+
82
+
See [ADR 0018](decisions.md#0018--two-tier-write-locking-for-memory-files) for the full decision record.
75
83
76
84
### Centralised LM Access
77
85
@@ -99,7 +107,7 @@ This extension uses:
99
107
-`vscode.lm.selectChatModels` — to select a Copilot model for redundancy checks and gap analysis
100
108
-`vscode.lm.onDidChangeChatModels` — to refresh the status bar when available models change
101
109
102
-
These APIs require **VS Code 1.99+** (or any Open VSX-compatible editor that implements the VS Code LM Tool API at the same version level). Editors that do not implement `vscode.lm.registerTool` will install the extension but the memory tools will not be available in chat.
110
+
These APIs require **VS Code 1.99+**. The extension publishes to Open VSX; the memory tools function in any editor that implements the VS Code LM Tool API. A separate MCP-based implementation for additional editors is planned (see [ADR 0017](decisions.md#0017--additional-editor-support-via-mcp)).
0 commit comments