feat: Enhance project memory and skills documentation; add memory-sync skill for knowledge consolidation
All checks were successful
CI — Test & Build / Test & Build (push) Successful in 1m15s

This commit is contained in:
john kevin asprec
2026-07-15 16:01:13 +08:00
parent acea99d7ad
commit c2ca659a2b
13 changed files with 123 additions and 17 deletions

View File

@@ -19,6 +19,7 @@
- `entrypoints/content.ts` — fixed unbounded document-listener leak: `showToolbar` added `click`/`scroll` listeners per selection and never removed them; now unregistered in `hideToolbar` (also closes an orphaned More-menu). Error toast gained `data-lexai`; mouseup threshold now uses `MIN_SELECTION_LENGTH` (was hardcoded `<= 10`, which ate exactly-10-char selections); same sender guard on its listener.
- `src/lib/providers.ts``callProvider` guards `res.json()` so non-JSON gateway errors (HTML 502) surface as `"<Provider> error: HTTP <status>"` instead of a raw SyntaxError.
- Verified: typecheck clean, 54/54 tests (6 new: 4 migration, 1 non-JSON error, plus existing), build clean (280.3 kB). `security-auditor` reviewed the key-path diff: PASS; its two P3 hardening notes (await encKey persistence, concurrent-save re-check) were implemented and re-gated. User-text privacy audited clean: no persistence of analyzed text, debug logs dev-gated, key/text travel only to the chosen provider. Real-page load-unpacked check of toolbar/replace still recommended (DOM-timing paths untouched except listener cleanup).
- **CI fix + workflow hardening (2026-07-15):** CI typecheck failed on push (`content.ts(10,31) TS2339: Property 'env' does not exist on type 'ImportMeta'`) because `.wxt/types/` (which types `import.meta.env`) is generated by `wxt prepare`, which CI never ran — locally it existed as a side effect of `wxt build`/`dev`. Reproduced locally by deleting `.wxt/`. Fixes: `postinstall: wxt prepare` in package.json (root fix — every fresh install regenerates types); explicit "Prepare WXT types" step in both workflows (survives a future `--ignore-scripts`); `deploy-chrome.yml` now runs **typecheck** before tests (release previously gated less than CI); fixed `head -1``sed '$d'` body extraction in both curl-response checks (body is all-but-last-line, not first line); added `timeout-minutes` (15 CI / 20 deploy). Verified: fresh install regenerates `.wxt`, then typecheck + 54/54 tests + build all green. CLAUDE.md Commands section documents the gotcha.
- **Changed paths (this alignment):** added `docs/` (brief, architecture, decisions, tasks, evals, lessons, handoff, self-model, attacksurface), ported `.claude/agents/*` roster + `.claude/skills/*`, kept `lexai-extension-dev`, updated `.claude/AGENTS.md`. `CLAUDE.md` restructured to the operating-system format (all original LexAI rules preserved).
- **Open risks (ranked):**
1. `<all_urls>` host permission — privacy surface + CWS review blocker (TASKS #1).

49
docs/MEMORY.md Normal file
View File

@@ -0,0 +1,49 @@
# Project memory — LexAI
> Curated long-term knowledge that must survive sessions, compaction, and agent turnover. Loaded at every session start alongside `HANDOFF.md`. **Hard cap: 60 lines of entries.** When full, the `memory-sync` skill consolidates or archives before adding. Facts only — state goes in `HANDOFF.md`, mistakes in `LESSONS_LEARNED.md`, choices in `DECISIONS.md`.
## Verified facts
Durable, evidence-backed truths about this project (domain rules, invariants, external realities).
- No backend: the background service worker is the only context that calls provider APIs; the user's key never leaves the extension except to the chosen provider.
## Conventions
How this codebase does things (naming, structure, patterns a new agent must follow).
- UI is inline style objects (dark Catppuccin-ish palette); Tailwind is installed but inactive.
- Each provider is duplicated as `callX` + `callXWithPrompt` — change both until T-04 refactors the layer.
## Environment quirks
Non-obvious facts about tooling, commands, CI, or the operator's machine that repeatedly cost time to rediscover.
- `node_modules` is gitignored and absent by default — run `npm install` before any `npm run *`.
- CI is Gitea (`.gitea/workflows/`), Node 22 pinned. Version must match in `package.json` and `wxt.config.ts`.
## Key paths and entry points
| What | Where |
| --- | --- |
| Content script (selection, toolbar, replace) | `entrypoints/content.ts` |
| Background LLM proxy (providers, key decrypt) | `entrypoints/background.ts` |
| Options (provider/model/key + encrypt) | `entrypoints/options/Options.tsx` |
| Popup (standalone analyze) | `entrypoints/popup/Popup.tsx` |
| Task list (from RECOMMENDATIONS) | `docs/TASKS.md` |
## Expiring notes
Short-lived knowledge with an explicit expiry; `memory-sync` deletes past-due entries.
- _None yet. Format: `[YYYY-MM-DD expires] note`_
## Consolidation log
| Date | Action | Reason |
| --- | --- | --- |
| 2026-07-15 | Seeded initial facts, conventions, quirks, key paths | memory layer added |
---
*Write rules: one line per entry, evidence-backed, no secrets/personal data/transcripts. Every entry must answer "would a fresh agent waste tokens rediscovering this?" — if no, it doesn't belong here.*