neuralmind.uk / Measure how your AI memory improves across a major refactor Edit this page on GitHub ↗

Measure how your AI memory improves across a major refactor

You just rebuilt a subsystem. Did your AI agent’s memory keep up — or is it recalling a codebase that no longer exists? With NeuralMind this is measurable: snapshot the graph and synapse stats before the refactor, work normally, snapshot after, and diff.

This page is two things: a field report with real numbers from a private mid-size TypeScript SaaS platform (~9,300 nodes) measured across a major internal rebuild, and a recipe for running the same before/after measurement on your own repo.

The field report

The setting. A private, mid-size TypeScript SaaS platform (~9,300 indexed nodes), maintained by NeuralMind’s own maintainer — see the honesty notes below. A major internal rebuild (“Phase 3 → Phase 4”) landed a new backend module, a shared business-logic layer, an admin UI, and end-to-end specs. NeuralMind ran throughout with lifecycle hooks installed, so the synapse layer observed the work as it happened. The repo is private, so the numbers are anonymized; every one of them came from the shipped CLI.

The numbers.

Metric Before (Phase 3) After (Phase 4) Change
Total nodes 9,190 9,293 +103
Communities 810 new resolution — no comparable before
Personal synapse edges 36 135 +275%
Shared synapse edges 10,079 10,183 +104
Shared edge weight 2,774.73 2,924.66 +5.4%
Wake-up tokens 455  
Avg query tokens 1,033  
Avg token reduction 48.8× vs loading files naively
Full --force rebuild 326 s (~5.4 min) incremental rebuilds ~30 s after

What the numbers say

Where each number comes from

Honesty first: the before/after table above is hand-assembled from the output of several commands — there is no single neuralmind compare-phases command.

Metric Command
Total nodes, communities neuralmind stats . --json (nodes also printed at build time)
Personal/shared edges, edge weight neuralmind stats . — the Memory namespaces block (per-namespace edges (weight …))
Wake-up tokens, avg query tokens, avg reduction neuralmind benchmark .
Rebuild time timed neuralmind build . --force (and an untimed incremental build)
Synapses fired per query, mean tokens neuralmind metrics .
Real logged spend neuralmind savings .

Run the same measurement on your refactor

Step 1 — Snapshot before you start

neuralmind stats . --json > .neuralmind-before.json
neuralmind stats .          # eyeball the Memory namespaces block
neuralmind benchmark .      # baseline reduction number

Keep the JSON out of your commit (or don’t — it’s small and diffs nicely).

Step 2 — Do the refactor, with the memory watching

The synapse layer only learns from what it observes. Make sure hooks are installed before the work starts:

neuralmind install-hooks .
neuralmind watch &   # optional: always-on learning from edits

Then work normally — query, edit, run tools. No manual “learn” step exists; co-activations are recorded as you go (see the Learning Guide).

Step 3 — Rebuild and snapshot after

time neuralmind build . --force   # once, to pick up new structure
neuralmind stats . --json > .neuralmind-after.json
neuralmind stats .

Diff the two JSON files (or the two Memory namespaces blocks). The interesting deltas: node count (did the graph track the new code?), personal edges (did the memory learn the new co-activations?), shared edge weight (did the graph get denser or just bigger?).

Step 4 — Re-benchmark and price it

neuralmind benchmark .   # reduction ratio on the post-refactor graph
neuralmind metrics .     # mean tokens/query and synapses fired, from real usage
neuralmind savings .     # what your actual logged queries cost vs naive

If the reduction ratio held (or improved) across the rebuild, your agent’s context bill survived the refactor. If personal edges barely moved, the memory wasn’t watching — check that hooks were installed before the work.

Honesty notes


← Back to use-case index · Main README