refactor: replace hardcoded workflow→skill maps with catalog-driven lookup
Skills now declare their workflow in metadata.archie.workflow. Catalog() scans frontmatter only (lazy, Tier 1). SkillForWorkflow() derives the skill directory from the catalog — no hardcoded maps. Removed workflowToSkill map (agent.go) and workflowToSkillDir switch (worker.go). Both daemon and agent use the same catalog-based lookup. Skills renamed to archie-wf-* convention. SKILL.md files updated with workflow metadata field. Progressive disclosure Tier 1: Catalog() returns name+description +workflow. Tier 2: LoadBody() loads full body on activation.
This commit is contained in:
1 parent
d3c843e8f5
commit
2182cc00a5
11 files changed
+312
-38
No files matched your search
@@ -36,14 +36,17 @@ func TestHandleMessageLoadsSkillsFromWorktree(t *testing.T) {
|
||||
// the Mission string. HandleMessage never touches .agents/skills/.
|
||||
|
||||
dir := t.TempDir()
|
||||
skillsDir := filepath.Join(dir, ".agents", "skills", "tdd-bugfix")
|
||||
skillsDir := filepath.Join(dir, ".agents", "skills", "archie-wf-tdd")
|
||||
if err := os.MkdirAll(skillsDir, 0o755); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := os.WriteFile(filepath.Join(skillsDir, "SKILL.md"), []byte(`---
|
||||
name: tdd-bugfix
|
||||
name: archie-wf-tdd
|
||||
description: TDD bugfix workflow
|
||||
version: 1.0.0
|
||||
metadata:
|
||||
archie:
|
||||
workflow: tdd
|
||||
---
|
||||
Analyse the bug. Write repro tests. Fix.
|
||||
`), 0o644); err != nil {
|
||||
|
||||
@@ -73,7 +73,7 @@ func HandleMessage(ctx context.Context, msg AgentRequestMessage, log *slog.Logge
|
||||
// Load the skill body from the worktree — the agent owns skill
|
||||
// loading per PRD section 1. Mirrors daemon-side loadSkillBody().
|
||||
if msg.Workflow != "" && msg.Workspace != "" {
|
||||
body := skill.LoadBody(msg.Workspace, workflowToSkillDir(msg.Workflow))
|
||||
body := skill.LoadBody(msg.Workspace, skillDirForWorkflow(msg.Workspace, msg.Workflow))
|
||||
if body != "" {
|
||||
msg.Request.Mission = "Follow these project-specific guidelines:\n\n" + body + "\n\n---\n\n" + msg.Request.Mission
|
||||
for i := range msg.Stages {
|
||||
@@ -151,19 +151,15 @@ func runStages(ctx context.Context, runner Runner, msg AgentRequestMessage, chan
|
||||
}, nil
|
||||
}
|
||||
|
||||
// workflowToSkillDir maps a workflow name to the skill directory name.
|
||||
// Mirrors the mapping in internal/workflow/agent.go.
|
||||
func workflowToSkillDir(workflow string) string {
|
||||
switch workflow {
|
||||
case "tdd":
|
||||
return "tdd-bugfix"
|
||||
case "implement":
|
||||
return "implement"
|
||||
case "feasibility":
|
||||
return "feasibility"
|
||||
default:
|
||||
return workflow
|
||||
// skillDirForWorkflow finds the skill directory for a workflow from the
|
||||
// workspace catalog. Skills declare their workflow in metadata.archie.workflow.
|
||||
func skillDirForWorkflow(workspace, workflow string) string {
|
||||
catalog, _ := skill.Catalog(workspace)
|
||||
entry := skill.SkillForWorkflow(catalog, workflow)
|
||||
if entry == nil {
|
||||
return ""
|
||||
}
|
||||
return entry.Dir
|
||||
}
|
||||
|
||||
func decodeOne(r io.Reader, value any) error {
|
||||
|
||||
Reference in new issue
Block a user