smallcode  by Doorman11991

AI coding agent for local LLMs

Created 4 days ago

New!

1,091 stars

Top 34.6% on SourcePulse

GitHubView on GitHub
Project Summary

Summary

SmallCode enables coding tasks using small, locally-run LLMs (7B-20B parameters) on consumer hardware. This terminal-native agent compensates for smaller models' limitations—context, tool-calling—via an intelligent, privacy-focused architecture, facilitating local development without cloud reliance.

How It Works

SmallCode's architecture optimizes for small LLMs. It manages context via summarization/budgeting and uses a forgiving parser for imperfect tool calls. Complex tasks decompose into TODO-file managed steps, with editing primarily using safer search-and-replace patches. Key innovations include MarrowScript for generating robust AI cognition logic (caching, validation, budgets) from concise declarations, and BoneScript, compiling .bone files into complete Node.js/TypeScript backends to reduce tool call overhead and boost reliability.

Quick Start & Requirements

  • Install: npm install -g smallcode or npx smallcode.
  • Prerequisites: Node.js 18+ (LTS recommended for SQLite binaries) and a local LLM server (e.g., LM Studio, Ollama, OpenAI-compatible endpoint).
  • Optional Dependencies: better-sqlite3 for code graph features requires native compilation tools (Python 3, make, C++ compiler) if prebuilt binaries are unavailable; SmallCode falls back to JSON memory if build fails.
  • Configuration: Set SMALLCODE_MODEL and SMALLCODE_BASE_URL in .env. Optional cloud API keys for model escalation.

Highlighted Details

  • MarrowScript Cognition Layer: Declarative AI logic compiles to robust TypeScript with caching, retries, validation, and budget enforcement.
  • BoneScript Integration: Compiles .bone files into full Node.js/TypeScript backends, reducing tool calls from 8-15 to 1-2 for improved reliability.
  • Model Escalation: Opt-in fallback to cloud models (Claude, OpenAI, DeepSeek) on local failure, session-limited.
  • Context Budget Engine: Manages context via token capping, mid-turn eviction, and semantic compression.
  • Forgiving Tool Call Parser: Parses and auto-repairs tool calls from JSON, YAML, XML, or plain text.
  • Patch-First Editing & TODO Planning: Uses search-and-replace editing and TODO-driven decomposition for small model reliability.
  • Web Browsing: Integrated Playwright (optional, requires SMALLCODE_WEB_BROWSE=true) for web search/fetching with anti-detection.

Maintenance & Community

No specific details regarding maintainers, community channels, or roadmap were found in the provided README.

Licensing & Compatibility

  • License: MIT.
  • Compatibility: Permissive MIT license allows broad compatibility, including commercial use and closed-source linking.

Limitations & Caveats

  • Code graph features require build tools if better-sqlite3 prebuilt binaries are unavailable.
  • Web browsing is optional and requires explicit enablement.
  • Cloud model escalation is opt-in and incurs costs.
Health Check
Last Commit

19 hours ago

Responsiveness

Inactive

Pull Requests (30d)
13
Issues (30d)
20
Star History
1,103 stars in the last 4 days

Explore Similar Projects

Starred by Patrick von Platen Patrick von Platen(Author of Hugging Face Diffusers; Research Engineer at Mistral), David Cournapeau David Cournapeau(Author of scikit-learn), and
3 more.

codecompanion.nvim by olimorris

0.3%
7k
Neovim plugin for AI-powered coding assistance
Created 2 years ago
Updated 6 days ago
Starred by Yiran Wu Yiran Wu(Coauthor of AutoGen) and Eric Zhu Eric Zhu(Coauthor of AutoGen; Research Scientist at Microsoft Research).

PocketFlow by The-Pocket

0.3%
11k
Minimalist LLM framework for agentic coding
Created 1 year ago
Updated 1 month ago
Feedback? Help us improve.