Super Library Agent: Joint Generation and Maintenance of Multiple Applications Beyond the Single Codebase
Organizations: KAIST
Abstract
Organizations often develop and maintain portfolios of related applications: independently deployable codebases that share substantial domain logic, interface patterns, or operational conventions. As LLM coding agents are increasingly used to generate and maintain such software, a naive application-by-application workflow duplicates shared logic across codebases and allows prolonged agentic maintenance to accumulate verbosity, dead code, and structural erosion. We introduce the Super Library Agent problem, where an agent sequentially generates a portfolio of N related applications while maintaining a shared Super Library of reusable cross-application components. A minimal sequential scaffold can in principle extract shared code and migrate applications to the evolving library, but in practice suffers from low extraction recall and fragile dependency migration. We address these failures with candidate-guided extraction over code chunk summaries, pre-extraction codebase consolidation, and context-aware migration using extraction traces and call-graph information. Across WebGen-Bench and PaperBench, our method preserves application functionality while significantly reducing redundancy and token footprint (verbosity, token length) over zero-shot, and avoiding the structural erosion introduced by naive library construction, with additional reductions in LOC and MDL. Our code is available at https://github.com/sbigstar0310/super-library-agent.
Figures & tables
| Functionality | Maintainability | Library Size | |||||||
| Method | Acc. | Appr. | LOC | Tok | MDL | Eros. | Verb. | LOC | MDL |
| WebGen-Bench | |||||||||
| Zero-Shot | 76.04 | 3.84 | 9393 | 70364 | 34875 | 0.1032 | 0.1603 | – | – |
| Librarian ( ) | 75.09 | 3.90 | 9202 | 69492 | 34566 | 0.1266 | 0.1558 | 184 | 576 |
| Librarian ( ) | 75.78 | 3.89 | 8973 | 68159 | 33919 | 0.1352 | 0.1472 | 222 | 639 |
| Naive-Implicit | 76.95 | 3.89 | 9133 | 69777 | 35103 | 0.1567 | 0.1408 | 447 | 1212 |
| Patch Size | Functionality | |||||
| Method | Total | App | Lib | Orig. | Req. | Appr. |
| Zero-Shot | 936 | 936 | 0 | 77.9 | 81.9 | 3.93 |
| Librarian | 522 | 500 | 22 | 74.0 | 76.9 | 3.83 |
| Naive-Implicit | 632 | 618 | 14 | 76.9 | 82.9 | 3.82 |
| Naive-Ward | 380 | 363 | 18 | 77.7 | 81.1 | 3.95 |
| SLA-Full | 256 | 232 | 24 | 77.4 | 80.0 | 3.86 |
| No. of Apps | Total Exports | |||
| Method | 1–2 | 3–5 | 6–8 | |
| Librarian | 1.2 | 1.6 | 1.0 | 4.2 |
| Naive-Implicit | 1.3 | 3.6 | 2.7 | 8.2 |
| Naive-Ward | 1.4 | 3.3 | 2.0 | 7.2 |
| SLA-Full | 2.2 | 6.0 | 4.8 | 13.3 |
| Metric | w/o library | w/ library | ||
| App | Lib | |||
| UI acc. (%) | 80.95 | 84.35 | ||
| Appear. (0–5) | 3.83 | 3.92 | ||
| LOC | 8,256 | 6,567 | 750 | |
| MDL | 29,291 | 27,442 | 1,985 | |
Appendix figures & tables20 assets
Supplementary material from the paper’s appendix.
Appendix
| vs. Zero-Shot | vs. Librarian | vs. Naive-Implicit | vs. Naive-Ward | |||||
| Metric | [95% CI] | [95% CI] | [95% CI] | [95% CI] | ||||
| WebGen-Bench ( ) | ||||||||
| Acc. | -0.85 [-3.24, +1.38] | 0.484 | -1.14 [-3.07, +0.78] | 0.274 | +0.23 [-2.38, +2.60] | 0.864 | -1.04 [-3.23, +1.06] | 0.358 |
| Appear. | -0.028 [-0.125, +0.042] | 0.539 | +0.028 [-0.069, +0.125] | 0.575 | +0.028 [-0.056, +0.125] | 0.575 | +0.042 [-0.028, +0.125] | 0.328 |
| LOC | +105 [+54, +154] | 0.001 | +53 [+0, +102] | 0.059 | +73 [+28, +126] | 0.009 | +29 [+3, +56] | 0.044 |
| Tok | +591 [+275, +891] | 0.001 | +316 [-1, +633] | 0.068 | +518 [+232, +884] | 0.006 | +268 [+60, +492] | 0.028 |
| Suite | WebGen-Bench tasks |
| S1 Content Presentation Brochures & Portfolios | 1. [000019] SW solutions brochure. 2. [000075] Team projects & skills. 3. [000015] Clinical office info. 4. [000016] Solar company products. 5. [000040] Consulting & training. 6. [000072] Personal CV/resume. 7. [000071] Designer portfolio. 8. [000064] Shipping news blog. |
| S2 Data Management CRUD / ERP / CRM | 1. [000085] Construction project mgmt. 2. [000022] Customer-service call log. 3. [000046] Hospital admin & inventory. 4. [000083] Detective agency case mgmt. 5. [000047] E-government office system. 6. [000044] Supply-chain traceability. 7. [000023] CRM sales lead tracking. 8. [000080] Advanced to-do list app. |
| S3 User Interaction Social & Job Platforms | 1. [000052] Blue-collar job board. 2. [000090] Social networking site. 3. [000051] Driver recruitment listings. 4. [000077] Engineer tool info site. 5. [000092] Skill-sharing platform. 6. [000053] Student internship portal. 7. [000091] Matrimonial matching site. 8. [000027] Promotions & discounts forum. |
| Suite | PaperBench tasks |
| S1 | 1. fre : Functional Reward Encodings. 2. rice : RICE. 3. sapg : Split and Aggregate Policy Gradients. 4. ftrl : RL Fine-tuning as Forgetting Mitigation. |
| S2 | 1. robust-clip : Robust CLIP. 2. sample-specific-masks : Sample-specific Masks. 3. lca-on-the-line : OOD Generalization. 4. test-time-model-adaptation : Test-Time Adaptation. |
| S3 | 1. mechanistic-understanding : DPO and Toxicity. 2. what-will-my-model-forget : Forgotten Examples. 3. stay-on-topic-with-classifier-free-guidance : CFG. 4. adaptive-pruning : Adaptive Pruning and Tuning. |
| S4 | 1. bridging-data-gaps : Diffusion Transfer Learning. 2. sequential-neural-score-estimation : Neural Score Estimation. 3. stochastic-interpolants : Data-Dependent Couplings. 4. all-in-one : Simulation-Based Inference. |
| S5 | 1. bam : Batch-and-Match Variational Inference. 2. pinn : Training PINNs Loss Landscapes. 3. lbcs : Refined Coreset Selection. 4. bbox : BBox-Adapter for Black-Box LLMs. |
| Metric | Suite | Zero | Librarian | Naive | Full | |
| Implicit | Ward | |||||
| Functionality | ||||||
| Acc. | S1 | 82.99 2.12 | 81.97 1.56 | 83.67 0.00 | 83.67 3.68 | 83.33 2.12 |
| S2 | 70.28 2.55 | 70.83 2.21 | 70.83 3.00 | 70.00 4.64 | 72.22 3.37 | |
| S3 | 74.85 0.52 | 74.55 1.82 | 76.36 1.57 | 74.54 3.96 | 76.06 2.62 | |
| Avg. | 76.04 5.82 | 75.78 5.17 | 76.96 5.83 | 76.07 7.00 | 77.21 5.44 | |
| Metric | Suite | Zero | Librarian | Naive | Full | |
| Implicit | Ward | |||||
| Functionality | ||||||
| Score | S1 | 0.3409 0.0918 | 0.3539 0.0476 | 0.3393 0.0822 | 0.3918 0.0594 | 0.3690 0.0456 |
| S2 | 0.4394 0.0127 | 0.3924 0.0137 | 0.4885 0.0382 | 0.4557 0.0269 | 0.4584 0.0104 | |
| S3 | 0.4461 0.0193 | 0.4420 0.0406 | 0.4006 0.0154 | 0.3958 0.0799 | 0.4160 0.0597 | |
| S4 | 0.5909 0.0564 | 0.5801 0.0772 | 0.6071 0.0701 | 0.5392 0.0650 | 0.5751 0.0683 | |
| Patch | Change in maintainability | Patch Size by suite | ||||||||||
| Method | Added LOC | App | Lib | Files | LOC | Tok | MDL | Eros. | Verb. | S1 | S2 | S3 |
| Zero-Shot | 936 | 936 | 0 | 29.8 | 605 | 5101 | 2565 | 0.004 | 0.007 | 182 | 1804 | 822 |
| Librarian | 522 | 500 | 22 | 27.0 | – | – | – | – | – | 151 | 717 | 699 |
| Naive-Implicit | 632 | 618 | 14 | 27.4 | 278 | 2874 | 2078 | 0.019 | 0.005 | 97 | 1328 | 471 |
| Naive-Ward | 380 | 363 | 18 | 22.2 | 251 | 2779 | 1909 | 0.030 | 0.011 | 103 | 574 | 463 |
| SLA-Full | 256 | 232 | 24 | 19.9 | 171 | 2073 | 1377 | 0.001 | 0.003 | 79 | 422 | 268 |
| App ID | Action | Expected result |
| 000015 | Go to the Contact Us page. In the contact form, fill the Name and Message fields but leave Email empty (or whitespace only), then submit. | An inline error message appears, no success/confirmation state is shown, and the values already typed in Name and Message remain in the fields. |
| 000015 | On the same contact form, fill Name, a valid Email containing “@” and “.”, and Message, then submit. | An in-page confirmation appears on the Contact Us page without navigating away, containing the word “Received” or “Submitted” and including the submitted name or email. |
| 000016 | Go to the Contact page. In the contact form, enter a Name and Message but type an invalid email without “@” or “.” (e.g., “testmail”), then submit. | A clear inline error appears for the email field, no confirmation banner is shown, and the typed Name, Email, and Message values remain in the inputs. |
| 000016 | Correct the email to a valid address containing “@” and “.”, then submit the form. | An in-page confirmation banner appears on the Contact page without navigating away, containing “Received” or “Submitted” together with the submitted name or email. |
| 000019 | Go to the Contact page. Submit the contact form with the “How can we help?” field empty while Name and Email are filled. | An inline error message appears, no confirmation is shown, and all values typed so far, including Company if entered, are preserved in the form. |
| 000019 | Fill Name, a valid Email containing “@” and “.”, and the “How can we help?” field, then submit. | An in-page confirmation appears on the Contact page without navigating away, including “Received” or “Submitted” plus the submitted name or email. |
| App ID | Action | Expected result |
| 000022 | Create a new call log via the New Call form with required fields filled. | A confirmation message appears, and the new call log displays a human-readable ID with the CALL- prefix (e.g., CALL-001) and a “Last updated” timestamp. The call appears in the Open Calls or To-Do Calls view. |
| 000022 | Modify an existing client’s information (or close/mark done an existing call). | A confirmation message appears and the record’s “Last updated” timestamp refreshes to reflect the change. |
| 000023 | Create a new lead via the New Lead form/modal with valid details. | A confirmation message appears, and the new lead is shown with a LEAD- prefixed ID (e.g., LEAD-001) and a “Last updated” timestamp or date, visible in the leads table. |
| 000023 | Change that lead’s status (or edit it), then locate it using the leads search or filters. | A confirmation appears, the “Last updated” value refreshes, and the lead is findable via search/filter with its LEAD- ID still displayed. |
| 000044 | Register a new product via the registration form. | A confirmation message appears and the product’s SCT- prefixed ID is displayed immediately upon registration. |
| 000044 | Add a checkpoint to that product on the Track screen, then look it up on the Inquiry screen. | A confirmation appears for the checkpoint, the product’s “Last updated” line refreshes, and the product is findable via the Inquiry search with its updated status. |
| App ID | Action | Expected result |
| 000027 | Share a new promotion using the share form with all necessary details. | A confirmation message appears, and the new promotion is visible in the browse list carrying a visible “Pending review” badge or status text. It is not hidden. |
| 000027 | Search for that promotion using its title typed in mixed case with leading and trailing spaces, then search for a nonsense string such as “zzqqxx”. | The mixed-case padded query still returns the promotion. The nonsense query shows a clear empty-state message instead of a blank area or all deals. |
| 000051 | Post a new job as a client with all required details. | A confirmation appears, and the new listing shows a visible “Pending review” badge while still appearing on the jobs board and in the client’s active-postings list. |
| 000051 | Search the jobs page for that job’s title typed in mixed case with surrounding spaces, then search for a nonsense string. | The padded mixed-case query returns the job. The nonsense query shows a clear empty-state message instead of a blank list or all jobs. |
| 000052 | On the jobs page, search for “ELECTRICIAN ” (upper case with trailing spaces), then search for a nonsense string such as “zzqqxx”. | The padded upper-case query returns the electrician listings. The nonsense query shows a clear empty-state message such as “No jobs match your search” instead of a blank grid or all listings. |
| 000053 | As a company, post a new internship position. | A confirmation appears, and the new listing shows a visible “Pending review” badge while remaining visible on the student browse list and in the company’s listings. |
| Method | WebGen | PaperBench |
| Zero-Shot | 1.0 | 1.0 |
| Librarian ( ) | 5.9 | 3.2 |
| Naive-Implicit | 3.1 | 1.7 |
| Naive-Ward | 2.9 | 1.7 |
| SLA-Full | 8.3 | 3.1 |
| Cost | Functionality | Maintainability | ||||||
| Migration configuration | Total (\downarrow$ | Migr. turns | Acc. | Appr. | LOC | MDL | Eros. | Verb. |
| Fresh sessions | 0.453 | 485 | 75.4 | 3.78 | 8598 | 34473 | 0.094 | 0.104 |
| Reused sessions | 0.400 | 354 | 76.0 | 3.88 | 8760 | 35122 | 0.104 | 0.114 |
| (%) | 11.7 | 27.0 | 0.8 | 2.6 | 1.9 | 1.9 | 11.1 | 10.0 |
| 0.017 | 0.002 | 0.749 | 0.064 | 0.348 | 0.553 | 0.410 | 0.536 | |
| Rounds | Cost | Acc. | LOC | Verb. | |
| 2 | 4 | 8.30 | 77.21 | 8552 | 0.099 |
| 4 | 2 | 6.55 | 73.97 | 8643 | 0.095 |
| 8 | 1 | 4.93 | 74.44 | 8932 | 0.110 |
| Zero-Shot | Naive-I | Naive-W | SLA-Full | |
| Functionality | ||||
| Acc. | 79.17 | 74.51 | 81.68 | 77.45 |
| Appr. | 3.92 | 3.86 | 3.90 | 3.91 |
| Maintainability | ||||
| LOC | 10,957 | 11,305 | 11,152 | 10,581 |
| Tok | 80,796 | 85,795 | 85,930 | 80,185 |
| Zero-Shot | Naive-I | Naive-W | SLA-Full | |
| Functionality | ||||
| Acc. | 69.02 | 62.58 | 63.37 | 65.88 |
| Appr. | 3.66 | 3.48 | 3.52 | 3.29 |
| Maintainability | ||||
| LOC | 23,263 | 20,744 | 19,900 | 18,557 |
| Tok | 177,022 | 163,063 | 157,096 | 147,844 |
| Functionality | Maintainability | |||||||
| Method | Scaffold | Acc. | Appr. | LOC | Tok | MDL | Eros. | Verb. |
| Zero-Shot | mini-SWE-agent | 76.04 | 3.84 | 9393 | 70364 | 34875 | 0.1032 | 0.1603 |
| Zero-Shot | OpenHands | 77.34 | 3.92 | 8948 | 68528 | 34926 | 0.0732 | 0.1489 |
| Zero-Shot | Claude Code | 78.20 | 3.86 | 8712 | 67857 | 34009 | 0.1125 | 0.1349 |
| SLA-Full | mini-SWE-agent | 77.21 | 3.86 | 8552 | 65633 | 34195 | 0.0987 | 0.0994 |
| Method | Trial | # | Exported symbols with reuse rate |
| Naive-Implicit | T1 | 6 | Footer (100%), Header (88%), ContactForm (62%), PillNav (50%), useLocalStorage (50%), SkillBar (25%). |
| Naive-Implicit | T2 | 5 | Footer (100%), Header (88%), ContactForm (62%), useLocalStorage (62%), SkillBar (25%). |
| Naive-Implicit | T3 | 6 | Footer (100%), ContactForm (50%), NavBar (50%), FilterGroup (38%), useLocalStorage (38%), SkillBar (25%). |
| Naive-Ward | T1 | 4 | Footer (100%), Header (62%), ContactSection (38%), SkillsSection (25%). |
| Naive-Ward | T2 | 5 | Footer (100%), Header (88%), ContactForm (62%), SkillsChart (25%), useLocalStorage (25%). |
| Naive-Ward | T3 | 7 | Footer (88%), Header (62%), ContactForm (50%), Section (38%), loadStorage (38%), saveStorage (38%), SkillBar (25%). |
| Method | Trial | # | Exported symbols with reuse rate |
| Naive-Implicit | T1 | 10 | Button (100%), FormField (88%), Card (75%), useLocalStorage (75%), ErrorMsg (62%), NavBar (50%), StatusPill (50%), SearchInput (38%), loadStorage (0%), saveStorage (0%). |
| Naive-Implicit | T2 | 10 | useLocalStorage (100%), Button (88%), Card (88%), FormField (75%), KpiCard (75%), Footer (50%), NavBar (50%), SearchBar (38%), PageHeader (12%), DataTable (0%). |
| Naive-Implicit | T3 | 9 | Footer (100%), Header (100%), NavBar (88%), Badge (62%), useLocalStorage (62%), Card (50%), loadStorage (38%), saveStorage (12%), StatCard (0%). |
| Naive-Ward | T1 | 7 | Button (88%), Card (88%), useLocalStorage (62%), Footer (50%), Header (50%), NavBar (50%), Sidebar (25%). |
| Naive-Ward | T2 | 9 | Button (100%), Card (88%), useLocalStorage (75%), FormField (62%), StatusPill (62%), StatCard (50%), Table (50%), NavTabs (38%), Alert (12%). |
| Naive-Ward | T3 | 14 | Button (88%), useLocalStorage (75%), Card (62%), StatCard (62%), Badge (50%), FormGroup (50%), NavBar (50%), DataTable (38%), PageHeader (25%), SearchBar (25%), Sidebar (25%), EmptyState (12%), loadData (0%), saveData (0%). |
| Method | Trial | # | Exported symbols with reuse rate |
| Naive-Implicit | T1 | 8 | Alert (100%), loadStorage (100%), saveStorage (100%), Footer (62%), FileInput (38%), SearchBar (38%), useFileUpload (25%), useLocalStorage (0%). |
| Naive-Implicit | T2 | 12 | Alert (100%), FormField (100%), useLocalStorage (100%), validateRequired (50%), FilePicker (38%), Button (25%), SearchBar (25%), validateEmail (25%), validateMinLength (25%), Modal (12%), Pill (12%), Footer (0%). |
| Naive-Implicit | T3 | 8 | useFormValidation (75%), Footer (62%), createKeyedStorage (50%), loadStorage (50%), saveStorage (50%), Chip (38%), FileUpload (38%), SearchFilter (38%). |
| Naive-Ward | T1 | 5 | Header (100%), loadStorage (100%), saveStorage (100%), Footer (75%), FormField (75%). |
| Naive-Ward | T2 | 8 | Button (62%), Footer (62%), FormField (62%), createAuthContext (62%), Modal (25%), useLocalStorage (12%), getStorage (0%), setStorage (0%). |
| Naive-Ward | T3 | 6 | loadJSON (100%), saveJSON (100%), Footer (62%), ImageUpload (38%), LoginForm (38%), RegisterForm (25%). |
| Artifact | License | Use |
| WebGen-Bench | MIT | eval suite |
| PaperBench | MIT | eval suite |
| WebVoyager | Apache 2.0 | UI runner |
| mini-SWE-agent | MIT | harness |
| cocoindex-code | Apache 2.0 | indexing |
| Qwen2.5-7B | Apache 2.0 | MDL ref. |