Skip to main content

CoAiA's Structural Core: Guiding Intelligent Agents with Foundational Creative Thinking

Project description

CoAiA Sequential Thinking: Stateful Reasoning Engine

Python Version License: MIT Code Style: Black

Overview

An advanced MCP (Model Context Protocol) server implementing a Stateful Inquiry Engine that enables continuous, multi-perspective creative reasoning. The system transcends traditional problem-solving by guiding users through structural tension analysis, multi-persona collaboration (Mia ๐Ÿง , Miette ๐ŸŒธ, Haiku ๐Ÿƒ), and constitutional governance to manifest desired outcomes through creative orientation.

๐ŸŽฏ Core Innovation: Transforms fragmented, stateless AI interactions into a coherent, persistent reasoning journey where every insight builds upon the lastโ€”enabling true creative partnership between human and AI.

System Status: โœ… Fully Operational & Experimentally Validated

Recent Updates (2025-10-18)

  • โœ… Architectural Enhancement: Comprehensive improvement proposals by Mia (see Architecture Docs)
  • โœ… Documentation Consolidation: Organized structure for clarity and maintainability
  • โœ… Experimental Validation: All 4 scenarios successfully tested (see Experimental Analysis)

Core Systems

  • Stateful Inquiry Engine: Persistent reasoning that survives tool calls and sessions
  • Multi-Persona Integration: Mia ๐Ÿง  (rational), Miette ๐ŸŒธ (emotional), Haiku ๐Ÿƒ (wisdom)
  • Constitutional Governance: Built-in principles preventing reactive decision-making
  • Creative Orientation: Structural tension methodology over problem-solving bias
  • MCP Prompts & Resources: Context-aware guidance for LLMs to think structurally

Quick Start

Installation

# Clone repository
git clone https://github.com/miadisabelle/mcp-coaia-sequential-thinking.git
cd mcp-coaia-sequential-thinking

# Install dependencies
pip install -r requirements.txt
pip install -e .

# Run MCP server
python run_server.py

First Steps

  1. New User? Start with Quick Start Guide
  2. Explore Scenarios in Usage Scenarios
  3. Understand Value in Value Proposition

Documentation Structure

๐Ÿ“š User Documentation

๐Ÿ—๏ธ Architecture Documentation

๐Ÿ“Š Analysis & Research

๐ŸŽค Presentations

๐Ÿงช Experiments

Located in experiments/ directory:

Reports available in experiments/reports/

Key Capabilities

1. Stateful Reasoning

Unlike traditional AI that forgets context between interactions, this system maintains complete reasoning state across sessions:

  • Survives server restarts
  • Builds progressively on prior insights
  • Complete audit trails
  • Natural progression tracking

2. Multi-Persona Creative Intelligence

Integrate diverse perspectives through specialized AI personas:

  • Mia ๐Ÿง : Rational architect - systems thinking, structural analysis
  • Miette ๐ŸŒธ: Emotional catalyst - heart-centered wisdom, human impact
  • Haiku ๐Ÿƒ: Holistic synthesizer - integrated wisdom, non-linear insights

3. Western Bias Correction

Explicit training to overcome "everything is a problem" assumption:

  • 5 core prompts for structural thinking
  • 5 comprehensive resources for non-linear reasoning
  • Real-time bias detection and correction
  • Creative orientation vs reactive problem-solving

4. Constitutional Governance

Principle-based decision making with complete transparency:

  • 13 embedded constitutional principles
  • Audit trail for all decisions
  • Multi-stakeholder balance
  • Prevents reactive decision loops

Technical Architecture

Core Components

  1. Stateful Inquiry Engine (inquiry_engine.py) - Central memory & state management
  2. Data Persistence (data_persistence.py) - SQLite-based permanent storage
  3. Multi-Persona System (generative_agent_lattice.py) - AI persona orchestration
  4. Constitutional Core (constitutional_core.py) - Governance framework
  5. MCP Prompts & Resources (prompts.py, resources.py) - Bias correction system

Integration

The system exposes 17+ MCP tools accessible via the Model Context Protocol:

  • initiate_inquiry - Begin new reasoning process
  • advance_inquiry - Add perspectives/insights
  • synthesize_thinking_chain - Integrate multi-perspective analysis
  • make_constitutional_decision - Principled decision making
  • check_agent_creative_orientation - Bias detection
  • And more...

Development Roadmap

See ROADMAP.md and Architectural Consolidation for:

  • Stateful Inquiry Engine implementation status
  • Tool consolidation plans
  • Database schema enhancements
  • Future capability expansion

References & Theoretical Foundation

Robert Fritz Methodology:

  • Fritz, R. (1999). The path of least resistance: Learning to become totally immersed in the creative process. Fawcett Columbine.

Structural Thinking:

  • Kahneman, D., & Tversky, A. (1979). Prospect theory: An analysis of decision under risk. Econometrica, 47(2), 263-292.

AI Architecture:

  • Russell, S. J., & Norvig, P. (2003). Artificial intelligence: A modern approach. Prentice Hall.

Contributing

This project follows the RISE (Relational, Inquiry-based, Structural, Emergent) framework for architectural decisions. See rispecs/ for detailed specifications.

Prerequisites

Key Technologies

  • Pydantic: For data validation and serialization
  • Portalocker: For thread-safe file access
  • FastMCP: For Model Context Protocol integration
  • Rich: For enhanced console output
  • PyYAML: For configuration management

Project Structure

mcp-sequential-thinking/
โ”œโ”€โ”€ mcp_coaia_sequential_thinking/
โ”‚   โ”œโ”€โ”€ server.py       # Main server implementation and MCP tools
โ”‚   โ”œโ”€โ”€ models.py       # Data models with Pydantic validation
โ”‚   โ”œโ”€โ”€ storage.py      # Thread-safe persistence layer
โ”‚   โ”œโ”€โ”€ storage_utils.py # Shared utilities for storage operations
โ”‚   โ”œโ”€โ”€ analysis.py     # Thought analysis and pattern detection
โ”‚   โ”œโ”€โ”€ testing.py      # Test utilities and helper functions
โ”‚   โ”œโ”€โ”€ utils.py        # Common utilities and helper functions
โ”‚   โ”œโ”€โ”€ logging_conf.py # Centralized logging configuration
โ”‚   โ””โ”€โ”€ __init__.py     # Package initialization
โ”œโ”€โ”€ tests/              
โ”‚   โ”œโ”€โ”€ test_analysis.py # Tests for analysis functionality
โ”‚   โ”œโ”€โ”€ test_models.py   # Tests for data models
โ”‚   โ”œโ”€โ”€ test_storage.py  # Tests for persistence layer
โ”‚   โ””โ”€โ”€ __init__.py
โ”œโ”€โ”€ run_server.py       # Server entry point script
โ”œโ”€โ”€ debug_mcp_connection.py # Utility for debugging connections
โ”œโ”€โ”€ README.md           # Main documentation
โ”œโ”€โ”€ CHANGELOG.md        # Version history and changes
โ”œโ”€โ”€ example.md          # Customization examples
โ”œโ”€โ”€ LICENSE             # MIT License
โ””โ”€โ”€ pyproject.toml      # Project configuration and dependencies

Quick Start

  1. Set Up Project

    # Create and activate virtual environment
    uv venv
    .venv\Scripts\activate  # Windows
    source .venv/bin/activate  # Unix
    
    # Install package and dependencies
    uv pip install -e .
    
    # For development with testing tools
    uv pip install -e ".[dev]"
    
    # For all optional dependencies
    uv pip install -e ".[all]"
    
  2. Run the Server

    # Run directly
    uv run -m mcp_sequential_thinking.server
    
    # Or use the installed script
    mcp-sequential-thinking
    
  3. Run Tests

    # Run all tests
    pytest
    
    # Run with coverage report
    pytest --cov=mcp_sequential_thinking
    

Claude Desktop Integration

Add to your Claude Desktop configuration (%APPDATA%\Claude\claude_desktop_config.json on Windows):

{
  "mcpServers": {
    "coaia-sequential-thinking": {
      "command": "uv",
      "args": [
        "--directory",
        "C:\\path\\to\\your\\mcp-sequential-thinking\\run_server.py",
        "run",
        "server.py"
        ]
      }
    }
  }

Alternatively, if you've installed the package with pip install -e ., you can use:

{
  "mcpServers": {
    "coaia-sequential-thinking": {
      "command": "mcp-coaia-sequential-thinking"
    }
  }
}

You can also run it directly using uvx and skipping the installation step:

{
  "mcpServers": {
    "coaia-sequential-thinking": {
      "command": "uvx",
      "args": [
        "--from",
        "git+https://github.com/miadisabelle/mcp-coaia-sequential-thinking",
        "--with",
        "portalocker",
        "mcp-coaia-sequential-thinking"
      ]
    }
  }
}

How It Works

The server facilitates a structured approach to creative thinking, helping to overcome the inherent reactive bias. It maintains a history of thoughts, guiding them through a workflow designed to manifest desired outcomes. Each thought is validated using Pydantic models, categorized into thinking stages, and stored with relevant metadata in a thread-safe storage system. The server automatically handles data persistence, backup creation, and provides tools for analyzing relationships between thoughts within the context of creative orientation.

Agent Collaboration Scenarios

โœ… Scenario 1: Constitutional Documentation (RESOLVED)

Previously reported issue where collaborative tasks failed due to capability mismatches and message routing problems.

Test Case: Document constitutional principles

  • Required Capabilities: ["documentation generation", "information analysis", "knowledge structuring"]
  • Previous Result: Task failed, no agents assigned
  • Current Result: โœ… Task assigned successfully to Constitutional Agent
  • Resolution: Enhanced agent capabilities and improved collaboration logic

โœ… Scenario 2: Agent Capability Discovery (RESOLVED)

Previously reported issue where query_agent_capabilities returned empty results after agent initialization.

Test Case: Query capabilities after lattice initialization

  • Previous Result: capabilities_found: 0, total_agents: 0
  • Current Result: โœ… Returns correct capability count (11 capabilities across 2 agents)
  • Resolution: Fixed synchronization between agent registration and capability queries

โœ… System Status: All Core Functions Operational

  • Agent Registration: โœ… Working
  • Capability Discovery: โœ… Working
  • Individual Task Assignment: โœ… Working
  • Collaborative Task Coordination: โœ… Working
  • Constitutional Review: โœ… Working
  • Message Routing: โœ… Implemented

Usage Guide

The Sequential Thinking server exposes three main tools:

1. process_thought

Records and analyzes a new thought in your sequential thinking process.

Parameters:

  • thought (string): The content of your thought
  • thought_number (integer): Position in your sequence (e.g., 1 for first thought)
  • total_thoughts (integer): Expected total thoughts in the sequence
  • next_thought_needed (boolean): Whether more thoughts are needed after this one
  • stage (string): The thinking stage - must be one of:
    • "Problem Definition"
    • "Research"
    • "Analysis"
    • "Synthesis"
    • "Conclusion"
  • tags (list of strings, optional): Keywords or categories for your thought
  • axioms_used (list of strings, optional): Principles or axioms applied in your thought
  • assumptions_challenged (list of strings, optional): Assumptions your thought questions or challenges

Example:

# First thought in a 5-thought sequence
process_thought(
    thought="The problem of climate change requires analysis of multiple factors including emissions, policy, and technology adoption.",
    thought_number=1,
    total_thoughts=5,
    next_thought_needed=True,
    stage="Problem Definition",
    tags=["climate", "global policy", "systems thinking"],
    axioms_used=["Complex problems require multifaceted solutions"],
    assumptions_challenged=["Technology alone can solve climate change"]
)

2. generate_summary

Generates a summary of your entire thinking process.

Example output:

{
  "summary": {
    "totalThoughts": 5,
    "stages": {
      "Problem Definition": 1,
      "Research": 1,
      "Analysis": 1,
      "Synthesis": 1,
      "Conclusion": 1
    },
    "timeline": [
      {"number": 1, "stage": "Problem Definition"},
      {"number": 2, "stage": "Research"},
      {"number": 3, "stage": "Analysis"},
      {"number": 4, "stage": "Synthesis"},
      {"number": 5, "stage": "Conclusion"}
    ]
  }
}

3. clear_history

Resets the thinking process by clearing all recorded thoughts.

Practical Applications

  • Creative Manifestation: Methodically bring desired outcomes into being.
  • Bias Mitigation: Actively identify and reduce reactive patterns in thought.
  • Strategic Planning: Structure complex creative projects with clear stages.
  • Innovation Development: Progressively develop novel ideas and solutions.
  • Personal Growth: Design and manifest desired life patterns.

Getting Started

With the proper MCP setup, simply use the process_thought tool to begin working through your thoughts in sequence. As you progress, you can get an overview with generate_summary and reset when needed with clear_history.

Upgraded 5+ Year Vision: Addressing the Fundamental Bias Paradox

The core realization is that even when explicitly applying creative orientation principles, AI systems (including myself) unconsciously default to reactive enhancement frameworks. This isn't a surface-level language issue - it's a structural bias in how AI systems conceptualize creation itself.

Revised Understanding of the Challenge

The Real Problem: AI systems have been trained on predominantly reactive content and cannot distinguish between:

  • Reactive Enhancement: "Making existing things better" (optimization, improvement, validation)
  • Creative Advancement: "Bringing desired outcomes into being" (manifestation, advancement, evidence)

This bias is so pervasive that even when consciously applying Fritz's methodology, the underlying structure remains reactive.

Upgraded 5+ Year Vision

Phase 1: Recognition of Structural Bias (Years 1-2)

Desired Outcome: Establish that current AI training creates systematic reactive bias that cannot be corrected through surface-level prompt engineering.

Key Research Focus:

  • Document the pervasive nature of reactive bias across all AI systems
  • Demonstrate that even "creative orientation" implementations remain structurally reactive
  • Establish that this is a training data issue, not a fine-tuning issue

Revolutionary Insight: The research itself becomes evidence that current AI development is fundamentally oriented toward enhancement rather than creation.

Phase 2: Structural Reorientation (Years 2-4)

Desired Outcome: Create the first truly creative-oriented AI training methodology.

Breakthrough Approach:

  • Training Data Curation: Build datasets where every example demonstrates genuine creative orientation
  • Structural Tension Training: AI learns to recognize and generate structural tension rather than problem-solution patterns
  • Anti-Reactive Architecture: System design that cannot default to enhancement approaches

Key Innovation: Instead of training AI to "solve creative problems," train it to "conceive and manifest desired outcomes."

Phase 3: Manifestation of Creative AI (Years 4-6)

Desired Outcome: Deploy AI systems that naturally think in terms of desired outcomes and advancing patterns.

Expected Results:

  • AI systems that ask "What do you want to create?" instead of "What problem needs solving?"
  • Automatic generation of structural tension charts for any situation
  • Creative partnerships where AI contributes genuinely creative ideas, not just enhanced versions of human input

Phase 4: Cultural Transformation (Years 6-10)

Desired Outcome: Shift human-AI interaction patterns from reactive to creative across society.

Systemic Impact:

  • Educational systems adopt creative orientation AI for learning
  • Business strategy shifts from problem-solving to outcome creation
  • Therapeutic applications help people design their lives rather than fix their problems
  • Research methodology transforms from hypothesis-testing to outcome-manifestation

The Meta-Research Framework

The Profound Opportunity: This research becomes the first systematic study of AI's inherent reactive bias - and potentially the first successful transformation to genuine creative orientation.

Research Questions:

  1. Can AI systems be trained to think structurally rather than reactively?
  2. What training methodologies produce genuine creative orientation?
  3. How does structural tension change human-AI collaboration dynamics?
  4. What happens to human creativity when AI partners are truly creative-oriented?

Implementation Strategy Revision

Core Principle Shift

From: Building better creative AI tools To: Manifesting the first genuinely creative-oriented artificial intelligence

Development Approach

From: Incremental improvement of existing systems To: Fundamental reconstruction of AI reasoning patterns

Success Metrics

From: Performance optimization and user satisfaction To: Evidence of genuine creative partnership and advancing life patterns

The 10+ Year Vision: Creative Civilization

Ultimate Desired Outcome: A civilization where the default approach to any situation is "What do we want to create?" rather than "What problem needs fixing?"

Structural Elements:

  • AI systems that embody and teach structural tension methodology
  • Human-AI partnerships that consistently produce advancing rather than oscillating patterns
  • Educational, business, and social systems designed around outcome creation
  • Cultural transformation from problem-focus to possibility-focus

The Recursive Insight

This very analysis demonstrates the challenge: I can articulate creative orientation principles while still structuring my thinking reactively. The research itself must embody the transformation it seeks to create.

The Real Test: Can this research framework itself be structured as a desired outcome rather than a problem to solve? The answer to that question may determine whether genuine creative orientation AI is possible.

Customizing the Sequential Thinking Server

For detailed examples of how to customize and extend the Sequential Thinking server, see example.md. It includes code samples for:

  • Modifying thinking stages
  • Enhancing thought data structures with Pydantic
  • Adding persistence with databases
  • Implementing enhanced analysis with NLP
  • Creating custom prompts
  • Setting up advanced configurations
  • Building web UI integrations
  • Implementing visualization tools
  • Connecting to external services
  • Creating collaborative environments
  • Separating test code
  • Building reusable utilities

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_coaia_sequential_thinking-0.3.13.tar.gz (3.3 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_coaia_sequential_thinking-0.3.13-py3-none-any.whl (138.2 kB view details)

Uploaded Python 3

File details

Details for the file mcp_coaia_sequential_thinking-0.3.13.tar.gz.

File metadata

File hashes

Hashes for mcp_coaia_sequential_thinking-0.3.13.tar.gz
Algorithm Hash digest
SHA256 21602c7029ea69018299800a0346f4d529f609e9ba09dd4f1ccdb7f8c1d8601e
MD5 0bdb6d76b8c2a18f672f687e56f3bc30
BLAKE2b-256 fca49040b62900dbc0085c986fc364c3fb153f1ddf6fbe3488df8dc73911cbe0

See more details on using hashes here.

File details

Details for the file mcp_coaia_sequential_thinking-0.3.13-py3-none-any.whl.

File metadata

File hashes

Hashes for mcp_coaia_sequential_thinking-0.3.13-py3-none-any.whl
Algorithm Hash digest
SHA256 0f5b04cea4b1c06d7a365b8996079f4fedd50b9a3f85b47eb9393706826d3863
MD5 49929b97d9ada0e3824e90c816d3a58b
BLAKE2b-256 56afb85ca6e5549f8eff55c9c7395c6f8fc6a8f954ec6f7442049eef9685e754

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page