v3/docs/adr/ADR-353-dream-cycle-intelligence-skill-distillation.md
Ruflo's intelligence pipeline records agent execution traces via 17 hooks + 12 background workers and stores them in AgentDB / ReasoningBank. However, the pipeline terminates at the recording step — no subsequent compilation converts raw traces into reusable procedural skills.
SKILL-DISCO (Guo, Qi, Gu — arXiv 2026) demonstrates that distilling agent execution traces into compiled procedural skills improves task success by +22% on ALFWorld and statistically significant improvement on WebArena vs. embedding-only trace storage. The mechanism: traces are chunked into sub-goals, each sub-goal is summarised into a parameterised skill template, and the template library is retrieved by future agents at planning time rather than raw trace replay.
A parallel gap exists in Ruflo's reward model: SONA verdicts use a fixed success/failure schema. "The Verification Horizon" (Wang et al., arXiv 2026) demonstrates that fixed rewards become inadequate as base model capability increases — verification must co-evolve with the generator.
Add a skill distillation worker (distill-skills) as the 13th background worker in the hooks system. The worker:
post-task events where the task outcome was recorded as success=true.skill:// URI prefix:
skill://<task-type>/<semantic-slug>/<version>
pre-task hook queries AgentDB for skill:// records matching the current task's embedding before falling back to raw ReasoningBank retrieval.Additionally, introduce a versioned verdict registry to address the Verification Horizon gap:
verdict_schema_version (integer) to all new ReasoningBank entries.Positive:
Negative / Risks:
post-task hook on success path; must be async / non-blocking.skill:// URI namespace requires AgentDB schema migration (add uri_prefix column to vector_indexes).v3/@claude-flow/hooks/src/workers/distill-skills.ts (<500 lines)v3/@claude-flow/memory/src/agentdb/schema.ts (add skill_library table)v3/@claude-flow/hooks/src/hooks/post-task.ts (emit trace payload to worker)v3/@claude-flow/hooks/src/hooks/pre-task.ts (query skill library before raw retrieval)tests/hooks/distill-skills.test.ts