Skip to content

Add house styles, watermarks, Plan mode storyboards, agent CLI auto-update and leaner agent sessions - #1

Merged
ItsTatsuya merged 14 commits into
mainfrom
feature/teaching-studio
Oct 27, 2026
Merged

ItsTatsuya merged 14 commits into
mainfrom
feature/teaching-studio

Conversation

@ItsTatsuya

Copy link
Copy Markdown
Owner

Five features for making consistent teaching videos and using agent plans more efficiently. Each was built on its own branch, merged here, and then audited together.

What changed

  • House styles (styles.py, Settings → Styles): three read-only built-in presets (light textbook, dark, high contrast) plus custom ones. A style sets fonts (installed or uploaded to project assets), colours, type scale, layout, pacing, narration tone and house rules. Projects and PDF-batch videos store only a style id. Studio writes studio_style.py beside script.py, but only when its text changes, so render cache keys stay stable. It also appends a short style guide to the agent instructions.
  • Custom watermark (watermark.py): a logo or text with position, scale, opacity and margin. There is a global default, and projects or videos can override it. The worker overlays the finished movie with PyAV after narration and after the render-cache checkpoint, so changing the watermark never invalidates the animation cache. The bundled ffmpeg is audio-only, which is why this does not use it.
  • Plan mode / lesson storyboard (storyboard.py): a Plan/Build switch in the composer. Plan turns write only storyboard.md, a structured lesson script with objectives, sections, worked examples, key ideas, practice, common mistakes and a scene plan. They never render or queue. A new Storyboard tab lets the user review and edit it, revise it with the agent, or choose "Approve & generate video", which starts a Build turn that reads the file by path. Approval is stored as a hash in .storyboard.json, so any later edit returns the storyboard to draft. If a plan turn changes script.py or narration.txt, Studio restores it.
  • Agent CLI auto-update (agent_updates.py):
    • Checks the npm registry for Claude Code and Codex at startup, then at most once a day.
    • Updates npm and native installs only while that provider has no running turn. Custom binaries are reported as managed externally.
    • New turns wait during an update. Video repairs retry on a timer instead of failing.
    • The CLI capability cache is cleared after an update.
    • Settings → Providers shows versions and has "Update now". MANIM_STUDIO_AGENT_UPDATES=0 turns off the background check.
  • Token usage:
    • Claude sessions run with Studio's own tool list, an empty strict MCP config, hooks and slash commands off, and no CLAUDE.md or auto memory.
    • Codex gets -c overrides that turn off web search, apps, plugins, sub-agents and MCP servers.
    • Every flag is feature-detected per CLI binary, so an unknown flag never breaks a run.
    • The system prompt is tighter.
    • Repair diagnostics are compacted: a 10k-character log becomes about 700 characters.
    • Fork transcripts are leaner: an 8-turn sample went from 21.7k to 8.2k characters.
    • Per-turn token counts appear in the timeline.

Review notes

  • Seams between the features:
    • In agents.build_command, Plan mode swaps the system prompt and the style guide is then appended to it.
    • Resumed Codex sessions are re-briefed when the mode or the style changes (a hash of the system text).
    • projects.set_watermark and style updates now write only project.json. They no longer rewrite narration.txt, which had disturbed repair revision checks.
  • Behaviour change: Studio agent sessions no longer load the user's own Claude hooks, MCP servers or CLAUDE.md.
  • Not covered:
    • Narrated, parallel and cache-resumed renders with a watermark were not run end to end.
    • claude update and codex update were never run for real.
    • Plan turns do not undo writes to assets/.
  • studio_ui/ is rebuilt in the last commit.

Verification

  • uv run ruff check . and uv run ruff format --check .: pass
  • npm run format:check: passes
  • uv run python -m unittest discover -s tests: 292 tests OK, 2 skipped
  • npm run build:editor: passes
  • uv run python tests/ui_smoke.py: 47 OK, 1 skipped (Kokoro)
  • uv run python tests/react_audit.py: passes

Claude Code sessions no longer load the user's MCP servers, hooks, skills,
CLAUDE.md memory or project/local settings, and only get the file and shell
tools the animation agent uses (--tools). Codex sessions switch off web
search, MCP servers, apps, plugins, sub-agents, image generation and other
unused features through -c overrides. Every option is feature-detected from
the installed CLI (--help, an offline features list check) and cached per
binary, so older releases never see an unknown flag. Access modes keep their
permission semantics.

The system prompt is tighter and tells the agent to avoid re-reading files and
to run the Studio check once at the end. Repair turns send compact
diagnostics (no progress bars or info logs, tracebacks cut to the project's
frames plus the raising frame, capped at 4k chars) instead of 12k of raw log.
Fork replays keep each request, the files changed and the final reply only
(12k limit). Turns record normalised token counts, shown in the timeline.
agent_updates.py checks the npm registry for each enabled CLI, detects how it
was installed (npm prefix, native Claude/Codex installer, or managed
externally) and updates npm and native installs non-interactively in a hidden,
cancellable process tree. Updates wait until no turn for that provider runs;
new turns wait briefly for an update window. Status persists in
.studio/agent-updates.json and streams as agent.updates events. The new
auto_update_agents setting (default on) drives a daily background check
started by desktop.py. Settings > Providers shows installed and latest
versions, Update now, Check for updates and the auto-update switch.
Global default in .studio/watermark.json, per-project and per-video-workspace
overrides in project.json (videos inherit their project). Logos (PNG/JPG/WebP/
GIF/BMP/SVG) are rasterised once into a content-addressed store. The render
worker overlays the watermark last, after narration and after the animation
cache checkpoint, re-encoding video with PyAV/libx264 and copying audio, with
progress, cancellation and a dedicated error marker. UI: watermark dialog in
the Preview panel and a default in Settings > General.
…ent style guide

Styles live in DATA_ROOT/.studio/styles.json (built-ins read-only, duplicable).
Projects and batch videos store only a style id; Studio writes studio_style.py
beside script.py before renders and agent turns (only when it changes, so render
cache keys stay stable) and adds a short style guide to the agent instructions.
Adds a Styles settings page, a project style picker in Preview, and style choice
in the New project and Videos from PDFs dialogs.
…-studio

# Conflicts:
#	projects.py
#	studio.py
#	web/src/components/panel/PreviewPanel.tsx
A composer toggle switches a chat between Build and Plan. Plan turns use a
compact lesson-storyboard system prompt and may only write storyboard.md in
the project or video workspace; Studio restores any plan-turn change to
script.py or narration.txt and video_workflow never validates or queues a
plan turn. The new Storyboard tab renders, edits, revises and approves the
storyboard; approval (a hash of the approved text, so edits return it to
draft) starts a Build turn that reads storyboard.md by path. PDF batches can
plan first, and project imports keep storyboard.md outside assets.
…-studio

# Conflicts:
#	agents.py
#	packaging/build.py
#	studio.py
#	web/src/components/BatchVideosDialog.tsx
#	web/src/lib/api.ts
- Re-brief a resumed Codex session whenever its instructions change (mode
  or house style), not only on a Plan/Build switch; record it under the lock.
- Forked chats keep the source chat's Plan/Build mode.
- Watermark, rename and style changes write project.json only, so they no
  longer rewrite narration.txt (which raced agents and made running video
  workflows think the files changed).
- storyboard.md and its approval sidecar no longer invalidate the render cache.
- The style library endpoints no longer hold the render LOCK.
- Fix the style agent-instructions test for plan-mode turns and cover
  re-briefing on style and mode changes.
The style selects inherited the muted label colour inside Field, failing the
dark-theme contrast audit on the PDF batch dialog, and were disabled until the
style library loaded. Use the foreground colour and keep them enabled; the
inherited option is always available.
Copilot AI balanced review requested due to automatic review settings October 27, 2026 12:09

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@ItsTatsuya
ItsTatsuya merged commit ffafeae into main Oct 27, 2026
2 checks passed
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.

2 participants