Agent Memory logo

Agent Memory

Organization
UitbreidenOS
agent-memory

Agent memory and context management: design persistent memory systems, manage context windows, implement summarization strategies, and build stateful agents that learn across sessions

Overview

PublisherUitbreidenOS
RepositoryUitKit
Skill nameagent-memory
Stars
14
Forks
5
Bundled files
Instructions only
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by UitbreidenOS on GitHub. Read the source before you install it.

Installation

Install the Agent Memory AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/UitbreidenOS/UitKit/tree/main/plugins/uitkit-ai-engineering/skills/agent-memory
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/UitbreidenOS/UitKit.git /tmp/UitKit
mkdir -p .claude/skills
cp -r /tmp/UitKit/plugins/uitkit-ai-engineering/skills/agent-memory .claude/skills/agent-memory
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Agent Memory in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Agent Memory on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Agent Memory is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Agent Memory & Context Management Skill

When to activate

  • Building agents that need to remember information across conversation turns
  • Designing systems that must work within LLM context window limits (100K-200K tokens)
  • Implementing long-term memory (vector stores, structured databases) for agents
  • Building multi-session agents that accumulate knowledge over time
  • When agent responses degrade due to context overflow or information loss
  • Designing memory hierarchies (working memory, episodic, semantic, procedural)

When NOT to use

  • Stateless one-shot completions where no memory is needed
  • Simple chatbots without domain-specific persistence requirements
  • When the conversation fits entirely within the context window with room to spare
  • Single-turn question-answering without session continuity

Instructions

1. Memory Architecture Design

Choose the appropriate memory type for each information category:

Memory TypeAnalogyUse CaseImplementation
Working MemoryShort-term RAMCurrent conversation contextContext window (system prompt + messages)
Episodic MemoryPersonal experiencesPast interactions, decisions madeVector store with timestamps
Semantic MemoryFacts & knowledgeDomain knowledge, user preferencesStructured DB or knowledge graph
Procedural MemorySkills & habitsLearned workflows, tool patternsFine-tuning or prompt templates

2. Context Window Management

Strategies for staying within token limits:

Prioritization (when context is full):

  1. System instructions (never evict)
  2. Current task context (never evict)
  3. Recent conversation turns (compress older turns)
  4. Retrieved memory (summarize or re-retrieve)
  5. Tool results (keep only relevant outputs)

Compression techniques:

  • Summarization: Replace N old messages with 1 summary message
  • Selective inclusion: Only include relevant turns based on current query
  • Rolling window: Keep last K turns + summary of everything before
  • Semantic retrieval: Instead of full history, retrieve relevant past interactions

3. Memory Read/Write Patterns

python
# Memory write: after each significant interaction
async def store_memory(agent_id: str, interaction: dict):
    """Store important information from an interaction."""
    # Extract key facts, decisions, preferences
    facts = extract_facts(interaction)
    
    # Store in appropriate memory system
    for fact in facts:
        await semantic_memory.upsert(
            agent_id=agent_id,
            content=fact.text,
            metadata={
                "type": fact.type,  # preference, decision, fact
                "source": "conversation",
                "timestamp": datetime.now(),
                "confidence": fact.confidence,
            }
        )

# Memory read: before generating response
async def recall_memories(agent_id: str, query: str, top_k: int = 10):
    """Retrieve relevant memories for the current query."""
    # Semantic search across all memory types
    episodic = await episodic_memory.search(query, top_k=5)
    semantic = await semantic_memory.search(query, top_k=5)
    
    # Rank by relevance × recency × importance
    combined = rank_memories(episodic + semantic, query)
    return combined[:top_k]

4. Summarization Strategies

Progressive summarization (best for long conversations):

Turn 1-10: Full messages in context
Turn 11-50: Summary of turns 1-10 + full turns 11-50
Turn 51-100: Summary of turns 1-50 + full turns 51-100
Turn 101+: Summary of summaries + full recent turns

Topic-based summarization:

  • Group past messages by topic
  • Summarize each topic independently
  • Include topic summaries as structured context

5. Memory Consistency & Conflicts

Handle contradictory information:

  • Timestamp precedence: Newer information overrides older
  • Confidence scoring: Higher confidence facts persist
  • Explicit contradiction detection: Flag conflicts, ask user to clarify
  • Version tracking: Keep history of changing facts (user preferences evolve)

6. Memory Persistence Patterns

File-based (simple):

json
// .agent-memory/user-123.json
{
  "preferences": {"language": "en", "style": "concise"},
  "decisions": [
    {"date": "2026-06-13", "topic": "auth", "decision": "JWT over sessions"}
  ],
  "knowledge": ["project uses FastAPI", "deployed on AWS ECS"]
}

Vector store (scalable):

  • Embed all memories with metadata
  • Retrieve top-K relevant memories per query
  • Decay old, unused memories over time

Knowledge graph (structured):

  • Entity → relationship → entity triples
  • Query by entity (all facts about user X) or relationship (all decisions about auth)

7. Context Budget Allocation

For a 200K token context window:

System prompt:          ~2K tokens  (1%)
Agent instructions:     ~3K tokens  (1.5%)
Retrieved memories:     ~5K tokens  (2.5%)
Tool descriptions:      ~5K tokens  (2.5%)
Current task context:   ~10K tokens (5%)
Conversation history:   ~170K tokens (85%)
Response generation:    ~5K tokens  (2.5%)

Adjust based on use case:

  • Memory-heavy agents: Increase memory allocation, reduce history
  • Conversation-heavy: Increase history, reduce memory
  • Tool-heavy: Increase tool descriptions, use summarization for history

Example

Building a customer support agent with memory:

yaml
memory_config:
  working_memory:
    type: context_window
    max_tokens: 8000
    strategy: rolling_window
    keep_recent: 20  # last 20 messages
  
  episodic_memory:
    type: vector_store
    provider: pinecone
    embedding: text-embedding-3-small
    store:
      - past_tickets
      - resolution_steps
      - customer_feedback
    retrieval:
      top_k: 5
      min_similarity: 0.75
      rerank: true
  
  semantic_memory:
    type: structured_db
    provider: postgresql
    store:
      - customer_preferences  # language, timezone, product tier
      - product_knowledge     # known issues, workarounds
      - agent_decisions       # escalation history, compensation given
    update_policy: upsert_on_conflict  # newer wins
  
  memory_operations:
    on_turn_complete:
      - extract_facts(turn)
      - update_semantic_memory(facts)
      - store_episodic_if_significant(turn)
    
    on_new_conversation:
      - load_customer_profile(semantic_memory)
      - recall_recent_tickets(episodic_memory, days=30)
      - inject_into_system_prompt()
    
    on_context_overflow:
      - summarize_oldest_turns(n=10)
      - replace_with_summary()
      - re_retrieve_memories(current_query)

Anti-Patterns

  • Memory bloat: Storing every detail without pruning → retrieval noise
  • Stale memory: Not updating facts when they change → incorrect responses
  • Context stuffing: Filling context with low-relevance memories → degraded performance
  • No summarization: Keeping full history until context overflow → abrupt information loss
  • Over-reliance on memory: Retrieving memories for simple queries that don't need them → latency and cost

Frequently asked questions

What does the Agent Memory AI skill do?

Agent memory and context management: design persistent memory systems, manage context windows, implement summarization strategies, and build stateful agents that learn across sessions

Why use Agent Memory on TypingMind?

Because you install it once and use it with any model. Agent Memory is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Agent Memory in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/UitbreidenOS/UitKit/tree/main/plugins/uitkit-ai-engineering/skills/agent-memory. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Agent Memory?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Agent Memory?

As many as you like. As long as a model supports skills, you can use Agent Memory with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Agent Memory AI skill free?

It is published on GitHub by UitbreidenOS. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇