Daem0nMCP 标志

Daem0nMCP

社区
9thLevelSoftware

Persistent memory, decision-making, and governance for AI agents

发布者9thLevelSoftware
代码仓库Daem0n-MCP
语言Python
复刻数
12
星标数
73
可用工具
0
传输类型stdio
分类
许可协议MIT
链接
  • 将工具接入 AI 工作流

    Daem0nMCP 提供 MCP 功能,可供兼容的 AI 客户端和智能体使用。

  • 0 个可用工具

    浏览下方可调用的操作;如果服务器提供了名称和描述,也会一并显示。

  • 可直接复制的配置

    使用安装配置片段,在您首选的 MCP 客户端中配置此服务器。

  • 开源社区热度

    关联的代码仓库有 73 个星标和 12 个复刻。

Daem0nMCP

        ,     ,
       /(     )\
      |  \   /  |      "I am Daem0n, keeper of memories,
       \  \ /  /        guardian of decisions past..."
        \  Y  /
         \ | /
          \|/
           *

AI Memory & Decision System - Give AI agents persistent memory and consistent decision-making with actual semantic understanding.

What's New in v6.6.6

ModernBERT Deep Sight (BREAKING)

The daemon's vision has been fundamentally sharpened. The old all-MiniLM-L6-v2 embedding model is replaced by ModernBERT with asymmetric query/document encoding and optional ONNX acceleration.

AspectOld (v5.x)New (v6.6.6)
Modelall-MiniLM-L6-v2nomic-ai/modernbert-embed-base
Dimensions384256 (Matryoshka truncation)
EncodingSingle encode()Dual: encode_query() / encode_document()
BackendPyTorch onlyONNX quantized (with torch fallback)
PrefixesNonesearch_query: / search_document:

This is a BREAKING CHANGE — existing embeddings must be re-encoded:

bash
python -m daem0nmcp.migrations.migrate_embedding_model --project-path /path/to/.daem0nmcp

Background Dreaming

When the user goes idle, the daemon autonomously re-evaluates past failed decisions using current evidence:

  • IdleDreamScheduler monitors tool call activity
  • After configurable idle timeout (default 60s), FailedDecisionReview strategy runs
  • Classifies decisions as revised, confirmed_failure, or needs_more_data
  • Insights persisted as learning memories with dream tag and full provenance
  • Yields immediately when user returns (cooperative scheduling)

Cognitive Tools (3 new standalone MCP tools)

Meta-reasoning tools for daemon introspection:

ToolPurpose
simulate_decisionTemporal Scrying — replay a past decision with current knowledge, revealing what changed
evolve_ruleRule Entropy Analysis — examine rules for staleness, code drift, and outcome correlation
debate_internalAdversarial Council — structured evidence-grounded debate with convergence detection

Auto-Zoom Retrieval Routing

Query-aware search dispatch that routes to the optimal retrieval strategy:

  • SIMPLE queries → Vector-only search (fast path)
  • MEDIUM queries → Hybrid BM25+vector with RRF fusion
  • COMPLEX queries → GraphRAG multi-hop traversal + community summaries
  • Shadow mode (default) logs classifications without changing behavior
  • All strategies fall back to hybrid on failure

Claude Code Native Hooks

New daem0nmcp/claude_hooks/ module with 5 lifecycle hooks and automated installation:

bash
python -m daem0nmcp.cli install-claude-hooks      # Install to ~/.claude/settings.json
python -m daem0nmcp.cli uninstall-claude-hooks     # Remove
HookPurpose
session_startAuto-briefing at session dawn
pre_editPreflight enforcement + file memory recall before edits
pre_bashRule enforcement on bash commands
post_editSuggest remembrance for significant changes
stopAuto-capture decisions from conversation

Stats

  • 8 workflow tools + 3 cognitive tools (11 MCP tools total)
  • 59 workflow actions across 8 workflows
  • 500+ tests passing

What's New in v5.1.0

Workflow Consolidation

v5.1 consolidates 67 individual MCP tools into 8 workflow-oriented tools, dramatically reducing context overhead for AI agents while preserving all capabilities.

8 Workflow Tools

WorkflowPurposeActions
communeSession start & statusbriefing, active_context, triggers, health, covenant, updates
consultPre-action intelligencepreflight, recall, recall_file, recall_entity, recall_hierarchical, search, check_rules, compress
inscribeMemory writing & linkingremember, remember_batch, link, unlink, pin, activate, deactivate, clear_active, ingest
reflectOutcomes & verificationoutcome, verify, execute
understandCode comprehensionindex, find, impact, todos, refactor
governRules & triggersadd_rule, update_rule, list_rules, add_trigger, list_triggers, remove_trigger
exploreGraph & discoveryrelated, chain, graph, stats, communities, community_detail, rebuild_communities, entities, backfill_entities, evolution, versions, at_time
maintainHousekeeping & federationprune, archive, cleanup, compact, rebuild_index, export, import_data, link_project, unlink_project, list_projects, consolidate

How It Works

Each workflow tool accepts an action parameter that selects the operation:

python
# Old way (67 separate tools)
mcp__daem0nmcp__get_briefing(project_path="...")
mcp__daem0nmcp__recall(topic="auth", project_path="...")
mcp__daem0nmcp__remember(category="decision", content="...", project_path="...")
mcp__daem0nmcp__record_outcome(memory_id=42, outcome="...", worked=True, project_path="...")

# New way (8 workflow tools)
mcp__daem0nmcp__commune(action="briefing", project_path="...")
mcp__daem0nmcp__consult(action="recall", topic="auth", project_path="...")
mcp__daem0nmcp__inscribe(action="remember", category="decision", content="...", project_path="...")
mcp__daem0nmcp__reflect(action="outcome", memory_id=42, outcome_text="...", worked=True, project_path="...")

Why Consolidate?

  • 88% fewer tool definitions in context (8 vs 67)
  • Lower token overhead — AI agents load fewer tool schemas
  • Logical grouping — related operations live in one tool
  • Backward compatible — legacy individual functions remain importable for internal dispatch, but only the consolidated workflow and cognitive tools are exposed to MCP clients

What's New in v5.0.0

Visions of the Void (MCP Apps)

Interactive HTML interfaces via MCP Apps (SEP-1865). Visual mode is now accessed via the visual=true parameter on workflow tools:

python
commune(action="briefing", visual=true, project_path="...")      # Briefing Dashboard
consult(action="recall", topic="auth", visual=true, project_path="...")  # Search Results UI
commune(action="covenant", visual=true, project_path="...")      # Covenant Status
explore(action="communities", visual=true, project_path="...")   # Community Map
explore(action="graph", topic="auth", visual=true, project_path="...")  # Memory Graph Viewer

Features: D3.js v7 bundled (105KB, no CDN), restrictive CSP, canvas-based graph (10,000+ nodes at 60fps), graceful text fallback for non-visual hosts.


What's New in v4.0.0

Cognitive Architecture

Five major capabilities:

  • GraphRAG & Leiden Communities: Knowledge graph construction with hierarchical community detection, multi-hop queries, global search via community summaries
  • Bi-Temporal Knowledge: Dual timestamps (valid_time vs transaction_time), happened_at backfilling, as_of_time point-in-time queries, contradiction detection
  • Metacognitive Reflexion: Actor-Evaluator-Reflector loop, verify action validates claims against stored knowledge, reflection persistence
  • Context Engineering: LLMLingua-2 for 3x-6x compression, code entity preservation, adaptive rates, compress action for on-demand optimization
  • Dynamic Agency: execute action for sandboxed Python execution via E2B Firecracker microVMs

What's New in v3.1.0

2026 AI Memory Research Enhancements

  • BM25 + RRF Hybrid Retrieval: Okapi BM25 replaces TF-IDF, Reciprocal Rank Fusion combines keyword and vector search
  • TiMem-Style Recall Planner: Complexity-aware retrieval adapting to query difficulty (simple/medium/complex)
  • Titans-Inspired Surprise Scoring: Novelty detection with surprise_score (0.0-1.0)
  • Importance-Weighted Learning: EWC-inspired protection for valuable memories via importance_score
  • Fact Model: Verified facts promote to immutable O(1) lookup after threshold successful outcomes

What's New in v3.0.0

FastMCP 3.0 Upgrade

  • CovenantMiddleware: Sacred Covenant enforcement via FastMCP 3.0 middleware pattern
  • Component Versioning: All tools include version metadata
  • OpenTelemetry Tracing (Optional): pip install daem0nmcp[tracing]

Previous Versions

  • Tools block with COMMUNION_REQUIRED/COUNSEL_REQUIRED until proper rituals observed
  • Preflight tokens with 5-minute validity
  • MCP Resources for dynamic context injection (daem0n://warnings/, daem0n://failed/, etc.)
  • Active Working Context (MemGPT-style always-hot memories, max 10)
  • Temporal versioning with versions and at_time queries
  • Hierarchical summarization via Leiden communities
  • Auto entity extraction from memory content
  • Contextual recall triggers (auto-recall on file/tag/entity patterns)
  • Configurable hybrid search weight, result diversity, tag inference
  • Qualified entity names (module.Class.method), incremental indexing
  • Passive Capture hooks (auto-remember decisions from conversation)
  • Endless Mode (condensed recall with 50-75% token reduction)
  • Linked Projects for cross-repo memory awareness
  • Multi-language AST parsing via tree-sitter (Python, TypeScript, JavaScript, Go, Rust, Java, C, C++, C#, Ruby, PHP)
  • Qdrant vector backend for persistent vector storage
  • Proactive file watcher with desktop/log/editor-poll notifications
  • Pre-commit enforcement hooks blocking commits with stale decisions
  • CLI tools for status, record-outcome, install-hooks
  • TF-IDF semantic search with real similarity matching
  • Memory decay (30-day half-life for decisions/learnings, eternal patterns/warnings)
  • Conflict detection and failed decision boosting (1.5x relevance)
  • File-level memory associations
  • Vector embeddings for enhanced semantic matching

Why Daem0nMCP?

AI agents start each session fresh. They don't remember:

  • What decisions were made and why
  • Patterns that should be followed
  • Warnings from past mistakes

Markdown files don't solve this - the AI has to know to read them and might ignore them.

Daem0nMCP provides ACTIVE memory - it surfaces relevant context when the AI asks about a topic, enforces rules before actions, and learns from outcomes.

What Makes This Different

  • Semantic matching: "creating REST endpoint" matches rules about "adding API route"
  • Time decay: A decision from yesterday matters more than one from 6 months ago
  • Conflict warnings: "You tried this approach before and it failed"
  • Learning loops: Record outcomes, and failures get boosted in future recalls
  • Surprise scoring: Novel information surfaces above routine knowledge
  • Graph reasoning: Multi-hop traversal across linked memories and communities
  • Background dreaming: Idle-time re-evaluation of past failed decisions

Quick Start

Claude Code (The Easy Way)

  1. Copy Summon_Daem0n.md to your project
  2. Start a Claude Code session in that project
  3. Claude will read the file and perform the summoning ritual automatically

OpenCode

  1. Install Daem0n-MCP: pip install -e ~/Daem0n-MCP
  2. Run the installer: python -m daem0nmcp.cli install-opencode
  3. Launch OpenCode in your project directory
  4. Run /commune to begin

For the full ritual walkthrough, see Summon_Daem0n_OpenCode.md.

Manual Installation

bash
# Clone the repository
git clone https://github.com/9thlevelsoftware/Daem0n-MCP.git ~/Daem0n-MCP

# Install
pip install -e ~/Daem0n-MCP

# Run the MCP server (Linux/macOS — stdio transport)
python -m daem0nmcp.server

# Run the MCP server (Windows — HTTP transport required)
python ~/Daem0n-MCP/start_server.py --port 9876

Installation by Platform

Linux / macOS (stdio transport)

bash
# Find your Python path
python3 -c "import sys; print(sys.executable)"

# Register with Claude Code (replace <PYTHON_PATH>)
claude mcp add daem0nmcp --scope user -- <PYTHON_PATH> -m daem0nmcp.server

# Restart Claude Code

Windows (HTTP transport required)

Windows has a known bug where Python MCP servers using stdio transport hang indefinitely. Use HTTP transport instead:

  1. Start the server (keep this terminal open):
bash
python ~/Daem0n-MCP/start_server.py --port 9876

Or use start_daem0nmcp_server.bat

  1. Add to ~/.claude.json:
json
{
  "mcpServers": {
    "daem0nmcp": {
      "type": "http",
      "url": "http://localhost:9876/mcp"
    }
  }
}
  1. Start Claude Code (after server is running)

Transport Modes

MethodTransportDefault PortUse Case
python -m daem0nmcp.serverstdio (default) or sse8765 (sse)Unix/macOS direct channel
python start_server.pystreamable-http9876Windows HTTP, remote access

For OpenCode setup, see the OpenCode Integration section below, or run python -m daem0nmcp.cli install-opencode for automated setup.

Workflow Tools (8 Tools, 59 Actions)

All capabilities are accessed through 8 workflow tools. Each tool accepts an action parameter to select the operation. Legacy individual functions remain importable for internal dispatch, but only the consolidated workflow and cognitive tools are exposed to MCP clients.

commune — Session Start & Status

ActionPurpose
briefingSmart session start with git awareness
active_contextGet all hot memories for current focus
triggersCheck context triggers for auto-recalled memories
healthServer health, version, and statistics
covenantSacred Covenant status and phase
updatesPoll for knowledge changes (real-time notifications)

consult — Pre-Action Intelligence

ActionPurpose
preflightCombined recall + rules check before changes
recallSemantic memory retrieval by topic (supports condensed, visual)
recall_fileGet memories linked to a specific file
recall_entityGet memories mentioning a code entity
recall_hierarchicalGraphRAG-style layered retrieval with community summaries
searchFull-text search across all memories (supports highlight, visual)
check_rulesValidate action against decision rules
compressLLMLingua-2 context compression

inscribe — Memory Writing & Linking

ActionPurpose
rememberStore a memory with conflict detection
remember_batchStore multiple memories in one transaction
linkCreate causal relationships between memories
unlinkRemove relationships between memories
pinPin/unpin memories to prevent pruning
activateAdd memory to always-hot working context
deactivateRemove memory from active context
clear_activeClear all active context
ingestImport external documentation from URL

reflect — Outcomes & Verification

ActionPurpose
outcomeRecord whether a decision worked or failed
verifyValidate factual claims against stored knowledge
executeSandboxed Python execution (E2B)

understand — Code Comprehension

ActionPurpose
indexIndex code entities via tree-sitter
findSemantic search across code entities
impactAnalyze blast radius of code changes
todosScan for TODO/FIXME/HACK/XXX/BUG comments
refactorGenerate refactor suggestions with causal history

govern — Rules & Triggers

ActionPurpose
add_ruleCreate decision tree rules
update_ruleModify existing rules
list_rulesShow all configured rules
add_triggerCreate auto-recall context triggers
list_triggersList all context triggers
remove_triggerRemove a context trigger

explore — Graph & Discovery

ActionPurpose
relatedFind related memories via graph traversal
chainFind causal paths between memories
graphVisualize memory relationships (JSON/Mermaid, supports visual)
statsKnowledge graph metrics
communitiesList Leiden community clusters (supports visual)
community_detailDrill down into a community
rebuild_communitiesDetect communities via Leiden algorithm
entitiesList most frequently mentioned entities
backfill_entitiesExtract entities from existing memories
evolutionTrace knowledge evolution over time
versionsGet version history for a memory
at_timeQuery memory state at a point in time

maintain — Housekeeping & Federation

ActionPurpose
pruneRemove old, low-value memories (with protection)
archiveArchive/restore memories
cleanupFind and merge duplicate memories
compactConsolidate episodic memories into summaries
rebuild_indexForce rebuild TF-IDF and vector indexes
exportExport all memories and rules as JSON
import_dataImport memories and rules from JSON
link_projectLink to another project for cross-repo awareness
unlink_projectRemove a project link
list_projectsList all linked projects
consolidateMerge memories from linked projects

Cognitive Tools (Standalone)

ToolPurpose
simulate_decisionTemporal Scrying — replay a past decision with current knowledge
evolve_ruleRule Entropy — examine rules for staleness and drift
debate_internalAdversarial Council — evidence-grounded debate with convergence detection

Tool Names by Client

Different MCP clients use different naming conventions for tools. Both formats resolve to the same server-side operations.

Workflow Tools:

MCP ToolClaude CodeOpenCode
communemcp__daem0nmcp__communedaem0nmcp_commune
consultmcp__daem0nmcp__consultdaem0nmcp_consult
inscribemcp__daem0nmcp__inscribedaem0nmcp_inscribe
reflectmcp__daem0nmcp__reflectdaem0nmcp_reflect
understandmcp__daem0nmcp__understanddaem0nmcp_understand
governmcp__daem0nmcp__governdaem0nmcp_govern
exploremcp__daem0nmcp__exploredaem0nmcp_explore
maintainmcp__daem0nmcp__maintaindaem0nmcp_maintain

Cognitive Tools:

MCP ToolClaude CodeOpenCode
simulate_decisionmcp__daem0nmcp__simulate_decisiondaem0nmcp_simulate_decision
evolve_rulemcp__daem0nmcp__evolve_ruledaem0nmcp_evolve_rule
debate_internalmcp__daem0nmcp__debate_internaldaem0nmcp_debate_internal

Format pattern:

ClientFormatSeparator
Claude Codemcp__servername__toolnameDouble underscore (__)
OpenCodeservername_toolnameSingle underscore (_)

Usage Examples

Store a Memory

python
inscribe(
    action="remember",
    category="decision",  # decision, pattern, warning, or learning
    content="Use JWT tokens instead of sessions",
    rationale="Need stateless auth for horizontal scaling",
    tags=["auth", "architecture"],
    file_path="src/auth/jwt.py"  # optional file association
)

Retrieve Memories

python
consult(action="recall", topic="authentication")
# Returns: decisions, patterns, warnings, learnings about auth
# Sorted by: semantic relevance x recency x importance

consult(action="recall_file", file_path="src/auth/jwt.py")
# Returns: all memories linked to this file

consult(action="recall_entity", entity_name="UserService")
# Returns: all memories mentioning the entity

consult(action="recall", topic="auth", condensed=True)
# Condensed: 50-75% fewer tokens, content truncated to 150 chars

Create Rules

python
govern(
    action="add_rule",
    trigger="adding new API endpoint",
    must_do=["Add rate limiting", "Write integration test"],
    must_not=["Use synchronous database calls"],
    ask_first=["Is this a breaking change?"]
)

Track Outcomes

python
reflect(action="outcome", memory_id=42, outcome_text="JWT auth works great", worked=True)
reflect(action="outcome", memory_id=43, outcome_text="Caching caused stale data", worked=False)
# Failed decisions get 1.5x boost in future recalls

Session Start

python
commune(action="briefing", focus_areas=["authentication", "API"])
# Returns: stats, recent decisions, warnings, failed approaches,
# git changes, plus pre-fetched context for focus areas

Active Context (Working Memory)

python
inscribe(action="activate", memory_id=42, reason="Working on auth refactor",
         priority=10, expires_in_hours=8)
# Memory stays in always-hot context, auto-injected into briefings
# Max 10 items, auto-expires, duplicate prevention

commune(action="active_context")  # View all hot memories
inscribe(action="deactivate", memory_id=42)  # Remove
inscribe(action="clear_active")  # Clear all

Cognitive Tools

python
# Temporal Scrying: What would I decide differently today?
simulate_decision(decision_id=42)

# Rule Entropy: Which rules have grown stale?
evolve_rule(rule_id=5)       # Single rule
evolve_rule()                 # Batch: all enabled rules

# Adversarial Council: Evidence-grounded debate
debate_internal(
    topic="Database choice for sessions",
    advocate_position="Use Redis",
    challenger_position="Use PostgreSQL"
)

Import External Docs

python
inscribe(action="ingest", url="https://stripe.com/docs/api/charges", topic="stripe")
# Later: consult(action="recall", topic="stripe") to retrieve

AI Agent Protocol

The recommended workflow for AI agents:

SESSION START
    +-> commune(action="briefing")

BEFORE CHANGES
    +-> consult(action="preflight", description="what you're doing")
    +-> consult(action="recall_file", file_path="path/to/file.py")

AFTER DECISIONS
    +-> inscribe(action="remember", category=..., content=..., rationale=..., file_path=...)

AFTER IMPLEMENTATION
    +-> reflect(action="outcome", memory_id=..., outcome_text=..., worked=...)

See Summon_Daem0n.md for the complete protocol (with ritual theme for fun).

Claude Code Integration

Automated Hook Installation (Recommended)

bash
python -m daem0nmcp.cli install-claude-hooks

This registers 5 hook modules in ~/.claude/settings.json:

EventHookPurpose
SessionStartsession_startAuto-briefing summary
PreToolUse (Edit/Write/NotebookEdit)pre_editPreflight enforcement + file memory recall
PreToolUse (Bash)pre_bashRule enforcement on commands
PostToolUse (Edit/Write)post_editSuggest remembrance for significant changes
Stop/SubagentStopstopAuto-capture decisions from conversation

To remove: python -m daem0nmcp.cli uninstall-claude-hooks

Manual Hooks (Legacy)

Add to .claude/settings.json:

json
{
  "hooks": {
    "PreToolUse": [{
      "matcher": "Edit|Write|NotebookEdit",
      "hooks": [{
        "type": "command",
        "command": "python3 \"$HOME/Daem0nMCP/hooks/daem0n_pre_edit_hook.py\""
      }]
    }],
    "PostToolUse": [{
      "matcher": "Edit|Write",
      "hooks": [{
        "type": "command",
        "command": "python3 \"$HOME/Daem0nMCP/hooks/daem0n_post_edit_hook.py\""
      }]
    }],
    "Stop": [{
      "matcher": "",
      "hooks": [{
        "type": "command",
        "command": "python3 \"$HOME/Daem0nMCP/hooks/daem0n_stop_hook.py\""
      }]
    }]
  }
}

Protocol Skill

A Claude Code skill is included at .claude/skills/daem0nmcp-protocol/SKILL.md that enforces the memory protocol automatically.

OpenCode Integration

OpenCode connects to Daem0n-MCP via the same MCP server. No server changes required -- the daemon serves all clients equally.

Configuration

Create opencode.json at your project root:

json
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "daem0nmcp": {
      "type": "local",
      "command": ["python", "-m", "daem0nmcp"],
      "enabled": true,
      "environment": {
        "PYTHONUNBUFFERED": "1"
      }
    }
  }
}

For Windows (where HTTP transport is required), use:

json
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "daem0nmcp": {
      "type": "remote",
      "url": "http://localhost:9876/mcp",
      "enabled": true
    }
  }
}

System Instructions

OpenCode reads AGENTS.md from the project root for system prompt injection. The Sacred Covenant protocol is included in AGENTS.md with OpenCode-compatible tool names.

If both AGENTS.md and CLAUDE.md exist in a project, OpenCode uses only AGENTS.md.

Tool Names

OpenCode uses a different tool name format than Claude Code:

ClientFormatExample
Claude Codemcp__servername__toolnamemcp__daem0nmcp__commune
OpenCodeservername_toolnamedaem0nmcp_commune

Both formats resolve to the same MCP server tools. Use the format matching your client. See the Tool Names by Client table in the Workflow Tools section for the complete mapping.

How It Works

Hybrid Search (BM25 + Vector + RRF)

  • BM25 for keyword matching with term saturation and length normalization
  • ModernBERT vector embeddings (256-dim, asymmetric encoding) for deep semantic understanding
  • Reciprocal Rank Fusion combines both with configurable weights
  • "blocking database calls" matches memories about "synchronous queries"

Auto-Zoom Retrieval Routing

Query-aware dispatch classifies complexity and routes to the optimal strategy:

  • Simple queries → vector-only (fast path)
  • Medium queries → hybrid BM25+vector
  • Complex queries → GraphRAG multi-hop with community summaries

Memory Decay

weight = e^(-lambda*t) where lambda = ln(2)/half_life_days

Default half-life is 30 days. Patterns and warnings are permanent (no decay).

Conflict Detection

When storing a new memory, it's compared against recent memories:

  • If similar content failed before → warning about the failure
  • If it matches an existing warning → warning surfaced
  • If highly similar content exists → potential duplicate flagged

Failed Decision Boosting

Memories with worked=False get a 1.5x relevance boost in recalls. Warnings get a 1.2x boost. Past mistakes surface prominently.

Background Dreaming

During idle periods, the daemon re-evaluates failed decisions against current evidence. FailedDecisionReview strategy finds worked=False decisions, recalls current evidence, and persists actionable insights as learning memories. Yields cooperatively when the user returns.

Data Storage

Each project gets isolated storage at:

<project_root>/.daem0nmcp/storage/daem0nmcp.db

Configuration

All settings are configurable via environment variables with DAEM0NMCP_ prefix.

Core Settings

VariableDefaultDescription
DAEM0NMCP_PROJECT_ROOT.Project root path
DAEM0NMCP_STORAGE_PATHautoOverride storage location
DAEM0NMCP_LOG_LEVELINFOLogging level
DAEM0NMCP_QDRANT_URLNoneRemote Qdrant URL (overrides local)

Embedding Model (v6.6.6+)

VariableDefaultDescription
DAEM0NMCP_EMBEDDING_MODELnomic-ai/modernbert-embed-baseModel name
DAEM0NMCP_EMBEDDING_DIMENSION256Matryoshka truncation dimension
DAEM0NMCP_EMBEDDING_BACKENDauto-detectedonnx or torch
DAEM0NMCP_EMBEDDING_QUERY_PREFIXsearch_query: Prefix for query encoding
DAEM0NMCP_EMBEDDING_DOCUMENT_PREFIXsearch_document: Prefix for document encoding

Search Tuning

VariableDefaultDescription
DAEM0NMCP_HYBRID_VECTOR_WEIGHT0.3Vector weight in hybrid search (0.0-1.0)
DAEM0NMCP_BM25_K11.5BM25 term frequency saturation
DAEM0NMCP_BM25_B0.75BM25 document length normalization
DAEM0NMCP_RRF_K60RRF fusion dampening constant
DAEM0NMCP_SEARCH_DIVERSITY_MAX_PER_FILE3Max results from same file

Auto-Zoom Routing

VariableDefaultDescription
DAEM0NMCP_AUTO_ZOOM_ENABLEDfalseMaster switch for query-aware routing
DAEM0NMCP_AUTO_ZOOM_SHADOWtrueLog classifications without routing
DAEM0NMCP_AUTO_ZOOM_CONFIDENCE_THRESHOLD0.25Below this → hybrid fallback
DAEM0NMCP_AUTO_ZOOM_GRAPH_EXPANSION_DEPTH2Multi-hop depth for complex queries

Background Dreaming

VariableDefaultDescription
DAEM0NMCP_DREAM_ENABLEDtrueMaster switch for dreaming
DAEM0NMCP_DREAM_IDLE_TIMEOUT60.0Seconds of idle before dreaming starts
DAEM0NMCP_DREAM_MAX_DECISIONS_PER_SESSION5Max failed decisions to re-evaluate
DAEM0NMCP_DREAM_MIN_DECISION_AGE_HOURS1Min age before re-evaluation eligible

Cognitive Tools

VariableDefaultDescription
DAEM0NMCP_COGNITIVE_DEBATE_MAX_ROUNDS5Max rounds for adversarial council
DAEM0NMCP_COGNITIVE_EVOLVE_MAX_RULES10Max rules to analyze for staleness
DAEM0NMCP_COGNITIVE_STALENESS_AGE_WEIGHT0.3Time-based decay weight

Recall Planner

VariableDefaultDescription
DAEM0NMCP_SURPRISE_K_NEAREST5Neighbors for surprise calculation
DAEM0NMCP_SURPRISE_BOOST_THRESHOLD0.7Boost threshold (0.0-1.0)
DAEM0NMCP_RECALL_SIMPLE_MAX_MEMORIES5Max memories for simple queries
DAEM0NMCP_RECALL_MEDIUM_MAX_MEMORIES10Max memories for medium queries
DAEM0NMCP_RECALL_COMPLEX_MAX_MEMORIES20Max memories for complex queries
DAEM0NMCP_FACT_PROMOTION_THRESHOLD3Outcomes to promote to fact

See Summon_Daem0n.md for the complete configuration reference (~50 settings).

Architecture

daem0nmcp/
├── server.py            # MCP server with 8 workflow + 3 cognitive tools (FastMCP)
├── mcp_instance.py      # FastMCP instance creation
├── config.py            # Pydantic settings (~50 configurable options)
├── memory.py            # Memory storage & semantic retrieval
├── rules.py             # Rule engine with BM25 matching
├── similarity.py        # TF-IDF index, decay, conflict detection
├── vectors.py           # ModernBERT embeddings (ONNX/torch, asymmetric encoding)
├── bm25_index.py        # BM25 Okapi keyword retrieval
├── fusion.py            # Reciprocal Rank Fusion for hybrid search
├── surprise.py          # Titans-inspired novelty detection
├── recall_planner.py    # TiMem-style complexity classification
├── retrieval_router.py  # Auto-Zoom query-aware search dispatch
├── query_classifier.py  # Exemplar-based query complexity classification
├── qdrant_store.py      # Qdrant vector database backend
├── active_context.py    # MemGPT-style always-hot working memory
├── entity_extractor.py  # Entity extraction from memory content
├── entity_manager.py    # Entity lifecycle management
├── communities.py       # Leiden community detection & summaries
├── context_triggers.py  # Auto-recall trigger system
├── context_manager.py   # Multi-project context management
├── covenant.py          # Sacred Covenant enforcement & preflight tokens
├── database.py          # SQLite async database
├── models.py            # 10+ tables: memories, rules, relationships, etc.
├── enforcement.py       # Pre-commit enforcement & session tracking
├── hooks.py             # Git hook templates & installation
├── cli.py               # Command-line interface
├── workflows/           # 8 consolidated workflow tools
│   ├── commune.py       # Session start & status
│   ├── consult.py       # Pre-action intelligence
│   ├── inscribe.py      # Memory writing & linking
│   ├── reflect.py       # Outcomes & verification
│   ├── understand.py    # Code comprehension
│   ├── govern.py        # Rules & triggers
│   ├── explore.py       # Graph & discovery
│   └── maintain.py      # Housekeeping & federation
├── tools/               # MCP tool registrations
│   ├── workflows.py     # 8 workflow tool definitions
│   ├── cognitive_tools.py # simulate_decision, evolve_rule, debate_internal
│   ├── memory.py        # Legacy memory tools (deprecated)
│   ├── briefing.py      # Legacy briefing tools (deprecated)
│   ├── code_tools.py    # Legacy code tools (deprecated)
│   ├── context_tools.py # Legacy context tools (deprecated)
│   ├── entity_tools.py  # Legacy entity tools (deprecated)
│   ├── graph_tools.py   # Legacy graph tools (deprecated)
│   ├── rules.py         # Legacy rule tools (deprecated)
│   ├── temporal.py      # Legacy temporal tools (deprecated)
│   ├── verification.py  # Legacy verification tools (deprecated)
│   ├── federation.py    # Legacy federation tools (deprecated)
│   ├── maintenance.py   # Legacy maintenance tools (deprecated)
│   └── agency_tools.py  # Legacy agency tools (deprecated)
├── cognitive/           # Cognitive tool implementations
│   ├── simulate.py      # Temporal scrying (decision replay)
│   ├── evolve.py        # Rule entropy analysis
│   └── debate.py        # Adversarial council
├── dreaming/            # Background dreaming system
│   ├── scheduler.py     # IdleDreamScheduler (idle detection + dispatch)
│   ├── strategies.py    # FailedDecisionReview strategy
│   └── persistence.py   # Dream session/result models & persistence
├── claude_hooks/        # Claude Code native hooks
│   ├── install.py       # install/uninstall-claude-hooks CLI
│   ├── session_start.py # Auto-briefing at session dawn
│   ├── pre_edit.py      # Preflight enforcement + file recall
│   ├── pre_bash.py      # Rule enforcement on commands
│   ├── post_edit.py     # Significance detection
│   ├── stop.py          # Auto-capture decisions
│   └── _client.py       # Hook helper utilities
├── compression/         # LLMLingua-2 context compression
├── graph/               # Knowledge graph (NetworkX + Leiden)
├── reflexion/           # Metacognitive architecture (LangGraph)
├── agency/              # Dynamic agency (E2B sandboxing)
├── transforms/          # FastMCP 3.0 middleware
│   └── covenant.py      # CovenantMiddleware & CovenantTransform
├── ui/                  # MCP Apps visual interfaces (D3.js)
├── channels/            # Notification channels (desktop, log, editor-poll)
├── migrations/          # Database schema & embedding migrations
├── code_indexer.py      # Code understanding via tree-sitter
├── watcher.py           # Proactive file watcher daemon
├── tracing.py           # OpenTelemetry integration (optional)
├── prompt_templates.py  # AutoPDL-inspired modular prompts
└── tool_search.py       # Dynamic tool discovery index

.claude/
└── skills/
    └── daem0nmcp-protocol/
        └── SKILL.md       # Protocol enforcement skill

.opencode/
├── commands/
│   ├── commune.md       # /commune slash command
│   ├── counsel.md       # /counsel slash command
│   ├── inscribe.md      # /inscribe slash command
│   └── recall.md        # /recall slash command
└── plugins/
    └── daem0n.ts        # Covenant enforcement plugin

Summon_Daem0n.md              # Claude Code installation grimoire
Summon_Daem0n_OpenCode.md     # OpenCode installation grimoire
Banish_Daem0n.md              # Uninstallation instructions (both clients)
start_server.py               # HTTP server launcher (streamable-http transport)

CLI Commands

bash
# Session briefing/statistics
python -m daem0nmcp.cli briefing

# Index code entities
python -m daem0nmcp.cli index [--path PATH] [--patterns **/*.py **/*.ts ...]

# Scan for TODO/FIXME/HACK comments
python -m daem0nmcp.cli scan-todos [--auto-remember] [--path PATH]

# Check a file against memories and rules
python -m daem0nmcp.cli check <filepath>

# Run database migrations (usually automatic)
python -m daem0nmcp.cli migrate [--backfill-vectors]

Hook & Enforcement Commands

bash
# Install Claude Code hooks (user-level, all projects)
python -m daem0nmcp.cli install-claude-hooks [--dry-run]

# Remove Claude Code hooks
python -m daem0nmcp.cli uninstall-claude-hooks [--dry-run]

# Install OpenCode configuration (project-level)
python -m daem0nmcp.cli install-opencode [--dry-run] [--force]
# Creates: opencode.json, .opencode/ directories, .opencode/plugins/daem0n.ts
# AGENTS.md and command files are not auto-created

# Install git pre-commit hooks
python -m daem0nmcp.cli install-hooks [--force]

# Remove git pre-commit hooks
python -m daem0nmcp.cli uninstall-hooks

# Show pending decisions and blocking issues
python -m daem0nmcp.cli status

# Record outcome for a decision
python -m daem0nmcp.cli record-outcome <id> "<outcome>" --worked|--failed

All commands support --json for machine-readable output and --project-path to specify the project root.

Upgrading

1. Update the Code

bash
# If installed from source (recommended)
cd ~/Daem0n-MCP && git pull && pip install -e .

2. Re-encode Embeddings (v6.6.6+ — REQUIRED for existing data)

The embedding model changed from all-MiniLM-L6-v2 (384-dim) to nomic-ai/modernbert-embed-base (256-dim). Existing embeddings must be re-encoded:

bash
python -m daem0nmcp.migrations.migrate_embedding_model --project-path /path/to/.daem0nmcp

Qdrant collections are auto-recreated with the correct dimension on first startup.

3. Install Claude Code Hooks

bash
python -m daem0nmcp.cli install-claude-hooks

4. Restart Claude Code

After updating, restart Claude Code to load the new MCP tools.

4b. Update OpenCode Configuration (if using OpenCode)

bash
python -m daem0nmcp.cli install-opencode --force

This regenerates opencode.json and the plugin to match the latest version.

5. Migrations Run Automatically

Database schema migrations are applied automatically when any MCP tool runs. No manual migration step required.

6. Index Your Codebase

bash
python -m daem0nmcp.cli index

Supports Python, TypeScript, JavaScript, Go, Rust, Java, C, C++, C#, Ruby, PHP via tree-sitter.

Troubleshooting

MCP Tools Not Available in Claude Session

Symptom: claude mcp list shows daem0nmcp connected, but Claude can't use mcp__daem0nmcp__* tools.

Fixes:

  1. Start server before Claude Code (Windows):

    bash
    # Terminal 1: Start Daem0n server first
    python ~/Daem0n-MCP/start_server.py --port 9876
    # Wait for "Uvicorn running on http://localhost:9876"
    
    # Terminal 2: Then start Claude Code
    claude
  2. Re-register the server:

    bash
    claude mcp remove daem0nmcp -s user
    claude mcp add daem0nmcp http://localhost:9876/mcp -s user

Hooks Not Firing

  1. MCP server running: curl http://localhost:9876/mcp should respond
  2. Hooks configured: check ~/.claude/settings.json or .claude/settings.json
  3. Project has .daem0nmcp/ directory

Communion/Counsel Errors

  • COMMUNION_REQUIRED → Call commune(action="briefing", project_path="...") first
  • COUNSEL_REQUIRED → Call consult(action="preflight", description="...", project_path="...") first

OpenCode: Tools Not Found

Symptom: OpenCode reports "tool not found" when using mcp__daem0nmcp__* format.

Fix: OpenCode uses single-underscore format: daem0nmcp_commune (not mcp__daem0nmcp__commune). See Tool Names by Client for the full mapping.

OpenCode: MCP Connection Timeout

Symptom: First tool call times out, but subsequent calls work.

Fix: The embedding model loads on first call (several seconds). Add "timeout": 30000 to your opencode.json MCP config.

OpenCode: Covenant Not Enforced

Symptom: No preflight warnings, no post-edit suggestions in OpenCode.

Fix:

  1. Verify plugin exists: ls .opencode/plugins/daem0n.ts
  2. Verify AGENTS.md contains the Sacred Covenant section
  3. Check OpenCode logs for plugin errors

Development

bash
# Install in development mode
pip install -e .[dev]

# Run tests (500+ tests)
pytest tests/ -v --asyncio-mode=auto

# Run server directly (stdio)
python -m daem0nmcp.server

# Run HTTP server (Windows)
python start_server.py --port 9876

Support

If Daem0nMCP has been useful to you, consider supporting its development:

Ko-fi

Uninstallation

See Banish_Daem0n.md for complete removal instructions (covers both Claude Code and OpenCode), or quick version:

Claude Code

bash
python -m daem0nmcp.cli uninstall-claude-hooks
claude mcp remove daem0nmcp --scope user
pip uninstall daem0nmcp
rm -rf ~/Daem0n-MCP
rm -rf .daem0nmcp/

OpenCode

bash
rm opencode.json
rm -rf .opencode/commands/ .opencode/plugins/daem0n.ts
pip uninstall daem0nmcp
rm -rf ~/Daem0n-MCP
rm -rf .daem0nmcp/

    "The system learns from YOUR outcomes.
     Record them faithfully..."
                              ~ Daem0n

Daem0nMCP v6.6.6: ModernBERT Deep Sight (256-dim Matryoshka, ONNX quantized, asymmetric encoding). 8 workflow tools with 59 actions + 3 cognitive tools (simulate_decision, evolve_rule, debate_internal). Background Dreaming, Auto-Zoom Retrieval Routing, Active Context, Visual Portals (MCP Apps), GraphRAG, bi-temporal knowledge, LLMLingua-2 compression. Claude Code native hooks + OpenCode integration (plugins, commands, covenant enforcement). 500+ tests. The daemon reaches beyond the veil.

安装

TypingMind
{
  "mcpServers": {
    "daem0n-mcp": {
      "command": "python",
      "args": [
        "-m",
        "daem0nmcp.server"
      ]
    }
  }
}

将 Daem0nMCP MCP 与多个 AI 模型配合使用

TypingMind 在工作区级别连接 MCP 工具,因此连接 Daem0nMCP 后,您就可以在 TypingMind 中搭配不同的 AI 模型使用,无需为每个模型单独设置。 此 MCP 通过您设备上的 TypingMind MCP 连接器在本地运行。

本地连接器设置指南

如果 MCP 服务器需要访问您电脑上的本地文件、应用或私有资源,请选择此方式。

1

打开 MCP 设置

在 TypingMind 中,依次前往“设置”、“高级设置”和“模型上下文协议”,然后选择“设置连接器”。

  1. 在您的浏览器中打开 TypingMind。
  2. 点击“设置”图标。
  3. 进入“高级设置”。
  4. 打开“模型上下文协议”部分。
  5. 点击“设置连接器”,然后选择“此设备”。
TypingMind MCP 连接器设置界面,已选择“此设备”
2

运行连接器命令

选择“此设备”,从 TypingMind 复制命令并在终端中运行。使用 MCP 时,请保持该进程运行。

  1. 复制 TypingMind 显示的设置命令。
  2. 在 macOS 上打开“终端”,或在 Windows 上打开 Windows Terminal。
  3. 粘贴并运行命令。
  4. 如果终端询问您是否继续,请确认安装软件包。
  5. 使用 MCP 工具时,请勿关闭终端窗口或停止其中的连接器进程。
3

将 Daem0nMCP 添加为服务器

当连接器状态为“就绪”时,点击“编辑服务器”,然后粘贴 MCP 服务器配置。

  1. 等待连接器状态显示为“就绪”。
  2. 点击“编辑服务器”。
  3. 粘贴 Daem0nMCP MCP 服务器配置。
  4. 保存服务器列表。
  5. 如需确认连接器是否仍处于就绪状态,请刷新。
TypingMind MCP 设置界面,显示正在运行的服务器和“编辑服务器”按钮
{
  "mcpServers": {
    "daem0n-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "daem0nmcp-ui"
      ]
    }
  }
}
4

在不同模型中使用同一连接

保存服务器列表,打开“插件”,启用 Daem0nMCP MCP 工具,然后在 TypingMind 中选择任意受支持的 AI 模型,即可在聊天中使用这些工具,或将其分配给智能体。

  1. 在 TypingMind 中打开“插件”页面。
  2. 启用 Daem0nMCP MCP 工具。
  3. 开始聊天并选择您想使用的 AI 模型。
  4. 在聊天中使用 MCP 工具,或将其分配给 AI 智能体。
  5. 根据需要随时切换到其他 AI 模型,无需重新连接 MCP。
在 TypingMind 聊天中使用已启用的 MCP 工具和选定的 AI 模型
您能使用 Daem0nMCP 帮我完成这项任务吗?
Daem0nMCP
当然,我看过了。
以下是我使用 Daem0nMCP 得到的结果。

常见问题

Daem0nMCP MCP 服务器有什么用途?

Daem0nMCP 是一个 MCP 服务器,可让兼容的 AI 客户端连接外部工具并获取上下文。在 TypingMind 中,只需添加一次此 MCP 服务器,即可在您的 AI 工作区中使用其工具。

可以在 TypingMind 中让多个 AI 模型使用 Daem0nMCP MCP 吗?

可以。TypingMind 在工作区层面连接 MCP 工具,因此您无需为每个模型单独配置 MCP 服务器,就能在 Claude、ChatGPT、Gemini 或您在 TypingMind 中配置的其他 AI 模型中使用 Daem0nMCP。

为什么在 TypingMind 中使用 Daem0nMCP MCP?

TypingMind 将多个 AI 模型、提示词、插件、AI 智能体、API 密钥和 MCP 工具整合到同一个工作区中,是最出色的大语言模型聊天前端之一。连接 Daem0nMCP 后,您可以在偏好的不同模型中使用其 MCP 工具,同时在 TypingMind 中井然有序地管理聊天工作流程。

如何将 Daem0nMCP MCP 连接到 TypingMind?

Daem0nMCP 通过 TypingMind 本地 MCP 连接器运行。当 MCP 服务器需要访问您计算机上的本地文件、桌面应用、命令行工具或私有资源时,这种方式最合适。

Daem0nMCP MCP 在 TypingMind 中提供哪些工具?

Daem0nMCP 提供 MCP 功能,您可以在 TypingMind 的插件页面启用这些功能,然后在聊天中使用,或将其分配给 AI 智能体。

使用 Daem0nMCP MCP 需要向 TypingMind 提供我的 API 密钥吗?

不需要。TypingMind 采用本地优先的设计,让您自行选择模型提供商,并自行管理 API 密钥、提示词和 MCP 配置。如果 Daem0nMCP 需要身份验证,请在创建连接时,为该 MCP 服务器添加所需的请求头、OAuth 设置或本地配置。

相关 MCP 服务器

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇