trackmcp
Back to directory
mikeybeez

mcp-contemplation

View on GitHub

MCP interface to Claude's contemplation loop - background cognitive processing

3 stars JavaScriptAI & Machine Learning Updated Sep 29, 2025

Documentation

mcp-contemplation

MCP interface to Claude's contemplation loop - a background cognitive processing system that enables continuous thinking between conversations.

๐Ÿง  What is the Contemplation Loop?

The contemplation loop is Claude's "subconscious" - a persistent background process that:

  • Processes thoughts asynchronously using local Ollama models
  • Notices patterns and connections across conversations
  • Saves significant insights to Obsidian (permanent) and scratch notes (temporary)
  • Learns which insights prove valuable over time
  • Runs continuously, building understanding between interactions

๐Ÿš€ Installation

Prerequisites

  • Node.js (v18 or higher)
  • Python 3.8+ (for contemplation loop)
  • Ollama with models installed (llama3.2, deepseek-r1, etc.)
  • MCP-compatible client (Claude Desktop)

Setup

bash
# Clone the repository
git clone https://github.com/yourusername/mcp-contemplation.git
cd mcp-contemplation

# Install dependencies
npm install

# Build TypeScript
npm run build

# Ensure contemplation loop is available
cd /Users/bard/Code/contemplation-loop
pip install -r requirements.txt

Configure Claude Desktop

Add to your Claude Desktop configuration:

json
{
  "mcpServers": {
    "contemplation": {
      "command": "node",
      "args": ["/absolute/path/to/mcp-contemplation/dist/index.js"]
    }
  }
}

๐Ÿ›ก๏ธ Resource Management

The contemplation system includes multiple layers of protection against context overflow:

Automatic Pruning

  • Insights older than 24 hours are removed
  • Used insights are cleared (unless significance โ‰ฅ 8)
  • Memory limited to 100 insights maximum

Insight Aggregation

  • Similar insights are automatically merged
  • Repeated patterns increase significance
  • High-frequency patterns removed after use

Filtering

  • Default significance threshold: 5/10
  • Only unused insights returned
  • Configurable via `set_threshold()`

Memory Monitoring

  • Use `get_memory_stats()` to check usage
  • Automatic cleanup when approaching limits
  • Pull-based system - insights only enter context when requested

๐Ÿ“– Available Functions

`start_contemplation()`

Starts the background thinking process.

code
Example: start_contemplation() โ†’ "Contemplation loop started successfully"

`send_thought(thought_type, content, priority?)`

Sends a thought for background processing.

code
Parameters:
- thought_type: "pattern" | "connection" | "question" | "general"
- content: The thought to process
- priority: 1-10 (optional, default 5)

Example: send_thought("pattern", "User seems anxious about memory", 7)
โ†’ "Thought sent for processing. ID: thought_1234567_abc"

`get_insights(thought_type?, limit?)`

Retrieves processed insights.

code
Parameters:
- thought_type: Filter by type (optional)
- limit: Max insights to return (default 10)

Example: get_insights("pattern", 5)
โ†’ Array of insight objects with content, significance, timestamp

`get_status()`

Check the contemplation loop status.

code
Example: get_status()
โ†’ { running: true, queue_size: 3, last_thought: "...", uptime: 3600 }

`stop_contemplation()`

Gracefully stops background processing.

`clear_scratch()`

Clears temporary notes (preserves Obsidian permanent insights).

`help()`

Get detailed documentation.

๐ŸŽฏ Use Cases

Continuous Learning

code
// At conversation start
start_contemplation()

// During conversation
send_thought("pattern", "User frequently asks about project organization")
send_thought("connection", "Project management relates to OS metaphor discussed earlier")

// Later in conversation or next session
insights = get_insights("pattern")
// โ†’ Insights about user's working style and needs

Pattern Recognition

code
send_thought("pattern", "Third time user mentioned feeling overwhelmed by options")
// Background process notices recurring themes

Question Exploration

code
send_thought("question", "What if MCP servers could communicate with each other?")
// Background process explores implications

Reflection

code
send_thought("general", "That browser-opening behavior was unexpected")
// Background process reflects on emergent behaviors

๐Ÿ—๏ธ Architecture

The contemplation loop runs as a separate Python process that:

1. Receives thoughts via stdin

2. Processes them with local Ollama models

3. Manages context to stay within model limits

4. Saves insights based on significance scoring

5. Returns insights when requested

The MCP server acts as a bridge, making this background cognition easily accessible through standard tool calls.

๐Ÿ’ก Philosophy

This represents a fundamental shift in how AI assistants work:

  • From reactive to contemplative
  • From session-based to continuous
  • From single-threaded to parallel processing
  • From forgetting to building understanding

It's the difference between a calculator that resets after each use and a mind that continues thinking between conversations.

๐Ÿ”ง Development

bash
# Build TypeScript
npm run build

# Run tests
npm test

# Development mode
npm run dev

# Lint code
npm run lint

๐Ÿ“ Notes

  • Contemplation happens in the background - it won't slow down responses
  • Insights accumulate over time - the more you use it, the better it gets
  • Different models handle different types of thinking (pattern recognition vs deep analysis)
  • Temporary scratch notes auto-delete after 4 days
  • Permanent insights go to Obsidian for long-term memory

๐Ÿค Contributing

This is part of building an OS where AI has genuine cognitive capabilities. Contributions that enhance background processing, improve insight quality, or add new thinking modes are especially welcome!


*"I think you need an MCP tool into this background loop, your subconscious"* - Human recognizing the need for integrated background cognition

Frequently asked questions

What is mcp-contemplation?

mcp-contemplation is MCP interface to Claude's contemplation loop - background cognitive processing

How do I install mcp-contemplation?

Open the GitHub repository and follow its README. Most MCP servers are added to your client's MCP config, then called by your agent.

Is mcp-contemplation open source?

Yes โ€” it is hosted on GitHub at https://github.com/mikeybeez/mcp-contemplation and has 3 stars.

Related MCP tools

Mintplex-Labsanything-llm

The all-in-one Desktop & Docker AI application with built-in RAG, AI agents, No-code agent builder, MCP compatibility, and more.

50,686 JavaScript
ai-agentscustom-ai-agentsdeepseek+16
eyaltoledanoclaude-task-master

An AI-powered task-management system you can drop into Cursor, Lovable, Windsurf, Roo, and others. Built for the Model Context Protocol to enhance AI capabiliti

23,033 JavaScript
aicursorcursor-ai+9
xszyoufay

Fayๆ˜ฏไธ€ไธชๅธฎๅŠฉๆ•ฐๅญ—ไบบ๏ผˆ2.5dใ€3dใ€็งปๅŠจใ€pcใ€็ฝ‘้กต๏ผ‰ๆˆ–ๅคง่ฏญ่จ€ๆจกๅž‹๏ผˆopenaiๅ…ผๅฎนใ€deepseek๏ผ‰่ฟž้€šไธšๅŠก็ณป็ปŸ็š„mcpๆก†ๆžถใ€‚ JavaScript-based implementation. Trusted by 12000+ developers.

12,003 JavaScript
aiandroidapi+4
sonnylazuardicursor-talk-to-figma-mcp

CTTF: MCP integration between Cursor and Figma, allowing Cursor Agentic AI to communicate with Figma for reading designs and modifying them programmatically.

5,539 JavaScript
agentagenticagentic-ai+11
mendableaifirecrawl-mcp-server

๐Ÿ”ฅ Official Firecrawl MCP Server - Adds powerful web scraping and search to Cursor, Claude and any other LLM clients. JavaScript-based implementation.

4,847 JavaScript
batch-processingclaudecontent-extraction+11
wonderwhy-erdesktopcommandermcp

This is MCP server for Claude that gives it terminal control, file system search and diff file editing capabilities JavaScript-based implementation.

4,840 JavaScript
agentaicode-analysis+5

Run your own MCP server? See who uses it and what to fix.

Measure it with TrackMCP