Skip to content

chunk 3/13: .llmem storage centralization + migration#3

Closed
cogeor wants to merge 6 commits into
mainfrom
land/03-llmem-storage
Closed

chunk 3/13: .llmem storage centralization + migration#3
cogeor wants to merge 6 commits into
mainfrom
land/03-llmem-storage

Conversation

@cogeor

@cogeor cogeor commented Jun 4, 2026

Copy link
Copy Markdown
Owner

Chunk 3/13. Centralize storage under .llmem (DOCS_DIR + artifactRoot default), one-time conflict-safe .arch -> .llmem/docs migration at init, blanket .llmem/ gitignore (collapse cache-vs-docs split), idempotent ensureGitignored on first scan, and an arch guardrail against new hardcoded .arch storage-root literals.

🤖 Generated with Claude Code

cogeor and others added 6 commits June 4, 2026 03:01
…oot default)

Flip the two prefix owners + the one hardcoded derivation together so every
downstream path moves atomically: docs at .llmem/docs (ARCH_DIR -> DOCS_DIR),
graph artifacts at .llmem/graph (DEFAULT_CONFIG.artifactRoot + the VS Code
config default), webview deriving as .llmem/graph/webview. Fixes the
workspace-context drift trap (hardcoded asRelPath('.arch') -> asRelPath(DOCS_DIR))
and normalizes artifactRootRel to forward slashes for the web contract.
design-doc-keys/workspace-context/viewer-data fixtures move to the new prefixes
(keys unchanged, archRoot-relative); 4 now-stale rows dropped from the
.artifacts allowlist. generator step-3 + a one-time migration follow in VS-B2/B3.

Implements: 4-viewer-summaries/VS-B1

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
generator step 3 physically copied .arch into webview/arch/ (a third copy of the
docs) and the client kept a matching arch/${key} fetch fallback — both dead now
that docs are delivered via the design_docs.js bundle (static) and
ctx.archWatcher.readDoc/api/arch (serve). Remove the copy + convertAllMarkdown
call + its import, and the designDocService PHASE 2 fetch (PHASE 1 bundle lookup
stays). Also fold in the centralization fix VS-B1 surfaced: viewer-data's two
stray io.mkdirRecursive('.arch') calls now target ctx.archRootRel (.llmem/docs).

Implements: 4-viewer-summaries/VS-B2

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…init

migrateDocs runs once per workspace-context init and handles four cases:
no-legacy (no-op), legacy-only (atomic whole-dir fs.rename, EXDEV
copy->verify->unlink fallback), new-only (no-op), and both-present conflict
(policy b: leave both trees untouched, warn, never clobber an existing
.llmem/docs file). Idempotent (guards on .llmem/docs non-existence), cheap on
warm inits (single exists() short-circuit), and never touches the regenerable
.artifacts/ cache. New four-case + .artifacts-safety test; arch guards
allowlist the helper's direct fs.rename and its JSDoc literal.

Implements: 4-viewer-summaries/VS-B3

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Decision 2026-06-02: .llmem/ is gitignored ENTIRELY (docs + graph + webview),
matching today's local-only .arch. Replace the .arch/.artifacts entries in
.gitignore, .eslintrc.json, and .vscodeignore with a single blanket .llmem/
(the migration removes .arch; .artifacts regenerates under .llmem/graph). Drop
the three now-stale .artifacts allowlist rows. PH-05's ensureGitignored will
write the same blanket line idempotently. design-doc-keys/workspace-context
fixtures already moved in VS-B1.

Implements: 4-viewer-summaries/VS-B4

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sibling to the .artifacts allowlist guard: arch-root-literals.test.ts scans src/
for the quoted .arch storage-root literal and fails on any occurrence outside an
owner allowlist (workspace-marker detectors, the migrate-docs legacy source,
IGNORED_FOLDERS) — new drift must use ctx.archRootRel/DOCS_DIR instead. Scoped to
src/ + a quoted-literal regex that rejects .archRoot/archWatcher/.archive. STALE
rows are flagged too. (One self-reference row added to the .artifacts allowlist
for the new file's own scoping prose.)

Implements: 4-viewer-summaries/VS-B5

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…rst scan

The first scan/doc-gen silently created .llmem/ in the user's repo with no
gitignore entry. ensureGitignored runs once per process at the artifact-root
mkdir seam: in a git repo it appends a "# LLMem (generated)" block + a single
blanket `.llmem/` line (append-only, never reorders the user's file), is a no-op
when `.llmem`/`.llmem/` already exists (matching VS-B4's line idempotently), and
in a non-git workspace logs a one-time notice without writing. Writes via the
realpath-safe WorkspaceIO surface.

Implements: 1-package-hardening/PH-05

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@cogeor

cogeor commented Jun 4, 2026

Copy link
Copy Markdown
Owner Author

Refolded: chunks 3-11 fail CI individually (npm-test hang + smoke-pack drift, both fixed only at chunk 11). Re-landing as one CI-green core PR.

@cogeor cogeor closed this Jun 4, 2026
@cogeor cogeor deleted the land/03-llmem-storage branch June 4, 2026 01:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant