A multi-agent platform that discovers hardcoded strings in production codebases, localizes them without corrupting syntax, preserves code health over time, and optimizes translated copy for local search visibility.
Key Links & Quickstart
- Quick Demo: https://youtu.be/V51cDEqzdqw
- In-Depth Demo Video: Watch langPeanut in Action on YouTube
- Prerequisite: Set up an AI API key in your environment before initiating cloud inference.
- Github: https://github.com/HarmanPreet-Singh-XYT/langpeanut-ai
- Presentation: https://docs.google.com/presentation/d/e/2PACX-1vTmoL6M5o1eWTp7yPSOzlq31I8gTbdriz1iWoP4B4PJRn1EdtYct-Z5m0Rb1h-DyQIvIZ0ZEDhPTHY-/pub?start=false&loop=false&delayms=3000
The Problem
Retrofitting internationalization onto an existing codebase is a brittle, error-prone chore: developers must hunt down hardcoded strings across thousands of lines, manually author locale catalogs (.arb, .json, .xcstrings, strings.xml), and refactor source files to invoke the correct i18n APIs without damaging JSX/widget trees, ICU plurals, or formatting.
Standard approaches routinely fail:
- Regex extractors and naive single-prompt LLMs corrupt code: They strip comments, mangle component hierarchies, break string interpolation, and mistranslate
{placeholders}. - Whole-file regeneration introduces silent regressions: Allowing models to rewrite full source files creates AST drift, drops imports, and introduces syntax errors.
- Maintenance and search visibility remain fragmented: Once localized, catching key drift, pruning dead strings, and optimizing copy for local search intent require disconnected tools that teams rarely maintain.
What It Does
langPeanut treats localization as an AST boundary problem rather than a text translation problem. It coordinates three specialized agentic systems through a shared, high-performance Go core and on-disk project state, ensuring state changes propagate across all subsystems instantly.
System A — The Autonomous Localization Engine (8 Specialized Agents)
An execution DAG with resumable session state and automatic pre-run snapshots orchestrates end-to-end refactoring:
- AST Scout Extractor: Leverages dedicated tree-sitter grammars (TSX/JSX, Dart, Swift, Kotlin) to isolate translatable UI string literals while bypassing non-translatable code (
console.log, route paths, API endpoints, hex color codes, regex literals). - Semantic Context & Disambiguation Agent: Evaluates surrounding component trees and sibling nodes to disambiguate polysemous words (e.g., distinguishing
"Book"asreserveFlightBtnversusreadBookBtnin a booking app). - Deterministic AST Range Patch Engine: Calculates exact byte offsets to patch source files in-memory without altering adjacent whitespace, comments, or unedited code.
- Specialized Cultural Translator: Enforces cross-run translation memory, guarantees strict ICU/plural/placeholder preservation, and executes parallel per-locale workers.
- 4-Tier Verification Critic: Inspects AST syntax validity, ICU variable parity, character-expansion/UI-clipping risks, and cross-locale catalog parity before writing changes to disk.
- Autonomous Code Repair Agent: Diffs post-refactor compiler diagnostics against baseline builds, applies deterministic structural fixes, executes bounded repair iterations, and flags regressions for human review when necessary.
- Directive Agent: Executes contextual architectural instructions post-localization (such as auto-scaffolding language switchers) using an outline-and-window strategy to handle large files safely.
- Automated Lifecycle Maintenance Agents:
- Doctor: Evaluates overall project localization health on a 0–100 scale and bootstraps missing project configurations with
--fix. - Pruner: Cross-references active AST call sites to delete orphaned or unused translation keys.
- Persona Scout: Discovers brand voice guidelines from documentation to enforce consistent tone and preserve protected terminology.
System B — Central Agentic Copilot (19 Tools)
langPeanut chat provides a structured agentic control plane. An autonomous planning layer selects from 19 registered tools across multiple domains:
- Localization Operations:
scan_repository,execute_localization,verify_translations. - Search Optimization:
seo_analyze_competitor,seo_weave_copy. - System Maintenance:
manage_checkpoints,diagnose_system,prune_dead_keys. - Distributed Execution:
trigger_job,query_jobs.
A deterministic keyword-based routing layer maintains full command execution even in network-isolated environments. Tools execute via verified deterministic engines, preventing unvalidated file mutations. Results render as structured cards showing unified diffs, critic diagnostics, and cost metrics in both the terminal and the web Studio.
System C — Autonomous SEO & Growth Studio (5 Agents)
langPeanut seo optimizes translated copy directly for regional search behavior without manual export steps:
- SERP Scout: Discovers regional search competitor footprints.
- Keyword Intelligence: Evaluates local keyword search volume and user intent.
- Semantic Copy Weaver: Incorporates target search terms into localized copy while preserving ICU variables and layout integrity.
- SERP Simulator: Generates accurate previews of search result appearances across target markets.
- Growth Predictor Critic: Projects click-through rate adjustments and traffic impact.
Multi-Surface Interface & Execution
langPeanut delivers four coordinated operating surfaces:
- Command-Line Interface (CLI): Direct commands for CI/CD scripting, verification, and headless execution.
- Interactive Terminal UI (TUI): Real-time inspection of AST parsing, diff previews, and health scores in the console.
- Zero-Build Web Studio: Embedded single Go binary providing real-time telemetry, visual diffing, and Server-Sent Event (SSE) streaming without external node dependencies.
- Automated Git Integration: Ephemeral sandboxed execution in isolated containers, opening PRs with deterministically generated technical summaries.
Zero-Cost Offline Execution Path
All AST parsing, syntax isolation, and byte-level range patching run entirely offline through native tree-sitter compilation with zero network overhead. When cloud inference models are unconfigured, reasoning, translation, and SEO tasks fall back transparently to a local Ollama instance, enabling complete offline evaluation at zero API cost.
Technical Innovation: Constrained Agentic Mutations
langPeanut operates on a strict architectural principle: never permit an LLM to regenerate an entire file.
Prompt engineering cannot match deterministic compilers at preserving AST structural integrity or preventing escaped placeholders. In langPeanut, agentic intelligence handles only targeted semantic decisions—such as intent disambiguation and cultural tone adaptation. All code manipulations are executed by the deterministic AST Range Patch Engine, guaranteeing syntax safety.
Measured Performance & Validation
An automated 10-case adversarial test suite evaluates complex JSX component nesting, ICU plural expressions, polysemous phrases, and comment-dense files:
- langPeanut Engine: Achieves a 100% compilation pass rate with 0% unintended formatting drift.
- Regex & Zero-Shot LLM Baselines: Consistently trigger syntax errors, drop comments, or corrupt dynamic variables across the same test cases.
The benchmark suite is fully reproducible offline via ./langPeanut benchmark.
What's Next
- Broadened Framework Grammars: Expanding deep tree-sitter extraction and native patching to Vue, Svelte, and Jetpack Compose.
- Automated Visual Regression Sandboxes: Integrating automated headless browser rendering to visually detect and correct text-overflow clipping across compact UI elements.
- Bi-Directional TMS Synchronization: Expanding two-way continuous sync pipelines with enterprise translation management systems via automated webhooks.
Log in or sign up for Devpost to join the conversation.