## MEMORY COMPACTION RULES

Apply these at session end when thresholds are hit. No external scripts needed.

- `dbt_archive.md` > 80 items: compress the oldest 40 into a 3-line paragraph per PWA (date range + key milestones only). Keep full detail for the most recent 40.
- `parallel_sessions.md` lock history: enforce last-10 trim immediately after appending a new entry. Never let it exceed 15 rows.
- `dbt_[pwa].md`: if a PWA has had no work in 30+ days AND has no pending items, collapse to a 5-line status paragraph (SW version, last migration, stable date).
- Freshness rule: if a memory file contains file paths, function names, or version numbers and was last updated > 21 days ago, verify against current code before using.

---

## PLAYWRIGHT TEST RUNNER

Install path: /var/www/360lm/
Config: /var/www/360lm/playwright.config.js
Tests: /var/www/360lm/tests/[pwa].spec.js
Reports: /var/www/360lm/test_reports/

### Run Commands
Single PWA test (background):
  cd /var/www/360lm && npx playwright test tests/[pwa].spec.js \
  --reporter=json > test_reports/pw_[pwa]_$(date +%Y%m%d_%H%M).json 2>&1 &

All tests:
  cd /var/www/360lm && npx playwright test

Read last report:
  cat /var/www/360lm/test_reports/last_run.json

### Rules
- Always fire Playwright AFTER self-test, in background
- Use _template.spec.js as base for every new PWA test file
- If Playwright test FAILS: do not deploy to staging
- Update [pwa].spec.js whenever new form fields or
  screens are added to that PWA

## graphify

This project has a knowledge graph at graphify-out/ with god nodes, community structure, and cross-file relationships.

Rules:
- For codebase questions, first run `graphify query "<question>"` when graphify-out/graph.json exists. Use `graphify path "<A>" "<B>"` for relationships and `graphify explain "<concept>"` for focused concepts. These return a scoped subgraph, usually much smaller than GRAPH_REPORT.md or raw grep output.
- If graphify-out/wiki/index.md exists, use it for broad navigation instead of raw source browsing.
- Read graphify-out/GRAPH_REPORT.md only for broad architecture review or when query/path/explain do not surface enough context.
- After modifying code, run `graphify update .` to keep the graph current (AST-only, no API cost).
