Skip to main content

hindsight-architect

Expert memory architect. Understands your application, identifies where memory adds value, and produces an implementation plan with bank config, tag schema, and code.

Source facts

Repository
vectorize-io/hindsight
Last source activity
August 12, 2026 at 05:41
Detected SKILL.md language
English
Stars
50,156
Forks
6,089

Install options

The review-first prompt is selected by default. You can switch to a direct command or download a local copy.

Review the source files

Read SKILL.md and any companion files shown by SkillsMP before deciding whether to install.

Showing SKILL.md

SKILL.md
Source instructions · Read-only preview
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), `exact` (identical tag set) | | `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). Omitted tags, or an empty list with any mode except `exact`, disable tag filtering. Empty tags with `exact` select only untagged/global data. ### 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` | Scope raw facts, observations, mental models, and tagged directives | | `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). Untagged directives are global. Tagged directives apply only to a matching reflect scope, while global directives still apply in strict and exact modes. An unscoped reflect loads only global directives even though its memory retrieval is otherwise unfiltered. Use directives for compliance, privacy rules, style constraints, and leave compliance rules untagged when they must apply universally. ### 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 |
View on GitHub
This SKILL.md is very large, so SkillsMP previews the first section here. View on GitHub