MindKit π§
A Rust library for structured sequential thinking and reasoning patterns for LLMs. MindKit provides a framework-agnostic implementation for organizing thoughts, tracking reasoning processes, and applying different analytical lenses to problems.
Overview
MindKit allows you to integrate structured, reflective reasoning into any MCP (Model Context Protocol) server or other AI application. It's designed to make thinking processes transparent, traceable, and systematic.
Features
- Multiple Thinking Modes: Analytical, Critical, Synthesis, and Validation
- Revision Tracking: Track when thoughts are revised and what they revise
- Branching Thoughts: Create alternate reasoning paths
- Custom Lenses: Apply domain-specific analysis (e.g., "Rust best practices", "security")
- Confidence Levels: Track reasoning confidence (0.0-1.0)
- Visual Feedback: Intuitive emoji indicators for different thought types
- Dynamic Adjustment: Automatically adjusts total thoughts as reasoning expands
- Framework Agnostic: Use with any MCP server implementation
Installation
Add MindKit to your Cargo.toml:
[]
= "0.1.0"
Quick Start
use ;
// Create a basic analytical thought
let input = ThinkInput ;
let result = process_thinking;
println!;
// Output: π 1/5 [analytical] | Breaking down this problem into smaller components...
Thought Types
Analytical (default)
Standard reasoning mode for breaking down problems and exploring ideas.
thought_type: Some // Icon: π
Critical
Actively looks for flaws, assumptions, and potential issues. Automatically adds warnings for detected assumptions, absolute statements, and implicit biases.
thought_type: Some // Icon: π
// Example output: "This will always work [β οΈ ABSOLUTE STATEMENT: Consider edge cases]"
Synthesis
Combines multiple perspectives and ideas into cohesive insights.
thought_type: Some // Icon: π
Validation
Verifies conclusions and checks reasoning validity.
thought_type: Some // Icon: β
Advanced Features
Revising Previous Thoughts
let revision = ThinkInput ;
// Output: π 3/5 | Actually, I need to reconsider my approach... βΊ#2
Branching Thoughts
let branch = ThinkInput ;
// Output: πΏ 4/6 | Alternative approach: what if we tried... β#3[alt-1]
Custom Analytical Lenses
Apply domain-specific analysis to your thoughts:
let security_lens = ThinkInput ;
// Output: π― 2/4 πsecurity | Examining the input validation logic... [π SECURITY: Validate and sanitize all inputs]
Supported lenses include:
- Rust: Adds reminders about ownership, borrowing, and error handling
- Security: Highlights input validation and authentication concerns
- Performance: Points out algorithmic complexity and memory usage
- Custom: Any other lens applies a generic perspective marker
Confidence Tracking
let confident_thought = ThinkInput ;
// Output: π 5/5 95% | Based on the evidence, the solution is clear.
Integration Examples
With FTL SDK
use ;
use ;
Visual Indicators
The formatted output includes visual indicators for quick understanding:
- π Analytical thinking
- π Critical analysis
- π Synthesis of ideas
- β Validation check
- π Revision of previous thought
- πΏ Branching to alternate path
- π― Custom lens applied
- (+) Expanding beyond initial estimate
- βΊ#N Revising thought number N
- β#N Branching from thought number N
API Reference
Core Types
ThinkInput
The main input structure for the thinking process. All fields except the first four are optional.
| Field | Type | Required | Description |
|---|---|---|---|
thought |
String |
Yes | The current thinking step |
next_thought_needed |
bool |
Yes | Whether more thinking is required |
thought_number |
u32 |
Yes | Current thought number (must be > 0) |
total_thoughts |
u32 |
Yes | Estimated total thoughts (must be > 0) |
thought_type |
Option<String> |
No | Type: analytical, critical, synthesis, or validation |
is_revision |
Option<bool> |
No | Whether this revises a previous thought |
revises_thought |
Option<u32> |
No | Which thought number is being revised |
branch_from_thought |
Option<u32> |
No | Branching point for alternate paths |
branch_id |
Option<String> |
No | Identifier for the branch |
needs_more_thoughts |
Option<bool> |
No | Indicates expansion beyond initial estimate |
custom_lens |
Option<String> |
No | Domain-specific analytical lens |
confidence |
Option<f32> |
No | Confidence level (0.0-1.0) |
ThinkResult
The result of processing a thinking input.
| Field | Type | Description |
|---|---|---|
formatted_output |
String |
The formatted thought with metadata |
is_error |
bool |
Whether an error occurred |
Functions
process_thinking(input: ThinkInput) -> ThinkResult
Main function that processes a thinking input and returns formatted output.
Use Cases
- AI Assistants: Structure reasoning for transparent decision-making
- Problem Solving: Break down complex problems systematically
- Code Review: Apply different analytical lenses to code analysis
- Decision Systems: Track confidence and reasoning paths
- Learning Tools: Make thinking processes visible and traceable
- Debugging: Systematic approach to finding and fixing issues
Inspiration
This project was inspired by @modelcontextprotocol/server-sequential-thinking, extending these concepts into a framework-agnostic Rust library.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
Licensed under the Apache License, Version 2.0.