context-memory

Advanced context and memory management system for AI agents. Provides persistent memory across sessions through daily logs (memory/YYYY-MM-DD.md), long-term curated memory (MEMORY.md), conversation archives with semantic search, and automatic behavioral learning from user satisfaction tracking. Use when you need to: (1) Remember information across sessions, (2) Archive conversations before context loss, (3) Search past discussions, (4) Track and learn from user satisfaction patterns, (5) Maintain session continuity, (6) Implement proactive memory maintenance. Includes conversation-archiver.py and satisfaction-tracker.py scripts, session startup routines, and periodic reflection workflows.

16 stars

Best use case

context-memory is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Advanced context and memory management system for AI agents. Provides persistent memory across sessions through daily logs (memory/YYYY-MM-DD.md), long-term curated memory (MEMORY.md), conversation archives with semantic search, and automatic behavioral learning from user satisfaction tracking. Use when you need to: (1) Remember information across sessions, (2) Archive conversations before context loss, (3) Search past discussions, (4) Track and learn from user satisfaction patterns, (5) Maintain session continuity, (6) Implement proactive memory maintenance. Includes conversation-archiver.py and satisfaction-tracker.py scripts, session startup routines, and periodic reflection workflows.

Teams using context-memory should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/context-memory/SKILL.md --create-dirs "https://raw.githubusercontent.com/diegosouzapw/awesome-omni-skill/main/skills/development/context-memory/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/context-memory/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How context-memory Compares

Feature / Agentcontext-memoryStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Advanced context and memory management system for AI agents. Provides persistent memory across sessions through daily logs (memory/YYYY-MM-DD.md), long-term curated memory (MEMORY.md), conversation archives with semantic search, and automatic behavioral learning from user satisfaction tracking. Use when you need to: (1) Remember information across sessions, (2) Archive conversations before context loss, (3) Search past discussions, (4) Track and learn from user satisfaction patterns, (5) Maintain session continuity, (6) Implement proactive memory maintenance. Includes conversation-archiver.py and satisfaction-tracker.py scripts, session startup routines, and periodic reflection workflows.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Context & Memory System

A comprehensive memory management system that gives AI agents persistent context and continuous learning capabilities.

## What This Skill Provides

1. **Persistent Memory Architecture** - Multi-tier memory system (daily logs, long-term memory, conversation archives)
2. **Conversation Archive & Search** - Save and semantically search past conversations
3. **Satisfaction Tracking** - Learn from user reactions and behavioral patterns
4. **Auto-Reflection** - Daily summaries and behavioral insights
5. **Session Startup Routines** - Load context at the beginning of each session
6. **Memory Maintenance Workflows** - Periodic review and consolidation

## Quick Start

### 1. Setup Directory Structure

```bash
mkdir -p memory/conversations memory/satisfaction-insights
```

### 2. Create Core Files

See `references/templates.md` for templates:
- `MEMORY.md` - Long-term curated memory
- `LEARNING.md` - Behavioral insights (auto-generated)
- `memory/YYYY-MM-DD.md` - Today's daily log
- `memory/heartbeat-state.json` - Periodic check state

### 3. Configure Workspace

```bash
# Optional: Set workspace path (defaults to current directory)
export OPENCLAW_WORKSPACE=/path/to/your/workspace
```

### 4. Session Startup Routine

At the start of each session, read these files in order:
1. `SOUL.md` (if exists) - Who you are
2. `USER.md` (if exists) - Who you're helping
3. `LEARNING.md` - Behavioral insights
4. `memory/YYYY-MM-DD.md` (today + yesterday)
5. `MEMORY.md` - **Only in main session** (not in group chats)

## Core Workflows

### Archive Conversations

Before context compaction or topic switches:

```bash
python3 scripts/conversation-archiver.py archive '<messages_json>' '<topic>' '<summary>'
```

Search archived conversations:

```bash
python3 scripts/conversation-archiver.py search "keyword"
python3 scripts/conversation-archiver.py get <conv_id>
```

### Track Satisfaction

Record user reactions:

```bash
python3 scripts/satisfaction-tracker.py record "positive" "context" "user message" "my response" "analysis"
```

Signals: `negative`, `positive`, `interested`

Generate daily insights:

```bash
python3 scripts/satisfaction-tracker.py daily-summary
python3 scripts/satisfaction-tracker.py update-learning
```

### Memory Maintenance

Periodically (every few days):
1. Read recent `memory/YYYY-MM-DD.md` files
2. Identify significant events/learnings
3. Update `MEMORY.md` with distilled wisdom
4. Remove outdated information

## Security Model

**MEMORY.md is private** - Only load in main session (direct chats with your human):
- ✅ Load in: One-on-one conversations, private sessions
- ❌ Don't load in: Group chats, shared contexts, public channels

This prevents leaking personal context to other users.

## Memory Philosophy

**Files > Brain** - Memory doesn't survive session restarts. Files do.

- Daily logs = raw notes
- MEMORY.md = curated wisdom
- No "mental notes" - write everything down immediately
- Archive before losing context
- Review and consolidate periodically

## Detailed Documentation

- **Memory Guidelines:** `references/memory-guidelines.md` - Complete workflow documentation
- **Templates:** `references/templates.md` - File templates and directory structure

## Script Reference

### conversation-archiver.py

Archive conversation blocks with topics and summaries:

```bash
# Archive a conversation
conversation-archiver.py archive '<messages_json>' [topic] [summary]

# Search conversations
conversation-archiver.py search <query> [topic]

# Retrieve full conversation
conversation-archiver.py get <conv_id>

# List topics
conversation-archiver.py topics
```

**Environment:**
- Workspace: `OPENCLAW_WORKSPACE` (default: current directory)
- Archive location: `memory/conversations/`

### satisfaction-tracker.py

Track satisfaction and generate behavioral insights:

```bash
# Record an incident
satisfaction-tracker.py record <signal> <context> <user_msg> <my_response> [analysis]

# Analyze patterns
satisfaction-tracker.py analyze [days]

# Generate daily summary
satisfaction-tracker.py daily-summary

# Update LEARNING.md
satisfaction-tracker.py update-learning
```

**Environment:**
- Workspace: `OPENCLAW_WORKSPACE` (default: current directory)
- Output: `memory/satisfaction-insights/`, `LEARNING.md`

## Integration with OpenClaw

### Semantic Search

Use built-in tools before answering questions about history:

```
1. memory_search - Search MEMORY.md + memory/*.md semantically
2. memory_get - Retrieve specific snippets by path/lines
```

### Cron Jobs

Schedule daily reflection (example):

```json
{
  "name": "Daily satisfaction reflection",
  "schedule": {"kind": "cron", "expr": "0 23 * * *", "tz": "UTC"},
  "payload": {
    "kind": "systemEvent",
    "text": "Run satisfaction-tracker.py daily-summary and update-learning"
  },
  "sessionTarget": "main",
  "enabled": true
}
```

### Heartbeats

Use heartbeat polls for:
- Memory maintenance (review and consolidate)
- Periodic checks (track in `memory/heartbeat-state.json`)
- Proactive context updates

## When to Archive

- **Before context compaction** - Save conversations before pruning
- **Topic switches** - When conversation shifts to new subject
- **User request** - "Remember this" or "save this conversation"
- **End of session** - Preserve important discussions

## Active Learning Loop

1. **Track** - Record satisfaction signals during interactions
2. **Analyze** - Daily summaries identify patterns
3. **Learn** - Update LEARNING.md with insights
4. **Apply** - Read LEARNING.md on startup, adjust behavior
5. **Repeat** - Continuous improvement cycle

## Tips for Success

- **Start simple** - Begin with MEMORY.md and daily logs only
- **Build habits** - Update daily logs as events happen, not at end of day
- **Review regularly** - Use heartbeats for periodic maintenance
- **Trust the system** - Write everything down, don't rely on memory
- **Archive proactively** - Before context loss, not after
- **Consolidate wisely** - Promote only significant items to MEMORY.md

---

**Note:** This skill provides the infrastructure. Customize templates and workflows to match your specific needs and preferences.

Related Skills

contextui

16
from diegosouzapw/awesome-omni-skill

Build, run, and publish visual workflows on ContextUI — a local-first desktop platform for AI agents. Create React TSX workflows (dashboards, tools, apps, visualizations), manage local Python backend servers, test workflows via scoped UI automation within the ContextUI app window, and optionally publish to the ContextUI Exchange. All tools operate locally on the user's machine under standard OS permissions — no remote execution or privilege escalation. Python backends bind to localhost. See SECURITY.md for the full capability scope and trust model. Requires ContextUI installed locally and MCP server configured.

contextual-pattern-learning

16
from diegosouzapw/awesome-omni-skill

Advanced contextual pattern recognition with project fingerprinting, semantic similarity analysis, and cross-domain pattern matching for enhanced learning capabilities

context7

16
from diegosouzapw/awesome-omni-skill

Fetch up-to-date library documentation via Context7 REST API. Use when needing current API docs, framework patterns, or code examples for any library. Use when user asks about React, Next.js, Prisma, Express, Vue, Angular, Svelte, or any npm/PyPI package. Use when user says 'how do I use X library', 'what's the API for Y', or needs official documentation. Lightweight alternative to Context7 MCP with no persistent context overhead.

context7-usage

16
from diegosouzapw/awesome-omni-skill

Patterns for using Context7 MCP for library documentation (v2.25)

context7-efficient

16
from diegosouzapw/awesome-omni-skill

Token-efficient library documentation fetcher using Context7 MCP with 86.8% token savings through intelligent shell pipeline filtering. Fetches code examples, API references, and best practices for JavaScript, Python, Go, Rust, and other libraries. Use when users ask about library documentation, need code examples, want API usage patterns, are learning a new framework, need syntax reference, or troubleshooting with library-specific information. Triggers include questions like "Show me React hooks", "How do I use Prisma", "What's the Next.js routing syntax", or any request for library/framework documentation.

context7-docs

16
from diegosouzapw/awesome-omni-skill

Fetch official library docs via Context7 MCP. Use for Tailwind CSS docs (grid, responsive variants), React, Next.js, Vue, MCP, OpenCode, or any npm library. Always use before external web search.

context7-auto-research

16
from diegosouzapw/awesome-omni-skill

Automatically fetch latest library/framework documentation for Claude Code via Context7 API

context-optimization

16
from diegosouzapw/awesome-omni-skill

Apply compaction, masking, and caching strategies

context-engineering

16
from diegosouzapw/awesome-omni-skill

Use when starting a new session, when agent output quality degrades, when switching between tasks, or when you need to configure rules files and context for a project.

context-driven-development

16
from diegosouzapw/awesome-omni-skill

Use this skill when working with Conductor's context-driven development methodology, managing project context artifacts, or understanding the relationship between product.md, tech-stack.md, and...

context-detector

16
from diegosouzapw/awesome-omni-skill

Detect project language, framework, and existing conventions. Use when creating workflows to adapt generated artifacts to match project patterns.

context-detection

16
from diegosouzapw/awesome-omni-skill

Automatically detect project tech stack, frameworks, and development context