Skip to content

[P0-1] Skill mutation API: write path + frontmatter parser + SDK skills.{create,update,patch,writeFile,delete,removeFile} #35

@justrach

Description

@justrach

Parent: #34 — graff-agent prerequisites in codegraff
Priority: P0 (substrate — blocks the entire learning loop)
Branch base: release/0.1.53

Why

Skills are read-only today. The Hermes-class self-improvement loop in graff-agent (graff-memd) depends on the agent being able to create, patch, and organize skill folders during a conversation. This issue adds that surface in codegraff so graff-memd can use it via the SDK.

Scope

Rust side

  • forge_domain::SkillRepository: add write, patch_file, delete, write_support_file, remove_support_file methods (mirrors Hermes' skill_manage actions: create, patch, edit, write_file, delete, remove_file).
  • File layout per skill: <skills_root>/<name>/SKILL.md + references/, templates/, scripts/ — match agentskills.io spec.
  • Parse YAML frontmatter at the top of SKILL.md for name + description + optional version + tools so progressive disclosure works (only metadata loads until activation).
  • SkillFetchService::list_skills() returns metadata only; full body fetched lazily via fetch_skill(name).

SDK side (sdk/typescript)

Expose under graff.skills:

  • create({ name, description, body, supportFiles? })
  • update(name, { description?, body? })
  • patch(name, { oldString, newString })
  • writeFile(name, { relPath, content })
  • delete(name)
  • removeFile(name, relPath)
  • list() returns { name, description }[]
  • get(name) returns full body

Acceptance

  • cargo insta test --accept passes for new repository tests
  • Round-trip test: create → list → patch → fetch → delete
  • Frontmatter parser handles missing/malformed YAML gracefully (skill still loads)
  • SDK example: examples/skill-mutation.ts round-trips a skill

Metadata

Metadata

Assignees

No one assigned

    Labels

    severity: highSignificant impact; core functionality is impaired.type: featureBrand new functionality, features, pages, workflows, endpoints, etc.work: complexThe situation is complex, emergent practices used.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions