| Crates.io | mindkit |
| lib.rs | mindkit |
| version | 0.1.0 |
| created_at | 2025-08-04 17:40:20.231946+00 |
| updated_at | 2025-08-04 17:40:20.231946+00 |
| description | A generic sequential thinking toolkit for AI reasoning systems |
| homepage | |
| repository | https://github.com/DevOpsDali/mindkit |
| max_upload_size | |
| id | 1780985 |
| size | 68,061 |
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.
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.
Add MindKit to your Cargo.toml:
[dependencies]
mindkit = "0.1.0"
use mindkit::{ThinkInput, process_thinking};
// Create a basic analytical thought
let input = ThinkInput {
thought: "Breaking down this problem into smaller components...".to_string(),
next_thought_needed: true,
thought_number: 1,
total_thoughts: 5,
thought_type: Some("analytical".to_string()),
is_revision: None,
revises_thought: None,
branch_from_thought: None,
branch_id: None,
needs_more_thoughts: None,
custom_lens: None,
confidence: None,
};
let result = process_thinking(input);
println!("{}", result.formatted_output);
// Output: π 1/5 [analytical] | Breaking down this problem into smaller components...
Standard reasoning mode for breaking down problems and exploring ideas.
thought_type: Some("analytical".to_string()) // Icon: π
Actively looks for flaws, assumptions, and potential issues. Automatically adds warnings for detected assumptions, absolute statements, and implicit biases.
thought_type: Some("critical".to_string()) // Icon: π
// Example output: "This will always work [β οΈ ABSOLUTE STATEMENT: Consider edge cases]"
Combines multiple perspectives and ideas into cohesive insights.
thought_type: Some("synthesis".to_string()) // Icon: π
Verifies conclusions and checks reasoning validity.
thought_type: Some("validation".to_string()) // Icon: β
let revision = ThinkInput {
thought: "Actually, I need to reconsider my approach...".to_string(),
next_thought_needed: true,
thought_number: 3,
total_thoughts: 5,
is_revision: Some(true),
revises_thought: Some(2), // Revising thought #2
// ... other fields as None
};
// Output: π 3/5 | Actually, I need to reconsider my approach... βΊ#2
let branch = ThinkInput {
thought: "Alternative approach: what if we tried...".to_string(),
next_thought_needed: true,
thought_number: 4,
total_thoughts: 6,
branch_from_thought: Some(3),
branch_id: Some("alt-1".to_string()),
// ... other fields as None
};
// Output: πΏ 4/6 | Alternative approach: what if we tried... β#3[alt-1]
Apply domain-specific analysis to your thoughts:
let security_lens = ThinkInput {
thought: "Examining the input validation logic...".to_string(),
next_thought_needed: true,
thought_number: 2,
total_thoughts: 4,
custom_lens: Some("security".to_string()),
// ... other fields as None
};
// Output: π― 2/4 πsecurity | Examining the input validation logic... [π SECURITY: Validate and sanitize all inputs]
Supported lenses include:
let confident_thought = ThinkInput {
thought: "Based on the evidence, the solution is clear.".to_string(),
next_thought_needed: false,
thought_number: 5,
total_thoughts: 5,
confidence: Some(0.95),
// ... other fields as None
};
// Output: π 5/5 95% | Based on the evidence, the solution is clear.
use ftl_sdk::{tool, ToolResponse};
use mindkit::{ThinkInput, process_thinking};
#[tool]
fn sequential_thinking(input: ThinkInput) -> ToolResponse {
let result = process_thinking(input);
if result.is_error {
ToolResponse::error(result.formatted_output)
} else {
ToolResponse::text(result.formatted_output)
}
}
The formatted output includes visual indicators for quick understanding:
ThinkInputThe 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) |
ThinkResultThe result of processing a thinking input.
| Field | Type | Description |
|---|---|---|
formatted_output |
String |
The formatted thought with metadata |
is_error |
bool |
Whether an error occurred |
process_thinking(input: ThinkInput) -> ThinkResultMain function that processes a thinking input and returns formatted output.
This project was inspired by @modelcontextprotocol/server-sequential-thinking, extending these concepts into a framework-agnostic Rust library.
Contributions are welcome! Please feel free to submit a Pull Request.
Licensed under the Apache License, Version 2.0.