Add Forger/TaskStore/Trees interfaces in internal/workflow/workflow.go,
scoped to exactly the methods stages call mid-run: 4 Forge methods
(Comment, CloseIssue, CreatePR, SetStateLabel), 2 Store methods (Update,
Transition), 6 Trees methods (Prepare, CommitAll, Push, Diff, ChangedFiles,
ChangedLines). This lets storerpc.Client/forgerpc.Client/worktreerpc.Client
satisfy TaskContext from inside archie-agent.
Go's structural typing meant zero other changes were needed — forge.Forge,
*store.Store, and *worktree.Manager already satisfy the trimmed interfaces.
No behavior change for the daemon's existing inprocess/subprocess paths.
Also fixes a gofmt nit left over from the 5zh.2 commit.
loadSkillBody() now populates TaskContext.SkillPlugins alongside
SkillBody. Plugins are discovered from .agents/skills/<name>/plugins/*.go
once, lazily on the first agent stage that loads the skill body.
New field: TaskContext.SkillPlugins []skill.Plugin — populated by
loadSkillBody, nil when no skill or no plugins.
Test-first: TestSkillPluginsAvailableDuringStageExecution creates a
worktree with a skill + bundled plugin, verifies plugins are loaded
and runnable via plugin.Run() after loadSkillBody().
Adds internal/skill package with YAML frontmatter parsing and skill
discovery from .agents/skills/ (agentskills.io spec convention).
- Frontmatter struct with name, description, version, metadata.archie
- Parse() extracts YAML frontmatter delimited by --- markers
- Discover() scans .agents/skills/*/SKILL.md (follows wfeval pattern)
- LoadBody() for single-skill lazy loading
Skills moved from .archie/skills/ to .agents/skills/ per the
agentskills.io specification.
Wiring: TaskContext.SkillBody field, lazy-loaded on first agent stage
from worktree. When non-empty, prepended to Mission as "Follow these
project-specific guidelines" context. Hardcoded Mission templates stay
(task-specific formatting). Backward compatible: empty when no skill
found.
Implements the full PRD (docs/prds/yaegi-plugin-system.md): repos can
now define .archie/gate.go for diff-inspecting quality rules shell
commands can't express, .archie/stages/*.go for custom pipeline steps,
and skills can ship Go scripts run via a new run_go_script agent tool —
all interpreted in-process with Yaegi, with panics recovered so a bad
script can't take down the daemon. Hot reload (phase 4) needed no code:
every loader reads from disk per call and every task gets a fresh
clone, so nothing is ever cached to go stale.
Routed via the feature label. Stages: assess (read-only agent with a
structured decide tool — verdict as a tool call, not parsed prose;
not-a-fit closes the issue as won't-do with reasons) -> PRD (read-only
agent; problem, solution, surface, acceptance criteria, non-goals) ->
deliver (PRD posted as the watched issue comment, optional [notify]
webhook POST for n8n->email, task -> waiting_human).
The daemon's cycle now watches waiting_human tasks: replies after the
watch comment (excluding the bot) are judged by an LLM (triage role,
APPROVE/REJECT/UNCLEAR + reason — never keyword matching). Approvals
requeue under implement (whose planner now treats an existing PRD as
prior context); rejections close with the reasoning acknowledged;
unclear replies keep waiting.
Supporting changes: forge.Comment returns the comment id;
forge.RepliesAfter; store watch_comment_id (additive migration),
WaitingTasks, Requeue; Route honours a pre-assigned workflow;
AgentStage.Extra for stage-specific tools.
Live: todo#7 assessed fit -> PRD delivered -> waiting_human.
Adapted from tau's eventbus/metrics designs (per Sam), slimmed for a
small daemon:
- internal/events: single-type bus with mutex fan-out and bounded
per-subscriber buffers that DROP on overflow (counted) — a stalled
dashboard can never backpressure the task engine (tau's blocking
delivery deliberately not copied)
- store: events table + queries powering the dashboards: task
timelines, per-workflow outcomes/spend, stage durations and error
counts (from stage_finish events), token spend by day
- emit points: task_queued, stage_start/finish(duration, error),
agent_finish(status, tokens, steps, model), parked, outcome,
pr_merged/pr_rejected
- internal/webui: read-only dashboard (embedded single page, no build
step) — status cards, task board with click-through timelines, live
SSE event tail with catch-up via ?since=<event id>, workflow/stage
metrics tables. [web] listen config, default 127.0.0.1:8484, no auth
by design (bind localhost/tailnet); "off" disables
- sink pipeline: bus -> SQLite insert (stamps row id) -> SSE broadcast
Verified live: dashboard serves real workflow stats from the existing
task history; bus overflow and event-log round-trips unit-tested.
- Issues are picked up by assigning them to the bot (tink-bot style)
instead of by label; labels now only influence workflow routing
- TDD: capture the failing 'go test' output after the repro stage
(parking if it unexpectedly passes) and post it on the PR as a code
block — evidence the bug was reproduced before the fix
- TDD fix stage now write-protects *_test.go via agentloop.ProtectPaths
(environmental enforcement, replacing the advisory prompt rule)
- OpenPR extracted so stages can act after the PR exists in the same
stage (the engine stops at the first stage with an outcome)
AgentStage is the reusable bridge from workflow stages to agentloop
runs: role->model selection from config, budgets, repo gate conversion,
task-row NotesStore (survives worktree cleanup, never pollutes the PR),
and park-on-anything-but-passed. Every future LLM stage (tdd,
feasibility) is an AgentStage with a different mission/gate/handler.
The implement workflow: prepare -> baseline gate (park on red base,
prevents park-storms) -> plan (read-only agentloop, plan posted to the
issue as a veto window) -> build (full toolset behind the repo's
configured gate) -> commit/push -> diff cap -> PR with the builder's
finish summary as the body.
Proven live on samcharles93/todo#3: planner 3 steps, builder 4 steps
(~31k tokens total), producing gate-verified table-driven TodoStore
tests as PR #4.
First live run exposed the gap: with only bootstrap registered, Route()
fell through to the definition-bug backstop. Label routing now falls
back to reg["default"], which archied maps to bootstrap until the
implement workflow exists.