{
  "id": 17349131,
  "title": "How I built an asynchronous predictive compiler using Git Worktrees and Docker",
  "url": "https://urgent.news/2026/10/31/how-i-built-an-asynchronous-predictive-compiler-using-git-worktrees",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-10-31T05:55:43.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/hariom_dubey_/how-i-built-an-asynchronous-predictive-compiler-using-git-worktrees-and-docker-1mfi"
  },
  "original_language": "en",
  "account": "Asynchronous predictive compilers are revolutionizing the AI coding landscape, but current tools remain purely reactive. Users still write code, run tests, and wait for feedback from AI chatbots. Hariom Dev wanted an engine that operates in the space between keystrokes, analyzing unfinished code, creating parallel replicas, and patching errors before a developer commits changes. That's how Shadow-Branch Engine came to be.\n\nShadow-Branch uses Git worktrees to create a parallel replica of a project in near real-time. When a file is saved, the daemon triggers a git stash create and mounts a hidden worktree using OS-level hardlinks to mirror the existing node_modules directory. This creates a sub-millisecond, isolated copy of the codebase, ready for execution.\n\nTo address the computational cost of sending an entire codebase to a large language model (LLM), Shadow-Branch leverages the TypeScript Compiler API (ts-morph). When a file is saved, the engine parses the Abstract Syntax Tree (AST), identifies the modified function, and traces its exact dependency graph. Unrelated files and comments are stripped away, sending only the necessary context to the local AI. This reduces the token count by over 90%, making local model execution incredibly fast.\n\nAll generated test suites and patches are executed inside Docker containers. The Docker sandbox is network-isolated and only mapped to the .shadow-workspace. If the AI-generated code fails, the daemon captures the exit codes and routes error logs through a local XState state machine for autonomous healing. Passing tests result in a clean, merge-ready patch being sent directly to the IDE.\n\nShadow-Branch's asynchronous nature allows it to spin up parallel Micro-VMs for aggressive fuzz testing of asynchronous operations. If any container fails, the patch is rejected. The engine is a Node.js daemon with zero dependencies on external platforms, making it highly customizable and open-source. It's built strictly for local use, focusing on Git manipulation, AST parsing, and Docker orchestration. Hariom Dev invites feedback on the architecture and encourages contributions to add support for Python and Rust LSPs. The full source code is available in the GitHub repository.",
  "summary": "Current AI coding tools have a fundamental workflow problem: they are entirely reactive. You write a function, you run your test suite, it fails, you copy the error logs, paste them into the AI chat, and wait for a fix. You are the orchestrator, and the AI is just glorified autocomplete. I wanted an engine that operates entirely in the gap between keystrokes. I wanted a system that detects my…",
  "key_points": [
    "Shadow-Branch Engine uses Git worktrees for real-time code replication.",
    "TypeScript Compiler API reduces context sent to LLM by over 90%.",
    "Docker containers execute generated test suites and patches with autonomous healing."
  ],
  "editors_take": "By shifting AI assistance from reactive feedback to proactive error patching, this architecture transforms the development workflow into an autonomous cycle of continuous, isolated testing and code refinement.",
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}