Skip to content

feat: BotE Calculator & Scale Sandbox + Smart SRS Knowledge Graph (v1.4.0) - #4

Merged
arvarik merged 1 commit into
mainfrom
feature/bote-calculator-knowledge-graph
Aug 17, 2026
Merged

feat: BotE Calculator & Scale Sandbox + Smart SRS Knowledge Graph (v1.4.0)#4
arvarik merged 1 commit into
mainfrom
feature/bote-calculator-knowledge-graph

Conversation

@arvarik

@arvarik arvarik commented Aug 17, 2026

Copy link
Copy Markdown
Owner

Summary

Implements two major features against their business specs, plus a critical SRS bug fix found during implementation.

🧮 Back-of-the-Envelope Calculator & Scale Sandbox (/calculator, ⌘8, quick modal ⌘E)

  • Pure math engine (src/utils/bote.js) — standard interview conventions: QPS = DAU × req/user ÷ 86,400, storage with retention × replication × overhead, the 80/20 working-set cache, peak bandwidth, and server/shard counts from target CPU saturation. SI-unit formatters up to EB/Tbps, safe at zero and at 2B-DAU extremes.
  • Interactive sandbox — log-scale sliders + numeric inputs, six scenario presets (URL Shortener, Video Streaming, E-Commerce Flash Sale, Chat, Social Feed, Ride Sharing), and every stat shows the formula that produced it with real numbers substituted.
  • Numbers Every Engineer Should Know — canonical latency table (grounded in the Dean/Norvig numbers plus modern cross-AZ/cross-region RTTs) with click-to-apply Latency Budget composer, powers-of-two table, and handy constants.
  • AI Sanity CheckerPOST /api/calculator/audit returns a structured, severity-ranked critique (verdict, findings with concrete fixes, omitted real-world factors). Verified live: it correctly recomputed a deliberately wrong cache figure.
  • Omnipresent — dedicated page plus a global modal reachable from Chat, Guide, and Builder; state persists across navigation (persisted Zustand store). 1-click export as Markdown with LaTeX to clipboard, Chat draft, or any Guide section.

🕸️ Smart SRS Knowledge Graph & Adaptive Prerequisite Engine (/graph, ⌘7)

  • ~60-concept prerequisite DAG grounded in the standard learning progression (fundamentals → building blocks → distributed mechanics → paradigms), including the spec's chain Consistent Hashing → Distributed KV Stores → Virtual Nodes. Shared client/server module, validated acyclic at boot and in tests. Two topics added to the taxonomy: Caching Strategies & Invalidation and Consensus & Coordination.
  • Live retention heatmap — 🟢 mastered (ease ≥ 2.5, interval > 21d), 🟡 learning/due (≤ 48h), 🔴 decayed/fragile, ⚪ unseen. Cards auto-link to concepts by keyword phrases with guide-topic fallback. Node colors refresh after every graded card without a reload.
  • Exploration UX — deterministic force layout (prerequisites flow left→right), pan/zoom, hover lineage highlighting (prereqs in indigo, unlocked concepts in teal), search, pillar chips, readiness filters, and a slide-over panel deep-linking to the Guide blueprint, related whiteboards (/builder?board=<id>), and due flashcards with a 1-click node study session.
  • Curated learning tracks — six tracks (Senior Distributed Systems, Storage & Consistency, …) that number their concepts in topological order on the canvas and build prerequisite-ordered study sessions.
  • Adaptive remediation — rating an advanced card Again checks its direct prerequisite concepts for shaky cards (new/learning/lapsed/overdue/low-ease) and queues up to 3 into the next session via a remediation_queue table. They lead the queue with a Foundation Checkup banner. Solid foundations produce no remediation. Reviewing a queued card resolves it.

🐛 Fixed: silent card-grading failure

The client sent POST to the review endpoint while the server only registered PUT — every grade 404'd and was swallowed by the catch handler. The client now sends PUT; the server accepts both verbs (queued offline mutations may still carry POST). The SM-2 scheduler was extracted to server/srs/scheduler.js for reuse by the graph routes.

Testing

  • 250 tests / 18 files, all passing — new suites cover formula precision & unit conversions (reference case + zero/extreme boundaries), graph integrity (unique ids, acyclic, topo order, track expansion closure), cycle prevention, card→node matching precedence, health bucket boundaries (ease 2.5 / interval 21 / 48h window), remediation planning (shaky detection, cap, weakest-first, one-hop-only), and UI interaction (calculator recalculation/presets/budget, graph filters/panel/tracks).
  • Lint clean, production build clean.
  • Verified end-to-end in Chrome against the running dev server: graph heatmap with seeded data across all four health states, node panel deep links, track sessions, foundation-checkup banner in a live interleaved session, quick modal in Chat, AI audit round-trip, and light theme.
  • README + docs refreshed (api.md, user-guide.md, srs-algorithm.md, architecture.md, AGENTS.md) with new screenshots for all pages.

🤖 Generated with Claude Code

…emediation

Back-of-the-Envelope Calculator (/calculator + global ⌘E modal):
- Pure calculation engine (src/utils/bote.js): QPS, storage, cache,
  bandwidth, and hardware estimates with SI-unit formatters
- Scenario presets, log-scale sliders, per-stat formula readouts
- Interactive latency cheat-sheet (canonical Dean/Norvig numbers plus
  modern network figures) with click-to-apply Latency Budget composer
- AI Audit My Math endpoint (POST /api/calculator/audit) returning a
  structured critique via runStructured
- 1-click export: Markdown with LaTeX to clipboard, Chat draft, or
  appended to any Guide section
- State persists across navigation via a persisted Zustand store

Smart SRS Knowledge Graph (/graph):
- ~60-concept prerequisite DAG shared by client and server
  (src/utils/knowledgeGraph.js), validated acyclic at boot and in tests
- Live SM-2 retention heatmap (mastered/due/decayed/unseen) computed
  from flashcard state; updates without reload after every review
- Search, pillar filters, readiness filters, curated learning tracks
  with topological study sessions, and a node slide-over deep-linking
  to Guide sections, whiteboards, and due flashcards
- Adaptive prerequisite remediation: failing a card queues up to three
  shaky foundation cards (remediation_queue) into the next session,
  shown first with a Foundation Checkup banner
- Two new guide topics: Caching Strategies and Consensus & Coordination

Fixes and refactors:
- Fix silent card-grading failure: client sent POST to the PUT-only
  review route (404); client now sends PUT and the server accepts both
- Extract SM-2 scheduler into server/srs/scheduler.js (shared)
- BuilderPage supports /builder?board=<id> deep links
- Docker image now ships knowledgeGraph.js for the server

Testing: 250 tests across 18 files (formula precision, unit
conversions, boundary conditions, cycle prevention, traversal,
remediation planning, health buckets, and UI interaction suites).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@cursor

cursor Bot commented Aug 17, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@arvarik
arvarik merged commit 2789d1a into main Aug 17, 2026
2 checks passed
@arvarik
arvarik deleted the feature/bote-calculator-knowledge-graph branch August 17, 2026 05:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant