跪拜 Guibai
← All articles
Backend

Origami Agent for Rokid Glasses: Let the Fold Stay in Front of Your Eyes

By 努力的小雨 ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

Hands-free origami instruction points to a broader design pattern for smart glasses: keeping the user's hands on the material and letting the agent manage pacing through explicit commands rather than screen taps or video controls. The agent also shows how to constrain a language model to a narrow teaching role, which is a practical template for interactive craft education on wearable devices.

Summary

Origami is a new agent for Rokid AI glasses that guides parents and children through origami projects without the usual video-pause struggle. The agent shows a looping animation of the current fold on a canvas, keeps the step number fixed until the user says "next step", and supports replay, slower playback, and previous-step commands. Voice recognition uses final results only, and temple-arm button presses map to next/previous and a voice toggle.

The development splits into a lean file structure on AIUI Studio: app.json handles pages and permissions, lib/fold.js stores course and command logic, lib/draw.js does geometry and rendering, and pages/index/index.ink manages state and events. Course data stores each step's fixed base paper, moving paper, crease line, and folded result, with a 2D projection function for rotation. The model gets a catalog, current phase, selected lesson, and current step, returning structured replies limited to select, help, or unsupported, so it cannot invent animations.

An early prototype attempted photo-based paper-state detection, but the model repeatedly misjudged after a small fold, so completion confirmation was handed to the user. The agent is live on the Rokid platform, with courses like paper plane, cootie catcher, and jumping frog, and the author plans further family testing comparing phone vs glasses with balanced ordering.

Takeaways
— The Origami agent runs on Rokid AI glasses and is built with AIUI Studio, using a canvas for fold animations and voice plus temple-arm button inputs.
— State centralization in pages/index/index.ink keeps course ID, step index, phase, and canvas drawing consistent, preventing the screen and model from seeing different steps.
— The fold data structure stores base, moving, after, crease, and tip fields, with a reflect function that projects points onto the crease line; t from 0 to 1 controls fold progress.
— Each fold cycle has a 750ms start pause, a per-course action duration, and a 2600ms end hold; pressing 'slower' multiplies the action duration by 1.55.
— Speech recognition processes only final results and deduplicates via a Set, and temple-arm button presses are debounced for 180ms.
— The language model receives a JSON context with catalog, phase, current lesson, current step, and user text; it returns only kind, lessonId, and reply, validated for type, existing lesson, and length.
— The agent rejects photo-based paper-state detection because it failed after small folds; instead, users confirm each completed fold.
— Courses currently available include paper plane (A4) and fish, bookmark, and sailboat (square paper), plus more; the published version is on the Rokid platform.
— The model wait timeout is 30 seconds; explicit commands cancel pending requests, keeping the animation loop independent of model latency.
Conclusions

The design choice to let users confirm completion rather than rely on vision AI acknowledges the reliability limits of current models on fine-grained physical state, a pragmatic call for consumer devices.

Storing geometry as normalized coordinates (width=1, A4 ratio 1.414) makes the animation resolution-independent, a subtle but reusable trick for any instructional canvas.

The two-tier command handling (local dictionary match first, model only for fuzzy cases) mirrors a pattern that reduces cost and latency on constrained hardware like glasses.

Balancing the order of device comparisons in future testing shows awareness of learning effects, a higher standard than most hobbyist agent projects.

Concepts & terms
AIUI Studio
Rokid's development platform for creating AI agents for its smart glasses. It supports conversation-based project creation, a code editor, and a built-in LanguageModel API.
LanguageModel
Rokid's platform API for calling an LLM from an agent. It provides availability checks, session creation, prompt calls, and session destruction.
Temple-arm buttons
Physical buttons on the arms of the Rokid glasses. In this agent, a short press toggles voice input, and up/down arrows map to previous and next fold commands.
Source: juejin.cn ↗ Google Translate ↗ Backup ↗