Edit Code with Vibe
On this page
Update November 2, 2026 — Devstral. Devstral 2 (
devstral-2512) reached its end-of-life on July 31, 2026, and Devstral Small 2 on March 31, 2026: calls to these models are no longer guaranteed. The official table now redirects them to Mistral Medium 3.5, which is itself deprecated in favor of Mistral Large 4. Codestral (codestral-2508) remains generally available for code completion. Check the model table to see where the-latestaliases point before running these examples.
Describe, Don’t Write
Editing code with Vibe starts by stating what you want in plain English, without trying to craft a technical instruction:
Add email validation to the registerUser function
Refactor this component to use React hooks instead of classes
Fix the bug in the login handler that doesn't handle timeouts
The agent reads the existing code, understands the context, and proposes a tailored change. It relies primarily on the edit tool (formerly search_replace), which works surgically: only the relevant block is rewritten, leaving the rest of the file untouched. This avoids the dreaded side effect of full-file rewrites, where a three-line fix comes with fifty lines of unwanted reformatting.
Review Before You Accept
Vibe never modifies a file silently. It displays a colored diff in the terminal, using the exact git diff format: deleted lines appear in red prefixed with -, added lines in green prefixed with +, and the surrounding context remains visible so you can locate the change within the file. Every developer reads this format effortlessly, which is precisely the point.
Next comes approval. In default mode, the sequence is fixed: the agent analyzes the code and prepares the change, displays the diff, you verify exactly what will change, then you approve with y or reject with n. No change reaches your codebase without this step. This makes the tool safe for production code: you retain final control, line by line.
Rejecting isn’t your only option when a proposal is only half-right. The most efficient approach is to course-correct in the conversation:
Close, but use a regex instead of split for email parsing
Vibe adjusts its proposal based on your feedback and everything else said earlier in the session.
When Changes Span Multiple Files
Real features rarely live in a single file, and Vibe handles this spread without requiring you to break up your request:
Add a /api/users/:id/avatar endpoint with file upload.
Create the route handler, validation middleware, and unit test.
The agent identifies which files to modify and which to create, prepares changes for each, and then submits them for approval file by file. You can accept the handler but reject the test if its structure doesn’t suit you.
Have Your Code Reviewed
Editing is only part of the job: Vibe is just as useful for reviews. Ask for a security review on a specific file with “Review changes in @src/api/auth.ts and tell me if there are security issues,” a performance analysis with “Analyze this file and suggest performance improvements,” or a style check with “Verify this code follows TypeScript best practices.” In each case, the agent reads, flags potential issues, and proposes reasoned fixes.
For an audit where any writing would be unacceptable, don’t rely on your own vigilance at approval time: simply strip write tools from a dedicated agent.
# ~/.vibe/agents/reviewer.toml
system_prompt_id = "code_reviewer"
disabled_tools = ["write_file", "edit", "bash"] # edit: formerly search_replace
Run it with:
vibe --agent reviewer
This agent can only read and analyze. This is the preferred configuration for security audits or reviewing a contractor’s repository.
What Separates a Good Prompt from a Bad One
The quality of the modification follows directly from the precision of the instruction. Compare these two formulations: the first leaves the agent guessing your intent, the second leaves nothing to invent.
# Too vague
Improve this file
# Precise
Add logging with the winston module for errors in the createOrder handler,
logging the HTTP error code and message
The second reflex is to explicitly designate the target area with @, as in “In @src/middleware/auth.ts, add a token expiry check before validating the session.” The third is to never close a series of changes without verification: ask “Run tests to verify the changes didn’t break anything,” and the agent will execute the appropriate command for your project—npm test, pytest, cargo test—before telling you if everything passes.
Finally, there’s the case of approving too quickly. All is not lost: you can ask the agent to undo the last change in @src/api/auth.ts, or take back control via Git without leaving interactive mode, using the ! prefix to run the shell command directly.
!git checkout -- src/api/auth.ts
Key Takeaways
- Describe your changes in natural language; Vibe generates the code
- Colored diffs show exactly what changes before approval
- Default mode requires explicit approval for every change
- Multi-file changes are handled automatically
- A read-only agent is ideal for code review
- Always verify tests after a series of changes