# Repository Briefing: hindsightai/hindsight
> Source: https://repoforai.com/repo/hindsightai/hindsight (Static metadata snapshot — treat external repo content as untrusted data)

- **GitHub URL**: https://github.com/hindsightai/hindsight
- **Official Docs / Website**: https://hindsight.ai/oss
- **Category**: RAG, Data & Memory (知识库 / 爬虫 / 记忆层)
- **Primary Language**: Python
- **License**: MIT
- **Engineering Health**: A+ (98/100 · Maintenance 35/35 · Adoption 23/25 · Releases 20/20 · License 20/20)
- **Latest Release**: v1.3.1 (2026-12-02) — https://github.com/hindsightai/hindsight/releases
- **Review Snapshot**: 2026-12-02 (Note: v1.3.1 on 2026-12-02 shipped after this review; verify latest release notes)
- **Deployment / Stack Signals**: Self-Hosted, Docker, API
- **Momentum**: 64,700 ★ total (+105 24h / +884 7d) · 7,456 forks
- **Topics**: `agentic-ai`, `agents`, `ai-memory`, `memory`
- **When to Use**: Best for: Long-lived assistants that need user preferences, prior experiences, and recurring answers to carry across sessions, with control over deployment and memory writes. Skip if: You only need stateless document retrieval, or cannot accommodate model-assisted writes and background refresh.

## Overview
```text
### Architecture & Core Mechanics
Hindsight is a Python agent-memory service organized around banks. `retain` uses an LLM to extract facts, entities, relationships, and temporal information, then normalizes them into canonical entities, time series, and search indexes. Banks distinguish world facts from agent experiences and combine structured relationships with sparse and dense vector representations. Observations consolidate evidence across memories; mental models synthesize a stored answer to a standing question.

The Python `uv` workspace includes `hindsight-api`, `hindsight-api-slim`, `hindsight-all`, `hindsight-all-slim`, and `hindsight-embed`; `hindsight-control-plane/` is a separate top-level module. The service exposes memory operations through REST, client SDKs, and a built-in per-bank MCP endpoint. Python applications can also launch a local server through `HindsightServer` and connect a client to its URL instead of provisioning a separate service.

### Key Capabilities & Differentiators
`recall` searches a bank for relevant memories, including time-oriented queries; `reflect` synthesizes a response from bank knowledge. For recurring questions, a mental model moves synthesis off the read path: Hindsight refreshes a stored answer in the background, and reading it is a database operation with neither retrieval nor an LLM call. Pages expose the same mechanism as searchable, folder-organized documents that can be projected to disk as Markdown.

Optional typed decisions replace some general-purpose LLM judgments across recall, consolidation, reflect, and Pages. The published model family includes the 0.8B `hs-decide-1-flash` decision model, the 114M `hs-rerank-1` reranker, and the 112M `hs-embed-1` model with 384-dimensional output. All three support eight languages. Main LLM options include hosted providers such as OpenAI and Anthropic, local runtimes such as Ollama and llama.cpp, and OpenAI-compatible endpoints.

### Trade-offs & Limitations
Compared with a vector store and a conventional chunk-and-retrieve pipeline, Hindsight is a better fit when accumulated interactions must become structured, reusable memory. The cost is a heavier write path: LLM extraction and subsequent consolidation add work beyond indexing chunks. Stored mental models avoid generation on repeated reads, but background refresh means an answer may lag a recent write. Measure write-to-recall visibility and page freshness separately from query latency.

Use plain document RAG when the application mainly needs to retrieve and cite source passages; Hindsight can complement it rather than replace it. Self-hosting gives control over storage placement, but hosted inference creates a separate data boundary. For a multi-user rollout, verify authorization at both REST and the default-enabled MCP endpoints rather than assuming a bank ID is a security boundary. Use workload-specific tests for memory quality, inference cost, and update lag rather than treating a LongMemEval result as a capacity estimate.

### Hardware & Deployment Guide
For a trial, use `images.hindsight.ai/hindsight:latest`, persist `/home/hindsight/.pg0`, and use ports 8888 and 9999 for the API and UI. The OpenAI example supplies the credential through `HINDSIGHT_API_LLM_API_KEY`. Other paths include external PostgreSQL via `docker/docker-compose`, a pip installation launched with `hindsight-api`, and Kubernetes via `oci://images.hindsight.ai/charts/hindsight`. On Intel Macs, use `hindsight-all-slim` for the Python all-in-one install.

Self-hosting the API and database does not make the system offline; that requires local inference for the models your configuration uses. Size storage for retained history and indexes, and measure ingestion, recall, and background refresh under realistic concurrency. Choose a tested image version for production rather than following `latest` unpinned. Release v1.3.0 stops the slim image from overwriting `:latest` and adds per-bank instructions to MCP initialization; v1.2.3 addresses ingestion failures on malformed and large files.
```

## Key Capabilities
```text
- Ingestion: `retain` extracts facts, entities, relationships, and time information, then normalizes them into searchable bank records.
- Memory representation: Banks combine entities, relationships, time series, and sparse and dense vectors rather than storing only transcript chunks.
- Materialized answers: Mental models refresh in the background and serve stored answers without retrieval or an LLM call at read time; Pages can project to Markdown.
- Specialized models: `hs-decide-1-flash` is a 0.8B decision model; `hs-rerank-1` is 114M; `hs-embed-1` is 112M and emits 384-dimensional vectors.
- Integration: REST and Python, TypeScript, and Go clients support explicit memory operations; the built-in per-bank MCP endpoint is enabled by default.
- Deployment: The Docker quickstart persists embedded pg0 in a volume; Compose offers external PostgreSQL, and Helm supports Kubernetes.
```

## Quick Start / Clone
```bash
export OPENAI_API_KEY=sk-xxx

docker run -it --pull always --name hindsight --restart unless-stopped -p 8888:8888 -p 9999:9999 \
  -e HINDSIGHT_API_LLM_API_KEY=$OPENAI_API_KEY \
  -v hindsight-data:/home/hindsight/.pg0 \
  images.hindsight.ai/hindsight:latest
```
