How Should Agents See Code? Rethinking Code Representations for Agentic Software Engineering
Organizations: York University Toronto, Canada
Abstract
LLM agents are increasingly used for repository-level software engineering tasks. However, most agents still access repositories through raw files, lexical search, and shell commands, treating code primarily as text. This paper investigates map-based code-representation workflows as a design variable in agentic software engineering, examining how different repository views change agents' retrieval behavior, task success, token use, and latency. In this paper, we study five code-representation workflows: abstract syntax trees, call graphs, module dependencies, documentation-enriched search, and a hybrid workflow that combines them. Each workflow exposes a repository map that the agent can query during a task. We evaluate Claude Code with Haiku 4.5 against a raw-tool baseline on four repository-level tasks: fault localization with LinuxFLBench, repository-level code generation and repair with SWE-bench Pro, test generation with SWT-bench, and security patching with SecBench. The results show that representation workflows are most useful as token-saving tools when localization is the bottleneck, while their success gains narrow when the decisive step is patch or test authoring. On LinuxFLBench, all five workflows improve recall@10 over the baseline (0.757-0.829 vs. 0.717) and reduce token usage by 25-39%. On SWE-bench Pro, resolution remains close to the baseline (44.3-50.6% vs. 49.0%) while token usage drops by 17-26%. On SecBench, Callgraph has the highest patch-resolution rate in this sample (34.3% vs. 28.9%) and uses fewer tokens, but all workflows increase latency. On SWT-bench, Hybrid and Docs have the highest reproducing-test rates in this sample (47.8% and 47.2% vs. 44.7%), but all workflows use more tokens and take longer. Overall, map-based workflows change both what the agent inspects and how much it spends, but their benefits are task-dependent rather than universal.
Figures & tables
| Server | #tools | Tools exposed |
|---|---|---|
| AST (structural) | 8 | ast_explore , ast_node , ast_search , ast_files , ast_status , file_skeleton , ts_query , parse_file |
| Callgraph (CG) (inter-procedural flow) | 9 | callgraph_explore , callgraph_node , callgraph_search , callgraph_files , callgraph_status , callers_of , callees_of , call_path , function_info |
| Deps (module dependency graph) | 8 | deps_explore , deps_node , deps_files , deps_status , module_deps , dependency_path , layer_summary , cycles |
| Docs (documentation-enriched) | 6 | docs_explore , docs_node , docs_files , docs_status , module_overview , repo_map |
| Hybrid (composite) | 6 | hybrid_explore , hybrid_node , hybrid_files , hybrid_status , impact_of , repo_map |
| Benchmark | Task | Agent output | Task-success metric | Sample |
|---|---|---|---|---|
| LinuxFLBench [ 18 ] | Fault localization from a Linux kernel bug report. | Ranked list of up to ten likely buggy files. | File-level recall@ , for ; success means the ground-truth file appears in the top- predictions. | 152 |
| SWE-bench Pro [ 19 ] | Program repair from a real GitHub issue. | A code patch in unified-diff format. | Resolution rate; a task is resolved if the patch passes all hidden fail-to-pass tests and preserves all pass-to-pass tests. | 253 |
| SWT-bench [ 21 ] | Test generation from a GitHub issue. | A unit test that reproduces the issue. | Reproducing-test rate; the test must fail on the buggy version and pass after the known fix. | 161 |
| SecBench [ 20 ] | Automatic security patching for vulnerabilities | A security patch. | Patch-resolution rate; a task is resolved if the generated patch is accepted by the benchmark harness. | 166 |
| Workflow | fR@1 | fR@10 | avg_tokens | avg_wall_s | avg_MCP | avg_builtin | avg_read | avg_grep | avg_glob | avg_bash |
|---|---|---|---|---|---|---|---|---|---|---|
| Baseline | 0.572 | 0.717 | 1,008,163 | 66.7 | 0.0 | 25.4 | 8.4 | 6.0 | 1.4 | 9.5 |
| AST | 0.526 | 0.757 | 754,768 | 104.6 | 13.1 | 0.9 | 0.5 | 0.0 | 0.0 | 0.3 |
| Callgraph | 0.572 | 0.770 | 683,227 | 105.1 | 11.0 | 2.2 | 1.1 | 0.0 | 0.0 | 1.1 |
| Deps | 0.572 | 0.757 | 628,244 | 87.6 | 8.5 | 0.7 | 0.4 | 0.0 | 0.0 | 0.3 |
| Docs | 0.586 | 0.770 | 662,834 | 105.6 | 11.1 | 2.4 | 0.6 | 0.0 | 0.0 | 1.7 |
| Hybrid | 0.526 | 0.829 | 610,910 | 82.2 | 9.5 | 0.5 | 0.3 | 0.0 | 0.0 | 0.3 |
| Workflow | Resolved | avg_tokens | avg_wall_s | avg_MCP | avg_builtin | avg_read | avg_grep | avg_glob | avg_bash |
|---|---|---|---|---|---|---|---|---|---|
| Baseline | 49.0% | 3,116,193 | 268.8 | 0.0 | 44.5 | 12.7 | 0.0 | 0.0 | 25.2 |
| AST | 50.6% | 2,450,752 | 209.1 | 5.2 | 37.7 | 8.4 | 0.2 | 0.0 | 23.4 |
| Callgraph | 46.2% | 2,310,653 | 193.7 | 4.2 | 38.1 | 8.7 | 0.2 | 0.1 | 23.6 |
| Deps | 49.4% | 2,406,690 | 205.3 | 3.4 | 39.1 | 8.6 | 0.2 | 0.0 | 24.7 |
| Docs | 44.3% | 2,532,738 | 205.8 | 4.9 | 39.0 | 7.6 | 0.1 | 0.1 | 25.8 |
| Hybrid | 50.6% | 2,590,046 | 204.3 | 4.3 | 39.2 | 8.6 | 0.2 | 0.0 | 24.5 |
| Workflow | Reprod. | avg_tokens | avg_wall_s | avg_MCP | avg_builtin | avg_read | avg_grep | avg_glob | avg_bash |
|---|---|---|---|---|---|---|---|---|---|
| Baseline | 44.7% | 1,671,772 | 161.4 | 0.0 | 33.4 | 12.7 | 0.0 | 0.0 | 16.9 |
| AST | 45.3% | 1,772,180 | 170.1 | 5.7 | 27.3 | 9.7 | 0.0 | 0.0 | 13.6 |
| Callgraph | 37.9% | 1,687,094 | 201.1 | 3.5 | 31.9 | 12.1 | 0.0 | 0.0 | 15.8 |
| Deps | 42.9% | 1,771,300 | 184.2 | 2.6 | 30.2 | 10.4 | 0.0 | 0.0 | 15.7 |
| Docs | 47.2% | 1,823,938 | 185.1 | 4.2 | 30.8 | 10.9 | 0.0 | 0.0 | 16.1 |
| Hybrid | 47.8% | 1,871,848 | 192.5 | 3.8 | 28.6 | 10.5 | 0.0 | 0.0 | 14.2 |
| Workflow | Resolved | avg_tokens | avg_wall_s | avg_MCP | avg_builtin | avg_read | avg_grep | avg_glob | avg_bash |
|---|---|---|---|---|---|---|---|---|---|
| Baseline | 28.9% | 683,774 | 66.4 | 0.0 | 12.9 | 7.2 | 0.0 | 0.0 | 4.1 |
| AST | 25.3% | 656,332 | 166.6 | 5.5 | 6.5 | 3.6 | 0.0 | 0.0 | 1.3 |
| Callgraph | 34.3% | 614,360 | 184.2 | 3.1 | 7.4 | 4.1 | 0.0 | 0.0 | 1.6 |
| Deps | 31.9% | 651,116 | 144.4 | 3.1 | 7.6 | 4.4 | 0.0 | 0.0 | 1.5 |
| Docs | 31.3% | 697,763 | 290.4 | 4.4 | 7.4 | 4.3 | 0.0 | 0.0 | 1.5 |
| Hybrid | 29.5% | 658,069 | 136.4 | 5.0 | 8.0 | 4.7 | 0.0 | 0.0 | 1.1 |
| Performance | Tokens | |||||
|---|---|---|---|---|---|---|
| Benchmark | Rep | Win | Loss | Net | Fewer | More |
| Fault Loc. (LinuxFLBench) | AST | 17 | 11 | 111 | 41 | |
| Callgraph | 17 | 9 | 109 | 43 | ||
| Deps | 17 | 11 | 115 | 37 | ||
| Docs | 17 | 9 | 115 | 37 | ||
| Hybrid | 17 | 0 | +17 | 117 | 35 | |
| Performance axis | Token axis | ||||
|---|---|---|---|---|---|
| Benchmark | Rep | Dominant win | Dominant loss | Dominant fewer-token category | Dominant more-token category |
| Fault Localization | AST | Report-named in-file fault (17/17) | Symptom root-cause file (7/11) | Read displacement (79/111) | Map overhead (30/41) |
| (LinuxFLBench) | Callgraph | Call-reachable cross-file fault (17/17) | Neighbor-drift (5/9) | Read displacement (109/109) | Map overhead (34/43) |
| Deps | Report names function/API (13/17) | Arch file outside import cluster (9/11) | Read displacement (72/115) | Map overhead (32/37) | |
| Docs | Terms match in-file comments (17/17) | Symptom-only crash, no term (7/9) | Read displacement (93/115) | Over-exploration (27/37) | |
| Hybrid | Lands the single target file (11/17) | — (zero losses) | Read displacement (85/117) | Verbatim-source explosion (27/35) | |
Software Engineering Agents
Software Engineering Agents are AI systems that use code, tools, and feedback to perform software development tasks.
See all 354 papers