Skip to main content

Architecture

Understanding the Cognitive Stack that powers Maenifold

The Cognitive Stack

Maenifold organizes intelligence into three interconnected layers, each serving a distinct purpose in the reasoning pipeline.

4.1 Memory Layer (memory://)

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.

4.2 Graph Layer (SQLite + Vectors)

Automatic graph construction from WikiLinks with:

  • 384-dimensional embeddings for semantic similarity
  • Edge weights that strengthen with repeated mentions
  • Concept clustering revealing emergent patterns
  • Incremental sync keeping the graph current

4.3 Reasoning Layer (Tools + Workflows)

Where test-time computation happens:

  • Sequential Thinking: Multi-step reasoning with revision and branching
  • Workflow Orchestration: 30 distinct methodologies with quality gates and guardrails
  • Assumption Ledger: Traceable skepticism for agent reasoning—capture, validate, and track assumptions without auto-inference
  • Multi-agent Coordination: Wave-based execution with parallel agent dispatch
  • Intelligent Method Selection: Meta-cognitive system for optimal reasoning approach selection
  • 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.

∴ The PM remembers so agents can forget

Technical Specifications

  • Language: C# with .NET 9.0
  • Vector Dimensions: 384 (all-MiniLM-L6-v2 via ONNX)
  • Search Algorithm: Reciprocal Rank Fusion (k=60)
  • Database: SQLite with vector extension
  • Graph Sync: Incremental with file watching
  • Memory Format: Markdown with YAML frontmatter
  • URI Scheme: memory:// protocol
  • Tested Scale: > 1.1 million relationships

Cognitive Assets

30 Distinct Methodologies

Complete taxonomy from deductive reasoning to design thinking:

  • Reasoning: deductive, inductive, abductive, critical, strategic, higher-order thinking
  • Creative: design thinking, divergent thinking, lateral thinking, oblique strategies, SCAMPER
  • Development: agentic-dev with anti-slop controls, agile, SDLC, code review workflows
  • Collaborative: world café, parallel thinking, six thinking hats
  • Meta-orchestration: workflow-dispatch for intelligent methodology selection

Roles & Perspectives

  • 7 Roles: architect, engineer, PM, data-scientist, product-manager, writer, designer
  • 7 Thinking Hats: DeBono's Six Thinking Hats + Gray Hat

Search & RAG Patterns

Maenifold combines vector search, a concept graph, and tools to implement a range of Retrieval-Augmented Generation (RAG) techniques:

  • Classic RAG: semantic search over files using 384-dimension embeddings.
  • Graph-RAG: concept-centric retrieval using BuildContext + SearchMemories on the concept graph.
  • Multi-hop traversal: depth-limited graph exploration (typically depth=2) to gather related concepts.
  • RRF reranking: Hybrid search that fuses text and semantic scores using Reciprocal Rank Fusion.
  • HYDE & FLARE patterns: hypothetical answers with [[concepts]] then search (HYDE), and proactive session-start retrieval (FLARE).
  • Self-RAG / CRAG: iterative refinement and corrective retrieval via SequentialThinking + AssumptionLedger.

These patterns are applied consistently across integrations:

  • Claude Code: session-start hook implements FLARE-style proactive Graph-RAG context restoration.
  • VS Code agents: maenifold SWE agent and agent-boss orchestrator implement HYDE + Self-RAG over the graph.
  • Codex CLI: SWE profile drives HYDE, FLARE-like startup, and iterative Self-RAG inside the Codex harness.

For a deep dive into these patterns and CLI scripting examples, see the repository documentdocs/search-and-scripting.md.

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

Hybrid RRF Search

Semantic + full-text fusion for optimal retrieval, not just embedding similarity

Lazy Graph Construction

No schema, no ontology—structure emerges from WikiLink usage

Quality-Gated Orchestration

Multi-agent coordination with validation waves, guardrails, and RTM compliance

Complete Transparency

Every thought, revision, and decision visible in markdown files

How They Work Together

The three layers integrate into a cohesive system for persistent, compound reasoning:

  1. Memory Layer captures every decision as markdown with WikiLinks
  2. Graph Layer automatically builds relationships from those WikiLinks, creating a knowledge network
  3. Reasoning Layer uses both memory and graph to enable multi-step thinking, intelligent workflow selection, and quality-gated orchestration

Together, they create a system where knowledge compounds over time, where reasoning can revise and branch, and where complex problems can be systematically solved.

MCP Integration

Maenifold is fully compliant with the Model Context Protocol, exposing all cognitive tools through the MCP interface:

  • Full tool annotation support for AI agents
  • Seamless integration with Claude, Cursor, Continue, and other MCP clients
  • Composable tools that can be orchestrated into complex workflows
  • Real-time tool discovery and capability introspection