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

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

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

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

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

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

Community vs Pro Features

Validation

Verify layer classification before publishing:

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