external/ag-shared/prompts/skills/remember/SKILL.md
/rememberSave branch-scoped context (.context/) or project-scoped learnings (.rulesync/).
Ask the user:
What would you like to remember?
Use AskUserQuestion. Then follow the corresponding path(s) below.
Save or update context for the current branch. Keep it concise — only preserve information useful for future sessions.
Run the co-located script to resolve paths and load any existing context. Use the skill base directory from the header above:
bash "<skill-base-directory>/context-path.sh" --ensure-dir
Parse the structured output:
BRANCH= — current branch nameSLUG= — filename slugCONTEXT_FILE= — full path to context fileSTATUS=found|not_found — whether context exists---CONTENT--- — existing context file contents (if found)If the context file already exists, read its current contents from the script output. When updating, prune resolved items and transient issues.
Ask the user what to save. Keep responses brief.
For new context: What's the branch intent? Any patterns worth remembering?
For updates: What changed? Any gaps resolved? New patterns discovered?
Use this minimal template:
---
branch: {branch-name}
updated: {ISO-date}
---
# {branch-name}
## Intent
{1-2 sentences: what this branch accomplishes}
## Patterns
{Only include if there are reusable code patterns}
## Gaps
{Only persistent gaps — architectural decisions, known limitations}
## References
{Links to ticket, relevant docs}
Saved: {context-file-path}
KEEP (future-relevant):
PRUNE (transient):
Extract decisions, patterns, and learnings from the current conversation and persist them as agentic memory.
Review the conversation to identify:
For each candidate, extract:
Determine the best location for each memory:
| Type | Location | When |
|---|---|---|
| Domain rule | .rulesync/rules/{domain}.md | Topic-specific guidance |
| Command enhancement | .rulesync/commands/{cmd}.md | Workflow-specific |
| Skill update | external/prompts/skills/{skill}/ | Skill-scoped learning |
| New rule file | .rulesync/rules/{new}.md | Distinct topic, 3+ guidelines |
Constraints:
.claude/ directly — .claude/ is a synced output directory; the source of truth is .rulesync/. Always propose paths under .rulesync/rules/, .rulesync/commands/, etc. Never propose .claude/rules/ or .claude/commands/.CLAUDE.md, AGENTS.md, and files with root: true frontmatter are managed separately. If a memory belongs there, recommend creating/updating a non-root rule that gets referenced instead.For each memory candidate, present to user:
Learning: [The extracted insight]
Recommended location: path/to/file.md → Section Name
Options:
Use AskUserQuestion with these options. Wait for user response before proceeding.
For approved memories:
- bullet points, match existing toneAfter processing all memories, summarise:
## Memory Update Summary
Added: N memories
Skipped: M memories
Files modified:
- path/to/file1.md (section updated)
- path/to/file2.md (new section added)
.claude/ directly — .claude/ is a synced output; the source of truth is .rulesync/. Always write to .rulesync/rules/, .rulesync/commands/, etc.CLAUDE.md, AGENTS.md, or any file with root: true in frontmatter. These are managed separately. Instead, create or update a non-root rule file that can be referenced.