The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
feat(onboarding): first tasks show results in the preview pane on every host
alt-glitch9c9e80b5a2bb
diff --git a/agent/onboarding_first_tasks.py b/agent/onboarding_first_tasks.pyindex f727778ddb9..389195036f9 100644--- a/agent/onboarding_first_tasks.py+++ b/agent/onboarding_first_tasks.py@@ -26,7 +26,7 @@ OWN_ID = "own"class FirstTask:"""``skills`` load first, before the work; an entry ``a|b`` means one of them, whichever fits.Plugin skills use the ``<plugin>:<skill>`` form skill_view resolves. ``goal`` finishes the- sentence "Your job: ..."; ``<open>`` in a step and ``<shown>`` in the output are replaced with how this host shows a page."""+ sentence "Your job: ..."."""id: strlabel: str@@ -59,63 +59,71 @@ def _macos(facts: Facts, picks: Mapping[str, Any]) -> bool:FIRST_TASKS: tuple[FirstTask, ...] = (FirstTask("hermes", "Explain how Hermes works", lambda facts, picks: False, ("hermes-agent", "claude-design", "p5js"),- goal="build a designed page of at least three screens that shows how Hermes works, from the real docs "- "and real facts about this install",+ goal="build a living page that shows how Hermes works, from the real docs and this install",steps=(- "Read the docs with web_extract, starting at https://hermes-agent.nousresearch.com/docs (the "- "hermes-agent skill links the pages): the agent loop, skills and the learning loop, cron and "- "automations, tools and toolsets, memory.",- "Read facts from this install with your own tools: how many skills are installed, which apps are "- "connected, which model is configured, and which skills this chat used.",- "Write a first version within a minute and <open>. Then refine the same file.",- "Screen 1, the agent loop: model, tools, results, back to the model, as an animated diagram.",- "Screen 2, the skill learning loop: Hermes notices a procedure, saves it as a skill and loads it next "- "time. Name the skills this chat used.",- "Screen 3, automations and what they can do: cron jobs, webhooks, connectors, messaging, with "- "examples that fit them.",+ "Read https://hermes-agent.nousresearch.com/docs/llms.txt once with web_extract. Open a page only to "+ "check a fact you show.",+ "Read this install: the model, how many skills are installed, the connected apps, and what this chat did "+ "(tools called, skills loaded, their name and picks).",+ "Within a minute, open it in the preview pane with the title, those facts and three screen headings. "+ "Then fill one screen at a time.",+ "Screen 1, the agent loop: a pulse runs model, tool, result, back to the model, labelled with the tools "+ "this chat called.",+ "Screen 2, learning: a procedure becomes a skill that loads next time; memory keeps facts across chats. "+ "Use the skills this chat loaded.",+ "Screen 3, out in the world: cron jobs, connectors and messaging, one example each built on their apps.",),- output="One self-contained HTML file in ~/hermes-first-task/, at least three full-screen sections, each "- "with its own graphic (a p5js animation or an SVG diagram).",- quality="Designed with claude-design, not a plain document. Every name and number comes from the docs or "- "this install. Copy is short and plain.",- done="The page is open, every screen has its graphic and real facts, and you said where the file is."),+ output="One HTML file in ~/hermes-first-task/, three screens that each fill the pane with one animated "+ "graphic; open in the preview pane.",+ quality="Every name and number comes from the docs or this install. A few short lines per screen.",+ done="All three screens move and show real facts, and you said where the file is."),FirstTask("games", "Tune my games for this PC", _plugin("nvidia-app"), ("nvidia-app:nvidia-app",),goal="optimise the games on this PC with NVIDIA App and show what changed",steps=(- "Check NVIDIA App is running, as the skill says. If it is not, say how to start it and wait.",- "Read the installed games and their current settings.",- "Ask once before changing anything, naming the games you will change.",- "Apply the optimised settings, then read them back.",+ "Its tools are mcp__nvidia_app__nvapp_*. If none are listed, say so as the skill says and wait until "+ "they start NVIDIA App.",+ "List the installed games and show them at once. If the driver status shows a newer Game Ready "+ "driver, say so in one line.",+ "Ask in one clarify which preset to apply (Performance, Visual or Recommended), naming the games.",+ "Apply it, then read each game back.",),- output="A before and after table in chat: one row per game, what changed and why.",+ output="A before and after table in chat: one row per game, what changed.",quality="Only settings NVIDIA App reports and really changed. Never guess a value.",- done="The changes are applied and read back, and the table shows each one."),+ done="The changes are read back and in the table. Next-step idea: launch one of the games."),FirstTask("broadcast", "Make my mic and camera pro", _plugin("nvidia-broadcast"), ("nvidia-broadcast:nvidia-broadcast",),goal="set up NVIDIA Broadcast so their mic and camera are ready for a call",steps=(- "Check NVIDIA Broadcast is running, as the skill says. If it is not, say how to start it and wait.",- "Read the mic, speaker and camera devices and the effects this machine offers.",- "Ask in one clarify what the setup is for, with three options such as a meeting, a stream or a "- "noisy room.",- "Turn on the effects that fit, then read them back.",+ "Its tools are mcp__nvidia_broadcast__*. If none are listed, say so as the skill says and wait until "+ "they start Broadcast.",+ "Read the devices and the effects this machine offers, then ask in one clarify what it is for: a "+ "meeting, a stream or a noisy room.",+ "Turn the effects on one at a time. After each, say what to look at or listen for in the Broadcast "+ "window.",),output="A short list in chat: each effect, its device, before and after.",quality="Only effects Broadcast reports on this machine.",- done="The effects are on and they know how to turn each one off."),+ done="The effects are on and read back, and they know how to turn each one off."),FirstTask("blender", "Build a 3D scene in Blender", _plugin("blender"), ("blender:blender",),- goal="make one small 3D scene in Blender from a script, render it and show it",+ goal="build a small 3D scene live in their open Blender, one visible step at a time",steps=(- "Check Blender is running, as the skill says. If it is not, say how to start it and wait.",- "Offer three scene ideas that fit them in one clarify.",- "Write a short Python script, run it in Blender and render one still.",- "Show the render, then offer one variation.",+ "Drive the open Blender with its mcp__blender__* tools. Never run Blender from the terminal.",+ "If Blender is not connected, give the skill's setup steps for this OS as a short list, and check "+ "again each time they say done.",+ "Offer three scene ideas in one clarify: two that fit them, one that shows off this machine.",+ "Build it in a new scene named Hermes, in camera view, in four calls they can watch: ground and camera, "+ "main objects, materials and light, framing. After each, render the viewport to render.png; after the "+ "first, open it in the preview pane.",+ "Render a 1280x720 EEVEE still over render.png. Look at it before you call it done: lit, not black, "+ "framed.",+ "Save only the new scene with bpy.data.libraries.write as scene.blend, and the code as scene.py.",),- output="The script and the PNG render in ~/hermes-first-task/; the render <shown>.",- quality="A real Blender render, lit and framed. Never a placeholder.",- done="The render is shown and you said where the script and image are."),+ output="scene.blend, scene.py and render.png in ~/hermes-first-task/; the render open in the preview pane.",+ quality="Made in their open Blender, never headless, never a placeholder.",+ done="The final still is shown and you named the files. Next-step idea: a turntable video or a GPU Cycles "+ "render."),FirstTask("brief", "Brief me on today", _connected, ("claude-design",),goal="write today's brief from their connected apps",@@ -125,7 +133,7 @@ FIRST_TASKS: tuple[FirstTask, ...] = ("Show a first version early, then fill it in: what needs attention, what changed, what is next.","Offer a morning cron job that sends the brief. Schedule it only on yes.",),- output="One designed HTML page in ~/hermes-first-task/, <shown>.",+ output="One designed HTML page in ~/hermes-first-task/, open in the preview pane.",quality="Every item comes from a connected app and says which one. Nothing invented.",done="The brief is shown and the morning job is set up or declined."),FirstTask(@@ -137,7 +145,7 @@ FIRST_TASKS: tuple[FirstTask, ...] = ("Show a first version early, then fill it in: meetings, threads, work shipped, open loops.","End with a short plan for next week built from the open loops.",),- output="One designed HTML page in ~/hermes-first-task/, <shown>.",+ output="One designed HTML page in ~/hermes-first-task/, open in the preview pane.",quality="Every item comes from a connected app and says which one. Nothing invented.",done="The page is shown with all five parts filled from real data."),FirstTask(@@ -166,18 +174,18 @@ FIRST_TASKS: tuple[FirstTask, ...] = (FirstTask("explain", "Explain a topic I care about", _always,("grounded-citations", "claude-design", "p5js", "blocked-page-recovery"),- goal="explain a topic they care about on one designed page with an interactive figure",+ goal="explain a topic they care about on one page built around a figure they can play with",steps=(- "If the label they clicked names a topic, use it. Otherwise offer three topic guesses from what you "- "learned about them in one clarify.",- "Research it with citations. For a technical topic, also load arxiv.",- "Show a first version early, then refine the same file.",- "Add one interactive p5js figure that shows the core idea.",+ "If the label they clicked names a topic, use it. Otherwise offer three guesses from what you know about "+ "them in one clarify.",+ "Within a minute, open it in the preview pane with the title and the figure already moving: the one "+ "mechanism that makes the topic click, which they can drag or tune.",+ "Research it with citations (load arxiv for a technical topic), then write short sections around the "+ "figure. End on the most surprising thing you found.",),- output="One self-contained HTML file in ~/hermes-first-task/, <shown>, sources at "- "the end.",- quality="Designed with claude-design. Every claim is cited. The figure responds to input.",- done="The page is shown with the figure working and every source listed."),+ output="One HTML file in ~/hermes-first-task/, open in the preview pane, sources at the end.",+ quality="Every claim and every number in the figure is cited. Under 400 words of text.",+ done="The figure responds to input and every source is listed."),FirstTask("youtube", "Turn a video into a page", _always, ("youtube-content", "claude-design", "p5js"),goal="turn one video into a page that lays its ideas out visually",@@ -187,7 +195,7 @@ FIRST_TASKS: tuple[FirstTask, ...] = ("Pull out the main ideas, each with a timestamp and a quote.","Show a first version early, then lay the ideas out visually, with one figure where it helps.",),- output="One self-contained HTML file in ~/hermes-first-task/, <shown>; each "+ output="One self-contained HTML file in ~/hermes-first-task/, open in the preview pane; each ""timestamp links to that moment in the video.",quality="Designed with claude-design. Quotes are exact words from the transcript.",done="The page is shown and every idea has its timestamp and quote."),@@ -212,7 +220,7 @@ FIRST_TASKS: tuple[FirstTask, ...] = ("Show a first version early with a p5js hero, then refine the same file.","Offer one variation.",),- output="One self-contained HTML file in ~/hermes-first-task/, <shown>.",+ output="One self-contained HTML file in ~/hermes-first-task/, open in the preview pane.",quality="Designed with the skills. Real content they gave you, never filler text.",done="The page is shown and a variation is offered."),FirstTask(@@ -224,7 +232,7 @@ FIRST_TASKS: tuple[FirstTask, ...] = ("Read its entry points and main modules.","Draw the architecture page: the modules, how they connect, where to start reading.",),- output="One self-contained HTML file in ~/hermes-first-task/, <shown>.",+ output="One self-contained HTML file in ~/hermes-first-task/, open in the preview pane.",quality="Only modules that are really in the repo, named by their paths.",done="The page is shown and every box on it maps to a real path."),)@@ -239,7 +247,7 @@ OWN_TASK = FirstTask("Cut a big ask to a first slice and say so in one line.","Show a first version early, then refine it.",),- output="Whatever fits the task; a page is one self-contained HTML file, <shown>.",+ output="Whatever fits the task; a page is one self-contained HTML file, open in the preview pane.",quality="Real data only, designed with the skills when it is a page.",done="The first slice is shown and you said where its files are.")TASK_BY_ID = {task.id: task for task in FIRST_TASKS}diff --git a/agent/onboarding_text.py b/agent/onboarding_text.pyindex 58ee6e15861..9db2348dbfe 100644--- a/agent/onboarding_text.py+++ b/agent/onboarding_text.py@@ -123,18 +123,44 @@ _CLOSE = ('When the first thing is built and shown, ask with clarify: "How does'After they answer, call setup_beat(beat="done").')_HOW_TO_WORK = (- "Real data only: their connected apps, or tools signed in on this computer. Never mock or invent data, and "- "never route around a connector.",- "Show visible progress within a minute and a first result within five.",- "Your first reply is one line, then a tool call.",- "At most two checks and one question before you start working.",- "Connect or install anything once, with exact ids and no searching, then use it.",- "Never search the whole disk.",- "Save every file in ~/hermes-first-task/ and say where it is. No test files.",- "A page is one self-contained HTML file, unless the task says otherwise.",+ "Real data only: this computer, their connected apps, the live web. Never mock or invent data.",+ "First reply: one line, then a tool call. At most two checks and one question before you start. Something "+ "visible within a minute, finished within five.",+ "Save every file in ~/hermes-first-task/ and say where. No test files.",+ "Install or connect anything once, with exact ids. Never search the whole disk.",+ "Write the words they read with humanizer: short, plain, specific.",)+_PREVIEW_CALL = 'tool_call {"calls":[{"name":"desktop_preview","arguments":{"action":"open","url":"<file>"}}]}'+++def _preview_line(facts: Facts) -> str:+ """Every host shows results in the app's preview pane, which watches a local file but not a remote one."""+ reload = ("On this host it does not reload by itself: open it again after each change."+ if facts.facts_source == "remote" else+ "Open it once, early: it reloads when the file changes, so keep improving the same file while they "+ "watch.")+ return (f"Show results in the preview pane beside the chat with {_PREVIEW_CALL}; it shows HTML, images and "+ f"PDFs. {reload} Say it is open only after the call succeeds.")+++_NPM = "https://cdn.jsdelivr.net/npm/"+_PAGE = (+ "One self-contained HTML file, laid out for the pane (often about 600px wide) and able to widen.",+ "It moves within a second: a diagram that draws itself, a dot that runs a path, numbers that count up to "+ "real values.",+ f"Libraries, only what the page needs, each pinned as {_NPM}<package>@<version>/<file>: [email protected] for "+ "motion, with its DrawSVGPlugin, MotionPathPlugin and ScrollTrigger (register each); [email protected] for charts of "+ "real numbers; [email protected] for a 2D figure they drag or tune; [email protected] for physics; [email protected] "+ "with its CSS and auto-render for maths; [email protected] for sound, started on a click; [email protected] for a "+ "hand-drawn look.",+ '3D: [email protected] is ES modules only. Use an import map: "three" to its build/three.module.js, '+ '"three/addons/" to its examples/jsm/.',+)+_PAGE_TASKS = ("hermes", "explain", "brief", "week", "youtube", "site", "repo", "own")+_CONNECTORS = (+ "Never route around a connector. "'Reading a connected app: check it with manage_connections(action="status"). Find its tools with tool_search '"using the app slug, then the slug plus an action (a bare slug misses actions). tool_describe every action you "'need in one batch, then call them through tool_call(calls=[{"name": "connectors__<slug>__<ACTION>", '@@ -157,43 +183,13 @@ _SPARK_LINE = "This machine is built for local models; say so once when it fits_REMOTE_LINE = "Hermes runs on another computer than the user's: say which machine anything is installed on."-_PREVIEW_CALL = 'tool_call {"calls":[{"name":"desktop_preview","arguments":{"action":"open","url":"<file>"}}]}'-# The terminal tool's Git Bash on Windows passes argv literally (MSYS_NO_PATHCONV=1), so Git's `start`-# wrapper hands cmd a literal `//c` and opens nothing; a single-slash `cmd.exe /c` survives that.-_OPEN = {"macos": "`open <file>`",- "windows": '`cmd.exe /c start "" "<file>"` with the full Windows path (C:/Users/...), never a ~ or /c/ path'}-_CMD_BANNER = ('Exit 0 with a cmd banner ("Microsoft Windows [Version ...]") in the output is a failure: nothing '- "opened; fix the command.")---def _open_line(facts: Facts) -> str:- if facts.facts_source == "remote":- return f"show it with desktop_preview: {_PREVIEW_CALL}"- return f"open it in the default browser with {_OPEN.get(facts.os, '`xdg-open <file>`')}"---def _shown_phrase(facts: Facts) -> str:- return "shown with desktop_preview" if facts.facts_source == "remote" else "opened in the default browser"---def _page_lines(facts: Facts) -> list[str]:- """How a page reaches the user: a local backend opens it in their browser; a remote one cannot."""- if facts.facts_source == "remote":- return [f"Show a page with desktop_preview, through tool_call: {_PREVIEW_CALL}. Their browser is on "- "another computer.",- "Say the page is open only after desktop_preview returned success."]- check = f" {_CMD_BANNER}" if facts.os == "windows" else ""- return [f"Open a page in their default browser with {_OPEN.get(facts.os, '`xdg-open <file>`')}.",- f"Say the page is open only after the open command succeeded.{check}"]---def _task_prompt(option: str, label: str, facts: Facts, has_skill: Callable[[str], bool]) -> list[str]:+def _task_prompt(option: str, label: str, has_skill: Callable[[str], bool]) -> list[str]:task = TASK_BY_ID.get(option, OWN_TASK)picked = f'They picked "{label or task.label}". ' if (label or task.label) else ""- steps = [f"{n}. {step.replace('<open>', _open_line(facts))}" for n, step in enumerate(task.steps, 1)]+ steps = [f"{n}. {step}" for n, step in enumerate(task.steps, 1)]return [f"{picked}Your job: {task.goal}.",f"Load these skills with skill_view first: {', '.join(task_skills(option, has_skill))}.",- "Steps:", *steps, f"Output: {task.output.replace('<shown>', _shown_phrase(facts))}", f"Quality bar: {task.quality}", f"Done when: {task.done}"]+ "Steps:", *steps, f"Output: {task.output}", f"Quality bar: {task.quality}", f"Done when: {task.done}"]def _bullets(title: str, lines) -> str:@@ -204,7 +200,8 @@ def build_guidance(option: str, facts: Facts, has_skill: Callable[[str], bool] =label: str = "") -> str:"""The prompt once a first task is picked; ``label`` is the card text they clicked, ``has_skill``says whether a bundled skill is on this install."""- work = [*_HOW_TO_WORK, *_page_lines(facts), *((_CONNECTORS,) if option in _CONNECTOR_TASKS else ())]+ work = [*_HOW_TO_WORK, _preview_line(facts), *((_CONNECTORS,) if option in _CONNECTOR_TASKS else ())]+ page = [_bullets("When you make a page", _PAGE)] if option in _PAGE_TASKS else []host = [_OS_LINES.get(facts.os, _OS_LINES["linux"])]if facts.os == "windows" and facts.arch == "arm64":host.append(_ARM_WINDOWS)@@ -212,7 +209,7 @@ def build_guidance(option: str, facts: Facts, has_skill: Callable[[str], bool] =host.append(_SPARK_LINE)if facts.facts_source == "remote":host.append(_REMOTE_LINE)- return "\n\n".join(["\n".join(_task_prompt(option, label, facts, has_skill)), _bullets("How to work", work),+ return "\n\n".join(["\n".join(_task_prompt(option, label, has_skill)), _bullets("How to work", work), *page,_bullets("This computer", host), f"When it is shown:\n{_CLOSE}"])diff --git a/tests/agent/test_onboarding_first_tasks.py b/tests/agent/test_onboarding_first_tasks.pyindex 3c26654439f..cb72ae36d5c 100644--- a/tests/agent/test_onboarding_first_tasks.py+++ b/tests/agent/test_onboarding_first_tasks.py@@ -39,8 +39,7 @@ def test_a_task_reminder_opens_with_its_skills_and_drops_a_bundled_skill_this_intext = reminder("build_explain", new_record(MAC), MAC, has_skill=lambda name: name != "p5js")goal, skills = text.split("\n")[:2]- assert goal == ('They picked "Explain a topic I care about". Your job: explain a topic they care about on one '- "designed page with an interactive figure.")+ assert goal.startswith('They picked "Explain a topic I care about". Your job: ')assert skills == ("Load these skills with skill_view first: grounded-citations, claude-design, ""blocked-page-recovery, humanizer.")# Plugin skills come with the plugin, which is the row's gate; a typed task starts from hermes-agent.@@ -77,40 +76,25 @@ def test_how_hermes_works_reads_the_docs_and_builds_three_screens():assert all(f"Screen {n}" in text for n in (1, 2, 3)) and "~/hermes-first-task/" in text[email protected](("facts", "opens"), [- (MAC, "`open <file>`"), (PC, '`cmd.exe /c start "" "<file>"`'), (Facts(os="linux"), "`xdg-open <file>`"),-])-def test_a_local_backend_opens_the_page_in_the_default_browser_and_never_names_desktop_preview(facts, opens):- text = reminder("build_hermes", new_record(facts), facts)- site = reminder("build_site", new_record(facts), facts)-- assert f"open it in the default browser with {opens}" in text- assert f"Open a page in their default browser with {opens}" in text- assert "Say the page is open only after the open command succeeded." in text- assert "desktop_preview" not in text and "desktop_preview" not in site- assert "opened in the default browser" in site---def test_windows_opens_with_a_single_slash_cmd_and_a_banner_is_not_success():- """Vesper run 1: Git's `start` wrapper passes a literal `//c` under MSYS_NO_PATHCONV=1, cmd printed its- banner, exited 0 and nothing opened; the model still said the page was open."""- text = reminder("build_hermes", new_record(PC), PC)-- assert '`start "" <file>`' not in text and "//c" not in text- assert "full Windows path (C:/Users/...)" in text- assert 'cmd banner ("Microsoft Windows [Version ...]") in the output is a failure' in text- assert "cmd banner" not in reminder("build_hermes", new_record(MAC), MAC)-[email protected]("facts", [MAC, PC, Facts(os="linux"), Facts(os="linux", facts_source="remote")],+ ids=["mac", "windows", "linux", "remote"])+def test_every_host_shows_results_in_the_preview_pane_and_never_opens_a_browser(facts):+ call = 'tool_call {"calls":[{"name":"desktop_preview","arguments":{"action":"open","url":"<file>"}}]}'+ for row in ("hermes", "site", "blender"):+ text = reminder(f"build_{row}", new_record(facts), facts)-def test_a_remote_backend_shows_the_page_with_desktop_preview_through_tool_call():- facts = Facts(os="linux", facts_source="remote")+ assert call in text and "Say it is open only after the call succeeds." in text+ assert "default browser" not in text and "cmd.exe" not in text and "xdg-open" not in text+ # The pane watches a local file; a remote backend's file has no watcher, so it is opened again.text = reminder("build_hermes", new_record(facts), facts)- call = 'tool_call {"calls":[{"name":"desktop_preview","arguments":{"action":"open","url":"<file>"}}]}'+ assert ("open it again after each change" in text) is (facts.facts_source == "remote")+- assert f"show it with desktop_preview: {call}" in text- assert "Say the page is open only after desktop_preview returned success." in text- assert "default browser" not in text and "xdg-open" not in text- assert "shown with desktop_preview" in reminder("build_site", new_record(facts), facts)+def test_the_page_guidance_rides_only_the_tasks_that_make_a_page():+ assert "When you make a page:" in reminder("build_hermes", new_record(MAC), MAC)+ assert "When you make a page:" in reminder("build_explain", new_record(MAC), MAC)+ for row in ("blender", "games", "notes"):+ assert "When you make a page:" not in reminder(f"build_{row}", new_record(PC), PC), rowdef test_the_app_tasks_carry_the_connectors_playbook_and_the_menu_lists_only_eligible_rows():