Repository navigation
Commit 063a2f4
committed
fix(ai): make the editor tools discoverable and state what the user is on
The system prompt told the model to call getEditorState first and to reach
for takeScreenshot / execJsInLivePreview "listed below", but none of the
phoenix-editor tools were in its tool list: they sat behind ToolSearch. It
was being told to use tools it could not see, so it fell back to what it
could — an Explore subagent grepping the project — and only discovered the
editor tools later, usually to verify work already finished.
- alwaysLoad on the four "look at what the user is looking at" tools:
getEditorState, takeScreenshot, execJsInLivePreview, controlEditor.
~1.2k tokens on the cached system block; one ToolSearch round-trip costs
a whole model turn, so it pays for itself immediately.
- searchHint on all ten, worded in the terms someone would search with
(browser, rendered page, DOM, screenshot, responsive) rather than the
"live preview" jargon, so the six deferred ones stay findable.
- Prepend one line naming the active file, the unsaved buffers and what the
live preview renders. The panel assembles it, since the data and the
context chips both live there; this side only renders the prose. Says
plainly when a list is complete, because told only that a list *can* be
truncated the model re-checks with getEditorState — the exact lookup this
is meant to save.
Measured on the same prompt against a page with a runtime-only bug:
baseline +alwaysLoad +both
ToolSearch calls 2 0 0
first move Explore↴ Explore↴ the right file
model turns 10 9 6-9
wall time 85.5s 76.1s 17-27s
cost $0.2335 $0.2960 $0.08-0.11
The line itself costs ~106 tokens typically, ~195 worst case.1 parent e0fe117 commit 063a2f4
2 files changed
Lines changed: 86 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
315 | 315 | | |
316 | 316 | | |
317 | 317 | | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
318 | 351 | | |
319 | 352 | | |
320 | 353 | | |
| |||
855 | 888 | | |
856 | 889 | | |
857 | 890 | | |
858 | | - | |
| 891 | + | |
| 892 | + | |
859 | 893 | | |
860 | 894 | | |
861 | 895 | | |
| |||
874 | 908 | | |
875 | 909 | | |
876 | 910 | | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
877 | 917 | | |
878 | 918 | | |
879 | 919 | | |
| |||
896 | 936 | | |
897 | 937 | | |
898 | 938 | | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
899 | 942 | | |
900 | 943 | | |
901 | 944 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
157 | | - | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
158 | 162 | | |
159 | 163 | | |
160 | 164 | | |
| |||
219 | 223 | | |
220 | 224 | | |
221 | 225 | | |
222 | | - | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
223 | 231 | | |
224 | 232 | | |
225 | 233 | | |
| |||
265 | 273 | | |
266 | 274 | | |
267 | 275 | | |
268 | | - | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
269 | 281 | | |
270 | 282 | | |
271 | 283 | | |
| |||
330 | 342 | | |
331 | 343 | | |
332 | 344 | | |
333 | | - | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
334 | 350 | | |
335 | 351 | | |
336 | 352 | | |
| |||
364 | 380 | | |
365 | 381 | | |
366 | 382 | | |
367 | | - | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
368 | 387 | | |
369 | 388 | | |
370 | 389 | | |
| |||
383 | 402 | | |
384 | 403 | | |
385 | 404 | | |
386 | | - | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
387 | 409 | | |
388 | 410 | | |
389 | 411 | | |
| |||
457 | 479 | | |
458 | 480 | | |
459 | 481 | | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
460 | 485 | | |
461 | 486 | | |
462 | 487 | | |
| |||
527 | 552 | | |
528 | 553 | | |
529 | 554 | | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
530 | 558 | | |
531 | 559 | | |
532 | 560 | | |
| |||
574 | 602 | | |
575 | 603 | | |
576 | 604 | | |
577 | | - | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
578 | 609 | | |
579 | 610 | | |
580 | 611 | | |
| |||
607 | 638 | | |
608 | 639 | | |
609 | 640 | | |
610 | | - | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
611 | 645 | | |
612 | 646 | | |
613 | 647 | | |
| |||
0 commit comments