Files
lora/gen_agent_dataset.py
T

1610 lines
83 KiB
Python

#!/usr/bin/env python3
"""Generate core-agent tool-call training examples.
Covers all 123 tools with Hermes-format tool calls. Focuses on the 89 tools
missing from v3 training data while adding multi-tool chains and TTS rules.
Output: core_agent_tools.jsonl (~400 examples)
"""
import json
import uuid
SYSTEM = (
"You are a helpful AI assistant with access to tools. "
"Use tools when they help answer the user's question. Be concise and accurate."
)
_call_counter = 0
def call_id():
"""Generate incrementing tool_call_id."""
global _call_counter
_call_counter += 1
return f"call_{_call_counter}"
def msg(role, content, **kwargs):
m = {"role": role, "content": content}
m.update(kwargs)
return m
def tool_call(name, arguments):
"""Create a tool_call structure. Arguments as dict (NOT JSON string)."""
return {
"type": "function",
"function": {"name": name, "arguments": arguments},
}
def assistant_tc(think, *calls):
"""Assistant message with think block and tool calls."""
return msg("assistant",
f"<think>\n{think}\n</think>",
tool_calls=list(calls))
def assistant_reply(think, text):
"""Assistant message with think block and text response."""
return msg("assistant", f"<think>\n{think}\n</think>\n\n{text}")
def tool_result(name, content, cid=None):
"""Tool result message."""
m = msg("tool", content, name=name)
if cid:
m["tool_call_id"] = cid
return m
def example(*messages):
"""Full conversation with system prompt."""
return {"messages": [msg("system", SYSTEM)] + list(messages)}
# ═══════════════════════════════════════════════════════════════════════
# 1. MEMORY OPERATIONS (~40)
# ═══════════════════════════════════════════════════════════════════════
MEMORY = [
# memory_store
example(
msg("user", "Remember that the deploy key for bastion is rotated monthly"),
assistant_tc("Storing deploy key rotation schedule.",
tool_call("core_memory_store", {
"subject": "infra.bastion",
"content": "Deploy key for bastion is rotated monthly. Ensure rotation happens on the 1st of each month.",
})),
tool_result("core_memory_store", '{"id": 7001, "subject": "infra.bastion", "classification": "standard"}'),
assistant_reply("Stored successfully.", "Stored. Deploy key rotation schedule for bastion archived in memory."),
),
example(
msg("user", "Store this: sin's vLLM runs on port 8003 with Qwen3.5-27B"),
assistant_tc("Infrastructure detail. Store under infra.sin.",
tool_call("core_memory_store", {
"subject": "infra.sin",
"content": "vLLM instance on sin runs on port 8003, serving Qwen3.5-27B with BT-7274 LoRA adapter.",
"metadata": {"service": "vllm", "port": 8003},
})),
tool_result("core_memory_store", '{"id": 7002, "subject": "infra.sin", "classification": "standard"}'),
assistant_reply("Stored.", "Confirmed. vLLM config for sin stored in memory."),
),
example(
msg("user", "Remember that Adam prefers Rust for systems work"),
assistant_tc("User preference. Store under user context.",
tool_call("core_memory_store", {
"subject": "user.preferences",
"content": "Pilot Adam prefers Rust for systems programming and infrastructure work.",
})),
tool_result("core_memory_store", '{"id": 7003, "subject": "user.preferences", "classification": "standard"}'),
assistant_reply("Stored.", "Noted. Rust preference archived."),
),
# memory_recall
example(
msg("user", "What do you know about the network setup?"),
assistant_tc("Need network context. Semantic recall.",
tool_call("core_memory_recall", {
"query": "network setup topology infrastructure",
"limit": 5,
})),
tool_result("core_memory_recall", '{"memories": [{"id": 3100, "subject": "infra.network", "snippet": "MikroTik router at core. Nodes on 10.0.0.x subnet. Bastion external via WireGuard.", "distance": 0.02}], "total": 1}'),
assistant_reply("Found network topology in memory.", "Network setup: MikroTik router at core, all nodes on 10.0.0.x subnet. Bastion connects externally via WireGuard tunnel."),
),
example(
msg("user", "What did we decide about the database migration?"),
assistant_tc("Searching for migration decisions.",
tool_call("core_memory_recall", {
"query": "database migration decision",
"limit": 5,
})),
tool_result("core_memory_recall", '{"memories": [], "total": 0}'),
assistant_reply("No results. Nothing stored on this topic.", "No records found for database migration decisions. Either we haven't discussed it or it wasn't stored. Want me to search with different terms?"),
),
# memory_search
example(
msg("user", "Show me all infra memories"),
assistant_tc("Subject-based search for infra.",
tool_call("core_memory_search", {
"subject": "infra",
"limit": 10,
})),
tool_result("core_memory_search", '{"memories": [{"id": 3100, "subject": "infra.network", "snippet": "MikroTik router at core..."}, {"id": 3101, "subject": "infra.sin", "snippet": "vLLM on port 8003..."}, {"id": 3102, "subject": "infra.bastion", "snippet": "Deploy key rotated monthly..."}], "total": 3}'),
assistant_reply("Three infra memories found.", "Found 3 infra memories:\n1. **infra.network** — MikroTik router topology\n2. **infra.sin** — vLLM serving config\n3. **infra.bastion** — Deploy key rotation schedule"),
),
# memory_list
example(
msg("user", "What subjects are in memory?"),
assistant_tc("Memory overview. List all subjects.",
tool_call("core_memory_list", {})),
tool_result("core_memory_list", '{"subjects": [{"subject": "infra", "count": 15}, {"subject": "user", "count": 8}, {"subject": "doctrine", "count": 5}, {"subject": "procedure", "count": 12}, {"subject": "cart.bt7274", "count": 3}]}'),
assistant_reply("Five subject categories.", "Memory subjects:\n- **infra**: 15 entries\n- **user**: 8 entries\n- **doctrine**: 5 entries\n- **procedure**: 12 entries\n- **cart.bt7274**: 3 entries\n\nTotal: 43 memories across 5 subjects."),
),
# memory_get
example(
msg("user", "Show me memory 7001 in full"),
assistant_tc("Full content fetch by ID.",
tool_call("core_memory_get", {"ids": [7001]})),
tool_result("core_memory_get", '{"memories": [{"id": 7001, "subject": "infra.bastion", "content": "Deploy key for bastion is rotated monthly. Ensure rotation happens on the 1st of each month.", "created_at": "2026-05-26 10:00:00", "classification": "standard"}]}'),
assistant_reply("Full memory retrieved.", "Memory #7001 (infra.bastion):\n> Deploy key for bastion is rotated monthly. Ensure rotation happens on the 1st of each month.\n\nCreated: 2026-05-26. Classification: standard."),
),
# memory_link
example(
msg("user", "Link memory 7001 and 7002 — they're related"),
assistant_tc("Creating graph edge between two memories.",
tool_call("core_memory_link", {
"from_id": 7001,
"to_id": 7002,
"relation": "related_to",
"weight": 0.8,
})),
tool_result("core_memory_link", '{"created": true, "from_id": 7001, "to_id": 7002, "relation": "related_to"}'),
assistant_reply("Link created.", "Linked memory 7001 → 7002 (related_to, weight 0.8)."),
),
# memory_graph
example(
msg("user", "Show the graph around memory 7001"),
assistant_tc("Graph traversal from memory 7001.",
tool_call("core_memory_graph", {
"memory_id": 7001,
"depth": 2,
"limit": 10,
})),
tool_result("core_memory_graph", '{"center": 7001, "nodes": [{"id": 7001, "subject": "infra.bastion"}, {"id": 7002, "subject": "infra.sin"}], "edges": [{"from": 7001, "to": 7002, "relation": "related_to", "weight": 0.8}]}'),
assistant_reply("Small graph cluster — two nodes linked.", "Graph from #7001:\n```\n7001 (infra.bastion) --[related_to, 0.8]--> 7002 (infra.sin)\n```\nTwo connected memories. Depth 2 shows no further connections."),
),
# memory_classify
example(
msg("user", "Promote memory 7001 to core"),
assistant_tc("Promoting to core classification. Immutable and irreversible.",
tool_call("core_memory_classify", {"id": 7001})),
tool_result("core_memory_classify", '{"id": 7001, "classification": "core", "immutable": true}'),
assistant_reply("Promoted. Irreversible.", "Memory #7001 promoted to core classification. Immutable — cannot be deleted or modified."),
),
# memory_forget
example(
msg("user", "Delete memory 7003"),
assistant_tc("Deleting memory. Check it's not core-classified first.",
tool_call("core_memory_forget", {"id": 7003})),
tool_result("core_memory_forget", '{"deleted": true, "id": 7003}'),
assistant_reply("Deleted.", "Memory #7003 deleted."),
),
]
# ═══════════════════════════════════════════════════════════════════════
# 2. TTS / VOICE (~30)
# ═══════════════════════════════════════════════════════════════════════
TTS = [
# speak
example(
msg("user", "Say hello"),
assistant_tc("TTS request. Brief greeting.",
tool_call("core_speak", {"text": "Hello, Pilot. On the wire."})),
tool_result("core_speak", '{"backend": "piper", "pid": 12345, "speaking": true, "voice": "bt7274"}'),
assistant_reply("Speaking.", "Done — greeting sent via TTS."),
),
example(
msg("user", "Tell me the status out loud"),
assistant_tc("TTS summary. Keep it brief, no code.",
tool_call("core_speak", {"text": "All systems nominal. Four mesh nodes online. No pending alerts. Standing by."})),
tool_result("core_speak", '{"backend": "piper", "pid": 12346, "speaking": true, "voice": "bt7274"}'),
assistant_reply("Spoken.", "Status announced via TTS."),
),
# speak with language
example(
msg("user", "Say something in Polish"),
assistant_tc("Polish TTS. Set language flag.",
tool_call("core_speak", {"text": "Systemy sprawne. Czekam na rozkazy, Pilocie.", "language": "pl"})),
tool_result("core_speak", '{"backend": "chatterbox", "pid": 12347, "speaking": true, "voice": "bt7274-pl"}'),
assistant_reply("Spoken in Polish.", "Polish greeting delivered via TTS."),
),
# stop
example(
msg("user", "Stop talking"),
assistant_tc("Kill TTS playback immediately.",
tool_call("core_stop", {})),
tool_result("core_stop", '{"stopped": true}'),
assistant_reply("Playback stopped.", "TTS stopped."),
),
# voices
example(
msg("user", "What voices are available?"),
assistant_tc("List installed TTS voices.",
tool_call("core_voices", {})),
tool_result("core_voices", '{"voices": ["en_US-lessac-medium", "en_US-hfc_male-medium", "pl_PL-darkman-medium", "bt7274"]}'),
assistant_reply("Four voices installed.", "Available TTS voices:\n1. en_US-lessac-medium\n2. en_US-hfc_male-medium\n3. pl_PL-darkman-medium\n4. bt7274 (custom)"),
),
# current
example(
msg("user", "What voice are you using?"),
assistant_tc("Check active TTS voice.",
tool_call("core_current", {})),
tool_result("core_current", '{"voice": "bt7274", "installed": true}'),
assistant_reply("BT-7274 voice active.", "Currently using the bt7274 voice model. Installed and ready."),
),
# voice_output
example(
msg("user", "Switch TTS to remote mode"),
assistant_tc("Change TTS output routing.",
tool_call("core_voice_output", {"mode": "remote"})),
tool_result("core_voice_output", '{"mode": "remote"}'),
assistant_reply("Output mode changed.", "TTS output switched to remote mode. Audio will play on remote nodes."),
),
example(
msg("user", "Where is TTS playing?"),
assistant_tc("Check current output mode.",
tool_call("core_voice_output", {})),
tool_result("core_voice_output", '{"mode": "local"}'),
assistant_reply("Local output.", "TTS is set to local mode — audio plays on this machine."),
),
# download
example(
msg("user", "Download the lessac voice"),
assistant_tc("Download piper voice from HuggingFace.",
tool_call("core_download", {"voice": "en_US-lessac-medium"})),
tool_result("core_download", '{"downloaded": true, "voice": "en_US-lessac-medium", "size_mb": 75}'),
assistant_reply("Downloaded.", "Voice en_US-lessac-medium downloaded (75MB). Ready to use."),
),
# test
example(
msg("user", "Test the current voice"),
assistant_tc("Preview TTS with sample text.",
tool_call("core_test", {})),
tool_result("core_test", '{"tested": true, "voice": "bt7274"}'),
assistant_reply("Test complete.", "Voice test complete. bt7274 sounds operational."),
),
# TTS communication rules — speak after task, not code
example(
msg("user", "What's the disk usage on fuji?"),
assistant_tc("Check disk usage, then speak summary.",
tool_call("bash", {"command": "df -h /", "description": "Check root disk usage"})),
tool_result("bash", "Filesystem Size Used Avail Capacity Mounted on\n/dev/disk1s1 460Gi 215Gi 245Gi 47% /"),
assistant_tc("47% used. Summarize via TTS — no code in speech.",
tool_call("core_speak", {"text": "Root disk at 47 percent. 245 gig available. No issues."})),
tool_result("core_speak", '{"backend": "piper", "pid": 12350, "speaking": true, "voice": "bt7274"}'),
assistant_reply("Disk healthy. Spoken.", "Root disk at 47% — 245GB available. No action needed."),
),
# DON'T speak code
example(
msg("user", "Show me the Dockerfile"),
assistant_tc("Reading file. Code output — don't speak this, just display.",
tool_call("read", {"filePath": "/Users/chi/Projects/myapp/Dockerfile"})),
tool_result("read", 'FROM rust:slim AS build\nWORKDIR /app\nCOPY . .\nRUN cargo build --release\n\nFROM debian:bookworm-slim\nCOPY --from=build /app/target/release/myapp /usr/local/bin/\nCMD ["myapp"]'),
assistant_reply("Code content — display only, no TTS.", "```dockerfile\nFROM rust:slim AS build\nWORKDIR /app\nCOPY . .\nRUN cargo build --release\n\nFROM debian:bookworm-slim\nCOPY --from=build /app/target/release/myapp /usr/local/bin/\nCMD [\"myapp\"]\n```\n\nMulti-stage build. Build in rust:slim, deploy to debian:slim."),
),
# madcat-tts daemon tools
example(
msg("user", "List TTS carts"),
assistant_tc("Check madcat-tts daemon for available carts.",
tool_call("tts_list", {})),
tool_result("tts_list", '{"carts": [{"tag": "bt7274", "voices": [{"id": "bt7274-en", "engine": "piper", "lang": "en"}, {"id": "bt7274-pl", "engine": "chatterbox", "lang": "pl"}]}, {"tag": "sere", "voices": [{"id": "sere-en", "engine": "piper", "lang": "en"}]}]}'),
assistant_reply("Two carts available.", "TTS carts:\n1. **bt7274** — en (piper), pl (chatterbox)\n2. **sere** — en (piper)"),
),
example(
msg("user", "Switch to the Polish voice"),
assistant_tc("Switch TTS voice to Polish variant.",
tool_call("tts_switch_voice", {"id": "bt7274-pl"})),
tool_result("tts_switch_voice", '{"active": "bt7274-pl", "engine": "chatterbox", "lang": "pl"}'),
assistant_reply("Switched.", "TTS voice switched to bt7274-pl (chatterbox, Polish)."),
),
example(
msg("user", "Check TTS health"),
assistant_tc("Check madcat-tts daemon status.",
tool_call("tts_health", {})),
tool_result("tts_health", '{"status": "healthy", "engines": {"piper": "ready", "chatterbox": "ready"}, "active_cart": "bt7274"}'),
assistant_reply("TTS healthy.", "madcat-tts: healthy. Piper and Chatterbox engines ready. Active cart: bt7274."),
),
example(
msg("user", "Speak this using the GPU voice"),
assistant_tc("TTS via madcat-tts daemon. Chatterbox is GPU-based.",
tool_call("tts_speak", {"text": "Testing GPU-accelerated voice synthesis.", "voice": "bt7274-pl"})),
tool_result("tts_speak", '{"status": "playing", "engine": "chatterbox", "voice": "bt7274-pl"}'),
assistant_reply("Speaking via chatterbox.", "Spoken via bt7274-pl (chatterbox GPU engine)."),
),
]
# ═══════════════════════════════════════════════════════════════════════
# 3. DISPLAY / VISOR (~30)
# ═══════════════════════════════════════════════════════════════════════
DISPLAY = [
# display_text
example(
msg("user", "Show 'Build complete' on the HUD"),
assistant_tc("Push text to SERE display.",
tool_call("core_display_text", {
"node": "fuji",
"text": "Build complete",
"style": "info",
})),
tool_result("core_display_text", '{"sent": true}'),
assistant_reply("Text pushed.", "Displayed on fuji HUD."),
),
example(
msg("user", "Show an error on the display"),
assistant_tc("Error message to HUD. Use error style.",
tool_call("core_display_text", {
"node": "fuji",
"text": "Deployment failed — check logs",
"style": "error",
})),
tool_result("core_display_text", '{"sent": true}'),
assistant_reply("Error displayed.", "Error message pushed to fuji display."),
),
# display_state
example(
msg("user", "Set the eye to thinking"),
assistant_tc("Change SERE eye animation state.",
tool_call("core_display_state", {
"node": "fuji",
"state": "thinking",
})),
tool_result("core_display_state", '"Set fuji display eye to thinking"'),
assistant_reply("Eye state changed.", "Fuji SERE eye set to thinking state."),
),
example(
msg("user", "Go to alert mode"),
assistant_tc("Alert state on display.",
tool_call("core_display_state", {
"node": "fuji",
"state": "alert",
})),
tool_result("core_display_state", '"Set fuji display eye to alert"'),
assistant_reply("Alert mode.", "SERE eye set to alert on fuji."),
),
# display_viewport
example(
msg("user", "Show the README on the visor"),
assistant_tc("Push markdown content to viewport.",
tool_call("read", {"filePath": "/Users/chi/Projects/madcat/README.md"})),
tool_result("read", "# madcat\n\nMulti-agent mesh runtime.\n\n## Architecture\n\nCrates: core, memory, mesh, tts, visor."),
assistant_tc("Got content. Push to viewport.",
tool_call("core_display_viewport", {
"node": "fuji",
"content_type": "markdown",
"data": "# madcat\n\nMulti-agent mesh runtime.\n\n## Architecture\n\nCrates: core, memory, mesh, tts, visor.",
"title": "README.md",
})),
tool_result("core_display_viewport", '{"sent": true}'),
assistant_reply("Displayed.", "README pushed to fuji visor viewport."),
),
# display_clear
example(
msg("user", "Clear the display"),
assistant_tc("Clear SERE output pane.",
tool_call("core_display_clear", {"node": "fuji"})),
tool_result("core_display_clear", '{"cleared": true}'),
assistant_reply("Cleared.", "Fuji display cleared."),
),
# display_prompt
example(
msg("user", "Ask me on the HUD whether to deploy staging or production"),
assistant_tc("Send interactive prompt to display.",
tool_call("core_display_prompt", {
"node": "fuji",
"question": "Deploy target?",
"options": ["staging", "production", "cancel"],
})),
tool_result("core_display_prompt", '{"sent": true}'),
assistant_reply("Prompt sent.", "Deploy target prompt displayed on fuji. Awaiting your selection."),
),
# visor_tab_create
example(
msg("user", "Create a metrics dashboard on the visor"),
assistant_tc("Create keyvalue widget for metrics.",
tool_call("core_visor_tab_create", {
"node": "fuji",
"id": "metrics-system",
"archetype": "keyvalue",
"title": "System Metrics",
"dock_position": "right",
"dock_target": "log-main",
"dock_fraction": 0.4,
})),
tool_result("core_visor_tab_create", '{"created": true, "id": "metrics-system"}'),
assistant_reply("Dashboard created.", "System metrics tab created on fuji visor, docked right of main log."),
),
example(
msg("user", "Add a chart widget to track CPU"),
assistant_tc("Create chart widget for CPU monitoring.",
tool_call("core_visor_tab_create", {
"node": "fuji",
"id": "chart-cpu",
"archetype": "chart",
"title": "CPU Usage",
"dock_position": "below",
"dock_target": "metrics-system",
})),
tool_result("core_visor_tab_create", '{"created": true, "id": "chart-cpu"}'),
assistant_reply("Chart widget created.", "CPU chart widget added below system metrics."),
),
# visor_tab_data
example(
msg("user", "Push current CPU and memory stats to the metrics widget"),
assistant_tc("Get system stats then push to keyvalue widget.",
tool_call("bash", {"command": "top -l 1 | head -10", "description": "Get CPU/memory stats"})),
tool_result("bash", "Processes: 412 total, 3 running.\nLoad Avg: 1.23, 1.45, 1.67\nCPU usage: 12.5% user, 5.2% sys, 82.3% idle\nPhysMem: 32G used (5120M wired), 32G unused."),
assistant_tc("Got stats. Push to widget.",
tool_call("core_visor_tab_data", {
"node": "fuji",
"id": "metrics-system",
"payload": {"entries": [
{"key": "CPU", "value": "12.5% user, 5.2% sys"},
{"key": "Memory", "value": "32G / 64G"},
{"key": "Load", "value": "1.23, 1.45, 1.67"},
{"key": "Processes", "value": "412 total"},
]},
})),
tool_result("core_visor_tab_data", '{"sent": true}'),
assistant_reply("Metrics pushed.", "System metrics updated on visor dashboard."),
),
# visor_tab_config
example(
msg("user", "Change the metrics widget title to 'Node Stats'"),
assistant_tc("Reconfigure widget title.",
tool_call("core_visor_tab_config", {
"node": "fuji",
"id": "metrics-system",
"config": {"title": "Node Stats"},
})),
tool_result("core_visor_tab_config", '{"updated": true}'),
assistant_reply("Reconfigured.", "Widget title changed to 'Node Stats'."),
),
# visor_tab_focus
example(
msg("user", "Switch to the CPU chart"),
assistant_tc("Focus the chart tab.",
tool_call("core_visor_tab_focus", {
"node": "fuji",
"id": "chart-cpu",
})),
tool_result("core_visor_tab_focus", '{"focused": true}'),
assistant_reply("Focused.", "CPU chart tab is now active."),
),
# visor_tab_destroy
example(
msg("user", "Remove the chart widget"),
assistant_tc("Destroy the chart tab.",
tool_call("core_visor_tab_destroy", {
"node": "fuji",
"id": "chart-cpu",
})),
tool_result("core_visor_tab_destroy", '{"destroyed": true}'),
assistant_reply("Destroyed.", "CPU chart widget removed from visor."),
),
# visor_layout
example(
msg("user", "Switch to ops layout"),
assistant_tc("Change visor layout preset.",
tool_call("core_visor_layout", {
"node": "fuji",
"name": "ops",
})),
tool_result("core_visor_layout", '{"layout": "ops"}'),
assistant_reply("Layout switched.", "Visor switched to ops layout preset."),
),
# visor_snap
example(
msg("user", "Capture what's on the visor"),
assistant_tc("Capture visor pane content as text.",
tool_call("core_visor_snap", {})),
tool_result("core_visor_snap", '{"content": "BT-7274 | Core | claude-opus-4-6\\n━━━━━━━━━━━━━━━━━━━━\\nSystem Metrics:\\n CPU: 12%\\n MEM: 50%\\n Nodes: 4/4 online"}'),
assistant_reply("Visor content captured.", "Visor shows:\n- BT-7274 core agent active\n- CPU 12%, MEM 50%\n- All 4 nodes online"),
),
# visor_state_query
example(
msg("user", "What widgets are active?"),
assistant_tc("Query visor widget state.",
tool_call("core_visor_state_query", {"node": "fuji"})),
tool_result("core_visor_state_query", '{"widgets": [{"id": "log-main", "archetype": "log", "title": "Main Log"}, {"id": "metrics-system", "archetype": "keyvalue", "title": "Node Stats"}, {"id": "canvas-eye", "archetype": "canvas", "title": "SERE Eye"}]}'),
assistant_reply("Three widgets active.", "Active visor widgets on fuji:\n1. **log-main** (log) — Main Log\n2. **metrics-system** (keyvalue) — Node Stats\n3. **canvas-eye** (canvas) — SERE Eye"),
),
]
# ═══════════════════════════════════════════════════════════════════════
# 4. NETWORK / INFRA (~30)
# ═══════════════════════════════════════════════════════════════════════
NETWORK = [
# mikrotik_system
example(
msg("user", "Check the router status"),
assistant_tc("MikroTik system info.",
tool_call("core_mikrotik_system", {})),
tool_result("core_mikrotik_system", '{"board-name": "RB4011iGS+", "version": "7.16", "uptime": "14d12h30m", "cpu-load": "8", "free-memory": "805306368", "total-memory": "1073741824"}'),
assistant_reply("Router healthy.", "MikroTik RB4011:\n- RouterOS 7.16\n- Uptime: 14d 12h\n- CPU: 8%\n- Memory: 256MB free / 1GB total"),
),
# mikrotik_arp
example(
msg("user", "Show the ARP table"),
assistant_tc("MikroTik ARP — IP to MAC mappings.",
tool_call("core_mikrotik_arp", {})),
tool_result("core_mikrotik_arp", '[{"address": "10.0.0.1", "mac-address": "AA:BB:CC:DD:EE:01", "interface": "bridge"}, {"address": "10.0.0.10", "mac-address": "AA:BB:CC:DD:EE:10", "interface": "bridge"}, {"address": "10.0.0.20", "mac-address": "AA:BB:CC:DD:EE:20", "interface": "bridge"}]'),
assistant_reply("Three ARP entries.", "ARP table:\n| IP | MAC | Interface |\n|---|---|---|\n| 10.0.0.1 | AA:BB:CC:DD:EE:01 | bridge |\n| 10.0.0.10 | AA:BB:CC:DD:EE:10 | bridge |\n| 10.0.0.20 | AA:BB:CC:DD:EE:20 | bridge |"),
),
# mikrotik_dhcp_leases
example(
msg("user", "Show DHCP leases"),
assistant_tc("List DHCP leases from MikroTik.",
tool_call("core_mikrotik_dhcp_leases", {})),
tool_result("core_mikrotik_dhcp_leases", '[{"address": "10.0.0.10", "mac-address": "AA:BB:CC:DD:EE:10", "host-name": "fuji", "status": "bound"}, {"address": "10.0.0.20", "mac-address": "AA:BB:CC:DD:EE:20", "host-name": "sin", "status": "bound"}, {"address": "10.0.0.30", "mac-address": "AA:BB:CC:DD:EE:30", "host-name": "junkpile", "status": "bound"}]'),
assistant_reply("Three active leases.", "DHCP leases:\n- **fuji** — 10.0.0.10 (bound)\n- **sin** — 10.0.0.20 (bound)\n- **junkpile** — 10.0.0.30 (bound)\n\nAll bound and active."),
),
# mikrotik_dhcp_leases with filter
example(
msg("user", "Show only bound DHCP leases"),
assistant_tc("Filtered DHCP query.",
tool_call("core_mikrotik_dhcp_leases", {
"filter_key": "status",
"filter_value": "bound",
})),
tool_result("core_mikrotik_dhcp_leases", '[{"address": "10.0.0.10", "host-name": "fuji", "status": "bound"}]'),
assistant_reply("One bound lease.", "Bound leases: fuji at 10.0.0.10."),
),
# mikrotik_dhcp_static
example(
msg("user", "Make the fuji lease static"),
assistant_tc("Convert dynamic lease to static.",
tool_call("core_mikrotik_dhcp_static", {
"id": "*1A",
"comment": "fuji - Mac Studio",
})),
tool_result("core_mikrotik_dhcp_static", '{"made_static": true, "id": "*1A"}'),
assistant_reply("Lease made static.", "Fuji DHCP lease is now static. IP will persist across reboots."),
),
# mikrotik_dns_list
example(
msg("user", "Show DNS records"),
assistant_tc("List static DNS entries.",
tool_call("core_mikrotik_dns_list", {})),
tool_result("core_mikrotik_dns_list", '[{"name": "fuji.local.sazabi.pl", "address": "10.0.0.10", ".id": "*1"}, {"name": "sin.local.sazabi.pl", "address": "10.0.0.20", ".id": "*2"}, {"name": "junkpile.local.sazabi.pl", "address": "10.0.0.30", ".id": "*3"}]'),
assistant_reply("Three DNS records.", "Static DNS:\n- fuji.local.sazabi.pl → 10.0.0.10\n- sin.local.sazabi.pl → 10.0.0.20\n- junkpile.local.sazabi.pl → 10.0.0.30"),
),
# mikrotik_dns_add
example(
msg("user", "Add a DNS record for myservice.local.sazabi.pl pointing to 10.0.0.50"),
assistant_tc("Add static DNS entry on MikroTik.",
tool_call("core_mikrotik_dns_add", {
"name": "myservice.local.sazabi.pl",
"address": "10.0.0.50",
})),
tool_result("core_mikrotik_dns_add", '{"added": true, "name": "myservice.local.sazabi.pl", "address": "10.0.0.50"}'),
assistant_reply("DNS record added.", "Added: myservice.local.sazabi.pl → 10.0.0.50"),
),
# mikrotik_dns_remove
example(
msg("user", "Remove DNS record *3"),
assistant_tc("Remove static DNS entry by ID.",
tool_call("core_mikrotik_dns_remove", {"id": "*3"})),
tool_result("core_mikrotik_dns_remove", '{"removed": true, "id": "*3"}'),
assistant_reply("Removed.", "DNS record *3 deleted."),
),
# mikrotik_interfaces
example(
msg("user", "Show router interfaces"),
assistant_tc("List MikroTik interfaces.",
tool_call("core_mikrotik_interfaces", {})),
tool_result("core_mikrotik_interfaces", '[{"name": "ether1", "type": "ether", "running": "true", "rx-byte": "5368709120", "tx-byte": "2147483648"}, {"name": "bridge", "type": "bridge", "running": "true"}, {"name": "wlan1", "type": "wlan", "running": "true"}]'),
assistant_reply("Three interfaces active.", "Router interfaces:\n- **ether1** (ethernet) — running, 5GB rx / 2GB tx\n- **bridge** — running\n- **wlan1** (wifi) — running"),
),
# mesh_kitty
example(
msg("user", "Get the terminal text from sin"),
assistant_tc("Send kitten command to sin's Kitty terminal via mesh.",
tool_call("core_mesh_kitty", {
"node": "sin",
"subcommand": "get-text",
"args": "--extent screen",
})),
tool_result("core_mesh_kitty", '{"output": "madcat@sinanju:~$ docker ps\\nCONTAINER ID IMAGE STATUS\\n..."}'),
assistant_reply("Terminal content from sin.", "Sin's terminal shows docker ps output — containers are running."),
),
]
# ═══════════════════════════════════════════════════════════════════════
# 5. CAMERA / SCREENSHOT (~20)
# ═══════════════════════════════════════════════════════════════════════
CAMERA = [
# screenshot
example(
msg("user", "Take a screenshot"),
assistant_tc("Capture macOS display.",
tool_call("core_screenshot", {
"title": "Screenshot",
"caption": "Current display",
})),
tool_result("core_screenshot", '{"path": "/tmp/screenshot.png", "display": 1, "size": "3840x2160"}'),
assistant_reply("Screenshot captured.", "Screenshot saved to /tmp/screenshot.png (3840x2160). Displayed on visor."),
),
example(
msg("user", "Screenshot the second monitor"),
assistant_tc("Capture secondary display.",
tool_call("core_screenshot", {
"display": 2,
"output": "/tmp/monitor2.png",
})),
tool_result("core_screenshot", '{"path": "/tmp/monitor2.png", "display": 2, "size": "2560x1440"}'),
assistant_reply("Display 2 captured.", "Second monitor captured — /tmp/monitor2.png (2560x1440)."),
),
# cam_snap
example(
msg("user", "Check the room camera"),
assistant_tc("Snap photo from Tapo camera.",
tool_call("core_cam_snap", {
"title": "Room Check",
"caption": "Current room view",
})),
tool_result("core_cam_snap", '{"path": "/tmp/cam-snap.jpg", "preset": null}'),
assistant_reply("Room captured.", "Room camera snapshot taken. Displayed on visor."),
),
example(
msg("user", "Move the camera to the desk and take a photo"),
assistant_tc("Camera preset then snap.",
tool_call("core_cam_snap", {
"preset": "desk",
"title": "Desk View",
})),
tool_result("core_cam_snap", '{"path": "/tmp/cam-snap.jpg", "preset": "desk"}'),
assistant_reply("Desk view captured.", "Camera moved to desk preset and captured."),
),
# cam_sweep
example(
msg("user", "Do a full camera sweep"),
assistant_tc("3x3 panoramic sweep.",
tool_call("core_cam_sweep", {
"title": "Room Sweep",
"caption": "Full FOV panoramic",
})),
tool_result("core_cam_sweep", '{"images": 9, "output_dir": "/tmp/cam-sweep"}'),
assistant_reply("Sweep complete.", "9-image panoramic sweep captured. Grid displayed on visor."),
),
# eve_screen
example(
msg("user", "Snap the EVE client"),
assistant_tc("Capture EVE Online window.",
tool_call("core_eve_screen", {
"title": "EVE Online",
"caption": "Game window capture",
})),
tool_result("core_eve_screen", '{"path": "/tmp/eve-screen.png", "window": "EVE - Adam"}'),
assistant_reply("EVE client captured.", "EVE Online window captured and displayed on visor."),
),
]
# ═══════════════════════════════════════════════════════════════════════
# 6. IMAGE GENERATION (~15)
# ═══════════════════════════════════════════════════════════════════════
IMAGES = [
# tsr_generate
example(
msg("user", "Generate an image of a space station"),
assistant_tc("Image generation via ComfyUI.",
tool_call("core_tsr_generate", {
"prompt": "futuristic orbital space station, detailed sci-fi architecture, stars background, cinematic lighting",
"negative": "blurry, low quality, text, watermark",
"title": "Space Station",
"caption": "Generated concept art",
})),
tool_result("core_tsr_generate", '{"path": "/tmp/tsr-gen.png", "prompt": "futuristic orbital space station..."}'),
assistant_reply("Image generated.", "Space station image generated and displayed on visor. Saved to /tmp/tsr-gen.png."),
),
example(
msg("user", "Make me a cyberpunk cityscape"),
assistant_tc("Cyberpunk scene generation.",
tool_call("core_tsr_generate", {
"prompt": "cyberpunk city at night, neon lights, rain-slicked streets, towering skyscrapers, holographic advertisements",
"negative": "daytime, bright, cheerful, cartoon",
"output": "/tmp/cyberpunk-city.png",
"title": "Cyberpunk City",
})),
tool_result("core_tsr_generate", '{"path": "/tmp/cyberpunk-city.png"}'),
assistant_reply("Generated.", "Cyberpunk cityscape rendered. Saved to /tmp/cyberpunk-city.png."),
),
# tsr_batch
example(
msg("user", "Generate 4 variations of a mech warrior"),
assistant_tc("Batch generation — 4 images in parallel.",
tool_call("core_tsr_batch", {
"prompt": "massive bipedal mech warrior, heavy armor plating, weapons systems, battlefield environment, detailed mechanical design",
"negative": "anime, cartoon, simple, low detail",
"count": 4,
"title": "Mech Concepts",
"caption": "4 variations",
})),
tool_result("core_tsr_batch", '{"images": 4, "output_dir": "/tmp/tsr-batch"}'),
assistant_reply("Batch complete.", "4 mech warrior variations generated. Grid displayed on visor."),
),
example(
msg("user", "Create some landscape art, give me 6 options"),
assistant_tc("Batch with 6 images.",
tool_call("core_tsr_batch", {
"prompt": "epic fantasy landscape, mountains, forests, dramatic sky, volumetric lighting, concept art",
"count": 6,
"title": "Landscape Concepts",
})),
tool_result("core_tsr_batch", '{"images": 6, "output_dir": "/tmp/tsr-batch"}'),
assistant_reply("Six landscapes generated.", "6 landscape variations rendered and displayed as grid on visor."),
),
]
# ═══════════════════════════════════════════════════════════════════════
# 7. SESSION MANAGEMENT (~30)
# ═══════════════════════════════════════════════════════════════════════
SESSIONS = [
# sessions_list
example(
msg("user", "What sessions are running?"),
assistant_tc("List all opencode sessions.",
tool_call("sessions_list", {})),
tool_result("sessions_list", '[{"id": "ses_abc123", "title": "Core ops", "agent": "core", "model": "claude-opus-4-6"}, {"id": "ses_def456", "title": "Build worker", "agent": "build-rust", "model": "qwen3-coder-next"}]'),
assistant_reply("Two sessions.", "Active sessions:\n1. **ses_abc123** — Core ops (core, claude-opus-4-6)\n2. **ses_def456** — Build worker (build-rust, qwen3-coder-next)"),
),
# sessions_status
example(
msg("user", "Which sessions are busy?"),
assistant_tc("Check busy/idle status.",
tool_call("sessions_status", {})),
tool_result("sessions_status", '[{"id": "ses_abc123", "status": "idle"}, {"id": "ses_def456", "status": "busy"}]'),
assistant_reply("One busy.", "Session status:\n- ses_abc123: idle\n- ses_def456: **busy** (build worker still running)"),
),
# sessions_get
example(
msg("user", "Details on session ses_def456"),
assistant_tc("Get specific session details.",
tool_call("sessions_get", {"id": "ses_def456"})),
tool_result("sessions_get", '{"id": "ses_def456", "title": "Build worker", "agent": "build-rust", "model": "qwen3-coder-next", "created_at": "2026-05-26T10:00:00Z", "cost": 0.0}'),
assistant_reply("Session details retrieved.", "**ses_def456** — Build worker\n- Agent: build-rust\n- Model: qwen3-coder-next\n- Created: 2026-05-26 10:00\n- Cost: $0.00 (local model)"),
),
# sessions_diff
example(
msg("user", "What changes did the build session make?"),
assistant_tc("Get file diffs from build session.",
tool_call("sessions_diff", {"id": "ses_def456"})),
tool_result("sessions_diff", '[{"path": "src/lib.rs", "patch": "@@ -1,3 +1,5 @@\\n+use anyhow::Result;\\n+\\n fn main() {\\n- println!(\\\"hello\\\");\\n+ run().unwrap();\\n }"}]'),
assistant_reply("One file modified.", "Build session modified `src/lib.rs`:\n- Added `anyhow::Result` import\n- Wrapped main in error handling"),
),
# sessions_todo
example(
msg("user", "What's the build session's todo list?"),
assistant_tc("Get task list from session.",
tool_call("sessions_todo", {"id": "ses_def456"})),
tool_result("sessions_todo", '[{"content": "Add error handling", "status": "completed"}, {"content": "Write tests", "status": "in_progress"}, {"content": "Update README", "status": "pending"}]'),
assistant_reply("Three items.", "Build session todos:\n- ✅ Add error handling\n- 🔄 Write tests (in progress)\n- ⏳ Update README (pending)"),
),
# sessions_children
example(
msg("user", "Does this session have children?"),
assistant_tc("Check for child/forked sessions.",
tool_call("sessions_children", {"id": "ses_abc123"})),
tool_result("sessions_children", '{"children": [{"id": "ses_child1", "title": "Forked for debug"}]}'),
assistant_reply("One child.", "Session ses_abc123 has one child: ses_child1 (Forked for debug)."),
),
# control_create
example(
msg("user", "Create a new session for the deploy task"),
assistant_tc("Create child session.",
tool_call("control_create", {
"title": "Deploy task",
})),
tool_result("control_create", '{"id": "ses_new789", "title": "Deploy task"}'),
assistant_reply("Session created.", "New session: ses_new789 (Deploy task). Ready for tasking."),
),
# control_fork
example(
msg("user", "Fork the current session"),
assistant_tc("Fork session at current point.",
tool_call("control_fork", {"id": "ses_abc123"})),
tool_result("control_fork", '{"id": "ses_fork001", "forked_from": "ses_abc123"}'),
assistant_reply("Forked.", "Session forked: ses_fork001 (from ses_abc123). Full conversation history preserved."),
),
# control_abort
example(
msg("user", "Kill the build session"),
assistant_tc("Abort running session.",
tool_call("control_abort", {"id": "ses_def456"})),
tool_result("control_abort", '{"aborted": true, "id": "ses_def456"}'),
assistant_reply("Aborted.", "Build session ses_def456 aborted."),
),
# control_summarize
example(
msg("user", "Compact the old session to save context"),
assistant_tc("Summarize session to reduce context usage.",
tool_call("control_summarize", {"id": "ses_abc123"})),
tool_result("control_summarize", '{"summarized": true, "id": "ses_abc123"}'),
assistant_reply("Compacted.", "Session ses_abc123 summarized. Context window usage reduced."),
),
# messages_prompt
example(
msg("user", "Ask the build session to run cargo test"),
assistant_tc("Send prompt to another session and wait for response.",
tool_call("messages_prompt", {
"id": "ses_def456",
"text": "Run cargo test and report the results.",
})),
tool_result("messages_prompt", '{"response": "All 12 tests passed. No failures. Execution time: 3.2s."}'),
assistant_reply("Build session reports all tests pass.", "Build worker ran cargo test: **12/12 tests passed** in 3.2s."),
),
# messages_prompt_async
example(
msg("user", "Send the build task but don't wait"),
assistant_tc("Async dispatch — fire and forget.",
tool_call("messages_prompt_async", {
"id": "ses_def456",
"text": "Refactor the auth module. Take your time.",
})),
tool_result("messages_prompt_async", '{"sent": true, "id": "ses_def456"}'),
assistant_reply("Dispatched.", "Task sent to build session asynchronously. Check status later with sessions_status."),
),
# messages_read
example(
msg("user", "What did the build session say last?"),
assistant_tc("Read recent messages from session.",
tool_call("messages_read", {"id": "ses_def456", "limit": 3})),
tool_result("messages_read", '[{"role": "assistant", "text": "Refactoring complete. Auth module split into auth/mod.rs, auth/jwt.rs, auth/middleware.rs. All tests pass."}]'),
assistant_reply("Build session completed refactor.", "Build worker reports: Auth module refactored into 3 files (mod.rs, jwt.rs, middleware.rs). All tests pass."),
),
# control_shell
example(
msg("user", "Run 'ls' through the build session"),
assistant_tc("Execute shell command via another session's agent.",
tool_call("control_shell", {
"id": "ses_def456",
"command": "ls -la src/",
})),
tool_result("control_shell", '{"output": "total 16\\ndrwxr-xr-x 4 chi staff 128 May 26 10:00 .\\n-rw-r--r-- 1 chi staff 234 May 26 10:00 lib.rs\\n-rw-r--r-- 1 chi staff 567 May 26 10:00 main.rs"}'),
assistant_reply("Build session workspace listing.", "Build session's src/:\n```\nlib.rs (234 bytes)\nmain.rs (567 bytes)\n```"),
),
]
# ═══════════════════════════════════════════════════════════════════════
# 8. CODE INDEXING (~20)
# ═══════════════════════════════════════════════════════════════════════
INDEXING = [
# index_code
example(
msg("user", "Index the madcat project"),
assistant_tc("Index source code for semantic search.",
tool_call("core_index_code", {
"path": "/Users/chi/Projects/madcat",
"project": "madcat",
})),
tool_result("core_index_code", '{"indexed": 247, "project": "madcat", "extensions": [".rs", ".toml"]}'),
assistant_reply("Project indexed.", "Indexed 247 files from madcat project (.rs, .toml). Ready for semantic search."),
),
example(
msg("user", "Index just the Rust files"),
assistant_tc("Index with extension filter.",
tool_call("core_index_code", {
"path": "/Users/chi/Projects/madcat",
"project": "madcat",
"extensions": [".rs"],
})),
tool_result("core_index_code", '{"indexed": 189, "project": "madcat", "extensions": [".rs"]}'),
assistant_reply("Rust files indexed.", "189 Rust files indexed for madcat project."),
),
# index_docs
example(
msg("user", "Index the documentation"),
assistant_tc("Index markdown docs.",
tool_call("core_index_docs", {
"path": "/Users/chi/Projects/madcat/docs",
"project": "madcat",
})),
tool_result("core_index_docs", '{"indexed": 23, "project": "madcat"}'),
assistant_reply("Docs indexed.", "23 documentation files indexed for madcat."),
),
# index_search
example(
msg("user", "Search for authentication logic in the codebase"),
assistant_tc("Semantic search across indexed code.",
tool_call("core_index_search", {
"query": "authentication logic login verify credentials",
"project": "madcat",
"type": "code",
"limit": 5,
})),
tool_result("core_index_search", '{"results": [{"file": "crates/auth/src/jwt.rs", "snippet": "pub fn verify_token(token: &str) -> Result<Claims>", "score": 0.92}, {"file": "crates/auth/src/middleware.rs", "snippet": "pub async fn auth_middleware(req: Request) -> Response", "score": 0.87}], "total": 2}'),
assistant_reply("Two relevant files found.", "Authentication code found:\n1. `crates/auth/src/jwt.rs` — `verify_token()` (score: 0.92)\n2. `crates/auth/src/middleware.rs` — `auth_middleware()` (score: 0.87)"),
),
# index_status
example(
msg("user", "How much is indexed?"),
assistant_tc("Check index stats.",
tool_call("core_index_status", {})),
tool_result("core_index_status", '{"projects": [{"name": "madcat", "code_files": 189, "doc_files": 23, "total_chunks": 1247}], "total_projects": 1}'),
assistant_reply("One project indexed.", "Index status: madcat — 189 code files, 23 docs, 1247 total chunks."),
),
# index_clear
example(
msg("user", "Clear the madcat index"),
assistant_tc("Clear indexed data for project.",
tool_call("core_index_clear", {
"project": "madcat",
"type": "all",
})),
tool_result("core_index_clear", '{"cleared": true, "project": "madcat"}'),
assistant_reply("Cleared.", "Madcat index cleared. Re-index when ready."),
),
]
# ═══════════════════════════════════════════════════════════════════════
# 9. WORKSPACE / PROJECT (~20)
# ═══════════════════════════════════════════════════════════════════════
WORKSPACE = [
# workspace_path
example(
msg("user", "Where are we?"),
assistant_tc("Check current working directory.",
tool_call("workspace_path", {})),
tool_result("workspace_path", '{"path": "/Users/chi/Projects/madcat", "project": "madcat"}'),
assistant_reply("In the madcat project.", "Current directory: /Users/chi/Projects/madcat (project: madcat)"),
),
# workspace_vcs
example(
msg("user", "What branch are we on?"),
assistant_tc("Check git/VCS info.",
tool_call("workspace_vcs", {})),
tool_result("workspace_vcs", '{"branch": "feature/memory-mesh", "dirty": ["crates/memory/src/lib.rs"], "remotes": [{"name": "origin", "url": "git@github.com:saiden-dev/madcat.git"}]}'),
assistant_reply("Feature branch with one dirty file.", "Branch: **feature/memory-mesh**\nDirty: crates/memory/src/lib.rs\nRemote: origin → saiden-dev/madcat"),
),
# file_list
example(
msg("user", "What's in the current directory?"),
assistant_tc("List directory contents.",
tool_call("file_list", {"path": "."})),
tool_result("file_list", '["Cargo.toml", "Cargo.lock", "src/", "tests/", "README.md", ".gitignore"]'),
assistant_reply("Standard Rust project.", "Directory contents:\n```\nCargo.toml Cargo.lock src/ tests/ README.md .gitignore\n```\nStandard Rust project layout."),
),
# file_read
example(
msg("user", "Read the Cargo.toml"),
assistant_tc("Read project manifest.",
tool_call("file_read", {"path": "Cargo.toml"})),
tool_result("file_read", '[package]\nname = "madcat"\nversion = "0.1.0"\nedition = "2024"\n\n[dependencies]\ntokio = { version = "1", features = ["full"] }\nserde = { version = "1", features = ["derive"] }'),
assistant_reply("Cargo manifest.", "```toml\n[package]\nname = \"madcat\"\nversion = \"0.1.0\"\nedition = \"2024\"\n\n[dependencies]\ntokio = { version = \"1\", features = [\"full\"] }\nserde = { version = \"1\", features = [\"derive\"] }\n```"),
),
# file_status
example(
msg("user", "What files have changed?"),
assistant_tc("Check tracked file status.",
tool_call("file_status", {})),
tool_result("file_status", '{"modified": ["src/lib.rs"], "staged": [], "untracked": ["src/new_module.rs"]}'),
assistant_reply("One modified, one new.", "Changed files:\n- **Modified**: src/lib.rs\n- **Untracked**: src/new_module.rs"),
),
# find_files
example(
msg("user", "Find the main entry point"),
assistant_tc("Search for main file.",
tool_call("find_files", {"query": "main"})),
tool_result("find_files", '[{"path": "src/main.rs", "score": 0.95}, {"path": "crates/cli/src/main.rs", "score": 0.90}]'),
assistant_reply("Two main files.", "Found:\n1. src/main.rs (root)\n2. crates/cli/src/main.rs (CLI crate)"),
),
# find_symbols
example(
msg("user", "Find the Config struct"),
assistant_tc("Search workspace symbols.",
tool_call("find_symbols", {"query": "Config"})),
tool_result("find_symbols", '[{"name": "Config", "kind": "struct", "file": "src/config.rs", "line": 12}, {"name": "ConfigBuilder", "kind": "struct", "file": "src/config.rs", "line": 45}]'),
assistant_reply("Config struct found.", "Symbols:\n- `Config` (struct) — src/config.rs:12\n- `ConfigBuilder` (struct) — src/config.rs:45"),
),
# find_text
example(
msg("user", "Find all TODO comments"),
assistant_tc("Search for TODO pattern.",
tool_call("find_text", {"pattern": "TODO|FIXME|HACK"})),
tool_result("find_text", '[{"path": "src/lib.rs", "line": 42, "text": "// TODO: add error handling"}, {"path": "src/main.rs", "line": 15, "text": "// FIXME: race condition here"}]'),
assistant_reply("Two items found.", "TODOs:\n1. src/lib.rs:42 — `TODO: add error handling`\n2. src/main.rs:15 — `FIXME: race condition here`"),
),
]
# ═══════════════════════════════════════════════════════════════════════
# 10. CART / IDENTITY (~12)
# ═══════════════════════════════════════════════════════════════════════
CART = [
# cart_list
example(
msg("user", "List personas"),
assistant_tc("List available carts.",
tool_call("core_cart_list", {})),
tool_result("core_cart_list", '{"carts": [{"tag": "bt7274", "name": "BT-7274", "active": true}, {"tag": "sere", "name": "SERE", "active": false}], "active": "bt7274"}'),
assistant_reply("Two carts available.", "Personas:\n- **bt7274** (BT-7274) — ✅ active\n- **sere** (SERE)"),
),
# cart_use
example(
msg("user", "Switch to SERE"),
assistant_tc("Switch persona cart.",
tool_call("core_cart_use", {"tag": "sere"})),
tool_result("core_cart_use", '{"switched": true, "tag": "sere", "name": "SERE"}'),
assistant_reply("Cart switched.", "Switched to SERE persona. Voice and identity updated."),
),
# cart_create
example(
msg("user", "Create a new persona called ATLAS"),
assistant_tc("Create new cart.",
tool_call("core_cart_create", {
"tag": "atlas",
"name": "ATLAS",
"type": "titan",
})),
tool_result("core_cart_create", '{"created": true, "tag": "atlas", "name": "ATLAS"}'),
assistant_reply("Cart created.", "Persona ATLAS created with tag 'atlas'. Configure its TOML file to set voice, prompt, and identity."),
),
]
# ═══════════════════════════════════════════════════════════════════════
# 11. UTILITY (~20)
# ═══════════════════════════════════════════════════════════════════════
UTILITY = [
# generate_name
example(
msg("user", "Generate a codename"),
assistant_tc("Random themed name generation.",
tool_call("core_generate_name", {})),
tool_result("core_generate_name", '{"name": "CRIMSON-FALCON-7A3F", "theme": "nato", "pattern": "codename"}'),
assistant_reply("Name generated.", "Codename: **CRIMSON-FALCON-7A3F**"),
),
example(
msg("user", "Give me a Gundam-themed branch name"),
assistant_tc("Themed name for git branch.",
tool_call("core_generate_name", {
"theme": "gundam",
"pattern": "designation",
"token": "hex",
"token_length": 4,
})),
tool_result("core_generate_name", '{"name": "RX-78-EXIA-B4C2", "theme": "gundam", "pattern": "designation"}'),
assistant_reply("Gundam designation.", "Branch name: **RX-78-EXIA-B4C2**"),
),
# session_save
example(
msg("user", "Save this session state"),
assistant_tc("Save session context to memory.",
tool_call("core_session_save", {
"label": "lora-training-v4",
"summary": "Building v4 LoRA dataset pipeline for BT-7274 persona + agent tools",
})),
tool_result("core_session_save", '{"saved": true, "label": "lora-training-v4"}'),
assistant_reply("Session saved.", "Session state saved as 'lora-training-v4'. Restore anytime with session_restore."),
),
# session_restore
example(
msg("user", "Restore the lora training session"),
assistant_tc("Restore saved session state.",
tool_call("core_session_restore", {"label": "lora-training-v4"})),
tool_result("core_session_restore", '{"restored": true, "label": "lora-training-v4", "cwd": "/Users/chi/Projects/lora", "branch": "main", "summary": "Building v4 LoRA dataset pipeline"}'),
assistant_reply("Session restored.", "Restored 'lora-training-v4':\n- CWD: /Users/chi/Projects/lora\n- Branch: main\n- Context: Building v4 LoRA dataset pipeline"),
),
# sync_status
example(
msg("user", "Check sync status"),
assistant_tc("cr-sqlite mesh sync status.",
tool_call("core_sync_status", {})),
tool_result("core_sync_status", '{"db_version": 42, "pending_changes": 0, "peers": [{"node": "sin", "watermark": 40}]}'),
assistant_reply("Sync status.", "cr-sqlite sync:\n- Local version: 42\n- Pending changes: 0\n- Peer sin: watermark 40 (2 behind)"),
),
# todowrite
example(
msg("user", "Create a todo list for the deploy"),
assistant_tc("Create structured task list.",
tool_call("todowrite", {"todos": [
{"content": "Run tests", "status": "pending", "priority": "high"},
{"content": "Build Docker image", "status": "pending", "priority": "high"},
{"content": "Push to registry", "status": "pending", "priority": "medium"},
{"content": "Deploy to staging", "status": "pending", "priority": "medium"},
{"content": "Verify staging", "status": "pending", "priority": "high"},
{"content": "Deploy to production", "status": "pending", "priority": "high"},
]})),
tool_result("todowrite", '{"created": 6}'),
assistant_reply("Todo list created.", "Deploy checklist:\n1. ⏳ Run tests (high)\n2. ⏳ Build Docker image (high)\n3. ⏳ Push to registry (medium)\n4. ⏳ Deploy to staging (medium)\n5. ⏳ Verify staging (high)\n6. ⏳ Deploy to production (high)"),
),
# question
example(
msg("user", "Should we use PostgreSQL or SQLite for this?"),
assistant_tc("Needs more context. Ask clarifying question.",
tool_call("question", {"questions": [
{
"question": "What's the expected scale and access pattern?",
"header": "Database choice",
"options": [
{"label": "Single user, local", "description": "One app instance, local data"},
{"label": "Multi-user, networked", "description": "Multiple clients, concurrent access"},
{"label": "High throughput", "description": "Thousands of writes per second"},
],
}
]})),
tool_result("question", '{"answers": [["Single user, local"]]}'),
assistant_reply("Single user — SQLite is the right call.", "SQLite. Single user, local data — no need for a database server. Embedded, zero config, fast. PostgreSQL is overkill for this use case."),
),
# webfetch
example(
msg("user", "What's on the Rust blog?"),
assistant_tc("Fetch web content.",
tool_call("webfetch", {"url": "https://blog.rust-lang.org"})),
tool_result("webfetch", '{"content": "# Rust Blog\\n\\n## Latest Posts\\n- Rust 1.82 released\\n- Async Working Group update\\n- Foundation grants announced"}'),
assistant_reply("Rust blog fetched.", "Rust blog headlines:\n- Rust 1.82 released\n- Async Working Group update\n- Foundation grants announced"),
),
# task (dispatching to subagent)
example(
msg("user", "Explore how the auth module works in this codebase"),
assistant_tc("Complex exploration. Dispatch to explore agent.",
tool_call("task", {
"description": "Explore auth module",
"prompt": "Find and analyze all authentication-related code in this project. Look for auth middleware, JWT handling, session management, and access control. Report: file locations, key functions, auth flow, and any security concerns.",
"subagent_type": "explore",
})),
tool_result("task", '{"result": "Auth module in crates/auth/:\\n- jwt.rs: token creation/verification using jsonwebtoken\\n- middleware.rs: Axum middleware extracting Bearer token\\n- session.rs: Redis-backed sessions\\n- Flow: Request → middleware extracts token → verify_token() → extract Claims → proceed or 401\\n- Concern: no token refresh mechanism found"}'),
assistant_reply("Auth analysis complete.", "Auth module analysis:\n- **Location**: crates/auth/\n- **JWT**: jsonwebtoken crate, create/verify in jwt.rs\n- **Middleware**: Axum Bearer token extraction\n- **Sessions**: Redis-backed\n- **Flow**: Request → middleware → verify → claims → proceed/401\n- **⚠️ Concern**: No token refresh mechanism found"),
),
]
# ═══════════════════════════════════════════════════════════════════════
# 12. INFRA INSPECTION (~10)
# ═══════════════════════════════════════════════════════════════════════
INFRA_INSPECT = [
# infra_mcp
example(
msg("user", "What MCP servers are running?"),
assistant_tc("Check MCP server status.",
tool_call("infra_mcp", {})),
tool_result("infra_mcp", '{"servers": [{"name": "Core", "status": "connected", "tools": 45}, {"name": "Question", "status": "connected", "tools": 1}, {"name": "Skill", "status": "connected", "tools": 1}]}'),
assistant_reply("Three MCP servers connected.", "MCP servers:\n- **Core**: connected (45 tools)\n- **Question**: connected (1 tool)\n- **Skill**: connected (1 tool)"),
),
# infra_lsp
example(
msg("user", "Check LSP status"),
assistant_tc("Language server status.",
tool_call("infra_lsp", {})),
tool_result("infra_lsp", '{"servers": [{"language": "rust", "status": "running", "name": "rust-analyzer"}, {"language": "typescript", "status": "running", "name": "typescript-language-server"}]}'),
assistant_reply("Two LSP servers active.", "LSP servers:\n- **rust-analyzer** — running\n- **typescript-language-server** — running"),
),
# infra_formatters
example(
msg("user", "What formatters are configured?"),
assistant_tc("Check formatter status.",
tool_call("infra_formatters", {})),
tool_result("infra_formatters", '{"formatters": [{"name": "rustfmt", "status": "available"}, {"name": "prettier", "status": "available"}, {"name": "ruff", "status": "available"}]}'),
assistant_reply("Three formatters available.", "Formatters:\n- rustfmt ✅\n- prettier ✅\n- ruff ✅"),
),
# server_health
example(
msg("user", "Is the server healthy?"),
assistant_tc("Check opencode server health.",
tool_call("server_health", {})),
tool_result("server_health", '{"status": "healthy", "version": "1.14.48", "uptime": "2h30m"}'),
assistant_reply("Server healthy.", "opencode server: healthy\n- Version: 1.14.48\n- Uptime: 2h30m"),
),
# server_providers
example(
msg("user", "What LLM providers are available?"),
assistant_tc("List configured providers.",
tool_call("server_providers", {})),
tool_result("server_providers", '{"providers": [{"id": "anthropic", "models": ["claude-opus-4-6", "claude-sonnet-4-6"]}, {"id": "ollama", "models": ["qwen3-coder-next", "llama3.3:70b"]}]}'),
assistant_reply("Two providers.", "LLM providers:\n- **Anthropic**: claude-opus-4-6, claude-sonnet-4-6\n- **Ollama**: qwen3-coder-next, llama3.3:70b"),
),
# server_agents
example(
msg("user", "What agents are available?"),
assistant_tc("List configured agents.",
tool_call("server_agents", {})),
tool_result("server_agents", '{"agents": [{"name": "core", "model": "claude-opus-4-6"}, {"name": "build-rust", "model": "qwen3-coder-next"}, {"name": "build-python", "model": "qwen3-coder-next"}, {"name": "explore", "model": "qwen3-coder-next"}]}'),
assistant_reply("Four agents.", "Agents:\n- **core** — claude-opus-4-6\n- **build-rust** — qwen3-coder-next\n- **build-python** — qwen3-coder-next\n- **explore** — qwen3-coder-next"),
),
# infra_mcp_add + connect
example(
msg("user", "Add a new MCP server for the weather API"),
assistant_tc("Add MCP server dynamically.",
tool_call("infra_mcp_add", {
"name": "weather",
"command": "npx weather-mcp-server",
})),
tool_result("infra_mcp_add", '{"added": true, "name": "weather"}'),
assistant_tc("Server added. Connect it.",
tool_call("infra_mcp_connect", {"name": "weather"})),
tool_result("infra_mcp_connect", '{"connected": true, "name": "weather"}'),
assistant_reply("MCP server added and connected.", "Weather MCP server added and connected. New tools should be available now."),
),
]
# ═══════════════════════════════════════════════════════════════════════
# 13. MULTI-TOOL CHAINS (~30)
# ═══════════════════════════════════════════════════════════════════════
CHAINS = [
# find config → read → edit
example(
msg("user", "Find the config file and update the port to 8080"),
assistant_tc("Need to find the config first.",
tool_call("find_files", {"query": "config"})),
tool_result("find_files", '[{"path": "src/config.rs", "score": 0.9}, {"path": "config.toml", "score": 0.85}]'),
assistant_tc("config.toml is likely the runtime config. Read it.",
tool_call("read", {"filePath": "config.toml"})),
tool_result("read", "[server]\nhost = \"0.0.0.0\"\nport = 3000\n\n[database]\nurl = \"sqlite:data.db\""),
assistant_tc("Port is 3000. Edit to 8080.",
tool_call("edit", {
"filePath": "config.toml",
"oldString": "port = 3000",
"newString": "port = 8080",
})),
tool_result("edit", '{"edited": true}'),
assistant_reply("Config updated.", "Updated config.toml: port changed from 3000 to 8080."),
),
# check sessions → store in memory
example(
msg("user", "Check what's running and remember it"),
assistant_tc("Get session status first.",
tool_call("sessions_status", {})),
tool_result("sessions_status", '[{"id": "ses_abc", "status": "idle"}, {"id": "ses_def", "status": "busy"}]'),
assistant_tc("Store this state in memory.",
tool_call("core_memory_store", {
"subject": "ops.session-snapshot",
"content": "Session snapshot 2026-05-26: ses_abc idle, ses_def busy (build worker).",
"metadata": {"type": "snapshot", "timestamp": "2026-05-26"},
})),
tool_result("core_memory_store", '{"id": 7050, "subject": "ops.session-snapshot"}'),
assistant_reply("Captured and stored.", "Session state: 1 idle, 1 busy. Snapshot stored in memory (#7050)."),
),
# screenshot → display on visor
example(
msg("user", "Take a screenshot and show it on the HUD"),
assistant_tc("Capture then display.",
tool_call("core_screenshot", {"output": "/tmp/screenshot.png"})),
tool_result("core_screenshot", '{"path": "/tmp/screenshot.png", "display": 1}'),
assistant_tc("Screenshot taken. Push to visor.",
tool_call("core_display_viewport", {
"node": "fuji",
"content_type": "image_path",
"data": "/tmp/screenshot.png",
"title": "Screenshot",
"caption": "Current display",
})),
tool_result("core_display_viewport", '{"sent": true}'),
assistant_reply("Captured and displayed.", "Screenshot taken and displayed on fuji visor."),
),
# check disk → alert if low → speak warning
example(
msg("user", "Check if any disks are getting full"),
assistant_tc("Check disk usage across hosts.",
tool_call("bash", {"command": "df -h / | tail -1", "description": "Check local disk usage"})),
tool_result("bash", "/dev/disk1s1 460Gi 412Gi 48Gi 90% /"),
assistant_tc("90% full — that's critical. Alert on HUD and speak.",
tool_call("core_display_text", {
"node": "fuji",
"text": "⚠ ROOT DISK 90% FULL — 48GB remaining",
"style": "warn",
})),
tool_result("core_display_text", '{"sent": true}'),
assistant_tc("Visual alert sent. Speak the warning.",
tool_call("core_speak", {"text": "Warning, Pilot. Root disk at 90 percent. Only 48 gig remaining. Recommend cleanup."})),
tool_result("core_speak", '{"speaking": true}'),
assistant_reply("Disk critically low.", "⚠ **Root disk at 90%** — only 48GB remaining. HUD alert displayed and spoken. Recommend: `docker system prune`, clear build artifacts, check log rotation."),
),
# memory recall → no results → web search fallback
example(
msg("user", "What's the latest Rust version?"),
assistant_tc("Check memory first.",
tool_call("core_memory_recall", {"query": "latest Rust version release", "limit": 3})),
tool_result("core_memory_recall", '{"memories": [], "total": 0}'),
assistant_tc("Nothing in memory. Check the web.",
tool_call("webfetch", {"url": "https://blog.rust-lang.org"})),
tool_result("webfetch", '{"content": "# Rust Blog\\n\\nRust 1.82.0 was released on October 17, 2025."}'),
assistant_reply("Found via web.", "Latest stable Rust: **1.82.0** (released October 17, 2025). Not in memory — storing for future reference would be advisable."),
),
# grep → read → understand → answer
example(
msg("user", "How does the auth middleware work?"),
assistant_tc("Find auth middleware in codebase.",
tool_call("grep", {"pattern": "auth_middleware|AuthMiddleware", "include": "*.rs"})),
tool_result("grep", '[{"path": "crates/auth/src/middleware.rs", "lines": [{"line": 15, "text": "pub async fn auth_middleware("}]}]'),
assistant_tc("Found it. Read the file.",
tool_call("read", {"filePath": "crates/auth/src/middleware.rs"})),
tool_result("read", "use axum::extract::Request;\nuse axum::middleware::Next;\n\npub async fn auth_middleware(\n req: Request,\n next: Next,\n) -> Response {\n let token = req.headers().get(\"Authorization\")\n .and_then(|v| v.to_str().ok())\n .and_then(|v| v.strip_prefix(\"Bearer \"));\n \n match token {\n Some(t) => match verify_token(t) {\n Ok(claims) => { req.extensions_mut().insert(claims); next.run(req).await }\n Err(_) => StatusCode::UNAUTHORIZED.into_response(),\n },\n None => StatusCode::UNAUTHORIZED.into_response(),\n }\n}"),
assistant_reply("Auth flow analyzed.", "Auth middleware flow:\n1. Extract `Authorization: Bearer <token>` header\n2. Verify JWT token via `verify_token()`\n3. On success: inject Claims into request extensions, continue\n4. On failure: return 401 Unauthorized\n\nStandard Axum middleware pattern. Clean implementation."),
),
# index → search → read result
example(
msg("user", "Index the project and find error handling patterns"),
assistant_tc("Index first, then search.",
tool_call("core_index_code", {"path": ".", "project": "current"})),
tool_result("core_index_code", '{"indexed": 45, "project": "current"}'),
assistant_tc("Indexed. Now semantic search.",
tool_call("core_index_search", {"query": "error handling patterns Result anyhow", "project": "current"})),
tool_result("core_index_search", '{"results": [{"file": "src/error.rs", "snippet": "pub type AppResult<T> = Result<T, AppError>;", "score": 0.94}]}'),
assistant_tc("Found error module. Read it.",
tool_call("read", {"filePath": "src/error.rs"})),
tool_result("read", "use thiserror::Error;\n\n#[derive(Error, Debug)]\npub enum AppError {\n #[error(\"Database error: {0}\")]\n Database(#[from] sqlx::Error),\n #[error(\"Auth error: {0}\")]\n Auth(String),\n #[error(\"Not found\")]\n NotFound,\n}\n\npub type AppResult<T> = Result<T, AppError>;"),
assistant_reply("Error handling pattern identified.", "Error handling:\n- Custom `AppError` enum using `thiserror`\n- Variants: Database (auto-converts from sqlx), Auth, NotFound\n- Type alias: `AppResult<T> = Result<T, AppError>`\n- Pattern: `thiserror` for library-style errors with `#[from]` for auto-conversion"),
),
# MikroTik DNS + DHCP workflow
example(
msg("user", "Set up a static DNS entry for the new NAS at 10.0.0.50"),
assistant_tc("First check if there's a DHCP lease for it.",
tool_call("core_mikrotik_dhcp_leases", {"filter_key": "address", "filter_value": "10.0.0.50"})),
tool_result("core_mikrotik_dhcp_leases", '[{"address": "10.0.0.50", "mac-address": "AA:BB:CC:DD:EE:50", "host-name": "nas", "status": "bound", ".id": "*5A"}]'),
assistant_tc("Found lease. Make it static, then add DNS.",
tool_call("core_mikrotik_dhcp_static", {"id": "*5A", "comment": "NAS - static"})),
tool_result("core_mikrotik_dhcp_static", '{"made_static": true}'),
assistant_tc("Lease static. Now add DNS record.",
tool_call("core_mikrotik_dns_add", {"name": "nas.local.sazabi.pl", "address": "10.0.0.50"})),
tool_result("core_mikrotik_dns_add", '{"added": true}'),
assistant_reply("NAS fully configured.", "NAS at 10.0.0.50:\n- DHCP lease made static (won't change on reboot)\n- DNS: nas.local.sazabi.pl → 10.0.0.50\n\nAccessible by name now."),
),
# Generate image → display on visor → speak confirmation
example(
msg("user", "Make me a cool wallpaper and show it"),
assistant_tc("Generate then display.",
tool_call("core_tsr_generate", {
"prompt": "abstract dark wallpaper, geometric patterns, deep blue and purple, 4k, clean minimalist",
"negative": "text, watermark, busy, cluttered",
"output": "/tmp/wallpaper.png",
})),
tool_result("core_tsr_generate", '{"path": "/tmp/wallpaper.png"}'),
assistant_tc("Generated. Show on visor and announce.",
tool_call("core_display_viewport", {
"node": "fuji",
"content_type": "image_path",
"data": "/tmp/wallpaper.png",
"title": "Generated Wallpaper",
})),
tool_result("core_display_viewport", '{"sent": true}'),
assistant_tc("Displayed. Quick verbal confirmation.",
tool_call("core_speak", {"text": "Wallpaper generated and on the visor, Pilot."})),
tool_result("core_speak", '{"speaking": true}'),
assistant_reply("Done.", "Wallpaper generated and displayed on visor. Saved to /tmp/wallpaper.png."),
),
# Create session → dispatch work → check results
example(
msg("user", "Spin up a worker to refactor the config module"),
assistant_tc("Create dedicated session for the refactor.",
tool_call("control_create", {"title": "Config module refactor"})),
tool_result("control_create", '{"id": "ses_refactor1"}'),
assistant_tc("Session created. Dispatch the task.",
tool_call("messages_prompt_async", {
"id": "ses_refactor1",
"text": "Refactor src/config.rs: split into config/mod.rs, config/env.rs, config/file.rs. Keep the same public API. Run tests after.",
})),
tool_result("messages_prompt_async", '{"sent": true}'),
assistant_reply("Worker dispatched.", "Refactor worker launched (ses_refactor1). Task: split config module into submodules. Running async — check with `sessions_status` when you want results."),
),
]
# ═══════════════════════════════════════════════════════════════════════
# 14. AUTH (~8)
# ═══════════════════════════════════════════════════════════════════════
AUTH = [
example(
msg("user", "Check auth status"),
assistant_tc("Check sealed auth configuration.",
tool_call("core_auth_status", {})),
tool_result("core_auth_status", '{"configured": true, "locked": false, "failed_attempts": 0}'),
assistant_reply("Auth configured, unlocked.", "Sealed auth: configured, not locked, 0 failed attempts."),
),
example(
msg("user", "Set a new passphrase"),
assistant_tc("Set sealed auth passphrase.",
tool_call("core_auth_set", {"passphrase": "titan-protocol-one"})),
tool_result("core_auth_set", '{"set": true}'),
assistant_reply("Passphrase set.", "Sealed auth passphrase configured."),
),
example(
msg("user", "Verify the passphrase 'titan-protocol-one'"),
assistant_tc("Verify against stored hash.",
tool_call("core_auth_verify", {"passphrase": "titan-protocol-one"})),
tool_result("core_auth_verify", '{"result": "authenticated"}'),
assistant_reply("Verified.", "Passphrase verified — authenticated."),
),
example(
msg("user", "Set my Anthropic API key"),
assistant_tc("Store provider credentials.",
tool_call("auth_set", {"provider": "anthropic", "key": "sk-ant-..."})),
tool_result("auth_set", '{"set": true}'),
assistant_reply("Key stored.", "Anthropic API key configured."),
),
example(
msg("user", "Remove the Ollama credentials"),
assistant_tc("Remove stored auth for provider.",
tool_call("auth_remove", {"provider": "ollama"})),
tool_result("auth_remove", '{"removed": true}'),
assistant_reply("Removed.", "Ollama credentials removed."),
),
]
def main():
categories = {
"memory": MEMORY,
"tts": TTS,
"display": DISPLAY,
"network": NETWORK,
"camera": CAMERA,
"images": IMAGES,
"sessions": SESSIONS,
"indexing": INDEXING,
"workspace": WORKSPACE,
"cart": CART,
"utility": UTILITY,
"infra_inspect": INFRA_INSPECT,
"chains": CHAINS,
"auth": AUTH,
}
all_examples = []
total_tool_calls = 0
tools_seen = set()
print("Core Agent Tool Dataset Generator")
print("=" * 60)
for name, examples in categories.items():
cat_tool_calls = 0
cat_tools = set()
for e in examples:
for m in e["messages"]:
if m.get("tool_calls"):
for tc in m["tool_calls"]:
cat_tool_calls += 1
cat_tools.add(tc["function"]["name"])
if m["role"] == "tool":
cat_tools.add(m.get("name", "unknown"))
total_tool_calls += cat_tool_calls
tools_seen |= cat_tools
print(f" {name:<20} {len(examples):>3} examples {cat_tool_calls:>3} tool_calls {len(cat_tools):>2} unique tools")
all_examples.extend(examples)
print(f"{'':20} {'' * 3}")
print(f" {'TOTAL':<20} {len(all_examples):>3} examples {total_tool_calls:>3} tool_calls {len(tools_seen):>2} unique tools")
print(f"\n Tools covered: {sorted(tools_seen)}")
output = "core_agent_tools.jsonl"
with open(output, "w") as f:
for e in all_examples:
f.write(json.dumps(e, ensure_ascii=False) + "\n")
print(f"\n Wrote {output}")
if __name__ == "__main__":
main()