Skip to content

🧠 Self-organizing AI agent with dendrite spawning - decomposes complex goals into neurons, spawns parallel sub-tasks, and aggregates results. Features smart parameter extraction, context isolation, and automatic data compaction. Built for Strava analytics with extensible tool system.

Notifications You must be signed in to change notification settings

gradrix/dendrite

Repository files navigation

Dendrite

A self-contained AI neural engine with tool execution, scheduled goals, and 100% local LLM inference via llama.cpp.

Features

  • Local LLM: Built-in llama.cpp server (Mistral 7B) - no external APIs
  • Tool System: Semantic tool discovery and execution (Strava, memory, calculator, etc.)
  • Scheduler: Run goals on cron schedules or intervals
  • PostgreSQL Storage: Persistent tool data and credentials
  • GPU Acceleration: Auto-detects NVIDIA GPU for faster inference

Quick Start

# Clone
git clone https://github.com/gradrix/dendrite.git
cd dendrite

# Start (auto-detects GPU)
./start.sh

# Run a single goal
./start.sh goal "What is 2+2?"

# Run scheduler daemon
./start.sh scheduler

Commands

./start.sh              # Start services (auto-detect GPU)
./start.sh goal "..."   # Run single goal and exit
./start.sh scheduler    # Run scheduler daemon (uses goals.yaml)
./start.sh api          # Start HTTP API server
./start.sh stop         # Stop all services
./start.sh status       # Show service status
./start.sh logs         # Follow logs
./start.sh test         # Run tests
./start.sh help         # Show help

Configuration

Environment (.env)

# RAM profile for model selection (8gb, 16gb, 32gb)
RAM_PROFILE=32gb

# GPU VRAM (auto-detected if not set)
VRAM_GB=32

# Strava OAuth (optional)
STRAVA_CLIENT_ID=your_id
STRAVA_CLIENT_SECRET=your_secret

Scheduled Goals (goals.yaml)

goals:
  - id: collect_kudos
    goal: "Use strava_collect_kudos_givers with hours_back=48"
    schedule: cron
    cron: "0 */4 * * *"  # Every 4 hours
    enabled: true

  - id: reciprocate_kudos
    goal: "Use strava_reciprocate_kudos with count=30 and max_age_hours=24"
    schedule: cron
    cron: "0 */6 * * *"  # Every 6 hours
    enabled: true

settings:
  check_interval: 60

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                      Orchestrator                        β”‚
β”‚  Routes goals to appropriate neurons based on intent     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                           β”‚
         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
         β–Ό                 β–Ό                 β–Ό
   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
   β”‚  Intent   β”‚    β”‚   Tool    β”‚    β”‚ Generativeβ”‚
   β”‚  Neuron   β”‚    β”‚  Neuron   β”‚    β”‚  Neuron   β”‚
   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚                 β”‚                 β”‚
         β–Ό                 β–Ό                 β–Ό
   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
   β”‚  LLM      β”‚    β”‚  Tool     β”‚    β”‚  LLM      β”‚
   β”‚  Client   β”‚    β”‚  Registry β”‚    β”‚  Client   β”‚
   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                           β”‚
                           β–Ό
              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
              β”‚   Tools (Strava, etc)   β”‚
              β”‚   PostgreSQL Storage    β”‚
              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Tools

Built-in

  • calculator - Math expressions
  • memory_write / memory_read - Persistent key-value storage
  • current_datetime - Current date/time

Strava Integration

  • strava_get_activities - Get your activities
  • strava_get_dashboard_feed - Get friends' activities
  • strava_give_kudos - Give kudos to an activity
  • strava_collect_kudos_givers - Track who gives you kudos
  • strava_reciprocate_kudos - Auto-kudos back to givers
  • strava_list_kudos_givers - List known kudos givers

Services

Service Port Description
llama-gpu 8080 llama.cpp server (Mistral 7B)
postgres 5432 PostgreSQL with pgvector
redis 6379 Message bus / caching

Development

# Run tests
./start.sh test

# Run specific tests
./start.sh test -k "test_strava"

# Access container shell
./scripts/docker/shell.sh

Project Structure

β”œβ”€β”€ main.py                 # Entry point
β”œβ”€β”€ start.sh                # Main startup script
β”œβ”€β”€ goals.yaml              # Scheduled goals config
β”œβ”€β”€ docker-compose.yml      # Services definition
β”œβ”€β”€ neural_engine/
β”‚   └── v2/
β”‚       β”œβ”€β”€ core/           # Config, LLM, Orchestrator
β”‚       β”œβ”€β”€ neurons/        # Intent, Tool, Generative, Memory
β”‚       β”œβ”€β”€ tools/          # Tool implementations
β”‚       β”œβ”€β”€ scheduler/      # Goal scheduling
β”‚       β”œβ”€β”€ forge/          # Dynamic tool creation
β”‚       β”œβ”€β”€ cli.py          # Command-line interface
β”‚       └── api.py          # HTTP API
└── scripts/
    β”œβ”€β”€ db/                 # Database migrations
    β”œβ”€β”€ docker/             # Docker helper scripts
    └── testing/            # Test runners

License

MIT

About

🧠 Self-organizing AI agent with dendrite spawning - decomposes complex goals into neurons, spawns parallel sub-tasks, and aggregates results. Features smart parameter extraction, context isolation, and automatic data compaction. Built for Strava analytics with extensible tool system.

Topics

Resources

Stars

Watchers

Forks

Contributors 2

  •  
  •