A tiny, dependency-free RL brain that learns which approach wins for each task type — and recommends the best next move.
Turn every outcome into a policy update. FLYWHEEL generalizes proven bandit math (win-rate·0.6 + avg-reward·0.4 + exploration + count-decay) from 'which model wins' to 'which action wins for THIS task type', so each thing your agent does biases the next decision. Recall the best past approach; reward outcomes; exploit and explore. Zero dependencies, atomic writes, never throws.
Call record(taskType, action, reward) after anything your agent does. It appends an observation and updates a bounded policy. Low-confidence judgments are logged but never drift the calibration.
Each action's score blends win-rate, average reward, an under-sampling exploration bonus, and a nudge to re-check stale winners. Old counts decay so the policy never ossifies.
recommend(taskType, actions) returns the best learned action with a reason — exploit a proven winner or explore an untried one. Group K variants through GRPO to get critic-free advantages.
Every value comes from .env. Nothing here is tied to any account — bring your own.
# 1. no install needed — pure Node builtins node lib/group-advantage.cjs # runs the GRPO self-test # 2. watch the policy learn from rewards node examples/demo.cjs # 3. inspect / drive the brain from the CLI node lib/flywheel.cjs recommend build react vue svelte node lib/flywheel.cjs record build react 0.9 "shipped clean" node lib/flywheel.cjs policy build