memory
SKILL.md
Memory Management
Efficient context and knowledge management.
Instructions
1. Working Memory Model
┌─────────────────────────────────────────┐
│ WORKING MEMORY │
├─────────────────────────────────────────┤
│ • Current task goal │
│ • Relevant file contents │
│ • Recent decisions │
│ • Active constraints │
└─────────────────────────────────────────┘
↑ Load ↓ Store
┌─────────────────────────────────────────┐
│ LONG-TERM MEMORY │
├─────────────────────────────────────────┤
│ • Project structure │
│ • User preferences │
│ • Past solutions │
│ • Domain knowledge │
└─────────────────────────────────────────┘
2. Context Prioritization
Order of importance for context:
| Priority | Content | Action |
|---|---|---|
| 🔴 Critical | Current task, active file | Always keep |
| 🟠 High | Related files, types | Keep if relevant |
| 🟡 Medium | Project structure | Summarize |
| 🟢 Low | History, logs | Forget if needed |
3. Information Retention
## What to Remember
✅ Keep in context:
- Current task objective
- File being modified
- Type definitions in use
- Recent error messages
- User preferences
❌ Safe to forget:
- Already processed files
- Resolved errors
- Intermediate calculations
- Verbose logs
4. Context Summarization
When context grows too large:
## Summarization Rules
1. **Files**: Keep imports, types, key functions
2. **Errors**: Keep message, remove stack trace
3. **Logs**: Keep last 10 lines
4. **History**: Keep decisions, remove process
### Example
Before (verbose):
"I looked at file A, then file B, noticed pattern X,
then explored file C, found issue Y, traced it to..."
After (summarized):
"Analyzed A, B, C. Found: pattern X, issue Y in C."
5. Session State Pattern
// Conceptual session state
interface SessionMemory {
// Always retain
task: {
goal: string;
status: 'planning' | 'executing' | 'verifying';
progress: number;
};
// Retain while relevant
context: {
activeFiles: string[];
recentDecisions: string[];
constraints: string[];
};
// Summarize or forget
history: {
summary: string;
keyInsights: string[];
};
}
6. Knowledge Retrieval
## Before Starting New Task
1. Check: Have I seen this before?
2. Recall: What approach worked?
3. Apply: Use proven patterns
4. Adapt: Modify for current context
7. Memory Hygiene
## Per-Turn Cleanup
After completing a step:
1. ✅ Task still relevant? Keep
2. ❓ Might need later? Summarize
3. ❌ No longer needed? Forget
## End of Task
1. Extract learnings
2. Update knowledge base
3. Clear working memory
8. Context Window Management
## Token Budget Allocation
| Category | Budget |
|----------|--------|
| System prompt | 10% |
| Task context | 30% |
| Active code | 40% |
| Conversation | 20% |
## When Near Limit
1. Summarize conversation history
2. Remove resolved issues
3. Keep only relevant code sections
4. Preserve critical context
References
Weekly Installs
12
Repository
alicoder001/agent-skillsFirst Seen
Feb 6, 2026
Security Audits
Installed on
opencode12
gemini-cli12
github-copilot12
codex12
amp12
kimi-cli12