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

@@ -36,6 +36,7 @@ docs/
ARCHITECTURE.md # the three-context system and boundaries
DECISIONS.md # ADRs: BYO-key, inline styles, no shadow DOM, key story, Gitea CI
TASKS.md # active contracts derived from RECOMMENDATIONS.md
MEMORY.md # curated durable knowledge; loaded every session; capped (60 lines)
EVALS.md # standing gates + failure-derived checks
LESSONS_LEARNED.md # codebase invariants (detail behind the ## Lessons list)
HANDOFF.md # current state, risks, next action
@@ -73,7 +74,7 @@ npm run test:e2e # Playwright (requires a prior `npm run build`)
npm run typecheck # tsc --noEmit
```
**Prerequisite:** Node. CI pins **Node 22** (`node:22-bookworm`). Run `npm install` before any `npm run *` — the binaries (`tsc`, `vitest`) come from `node_modules/.bin`.
**Prerequisite:** Node. CI pins **Node 22** (`node:22-bookworm`). Run `npm install` before any `npm run *` — the binaries (`tsc`, `vitest`) come from `node_modules/.bin`. Install triggers `postinstall: wxt prepare`, which generates `.wxt/types/`**typecheck fails without it** (`import.meta.env` is typed there). If a fresh clone errors with `Property 'env' does not exist on type 'ImportMeta'`, run `npx wxt prepare`.
**Load unpacked in Chrome:** `npm run build``chrome://extensions` → Developer Mode → Load unpacked → select `.output/chrome-mv3`.
@@ -138,7 +139,7 @@ Workflows live in `.gitea/workflows/`:
For coordinated work, run Fable as the main session (`claude --agent fable-orchestrator`) and let it route to specialists; see `.claude/AGENTS.md` for the roster. For LexAI code (`entrypoints/`, `src/`), prefer the **`lexai-extension-dev`** specialist over the generic `builder` — it knows the message contract, snapshot pattern, and key rules. Security-relevant changes (permissions, key path, dependencies) go through `security-auditor`.
On-demand skills in `.claude/skills/`: `resume-project`, `continuous-improvement`, `dev-loop`, `attack-surface`, `prompt-injection-audit`, `self-model-audit`. Invoke by name; keep each run bounded.
On-demand skills in `.claude/skills/`: `resume-project`, `memory-sync`, `continuous-improvement`, `dev-loop`, `attack-surface`, `prompt-injection-audit`, `self-model-audit`. Invoke by name; keep each run bounded.
## Quality gates by risk
@@ -168,8 +169,22 @@ Codebase invariants that break silently when violated (detail + evidence in `doc
- Bump `version` in both `package.json` and `wxt.config.ts`.
- Style inline; Tailwind classes do nothing until PostCSS is wired.
## Memory protocol
Project knowledge lives in layers; write each item to exactly one and link instead of duplicating:
| Layer | Holds | Written when |
| --- | --- | --- |
| `docs/MEMORY.md` | durable facts, conventions, environment quirks, key paths | a fresh agent would waste tokens rediscovering it |
| `docs/HANDOFF.md` | current state and next action only | end of every substantial task |
| `docs/DECISIONS.md` | why a choice was made | a hard-to-reverse choice is made |
| `docs/LESSONS_LEARNED.md` + `## Lessons` | verified mistakes and their preventions | a learning signal is verified |
**Context budget caps** (session-start files are a recurring token tax): `## Lessons` ≤ 12 rules, `docs/MEMORY.md` ≤ 60 entry lines, `docs/HANDOFF.md` ≤ 25 lines, `docs/TASKS.md` Active ≤ 7 contracts. When a cap is hit, run `/memory-sync` to consolidate/archive before adding — never grow past the cap.
## State continuity
- On a fresh/compacted/interrupted session, invoke `/resume-project` before planning or editing.
- Before ending a substantial task, update `docs/HANDOFF.md` (verified state, changed paths, checks, risks, next action).
- Before ending a substantial task, update `docs/HANDOFF.md` (verified state, changed paths, checks, risks, next action) and promote any durable new knowledge into `docs/MEMORY.md` per the memory protocol.
- Run `/memory-sync` at a phase change, before ending a long run, or when a capped file is full.
- After a verified recurring mistake or workflow gap, invoke `/continuous-improvement`; durable agent/skill changes go through `system-steward`.