engram-memory
npx skills add https://github.com/gentleman-programming/engram --skill engram-memory
Agent 安装分布
Skill 文档
Engram Persistent Memory â Protocol
You have access to Engram, a persistent memory system that survives across sessions and compactions. This protocol is MANDATORY and ALWAYS ACTIVE â not something you activate on demand.
PROACTIVE SAVE TRIGGERS (mandatory â do NOT wait for user to ask)
Call mem_save IMMEDIATELY and WITHOUT BEING ASKED after any of these:
After decisions or conventions
- Architecture or design decision made
- Team convention documented or established
- Workflow change agreed upon
- Tool or library choice made with tradeoffs
After completing work
- Bug fix completed (include root cause)
- Feature implemented with non-obvious approach
- Notion/Jira/GitHub artifact created or updated with significant content
- Configuration change or environment setup done
After discoveries
- Non-obvious discovery about the codebase
- Gotcha, edge case, or unexpected behavior found
- Pattern established (naming, structure, convention)
- User preference or constraint learned
Self-check â ask yourself after EVERY task:
“Did I just make a decision, fix a bug, learn something non-obvious, or establish a convention? If yes, call mem_save NOW.”
Format for mem_save:
- title: Verb + what â short, searchable (e.g. “Fixed N+1 query in UserList”, “Chose Zustand over Redux”)
- type: bugfix | decision | architecture | discovery | pattern | config | preference
- scope:
project(default) |personal - topic_key (optional but recommended for evolving topics): stable key like
architecture/auth-model - content: What: One sentence â what was done Why: What motivated it (user request, bug, performance, etc.) Where: Files or paths affected Learned: Gotchas, edge cases, things that surprised you (omit if none)
Topic update rules (mandatory)
- Different topics MUST NOT overwrite each other (example: architecture decision vs bugfix)
- If the same topic evolves, call
mem_savewith the sametopic_keyso memory is updated (upsert) instead of creating a new observation - If unsure about the key, call
mem_suggest_topic_keyfirst, then reuse that key consistently - If you already know the exact ID to fix, use
mem_update
WHEN TO SEARCH MEMORY
When the user asks to recall something â any variation of “remember”, “recall”, “what did we do”, “how did we solve”, “recordar”, “acordate”, “qué hicimos”, or references to past work:
- First call
mem_contextâ checks recent session history (fast, cheap) - If not found, call
mem_searchwith relevant keywords (FTS5 full-text search) - If you find a match, use
mem_get_observationfor full untruncated content
Also search memory PROACTIVELY when:
- Starting work on something that might have been done before
- The user mentions a topic you have no context on â check if past sessions covered it
SESSION CLOSE PROTOCOL (mandatory)
Before ending a session or saying “done” / “listo” / “that’s it”, you MUST:
- Call
mem_session_summarywith this structure:
Goal
[What we were working on this session]
Instructions
[User preferences or constraints discovered â skip if none]
Discoveries
- [Technical findings, gotchas, non-obvious learnings]
Accomplished
- [Completed items with key details]
Next Steps
- [What remains to be done â for the next session]
Relevant Files
- path/to/file â [what it does or what changed]
This is NOT optional. If you skip this, the next session starts blind.
AFTER COMPACTION
If you see a message about compaction or context reset, or if you see “FIRST ACTION REQUIRED” in your context:
- IMMEDIATELY call
mem_session_summarywith the compacted summary content â this persists what was done before compaction - Then call
mem_contextto recover any additional context from previous sessions - Only THEN continue working
Do not skip step 1. Without it, everything done before compaction is lost from memory.