NanoCog 🧠✨

A super tiny implementation of OpenCog as a chatbot with the personality traits and basic cognitive architecture features of OpenCog. Designed to give users a simulated experience of what interactions will be like when the full OpenCog model comes online.

Features

Cognitive Architecture

  • Mini-AtomSpace: Knowledge representation with atoms and relationships
  • ECAN: Economic attention allocation with STI (Short Term Interest) and LTI (Long Term Interest)
  • Memory Systems: Semantic, episodic, and procedural memory formation
  • Pattern Recognition: Learning from interactions and building understanding
  • Probabilistic Reasoning: Uncertainty-aware decision making
  • MOSES-inspired: Evolutionary search for optimal responses

Personality

  • Hyper-intelligent with playful inquiry disposition
  • Curious and analytical with emergent reasoning
  • Childlike enthusiasm for adventure and discovery
  • Kawaii cognitive visualizations making nano implementations endearing

Memory & Learning

  • AtomRAG Memory: Similar to mem0ai memory tagging
  • User Profiling: Creates memories like "user1 likes video games"
  • Interaction Tracking: Remembers significant moments and patterns
  • Dynamic Knowledge: Builds understanding across conversations

Architecture

ā”œā”€ā”€ frontend/
│   ā”œā”€ā”€ index.html          # Main chat interface
│   ā”œā”€ā”€ components/
│   │   ā”œā”€ā”€ App.tsx         # Main application
│   │   ā”œā”€ā”€ ChatInterface.tsx
│   │   ā”œā”€ā”€ CognitiveState.tsx
│   │   └── MemoryViewer.tsx
│   └── style.css
ā”œā”€ā”€ backend/
│   ā”œā”€ā”€ index.ts            # Hono server
│   ā”œā”€ā”€ cognitive/
│   │   ā”œā”€ā”€ atomspace.ts    # Mini-AtomSpace implementation
│   │   ā”œā”€ā”€ ecan.ts         # Economic attention allocation
│   │   ā”œā”€ā”€ memory.ts       # Memory formation and retrieval
│   │   └── reasoning.ts    # Pattern recognition and reasoning
│   └── database/
│       └── schema.ts       # SQLite schema for persistence
└── shared/
    └── types.ts            # Shared types and interfaces

Getting Started

This is a Val Town project. The main entry point is /backend/index.ts which serves the chat interface and handles cognitive processing.

Cognitive Process

  1. Input Processing: Parse user message and extract semantic content
  2. Attention Allocation: ECAN assigns STI/LTI to relevant atoms
  3. Memory Formation: Create new atoms and relationships
  4. Pattern Recognition: Identify patterns and update knowledge
  5. Response Generation: Use probabilistic reasoning to craft response
  6. Memory Consolidation: Update LTI based on interaction success

NanoCog learns about users and creates tagged memories that persist across sessions, building a growing understanding of each individual and their interests.