feat: skills — additive instruction+tool bundles, clock + calc examples

Phase 6: skill.New constructor satisfying the agent.Skill contract;
instruction-only skills; ordered additive composition; skill/clock
(injectable-clock time tools) and skill/calc (recursive-descent arithmetic
evaluator) as ready-made examples with full test suites incl. an
agent-loop round trip. ADR-0013; README skills section + matrix synced.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-06-10 13:13:07 +02:00
parent 7dab4112ff
commit 76ecf0e49e
10 changed files with 717 additions and 3 deletions
+26 -3
View File
@@ -237,9 +237,32 @@ the model can react to; unknown tools likewise; duplicate tool names across
toolboxes fail loudly. On `agent.ErrMaxSteps` (and on model errors) the
partial result with the full transcript is still returned.
## Skills *(pending — Phase 6)*
## Skills
Skills = reusable instruction+tool bundles attachable to any agent.
Skills are reusable instruction+tool bundles attachable to **any** agent,
at construction or on demand. Instructions extend the system prompt;
tools extend the toolset — additively, in attachment order.
```go
import (
"gitea.stevedudenhoeffer.com/steve/majordomo/skill"
"gitea.stevedudenhoeffer.com/steve/majordomo/skill/calc"
"gitea.stevedudenhoeffer.com/steve/majordomo/skill/clock"
)
research := skill.New("research",
skill.WithInstructions("Cite a source for every claim."),
skill.WithTools(searchTool, fetchTool),
)
a := agent.New(m, "You are helpful.", agent.WithSkill(research))
a.AddSkill(clock.New()) // ready-made: time awareness
a.AddSkill(calc.New()) // ready-made: exact arithmetic
```
Anything implementing the three-method `agent.Skill` interface (Name /
Instructions / Tools) is a skill — `skill.New` is just the convenient way
to build one.
## Feature/provider support matrix
@@ -263,7 +286,7 @@ Notes: Ollama has no native tool_choice — `"none"` drops the tools;
Cross-cutting: Parse grammar ✅ · aliases/tiers ✅ · failover chains ✅ ·
health tracking/backoff ✅ · LLM_* env DSNs ✅ · media pipeline ✅
(per-target normalization in chains) · agent loop ✅ · `Generate[T]` +
schema derivation ✅ · skills pending.
schema derivation ✅ · skills ✅ (with clock + calc examples).
## Development