Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

fix(verse): keep the progress panel and level card stable

rubenluetke10-beepd24b4d274d57
diff --git a/docs/agent-society/level-system.md b/docs/agent-society/level-system.md
new file mode 100644
index 0000000000..381918b8ca
--- /dev/null
+++ b/docs/agent-society/level-system.md
@@ -0,0 +1,126 @@
+# Jarvis Verse level system
+
+Status: **built 2026-10-03.** Backend `jarvis/progression/`, REST
+`/api/progression`, frontend `components/society/progression/`. The rulebook
+in `jarvis/progression/rules.py` is the source of truth; this page is its
+readable version.
+
+## 1. Who levels up
+
+| Subject | Id | Earns from |
+|---|---|---|
+| The person | `person` | Talking to Jarvis, giving the team work, growing the team, small actions in the Verse |
+| Every Jarvis agent | `agent:<agent_id>` | Finished work: results, quests, answers to teammates |
+| The person's pet | `pet:<pet_id>` | Jarvis's own work (the pet IS Jarvis in the Verse) and walks with the person |
+
+The lead agent (`jarvis`) never has an agent subject: it is drawn as the pet,
+so its work pays the pet. Each pet keeps its own level; the pet chosen in
+My Pets at the moment of the award earns it.
+
+Coding-floor panes are not subjects: they are short-lived terminal sessions,
+not members of the team.
+
+## 2. XP rules
+
+Every award comes from one rule: a fixed amount, optionally a cooldown, a
+daily cap (local calendar day) or "once per reference". The server applies
+every limit against its own ledger, so a replayed event or a client that
+reports twice never pays twice. Nothing calls a model; XP costs no tokens and
+works with any single key.
+
+**Server rules** (read off bus events):
+
+| Source | Pays | XP | Limit | Event |
+|---|---|---|---|---|
+| `chat_turn` | person | 5 | 100/day | `JarvisChatTurnFinished` (done) |
+| `voice_turn` | person | 5 | 100/day | `VoiceTurnCompleted` |
+| `jarvis_answered` | pet | 4 | 120/day | either of the two above |
+| `quest_posted` | person | 15 | 75/day | `SocietyQuestChanged` (new) |
+| `quest_completed` | person | 20 | — | `SocietyQuestChanged` → done |
+| `quest_done` | agent (taker) | 60 | — | `SocietyQuestChanged` → done |
+| `task_done` | agent | 40 | — | `SocietyResultPosted` (done) |
+| `task_blocked` | agent | 8 | 40/day | `SocietyResultPosted` (blocked) |
+| `answered_teammate` | agent | 5 | 50/day | `SocietyMessageSent` ANSWER |
+| `delegated` | pet | 10 | 100/day | `SocietyMessageSent` ASSIGN from the lead |
+| `mission_completed` | person | 30 | 150/day | `MissionCompleted` (approved) |
+| `agent_hired` | person | 50 | once per agent | `POST /api/society/agents` created a row |
+
+**World rules** (reported by the Verse via `POST /api/progression/actions`):
+
+| Source | Pays | XP | Limit |
+|---|---|---|---|
+| `daily_visit` | person | 25 | once per day (server date) |
+| `floor_discovered` | person | 20 | once per floor (`agents`, `coding`, `arcade`) |
+| `dog_petted` | person | 3 | every 60 s, 30/day |
+| `dog_treat` | person | 10 | every 5 min, 30/day |
+| `arcade_round` | person | 8 | every 45 s, 80/day (a scored round) |
+| `arcade_record` | person | 15 | every 45 s, 60/day (a new best) |
+| `team_meeting` | person | 10 | every 10 min, 40/day |
+| `walk_together` | pet | 3 | every 20 s, 60/day (each 50 m walked with the pet) |
+
+## 3. Level curve
+
+Level *L* → *L + 1* costs `40 + 25·(L−1)^1.1` XP, rounded to 5; the cap is
+level 50. Level 2 arrives after a handful of actions, level 10 after about a
+week of ordinary use (~200 XP a day), level 50 after several months. The
+server sends the whole curve (`level_xp`), so the client never re-derives it.
+
+## 4. Titles and rewards
+
+Titles change at bands: the person goes Newcomer → Apprentice (5) → Operator
+(10) → Specialist (15) → Strategist (20) → Architect (25) → Commander (30) →
+Visionary (40) → Legend (50); agents Rookie → … → Grandmaster; pets
+Hatchling → … → Mythic.
+
+Rewards are cosmetic and fill four slots. Each reward names the level at which
+each subject kind unlocks it (or never):
+
+| Slot | Rewards (person level) |
+|---|---|
+| Frame (level chip and HUD ring) | bronze 3, silver 10, gold 20, diamond 50 |
+| Trail (left while moving) | footprints 2, sparkle 5, comet 12, neon 20, rainbow 30, star dust 45 |
+| Aura (on the floor) | glow 7, runes 15, storm 35, legend 50 |
+| Gadget (on or around the figure) | drone 10, halo 18, crown 25, light wings 40 |
+
+The person chooses per slot for themself and their pet (automatic = the
+latest unlock, none, or any unlocked piece; stored per browser profile).
+Agents always wear their best unlocks.
+
+## 5. The level-up moment
+
+- **In the world:** a column of light from the floor, two shockwave rings,
+ a fountain of sparks that rains back down and a rising "LEVEL n" tag, in
+ gold (person), teal (pet) or green (agent). The person's figure hops and
+ waves.
+- **On screen:** person and pet get a banner — light rays and a flash, the
+ word stamps in, the old number rolls out and the new one in, then the new
+ title and each unlocked reward slide up one after another. Agents get a
+ quiet toast in the corner. Level-ups that happened while the map was closed
+ are told once per subject ("While you were away").
+- **Sound:** a synthesised fanfare (Web Audio, no files), a short chime for an
+ agent, a soft tick for "+XP"; switchable in the progress panel.
+- **Every gain:** a floating "+n XP" over whoever earned it; the HUD bar lights
+ the gain first and fills a beat later.
+
+Reduced motion keeps the information (banner, tag, toast) and drops the motion.
+
+## 6. Surfaces
+
+- Level card under the floor title (click or `L` opens the progress panel).
+- Level chip on every name plate; the lead's chip shows the pet's level.
+- Progress panel: You / Pet / Agents tabs — level, wear choices, reward track,
+ the exact rules; Agents is a ranking.
+
+## 7. Contracts
+
+- `ProgressionAwarded` (core bus → WebSocket) carries `subject_id`,
+ `subject_kind`, `xp_source`, `xp`, `total_xp`, `level`, `previous_level`,
+ `title`, `unlocked`.
+- `SocietyResultPosted` is new: `WorldFeed` forwards a board RESULT (id,
+ agent, status; never its text).
+- `levelCatalog.ts` mirrors the ids (kinds, slots, rewards, titles, sources);
+ `tests/unit/progression/test_frontend_parity.py` pins it and the three
+ locale files to the rulebook.
+- The ledger is `<data_dir>/progression.db`, opened on the first award, never
+ on the boot path. Bus handlers only queue their writes, so a publisher (the
+ voice pipeline) never waits on the disk.
diff --git a/docs/agent-society/office-map.md b/docs/agent-society/office-map.md
index 7efc504663..4f27c82b9d 100644
--- a/docs/agent-society/office-map.md
+++ b/docs/agent-society/office-map.md
@@ -310,6 +310,17 @@ which follows like on the coding floor).
where a game aims with it, and a touch pad on coarse pointers. Escape or E
leaves.
+## 5f. Levels (2026-10-03)
+
+The person, their pet and every agent level up from real work: finished
+Jarvis turns, agent results, quests, missions, new agents, plus small metered
+actions in the Verse (daily visit, floors, the office dog, arcade rounds, team
+meetings, walks with the pet). A level card sits under the floor title, every
+name plate wears a level chip, `L` opens the progress panel, and a level-up
+plays a light column, shockwaves and sparks in the world plus a banner on
+screen. Unlocked trails, auras, gadgets and frames are worn in the world.
+The whole contract lives in [level-system.md](level-system.md).
+
## 6. Plan
1. First map (done 2026-09-28).
diff --git a/jarvis/ui/web/frontend/src/components/society/progression/LevelPanel.tsx b/jarvis/ui/web/frontend/src/components/society/progression/LevelPanel.tsx
index fec43dae6b..9902f86cfd 100644
--- a/jarvis/ui/web/frontend/src/components/society/progression/LevelPanel.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/progression/LevelPanel.tsx
@@ -13,7 +13,7 @@ import { useT } from "@/i18n";
import type { SocietyAgent } from "../data";
import { levelFraction, unlockedFor, type SlotChoice } from "./cosmetics";
import { LevelChip, LevelRing, XpBar } from "./LevelHud";
-import { SLOTS, type RewardId, type SubjectKind } from "./levelCatalog";
+import { SLOTS, type RewardId, type Slot, type SubjectKind } from "./levelCatalog";
import { agentSubject, PERSON_SUBJECT, petSubject, type RewardRow, type XpRuleRow } from "./progressionApi";
import { useProgression, type PanelTab } from "./progressionStore";
import { RewardIcon } from "./RewardIcon";
@@ -21,6 +21,12 @@ import { useLevelSound } from "./levelSounds";
const LEAD_AGENT_ID = "jarvis";
+// Stable fallbacks: a selector that returns a fresh [] or {} re-renders forever.
+const NO_RULES: XpRuleRow[] = [];
+const NO_REWARDS: RewardRow[] = [];
+const NO_TITLES: { level: number; title: string }[] = [];
+const NO_CHOICES: Partial<Record<Slot, SlotChoice>> = {};
+
function duration(seconds: number, t: (key: string) => string): string {
return seconds >= 60
? t("society.level.minutes").replace("{0}", String(Math.round(seconds / 60)))
@@ -40,7 +46,7 @@ export function ruleLimit(rule: XpRuleRow, t: (key: string) => string): string {
function Rules({ kind }: { kind: SubjectKind }) {
const t = useT();
- const rules = useProgression((s) => s.snapshot?.rules ?? []);
+ const rules = useProgression((s) => s.snapshot?.rules ?? NO_RULES);
const mine = rules.filter((r) => r.kind === kind);
return (
<section className="level-section">
@@ -65,8 +71,8 @@ function Rules({ kind }: { kind: SubjectKind }) {
function Wardrobe({ who, kind, level }: { who: "person" | "pet"; kind: SubjectKind; level: number }) {
const t = useT();
- const rewards = useProgression((s) => s.snapshot?.rewards ?? []);
- const choices = useProgression((s) => s.choices[who] ?? {});
+ const rewards = useProgression((s) => s.snapshot?.rewards ?? NO_REWARDS);
+ const choices = useProgression((s) => s.choices[who] ?? NO_CHOICES);
const choose = useProgression((s) => s.choose);
const open = useMemo(() => unlockedFor(rewards, kind, level), [rewards, kind, level]);
return (
@@ -107,8 +113,8 @@ function Wardrobe({ who, kind, level }: { who: "person" | "pet"; kind: SubjectKi
function Track({ kind, level }: { kind: SubjectKind; level: number }) {
const t = useT();
- const rewards = useProgression((s) => s.snapshot?.rewards ?? []);
- const titles = useProgression((s) => s.snapshot?.titles[kind] ?? []);
+ const rewards = useProgression((s) => s.snapshot?.rewards ?? NO_REWARDS);
+ const titles = useProgression((s) => s.snapshot?.titles[kind] ?? NO_TITLES);
const steps = useMemo(() => {
const byLevel = new Map<number, { rewards: RewardRow[]; title?: string }>();
for (const r of rewards) {
diff --git a/jarvis/ui/web/frontend/src/components/society/progression/progression.test.ts b/jarvis/ui/web/frontend/src/components/society/progression/progression.test.ts
index 062140f818..fa89ae8f4b 100644
--- a/jarvis/ui/web/frontend/src/components/society/progression/progression.test.ts
+++ b/jarvis/ui/web/frontend/src/components/society/progression/progression.test.ts
@@ -76,7 +76,7 @@ describe("progressionApi", () => {
describe("progressionStore", () => {
beforeEach(() => {
- useProgression.setState({ snapshot: null, subjects: {}, banners: [], toasts: [], popups: [], bursts: [], cheerUntil: 0 });
+ useProgression.setState({ snapshot: null, subjects: {}, banners: [], toasts: [], popups: [], bursts: [], cheerUntil: 0, choices: {} });
useProgression.getState().hydrate(snapshot(), []);
});
@@ -99,6 +99,12 @@ describe("progressionStore", () => {
expect(s.cheerUntil).toBeGreaterThan(1000);
});
+ it("never rolls a subject back to a read older than a push", () => {
+ useProgression.getState().apply({ seq: 9, subjectId: "person", kind: "person", source: "agent_hired", xp: 50, totalXp: 50, level: 2, previousLevel: 1, title: "newcomer", unlocked: [] }, 0);
+ useProgression.getState().hydrate(snapshot({ subjects: [{ subjectId: "person", kind: "person", xp: 25, level: 1, xpIntoLevel: 25, xpForNext: 40, title: "newcomer" }] }), []);
+ expect(useProgression.getState().subjects.person.xp).toBe(50);
+ });
+
it("ignores a late duplicate push", () => {
const award = { seq: 4, subjectId: "person", kind: "person" as const, source: "chat_turn", xp: 5, totalXp: 5, level: 1, previousLevel: 1, title: "newcomer", unlocked: [] };
useProgression.getState().apply(award, 1000);
diff --git a/jarvis/ui/web/frontend/src/components/society/progression/progressionStore.ts b/jarvis/ui/web/frontend/src/components/society/progression/progressionStore.ts
index 51131f98f1..c4a4d20a8f 100644
--- a/jarvis/ui/web/frontend/src/components/society/progression/progressionStore.ts
+++ b/jarvis/ui/web/frontend/src/components/society/progression/progressionStore.ts
@@ -81,8 +81,12 @@ export const useProgression = create<ProgressionState>((set, get) => ({
panel: null,
choices: loadChoices(),
hydrate: (snapshot, away) => set((s) => {
- const subjects: Record<string, SubjectLevel> = {};
- for (const row of snapshot.subjects) subjects[row.subjectId] = row;
+ // A push can land before the read that was already on its way: never roll a subject back.
+ const subjects: Record<string, SubjectLevel> = { ...s.subjects };
+ for (const row of snapshot.subjects) {
+ const known = subjects[row.subjectId];
+ if (!known || known.xp <= row.xp) subjects[row.subjectId] = row;
+ }
const banners = [...s.banners, ...away.filter((c) => c.kind !== "agent")];
const toasts = [...s.toasts, ...away.filter((c) => c.kind === "agent")].slice(-MAX_TOASTS);
return { snapshot, subjects, petId: snapshot.petId, banners, toasts };