{"slug": "anahata-asi-an-in-jvm-java-agent-for-netbeans-with-runtime-compilation-and-gc", "title": "Anahata ASI: An In-JVM Java Agent for NetBeans with Runtime Compilation and Context GC", "summary": "Anahata OS released Anahata ASI, an Apache 2.0 pure-Java AI agent container that runs inside the target JVM, primarily as an Apache NetBeans plugin (Plugin Portal #135, NetBeans 28–35+, Java 21+) with a standalone desktop build and early IntelliJ support. The agent compiles Java snippets in memory against the active project classpath, including on-the-fly Maven Central dependency resolution, loads them through a child-first AgiClassLoader, and feeds NetBeans javac diagnostics back into its loop; it manages long sessions with a context-window garbage collector that prunes stale tool outputs and compacts history into \"Semantic Ghosts.\" The full Studio .nbm bundle is about 140 MB and targets NetBeans 30–31+ for the full bundle, and every tool execution stages in a PENDING human-in-the-loop state because in-IDE compilation and OS/WebDriver tools are high-privilege.", "body_md": "Most AI coding tools today wrap an external Node or Python CLI around your editor and interact with Java code via regex and raw text diffs. Over the past year we built [**Anahata ASI**](https://github.com/anahata-os/anahata-asi) (Apache 2.0), a pure-Java agent container that runs directly inside the target JVM—primarily as an [**Apache NetBeans plugin**](https://asi.anahata.uno/nb.html) (Plugin Portal `#135`, NetBeans 28–35+, Java 21+), with a standalone desktop build and early IntelliJ support.\n\nInstead of bridging out to a separate Python runtime, embedding the agent directly inside the IDE JVM unlocks a few interesting JVM-native patterns:\n\n### 1. In-JVM Compilation & Child-First Classloading (`NbJava`)\n\nRather than constraining the model strictly to pre-baked JSON tool schemas, the agent can write Java snippets, compile them in memory against the active project classpath (including resolving Maven Central dependencies on the fly), and load them through a child-first `AgiClassLoader` inside the running JVM.\n\nIn practice, this turns the agent loop into a compiler-in-the-loop workflow: it hooks directly into NetBeans `javac` diagnostics so compilation errors feed back into the loop automatically until edits build cleanly.\n\n### 2. AST-Guided Refactoring Instead of Line Patches\n\nString-based diff patching routinely mangles formatting and comments in large Java classes. Inside NetBeans, the agent delegates structural edits to NetBeans' own AST and Refactoring APIs so batch refactors preserve exact indentation and inline comments.\n\n### 3. Context Window Garbage Collection (`CwGC`)\n\nLong multi-turn sessions normally hit token walls or degrade via naive sliding-window truncation. We modeled context management a bit like generational GC: tracking part-level depth decay across turns, pruning stale tool outputs, and compacting older history into compact \"Semantic Ghosts,\" paired with Kryo session persistence and plain `.md` history backups.\n\n### 4. Models, Local Execution & Honest Tradeoffs\n\nIt works with **Ollama / vLLM** on `localhost` (no tunnels required) as well as Gemini, Claude, OpenAI, DeepSeek, and OpenRouter. Because running dynamic Java compilation and OS/WebDriver tools inside an IDE JVM is inherently **high-privilege**, every tool execution stages in a `PENDING` human-in-the-loop state so you inspect and edit arguments or diffs before anything runs.\n\nThe biggest practical tradeoff right now is footprint and version coupling: bundling Swing/JavaFX multimodal tooling, browser automation, and provider SDKs makes the full Studio `.nbm` around **140 MB** and targets recent NetBeans releases (NB 30–31+ for the full Studio bundle).\n\nIf you want to see what the loop looks like in practice—like building a live [3D JavaFX ADS-B flight tracker](https://www.youtube.com/@anahata108) inside NetBeans—the full 13-module Maven reactor is on [GitHub](https://github.com/anahata-os/anahata-asi). Curious how other JVM devs feel about in-IDE agents vs. external CLI harnesses like Claude Code or MCP servers.", "url": "https://wpnews.pro/news/anahata-asi-an-in-jvm-java-agent-for-netbeans-with-runtime-compilation-and-gc", "canonical_source": "https://bytecode.news/posts/2026/11/anahata-asi-an-in-jvm-java-agent-for-netbeans-with-runtime-compilation-and-context-gc", "published_at": "2026-11-24 15:35:00+00:00", "updated_at": "2026-11-24 15:48:18.777301+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "developer-tools", "artificial-intelligence"], "entities": ["Anahata ASI", "Anahata OS", "Apache NetBeans", "NetBeans Plugin Portal", "AgiClassLoader", "IntelliJ", "Ollama", "vLLM"], "also_reported_by": [], "takeaway": "Anahata ASI runs the agent inside the IDE JVM, compiling Java snippets in memory against the project classpath and feeding NetBeans javac diagnostics back into the loop until edits build cleanly, with every tool call staged in a PENDING human-in-the-loop state before execution.", "recommendation": null, "alternates": {"html": "https://wpnews.pro/news/anahata-asi-an-in-jvm-java-agent-for-netbeans-with-runtime-compilation-and-gc", "markdown": "https://wpnews.pro/news/anahata-asi-an-in-jvm-java-agent-for-netbeans-with-runtime-compilation-and-gc.md", "text": "https://wpnews.pro/news/anahata-asi-an-in-jvm-java-agent-for-netbeans-with-runtime-compilation-and-gc.txt", "jsonld": "https://wpnews.pro/news/anahata-asi-an-in-jvm-java-agent-for-netbeans-with-runtime-compilation-and-gc.jsonld"}}