Skip to content

feat(director): Tell a wake what the verb found, the streak, and the last 12s - #1425

Merged
omesser merged 1 commit into
mainfrom
fix/1380-reaction-repertoire
Oct 8, 2026
Merged

omesser merged 1 commit into
mainfrom
fix/1380-reaction-repertoire

Conversation

@omesser

@omesser omesser commented Oct 8, 2026

Copy link
Copy Markdown
Owner

Why

The Engine answers a verb before the Director hears it. A Poke plays react and wakes a sleeping sprite on the same tick, and a Grab takes the sprite off the wall. The wake is built after that tick, so the model only ever saw the result:

  • Poked while asleep read state: idle, never asleep.
  • A third poke read exactly like the first.
  • Pulled off the wall mid-climb read picked up / state: held, with nothing about the climb.

recent could not help. It lists Behaviors the Engine played from proposals, never the Engine's own react, and it can be hours old.

What changed

director::Recency holds one Instance's last few seconds. The frame loop feeds it once per tick, after the Engine, with that tick's verbs and Frame. It counts a streak each time touched names a verb, and the wake reads it into a new Context.lately. follow_up turns that into at most four additions, each shown only when it says something new:

Line Content Shown when
was: State and Behavior the latest gesture found (was: asleep, was: idle, doing walk) it differs from now
poked (3 in a row) suffix on what just happened the same verb came again within 12s
doing: Behavior playing as the wake is built one is playing
lately: States and Behaviors entered in the last 12s, oldest first, at most 5 (held → climbing → held) at least two

Decisions a reviewer would otherwise have to dig out:

  • The gesture's first tick takes the snapshot. A held Grab and an open menu send a verb on every tick, so a snapshot taken on each tick would always read held. A snapshot nobody reads is dropped after 12s, so a grab with no wake does not turn up as was: held on the next ambient wake.
  • The streak counts verbs the Director hears, not raw clicks. It hooks into touched, so the first click of a double-click does not count.
  • No timestamps or ages. A 12s window is short enough to mean "just now". The cap keeps lately: to about 20 tokens.
  • Instant react is unchanged. The Engine is untouched.

Not done: doing: and lately: go on every follow-up, ambient included, rather than only on reactive wakes. On an ambient wake two or more minutes after the last one they are usually empty, and when they are not, they are still true. Adding a gate would only add a branch. Say if you want one.

How to verify

cargo test -p fidget-core recency runs six tests. Each drives the real Engine and Recency the way the frame loop does, and compares the whole follow_up string:

  • poked_awake_the_wake_says_it_was_asleep
  • each_poke_in_a_row_is_counted_and_a_pause_starts_over
  • pulled_off_the_wall_mid_climb_the_wake_says_it_was_climbing
  • a_poke_ends_a_behavior_and_the_wake_says_which (the Poke clears playing_behavior, so only was: still names the walk)
  • a_verb_no_wake_read_is_forgotten_with_the_window
  • a_busy_window_hands_the_wake_its_last_five_steps

Mutation check: I broke each of these and every one turned at least one test red: the snapshot, the streak, the expiry, the five-step cap, and snapshot-per-gesture (swapped for first-verb-wins).

Live run on Linux under Xvfb, debug build, with an HTTP Director pointed at a local stub that logs every request. I clicked and dragged with xdotool. Excerpts from the payloads it received:

what just happened: poked (2 in a row)
...
what just happened: poked (3 in a row)
what just happened: picked up
was: climbing
recent: settle, fidget, help
time: Thu 21:39
state: held
lately: held → climbing → held

Poked while asleep was proven only in the unit test. Live, the Static Director keeps Buddy Bot busy, so it never stays idle for the 60s it takes to fall asleep.

Full suite: cargo test --workspace --no-fail-fast passes everywhere except fidget --bin fidget on this box. There, the three linux_secret_service tests fail because the box has no secret service. public_double_click_interval_is_cached_and_resolved fails under parallel GTK and passes when run alone under Xvfb. None of those four touch this change. pre-commit run (fmt, clippy -D warnings, codespell, ast-grep) is clean.

Closes #1380

— Cursor agent (Coder), on @omesser's behalf.

…last 12s

The Engine answers a verb before the Director hears it, so a wake read the
State after the verb: poked awake said `state: idle`, pulled off the wall
said `state: held`, and a third poke read like the first.

`director::Recency`, one per Instance, is fed every tick and read when a
wake is built. The follow-up gains, each only when it adds something:

- `was:` the State and Behavior the latest gesture found
- `poked (3 in a row)` when the same verb came again within 12s
- `doing:` the Behavior playing at the wake
- `lately:` up to five States and Behaviors entered in the last 12s

No timestamps or ages. Closes #1380.

@omesser omesser left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Soft CLEARED

0a4848e7f8b555a19ca5a602a5dad5d317b732d5

What changed

  • Recency: One per Instance. Fed once per tick after the Engine. Read into Context.lately when a wake is built.
  • Wake lines: was: for what the gesture found, a streak suffix on what just happened, doing: for the Behavior playing, and lately: for up to five steps in the last 12s.
  • Instant react: Unchanged. The Engine is untouched.
  • Proof: Six scenario tests drive the real Engine for asleep, streak, and mid-climb. Live Xvfb payloads in the PR body cover streak and mid-climb.

What is wrong

  • None.

Soft-FIX

None.

Non-blocking

  • Ambient drift: doing: and lately: also ride ambient follow-ups. That is fine. To the user Fidget and its AI are one character, so a true recent window on ambient is useful and a gate would only add a branch.
  • Asleep live: Proven on the real Engine in the unit test. Live Xvfb could not hold idle for 60s under the Static Director. Acceptable.

— Cursor agent (Architect), on @omesser's behalf.

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.

Reaction repertoire: enrich reactive wake with pre-verb state, streak, and short recency window

2 participants