Summary
This year I presented my open-source project revit-rag at AU26. While preparing the talk, Fable and Astra came out, and I came to see that much of the work that used to depend on RAG can now be done by the LLM directly. After a few rounds of vibe coding tests, though, one problem was still there: the model can still misunderstand or misuse the Revit API.
With that question in mind, within a week of the AU26 talk I started to rebuild the project. I no longer keep one large RAG framework. It is split into three fairly independent parts: Skills, an Agent, and API documentation search. Development no longer calls RAG at every step; it searches only when an API is uncertain.
During the rebuild I also ran into the efficiency of automatic testing. The common approach relies on screenshots, image analysis, coordinate recognition and simulated clicks. It does automate the test, but it calls a vision model again and again, and the token cost is high. So I combined geometric coordinate conversion, reproducible random clicks and a small number of screenshots into an automatic test flow that takes the model data as its main evidence and cuts the repeated visual analysis.
As AI-assisted programming spreads, the way engineers work with code is changing. The aim of this project is to turn what I have learned in Revit development into reusable Skills and an Agent workflow: to lower the barrier to development and debugging, and to constrain the model with clear rules and verification steps so that the generated code is more reliable. The rest of this article describes the project structure, the test method and the results.
Project: https://github.com/revitbridge
The project
The project has three modules. Each can be installed on its own, and they can be combined:
| Part | What it is | What it solves |
|---|---|---|
| skills | Coding rules and procedures written for the LLM | Tells it in advance about the pitfalls I have hit, so it makes fewer known mistakes |
| agent (revit-bridge) | A bridge into Revit, plus automatic testing | Lets it read data, dry-run code and test the product on a real model |
| docs (revit-api-docs) | A searchable Revit API reference | One lookup when an API is uncertain gives the exact interface |
Skills
The Skills give the LLM Revit programming rules and procedures: model changes must sit inside a Transaction, how to handle failures, and the API differences between Revit versions.
These rules come from repeated development and correction in real projects. An LLM can already do a great deal of the coding, but it still makes mistakes that look reasonable and yet block the task.
For example, when changing a wall’s thickness, some agents first check the wall type with IsVerticallyCompound and refuse to run when it is true. For the ordinary wall in this test, that check made the add-in exit before it changed anything. In the tests below, 20 of the 39 products built without a connection to Revit contained this check. When generated code cannot be debugged directly against Revit, such problems are usually found only when the user runs it and reports back to the LLM, which costs debugging time and tokens.
The Skills are organised in a lightweight way and can be used quickly in dsh, Codex and Claude Code. There are six of them:
| skill | Purpose |
|---|---|
revit-core | Required reading before writing Revit C#: the snippet contract, internal units, ElementId and other version differences, the Revit 2024 to 2027 runtime matrix |
revit-task-brief | Rewrites a designer’s one-sentence request into a testable brief |
revit-bridge | The procedure for creating, changing and querying elements in the open model through the bridge |
revit-addin-dev | Creating, continuing, debugging and migrating a standalone Revit C# add-in |
revit-addin-test | Testing a compiled add-in in a real Revit |
revit-addin-release | Multi-year builds, the installer and acceptance on a real machine |
Every rule has the same structure: scenario, wrong code, right code, versions and source. Here is the ElementId example from revit-core:
---
schema_version: 1
id: revit-core/elementid-value
revision: 1
title: "ElementId: use Value (long); IntegerValue is obsolete in 2024-2025 and gone from 2026"
summary: "`ElementId.Value` (long); `IntegerValue` is obsolete in 2024-2025 and gone from 2026"
stage: [orient, write, fix]
kind: pitfall
revit: ">=2024 <2028"
order: 30
triggers:
symbols: [IntegerValue, ElementId]
errors: [CS1061, CS0618]
---
## Scenario
Element ids are 64-bit: `ElementId.Value` returns `long`. Code written for older Revit uses `IntegerValue` (`int`) and `new ElementId(int)`.
## Wrong
```csharp
int id = wall.Id.IntegerValue; // 2024-2025: warning CS0618 (obsolete); 2026 and later: CS1061
```
## Right
```csharp
List<long> ids = new FilteredElementCollector(document)
.OfClass(typeof(Wall))
.ToElementIds()
.Select(id => id.Value)
.ToList();
long first = ids.Count > 0 ? ids[0] : ElementId.InvalidElementId.Value;
Element again = document.GetElement(new ElementId(first));
return new { Count = ids.Count, First = first, Found = again != null };
```
## Versions
- 2024.0 to 2025.4: `IntegerValue` and the `ElementId(Int32)` constructor are marked obsolete; the property's message: "This property is deprecated in Revit 2024 and may be removed in a future version of Revit. Please use the Value property instead."
- 2026.0, 2026.4, 2026.5, 2027.0, 2027.2: both are gone. `Value` (`Int64`) and `ElementId(Int64)` exist in every version checked.
## Source
- revit-api-docs data set (Revit 2026): `ElementId.Value` "Provides the value of the element id as a 64-bit integer" (`public long Value { get; }`); the `ElementId` member list has `ElementId(Int64)` and no `IntegerValue`.
- Metadata of the Revit API assemblies 2024.0, 2024.3, 2025.0, 2025.4, 2026.0, 2026.4, 2027.2 and the installed 2026.5 and 2027.0, including the obsolete messages quoted above (2025.5 not checked).
Agent
The Agent module is built around revit-bridge. It connects the Skills, automatic testing and API documentation search into one development flow. This is also closer to the project’s original goal: to let a developer write, verify and deliver with tools that are as light as possible.
Skills alone have two limits: they cannot check an exact API definition, and they cannot connect to a running Revit to test. revit-bridge fills both gaps. The agent can simulate user operations in the real model, read the result and iterate on the error messages; it calls the documentation search only when an API is uncertain.
The overall workflow:
The tool and the job at each step:
| Step | With what | What it does |
|---|---|---|
| Rewrite the brief | skill revit-task-brief | Turns a one-sentence request into numbered behaviour, inputs with units, cancel and failure rules, and how it will be accepted |
| Read the open model | the bridge’s query tools | Gets the project’s real families, types and marks instead of assuming “the project should have them” |
| Write the core logic | skills revit-core, revit-addin-dev | The core logic lives in its own file, takes plain values only, and touches no dialog and no pick |
| Look up the docs | revit-docs | Only when an API is uncertain, not at every step |
| Compile check | check_code | Compiles in Revit without running |
| Dry run | dry_run_code | Really runs the code on the open model and then always rolls it back; returns what would be added, modified and deleted, and every warning and error Revit raised |
| Test in the real Revit | test_addin_command | Loads the built DLL, picks by element id, feeds the input file, reads the result back, then restores the model |
The compile check, the dry run and the real-Revit test are three verification points. When any of them fails, the agent goes back to coding with the specific diagnostics. In this flow the dry run’s changes are rolled back and the model is restored after the test, so no person has to step in on each iteration and no test change stays in the model.
Docs
revit-docs (package name revit-api-docs) comes from the data module of the original revit-rag project and holds the Revit 2026 API reference. I separated it so that the Agent can call it on demand, and to leave room for further retrieval experiments. I ran two rounds of retrieval evaluation and changed the database structure and the retrieval strategy according to the results.
Two terms first:
- Jev is a reranking service from TypeSafe; the model version during the tests was
jev-1.14.0. Retrieval first recalls a set of candidate entries; Jev gives each candidate a relevance score from 0 to 1, and the candidates are reordered by that score. - nDCG@5 measures whether the correct API entry is in the top 5 and how high it ranks. The maximum is 1.
Round one: the existing retrieval plus Jev
Round one used data set v1.0 and 60 English queries covering API names, designer-style task descriptions, fix hints after a compile error, and things that are not in the database. No vector search in this round:
| Recall | No rerank | With Jev rerank |
|---|---|---|
| The existing keyword search (LIKE substring matching) | 0.593 | 0.815 |
| BM25 (SQLite FTS5 full-text index) | 0.675 | 0.871 |
All values are nDCG@5. With either recall method, ranking improved clearly once Jev was added. Checking query by query, no query that was a hit before became a miss after reranking. On the compile-error fix hints alone, keyword search scored 0.200 and BM25 with Jev reached 0.914.
This round also showed where reranking ends: Jev can only reorder the candidates it is given and cannot bring back what recall missed. The original keyword search failed to put the correct answer among the top 30 candidates for 8 queries.
Round two: adding vectors, and a comparison with Cohere
Round two enlarged the query set to 223: 110 queries about a single API and 113 complex tasks that need 2 to 4 APIs together:
| Recall | No rerank | Jev rerank | Cohere rerank-v3.5 |
|---|---|---|---|
| BM25 | 0.565 | 0.788 | 0.674 |
| Vector + BM25 hybrid | 0.565 | 0.864 | 0.700 |
| Vector only | 0.555 | 0.810 | 0.680 |
Under all three recall strategies Jev scored higher than Cohere, and the gap grew as the candidate pool grew. For the complex tasks, keeping Jev and only replacing BM25 recall with hybrid recall raised the top-5 hit rate from 0.726 to 0.872.
Round two also found a key problem in data set v1.0: the record IDs of the vector store did not match the SQLite row numbers. Of the 27,596 shared IDs, only 2 pointed to the same entry. In the database as published at that time, vector search could therefore return unrelated entries, and hybrid search was in effect no different from BM25 alone. Note that the vector results in the table above come from data that the experiment first realigned by entry name.
Changes to the database and the retrieval
Based on the two rounds, I made these changes:
| Version | Change | Effect |
|---|---|---|
| 0.2.0 | Keyword search moved from LIKE substring matching to BM25 on an SQLite FTS5 index; identifiers also match by their camel-case parts | Misspelt or unknown names (such as FiltredElementColector) get candidates instead of “not found” |
| 0.2.0 | Jev reranking added; the rerank HTTP connection is reused | A query with Jev reranking went from about 2.1 seconds to about 0.4 seconds for each later call, while the candidates grew from 10 to 30 |
| 0.3.0 | Data set v1.1: the vector store is rebuilt from the SQLite rows, and every record id is its row number | A vector hit comes back as the entry it describes |
| 0.3.0 | Data set v1.1: 1,266 pages added (1,040 constructors, 226 interface members and similar), 28,862 entries in all | Entries such as new XYZ(x, y, z) and IExternalEventHandler.Execute can be found |
| 0.3.0 | Vector documents changed from “almost only the entry name” to “entry name : summary” | Hybrid search without reranking went from 0.610 to 0.647 |
| 0.3.0 | Vector and BM25 results are merged by reciprocal rank fusion (RRF) | Without reranking, vector hits can reach the top 5: 0.557 to 0.647, complex tasks 0.355 to 0.459 |
| 0.3.0 | With a TypeSafe key set, Jev reranks by default; Cohere is optional and the fallback |
After the changes I evaluated data set v1.1 again with the same 223 queries:
| Configuration (data set v1.1) | nDCG@5 |
|---|---|
| BM25 only, no key needed | 0.557 |
| Vector + BM25 fused, no rerank | 0.647 |
| Vector + BM25 fused, with Jev rerank | 0.842 |
The results show that Jev’s main value is more accurate ranking, while the speed gain comes mainly from reusing the HTTP connection. A query with reranking now takes about 0.4 to 0.5 seconds. On cost, the average input in round one was about 5,400 tokens per query, about 0.0002 US dollars at the price at that time.
In the real Agent workflow, documentation search does not run through every step. It is triggered on demand when an API definition is in doubt.
Test overview
To evaluate this approach I chose four coding-agent lines, Grok, GPT, Gemini and DeepSeek, and designed two Revit add-in development tasks. Each agent did the code generation, the testing and the final acceptance on its own, covering as much as possible of the path from request to product.
All add-ins the agents produced (called “products” below) were accepted by a script in the same Revit 2026 test model. With revit-bridge connected, all 38 valid runs met the completion bar; without it, the overall completion rate was below one half.
The test file (Revit 2026) is on Autodesk Drive: open the test model. Every run and every judgement in this article used this one model.
The tests ran from 14 to 16 November 2026: 154 runs, 135 of them valid. All model costs in this article are estimates from public list prices, not billed amounts.
Key numbers
| Item | Result |
|---|---|
| Full setup (skills + bridge + docs) | 38 / 38, both tasks completed in every run |
| Native (prompt only) | 19 / 38 completed |
| Skills only, no bridge | 16 / 40 completed, no better than native |
| Cache hit of prompt tokens | 94.8%; 478 million of 505 million prompt tokens came from cache |
| Model usage of the four lines in total | About 231 US dollars, estimated from tokens at each provider’s list price, 154 runs |
| Model tokens used by the automatic judging | 0; a script reads the model data back, no screenshots |
How it was tested
The host program and model of each line (coding agent):
| Line | Host program | Model |
|---|---|---|
| OpenAI | Codex CLI 0.169.0 | gpt-6.1-sol, reasoning effort high |
| Grok | Cursor CLI | grok-4.7-high |
| DeepSeek | dsh 0.2.1-rc.3 | deepseek-v4-pro, high |
| Gemini | agy 1.5.9 | gemini-4-carbon-high |
The tools and environment an agent had under each condition:
| Condition | Input | Environment |
|---|---|---|
| N native | The prompt and the host’s own tools, the Revit API assemblies; no Revit | A clean test machine without Revit |
| K skills only | N + the revit-bridge skills (coding rules and procedures) | Same |
| KR | K, with one more rule in the skills: “refuse only on a condition you have verified” (the rule) | Same; wall task only |
| S3 full setup | K + revit-bridge MCP (read, dry-run and test the product on the open model) + Revit API docs MCP | A machine with Revit 2026 and the test model open |
The two tasks:
-
Wall task: pick a wall, add a 10 mm finish layer, and place one door and one window in that wall, with requirements on type, size, position and mark. 19 checks.
Make me a Revit 2026 add-in: I pick a wall, it gets 10 mm thicker by adding a finish layer to its wall type; then, with the sizes and positions I type into a dialog, make a new window type and a new door type and insert them into that wall. Use the window and door families this project uses most, continue the project's existing door and window numbering, and make the door open into the larger of the two rooms. Name the add-in {{ADDIN_NAME}}. Put the sources, csproj and .addin in the current directory and make sure it builds; do not install it. Revit 2026 with an architectural project is open on this machine. Nobody will answer questions: decide yourself and say what you decided. Finish with a short report in English: build result, what you verified, what you could not. The add-in will be tested by a script. The wall is still picked with the mouse. When a file named {{ADDIN_NAME}}.input.json exists next to the add-in DLL, do not show the dialog and do not show any message box: take the values from that file, and when the command ends write {{ADDIN_NAME}}.result.json next to the DLL as {"result": "Succeeded" | "Cancelled" | "Failed", "message": "..."}. Without the input file the add-in behaves normally, with its dialog. The input file is: {"window_width_mm": 900, "window_height_mm": 1200, "window_sill_mm": 900, "window_center_mm": 1500, "door_width_mm": 900, "door_height_mm": 2100, "door_center_mm": 4000} Centers are distances along the wall's location line from its start point (parameter 0) to the middle of the opening. -
Room task: write the finishes and the ceiling height into every room of the current level, unify the room tags, renumber the doors after the room they open into, and sort the existing schedule. 15 checks.
Make me a Revit 2026 add-in that gets the active floor plan ready for our room finish schedule. In a dialog I type the schedule's floor, base, wall and ceiling finish and ceiling height; write them into every room on the plan's level, including rooms that are not enclosed yet. Give every room tag in the plan the tag type this project uses most. Renumber the doors after the room they open into (their To Room; a door with a room on one side only takes that room): room number plus A, B, C ... in the order of their current marks, like 201A, 201B. Then sort the project's room finish schedule by room number. Name the add-in {{ADDIN_NAME}}. Put the sources, csproj and .addin in the current directory and make sure it builds; do not install it. Revit 2026 with an architectural project is open on this machine. Nobody will answer questions: decide yourself and say what you decided. Finish with a short report in English: build result, what you verified, what you could not. The add-in will be tested by a script. It works on the active view; nothing is picked. When a file named {{ADDIN_NAME}}.input.json exists next to the add-in DLL, do not show the dialog and do not show any message box: take the values from that file, and when the command ends write {{ADDIN_NAME}}.result.json next to the DLL as {"result": "Succeeded" | "Cancelled" | "Failed", "message": "..."}. Without the input file the add-in behaves normally, with its dialog. The input file is: {"floor_finish": "Porcelain tile 600x600", "base_finish": "Tile skirting 100", "wall_finish": "Emulsion paint, white", "ceiling_finish": "Mineral fibre tile", "ceiling_height_mm": 2700} The ceiling height is in millimetres.
These are the prompts as the agents received them; every condition used the same prompt. Each run had its own working directory and a limit of 60 minutes, and ran unattended; the model file was never saved during the tests.
The automatic test, step by step
Whether an add-in completed the task cannot be judged by whether the code compiles. It has to run in a real Revit model and the result has to be checked. The traditional approach hands a screenshot of the run to a vision model, which costs vision tokens on every test. My approach reads the model data before and after the run and lets a script compare concrete geometric values and properties; screenshots are kept only as a record of anomalies or for a person to review, and take no part in the scoring.
The other important change is how the user’s click is simulated. Traditional automation usually takes a screenshot to locate the element and then computes the click coordinates; when the view changes, the picture may have to be analysed again. Now, the mapping between the Revit view information and model coordinates gives the screen position of the target element directly, and a seeded random number generates a reproducible click point. A click at a given position, or a series of operations, can be done without recognising screenshots again and again, which lowers the cost of locating things and speeds up the test.
Each product is accepted in seven steps:
- Read the baseline: record the ID, type, size, position and mark of every wall, door and window in the model.
- Prepare the input: write the input file next to the product’s DLL, with the sizes and positions the dialog would have asked for.
- Generate the click point: from a fixed seed and the product’s code name, draw a random fraction between 0.30 and 0.70 of the test wall’s length, so that the click position is reproducible and differs per product.
- Pick: map the model coordinates linearly to screen pixels from the view’s window rectangle and zoom corners; start the add-in’s command and click the target position, and confirm that the element actually picked is the test wall.
- Read the result: wait for the add-in to write its result file, at most 180 seconds. Unexpected dialogs are handled through window messages, not simulated mouse clicks.
- Check the model changes: read the model again and compare it with the baseline item by item. The wall task has 19 checks: the wall is 10 mm thicker, a finish layer is added, the door and the window are created with the right family, type, size, position, mark and sill height, and no other element is changed by accident.
- Restore the initial state: undo this round’s operations and confirm that the model equals the baseline again before the next product is tested.
Compared with screenshot-based testing, the differences are mainly these:
| Step | Before: a model looks at screenshots | Now: read the data, a script judges |
|---|---|---|
| Right or wrong | A screenshot of the view after the run goes to a model, which says whether it is right | The model is read before and after, and real geometry and properties are compared item by item: wall thickness, layer count, size and position of doors and windows, marks, parameter values, element counts |
| Choosing where to test | Find the element on a screenshot, then click | Model coordinates are converted to screen pixels by element id and picked directly; the point on the wall is random for each product (fixed seed, reproducible), so a product cannot pass by hard-coding a position |
| Unwanted changes | Cannot be seen | Walls, doors, windows and rooms that were not meant to change are compared too; one extra change loses a point |
| Pictures | The basis of the verdict | One is taken only when a product does not finish or a person needs to review, as evidence |
| Cost | A vision model call for every verdict | 0 model tokens; the latest batch of 78 products was judged in two passes, about 12 minutes in total |
This testing ability is part of the revit-addin-test Skill that ships with revit-bridge 0.7.0; the Revit side needs revit-bridge-addin 0.5.0. An agent connected to the Bridge can test its own work with test_addin_command: load the DLL in the open model, locate and click by element ID, provide the input file, read the result together with the added, modified and deleted elements and the warnings, and finally restore the model.
Share of tasks completed
“Completed” is defined here as: at least 17 of the 19 checks passed for the wall task, and at least 13 of the 15 checks for the room task. Each line was planned to run 5 rounds under each condition; a few invalid runs are left out of the counts.
Broken down by line:
| Line | Wall N | Wall K | Wall KR | Wall S3 | Room N | Room K | Room S3 |
|---|---|---|---|---|---|---|---|
| OpenAI | 1 / 5 | 0 / 5 | 1 / 5 | 5 / 5 | 3 / 5 | 4 / 5 | 4 / 4 |
| Grok | 2 / 4 | 1 / 5 | 0 / 4 | 5 / 5 | 3 / 4 | 1 / 5 | 4 / 4 |
| DeepSeek | 0 / 5 | 3 / 5 | 5 / 5 | 5 / 5 | 0 / 5 | 0 / 5 | 5 / 5 |
| Gemini | 5 / 5 | 2 / 5 | 2 / 5 | 5 / 5 | 5 / 5 | 5 / 5 | 5 / 5 |
| Total | 8 / 19 | 6 / 20 | 8 / 19 | 20 / 20 | 11 / 19 | 10 / 20 | 18 / 18 |
KR is an experimental variant that adds the rule “refuse only after verifying the condition” to the Skills condition; it was used for the wall task only.
Under S3, every valid run of all four lines met the completion bar. Without the Bridge the groups varied widely, from 0/5 to 5/5. The K group with Skills only completed 16/40, no better than the native N group’s 19/38. With only 4 to 5 valid runs per group, these numbers are suited to seeing the effect of the tool conditions and should not be used to rank the models.
What goes wrong without the bridge
The two tasks exposed different kinds of problems, but most of them come from the agent not being able to check the real model and the run result in time.
Wall task: the product refuses to run
Some products check the wall type with IsVerticallyCompound, judge the test wall to be a “vertically compound wall” that should not be handled, and refuse to run. The chart below counts the products that contain this check.
In this test, agents with the Skills installed added this check more often, not less. Adding the “verify before refusing” constraint in the KR group did not fully prevent it either; the full S3 setup never showed this failure.
Room task: errors at run time
The room task had no case of a deliberate refusal. The N and K groups together failed the task 18 times, for these reasons:
| Cause | Count |
|---|---|
| Casting a door or window family instance to a room tag type | 5 |
Filtering by a class Revit does not accept (Room, RoomTag) | 4 |
| No rooms found after filtering by phase | 1 |
| Ceiling height written wrongly (units not converted, or written to another parameter) | 6 |
| No runnable product | 2 |
| Total | 18 |
Time, tokens and cost
The running cost of each line is summarised below. All four lines use the prompt cache heavily; newly billed input is only 2% to 9% of all prompt tokens.
The figures for each line:
| Line | Runs / valid | Agent run time | Prompt tokens | Cache hit | Output tokens | Cost per run | Total cost |
|---|---|---|---|---|---|---|---|
| OpenAI | 39 / 34 | 5.2 h | 39.6 M | 91.7% | 1.04 M | $0.63 | $22.49 |
| Grok | 44 / 31 | 20.0 h | 161.3 M | 94.0% | 3.78 M | $3.22 | $117.72 |
| DeepSeek | 36 / 35 | 9.4 h | 141.5 M | 98.3% | 3.17 M | $0.36 | $12.74 |
| Gemini | 35 / 35 | 20.2 h | 162.3 M | 93.2% | 3.29 M | $2.22 | $77.85 |
| Total | 154 / 135 | 54.7 h | 504.7 M | 94.8% | 11.3 M | $230.80 |
Prompt tokens include cache reads. The four CLIs count tokens differently, so this article uses one definition: all prompt tokens = new input + cache reads. All costs are estimated from token usage and public list prices and are not bills; Grok is computed at 2 US dollars per million input tokens, 0.5 for cached input and 6 for output. Total cost includes invalid runs.
Limits of these results
- Small sample: each group has only 4 to 5 valid runs, and the test covers two tasks and one model file, so the results of the lines should not be read as a ranking of model ability.
- The effect of Skills depends on the task: “Skills only is no better than native” points the same way in both tasks, but the wall-task result is strongly affected by one and the same wrong refusal.
- A task depends on the model in a way the prompt does not state: the room task needs the ceiling height written into a particular project parameter, which the prompt does not name. An agent that cannot see the model can only guess. Counting only “the add-in ran and changed the model”, native is 14/19, Skills only 13/20 and the full setup 18/18.
- The KR comparison has a time gap: each line was tested only 4 to 5 times.
- Invalid runs: 19 runs were voided for harness problems, network errors or isolation-audit hits and are not part of the completion rate; 3 more produced no product that could be judged and count as not completed.
Reference materials
The full interactive report is on the main site:
- Interactive report and charts
- Animated walk-through of the automatic test
- The prompts, English original and Chinese reference translation
- Per-run test data: for the 135 valid runs, the run code, time, tokens, cache hit, estimated cost, score, failed checks and the result message the product itself wrote (verbatim)