Skip to content

feat(coderd/x/chatd): persist skills as message parts like AGENTS.md#23748

Open
kylecarbs wants to merge 1 commit intomainfrom
persist-skills-as-message-parts
Open

feat(coderd/x/chatd): persist skills as message parts like AGENTS.md#23748
kylecarbs wants to merge 1 commit intomainfrom
persist-skills-as-message-parts

Conversation

@kylecarbs
Copy link
Copy Markdown
Member

Summary

Skills are now discovered once on the first turn (or when the workspace agent changes) and persisted as skill message parts alongside context-file parts. On subsequent turns, the skill index is reconstructed from persisted parts instead of re-dialing the workspace agent.

This makes skills consistent with the AGENTS.md pattern and is groundwork for a future /context endpoint that surfaces loaded workspace context to the frontend.

Changes

  • Add skill ChatMessagePartType with SkillName and SkillDescription fields
  • Extend persistInstructionFiles to also discover and persist skills as parts
  • Add skillsFromParts() to reconstruct skill index from persisted parts on subsequent turns
  • Update runChat() to use skillsFromParts instead of re-dialing workspace for skills
  • Frontend: handle new skill part type (skip rendering, hide metadata-only messages)

Before / After

AGENTS.md Skills
Before Persist as context-file parts, reconstruct from parts In-memory skillsCache only, re-dial workspace on cache miss
After Persist as context-file parts, reconstruct from parts Persist as skill parts, reconstruct from parts

The in-memory skillsCache remains for read_skill/read_skill_file tool calls that need full skill bodies on demand.

Design context

This is the first step toward a unified workspace context representation. Currently:

  • Context files are persisted as message parts (works)
  • Skills were only in-memory (inconsistent)
  • Workspace MCP servers are cached in-memory (future work)

Persisting skills as parts means a future /context endpoint can query both context files and skills from the same message parts in the DB, without depending on ephemeral server-side caches.

@kylecarbs kylecarbs force-pushed the persist-skills-as-message-parts branch 2 times, most recently from 0e18b9f to 66eeef0 Compare March 28, 2026 16:52
Skills are now discovered once on the first turn (or when the workspace
agent changes) and persisted as `skill` message parts alongside
`context-file` parts. On subsequent turns, the skill index is
reconstructed from persisted parts instead of re-dialing the workspace
agent.

This makes skills consistent with the AGENTS.md pattern: discover once,
persist as parts, read from parts on subsequent turns. The in-memory
skillsCache remains for read_skill/read_skill_file tool calls that need
full skill bodies.

Changes:
- Add `skill` ChatMessagePartType with SkillName and SkillDescription
  fields
- Extend persistInstructionFiles to also discover and persist skills
- Add skillsFromParts() to reconstruct skill index from persisted parts
- Update runChat() to use skillsFromParts on subsequent turns
- Frontend: handle new `skill` part type (skip rendering, hide
  metadata-only messages)
@kylecarbs kylecarbs force-pushed the persist-skills-as-message-parts branch from 66eeef0 to cdaa25f Compare March 28, 2026 17:36
@kylecarbs kylecarbs requested a review from ibetitsmike March 28, 2026 18:41
@kylecarbs kylecarbs marked this pull request as ready for review March 28, 2026 18:41
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.

2 participants