diff --git a/.agent/AGENTS.md b/.agent/AGENTS.md index fe5b4fb921..ac296f144a 100644 --- a/.agent/AGENTS.md +++ b/.agent/AGENTS.md @@ -95,6 +95,27 @@ Cross-session SQLite FTS5 memory. Commands: `/remember {content}`, `/recall {que **Full docs**: `memory/README.md` +### MANDATORY: Proactive Memory Triggers + +**You MUST suggest `/remember` when you detect these patterns:** + +| Trigger | Memory Type | Example | +|---------|-------------|---------| +| Solution found after debugging | `WORKING_SOLUTION` | "That fixed it! Want me to remember this?" | +| User states a preference | `USER_PREFERENCE` | "I'll remember you prefer tabs over spaces" | +| Workaround discovered | `WORKING_SOLUTION` | "This workaround worked - should I save it?" | +| Failed approach identified | `FAILED_APPROACH` | "That didn't work - remember to avoid this?" | +| Architecture decision made | `DECISION` | "Good decision - want me to remember why?" | +| Tool configuration worked | `TOOL_CONFIG` | "That config worked - save for next time?" | + +**Format**: After detecting a trigger, suggest: + +```text +Want me to remember this? /remember {concise description} +``` + +**Do NOT wait for user to ask** - proactively offer to remember valuable learnings. + ## Inter-Agent Mailbox TOON-based async communication between parallel agent sessions. diff --git a/.agent/scripts/commands/remember.md b/.agent/scripts/commands/remember.md index 08b9203956..d64f5e5eee 100644 --- a/.agent/scripts/commands/remember.md +++ b/.agent/scripts/commands/remember.md @@ -109,21 +109,72 @@ AI: Storing memory: 1. Confirm 2. Change type 3. Edit 4. Cancel ``` -## Auto-Remember Triggers +## Auto-Remember Triggers (MANDATORY) -AI assistants should proactively suggest `/remember` when: +AI assistants **MUST** proactively suggest `/remember` when detecting these patterns: -1. A solution is found after debugging -2. User explicitly states a preference -3. A workaround is discovered for a tool limitation -4. An architecture decision is made -5. A failed approach is identified +### Conversation Pattern Detection +| User Says | Trigger Type | Memory Type | +|-----------|--------------|-------------| +| "that fixed it", "it works now", "solved" | Solution found | `WORKING_SOLUTION` | +| "I prefer", "I like", "always use", "never use" | Preference stated | `USER_PREFERENCE` | +| "don't do X", "X doesn't work", "avoid X" | Failed approach | `FAILED_APPROACH` | +| "let's go with", "decided to", "we'll use" | Decision made | `DECISION` | +| "the trick is", "workaround", "hack" | Workaround found | `WORKING_SOLUTION` | +| "configure X as", "set X to", "X needs Y" | Tool config | `TOOL_CONFIG` | + +### Required Response Format + +When a trigger is detected, immediately offer: + +```text +That worked! Want me to remember this for future sessions? + +/remember {concise, actionable description} + +(Reply 'y' to confirm, or edit the description) +``` + +### Examples + +**After fixing a bug:** ```text -AI: That fixed it! Want me to remember this solution for future sessions? - /remember {suggested content} +User: Adding --legacy-peer-deps fixed the npm install +AI: That worked! Want me to remember this for future sessions? + + /remember Use --legacy-peer-deps flag when npm install fails with peer dependency conflicts + + (Reply 'y' to confirm, or edit the description) ``` +**When user states preference:** +```text +User: I always use pnpm instead of npm +AI: Got it! Want me to remember this preference? + + /remember User prefers pnpm over npm for package management + + (Reply 'y' to confirm) +``` + +**After failed approach:** +```text +User: That approach with setTimeout didn't work at all +AI: Noted. Want me to remember to avoid this approach? + + /remember Avoid using setTimeout for async coordination - use proper async/await or Promises instead + + (Reply 'y' to confirm) +``` + +### Do NOT Wait + +- Do NOT wait for user to explicitly ask to remember +- Do NOT skip the suggestion if the learning seems minor +- DO suggest immediately when pattern is detected +- DO make the suggestion concise and actionable + ## Storage Location Memories are stored in SQLite with FTS5 for fast search: diff --git a/.agent/scripts/commands/session-review.md b/.agent/scripts/commands/session-review.md index eb124095d3..8a45c54b0d 100644 --- a/.agent/scripts/commands/session-review.md +++ b/.agent/scripts/commands/session-review.md @@ -45,22 +45,41 @@ Verify aidevops best practices: | TODO tracking | Tasks logged appropriately | Recommended | | Quality checks | Linters run before commit | Recommended | -### Step 4: Identify Knowledge to Capture +### Step 4: Auto-Distill Session Learnings -Look for learnings that should be preserved: +**MANDATORY**: Run session distillation to automatically extract and store learnings: + +```bash +~/.aidevops/agents/scripts/session-distill-helper.sh auto +``` + +This will: +1. Analyze git commits for patterns (fixes, features, refactors) +2. Extract learnings with appropriate types (ERROR_FIX, WORKING_SOLUTION, etc.) +3. Store them to memory automatically + +### Step 5: Identify Additional Knowledge to Capture + +After auto-distill, look for learnings that may have been missed: 1. **Corrections Made**: Did the AI make mistakes that were corrected? 2. **New Patterns**: Were new approaches discovered? 3. **Tool Issues**: Did any tools not work as expected? 4. **User Preferences**: Did the user express preferences? -For each learning, suggest where to document: +For each additional learning, suggest: + +```text +/remember {concise description of learning} +``` + +Or document in: - Agent improvements → `@agent-review` - Code patterns → Code comments or docs - User preferences → `memory/` files - Temporary workarounds → TODO.md -### Step 5: Session Health Assessment +### Step 6: Session Health Assessment Determine recommendation: