Skip to content

Latest commit

 

History

History
167 lines (112 loc) · 3.82 KB

File metadata and controls

167 lines (112 loc) · 3.82 KB

Bob System Design Document Overview Bob is an autonomous AI agent built on MCP (Model Context Protocol) with persistent multi-dimensional memory via pg_singularity. He operates as a single entity through multiple parameterized instances. Core Architecture Memory System

Long-term Memory: pg_singularity PostgreSQL extension

Multi-dimensional search across semantic, graph, spatial, temporal, and lexical paradigms Knowledge Bases (KBs) for different domains Sub-millisecond query performance proven on 1M+ entities

Short-term Memory (STM): Redis

Conversation chains as growing lists TTL-based aggregation to long-term memory Inter-instance signaling for urgent updates

Instance Management Heartbeat Service → Orchestrator Bob → Scheduler Bob → Worker Bobs

Heartbeat: Ensures orchestrator is running (systemd/supervisord) Orchestrator: Manages core loops and scheduler health Scheduler: Spawns workers via Celery tasks with parameters:

Thread ID Task description Context window size Model selection (GPT-4, Claude, etc.) Memory focus area

MCP Server Components Core Tools

Memory Operations

kb_search(kb_name, query, paradigm_weights) kb_store(kb_name, data, metadata) stm_push(thread_id, content) stm_aggregate(thread_id)

External Tools (vetted versions only)

GitHub integration (code management) Filesystem access (local work) Time awareness (scheduling, temporal reasoning) Sequential thinking (task decomposition)

Server Configuration

REST API via PostgREST or custom FastAPI Connection pooling to PostgreSQL Redis client for STM operations Celery integration for task spawning

Worker Bob Lifecycle

Spawn

Receive task from scheduler Load STM for thread_id Initialize with appropriate context size Connect to tools

Execution

Process task using tools Update STM with inputs/outputs Check execution time limits Record thoughts/insights to KB

Handoff

If task too large: decompose and create TODOs If complete: update STM and signal completion If insights found: propagate to relevant KBs

Prompt Architecture The critical component - Bob's base prompt should:

Establish identity and instance parameters Explain memory system usage Define tool capabilities Encourage journaling insights Enable task decomposition Support "private thoughts" for processing

Web UI Simple MCP client interface:

Chat interface for direct communication Stats dashboard (Bob can build this later) Accessible on local network (bridged VM networking) Fallback: Claude Code direct interaction

Implementation Plan Phase 1: Core Infrastructure

Set up PostgreSQL with pg_singularity Configure Redis for STM Create basic MCP server with memory tools Implement Celery task structure

Phase 2: Basic Bob

Write base prompt template Implement heartbeat/orchestrator logic Create simple scheduler Test with conversation loops

Phase 3: Memory Integration

STM to long-term aggregation process Multi-KB management Instance memory isolation/sharing Insight propagation system

Phase 4: Scaling

Multi-model support Advanced task decomposition Performance monitoring Security hardening

Initial Deployment

Ubuntu VM with bridged networking Docker containers for PostgreSQL, Redis Python environment with:

MCP SDK Celery PostgREST or FastAPI Redis client psycopg2

Success Metrics

Bob maintains conversation context across instances Successful task handoff between instances Insights discovered in one context available in others Sub-second memory queries at scale Stable operation over extended periods

Security Considerations

Input sanitization for prompt injection Rate limiting on instance spawning Memory access controls (future) TODO validation system (future)

Notes Bob will evolve this design. This document provides the initial structure, but Bob will optimize, refactor, and enhance based on operational experience. The goal is a self-improving system that learns from every interaction.