-
Notifications
You must be signed in to change notification settings - Fork 39
feat(memory): add proactive auto-remember triggers and session distill #269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| ``` | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| **Do NOT wait for user to ask** - proactively offer to remember valuable learnings. | ||
|
|
||
| ## Inter-Agent Mailbox | ||
|
|
||
| TOON-based async communication between parallel agent sessions. | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -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? | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The first line of the required response format, "That worked!", is specific to a solution being found. However, the examples that follow correctly demonstrate that this opening phrase should be contextual (e.g., "Got it!", "Noted."). To avoid the agent using "That worked!" in inappropriate situations, consider making this line in the template more generic. "Got it." is a good, neutral alternative.
Suggested change
|
||||||
|
|
||||||
| /remember {concise, actionable description} | ||||||
|
|
||||||
| (Reply 'y' to confirm, or edit the description) | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The prompt says to “Reply 'y' to confirm”, but the documented Other Locations
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage. |
||||||
| ``` | ||||||
|
|
||||||
| ### 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) | ||||||
| ``` | ||||||
|
Comment on lines
+151
to
+169
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's an inconsistency in the examples regarding the user's ability to edit a memory. The "Required Response Format" (line 136) and the "After fixing a bug" example correctly include |
||||||
|
|
||||||
| ### 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: | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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} | ||
| ``` | ||
|
|
||
|
Comment on lines
+70
to
+75
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add blank lines around the fenced block. Codacy flags fenced blocks without blank lines before/after. Insert blank lines around the ```text block to keep the documentation lint-clean. 🧰 Tools🪛 GitHub Check: Codacy Static Code Analysis[notice] 71-71: .agent/scripts/commands/session-review.md#L71 🤖 Prompt for AI Agents |
||
| Or document in: | ||
|
Comment on lines
+70
to
+76
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The structure here, with For example, you could rephrase lines 70 and 75:
|
||
| - 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: | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The example for
USER_PREFERENCE("I'll remember you prefer tabs over spaces") is a statement of action, whereas other examples are phrased as questions (e.g., "should I save it?", "want me to remember why?"). To maintain consistency with the other examples and the goal of suggesting an action to the user, it would be better to phrase this as a question as well.