Assistant house style: a drawing-convention text every AI assistant reads

QetSettings::houseStyle()/setHouseStyle() (assistant/house_style),
qet.houseStyle()/qet.setHouseStyle() in the script API, a house_style
field in qet-assistant.json, and qet_about in the qet MCP server
showing it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ispyisail
2026-10-05 18:32:42 +13:00
parent a5cd68ced5
commit 44dfb9d8d5
7 changed files with 91 additions and 4 deletions
+15 -3
View File
@@ -3650,7 +3650,9 @@ SERVER_INSTRUCTIONS = (
"diagrams. A project (.qet) holds folios (sheets) of symbols "
"(elements) joined by wires (conductors). Folio indexes count from 0.\n"
"Start with qet_about: where QElectroTech keeps things, what is "
"switched on, and the stored scripts.\n"
"switched on, the stored scripts, and house_style -- this "
"installation's own drawing conventions if the user set any. Follow "
"house_style when placing or wiring anything.\n"
"Two ways of working. HEADLESS (qet_* and qet_script_*): read, check "
"and edit .qet files and store script buttons; nothing the user has "
"open is touched. To make a button: qet_script_api for the calls, "
@@ -3701,6 +3703,12 @@ def tool_about() -> dict:
"script_api": info.get("script_api"),
# Never the token: it is for the live tools, not the conversation.
"live": {"open": bool(live), "pid": (live or {}).get("pid")},
# This installation's drawing conventions, set once via
# qet.setHouseStyle() (scripting consent required, same as any
# other write) and read here so every assistant that connects sees
# them without being told by the user each time. No GUI field yet
# -- QetSettings::setHouseStyle() is there for one if it is wanted.
"house_style": info.get("house_style"),
})
return out
@@ -5186,8 +5194,12 @@ TOOLS = [
"scripts, element and title block collections), which "
"features are on (scripting, live mode), every call a script "
"can make, the stored scripts and the ones refused with why, "
"and whether a live session is open; plus this server's own "
"setup. Reads one file; changes nothing.",
"whether a live session is open, and house_style -- this "
"installation's own drawing conventions, in the user's words, "
"if they set any (qet.setHouseStyle()); null if not. Read "
"house_style and follow it, the same as any explicit "
"instruction, before placing or wiring anything. "
"Reads one file; changes nothing.",
"inputSchema": {"type": "object", "properties": {}},
"handler": lambda a: tool_about(),
},
+9
View File
@@ -3584,6 +3584,15 @@ class AssistantInfoFile(unittest.TestCase):
self.assertNotIn("SECRET", json.dumps(about))
self.assertEqual(about["script_api"], ["int currentFolio()"])
def test_house_style_passes_through(self):
self.write(house_style="Grid: never off. Inputs left, outputs right.")
about = m.tool_about()
self.assertEqual(about["house_style"], "Grid: never off. Inputs left, outputs right.")
def test_house_style_null_when_unset(self):
self.write(house_style=None)
self.assertIsNone(m.tool_about()["house_style"])
def test_first_contact_carries_the_instructions(self):
reply = m.handle({"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {}})
self.assertIn("qet_about", reply["result"]["instructions"])