Skip to content

feat(mentat): skill distribution to agent-specific paths#19

Closed
bketelsen wants to merge 1 commit intomainfrom
mentat/skill-distribution
Closed

feat(mentat): skill distribution to agent-specific paths#19
bketelsen wants to merge 1 commit intomainfrom
mentat/skill-distribution

Conversation

@bketelsen
Copy link
Copy Markdown
Contributor

Summary

After mentat sync generates per-domain SKILL.md files, the new distributor package copies each skill to every agent toolchain's expected location in a single pass.

What's added

mentat/internal/distributor/distributor.go

Five distribution targets (all enabled by default via DefaultConfig()):

Target Output path Transformation
pi .agents/skills/{domain}/SKILL.md as-is
claude .claude/commands/{domain}.md frontmatter stripped
codex .codex/skills/{domain}.md frontmatter stripped
cursor .cursor/rules/{domain}.mdc description-only frontmatter, .mdc extension
agents-md AGENTS.md (repo root) all domains, sorted ## {domain} sections, no frontmatter

Public API:

  • Distribute(repoPath, domain, content string, cfg Config, log *slog.Logger) error — single domain, all targets except agents-md
  • DistributeAll(repoPath string, skills []SkillContent, cfg Config, log *slog.Logger) error — full set, then regenerates AGENTS.md
  • Respects clix.DryRun; logs intent without writing

mentat/internal/distributor/distributor_test.go

23 table-driven tests covering: all five target paths, frontmatter stripping/rewriting, Cursor description extraction, AGENTS.md ## sections + no-frontmatter + alpha sort, disabled targets, dry-run (no writes), and content with no frontmatter.

mentat/cmd/mentat/commands.go

  • Wires distributor.DistributeAll into syncCmd after generator.GenerateAll returns
  • Reads back written SKILL.md files and passes []distributor.SkillContent to the distributor
  • Adds --no-distribute flag to skip distribution (useful for quick stale-file reruns)

docs/exec-plans/active/mentat-skill-distribution.md

Exec plan per AGENTS.md convention (3+ files changed).

Verification

just build-mentat   # exit 0
cd mentat && go test ./...   # all packages pass
cd mentat && go vet ./...    # clean

Add distributor package that copies generated SKILL.md content to the
directory layouts expected by pi/Miles, Claude Code, Codex, Cursor, and
a combined AGENTS.md at repo root.

Targets:
  pi        — .agents/skills/{domain}/SKILL.md  (as-is)
  claude    — .claude/commands/{domain}.md       (frontmatter stripped)
  codex     — .codex/skills/{domain}.md          (frontmatter stripped)
  cursor    — .cursor/rules/{domain}.mdc         (description-only frontmatter)
  agents-md — AGENTS.md                          (all domains, ## sections, sorted)

Wire distributor.DistributeAll into syncCmd after generator.GenerateAll.
Add --no-distribute flag to skip distribution (useful for fast stale-only
regeneration runs).

Tests: 23 new cases covering all five targets, frontmatter handling,
dry-run, disabled targets, and deterministic alpha-sorted AGENTS.md output.
@bketelsen bketelsen closed this Apr 30, 2026
@bketelsen bketelsen deleted the mentat/skill-distribution branch April 30, 2026 00:35
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