retrieval augmented thinking

Local 2025-08-31 23:15:50 0

Enhances AI model capabilities with structured, retrieval-augmented thinking processes that enable dynamic thought chains, parallel exploration paths, and recursive refinement cycles for improved reasoning.


An MCP (Model Context Protocol) server implementation that enhances AI model capabilities with structured, retrieval-augmented thinking processes. This server enables dynamic thought chains, parallel exploration paths, and recursive refinement cycles for improved reasoning and problem-solving.

Features

  • Adaptive Thought Chains: Maintains coherent reasoning flows with branching and revision capabilities
  • Iterative Hypothesis Generation: Implements validation cycles for hypothesis testing
  • Context Coherence: Preserves context across non-linear reasoning paths
  • Dynamic Scope Adjustment: Supports flexible exploration and refinement
  • Quality Assessment: Real-time evaluation of thought processes
  • Branch Management: Handles parallel exploration paths
  • Revision Tracking: Manages recursive refinement cycles

Installation

npm install @modelcontextprotocol/server-retrieval-augmented-thinking

Usage

Command Line

mcp-server-retrieval-augmented-thinking

Programmatic Usage

import { Server } from '@modelcontextprotocol/sdk/server';
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio';

// Initialize and run the server
const server = new Server({
  name: 'retrieval-augmented-thinking',
  version: '0.1.0'
});

// Connect transport
const transport = new StdioServerTransport();
await server.connect(transport);

Tool Configuration

The server provides a tool with the following parameters:

  • thought (string): Current reasoning step
  • thoughtNumber (number): Position in reasoning chain
  • totalThoughts (number): Estimated scope
  • nextThoughtNeeded (boolean): Chain continuation signal
  • isRevision (boolean, optional): Marks refinement steps
  • revisesThought (number, optional): References target thought
  • branchFromThought (number, optional): Branch origin point
  • branchId (string, optional): Branch identifier
  • needsMoreThoughts (boolean, optional): Scope expansion signal

Advanced Features

Thought Chain Analytics

The server tracks various metrics for thought chain quality:

  • Chain effectiveness
  • Revision impact
  • Branch success rate
  • Overall quality
  • Individual thought metrics (complexity, depth, quality, impact)

Pattern Recognition

Analyzes thought patterns for:

  • Reasoning structures
  • Context preservation
  • Hypothesis validation
  • Solution coherence

Development

# Build
npm run build

# Watch mode
npm run watch

Contributing

Contributions welcome! Please read our contributing guidelines and submit pull requests.

License

MIT

[
  {
    "description": "A context-aware reasoning system that orchestrates structured thought processes through dynamic trajectories.nnCore Capabilities:n- Maintains adaptive thought chains with branching and revision capabilitiesn- Implements iterative hypothesis generation and validation cyclesn- Preserves context coherence across non-linear reasoning pathsn- Supports dynamic scope adjustment and trajectory refinementnnReasoning Patterns:n- Sequential analysis with backtracking capabilityn- Parallel exploration through managed branch contextsn- Recursive refinement via structured revision cyclesn- Hypothesis validation through multi-step verificationnnParameters:nthought: Structured reasoning step that supports:n• Primary analysis chainsn• Hypothesis formulation/validationn• Branch exploration pathsn• Revision proposalsn• Context preservation markersn• Verification checkpointsnnnext_thought_needed: Signal for continuation of reasoning chainnthought_number: Position in current reasoning trajectoryntotal_thoughts: Dynamic scope indicator (adjustable)nis_revision: Marks recursive refinement stepsnrevises_thought: References target of refinementnbranch_from_thought: Indicates parallel exploration pathsnbranch_id: Context identifier for parallel chainsnneeds_more_thoughts: Signals scope expansion requirementnnExecution Protocol:n1. Initialize with scope estimationn2. Generate structured reasoning stepsn3. Validate hypotheses through verification cyclesn4. Maintain context coherence across branchesn5. Implement revisions through recursive refinementn6. Signal completion on validation successnnThe system maintains solution integrity through continuous validation cycles while supporting dynamic scope adjustment and non-linear exploration paths.",
    "displayName": "rat",
    "inputSchema": {
      "properties": {
        "branchFromThought": {
          "description": "Branching point thought number",
          "minimum": 1,
          "type": "integer"
        },
        "branchId": {
          "description": "Branch identifier",
          "type": "string"
        },
        "isRevision": {
          "description": "Whether this revises previous thinking",
          "type": "boolean"
        },
        "needsMoreThoughts": {
          "description": "If more thoughts are needed",
          "type": "boolean"
        },
        "nextThoughtNeeded": {
          "description": "Whether another thought step is needed",
          "type": "boolean"
        },
        "revisesThought": {
          "description": "Which thought is being reconsidered",
          "minimum": 1,
          "type": "integer"
        },
        "thought": {
          "description": "Your current thinking step",
          "type": "string"
        },
        "thoughtNumber": {
          "description": "Current thought number",
          "minimum": 1,
          "type": "integer"
        },
        "totalThoughts": {
          "description": "Estimated total thoughts needed",
          "minimum": 1,
          "type": "integer"
        }
      },
      "required": [
        "thought",
        "nextThoughtNeeded",
        "thoughtNumber",
        "totalThoughts"
      ],
      "type": "object"
    },
    "name": "rat"
  }
]