Skip to main content
Mega Brain organizes content into three distribution layers (L1, L2, L3) that control what is shared publicly, distributed to premium users, or kept private.

Quick Reference

LayerNameGit StatusDistributionWho Uses It
L1CommunityTrackednpm package (public)Everyone — open source core
L2PremiumTrackedPrivate repo (gated)Paying users
L3PersonalGitignoredLocal only / personal backupIndividual user only

Layer 1: Community (npm package)

The open-source engine that powers Mega Brain. Distributed via npm as mega-brain-ai. Anyone can install and use this to build their own knowledge management system.
Git status: Fully tracked
Distribution: Public — npm publish
Who uses it: Open source community, all users as the foundation layer

What Belongs in L1

Core Engine

  • core/ - Processing engine
  • core/tasks/ - Task definitions
  • core/workflows/ - Workflow templates
  • core/schemas/ - JSON schemas
  • core/intelligence/ - Intelligence scripts

CLI & Tooling

  • bin/ - CLI binaries
  • Setup wizard
  • Validation scripts
  • Pre-publish gates

Integration

  • .claude/ - Claude Code integration
  • .claude/hooks/ - Lifecycle hooks
  • .claude/commands/ - Slash commands
  • .claude/skills/ - Skill system
  • .claude/rules/ - Operational rules

Templates

  • agents/_templates/ - Agent templates
  • agents/conclave/ - Deliberation agents
  • docs/ - Documentation
  • .gitkeep files (structure markers)

Real Examples

core/                          → L1 (Core engine)
core/tasks/                    → L1 (Core engine)
core/intelligence/audit_layers.py → L1 (Core engine)
bin/                           → L1 (Core engine)
.claude/                       → L1 (Core engine)
.claude/rules/RULE-GROUP-1.md  → L1 (Core engine)
agents/conclave/               → L1 (Core engine)
docs/                          → L1 (Core engine)
inbox/.gitkeep                 → L1 (Empty structure marker)
Key rule: .gitkeep files are always L1, regardless of directory. They mark where populated content will live but contain no personal data.

Layer 2: Premium (populated content)

Content generated through the Mega Brain pipeline — actual knowledge, agent personalities, dossiers, playbooks. Requires a paid subscription or private repository access.
Git status: Tracked in private repo (gitignored in public L1 repo)
Distribution: Private — premium repository or direct sync
Who uses it: Paying users who have run the pipeline and built their knowledge base

What Belongs in L2

Agents

  • agents/minds/ (populated)
  • agents/cargo/ (populated)
  • Agent personalities and memories
  • Agent DNA configurations

Knowledge

  • knowledge/dossiers/
  • knowledge/playbooks/
  • knowledge/dna/
  • knowledge/sources/

Artifacts

  • artifacts/insights/
  • artifacts/chunks/
  • artifacts/extractions/
  • Populated state files

Processed Content

  • Dossiers with expert knowledge
  • Extracted DNA schemas
  • Synthesized narratives
  • Theme compilations

Real Examples

agents/minds/                        → L2 (Premium content — when populated)
agents/cargo/                        → L2 (Premium content — when populated)
knowledge/dossiers/persons/          → L2 (Premium content)
knowledge/dossiers/themes/           → L2 (Premium content)
knowledge/playbooks/                 → L2 (Premium content)
knowledge/dna/                       → L2 (Premium content)
knowledge/sources/                   → L2 (Premium content)
artifacts/insights/                  → L2 (Premium content)
artifacts/chunks/                    → L2 (Premium content)
Key rule: L2 is a superset of L1. An L2 distribution includes all L1 content plus the populated knowledge content.

Layer 3: Personal (never distributed)

User-generated content specific to one person’s workflow — raw source materials, processing logs, session history, company-specific data. Never leaves the local machine except in personal backups.
Git status: Gitignored (not committed to any shared repo)
Distribution: Local backup only — never shared
Who uses it: The individual user only — this is their private data

What Belongs in L3

Raw Materials

  • inbox/ - All input materials
  • Videos, PDFs, transcripts
  • Course materials
  • Podcast downloads

Logs & History

  • logs/ - Processing logs
  • .claude/sessions/ - Session history
  • Execution reports
  • Audit trails

State & Runtime

  • .claude/mission-control/
  • Session state files
  • Runtime configuration
  • Processing checkpoints

Company Data

  • agents/sua-empresa/
  • Company-specific agents
  • Internal processes
  • Proprietary workflows

Real Examples

inbox/                         → L3 (Personal data)
inbox/alex-hormozi/            → L3 (Personal data)
inbox/my-video-transcript.txt  → L3 (Personal data)
logs/                          → L3 (Personal data)
logs/batches/BATCH-001.md      → L3 (Personal data)
.claude/sessions/              → L3 (Personal data)
.claude/mission-control/       → L3 (Personal data)
agents/sua-empresa/            → L3 (Personal data)
Key rule: L3 content is the “input” and “runtime state” of your system. Valuable to you personally but meaningless (or sensitive) to others.

Special Categories

NEVER — Secrets and Credentials

Purpose: Files that must never be committed to any git repository. What belongs:
  • .env, .env.local - Environment variables
  • credentials.json, token.json - API credentials
  • .mcp.json - MCP configuration with tokens
  • *.key, *.pem - Certificate files
.env                           → NEVER (Secrets/sensitive config)
.env.local                     → NEVER (Secrets/sensitive config)
.mcp.json                      → NEVER (Secrets/sensitive config)
credentials.json               → NEVER (Secrets/sensitive config)
token.json                     → NEVER (Secrets/sensitive config)

DELETE — Obsolete Content

Purpose: Files superseded by newer implementations. Run python3 core/intelligence/audit_layers.py to identify delete candidates.

Classification Flowchart

1

Check NEVER

Does it contain API keys, tokens, or credentials?YES → NEVER (add to .gitignore)
2

Check L3

Is it user-generated (inbox, logs, sessions, company data)?YES → L3 (gitignored)
3

Check L2

Is it populated knowledge (dossiers, playbooks, DNA, artifacts)?YES → L2 (private repo)
4

Check .gitkeep

Is it a .gitkeep file anywhere?YES → L1 (structure marker)
5

Default to L1

Is it core engine, CLI, integration, or templates?YES → L1 (public repo)

Distribution Matrix

Content TypeL1 (Community)L2 (Premium)L3 (Personal)
Core engine
CLI tools
Agent templates
Empty structure
Populated agents
Knowledge base
Processing artifacts
Raw materials
Logs & sessions
Company data
API keys

Community vs Pro Features

FeatureCommunity (L1)Pro (L2)
CLI and setup wizard
Core engine and templates
Skills and hooks
Agent templates and examples
Populated knowledge base
Mind clone agents
Pipeline processing
Council / Conclave

Validation

Verify layer classification before publishing:
# Check that only L1 content is in the package
npm run validate:layers

# Full pre-publish gate (secrets scan + layer validation)
node bin/pre-publish-gate.js

# Programmatic audit with Python
python3 core/intelligence/audit_layers.py

Layer Management Best Practices

1

Separate Concerns

Keep L1 (engine), L2 (content), and L3 (personal) clearly separated
2

Never Mix

Don’t commit L3 content to L1/L2 repos. Don’t include secrets anywhere.
3

Validate Before Publish

Always run validation before pushing to public or premium repos
4

Document Decisions

When adding new content, document which layer it belongs to and why

Next Steps

Architecture

Understand the full system architecture

Knowledge Pipeline

Learn how L2 content is generated

Build docs developers (and LLMs) love