This is a COMPLETE REWRITE - not a refactor. We're gutting the over-engineered current system and replacing it with a clean, tool-first architecture.
# Complex orchestration (616 lines → DELETE)
rm src/Intentive.Core/Plugins/IntentiveOrchestrationPlugin.cs
# Unused LLM-first (223 lines → DELETE)
rm src/Intentive.Core/Plugins/LLMFirstOrchestrationPlugin.cs
# Complex model classes → DELETE ALL
rm src/Intentive.Core/Models/Plan.cs
rm src/Intentive.Core/Models/PlanStep.cs
rm src/Intentive.Core/Models/ValidationResult.cs
rm src/Intentive.Core/Models/QualityIndicators.cs
# Keep OrchestrationResult.cs but simplify it- ❌ Multi-step plan generation and validation
- ❌ Quality indicators and response refinement
- ❌ Complex execution path tracking
- ❌ Plan repair and LLM escalation loops
- ❌ JSON parsing for plan steps
- ❌ Generic/vague intent detection
- ❌ The entire "CheapLMProbe → PlanValidator → ToolExecution → QualityEscalation" chain
- ✅
GetOrderTool.cs(example local tool) - ✅
OrchestrationConfig.cs(extend for tools) - ✅
SimpleIntentClassifier.cs(gut and rebuild) - ✅ Rule Gate concept (simplify to 5 lines)
STARTUP:
1. Load tools.json config
2. Discover local tools ([KernelFunction] methods)
3. Connect to MCP Docker servers
4. Generate intent training examples from ALL tools
5. Train/load ONNX classifier
6. Display: "🤖 Here's what I can do: weather, time, math, orders"
RUNTIME:
User Input → Rule Gate → ONNX Classification → {
HIGH CONFIDENCE + Tool Available: Execute Tool Directly (5-10ms)
LOW CONFIDENCE: "I don't have a tool for that, escalating..." → LLM
}
public class SimpleOrchestrationEngine
{
public async Task<string> HandleAsync(string input)
{
// Rule gate (5 lines)
if (input.ToLower() is "hi" or "hello")
return "Hello! Ask me about weather, time, math, or orders.";
// ONNX classification (1 line)
var tool = await _classifier.FindToolForAsync(input);
// Execute or escalate (3 lines)
return tool != null
? await _toolRegistry.ExecuteAsync(tool, input)
: await _llm.RespondAsync($"I don't have a tool for: {input}");
}
}File: tools.json
{
"mcpServers": [
{
"name": "weather-server",
"enabled": true,
"transport": {
"type": "stdio",
"command": "docker",
"args": ["run", "--rm", "-i", "mcp/weather-server"]
},
"capabilities": ["weather", "forecast", "temperature"]
},
{
"name": "time-server",
"enabled": true,
"transport": {
"type": "stdio",
"command": "docker",
"args": ["run", "--rm", "-i", "mcp/time-server"]
},
"capabilities": ["current_time", "date", "timezone"]
},
{
"name": "calculator-server",
"enabled": true,
"transport": {
"type": "stdio",
"command": "docker",
"args": ["run", "--rm", "-i", "mcp/calculator-server"]
},
"capabilities": ["calculate", "math", "arithmetic"]
}
],
"localTools": [
{
"name": "GetOrder",
"enabled": true,
"class": "Intentive.Core.Tools.GetOrderTool",
"capabilities": ["order", "status", "track"]
}
]
}File: src/Intentive.Core/Services/ToolRegistry.cs
- Discover local tools via reflection ([KernelFunction] attributes)
- Connect to MCP Docker servers via stdio
- Maintain unified tool catalog with capabilities
- Health check MCP servers at startup
File: src/Intentive.Core/Services/IntentGenerator.cs
Binary Command: ./intentive --train-tools
Self-Configuring Training Pipeline:
- Read tools.json (no hardcoded capabilities)
- Connect to ALL MCP servers listed in config
- Auto-discover actual capabilities via MCP
list_toolsprotocol - Generate training examples (200-500 per discovered tool):
- Weather server discovers: ["get_weather", "get_forecast"] → generates "weather in NYC", "forecast for tomorrow"
- Calculator discovers: ["calculate", "solve"] → generates "calculate 15 * 23", "what's 100 + 50"
- Time server discovers: ["current_time", "get_date"] → generates "what time is it?", "today's date"
- Local GetOrder: ["GetOrderAsync"] → generates "order status 12345", "track order"
- Train ONNX model with generated data (2-5 minutes)
- Replace existing model with trained version
- System ready - now accurately classifies user input to discovered tools
Key Benefits:
- Zero code changes when adding new MCP servers - just edit tools.json
- Self-discovery - system learns actual capabilities from MCP servers
- Accurate classification - trained model vs pattern matching
- Simple workflow - one command retrains everything
File: src/Intentive.Core/Services/SimpleIntentClassifier.cs (REWRITE)
- Remove hardcoded patterns
- Work with tool-generated training data
- Return tool name + confidence (not complex classification result)
- Simple interface:
Task<(string? ToolName, double Confidence)> FindToolForAsync(string input)
File: src/Intentive.Core/Services/SimpleOrchestrationEngine.cs (NEW)
- Replace IntentiveOrchestrationPlugin entirely
- Clean 3-step process: Rule Gate → Classification → Execute/Escalate
- ~50 lines total vs 616 lines current
File: src/Intentive.Core/Services/McpClient.cs
- Communicate with Docker MCP servers via stdio
- Handle tool discovery and execution
- Manage process lifecycle (docker run --rm -i)
File: src/Intentive.Console/Program.cs
- Initialize ToolRegistry on startup
- Display available capabilities to user
- Show "Here's what I can do" message
- 616 lines of orchestration complexity
- Plan generation → validation → execution → quality checking → refinement
- Multiple LLM calls for simple requests
- Unclear what the system can actually do
- ~50 lines of orchestration
- Direct tool execution for supported requests
- Single LLM call only for unsupported requests
- Clear "I can do X, Y, Z" startup message
🚀 Starting Intentive...
✅ Local tools: GetOrder
✅ MCP weather-server: weather, forecast
✅ MCP time-server: current_time, date
✅ MCP calculator: math, calculate
🤖 Ready! I can help with: weather, time, calculations, orders
> What's the weather in Paris?
🌤️ Paris: 18°C, partly cloudy, humidity 65%
⚡ Executed: weather-server (45ms)
> What's today's date?
📅 Today is Friday, January 27, 2025
⚡ Executed: time-server (32ms)
> How do I cook pasta?
🤔 I don't have a tool for cooking, escalating to AI...
🤖 Here's how to cook pasta... (LLM response)
⚡ Executed: LLM escalation (850ms)
- Task 1 - Create tools.json config (foundation)
- Task 2 - Build ToolRegistry (core infrastructure)
- Task 6 - Add MCP client (enables MCP servers)
- Task 3 - Generate training data (enables ONNX)
- Task 4 - Rewrite ONNX classifier (enables classification)
- Task 5 - Create simple orchestration (ties it together)
- Task 7 - Update startup (user experience)
Status: Ready for implementation ⚡
- Code reduction: ~90% less orchestration code
- Performance: 10x faster for supported tools (5-10ms vs 200-800ms)
- Clarity: Users know exactly what system can do
- Maintainability: Simple, understandable architecture
- Extensibility: Just add tools to JSON config