5.1 KiB
/learn Command Web UI Integration Plan
Date: 2026-06-25
Context
Hermes Agent added a /learn slash command that turns a user-described source
or recent workflow into a reusable Hermes skill. The command does not use a
separate model or learning engine. It builds a standards-guided prompt with
agent.learn_prompt.build_learn_prompt() and submits that prompt through the
normal agent loop.
Web UI chat sessions use the local bridge run path instead of always going
through the upstream CLI or gateway slash-command handler. For a reliable user
experience, Web UI should explicitly recognize /learn and expand it through
the bridge command path before running the generated prompt.
Goals
- Let users type
/learn <source or workflow>in a normal Hermes chat session. - Show
/learnin the chat input slash-command picker. - Run the prompt generated by Hermes Agent's
build_learn_prompt()as the real agent input. - Preserve the visible transcript as a command invocation, not as the expanded internal prompt.
- Support bare
/learnas "learn from this conversation". - Fail clearly when the bundled/runtime Hermes Agent version does not provide
agent.learn_prompt.
Non-Goals
- Do not add a dedicated model, provider, or auxiliary model for
/learn. - Do not create a new Web UI page for skill creation.
- Do not duplicate Hermes Agent's skill-authoring prompt in TypeScript.
- Do not treat
/learnas memory, fine-tuning, or persistent model training.
Proposed Design
Server Bridge Command
Add /learn to the Web UI session-command layer:
- Extend
CommandNameinpackages/server/src/services/hermes/run-chat/session-command.ts. - Add
learntoCOMMAND_ALIASES. - Handle
command.name === "learn"similarly to/skill:- call the bridge command endpoint with
/learn <args>; - expect a handled result with
type: "learn"and a generatedmessage; - enqueue or start a run with the generated message as the actual input;
- keep the visible/display input as
/learn <args>.
- call the bridge command endpoint with
Python Bridge
Add support in
packages/server/src/services/hermes/agent-bridge/python/bridge_pool.py:
- In
dispatch_command(), recognizelearn. - Import
build_learn_promptfromagent.learn_prompt. - Return a handled bridge result:
{
"session_id": session_id,
"command": name,
"handled": True,
"type": "learn",
"message": build_learn_prompt(arg),
}
If the import fails, return a clear unsupported-version message instead of
silently passing /learn through as normal text.
Client Slash Picker
Update packages/client/src/utils/hermes/bridge-session-commands.ts:
- Add
learntoBridgeSessionCommandName. - Add a command definition with text args.
- Keep it as a bridge session command so the UI renders it as a command message.
Update all locale files under packages/client/src/i18n/locales/:
- Add
chat.slashCommands.learn. - Reuse the existing
chat.slashCommandArgs.textplaceholder unless a more specific placeholder is needed.
Runtime Compatibility
The feature depends on Hermes Agent containing agent/learn_prompt.py. Web UI
should not copy the prompt text locally. The bridge should surface a clear error
when the runtime agent is too old, for example:
/learn requires a newer Hermes Agent runtime with agent.learn_prompt.
This keeps the upstream agent as the source of truth for skill-authoring rules.
UX Notes
- Idle session:
- user sees
/learn ...as a command message; - assistant runs the generated skill-authoring prompt;
- final answer should mention the created skill name and category, as directed by the upstream prompt.
- user sees
- Running session:
/learn ...should queue like/skilland/plan;- queued item should display the original command, not the expanded prompt.
- Bare
/learn:- should be accepted and should expand to the upstream fallback for the current conversation.
Tests
Add or update focused tests:
- Server:
parseSessionCommand("/learn from docs")returns a learn command.- idle
/learnstarts a run using the bridge-generated prompt. - running
/learnqueues the command like/skill. - missing
agent.learn_promptreturns a clear error.
- Client:
- slash picker includes
/learn. isKnownBridgeSessionCommand("/learn something")is true.- queued/running behavior displays
/learn ..., not the expanded prompt.
- slash picker includes
- Harness:
- Run the smallest relevant unit tests while iterating.
- Run
npm run harness:checkbefore opening a PR.
Rollout
- Land bridge command support and tests.
- Update bundled/runtime Hermes Agent to a revision containing
agent/learn_prompt.py. - Add the client slash-picker entry and locale strings.
- Verify against a local chat session with:
/learn/learn from docs/workflow.md/learn the workflow we just performed
Open Questions
- Should
/learnbe available in workflow node chat drawers, or only normal Hermes chat sessions? - Should Web UI refresh the skills list automatically after
/learncompletes? - Should the skills page show a lightweight "created by /learn" marker if the upstream skill metadata exposes one later?