Guide · Freshness

How to keep agent knowledge fresh: sync, staleness and drift

For teams whose docs, schema and rules change faster than their agents are updated.

Updated

To keep what an agent knows fresh, treat the Brain like a synced copy of your sources: re-run brainbox sync when docs change, re-ingest when the schema changes, let events add traces, and review deletes instead of letting them pass silently. Re-ingest retracts what a changed source no longer says, and events that contradict an element show up as stale signals.

  • brainbox sync ingests new and edited docs and skips unchanged ones.
  • Deleted files are never archived silently: review pending deletes, then prune.
  • Re-ingest retracts knowledge a changed source no longer supports; stale signals flag elements that recent events contradict.

Sync keeps a folder in step

Each file is stored under a stable key: the namespace plus its relative path. Re-run sync and new and edited files are ingested while unchanged ones are skipped. Start with --dry-run to see the diff, and use --json in scripts and CI.

npx -y @brainbox-labs/cli@latest sync ./docs --namespace kb --dry-run
npx -y @brainbox-labs/cli@latest sync ./docs --namespace kb --json

Deletes and renames

A file you delete is never archived silently. On a terminal, sync lists the pages and asks first. Without a terminal (CI, agents, --json) it reports them as pending deletes; pass --prune to archive all of them, or brainbox prune <key> for specific ones. A rename or move gives a file a new key, so the old page becomes a pending delete. Add sourceKey: my-doc to a file's frontmatter to keep one identity across renames.

npx -y @brainbox-labs/cli@latest prune kb%2Fold.md kb%2Fgone.md

Re-ingest retracts, it does not only add

When a source changes, the Brain diffs the old and new versions and proposes enrich, add and retract changes, applied as guarded soft-archives. A fact a document no longer states does not linger as an orphan in the Domain Model.

Drift between syncs

Events can contradict what the Brain holds before the next sync. process_event notices and get_index returns staleSignals: elements that recent events keep contradicting. Each element also carries a validity window and a confirmation date, and confirming an element renews it. Review the signals, correct the source, and sync.

A refresh cadence by source type
SourceRefresh withSuggested trigger
Docs folder or repobrainbox sync <dir>On every merge to the docs, or on a schedule
Database schemabrainbox ingest <url>After a migration
Meetings, email, ticketsprocess_eventAs each event happens
A correction from an agent or personcreate_learningWhen it is noticed; a person promotes it
Metric definitionssync the glossary, or re-upload dbt artifactsWhen a definition changes

FAQ

How does the Brain know a doc changed?
sync compares each file with what is stored under its stable key. New and edited docs are ingested and unchanged ones are skipped.
What happens when I delete or rename a file?
A deleted file is reported as a pending delete and archived only after you approve it, or with --prune. A renamed or moved file gets a new key unless you set sourceKey in its frontmatter.
Does an old fact stay in the Brain after the source changes?
No. Re-ingest diffs the old and new source and proposes retractions for what the new one no longer says.
How do I see what is going stale?
get_index returns staleSignals: elements that recent events keep contradicting.

Give your agents a brain.

Sign in and ask your first question.

Book a Demo