The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(skills): every turn announces skill changes once, on every surface
Teknium097fcaa1deec
diff --git a/agent/conversation_loop.py b/agent/conversation_loop.pyindex 6eb554d9655..411134b41ae 100644--- a/agent/conversation_loop.py+++ b/agent/conversation_loop.py@@ -34,9 +34,6 @@ from agent.runtime_cwd import resolve_agent_cwdfrom agent.surface_switch import (identity_line_value, note_inert_pinned_tools, runtime_host_value, stage_surface_switch_note,)-from agent.skills_index_delta import ( # noqa: F401 — patch seam shared with the tests- stage_skills_index_note,-)from agent.turn_context import PreflightCompressionTimedOut, build_turn_contextfrom hermes_cli.observability.shared_metrics_efficiency import record_cache_break, record_prompt_rebuildfrom agent.turn_retry_state import TurnRetryState@@ -801,9 +798,6 @@ def _restore_or_build_system_prompt(agent, system_message, conversation_history)# The reused bytes may describe the surface this conversation STARTED on; correct that# at the tail of the request instead of rebuilding the prompt in front of it (#104414).announced_switch = stage_surface_switch_note(agent, stored_prompt, conversation_history)- # Same channel for a skills index that drifted since the prompt was built (a skill- # installed or removed mid-conversation); the index bytes stay, the delta rides behind them.- stage_skills_index_note(agent, stored_prompt, conversation_history)# Same contract for tools[]: pin the array to the order this session already# sent (tools freeze) instead of re-probing every check_fn on a fresh AIAgent.# The pin holds ON the announcing turn too. tools[] is serialized AHEAD of the systemdiff --git a/agent/skills_index_delta.py b/agent/skills_index_delta.pyindex e0bdac763b0..a2c35056113 100644--- a/agent/skills_index_delta.py+++ b/agent/skills_index_delta.py@@ -1,109 +1,113 @@-"""Skills index drift without a prompt rebuild.--The ``<available_skills>`` routing index is embedded in the persisted system prompt, and a-continuing session reuses those bytes verbatim so the provider prefix cache stays warm (#104414).-A skill that appears or disappears mid-conversation (a hub install, ``skill_manage`` from another-session, an org sync, the curator) therefore never reaches the index the model actually routes on-until compaction rebuilds the prompt; ``skills_list`` is live, but the prompt tells the model to-scan the index, not to call it. The delta is delivered on the per-turn user-message channel-instead: it lands behind the cached prefix, is stamped into the byte-stable ``api_content``-sidecar, and is re-staged only when the delta itself changes (ported from-cloudflare/cloudflare-os#267, whose chat cached its skill catalog once and never saw a new skill).+"""Skills that change mid-conversation reach the model without a prompt rebuild.++The ``<available_skills>`` index lives in the system prompt, and a conversation keeps those bytes+for its whole life so the provider prefix cache stays warm (#104414). A skill installed, created or+removed after the prompt was built (hub install, ``skill_manage``, the curator, a plugin going+live, a change made by another process) therefore never reached the index the model routes on+until compaction rebuilt the prompt. Every turn compares the index the prompt carries with the+index the session would build now and delivers the difference on the per-turn user-message note+channel, behind the cached prefix (ported from cloudflare/cloudflare-os#267).++Each note states the FULL difference against the prompt, so the prompt plus the newest note is the+complete record of what the model was told. A fresh agent (the gateway builds one per turn) reads that record back+from the transcript once; a long-lived agent (CLI, TUI, Desktop) keeps it on itself. A note is sent+only when the difference changes."""from __future__ import annotationsimport loggingimport re-from typing import Any, Dict, Set, Tuple+from typing import Anyfrom agent.message_content import flatten_message_textlogger = logging.getLogger("run_agent")-_SKILLS_INDEX_NOTE_PREFIX = "[System: The skills index in the system prompt is out of date for this conversation."-_ADDED_HEAD = "Skills added since it was built (load with skill_view(name) when relevant, like the index above):"-_REMOVED_HEAD = "Skills no longer available:"-_NOTE_END = "]"-_NOTE_SCAN_TAIL = 200+_NOTE_PREFIX = "[System: The skills available in this conversation changed after its system prompt was built."+_ADDED_HEAD = "Now available (load with skill_view(name) when relevant, like the skills listed in the system prompt):"+_REMOVED_HEAD = "No longer available:"+_ACCURATE_AGAIN = " The skills listed in the system prompt are accurate again; earlier skill-change notes are superseded."+_ROW = " - "_BLOCK_RE = re.compile(r"<available_skills>\n?(.*?)</available_skills>", re.DOTALL)-_ENTRY_RE = re.compile(r"^\s*- ([^:\n]+?)(?::|$)", re.MULTILINE)-_NAMES_ONLY_RE = re.compile(r"\[names only\]:\s*(.+)$", re.MULTILINE)---def index_entries(prompt: str) -> Dict[str, str]:- """``{name: index line}`` for every skill the ``<available_skills>`` block of ``prompt`` lists.-- Names-only category lines (focus mode) contribute the name with an empty line; ``{}`` when- the prompt has no block at all.- """- m = _BLOCK_RE.search(prompt or "")- if not m:- return {}- body = m.group(1)- entries: Dict[str, str] = {}- for line in body.splitlines():- em = _ENTRY_RE.match(line)- if em:- entries.setdefault(em.group(1).strip(), line.rstrip())- continue- nm = _NAMES_ONLY_RE.search(line)- if nm:- for name in nm.group(1).split(","):- if name.strip():- entries.setdefault(name.strip(), "")- return entries+_NAMES_ONLY_RE = re.compile(r"\[names only\]:\s*(.+)$")++_Delta = tuple[frozenset, frozenset]-def _last_announced_delta(conversation_history: Any) -> Tuple[Set[str], Set[str]]:- """``(added, removed)`` named by the NEWEST skills-index note in the transcript.+def _row_name(line: str) -> str:+ """Skill name of an index row (`` - name: description`` / `` - name``). Split on ``": "``:+ plugin skills are qualified (``plugin:skill``), so a bare ``":"`` is part of the name."""+ return line.strip()[2:].split(": ", 1)[0].strip()- Every note carries the FULL delta against the stored prompt, so the newest one is the- complete statement of what the model has been told; reading it back is what keeps a fresh- agent per turn (the gateway shape) from re-sending the same note every turn.- """- for msg in reversed((conversation_history or [])[-_NOTE_SCAN_TAIL:]):++def index_entries(prompt: Any) -> dict[str, str]:+ """``{name: index row}`` for every skill in ``prompt``'s ``<available_skills>`` block; names-only+ category rows (focus mode) map to ``""``. ``{}`` without a block."""+ match = _BLOCK_RE.search(prompt) if isinstance(prompt, str) else None+ entries: dict[str, str] = {}+ for line in match.group(1).splitlines() if match else ():+ if line.strip().startswith("- ") and (name := _row_name(line)):+ entries.setdefault(name, line.rstrip())+ elif names_only := _NAMES_ONLY_RE.search(line):+ for name in filter(None, (n.strip() for n in names_only.group(1).split(","))):+ entries.setdefault(name, "")+ return entries+++def _render(added: dict[str, str], removed: set[str]) -> str:+ if not added and not removed:+ return f"{_NOTE_PREFIX}{_ACCURATE_AGAIN}]"+ parts = [_NOTE_PREFIX]+ if added:+ parts += [_ADDED_HEAD, *(added[name] or f"{_ROW}{name}" for name in sorted(added))]+ if removed:+ parts.append(f"{_REMOVED_HEAD} {', '.join(sorted(removed))}")+ return "\n".join(parts) + "]"+++def _parse(note: str) -> _Delta:+ """Inverse of :func:`_render` for the text that follows ``_NOTE_PREFIX``."""+ lines = note.split("\n")+ added: set[str] = set()+ if _ADDED_HEAD in lines[1:2]:+ for line in lines[2:]:+ if not line.startswith(_ROW):+ break+ added.add(_row_name(line.removesuffix("]")))+ removed: set[str] = set()+ for line in lines[1:]:+ if line.startswith(_REMOVED_HEAD):+ tail = line[len(_REMOVED_HEAD):].removesuffix("]")+ removed = {n.strip() for n in tail.split(",") if n.strip()}+ break+ return frozenset(added), frozenset(removed)+++def _announced(conversation_history: Any) -> _Delta:+ """The difference named by the newest skills note anywhere in the transcript: a note far back+ still describes the current state when nothing changed since it was sent."""+ for msg in reversed(conversation_history or []):if not isinstance(msg, dict) or msg.get("role") != "user":continuesidecar = msg.get("api_content")text = (sidecar if isinstance(sidecar, str) else "") + "\n" + flatten_message_text(msg.get("content"))- if _SKILLS_INDEX_NOTE_PREFIX not in text:- continue- note = text.rsplit(_SKILLS_INDEX_NOTE_PREFIX, 1)[1]- added: Set[str] = set()- removed: Set[str] = set()- if _ADDED_HEAD in note:- added_part = note.split(_ADDED_HEAD, 1)[1].split(_REMOVED_HEAD, 1)[0]- added = {m.group(1).strip() for m in _ENTRY_RE.finditer(added_part)}- if _REMOVED_HEAD in note:- removed_part = note.split(_REMOVED_HEAD, 1)[1].split(_NOTE_END, 1)[0]- removed = {n.strip() for n in removed_part.split(",") if n.strip()}- return added, removed- return set(), set()---def _render_note(added: Dict[str, str], removed: Set[str]) -> str:- parts = [_SKILLS_INDEX_NOTE_PREFIX]- if added:- parts.append(_ADDED_HEAD)- parts.extend(added[name] or f" - {name}" for name in sorted(added))- if removed:- parts.append(f"{_REMOVED_HEAD} {', '.join(sorted(removed))}")- return "\n".join(parts) + _NOTE_END+ if _NOTE_PREFIX in text:+ return _parse(text.rsplit(_NOTE_PREFIX, 1)[1])+ return frozenset(), frozenset()-def stage_skills_index_note(agent: Any, stored_prompt: str, conversation_history: Any) -> bool:- """Stage a one-shot note when the stored prompt's skills index no longer matches the skills- the session can load right now. Returns whether it staged.+def stage_skills_index_note(agent: Any, prompt: Any, conversation_history: Any) -> bool:+ """Stage a one-shot note when the skills this session can load differ from ``prompt``'s index+ by something the model has not been told yet. Returns whether it staged.- Only a prompt that HAS an index is compared (no baseline otherwise), and only against the- index the current build would emit — the same cached builder the prompt came from, so a turn- with no skill change costs one LRU hit. MoA and codex_app_server turns never stamp the- ``api_content`` sidecar, so the note could not be read back; those modes skip it.- """+ A prompt without an index is never compared: it has no baseline (skills tools off, a seeded or+ embedder-supplied prompt), and announcing the whole catalog there would only add noise. MoA and+ codex_app_server turns never stamp the ``api_content`` sidecar, so the note could not be read+ back from the transcript; those modes skip it, like the surface-switch note."""if getattr(agent, "provider", None) == "moa" or getattr(agent, "api_mode", None) == "codex_app_server":return False- stored = index_entries(stored_prompt)+ stored = index_entries(prompt)if not stored:return Falsetry:@@ -112,19 +116,21 @@ def stage_skills_index_note(agent: Any, stored_prompt: str, conversation_historyexcept Exception:logger.debug("skills index delta: current index unavailable", exc_info=True)return False- added = {name: line for name, line in current.items() if name not in stored}- removed = set(stored) - set(current)- if (set(added), removed) == _last_announced_delta(conversation_history):+ told = getattr(agent, "_skills_index_told", None)+ key = hash(prompt)+ told_added, told_removed = told[1] if isinstance(told, tuple) and told[0] == key else _announced(conversation_history)+ # What the model believes it can load: the prompt's index as amended by the newest note. A rebuilt+ # prompt (compaction) that now lists what an earlier note announced needs no further note.+ if (set(stored) | told_added) - told_removed == set(current):+ agent._skills_index_told = (key, (told_added, told_removed))return False- if not added and not removed:- # Told about a delta that has since been undone (the skill came back / went away again);- # the stored index is accurate again and the stale note has to be retired.- agent._skills_index_note = f"{_SKILLS_INDEX_NOTE_PREFIX} It is accurate again: earlier skills-index notes in this conversation are superseded.{_NOTE_END}"- return True- agent._skills_index_note = _render_note(added, removed)+ added = {name: row for name, row in current.items() if name not in stored}+ removed = set(stored) - set(current)+ agent._skills_index_told = (key, (frozenset(added), frozenset(removed)))+ agent._skills_index_note = _render(added, removed)logger.info(- "Session %s: skills index drifted (+%d/-%d) since the stored prompt was built; keeping the "- "prompt and delivering the delta as a turn note (prefix cache preserved).",+ "Session %s: skills changed (+%d/-%d) since the system prompt was built; delivering the "+ "change as a turn note (prefix cache preserved).",getattr(agent, "session_id", None), len(added), len(removed),)return Truediff --git a/agent/turn_context.py b/agent/turn_context.pyindex 4814778e60f..cb7002ec92d 100644--- a/agent/turn_context.py+++ b/agent/turn_context.py@@ -22,6 +22,7 @@ from agent.iteration_budget import IterationBudgetfrom agent.memory_manager import build_memory_context_blockfrom agent.memory_provider import is_trivial_promptfrom agent.message_content import flatten_message_text+from agent.skills_index_delta import stage_skills_index_notefrom agent.message_metadata import PERSISTENCE_ONLY_MESSAGE_FIELDS, append_message, stamp_message_timestampfrom agent.model_metadata import (estimate_messages_tokens_rough,@@ -1173,6 +1174,9 @@ def build_turn_context(original_user_message=original_user_message, messages=messages,conversation_history=conversation_history,)+ # Every turn, not only on a prompt restore: a long-lived agent (CLI, TUI, Desktop) keeps its+ # prompt in memory for the whole conversation and would never re-check its skills index.+ stage_skills_index_note(agent, active_system_prompt, messages)plugin_user_context = _merge_gateway_notes(agent, messages, current_turn_user_idx, plugin_user_context)diff --git a/hermes_cli/plugins_activation_live.py b/hermes_cli/plugins_activation_live.pyindex 02b6d04ff5c..41a00b8b805 100644--- a/hermes_cli/plugins_activation_live.py+++ b/hermes_cli/plugins_activation_live.py@@ -84,12 +84,13 @@ def plugin_skills(plugin_key: str) -> list[dict[str, str]]:def live_notice(activation: dict[str, Any]) -> str:- """The note an open chat gets on its next turn: connected MCP servers with their tools, skills,- and what waits for the next session. Empty when nothing became usable."""- live = activation.get("live_now") or {}- servers, skills = live.get("mcp_servers") or [], live.get("skills") or []+ """The note an open chat gets on its next turn: connected MCP servers with their tools and what+ waits for the next session. Empty without servers. The plugin's skills are not listed here: every+ turn announces any skill the chat's system prompt does not list (``agent/skills_index_delta.py``),+ whichever way it arrived."""+ servers = (activation.get("live_now") or {}).get("mcp_servers") or []deferred = activation.get("deferred") or {}- if not servers and not skills:+ if not servers:return ""lines = [f"[plugin installed: {activation.get('name') or activation.get('key')}]"]connected = [s for s in servers if s.get("connected")]@@ -102,10 +103,6 @@ def live_notice(activation: dict[str, Any]) -> str:lines.extend(f" {line}" for line in listing.splitlines())for server in (s for s in servers if not s.get("connected")):lines.append(f"- {server['name']}: not connected ({server.get('error') or 'unknown error'})")- if skills:- lines.append("Skills now available; load one with skill_view:")- lines.extend(f"- {s['name']}: {s['description']}" if s.get("description") else f"- {s['name']}"- for s in skills)later = [f"{len(deferred['tools'])} Python tools" if deferred.get("tools") else "",f"{len(deferred['prompt'])} prompt sections" if deferred.get("prompt") else ""]if any(later):diff --git a/tests/agent/test_skills_index_delta.py b/tests/agent/test_skills_index_delta.pyindex b38ab6d2c0e..14ed10fc20d 100644--- a/tests/agent/test_skills_index_delta.py+++ b/tests/agent/test_skills_index_delta.py@@ -1,76 +1,85 @@-"""A skill that appears or disappears mid-conversation reaches the model without a prompt rebuild.+"""Skills that change mid-conversation reach the model, behind the cached system prompt.-The persisted ``<available_skills>`` index is reused byte-for-byte for the prefix cache, so the-delta is delivered on the per-turn note channel (cloudflare/cloudflare-os#267 port).+The ``<available_skills>`` index is frozen in the system prompt for the prefix cache, so the change+is delivered on the per-turn note channel (cloudflare/cloudflare-os#267 port)."""-from unittest.mock import MagicMock, patch--from agent.skills_index_delta import (- _ADDED_HEAD, _REMOVED_HEAD, _SKILLS_INDEX_NOTE_PREFIX, index_entries, stage_skills_index_note,-)--_STORED = (- "BODY\n\n## Skills\nintro\n\n<available_skills>\n"- " devops: ops tools\n"- " - docker-ops: Run and debug containers.\n"- " - k8s-ops: Kubernetes rollouts.\n"- " creative [names only]: ascii-art, manim-video\n"- "</available_skills>\n\nOnly proceed without loading a skill if none fit.\n\nPlatform: cli"-)-_CURRENT = _STORED.replace(- " - k8s-ops: Kubernetes rollouts.\n",- " - k8s-ops: Kubernetes rollouts.\n - terraform-ops: Plan and apply infra changes.\n",-).replace("ascii-art, manim-video", "manim-video")---def _agent():- agent = MagicMock()- agent.provider = "openrouter"- agent.api_mode = "chat_completions"- agent._skills_index_note = ""- return agent---def _stage(agent, history, current=_CURRENT):- with patch("agent.system_prompt._skills_prompt", return_value=current):- return stage_skills_index_note(agent, _STORED, history)---def test_index_entries_reads_described_and_names_only_skills():- assert set(index_entries(_STORED)) == {"docker-ops", "k8s-ops", "ascii-art", "manim-video"}- assert index_entries(_STORED)["docker-ops"] == " - docker-ops: Run and debug containers."- assert index_entries("no block here") == {}---def test_delta_is_announced_once_with_its_description_and_restaged_only_when_it_changes():- agent = _agent()- assert _stage(agent, [{"role": "user", "content": "hi"}]) is True- note = agent._skills_index_note- assert note.startswith(_SKILLS_INDEX_NOTE_PREFIX)- assert " - terraform-ops: Plan and apply infra changes." in note # the routing signal, not just a name- assert f"{_REMOVED_HEAD} ascii-art]" in note- assert "docker-ops" not in note.split(_ADDED_HEAD, 1)[1] # unchanged skills are not re-listed-- # Gateway shape: a fresh agent next turn, the transcript already carries this exact delta.- carried = [{"role": "user", "content": "hi", "api_content": f"hi\n\n{note}"}, {"role": "assistant", "content": "ok"}]- again = _agent()- assert _stage(again, carried) is False- assert again._skills_index_note == ""-- # The delta grows (another skill lands): the cumulative note is re-staged.- grown = _CURRENT.replace("</available_skills>", " - ansible-ops: Configuration runs.\n</available_skills>")- third = _agent()- assert _stage(third, carried, current=grown) is True- assert "ansible-ops" in third._skills_index_note and "terraform-ops" in third._skills_index_note-- # Undone (index accurate again): the stale note is retired, then nothing more is staged.- fourth = _agent()- assert _stage(fourth, carried, current=_STORED) is True- assert "accurate again" in fourth._skills_index_note- retired = carried + [{"role": "user", "content": "x", "api_content": f"x\n\n{fourth._skills_index_note}"}]- fifth = _agent()- assert _stage(fifth, retired, current=_STORED) is False-- # A prompt without an index has no baseline; an unchanged index stages nothing.- assert stage_skills_index_note(_agent(), "no skills block", []) is False- assert _stage(_agent(), [], current=_STORED) is False+import subprocess+import sys+from types import SimpleNamespace++from agent import prompt_builder as pb+from agent.skills_index_delta import stage_skills_index_note+from agent.turn_context import consume_skills_index_note+++def _write_skill(skills, name, description):+ path = skills / "devops" / name / "SKILL.md"+ path.parent.mkdir(parents=True, exist_ok=True)+ path.write_text(f"---\nname: {name}\ndescription: {description}\n---\nBody.\n", encoding="utf-8")+++def _agent(home):+ return SimpleNamespace(valid_tool_names={"skills_list", "skill_view", "skill_manage"}, platform="cli",+ provider="openrouter", api_mode="chat_completions", session_id="s1",+ _session_db=SimpleNamespace(db_path=str(home / "state.db")))+++def _turn(agent, prompt, history):+ """One turn: stage, then the consume ``_merge_gateway_notes`` does; returns the note sent."""+ stage_skills_index_note(agent, prompt, history)+ note = consume_skills_index_note(agent)+ history.append({"role": "user", "content": "hi", **({"api_content": f"hi\n\n{note}"} if note else {})})+ history.append({"role": "assistant", "content": "ok"})+ return note+++def _home(tmp_path, monkeypatch):+ monkeypatch.setenv("HERMES_HOME", str(tmp_path))+ monkeypatch.setattr(pb, "get_disabled_skill_names", lambda *_: set())+ pb.clear_skills_system_prompt_cache(clear_snapshot=True)+ return tmp_path / "skills"+++def test_skill_installed_by_another_process_reaches_a_running_process(tmp_path, monkeypatch):+ """The in-process index cache is keyed on skill files: a write this process never saw (a hub+ install in another terminal) is not answered from the pre-install cache entry (#92313)."""+ skills = _home(tmp_path, monkeypatch)+ _write_skill(skills, "docker-ops", "Run containers.")+ assert "docker-ops" in pb.build_skills_system_prompt()+ code = ("import pathlib, sys; p = pathlib.Path(sys.argv[1]); p.parent.mkdir(parents=True); "+ "p.write_text('---\\nname: terraform-ops\\ndescription: Plan infra.\\n---\\nBody.\\n')")+ subprocess.run([sys.executable, "-c", code, str(skills / "devops" / "terraform-ops" / "SKILL.md")], check=True)+ assert "- terraform-ops: Plan infra." in pb.build_skills_system_prompt()+++def test_long_lived_agent_is_told_each_skill_change_once(tmp_path, monkeypatch):+ """Every turn checks the index (a long-lived agent never rebuilds its prompt). The note names+ only what changed, is sent once per change (a fresh agent reading the transcript included,+ however far back the note is), and retires itself when the change is undone."""+ skills = _home(tmp_path, monkeypatch)+ _write_skill(skills, "docker-ops", "Run containers.")+ agent, history = _agent(tmp_path), []+ prompt = "Identity.\n\n" + pb.build_skills_system_prompt()+ assert _turn(agent, prompt, history) == ""++ _write_skill(skills, "terraform-ops", "Plan infra.")+ note = _turn(agent, prompt, history)+ assert " - terraform-ops: Plan infra." in note and "docker-ops" not in note+ assert _turn(agent, prompt, history) == ""+ history += [{"role": "user", "content": "x"}, {"role": "assistant", "content": "y"}] * 150+ assert _turn(_agent(tmp_path), prompt, history) == ""++ (skills / "devops" / "docker-ops" / "SKILL.md").unlink()+ note = _turn(agent, prompt, history)+ assert " - terraform-ops: Plan infra." in note and note.endswith("No longer available: docker-ops]")++ (skills / "devops" / "terraform-ops" / "SKILL.md").unlink()+ _write_skill(skills, "docker-ops", "Run containers.")+ assert "accurate again" in _turn(agent, prompt, history)+ assert _turn(_agent(tmp_path), prompt, history) == ""++ # A compaction rebuild that now lists the announced skill needs no new note.+ _write_skill(skills, "terraform-ops", "Plan infra.")+ assert "terraform-ops" in _turn(agent, prompt, history)+ rebuilt = "Identity.\n\n" + pb.build_skills_system_prompt()+ assert _turn(agent, rebuilt, history) == "" and _turn(_agent(tmp_path), rebuilt, history) == ""diff --git a/website/docs/developer-guide/prompt-assembly.md b/website/docs/developer-guide/prompt-assembly.mdindex 19c80daf7d6..5576353ea96 100644--- a/website/docs/developer-guide/prompt-assembly.md+++ b/website/docs/developer-guide/prompt-assembly.md@@ -53,9 +53,11 @@ blocks do not masquerade as the runtime cwd. Model/provider are read before theexcluding embedder descriptions. `Platform:` is deliberately not an identity field: a surface switch(desktop ↔ TUI) keeps the stored bytes and delivers the current surface's guidance as a one-shot note onthe per-turn user-message channel (`agent/surface_switch.py`), so the cached prefix survives (#104414). The-`<available_skills>` index is kept the same way: when a skill is installed, created or removed after the-prompt was built, the stored bytes stay and the delta (new index lines, removed names) rides the same-one-shot note channel (`agent/skills_index_delta.py`), re-sent only when the delta changes; the index+`<available_skills>` index is kept the same way: every turn compares it with the index the session would+build now (`agent/skills_index_delta.py`, called from `build_turn_context` so long-lived CLI/TUI/Desktop+agents are covered, not only prompt restores), and a difference (new index rows, removed names) rides+the same one-shot note channel, sent only when the difference changes. The in-process index cache is+keyed on the skill files' signatures, so a change written by another process is seen too. The indexitself converges at the next rebuild boundary (compaction). Legacy prompts retain their originalhost-before-context anchor, so prompts persisted before the reorder still validate.diff --git a/website/docs/user-guide/features/skills.md b/website/docs/user-guide/features/skills.mdindex 041e8c2007f..7c6b06930e5 100644--- a/website/docs/user-guide/features/skills.md+++ b/website/docs/user-guide/features/skills.md@@ -35,7 +35,7 @@ then **Installed** and a completion notification; errors stay in the dialog so ycan retry. Installation goes through the normal Skills Hub pipeline (security scan,action log, installed-list refresh). If you switch profile or connection while theconfirmation is open, reopen the link for the new destination; a link cannot bypass-scanning or pick a different profile. Changes apply to new sessions.+scanning or pick a different profile. Open conversations are told about the new skill on their next message.The `skill/install` route needs an updated Desktop build. If the app is missing ordoes not recognize the link, expand the card and copy its CLI install command.@@ -181,6 +181,16 @@ Level 2: skill_view(name, path) → Specific reference file (varies)The agent only loads the full skill content when it actually needs it.+### Skills added during a conversation++The list of skills the agent picks from is part of the conversation's system prompt, which stays+fixed so the provider's prompt cache keeps working. When a skill is installed, created or removed+while a conversation is open (from the Skills Hub, `hermes skills install` in another+terminal, a plugin, the curator, or the agent itself), your next message to the agent carries a short+note naming the new skills with their descriptions and the removed ones. The note is sent once per change;+the system prompt itself picks up the change at the next compaction. `/reload-skills` is not needed+for this, it still refreshes the `/skill-name` slash commands.+## SKILL.md Format```markdown