fleet-memory/hindsight-docs/docs/developer/api/memory-banks.md
2025-12-03 11:52:25 +01:00

7.9 KiB

sidebar_position
6

Memory Bank Identity

Configure memory bank personality, background, and behavior.

import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';

Creating a Memory Bank

from hindsight_client import Hindsight

client = Hindsight(base_url="http://localhost:8888")

client.create_bank(
    bank_id="my-bank",
    name="Research Assistant",
    background="I am a research assistant specializing in machine learning",
    personality={
        "openness": 0.8,
        "conscientiousness": 0.7,
        "extraversion": 0.5,
        "agreeableness": 0.6,
        "neuroticism": 0.3,
        "bias_strength": 0.5
    }
)
import { HindsightClient } from '@hindsight/client';

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

await client.createBank('my-bank', {
    name: 'Research Assistant',
    background: 'I am a research assistant specializing in machine learning',
    personality: {
        openness: 0.8,
        conscientiousness: 0.7,
        extraversion: 0.5,
        agreeableness: 0.6,
        neuroticism: 0.3,
        bias_strength: 0.5
    }
});
# Set background
hindsight agent background my-bank "I am a research assistant specializing in ML"

# Set personality
hindsight agent personality my-bank \
    --openness 0.8 \
    --conscientiousness 0.7 \
    --extraversion 0.5 \
    --agreeableness 0.6 \
    --neuroticism 0.3 \
    --bias-strength 0.5

Personality Traits (Big Five)

Each trait is scored 0.0 to 1.0:

Trait Low (0.0) High (1.0)
Openness Conventional, prefers proven methods Curious, embraces new ideas
Conscientiousness Flexible, spontaneous Organized, systematic
Extraversion Reserved, independent Outgoing, collaborative
Agreeableness Direct, analytical Cooperative, diplomatic
Neuroticism Calm, optimistic Risk-aware, cautious

How Traits Affect Behavior

Openness influences how the bank weighs new vs. established ideas:

# High openness bank
"Let's try this new framework—it looks promising!"

# Low openness bank
"Let's stick with the proven solution we know works."

Conscientiousness affects structure and thoroughness:

# High conscientiousness bank
"Here's a detailed, step-by-step analysis..."

# Low conscientiousness bank
"Quick take: this should work, let's try it."

Extraversion shapes collaboration preferences:

# High extraversion bank
"We should get the team together to discuss this."

# Low extraversion bank
"I'll analyze this independently and share my findings."

Agreeableness affects how disagreements are handled:

# High agreeableness bank
"That's a valid point. Perhaps we can find a middle ground..."

# Low agreeableness bank
"Actually, the data doesn't support that conclusion."

Neuroticism influences risk assessment:

# High neuroticism bank
"We should consider what could go wrong here..."

# Low neuroticism bank
"The risks seem manageable, let's proceed."

Background

The background is a first-person narrative providing bank context:

client.create_bank(
    bank_id="financial-advisor",
    background="""I am a conservative financial advisor with 20 years of experience.
    I prioritize capital preservation over aggressive growth.
    I have seen multiple market crashes and believe in diversification."""
)
await client.createBank('financial-advisor', {
    background: `I am a conservative financial advisor with 20 years of experience.
    I prioritize capital preservation over aggressive growth.
    I have seen multiple market crashes and believe in diversification.`
});

Background influences:

  • How questions are interpreted
  • Perspective in responses
  • Opinion formation context

Getting Bank Profile

# Using the low-level API
from hindsight_client_api import ApiClient, Configuration
from hindsight_client_api.api import DefaultApi

config = Configuration(host="http://localhost:8888")
api_client = ApiClient(config)
api = DefaultApi(api_client)

profile = api.get_bank_profile("my-bank")

print(f"Name: {profile.name}")
print(f"Background: {profile.background}")
print(f"Personality: {profile.personality}")
const profile = await client.getBankProfile('my-bank');

console.log(`Name: ${profile.name}`);
console.log(`Background: ${profile.background}`);
console.log(`Personality:`, profile.personality);
hindsight agent profile my-bank

Default Values

If not specified, banks use neutral defaults:

{
    "openness": 0.5,
    "conscientiousness": 0.5,
    "extraversion": 0.5,
    "agreeableness": 0.5,
    "neuroticism": 0.5,
    "bias_strength": 0.5,
    "background": ""
}

Personality Templates

Common personality configurations:

Use Case O C E A N Bias
Customer Support 0.5 0.7 0.6 0.9 0.3 0.4
Code Reviewer 0.4 0.9 0.3 0.4 0.5 0.6
Creative Writer 0.9 0.4 0.7 0.6 0.5 0.7
Risk Analyst 0.3 0.9 0.3 0.4 0.8 0.6
Research Assistant 0.8 0.8 0.4 0.5 0.4 0.5
Neutral (default) 0.5 0.5 0.5 0.5 0.5 0.5
# Customer support bank
client.create_bank(
    bank_id="support",
    background="I am a friendly customer support agent",
    personality={
        "openness": 0.5,
        "conscientiousness": 0.7,
        "extraversion": 0.6,
        "agreeableness": 0.9,  # Very diplomatic
        "neuroticism": 0.3,    # Calm under pressure
        "bias_strength": 0.4
    }
)

# Code reviewer bank
client.create_bank(
    bank_id="reviewer",
    background="I am a thorough code reviewer focused on quality",
    personality={
        "openness": 0.4,       # Prefers proven patterns
        "conscientiousness": 0.9,  # Very thorough
        "extraversion": 0.3,
        "agreeableness": 0.4,  # Direct feedback
        "neuroticism": 0.5,
        "bias_strength": 0.6
    }
)
// Customer support bank
await client.createBank('support', {
    background: 'I am a friendly customer support agent',
    personality: {
        openness: 0.5,
        conscientiousness: 0.7,
        extraversion: 0.6,
        agreeableness: 0.9,
        neuroticism: 0.3,
        bias_strength: 0.4
    }
});

// Code reviewer bank
await client.createBank('reviewer', {
    background: 'I am a thorough code reviewer focused on quality',
    personality: {
        openness: 0.4,
        conscientiousness: 0.9,
        extraversion: 0.3,
        agreeableness: 0.4,
        neuroticism: 0.5,
        bias_strength: 0.6
    }
});

Bank Isolation

Each bank has:

  • Separate memories — banks don't share memories
  • Own personality — traits are per-bank
  • Independent opinions — formed from their own experiences
# Store to bank A
client.retain(bank_id="bank-a", content="Python is great")

# Bank B doesn't see it
results = client.recall(bank_id="bank-b", query="Python")
# Returns empty
// Store to bank A
await client.retain('bank-a', 'Python is great');

// Bank B doesn't see it
const results = await client.recall('bank-b', 'Python');
// Returns empty