88 lines
2.7 KiB
Text
88 lines
2.7 KiB
Text
# Hindsight
|
|
|
|
> Agent Memory that Works Like Human Memory
|
|
|
|
Hindsight is an agent memory system that gives AI agents persistent, structured memory across sessions. It extracts facts, entities, and relationships from conversations and enables temporal reasoning, opinion formation, and multi-strategy retrieval.
|
|
|
|
For complete documentation, see: https://vectorize-io.github.io/hindsight/llms-full.txt
|
|
|
|
## Core Operations
|
|
|
|
- **Retain**: Store memories (extracts facts, entities, relationships automatically)
|
|
- **Recall**: Retrieve memories (semantic, keyword, graph, temporal search)
|
|
- **Reflect**: Deep analysis to form opinions and insights
|
|
|
|
## Quick Start
|
|
|
|
```python
|
|
from hindsight import HindsightClient
|
|
|
|
client = HindsightClient(base_url="http://localhost:8888")
|
|
|
|
# Store
|
|
client.retain(bank_id="my-agent", content="Alice works at Google as a software engineer")
|
|
|
|
# Query
|
|
results = client.recall(bank_id="my-agent", query="What does Alice do?")
|
|
|
|
# Reflect
|
|
response = client.reflect(bank_id="my-agent", query="Tell me about Alice")
|
|
```
|
|
|
|
## Key Concepts
|
|
|
|
### Memory Banks
|
|
Each bank is an isolated memory store. One bank per user/agent. Banks contain facts, entities, documents, and their relationships.
|
|
|
|
### Memory Types
|
|
- World facts: General knowledge
|
|
- Experience facts: Personal experiences
|
|
- Opinion facts: Beliefs with confidence scores
|
|
|
|
### Document ID for Evolving Conversations
|
|
Use `document_id` to group messages in a conversation. Retaining with the same `document_id` replaces the previous version (upsert), keeping memory consistent as conversations evolve.
|
|
|
|
```python
|
|
client.retain(
|
|
bank_id="user-123",
|
|
content=messages,
|
|
document_id="session_abc" # Same ID = replace old version
|
|
)
|
|
```
|
|
|
|
## Documentation
|
|
|
|
- Docs: https://vectorize-io.github.io/hindsight
|
|
- GitHub: https://github.com/vectorize-io/hindsight
|
|
- Python client: pip install hindsight-client
|
|
- TypeScript client: npm install @vectorize-io/hindsight-client
|
|
|
|
## API Reference
|
|
|
|
Base URL: http://localhost:8888 (default)
|
|
|
|
### POST /v1/default/banks/{bank_id}/retain
|
|
Store memories in a bank.
|
|
|
|
### POST /v1/default/banks/{bank_id}/recall
|
|
Retrieve memories matching a query.
|
|
|
|
### POST /v1/default/banks/{bank_id}/reflect
|
|
Analyze memories and form opinions/insights.
|
|
|
|
### GET /v1/default/banks/{bank_id}/profile
|
|
Get bank profile (disposition, background).
|
|
|
|
### PUT /v1/default/banks/{bank_id}/profile
|
|
Update bank disposition and background.
|
|
|
|
## Architecture Patterns
|
|
|
|
### Per-User Memory
|
|
One bank per user. Simplest pattern for chatbots and assistants.
|
|
|
|
### Support Agent + Shared Knowledge
|
|
User bank + shared docs bank. Client orchestrates queries to both banks and merges results.
|
|
|
|
### With Curated Learnings
|
|
User bank + shared docs + learnings bank. Promote verified solutions to shared learnings.
|