Let Agents Act via Code, Not Token by Token

Let Agents Act via Code, Not Token by Token

There is a moment in almost every migration where an agent clearly knows what needs to happen, but still has to spend an absurd amount of effort doing it the slow way.

Maybe the task is renaming an import across hundreds of files. Maybe it is updating a deprecated API call to a new shape. Maybe it is applying the same framework migration pattern again and again through a large codebase. The change is mechanical. The desired end state is already understood. And yet the agent is forced to burn tokens reading files, reasoning about repetitive edits, and rewriting code one patch at a time.

That is exactly the kind of work Hypermod is built to eliminate.

Hypermod gives agents a better primitive: act via code.

Instead of asking an agent to manually perform every migration step, you can let it reach for a codemod—a static, declarative program that already encodes the transformation. When a migration can be expressed as code, the best move is usually not to describe it over and over in natural language. The best move is to run the transformation that already knows how to do the job.

This sounds simple, but it changes the economics of software change in a big way.

Stop Spending Intelligence on Mechanical Work

Agents are powerful, but they are still expensive if you use them like very patient interns. If an agent has to inspect file after file just to make the same syntactic migration repeatedly, you are paying for cognition where a deterministic transform would do better.

Codemods flip that model around. You invest once in expressing the migration as executable code, then reuse it as often as needed. The agent can focus on the parts that actually benefit from intelligence: selecting the right migration, composing it with other changes, handling edge cases, validating the rollout, and deciding what to do when the codebase does something unusual.

The repetitive part becomes cheap.

The reliable part becomes reusable.

And the agent becomes much more effective because it is no longer trapped doing the same edit in slow motion.

Hypermod as a Library of Actions

Hypermod is more than a place to write a codemod. It gives agents access to a growing library of codemods they can download and use as part of a larger change.

That matters because many migrations are not unique snowflakes. Framework upgrades, import rewrites, API renames, config changes, dependency replacements, and ecosystem cleanups often follow patterns that show up in many repositories. Once those patterns are captured as codemods, an agent can pull them into its workflow instead of reinventing the migration from scratch every time.

In practice, that means an agent can recognize a change, fetch the right codemod, run it against the repository, inspect the result, and continue with the rest of the task. The codemod handles the mechanical rewrite. The agent handles orchestration and judgment.

That division of labor is what makes agentic code change feel practical instead of theatrical.

Large-Scale Changes Without the Usual Drag

The biggest payoff shows up when the scope gets large.

A migration across one file is annoying. A migration across one hundred repositories is a program. At that scale, manual editing—whether done by a person or simulated by an agent—becomes the bottleneck.

Codemods remove that bottleneck because they are declarative and repeatable. You define the transformation once, then run it everywhere it applies. Hypermod makes that especially useful for agents because the same codemod can be reused across pull requests, teams, and codebases without re-explaining the migration each time.

This is what unblocks large-scale changes. A security fix that requires code updates. A framework release with breaking API changes. A design system migration that touches dozens of applications. A dependency modernization campaign across a fleet of repositories. These are all painful if every edit is handcrafted. They become much more tractable when agents can execute codified transforms.

Faster, Safer, and More Secure by Construction

There is also a trust advantage here.

Natural-language-driven editing can be impressive, but it can also be hard to predict. A codemod is much more inspectable. You can read it, test it, version it, review it, and rerun it. The migration lives in code, not just in a prompt or a model's transient reasoning.

That makes changes safer. It also makes them more secure.

Teams can decide exactly which codemods agents are allowed to use, audit the transformation logic ahead of time, and run known migrations in a controlled way. Instead of giving an agent broad permission to improvise through a codebase, you can hand it trusted building blocks. That is a better security posture and a better operational model.

It also gives engineering teams something they rarely get with one-off AI edits: reproducibility. If a migration worked in one repository, the same codemod can be applied in the next repository with the same intent and the same transformation logic.

Declarative Change Scales Better Than Conversation

One of the easiest traps in AI tooling is treating conversation as the universal interface for every problem.

Conversation is great for discovery, planning, and exception handling. It is not always the best medium for deterministic code transformations. If a migration is static and declarative, pushing it through a long token-heavy dialogue is often the wrong abstraction.

Hypermod helps agents cross that boundary. The agent can still understand the task conversationally, but when it is time to make the change, it can switch from describing the migration to executing code that defines it.

That is the heart of acting via code.

Not replacing the agent, but upgrading its toolbox.

Cheap Enough to Use Everywhere

There is a cost story here too, and it matters.

When an agent relies on codemods for the mechanical part of a migration, the amount of token-intensive work drops dramatically. Fewer files need to be laboriously rewritten line by line. Fewer repetitive decisions need to be re-derived. The expensive part of the system gets reserved for the places where it creates the most value.

That makes agent-assisted migrations not only faster, but cheap enough to apply much more broadly. Changes that might have felt too expensive to automate across an entire fleet start to become reasonable. Teams can use agents for ongoing maintenance, not just special occasions.

And that is where this gets exciting. Once the cost and reliability profile improves, you can stop thinking of migrations as dreaded one-time events and start treating them as normal software operations.

The Human Payoff

For developers, the benefit is not abstract.

It means fewer hours wasted on tedious cleanup. Fewer migration checklists that drag on for weeks. Fewer giant prompts asking an agent to slog through mechanical edits that could have been encoded once and reused forever.

Instead, teams get to spend more of their attention on what actually deserves it: architecture, product decisions, tricky edge cases, rollout strategy, and quality.

That is the promise behind Hypermod for agents. Let the agent think where thinking helps. Let codemods execute where execution is enough.

If the change already exists as static, declarative code, the smartest thing an agent can do may be to stop talking about it—and run it.


Credit: This post was inspired by Act via Code from the Graph-sitter team.