Skip to main content
The Code Generation Agent reads your codebase’s existing patterns and conventions before writing a single line, then generates code that fits naturally into what already exists. If specific nodes are referenced in the query, it fetches their source code and appends it as code context.

How It Works

Understand the Task

The agent classifies every incoming task into one of five types:
  • New feature
  • Modification
  • Refactor
  • Bug fix
  • Multi-file change
It extracts target files, classes, functions, scope, and dependencies.
For multi-file or complex tasks, the agent upfront identifies all impacted files and determines the order in which changes need to happen, resolving dependencies across files before writing anything.

Explore the Codebase

The agent reads the codebase before writing anything. It starts by finding where the relevant feature or functionality lives, then understands the directory layout and module organization. It retrieves specific named classes or functions, maps all call relationships, and fetches full files or specific line ranges as needed. It reads multiple files simultaneously when working across related modules, and also performs grep style content searches to surface naming conventions, import patterns, and usage sites across the codebase. If the task involves domain best practices not present in the repo, it retrieves external references to inform the implementation. If no relevant files are found through normal navigation, it falls back to a tag-based search across the graph.

Analyze Patterns

Before writing, the agent captures exact indentation, import order, naming conventions, string literal formats, and docstring style from the existing codebase. It maps every import that needs to change, identifies all impacted files including tests, and documents any database schema or API contract changes.

Write Code

Changes are written into a dedicated branch created at the start of every session. The agent works against a live view of each file as it evolves, re-fetching the current state before every operation so line numbers are always accurate after prior inserts or deletes. After every operation, it re-fetches to verify the change applied correctly.

Review and Apply

The agent displays all changes as a unified diff for you to review. Until you confirm, no changes are written to disk. PR creation only happens upon your explicit confirmation. Once confirmed, the agent applies the patches, commits the changes, pushes them to the remote repository, and opens a pull request on GitHub or GitLab in a single step.

Next Steps