Command Palette
Search for a command to run...
スーパーライブラリエージェント:単一コードベースを超えた複数アプリケーションの統合的生成と保守
スーパーライブラリエージェント:単一コードベースを超えた複数アプリケーションの統合的生成と保守
Daegyu Sung Yukyeong Lee Geon Park Yumin Choi Sung Ju Hwang
概要
組織はしばしば、相当量のドメインロジック、インタフェースパターン、または運用上の慣習を共有する、独立してデプロイ可能なコードベース群である関連アプリケーションのポートフォリオを開発・保守する。LLMコーディングエージェントがそのようなソフトウェアの生成と保守にますます利用されるようになるにつれ、アプリケーションごとに単純に作業を行うワークフローでは、共有ロジックがコードベース間で重複し、長期にわたるエージェントによる保守によって冗長性、デッドコード、構造的劣化が蓄積されることが許容されてしまう。我々は、エージェントが再利用可能なクロスアプリケーションコンポーネントからなる共有スーパーライブラリを保守しながら、N個の関連アプリケーションのポートフォリオを逐次的に生成する、スーパーライブラリエージェント問題を導入する。最小限の逐次的な足場は、原理的には共有コードを抽出し、アプリケーションを進化するライブラリへ移行させることができるが、実際には低い抽出再現率と脆弱な依存関係移行に悩まされる。我々は、コードチャンク要約に基づく候補誘導抽出、抽出前のコードベース統合、抽出トレースと呼び出しグラフ情報を用いた文脈認識移行によって、これらの失敗に対処する。WebGen-BenchとPaperBenchにわたる評価において、我々の手法は、ゼロショットと比較してアプリケーションの機能性を維持しながら冗長性とトークンフットプリント(冗長性、トークン長)を大幅に削減し、単純なライブラリ構築によって導入される構造的劣化を回避し、LOCとMDLの追加的な削減を達成する。
One-sentence Summary
Researchers from KAIST and DeepAuto.ai introduce the Super Library Agent problem, which involves sequentially generating a portfolio of N related applications while maintaining a shared Super Library, and address extraction failures with candidate-guided extraction over code chunk summaries, pre-extraction consolidation, and context-aware migration, preserving functionality while reducing redundancy and token footprint on WebGen-Bench and PaperBench.
Key Contributions
- The Super Library Agent problem is formulated as an online setting where a coding agent sequentially builds a portfolio of related applications while maintaining a shared Super Library of reusable cross-application components.
- To overcome low extraction recall and fragile dependency migration, candidate-guided extraction uses summarized code chunk indexes and LLM-based candidate selection, and context-aware migration supplies extraction traces and call-graph information to a dependency-migration agent.
- Evaluations on WebGen-Bench and PaperB ench show that the method preserves application functionality, reduces redundancy and token footprint, and improves maintainability metrics, library utilization, and abstraction quality over zero-shot and naive library baselines.
Introduction
The authors address the challenge of using LLM coding agents to build and maintain portfolios of related applications, where independent generation duplicates shared logic and violates DRY principles. This duplication is amplified by LLM-induced code slop, making maintenance across many applications increasingly brittle. Prior library learning techniques treat abstraction as a post-hoc step over existing codebases or assume a single project, leaving the multi-repo, online setting unexplored. The key contribution is the Super Library Agent problem formulation and a scaffold that tackles two core obstacles: low extraction recall when identifying reusable components across divergent implementations, and fragile dependency migration when those components are moved into a shared library. The authors introduce candidate-guided extraction using summarized code indexes and an LLM‑based selector, paired with context-aware migration that leverages extraction traces and call‑graph information to safely update imports and call sites.
Method
The authors formalize the Super Library Agent problem as a sequential multi-application construction task. Given a stream of application requests x1,…,xN, an agent must build each codebase while progressively maintaining a shared Super Library Lt. At step t, with previous codebases C<t and the library Lt−1, the agent produces the new codebase ct, an updated library Lt, and patched previous codebases C<t′:
(ct,C<t′,Lt)=A(xt,C<t,Lt−1).The ideal library Lt⋆ contains every component used by at least two applications, while application-specific code stays local. The agent is optimized for a Pareto trade-off between functionality (request satisfaction) and maintainability (proper extraction, deduplication, reuse, and consistency across the joint codebase).
The minimal agentic scaffold, used as a naive baseline, tackles this mapping with two coarse phases per step. A coding agent generates an initial codebase ct0 from the request xt, reusing existing library components when possible. Then a single library agent jointly extracts shared components into the Super Library and migrates all previous codebases to use the updated library, producing Lt, ct, and C<t′. This undifferentiated hand-off suffers from low recall in identifying reusable blocks and the risk of breaking existing applications during migration.
To overcome these limitations, the augmented scaffold decomposes the single library phase into two specialized agents: a library-extraction agent and a dependency-migration agent. The extraction agent is responsible for updating Lt; the migration agent patches previous codebases. They are supported by two complementary strategies.
First, index-based candidate extraction shifts from surface-form matching to semantic-level reasoning. Code blocks from every codebase and the library are identified via AST boundaries (functions, classes, modules) and summarized in natural language by an LLM, producing a compact code-summary index. A dedicated LLM-based candidate selector then compares these summaries for two tasks: extraction candidates (blocks used across multiple applications) and migration candidates (library symbols paired with local blocks they can replace). Before cross-application extraction, a one-time consolidation refactors duplicated local code within each new application, further refining the index.
Second, context-aware dependency migration bridges the extraction and migration agents and aligns local edits. The extraction agent produces a structured extraction trace for each new or updated library symbol, recording its origin, the generalized pattern, and a replacement guide. This trace is forwarded to the migration agent, obviating the need to rediscover correspondences. Additionally, a call-graph conditioning step attaches an “also-refactor” list to every migration candidate, including relevant import declarations and caller/callee relationships. This prompts the agent to update dependencies, remove dead code, and eliminate obsolete local implementations, reducing broken references and duplication. Together, these strategies enable the system to iteratively refactor the codebase portfolio into a maintainable, library-driven structure.
Experiment
The evaluation uses sequential coding task suites from WebGen-Bench and PaperBench to compare a Super Library Agent that incrementally builds a shared library against zero-shot generation and post-hoc library construction. SLA-Full consistently achieves the best maintainability metrics—lower code size, structural erosion, and verbosity—while preserving application functionality, and it markedly reduces patch size during shared policy updates by centralizing changes in the library. Ablation studies show that summary-guided candidate selection, pre-extraction consolidation, and call-graph-conditioned migration each improve library quality, enabling the library to capture diverse behavioral and domain-level abstractions beyond simple UI primitives. Additionally, a mature Super Library can act as a reuse prior to improve future application generation accuracy and compactness.
All methods achieve comparable functionality on WebGen-Bench, indicating library use does not harm task performance. SLA-FULL obtains the best maintainability scores (LOC, token length, erosion, verbosity) with statistically significant reductions versus zero-shot, while LIBRARIAN's best-of-K selection lowers MDL but increases erosion. On PaperBench, SLA-FULL achieves the lowest values on all five maintainability metrics while retaining comparable code-dev scores, and naive unguided extraction variants reduce some size metrics but concentrate complexity into shared components. Zero-shot, LIBRARIAN, and naive variants all reach similar accuracy (75–77) and appearance (≈3.9) on WebGen-Bench. SLA-FULL achieves the best maintainability results, significantly reducing LOC, token length, and verbosity relative to zero-shot. LIBRARIAN (K=8) attains the lowest MDL but increases erosion above zero-shot, rather than reducing it. Naive-Implicit and Naive-Ward reduce LOC and tokens but suffer higher erosion, suggesting unguided library extraction concentrates complexity. On PaperBench, SLA-FULL scores lowest on all five maintainability metrics while keeping code-dev scores comparable to other methods. LIBRARIAN's post-hoc MDL selection on PaperBench yields no MDL or functionality improvement over zero-shot.
SLA-FULL requires the smallest total patch size by centralizing shared updates in the Super Library, substantially reducing application-level edits. The other methods apply larger patches directly to applications, while post-patch pass rates and appearance quality remain comparable across all approaches. This shows that library-centric maintenance can streamline changes without compromising functionality. SLA-FULL yields the smallest overall patch size, with most changes applied to the shared library rather than individual applications. Original and requested behavior pass rates are similar across methods, indicating that the smaller patches do not degrade functionality.
Natural-language summary-based candidate selection gives the best maintainability scores among naive strategies, and SLA-FULL further improves accuracy by adding call-graph conditioning and pre-extraction codebase consolidation. The resulting Super Library is larger, more broadly reused, and captures richer abstraction layers beyond primitive UI widgets, yielding less redundancy and better downstream application generation. The natural-language summary approach identifies the largest number of shared components and achieves top scores on four of five maintainability metrics. Dropping pre-extraction consolidation increases verbosity, structural erosion, and total lines of code, showing it helps the library agent abstract components within a single codebase. Removing call-graph conditioning hurts migration accuracy, leaves dead code, and raises verbosity and erosion, indicating structural caller-callee context is essential for clean dependency replacement. SLA-FULL exports more library components that are reused by many applications and extracts behavioral hooks and page-level patterns, while naive methods stay limited to shallow UI widgets and thin utilities. Over sequential rounds, SLA-FULL steadily reduces each application's local code, whereas a naive shared library shows a flatter trajectory without reliable candidate discovery and migration.
SLA-FULL produces a substantially larger Super Library than naive variants, with roughly 60% more exported components on average. It also achieves broader reuse, with many more components shared across 3–5 and 6–8 applications. This expansion reflects extraction of higher-level abstractions beyond primitive UI elements, which later helps generate more accurate applications with less total code. SLA-FULL exports about 13 components on average, compared to 7–8 for the naive methods. Exports reused by 6–8 apps more than double, rising from approximately 2–3 in naive variants to nearly 5 in SLA-FULL.
When a vanilla coding agent uses a mature Super Library to generate content-presentation applications, UI accuracy rises substantially and application-local code shrinks. Even after accounting for the added library code, total lines of code decrease by approximately 11%, with only a marginal change in maintainability. UI accuracy improved from 80.95% to 84.35% with library access. Total lines of code (application plus library) fell by roughly 11%, despite the library's own contribution.
Experiments on WebGen-Bench and PaperBench evaluate the Super Library approach for multi‑application code generation and maintenance. SLA‑FULL consistently achieves the best maintainability scores with significantly lower code size, token length, erosion, and verbosity compared to zero‑shot baselines, while all methods attain comparable functional accuracy and appearance, confirming that library‑oriented structuring does not harm task performance. Ablations show that call‑graph conditioning and pre‑extraction consolidation are essential for extracting richer, more reusable abstractions beyond shallow UI widgets, resulting in a substantially larger Super Library that is shared by more applications and drives steady application‑local code reduction across rounds. Maintenance evaluations further demonstrate that centralizing edits in the library yields the smallest total patch sizes without degrading pass rates, and a downstream coding agent equipped with this mature library obtains higher UI accuracy and an overall 11% reduction in total lines of code.