⭐ 1802 stars JavaScript MIT

SmallCode

终端原生 AI 编程代理 · 为小型 LLM 而生 Terminal-native AI coding agent · Built for small LLMs

SmallCode 是一款完全本地运行的 AI 编程助手,针对 8B–35B 参数的小型模型深度优化。通过智能上下文预算管理、任务分解、多模型路由、搜索替换补丁等机制,弥补小模型的局限性,提供完整的代理循环体验。 SmallCode is a fully local AI coding agent optimized for small models (8B–35B). It compensates for small model limitations through context budget management, task decomposition, multi-model routing, and search-and-replace patching — delivering a full agent loop experience.

在 GitHub 上查看View on GitHub
⚡ 安装⚡ Install
npm install -g smallcode
🚀 快速开始🚀 Quick Start
  1. 在终端运行 smallcode 启动全屏 TUIRun smallcode in terminal to start the fullscreen TUI
  2. 输入你的编程任务,例如 "创建一个 Express API 服务器"Enter a task like "create an Express API server"
  3. SmallCode 会自动分解步骤、读写文件、执行命令SmallCode decomposes steps, reads/writes files, runs commands
  4. 使用 /help 查看所有斜杠命令Use /help to see all slash commands
🧠 核心特性🧠 Core Features

🤖 Agent Loop

交互式编程代理:读、写、编辑文件,执行 shell 命令,搜索代码Interactive coding agent: read, write, edit files, run shell, search code

🔀 Multi-Model Routing

根据复杂度路由到 fast/default/strong 模型Route tasks to fast/default/strong tiers by complexity

📦 Context Budget

压缩对话历史,智能管理小模型上下文窗口Compress history, manage small model context windows

🔧 Forgiving Parser

恢复小模型格式错误的工具调用(JSON、Liquid AI、围栏块)Recover malformed tool calls (JSON, Liquid AI, fenced blocks)

✂️ Search & Replace Patch

精确搜索替换补丁,避免全文件重写Exact search-and-replace patching, no full rewrites

📐 Task Decomposition

将复杂任务分解为原子步骤,逐步执行Break complex tasks into atomic numbered steps

💾 Project Memory

跨会话持久化决策、工作流、约定Persist decisions, workflows, conventions across sessions

🧪 TDD Loop

红-绿-重构循环,自动阶段转换Red-Green-Refactor cycle with auto phase transitions

📊 Code Graph

符号搜索、代码解释、MCP 桥接Symbol search, explanation, MCP bridge

🔒 Read-Before-Write

防止覆盖未读取的文件Prevents overwriting unread files

📋 使用示例📋 Example
$ smallcode ╭──────────────────────────────────────────╮ │ SmallCode v1.2.0 · model: qwen2.5:14b │ │ endpoint: http://localhost:11434 │ │ cwd: /home/user/project │ ╰──────────────────────────────────────────╯ read_file src/server.js search_code "route handler" edit_patch src/server.js ⚠ retry 1 edit_patch src/server.js ✔ 完成: 添加了 /api/users 路由
🔬 交互演示 · 任务分解🔬 Interactive Demo · Task Decomposition

输入一个复杂任务,SmallCode 会将其分解为原子步骤(模拟核心算法) Enter a complex task, SmallCode decomposes it into atomic steps (simulating core logic)

等待分解…Waiting for decomposition…

Share

Submit to AI Directories

Futurepedia AI Tool Hunt Awesome AI Tools ToolPilot AI Infinity

Nebula AI Tool Base