Skip to main content
Mega Brain follows a modular architecture designed to separate concerns between processing engine, knowledge storage, agent systems, and user workspace.

Directory Structure

core/

Processing EngineTasks, workflows, protocols, schemas, and intelligence scripts that power the knowledge pipeline.

agents/

AI AgentsMind clones, cargo roles, conclave deliberation agents, and agent templates.

.claude/

Claude IntegrationHooks, skills, slash commands, and rules for Claude Code integration.

knowledge/

Knowledge BasePlaybooks, dossiers, DNA schemas, and sources with full traceability.

artifacts/

Processing ArtifactsIntermediate pipeline outputs: chunks, insights, narratives, and extractions.

inbox/

Input DirectoryRaw materials for processing: videos, PDFs, transcriptions, courses.

Core Components

Processing Engine (core/)

The core engine contains everything needed to transform raw materials into structured knowledge:
Task definitions for atomic operations:
  • extract-dna.md - Extract 5-layer DNA from sources
  • analyze-themes.md - Identify themes and patterns
  • normalize-entities.md - Resolve entity names
  • process-batch.md - Batch processing orchestration
  • validate-cascade.md - Validation and integrity checks
YAML workflow definitions:
  • wf-pipeline-full.yaml - Complete 5-phase pipeline
  • wf-ingest.yaml - Material ingestion
  • wf-extract-dna.yaml - DNA extraction workflow
  • wf-conclave.yaml - Multi-agent deliberation
JSON Schema definitions for all state files:
  • chunks-state.schema.json
  • insights-state.schema.json
  • narratives-state.schema.json
  • canonical-map.schema.json
  • decisions-registry.schema.json
Python intelligence scripts:
  • audit_layers.py - Layer system validation
  • RAG and semantic processing utilities
  • Quality control and validation scripts

Agent System (agents/)

Mega Brain includes a hierarchical agent system with four main types:
See the Agents page for detailed information.

Claude Code Integration (.claude/)

The .claude/ directory contains all Claude Code integration files:
20+ lifecycle hooks for automated operations:
  • agent_index_updater.py - Auto-update agent catalog
  • continuous_save.py - Session auto-save
  • enforce_dual_location.py - Dual-location logging
  • memory_persister.py - Agent memory updates
  • inbox_age_alert.py - Unprocessed material alerts
  • creation_validator.py - File creation validation

Knowledge Base (knowledge/)

All extracted and structured knowledge lives here:
Every piece of knowledge traces back to source material with chunk_id, file path, and original context.

Pipeline Artifacts (artifacts/)

Intermediate processing stages store data here:

State Management

Mega Brain maintains several critical state files:

Binaries and CLI (bin/)

Command-line tools for setup and operations:
  • setup.js - Interactive setup wizard
  • cli.js - Main CLI entry point
  • pre-publish-gate.js - Layer validation before publishing
  • validate-layers.js - Layer system integrity check

Development Workflow

1

Add Material

Place raw materials (PDFs, videos, transcripts) in inbox/
2

Run Pipeline

Execute /process-jarvis to run the 8-phase processing pipeline
3

Review Artifacts

Check artifacts/ for chunks, insights, and narratives
4

Access Knowledge

Query structured knowledge in knowledge/dossiers/ and knowledge/playbooks/
5

Consult Agents

Use mind clones and cargo agents for expert reasoning

Next Steps

Knowledge Pipeline

Learn about the 8-phase processing pipeline

DNA Schema

Understand the 5-layer knowledge extraction

Layer System

Explore the L1/L2/L3 distribution layers

Agents

Deep dive into the agent system