Codex + maenifold: Persistent Development Context
Never lose context between coding sessions. Your decisions, architecture, and progress persist in a living knowledge graph.
Prerequisites
- Codex installed
- Active development project
- Basic understanding of project documentation
Graph-First Reset Protocol
Because Codex (and all agents) experience memory resets between sessions, maenifold provides a systematic recovery protocol:
- Sync → Ensure graph reflects latest markdown changes
- RecentActivity → Identify active sessions and recent documents
- SearchMemories → Find relevant knowledge using hybrid search
- BuildContext → Navigate concept relationships for full context
This protocol ensures every session starts with complete context from the knowledge graph, not from scratch.
Plan Mode
Discovery and planning
Act Mode
Implementation and execution
These workflows are embedded in the swe.md agent instructions and automatically guide Codex through systematic development.
Setup
1. Install maenifold
npm install -g @ma-collective/maenifold2. Configure Codex
Add to ~/.codex/config.toml:
[mcp_servers.maenifold]
type = "stdio"
command = "maenifold"
args = ["--mcp"]
startup_timeout_sec = 120
tool_timeout_sec = 600
env = { MAENIFOLD_ROOT = "~/maenifold" }3. Optional: Add swe.md agent instructions
Copy agent instructions to ~/.codex/agents/swe.md for automatic graph-first protocol.
4. Verify installation
codex chat "List maenifold MCP tools"Walkthrough Examples
Example 1: Day 1 - Starting New Feature
Scenario: You're starting work on a new authentication feature.
Codex Session:
"I'm starting work on JWT authentication. Write a project brief and initial architecture decisions to memory."
What maenifold Does:
- Creates
memory://projects/myapp/projectbrief.md- Scope: JWT authentication feature
- Stakeholders: Backend team
- Constraints: Must support refresh tokens
- Creates
memory://projects/myapp/systemPatterns.md- Architecture: JWT stored in httpOnly cookies
- Security: HMAC SHA-256 signing
- Refresh strategy: Sliding window pattern
- Creates
memory://projects/myapp/activeContext.md- Current: Implementing token generation
- Next: Add refresh token rotation
- Blockers: Need to decide token expiry time
All files contain [[JWT]], [[authentication]], [[security]] WikiLinks.
Example 2: Day 2 - Resume Work
Scenario: You're back the next day. Codex memory is reset.
Codex Session:
"What was I working on yesterday? Show recent activity."
maenifold Response via RecentActivity:
Codex automatically:
- Reads activeContext.md
- Has full context of yesterday's decisions
- Knows exactly where to continue
- No need to re-explain the feature
Example 3: Multi-Day Feature Development
- Write projectbrief.md, systemPatterns.md
- Document
[[security-requirements]]
- Update activeContext.md with progress
- Write memories about
[[implementation-challenges]] - Link to relevant
[[code-patterns]]
- SearchMemories for
[[security-requirements]] - Verify all requirements met
- Update progress.md with completion status
- BuildContext around
[[JWT]]concept - Generate summary of all related decisions
- Create review checklist from memory
Project Memory Structure
memory://
└── projects/
└── myapp/
├── projectbrief.md # Foundation: scope, stakeholders, constraints
├── productContext.md # User needs, desired outcomes
├── systemPatterns.md # Architecture, integrations, invariants
├── techContext.md # Tooling, environment, dependencies
├── activeContext.md # Current priorities, next steps, blockers
└── progress.md # Status log, milestone trackingCommon Pitfalls
Advanced Patterns
Pattern 1: Assumption Tracking
# When making architectural decisions with uncertainty
codex chat "We're assuming users want single sign-on. Track this assumption."
# maenifold creates assumption ledger entry
# Later, when assumption is validated/invalidated:
codex chat "Update assumption: SSO requirement confirmed by product team"Pattern 2: Cross-Project Learning
# Reuse patterns from previous projects
codex chat "Search memories for [[authentication]] patterns across all projects"
# maenifold returns authentication approaches from ALL projects
# Codex suggests best practices based on past experiencePattern 3: Team Knowledge Sharing
# Multiple developers sharing same MAENIFOLD_ROOT
export MAENIFOLD_ROOT="/shared/team-knowledge"
# Each developer's Codex writes to shared graph
# All team members benefit from collective knowledge
# Search finds insights from entire team's workNext Steps
- →Explore Tools
Browse all maenifold tools including SequentialThinking
- →Explore Tools
Discover workflow and memory management tools
- →Multi-Agent Orchestration
See team simulation with parallel agent waves