Intelligence Layer · v1.5.0

Memory Intelligence

Six additive proxy modules that layer intelligence on top of the core memory engine — without touching obfuscated core files. Each module wraps memRef.current as a transparent Proxy, fails open on every error, and can be disabled independently via env vars.

Proxy Chain Boot Order
Wire-ins must be applied in this order inside boot() for correct behaviour:

recall-tune → contradict → confidence → dedup → selforg → rl-memory

Confidence Scoring

Tracks how reliable each memory is on a 0.0–1.0 scale. Confidence initialises at 1.0 on first store, decays when contradictions are detected, and boosts when the same fact is reinforced across sessions. Exposed on every recall() result.

vektor-confidence.js PROXY

Wraps remember() and recall(). Reads/writes a confidence column via the underlying DB handle. Falls back to in-process map if DB handle is unavailable.

Wire-in

javascript
try{const _cf=require2('./vektor-confidence');memRef.current=_cf.wrapMemory(memRef.current);}
catch(_){}

Confidence Rules

EventDeltaDescription
New storeinit 1.0Brand-new memory initialised at full confidence
Reinforcement+0.05High-similarity write (≥0.85 score), no contradiction
In-place update+0.025Mild boost on contradiction-resolved overwrite
Superseded−0.10Old memory flagged as superseded by vektor-contradict
Hard replace−0.20Memory deleted and replaced by contradiction

CLI

bash
node vektor-confidence.js list              # all memories sorted by confidence asc
node vektor-confidence.js get <id>         # confidence for one memory
node vektor-confidence.js set <id> 0.75   # set confidence manually
node vektor-confidence.js decay <id>       # apply decay (default −0.20)
node vektor-confidence.js boost <id>       # apply boost (default +0.05)

Dedup on Write

Before every remember() call, recalls the top-5 nearest existing memories. If cosine similarity meets the threshold, merges into the existing record instead of inserting a duplicate. Keeps the graph clean automatically.

vektor-dedup.js PROXY

Wire-in

javascript
try{const _dd=require2('./vektor-dedup');memRef.current=_dd.wrapMemory(memRef.current);}
catch(_){}

Environment Variables

VariableDefaultDescription
VEKTOR_DEDUP_THRESHOLD0.95Cosine similarity cutoff for merge
VEKTOR_DEDUP_RECALL_LIMIT5Number of candidates to check per write
VEKTOR_DEDUP_UPDATE_IMPORTANCEtrueInherit max importance when merging

CLI

bash
node vektor-dedup.js stats                      # insert/update/error counts
node vektor-dedup.js test "memory content"      # dry-run duplicate check
node vektor-dedup.js config                     # show active config

Recall Tuning

Exposes min_score, max_results, and recency boost parameters for recall without touching the obfuscated core. Applied as the outermost proxy — wraps before all others.

vektor-recall-tune.js PROXY

Wire-in (must be FIRST proxy)

javascript
try{const _rt=require2('./vektor-recall-tune');memRef.current=_rt.wrapMemory(memRef.current,{push});}
catch(_){}

Environment Variables

VariableDefaultDescription
VEKTOR_RECALL_MIN_SCORE0.0Filter results below this cosine score
VEKTOR_RECALL_MAX_RESULTS20Hard cap on results returned
VEKTOR_RECALL_BOOST_RECENTtrueApply recency boost to scores
VEKTOR_RECALL_BOOST_HALFLIFE30Recency halflife in days
VEKTOR_RECALL_BOOST_WEIGHT0.15Max boost contribution to score
VEKTOR_RECALL_DEFAULT_LIMIT5Default limit when not specified

Runtime Tuning API

javascript
memory.setRecallTune({ minScore: 0.35, boostRecent: false });
memory.getRecallTune();   // → current config object
memory.resetRecallTune(); // restore defaults

CLI

bash
node vektor-recall-tune.js show
node vektor-recall-tune.js set min_score 0.35
node vektor-recall-tune.js set max_results 10
node vektor-recall-tune.js set boost_recent false
node vektor-recall-tune.js set boost_halflife 14
node vektor-recall-tune.js reset
node vektor-recall-tune.js test "query" --db ./slipstream-memory.db

RL-Based Prioritisation

Logs which recalled memories were actually used in agent responses. Trains a lightweight logistic regression scorer over 5 features — importance, recency, frequency, confidence, bias. Gradually replaces static importance with learned importance.

vektor-rl-memory.js PROXY

Wire-in

javascript
try{const _rl=require2('./vektor-rl-memory');memRef.current=_rl.wrapMemory(memRef.current,{push});}
catch(_){}
Required: Mark Used Memories
After every agent response, call memory.markSessionUsed(recalledIds) — passing the IDs of memories that were injected into context. Without this, the scorer never trains.

Environment Variables

VariableDefaultDescription
VEKTOR_RL_TRAIN_EVERY50Train after N new usage log entries
VEKTOR_RL_LEARN_RATE0.05SGD learning rate
VEKTOR_RL_BLEND_RATIO0.35How much learned score influences final importance
VEKTOR_RL_MIN_SAMPLES10Min log entries before scorer activates
VEKTOR_RL_WINDOW_DAYS30Rolling usage window in days

Runtime API

javascript
// After agent responds — pass IDs of memories that were used
memory.markSessionUsed(recalledIds);

// Force a training pass
memory.rlTrain();

// Scorer state
memory.rlStats(); // → { model, logCount }

CLI

bash
node vektor-rl-memory.js stats          # scorer state + top used memories
node vektor-rl-memory.js log <id>       # manually mark a memory as used
node vektor-rl-memory.js train          # force training pass
node vektor-rl-memory.js reset          # wipe usage log (memories intact)

Briefing Scheduler

Fires a memory briefing automatically 8 seconds after boot, then on a configurable interval. Synthesises top recalled memories into 3–6 bullet points via LLM and pushes them into the chat stream. Optionally injects the briefing into the active session's system prompt.

vektor-briefing-scheduler.js ASYNC

Wire-in

javascript
try{
  const _bs=require2('./vektor-briefing-scheduler');
  _bs.startBriefingScheduler(memRef,{
    provider: ()=>providerRef.current,
    model:    ()=>modelRef.current,
    push,
    getSession:   ()=>sessionRef.current,
    patchSession: (patch)=>Object.assign(sessionRef.current, patch)
  });
}catch(_){}

Environment Variables

VariableDefaultDescription
VEKTOR_BRIEFING_BOOT_DELAY_MS8000Delay after boot before first briefing (ms)
VEKTOR_BRIEFING_INTERVAL_MS3600000Interval between briefings (ms). Default: 1hr
VEKTOR_BRIEFING_RECALL_LIMIT20Memories to include in briefing input
VEKTOR_BRIEFING_INJECT_SYSTEMtrueInject briefing into session system prompt
VEKTOR_BRIEFING_MAX_SYSTEM_CHARS1200Max chars to inject into system prompt
VEKTOR_BRIEFING_ENABLEDtrueSet to false to disable entirely

CLI (one-shot)

bash
node vektor-briefing-scheduler.js --db ./slipstream-memory.db
Fallback Behaviour
If the LLM is unavailable, falls back to the raw top-5 memories formatted as bullet points. The briefing always fires — never blocks boot.

Self-Organising Memory

Every remember() triggers a non-blocking background agent that extracts keywords, links the new memory to related nodes, classifies relationships (SUPPORTS, EXTENDS, CONTRASTS, RELATED, PREREQUISITE), and synthesises a Zettelkasten context note when enough links are found. remember() itself returns immediately — zero added latency.

vektor-selforg.js PROXY

Wire-in

javascript
try{const _so=require2('./vektor-selforg');memRef.current=_so.wrapMemory(memRef.current,{
  provider: ()=>providerRef.current,
  model:    ()=>modelRef.current,
  callLLM,
  push
});}
catch(_){}

What runs per remember() call (non-blocking)

PhaseDescription
KeywordsLLM extracts up to 6 keywords → saved to memories.keywords
Link candidatesRecalls top-8 related memories above score 0.45
Relationship classificationLLM labels each pair: SUPPORTS | EXTENDS | CONTRASTS | RELATED | PREREQUISITE with 0–1 strength → written to memory_links table
Context noteIf ≥2 links found and importance ≥0.6, LLM synthesises a permanent note → saved to memories.context_note
Schema Note
Migration 007 runs automatically on first boot — adds memory_links table, keywords, and context_note columns. No manual migration step needed.