Skip to content
maenifold
GitHub

maenifold

Domain expertise that compounds. Open. Local. Yours.

Context engineering infrastructure for AI agents. Point it at any domain's literature, and it builds specialized experts that live on your machine, work offline, and get smarter with every use.



Theoretical Foundations

Philosophical Foundations

ConceptOriginApplication
Ma (間)Japanese aestheticsThe space between things as the thing itself (what we don't do)

Research Foundations

ConceptOriginApplication
Context EngineeringAnthropic (2025)Attention budget management: just-in-time retrieval, compaction, decay, structured notes, sub-agents
ACT-RAnderson (CMU); Wixted & Ebbesen (1991)Power-law inspired decay (exponential approximation)
New Theory of DisuseBjork & BjorkStorage vs retrieval strength
Two-Stage MemoryCognitive neuroscienceEpisodic → semantic consolidation
Linguistic RelativityWeak form (Boroditsky, 2003)Perspectives change the linguistic frame of LLM reasoning
ConfessionReportOpenAI (Barak et al., 2025)Inference-time honesty enforcement via hooks + adversarial audit

Memory System

FeatureWhat It MeansImplementation
Two-Stage ModelFast episodic encoding → slow semantic consolidationmemory://thinking/ (episodic) vs memory://research/ (semantic)
ACT-R DecayMemories fade without access following power-lawDecayCalculator: base × time^(-0.5)
Storage vs RetrievalPointers persist; only accessibility fadesWikiLinks never deleted; decay affects ranking
Maintenance CyclesPeriodic graph hygiene5 workflows in serialized dependency order: repair, hub-detection, consolidation, epistemic, status
ConsolidationThinking sessions → semantic memoryReplay via RecentActivity, distill to WriteMemory, link via FindSimilarConcepts

Symbolic Systems

FeatureWhat It MeansImplementation
Concept-as-ProtocolWikiLinks carry context between agentsPreToolUse hook extracts [[concepts]], injects graph context
Lazy GraphNo predefined schema; structure emergesSync extracts WikiLinks; co-occurrence creates edges
Hybrid SearchSemantic similarity + exact matchingSearchMemories fuses with Reciprocal Rank Fusion (k=60)
Concept RepairNormalize WikiLink variants safelyRepairConcepts validates similarity ≥0.7 before replacing
WikiLink FilteringWrite-time concept blocklist.wikilink-filter.json prevents hub concepts from graph pollution

Reasoning

FeatureWhat It MeansImplementation
Sequential ThinkingMulti-step reasoning with persistence, graph integration, multi-agent branchingExtends MCP server with sessionId, branchId, parentWorkflowId
Assumption LedgerTrack beliefs and their validation statusAssumptionLedger with confidence levels, evidence links

Workflow System

FeatureWhat It MeansImplementation
Workflow EngineStructured multi-step methodology executionWorkflow tool with JSON steps, toolHints, guardrails
Nested CompositionWorkflows invoke other workflows and toolsWorkflows embed SequentialThinking; bidirectional linking
Session PersistenceResume reasoning across daysState in memory://workflow/; session IDs enable continuation

Notable Workflows:

WorkflowWhat It DemonstratesHow
Workflow DispatchMeta-cognitive methodology selectionAnalyzes problem characteristics, queries graph for similar past problems, selects optimal workflow
Research Think TankMulti-agent collaborative reasoningDefines roles (synthesizer, critic, explorer), structures knowledge construction phases
Agentic SLCQuality-controlled developmentEmbeds anti-slop checks, requires RTM traceability, enforces ConfessionReports
Constitutional RolesConstitutional AI for persona creationUses principles + examples to generate role definitions that constrain agent behavior
Higher-Order ThinkingMeta-cognitive reflectionRecursive self-analysis steps: examine reasoning, identify biases, refine approach
Six Thinking HatsStructured perspective switchingSequences through DeBono's colors with explicit transitions and synthesis

Multi-agent orchestration requires an MCP client with agent dispatch (Claude Code, Codex, aishell) or CLI scripting with subprocess spawning.


How It Works

Sequential Thinking

AI agents can engage in multi-hour reasoning sessions with full revision capability:

Each session creates a memory://thinking/session-{id} file tracking the complete reasoning chain. Sessions support:

  • Revision: Reconsider and update previous thoughts
  • Branching: Explore alternative reasoning paths
  • Persistence: Continue across days or weeks
  • Multi-agent: Share sessions between agents

Orchestrated Workflows

Pre-built workflows embed sequential thinking at critical decision points:

  • Discovery Wave: Parallel agents explore the problem space
  • Validation Wave: Test assumptions and verify approaches
  • Implementation Wave: Execute with confidence

Intelligent Workflow Selection: The workflow-dispatch meta-system analyzes problem characteristics, researches historical context, assesses cognitive requirements, and automatically selects optimal reasoning methodologies.

The PM Pattern: A primary agent (usually Sonnet) acts as the blue-hat orchestrator, using sequential thinking to maintain project context. It dispatches ephemeral sub-agents for specific tasks — these agents can burn through their context windows on implementation details while the PM preserves the overall vision. All thinking persists to memory:// for continuity.

Workflows maintain state across days, enabling true long-running projects.

Combines semantic vectors with full-text search using Reciprocal Rank Fusion:

  • Semantic search finds conceptually related content
  • Full-text search ensures exact terms aren't missed
  • RRF fusion optimally blends both result sets (k=60)
  • Returns context with relevance scores for transparency

Lazy Graph Construction

The knowledge graph builds itself through natural use:

Every [[WikiLink]] becomes a node. Every mention strengthens edges. Patterns emerge without planning.

Concepts can be excluded from the graph via .wikilink-filter.json — a simple blocklist checked at write time that prevents hub or ephemeral concepts from polluting the graph structure.

Memory Lifecycle

Knowledge follows a lifecycle grounded in cognitive neuroscience:

Decay: Memories fade without access, following ACT-R's power-law of forgetting:

Tiered Memory Classes:

TierGrace PeriodHalf-LifeExamples
Sequential7 days30 daysmemory://thinking/sequential/ sessions
Workflows14 days30 daysmemory://thinking/workflow/ sessions
Semantic28 days30 daysmemory://research/, memory://decisions/
ImmortalValidated assumptions, core architecture

Sleep Cycles: Periodic maintenance runs five specialist workflows in serialized dependency order:

  • Repair: Normalizes WikiLink variants, cleans orphaned concepts
  • Hub Detection: Identifies and filters generic hub concepts from the graph
  • Consolidation: Replays high-significance episodic memories, promotes to semantic
  • Epistemic: Reviews assumptions, validates or invalidates based on evidence
  • Status: Analyzes decay patterns, reports memory health

Decay affects search ranking only. Files are never deleted.


Quick Start

For VSCode Users

  1. Install maenifold:
  1. Configure your AI assistant:

Claude Code

Continue.dev

Add to ~/.continue/config.json:

Cline

Add to VSCode settings (Cmd+, → Extensions → Cline):

Codex

Add to ~/.codex/config.toml:

Multi-agent orchestration requires MCP clients with agent dispatch:

  • Claude Codeclaude-code CLI with Task tool
  • Codex — Purpose-built orchestrator
  • aishell — Open-source with agent management
  1. Start using it:
  • Single agent: "Write a memory about our project architecture"
  • Multi-agent: "Use agentic-dev workflow to implement authentication"
  • Graph query: "Show me how our concepts connect"

For Developers

CLI (macOS/Linux):

CLI (Windows PowerShell):

MCP vs CLI:

InterfaceAdvantageBest for
MCPAuto-sync watcher keeps graph currentInteractive sessions, simple queries
CLIFilter intermediate results, preserve context (why this matters)Complex workflows, scripting, Graph-RAG patterns

See SCRIPTING.md for advanced patterns and BOOTSTRAP.md for the full journey from empty graph to domain expertise.


The Cognitive Stack

Memory Layer

Every piece of knowledge lives as a markdown file with a unique URI:

  • memory://decisions/api-design — Architectural decisions
  • memory://thinking/session-12345 — Sequential thinking sessions
  • memory://research/rag-comparison — Research notes

All files are human-readable, Obsidian-compatible, and persist across sessions.

Two-Stage Memory Model: Following the hippocampal-neocortical distinction:

  • Episodic (memory://thinking/): Fast encoding, rapid decay — raw reasoning traces
  • Semantic (memory://research/, memory://decisions/): Slow consolidation, stable knowledge
  • Immortal: Validated assumptions and core architecture — exempt from decay

The memory-consolidation workflow transfers high-value episodic memories to semantic storage, mirroring biological memory consolidation during sleep.

Graph Layer

Automatic graph construction from WikiLinks with:

  • 384-dimensional embeddings for semantic similarity
  • Edge weights that strengthen with repeated mentions
  • Concept clustering revealing emergent patterns
  • Community detection via Louvain algorithm identifies reasoning domains
  • Decay weighting (ACT-R power-law) biases concept rankings by recency
  • Incremental sync keeping the graph current

Symbolic Communication

WikiLinks serve as an inter-agent communication protocol — concept-as-protocol:

When an agent writes [[concept]], the system:

  1. Extracts WikiLinks via regex
  2. Calls BuildContext + FindSimilarConcepts for each
  3. Injects graph neighborhood as enriched context
  4. Receiving agent gets structured knowledge without manual curation

Information Density: A 14-byte [[authentication]] dereferences to megabytes of structured knowledge — far exceeding what fits in a prompt.

Storage vs Retrieval Strength (New Theory of Disuse):

  • WikiLinks = storage strength (pointers persist, never decay)
  • Decay weight = retrieval strength (access recency determines surfacing priority)

Forgetting is not loss of the pointer — it's reduced priority for retrieval. The knowledge remains; only its accessibility fades.

Reasoning Layer

Where test-time computation happens:

  • Sequential Thinking: Multi-step reasoning with revision and branching
  • Workflow Orchestration: 35+ distinct methodologies with quality gates and guardrails
  • Assumption Ledger: Traceable skepticism — capture, validate, and track assumptions
  • Multi-agent Coordination: Wave-based execution with parallel agent dispatch
  • Intelligent Method Selection: Meta-cognitive system for optimal reasoning approach
  • RTM Validation: Requirements traceability for systematic development
  • Quality Control: Stop conditions, validation gates, and anti-slop controls

Context Window Economics: The PM (blue hat) uses sequential thinking to preserve expensive context while dispatching fresh agents for implementation. This allows complex projects without context exhaustion.


Cognitive Assets

AssetCountExamples
Workflows35+Deductive, design thinking, agentic sprints, game theory, research think tank
Roles16Architect, PM, red-team, blue-team, researcher, writer, FinOps practitioner
Thinking Colors7DeBono's Six Hats + Gray (skeptical inquiry)
Perspectives12Native language modes for culturally-aware reasoning

Key Capabilities

  • Test-time Adaptive Reasoning: Sequential thinking with revision, branching, and multi-agent collaboration
  • Intelligent Workflow Selection: Meta-cognitive system that analyzes problems and selects optimal reasoning approaches
  • 35+ Distinct Methodologies: Complete taxonomy from deductive reasoning to design thinking
  • Hybrid RRF Search: Semantic + full-text fusion for optimal retrieval
  • Lazy Graph Construction: No schema, no ontology — structure emerges from WikiLink usage
  • Neuroscience-Grounded Decay: ACT-R power-law forgetting with tiered memory classes
  • Autonomous Sleep Cycles: Five-specialist maintenance runs unattended
  • Symbolic Inter-Agent Protocol: WikiLinks dereference to graph context
  • Quality-Gated Orchestration: Multi-agent coordination with validation waves and RTM compliance
  • Complete Transparency: Every thought, revision, and decision visible in markdown files
  • Multi-day Persistence: Sessions maintain state across restarts
  • Community Detection: Louvain algorithm identifies reasoning domains during sync, enabling graph-of-thought priming
  • Session Abandonment Detection: 30-minute inactivity threshold marks active sessions as abandoned during sync
  • Graph-of-Thought Priming: Hook system queries community index to inject clustered concept maps at session start and task dispatch

Demo Artifacts

Real orchestration sessions demonstrating the system in use:

See the demo artifacts README for the full timeline and directory structure.


Testing & Validation

The Hero Demo

The comprehensive E2E test orchestrated 12 specialized agents across 4 waves:

  • Found and fixed a critical bug: Move operations were losing file extensions — mocks would never catch this
  • Discovered parameter inconsistencies: minScore filtering wasn't working — only real queries revealed this
  • Validated actual performance: Real operations against real data, not synthetic benchmarks
  • 85% success rate: Honest assessment, not 100% fake passes

Test Philosophy

Following the NO FAKE TESTS principle:

  • Real SQLite, not mocks
  • Real file operations, not stubs
  • Real vector embeddings, not fixtures
  • Real multi-agent coordination, not simulations

Technical Specifications

SpecValue
LanguageC# / .NET 9.0
Vectors384-dim (all-MiniLM-L6-v2 via ONNX)
SearchReciprocal Rank Fusion (k=60)
DatabaseSQLite + sqlite-vec (bundled)
Memory CycleConfigurable interval; decay params expressed as cycle multiples
Decay ModelACT-R power-law (d=0.5); calibrated to memory cycle
Memory TiersSequential (7d grace) / Workflows (14d) / Semantic (28d) / Half-life 30d
Maintenance5 workflows (repair/hub-detection/consolidation/epistemic/status) in serialized dependency order

Decay affects search ranking only. Files are never deleted.

Local-only, single-user, no authentication. Memory files (markdown) are the source of truth; the SQLite database is a regenerable cache (maenifold --tool Sync). Version control memory with git to track changes alongside code. Set MAENIFOLD_ROOT to store memory in your repository for atomic commits of code + reasoning.


Technical Principles

Transparency First

Every operation is inspectable — thinking sessions show all revisions, search results include scores, graph relationships are queryable SQL, all content is readable markdown.

Lazy Evaluation

Nothing is pre-computed or pre-structured — graph builds from WikiLink usage, embeddings generate on demand, relationships emerge from repetition, structure follows function.

Composable Tools

Each tool does one thing well — WriteMemory creates markdown, SequentialThinking reasons iteratively, BuildContext traverses the graph, Workflow orchestrates tool composition.

Files as Source of Truth

Not a black box — direct file access for debugging, git-compatible for version control, Obsidian-compatible for human editing, standard markdown for portability.


Configuration

Custom data directory:

Claude Desktop — Same MCP config, different location:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json

Skills

SkillWhat You Get
Maenifold25+ tools, 6 composable layers, sequential thinking, 35+ workflows
Product ManagerMulti-agent orchestration, graph context injection, quality gates, sprint traceability

Integrations

IntegrationWhat It Does
Claude Code PluginMCP server, graph-of-thought hooks, skill auto-loading
OpenCode PluginsWikiLink-aware compaction, session persistence for OpenCode CLI

Project Structure


License & Attribution

License: MIT

Sequential Thinking implementation inspired by MCP Sequential Thinking — enhanced with lazy graph construction and multi-agent collaboration.


Domain expertise that compounds.