The Sequential Thinking MCP enables systematic, verifiable, step-by-step reasoning via an agentic plan-execute-reflect loop, allowing the AI to dynamically correct course.

Domain: wiki.omp.loca.zone | ID: omp-sequential-thinking | Version: 1.0.0

Native OMP extension. Enforces cognitive steps before tool execution via ExtensionAPI. Zero-latency. In-memory state. Active blocking.


๐Ÿ”Œ Architecture Hooks

Replaces stdio MCP:

  • pi.registerFlag: CLI args
  • pi.getFlag: CLI args
  • pi.registerCommand: TUI slash commands
  • pi.registerTool: Native sequential_thinking tool
  • pi.on(context): Injects forcedThoughts instruction
  • pi.on(tool_call): Blocks non-cognitive tools until threshold met
  • pi.on(message_end): Loops prompt if LLM yields early
  • pi.on(turn_start): Counter lifecycle
  • pi.on(tool_execution_end): Counter lifecycle

๐Ÿ“ฆ Layout Deployment

cd ~/.omp/plugins
bun add file:../extensions/sequential-thinking

Manifest:

  • File: package.json
  • Type: module
  • Entry: ./src/index.ts via omp.extensions

๐Ÿ—ƒ๏ธ Parameters / Tool Schema

ParameterTypeDescription
thoughtstringThe actual reasoning text for the current step.
thoughtNumberintegerThe current step number in the thinking sequence.
totalThoughtsintegerThe total estimated thoughts required (dynamic).
nextThoughtNeededbooleanSet to true to continue the loop, or false to output the final response.
isRevisionbooleanIndicates if this step corrects a previous thought.
revisesThoughtintegerThe specific thought number being corrected.
branchFromThoughtintegerThe thought number from which to fork a new reasoning branch.
branchIdstringUnique identifier for the active reasoning branch.
needsMoreThoughtsbooleanRequest to increase totalThoughts when limits are reached.

Example Payload:

{
  "thought": "The database migration failed because of a missing index on the 'users' table. I need to create a branch to test the index creation before altering the production DB.",
  "thoughtNumber": 4,
  "totalThoughts": 6,
  "nextThoughtNeeded": true,
  "branchFromThought": 3,
  "branchId": "test-index-creation"
}

๐Ÿ” Execution Loop

  1. Plan: Initialize sequential_thinking (thoughtNumber: 1, nextThoughtNeeded: true) to define the execution plan.
  2. Execute: Interleave external tool calls (e.g., read, bash).
  3. Reflect: Call sequential_thinking to process tool output.
  4. Terminate: Call sequential_thinking (nextThoughtNeeded: false).
  5. Synthesize: Yield final Markdown output.

๐ŸŽฏ Best Practices & Rules

  1. Interleave Actions: Alternate between thinking steps and tool executions (e.g., Think Read File Think Modify Code).
  2. Structure Phases: Follow sequence: Define Research Analyze Synthesize.
  3. Atomic Steps: Limit to one logical leap per thought. No monolithic dumps.
  4. Pivot Safely: Use isRevision to fix flawed premises immediately. Use branchFromThought to test alternative strategies. Never hallucinate forward.
  5. State Tracking: Define the branch goal in the first thought of a new branch.

Common Pitfalls

  • Monolithic Thoughts: Packing multiple logical phases into a single step. Keep thoughts atomic.
  • Infinite Loops: Setting nextThoughtNeeded: true repeatedly without progression. Revise logic if stuck.
  • Undocumented Branches: Forking paths without clarifying the branch goal in the initial thought of that branch.

๐Ÿ›ก๏ธ Enforcement Sandbox & Controls

  • CLI: omp --seq-thoughts <N> "<prompt>"

  • TUI: /seqthink <N>

  • Context: Injects developer role forcing tool usage.

  • Blocker: Rejects premature tool calls with block reason.

  • Loop: Sends followUp if agent skips thinking.


๐Ÿšฆ When to Use vs. Skip

Use CaseRecommended?Why
Complex Architecture / DB MigrationsYesRequires multi-stage planning and verification.
Deep Debugging / Memory LeaksYesRequires systematic hypothesis testing.
Ambiguous Tasks / RefactoringYesRequires iterative exploration.
Simple Math / FactsNoUnnecessary overhead.
Low-Latency QueriesNoSequential iterations add execution time.
Single-Step Tasks (Summarization)NoNo reasoning depth needed.

๐Ÿงช QA Validation

  1. Deps: Verify omp-sequential-thinking in plugin deps.
  2. CLI: Run omp --help to confirm --seq-thoughts.
  3. Loop: Run omp --seq-thoughts 3 "Calc." and verify 3 sequential thoughts.
  4. Block: Run /seqthink 5 then โ€œRun lsโ€ and verify bash block.