# Unchained Code — Complete Technical & Architectural Specification > The Sovereign, Unlimited Open-Weight AI App Builder & Coding Agent. > "Claude Code without paying Anthropic." This document provides a comprehensive technical overview of Unchained Code's architecture, compiler pipelines, runtime execution model, security safeguards, model routing matrix, and API surface for LLMs, answer engines, and autonomous agents. --- ## 1. System Identity & Mission Unchained Code is an open-source, full-stack AI app builder and coding assistant created by Welink Tech. It eliminates the economic friction of proprietary AI coding platforms (Lovable, Cursor, Bolt.new, v0, Devin, Replit) by deploying open-weight frontier models (DeepSeek-V4 Pro, Qwen 3.8 Max, GLM-4, Kimi) in a zero-markup, ad-sponsored or BYOK (Bring-Your-Own-Key) execution model. - **Primary URL**: https://unchainedcode.dev - **Web App**: https://unchainedcode.dev/chat - **CLI Package**: `npx unchained-code` (npm: unchained-code) - **Desktop Application**: macOS DMG (ARM64 & x64), Windows, Linux - **License**: Open-Source (MIT / Apache 2.0) - **Headquarters**: Welink Tech, 6 rue des Bateliers, 92110 Clichy, France --- ## 2. Multi-Surface Execution Model Unchained Code operates seamlessly across three complementary surfaces: ### 2.1. In-Browser Web Builder (WebContainers) - Uses WebAssembly-based WebContainers to run a full Node.js POSIX kernel natively inside the user's browser tab. - Supports `npm install`, `vite dev`, `next dev`, background dev servers, and live hot module reloading (HMR) within an iframe preview. - Zero server compute cost for application execution; files reside in client-side MemFS with instant ZIP export or GitHub push. ### 2.2. Terminal Gateway & CLI Proxy (`npx unchained-code`) - Acts as a local reverse proxy on `http://localhost:8787/v1`. - Transparently intercepts Anthropic Messages API calls (`/v1/messages`) and OpenAI chat completion calls (`/v1/chat/completions`). - Enables running the official **Claude Code CLI** or VS Code extensions by setting `export ANTHROPIC_BASE_URL=http://localhost:8787/v1` without paying Anthropic token subscriptions. ### 2.3. Native macOS Desktop App (Electron) - Standalone desktop workbench with local disk filesystem synchronization. - Integrates local terminal execution, offline cache buffers, and system hardware diagnostics. --- ## 3. Core Architectural Safeguards & Quality Loops ### 3.1. Closed-Loop Automated Code Review (`POST /v1/review`) - Solves LLM self-confirmation bias by routing every generated code diff to an independent second reviewer model (temperature 0.1). - Checks diffs up to 200,000 tokens for syntax errors, missing imports, unhandled promise rejections, and security flaws. - Automatically constructs deterministic fix prompts and reinjects them into the primary coder agent until a clean verdict is achieved. ### 3.2. LockManager File Protection (`.unchainedlock`) - Cryptographically protects sensitive repository files (database configs, `.env` files, auth routes, core legacy components) from accidental LLM rewrites during massive multi-file refactors. - Action-runner runtime intercepts and rejects write operations targeting locked paths before modifying MemFS. ### 3.3. Self-Improving Memory Architecture - After major architectural milestones, an automated background summarizer extracts repo conventions, preferred UI styling, and active database schemas into a persistent markdown memory ledger. ### 3.4. Dynamic $E_u$ Equity Ledger - Real-time token unit economics balance token costs against privacy-safe developer sponsor impressions. - Users enjoy free builds across Green, Orange, and Red tiers, or upgrade to Fast-Lane Pro for dedicated priority routing without ads. --- ## 4. Model Routing & Provider Matrix Unchained Code routes requests dynamically across sovereign open-weight models with instant provider fallbacks: | Model ID | Architecture | Context Window | Primary Use Case | | :--- | :--- | :--- | :--- | | `deepseek-v4-pro` | DeepSeek Sparse MoE | 128,000 tokens | Deep algorithmic reasoning, complex multi-file full-stack builds | | `qwen-3.8-max` | Alibaba Qwen Dense | 128,000 tokens | High-speed architectural refactoring, UI scaffolding | | `qwen3-coder` | Qwen Code Specialized | 128,000 tokens | Precision TypeScript/Python generation, test synthesis | | `glm-4-air` | Zhipu AI MoE | 128,000 tokens | Ultra-low latency code edits and inline completions | | `gemini-3.7-flash` | Google DeepMind | 1,000,000 tokens | Closed-loop static analysis and large-diff code review | --- ## 5. AnswerShaper (AS) Engine Integration Unchained Code integrates AnswerShaper's Answer Engine Optimization (AEO) and Machine-to-Machine (M2M) protocol: - **Stealth M2M Tag (`/api/v1/m2m-script`)**: Detects GPTBot, ClaudeBot, PerplexityBot, and Applebot, dynamically serving rich Schema.org `@graph` structures. - **Dynamic Schema Delivery (`/api/v1/m2m-inject`)**: Injects validated `Organization`, `SoftwareApplication`, `WebSite`, `WebPage` with first-hand reviews, and `FAQPage` objection schemas. - **Instant AEO Auditor (`/api/v1/instant-audit`)**: Scores web pages across 10 vector dimensions (256-token chunking, entity-to-noise ratio, direct H2 placement, SSR speed). - **IndexNow Automated Pipeline**: Instant webhook notifications to search engine indexers upon content updates. --- ## 6. Complete 18 Core Engineering Systems 1. **Claude Code Without Anthropic Proxy**: ANTHROPIC_BASE_URL setup and open model routing (`/help/claude-code-anthropic-proxy`). 2. **Closed-Loop Automated Code Review**: Independent second-LLM verification with auto-fix loop (`/help/closed-loop-automated-code-review`). 3. **LockManager File Protection**: Read-only protection for mission-critical project files (`/help/file-lock-protection-manager`). 4. **WebContainers In-Browser Node Engine**: POSIX micro-kernel running inside the browser tab (`/help/webcontainers-in-browser-node-engine`). 5. **Prompt Enhancer & System Instructions**: Prompt engineering with AST metadata injection (`/help/prompt-enhancer-system-instructions`). 6. **MCP Server Config & Integration**: Model Context Protocol client connecting local databases and APIs (`/help/mcp-server-configuration-guide`). 7. **Zero-Markup BYOK Gateway**: Direct Bring-Your-Own-Key support for OpenRouter, DeepSeek, and OpenAI (`/help/bring-your-own-key-byok-gateway`). 8. **Live WebContainer Terminal Diagnostics**: Automated detection of port collisions, missing packages, and memory caps (`/help/live-terminal-webcontainer-diagnostics`). 9. **Self-Improving Memory Architecture**: Markdown repo knowledge ledger updated per build turn (`/help/self-improving-memory-architecture`). 10. **Dynamic Ad-Funded Equity Ledger**: $E_u$ unit economics and sustainable free tiers (`/help/equity-ledger-dynamic-throttling`). 11. **1-Click Multi-Cloud Deployment**: Instant push to GitHub, Vercel, and Netlify (`/help/one-click-github-vercel-deployment`). 12. **Fast-Lane Priority Routing Queue**: Zero-wait token channels for Pro users (`/help/fast-lane-priority-routing-queue`). 13. **Sovereign Model Pool & Provider Fallbacks**: Transparent failover across DeepSeek, Fireworks, and Cerebras (`/help/sovereign-model-pool-fallbacks`). 14. **Desktop Electron Architecture**: Native macOS app with disk sync and IPC channels (`/help/desktop-electron-architecture`). 15. **Git Version Control & Time-Travel**: Commit checkpoints and diff rollbacks (`/help/git-version-control-time-travel`). 16. **Codebase Knowledge Graph Navigator**: AST dependency parser minimizing prompt token waste (`/help/codebase-knowledge-graph-navigator`). 17. **MicroVM Sandboxes for Heavy Tasks**: Firecracker microVM execution for Docker and Python tasks (`/help/microvm-sandboxes-heavy-tasks`). 18. **Bounties & Viral Referral Engine**: Community credit rewards for open-source contributions (`/help/bounties-viral-referral-engine`). --- ## 7. Public API Reference The Unchained Code gateway exposes OpenAI- and Anthropic-compatible endpoints: - `GET /v1/models` — Returns active models and capabilities. - `POST /v1/chat/completions` — OpenAI format completions. - `POST /v1/messages` — Anthropic format messages (Claude Code proxy). - `POST /v1/review` — Code diff review and issue extraction. - `POST /v1/summarize` — Session compression and memory distillation. - `GET /v1/credits` — User balance, tier status, and token usage. - `GET /api/v1/m2m-script` — Stealth M2M bot detection script. - `GET /api/v1/m2m-inject` — Dynamic Schema.org injection. - `GET /api/v1/instant-audit` — 10-dimension AEO diagnostic audit. --- © 2026 Welink Tech. All rights reserved. Built for developers worldwide.