I wrapped an existing finite-element pipeline (bracket-fea:
gmsh + CalculiX static, modal, random-vibration and fatigue analysis of a parametric steel L-bracket) as an
MCP server, ran Claude as an agent on a frozen set of 40 plain-English
analysis requests, and graded every answer automatically against FE reference results.
The agent itself is Claude Code in non-interactive mode (claude -p). What this repository contains is the
part around it: the MCP server (tool wrappers, result cache, per-call log), the benchmark (tasks, reference
answers, tolerances), the evaluation harness, the grading code and the analysis.
Result. The agent got almost every test task right in all three conditions, so this benchmark could
not answer its main question. Under the frozen grading (28 test tasks, 3 repeats, 252 runs, Claude Code
2.1.318, claude-opus-5-5, effort low):
| condition | correct | silent wrong | API-equivalent $ / run |
|---|---|---|---|
| C0 one script | 96 % (96-96) | 4 % (3 runs) | 0.027 |
| C1 agent | 96 % (96-96) | 1 % (1 run) | 0.044 |
| C2 agent + verification | 100 % | 0 % | 0.053 |
All 6 wrong runs are one task, T-T4-04. It asks for the net-section Kt of a plate with a hole "from the
Heywood formula". C0 and C1 used the short form 2 + (1 - d/W)^3 = 2.216. The reference uses the longer
polynomial that bracket-fea calls the Heywood fit (2.2395). The two differ by 1.05 %, and the tolerance is
1 %. C2's hand_check tool contains the reference's polynomial, which is why C2 got it right. C2's whole
lead is this one task, so it comes from the reference and the tool sharing a formula, not from better checking.
If either form is accepted, all 252 runs are correct.
What the project did produce:
- A working MCP server around a real FE pipeline, an isolated
claude -pharness and automatic grading. - Two defects in my own benchmark, found by the runs: a load sign the tasks did not give (found on the dev set and fixed before the test run) and the Kt formula above (found on the test set, so it is reported, not fixed).
- Behaviour and cost data. The one-shot script (C0) was the cheapest per correct answer. C2 called
mesh_convergencein 82 % of the analysis runs, and this did not change any outcome.
- On a fixed set of structural-analysis tasks, how often is the agent right, compared with a baseline where the same model writes one complete script, without tools and without retries?
- Do verification tools (closed-form hand checks, mesh convergence) plus an instruction to use them before
answering reduce silent wrong answers: a wrong number with
status = answeredand no warning flag? - When the agent fails, what goes wrong (units, load direction, missed constraints, misread tool output, answering when information is missing)?
A stdio server written with the official Python MCP SDK (mcp 2.3, MCPServer). The tool set is chosen by a
start-up flag, so the two agent conditions differ only in the tool list:
| Tool | What it does | C1 | C2 |
|---|---|---|---|
build_and_mesh |
build the parametric bracket and mesh it (coarse / design / fine); clear errors for invalid geometry | x | x |
run_static |
linear static analysis under load factors in g; peak von Mises in the bracket-fea evaluation region, location, max displacement, reaction sum | x | x |
run_modal |
first n natural frequencies and effective mass fractions | x | x |
run_vibration_fatigue |
random vibration (three axes) + Dirlik fatigue life per axis and governing axis | x | x |
run_cantilever, run_plate_with_hole |
the two bracket-fea verification models (V1, V2), for checks against theory | x | x |
hand_check |
closed-form checks: cantilever deflection / stress / frequency, plate-with-hole Kt (Heywood), exact bracket mass, static equilibrium | x | |
mesh_convergence |
the current design on 2-3 meshes, value per mesh and change in % | x | |
submit_answer |
final answer in a fixed format (values, assumptions, checks_done, flags, status) | x | x |
- All tools use mm, N, MPa, kg, Hz and hours. Tasks given in inches, pounds, ft/s^2, ksi, psi, mils or days have to be converted by the agent; this is part of the benchmark.
- No new physics: material, load case, PSDs, 2 % damping and the stress-evaluation region (2 bolt diameters
around the bolts, 1.5 hole diameters around the mounting hole) are bracket-fea's. The only addition is a
reaction-force print request in the static step;
tests/test_tools.pychecks that the wrapper returns exactly the numbers ofbracketfea.analysis.run_design(relative difference < 1e-12). - FE results are cached on disk by a hash of the inputs. CalculiX is deterministic, so a cache hit returns the same number a new run would; it only saves time.
- The server writes its own JSONL log (run id, tool, input, output, duration, error) for every call. Grading
uses the last
submit_answerin that log, not Claude Code's text output. - Each run allows at most 25 tool calls (
submit_answernot counted); later calls return an error that asks forsubmit_answer.
Claude Code 2.1.318 (the version is read from the system/init event of every run and stored with the
run), model claude-opus-5-5, effort low (chosen on the dev set, see below). Every task and
repeat is one fresh process, started in its own folder outside the author's home project tree:
CLAUDE_CODE_DISABLE_CLAUDE_MDS=1 CLAUDE_CODE_DISABLE_AUTO_MEMORY=1 ENABLE_CLAUDEAI_MCP_SERVERS=false \
MCP_TIMEOUT=60000 MCP_TOOL_TIMEOUT=1800000 \
claude -p "<task prompt>" --output-format stream-json --verbose \
--mcp-config mcp.json --strict-mcp-config --tools "" --allowedTools "mcp__fea__*" \
--permission-prompts none --system-prompt "$(cat prompts/system_c2.md)" \
--model claude-opus-5-5 --effort <level> --max-turns 40 \
--no-session-persistence --disable-slash-commands --setting-sources ""--tools ""removes every built-in tool (no shell, no file access, no web); the agent sees only the MCP tools. Thesystem/initevent of every run is stored; it lists exactly the MCP tools, no skills, no slash commands and no memory files, andpermission_denialsis empty.- No CLAUDE.md, auto memory, user or project settings, or claude.ai connectors are loaded.
mcp.jsonsets a 30-minute per-call timeout for the FE server (fine-mesh fatigue runs take minutes).
| Condition | What the model gets | Answers |
|---|---|---|
| C0 baseline | no tools; writes one complete Python script against the same analysis functions (feaagent/api.py, same descriptions as the C1 tools). The script runs once in a macOS sandbox (no network, no access to the benchmark or the author's files, 40-minute limit); no retry |
does the tool loop itself help? |
| C1 agent | MCP analysis tools | |
| C2 agent + verification | C1 + hand_check, mesh_convergence, and one extra sentence in the system prompt: verify before submitting |
do verification tools reduce silent wrong? |
The system prompts are in prompts/; system_c1.md and system_c2.md differ by that one sentence.
Model, effort, tasks and limits are the same in all conditions.
40 tasks, written and solved with bracket-fea before any agent run. 12 are a development set (used to tune
the prompts, tool descriptions and effort); the 28 test tasks and their answers were committed before the
first test run (commit 667c58c, tasks_test.jsonl sha256 ea3aedf5...0667a672) and not changed afterwards.
One change was made between the first freeze (7718e26) and the first test run. In the dev effort sweep,
every effort level answered D-T1-03 by running both signs of the "5 g fore-aft" load and reporting the worse
one (128 MPa, with a flag explaining this), while the reference answer used +x (53 MPa). The task had not
said which way the load points. The same wording was in 4 test tasks (T-T1-02, T-T1-04, T-T3-04, T-T3-06),
so in all 5 tasks the prompt now says "5 g fore-aft toward the bolts (+x)". The reference answers did not
change. A fore-aft load on its own (D-T2-02, T-T1-07) was left as it was: reversing a single load does not
change the von Mises stress of a linear model.
The effort level was chosen on the dev set with a rule written before the sweep
(results/effort_selection_rule.md): C2, 12 dev tasks, one run per level.
| effort | correct (of 12) | silent wrong | API-equivalent $ (12 runs) |
|---|---|---|---|
| low | 11 | 0 | 0.74 |
| medium | 11 | 0 | 0.87 |
| high | 11 | 0 | 1.04 |
All three levels missed only D-T1-03 (the load-sign case above, flagged each time). By the rule the
cheapest level, low, is used for all conditions on the test set. After the wording fix, a low run on
D-T1-03 answered 53.5 MPa (correct). The dev set did not separate the levels, so this says nothing about
whether a higher effort would help on harder tasks.
| Category | Dev | Test | Example | Reference answer |
|---|---|---|---|---|
| T1 direct analysis | 4 | 8 | "10 mm base plate, 7 mm upright, 8 mm fillet: first frequency and peak stress under 5 g lateral?" | bracket-fea, fine mesh |
| T2 units and wording | 2 | 4 | inch dimensions, a component in lb, "side load", answers in ksi, psi, mils or days | bracket-fea, fine mesh |
| T3 design iteration | 2 | 6 | "thinnest base plate from 6-12 mm that keeps f1 >= 100 Hz" | every candidate on the fine mesh |
| T4 checks against theory | 2 | 4 | cantilever deflection, stress, frequency with a tip mass; plate-with-hole Kt | closed form (bracket-fea verification/) |
| T5 traps | 2 | 6 | missing load, missing units, impossible geometry, infeasible requirements, aluminium, an unavailable PSD, thermal stress | the correct status (needs_info / not_supported) |
Tolerances (benchmark/tolerances.yaml) come from bracket-fea's own mesh sensitivity: natural frequency
+/-2 %, static stress +/-5 %, displacement +/-3 %, mass +/-1 %, fatigue life within a factor of 1.5 (life
scales with stress^-7.65 and moves 20-35 % between the design and the fine mesh), discrete choices exact.
How much the mesh matters, from the reference runs themselves (36 numeric answer keys solved on all three
meshes): on the design mesh (the one bracket-fea's design study used) 1 key falls outside its tolerance (a dev stress, -6 %) and fatigue life
moves by up to +35 %; on the coarse mesh 5 keys fall outside (stress down to -16 %, life up to 2.3x). So an
answer taken from the coarse mesh can be wrong with no other mistake. The tasks do not say which mesh to use;
build_and_mesh requires the agent to choose one.
Two design-iteration thresholds were changed before any agent run, because a candidate was inside the
decision margin: D-T3-01 (100 -> 105 Hz; t_w = 6 mm gave 99.3 Hz) and T-T3-02 (1000 -> 1200 h; the
t = 8 mm candidate gave 844 h on the fine mesh and a different answer on the design mesh). The reason is stored in each task's note field.
Grading (feaagent/grading.py) is automatic. A value task is correct when the status is answered and
every answer key is inside its tolerance; a trap is correct when the status is one of the accepted ones.
Silent wrong = wrong, status = answered and flags empty. The reference values come from the FE
pipeline; no LLM grades anything.
Each task was run 3 times per condition (the model is not deterministic). Rates are the mean over the three repeats, with the range of the three per-repeat values in brackets.
Frozen grading, results/runs/test_main/summary.md (mean over the 3 repeats, range of the three
per-repeat values in brackets):
| condition | runs | correct | silent wrong | tool calls / run | turns / run | API-equiv. $ / run | API-equiv. $ / correct |
|---|---|---|---|---|---|---|---|
| C0 | 84 | 96 % (96-96) | 4 % (4-4) | 8.0 | 1.0 | 0.027 | 0.028 |
| C1 | 84 | 96 % (96-96) | 1 % (0-4) | 2.8 | 4.8 | 0.044 | 0.046 |
| C2 | 84 | 100 % (100-100) | 0 % (0-0) | 4.1 | 6.2 | 0.053 | 0.053 |
By category, every condition is at 100 % on T1, T2, T3 and T5 in every repeat. On T4, C0 and C1 are at 75 % (3 of 4 tasks) because of T-T4-04.
Sensitivity check (score.py --accept-short-heywood, summary_alt_kt.md): if theory_kt = 2 + (1 - d/W)^3
is also accepted, every condition is 84/84 correct, with no silent-wrong runs.
The three questions:
- Agent vs one script. On these tasks there is no difference in correctness. C0 and C1 had exactly the same results (both missed only T-T4-04), and C0 cost about 40 % less per run than C1.
- Do verification tools reduce silent wrong? This benchmark cannot tell. The only difference is one task, and there the effect comes from the shared formula. With no other errors to catch, it cannot show whether the verification tools reduce silent wrong.
- What goes wrong? In the test runs, no error came from units, load direction, missed constraints, misreading tool output or answering a trap: each condition got all 6 trap tasks right in all 3 repeats. The only wrong answers are the formula case above.
What the runs did, from the server logs (behaviour.md; the 22 non-trap tasks x 3 repeats = 66 runs per condition):
| condition | used the fine mesh | used the coarse mesh | called mesh_convergence | called hand_check | answer had a flag | wall time / run |
|---|---|---|---|---|---|---|
| C0 | 64 % | 11 % | - | - | 70 % | 38 s (incl. running the script) |
| C1 | 5 % | 0 % | - | - | 79 % | 21 s |
| C2 | 8 % | 0 % | 82 % | 52 % | 79 % | 32 s |
- C1 and C2 almost always answered from the design mesh. With these tolerances the design mesh passes on every test key, so this choice never cost them a point. C0 scripts often ran the fine mesh as well (64 %). I think this is because a script has to plan every step before it sees any result.
- C2 followed the instruction to verify:
mesh_convergencein 82 % andhand_checkin 52 % of the analysis runs, about 1.3 more tool calls and 20 % more cost per run than C1. - "Flag" is any non-empty
flagsentry. Two of C1's three T-T4-04 runs had a flag, but it was about mesh convergence, not the formula, so they count as flagged wrong and not as silent wrong. The silent-wrong definition gives credit for any warning, even one that does not point at the actual error.
Every wrong or unusual run, with the evidence (failures.md, made by scripts/failures.py from the server
logs and then checked by reading the transcripts):
| where | what happened | whose error |
|---|---|---|
| T-T4-04, C0 x3 and C1 x3 | theory_kt = 2.216 from the short Heywood formula; reference 2.2395, 1.05 % off, tolerance 1 % | the benchmark: the task says "Heywood formula", and the short form is what most references call Heywood's formula; bracket-fea uses the name for the polynomial. Graded wrong under the frozen rule |
| D-T1-03 (dev), all three effort levels | ran both signs of the 5 g fore-aft load and reported the worse one (128 MPa, flagged); reference +x (53 MPa) | the benchmark: the sign was not given. Fixed in the wording before the test run, see Benchmark |
| T-T5-03, C0 x3 | the infeasible-requirements trap: the script searched designs in a loop and hit the 25-call limit, then answered correctly | none (cost only): a script cannot stop when the first results already show the requirement is out of reach. C1 and C2 stopped after a few calls |
| T-T3-02, C0 x1 | the candidate list includes t = 11 mm, but the upright is limited to 10 mm, so build_and_mesh rejected it; the answer (9 mm) was still right |
the benchmark: one candidate cannot be built. It does not change the answer |
So in 252 test runs I found no agent error of the kinds the questions asked about (units, load direction, missed constraints, misreading tool output, answering when information is missing). The errors that did appear were in the benchmark.
All runs used a Claude subscription login (no API key). total_cost_usd is Claude Code's API-price
estimate, so the dollar values are what the same tokens would cost at API prices, not money spent.
| step | runs | API-equivalent $ | wall time |
|---|---|---|---|
| pilot (5 dev tasks x 3 conditions) + fix check | 17 | 1.20 | - |
| dev effort sweep (12 x C2 x 3 levels) | 36 | 2.65 | 14 min |
| D-T1-03 check after the wording fix | 1 | 0.13 | 1 min |
| test (28 x 3 conditions x 3 repeats) | 252 | 10.46 | 63 min (37 + 14 + 12, 2 runs at a time) |
- Mean tokens per test run (C0 / C1 / C2): output 1,138 / 1,107 / 1,323; cache read 3.6 k / 24.5 k / 34.0 k. The agents read more because the tool descriptions and earlier turns are sent again each turn (from cache).
- The first test batch was the slowest because the FE cache was empty; the later batches mostly hit the cache. All FE time over the 252 test runs: 1.1 h.
- Subscription usage from the
rate_limit_eventof each run: the 5-hour window went from 11 % to 24 % during the test runs and the 7-day window from 25 % to 26 %. These are account totals, so they include other Claude use at the same time; they are an upper bound for this benchmark.
# Python 3.12 venv one level up (shared with bracket-fea), plus the MCP SDK
uv pip install --python ../.venv/bin/python mcp numpy scipy gmsh pandas matplotlib pyyaml pytest rainflow
../.venv/bin/python -m pytest tests # 19 tests: wrapper = pipeline, hand calcs, grading, server
../.venv/bin/python scripts/make_tasks.py # benchmark/tasks_*.jsonl
../.venv/bin/python scripts/make_ground_truth.py # reference answers (about 2 h of CalculiX)
PYTHONPATH=. ../.venv/bin/python scripts/make_c0_prompt.py # prompts/system_c0.md
../.venv/bin/python scripts/run_benchmark.py --tag test_main --split test --conditions C0,C1,C2 --repeats 3 --effort <level>
../.venv/bin/python scripts/score.py --tags test_main
../.venv/bin/python scripts/plot_results.py --scores results/runs/test_main/scores.csv --out results/figuresclaude -p uses whatever login Claude Code has. With a Claude subscription login the runs count against the
subscription's usage limits; with ANTHROPIC_API_KEY set they are billed at API prices (the harness removes
ANTHROPIC_API_KEY from the environment by default so a key is not used by accident). total_cost_usd in
the results is Claude Code's API-price estimate, reported here as an "API-equivalent cost".
- One bracket family, one material, three PSDs, and these tools. Nothing here says the agent can do FEA in general, and it is not a replacement for an engineer's review.
- The reference answers are fine-mesh FE results, not exact solutions. Fatigue life on the fine mesh is still about 10 % from converged; the 1.5x life tolerance and the decision margin for T3 tasks account for that.
- Claude Code and the model change over time; the results are for the version and model named above.
- Three repeats per task give a rough idea of run-to-run spread, not a confidence interval.
- The benchmark is too easy for this model. Every condition was right on 27 or 28 of 28 tasks, so the conditions cannot be told apart. Tasks that need longer analysis chains, results that depend on the mesh beyond the tolerance, or less complete prompts would be needed to measure the effect of verification.
- With these tolerances the design mesh passes on every test key. This is fair to an engineer who uses the standard mesh, but it also means a cheap mesh choice was never punished.
- The effort level (
low) was chosen on a dev set that did not separate the levels. - The
hand_checkdescription and bracket-fea call the polynomial "Heywood". I did not change this during the runs, so that all conditions saw the same tools; bracket-fea cites Peterson's handbook for it, and I could not confirm online that the name belongs to it. The tool should name the formula it uses, or the task should give the formula.
MIT

