代码扫描
Code Scans

原始链接: https://devin.ai/blog/introducing-code-scans

Devin 推出了名为“代码扫描”(Code Scans)的新功能。该功能旨在将提升 SEO、减少技术债务或优化性能等高层工程目标,转化为可执行的代码改进方案。 Code Scans 基于“代理 MapReduce”(Agentic MapReduce)架构,能够自动化处理繁琐的代码库调查工作。用户只需设定目标,Devin 便会协作确定范围、并行调查代码,并将发现的问题整合为一份优先级报告。除了识别问题,Devin 还能直接根据这些结果生成可供开发者审核的合并请求(PR)。 该工具在测试中表现卓越,PR 合并率高达 96%,并节省了超过 700 小时的工程时间。无论是识别未使用的代码、查找 N+1 数据库查询,还是检查合规性,Code Scans 都能帮助团队处理那些通常被搁置的复杂仓库级维护任务。 用户只需在 Devin 网络应用中输入 `/scan`,即可定义目标并开始优化代码库。

Hacker News 最新 | 往期 | 评论 | 提问 | 展示 | 招聘 | 提交 登录 代码扫描 ( devin.ai ) 8 分 由 geoffbp 发布 1 小时前 | 隐藏 | 往期 | 收藏 | 讨论 帮助 指南 | 常见问题 | 列表 | API | 安全 | 法律 | 申请 YC | 联系 搜索:
相关文章

原文

Today we’re introducing Code Scans: a new way to turn broad engineering goals into concrete improvements across your codebase. Tell Devin what you want to achieve, and it helps you investigate what needs to change, evaluate the findings, and turn them into pull requests.

Many engineering tasks start with a specific change. Others start with an outcome:

  • Improve SEO
  • Reduce maintenance overhead
  • Make your application compile faster

These goals often stay on the backlog because the first step alone is a substantial project: investigating the codebase to figure out where to start. Additionally, identifying the opportunities is only half the work — someone still has to implement the changes, and many of them.

Code Scans helps with both.

Powered by Agentic MapReduce, the architecture we built for Devin Security Swarm, Code Scans breaks large investigations into focused batches, distributes them across parallel agents, and synthesizes their findings into one report. Devin then turns its findings into PRs ready to review.

Teams testing Code Scans ahead of launch are already seeing results:

Code Scans had a significant impact on the things we care most about: software quality, bug fixes, stability, performance, and compliance, including security and privacy. With an estimated 96% PR merge rate across several repos, we estimate we've saved over 700 engineering hours in our short testing timeframe.

Digital Computational Pathology, Enterprise Informatics at Philips

PR merge rate
96%

Engineering hours saved
700+

To get started, type /scan in the Devin webapp, or read the docs.

Start with a goal

You don’t need to know which files to look at before starting a scan. Instead, you define what you’re looking for, and Devin works with you to turn that goal into a concrete codebase investigation.

For example:

Find unused code in our web app. Exclude generated files and test fixtures, and check for indirect references before recommending a removal.

You can also bring your own criteria: a team’s coding standards, an accessibility checklist, or requirements for an upcoming migration. Devin helps establish what to inspect, what to skip, and what should count as a finding.

Once you confirm the scope and settings, Devin runs the investigation and brings back a list of findings ordered by priority. From there, you can inspect the evidence, discuss the results with Devin, and ask it to open PRs for the issues you want to address.

Improve Rust compilation time

We asked Code Scans to speed up compilation in the Dioxus repository. Devin identified opportunities to streamline dependencies and build configuration, including making heavyweight CLI features opt-in rather than compiling them by default. After applying the changes locally, clean debug build time dropped from 58.6 seconds to 21.0 seconds—a 64% reduction across the 22 workspace crates tested.

Scan findings

dioxus · compile-time scan
Example findings · ordered by priority

SEO Optimization

We ran a scan for SEO issues across devin.ai and cognition.com. It surfaced 44 findings across the two repositories, and we shipped fixes over the following days. Comparing Ahrefs crawls before and after:

  • Ahrefs health score increased from 87 to 92 on devin.ai.
  • Slow pages decreased by 73% on devin.ai.
  • Missing image alt text was eliminated on cognition.com.

Scan findings

devin.ai + cognition.com · SEO scan
Example findings · ordered by priority

Agentic MapReduce

Code Scans is built on top of Agentic MapReduce, the architecture we built for Devin Security Swarm, to make codebase-wide investigations practical. It works in 4 phases:

  1. Plan. Devin studies your repository and defines rules for identifying code relevant to your goal.
  2. Shard. Those rules run across the codebase, and the matching code is divided into focused batches.
  3. Map. Parallel Devin agents investigate each batch, reading surrounding code as needed and reporting their findings.
  4. Reduce. A final agent combines the findings, removes duplicates, and prioritizes the results into one report.

Agentic MapReduce Pipeline

dead-code scan example

1. Plan

Devin studies the repository and defines rules for the code relevant to your goal — here, symbols, modules, and dependencies that may no longer be used.

exports with no importersunreferenced modulesunused dependenciesstale feature flags

This keeps each agent’s context focused and directs the reasoning budget toward relevant code rather than repeated searching. This architecture also ensures completeness: every selected batch must be processed. Code Scans brings that same approach beyond security to the engineering goals you define.

What would you scan for?

Code Scans can investigate a wide range of engineering questions, using your codebase’s conventions and the criteria you provide. Here are some examples:

ScanGoal
PerformanceFind slow paths, redundant computation, and missed caching opportunities that could make your application faster.
Database queriesLook for N+1 queries, unnecessary round trips, unbounded reads, and other inefficient or unreliable data-access patterns.
Test coverageIdentify important flows, edge cases, and failure paths that aren’t covered by tests.
Dead codeFind unused functions, modules, dependencies, and obsolete feature flags, with evidence for what can safely be removed.
Code qualityLook for duplicated logic, unnecessary complexity, better abstraction opportunities, and patterns that violate your team’s coding standards.
CleanupIdentify redundant abstractions, excessive boilerplate, and code that can be simplified without changing behavior.
TelemetryFind gaps in logging, metrics, and tracing that make failures difficult to diagnose or important behavior difficult to measure.
AccessibilityLook for missing labels, broken keyboard interactions, and other gaps against the WCAG criteria you specify.
ComplianceInvestigate sensitive-data handling, audit trails, and retention logic against your organization’s regulatory requirements and policies.
Migration planningTrace existing dependencies, end-to-end flows, and business logic to produce a plan for an upcoming migration.
SEO OptimizationFind code-level issues affecting search visibility, including missing or duplicated metadata, incorrect canonical URLs, indexing directives, and gaps in sitemaps or structured data.
Your ownDefine a pattern you want Devin to look for throughout the codebase.

The most useful scan might come from a question your team has been putting off because answering it meant looking everywhere.

Type /scan in your Devin session, specify what you want to investigate, build the scope together, and start optimizing your codebase today.

Try Code Scans at devin.ai and learn more in the Code Scans docs.

联系我们 contact @ memedata.com