Skip to content

A creative AI system that thinks beyond its training data through autonomous graph exploration and cross-domain reasoning

Notifications You must be signed in to change notification settings

AaronTJDev/genesis

Repository files navigation

Genesis: Creative AI with Graph Memory

A creative AI system that thinks beyond its training data through autonomous graph exploration and cross-domain reasoning

License: MIT TypeScript Neo4j Anthropic Claude


🌟 What is Genesis?

Genesis is an experimental creative AI system that combines the power of Large Language Models (Claude) with graph databases (Neo4j) to enable genuine creative problem-solving. Unlike traditional AI systems that rely solely on parametric knowledge, Genesis builds and explores a self-managed long-term memory that enables:

  • 🎨 Analogical Reasoning: Find structural similarities across completely different domains
  • 🌉 Cross-Domain Exploration: Bridge ideas from biology to engineering, art to computer science
  • 🔓 Constraint Relaxation: Break free from obvious solutions by temporarily removing limitations
  • 🎲 Serendipitous Discovery: Use random walks to stumble upon unexpected connections
  • 🧠 Persistent Memory: Build knowledge that grows and compounds across sessions

🎯 Why Does This Matter?

The Problem

Current AI systems excel at tasks within their training distribution but struggle with genuine creativity:

  • Limited to Known Patterns: LLMs can only recombine what they've seen before
  • No Long-Term Memory: Each conversation starts from scratch
  • Domain-Bound Thinking: Solutions tend to stay within the problem's original domain
  • Constraint-Locked: Struggle to question fundamental assumptions

The Genesis Approach

Genesis addresses these limitations by treating creativity as a graph exploration problem:

  1. Seed from Parametric Knowledge: Start with Claude's extensive training
  2. Externalize to Graph: Convert concepts and relationships into a queryable structure
  3. Explore Autonomously: Let the AI randomly walk, bridge domains, and relax constraints
  4. Discover Emergent Insights: Find connections that weren't explicitly in the training data
  5. Compound Over Time: Each session enriches the graph for future exploration

Real-World Impact

Genesis can tackle problems like:

  • Innovation: "How can we make batteries last 10x longer?" → Discovers bio-inspired hibernation strategies
  • Design: "Create a novel user interface paradigm" → Blends concepts from musical composition and urban planning
  • Research: "Find unexplored angles in cancer immunotherapy" → Bridges insights from plant immunity and network security
  • Education: "Explain quantum computing" → Builds analogies from orchestras, traffic systems, and democratic voting

🏗️ Architecture Overview

┌─────────────────────────────────────────────────────────────┐
│                         Claude LLM                          │
│                   (Short-term Memory)                       │
│                                                             │
│  ┌──────────────────────────────────────────────────────┐  │
│  │  Parametric Knowledge + Current Conversation         │  │
│  └──────────────────────────────────────────────────────┘  │
│                           │                                 │
│                           ▼                                 │
│  ┌──────────────────────────────────────────────────────┐  │
│  │            Creative Exploration Tools                │  │
│  │  • seed_graph_from_hypothesis                        │  │
│  │  • random_walk                                       │  │
│  │  • cross_domain_bridge                               │  │
│  │  • relax_constraint                                  │  │
│  │  • analogical_search                                 │  │
│  │  • conceptual_blend                                  │  │
│  │  • query_graph                                       │  │
│  │  • add_to_graph                                      │  │
│  └──────────────────────────────────────────────────────┘  │
└─────────────────────────────────────────────────────────────┘
                           │
                           ▼
┌─────────────────────────────────────────────────────────────┐
│                    Neo4j Graph Database                     │
│                   (Long-term Memory)                        │
│                                                             │
│    Concepts ─[RELATES_TO]→ Concepts                        │
│       │                                                     │
│       └─[ANALOGOUS_TO]→ Analogies                          │
│       │                                                     │
│       └─[CROSS_DOMAIN]→ Other Domains                      │
│                                                             │
│    Problems ←[CONSTRAINS]─ Constraints                     │
│       │                                                     │
│       └─[ENABLES]→ Solutions                               │
└─────────────────────────────────────────────────────────────┘

Features

  • Graph-Based Memory: Neo4j as long-term knowledge storage
  • Creative Tools:
    • Random walks for serendipitous discovery
    • Cross-domain bridges for analogical thinking
    • Constraint relaxation for expanding solution spaces
    • Conceptual blending for novel ideas
    • Analogical search across domains
  • Autonomous Exploration: Claude manages its own exploration strategy
  • Persistent Knowledge: Graph persists across sessions

Architecture

src/
├── index.ts                 # Main entry point
├── orchestrator.ts          # Creative session coordinator
├── tool-executor.ts         # Tool execution dispatcher
├── types.ts                 # TypeScript type definitions
├── claude/
│   ├── client.ts           # Anthropic API wrapper
│   └── tools.ts            # Tool definitions for Claude
├── graph/
│   ├── neo4j-client.ts     # Neo4j connection & queries
│   └── seeding.ts          # Graph seeding from LLM knowledge
└── creative-tools/
    ├── random-walk.ts      # Random graph traversal
    ├── cross-domain.ts     # Cross-domain bridge finding
    ├── constraint-relax.ts # Constraint relaxation
    ├── analogical.ts       # Analogical reasoning
    └── conceptual-blend.ts # Conceptual blending

Quick Setup

Complete setup guide: See SETUP.md

Fast Track (5 minutes)

# 1. Start Neo4j with Docker
npm run neo4j:start

# 2. Configure your API key
cp .env.example .env
# Edit .env and add your ANTHROPIC_API_KEY

# 3. Run Genesis
npm start

Prerequisites

Neo4j Options

Option 1: Docker (Recommended - Easiest)

npm run neo4j:start

Uses docker-compose.yml to start Neo4j automatically.

Option 2: Neo4j Desktop

  1. Download Neo4j Desktop
  2. Create and start a database
  3. Update .env with credentials

Option 3: Neo4j AuraDB (Cloud)

  1. Sign up at Neo4j Aura
  2. Create free instance
  3. Update .env with connection string

Usage

Basic Usage

Run with the default problem:

npm start

Custom Problem

Provide your own problem as command-line arguments:

npm start "How can we reduce plastic waste in oceans?"

Clear Database

Start fresh by clearing the database:

npm start "Your problem here" --clear

Development Mode

Watch for changes:

npm run dev

Managing Neo4j

Start Neo4j:

npm run neo4j:start

Stop Neo4j:

npm run neo4j:stop

Check if running:

npm run neo4j:check

Access Neo4j Browser at http://localhost:7474

  • Username: neo4j
  • Password: password

View Reports

After each session, a detailed markdown report is saved:

# List all reports
npm run reports

# Open reports directory in Finder
npm run reports:open

Reports include:

  • Problem statement and timing
  • Graph statistics
  • Complete exploration journey (all tool calls)
  • Tool usage summary
  • Final creative insights

Reports are saved to: ~/tmp/genesis-reports/

See example-report.md for a sample report.

How It Works

Genesis uses a dual-model approach for optimal performance:

  • 🚀 Claude Haiku 4.5 - Fast extractions and data processing
  • 🧠 Claude Sonnet 4.5 - Deep reasoning and creative synthesis

Process

  1. Seeding Phase: Claude extracts relevant concepts from its parametric knowledge and creates initial graph structure
  2. Exploration Phase: Claude autonomously explores using creative tools:
    • Takes random walks to discover unexpected connections
    • Finds cross-domain bridges for analogical thinking
    • Relaxes constraints to expand solution spaces
    • Blends concepts to create novel ideas
  3. Synthesis Phase: Claude synthesizes findings into 3-5 novel, actionable approaches

Example Session

npm start "How can we make batteries last 10x longer?"

Expected output:

  • Seeds graph with concepts: batteries, energy storage, chemistry, etc.
  • Random walks discover: hibernation, capacitors, regenerative braking
  • Cross-domain finds: tardigrade survival mechanisms, data compression
  • Synthesizes novel ideas: "biological hibernation for batteries", "energy compression", etc.

Graph Schema

Node Types

  • Concept: Core knowledge concepts
    • Properties: name, description, domain, source, confidence
  • Problem: Problem definitions
    • Properties: id, description, constraints
  • Solution: Potential solutions
    • Properties: description, domain
  • Analogy: Analogical relationships
    • Properties: from_concept, to_concept, structural_similarity
  • Constraint: Problem constraints
    • Properties: description, type, parent_problem

Relationship Types

  • RELATES_TO: General relationships between concepts (strength, reasoning)
  • ANALOGOUS_TO: Analogical relationships (structural_pattern)
  • CROSS_DOMAIN: Cross-domain connections (from_domain, to_domain)
  • CONSTRAINS: Constraint → Concept (what the constraint limits)
  • ADDRESSES: Solution → Concept (what problem/concept the solution addresses)
  • ENABLES: Enabling relationships
  • OPPOSES: Opposing relationships

Note: The system automatically connects orphaned nodes to prevent isolated components in the graph.

Configuration

Model Configuration

Genesis uses two models for optimal cost/performance:

  • Sonnet 4.5 (claude-sonnet-4-5-20241022) - Creative reasoning
  • Haiku 4.5 (claude-haiku-4-5-20251001) - Fast extractions

To change models, edit src/orchestrator.ts:

const REASONING_MODEL = "claude-sonnet-4-5"; // Line 14

And src/claude/client.ts:

constructor(apiKey: string, model: string = "claude-haiku-4-5-20251001") // Line 11

Session Configuration

You can customize session behavior in orchestrator.ts:

const config = {
  max_turns: 15, // Maximum exploration turns
  temperature: 0.7, // Randomness in exploration
  enable_random_walks: true, // Enable random walks
  enable_cross_domain: true, // Enable cross-domain search
  log_level: "info", // Logging verbosity
};

Tools Available to Claude

  1. seed_graph_from_hypothesis: Bootstrap knowledge graph
  2. random_walk: Explore graph randomly
  3. cross_domain_bridge: Find analogies in different domains
  4. relax_constraint: Remove constraints to explore new solutions
  5. analogical_search: Find similar problem structures
  6. conceptual_blend: Combine concepts creatively
  7. query_graph: Execute custom Cypher queries
  8. add_to_graph: Add new discoveries to graph

Development

Project Structure

  • src/claude/: Claude API integration
  • src/graph/: Neo4j database integration
  • src/creative-tools/: Creative exploration tools
  • src/types.ts: TypeScript type definitions
  • src/orchestrator.ts: Main session orchestration
  • src/tool-executor.ts: Tool execution logic

Adding New Tools

  1. Create tool implementation in src/creative-tools/
  2. Add tool definition to src/claude/tools.ts
  3. Add case to src/tool-executor.ts

Troubleshooting

Cannot connect to Neo4j

  • Verify Neo4j is running
  • Check connection URI and credentials in .env
  • Ensure firewall allows connection to Neo4j port

Anthropic API errors

  • Verify your API key is correct
  • Check you have available credits
  • Ensure you're using a supported model

Graph schema errors

  • Try clearing the database with --clear flag
  • Verify Neo4j version compatibility (5.x recommended)

License

MIT

Contributing

Contributions welcome! Please open an issue or PR.

About

A creative AI system that thinks beyond its training data through autonomous graph exploration and cross-domain reasoning

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published