Migrating with an AI agent
The UltraGX output is written so that a coding agent (Claude Code, Codex, Cursor, Antigravity or another) can rebuild the application in another technology without opening GeneXus. The agent does not have to interpret GeneXus code from scratch: it reads rules that are already explained, pseudocode per event, the implicit SQL of each For each, the data model with its keys and a rebuild order.
This chapter describes a way of working that works well. It is not the only one, but it avoids the most common mistakes: asking the agent for everything at once, or letting it invent structure that the KB already defines.
1. Preparing the workspace
- Generate the documentation with the full edition and, if you can, with the narrative at
okfor the business objects. Use the language your team works in. - Create the repository of the new application separate from the UltraGX output.
- Make the output available to the agent as read-only material: for example, a sibling folder (
../kb-docs/) or a submodule. There is no need to copyviewer/,_pipeline/or_source_text/. - In the new repository, write the agent's instructions file (
CLAUDE.md,AGENTS.mdor the Cursor rules) with:- the target technology and its conventions (language, framework, database, folder structure);
- the location of the KB documentation and the instruction to read its
README.mdfirst; - the rule that table, attribute and rule names come from the documentation and are never invented;
- that user notes take precedence over inferred statements.
Example block for that file (with documents in English, the sections are called User notes and Limits of this analysis, as below; adjust the names if your documents are in another language):
## Legacy system knowledge
The GeneXus application being migrated is documented in ../kb-docs (UltraGX output, read-only).
Start with ../kb-docs/README.md. Locate objects through kb_index.json (doc_path column).
Table and column names, keys and business rules come from those documents; never invent them.
"User notes" sections override inferred statements. When a document lists something under
"Limits of this analysis", ask before assuming.
2. Reading order
The output's README.md tells the agent how to go through it. In short:
README.md,kb_summary.mdandkb_clusters_summary.md: what there is and how it is grouped.datamodel/index.md: tables, keys and which transaction defines each table.global_rebuild_roadmap.md: in what order to rebuild.- For each cluster:
clusters/cluster_NNN.knowledge.md,.flow.mdand.rebuild.md. - For each object: its document in
objects/(path inkb_index.jsonโdoc_path). - To follow relationships:
kb_graph.jsonor the Cross references section of each document.
3. Working by phase and by cluster
- Data model first. Ask the agent for the database schema and the entities based on
datamodel/. Check it against the real database before going on: everything else builds on this. - Follow the roadmap. Take the first phase of
global_rebuild_roadmap.mdand, within it, one cluster at a time. - One cluster, one task. For each cluster, the agent reads its rebuild plan and the documents of its objects, proposes the design, implements it and writes tests based on the business rules.
- Close the cluster before moving to the next one: tests green, rules reviewed one by one and user notes with the decisions taken (they remain for the agent's next sessions).
4. Sample prompts
Orientation
Read ../kb-docs/README.md, kb_summary.md and kb_clusters_summary.md. Summarise what the application does, its
functional areas and the 10 most important tables. Do not write any code yet.
Data model
Based on ../kb-docs/datamodel/, generate the database migrations for PostgreSQL and the ORM entities. Keep the
names, types, primary keys and foreign keys. List any table whose
definition is incomplete.
One cluster
Implement cluster cluster_004 according to clusters/cluster_004.rebuild.md. Read the document of each member object
and reproduce its business rules and the implicit SQL of its For each commands. For the screens, use the user
interface section. Write one test per business rule and flag anything you cannot reproduce with certainty.
A single object
Look up the procedure CalcularDescuento in kb_index.json, read its document and reimplement it as a service. Explain
each branch of the pseudocode in a comment in the corresponding test.
Verification
Compare the InvoiceService service with objects/Facturacion/Transaction.Factura.md: list every business rule in
the document and state where it is implemented or whether it is missing.
5. Good practices
- Limited context. Do not ask the agent to read the whole folder: with
kb_index.jsonanddoc_pathit finds what it needs for each task. - Confidence. Prioritise human review of objects with a low
confidence_leveland of whatever appears under Limits of this analysis. - Library and pattern objects. Objects marked as library (modules imported from GeneXus or third parties) and pattern scaffolding (Work With, K2BTools) are not migrated as they are: they are replaced by the equivalents of the target framework.
- The KB is still alive. If the GeneXus application receives changes during the migration, export again and run the pipeline on the same project; notes are kept and the differences are visible in version control if the output is versioned.