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
+10
-18
@@ -202,28 +202,20 @@ func missionWithSkill(tc *TaskContext, mission string) string {
|
||||
return "Follow these project-specific guidelines:\n\n" + tc.SkillBody + "\n\n---\n\n" + mission
|
||||
}
|
||||
|
||||
// workflowToSkill maps a workflow name to the skill directory name.
|
||||
var workflowToSkill = map[string]string{
|
||||
"tdd": "tdd-bugfix",
|
||||
"implement": "implement",
|
||||
"feasibility": "feasibility",
|
||||
}
|
||||
|
||||
// loadSkillBody loads the SKILL.md body and any bundled plugins for the
|
||||
// current workflow from the worktree's .agents/skills/ directory. Returns ""
|
||||
// if not found. Populates tc.SkillPlugins alongside tc.SkillBody.
|
||||
// loadSkillBody loads the SKILL.md body and plugins for the current
|
||||
// workflow from the worktree's .agents/skills/ directory. Skills declare
|
||||
// their workflow in metadata.archie.workflow — no hardcoded mapping.
|
||||
func loadSkillBody(tc *TaskContext) string {
|
||||
skillDir, ok := workflowToSkill[tc.Task.Workflow]
|
||||
if !ok {
|
||||
catalog, _ := skill.Catalog(tc.Dir)
|
||||
entry := skill.SkillForWorkflow(catalog, tc.Task.Workflow)
|
||||
if entry == nil {
|
||||
return ""
|
||||
}
|
||||
body := skill.LoadBody(tc.Dir, skillDir)
|
||||
body := skill.LoadBody(tc.Dir, entry.Dir)
|
||||
if body != "" && tc.SkillPlugins == nil {
|
||||
// Load plugins lazily on first agent stage.
|
||||
plugins, err := skill.DiscoverPlugins(tc.Dir, skillDir)
|
||||
if err == nil {
|
||||
tc.SkillPlugins = plugins
|
||||
}
|
||||
plugins, _ := skill.DiscoverPlugins(tc.Dir, entry.Dir)
|
||||
tc.SkillPlugins = plugins
|
||||
}
|
||||
return body
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ func TestSkillPluginsAvailableDuringStageExecution(t *testing.T) {
|
||||
// accessible via the TaskContext.
|
||||
|
||||
dir := t.TempDir()
|
||||
skillsDir := filepath.Join(dir, ".agents", "skills", "tdd-bugfix")
|
||||
skillsDir := filepath.Join(dir, ".agents", "skills", "archie-wf-tdd")
|
||||
pluginsDir := filepath.Join(skillsDir, "plugins")
|
||||
if err := os.MkdirAll(pluginsDir, 0o755); err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -39,6 +39,7 @@ metadata:
|
||||
archie:
|
||||
tools: [go]
|
||||
engine: any
|
||||
workflow: tdd
|
||||
---
|
||||
Analyse the bug, write repro tests, fix.
|
||||
`), 0o644); err != nil {
|
||||
|
||||
Reference in new issue
Block a user