I love it when side projects go off the rails—and in a good way. KayGeeGo started as an experiment in knowledge graph construction, and ended up as a full-featured, LLM-driven graph builder and explorer.

The Pitch: Automate Curiosity

Imagine if you could say, "Hey computer, here's a concept – 'Artificial Intelligence'… now give me a sprawling web of related ideas, mined with AI, and let me explore it visually." That's KayGeeGo. You type in a seed concept, and it builds a semantic map of concepts and relationships, using LLMs for discovery and Neo4j to keep it all tidy.

What started as a simple Go CLI mushroomed into a microservice architecture with concurrency, caching, real-time metrics, and a modern web UI. And this taught me a lot about Go! Once you see the potential of AI-driven graph expansion, you can't help but keep pulling at the thread. With local LLMs on Ollama, there's a lot you can accomplish even without those OpenAI or Claude tokens.

Architecture: Three Brains, One Graph

KayGeeGo is split into three main services (all written in Go):

1. The Builder (kg-builder)

  • Seed → Graph: Starts from a root concept (e.g., "Quantum Computing"). It hammers an LLM for related concepts, then asks for the relationships.
  • Concurrency: Spawns goroutines for parallel node/edge mining. (Go's concurrency is a cheat code for this kind of workload.)
  • Low Connectivity Seeding: Periodically targets sparsely connected nodes, ensuring your graph isn't just a hairy star-burst.
  • Caching: Every LLM call is cached on disk (JSON blobs), so re-builds are fast and offline-friendly.

2. The Enricher (kg-enricher)

  • Continuous Discovery: Runs as a service, sampling random pairs of nodes and asking the LLM if they're related.
  • Batch Processing: Customizable batch size, interval, worker count—tune it to your CPU and LLM latency.
  • Focus on Cohesion: Intentionally seeks weakly-connected regions to prevent graph fragmentation.
  • Stats: Tracks relationships mined, enrichment rate, batch times, and more. (I love a good dashboard.)

3. The Frontend (kg-frontend)

  • WebGL 3D Visualization: Interactive, real-time, and performant (even with hundreds or thousands of nodes).
  • Search & Filter: Query concepts, filter subgraphs, highlight paths.
  • Live Stats: Node/edge counts, enrichment progress, and more.
  • Manual Hacking: Add your own relationships right from the UI.
  • UX Touches: Dark/light mode, mini-map, node inspector, and other nerdy details.

Everything runs in Docker, orchestrated by a bash script (kg.sh). Start, stop, test, optimize, and tail logs—one script to rule them all.

Key Tech & Nerdy Details

  • LLM Integration: Out-of-the-box, uses Ollama's qwen2.5:3b (local, fast, open-source). But you can point it at any model with an API (Claude, GPT, Llama, etc.).
  • Neo4j: All graph data (nodes, edges, properties) lives in a persistent Docker volume, queryable by Cypher or via the browser.
  • Config Galore: Tweak settings via CLI flags, YAML configs, or environment variables. Want 10,000 nodes? Go for it. Prefer five concurrent enrichers? Easy.
  • Cache Discipline: LLM responses are deduped and stored as JSON. Aggressive optimization can clean house when the cache gets unwieldy.

What's Fun (and Weird) About It

  • LLM Hallucinations: Sometimes the AI invents relationships that are… questionable. (Why is "Muffin" related to "Quantum Mechanics"? Ask the LLM.)
  • Graph Topology: Watching a graph organically expand, with islands coalescing into continents, is oddly satisfying. The periodic connecting of randomly picked nodes is also really interesting – makes you question how the mind forms connections by exploring disparate ideas!
  • Performance Tweaks: Tuning goroutines, cache hit rates, and Docker resource limits is a playground for optimization nerds.

Real-World Use

  • Idea Exploration: Start with "Neural Networks" and watch the knowledge space bloom.
  • Research Mapping: Plug in a science concept and see cross-disciplinary links.
  • LLM Benchmarking: Try different models, compare how "creative" or "accurate" their graphs are.
  • Code Hacking: Want to swap out the enrichment logic? Dive into Go, tweak, rebuild, docker-compose up and you're off.

Run It Yourself

Assuming you have Docker, it's as simple as:

git clone https://github.com/aiexplorations/kay-gee-go.git
cd kay-gee-go
chmod +x kg.sh
./kg.sh start --seed="Graph Theory" --max-nodes=300 --concurrency=8

Check logs, stats, and optimize your cache with ./kg.sh logs, ./kg.sh start --stats-only, and ./kg.sh optimize.

Final Thoughts

KayGeeGo is for anyone who wants to experiment with AI, graphs, and Go—all at once. It's a playground for the curious, the technical, and the easily distracted. I built it for fun, but I'd love to see what others do with it.

Check out the repo, fork it, and let me know what wild graphs you build:
https://github.com/aiexplorations/kay-gee-go