feat(site-memory): add local self-learning browser memory - #475
Merged
Conversation
Walk parent hostnames to the PSL registrable-domain boundary instead of jumping to the apex, so admin.eu.example.com prefers eu.example.com.
…itory lock Hold the repository lock across the post-acquire manifest re-check, seed writes, nested commit, and failure cleanup so a losing cold init cannot unlink the winner's committed files. Ignore ENOENT only during cleanup.
Write snake_case candidate JSON through an explicit codec, reject untrusted loads, serialize capture write+commit under the repository lock with own-file cleanup, and hard-cap search at 20.
If index restore also fails after a commit error, throw AggregateError with both causes instead of swallowing cleanup.
Restore prior Markdown and delete new paths if the memory commit fails, combining rollback errors. Reuse parseProductManifest, recover partial provenance without replaying memory, and require ingestion dispositions plus a real memory change.
Persist unattempted seed manifests, apply changed drafts during provenance recovery, classify same-product vs distinct hosts, scope dirty checks, and honor 500/200 plus structural Markdown dates.
Give each reference an explicit trigger, classify before write on provisional fallbacks, state the 500/200 rewrite rule, and disclose the ipify lookup with WEBCMD_CANDIDATE_PUBLIC_IP=off.
…alone Keep product-scoped dirty checks, then reject any staged path outside the commit allow-set. Create the canonical .gitignore only when absent.
Durable facts in nested lists, numbered lists, blockquotes, and table data rows need [verified YYYY-MM-DD]. Pointer-bearing SITE.md stays at or below 200 lines at any current length.
Context writes SITE and reference drafts only when absent so conflict retry reuses the edited draft. Distinct classify keeps incompatible beta SITE.md read-only. Unattempted seed status is retried once lookup is enabled. Classify rollback surfaces AggregateError on cleanup failure.
Retry unattempted seeds only when no active local SITE.md exists, so normal browser runs keep local product memory and skip the seed endpoint.
…ence Gate the 200-line cap on optional manifest.postRewrite, set atomically on rewrite commit. Pointer-bearing organic SITE.md can still grow to 500. Conflict retry re-applies the intended edit onto refreshed siteMarkdown.
Contributor
🟠 Maintainer review suggested — low confidenceThe automated review could not reach a fully supported conclusion. Limitations
This review is advisory and does not block merging. |
Windows shard 1/2 hits Vitest's 5s default on four sequential git.exe tests; afterEach EBUSY is the timeout cascade. Match the existing 20s convention from candidates.test.ts without a global bump.
Windows shard 1/2 still hits Vitest's 5s default on the same-date evidence integration test; afterEach EBUSY is the timeout cascade. Match e0d67bb's 20s convention without a global bump.
Windows shard 1/2 hits the 20s cap on the 23-commit search-limit test and Vitest's 5s default on the rewrite-cap test; afterEach EBUSY is the timeout cascade. Match the 20s convention for rewrite, give the serialized capture batch more room without a global bump.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds invisible, local-first self-learning memory to the browser workflow. The change introduces safe product identity resolution, optional seed initialization, candidate capture/search, conflict-aware checkpointing, progressive-disclosure limits, local CLI commands, and a single generated
webcmd-browserskill contract.Remote seed lookup is explicit configuration:
WEBCMD_GLOBAL_MEMORY_URLenables one bounded first-access request, an absent or blank URL means zero seed requests and local-only learning, andWEBCMD_GLOBAL_MEMORY=offoverrides a configured URL. No local seed service is started.The implementation keeps hosted behavior compatible, preserves local drafts and unrelated Git state, avoids repeat seed lookups once local memory exists, and records explicit post-rewrite state for the 200-line cap.
Related issue: none
Type of Change
Checklist
skill-src/, I ranmake buildand committedskills/Adapter Notes
CliErrorsubclasses instead of rawErrorVerification
Node 22.17.0:
npm test— 176 files passed; 3,332 tests passed; 1 skippednpm run typechecknpm run buildmake verifynpm run check:codex-plugingit diff --checkIndependent Claude Opus review verdict: SHIP.
Screenshots / Output
No UI changes.