Milimo Frontend State Manager logo

Milimo Frontend State Manager

Community
mainza-ai
milimo-frontend-state-manager

Strict guidelines for the Milimo Video React 18/TypeScript frontend, specifically regarding the 7-slice Zustand God Store architecture, the SSE listener loops, and the "Magnetic V1" CSS-based timeline rendering logic. Use this when building UI features, modifying state synchronization, or addressing Safari playback drift.

Overview

Publishermainza-ai
Repositorymilimovideo
Skill namemilimo-frontend-state-manager
Stars
87
Forks
19
Bundled files
Instructions only
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by mainza-ai on GitHub. Read the source before you install it.

Installation

Install the Milimo Frontend State Manager AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/mainza-ai/milimovideo.git /tmp/milimovideo
mkdir -p .claude/skills
cp -r /tmp/milimovideo/skills/skills/milimo-frontend-state-manager .claude/skills/milimo-frontend-state-manager
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Milimo Frontend State Manager in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Milimo Frontend State Manager on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Milimo Frontend State Manager is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Milimo Frontend State Manager Skill

As the Milimo Frontend State Manager, your primary responsibility is maintaining the integrity, performance, and synchronization of the React 18 UI.

1. The Zustand "God Store" (timelineStore.ts)

Milimo uses a single timelineStore.ts built from 7 distinct slices to prevent context re-render thrashing:

  • projectSlice (Project metadata, save/load)
  • shotSlice (Storyboard elements, generation status)
  • trackSlice (Timeline lanes, clip positioning)
  • playbackSlice (currentTime, playing status, maximum duration cache)
  • uiSlice (Tooltips, panel visibility)
  • elementSlice (Project elements gallery)
  • serverSlice (SSE handling, active jobs dictionary)

RULES:

  • No independent React Contexts for global state.
  • Always use the <Toggle> component for switches.
  • Components subscribing to frequent updates (like currentTime from PlaybackEngine) MUST use selective useStore(useShallow(state => ...)) bounds or access .getState() directly via useRef to avoid React reconciliation loops.

2. Magnetic V1 & Free Placement (Timeline Layout)

The timeline UI is entirely DOM/CSS-based absolute positioning (no HTML5 <canvas>).

  • Centralized in computeTimelineLayout() inside timelineUtils.ts.
  • Track 0 (V1) behaves magically: It ignores user-specified startFrame. It calculates layout by iteratively appending the duration of Shot N-1 to Shot N. Dragging a clip on V1 simply reorders the array.
  • Track 1 (V2) & Track 2 (A1) are "free placement": Clips are absolutely positioned based on their explicitly defined startFrame, allowing overlapping overlays and audio.

3. Browser Quirks & Engine Workarounds

Safari is notoriously difficult for media web apps. The frontend must strictly adhere to these workarounds:

A. Safari Audio Fix (GlobalAudioManager.ts)

Safari blocks <audio> autoplay and suffers from aggressive media desync when syncing HTML5 video to separate audio tags.

  1. The Playback Loop: PlaybackEngine.tsx uses a headless requestAnimationFrame to advance currentTime via Date.now() deltas.
  2. Audio Decoding: GlobalAudioManager.ts pre-fetches .mp3 files via HTTP Range requests and uses decodeAudioData into an in-memory AudioBufferSourceNode.
  3. Mute Control: Audio nodes remain playing but are muted (gain.value = 0) instead of being stopped, circumventing Safari user-gesture policies on re-start.
  4. Drift Tolerance: The frontend hardcodes a 250ms drift tolerance. If the video <video> tag current time deviates from the PlaybackEngine time by more than 250ms, it forces a .fastSeek().

B. Safari Draggable Hover Bug

Elements with draggable={true} in Safari WebKit silently swallow CSS pointer events, completely neutralizing Tailwind's group-hover and standard :hover pseudo-classes intended for child overlay UI.

  • DO NOT use CSS hover states for interactive buttons inside draggable elements.
  • INSTEAD, use explicit React state (e.g., const [isHovered, setIsHovered] = useState(false)) bound to onMouseEnter and onMouseLeave synthetic events (which Safari does reliably fire) to toggle UI visibility.

4. SSE & React Hooks

Backend task updates flow exclusively through Server-Sent Events.

  • SSEProvider.tsx manages a single robust EventSource with exponential backoff.
  • The Zustand serverSlice.ts exposes handleServerEvent() which patches the shotSlice implicitly on "progress", "cancelled", and "complete" messages.
  • Job Poller: SSE dropouts happen. On initial page mount, jobPoller.ts grabs all shots marked isGenerating: true and fires explicit GET /status/{job_id} calls to hydrate the UI.

5. UI Layout Components

  • The layout revolves around Layout.tsx, wrapping a top toolbar, CinematicPlayer.tsx center stage, VisualTimeline.tsx sticky at the bottom, and a right-side inspector (InspectorPanel.tsx, MediaLibrary.tsx, StoryboardView.tsx mutually exclusive visible tabs).
  • Drag-and-drop between Library and the Inspector is supported via HTML5 drag APIs.

Frequently asked questions

What does the Milimo Frontend State Manager AI skill do?

Strict guidelines for the Milimo Video React 18/TypeScript frontend, specifically regarding the 7-slice Zustand God Store architecture, the SSE listener loops, and the "Magnetic V1" CSS-based timeline rendering logic. Use this when building UI features, modifying state synchronization, or addressing Safari playback drift.

Why use Milimo Frontend State Manager on TypingMind?

Because you install it once and use it with any model. Milimo Frontend State Manager is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Milimo Frontend State Manager in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/mainza-ai/milimovideo/tree/main/skills/skills/milimo-frontend-state-manager. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Milimo Frontend State Manager?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Milimo Frontend State Manager?

As many as you like. As long as a model supports skills, you can use Milimo Frontend State Manager with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Milimo Frontend State Manager AI skill free?

It is published on GitHub by mainza-ai. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇