@msm-core/learning
v0.1.0
Published
Auto-improvement for agents — capture goal-pursuit experiences, reflect them into reusable lessons (winning approaches + anti-patterns), and retrieve the relevant ones to seed the next plan. Storage- and brain-agnostic (inject a store port + a judge).
Downloads
153
Maintainers
Readme
@msm-core/learning
Auto-improvement for durable agents. Close the loop from outcome to better behaviour.
plan runs (verify verdicts + escalations) ──▶ recordExperience
▲ (goal, plan, outcome, failure, human feedback)
│ seed the next decompose │
│ reflect (brain → lessons)
retrieveLessons + formatLessons ◀───────── winning approaches / anti-patterns
(relevant, confidence-gated) (keyed by goal meaning, confidence-gated)The verify-and-adapt verdicts an agent produces (see @msm-core/planner) are exactly the
training signal this consumes. Storage- and brain-agnostic — inject a LearningStore and a
judge.
Pieces
recordExperience(store, exp)— capture a goal pursuit (call it on a job's terminal state).reflect(store, judge, opts)— distil recent experiences into lessons; persists them. Best-effort (too few experiences / brain outage / junk → no lessons, never throws).retrieveLessons(store, goal, opts)— the lessons most relevant to a goal, confidence-gated.formatLessons(lessons)— render them as a prompt fragment to seed a decompose/replan.InMemoryLearningStore— a reference store (word-overlap similarity) for tests + light use; back it with a vector index in production so lessons travel with the agent.
Safe by design
- Advisory, not authoritative — lessons seed the prompt; the brain still decides. A bad lesson nudges, it never forces.
- Confidence-gated + mergeable — a lesson the agent keeps re-learning gains support and confidence; a one-off stays weak and is filtered out of retrieval.
- Sovereign — experiences and lessons live in the store you provide (e.g. the agent's own database), never leave it.
Zero runtime dependencies.
