The companion mod already syncs built_machines (machine × recipe × count, from the save) into the project DB, and the app uses it for the block editor's built-vs-required comparison. The AI assistant can't see any of it: asking "what's left to build for the coke block?" or "which blocks are under-built?" currently forces it to propose a gameEval Lua snippet or guess.
Add a read-only blockBuildStatus tool to app/src/server/agent-tools.server.ts:
blockBuildStatus(blockId?) — for one block (or, with no id, every block with a shortfall): per recipe, the machine, the required count (ceiled solved count, same numbers the drafts' buildings field reports), the built count from built_machines, and the missing delta.
- Works offline — it reads the synced tables, no live bridge needed. Note the staleness caveat in the tool description (data is as fresh as the last save-load/resync).
- Mention it in the assistant system prompt's tool index (
agent.ts) so the model reaches for it instead of gameEval for "what's built" questions.
Both sides of the comparison already exist in queries.server.ts; this is mostly wiring plus a compact result shape.
The companion mod already syncs
built_machines(machine × recipe × count, from the save) into the project DB, and the app uses it for the block editor's built-vs-required comparison. The AI assistant can't see any of it: asking "what's left to build for the coke block?" or "which blocks are under-built?" currently forces it to propose agameEvalLua snippet or guess.Add a read-only
blockBuildStatustool toapp/src/server/agent-tools.server.ts:blockBuildStatus(blockId?)— for one block (or, with no id, every block with a shortfall): per recipe, the machine, the required count (ceiled solved count, same numbers the drafts'buildingsfield reports), the built count frombuilt_machines, and the missing delta.agent.ts) so the model reaches for it instead ofgameEvalfor "what's built" questions.Both sides of the comparison already exist in
queries.server.ts; this is mostly wiring plus a compact result shape.