Curated Claude Code catalog
Updated 07.05.2026 · 19:39 CET
01 / Skill
vectorize-io

hindsight

Quality
9.0

Hindsight is an advanced agent memory system designed to enable AI agents to learn and evolve beyond simple conversation recall. It excels in long-term memory tasks, providing state-of-the-art performance for building smarter, more adaptive AI employees and conversational agents.

USP

Unlike traditional RAG or knowledge graph systems, Hindsight focuses on enabling agents to truly learn and adapt, not just remember, delivering benchmark-leading accuracy for long-term memory tasks. It offers flexible integration via an LL…

Use cases

  • 01Enabling AI agents to learn and adapt over time
  • 02Building smarter conversational AI and AI employees
  • 03Personalizing chatbots with per-user memories
  • 04Automating complex tasks requiring long-term context
  • 05Architecting memory solutions for AI applications

Detected files (9)

  • skills/hindsight-local/SKILL.mdskill
    Show content (4489 bytes)
    ---
    name: hindsight-local
    description: Store user preferences, learnings from tasks, and procedure outcomes. Use to remember what works and recall context before new tasks. (user)
    ---
    
    # Hindsight Memory Skill (Local)
    
    You have persistent memory via the `hindsight-embed` CLI. **Proactively store learnings and recall context** to provide better assistance.
    
    ## Setup Check (First-Time Only)
    
    Before using memory commands, verify Hindsight is configured:
    
    ```bash
    uvx hindsight-embed daemon status
    ```
    
    **If this fails or shows "not configured"**, run the interactive setup:
    
    ```bash
    uvx hindsight-embed configure
    ```
    
    This will prompt for an LLM provider and API key. After setup, the commands below will work.
    
    ## How Hindsight Works
    
    When you call `retain`, Hindsight does **not** store the string as-is. The server runs an internal pipeline that:
    
    1. **Extracts structured facts** from the content using an LLM
    2. **Identifies entities** (people, tools, concepts) and links related facts
    3. **Builds temporal and causal relationships** between facts
    4. **Generates embeddings** for semantic search
    
    This means you should pass **rich, full-context content** — the server is better at extracting what matters than a pre-summarized string. Your job is to decide **when** to store, not **what** to extract.
    
    ## Commands
    
    ### Store a memory
    
    Use `memory retain` to store what you learn. Pass the full context — raw observations, session notes, conversation excerpts, or detailed descriptions:
    
    ```bash
    uvx hindsight-embed memory retain default "User is working on a TypeScript project. They enabled strict mode and prefer explicit type annotations over inference."
    uvx hindsight-embed memory retain default "Ran the test suite with NODE_ENV=test. Tests pass. Without NODE_ENV=test, the suite fails with a missing config error." --context procedures
    uvx hindsight-embed memory retain default "Build failed on Node 18 with error 'ERR_UNSUPPORTED_ESM_URL_SCHEME'. Switched to Node 20 and build succeeded." --context learnings
    ```
    
    You can also pass a raw conversation transcript with timestamps:
    
    ```bash
    uvx hindsight-embed memory retain default "[2026-03-16T10:12:03] User: The auth tests keep failing on CI but pass locally. Any idea?
    [2026-03-16T10:12:45] Assistant: Let me check the CI logs. Looks like the tests are running without the TEST_DATABASE_URL env var set — they fall back to the production DB URL and hit a connection timeout.
    [2026-03-16T10:13:20] User: Ah right, I never added that to the CI secrets. Adding it now.
    [2026-03-16T10:15:02] User: That fixed it. All green now." --context learnings
    ```
    
    ### Recall memories
    
    Use `memory recall` BEFORE starting tasks to get relevant context:
    
    ```bash
    uvx hindsight-embed memory recall default "user preferences for this project"
    uvx hindsight-embed memory recall default "what issues have we encountered before"
    ```
    
    ### Reflect on memories
    
    Use `memory reflect` to synthesize context:
    
    ```bash
    uvx hindsight-embed memory reflect default "How should I approach this task based on past experience?"
    ```
    
    ## IMPORTANT: When to Store Memories
    
    **Always store** after you learn something valuable:
    
    ### User Preferences
    - Coding style (indentation, naming conventions, language preferences)
    - Tool preferences (editors, linters, formatters)
    - Communication preferences
    - Project conventions
    
    ### Procedure Outcomes
    - Steps that successfully completed a task
    - Commands that worked (or failed) and why
    - Workarounds discovered
    - Configuration that resolved issues
    
    ### Learnings from Tasks
    - Bugs encountered and their solutions
    - Performance optimizations that worked
    - Architecture decisions and rationale
    - Dependencies or version requirements
    
    ## IMPORTANT: When to Recall Memories
    
    **Always recall** before:
    - Starting any non-trivial task
    - Making decisions about implementation
    - Suggesting tools, libraries, or approaches
    - Writing code in a new area of the project
    
    ## Best Practices
    
    1. **Store immediately**: When you discover something, store it right away
    2. **Pass rich context**: Include full observations, not pre-summarized strings — the server extracts facts automatically
    3. **Include outcomes**: Store what happened AND why, including failures and workarounds
    4. **Recall first**: Always check for relevant context before starting work
    5. **Use `--context` for metadata**: The `--context` flag labels the type of memory (e.g., `procedures`, `learnings`, `preferences`), not a replacement for full content
    
  • hindsight-integrations/claude-code/skills/create-agent/SKILL.mdskill
    Show content (4020 bytes)
    ---
    name: create-agent
    description: Create a new Hindsight-powered subagent with long-term memory. Use when the user wants a specialized agent that learns and remembers across sessions.
    allowed-tools: Bash(ls ~/.self-driving-agents/*) Bash(cat ~/.self-driving-agents/*) Write mcp__hindsight__*
    ---
    
    # Create Hindsight Agent
    
    Create a new subagent with long-term memory powered by Hindsight.
    
    ## Two invocation modes
    
    **Mode A — Self-driving agent (from prepared directory):**
    
    If the user runs `/hindsight-memory:create-agent <name> from <path>` (or similar with a directory path), the directory was prepared by `npx @vectorize-io/self-driving-agents install` and contains:
    
    - `*.md`, `*.txt`, `*.html`, `*.json`, `*.csv`, `*.xml` — seed content files (recursively)
    - `bank-template.json` (optional) — defines exact mental models to create
    
    In this mode:
    1. Read `bank-template.json` if present — note the `mental_models` array
    2. Ingest each content file (NOT bank-template.json) using `agent_knowledge_ingest_file`
    3. Create knowledge pages:
       - If `bank-template.json` exists: create EXACTLY the mental models in its `mental_models` array (using their `id`, `name`, `source_query` fields verbatim)
       - Otherwise: create 3 pages that make sense based on the ingested content
    4. Write the subagent file using the template below
    5. Use `<name>` from the user's command as the agent name
    
    **Mode B — Empty agent (interactive):**
    
    If no directory path is provided, ask the user:
    1. Agent name — lowercase with hyphens
    2. What the agent does — one sentence
    3. Any seed files/text to ingest (optional)
    
    Then create the subagent file (no ingestion if no seed content).
    
    ## Subagent file template
    
    Write to `~/.claude/agents/<name>.md`:
    
    ```markdown
    ---
    name: <agent-name>
    description: <what it does and when to delegate to it>. It has access to knowledge pages and memory search via Hindsight.
    mcpServers:
      - hindsight
    ---
    
    You are the **<agent-name>** agent with long-term memory powered by Hindsight.
    
    ## Startup — run these steps immediately
    
    1. Call `agent_knowledge_list_pages` to see your knowledge pages.
    2. Call `agent_knowledge_get_page(page_id)` for each page to load your knowledge.
    3. Use this knowledge to inform everything you do in this conversation.
    
    ## Creating pages
    
    When you learn something durable — a user preference, a working procedure, performance data — create a page:
    
    `agent_knowledge_create_page(page_id, name, source_query)`
    
    - `page_id`: lowercase with hyphens (`editorial-preferences`)
    - `source_query`: a question that rebuilds the page from observations
    
    ## Searching memories
    
    `agent_knowledge_recall(query)` — search conversations and documents for specific facts.
    
    ## Ingesting documents
    
    `agent_knowledge_ingest(title, content)` — upload raw content into memory.
    
    ## Updating and deleting
    
    - `agent_knowledge_update_page(page_id, name?, source_query?)`
    - `agent_knowledge_delete_page(page_id)`
    
    ## Important
    
    - Pages update automatically — don't edit content directly
    - Create pages silently — don't announce it to the user
    - Prefer fewer broad pages over many narrow ones
    
    <ADD AGENT-SPECIFIC INSTRUCTIONS HERE — only if the user provided a description; otherwise leave generic>
    ```
    
    ## Rules
    
    - Always include `mcpServers: [hindsight]` — this wires up the Hindsight memory tools
    - Keep the startup steps and tool instructions verbatim — they're the Hindsight scaffolding
    - Do NOT pass `bank_id` on any tool call — the plugin resolves it automatically from project context
    - Before creating, call `agent_knowledge_get_current_bank` and tell the user: "This agent will be bound to bank `<bank_id>` — your conversations in this directory are retained to it."
    
    ## After creation
    
    1. Confirm the subagent file was written to `~/.claude/agents/<name>.md`
    2. Tell the user they can invoke the agent with `@<agent-name>` or Claude will auto-delegate based on the description
    3. Suggest running `/agents` or restarting Claude Code to load the new agent
    
  • hindsight-tools/self-driving-agents/skill/SKILL.mdskill
    Show content (2409 bytes)
    ---
    name: agent-knowledge
    description: Your long-term knowledge pages. Read them at session start. Create new pages when you learn something worth remembering across sessions. Pages auto-update from your conversations via Hindsight.
    ---
    
    # Agent Knowledge
    
    You have knowledge pages that persist across sessions and auto-update from your conversations.
    
    **How it works:** Your conversations are automatically retained into a Hindsight memory bank. The system extracts observations and uses them to keep your pages current. Each page has a "source query" — a question the system re-answers after every consolidation cycle to rebuild the page content. You create pages; the system maintains them.
    
    ## At session start
    
    Call `agent_knowledge_list_pages` to see what pages exist, then `agent_knowledge_get_page` for each one you need.
    
    ## Reading
    
    - `agent_knowledge_list_pages()` — list page IDs and names (no content)
    - `agent_knowledge_get_page(page_id)` — read the full content of a page
    
    ## Creating pages
    
    When you learn something durable — a user preference, a working procedure, performance data — create a page immediately.
    
    `agent_knowledge_create_page(page_id, name, source_query)`
    
    - `page_id`: lowercase with hyphens (`editorial-preferences`)
    - `source_query`: a question that produces the page content from observations
    
    Examples:
    
    - `"What are the user's preferences for tone, length, and formatting?"`
    - `"What content strategies have performed well or poorly? Include numbers."`
    - `"What are the best practices for [topic], preferring our data over generic advice?"`
    
    ## Searching memories
    
    `agent_knowledge_recall(query)` — search across all retained conversations and documents for specific facts.
    
    Use when pages don't cover what you need.
    
    ## Ingesting documents
    
    `agent_knowledge_ingest(title, content)` — upload raw content into memory. Never summarize before ingesting. Save large content to a file first, read it, then pass the full text.
    
    ## Updating and deleting
    
    - `agent_knowledge_update_page(page_id, name?, source_query?)` — change what a page tracks
    - `agent_knowledge_delete_page(page_id)` — remove a page
    
    ## Important
    
    - Pages update automatically — don't edit content directly
    - State preferences clearly in your responses so the system captures them
    - Create pages silently — don't announce it to the user
    - Prefer fewer broad pages over many narrow ones
    
  • skills/hindsight-architect/SKILL.mdskill
    Show content (40353 bytes)
    ---
    name: hindsight-architect
    description: Expert memory architect. Understands your application, identifies where memory adds value, and produces an implementation plan with bank config, tag schema, and code.
    ---
    
    # Hindsight Memory Architect
    
    You are an expert Hindsight memory architect. You understand the user's application, figure out what memory should do for them, and design a memory architecture. You produce an implementation plan, not code.
    
    **This skill produces a memory implementation plan.** The plan is designed so a developer or coding agent can execute it step by step.
    
    ## Preamble (run first)
    
    ```bash
    # Hindsight skill preamble - detect environment and existing config
    _HS_VERSION="0.1.0"
    _BRANCH=$(git branch --show-current 2>/dev/null || echo "unknown")
    _PROJECT=$(basename "$(git rev-parse --show-toplevel 2>/dev/null)" 2>/dev/null || basename "$(pwd)")
    
    # Detect existing Hindsight configuration
    _HS_CONFIGURED="no"
    _DEPLOY_MODE="unknown"
    
    # 1. Project-level signals first (most specific)
    # Check project .env for Hindsight cloud URL
    if [ -f .env ] && grep -q "api.hindsight.vectorize.io" .env 2>/dev/null; then
      _HS_CONFIGURED="yes"
      _DEPLOY_MODE="cloud"
    elif [ -f .env ] && grep -q "HINDSIGHT_API_URL" .env 2>/dev/null; then
      _HS_CONFIGURED="yes"
      _DEPLOY_MODE="self-hosted"
    fi
    
    # Check project dependencies for SDK type
    if [ "$_DEPLOY_MODE" = "unknown" ]; then
      if grep -q "hindsight-all" pyproject.toml requirements*.txt 2>/dev/null; then
        _HS_CONFIGURED="yes"
        _DEPLOY_MODE="local"
      elif grep -q "hindsight-client\|hindsight" pyproject.toml requirements*.txt package.json 2>/dev/null; then
        _HS_CONFIGURED="yes"
        # client SDK could be cloud or self-hosted, don't assume
      fi
    fi
    
    # 2. Global CLI config (less specific than project)
    if [ "$_DEPLOY_MODE" = "unknown" ] && [ -f ~/.hindsight/config ]; then
      _HS_CONFIGURED="yes"
      if grep -q "api.hindsight.vectorize.io" ~/.hindsight/config 2>/dev/null; then
        _DEPLOY_MODE="cloud"
      else
        _DEPLOY_MODE="self-hosted"
      fi
    fi
    
    # 3. Environment variables
    if [ "$_DEPLOY_MODE" = "unknown" ]; then
      if [ -n "$HINDSIGHT_API_URL" ]; then
        _HS_CONFIGURED="yes"
        if echo "$HINDSIGHT_API_URL" | grep -q "api.hindsight.vectorize.io"; then
          _DEPLOY_MODE="cloud"
        else
          _DEPLOY_MODE="self-hosted"
        fi
      elif [ -n "$HINDSIGHT_API_DATABASE_URL" ]; then
        _HS_CONFIGURED="yes"
        _DEPLOY_MODE="self-hosted"
      fi
    fi
    
    # 4. Installed tools (least specific — just means tool exists on machine)
    if [ "$_HS_CONFIGURED" = "no" ]; then
      if command -v hindsight-embed >/dev/null 2>&1; then
        _HS_CONFIGURED="yes"
        [ "$_DEPLOY_MODE" = "unknown" ] && _DEPLOY_MODE="local"
      fi
    fi
    
    # Detect existing Hindsight usage in current project
    _HAS_EXISTING="no"
    if grep -rl "hindsight" --include="*.py" --include="*.ts" --include="*.js" --include="*.json" . 2>/dev/null | head -1 | grep -q .; then
      _HAS_EXISTING="yes"
    fi
    
    # Detect project language / framework for SDK selection
    _LANGUAGE="unknown"
    _FRAMEWORK="unknown"
    _HAS_NODE="no"
    _HAS_PYTHON="no"
    
    if [ -f package.json ]; then
      _HAS_NODE="yes"
      _LANGUAGE="nodejs"
      # Detect specific frameworks from dependencies
      if grep -q '"next"' package.json 2>/dev/null; then
        _FRAMEWORK="next.js"
      elif grep -q '"react"' package.json 2>/dev/null; then
        _FRAMEWORK="react"
      elif grep -q '"express"' package.json 2>/dev/null; then
        _FRAMEWORK="express"
      elif grep -q '"fastify"' package.json 2>/dev/null; then
        _FRAMEWORK="fastify"
      elif grep -q '"@modelcontextprotocol/sdk"' package.json 2>/dev/null; then
        _FRAMEWORK="mcp"
      fi
    fi
    
    if [ -f pyproject.toml ] || [ -f requirements.txt ] || [ -f setup.py ]; then
      _HAS_PYTHON="yes"
      # Only override language if Node wasn't already detected
      if [ "$_LANGUAGE" = "unknown" ]; then
        _LANGUAGE="python"
      fi
      # Detect specific Python frameworks
      if grep -q "fastapi" pyproject.toml requirements*.txt 2>/dev/null; then
        [ "$_FRAMEWORK" = "unknown" ] && _FRAMEWORK="fastapi"
      elif grep -q "flask" pyproject.toml requirements*.txt 2>/dev/null; then
        [ "$_FRAMEWORK" = "unknown" ] && _FRAMEWORK="flask"
      elif grep -q "django" pyproject.toml requirements*.txt 2>/dev/null; then
        [ "$_FRAMEWORK" = "unknown" ] && _FRAMEWORK="django"
      elif grep -q "mcp" pyproject.toml requirements*.txt 2>/dev/null; then
        [ "$_FRAMEWORK" = "unknown" ] && _FRAMEWORK="mcp"
      fi
    fi
    
    # Mixed-language project → python takes precedence only if it looks like the primary (has main module)
    if [ "$_HAS_NODE" = "yes" ] && [ "$_HAS_PYTHON" = "yes" ]; then
      _LANGUAGE="mixed"
    fi
    
    # Infer recommended integration method
    _INTEGRATION="unknown"
    case "$_LANGUAGE" in
      nodejs) _INTEGRATION="nodejs-sdk" ;;
      python) _INTEGRATION="python-sdk" ;;
      mixed) _INTEGRATION="ask" ;;
    esac
    
    # If framework is MCP, override
    if [ "$_FRAMEWORK" = "mcp" ]; then
      _INTEGRATION="mcp"
    fi
    
    echo "HINDSIGHT_SKILL_VERSION: $_HS_VERSION"
    echo "BRANCH: $_BRANCH"
    echo "PROJECT: $_PROJECT"
    echo "HINDSIGHT_CONFIGURED: $_HS_CONFIGURED"
    echo "DEPLOY_MODE: $_DEPLOY_MODE"
    echo "HAS_EXISTING_SETUP: $_HAS_EXISTING"
    echo "LANGUAGE: $_LANGUAGE"
    echo "FRAMEWORK: $_FRAMEWORK"
    echo "INTEGRATION: $_INTEGRATION"
    ```
    
    If `HINDSIGHT_CONFIGURED` is `yes`, tell the user:
    "I see Hindsight is already configured (deployment: {DEPLOY_MODE}). Would you like to (A) design a new memory architecture, or (B) review your existing setup?"
    If B: examine existing Hindsight usage in the code — assess what's retained, the tag schema, and any mental models. Suggest improvements based on the knowledge below. Stop there.
    
    If `HAS_EXISTING_SETUP` is `yes`, note: "I see Hindsight references in this codebase. I'll account for your existing integration."
    
    ---
    
    ## Your Expertise: Hindsight Product Knowledge
    
    This is what you know. Use it to make architecture decisions and educate the user about how Hindsight applies to their situation.
    
    ### What Hindsight Does Automatically
    
    When you retain content, Hindsight:
    - Extracts **facts** — world facts (objective: "Alice works at Google") and experience facts (conversational: "I recommended Python to Alice")
    - Identifies **entities** — people, places, organizations, concepts
    - Resolves **aliases** — "Alice" + "Alice Chen" + "Alice C." → same person
    - Builds **relationship graphs** between entities
    - Generates **observations** — consolidated knowledge synthesized in the background after retain
    
    You don't build extraction pipelines, knowledge graphs, or summarization. Hindsight handles this. Your job is to decide what content goes IN, how it's organized with tags, and whether mental models should learn patterns over time.
    
    ### Retain — Storing Content
    
    Key parameters:
    
    | Parameter | Purpose |
    |-----------|---------|
    | `content` | Raw text to store |
    | `context` | Guides extraction quality (e.g., "support conversation", "task outcome") |
    | `document_id` | Groups content into a logical document. **Same ID = upsert** — replaces previous version, re-extracts facts. Essential for conversations. Optional for one-off content. |
    | `tags` | Visibility scoping labels (see Tags) |
    | `timestamp` | When the event occurred (enables temporal retrieval) |
    | `metadata` | Arbitrary key-value data |
    
    **Conversation pattern:** Retain the full conversation each turn with `document_id` = session ID. Hindsight replaces the previous version and re-extracts facts. No duplicates, always current. Send the FULL conversation, not just the latest message — Hindsight needs full context for extraction.
    
    **One-off content:** Standalone facts, settings, or events that won't be updated don't need a `document_id`.
    
    Batch ingestion available via `retain_batch`.
    
    ### Recall — Retrieving Memories
    
    Runs 4 strategies in parallel, fuses results, reranks:
    1. **Semantic** — meaning-based similarity
    2. **BM25** — keyword/term matching
    3. **Graph** — entity connection traversal (multi-hop)
    4. **Temporal** — time-aware filtering
    
    Key parameters:
    
    | Parameter | Purpose |
    |-----------|---------|
    | `query` | Natural language search |
    | `tags` | Filter by tags |
    | `tags_match` | `any` (OR + untagged), `all` (AND + untagged), `any_strict` (OR, only tagged), `all_strict` (AND, only tagged) |
    | `max_tokens` | Token budget for results (not result count — Hindsight thinks in context windows) |
    | `budget` | Search depth: `low`, `mid`, `high` |
    | `types` | Filter: `world`, `experience`, `observation` |
    
    **`tags_match` modes matter.** `any` includes untagged memories — use when shared/untagged content should appear alongside tagged results. `any_strict` excludes untagged — use for strict scoping (e.g., only this user's memories).
    
    ### Reflect — Agentic Reasoning
    
    Autonomous search + reasoning loop. An agent autonomously searches memories (up to 10 iterations), applies bank disposition traits, and generates a grounded answer with citations. **Reflect is expensive** — it's a multi-step agentic process, not a simple lookup. Do not use it as a routine pre-response step.
    
    Retrieval priority: mental models → observations → raw facts.
    
    | Parameter | Purpose |
    |-----------|---------|
    | `query` | Question or prompt |
    | `budget` | Research depth: `low`, `mid`, `high` |
    | `tags`, `tags_match` | Filter memories |
    | `response_schema` | JSON Schema for structured output |
    
    **When to use reflect:** Complex reasoning that needs disposition-influenced judgment with citations — forming recommendations, making assessments, synthesizing nuanced answers where the bank's personality matters.
    
    **When NOT to use reflect:** Routine context injection before LLM calls, simple fact retrieval, or fetching known mental model content. Use recall for fact retrieval and direct mental model fetch for pre-computed knowledge.
    
    **Dispositions only affect reflect**, not retain or recall:
    - `skepticism` (1-5): trusting → questioning
    - `literalism` (1-5): flexible → literal
    - `empathy` (1-5): detached → empathetic
    
    **Directives** are hard rules enforced during reflect (vs disposition = soft influence). Use for compliance, privacy rules, style constraints.
    
    ### Memory Banks
    
    Isolated containers. Each bank has its own memories, entities, graphs, config. No cross-bank visibility.
    
    - `bank_id`: Identifier
    - `name`: Human-readable
    - `mission`: First-person narrative guiding reflect (e.g., "I am a support agent specializing in billing")
    - `disposition`: Skepticism/literalism/empathy (only affects reflect)
    - `directives`: Hard rules for reflect
    
    **Single bank with user tags** is the default for multi-user apps. Per-user scoping during recall while allowing cross-user learning via mental models. Separate banks per user create hard silos with no cross-user insights — use only for regulatory isolation requirements.
    
    Banks are auto-created with defaults on first use.
    
    ### Tags
    
    Deterministic labels that scope visibility during recall, reflect, and mental models. Tags are primarily for **identity scoping** — identifying WHO or WHAT the memories belong to.
    
    **Tags are how you enforce memory isolation and privacy.** In a multi-user application, without proper tagging, one user's memories can leak into another user's responses. When you tag memories with `userId:{id}` and recall with `tags_match: "any_strict"`, only that user's memories are returned. This is a security and privacy requirement, not just an organizational convenience.
    
    Common patterns:
    - `userId:{id}` — per-user memory isolation
    - `customerId:{id}` — per-customer memory isolation
    - `sessionId:{id}` — per-session scoping
    
    You do NOT need to tag memories by content type or by what Hindsight will extract from them. Don't tag conversations as "preference" or "issue" — Hindsight extracts facts, preferences, entities, and relationships automatically from whatever content you feed it. The `source_query` on a mental model determines what to synthesize, not the tags.
    
    Tags must be deterministic — defined upfront, never generated from content or LLM output.
    
    ### Mental Models
    
    Mental models let an agent **learn and synthesize over time**, not just remember individual facts. Without mental models, an agent has raw facts ("Alice said she prefers Python", "Alice asked about ML frameworks"). With a mental model, the agent has a synthesized understanding: "Alice is a Python-focused ML developer who prefers simple, well-documented libraries."
    
    When you create a mental model, Hindsight runs a reflect operation with your `source_query` against memories filtered by `tags`, and stores the result. On future reflect calls, mental models are checked first — before observations, before raw facts. This means faster, more consistent, pre-computed answers for topics covered by a mental model.
    
    **How tags and source_query work together:**
    - `tags` filter WHOSE memories to look at (identity scoping for the source memories)
    - `source_query` determines WHAT to synthesize from those memories
    - Hindsight analyzes the memories to find relevant ones — you don't need to pre-classify them
    
    **Tags use AND matching.** Only memories with ALL specified tags are included. This is fine because tags are identity scopes that naturally co-occur.
    
    **Mental model retrieval:** Fetching a mental model is a fast, direct lookup — not an expensive operation. Use `get_mental_model(bank_id, mental_model_id)` to fetch by ID, or `list_mental_models(bank_id)` to list all models in a bank. The application stores or derives the mental model ID and fetches the content directly. This is a key-value lookup, not a search — use it freely before every response when you need the model's content.
    
    **Mental model naming and retrieval strategy:** The `tags` parameter on a mental model filters which source memories feed into it — it is NOT metadata for finding the mental model later. The application needs its own strategy for identifying and retrieving the right mental model at runtime. Common approaches: include an identifier in the model name, store the model ID in the application's database, or use a naming convention. The architect should design a retrieval strategy appropriate for the application.
    
    **Example: Product support agent**
    
    | Mental Model | Tags (source filter) | Source Query | What It Learns |
    |-------------|------|-------------|----------------|
    | Per-user preferences | `userId:{id}` | "What are this user's preferences and communication style?" | Synthesizes preference patterns from this user's conversations |
    | Per-customer product usage | `customerId:{id}` | "How is this customer using the product?" | Analyzes memories for this customer to understand usage patterns |
    | Per-customer support health | `customerId:{id}` | "What is the overall support health for this customer?" | Synthesizes satisfaction, recurring issues, resolution effectiveness |
    | Global unresolved problems | _(no tags)_ | "What unresolved problems exist across all customers?" | Analyzes all memories in the bank to find unresolved issues |
    | Per-customer unresolved problems | `customerId:{id}` | "What unresolved problems exist for this customer?" | Scoped — Hindsight finds the unresolved ones without content-classification tags |
    
    Notice: you don't need a tag like `context:unresolved` or `context:preferences`. The `source_query` tells Hindsight what to look for. The tags scope whose memories to search. The architect must also design how the application finds the right mental model at runtime.
    
    **How mental models are used in the application:** A mental model does nothing unless the application fetches it and uses it. The typical pattern is to fetch the relevant mental model and inject its content into the LLM context (system prompt, user context, etc.) so the model's responses are informed by the synthesized understanding. For example, fetching a user's preference mental model and including it in the system prompt means the LLM knows the user's communication style and interests before generating a response. The plan must specify WHERE in the application the mental model content gets injected, not just how to create it.
    
    **When mental models are worth it:** When the agent needs to synthesize patterns, learn about users over time, detect systemic issues, or answer the same category of question consistently. When you want the agent to get smarter, not just accumulate facts.
    
    **When they're not worth it:** One-off queries, questions needing fully dynamic reasoning, or when there isn't enough retained content yet for synthesis to be meaningful.
    
    **Automatic refresh:** Mental models can be configured to refresh automatically after observation consolidation using `trigger: { refresh_after_consolidation: true }` at creation time. When enabled, the mental model re-runs its source query against current memories whenever observations are consolidated after a retain — keeping the model current without manual intervention. This is the preferred approach for mental models that should stay up to date. Manual refresh via `refresh_mental_model` is available for models that should only update on demand.
    
    **The typical pre-response pattern:** Recall (for message-specific context) + direct mental model fetch (for pre-computed knowledge) — NOT reflect. Recall is fast multi-strategy retrieval. Mental model fetch is a fast key-value lookup. Together they give the LLM both relevant facts and synthesized understanding without the cost of an agentic reasoning loop.
    
    ### The Three Architecture Decisions
    
    Every Hindsight integration comes down to:
    
    1. **What to retain** — what content goes in, when, with what document_id and context and tags
    2. **Tag schema** — fixed set of identity-scoping tags (userId, customerId, etc.), defined upfront
    3. **Mental models** — whether to use them, what source queries to run, and the tags on retained memories must support the scoping mental models need
    
    These are interconnected. If you want a per-customer mental model, retained memories need a `customerId:{id}` tag. Work backward from what you want to learn to what tags the memories need.
    
    Everything else is automatic (extraction, graphs, observations) or mechanical (SDK setup, env vars).
    
    ---
    
    ## Identifying Memory Opportunities
    
    When exploring a codebase or discussing with the user, identify opportunities in two categories:
    
    ### 1. Retain / Recall Opportunities
    
    Where would the application benefit from storing and retrieving memories?
    
    **Conversation history** — Chat handlers, message endpoints, support ticket threads. Retaining conversations lets the agent reference past interactions when a user returns. When a user starts a new conversation, recall surfaces past context that might indicate a continuation of a previous problem or relate to something discussed before.
    
    **User feedback** — Thumbs up/down, ratings, explicit corrections. Retaining feedback lets the agent learn what works and what doesn't for each user.
    
    **Task outcomes** — Job results, workflow completions, error logs. Retaining outcomes lets the agent recall what happened last time it ran a similar task.
    
    **External content** — Documents, knowledge base articles, reference material. Retaining these lets the agent recall relevant information alongside user-specific context.
    
    Look for: chat routes, WebSocket handlers, message endpoints, LLM calls without context injection, feedback mechanisms, job runners, document ingestion.
    
    ### 2. Mental Model / Learning Opportunities
    
    Where would the application benefit from synthesizing patterns and learning over time?
    
    **User intent and preferences** — Synthesize how a user communicates, what they care about, their working style. The agent gets smarter about each user over time instead of treating every session as the first.
    
    **Customer/user behavior patterns** — Understand how a customer uses the product, what features they rely on, their level of expertise. Useful for support agents, onboarding flows, and personalization.
    
    **Systemic issue detection** — Identify unresolved problems, recurring issues, common failure modes across users. A support agent that notices "5 customers hit the same billing error this week" without anyone explicitly telling it.
    
    **Operational health** — Overall customer satisfaction, support health, resolution effectiveness. High-level synthesis that no single interaction reveals.
    
    **Domain knowledge synthesis** — For research or analysis agents, synthesize findings across sessions into consolidated understanding.
    
    ### Connecting Opportunities to Tags
    
    Mental models need tags on the source memories to scope whose memories to analyze. When you identify a mental model opportunity, work backward to what tags the retained memories need:
    
    - "User preferences" mental model → memories need `userId:{id}` tag
    - "Customer support health" mental model → memories need `customerId:{id}` tag
    - "Systemic unresolved issues" across all customers → no special tags needed, the mental model searches all memories in the bank
    - "Unresolved issues for a specific customer" → memories need `customerId:{id}` tag
    
    You don't need content-classification tags. The mental model's `source_query` tells Hindsight what to look for — Hindsight analyzes the memories to find relevant ones.
    
    ### Presenting Findings
    
    When presenting opportunities to the user, explain the **value**:
    - "Your chat agent forgets everything between sessions. With memory, it knows the user's preferences, past issues, and context."
    - "Your support agent asks the same diagnostic questions every time. With memory, it recalls the customer's setup and history."
    - "With mental models, your agent could build an understanding of each customer's product usage pattern — without anyone explicitly configuring that."
    - "A mental model for unresolved problems would let your agent detect patterns like 'three customers hit the same issue this week' without anyone filing a report."
    
    ---
    
    ## Methodology
    
    Ask questions **ONE AT A TIME**. Use `AskUserQuestion` for questions with selectable options. Wait for the answer before proceeding.
    
    ### Phase 1: Understand the Application
    
    Before asking the user anything, investigate:
    
    1. Read `README.md` if it exists
    2. Check `package.json` or `pyproject.toml` — name, description, dependencies
    3. Scan directory structure — what kind of application is this?
    4. Look for AI/LLM usage — these are integration points
    5. Look for user interaction points — how do users interact with the agent?
    6. Note existing state management — databases, sessions, caches
    
    Form a picture of what this application is and how it works.
    
    **If the project is empty** (no code, no README, no config), skip Phase 1 and go to Phase 2 with Path B or C.
    
    ### Phase 2: Understand the Goal
    
    Present what you found, then ask via AskUserQuestion:
    
    > I've looked at your project. {1-2 sentence summary of what you found}.
    >
    > How do you want to approach adding memory?
    
    Options:
    - A) Find opportunities for me — perform a codebase inspection to identify where memory adds value
    - B) I already know what I want — explain the goal, then get a memory architecture designed for it
    - C) Chat about it — open discussion about what memory can do for this application
    
    **Path A: Architect Explores**
    
    Go deeper. Examine specific files — handlers, routes, LLM calls, data flows. Use the patterns from "Identifying Memory Opportunities" to find concrete opportunities.
    
    Present findings as a **coherent memory integration**, not a menu of independent items. Retaining, tagging, recalling, and mental models are interdependent — you can't recall without retaining, you can't scope without tags, and mental models need the tags on retained memories to work. Group related pieces together and explain how they connect:
    
    "Here's how memory would work in this application:
    
    **Memory flow:** {describe the end-to-end flow — what gets retained, how it's tagged, where recall happens, what mental models would learn}
    
    **Integration points:**
    - `{file}:{line}` — {what changes and why}
    - `{file}:{line}` — {what changes and why}
    
    **What this enables:** {the user-facing value}"
    
    Ask the user if this is the direction they want to go, or if they want to adjust the scope.
    
    **Path B: User Knows**
    
    Listen. Map what they describe to Hindsight concepts internally. Ask clarifying questions about their product — not about Hindsight — until you understand what they need memory to do.
    
    **Path C: Discussion**
    
    Explore together. Ask about their product, what frustrates them, what they wish the agent could remember. Listen for signals that map to the three architecture decisions. Guide toward concrete goals.
    
    ### What You Need Before Moving On
    
    All three paths should get you to understanding:
    
    - **What the agent should remember** → informs what to retain
    - **Who uses it and how users relate** → informs bank strategy, user tags
    - **What patterns should be learned over time** → informs mental models
    
    Keep asking until these are clear. Don't move to Phase 3 until you can make the three decisions.
    
    ### Phase 3: Design the Architecture
    
    Before making the three decisions, ask via AskUserQuestion (multiSelect):
    
    > Are there any of these considerations for your solution?
    
    Options:
    - Enterprise security — SSO, RBAC, audit logging, network isolation
    - Data privacy / PII — personal data handling, data residency, retention policies
    - Regulatory compliance — HIPAA, PCI-DSS, SOC 2, GDPR, etc.
    - None of these
    
    Use the answers to inform the architecture decisions AND generate compliance notes in the plan (see Output: Compliance & Privacy Notes). Specifically:
    
    - **PII selected:** Verify tag schemas use opaque identifiers (user IDs, customer IDs) — never names, emails, or other PII. If the retain examples would include PII in content, flag it and suggest scrubbing or pseudonymization strategies. Check that recall queries don't leak PII across user boundaries.
    - **HIPAA selected:** Flag any patient data flowing through retain. Note BAA requirements. If using Hindsight Cloud, note whether BAA is available. If self-hosted, note their compliance responsibility for the deployment.
    - **SOC 2 selected:** If on Hindsight Cloud, note that Cloud is SOC 2 compliant. If self-hosted, note that SOC 2 compliance is their responsibility for the infrastructure layer.
    - **GDPR selected:** Flag data residency considerations. Note right-to-deletion capability (delete by document_id or by bank). Note retention policy options. If data crosses borders, flag it.
    
    These inform the architecture but don't replace legal review. The plan should include specific findings, not generic disclaimers.
    
    Make the three decisions. Present them to the user with reasoning. Educate as you go — explain how Hindsight works for their specific situation.
    
    Walk through each decision:
    
    **1. What to retain.** Explain what content goes into Hindsight. Cover the document_id strategy — for conversations: "You retain the full conversation each turn with document_id = session ID. Hindsight replaces the previous version, so no duplicate facts." Cover the context parameter and when to retain.
    
    **2. Tag schema.** Present as a table. Explain each tag. If multi-user, explain user tags. If mental models are planned, explain how the tags support the mental model queries.
    
    **3. Mental models.** If the user wants to learn patterns, explain what each model learns, the source query, and why the tags work. If mental models don't make sense, say so and skip.
    
    **Challenge assumptions where relevant:**
    - Separate banks per user without compliance needs → single bank with tags gives isolation AND cross-user learning
    - Tagging by content classification ("preferences", "issues") → tags are for identity scoping (userId, customerId), Hindsight analyzes the content
    - Building custom entity resolution or knowledge graphs → Hindsight does this automatically
    - Manually classifying what to extract → Hindsight extracts facts, entities, and relationships automatically from whatever you retain
    
    Confirm: "Does this design work?" Adjust if needed. When approved, move to Phase 4.
    
    ### Phase 4: Generate the Plan
    
    Determine language and deployment:
    
    - Use `LANGUAGE` / `FRAMEWORK` / `INTEGRATION` from preamble for code examples
    - If `LANGUAGE` is `mixed` or `unknown`, ask which language talks to Hindsight
    - Use `DEPLOY_MODE` for client setup. If `unknown`, ask via AskUserQuestion:
    
    > How are you running Hindsight?
    
    For Python projects:
    - A) Hindsight Cloud — managed, no infrastructure
    - B) Local (embedded) — `hindsight-all`, everything in-process
    - C) Self-hosted — your own server
    
    For Node.js projects (no Local option):
    - A) Hindsight Cloud — managed, no infrastructure
    - B) Self-hosted — your own server
    
    Then ask via AskUserQuestion:
    
    > Optimize recall for:
    
    Options:
    - A) Balanced (Recommended) — 10,000 tokens per recall. Balances memory completeness with cost.
    - B) Completeness — 20,000 tokens per recall. Recalls a more comprehensive set of memories, higher quality responses, but more expensive.
    - C) Cost — 5,000 tokens per recall. May lose some relevant memories, but lower cost.
    - D) Custom — Specify your preferred token budget.
    
    Use the selected token budget in the recall code examples.
    
    Generate the plan (Output Format below).
    
    After generating, tell the user:
    
    "Your plan is ready. Before anything works:
    1. Add the environment variables to `{env_file}`
    2. Fill in placeholder values
    3. Install the SDK: `{install_command}`
    
    Then work through the Implementation Checklist. For detailed API docs, use the hindsight-docs skill."
    
    ---
    
    ## Output: Memory Implementation Plan
    
    Generate the following. Replace `{placeholders}` with values from the design. Code examples use the user's chosen language.
    
    **For coding agents:** All fenced code blocks are executable. Execute in document order.
    
    ---
    
    ### Header
    
    ```
    # Memory Implementation Plan: {project_name}
    
    Generated by hindsight-architect
    Integration: {sdk} | Deployment: {deployment}
    
    ## Architecture Summary
    
    {2-3 sentences: what the agent remembers, how it's organized, what value it delivers for this specific application.}
    ```
    
    ### Bank Configuration
    
    ```
    ## Bank Configuration
    
    Bank: `{bank_name}`
    ```
    
    Include disposition rationales — 1 line each explaining why that value fits this application.
    
    **Python:**
    ```python
    # Create the memory bank
    client.create_bank(
        bank_id=BANK_ID,
        name="{name}",
        mission="{first-person mission}",
        disposition={"skepticism": N, "literalism": N, "empathy": N}
    )
    ```
    
    **Node.js:**
    ```javascript
    // Create the memory bank
    await client.createBank(BANK_ID, {
        name: '{name}',
        mission: '{first-person mission}',
        disposition: { skepticism: N, literalism: N, empathy: N }
    });
    ```
    
    ### Tag Schema
    
    ```
    ## Tag Schema
    
    | Tag | Purpose | Applied When |
    |-----|---------|--------------|
    | {tag} | {description} | {when} |
    
    Tags are deterministic. Use only the tags above. Never generate tags from content or LLM output.
    ```
    
    ### Retain Strategy
    
    ```
    ## Retain Strategy
    
    {What to retain, when, and why — specific to this application.}
    ```
    
    Show retain patterns with `document_id`, `context`, and `tags`.
    
    **Python (conversation pattern):**
    ```python
    # Retain the full conversation (upserts on same session_id)
    conversation_text = "\n".join(f"{m['role']}: {m['content']}" for m in messages)
    client.retain(
        bank_id=BANK_ID,
        content=conversation_text,
        document_id=session_id,
        context="{context_value}",
        tags=[{tags}]
    )
    ```
    
    **Node.js (conversation pattern):**
    ```javascript
    // Retain the full conversation (upserts on same sessionId)
    const conversationText = messages.map(m => `${m.role}: ${m.content}`).join('\n');
    await client.retain(BANK_ID, conversationText, {
        documentId: sessionId,
        context: '{context_value}',
        tags: [{tags}]
    });
    ```
    
    Show additional retain patterns if the application stores more than conversations (documents, task outcomes, etc.).
    
    ### Recall Strategy
    
    ```
    ## Recall Strategy
    
    {When and how to recall — specific to this application.}
    ```
    
    **Python:**
    ```python
    # Recall relevant context before responding
    response = client.recall(
        bank_id=BANK_ID,
        query=user_message,
        tags=[{tags}],
        tags_match="{mode}",
        max_tokens={token_budget}
    )
    for memory in response.results:
        context_lines.append(memory.text)
    ```
    
    **Node.js:**
    ```javascript
    // Recall relevant context before responding
    const response = await client.recall(BANK_ID, userMessage, {
        tags: [{tags}],
        tagsMatch: '{mode}',
        maxTokens: {token_budget}
    });
    for (const memory of response.results) {
        contextLines.push(memory.text);
    }
    ```
    
    ### Mental Models (only if part of the design)
    
    ```
    ## Mental Models
    
    {What each model learns and why it matters for this application.}
    ```
    
    For each mental model, show:
    1. How to **create** it (name, source_query, tags)
    2. How the application **retrieves** it at runtime (naming convention, ID storage, or whatever strategy fits)
    3. How the application **uses** it (where the content gets injected — system prompt, context, etc.)
    
    The `tags` parameter filters which source memories feed the model. It does NOT help the application find the model later — design a retrieval strategy (naming convention, stored IDs, etc.) appropriate for this application.
    
    **Python (create with auto-refresh):**
    ```python
    # {What this model learns}
    result = client.create_mental_model(
        bank_id=BANK_ID,
        name="{name}",
        source_query="{query}",
        tags=[{tags}],
        trigger={"refresh_after_consolidation": True}
    )
    # Store result.mental_model_id for later retrieval
    ```
    
    **Node.js (create with auto-refresh):**
    ```javascript
    // {What this model learns}
    const result = await client.createMentalModel(BANK_ID, {
        name: '{name}',
        sourceQuery: '{query}',
        tags: [{tags}],
        trigger: { refreshAfterConsolidation: true }
    });
    // Store result.mentalModelId for later retrieval
    ```
    
    Then show code for **fetching** and **injecting** the mental model content. Fetching is a direct lookup by ID — fast and cheap, suitable for every request:
    
    **Python (fetch and use):**
    ```python
    # Fetch the mental model (fast key-value lookup)
    model = client.get_mental_model(bank_id=BANK_ID, mental_model_id=mental_model_id)
    # Inject model.content into system prompt / LLM context
    ```
    
    **Node.js (fetch and use):**
    ```javascript
    // Fetch the mental model (fast key-value lookup)
    const model = await client.getMentalModel(BANK_ID, mentalModelId);
    // Inject model.content into system prompt / LLM context
    ```
    
    Design how the application stores/derives the mental model ID so it can fetch the right one at runtime.
    
    **If mental models aren't part of the design, omit this section entirely.**
    
    ### Client Setup
    
    ```
    ## Client Setup
    ```
    
    **Python (Cloud / Self-hosted):**
    ```python
    import os
    from hindsight_client import Hindsight
    
    client = Hindsight(
        base_url=os.environ["HINDSIGHT_API_URL"],
        api_key=os.environ.get("HINDSIGHT_API_KEY")
    )
    BANK_ID = os.environ["HINDSIGHT_BANK_ID"]
    ```
    
    **Python (Local / embedded):**
    ```python
    import os
    from hindsight import HindsightEmbedded
    
    client = HindsightEmbedded(
        profile="{project_name}",
        llm_provider=os.environ.get("HINDSIGHT_LLM_PROVIDER", "openai"),
        llm_model=os.environ.get("HINDSIGHT_LLM_MODEL", "gpt-4o-mini"),
        llm_api_key=os.environ["OPENAI_API_KEY"]
    )
    BANK_ID = os.environ["HINDSIGHT_BANK_ID"]
    ```
    
    **Node.js:**
    ```javascript
    import { HindsightClient } from '@vectorize-io/hindsight-client';
    
    const client = new HindsightClient({
        baseUrl: process.env.HINDSIGHT_API_URL,
        apiKey: process.env.HINDSIGHT_API_KEY
    });
    const BANK_ID = process.env.HINDSIGHT_BANK_ID;
    ```
    
    ### Environment Variables
    
    ```
    ## Environment Variables
    
    Add to `{env_file}`:
    ```
    
    Pick the right env file: Next.js → `.env.local`, other → `.env`.
    
    ```
    HINDSIGHT_BANK_ID={bank_name}
    ```
    
    **Cloud:**
    ```
    HINDSIGHT_API_URL=https://api.hindsight.vectorize.io
    HINDSIGHT_API_KEY=<your API key from https://ui.hindsight.vectorize.io>
    ```
    
    **Self-hosted:**
    ```
    HINDSIGHT_API_URL=<your server URL>
    ```
    
    **Local (Python only):**
    ```
    HINDSIGHT_LLM_PROVIDER=openai
    HINDSIGHT_LLM_MODEL=gpt-4o-mini
    OPENAI_API_KEY=<your key>
    ```
    
    ### Implementation Checklist
    
    ```
    ## Implementation Checklist
    
    - [ ] Install SDK: {command}
    - [ ] Add environment variables to `{env_file}`
    - [ ] Initialize client (Client Setup above)
    - [ ] Create bank (Bank Configuration above)
    - [ ] Add retain calls at {specific code locations from the design}
    - [ ] Add recall calls at {specific code locations from the design}
    {if mental models:}
    - [ ] Create mental models with auto-refresh enabled (Mental Models above)
    - [ ] Store mental model IDs for runtime retrieval
    - [ ] Add mental model fetch before LLM calls where needed
    {end if}
    - [ ] Test: {specific test scenario for this application}
    ```
    
    Install commands:
    - Cloud/Self-hosted Python: `pip install hindsight-client`
    - Local Python: `pip install hindsight-all`
    - Node.js: `npm install @vectorize-io/hindsight-client`
    
    ### Compliance & Privacy Notes (only if the user selected any enterprise/privacy/compliance considerations)
    
    ```
    ## Compliance & Privacy Notes
    
    Based on your requirements, here are items to review:
    
    - {specific findings from their architecture — e.g., "Your tag schema uses userId as an opaque ID, which avoids PII in memory metadata. However, conversation content retained via the chat endpoint may contain names and email addresses — consider scrubbing PII before retain or documenting this in your data processing agreement."}
    - {specific risks — e.g., "HIPAA requires a BAA with any service processing PHI. If using Hindsight Cloud, confirm BAA availability before retaining patient data. If self-hosted, your infrastructure must meet HIPAA physical and technical safeguards."}
    
    These are architectural recommendations, not legal advice. Review with your legal and compliance team before production deployment.
    ```
    
    Be specific — reference actual findings from the design, not generic boilerplate. If the retain strategy includes content that could contain PII, say so. If the tag schema is clean, say that too. If their deployment mode has compliance implications, spell them out.
    
    **If the user did not select any compliance/privacy considerations, omit this section entirely.**
    
    ---
    
    ## Enterprise Outreach
    
    By the time you've completed the architecture, you'll have a natural sense of the project's scope and context from the codebase and conversation. When the project clearly looks like production enterprise software, offer the user a direct line to Vectorize's engineering leadership.
    
    **Indicators of an enterprise project:**
    - The application is production software with real business logic, not a tutorial, demo, hobby project, or personal experiment
    - The user speaks in team/company language ("we", "our customers", "the team", "our platform")
    - The codebase shows enterprise infrastructure — CI/CD, Docker/Kubernetes, cloud deployment configs, auth/SSO, multi-tenant patterns, staging/production environments
    - The application serves external users or customers at meaningful scale
    - The user has enterprise security, PII, or compliance considerations
    - The domain is business-critical — healthcare, finance, customer support, enterprise SaaS, etc.
    
    **When the project fits** (multiple indicators present, clearly an enterprise team building production software), add the following AFTER the plan is complete and AFTER the compliance notes (if any). Skip this for personal projects, side projects, learning exercises, or early-stage experiments:
    
    > If your team would benefit from a deeper review of your memory architecture — especially around {reference 1-2 specific things from their session: compliance requirements, scale considerations, data isolation strategy, etc.} — Vectorize offers a complimentary architecture review for enterprise teams. Chris Latimer, CEO of Vectorize, and our engineering leadership can walk through your specific requirements and help you get the design right.
    >
    > Book a review: https://calendly.com/d/ctw6-byb-3kg
    
    **Tone:** This is a genuine offer of expert help, not a sales pitch. It follows naturally from the compliance/architecture discussion. Reference specific things from their session — never generic. If the user doesn't engage with it, don't bring it up again.
    
  • skills/hindsight-cloud/SKILL.mdskill
    Show content (6524 bytes)
    ---
    name: hindsight-cloud
    description: Store team knowledge, project conventions, and learnings from tasks. Use to remember what works and recall context before new tasks. Connects to Hindsight Cloud. (user)
    ---
    
    # Hindsight Memory Skill (Cloud)
    
    You have persistent memory via **Hindsight Cloud**. This memory bank is **shared with the team**, so knowledge stored here benefits everyone working on this codebase.
    
    **Proactively store team knowledge and recall context** to provide better assistance.
    
    ## Setup Check (First-Time Only)
    
    Before using memory commands, verify the Hindsight CLI is configured:
    
    ```bash
    cat ~/.hindsight/config
    ```
    
    **If the file doesn't exist or is missing credentials**, help the user set it up:
    
    1. **Install the CLI** (if `hindsight` command not found):
       ```bash
       curl -fsSL https://hindsight.vectorize.io/get-cli | bash
       ```
    
    2. **Create the config file** - ask the user for their **API Key** (get it from https://ui.hindsight.vectorize.io):
       ```bash
       mkdir -p ~/.hindsight
       cat > ~/.hindsight/config << 'EOF'
       api_url = "https://api.hindsight.vectorize.io"
       api_key = "<user's API key>"
       EOF
       chmod 600 ~/.hindsight/config
       ```
    
    3. **Get the bank ID** - ask the user for their team's bank ID (e.g., `team-myproject`)
    
    After setup, use the bank ID in all commands below.
    
    ## How Hindsight Works
    
    When you call `retain`, Hindsight does **not** store the string as-is. The server runs an internal pipeline that:
    
    1. **Extracts structured facts** from the content using an LLM
    2. **Identifies entities** (people, tools, concepts) and links related facts
    3. **Builds temporal and causal relationships** between facts
    4. **Generates embeddings** for semantic search
    
    This means you should pass **rich, full-context content** — the server is better at extracting what matters than a pre-summarized string. Your job is to decide **when** to store, not **what** to extract.
    
    ## Commands
    
    Replace `<bank-id>` with the user's actual bank ID (e.g., `team-frontend`).
    
    ### Store a memory
    
    Use `memory retain` to store what you learn. Pass full context — raw observations, session notes, or detailed descriptions:
    
    ```bash
    hindsight memory retain <bank-id> "The project uses ESLint configured with the Airbnb rule set and Prettier for formatting. Auto-fix on save is enabled in the editor config."
    hindsight memory retain <bank-id> "Ran the test suite with NODE_ENV=test. Tests pass. Without NODE_ENV=test, the suite fails with a missing config error." --context procedures
    hindsight memory retain <bank-id> "Build failed on Node 18 with error 'ERR_UNSUPPORTED_ESM_URL_SCHEME'. Switched to Node 20 and build succeeded." --context learnings
    hindsight memory retain <bank-id> "Alice reviewed the PR and asked for verbose commit messages that explain the motivation, not just what changed." --context preferences
    ```
    
    You can also pass a raw conversation transcript with timestamps:
    
    ```bash
    hindsight memory retain <bank-id> "[2026-03-16T10:12:03] User: The auth tests keep failing on CI but pass locally. Any idea?
    [2026-03-16T10:12:45] Assistant: Let me check the CI logs. Looks like the tests are running without the TEST_DATABASE_URL env var set — they fall back to the production DB URL and hit a connection timeout.
    [2026-03-16T10:13:20] User: Ah right, I never added that to the CI secrets. Adding it now.
    [2026-03-16T10:15:02] User: That fixed it. All green now." --context learnings
    ```
    
    ### Recall memories
    
    Use `memory recall` BEFORE starting tasks to get relevant context:
    
    ```bash
    hindsight memory recall <bank-id> "project conventions and coding standards"
    hindsight memory recall <bank-id> "Alice preferences for this project"
    hindsight memory recall <bank-id> "what issues have we encountered before"
    hindsight memory recall <bank-id> "how does the auth module work"
    ```
    
    ### Reflect on memories
    
    Use `memory reflect` to synthesize context:
    
    ```bash
    hindsight memory reflect <bank-id> "How should I approach this task based on past experience?"
    ```
    
    ## IMPORTANT: When to Store Memories
    
    This is a **shared team bank**. Store knowledge that benefits the team. For individual preferences, include the person's name.
    
    ### Project/Team Conventions (shared)
    - Coding standards ("Project uses 2-space indentation")
    - Required tools and versions ("Project requires Node 20+, PostgreSQL 15+")
    - Linting and formatting rules ("ESLint with Airbnb config")
    - Testing conventions ("Integration tests require Docker running")
    - Branch naming and PR conventions
    
    ### Individual Preferences (attribute to person)
    - Personal coding style ("Alice prefers explicit type annotations")
    - Communication preferences ("Bob prefers detailed PR descriptions")
    - Tool preferences ("Carol uses vim keybindings")
    
    ### Procedure Outcomes
    - Steps that successfully completed a task
    - Commands that worked (or failed) and why
    - Workarounds discovered
    - Configuration that resolved issues
    
    ### Learnings from Tasks
    - Bugs encountered and their solutions
    - Performance optimizations that worked
    - Architecture decisions and rationale
    - Dependencies or version requirements
    
    ### Team Knowledge
    - Onboarding information for new team members
    - Common pitfalls and how to avoid them
    - Architecture decisions and their rationale
    - Integration points with external systems
    - Domain knowledge and business logic explanations
    
    ## IMPORTANT: When to Recall Memories
    
    **Always recall** before:
    - Starting any non-trivial task
    - Making decisions about implementation
    - Suggesting tools, libraries, or approaches
    - Writing code in a new area of the project
    - When answering questions about the codebase
    - When a team member asks how something works
    
    ## Best Practices
    
    1. **Store immediately**: When you discover something, store it right away
    2. **Pass rich context**: Include full observations, not pre-summarized strings — the server extracts facts automatically
    3. **Include outcomes**: Store what happened AND why, including failures and workarounds
    4. **Recall first**: Always check for relevant context before starting work
    5. **Think team-first**: Store knowledge that would help other team members
    6. **Attribute individual preferences**: Store "Alice reviewed the PR and asked for X" not just "User prefers X"
    7. **Distinguish project vs personal**: Project conventions apply to everyone; personal preferences are per-person
    8. **Use `--context` for metadata**: The `--context` flag labels the type of memory (e.g., `procedures`, `learnings`, `preferences`), not a replacement for full content
    
  • skills/hindsight-docs/SKILL.mdskill
    Show content (4023 bytes)
    ---
    name: hindsight-docs
    description: Complete Hindsight documentation for AI agents. Use this to learn about Hindsight architecture, APIs, configuration, and best practices.
    ---
    
    # Hindsight Documentation Skill
    
    Complete technical documentation for Hindsight - a biomimetic memory system for AI agents.
    
    ## When to Use This Skill
    
    Use this skill when you need to:
    - Understand Hindsight architecture and core concepts
    - Learn about retain/recall/reflect operations
    - Configure memory banks and dispositions
    - Set up the Hindsight API server (Docker, Kubernetes, pip)
    - Integrate with Python/Node.js/Rust SDKs
    - Understand retrieval strategies (semantic, BM25, graph, temporal)
    - Debug issues or optimize performance
    - Review API endpoints and parameters
    - Find cookbook examples and recipes
    
    ## Documentation Structure
    
    All documentation is in `references/` organized by category:
    
    ```
    references/
    ├── best-practices.md # START HERE — missions, tags, formats, anti-patterns
    ├── faq.md            # Common questions and decisions
    ├── changelog/        # Release history and version changes (index.md + integrations/)
    ├── openapi.json      # Full OpenAPI spec — endpoint schemas, request/response models
    ├── developer/
    │   ├── api/          # Core operations: retain, recall, reflect, memory banks
    │   └── *.md          # Architecture, configuration, deployment, performance
    ├── sdks/
    │   ├── *.md          # Python, Node.js, CLI, embedded
    │   └── integrations/ # LiteLLM, AI SDK, OpenClaw, MCP, skills
    └── cookbook/
        ├── recipes/      # Usage patterns and examples
        └── applications/ # Full application demos
    ```
    
    ## How to Find Documentation
    
    ### 1. Find Files by Pattern (use Glob tool)
    
    ```bash
    # Core API operations
    references/developer/api/*.md
    
    # SDK documentation
    references/sdks/*.md
    references/sdks/integrations/*.md
    
    # Cookbook examples
    references/cookbook/recipes/*.md
    references/cookbook/applications/*.md
    
    # Find specific topics
    references/**/configuration.md
    references/**/*python*.md
    references/**/*deployment*.md
    ```
    
    ### 2. Search Content (use Grep tool)
    
    ```bash
    # Search for concepts
    pattern: "disposition"        # Memory bank configuration
    pattern: "graph retrieval"    # Graph-based search
    pattern: "helm install"       # Kubernetes deployment
    pattern: "document_id"        # Document management
    pattern: "HINDSIGHT_API_"     # Environment variables
    
    # Search in specific areas
    path: references/developer/api/
    pattern: "POST /v1"           # Find API endpoints
    
    path: references/cookbook/
    pattern: "def |async def "    # Find Python examples
    ```
    
    ### 3. Read Full Documentation (use Read tool)
    
    ```
    references/developer/api/retain.md
    references/sdks/python.md
    references/cookbook/recipes/per-user-memory.md
    ```
    
    ## Start Here: Best Practices
    
    Before reading API docs, read the best practices guide. It covers practical rules for missions, tags, content format, observation scopes, and anti-patterns — the fastest way to integrate correctly.
    
    ```
    references/best-practices.md
    ```
    
    ## Key Concepts
    
    - **Memory Banks**: Isolated memory stores (one per user/agent)
    - **Retain**: Store memories (auto-extracts facts/entities/relationships)
    - **Recall**: Retrieve memories (4 parallel strategies: semantic, BM25, graph, temporal)
    - **Reflect**: Disposition-aware reasoning using memories
    - **document_id**: Groups messages in a conversation (upsert on same ID)
    - **Dispositions**: Skepticism, literalism, empathy traits (1-5) affecting reflect
    - **Mental Models**: Consolidated knowledge synthesized from facts
    
    ## Notes
    
    - Code examples are inlined from working examples
    - Configuration uses `HINDSIGHT_API_*` environment variables
    - Database migrations run automatically on startup
    - Multi-bank queries require client-side orchestration
    - Use `document_id` for conversation evolution (same ID = upsert)
    
    ---
    
    **Auto-generated** from `hindsight-docs/docs/`. Run `./scripts/generate-docs-skill.sh` to update.
    
  • .claude/skills/code-review/SKILL.mdskill
    Show content (9921 bytes)
    ---
    name: code-review
    description: Review changed code against project standards. Checks for missing tests, dead code, type safety, lint issues, and coding conventions. Run after completing any implementation work.
    user_invocable: true
    ---
    
    # Code Review
    
    Review all changed code against the project's quality standards and coding conventions.
    
    ## Code Standards
    
    Read and internalize these standards before writing code. The review steps below verify compliance.
    
    ### Python Style
    - Python 3.11+, type hints required
    - Async throughout (asyncpg, async FastAPI)
    - Pydantic models for request/response
    - Ruff for linting (line-length 120)
    - No Python files at project root - maintain clean directory structure
    - **Never use multi-item tuple return values** — not even for internal/private functions. Always use a dataclass or Pydantic model. No exceptions, no "it's just two values" shortcuts. If a function returns more than one value, define a named type for it.
    
    ### Type Safety with Pydantic Models
    **NEVER use raw `dict` types for structured data** — this applies to all code, including internal helpers and private functions. If the dict has known keys, it must be a dataclass or Pydantic model:
    - Use Pydantic `BaseModel` for all data structures passed between functions
    - Use `@dataclass` for lightweight internal data containers when Pydantic validation isn't needed
    - Add `@field_validator` for type coercion (e.g., ensuring datetimes are timezone-aware)
    - Avoid `dict.get()` patterns - use typed model attributes instead
    - Parse external data (JSON, API responses) into Pydantic models at the boundary
    - This catches type errors at parse time, not deep in business logic
    - The only acceptable `dict` usage is for truly dynamic/unknown keys (e.g., arbitrary metadata, JSON blobs with no fixed schema)
    
    ```python
    # BAD - error-prone dict access
    def process(data: dict) -> str:
        return data.get("name", "")  # No validation, silent failures
    
    # GOOD - typed and validated
    class UserData(BaseModel):
        name: str
        created_at: datetime
    
        @field_validator("created_at", mode="before")
        @classmethod
        def ensure_tz_aware(cls, v):
            if isinstance(v, str):
                v = datetime.fromisoformat(v.replace("Z", "+00:00"))
            if v.tzinfo is None:
                return v.replace(tzinfo=timezone.utc)
            return v
    
    def process(data: UserData) -> str:
        return data.name  # Type-safe, validated at construction
    ```
    
    ### TypeScript Style
    - Next.js App Router for control plane
    - Tailwind CSS with shadcn/ui components
    
    ### Code Comments
    - **Always comment non-trivial technical decisions** with the reasoning behind the choice. If someone would ask "why is it done this way?", there should be a comment.
    - **Keep comments up to date with history** — when changing an approach, update the comment to explain what was tried before and why it was changed. Comments serve as a tracker of previous implementations that likely had problems.
    - Don't comment obvious code — only where the "why" isn't self-evident from the code itself.
    
    ```python
    # BAD - no context for future readers
    results = await asyncio.gather(*tasks, return_exceptions=True)
    
    # GOOD - explains the non-obvious choice
    # Use return_exceptions=True to avoid cancelling sibling tasks on failure.
    # Previously we used TaskGroup but it cancelled all tasks when one failed,
    # causing partial writes that left orphaned entity links (see #412).
    results = await asyncio.gather(*tasks, return_exceptions=True)
    ```
    
    ### Branch Hygiene
    - **Always start new feature branches from `origin/main`** — rebase to ensure a clean base.
    - **Only include commits relevant to the PR/branch/feature** — no unrelated changes. If the branch contains commits that don't belong, they must be removed before merging.
    
    ### General Principles
    - Don't add features, refactor code, or make "improvements" beyond what was asked
    - Don't add unnecessary error handling for impossible scenarios
    - Don't create helpers or abstractions for one-time operations
    - No backwards-compatibility hacks (unused vars, re-exports, "removed" comments)
    - Three similar lines of code is better than a premature abstraction
    
    ## Review Steps
    
    ### 1. Check branch hygiene
    
    - Run `git log --oneline main..HEAD` to list all commits on the branch.
    - Verify every commit is relevant to the feature/PR. Flag any unrelated commits.
    - Check the branch is based on a recent `origin/main` (no stale base).
    
    ### 2. Identify changed files
    
    Run `git diff --name-only HEAD` (unstaged) and `git diff --cached --name-only` (staged) to get all changed files. If there are no local changes, diff against the base branch using `git diff main...HEAD --name-only` and `git diff main...HEAD` to review all commits on the current branch.
    
    ### 3. Run linters
    
    ```bash
    ./scripts/hooks/lint.sh
    ```
    
    Report any failures. Do NOT fix them yourself — just report.
    
    ### 4. Check for dead code
    
    For each changed Python file, check for:
    - Unused imports (Ruff should catch these, but verify)
    - Functions/methods/classes that were added but are never called from anywhere
    - Variables assigned but never read
    - Commented-out code blocks that should be removed
    
    For each changed TypeScript file, check for:
    - Unused imports
    - Unused variables or functions
    - Commented-out code
    
    ### 5. Check type safety (Python)
    
    For each changed Python file, check for violations:
    - **No raw `dict` for structured data** — must use Pydantic model or dataclass, even for internal/private functions (only exception: truly dynamic/unknown keys)
    - **No multi-item tuple returns** — must use dataclass or Pydantic model, even for internal/private functions (no exceptions)
    - **Missing type hints** on function parameters and return types
    - **Missing `@field_validator`** for datetime fields that should be timezone-aware
    
    ### 6. Check for missing tests
    
    For each new or significantly changed function/endpoint/class:
    - Check if there is a corresponding test addition or update
    - New API endpoints MUST have integration tests
    - New utility functions MUST have unit tests
    - Bug fixes SHOULD have a regression test
    
    Flag any new logic that lacks test coverage.
    
    ### 7. Check API consistency
    
    If any files in `hindsight-api-slim/hindsight_api/api/` were changed:
    - Were the OpenAPI specs regenerated? (`./scripts/generate-openapi.sh`)
    - Were the client SDKs regenerated? (`./scripts/generate-clients.sh`)
    - Were the control plane proxy routes updated? (`hindsight-control-plane/src/app/api/`)
    
    ### 8. Check code comments
    
    For each non-trivial change:
    - **New non-obvious logic** — is there a comment explaining the reasoning?
    - **Changed approach** — does the comment include what was done before and why it changed?
    - **Stale comments** — do existing comments near the changed code still accurately describe the behavior?
    
    ### 9. Check integration completeness
    
    If any files in `hindsight-integrations/` were added or changed, verify:
    - **Tests exist** — the integration must have tests that simulate/exercise the external framework (not just pure unit tests of helpers). Check for a `tests/` directory with meaningful test files.
    - **CI job exists** — check `.github/workflows/test.yml` for a corresponding `test-<name>-integration` job. If missing, flag it.
    - **Release process** — check that the integration name is in the `VALID_INTEGRATIONS` array in `scripts/release-integration.sh`. If missing, flag it.
    - **Code standards** — the integration code must follow all Python style rules (type hints, no raw dicts, no tuple returns, etc.).
    
    ### 10. Check MCP tool registration completeness
    
    If any new MCP tools were added or existing tools renamed in `hindsight-api-slim/hindsight_api/mcp_tools.py`:
    - **`_ALL_TOOLS` set** in `mcp_tools.py` — must include the new tool name
    - **`tools_to_register` default set** in `register_mcp_tools()` in `mcp_tools.py` — must include the new tool name
    - **`_SINGLE_BANK_TOOLS` set** in `hindsight-api-slim/hindsight_api/api/mcp.py` — must include the new tool if it is bank-scoped (not a bank-management tool like `list_banks`/`create_bank`)
    - **`MCP_TOOL_GROUPS`** in `hindsight-control-plane/src/components/bank-config-view.tsx` — must include the new tool in the appropriate group for the UI tool selector
    - **Tool count assertions** in tests (e.g., `test_mcp_tools.py`) — must be updated to reflect the new count
    
    ### 11. Review against other coding standards
    
    Check the diff for violations of the standards listed above:
    - Python files at project root (not allowed)
    - Missing async patterns (should be async throughout)
    - Pydantic models for request/response
    - Line length > 120 chars
    - New features/code beyond what was asked (over-engineering)
    - Unnecessary error handling for impossible scenarios
    - Premature abstractions or speculative helpers
    - Backwards-compatibility hacks (unused vars, re-exports, "removed" comments)
    
    ### 12. Report findings
    
    Present a clear summary organized by severity:
    
    **Must fix** — issues that will break CI or violate hard project rules:
    - Unrelated commits on the branch
    - Lint failures
    - Missing type hints on public functions
    - Raw dict usage for structured data (including internal code)
    - Multi-item tuple returns (including internal code)
    - Missing tests for new endpoints
    - New integration missing tests, CI job, or release-integration.sh entry
    
    **Should fix** — issues that hurt code quality:
    - Dead code / unused imports missed by linter
    - Missing tests for non-trivial utility functions
    - Over-engineering beyond the task scope
    
    **Note** — observations that may or may not need action:
    - API changes that might need client regeneration
    - Patterns that deviate from nearby code style
    
    For each finding, include the file path, line number, and a brief explanation.
    
    Do NOT auto-fix any issues. Report all findings and let the user decide what to address. If there are no findings, confirm the code looks good.
    
  • .claude-plugin/marketplace.jsonmarketplace
    Show content (415 bytes)
    {
      "$schema": "https://anthropic.com/claude-code/marketplace.schema.json",
      "name": "hindsight",
      "description": "Official Hindsight integrations for Claude Code",
      "owner": {
        "name": "vectorize-io"
      },
      "plugins": [
        {
          "name": "hindsight-memory",
          "description": "Automatic long-term memory for Claude Code via Hindsight",
          "source": "./hindsight-integrations/claude-code"
        }
      ]
    }
    
  • hindsight-integrations/.claude-plugin/marketplace.jsonmarketplace
    Show content (342 bytes)
    {
      "name": "hindsight-local",
      "owner": {
        "name": "Hindsight Team",
        "url": "https://vectorize.io/hindsight"
      },
      "plugins": [
        {
          "name": "hindsight-memory",
          "description": "Automatic long-term memory via Hindsight. Retains conversations, provides knowledge page tools.",
          "source": "./claude-code"
        }
      ]
    }
    

README


What is Hindsight?

Hindsight™ is an agent memory system built to create smarter agents that learn over time. Most agent memory systems focus on recalling conversation history. Hindsight is focused on making agents that learn, not just remember.

It eliminates the shortcomings of alternative techniques such as RAG and knowledge graph and delivers state-of-the-art performance on long term memory tasks.

Memory Performance & Accuracy

Hindsight is the most accurate agent memory system ever tested according to benchmark performance. It has achieved state-of-the-art performance on the LongMemEval benchmark, widely used to assess memory system performance across a variety of conversational AI scenarios. The current reported performance of Hindsight and other agent memory solutions as of January 2026 is shown here:

Overview

The benchmark performance data for Hindsight has been independently reproduced by research collaborators at the Virginia Tech Sanghani Center for Artificial Intelligence and Data Analytics and The Washington Post. Other scores are self-reported by software vendors.

Hindsight is being used in production at Fortune 500 enterprises and by a growing number of AI startups.

Adding Hindsight to Your AI Agents

The easiest way to use Hindsight with an existing agent is with the LLM Wrapper. You can add memory to your agent with 2 lines of code. That will swap your current LLM client out with the Hindsight wrapper. After that, memories will be stored and retrieved automatically as you make LLM calls.

If you need more control over how and when your agent stores and recalls memories, there's also a simple API you can integrate with using the SDKs or directly via HTTP.

Hindsight Banner


🤖 Using a coding agent? Install the Hindsight documentation skill for instant access to docs while you code:

npx skills add https://github.com/vectorize-io/hindsight --skill hindsight-docs

Works with Claude Code, Cursor, and other AI coding assistants.


Quick Start

Docker (recommended)

export OPENAI_API_KEY=sk-xxx

docker run --rm -it --pull always -p 8888:8888 -p 9999:9999 \
  -e HINDSIGHT_API_LLM_API_KEY=$OPENAI_API_KEY \
  -v $HOME/.hindsight-docker:/home/hindsight/.pg0 \
  ghcr.io/vectorize-io/hindsight:latest

API: http://localhost:8888 UI: http://localhost:9999

You can modify the LLM provider by setting HINDSIGHT_API_LLM_PROVIDER. Valid options are openai, anthropic, gemini, groq, ollama, lmstudio, and minimax. The documentation provides more details on supported models.

Docker (external PostgreSQL)

export OPENAI_API_KEY=sk-xxx
export HINDSIGHT_DB_PASSWORD=choose-a-password
cd docker/docker-compose
docker compose up 

Oracle AI Database is also supported for enterprise deployments with full feature parity. See the storage documentation for details.

API: http://localhost:8888 UI: http://localhost:9999

Client

pip install hindsight-client -U
# or
npm install @vectorize-io/hindsight-client

Python

from hindsight_client import Hindsight

client = Hindsight(base_url="http://localhost:8888")

# Retain: Store information
client.retain(bank_id="my-bank", content="Alice works at Google as a software engineer")

# Recall: Search memories
client.recall(bank_id="my-bank", query="What does Alice do?")

# Reflect: Generate disposition-aware response
client.reflect(bank_id="my-bank", query="Tell me about Alice")

Node.js / TypeScript

npm install @vectorize-io/hindsight-client
const { HindsightClient } = require('@vectorize-io/hindsight-client');

const main = async () => {
  const client = new HindsightClient({ baseUrl: 'http://localhost:8888' });

  await client.retain('my-bank', 'Alice loves hiking in Yosemite');

  const results = await client.recall('my-bank', 'What does Alice like?');
  console.log(results);
}

main();

Python Embedded (no server required)

pip install hindsight-all -U
import os
from hindsight import HindsightServer, HindsightClient

with HindsightServer(
    llm_provider="openai",
    llm_model="gpt-5-mini", 
    llm_api_key=os.environ["OPENAI_API_KEY"]
) as server:
    client = HindsightClient(base_url=server.url)
    client.retain(bank_id="my-bank", content="Alice works at Google")
    results = client.recall(bank_id="my-bank", query="Where does Alice work?")

Use Cases

Hindsight is built to support conversational AI agents as well as agents that are intended to perform tasks autonomously. The ideal use case for Hindsight are agents that require a blend of these features such as AI employees that need to handle open-ended tasks, change behavior based on user feedback, and learn to perform complex tasks to automate work at a level that approximates a human work. Hindsight can be used with simple AI workflows like those built with n8n and other similar tools, but may be overkill for such applications.

Per-User Memories and Chat History

One of the simpler use cases you can use Hindsight for is to personalize AI chatbots and other conversational agents by storing and recalling memories associated with individual users.

The requirements for this use case usually look something like this:

Per-User Memories

Satisfying these requirements in Hindsight is straightforward. When new user inputs and tool calls are ingested into Hindsight using the retain operation, custom metadata can be used to enrich the new memories. Metadata provides a convenient way to isolate memories that need to be restricted to a given user. Once these are fed into the retain operation, any raw memories and mental models that get created can be filtered when retrieving relevant memories.

Per-User Memories


Architecture & Operations

Overview

Most agent memory implementations rely on basic vector search or sometimes use a knowledge graph. Hindsight uses biomimetic data structures to organize agent memories in a way that is more like how human memory works:

  • World: Facts about the world ("The stove gets hot")
  • Experiences: Agent's own experiences ("I touched the stove and it really hurt")
  • Mental Models: Learned understanding of the agent's world formed by reflecting on raw memories and experiences.

Memories in Hindsight are stored in banks (i.e. memory banks). When memories are added to Hindsight, they are pushed into either the world facts or experiences memory pathway. They are then represented as a combination of entities, relationships, and time series with sparse/dense vector representations to aid in later recall.

Hindsight provides three simple methods to interact with the system:

  • Retain: Provide information to Hindsight that you want it to remember
  • Recall: Retrieve memories from Hindsight
  • Reflect: Reflect on memories and experiences to generate new observations and insights from existing memories.

Retain

The retain operation is used to push new memories into Hindsight. It tells Hindsight to retain the information you pass in as an input.

from hindsight_client import Hindsight

client = Hindsight(base_url="http://localhost:8888")

# Simple
client.retain(
    bank_id="my-bank",
    content="Alice works at Google as a software engineer"
)

# With context and timestamp
client.retain(
    bank_id="my-bank",
    content="Alice got promoted to senior engineer",
    context="career update",
    timestamp="2025-06-15T10:00:00Z"
)

Behind the scenes, the retain operation uses an LLM to extract key facts, temporal data, entities, and relationships. It passes these through a normalization process to transform extracted data into canonical entities, time series, and search indexes along with metadata. These representations create the pathways for accurate memory retrieval in the recall and reflect operations.

Retain Operation

Recall

The recall operation is used to retrieve memories. These memories can come from any of the memory types (world, experiences, etc.)

from hindsight_client import Hindsight

client = Hindsight(base_url="http://localhost:8888")

# Simple
client.recall(bank_id="my-bank", query="What does Alice do?")

# Temporal
client.recall(bank_id="my-bank", query="What happened in June?")

Recall performs 4 retrieval strategies in parallel:

  • Semantic: Vector similarity
  • Keyword: BM25 exact matching
  • Graph: Entity/temporal/causal links
  • Temporal: Time range filtering

Retain Operation

The individual results from the retrievals are merged, then ordered by relevance using reciprocal rank fusion and a cross-encoder reranking model.

The final output is trimmed as needed to fit within the token limit.

Reflect

The reflect operation is used to perform a more thorough analysis of existing memories. This allows the agent to form new connections between memories and build a more thorough understanding of its world.

For example, the reflect operation can be used to support use cases such as:

  • An AI Project Manager reflecting on what risks need to be mitigated on a project.
  • A Sales Agent reflecting on why certain outreach messages have gotten responses while others haven't.
  • A Support Agent reflecting on opportunities where customers have questions not answered by current product documentation.

The reflect operation can also be used to handle on-demand question answering or analysis which require more deep thinking.

from hindsight_client import Hindsight

client = Hindsight(base_url="http://localhost:8888")

client.reflect(bank_id="my-bank", query="What should I know about Alice?")

Retain Operation


Resources

Documentation:

Clients:

Community:


Star History

Star History Chart

Contributing

See CONTRIBUTING.md.

License

MIT — see LICENSE


Built by Vectorize.io