Skip to content

feat: add native Agent Skills support to ds4-agent#380

Open
fry69 wants to merge 5 commits into
antirez:mainfrom
fry69:fry69/feat-skills
Open

feat: add native Agent Skills support to ds4-agent#380
fry69 wants to merge 5 commits into
antirez:mainfrom
fry69:fry69/feat-skills

Conversation

@fry69

@fry69 fry69 commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Here is an implementation to teach ds4-agent reading skills on startup.

This PR soft depends on #379 to keep the current working directory available during startup.

Without keeping the working directory stable skill lookup will only find what is in the home directory, not in the project directory.

Automatically generated PR message follows:


Summary

Add native Agent Skills support to ds4-agent, following the open Agent Skills
specification (agentskills.io). 354 lines added, all in ds4_agent.c — no other
files touched.

Changes

New DSML tool: activate_skill

  • The model can call activate_skill(name) to load a skill's SKILL.md.
  • The tool looks up the skill by name in the discovered list, reads the file,
    and returns the content wrapped in <skill_content> tags with the skill
    directory path for relative-path resolution.
  • Schema and behavioural instructions are in the system prompt.

Skill discovery

  • Scans <cwd>/.agents/skills/ and ~/.agents/skills/ at session start.
  • Parses YAML frontmatter (name, description) with lenient error handling.
  • Skills with empty descriptions are skipped; malformed YAML is warned about.

Skill catalog

  • After the system prompt is loaded, a <available_skills> XML catalog is
    appended as a separate user message. This keeps the system prompt static
    and KV-cacheable while the catalog can change independently.
  • The catalog includes behavioural instructions telling the model to call
    activate_skill when a task matches a skill's description.

Slash commands

  • /skills — list discovered skills with names and descriptions.
  • /refresh — rescan skills directories, compare catalog text, and if changed,
    append the updated catalog at the end of the transcript. No full prefill is
    needed — only the new tokens are processed. The model sees the most recent
    catalog and uses it going forward.

Startup notification

  • Prints "Skills: N loaded" or "Skills: none found" at session start.

Backward compatibility

No breaking changes. If no skills directories exist, the agent behaves exactly
as before — no catalog message is appended, and /skills reports zero skills.

fry69 added 5 commits June 10, 2026 20:59
…d of rebuilding session

/refresh no longer discards the conversation. It rescans skills in memory,
compares the old and new catalog text, and if changed, appends the updated
catalog as a new user message at the end of the transcript. The model sees
the most recent catalog and uses it going forward. No full prefill is needed
— only the new tokens are processed.

Supporting changes:
- worker struct: added catalog_text field for change detection
- agent_skills_append_catalog: saves catalog_text after building
- agent_skills_free: frees catalog_text alongside skills
- help text updated to match new behavior
@fry69 fry69 force-pushed the fry69/feat-skills branch from 6c05553 to de39ba8 Compare June 10, 2026 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant