🌌 Astrophage: The Autonomous Enterprise Knowledge Graph

Image

Navigate your codebase. Chart your architecture. Never lose context again.


🚨 The Enterprise Disconnect: Why AI Agents & Engineers Struggle Today

In modern software organizations, knowledge is fractured. It lives in GitHub repositories, Jira tickets, Notion pages, Confluence docs, and Slack threads. This creates massive friction for both human developers and autonomous AI agents.

  1. The Fragmentation Problem: Engineers spend weeks onboarding, trying to piece together how microservices interact, relying on outdated wikis or tribal knowledge.
  2. The Context-Collapse for AI: AI coding tools (like Cursor, Copilot, or Claude Code) are excellent at reading single files, but they hit a wall when indexing an entire enterprise architecture.
  3. The Blindspot: Most critically, AI agents have zero awareness of cross-application dependencies. They fail to write context-aware code because they simply lack the enterprise-wide map.

AI agents don’t need bigger context windows to read more code; they need structured, interconnected knowledge.


🚀 The Solution: Project Astrophage

Astrophage is a fully autonomous, multi-connected knowledge base platform designed specifically for enterprise scale and AI agents. It continuously ingests, synthesizes, and maintains a living architectural map of your entire organization using a fleet of autonomous background agents.

Instead of writing static documentation that goes stale the moment it's published, your developers just write code. Astrophage writes the documentation.

It outputs this documentation natively into Google's Open Knowledge Format (OKF)—a highly structured, Obsidian-compatible Markdown standard optimized for both LLM consumption and human readability.


✨ Core Innovations & Technical Masterpieces

We didn't just build a wrapper around an LLM. Astrophage is an engineering powerhouse packed with deterministic safety gates, real-time syncs, and advanced UX.

1. 🤖 The Autonomous Agent Fleet (Multi-Agent Orchestration)

Powered by a highly concurrent Celery & Redis task queue, Astrophage orchestrates a specialized fleet of AI agents:

  • The Ingestor: Plugs into repositories and docs, running mode-aware map-reduce chunking to safely extract knowledge without hitting token limits.
  • The Compiler: Synthesizes insights into the OpenKB directory, ensuring flawless cross-referencing and generating a structured index.
  • The Gatekeeper: Acts as the bouncer. It analyzes Git diffs in real-time to prevent trivial commits (like typo fixes) from spamming the documentation history.
  • The Rollup Agent: Synthesizes multiple individual application-level KBs into a single, unified organizational architecture map.

2. ⚡ Zero-Cost Sync via Deterministic Fast-Path Anchors

Running LLMs on every single Git push across an enterprise would bankrupt an engineering team. We solved this. When a new Git push occurs, Astrophage uses deterministic code anchoring to instantly identify exactly which documentation page is dirty. This bypasses the need for an LLM to read the entire diff, triggering an update deterministically, with zero LLM triage calls (and zero cost).

3. 🛡️ Active Architectural Guardrails (Diff Constraints)

Documentation is usually passive; Astrophage makes it active. The system extracts hard rules from your Architecture Decision Records (ADRs)—for example, "Direct database queries from the frontend are forbidden." Using the built-in /guard endpoint, Astrophage can evaluate any incoming Git Pull Request diff against these active constraints and instantly warn reviewers if a developer is violating established architecture invariants.

4. 🔒 Deterministic Pre-PR Quality Gate (The Security Linter)

Before Astrophage opens a GitOps Pull Request to update your repository’s documentation, it runs a rigorous, deterministic Python linter to ensure AI hallucinations don't poison your knowledge base:

  • Security & PII Screener: Regex-based scanning ensures the AI hasn't accidentally hallucinated or leaked real API keys, tokens, or passwords into the documentation.
  • Wikilink Validator: Ensures zero broken internal links.
  • Orphan & Stub Detector: Flags pages with 0 backlinks or under 25 words to prevent low-value spam pages.

5. 🕸️ The Inter-Wiki Contract Mesh (Cross-Repository Linking)

In microservice architectures, one KB isn't enough. Code is highly decoupled, but the context shouldn't be. Astrophage features an automated contract mesh that enables knowledge bases to link to other repositories using [[ap:repo/path]] syntax. The AI automatically parses route calls and Kafka topic subscriptions, weaving cross-application dependencies together. This means a developer (or an AI agent) looking at a frontend component can instantly traverse the link to see the exact backend API contract and database schema it depends on, completely eliminating the silos between teams.

6. 💻 The Astrophage CLI Skill (ap Command)

Once the Astrophage KBs are generated, your autonomous coding agents (like Antigravity, Claude Code, or Cursor) can utilize our plug-and-play CLI tool (astrophage-skill) to instantly clone, search, and navigate the Knowledge Base. Crucially, the CLI empowers the agent to traverse between different application KBs autonomously if a cross-repository dependency is found. It even features an Architecture Digest Generator that creates an ultra-compact (<4,000 char) executive summary perfectly sized to be injected into an agent's system prompt (e.g., in .cursorrules).

7. 🔄 Multi-Source Incremental Ingestion Engine

Astrophage unifies context across the entire enterprise stack using continuously syncing connectors (with more coming soon):

  • GitHub (Code & AST)
  • Confluence & Notion (Product specs)
  • Jira (Epics, Stories, Tasks)
  • Slack (Channel threads)
  • File & Image Uploads: Enhanced with markitdown for advanced file parsing, enabling seamless extraction of data from PDFs, OpenAPI schemas, and even optical character recognition for fetching information from images.

🧠 The Hybrid-Model Economics: Gemma & Gemini

Deploying AI to monitor every commit across an enterprise requires brilliant economics. Astrophage solves this through a smart Hybrid Model Mode that balances privacy, intelligence, and cost.

  • Local Mode (Gemma 3): For continuous background monitoring, developers can opt to run the Gatekeeper and map-phase summarizations locally using Gemma 3 (via Ollama). This means high-frequency webhook monitoring and triage happen at absolutely zero cost and with 100% privacy.
  • Remote Mode (Gemini 3): Only the highly complex architectural syntheses (the Reduce phase) and the cross-repository Rollup Agent are routed to the cloud to leverage Gemini's massive context window and elite reasoning capabilities.

This intelligent per-task routing achieves massive cost reductions while preserving top-tier AI reasoning.


☁️ Powered by Google: A Robust & Scalable Foundation

Astrophage is enterprise-ready because it stands on the shoulders of Google's powerful ecosystem:

  • Google's Open Knowledge Format (OKF): The foundational data standard powering the entire generated knowledge graph.
  • Google Gemini Intelligence: The core synthesis agents utilize the vast context windows and advanced reasoning of the Gemini 3.5 Flash / Gemini 3.7 Flash APIs to map complex logic accurately.
  • Google Gemma 3 (Local): Powering the hybrid-mode Gatekeeper for zero-cost, private Git diff triage.
  • Google Cloud Run: The FastAPI backend and Next.js frontend are containerized and deployed on Cloud Run, guaranteeing infinite serverless autoscaling during massive enterprise ingestion bursts.
  • Google Cloud SQL & GCS: High-availability PostgreSQL database management and secure Cloud Storage for raw ingested content archives.

🛠️ The Tech Stack Arsenal

  • Backend Engine: FastAPI (Python 3.12), Uvicorn, SQLAlchemy (Async), Pydantic.
  • Async Orchestration: Celery & Redis for distributed, heavy-lifting multi-agent pipelines.
  • Frontend UI: Next.js 14 (App Router), React 18, Tailwind CSS, shadcn/ui, Framer Motion.
  • Real-time Comms: Server-Sent Events (SSE) via sse-starlette for streaming live agent execution statuses directly to the dashboard.
  • GitOps Automation: PyGitHub for seamless repository creation, feature branching, and Pull Request automation directly into the user's workflow.

ARCHITECTURE

Image

🔮 What's Next for Astrophage: The Enterprise Roadmap

Project Astrophage is just getting started. As we expand the platform from an autonomous knowledge base into a full-scale Autonomous Enterprise Architecture & Context Layer, here is our upcoming roadmap:

1. 🔍 Zero-Touch Autonomous Source Discovery & Auto-Linking

  • Frictionless Organization Onboarding: Automatically scan enterprise GitHub/GitLab organizations, cloud infrastructure (GCP/AWS), and documentation hubs to detect new services, databases, and microservices the moment they are created.
  • Self-Configuring Graph Topology: Use semantic embeddings and AST route analysis to automatically classify and link new sources to existing application domains and service meshes with minimal to zero manual intervention.

2. 🔄 End-to-End Requirement-to-Code Pipeline

  • Living Knowledge Across the Enterprise Lifecycle: In an enterprise, requirements originate with business and product stakeholders, passing through system architects, engineering leads, and finally developers.
  • Continuous Architectural Validation: At every phase of this lifecycle, Astrophage cross-references emerging requirements against the active knowledge graph to verify technical feasibility, prevent redundant development, flag architectural violations, and pinpoint impacted upstream/downstream services before any code is written.

3. 📋 Autonomous Spec Generation & Jira / Confluence Automation

  • From Idea to Production-Ready Specs: Transform high-level product prompts or loose meeting notes into fully structured Confluence documentation, architectural decision blueprints, and Jira Epics.
  • Automated Developer Task Breakdown: Synthesize granular user stories, edge-case test criteria, and API contract stubs directly mapped to the target codebase, giving developers instant execution-ready context.

4. 🛡️ CI/CD Architecture Drift Prevention & PR Guardian

  • Autonomous Pull Request Guardian: An intelligent GitHub/GitLab bot that comments on PRs with an enterprise impact analysis report: "This PR alters the /auth token schema which directly impacts 3 downstream microservices (Billing, Notifications, Portal)."
  • Active Drift Prevention: Automatically flag or block commits that violate Architecture Decision Records (ADRs) or introduce circular microservice dependencies before merging to main.

5. 🗺️ Live Visual Architecture & Telemetry Overlay

  • Interactive C4 Topology Visualizer: Render real-time, interactive architectural maps across all layers (Context, Container, Component, Code) with seamless drill-down capabilities.
  • Observability Integration: Overlay live telemetry data (error rates, service latency, Kafka lag from Google Cloud Monitoring / Prometheus) directly onto nodes in the architectural knowledge graph.

6. 🤖 Autonomous Cross-Repository Refactoring Agents

  • Multi-Repo Task Execution: Leverage Astrophage’s inter-wiki contract mesh to deploy autonomous AI coding agents capable of executing coordinated, cross-cutting migrations (e.g., updating shared protocol buffers, migrating auth providers, or upgrading dependencies across 20+ microservices in lockstep).

🌍 The Vision: The Cognitive Layer for Enterprise Software

Astrophage bridges the gap between what is built, what is planned, and what is documented. By providing an interconnected, transparent, and auto-updating enterprise knowledge graph, we empower the next generation of human engineers and autonomous AI agents to build faster, safer, and with perfect context.

Built With

Share this project:

Updates