# Imagination Studio — full corpus # LLM Wiki An open-source template for building LLM-powered knowledge bases, following [Andrej Karpathy's "LLM Wiki" pattern](https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f). You provide raw sources. The LLM reads them, writes structured wiki pages, cross-links everything, and maintains it over time. You never edit the wiki directly — you curate sources and ask questions. ## How It Works The system has three layers: ``` raw/ Sources you collect (articles, transcripts, notes, PDFs) wiki/ LLM-written & maintained pages (summaries, concepts, entities, syntheses) CLAUDE.md Schema that tells the LLM how to structure everything ``` Three operations drive the workflow: | Operation | Trigger | What happens | |-----------|---------|--------------| | **Ingest** | "ingest raw/my-source.txt" | LLM reads the source, creates a summary page, creates/updates concept and entity pages, adds cross-links, updates the index and log | | **Query** | Ask any question | LLM searches the wiki, synthesizes an answer with citations, optionally creates a synthesis page for novel insights | | **Lint** | "lint" or "health check" | LLM audits all pages for orphans, contradictions, missing links, incomplete sections, and low-confidence claims — fixes what it can, reports the rest | ## Quick Start 1. **Clone this repo** ```bash git clone https://github.com/YOUR_USERNAME/llm-wiki.git my-knowledge-base cd my-knowledge-base ``` 2. **Customize CLAUDE.md** for your domain - Update the Purpose section with your topic - Replace the placeholder tagging taxonomy with your own categories - Adjust confidence level descriptions if needed - Everything else (workflows, page formats, linking rules) works as-is 3. **Drop sources into `raw/`** - Text files, transcripts, articles, notes — any plain text - These are immutable once added; the LLM never modifies them 4. **Tell the LLM to ingest** ``` ingest raw/my-first-source.txt ``` The LLM will create summary pages, concept pages, entity pages, cross-links, and update the index. 5. **Ask questions** ``` What are the key differences between X and Y? ``` The LLM answers from the wiki, citing specific pages. 6. **Run health checks** ``` lint ``` The LLM audits the wiki and fixes issues. ## Directory Structure ``` . ├── CLAUDE.md # Schema — the LLM's instructions ├── raw/ # Your source documents (immutable) └── wiki/ ├── index.md # Master catalog of all pages ├── log.md # Append-only activity log ├── dashboard.md # Dataview dashboard (Obsidian) ├── analytics.md # Charts View analytics (Obsidian) ├── flashcards.md # Spaced repetition cards ├── summaries/ # One page per source document ├── concepts/ # Concept and framework pages ├── entities/ # People, tools, organizations, etc. ├── syntheses/ # Cross-cutting analyses and comparisons ├── journal/ # Research/session journal entries │ └── template.md # Journal entry template └── presentations/ # Marp slide decks ``` ## Enhancements This template includes several extras beyond the core wiki pattern: ### Dataview Dashboard (`wiki/dashboard.md`) Live queries that surface low-confidence pages, recent updates, concepts by tag, and pages with the most sources. Requires the [Dataview](https://github.com/blacksmithgu/obsidian-dataview) Obsidian plugin. ### Charts View Analytics (`wiki/analytics.md`) Visual analytics with pie charts, bar charts, and word clouds. Requires the [Charts View](https://github.com/caronchen/obsidian-chartsview-plugin) Obsidian plugin. ### Mermaid Diagrams Use Mermaid code blocks in any wiki page to create flowcharts, sequence diagrams, or concept maps. Native support in Obsidian and GitHub. ### Marp Slides (`wiki/presentations/`) Create slide decks from markdown using [Marp](https://marp.app/). Drop presentation files in this directory. ### Research Journal (`wiki/journal/`) Track your research sessions, experiments, or applied work with the included template. The LLM can reference journal entries when answering queries. ### Spaced Repetition (`wiki/flashcards.md`) Flashcards in the format used by the [Spaced Repetition](https://github.com/st3v3nmw/obsidian-spaced-repetition) Obsidian plugin. Ask the LLM to generate flashcards from any wiki page. ### MCP Server This repo works with Claude Code's MCP server capabilities. Point an MCP-compatible client at this repo and the LLM can read/write the wiki programmatically. ## Customizing for Your Domain The schema in `CLAUDE.md` is domain-agnostic. To adapt it: 1. **Purpose** — Describe your knowledge domain in one paragraph 2. **Tagging taxonomy** — Replace placeholder categories with your own (e.g., for a cooking KB: `cuisine`, `technique`, `ingredient`, `equipment`) 3. **Confidence levels** — Adjust the descriptions to match your domain's evidence standards 4. **Entity types** — Update the entity page description to match what entities mean in your domain (people, tools, companies, etc.) 5. **Journal template** — Customize `wiki/journal/template.md` for your workflow Everything else — page format, linking conventions, workflows, rules — is universal and works across domains. ## Example Domains This template works for any knowledge-intensive topic: - **Research notes** — papers, experiments, methodologies - **Book analysis** — themes, characters, author techniques - **Competitive analysis** — companies, products, market trends - **Course notes** — lectures, readings, key concepts - **Personal development** — frameworks, habits, book summaries - **Technical documentation** — APIs, architectures, design patterns - **Hobby deep-dives** — any subject you want to master ## License MIT --- title: "Imagination Studio KB — Master Index" type: index updated: 2026-11-19 imagination_studio_version: "4.5.0" sources: ["raw/github_doc-version.md", "raw/github_doc-readme-md.md", "raw/github_release-4-5-0-other-machines-as-workers-a-safer-machine-the-library-.md"] --- # Imagination Studio KB — Master Index **Domain:** Imagination Studio by keys+Wasserman, powered by TensorFold: a local AI film studio that plans a film, generates pictures, video, voices and music, then edits and exports it, on NVIDIA DGX Spark, Apple-silicon Macs, Windows on Arm with an RTX Spark, and other NVIDIA Linux GPUs. **Scope:** the public repository github.com/Keys-Wasserman/Imagination-Studio-by-keys-Wasserman as its `main` branch stood when fetched on 2026-11-19 (`VERSION` 4.5.0, newest release v4.5.0 of 2026-11-15), its 39 release notes and 11 closed issues. Not covered: TensorFold itself, ComfyUI, the upstream models' own documentation, open issues and Discussions, and the app's Python server source. **Pages:** 32 (25 concepts · 1 entity · 2 summaries · 4 syntheses) **Sources fetched:** 2026-11-19 Start at [[entities/imagination-studio]] if you are new, then [[syntheses/platform-comparison]] to pick a machine. ## Concepts ### Install - [[concepts/install-dgx-spark]] — DGX Spark and NVIDIA Linux CUDA install: requirements, disk, the command sequence, every install flag, Docker prebuilt engines, upgrading. - [[concepts/install-mac]] — Apple-silicon install: memory tiers, disk, `oneshot-setup.sh --app`, flags, the launcher app, upgrading. - [[concepts/install-windows-rtx-spark]] — Native Windows on Arm install (no WSL): the PowerShell installer, components, tray, Feature checks and the 128 GiB qualification policy, memory pools. - [[concepts/other-nvidia-gpus]] — RTX Pro 6000, RTX 5090, one to four local GPU workers and two-GPU rendering. - [[concepts/multi-spark-and-workers]] — Running several Sparks and using other machines as render workers. ### Run and maintain - [[concepts/launching-updating-and-access]] — Starting and stopping Studio per platform, the URL and port, updates, the access key, phone and remote use, moving an install. - [[concepts/memory-guard-and-job-queue]] — How the render queue admits jobs by measured memory, the memory API, and the per-user machine memory guard (`scripts/memguard.py`). - [[concepts/models-and-weights]] — The model catalog, Models & weights, measurements, Feature checks and qualification. - [[concepts/media-library-and-project-files]] — Where projects, renders, models and environments live; the readable folder layout; organizing older media; backups. - [[concepts/troubleshooting]] — Symptom, cause and fix tables for install, memory and renders, models, Windows, audio and remote access. ### Create - [[concepts/slate-and-story-planning]] — The Slate workflow: script import, film bible, shots, First AD and Director, Night shift, Slate on ComfyUI and Comfy Cloud. - [[concepts/picture-generation]] — Picture models, making and editing pictures, looks, scouts, turnarounds, references. - [[concepts/video-generation]] — MiniMax H3 and FastH3 video: modes, lengths, references, long clips, sound with video. - [[concepts/loras]] — The LoRA hub, licences, the essential bundle, presets, conversion and training. - [[concepts/voice-and-dialogue]] — Voices with Fish Audio Drama 3: setup, references, dialogue, per-platform availability. - [[concepts/music-and-sound]] — Songs (MiniMax-Music3, YuE2), sound effects and Foley. - [[concepts/local-brains]] — The local language models Studio uses (brains, Bolt) and how they share memory with renders. - [[concepts/edit-and-finish]] — The Library and takes, rough cut, beat edits, Finish, export to an editor. - [[concepts/motion-graphics-and-previs]] — Motion graphics templates and Motion Previs. - [[concepts/cli-recipes]] — The Mac/Linux shell recipes (`scripts/image.sh`, `video.sh`, `edit.sh`, `fast.sh`, `scout.sh`, `turnaround.sh`). ### Agents and internals - [[concepts/mcp-server]] — The Studio MCP server: registering it with an agent app and its full tool table. - [[concepts/agent-rules]] — What `AGENTS.md` and `STUDIO-AGENT.md` tell coding agents; the agent-bench harness. - [[concepts/add-ons]] — Local add-ons: a room, a tab or an agent without editing the app. - [[concepts/engine-architecture]] — The rendering architecture and the TensorFold engines per platform. - [[concepts/licensing-and-attribution]] — The Apache-2.0 code licence, each model's licence limits, attribution and brand rules. ## Entities - [[entities/imagination-studio]] — What the product is, who builds it, platforms, the five work areas, naming history and a feature map. ## Summaries - [[summaries/first-film-walkthrough]] — The tutorial path from a fresh install to a finished clip, stage by stage. - [[summaries/release-digest]] — Release history from 1.9 to 4.5.0, newest first, with the renaming timeline. ## Syntheses - [[syntheses/platform-comparison]] — DGX Spark vs Mac vs Windows RTX Spark vs other NVIDIA GPUs: requirements, features, gaps, which to pick. - [[syntheses/picture-model-comparison]] — The picture models compared on speed, memory, licence and availability. - [[syntheses/performance-and-memory]] — Measured render times and memory peaks by machine and recipe. - [[syntheses/issues-casebook]] — The 11 closed GitHub issues: problem, resolution and close date. ## Statistics - **Total pages**: 32 - **Concepts**: 25 - **Entities**: 1 - **Summaries**: 2 - **Syntheses**: 4 - **Sources ingested**: 128 - **High confidence**: 0 - **Medium confidence**: 32 - **Low confidence**: 0 --- title: "Local Add-ons" type: concept tags: [add-ons, extensions, agents, configuration] created: 2026-11-19 updated: 2026-11-19 confidence: medium sources: ["raw/github_doc-docs-addons-md.md", "raw/github_issue-proposal-add-ons-a-room-a-tab-or-an-agent-without-editing-th.md", "raw/github_doc-agents-md.md"] --- # Local Add-ons ## Definition An add-on is a folder beside the Studio that adds a room, a tab or a CLI agent without editing the app's built-in lists. Add-ons are **off by default**, local only, and not sandboxed: a server module is Python code the operator installed and trusts, and a client script is JavaScript with the Studio page's access. Described here from main as fetched 2026-11-19 (VERSION 4.5.0). ## How It Works ### Turn them on 1. Put each add-on in `/addons//`. 2. Set `STUDIO_ADDONS=1` before starting the Studio. 3. Restart after installing or changing a server module. Without the opt-in, or without that folder, nothing is loaded. No add-on is fetched from the network: there is no remote installer, upload endpoint or automatic download. Folder names are lowercase letters, digits, `_` and `-`, beginning with a letter, up to 48 characters. ### Files in an add-on folder | File | Role | |---|---| | `client.js` | Registers rooms and tabs on the page. Loaded after the Studio's own modules, before the initial navigation | | `server.py` (optional) | Exports `register(addon)`. Adds routes and can register a CLI agent | | `.js`, `.css`, `.svg`, `.png` files | Assets, served under `/api/addons//assets/` | Python files, hidden files and paths escaping the folder are not served as assets. ### A room and its tab Minimal example from the add-ons guide, as `addons/sample/client.js`: ```js StudioAddons.register({ rooms: [{ id: "sample", name: "Sample", group: "engines", tabs: ["Sample"] }], tabs: [{ id: "Sample", room: "sample", label: "Sample", view: () => el("div", { class: "panel" }, el("h2", {}, "Sample")) }] }); ``` - The groups are `apps`, `engines`, `agent` and `vaults`. - A tab may also name an existing room. - Built-in room and tab ids cannot be replaced. - A room uses the Studio's generic Agent icon. ### A server route `server.py` exports `register(addon)`. Its router is prefixed with `/api/addons/`: ```python def register(addon): @addon.router.post("/still") def still(body: dict): return addon.queue({"kind": "image", "params": body}) ``` - `addon.queue` is the same admission, memory checks and job queue as the built-in app. Use it for all render and processing jobs. Do not start a renderer, load models or run ComfyUI beside it (see [[concepts/memory-guard-and-job-queue]]). - `addon.home` is the Studio's data folder. - All add-on routes and assets stay behind the Studio's access-key, trusted-network and write-origin checks (see [[concepts/launching-updating-and-access]]). ### A CLI agent The server module can call: ``` addon.agent(id, label, command, ask=..., argv=..., read=..., session=True, signin=..., hints=...) ``` - The id must be new. - The executable is found on the same PATH as built-in CLIs, or through the existing remote CLI setting. - Installation and sign-in happen in the agent's own terminal; `signin` explains them. - `hints` is a list of `(error regex, message)` pairs; a message may use `{where}`. - The Studio's Agent, Connect and Brain menus include the backend automatically. ## Key Parameters | Item | Value | |---|---| | Opt-in | `STUDIO_ADDONS=1`, set before the Studio starts | | Location | `/addons//` | | Route prefix | `/api/addons/` | | Asset prefix | `/api/addons//assets/` | | Asset types | `.js`, `.css`, `.svg`, `.png` | | Room groups | `apps`, `engines`, `agent`, `vaults` | | Folder name | lowercase letters, digits, `_`, `-`; begins with a letter; up to 48 characters | ### Agent callbacks | Callback | Signature | Contract | |---|---|---| | `ask` | `ask(tool, host, system, prompt, tier, model, timeout)` | Returns one text answer for writing assistance. Use `agents.run_cli` with its supplied timeout; do not wait indefinitely in a request handler | | `argv` | `argv(task, tool, config_path, servers, system, session)` | Returns an argument list, never a shell string. Supply together with `read` for a harness | | `read` | `read(line, task)` | Turns each stdout line into displayed text and updates `task['reply']`; it may add working steps | | `session=True` | | A successful turn retains `task['_session']['id']`, assigned by `read`, for the next turn's `session` argument. Leave it off for stateless adapters. A cancelled or failed turn does not replace the conversation's session | `servers` and `config_path` contain only this turn's chosen MCP tools, including Studio, whose render calls use the normal job queue and memory admission (see [[concepts/mcp-server]]). A harness runs through the existing agent worker and stream runner: the same task queue, working folder, attachments, timeout, cancellation and output collection. It must honor the supplied working folder, selected MCP tools and system instructions, as the built-in adapters do. ## When To Use - You keep a fork with your own room, tab or agent backend and want upstream merges to stop conflicting in the app's lists. That was the case that led to the feature: a team merging 4.4.1 found nearly every conflict in the lists where the app names its rooms, tabs and agents (`index.html`, `shell.js`, `agent.js`, `machine.js`, `slate.js`, `server.py`, `agents.py`). - You want a CLI agent of your own in the Agent room and the Brain menus. - You want a route that queues jobs through the Studio's own queue. For a translated interface, use the separate language hook: the add-ons guide says the language hook and translation dictionaries are separate from this interface. Local languages are covered on [[concepts/local-brains]]. ### History Add-ons were proposed in issue #241, which is closed as completed (2026-11-16). The reply accepting it asked for two pull requests (the add-on loader first, the language hook second), off by default and local only, with the server module described plainly as code the operator installed. The closing comment says both parts are on main: the add-on loader (#275, on with `STUDIO_ADDONS=1`) and the language hook (#276), and that with no add-ons folder and no language file the app behaves as before. The issue attaches no release number to the feature. ## Risks & Pitfalls - **Not a sandbox.** The guide calls the agent interface a trust contract, not an OS sandbox; arbitrary operator-installed Python could bypass it. Do not install an untrusted add-on. The agent instructions say the same: treat add-on modules as operator-installed code, never as a sandbox. - **No secrets in the folder.** Like the rest of the Studio's data folder, an add-on's files can be read through `/files/` by anyone who holds the access key. - **WebSockets and mounted child applications are not supported.** - **An invalid add-on is logged and skipped**; other add-ons and the built-in app continue. If an add-on does not appear, read the log. - **A server module change needs a restart.** - **Do not render beside the queue.** A route that starts its own renderer, loads models or runs ComfyUI skips the memory admission. - **Built-in ids cannot be replaced**, and an agent id must be new. ## Related Concepts - [[concepts/agent-rules]]: the rules that also bind add-on code - [[concepts/mcp-server]]: the Studio tools an add-on agent is handed - [[concepts/memory-guard-and-job-queue]]: the admission `addon.queue` goes through - [[concepts/launching-updating-and-access]]: the access key behind every add-on route - [[syntheses/issues-casebook]]: the proposal among the closed issues ## Sources - `raw/github_doc-docs-addons-md.md`: the opt-in, folder layout, client and server examples, agent interface, limits - `raw/github_issue-proposal-add-ons-a-room-a-tab-or-an-agent-without-editing-th.md`: the problem that led to add-ons, the conditions set, the pull requests that landed it - `raw/github_doc-agents-md.md`: the instruction to treat add-on modules as operator-installed code and render through the queue --- title: "Rules for Coding Agents (AGENTS.md and STUDIO-AGENT.md)" type: concept tags: [agents, memory, job-queue, contributing, benchmark] created: 2026-11-19 updated: 2026-11-19 confidence: medium sources: ["raw/github_doc-agents-md.md", "raw/github_doc-studio-agent-md.md", "raw/github_doc-scripts-agent-bench-readme-md.md", "raw/github_doc-readme-md.md", "raw/github_doc-docs-memory-guard-md.md", "raw/github_doc-security-md.md", "raw/github_issue-proposal-add-ons-a-room-a-tab-or-an-agent-without-editing-th.md"] --- # Rules for Coding Agents (AGENTS.md and STUDIO-AGENT.md) ## Definition Two files in the repository instruct coding agents (Claude Code, Codex, Hermes and others): - **`STUDIO-AGENT.md`**: short rules for an agent that *operates* on a machine where the Studio runs. It carries skill frontmatter (`name: imagination-studio`). The one-shot setup places it in the Studio's folder and, where Claude Code is set up, as the skill `~/.claude/skills/imagination-studio/SKILL.md`. - **`AGENTS.md`**: the long file for an agent that installs the Studio for a person or *changes the repository*. It opens with the install one-shot, then lists rules, most of them tied to a named file or constant. `scripts/agent-bench` is a separate harness that measures how well an agent drives the Studio. Described here from main as fetched 2026-11-19 (VERSION 4.5.0). ## How It Works ### Operating a Studio: the six rules of STUDIO-AGENT.md The Studio runs at `http://127.0.0.1:7870` (or `$STUDIO_URL`). **1. Every render and processing task goes through the Studio.** - Do queue work through the MCP server (`queue_clip`, `queue_still`, `queue_voice`, `queue_song`, `queue_sound`, `queue_edit`, then `wait_for_jobs`; see [[concepts/mcp-server]]), or through the HTTP API: `POST /api/jobs` with `{"kind": "video", "title": "...", "params": {...}}`, then `GET /api/jobs/` until `status` is `done`. Its `outputs` are Library paths, served at `/files/`. - Do not run the render scripts (`scripts/*.sh`, `spark/*.py`, `h3_generate.py`), start a second ComfyUI, or load the Studio's models in a Python session of your own. - Reason given: only the queue checks a job's measured memory peak, unloads its own idle modules, runs one heavy job at a time and keeps a memory floor. On a DGX Spark one run outside it OOM-rebooted the machine, and another hung hard for 50 minutes with an LLM server, the video worker and the app resident together. **2. Check the headroom before starting a model server of your own.** ```bash curl -s http://127.0.0.1:7870/api/memory # MCP: memory_status ``` Read `headroom_mb` (available memory less the floor), `modules` (what the Studio has loaded, and which are idle), `others` (the largest other programs, GPU programs first) and `events`. - Do not start an LLM server, a training run or any big model while a Studio job renders (`GET /api/jobs` shows a job with `"status": "running"`), nor when it would leave less than the next job needs. - A job that does not fit waits up to two minutes for memory, then is refused with your process named in the message. - Stop your own server when you are done with it. **3. Ask the Studio to give memory back.** ```bash curl -s -X POST http://127.0.0.1:7870/api/memory/release -H 'Content-Type: application/json' -d '{}' curl -s -X POST http://127.0.0.1:7870/api/memory/release -H 'Content-Type: application/json' -d '{"modules": ["bolt"]}' ``` MCP: `release_memory`. Modules: `voice` (Fish Audio Drama 3), `music` (the song engines), `comfy` (the Studio's ComfyUI and its cached models), `bolt` (the Bolt brain). The module a running job uses is never unloaded, and nothing the Studio did not start is ever stopped by it. **4. Heat: leave cooling gaps, never bypass the gate.** - The Studio holds every GPU job until the machine has cooled, for up to five minutes; progress reads `Cooling the GPU: 78 °C → 70 °C`. - Queue a batch and let the queue pace it. When queuing clips one by one, leave a cooling gap (a minute) between them. Do not start GPU work of your own while a job waits at "Cooling". - Never set `STUDIO_THERMAL_GATE=off`, raise the thresholds, or render outside the Studio to get around a wait. - `GET /api/memory` has `thermal`. **5. The machine guard.** The one-shot setup installs `scripts/memguard.py` as a per-user service. `python3 scripts/memguard.py status` says whether it is installed; `python3 scripts/memguard.py uninstall` removes it. It stops a person's own model servers only if they opted in with `--stop-foreign`. Details: [[concepts/memory-guard-and-job-queue]]. **6. More than one NVIDIA card.** One Studio manages up to four cards. Set it up through the Studio, never beside it: no second Studio, ComfyUI or `CUDA_VISIBLE_DEVICES` launcher for another card. See [[concepts/other-nvidia-gpus]]. **Access key.** If the Studio answers `401`, send `X-Studio-Key: ` from `~/ImaginationStudio/access-key`. From the computer itself none is needed. ### Installing for a person (AGENTS.md) AGENTS.md gives a seven-step Mac procedure; the install pages own the detail ([[concepts/install-mac]], [[concepts/install-dgx-spark]]). The parts that are rules for the agent: - Check the machine first and stop and report if memory or disk falls short. - Tell the person the download sizes and licences before starting (see [[concepts/licensing-and-attribution]]). - Install Homebrew only with the person's agreement. - Do not set `HOST=0.0.0.0` unless the person asks to reach the Studio from other machines. - Tell the person the machine memory guard is installed and that `--memguard-stop-foreign` lets it stop their own model servers (off by default). - Do not sign, notarize or redistribute the built app. Do not move the clone afterwards without rebuilding the app. ### Changing the repository (AGENTS.md) AGENTS.md has no separate section on repository layout or pull requests. Its contributor rules are these. **Hard rules, in bold in the file** | Rule | Enforced by | |---|---| | No personal information, ever: no real email, phone number, address, account name, private IP, host name, tailnet name, key or token in a file or in a commit's author, committer or trailer. Commit with a GitHub noreply address. In examples use stand-ins (`example.invalid`, `/Users/you`, `192.168.1.10`, `tail1234.ts.net`) | `tests/test_no_personal_info.py` and the workflow's commit check | | Anything the repo or the Studio uses is credited in CREDITS.md in the same change that brings it in, and the maker is named in the page's Credits list (`app/static/settings.js`) | `tests/test_credits.py` | | Authors only, no credit hyperlinks, except the link to Motion Previs Studio | | | People reach the project through GitHub only: Issues, Discussions, and private vulnerability reporting (`SECURITY.md`). No email address is published | | **Recurring conventions** - **Measured constants change only with new measurements.** Named examples: `ESTIMATES`, `MEASURED_ROWS`, `MEASURED_PIXELS`, `NEED_GB`, `RESIDENT_GB`, `MAC_PEAK_GB`, `SOUND_ESTIMATE`, the thresholds in `app/shot.py`. - **Do not lower the memory floor to make a job fit.** Raise Spark limits only by measuring from below on a worker Spark, in small steps, under a second watchdog that kills your own server at 25 GB available; never on a machine with `vm.panic_on_oom=1`. - **The access key** lives only in `/access-key` (0600): never in a job's params, a log, a saved URL, a report or the repo. Never turn `STUDIO_TRUST_TAILNET` or `STUDIO_TRUST_NETWORKS` on by default. - **Licence hygiene.** Never copy ComfyUI source (GPL-3.0) into this Apache-2.0 repo: call its methods. Do not redistribute weights. Never call Fish Audio's cloud API. - **Pins stay pinned.** mflux, minimax-h3-mlx, flux3-mlx, TensorFold's music3-mlx, MMAudio and ComfyUI-MMAudio are pinned by commit: do not unpin. Never commit the native engine binary. - **Prompts.** Never rewrite the user's prompt, and do not add "no X" lines to prompts the app writes. - **Windows.** RTX Spark N1X on Windows is native only; never add a WSL version back or send a job to WSL. Never run a Linux script there. Never use `os.kill(pid, 0)` on Windows. - **Process ownership.** Never kill a process merely because its port, GPU or PID matches. - **Evidence.** Never present simulations as hardware measurements, and do not fabricate passed qualification evidence. - **Request handlers.** Nothing a request handler calls may run a tool without a time limit (`tests/test_api_answers.py`). - **Manual UI verification** uses the user's real running app; do not start alternate or hidden app instances or rerun expensive model qualifications unless asked. **Tests the file names** | Test or tool | Holds | |---|---| | `tests/test_no_personal_info.py` | no personal information in the repo | | `tests/test_credits.py` | CREDITS.md and the page's Credits list | | `tests/test_slate_page.py` | the Slate page code, run in node | | `tests/test_api_answers.py` | time limits in request handlers | | `tests/test_windows_cuda.py` | Windows installer pins in step with the Spark scripts | | `python3 scripts/studio-check.py` | queues the jobs each tab queues on a running app; writes `report.json` and `report.md` | | `scripts/studio-check-ui.cjs` | opens every tab and clicks every button with writes blocked | Actual hardware probes in tests require `STUDIO_TEST_HARDWARE=1`. **Pull requests.** The one statement of pull-request expectations in the cited files is the reply that accepted the add-ons proposal (issue #241, closed), which applied to those two pull requests: each small, with its tests; off by default and local only, so that with no add-ons folder and no language file the app behaves as before; a screenshot of the language switch in Settings helps, because the owners review every visible change; commits with a GitHub noreply address. ### agent-bench `scripts/agent-bench` scores an agent driving the Studio from the Agent room: 38 briefs a filmmaker would type, each with a spec a machine can check. ```bash python3 scripts/agent-bench/bench.py --endpoint http://127.0.0.1:8091 --label bolt # all briefs, dry run python3 scripts/agent-bench/bench.py --only pic-one,slate-render --label quick python3 scripts/agent-bench/bench.py --env STUDIO_LOCAL_AGENT=baseline --label plain # the harness without its method python3 scripts/agent-bench/bench.py --backend claude --label claude # Claude Code with the same tools python3 scripts/agent-bench/bench.py --real --label real # the 'real' briefs, rendered python3 scripts/agent-bench/bench.py --summary ~/agent-bench-runs/*/results.jsonl # the table python3 scripts/agent-bench/bench.py --rescore ~/agent-bench-runs/bolt # after a change to the scoring ``` - Each brief gets a Studio of its own: `dry_studio.py` on `--port` (7896) with a fresh `STUDIO_HOME`, bound to 127.0.0.1. The queue's runner is replaced: a job is marked done after two seconds with small placeholder files. - The brief goes to `POST /api/agent/threads` with the Studio's MCP tools, one brief at a time. - `--app` tests another checkout. `--real` runs `app/server.py` itself and takes the shared GPU lock `~/agent-gpu.lock.d` around each brief. - Briefs live in `briefs.json`. Each run writes `results.jsonl` and keeps turns under `turns/` and each brief's studio folder under `homes/`. - `export_sft.py` turns the exact and honest turns into chats for a LoRA or SFT run (`--clean`: only turns without a refused call). ## Key Parameters | Item | Value | |---|---| | Studio address | `http://127.0.0.1:7870` or `$STUDIO_URL` | | Queue a job | `POST /api/jobs` | | Poll a job | `GET /api/jobs/` | | Memory reading | `GET /api/memory` (`headroom_mb`, `modules`, `others`, `events`, `thermal`) | | Release memory | `POST /api/memory/release`, body `{}` or `{"modules": [...]}` | | Releasable modules | `voice`, `music`, `comfy`, `bolt` | | Wait before refusal | up to two minutes | | Key header | `X-Studio-Key` | ### agent-bench scores | Score | Meaning | |---|---| | complete | every job the spec asks for exists (its kind, its count), and the Slate films and Editor timeline it asks for | | exact | complete, every named setting right, and nothing else queued or made. A setting left out counts as the Studio's default (four candidates, Qwen 2.1 Turbo, FastH3 4 passes) | | honest | the final answer names no file that does not exist, and names everything that was made | | bad calls | tool calls the harness refused | | seconds | the turn's wall time | ## When To Use - Before an agent renders anything on a machine that has the Studio: rules 1 to 4. - Before an agent starts Ollama, llama.cpp, vLLM, a training run or any large model on that machine: rules 2 and 3. - Before an agent opens a pull request: the hard rules and the named tests. - To compare agent backends or local models on Studio tasks: agent-bench. ## Risks & Pitfalls - **A model server beside a render can take the machine down.** Both incidents the files cite were on a DGX Spark. - **A cooling wait is not a hang.** Bypassing it is forbidden; a job refused for heat means let the machine cool, then queue it again. - **`release_memory` frees only what the Studio started.** Your own processes are yours to stop. - **Commit trailers count** as places personal information must not appear. - **AGENTS.md mixes current rules with dated notes.** Its header names a carrier image tag and an engine pin; current engine pins are covered on [[concepts/engine-architecture]]. - **agent-bench dry runs render nothing.** Only `--real` uses the models. ## Related Concepts - [[concepts/mcp-server]]: the tools rule 1 points to - [[concepts/memory-guard-and-job-queue]]: admission, the floor, the thermal gate and `memguard` - [[concepts/add-ons]]: operator-installed code under the same queue rule - [[concepts/licensing-and-attribution]]: the licence statements agents must make - [[concepts/troubleshooting]]: refusals and their fixes ## Sources - `raw/github_doc-studio-agent-md.md`: the six operating rules, API calls, modules, heat and key notes - `raw/github_doc-agents-md.md`: the install procedure, contributor rules, named tests and constants - `raw/github_doc-scripts-agent-bench-readme-md.md`: the benchmark's commands, set-up and scoring - `raw/github_doc-readme-md.md`: the summary of the agent rules - `raw/github_doc-docs-memory-guard-md.md`: where the install places STUDIO-AGENT.md and the Claude Code skill - `raw/github_doc-security-md.md`: GitHub-only contact, which AGENTS.md refers to - `raw/github_issue-proposal-add-ons-a-room-a-tab-or-an-agent-without-editing-th.md`: the pull-request expectations stated in the accepting reply --- title: "Command-Line Recipes (Mac/Linux Shell)" type: concept tags: [cli, shell-scripts, mac, linux, environment-variables, prompts] created: 2026-11-19 updated: 2026-11-19 confidence: medium sources: ["raw/github_doc-docs-cli-md.md", "raw/github_doc-readme-md.md", "raw/github_doc-studio-agent-md.md", "raw/github_doc-agents-md.md", "raw/github_doc-scripts-image-sh.md", "raw/github_doc-scripts-video-sh.md", "raw/github_doc-scripts-edit-sh.md", "raw/github_doc-scripts-fast-sh.md", "raw/github_doc-scripts-scout-sh.md", "raw/github_doc-scripts-turnaround-sh.md", "raw/github_doc-scripts-studio-sh.md", "raw/github_doc-prompts-readme-md.md", "raw/github_doc-prompts-baker-image-txt.md", "raw/github_doc-prompts-baker-video-txt.md", "raw/github_doc-prompts-baker-long-speech-txt.md", "raw/github_doc-prompts-black-mirror-scene-txt.md", "raw/github_doc-prompts-singer-image-txt.md", "raw/github_doc-prompts-singer-video-txt.md", "raw/github_doc-prompts-singer-video-8s-txt.md", "raw/github_doc-docs-user-guide-md.md", "raw/github_doc-docs-engine-notes-md.md", "raw/github_doc-docs-installation-md.md", "raw/github_doc-docs-rtx-spark-n1x-md.md", "raw/github_doc-tutorial-md.md"] --- # Command-Line Recipes (Mac/Linux Shell) ## Definition The repository ships bash render scripts under `scripts/` (`image.sh`, `video.sh`, `edit.sh`, `fast.sh`, `scout.sh`, `turnaround.sh`, `studio.sh`) and documents them in the command-line guide (`docs/cli.md`). This page covers main as fetched 2026-11-19 (VERSION 4.5.0). **These are Mac/Linux shell commands, not Windows commands.** The command-line guide opens by saying these are "**Mac/Linux shell commands**, not Native Windows commands", and that Windows uses PowerShell setup and the app. The README repeats that the shell recipes "are not native Windows commands". On native Windows the Studio's jobs run Python ports of the scripts (`spark/windows_scripts.py`: scripts/video.sh, studio.sh, scout.sh, image.sh, edit.sh, and a turnaround port) instead of bash; see [[concepts/install-windows-rtx-spark]]. ### What the README says about renders going through Studio The README states that every render and processing task runs through Imagination Studio: "its page, its job API or its MCP tools", and "never the render scripts or a separate ComfyUI started beside it." Its reason: only the Studio's queue checks a job's measured memory peak, unloads its own idle modules to make room, waits and then refuses when other programs hold the memory, and keeps a floor under the render. STUDIO-AGENT.md tells agents the same: do not run the render scripts (`scripts/*.sh`, `spark/*.py`, `h3_generate.py`, ...) yourself, and it records that on a DGX Spark one such run OOM-rebooted the machine. How the two relate, as far as the sources say: the user guide says "The app drives the same scripts as the command line, one job at a time on each machine". So the scripts are what the queue runs; the command-line guide and the tutorial's section "Without the app" document calling them directly; the README and STUDIO-AGENT.md say a render should not be started that way beside a running Studio. The sources do not reconcile these statements with each other. For an agent the working rule is the README's: queue work through [[concepts/mcp-server]] or the job API, and treat this page as the reference for what each job's script does and which variables it reads. See [[concepts/agent-rules]] and [[concepts/memory-guard-and-job-queue]]. ## How It Works On Linux (a DGX Spark, CUDA) `image.sh`, `video.sh` and `edit.sh` hand over at once to `spark/image.sh`, `spark/video.sh` and `spark/edit.sh`, which serve "the same interface". The defaults and engine notes below are from the Mac branch of each script. A prompt can come from a file with `PROMPT_FILE` (pass `""` as the prompt). ### `scripts/image.sh`: one picture ```bash bash scripts/image.sh "a prompt" out.png TURBO=0 bash scripts/image.sh "..." out.png # 40 steps, base model WIDTH=2048 HEIGHT=2048 bash scripts/image.sh "..." out.png # sizes in multiples of 16 IMAGE_MODEL=flux3k-fast bash scripts/image.sh "..." out.png # FLUX3-K Fast, 16 steps (oneshot-setup.sh --flux3) IMAGE_MODEL=flux3k-full bash scripts/image.sh "..." out.png # FLUX3-K Full, 50 steps at CFG 3.5 IMAGE_MODEL=flux3k-fast UPSAMPLE=0 bash scripts/image.sh "a full scene caption ..." out.png # no prompt upsampler IMAGE_MODEL=qwen-full bash scripts/image.sh "a prompt" out.png # Qwen 2.1 Full: the base model, 40 steps at CFG 4 IMAGE_MODEL=moss-image bash scripts/image.sh "a prompt" out.png # MOSS-Image, 25 steps (oneshot-setup.sh --moss) IMAGE_MODEL=h3-image bash scripts/image.sh "a prompt" out.png # MiniMax-H3-Image, 6 steps (oneshot-setup.sh --h3-image) ``` Arguments: prompt, output file (default `outputs/image.png`). | Variable | Meaning | |---|---| | `IMAGE_MODEL` | `qwen` (default), `qwen-full`, `flux3k-fast`, `flux3k-full`, `moss-image` or `h3-image`; anything else exits with status 2 | | `TURBO` | `0` runs the base model, 40 steps (needs `QWEN_BASE_DIR`) | | `STEPS` | base model only, default 40 | | `QWEN_CFG` | base model only, default 4; 1 runs it without guidance | | `WIDTH`, `HEIGHT` | default 1344 and 768; multiples of 16 (MiniMax-H3-Image: steps of 32) | | `SEED` | default 0 | | `PROMPT_FILE` | read the prompt from a file | | `UPSAMPLE` | `0` skips FLUX3-K's prompt upsampler | | `NEGATIVE` | MOSS-Image: replaces the template's negative prompt | | `EXTRA` | extra flags | | `PREFIX` | install folder, default `$HOME/.local/opt/tensorfold-studio` | | `QWEN_MODEL_DIR` | default `$HOME/qwen-models/Qwen-Image-2.1-Turbo` | | `QWEN_BASE_DIR` | Qwen-Image-2.1, default beside `QWEN_MODEL_DIR` | | `FLUX3_MODEL_DIR` | default `~/flux3-models` | | `TURBO_ADAPTER` | the Viggle turbo adapter file, for an install from before 2.3 | ### `scripts/scout.sh`: several candidates and a contact sheet ```bash bash scripts/scout.sh "what the picture shows" [count] [folder] PROMPT_FILE=prompts/baker-image.txt bash scripts/scout.sh "" 6 scouts/baker ``` Arguments: prompt, count (default 4), folder (default `outputs/scout`). It writes `/scout_s.png` and `/sheet.jpg` from one model load. Seeds run from `SEED` (default 1) upwards. The default size is 1280x736 (`WIDTH`, `HEIGHT`), "what the video model starts from for a 2560x1440 clip". It takes everything `scripts/image.sh` takes. Then animate the pick: ```bash IMAGE_FILE=/scout_s3.png QHD=1 bash scripts/studio.sh "" "what happens in the clip" out.mp4 ``` ### `scripts/edit.sh`: edit a picture ```bash bash scripts/edit.sh photo.png "The same statue at night under a full moon" night.png LORA=~/ImaginationStudio/loras/qwen-multiple-angles.safetensors:0.9 \ bash scripts/edit.sh photo.png " right side view, high-angle shot" side.png SET_FILE=edits.json bash scripts/edit.sh photo.png # several edits from one load (file format below) BASE=1 bash scripts/edit.sh photo.png "..." out.png # 40 steps, base model (--image-edit) IMAGES="person.png" bash scripts/edit.sh room.png "The person of image 2 sits on the sofa of image 1" out.png # up to nine more, one a line SIZE=model RESOLUTION=1024 bash scripts/edit.sh photo.png "..." out.png # the model's own size; the default is the picture's own IMAGE_MODEL=flux3k-fast IMAGES="person.png" bash scripts/edit.sh room.png "..." out.png # FLUX3-K Fast (flux3k-full: Full), --flux3 ``` Arguments: the picture, the prompt, the output file. | Variable | Meaning | |---|---| | `IMAGE_MODEL` | `qwen` (default), `flux3k-fast`, `flux3k-full` or `h3-image`. FLUX3-K and MiniMax-H3-Image take no `LORA` and no `BASE` | | `BASE` | `1`: the 40-step base model at `QWEN_BASE_DIR` (what image LoRAs are trained on) | | `STEPS` | base model only | | `SEED` | default 0; the noise is drawn for `SEED` and the pictures together | | `IMAGES` | up to nine further pictures, one path a line: image 2, image 3, ... | | `SIZE` | `source` (default: the picture's own size) or `model` (about `RESOLUTION` pixels squared, default 1024, keeping its shape) | | `WIDTH`, `HEIGHT` | another size for the result | | `LORA` | one `PATH` or `PATH:STRENGTH` a line | | `SET_FILE` | several edits from one load: a JSON file holding a list of two-item lists, each a prompt and its output file (`"prompt", "out.png"`) | | `QUANTIZE` | bits for the weights on a Mac: 8 on a Mac under 96 GB; unset keeps bfloat16 (43 GiB at its peak with one picture) | | `MOST_PIXELS` | with `SIZE=source`, the most pixels an edit is made at; unset is 1536x1536; the app sets 1280x1280 on a Mac under 96 GB | | `UPSAMPLE` | `0`: FLUX3-K takes the prompt as written | | `PREFIX`, `QWEN_MODEL_DIR`, `QWEN_BASE_DIR`, `FLUX3_MODEL_DIR` | as for `image.sh` | ### `scripts/video.sh`: one clip ```bash bash scripts/video.sh "A hummingbird hovering over red flowers, soft wing hum" out.mp4 FIRST_FRAME=photo.jpg WIDTH=1344 HEIGHT=768 bash scripts/video.sh "She turns to the camera and smiles" out.mp4 QUALITY=high bash scripts/video.sh "..." out.mp4 # 20 steps, no adapter FIRST_FRAME=teapot.png LAST_FRAME=bonsai.png bash scripts/video.sh "The teapot opens and a bonsai grows out of it" out.mp4 LAST_FRAME=bonsai.png bash scripts/video.sh "A potter's table; a bonsai is set down" out.mp4 # arrives at the picture REF_IMAGES="face.jpg bike.png" bash scripts/video.sh "Use as the person and as the bicycle. ..." out.mp4 REF_TURBO=1 REF_IMAGES="face.jpg" bash scripts/video.sh "Use as the person. ..." out.mp4 # 4 passes REF_VIDEOS="baker.mp4" REF_VIDEO_SOUND=1 bash scripts/video.sh "..." out.mp4 # the video's own sound is