|
1 | 1 | --- |
2 | | -name: context-optimizer |
| 2 | +name: agent-context-optimizer |
3 | 3 | description: "Keep AI agents from forgetting. Keep context small. Use when: (1) building multi-agent systems, (2) context window overflow, (3) agents forget between sessions, (4) need memory sync across agents. Hot layer (<500 tokens) + cold layer (vector search) + auto decisions. Zero memory loss." |
4 | 4 | --- |
5 | 5 |
|
@@ -167,3 +167,44 @@ const enhancedPrompt = hotContext + "\n\n" + newMessage; |
167 | 167 | const stats = optimizer.getStats(); |
168 | 168 | console.log(stats.decisionsCount); // Number of decisions tracked |
169 | 169 | ``` |
| 170 | + |
| 171 | +--- |
| 172 | + |
| 173 | +## ⚠️ Important: Behavioral Integration Required |
| 174 | + |
| 175 | +**This skill is a tool. It does NOT auto-trigger.** |
| 176 | + |
| 177 | +The skill provides the engine (`ContextOptimizer`) and the startup helper (`onAgentStartup`), but the agent must be configured to actually CALL these functions. |
| 178 | + |
| 179 | +### What YOU Must Do (Agent Configuration) |
| 180 | + |
| 181 | +**1. Add to SOUL.md (or AGENTS.md) startup rules:** |
| 182 | +```markdown |
| 183 | +## 🔄 Memory Recovery (Mandatory on Every Wake) |
| 184 | + |
| 185 | +On first message of each session: |
| 186 | +1. Call `memory_search()` to retrieve relevant memories |
| 187 | +2. Call `onAgentStartup('agent-name')` to build hot context |
| 188 | +3. Inject hot context into current session |
| 189 | +4. If context exists, use it; otherwise, start fresh |
| 190 | +``` |
| 191 | + |
| 192 | +**2. Add to HEARTBEAT.md (end-of-session rules):** |
| 193 | +```markdown |
| 194 | +## After Each Session |
| 195 | +- Call `optimizer.summarize(conversationHistory)` |
| 196 | +- Call `sidecarUpdater.onSessionComplete()` |
| 197 | +``` |
| 198 | + |
| 199 | +### Why This Matters |
| 200 | + |
| 201 | +- **Without integration**: Agent reads the skill file but never calls it → context loss continues |
| 202 | +- **With integration**: Agent explicitly calls the tool → hot layer stays under 500 tokens |
| 203 | + |
| 204 | +### Real-World Lesson (2026-04-03) |
| 205 | + |
| 206 | +> Even with the skill installed and SOUL.md rules written, if the agent doesn't EXPLICITLY call `memory_search` on wake, the memory system fails. The tool + the rule + the execution = all three required. |
| 207 | +
|
| 208 | +### GitHub PR |
| 209 | + |
| 210 | +This skill was submitted to [MiniMax-AI/skills PR #58](https://github.com/MiniMax-AI/skills/pull/58). The skill itself is complete; integration is the implementer's responsibility. |
0 commit comments