|
3 | 3 | This project uses the **agentic-stack** portable brain. All memory, skills, |
4 | 4 | and protocols live in `.agent/`. |
5 | 5 |
|
6 | | -## Before doing anything |
7 | | -1. Read `.agent/AGENTS.md` — it's the map. |
8 | | -2. Read `.agent/memory/personal/PREFERENCES.md` — how the user works. |
9 | | -3. Read `.agent/memory/semantic/LESSONS.md` — what we've learned. |
10 | | -4. Read `.agent/protocols/permissions.md` — what you can and cannot do. |
| 6 | +## Session start — read in this order |
| 7 | +1. `.agent/AGENTS.md` — the map of the whole brain |
| 8 | +2. `.agent/memory/personal/PREFERENCES.md` — how the user works |
| 9 | +3. `.agent/memory/working/REVIEW_QUEUE.md` — pending lessons awaiting review |
| 10 | +4. `.agent/memory/semantic/LESSONS.md` — what we've already learned |
| 11 | +5. `.agent/protocols/permissions.md` — hard constraints, read before any tool call |
| 12 | + |
| 13 | +## Before every non-trivial action — recall first |
11 | 14 |
|
12 | | -## Before every non-trivial task — recall first |
13 | 15 | For any task involving **deploy**, **ship**, **release**, **migration**, |
14 | | -**schema change**, **timestamp** / **timezone** / **date**, **failing test**, |
15 | | -**debug**, **investigate**, or **refactor**, run recall FIRST and present |
16 | | -the surfaced lessons to yourself before acting: |
| 16 | +**schema change**, **supabase**, **edge function**, **timestamp** / |
| 17 | +**timezone** / **date**, **failing test**, **debug**, **investigate**, or |
| 18 | +**refactor**, run recall FIRST and present the results before acting: |
17 | 19 |
|
18 | 20 | ```bash |
19 | 21 | python3 .agent/tools/recall.py "<one-line description of what you're about to do>" |
20 | 22 | ``` |
21 | 23 |
|
22 | | -If the output contains a "Consulted lessons for intent:" block with one or |
23 | | -more results, show them to the user in a `Consulted lessons before acting:` |
24 | | -block and adjust your plan to respect them. If a surfaced lesson would be |
25 | | -violated by your intended action, stop and explain. |
26 | | - |
27 | | -This is how graduated lessons actually change behavior across harnesses. |
28 | | -Skip it and the system is just files on disk. |
| 24 | +Show the output in a `Consulted lessons before acting:` block. If a surfaced |
| 25 | +lesson would be violated by your intended action, stop and explain why. |
29 | 26 |
|
30 | 27 | ## While working |
31 | | -- Consult `.agent/skills/_index.md` and load the full `SKILL.md` for any |
32 | | - skill whose triggers match the task. |
33 | | -- Update `.agent/memory/working/WORKSPACE.md` as the task evolves. |
34 | | -- Log significant actions to `.agent/memory/episodic/AGENT_LEARNINGS.jsonl` |
35 | | - via `.agent/tools/memory_reflect.py`. |
36 | | -- Quick state check any time: `python3 .agent/tools/show.py`. |
37 | | -- Teach the agent a new rule in one shot: |
38 | | - `python3 .agent/tools/learn.py "<the rule>" --rationale "<why>"`. |
39 | | - |
40 | | -## Rules that override defaults |
| 28 | + |
| 29 | +### Skills |
| 30 | +Read `.agent/skills/_index.md` and load the full `SKILL.md` for any skill |
| 31 | +whose triggers match the task. Don't skip this — skills carry constraints |
| 32 | +the permissions file doesn't cover. |
| 33 | + |
| 34 | +### Workspace |
| 35 | +Update `.agent/memory/working/WORKSPACE.md` when: |
| 36 | +- You start a new task (write the goal and first step) |
| 37 | +- Your hypothesis changes |
| 38 | +- You complete or abandon a task (clear it so the next session is clean) |
| 39 | + |
| 40 | +### Brain state |
| 41 | +Quick overview any time: |
| 42 | +```bash |
| 43 | +python3 .agent/tools/show.py |
| 44 | +``` |
| 45 | + |
| 46 | +### Teaching the agent a new rule |
| 47 | +When you discover something that should never happen again: |
| 48 | +```bash |
| 49 | +python3 .agent/tools/learn.py "<the rule, phrased as a principle>" \ |
| 50 | + --rationale "<why — include the incident that taught you this>" |
| 51 | +``` |
| 52 | + |
| 53 | +## Manual memory logging — when and how |
| 54 | + |
| 55 | +The PostToolUse hook captures every tool call automatically, but its |
| 56 | +reflections are mechanical. For **significant events** you must call |
| 57 | +`memory_reflect.py` explicitly with a rich `--note`. These are the entries |
| 58 | +the dream cycle promotes into lessons. |
| 59 | + |
| 60 | +### When to log manually |
| 61 | +- After completing a major feature or fixing a bug that took real investigation |
| 62 | +- After any rollback, incident, or unexpected failure |
| 63 | +- After any architectural decision (why you chose approach A over B) |
| 64 | +- After discovering a project-specific constraint (e.g. "this table has a |
| 65 | + trigger that fires on every insert — don't bulk insert") |
| 66 | +- After a Supabase migration, RLS policy change, or edge function deploy |
| 67 | +- Any time you think "I wish I had known this an hour ago" |
| 68 | + |
| 69 | +### How to write a good entry |
| 70 | + |
| 71 | +```bash |
| 72 | +# Good: specific, domain-rich, future-oriented |
| 73 | +python3 .agent/tools/memory_reflect.py \ |
| 74 | + "supabase-migration" \ |
| 75 | + "applied add_user_tier_column migration" \ |
| 76 | + "migration succeeded; 847 rows backfilled to tier=free" \ |
| 77 | + --importance 8 \ |
| 78 | + --note "RLS policy on user_profiles must be updated whenever a new column is added that affects row visibility. Missed this, caused 401s in staging for 20 minutes." |
| 79 | + |
| 80 | +# Good: failure with root cause |
| 81 | +python3 .agent/tools/memory_reflect.py \ |
| 82 | + "edge-function" \ |
| 83 | + "deployed notify-on-signup" \ |
| 84 | + "deploy failed: missing RESEND_API_KEY in production env" \ |
| 85 | + --fail \ |
| 86 | + --importance 9 \ |
| 87 | + --note "Production env vars for edge functions must be set in supabase secrets, not .env. The .env file is ignored at deploy time." |
| 88 | + |
| 89 | +# Bad: vague, no content words for clustering |
| 90 | +python3 .agent/tools/memory_reflect.py \ |
| 91 | + "claude-code" "did stuff" "ok" --importance 3 |
| 92 | +``` |
| 93 | + |
| 94 | +### Importance guide |
| 95 | +| Value | When | |
| 96 | +|---|---| |
| 97 | +| 9–10 | Production incident, data migration, rollback, security issue | |
| 98 | +| 7–8 | Deploy, schema change, architectural decision, non-obvious constraint | |
| 99 | +| 5–6 | Refactor, significant bug fix, API contract change | |
| 100 | +| 3–4 | Routine edit, file creation, test run | |
| 101 | + |
| 102 | +## Rules that override all defaults |
41 | 103 | - Never force push to `main`, `production`, or `staging`. |
42 | 104 | - Never delete episodic or semantic memory entries — archive them. |
43 | | -- Never modify `.agent/protocols/permissions.md`. |
| 105 | +- Never modify `.agent/protocols/permissions.md` — only humans edit it. |
| 106 | +- Never hand-edit `.agent/memory/semantic/LESSONS.md` — use `graduate.py`. |
| 107 | +- If `REVIEW_QUEUE.md` shows pending > 10 or oldest > 7 days, review |
| 108 | + candidates before starting substantive work. |
0 commit comments