* Fix main-methods.py: entities is a dict, use .items() and .canonical_name * Migrate docs to use CodeSnippet components - Convert quickstart.md, retain.md, recall.md, reflect.md, memory-banks.md to .mdx - Use CodeSnippet to pull code from validated example scripts - Add missing 'name' parameter to create_bank calls - Fix main-methods.py entities iteration (dict not list) - Remove retain-new.mdx demo file * Migrate existing docs to match testing pattern with code snippet and add CLI tests to the CI * Fix doc-id issue + add main-method tests * CLI fixes * Update openAPI json * Fix rust build issues * increase sleep time for Hindsight to process the document * Added a polling sleep instead of fixed * Delete immediately fails, so create the doc a earlier in the test to get the doc ready * Add debug logs * Remove debug logs
88 lines
2.9 KiB
Text
88 lines
2.9 KiB
Text
---
|
|
sidebar_position: 6
|
|
---
|
|
|
|
# Memory Banks
|
|
|
|
Memory banks are isolated containers that store all memory-related data for a specific context or use case.
|
|
|
|
import Tabs from '@theme/Tabs';
|
|
import TabItem from '@theme/TabItem';
|
|
import CodeSnippet from '@site/src/components/CodeSnippet';
|
|
|
|
{/* Import raw source files */}
|
|
import memoryBanksPy from '!!raw-loader!@site/examples/api/memory-banks.py';
|
|
import memoryBanksMjs from '!!raw-loader!@site/examples/api/memory-banks.mjs';
|
|
|
|
## What is a Memory Bank?
|
|
|
|
A memory bank is a complete, isolated storage unit containing:
|
|
|
|
- **Memories** — Facts and information retained from conversations
|
|
- **Documents** — Files and content indexed for retrieval
|
|
- **Entities** — People, places, concepts extracted from memories
|
|
- **Relationships** — Connections between entities in the knowledge graph
|
|
|
|
Banks are completely isolated from each other — memories stored in one bank are not visible to another.
|
|
|
|
You don't need to pre-create a bank. Hindsight will automatically create it with default settings when you first use it.
|
|
|
|
:::tip Prerequisites
|
|
Make sure you've completed the [Quick Start](./quickstart) to install the client and start the server.
|
|
:::
|
|
|
|
## Creating a Memory Bank
|
|
|
|
<Tabs>
|
|
<TabItem value="python" label="Python">
|
|
<CodeSnippet code={memoryBanksPy} section="create-bank" language="python" />
|
|
</TabItem>
|
|
<TabItem value="node" label="Node.js">
|
|
<CodeSnippet code={memoryBanksMjs} section="create-bank" language="javascript" />
|
|
</TabItem>
|
|
<TabItem value="cli" label="CLI">
|
|
|
|
```bash
|
|
# Set background
|
|
hindsight bank background my-bank "I am a research assistant specializing in ML"
|
|
|
|
# Set disposition
|
|
hindsight bank disposition my-bank \
|
|
--skepticism 4 \
|
|
--literalism 3 \
|
|
--empathy 3
|
|
```
|
|
|
|
</TabItem>
|
|
</Tabs>
|
|
|
|
## Background and Disposition
|
|
|
|
Background and disposition are optional settings that influence how the bank forms opinions during [reflect](./reflect) operations.
|
|
|
|
:::info
|
|
Background and disposition only affect the `reflect` operation (opinion formation). They do not impact `retain`, `recall`, or other memory operations.
|
|
:::
|
|
|
|
### Background
|
|
|
|
The background is a first-person narrative providing context for opinion formation:
|
|
|
|
<Tabs>
|
|
<TabItem value="python" label="Python">
|
|
<CodeSnippet code={memoryBanksPy} section="bank-background" language="python" />
|
|
</TabItem>
|
|
<TabItem value="node" label="Node.js">
|
|
<CodeSnippet code={memoryBanksMjs} section="bank-background" language="javascript" />
|
|
</TabItem>
|
|
</Tabs>
|
|
|
|
### Disposition Traits
|
|
|
|
Disposition traits influence how opinions are formed during reflection. Each trait is scored 1 to 5:
|
|
|
|
| Trait | Low (1) | High (5) |
|
|
|-------|---------|----------|
|
|
| **Skepticism** | Trusting, accepts information at face value | Skeptical, questions and doubts claims |
|
|
| **Literalism** | Flexible interpretation, reads between the lines | Literal interpretation, takes things exactly as stated |
|
|
| **Empathy** | Detached, focuses on facts and logic | Empathetic, considers emotional context |
|