agentleFS
moeru-aimoeru-ai/airi/.agents/skills/enforce-rules-for-render-loops/SKILL.md

enforce-rules-for-render-loops

Skill51k starsChanged todayMITView on GitHub

Enforce AIRI's rules for time in render loops. Use when you write or review motion, reaction, animation, spring, or effect code that a Pixi (Live2D), TresJS (VRM), or Three (MMD) frame loop samples, or when an event outside the loop starts an effect that a frame then plays.

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 0 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Do not mix the frame clock with performance.now() or Date.now() in values that a frame samples.

    line 20
  2. Very specific:

    Do not give it a performance.now() timestamp.

    line 27
  3. Very specific:

    Use performance.now() only to measure durations for traces and logs, never as animation input.

    line 29
  4. Very specific:

    Write time-based logic as functions of explicit time inputs, for example sample(nowSeconds), and test them with chosen times.

    line 35

≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Enforce Rules for Render Loops

A render loop has its own clock. Code that a frame samples must read time from that clock only.

Find the clock

RendererClockUnit
Live2D (stage-ui-live2d)ctx.now of a motion manager plugin. It comes from Live2DModel.elapsedTime. Model.vue keeps the time of the last frame in lastUpdateTime.Seconds. Cubism4InternalModel.update runs now /= 1e3 before motionManager.update.
VRM (stage-ui-three)onBeforeRender(({ delta, elapsed }) => ...) of TresJS useLoop()Seconds
MMD (stage-ui-mmd)The Clock of the scene, clock.getDelta()Seconds

Rules

  • Do not mix the frame clock with performance.now() or Date.now() in values that a frame samples.
    • A frame clock adds the time of each frame, and it falls behind the wall clock:
      • The Pixi ticker counts at most 100 ms for one frame (Ticker._maxElapsedMS).
      • A hidden tab pauses requestAnimationFrame.
      • A paused stage stops the ticker.
    • The difference grows during a session. It can be several seconds.
  • An event from outside the loop, for example a pointer event, a store change, or a speech bus event, starts its effect at the frame time of the last frame. Alternatively, it queues the effect for the next frame.
    • Do not give it a performance.now() timestamp.
    • Example: Model.react() triggers the touch reaction at lastUpdateTime, the clock of useMotionUpdatePluginTouchReaction.
  • Use performance.now() only to measure durations for traces and logs, never as animation input.
  • Name the unit in each time name: atMs, elapsedSeconds, durationMs. Convert once, at the boundary.
  • Bound the delta in springs and integrators. A delta can be 0 on the first frame and large after a stall. See createLive2DMotionSpring, which splits a step into substeps and clamps the total.

Tests

  • Write time-based logic as functions of explicit time inputs, for example sample(nowSeconds), and test them with chosen times.
  • A test for an effect that one clock starts and another clock samples must use both clocks as the runtime does. A test that triggers and samples with the same clock cannot find a clock mismatch.
  • For runtime checks, sample the value that the frame renders, on the frame clock, for example touchReaction.sample(lastUpdateTime). Also report the difference between the frame clock and the wall clock.

Download now (ZIP)

Trending

Less talk lately.about the whole repository

Dec 2025: 0 mentionsJan 2026: 0 mentionsFeb 2026: 4 mentionsMar 2026: 13 mentionsApr 2026: 2 mentionsMay 2026: 6 mentionsJun 2026: 4 mentionsJul 2026: 36 mentionsAug 2026: 8 mentionsSep 2026: 10 mentionsOct 2026: 12 mentionsNov 2026: 0 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the moeru-ai/airi repository that our weekly crawl found. There is no adoption data for this file yet.

Who's talking about moeru-ai/airi

The biggest 5 of 112 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 112

Talked about on GitHub, Bluesky, YouTube, the web and Hacker News (112 times).

On GitHub · 50

45 more on GitHub

On Bluesky · 32

27 more on Bluesky

On YouTube · 22

17 more on YouTube

On Hacker News · 3

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.