State/bin/brain/growth.ts - the metric computer. .md file to compare - side-by-side diff against brain-growth
brain-growth
description: "Triggers on prompt mention of 'brain-growth'."
What it does for you
Tracks how much more capable your assistant gets each day.
What it produces
A recent result, so you can see the kind of work it returns.
loading…
How to get it
These run inside the Snappy workspace. Want this working in your business? I set skills like this up with you, in one focused week.
For developers how this skill is built, graded, and how it runs
at a glance- the short version
what's inside - the parts that make up a skill 2/4 present
A skill is just a few plain-text files. Only the main one is required. The rest are optional, added as the work needs them. This is what the skill is made of; how it runs is just below.
state/skills/brain-growth/SKILL.md
present
state/lib/brain-growth.ts
not present
state/bin/brain-growth/
not present
state/skills/brain-growth/AGENTS.md
present
how it's graded - what counts as a good run 4 criteria · 3 deterministic · 1 judge
Each row is one thing a good run has to get right. deterministic means a quick check decides, pass or fail. judge means the AI reads the result and rates it. Grading each piece on its own (instead of one overall score) shows exactly where a run fell short, so the fix is obvious.
how it runs - the shared frame every skill uses 5/5 present
Every skill runs the same way. One part does the work, a separate part checks it, and a short loader hands the AI exactly what it needs for the job. Anything this skill doesn't use shows a one-line note saying why, on purpose, not by accident.
state/log/evals.ndjson - Never crash on missing logs — parity.ndjson, sync-events.ndjson, pid-trends.ndjson all degrade to null / 0. Defensive file reads are the whole point on a fresh machine.
- The snapshot row is idempotent per day. Re-running without --force returns {wrote:false,reason:"already-logged-today"} and that IS the success path, not a failure.
- rolling_mean_100 must be null or ∈ [0,1] — shape-gate eval fires 0.0 otherwise.
- loader_pitfalls_total only counts bullet lines under ## Known Pitfalls headings in /AGENTS.md. Do not rewrite the script to count every - line in the sidecar — that double-counts Critical Rules and Commands.
- Never report as "growing" / "learning" based on a single day's data — at least one baseline snapshot (7d or 30d earlier) must be present before deltas are meaningful.
what it has learned - fixes written back in over time sample
When a run hits something this skill didn't handle, the fix gets written back into the skill so it doesn't happen again. FIXED means it was corrected on the spot. LOGGED means it's queued for a bigger rewrite. Either way, the skill gets a little better and never makes the same mistake twice.
- Loading feedback rows…
how the work flows- who makes it, who checks it
npx tsx state/bin/brain/growth.ts` (snapshot + log, idempotent per day)
SKILL.md- the skill, written out in plain English
Backed by: state/bin/brain/growth.ts (reads state/log/{evals,parity,sync-events,pid-trends,breakage-report}.ndjson + state/skills/*AGENTS.md + ~/.claude/projects/*/memory/*.md)
brain-growth
Answers the "how does it show that to us" question. Once per day (cron at 04:00 local) the script computes a snapshot of every metric that reflects the system getting better and appends one row to state/log/growth.ndjson. With --deltas it renders a today vs. 7d-ago vs. 30d-ago table so regressions are visible. Pod 24's Brain view consumes this log directly.
Steps
- Scope - read the logs and skill directories. No writes, no API calls.
- Compute - 17 metrics:
skills_total/skills_graduated/skills_prosefrom frontmatterloader_pitfalls_totalfrom## Known Pitfallsblocks in every*AGENTS.mdevals_total,evals_last_24h,rolling_mean_100,rolling_mean_1000open_breakage_p0,open_breakage_p1(status: open)parity_meansper runtime (claude, codex, gemini, openclaw) from last 24hsync_drift_count_7d(sync-events rows with mode=integrity-fail | error)recurring_areas_7dfrom pid-trendsmemory_files_totalacross~/.claude/projects/*/memory/*.md
- Persist - append one row per day to
state/log/growth.ndjson.
Idempotent: re-running the same day is a no-op unless --force.
- Deltas - with
--deltas, print a table: today vs the nearest snapshot
on or before (now − 7d) vs the nearest snapshot on or before (now − 30d). Icons: UP = improved, DN = regressed, - = unchanged, blank = no baseline.
- Log + eval - append to
chain.ndjson, score toevals.ndjson.
Eval
Actor: state/bin/brain/growth.ts - the metric computer. Auditor: shape-gate in the same script - different concern. The computer produces numbers; the auditor asserts the row shape (core counts are non-negative integers, rolling_mean_100 ∈ [0,1] ∪ null). The auditor never judges whether the numbers are "good" - that's the job of Pod 24's Brain view comparing deltas over time.
score:
1.0 if every core count is a non-negative integer AND rolling_mean_100
is null or in [0,1];
0.0 otherwise.
Manual Brain-view review is orthogonal: Robert reads the deltas table and decides whether the system is actually learning. That is the point of this skill - it is the surface where self-improvement is visible.
Gotchas
- Missing logs (fresh machine, empty
parity.ndjson) must degrade tonull,
not crash. All reads go through parseJsonLines which tolerates absent files.
- The same-day row is overwritten with
--force, appended fresh otherwise.
Without --force a second invocation on the same day returns { wrote: false, reason: "already-logged-today" } - not an error.
loader_pitfalls_totalcounts bullet lines inside## Known Pitfalls
blocks only. Other bulleted lists in the sidecar don't count.
- Parity means prefer the last 24h of rows; if fewer than 4 rows landed in
24h (e.g. parity-test.ts hasn't run today), it falls back to the most recent 20 rows so the number stays meaningful.
Graduation
Already graduated - script at state/bin/brain/growth.ts. Future work: deterministic change-detection for the "What got better since last snapshot" section so the wiki page can be regenerated automatically each day instead of being a human-edited artifact per snapshot day.
Rubric
criteria:
- name: metrics_computed_correctly
kind: deterministic
check: "The `evals.ndjson` for the skill confirms all core counts are non-negative integers and rolling_mean_100 is null or within [0,1]."
- name: growth_log_appended
kind: deterministic
check: "A new entry for the current day is appended to `state/log/growth.ndjson` when the skill runs after 04:00 local time, or `wrote: false` and `reason: \"already-logged-today\"` is returned on subsequent runs for the same day without `--force`."
- name: deltas_table_present
kind: judge
check: "When `--deltas` is provided, a well-formatted table comparing today's snapshot to 7-day-ago and 30-day-ago snapshots is displayed with appropriate Up/Down/Unchanged indicators."
- name: no_crashes_on_missing_logs
kind: deterministic
check: "The script completes execution without crashing when expected log files (e.g., `parity.ndjson`) are absent, defaulting to nulls as appropriate for metrics."AGENTS.md- what the AI loads when this skill comes up
brain-growth - loader
Per-turn rules for the brain-growth skill. Full reference: state/skills/brain-growth/SKILL.md. Do not skip these.
Critical Rules
- Never crash on missing logs -
parity.ndjson,sync-events.ndjson,pid-trends.ndjsonall degrade tonull/0. Defensive file reads are the whole point on a fresh machine. - The snapshot row is idempotent per day. Re-running without
--forcereturns{wrote:false,reason:"already-logged-today"}and that IS the success path, not a failure. rolling_mean_100must benullor∈ [0,1]- shape-gate eval fires 0.0 otherwise.loader_pitfalls_totalonly counts bullet lines under## Known Pitfallsheadings in*/AGENTS.md. Do not rewrite the script to count every-line in the sidecar - that double-counts Critical Rules and Commands.- Never report as "growing" / "learning" based on a single day's data - at least one baseline snapshot (7d or 30d earlier) must be present before deltas are meaningful.
Commands
| ui dashboard | state/skills/brain-growth/resources/ui.openui | |invoke: npx tsx state/bin/brain/growth.ts (snapshot + log, idempotent per day) |deltas: npx tsx state/bin/brain/growth.ts --deltas |overwrite: npx tsx state/bin/brain/growth.ts --force |output log: state/log/growth.ndjson (one row per day) |eval log: state/log/evals.ndjson (skill: "brain-growth")
OpenUI Resource
- Skill-owned OpenUI Lang resource:
state/skills/brain-growth/resources/ui.openui. Read it before rendering or editing this skill's generated component surface. - Treat this resource as a first-class artifact of the skill, not a generic chat response. Improve it when the skill's user-facing output needs to become richer.
- System resources compose OpenUI primitives and inherit SnappyChat tokens. Use
ui_contract: brandedin SKILL.md only for deliberate platform or client visuals.
Known Pitfalls
- Running on a fresh machine with no evals / parity data yields
rolling_mean_100: nullandparity_means.*: null- this is correct, not a bug - Cron at 04:00 local is intentional - it captures the state at quiet-hours boundary so deltas line up day-to-day
- Memory files are counted across every project under
~/.claude/projects/*/memory/, not just this repo's own memory
Self-Test
An agent reading this should correctly:
- [ ] Treat "already-logged-today" as success, not an error?
- [ ] Degrade missing logs to
null/0instead of crashing? - [ ] Only count pitfalls inside
## Known Pitfallsblocks? - [ ] Require a baseline snapshot before claiming the system is getting better?
Self-report
If this loader fell short, append a line:
echo "[$(date -u +%FT%TZ)] brain-growth: <what was missing>" >> state/log/loader-feedback.log
<!-- kernel-ok: historical attribution for the PID-loader pattern. -->
Self-correcting loader (PID feedback)
This is the rule that makes loaders learn. Ported from snappy-kernel, where it demonstrably worked: the snappy-dom-cartographer skill mapped Skool admin UI once, every later ship-agent inherited the full map for free.
Before you finish, do two things:
1. Fix gaps (P - proportional). MANDATORY. If this loader didn't cover your case - if you had to read another file, run an undocumented command, work around a wrong selector, or discover a quirk - you MUST attempt an Edit to this AGENTS.md before you log.
- Default action: edit this file. Surgical. Add the missing line, table
row, or code example where it belongs. No restructuring.
- Only
LOGGEDis allowed when: the fix needs >10 lines, spans multiple
files, or requires a structural rewrite. In that case the state/regen/drain.sh queue picks it up asynchronously.
- "I didn't have time" / "it's minor" / "the next agent will figure it out"
are NOT valid reasons. Minor gaps compound - that's the whole point of this loop.
- Concrete example of a valid P-fix: discover
agent-browser screenshot
takes path positionally not as --output <path>. One line in a table. Edit it in. Do not just log it.
- The goal: the next agent never has to leave the loader.
2. Log the result.
echo "[$(date -u +%FT%TZ)] brain-growth: <what was missing or fixed> [FIXED|LOGGED]" >> state/log/loader-feedback.log
FIXED= you patched this loader inline (P-fix).LOGGED= too large for inline; the PostToolUse enqueue + Stop-hook drain
will rewrite the loader from scratch on next session-end.
Do not skip this. Every agent run must leave the system better than it found it. The loader is the setpoint; you are the sensor; the gap is the error signal; closing the gap is the correction.
api.ts- the code it can call
⚠ no api.ts - this skill has no typed action surface
scripts- helper scripts it can run
prose-only skill - 2 inline code blocks live in SKILL.md above (no state/bin/ sidecar yet).
how we check it- the checks, plus the last 10 runs
| timestamp | verb | score | primary_issue | artifact |
|---|---|---|---|---|
| 2026-04-26 23:46Z | - | 1.00 | - | - |
| 2026-04-25 04:11Z | - | 1.00 | - | - |
| 2026-04-25 02:58Z | - | 1.00 | - | - |
| 2026-04-21 15:58Z | - | 1.00 | - | - |
| 2026-04-21 15:56Z | - | 1.00 | - | - |
| 2026-04-21 03:53Z | - | 1.00 | - | - |
| 2026-04-19 08:00Z | - | 1.00 | - | - |
| 2026-04-18 22:06Z | - | 1.00 | - | - |
| 2026-04-18 22:06Z | - | 1.00 | - | - |
| 2026-04-18 22:04Z | - | 1.00 | - | - |