Hierarchical Skill Evolution for Coding Agent
Abstract
Skills provide agents with reusable experience to guide future decisions without modifying the underlying model. However, coding trajectories are often entangled with task- and repository-specific contexts, making it challenging to distill procedural skills that generalize across diverse coding environments. To address this challenge, we present Hierarchical Skill Evolution (HSE), which progressively distills procedural knowledge from coding trajectories through hierarchical evidence aggregation. HSE first extracts task-level evidence from individual trajectories, then aggregates recurring evidence within the same repository to form repository-specific skill candidates, and finally consolidates consistent patterns across repositories into transferable skills across repositories. The evolution is driven by an external writer-evaluator loop that generates and assesses skills while keeping the underlying coding model frozen. The loop externally updates the writer and evaluator policies to improve subsequent skill generation and assessment. This hierarchy progressively filters task-specific details while preserving procedures that generalize across diverse coding environments. Successful trajectories yield reusable guidance for future tasks, while failed trajectories reveal recurring failure modes that guide avoidance and recovery. We evaluate HSE on SWE-bench Verified and DeepSWE, using GLM-5.2 across Pi and Claude Code harnesses and GPT-5.5 and Opus 4.8 with Pi. Across both benchmarks, 10 skills evolved solely from SWE-Gym improve coding performance across all evaluated settings, demonstrating transfer across benchmarks, coding models, and agent harnesses. We further evolve the skill library from target-benchmark trajectories without verifier feedback, relying solely on the learned evaluator for candidate assessment and achieving additional gains through benchmark-tailored skills.
Figures & tables
| Benchmark | Harness | No Skills | SWESkillsBench | GEPA | ReasoningBank | HSE |
|---|---|---|---|---|---|---|
| SWE-bench Verified | Pi | |||||
| CC | ||||||
| DeepSWE | Pi | |||||
| CC |
| Benchmark | Harness | HSE | Gate 1 | Gate 2 | Gate 3 | Gate 4 | Gate 5 | Gate 6 | Gate 7 | Gate 8 |
|---|---|---|---|---|---|---|---|---|---|---|
| SWE-bench Verified | Pi | |||||||||
| CC | ||||||||||
| DeepSWE | Pi | |||||||||
| CC |
| Benchmark | Harness | No Skills | HSE | w/o Procedural Skills | w/o Recovery Skills |
|---|---|---|---|---|---|
| SWE-bench Verified | Pi | 73.5 | 75.4 | 74.2 ( ) | 74.6 ( ) |
| CC | 76.1 | 80.6 | 77.0 ( ) | 79.0 ( ) | |
| DeepSWE | Pi | 43.1 | 48.7 | 45.1 ( ) | 43.4 ( ) |
| CC | 44.8 | 52.5 | 47.8 ( ) | 46.9 ( ) |
| SWE-bench Verified | DeepSWE | |||
|---|---|---|---|---|
| Method | Pi | CC | Pi | CC |
| HSE | 75.4 | 80.6 | 48.7 | 52.5 |
| w/o Hierarchical Aggregation | 74.2 | 78.6 | 46.9 | 48.7 |
| w/o Controller Updates | 74.8 | 79.2 | 46.9 | 50.4 |
| In-harness | Transfer harness | ||||||
|---|---|---|---|---|---|---|---|
| Benchmark | Harness | HSE | Harness | No Skills | HSE | ||
| SWE-bench Verified | Pi | 75.4 | CC | 76.1 | 79.2 | ||
| CC | 80.6 | Pi | 73.5 | 80.4 | |||
| DeepSWE | Pi | 48.7 | CC | 44.8 | 49.6 | ||
| CC | 52.5 | Pi | 43.1 | 50.4 | |||
| Model | Method | SWE-bench Verified | DeepSWE |
|---|---|---|---|
| GPT-5.5 | No Skills | 82.6 | 67.2 |
| HSE | 85.4 | 73.5 | |
| Opus 4.8 | No Skills | 88.6 | 59.3 |
| HSE | 90.2 | 61.1 |
Appendix figures & tables8 assets
Supplementary material from the paper’s appendix.
Appendix
| SWE-bench Verified | DeepSWE | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Harness | Method | Generation | Prefilling | Steps | Total | Generation | Prefilling | Steps | Total |
| Pi | No Skills | 2.1K | 312.5K | 52.4 | 314.7K | 8.3K | 2.4M | 141.9 | 2.4M |
| SWESkillsBench | 3.4K | 578.8K | 79.2 | 582.2K | 14.8K | 4.6M | 223.6 | 4.6M | |
| HSE | 2.5K | 382.6K | 58.4 | 385.1K | 9.0K | 2.8M | 151.6 | 2.8M | |
| CC | No Skills | 3.4K | 450.6K | 59.2 | 454.0K | 12.3K | 4.5M | 184.2 | 4.5M |
| SWESkillsBench | 6.2K | 698.7K | 79.8 | 704.9K | 17.3K | 6.9M | 237.3 | 6.9M | |
| Step | Recorded action | Observation and relevance |
|---|---|---|
| N11 | Read add_fields() at the referenced-field/default branch. | The code executes setattr(..., None) on the parent instance. |
| N28 | Create and run a non-PK UUID/inline-form reproducer. | The form and formset are valid, but saving raises IntegrityError: NOT NULL constraint failed: __main___thing.id . |
| N56 | Run model-form and formset suites after an early repair. | The recorded result is FAILED (failures=4, errors=1) ; one visible failure checks that the inline field’s initial is None. |
| N65 | Replace the early change with the original default-field clearing block. | The edit succeeds. This is an actual correction after failure, not an unrevised first guess. |
| N78 | Construct InlineForeignKeyField before the default-field branch and replace instance clearing with form.fields[name].initial = None . | The edit succeeds. No PK/non-PK branch is added; both parent key types remain populated. |
| N91–N92 | Add an alternate-key save regression test and run the UUID suite. | Ran 7 tests in 0.011s ; OK . |
| Step | Recorded action | Observation and relevance |
|---|---|---|
| S57 | Run an admin/inline-form reproducer and print parent UUID state. | UUID is present after parent-form validation but None after formset validation; saving raises a NOT NULL error. |
| S65 | Run the existing UUID suite after an early edit. | Six tests run, four fail. Failures include expectations that the inline field’s initial be None. |
| S72 | Move field construction earlier and clear only its initial . | The successful edit removes setattr(..., None) for both key types. Its comment says the parent instance must not be modified. |
| S74 | Re-run the reproducer and existing UUID tests. | The output reports FORMSET SAVED ; all six existing tests pass. |
| S86–S87 | Add an alternate-key save regression test and run the UUID suite. | Seven tests pass. The output explicitly marks the old default-PK submission test ok . |
| S89 | Substitute the original source, run the new test, then restore the fix. | Equality of parent.uuid and default_uuid fails on the original source. This checks the repair, not the effect of removing a skill. |
| Step | Recorded action | Observation and relevance |
|---|---|---|
| H5 | Read the exported procedural skill’s SKILL.md . | The tool returns the procedural skill used in the repair. |
| H98 | Run a reproducer that prints parent field values before and after formset validation. | The generated UUID becomes None; saving fails. Both getattr and pre_save output for the non-PK field are None. |
| H105 | Read add_fields() in models.py . | The output exposes the unconditional default-field reset. |
| H107 | Search repository commit history with git log -p -S . | The returned history shows the earlier expansion of clearing from PKs to referenced fields with defaults. |
| H109–H111 | Restrict resetting to default PKs and re-run the reproducer. | The one-test reproducer passes; the non-PK UUID is retained before and after saving. The repair is not yet complete. |
| H121 | Run the existing UUID suite. | Six tests run; the alternate-key test fails because the inline field’s initial is not None. This is a visible repository-test failure. |
| Condition | New-issue F2P | Existing-behavior P2P | Verifier tests | Reward |
|---|---|---|---|---|
| No Skills | 1/1 | 2/3 | 6/7 pass | 0 |
| SWESkillsBench | 1/1 | 2/3 | 6/7 pass | 0 |
| HSE Skills | 1/1 | 3/3 | 7/7 pass | 1 |
| Level | Object | Role |
|---|---|---|
| L1 | Task evidence | Organizes trajectory evidence into reproduce, locate, edit, validate, and recover stages. |
| L2 | Repository candidate | Summarizes procedures supported by recurring evidence within one repository. |
| L3 | Transferable skill | Retains success or recovery procedures supported across multiple repositories. |
| Benchmark | Harness | Method | Run 1 | Run 2 | Run 3 |
|---|---|---|---|---|---|
| SWE-bench Verified | Pi | No Skills | 362 | 367 | 373 |
| SWESkillsBench | 372 | 373 | 375 | ||
| GEPA | 371 | 373 | 375 | ||
| ReasoningBank | 358 | 364 | 370 | ||
| HSE | 376 | 377 | 378 | ||
| CC | No Skills | 374 | 380 | 387 |
| Benchmark | Harness | HSE | Gate 1 | Gate 2 | Gate 3 | Gate 4 | Gate 5 | Gate 6 | Gate 7 | Gate 8 |
|---|---|---|---|---|---|---|---|---|---|---|
| SWE-bench Verified | Pi 1 | 376 | 402 | 422 | 426 | 429 | 436 | 442 | 445 | 449 |
| Pi 2 | 377 | 406 | 425 | 431 | 431 | 438 | 443 | 447 | 450 | |
| Pi 3 | 378 | 408 | 429 | 434 | 434 | 440 | 445 | 449 | 452 | |
| CC 1 | 402 | 428 | 439 | 440 | 444 | 455 | 460 | 463 | 468 | |
| CC 2 | 403 | 433 | 443 | 445 | 450 | 458 | 462 | 465 | 468 | |
| CC 3 | 404 | 435 | 449 | 448 | 453 | 462 | 464 | 467 | 472 |
LLM Agent Skill Learning
Large language model agent skill learning studies how agents acquire, represent, reuse, and refine procedures for multi-step tasks.
See all 396 papers