Code tour · short

The demo link: two apps sharing one browser

Polaris plans the work. Olympus shows your progress toward your own goals. In the demos, anyone can make their own lanes, give a task a lane and a point value, tick it, and watch that lane climb, with nothing sent to a server. This tour shows how the two demo copies talk.

Saved only in the visitor's browserSame booking rules as the real systemExample mode + a fresh copy

The problem

The real pair runs across a phone, a hosted store, an always-on server and two apps. A visitor clicking a link has none of that, and must never see my data. The demos had to work alone, in one browser, and still behave like the real thing.

How the parts talk

Olympus demo. The visitor makes, renames and deletes lanes. They are stored in the browser.
Polaris demo. Reads the same lanes. A task gets a lane and a price; ticking it saves to the browser.
The link. One shared file runs the real booking rules over those saves and hands Olympus the climb.

Both demos sit at one address, so they share the browser's storage. When one changes it, the other notices and redraws.

Five short excerpts

1

The booking runs the real rules, in the visitor's browser

shared/demo-link.js

The real system books points with a function on a server. The demo copies that same function in at build time and runs it here, over the visitor's own lanes. So a demo tick is priced by exactly the rules my own ticks are.

_link-build/demo-link.src.js · lines 399–413
  function ledger() {
    var s = get();
    var live = s.lanes.filter(function (l) { return !l.deleted; });
    LANE_MAP = { admin: null, agent: null };
    LANE_BY_LABEL = {};
    live.forEach(function (l) { LANE_MAP[l.id] = l.id; LANE_BY_LABEL[l.name.trim().toLowerCase()] = l.id; });
    var marks = readJSON(PKEY) || emptyPolarisState();
    var p = s.mode === "example" ? samplePlan() : ownPlan();
    var out = deriveRows({ marks: marks, items: p.ITEMS, recurring: p.RECURRING,
                           ladder: TIER_LADDER, version: CB, since: "2000-01-01" });
    var ids = {}; live.forEach(function (l) { ids[l.id] = true; });
    var hist = (s.history || []).filter(function (r) { return ids[r.lane]; });
    var rows = hist.concat(out.rows.map(function (r) { r.source = r.key; return r; }));
    rows.sort(function (a, b) { return a.date < b.date ? -1 : a.date > b.date ? 1 : a.key < b.key ? -1 : a.key > b.key ? 1 : 0; });
    return { rows: rows, notes: out.notes };
2

Copying the rules, and refusing if they change shape

build step

The build cuts the function out of the real file and checks each cut. If the real code changes so a cut no longer fits, the build stops instead of shipping something half-right. (A later check also refuses a copy that still reaches for a server or a file.)

_link-build/build-link.mjs · lines 35–52
/* 2 · the deriver's pieces, in order */
const d = readFileSync(DERIVE, "utf8");
const esc = one(d, /const esc = s => [^\n]*\n/, "esc()");
let estToday = one(d, /const estToday = \(\) => \{[\s\S]*?\n\};/, "estToday()");
/* The real one lets a test move the clock through an environment variable.
   A browser has no environment, so that seam is removed; the date logic is not. */
const envLine = "  const o = process.env.OLYMPUS_NOW;";
if (!estToday.includes(envLine)) fail("estToday() no longer reads OLYMPUS_NOW the way this build expects");
estToday = estToday.replace(envLine, "  const o = null;   /* DEMO: no environment in a browser */");
const intact = one(d, /export const DEED_INTACT = [^\n]*\n/, "DEED_INTACT").replace(/^export /, "");
const derive = one(d, /export function deriveRows\([\s\S]*?\n  return \{ rows, notes, version, whyGone \};\n\}/, "deriveRows()")
  .replace(/^export /, "");
/* deriveRows calls these two by name; they live in the same file in the real
   system. Copy them too, so the demo runs the real versions. */
const rcd = one(d, /export function resolveCompletionDate\([\s\S]*?\n\}/, "resolveCompletionDate()").replace(/^export /, "");
const st = one(d, /export function sittingTier\([\s\S]*?\n\}/, "sittingTier()").replace(/^export /, "");

let deriver = [esc, estToday, intact, rcd, st, derive].join("\n");
3

Polaris: “booked” means booked in this browser's Olympus

Polaris demo

In the real app this badge reads the live data feed. In the demo the feed is the Olympus demo beside it, worked out on the spot, so a ticked task turns “✅ Booked” the moment it is saved.

_polaris-build/build-demo.mjs · lines 82–95
function demoRefreshOlympus() {
  try {
    const rows = window.DemoLink.ledger().rows;
    const ft = rows.reduce((a, r) => a + r.feet, 0);
    const el = document.getElementById("olympus-ft");
    if (el) el.textContent = \` · \${ft.toLocaleString()} ft\`;
    const next = new Map(rows.filter(r => r.kind !== "history").map(r => [r.key, r.feet]));
    OLYMPUS_FEED_MISSES = 0;
    OLYMPUS_BOOKED_LAST = next;
    const same = OLYMPUS_BOOKED instanceof Map && OLYMPUS_BOOKED.size === next.size
      && [...next].every(([k, v]) => OLYMPUS_BOOKED.has(k) && OLYMPUS_BOOKED.get(k) === v);
    OLYMPUS_BOOKED = next;
    if (!same) render();
  } catch (e) { console.error("demo olympus", e); }
4

Olympus: new points arrive through the app's own refresh path

Olympus demo

Olympus already knew how to swap in fresh data, redraw, and play its climb recap. The demo feeds that same path from this browser, so the celebration a visitor sees is the real one.

_olympus-build/demo-lanes.js · lines 22–40
  OA.demoRefresh = function (quiet) {
    try {
      var fresh = window.DemoOlympus.build();
      if (OA.DATA.meta && fresh.meta.sig === OA.DATA.meta.sig) return 0;
      window.DemoOlympus.styleLanes();
      var gained = OA.applyFresh(fresh);
      OA.feedChecked = new Date().toISOString();
      OA.render(true);
      if (!quiet) {
        if (gained > 0) OA.toast("Fresh from Polaris · +" + fmt(gained) + " ft");
        else if (gained < 0) OA.toast("Polaris took back " + fmt(-gained) + " ft (a tick was undone)");
      }
      if (gained > 0 && window.OLYMPUS_RECAP && !OA.firstOpen) window.OLYMPUS_RECAP.check(OA.settings);
      return gained;
    } catch (e) { console.error("demo refresh", e); return 0; }
  };
  /* Changes from the other app (another tab) announce themselves; a lane change made on THIS page does not:
     deleting a lane is not "a tick undone", and the page already says what happened. */
  L.onChange(function () { OA.demoRefresh(!!OA.demoLaneOp); });
5

Cutting out what was mine, not just hiding it

privacy

The real Olympus also tracks fitness. That code held my own fitness records as text. The demo build removes those parts from the shipped code entirely, and a search over every shipped file checks for my real names, lanes and task titles.

_olympus-build/build-demo.mjs · lines 128–134
/* W17: the fitness parts are CUT from the shipped code, not just hidden. They
   held his own fitness records as text [numbers removed], named his food
   tracker and his workout file, and they need records the demo does not have. */
va = patchRe("views-a.js", va, /    let cross = '';\n    \{[\s\S]*?\n    \}\n    let ask = '';\n    \{[\s\S]*?\n    \}\n(?=\n    \/\/ ── hero ──)/,
  `    let cross = '', ask = '';   /* DEMO: the weight and rung-check cards are not in the demo */\n`);
va = patchRe("views-a.js", va, /\n  \/\/ -{20,}\n  \/\/  STRENGTH\n[\s\S]*\n\}\)\(\);\s*$/,
  `\n  OA.LADDER_SHORT = {}; OA.ladderBgStem = () => null;   /* DEMO: Strength, Ladders and Workout Data are not in the demo */\n})();\n`);

How it is tested

A script drives both demos in a hidden browser at phone width (390 px) and desktop width (1440 px): it makes a lane, adds a task in that lane worth 10 ft, ticks it, checks Olympus climbed by exactly 10 ft, reloads, empties both into a fresh copy, and restores the example. It also logs every network request and fails if one goes anywhere but the local server.

What I designed, and what the agents wrote

I designed and directed it; AI coding agents wrote the code. I decided what the demos must do: a filled example plus an empty copy of your own, lanes you define, the real booking rules, nothing of mine shipped, nothing sent anywhere. The agents wrote the code to that, and an independent checker re-ran the flow before it was called done.