Skip to content

mogg321/kimi-code-explorer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Kimi Code Explorer - Final Edition

AI-Powered Code Refactoring with Reset Weights & Blueprint Orchestration

Version License


πŸš€ Overview

Kimi Code Explorer is a production-grade VS Code extension that combines cutting-edge AI patterns for intelligent code refactoring:

Feature Description
πŸ” Reset Weights Clean state for every analysis, eliminating context pollution
πŸ“‹ Blueprint Orchestration Multi-agent coordination for large-scale projects
🧠 3-Tier Memory Short-term / Mid-term / Long-term memory management
βœ… Verification Pipeline Syntax, security, and style gates before code changes
πŸ”„ Detach/Reload Context isolation to prevent memory overflow

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                     ORCHESTRATOR AGENT                          β”‚
β”‚              (Blueprint Controller + State Manager)              β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚  Blueprint  β”‚  β”‚  Checklist  β”‚  β”‚    3-Tier Memory        β”‚  β”‚
β”‚  β”‚   Store     β”‚  β”‚   Manager   β”‚  β”‚  (ST/MT/LT + Vectors)   β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                              β”‚
          β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
          β–Ό                   β–Ό                   β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   WORKER 1      β”‚  β”‚   WORKER 2      β”‚  β”‚   WORKER N      β”‚
β”‚                 β”‚  β”‚                 β”‚  β”‚                 β”‚
β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚  β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚  β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚ β”‚ 1. RESET    β”‚ β”‚  β”‚ β”‚ 1. RESET    β”‚ β”‚  β”‚ β”‚ 1. RESET    β”‚ β”‚
β”‚ β”‚ 2. LOAD     β”‚ β”‚  β”‚ β”‚ 2. LOAD     β”‚ β”‚  β”‚ β”‚ 2. LOAD     β”‚ β”‚
β”‚ β”‚ 3. EXECUTE  β”‚ β”‚  β”‚ β”‚ 3. EXECUTE  β”‚ β”‚  β”‚ β”‚ 3. EXECUTE  β”‚ β”‚
β”‚ β”‚ 4. VERIFY   β”‚ β”‚  β”‚ β”‚ 4. VERIFY   β”‚ β”‚  β”‚ β”‚ 4. VERIFY   β”‚ β”‚
β”‚ β”‚ 5. DETACH   β”‚ β”‚  β”‚ β”‚ 5. DETACH   β”‚ β”‚  β”‚ β”‚ 5. DETACH   β”‚ β”‚
β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚  β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚  β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
          β”‚                   β”‚                   β”‚
          β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                              β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                     SHARED ARTIFACTS                            β”‚
β”‚         (Code, Tests, Docs, Verification Results)               β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“¦ Installation

# Clone repository
git clone https://github.com/yourname/kimi-code-explorer.git
cd kimi-code-explorer

# Install dependencies
npm install

# Configure API key
cp .env.example .env
# Edit .env and add KIMI_API_KEY

# Build
npm run build

# Launch in VS Code
press F5

🎯 Usage

Basic Mode

  1. Select code in VS Code
  2. Press Ctrl+Shift+K
  3. View alternatives in Kimi Explorer panel
  4. Click "Apply" to replace code

Blueprint Mode

  1. Create blueprint.yaml in project root
  2. Press Ctrl+Shift+B
  3. Workers process modules in parallel
  4. Each worker detaches after completion

βš™οΈ Configuration

{
  "kimiCodeExplorer.apiKey": "your-api-key",
  "kimiCodeExplorer.model": "moonshot-v1-32k",
  "kimiCodeExplorer.resetWeights": true,
  "kimiCodeExplorer.blueprint.enabled": true,
  "kimiCodeExplorer.memory.fusionWeight": 0.15,
  "kimiCodeExplorer.verification.syntaxCheck": true,
  "kimiCodeExplorer.verification.securityScan": true
}

πŸ“ Project Structure

kimi-code-explorer/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ core/
β”‚   β”‚   β”œβ”€β”€ resetWeights.ts       # Reset Weights implementation
β”‚   β”‚   β”œβ”€β”€ worker.ts             # Worker Agent lifecycle
β”‚   β”‚   β”œβ”€β”€ orchestrator.ts       # Blueprint orchestration
β”‚   β”‚   β”œβ”€β”€ verification.ts       # Quality verification
β”‚   β”‚   β”œβ”€β”€ memoryManager.ts      # 3-Tier memory system
β”‚   β”‚   └── checkpoint.ts         # State persistence
β”‚   β”œβ”€β”€ services/
β”‚   β”‚   β”œβ”€β”€ llmService.ts         # Kimi API integration
β”‚   β”‚   └── blueprintService.ts   # Blueprint parser
β”‚   β”œβ”€β”€ providers/
β”‚   β”‚   └── kimiExplorer.ts       # VS Code sidebar panel
β”‚   └── extension.ts              # Entry point
β”œβ”€β”€ docs/
β”‚   β”œβ”€β”€ ARCHITECTURE.md
β”‚   β”œβ”€β”€ BLUEPRINT.md
β”‚   └── MEMORY_SYSTEM.md
β”œβ”€β”€ examples/
β”‚   └── blueprint.example.yaml
β”œβ”€β”€ AGENTS.md                     # Dynamic agent config
β”œβ”€β”€ package.json
β”œβ”€β”€ tsconfig.json
└── README.md

πŸ” Reset Weights Pattern

Ensures each analysis starts from a clean state:

// Before analysis
const cleanContext = await resetManager.reset({
    reason: 'code_exploration'
});

// Analysis with no historical baggage
const result = await analyze(code, cleanContext);

// After analysis, context is detached
await detachContext();

Benefits:

  • βœ… No context pollution from previous analyses
  • βœ… Consistent results regardless of history
  • βœ… Predictable behavior
  • βœ… Easier debugging

🧠 3-Tier Memory System

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                     3-TIER MEMORY ARCHITECTURE                   β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                  β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  Short-term (Session Cache)                     β”‚
β”‚  β”‚  Ephemeral  β”‚  β€’ Duration: Current session only              β”‚
β”‚  β”‚   Buffer    β”‚  β€’ Fusion Weight: ≀0.15                        β”‚
β”‚  β”‚   (EB)      β”‚  β€’ Auto-clear on reset                         β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜                                                 β”‚
β”‚         β”‚                                                        β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”  Mid-term (Validated Knowledge)                 β”‚
β”‚  β”‚   Working   β”‚  β€’ Duration: 48 hours                          β”‚
β”‚  β”‚   Memory    β”‚  β€’ Fusion Weight: 0.15-0.35                    β”‚
β”‚  β”‚   (WM)      β”‚  β€’ Requires external validation                β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜                                                 β”‚
β”‚         β”‚                                                        β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”  Long-term (Proven Knowledge Base)              β”‚
β”‚  β”‚  Long-term  β”‚  β€’ Duration: Permanent                         β”‚
β”‚  β”‚   Memory    β”‚  β€’ Fusion Weight: 0.35-0.50                    β”‚
β”‚  β”‚   (LTM)     β”‚  β€’ Requires multiple validations               β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                                                 β”‚
β”‚                                                                  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“‹ Blueprint Orchestration

Define project structure and execution order:

# blueprint.yaml
project:
  name: "E-Commerce API"
  version: "1.0.0"

modules:
  - id: "auth"
    name: "Authentication Service"
    dependencies: []
    output: "src/auth/"
    checklist:
      - "JWT token generation"
      - "Password hashing (bcrypt)"
      - "Unit tests > 80%"

  - id: "api"
    name: "API Gateway"
    dependencies: ["auth"]
    output: "src/api/"
    checklist:
      - "Rate limiting middleware"
      - "Input validation"

execution:
  strategy: "parallel"
  maxWorkers: 4

βœ… Verification Pipeline

Multi-layer quality gates:

Layer Check Description
1 Syntax Validate code can be parsed
2 Security Detect dangerous patterns (eval, hardcoded secrets)
3 Style Check line length, whitespace, formatting
4 Complexity Analyze loop depth, branch count
5 Checklist Verify against module requirements

πŸ”„ Detach/Reload Pattern

Worker lifecycle for context isolation:

RESET β†’ LOAD CONTEXT β†’ EXECUTE β†’ VERIFY β†’ SAVE β†’ DETACH

Critical: DETACH Phase

After every task completion:

  • Clear LLM instance
  • Clear context manager
  • Release temporary variables
  • Force garbage collection

Purpose: Prevent context pollution between tasks


πŸ“Š Comparison with v1

Feature v1 v2 (Final)
Reset Weights ❌ βœ…
Blueprint Mode ❌ βœ…
3-Tier Memory ❌ βœ…
Context Isolation ❌ βœ…
Parallel Workers ❌ βœ…
Checkpoint Recovery ❌ βœ…
Verification Pipeline Basic Full

πŸ“ License

MIT License - see LICENSE


Kimi Code Explorer - Production-Grade AI Code Refactoring πŸš€

About

Kimi Code Explorer - AI-powered VS Code extension for intelligent code analysis

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors