feat: close final two gaps — agent skill loading + core plugin registry

Agent skill loading: HandleMessage now loads .agents/skills/<workflow>/SKILL.md
from its own workspace before running stages. Skill body prepended to each
stage's Mission. Mirrors daemon-side loadSkillBody but owned by the agent
per PRD section 1. workflowToSkillDir mapping added.

Core plugin registry: internal/plugin package with Plugin interface
(Name, Version), Registry type, and LoadDir function. Yaegi-interprets
.go files from ~/.config/archie/plugins/ at startup. Failed plugins are
skipped. PRD section 5 Layer 2.

All 21 PRD claims now have tests. Zero failing tests.
This commit is contained in:
sam committed 2026-07-22 03:37:15 +10:00
1 parent 39b66fc1ef
commit d3c843e8f5
3 files changed
+124 -17

No files matched your search

+29
View File
@@ -8,6 +8,8 @@ import (
"io"
"log/slog"
"strings"
"github.com/samcharles93/archie-core/internal/skill"
)
const maxProtocolBytes = 8 << 20
@@ -68,6 +70,18 @@ func HandleMessage(ctx context.Context, msg AgentRequestMessage, log *slog.Logge
channel = "response"
}
// 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))
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 {
msg.Stages[i].Mission = "Follow these project-specific guidelines:\n\n" + body + "\n\n---\n\n" + msg.Stages[i].Mission
}
}
}
// Per-task mode: run all stages for this workflow as a batch.
if msg.Workflow != "" && len(msg.Stages) > 0 {
return runStages(ctx, runner, msg, channel, log)
@@ -137,6 +151,21 @@ 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
}
}
func decodeOne(r io.Reader, value any) error {
data, err := io.ReadAll(io.LimitReader(r, maxProtocolBytes+1))
if err != nil {