You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Built a mature search and retrieval soln. Enabled tool-based usage via MCP server. Introduced AI models - Devstral 2 and Gemini for natural language interactions, VoyageAI for embedding and reranking.
Provide a robust, configurable interface to external LLMs with failover, rate limiting, and multi-provider support.
559
+
560
+
### **Responsibilities**
561
+
562
+
* **Configuration**: Load model priorities and settings from `aimodels.yaml` or `knowcode.yaml`.
563
+
* **Model Selection**: Iterate through prioritized models.
564
+
* **Failover**: Automatically retry with the next model on `429 ResourceExhausted` errors.
565
+
* **Rate Limiting (New)**: Persistently track RPM (Requests Per Minute) and RPD (Requests Per Day) limit usage locally in `~/.knowcode/usage_stats.json` to avoid API bans.
* **OpenAI/OpenRouter**: Generic `openai` client support (e.g. Mistral via OpenRouter).
569
+
* **Reasoning Loop (ReAct)**: Dynamic capability to call tools (`list_files`, `find_references`, `search_history`) to disambiguate queries or explore before answering.
570
+
* **Temporal Integration**: Query `TemporalAnalyzer` to answer "why" and "when" questions based on git history.
571
+
* **Structured Output**: Support JSON/YAML schemas for automation tasks.
572
+
* **Task-Aware Context**: Dynamically adjust context prioritization (debug vs. explain) based on user intent.
573
+
574
+
### **Inputs**
575
+
576
+
* `aimodels.yaml` configuration
577
+
* User query
578
+
* Retrieved context bundle
579
+
580
+
### **Outputs**
581
+
582
+
* LLM Answer
583
+
* Updated usage statistics
584
+
585
+
### **Downstream Consumers**
586
+
587
+
* `knowcode ask` command
588
+
* External IDE agents via MCP (Layer 10b)
589
+
590
+
---
591
+
592
+
## **10b. [NEW] Tool Exposure Layer (MCP)**
593
+
594
+
### **Purpose**
595
+
596
+
Expose KnowCode's intelligence capabilities as **callable tools** for external AI agents (e.g., IDE-integrated agents like Google's Antigravity) via the Model Context Protocol (MCP).
597
+
598
+
### **Responsibilities**
599
+
600
+
* **MCP Server**: Run a compliant MCP server discoverable by IDE agents.
5. LLM generates step-by-step explanation with code snippets
888
+
889
+
**Key Capabilities Required**:
890
+
- Query-type detection (Layer 10a)
891
+
- Task-specific templates (Layer 9)
892
+
- Multi-hop call graph traversal (Layer 8)
893
+
- ReAct tool-use for complex queries (Layer 10a)
894
+
895
+
### **Use-Case 2: IDE Agent Integration for Token Efficiency**
896
+
897
+
> When prompting an IDE agent (e.g., Antigravity), it invokes KnowCode tools to retrieve context locally, minimizing expensive external LLM token usage.
898
+
899
+
**Workflow**:
900
+
1. User prompts IDE agent
901
+
2. IDE agent invokes KnowCode tools via MCP
902
+
3. KnowCode returns context with sufficiency score
0 commit comments