Skip to content

Latest commit

ย 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸงŠ ICE โ€” Intelligent Code Engine

A VS Code extension where AI agents plan, write, review, and test your code โ€” not just autocomplete it.

Status VS Code Python License


What is ICE?

ICE is a VS Code extension powered by a 3-agent AI pipeline that understands your entire codebase. Unlike autocomplete tools, ICE can plan multi-file changes, generate production-quality code, validate it with real tests, and auto-fix issues โ€” all streaming live in your editor.

Two Modes

Mode Trigger Speed Use Case
โšก Fast Just type ~10s Quick questions, small edits
๐Ÿš€ Pipeline /agents prefix ~55s Complex features, refactors, new code

DEMO

Screenshot 2026-02-18 at 3 12 40โ€ฏPM Screenshot 2026-02-18 at 3 13 06โ€ฏPM Screenshot 2026-02-18 at 3 13 11โ€ฏPM

How It Works

You: "/agents add pagination to the UserList component"
         โ”‚
         โ–ผ
   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     RAG search + AST analysis
   โ”‚  ๐Ÿ“‹ Planner  โ”‚โ”€โ”€โ”€โ–ถ Finds relevant files, reads target,
   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜     creates plan with exact edit locations
          โ”‚
          โ–ผ
   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     Receives plan + existing code
   โ”‚  โŒจ๏ธ  Coder   โ”‚โ”€โ”€โ”€โ–ถ Generates ONLY the changes needed
   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜     (INSERT_AFTER or REPLACE_FUNCTION)
          โ”‚
          โ–ผ
   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     Static checks + LLM review + pytest
   โ”‚  โœ… Validatorโ”‚โ”€โ”€โ”€โ–ถ If issues found โ†’ sends back to Coder
   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜     Auto-accepts after max fix attempts
          โ”‚
          โ–ผ
   ๐Ÿ“„ Proposed changes with diff preview

Features

๐Ÿ”ฎ Ghost Autocomplete

Context-aware inline completions powered by your indexed codebase. Understands imports, function signatures, and project patterns.

โŒ˜K Inline Edit

Select code, press โŒ˜K, describe what you want changed. ICE modifies just the selection.

๐Ÿ’ฌ Agent Chat Panel

Side panel with real-time streaming of agent actions. Watch the Planner search your codebase, the Coder generate code, and the Validator run tests โ€” all live.

๐Ÿ” Codebase-Aware RAG

ICE indexes your entire project on startup:

  • Semantic search โ€” sentence-transformers + FAISS embeddings
  • Symbol matching โ€” AST-extracted functions, classes, methods
  • Dependency graph โ€” Import relationships and call chains
  • Fusion retrieval โ€” Combines all three for best results

๐Ÿงช Real Test Execution

The Validator doesn't just review code โ€” it generates pytest tests and runs them in an isolated sandbox. Real failures, real feedback.

๐Ÿ”ง AST-Based Code Merging

LLMs are bad at outputting entire files. ICE uses Python's ast module to:

  • Find exact function boundaries (handles multi-line strings correctly)
  • Extract only the target function from LLM output
  • Merge via line splice โ€” zero ambiguity

Architecture

ice-vscode/
โ”œโ”€โ”€ src/                          # VS Code Extension (TypeScript)
โ”‚   โ”œโ”€โ”€ extension.ts              # Entry point, command registration
โ”‚   โ”œโ”€โ”€ backend/manager.ts        # Python backend lifecycle
โ”‚   โ”œโ”€โ”€ providers/autocomplete.ts # Ghost completions
โ”‚   โ”œโ”€โ”€ commands/
โ”‚   โ”‚   โ”œโ”€โ”€ indexProject.ts       # Codebase indexing command
โ”‚   โ”‚   โ””โ”€โ”€ inlineEdit.ts        # โŒ˜K inline edit
โ”‚   โ”œโ”€โ”€ views/
โ”‚   โ”‚   โ”œโ”€โ”€ chatPanel.ts         # Agent chat UI (webview)
โ”‚   โ”‚   โ””โ”€โ”€ agentTreeView.ts     # Agent status tree
โ”‚   โ””โ”€โ”€ utils/
โ”‚       โ”œโ”€โ”€ api.ts               # Backend HTTP client
โ”‚       โ””โ”€โ”€ config.ts            # Extension settings
โ”‚
โ”œโ”€โ”€ backend/                      # Python Backend (FastAPI)
โ”‚   โ””โ”€โ”€ src/
โ”‚       โ”œโ”€โ”€ main.py              # Uvicorn entry point
โ”‚       โ”œโ”€โ”€ api/                 # REST + SSE endpoints
โ”‚       โ”œโ”€โ”€ agents/
โ”‚       โ”‚   โ”œโ”€โ”€ base.py          # BaseAgent with LLM + logging
โ”‚       โ”‚   โ”œโ”€โ”€ planner.py       # RAG retrieval + implementation plan
โ”‚       โ”‚   โ”œโ”€โ”€ coder.py         # Code generation + AST-based merging
โ”‚       โ”‚   โ””โ”€โ”€ validator.py     # Static checks + LLM review + pytest
โ”‚       โ”œโ”€โ”€ workflows/
โ”‚       โ”‚   โ””โ”€โ”€ generate.py      # 3-agent sequential pipeline
โ”‚       โ”œโ”€โ”€ indexer/
โ”‚       โ”‚   โ”œโ”€โ”€ ast_parser.py    # tree-sitter multi-language parsing
โ”‚       โ”‚   โ”œโ”€โ”€ chunker.py       # Intelligent code chunking
โ”‚       โ”‚   โ”œโ”€โ”€ embedder.py      # sentence-transformers embeddings
โ”‚       โ”‚   โ””โ”€โ”€ graph_builder.py # Dependency graph construction
โ”‚       โ”œโ”€โ”€ retriever/
โ”‚       โ”‚   โ”œโ”€โ”€ fusion.py        # Fusion retrieval (semantic + symbol + graph)
โ”‚       โ”‚   โ”œโ”€โ”€ semantic.py      # Vector similarity search
โ”‚       โ”‚   โ”œโ”€โ”€ symbol.py        # Symbol name matching
โ”‚       โ”‚   โ””โ”€โ”€ graph.py         # Graph-based retrieval
โ”‚       โ””โ”€โ”€ core/
โ”‚           โ”œโ”€โ”€ models.py        # Pydantic models (WorkflowState, etc.)
โ”‚           โ”œโ”€โ”€ config.py        # Settings via pydantic-settings
โ”‚           โ””โ”€โ”€ logging.py       # Structured logging (structlog)
โ”‚
โ”œโ”€โ”€ package.json                  # Extension manifest + commands
โ”œโ”€โ”€ webpack.config.js             # TypeScript bundling
โ””โ”€โ”€ setup.sh                      # One-command setup

Tech Stack

Layer Technology
Extension TypeScript, VS Code Extension API, Webpack
Backend Python 3.11+, FastAPI, Uvicorn
LLM Claude API (Anthropic)
Embeddings sentence-transformers (all-MiniLM-L6-v2)
Vector Search FAISS
Code Parsing tree-sitter (Python, JS, TS)
Testing pytest (sandboxed execution)
Models Pydantic v2
Logging structlog

Getting Started

Prerequisites

  • VS Code 1.85+
  • Python 3.11+
  • Node.js 18+
  • Anthropic API key

Setup

# Clone
git clone https://github.com/your-username/ice-vscode.git
cd ice-vscode

# Backend
cd backend
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

# Create .env
cp .env.example .env
# Edit .env โ†’ set ANTHROPIC_API_KEY=sk-ant-...

# Frontend
cd ..
npm install
npm run compile

Run

  1. Open ice-vscode/ in VS Code
  2. Press fn+F5 (starts Extension Development Host)
  3. โŒ˜โ‡งP โ†’ "ICE: Index Current Project"
  4. Open the chat panel (ICE icon in sidebar)
  5. Type a request or prefix with /agents for the full pipeline

API Endpoints

Endpoint Method Description
/health GET Backend health check
/api/index POST Index a codebase directory
/api/status GET Index status + stats
/api/chat POST Fast single-call chat
/api/generate-stream POST Full 3-agent pipeline (SSE)
/api/complete POST Autocomplete suggestions
/api/search POST Semantic code search
/api/explain POST Code explanation

Agent Pipeline: Before & After

The pipeline was consolidated from 7 agents to 3 for performance:

v1 (7 agents) v2 (3 agents) Why
Researcher โ†’ Planner RAG is a function call, not an agent
Architect โ†’ Planner One LLM call does both
Coder โ†’ Coder Same
Fixer โ†’ Coder Coder + feedback = Fixer
Reviewer โ†’ Validator Both are quality checks
Tester โ†’ Validator Combined with review
Supervisor โ†’ loop logic Simple conditional, not an agent

Result: 7 LLM calls โ†’ 3-4 calls, ~2min โ†’ ~55s, same quality.


Code Modification Strategy

ICE doesn't rewrite entire files. The merge system uses three approaches:

Strategy When How
REPLACE_FUNCTION Improving existing code AST finds function boundaries โ†’ swap in place
INSERT_AFTER Adding new code Line matching โ†’ insert at exact position
Full file New files or files < 300 lines LLM outputs complete file

The AST-based approach (Python's ast module) correctly handles multi-line strings, decorators, and nested classes โ€” unlike regex/indentation scanners.


Current Status

๐ŸŸก Work in Progress โ€” Actively developing and improving daily.

What Works

  • โœ… Ghost autocomplete with codebase context
  • โœ… โŒ˜K inline editing
  • โœ… 3-agent pipeline (Planner โ†’ Coder โ†’ Validator)
  • โœ… Real-time streaming in chat panel
  • โœ… RAG with fusion retrieval
  • โœ… Real pytest execution
  • โœ… AST-based function replacement
  • โœ… Auto-fix loop on validation failure

In Progress

  • ๐Ÿ”ง Planner-driven edit ranges (AST line numbers passed to Coder)
  • ๐Ÿ”ง Full-file mode for small files (< 300 lines)
  • ๐Ÿ”ง Multi-file edit support
  • ๐Ÿ”ง Diff preview with accept/reject UI

Known Limitations

  • Python-focused AST merging (JS/TS files fall back to regex)
  • Single-file edits per pipeline run
  • Validator test generation can be slow (~30-60s)

Configuration

Settings available via VS Code Settings (โŒ˜,):

Setting Default Description
ice.provider anthropic LLM provider
ice.model claude-sonnet-4-20250514 Model name
ice.anthropicApiKey โ€” Your API key
ice.backendPort 8420 Backend server port
ice.pythonPath auto-detect Custom Python path

Contributing

This is a personal project in active development. If you're interested in contributing or have ideas, feel free to open an issue or reach out.


License

MIT


Built with frustration, curiosity, and way too many iterations on indentation matching.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages