When to Add a Module
The runtime has 15 modules. Adding a 16th is a significant decision — do it when a new function doesn’t fit any existing region and is important enough to be a permanent part of the pipeline.Before adding a module, consider whether the function belongs in an existing module. If it’s a new tool, it probably belongs in
cerebellum as a capability. If it’s a new safety check, it belongs in amygdala. New modules are for genuinely new cognitive functions.Step 1: Create the Folder
Follow the one-thing-per-folder convention:Step 2: Define the Class
Every module follows the same constructor pattern:Step 3: Define Corpus Events
Add your module’s events to theCorpusEvent enum in corpus.ts:
Step 4: Wire into Agent
Import and instantiate your module inagent.ts:
Step 5: Add Workspace Storage (if needed)
If your module needs persistent state, create a folder in the defaults:Design Rules
Modules NEVER import each other
Modules NEVER import each other
All inter-module communication goes through corpus events. This keeps the dependency graph flat and makes modules independently testable.
Single responsibility
Single responsibility
Each module does exactly one thing. If you’re adding two unrelated functions, that’s two modules (or one of them belongs in an existing module).
Workspace state is always markdown
Workspace state is always markdown
Human-readable, git-versionable, LLM-parseable. Never use binary formats or JSON for workspace state. Markdown with YAML frontmatter is the standard.
Independently testable
Independently testable
Your module should be testable by mocking only the corpus. If you need to mock five other things, your module has too many dependencies.
Config via workspace helper
Config via workspace helper
If your module needs configuration, read it from
config.json via the workspace helper. Don’t invent a new config mechanism.Testing
Unit test your module in isolation by mocking the corpus:Architecture Overview
Understand how all 15 modules fit together.
Project Structure
Where everything lives in the codebase.