Skip to content

Commit 27e91f7

Browse files
committed
fix: give excalidraw skill its own section in agent system prompt
The excalidraw skill targets MCP tools (read_me, create_view) not the widgetRenderer component, so it needs its own top-level section in the system prompt rather than being nested under widgetRenderer instructions.
1 parent f0ff080 commit 27e91f7

2 files changed

Lines changed: 25 additions & 6 deletions

File tree

apps/agent/main.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@
1010
from src.query import query_data
1111
from src.todos import AgentState, todo_tools
1212
from src.form import generate_form
13-
from skills import load_all_skills
13+
from skills import load_all_skills, load_skill
1414

15-
# Load all visualization skills
16-
_skills_text = load_all_skills()
15+
# Load visualization skills (excalidraw loaded separately — it targets MCP tools, not widgetRenderer)
16+
_widget_skills_text = load_all_skills(exclude=["excalidraw-diagram-skill"])
17+
_excalidraw_skill_text = load_skill("excalidraw-diagram-skill")
1718

1819
agent = create_agent(
1920
model=ChatOpenAI(model="gpt-5.4-2026-03-05"),
@@ -46,7 +47,18 @@
4647
4748
Follow the skills below for how to produce high-quality visuals:
4849
49-
{_skills_text}
50+
{_widget_skills_text}
51+
52+
## Excalidraw Diagramming Skills
53+
54+
You also have access to Excalidraw MCP tools (`Excalidraw:read_me` and
55+
`Excalidraw:create_view`) for creating animated, interactive diagrams.
56+
57+
When a user asks you to draw a diagram, flowchart, architecture map, or any
58+
visual that would benefit from the Excalidraw canvas — use the Excalidraw MCP
59+
tools instead of `widgetRenderer`. Follow the skill below exactly:
60+
61+
{_excalidraw_skill_text}
5062
""",
5163
)
5264

apps/agent/skills/__init__.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,17 @@ def load_skill(name: str) -> str:
1717
return path.read_text()
1818

1919

20-
def load_all_skills() -> str:
21-
"""Load and concatenate all .txt skill files in this directory."""
20+
def load_all_skills(exclude: list[str] | None = None) -> str:
21+
"""Load and concatenate all .txt skill files in this directory.
22+
23+
Args:
24+
exclude: Optional list of skill names (without extension) to skip.
25+
"""
26+
skip = set(exclude or [])
2227
parts: list[str] = []
2328
for path in sorted(_SKILLS_DIR.glob("*.txt")):
29+
if path.stem in skip:
30+
continue
2431
parts.append(f"\n\n{'='*60}\n# SKILL: {path.stem}\n{'='*60}\n\n")
2532
parts.append(path.read_text())
2633
return "".join(parts)

0 commit comments

Comments
 (0)