* feat(system-prompt): admit section updates incrementally * docs(system-prompt): accept retirement restart gap * test(system-prompt): cover retirement and reentry before admission * test(system-prompt): align rebase fixtures and persistence history * fix: align section prompt consumers and CI fixtures * test: pin credentials for section snapshot fixtures * test: align remaining snapshots with section admission * test: preserve section metadata in Web and PowerShell replays * refactor(system-prompt): retire sections through Cordis cleanup * chore: refresh section admission history after rebase * fix(system-prompt): advance admission head after compaction * fix(system-prompt): trim sections before admission hashing * docs: move system upgrade guides to current version * docs: add system message contribution cookbook * perf(system-prompt): avoid indexing history for admission * refactor(system-prompt): derive admission from logged sections * test(system-prompt): update lifecycle and compaction consumers * test(system-prompt): refresh CLI section event expectations * test(system-prompt): refresh question composer section metadata * feat(system-prompt): resolve same-name sections by scope * refactor(persona): use ordinary section registrations * refactor(system-prompt): clarify assembly and related control flow * test(system-prompt): reconcile rebased section snapshots * test(python): use current system text helper after rebase * test(system-prompt): refresh CLI expected section blocks * test(system-prompt): reconcile latest master integration * test(agent-loop): seed tools before deferred addition assertion * refactor(compaction): replace system heads when compacting prefixes * refactor(system-prompt): separate source text and notice attribution * fix(system-prompt): preserve legacy instructions in compaction snapshots * refactor(compaction): build system snapshots while reading the summary prefix * refactor(compaction): rebuild current system instructions * refactor(system-prompt): defer compaction rebuild to admission * refactor(system-prompt): remove redundant fixtures and setup * fix(plan-mode): announce committed user transitions * docs(system-prompt): reconcile section lifecycle and compaction design * refactor(system-prompt): consolidate projection version increments * fix(system-prompt): reconcile master integration and replay fixtures * docs(system-prompt): align upgrade guide with current release * refactor(system-prompt): make admission operations explicit * fix(system-prompt): reconcile master API and release changes * docs(system-prompt): regenerate catalogs after master refresh * refactor(llm-pi-ai): delegate text rendering to pi-ai * fix(llm-pi-ai): preserve blank lines between system text parts * refactor(system-prompt): remove redundant retirement metadata * refactor(system-prompt): own admission and use canonical surface targets * refactor(system-prompt): compare captured sections at commitment Assembly fixes section text and lifecycle; PromptAssembly.systemUpdates() compares them with the committed projection when the loop commits. This replaces SystemPrompt.admit(), needsRebuild() and isCurrent(), the SystemAdmission export, the loop's reassembly after compaction, and SessionSurface.systemHeadResetSeq. The projection records a pending rebuild as a boolean that an attributed reset clears. After a compaction inside a step, the rebuilt head uses the sections captured for that step; later source changes arrive as ordinary updates at the next step. * test: await the session read fixture and type a matcher for lint * test(tool-executor-ptc): describe same-name section override on executor replacement Duplicate section names no longer reject a scoped executor; the earlier registration is overridden and returns as an ordinary update when the executor leaves. * docs(upgrade-guide): move system-prompt integrations to v0.2.2-rc.3 The root version on master is 0.2.2-rc.3; verify-upgrade-guides rejects a guide added under an earlier version directory. * refactor(system-prompt): rebuild over system messages without sections A system message without source.sections now marks rebuilding pending, like a compaction summary. The next model attempt replaces the head with current sections and clears later system messages. This removes the separate legacy flag and its appended whole-prompt replacement and notice. Sessions written by earlier releases, migrated logs, and imported DeepSeek conversations take the same path, so the importer and its tests return to their master versions. * test(web): refresh the imported-conversation recording and drop a stray bytecode file The Web recording for a resumed DeepSeek import was recorded while the prompt was appended after the imported history; the head is replaced again, as on master. The .pyc under the macOS signing skill was staged by accident in an earlier merge. * refactor(session): scan system nodes on read surface.systemNodes is read only when a system rebuild is written. Scanning the current surface nodes on each read restores the surface fold's plan types and state to their master definitions, which no longer carry the system message. * refactor(session): rename SystemSurfaceNode.hasContent to isEmpty The flag reports that the logged content array has no blocks. isEmpty matches the documented "empty head" wording and covers a head that was written empty without ever being cleared. * refactor(llm): join system text through extractTextContent extractTextContent gains a trim option that trims each text block and omits blocks left empty. The DeepSeek serializer, the pi-ai converter, and the prompt inspector use it with a blank-line separator in place of three hand-written joins. The pi-ai converter now trims system and developer text like the other two, so whitespace-only blocks are omitted there as well. * test(snapshots): refresh the PowerShell and cordis-inspect recordings The two PowerShell scenarios still held the initial system message as one unattributed block; replay now writes one block per section with its attribution. The cordis-inspect-jsdoc recording embeds the API catalog, which names SystemSurfaceNode.isEmpty since the rename. * test(plan-mode,harness-dev-context): cover a rejected pre-step and a repeated legacy prompt A rejected pre-step must leave a queued plan-mode switch pending and unannounced until the next accepted step. A second unattributed system message with the same legacy paragraphs must keep the admitted paragraphs. * test(web): refresh Web recordings for section-attributed system messages Twenty-seven Web recordings still held the initial system message as one unattributed block. Replay now writes one text block per section with its attribution; twenty-six recordings differ only in that line. plan-review also records the plan-mode switch notice before the first prompt and appends a plan:status update on exit in place of a head replacement and a series header, so its expanded golden gains the notice row. The Creator persona test joins the system text blocks with blank lines, as the adapters do, before matching the persona line. * refactor(system-prompt): require the retry argument of systemUpdates The agent loop passes it on every attempt. A custom loop that omitted it on a retry received a full comparison in place of the pending rebuild, with no diagnostic; the type now makes each caller state which attempt it is. * docs(upgrade-guide): move the system prompt integrations guide to v0.2.2-rc.5 The root version is 0.2.2-rc.5 after the master merge, and verify-upgrade-guides rejects a guide added under an earlier version directory. * test(web): refresh the mention path presence recording for section-attributed system messages * test: align two specs that master left failing The DeepSeek settings spec waited for a saved notice carrying the provider label from before the rename to DeepSeek API. The Windows packaging workflow spec seeded one of the two helpers that the Stage workflow helpers step copies. * chore: remove a Python cache file committed by mistake
description, kind
| description | kind |
|---|---|
| The model-facing skill catalog and loader tool for users and maintainers understanding what agents see, or configuring the session skill catalog. | package-reference |
@deepseek-ai/dsh-tool-skill
English | 中文
Summary
Agents can discover and load skills during a session. When the skill tool is visible, model-invocable skills or incomplete discovery produce a durable catalog before the first request. The tool loads full instructions; users can invoke user-invocable skills with /name. Entry, visibility, and completeness changes append a replacement catalog. Incomplete discovery publishes confirmed skills with a warning, including when none are confirmed. Configure catalogDescriptionMaxLength to cap descriptions.
Table of Contents
- Use this package
- Understand the implementation
- Further Exploration
- Model Experience
- Known Limitations and Deferred Work
- Dev Note
Use this package
Skill discovery, catalog updates, and explicit skill invocation use the Session's current working directory.
Mount the plugin alongside the skill registry to give agents a session skill catalog and the skill loader tool. It requires ctx.agents, ctx.tools, and ctx.skills.
When to choose it
Use it when agents should discover and load skills during a session. Skip it when skill loading is handled by another consumer or not needed at all — without it, providers and the registry still work, but nothing renders a catalog or a tool for the model.
Mount and configure
Load the plugin together with the skill registry and at least one provider. The only configuration caps the normalized description length rendered in the catalog.
- name: '@deepseek-ai/dsh-skill'
- name: '@deepseek-ai/dsh-skill-filesystem'
- name: '@deepseek-ai/dsh-tool-skill'
| Field | Default | Meaning |
|---|---|---|
catalogDescriptionMaxLength |
500 |
Maximum normalized description length rendered in the session catalog; minimum 3 |
The generated configuration catalog is the exhaustive source for every accepted field.
What the model gets
- A session catalog. When the
skilltool is visible and either model-invocable skills exist or discovery is incomplete, the agent receives a durable user-role message before its first request, listing each confirmed skill's name and a capped description; a non-empty catalog tells the model to load a skill with the tool before acting on it, and never to infer instructions from the summary alone. - A loader tool. The model calls
skillwith the exact skill name and receives the full instruction body plus resource guidance in a canonical<skill_content>block; the result is retained as ordinary tool history. - Explicit user invocation. A
/nametoken in direct user input that names a user-invocable skill injects that skill's instructions into the step, without the model having to load it. - Live catalog updates. Later membership, description, visibility, or completeness changes append a replacement catalog; removing every skill appends an empty catalog that retires older names.
Observable success and failures
Loading a listed skill returns its full instructions; the model sees one canonical shape whether the load came from the tool or from a user's explicit invocation. An invalid name reports Error: invalid arguments: invalid skill name "<name>", an unknown name reports the skill is unknown or no longer available, and a skill disabled for model invocation reports it is not available for model invocation. The catalog is omitted entirely when no catalog was ever published and either discovery is complete with no model-invocable skills or the skill tool is hidden or shadowed; after a catalog has been published, either visibility loss — the skill tool hidden or shadowed by a same-name scoped tool — or removal of every skill instead appends an empty catalog that retires older names.
Understand the implementation
Implementation internals — click to expand
This section explains how the catalog and the invocation boundary are built; the observable behavior is fully covered in Use this package and the Model Experience section below.
Design concept
The package is built on two ideas. First, the catalog is a durable projection, diffed by a digest over the published entries and completeness rather than the rendered prose, so the <system-reminder> framing can never force a republish and consumers never re-parse the <available_skills> block. Second, one canonical rendering serves both load paths — the tool result and the user-explicit injection — through renderSkillContent shared from dsh-skill, so the model sees the same <skill_content> shape regardless of who initiated the load.
Source map
| File | Role |
|---|---|
src/index.ts |
Plugin entry: tool registration, catalog and gesture pre-step listeners, rendering and digest |
Catalog lifecycle
At each eligible agent/pre-step, the plugin snapshots the calling session's skill catalog, applies exact skill tool visibility, filters to model-invocable skills, and compares a digest of the entries and completeness against the newest visible skill-catalog message in the session log. When the digest changed, it hands the enter decision a durable user-role message containing the replacement catalog; an empty replacement explicitly retires earlier names. An incomplete snapshot publishes its readable entries with a discovery warning and durable incomplete: true source metadata, including when no entries remain. Completeness participates in the digest, so recovery clears the warning even when the entries stay the same; incomplete observations are retried rather than cached. The visibility check compares against the exact tool definition this plugin registered, so a scoped same-name shadow removes both the schema and its guidance; the plugin works mounted globally or inside one agent's composition.
Invocation boundary
The /name gesture listener scans only claimed user messages: a whitespace-bounded token naming a user-invocable skill in the workspace catalog injects the same <skill_content> rendering as a user-role instructions context appended after every other injection. Unknown names and user-disabled skills stay ordinary prose. This is the only entry point for disable-model-invocation skills, which the catalog and the skill tool never expose.
Further Exploration
Read these pages when the package-level contract is not enough. They move from the registry vocabulary behind the catalog to the exact tool schema and the design rationale.
- Skill subsystem reference — the registry and provider vocabulary behind the catalog.
- skill package — the registry and the shared
renderSkillContentrendering. - Generated tool catalog — the exact
skillschema the model receives. - User-explicit skill invocation Agent Note — the
/namegesture design.
Model Experience
Session catalog
What the model sees
If this exact skill tool is visible and either model-invocable skills exist or discovery is incomplete, the agent receives the catalog template below as a durable user-role message before the first request, with one data-dependent entry per sorted skill. Later membership, description, visibility, or completeness changes append a replacement using the same <available_skills> envelope; deleting every skill appends an empty envelope with an explicit instruction not to use older names. The template's closing sentence is the rule against double-loading: the user-explicit gesture boundary (the pre-step listener below) injects the same renderSkillContent output (shared from @deepseek-ai/dsh-skill) inline, and the catalog tells the model to follow that block instead of re-loading the skill through the tool; the replacement-catalog template carries the same anti-double-loading rule in both arms, including the emptied catalog.
Incomplete discovery notice
Some skills could not be checked. Only confirmed skills are listed; a lower-priority definition of the same name may be selected when a preferred source is unavailable. Discovery will be retried on the next request.
Initial empty incomplete catalog
No skills could be confirmed in this discovery attempt.
Wait for an updated catalog before calling the `skill` tool. Do not infer skill instructions from an empty catalog.
Empty incomplete replacement
No skills could be confirmed in this discovery attempt. Do not use names from earlier skill catalogs.
Skill catalog template
<system-reminder>
A skill is a reusable set of task-specific instructions. The following skills are available in this session:
<available_skills>
- `<name>`: <normalized-and-capped-description>
</available_skills>
If the user names a skill, or the task clearly matches a skill's description, call the `skill` tool with the exact skill name before taking task actions. Load all applicable skills, then follow their full instructions. This catalog contains summaries only; do not infer or follow a skill's instructions until it has been loaded.
A user may also invoke a skill directly; its <skill_content> block then appears in this conversation. Follow it, and do not call the `skill` tool again for that skill.
</system-reminder>
Token effect
Repeated input cost scales with skill count and catalogDescriptionMaxLength; no initial catalog tokens are sent when discovery is complete and empty or the tool is hidden or shadowed. Each entry or completeness change adds one retained replacement message; incomplete discovery adds a warning.
KV Cache effect
The initial durable catalog is appended after the existing reusable prefix. Dynamic changes are append-only history after that catalog, so earlier reusable tokens stay intact while each newly appended catalog and later turns form a new suffix. A new or resumed instance with a changed digest may affect cache reuse from the newly appended catalog position.
Tool schema
What the model sees
The model sees the generated skill schema.
Token effect
Fixed schema cost per request where the tool is visible.
KV Cache effect
Prefix-stable while the tool definition and visibility are unchanged. Shadowing, restrictions, or plugin lifecycle changes may invalidate reuse from this schema.
Tool result
What the model sees
A successful call uses the result template and the provider-managed, directory, URL, or opaque resource guidance below.
Skill result template
<skill_content name="<escaped-name>">
<skill_resources>
<resource-guidance>
</skill_resources>
<skill_instructions>
<provider-owned-instruction-body>
</skill_instructions>
</skill_content>
Provider-managed resource guidance
Resources for this skill are managed by provider "<provider>".
Load referenced resources only as needed.
Directory resource guidance
Base directory for this skill: <path>
Resolve relative paths mentioned by this skill against the base directory before using them. Load referenced resources only as needed.
URL resource guidance
Base URL for this skill: <url>
Resolve relative URLs mentioned by this skill against the base URL before using them. Load referenced resources only as needed.
Opaque resource guidance
Resources for this skill: <description>
Load referenced resources only as needed.
Token effect
Loaded instructions are data-dependent tool-result tokens, resent on later steps until compaction; no duplicate agent.inject() copy is made.
KV Cache effect
Append-only; newly visible content follows the reusable request prefix and does not invalidate existing KV-cache entries.
Tool errors
What the model sees
Invalid or stale selections return exactly Error: invalid arguments: invalid skill name "<name>" as ToolArgsError with INVALID_ARGS, or Error: skill "<name>" is unknown or no longer available and Error: skill "<name>" is not available for model invocation as SkillError with SKILL_NOT_FOUND and SKILL_NOT_MODEL_INVOCABLE. Provider-thrown lookup text is data-dependent and receives the same Error: <message> wrapper.
Token effect
Only a failing call adds these retained tokens.
KV Cache effect
Append-only; newly visible content follows the reusable request prefix and does not invalidate existing KV-cache entries.
User-explicit invocation injection
What the model sees
A whitespace-bounded /name token anywhere in a claimed user message, naming a user-invocable skill in the workspace catalog, injects that skill's full <skill_content> rendering (the exact result-template shape above) as a user-role instructions context appended after every other injection of that step — background first, the material to act on last. Only direct user input is scanned, the check runs on the loaded definition, and unknown or user-disabled names stay ordinary prose. This is the sole entry point for disable-model-invocation skills, which the catalog and the skill tool never expose; the catalog's closing sentence tells the model to follow the injected block instead of re-loading it.
Token effect
Each gesture adds one rendered skill body to that turn as injected context — the same size as the tool result for the same skill, paid deterministically at the user's request instead of at the model's discretion. Repeated gestures for one skill within one step inject once.
KV Cache effect
Append-only; the injection lands after the reusable request prefix inside the step's message batch and does not invalidate existing KV-cache entries.
Known Limitations and Deferred Work
These limits define when the catalog or the loader is a poor fit. They are current package constraints, not a task backlog.
- The catalog omits
whenToUse, source, and provider metadata — routing is based only on name and a capped description;whenToUseremains provider metadata and is not rendered by the loaded wrapper either. - Loaded instruction bodies have no size cap — a provider can return a skill large enough to consume substantial next-step context; only catalog descriptions are truncated.
- Resources are guidance, not attachments — the tool reports a base directory/URL/opaque hint but neither enumerates nor fetches referenced files for the model.
- Loading is one-shot text — there is no partial, streaming, or cached-content handle when a remote provider is slow or a skill body is large.
- Catalog replacement is whole-list — one changed name or description appends every visible summary; this keeps stale-name retirement explicit but costs tokens proportional to the catalog.
- Bodies are not versioned — body-only edits do not change the catalog digest or notify the model; a later tool call reads the current provider content while earlier tool results remain historical facts.
Dev Note
Working context for maintainers — click to expand
None.