
Garry TanandClaude Opus 4.7
237f4d8638
feat(brain): gstack-brain-cache CLI (T2a) — core subcommands
bin/gstack-brain-cache: TS CLI with five subcommands:
get <entity-name> [--project <slug>]
refresh [--full] [--entity X] [--project <slug>]
invalidate <entity-name> [--project <slug>]
digest <entity-slug>
meta [--project <slug>]
Cache layout per Phase 0.5 design:
~/.gstack/brain-cache/ ← cross-project (user-profile)
~/.gstack/projects/<slug>/brain-cache/ ← per-project (everything else)
Per-entity TTL drives staleness; per-entity byte budgets enforce
compression at write time. Atomic writes via tmp+rename. Stale-but-usable
fallback when brain unreachable (returns cached digest with diagnostic
prefix instead of failing). Schema-version mismatch + endpoint switch
both trigger full rebuild for the affected scope (D4 A4).
Fetch+compress paths wired for the 7 entities (user-profile, product,
goals, developer-persona, brand, competitive-intel, recent-decisions,
salience) via gbrain CLI shell-out — works for local PGLite and
local-stdio MCP, transparent over the existing spawnGbrain helper.
Concurrent-refresh dedup (D3 / T15) is a follow-up commit. Salience
allowlist gate (D9 / T17) is a follow-up commit. Bootstrap + lifecycle
subcommands (T2b / T18) are follow-up commits.
test/brain-cache-roundtrip.test.ts: 11 tests covering path resolution,
meta lifecycle, endpoint detection, schema mismatch behavior, and the
four cache states (warm / cold-refreshed / stale-fallback / missing).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-26 23:04:53 -07:00
..
2026-03-29 22:46:33 -06:00
2026-03-19 18:20:50 -07:00
2026-03-19 18:20:50 -07:00
2026-03-19 17:21:05 -07:00
2026-05-17 08:26:36 -07:00
2026-05-21 21:21:07 -07:00
2026-05-26 23:04:53 -07:00
2026-04-28 01:17:54 -07:00
2026-05-20 07:35:01 -07:00
2026-05-06 19:37:53 -07:00
2026-04-23 17:54:54 -07:00
2026-05-06 19:37:53 -07:00
2026-05-25 10:57:15 -07:00
2026-05-06 19:37:53 -07:00
2026-04-18 15:05:42 +08:00
2026-04-18 12:30:54 +08:00
2026-03-24 15:01:31 -07:00
2026-05-21 21:21:07 -07:00
2026-05-25 10:57:15 -07:00
2026-05-25 10:57:15 -07:00
2026-03-26 11:15:24 -06:00
2026-05-21 21:21:07 -07:00
2026-05-21 18:55:55 -07:00
2026-05-21 21:21:07 -07:00
2026-05-06 19:37:53 -07:00
2026-04-24 01:38:21 -07:00
2026-05-06 19:37:53 -07:00
2026-05-21 21:21:07 -07:00
2026-04-24 01:38:21 -07:00
2026-05-21 21:21:07 -07:00
2026-05-20 06:56:41 -07:00
2026-05-21 16:09:26 -07:00
2026-05-21 16:09:26 -07:00
2026-05-06 19:37:53 -07:00
2026-05-14 11:11:52 -04:00
2026-05-21 21:21:07 -07:00
2026-05-21 21:21:07 -07:00
2026-05-21 21:21:07 -07:00
2026-05-25 10:57:15 -07:00
2026-03-29 21:43:36 -06:00
2026-03-30 22:25:46 -06:00
2026-05-20 07:35:01 -07:00
2026-04-04 15:32:20 -07:00
2026-05-01 07:06:37 -07:00
2026-04-23 17:54:54 -07:00
2026-04-18 15:05:42 +08:00
2026-05-21 21:21:07 -07:00
2026-03-22 11:28:16 -07:00
2026-04-23 17:54:54 -07:00
2026-03-22 21:02:01 -07:00
2026-04-20 22:18:37 +08:00
2026-04-05 23:49:03 -07:00
2026-04-16 10:41:38 -07:00
2026-04-07 15:42:13 -10:00
2026-04-04 22:46:21 -07:00
2026-04-19 17:50:31 +08:00
2026-04-13 07:49:37 -10:00
2026-04-20 22:18:37 +08:00
2026-05-20 06:56:41 -07:00
2026-05-06 19:37:53 -07:00
2026-05-25 10:57:15 -07:00
2026-04-05 23:49:03 -07:00
2026-05-13 13:37:31 -04:00