Skip to content

Hand-walk the timeline: click a token, jump to a neighbour, undo #113

Done

Description

@Enniwhere

Size: 4 slices, about 380 changed lines. Depends on: none. Compost: Click-to-flip, neighbour-jump, interleaving and mixed strategies stay unbuilt and get no implementation issues until Direct manipulation is cultivated; the copy must not promise them — 2 — plan 1 on #107 and #108 — promotes the click/jump half only; the mixed-strategies half stays for #60.

Story. The app still treats the trajectory as a film: “Walk it” computes every row from the seed before the reader can touch it (src/routes/+page.svelte:401-425, :522-530), and the slider is the only way to move (:604-612). This issue makes the reader's choices the timeline. After “Walk it” the app holds one row — the encoded input — and no future. Clicking a prose or chip token pins the inspector (the same graph built by buildNeighborGraph in src/lib/strategies/neighbor-graph.ts:155-205), makes the current token's neighbour nodes clickable, and a click appends exactly one row: the chosen neighbour replaces the token at that position, every other position is copied, and the inspector follows the new token. Acting while scrubbed back to an earlier row discards the rows after it and branches from there. Undo pops the last row. The slider becomes a history scrubber; the total-timesteps input is hidden in this mode. No trajectory is computed or cached on the way in.

Show. Run npm run dev, click “Walk it”. The readout should show t = 0 / 0 and the input text, with no future. Click a token; the inspector pins. Click a neighbour; the token changes and the readout becomes t = 1 / 1. Scrub back to 0, click a different token and jump: the row at 1 is replaced, not appended at 2. Undo returns to 0. A short recorded run in the PR:

t=0  The quick brown fox
jump position 2 -> slow     t=1  The quick slow fox
jump position 3 -> dog      t=2  The quick slow dog
undo                        t=1  The quick slow fox

(Use the real GPT-2 token positions; the words are illustrative.)

Acceptance criteria.

  1. AC1 — the Show above is reproduced by a local npm run e2e spec (or a recorded manual run if e2e is skipped): the t = 0 / 0 start, the pinned inspector, the jump, the branch from an earlier row, and the undo.
  2. AC2 — entering explore with non-empty input creates a timeline with one row, T = 0, t = 0, trajectoryStore.status is ready, and no worker compute request is posted. A unit test on the hand-walk model and a page test/spy assert this.
  3. AC3 — a click (and Enter/Space) on a prose token or chip pins the inspector with the clicked position and time; the pinned inspector remains while the pointer moves into it; Escape or its close button unpins. Hover still previews without pinning.
  4. AC4 — only neighbour nodes adjacent to the token at the pinned time are clickable; nodes that are neighbours of earlier trajectory nodes are inert. Clicking one appends one row from the visible row: the chosen token replaces that position, every other cell equals the visible row, T increases by one, and t moves to the new row. A unit test covers append and the branch-from-earlier-t case.
  5. AC5 — undo removes the last row, sets t to the new last index, and is a no-op at T = 0; a jump after undo appends from the restored row. Unit test.
  6. AC6 — the slider ranges only over built rows (0..T), and its total-timesteps input is not editable in hand-walk mode; arrow keys and the step buttons cannot move past either end.
  7. AC7 — the hand-walk rows never enter TrajectoryCache; its size is unchanged across jumps, branches and undo.
  8. AC8 — changing strategy or schedule mid-walk leaves existing rows untouched; only subsequent actions and inspector queries use the new strategy/schedule.
  9. AC9 — npm run check, npm run lint, npx prettier --check . and npm run test pass.

Not doing.

  • The full-neighbourhood scroll list — issue 2. This issue can only pick the current token's neighbours that the graph already shows.
  • Random flip and one-step diffusion — issue 3. Specific jumps here use no RNG.
  • Redo, a branch tree, or named saved branches; acting from an earlier row discards the future.
  • Per-step strategy/schedule provenance; a mid-walk change applies to future actions and inspector reads only.
  • Clicking trajectory nodes to scrub; the slider covers that.
  • Mixed strategies — Kernel algebra: mixtures, composition, product-of-experts #60.
  • Touch gestures and modifier-key-only actions; explicit click/Enter and visible buttons only.

Open questions.

  • Should a specific jump to a neighbour outside the active strategy's candidate set be allowed? I propose yes — a forced jump, with its inspector edge weight shown as 0 or — — because direct choice is the point.
  • Should the hand-walk horizon cap at scheduleStore.T (300 by default), or may specific jumps grow past it? I propose cap at T; random flips in issue 3 need beta(t).
  • Should the inspector follow the jumped token at the same screen position, or close and require a new click? I propose follow and re-query; the tooltip may stay where it was.
  • Does “click a token” include tokens in historical rows, with a jump branching from that row? I propose yes; the visible row is the branch point.

Activity

  1. added this to the Direct manipulation milestone on Nov 22, 2026
  2. Enniwhere commented on Nov 23, 2026

    @Enniwhere
    ContributorAuthor

    Walked 2026-11-23.

    What is there. Explore is a film: +page.svelte posts one compute spec as soon as text and a tokenizer exist, trajectoryStore caches dense $(T+1)\times L$ rows, the slider scrubs them, and the inspector queries a column for buildNeighborGraph, which draws the chain plus the 1-hop neighbourhood of every visited token. Hand-walk inverts this: one row in, no compute or cache; a neighbour click appends one copied row; an earlier row branches; undo pops.

    Decided.

    • Hand-walk is the new explore, not a mode. The app opens directly on a one-row timeline; "Walk it" goes. The film can return later as a separate mode.
    • Changing the tokenizer resets the timeline; changing text does too. Changing strategy or schedule does not: later jumps and inspector reads use the new kernel (AC8).
    • The pinned inspector shows the trajectory chain plus the pinned token's current 1-hop neighbours only. Earlier-neighbour nodes are not drawn, so AC4 becomes structural rather than a disabled state.
    • The graph needs an explicit focus token and time. Token-id dedup with earliest anchorStep cannot say which node is current or adjacent now; add a focus step to buildNeighborGraph (or a focus field on NeighborGraph) and keep the chain.
    • A small pure hand-walk model (growable rows, append/branch/undo) sits behind trajectoryStore; TrajectoryCache and the worker's compute path stay untouched, per AC2/AC7.
    • Jumps cap at schedule T (300 by default). In this slice every clickable node is already in the active candidate set, so the forced-jump question waits for issue 2.
    • Undo is a tail operation. Disable it while scrubbed back rather than yank t to the new last row.
    • The Show's "click Walk it" and DESIGN §3.2/§5's editable T need rewriting with the code; capacity remains 300.

    Still open.

    • Does the Edit screen survive as an optional destination, or does the textarea move inline? Keeping it is the smaller change.
    • BetaReadout and the schedule picker still sit beside a timeline they no longer drive. Hide, quiet, or re-caption?
    • The inspector recomputes past edges through the current kernel, so after a mid-walk strategy change they no longer show the probability that produced them. Accepted (no provenance), but the UI may need a note.
    • AC2's "page test/spy" has no jsdom and no worker seam; evidence may have to be store-level plus e2e.
  3. Enniwhere commented on Nov 23, 2026

    @Enniwhere
    ContributorAuthor

    Story. Open the app and the input is already the timeline: t = 0 / 0, the text as row 0, no future. The walk supersedes the Show's "click Walk it": explore is the default screen and the precomputed film goes. Click a token and its inspector pins at that position and row. Click one of the current token's neighbour nodes and exactly one row is appended — the chosen token replaces that position, every other cell is copied, and t follows. Acting while scrubbed back discards the rows after that point and branches from there. Undo pops the tail. The slider becomes a history scrubber and the total-steps field is read-only, because the reader's choices, not a seed, now decide what comes next.

    Smallest version. One row on load, pin, neighbour jump, branch, undo, nothing computed ahead. It leaves out the film mode, the full-neighbourhood scroll list, random flips, redo and branch trees, forced jumps outside the candidate set, provenance and touch. Cost: about 410 added, 130 deleted, four slices. Two things beyond the issue's own list are argued for and are small: flipping the default mode (one line in viewStore) and exploiting deletions — the compute-request effect, the progress bar and phase labels, and the three film-era e2e assertions go, which is most of the deleted total. The Edit screen survives as an optional destination from the input bar; moving the textarea inline buys nothing here. BetaReadout is hidden in hand-walk, but the schedule picker stays: the inspector still reads past edges under it, and random flips will need it. No provenance badge or kernel-changed note — weights are read under the current kernel, as the walk accepted.

    Soil check. The Trajectory type's (T+1) × L rows and tokensAt, plus trajectoryStore.queryNeighbors, are already the right seam; TrajectoryCache and request() stay untouched (AC7). buildNeighborGraph and the worker's neighbors handler already build the tooltip's chain plus 1-hop graph — add a focus step and draw only the focus's neighbourhood, so AC4 is structural and earlier neighbours never exist. InlineTokens and TokenChips already carry role="button", tabindex=0 and focus previews; click/Enter is one handler each. TimeSlider already steps and clamps; a no-input flag covers AC6. Delete the compute-request effect (src/routes/+page.svelte:406–425), the progress bar and trajStatus (~40 lines), the scheduleStore.T clamps in canStep/handleKeydown, and three e2e tests whose subject is the removed random process. Two small corrections in the same area: one maxStep derived replaces the three scheduleStore.T reads and the duplicate clamp (~15 lines, the tending item), and neighbor-graph.ts's comment calling a trajectory edge "the true probability the walk used" is no longer true — it is the current kernel's read.

    Not doing.

    • The all-neighbours scroll list — issue 2; only nodes the graph already draws are clickable.
    • Random flip and one-step diffusion — issue 3; specific jumps draw no RNG.
    • Forced jumps to neighbours outside the active candidate set — with issue 2's list.
    • Redo, branch trees, named branches — a jump from an earlier row discards the future.
    • Per-step strategy/schedule provenance — rows keep no kernel record.
    • Clicking trajectory nodes to scrub — the slider does that.
    • Mixed strategies — Kernel algebra: mixtures, composition, product-of-experts #60.
    • Touch gestures and modifier-key-only actions — click/Enter and visible buttons only.
    • The film / random-process mode and the e2e coverage that goes with it; it returns as a separate mode.
    • A literal AC2 page spy — there is no jsdom and no worker seam; evidence is the model/store test plus e2e showing ready at 0 / 0 with no progress UI.

    Slices. Repo cap is 400 changed lines per commit (.omhu.json); the gate stops at 500.

    1. Behavioral — hand-walk trail (160). A pure trail model (one row, append the chosen token at a position with the rest copied, branch by truncating after the visible row, tail undo), a store session around it, explore opening on one row with status ready and no request, the slider over 0..T with the total read-only, and Undo disabled unless at the tail. Tests: append, branch, undo, no-op at T = 0, and ready-without-compute at the store seam.
    2. Behavioral — pin the inspector (110). buildNeighborGraph takes a focus step and builds only that step's 1-hop neighbourhood; the tooltip is told the focus so the ring and ramp are right. Click/Enter/Space on a prose token or chip pins position and time; Escape or close unpins; the pinned tooltip survives the pointer entering it; hover still previews when nothing is pinned. Test: the chain is intact and earlier-step neighbour nodes are absent.
    3. Behavioral — jump (60). Clicking a neighbour appends one row from the visible row, copies every other cell, moves t, and re-queries the inspector at the same position. Scrub-then-jump replaces the future; undo pops and restores; a strategy or schedule change re-queries only. Tests: jump, branch-from-earlier, undo-then-jump.
    4. Mechanical — record and retire (210). A hand-walk e2e spec for the Show (start, pin, jump, branch, undo) and a recorded run in the PR; delete the three film-era e2e assertions and adapt their helpers; rewrite the Show and the editable-T prose in README.md, DESIGN.md §3.2/§5, AboutPanel.svelte and .omhu/MAP.md; COMPOST lines; version bump (feat → minor). This slice is the estimate's swing — if it passes the cap it splits S4a/S4b.

    Net lines. About 410 added, 130 deleted, ~540 changed.

    This touches the main screen's state model and retires tests, so it deserves a review. Next step: /implement 113.

  4. added a commit that references this issue on Nov 23, 2026
  5. Enniwhere commented on Nov 24, 2026

    @Enniwhere
    ContributorAuthor

    Plan: fix the GPT-2 source switch and the review follow-ups

    Same issue #113 / PR #116; no new version bump (the PR already carries 1.18.0). Five slices.

    Diagnosis

    src/routes/+page.svelte:479-486 both reads and writes embeddingStore.sourceId. While the tokenizer is words, clicking GPT-2 sets the source to gpt2, the effect re-runs, and it writes glove back. The card is not broken; the effect is re-tracking its own output. Fix by reading and writing the source inside untrack(...) so the effect still selects the one valid source when the word tokenizer becomes active, but a user source click no longer re-runs it.

    Slices

    Slice Kind Change Test
    S1 fix / behavioral src/routes/+page.svelte:479-486: wrap the embeddingStore.sourceId read/write in untrack(...); update the comment. untrack is already imported. New e2e/embedding-source.spec.ts: wait for app ready, select embedding-knn, click embedding-source-glove-840b-300d, wait for the source picker to re-enable, click embedding-source-gpt2, assert aria-checked=true on the GPT-2 card and tokenizer-gpt2, then switch back to GloVe.
    S2 fix / behavioral Add setTime(t) in src/routes/+page.svelte: set trajectoryStore.t, then if (pinned) unpin(). Use it in TimeSlider ontchange (+page.svelte:641-643) and the ArrowLeft/ArrowRight branches (+page.svelte:165-172). Extend e2e/hand-walk.spec.ts: after the undo, pin a token, scrub to 0, assert the tooltip is hidden, then pin again before the existing branch assertion.
    S3 test Add a seeded randomized differential test to src/lib/engine/hand-walk.test.ts: seedrandom.alea('hand-walk-differential\0'), a naive number[][] reference, ~2,000 random jumps (including out-of-range from/position) and undos, comparing return values, T, rows, and tokensAt. npm run test.
    S4a docs Delete the stale β₂ = … ← β readout line at DESIGN.md:105. Keep the unused BetaReadout.svelte for the future film mode. npx prettier --check ..
    S4b chore / mechanical Remove the dead SeedControl usage at +page.svelte:9 and :704-711, delete src/lib/components/SeedControl.svelte, and remove the now-unused reroll() (src/lib/stores/trajectory.svelte.ts:140-142) and randomSeed import (:3). Keep the seed field: _wrapTrail still reads it. npm run check, npm run test; no e2e needed.

    Acceptance

    • With embedding-knn active and the word tokenizer loaded, clicking GPT-2 selects GPT-2 and the tokenizer follows. GloVe is still selected automatically when arriving from the word tokenizer; switching back to GloVe works.
    • A pinned inspector closes when the timeline is scrubbed or arrowed; the next neighbour click branches from the new visible row.
    • The differential test fails if HandWalk and the naive reference diverge; the existing hand-picked tests stay.
    • DESIGN.md no longer advertises a β readout that the app does not render; the Advanced panel has no inert seed control.
    • node scripts/verify.mjs passes (check, lint, prettier, test), and npm run e2e passes locally for the new and updated specs.

    Decisions / scope

    • Source fix: keep the "GloVe when the tokenizer is words" behaviour; untrack is the minimal change. The selectTokenizer loading guard at src/lib/stores/tokenizer.svelte.ts:13-30 is a separate latent race — the source picker is disabled while the tokenizer loads — so it stays out of this plan.
    • Pin/scrub: unpin rather than re-query. The pinned graph must belong to the row it branches from; re-querying would need to compute the token at the old position for the new row. Unpinning is one helper and matches the review's suggestion.
    • Seed cleanup: delete the dead UI, component, and reroll; keep seed because the Trajectory wrapper and cache key still use it. If the film mode needs the control, git history has it.
    • No new dependencies, no RNG/sampling changes, no TrajectoryCache or worker changes, no film-mode work. The source fix is UI-only.
    • Version: no bump; the PR already carries 1.18.0 for Hand-walk the timeline: click a token, jump to a neighbour, undo #113. If these split into a new issue, the final slice bumps to 1.18.1.
    • Review: the GPT-2 bug is a blocker the round 1 review missed. After S1–S4, a round 2 review should start from the new HEAD, with /tmp/opencode/probe3.mjs as the blocker repro. The existing round 1 approve is not final for this bug.

    Smoke steps

    1. npm run e2e — the new embedding-source spec and the updated hand-walk spec.
    2. Manual: open the app, select embedding-knn, select GloVe, then GPT-2; confirm the source card and tokenizer switch, then switch back to GloVe. Pin a token, scrub, confirm the inspector closes; re-pin, jump, undo, branch.
  6. added 6 commits that reference this issue on Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions