RCLL — self-hosted shared memory for a team of AI agents. Canonical repository; pushed out to github.com/Holetron-lab/fleet-memory. Fork of vectorize-io/hindsight (MIT). https://rcll.ai
Find a file
DK09876 dfccbf29f1
Added hindsight_liteLLM implementation (#17)
* Added hindsight_liteLLM implementation

* Add instructions for entity vs bank id

* Add another line about entity

* Address PR review comments and enhance litellm integration

- Remove deprecated limit parameter from recall() and arecall() functions
  since Hindsight uses budget/max_tokens for result control
- Remove dead MODEL_MAX_OUTPUT_TOKENS dict and max_output_tokens property
  from LLMProvider (superseded by hardcoded max_completion_tokens)
- Add test-litellm-integration job to CI workflow
- Add reflect API support with use_reflect config option
- Add verbose mode debug info via get_last_injection_debug()
- Add entity_id support for multi-user memory isolation
- Add retain() and reflect() wrapper functions
- Update docstrings and examples

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Make max_memories optional to allow unlimited memory injection

- Change max_memories default from 10 to None (no limit)
- When max_memories is None, all results from the API are used
- Fix recall result handling to properly detect list vs object return
- Update wrappers (OpenAI, Anthropic) with same optional behavior

This allows users to control memory limits via max_memory_tokens
and recall_budget without an artificial count limit.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Remove entity_id from hindsight_litellm; add gpt-4o token cap

Multi-user support now uses separate bank_ids per user instead of
entity_id scoping (e.g., bank_id=f"user-{user_id}"). This simplifies
the API and aligns with the Hindsight architecture.

Also fixes max_completion_tokens error for gpt-4o models by capping
the value at 16384 (gpt-4o's limit) instead of sending the default
65000 which exceeds the model's supported maximum.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Fix dark mode styling across Control Plane UI components

Improvements to ensure proper text visibility and contrast in both light
and dark modes:

- Add global CSS rules for datetime-local calendar picker icon visibility
  using filter: invert() for both light (0.5) and dark (1) modes
- Fix text colors in dialog components to use theme-aware foreground colors
- Update memory detail panel, document/chunk modals, and data views to use
  proper dark mode text classes (text-foreground, text-card-foreground)
- Fix form labels, headings, and content text in bank selector dialogs
- Update entities view and documents view table styling for dark mode
- Bump package versions to 0.1.4

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Remove session_id feature and add How It Works section to README

- Remove session_id and session management (new_session, set_session,
  get_session) from config.py, callbacks.py, and __init__.py
- Session management was a client-only abstraction not backed by core API
- Add "How It Works" section to README with visual flow diagram
- Update README to remove session management documentation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Fix readme example

* Add dark mode again

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-15 10:42:19 +01:00
.github/workflows Added hindsight_liteLLM implementation (#17) 2025-12-15 10:42:19 +01:00
cookbook prepare for release 2025-12-03 11:52:25 +01:00
docker/standalone Change npm packaging structure and fix contributing info (#16) 2025-12-12 14:14:19 -05:00
helm/hindsight Release v0.1.4 2025-12-11 14:24:06 +01:00
hindsight Release v0.1.4 2025-12-11 14:24:06 +01:00
hindsight-api Added hindsight_liteLLM implementation (#17) 2025-12-15 10:42:19 +01:00
hindsight-cli Release v0.1.4 2025-12-11 14:24:06 +01:00
hindsight-clients Change npm packaging structure and fix contributing info (#16) 2025-12-12 14:14:19 -05:00
hindsight-control-plane Added hindsight_liteLLM implementation (#17) 2025-12-15 10:42:19 +01:00
hindsight-dev Release v0.1.4 2025-12-11 14:24:06 +01:00
hindsight-docs Change npm packaging structure and fix contributing info (#16) 2025-12-12 14:14:19 -05:00
hindsight-integrations Added hindsight_liteLLM implementation (#17) 2025-12-15 10:42:19 +01:00
scripts Change npm packaging structure and fix contributing info (#16) 2025-12-12 14:14:19 -05:00
.dockerignore .dockerignore 2025-12-03 21:11:27 +01:00
.env.example Fix base CI issues and the defaults in .env.example (#24) 2025-12-11 16:48:12 -05:00
.gitignore Change npm packaging structure and fix contributing info (#16) 2025-12-12 14:14:19 -05:00
.python-version initial commit 2025-10-30 12:53:12 +01:00
.sesskey papers and fixes 2025-11-14 14:07:41 +01:00
AGENTS.md brandind and misc fixes 2025-12-11 12:46:48 +01:00
CODE_OF_CONDUCT.md add repo files 2025-12-04 10:20:26 +01:00
CONTRIBUTING.md Change npm packaging structure and fix contributing info (#16) 2025-12-12 14:14:19 -05:00
hindsight-favicon.png brandind and misc fixes 2025-12-11 12:46:48 +01:00
LICENSE Add license (#12) 2025-12-03 23:06:15 +01:00
openapi.json brandind and misc fixes 2025-12-11 12:46:48 +01:00
package-lock.json Change npm packaging structure and fix contributing info (#16) 2025-12-12 14:14:19 -05:00
package.json Change npm packaging structure and fix contributing info (#16) 2025-12-12 14:14:19 -05:00
pyproject.toml fix: ci and ui improvements (#8) 2025-12-03 15:08:39 +01:00
README.md Trademark to README 2025-12-14 18:58:34 -07:00
SECURITY.md add repo files 2025-12-04 10:20:26 +01:00
uv.lock switch to pg0-embedded (#28) 2025-12-12 19:13:26 +01:00


What is Hindsight?

Hindsight™ is an agent memory system built to create smarter agents that learn over time. It eliminates the shortcomings of alternative techniques such as RAG and knowledge graph.

Hindsight addresses common challenges that have frustrated AI engineers building agents to automate tasks and assist users with conversational interfaces. Many of these challenges stem directly from a lack of memory.

  • Inconsistency: Agents complete tasks successfully one time, then fail when asked to complete the same task again. Memory gives the agent a mechanism to remember what worked and what didn't and to use that information to reduce errors and improve consistency.
  • Hallucinations: Long term memory can be seeded with external knowledge to ground agent behavior in reliable sources to augment training data.
  • Cognitive Overload: As workflows get complex, retrievals, tool calls, user messages and agent responses can grow to fill the context window leading to context rot. Short term memory optimization allows agents to reduce tokens and focus context by removing irrelevant details.

How Hindsight Works

Overview

Hindsight organizes memory into four networks to mimic the way 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")
  • Opinion: Beliefs with confidence scores ("I shouldn't touch the stove again" - .99 confidence)
  • Observation: Complex mental models derived by reflecting on facts and experiences ("Curling irons, ovens, and fire are also hot. I shouldn't touch those either.")

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.

Memories in Hindsight are stored in banks (e.g. memory banks). When memories are retained, they are transformed to construct a series of search indexes, time series data, and entity/relationship graphs.


Quick Start

export OPENAI_API_KEY=your-key

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

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

Install client:

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

Python example:

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")

Python (embedded, no Docker)

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?")

Node.js / TypeScript

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

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

await client.retain('my-bank', 'Alice loves hiking in Yosemite');
await client.recall('my-bank', 'What does Alice like?');

Architecture & Operations

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 which are then persisted as opinions and/or observations. When building agents, the reflect operation is a key capability to enable the agent to learn from its experiences.

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:


Contributing

See CONTRIBUTING.md.

License

MIT — see LICENSE


Built by Vectorize.io