Knowledge and Learning
This page covers what an agent knows (documents, search, memory, playbooks) and how an environment gets better from its own runs. Read it when the agent should use your documents, or when operator…
This page covers what an agent knows (documents, search, memory, playbooks) and how an environment gets better from its own runs. Read it when the agent should use your documents, or when operator corrections should turn into tested changes.
#What the agent knows
Each kind of knowledge is a kit. Text from documents, search and memory reaches the model as untrusted (tainted) context (Authority and Safety).
| You need | Kit | What it does |
|---|---|---|
| Your documents | ingestion | Splits documents into chunks, writes them to the search index (search-index@1), and publishes source.changed when one changes. |
| One search, several methods | retrieval | Asks every search kit, merges the results (Reciprocal Rank Fusion by default), caches them, and adds the top hits to the context. |
| Keyword search | search-keyword | Full-text search in the index. |
| Search by meaning | search-vector | Embeddings from an embedding@1 driver. |
| Entities and relations | knowledge-graph, search-graph (Enterprise) | Resolves entities, keeps their relations and merged summaries, and searches them. |
| Domain terms | ontology | Adds a glossary to the context and refuses memory claims that use unknown terms. |
| Playbooks | skills | Versioned SKILL.md playbooks, added to the context when they match the work. Optional scripts run in a sandbox. |
| Facts learned at work | memory | Claims, with the admission rules below. |
| Where derived data came from | lineage (Enterprise) | When a source changes, marks everything built from it as stale (derived.invalidated). |
The index is a driver: search-index-memory in the test profile, a SQLite full-text file (search-index-local-fts) in local, and Postgres (Enterprise) in self-host. No profile binds an embedding driver, so search-vector fails plan ([Z1] Kit "search-vector" requires port "embedding@1", which has no provider in this workspace.) until you add one, such as embedding-openai-compat, under bindingOverrides.
#Who may read what
Every search filters by the reader's scopes (port scopes@1, provided by tenancy), and plan refuses a setup that could skip the filter: retrieval needs scopes@1, an index driver that filters by scope, and a listener for scope.revoked (rule Z11), and every search kit must require scopes@1 (Z12). A revoked scope, a changed source or a changed claim clears cached results. A summary merged from several sources (by knowledge-graph or memory-consolidation) is shown only to readers who hold a scope from every source (requiredScopeSets).
#Memory
memory stores claims of three kinds: fact, episode and preference. Code adds them through memory@1 (your host, or memory-consolidation), and the same rules apply to every claim:
- Episodes and preferences always enter as
candidate. Facts do too, unlessdefaultClaimStatusisverified. - A claim may not cite itself or repeat an unverified claim word for word (
ANTI_ECHO_LOOP,ANTI_ECHO_DUPLICATE). - Other kits can refuse a claim at the
memory.admitguard;ontologyrefuses unknown terms there. - Candidates can expire (
expiresAtMs) or fade (decayHalfLifeDays).
Up to maxContextClaims (default 8) claims go into the context, verified ones first. An operator lists claims with neusym memory claims, and promotes or removes one with neusym memory verify or neusym memory invalidate.
Memory shapes prompts, never permissions. When memory is loaded, plan refuses any kit that contributes a guard, intercept or filter and depends on memory@1, retrieval@1 or search-index@1, directly or through another kit (rule Z14). policy-engine (Enterprise) may not read candidate claims at all (Z13).
memory-consolidation (Enterprise) merges related claims and operator feedback into summaries, one per audience (readers with the same scopes), and admits each summary through memory.admit like any other claim.
#The learning loop
Models draft changes; held-out tests gate them before anything goes live.
| Step | Kit | What happens |
|---|---|---|
| Record | observability | Exports every event, and one cost record per model call, to the telemetry driver. |
| Diagnose | diagnostics | Sorts each run into a category (ok, loop, budget, model_error and more), stores feedback, and keeps named defects to tag runs with. neusym report groups the runs. |
| Test | evals | Replay suites rerun captured cases against recorded tool results, so no live tool is called. Trial suites run real tasks (below). Runs report pass rate, pass^k (all k repeats pass), fixed and regressed cases, and cost. |
| Propose (Enterprise) | proposals | Asks a model to turn operator corrections (and, if you allow it, tagged defects) into a new version of one target: agent definition, skill, rule table, model route or constraint set. |
| Release (Enterprise) | release-manager | Runs the held-out gate on the candidate, then promotes, rolls back or revokes it. From code it can also roll out in stages and roll back on its own (startCanary). A run keeps the version it started with. |
A trial run (neusym eval trial-start <dir> <suite> --max-cost <usd>) turns each case into tasks with the worker role eval, charged to a budget scope of their own. Those tasks run only in an environment at draft or below (EVAL_TRIAL_LEVEL_DENIED otherwise), so a trial never writes live. An attempt is checked on its answer (expect), on evidence fields, or by a verify task; --pair-with compares it with a baseline, and neusym eval trial-status shows the result (Trial Runs for Evals).
Two one-way suite flags keep the gate honest. A heldOut suite cannot be unmarked, automatic capture (autoCaptureSuite) never adds to it, and a suite with cases cannot become one. A locked suite takes no new cases and no changes. Only the host (the CLI, the server or your code) can change these flags, never a kit or an agent tool. And proposals never learns from a case of the held-out suite, so the gate never tests what the draft learned from.
#Walkthrough
These outputs come from a local environment: the seven starter kits from Build an Environment plus diagnostics and evals, with a scripted model (--model-turns on run, eval run and proposals draft). First, find and name the problem:
neusym run ./my-env "Check system health" # answer: "All services are healthy."
neusym feedback ./my-env <runId> down --correction "Name each service and its status."
neusym defects define ./my-env vague-health --title "Health answer names no service" --severity medium
neusym defects tag ./my-env <runId> vague-health --summary "Said healthy without listing services"
neusym report ./my-env --by defectdefect report · 1 run(s) · 0 failed
defect tagged failed rate cost what went wrong examples
vague-health 1 0 0% $0.0005 person×1 run_…005Then turn the bad run into a held-out case, lock the suite, and test a fix. Here, scripted replies that name the services stand in for the improved agent:
neusym eval configure ./my-env health-gate --kind replay --held-out
neusym eval capture ./my-env --suite health-gate --run <runId> --expect-includes payments
neusym eval configure ./my-env health-gate --lock
neusym eval run ./my-env health-gate --repeats 3eval evalrun_… · suite health-gate [held-out] · 1 case(s) × 3 · pass 100% · pass^3 100% · 1 fixed · 0 regressedneusym eval configure ./my-env health-gate --description "easier gate" now fails: Suite "health-gate" is locked and cannot be modified.
The Enterprise steps add proposals and release-manager, set kitConfigs.proposals.heldOutSuite: health-gate, and seed an agent definition named ops-assistant (domain.seeds.agentDefs). Drafting from the captured run alone is refused (No rated-down run of "ops-assistant@v1" carries a usable correction.), because it is a gate case. After a second run is rated down with a correction:
neusym proposals draft ./my-env ops-assistant --as ops-1prop_…004 evaluated def=ops-assistant@v1 · release=rel:ops-assistant:v1 · gate=PASS (health-gate)The draft started from ops-assistant@v1, and neusym proposals get shows its instructions as a diff. neusym releases promote ./my-env rel:ops-assistant:v1 --as ops-1 makes it live. After one more round of correction, draft and promote, roll back the latest:
neusym releases rollback ./my-env --name ops-assistant --as ops-1 --reason "Answers got slower"
neusym releases list ./my-envrel:ops-assistant:v1 active ops-assistant@v1 def=ops-assistant@v2 · gate=PASS (health-gate)
rel:ops-assistant:v2 rolled_back ops-assistant@v2 def=ops-assistant@v3 · gate=PASS (health-gate)Release and definition versions count separately: release v1 carries ops-assistant@v2.