Skip to content

Latest commit

Β 

History

108 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

⚑ prod-code

Remote Code Intelligence (RCI) for AI Agent Fleets & Distributed Workspaces

GitHub release License Fleet Scale Rust Go Protocol

Decouple semantic code intelligence from local developer machines.
Purpose-built for autonomous AI coding agent fleets, multi-worktree parallelism, and high-throughput polyglot development with native Model Context Protocol (MCP) and drop-in LSP.


Cluster

Any number of gateways form a cluster: start each with --peers <one live peer> and --advertise <its host:port>; membership spreads by gossip (every 5 s: load, engines, loaded workspaces). Clients need one seed:

export PROD_CODE_REMOTE=192.168.2.168:9400   # any node; the rest is discovered
prod-code cluster                            # the gossip view of every node

A checkout is placed by the cluster on the node that already holds it, otherwise on the quietest node that serves its language (Swift lands on a macOS node); the placement is remembered per checkout and an idle workspace drifts off an overloaded node.

What each language gets

Rust Go C/C++ TypeScript Python Swift
engine rust-analyzer in-process gopls clangd TypeScript 7 native LSP basedpyright sourcekit-lsp (macOS node)
hover / def / refs / symbols / callers / callees / impls yes yes yes yes yes yes
rename yes (+ module files) yes yes yes yes yes
assists / safe-delete yes - - - - -
check cargo check go build cmake / meson / make tsc (bunx / pnpm / yarn / npx) basedpyright (uv / .venv aware) swift build / xcodebuild
lint clippy go vet - eslint / biome ruff -
test cargo test go test ctest / meson test vitest / jest / bun test / mocha pytest / unittest swift test / xcodebuild test

Tooling is detected from the checkout (lock files, package.json, pyproject, CMakeLists...). Dependencies live on the node: run prod-code exec -- bun install, -- uv sync, -- npm ci once per checkout and the language servers and test runners use them.

Per-repository options (prod-code.toml)

Put a prod-code.toml at the checkout root to tune how the gateway analyses it. It is synced like any manifest and read when the workspace is loaded (restart or idle-evict the gateway after changing it):

[rust]
features = "all"            # or ["feat-a", "feat-b"]; default: the crate's default features
no_default_features = false
all_targets = true          # tests, benches and examples are analysed (default)
sysroot = true              # standard library from rust-src (default)

Use features = "all" when the same module tree is compiled into several crates behind feature flags: rust-analyzer attaches each file to one crate, and a module behind a disabled feature is dead there.

🎯 The Problem: Why Traditional Language Servers Fail at Agent Scale

Modern language servers (rust-analyzer, gopls, pyright, tsserver) were architected for a single human developer typing in an interactive desktop editor.

When deploying fleets of autonomous AI coding agents (Claude, Codex, Agy, Cursor Agent) across dozens of parallel Git worktrees, the architecture collapses:

Bottleneck Traditional Language Servers (rust-analyzer / gopls) prod-code Remote Code Intelligence
Memory Footprint 20–60+ GB RAM duplicated per session. Developer Mac freezes or OOMs. 0 MB on client. Entire Salsa DB / AST cache stays in server RAM (128+ GB).
CPU / Battery 100% CPU lockups on AST re-indexing; fans spin at full speed on laptop. 0% CPU on client. Heavy analysis runs on dedicated 32–64 core server CPUs.
Overlay Contention Global database write locks on every text edit. Concurrent sessions queue up (p95: 71s). Single-Owner Direct-Edits: edits write directly to in-memory inputs (p95: 12s).
Protocol Overhead Heavy bidirectional JSON-RPC state synchronization gymnastics. Dual Surface: Standard LSP for IDEs + Native MCP tools for AI agents.
Multi-Language Ops Fractured supervisor processes per language (gopls, analyzed, pyright). Unified Polyglot Gateway: single 10G port routes Rust, Go, Python, and TS.

πŸ—οΈ Architecture

 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
 β”‚   Developer Laptop / Agent Fleet Pod                   β”‚
 β”‚   β€’ Thin Client (`prod-code`, < 15 MB binary)          β”‚
 β”‚   β€’ Local IDEs (Cursor / VS Code / Neovim) via stdio   β”‚
 β”‚   β€’ AI Agents (Claude / Codex / Agy) via MCP           β”‚
 β”‚   Local Resource Usage: ~0% CPU, < 10 MB RAM           β”‚
 β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                             β”‚
                             β”‚ 10 GbE TCP / QUIC (~0.05–0.1 ms RTT, 1.2 GB/s)
                             β–Ό
 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
 β”‚   Remote Compute Node (128+ GB RAM, 32–64 Cores, NVMe) β”‚
 β”‚                                                        β”‚
 β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
 β”‚   β”‚  Universal Gateway (:9400)                     β”‚   β”‚
 β”‚   β”‚  β€’ Dual-Surface: LSP Multiplexer + MCP Server  β”‚   β”‚
 β”‚   β”‚  β€’ Bi-directional Path Translation             β”‚   β”‚
 β”‚   β”‚  β€’ Multi-Tenant Session Registry               β”‚   β”‚
 β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
 β”‚                           β”‚                            β”‚
 β”‚         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”          β”‚
 β”‚         β–Ό                 β–Ό                 β–Ό          β”‚
 β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
 β”‚   β”‚Rust Engineβ”‚     β”‚ Go Engine β”‚     β”‚ Python/TS β”‚    β”‚
 β”‚   β”‚β€’ RA Salsa β”‚     β”‚β€’ gopls    β”‚     β”‚β€’ Managed  β”‚    β”‚
 β”‚   β”‚  in RAM   β”‚     β”‚  pool     β”‚     β”‚  workers  β”‚    β”‚
 β”‚   β”‚β€’ Direct   β”‚     β”‚β€’ Shared   β”‚     β”‚β€’ Scaled   β”‚    β”‚
 β”‚   β”‚  Edits    β”‚     β”‚  GOCACHE  β”‚     β”‚  workers  β”‚    β”‚
 β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚
 β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

✨ Key Capabilities

1. Ultra-Low Latency 10G Wire Protocol

Over a 10 GbE local network, network latency drops to 0.05–0.1 ms with ~1.1–1.2 GB/s throughput β€” indistinguishable from local NVMe storage. prod-code uses a tuned TCP streaming protocol with TCP_NODELAY, binary frame headers, and connection reuse.

2. Dual-Surface API: LSP for Humans, MCP for Agents

  • For Editors: Drops directly into Cursor, VS Code, or Neovim as an ordinary language server speaking JSON-RPC LSP over stdio.
  • For AI Coding Agents: Exposes clean, structured Model Context Protocol (MCP) endpoints (code_definition, code_references, code_outline, code_diagnostics, code_type_at). No parsing multi-megabyte JSON-RPC streams in agent loops.

3. Single-Owner Direct-Edit Fast Path

For ephemeral Git worktrees used by autonomous agents:

  • Bypasses costly overlay crate cones and global database invalidation locks.
  • Unsaved buffer edits write directly into in-memory base Salsa inputs.
  • Benchmarked under 15 concurrent agent sessions: cuts query latency from 71s down to 12s.

4. Transparent Bi-directional Path Translation

Your client talks about /Users/alex09x/Documents/workspace/repo/src/main.rs. The remote daemon maps it to /srv/prod-code/workspaces/repo/src/main.rs. All response URIs, diagnostics, and symbol definitions are translated back into local client paths seamlessly.

5. Multi-Server Homelab / Cloud Clustering

Deploy across multiple machines on your 10G network:

  • Consistent workspace hashing pins repositories to dedicated memory nodes.
  • Procedural macro execution offloaded into an isolated worker pool.

πŸ“¦ Workspace Layout

prod-code/
β”œβ”€β”€ Cargo.toml                  # Workspace definition
β”œβ”€β”€ README.md                   # Project overview & architecture
β”œβ”€β”€ ROADMAP.md                  # 5-phase engineering plan
β”œβ”€β”€ LICENSE-MIT                 # MIT License
β”œβ”€β”€ LICENSE-APACHE              # Apache 2.0 License
β”œβ”€β”€ crates/
β”‚   β”œβ”€β”€ prod-code-protocol/     # Binary wire framing, handshake & path translation
β”‚   β”œβ”€β”€ prod-code-client/       # Ultra-thin CLI bridge (stdio LSP -> 10G TCP)
β”‚   β”œβ”€β”€ prod-code-gateway/      # Daemon gateway, multi-tenant session dispatcher
β”‚   β”œβ”€β”€ prod-code-engine-rust/  # In-memory Rust engine (ra_ap_ide::AnalysisHost)
β”‚   β”œβ”€β”€ prod-code-engine-go/    # Managed gopls worker pool with shared caches
β”‚   └── prod-code-mcp/          # Model Context Protocol (MCP) server for agents
└── bench/                      # Agent fleet mass load testing harness

πŸš€ Quick Start (Phase 1 Preview)

Build from Source

git clone https://github.com/alex09x/prod-code.git
cd prod-code
cargo build --release

1. Launch the Server Daemon (on server)

# Bind to 10G interface
./target/release/prod-code-server --bind 0.0.0.0:9400 --storage /srv/prod-code/workspaces

2. Connect from Laptop / Agent Workstation

# Configure endpoint
export PROD_CODE_REMOTE=192.168.2.100:9400

# Check connectivity
./target/release/prod-code status

# Run as drop-in language server in your editor
./target/release/prod-code lsp

# Or run as an MCP server for AI coding agents
./target/release/prod-code mcp

πŸ—ΊοΈ Roadmap & Milestones

See ROADMAP.md for the active engineering plan:

  • Phase 1: Wire Protocol, 10G TCP Streaming & Path Translation.
  • Phase 2: In-Memory Rust Engine Core (ra_ap_ide::AnalysisHost + Direct-Edits).
  • Phase 3: Polyglot Hub (Managed Go gopls pool + Python/TS adapters).
  • Phase 4: Dual-Surface Gateway (LSP Multiplexer + Native Agent MCP Server).
  • Phase 5: Multi-Node Clustering, Sharding & 50-Worker Fleet Stress Verification.

πŸ‘€ Author

Alex (@alex09x) β€” alex@prod.codes


πŸ“„ License

Dual-licensed under either of:

at your option.

About

Remote Code Intelligence (RCI) gateway & daemon for AI agent fleets, multi-worktree parallelism, and polyglot development

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages