Skip to main content
Glama
README.md
<img src="app-icon.png" width="96" alt="">

# Prospero's Hoard

A local media studio that drives your ComfyUI, ffmpeg and a local text-to-speech engine to make consistent characters, photocards, album art, music videos and narrated shorts, by hand or entirely over MCP.

[Español](README.es.md) · [Quick start](#quick-start) · [Connect to Faustus](#connect-it-to-faustus) · [MCP reference](docs/MCP.md) · [Voice studio](docs/VOICE.md)

![Generate screen: two cast members mentioned with @, the final prompt with their look inlined, the parameter panel and earlier results](docs/media/01-generate.png)
*Actual application, synthetic demo data. Every picture comes from the bundled demo backend, a procedural stand-in for ComfyUI that draws labelled placeholder scenes; with your ComfyUI connected the same screens show real model output.*

## What it is

Prospero brings image, audio and video production into one workspace. It keeps the cast, media, jobs and edits together so a person or an agent can pick up a production where it left off.

Generation and rendering run as queued operations with recorded recipes. `@Name` inserts a cast member's description into a prompt, generated assets retain their settings and inputs, and songs can be analysed and cut on the beat with ffmpeg.

The studio uses FastAPI, React, SQLite, and CPU and GPU workers. Hoard Link resolves media backends such as ComfyUI, Faustus TTS and Piper. Features that need a language or vision model use the global model configured in [Faustus](https://github.com/Luissalet/Faustus). The Generation and Editing clients offer English and Spanish. The common projects and modules page is in Spanish.

Typical uses:

- An independent musician imports a finished single, lets the beat tracker find tempo and sections, times the lyrics, and gets a cover, a lyric card and a 9:16 video cut on the beat.
- A writer or game designer sets a look prompt and a canonical reference for each character, then uses `@Iris` and `@Mika` to guide their likeness across shots.
- A local model in Faustus asked for "a teaser for the single" calls the studio tools, gets short ids back and looks at a picture only when it asks for one.
- Someone who explains things types a topic and gets a narrated vertical short: script, voice-over, word-by-word captions, stock or generated pictures and a music bed that ducks under the voice.
- A ComfyUI user imports their own UI-format workflow, gets it converted and checked against the live node list, and generates with it from then on with lineage.

## What it does

**Projects and cast**
- Receive production dossiers as drafts with the original context, approved references and details to preserve.
- Projects, characters (look prompt, negative, palette, canonical reference, voice), places and objects, ordered groups and style presets.
- `@Name` mentions match multi-word names and report unknown ones; a mentioned place or object with an image goes into the render as a numbered reference on Qwen-Image 2.1.
- Character kit: a model sheet redrawn from up to 12 set views, with retries resuming the missing views, a captioned training dataset with a readiness report, local LoRA training through a configurable trainer, identity-scored takes, portable `.hoardchar` packs and a global casting library with versions.

**Images**
- Workflows for Qwen-Image 2.1 (txt2img, edits with 1–10 references and draft keys guided by depth and identity), FLUX.1 schnell, FLUX.1 Kontext edits, SDXL (img2img, inpaint and two-pass hires fix) and SD 1.5. For automatic engine selection, `auto` checks for Qwen-Image 2.1, then the FLUX workflow for the operation, and falls back to the SDXL workflow. Results identify the engine used.
- Regional image edits use Qwen references or project existing artwork in perspective. The mask and receipt let you verify every exterior pixel. [Regional editing guide](docs/regional-edit.md).
- Depth-guided draft keys preserve prop silhouettes with transparent layers and repaint declared hand contacts. A paper layer can use a reference drawing lit to match the scene. Identity review compares each draft with the character sheet and retries below-threshold results within a set limit.
- Model upscale (x2 or x4), background removal to a transparent PNG, pose and depth maps, outpainting onto a larger canvas, reframing any picture or clip to 9:16, 16:9, 1:1, 4:5, 2:3, 3:2 or 21:9 without regenerating.
- Import your own ComfyUI workflows with preflight: node classes and model files are checked and missing ones are listed with the folder they belong in.

**Video**
- Image-to-video with Wan 2.2 (TI2V 5B, I2V 14B), SVD and LTX 2.3 (with optional 2x refinement and structure control); motion transfer, lip sync (speech and long singing), first-last-frame clips.
- Retake a stretch of a clip (Wan VACE), edit a whole clip from an instruction, smooth clips to a higher frame rate, review motion with technical checks and an optional vision model.
- Node canvases (Spaces) with typed, coloured connections for pictures, clips, songs, cast, layers and assistants, undo and a docked node library. Mark inputs and outputs to run a graph as a form, or export the graph as a reusable technique.
- Graphic shots drawn by code (title card, kinetic lyrics, lower third, outro card), Manim scenes, HTML animations exported to H.264 with generated sound, QR films, promo videos from a web page, and website walkthrough recordings.
- Explanatory videos with scenes, narration and imported diagrams; image composition with object and text boxes.

**Audio and voice**
- Import of mp3, wav, flac, ogg and m4a, waveform, own beat tracker with downbeat and section estimates, LRC lyrics with timing tools, stem separation (vocals, drums, bass, other, instrumental).
- Song composition with ACE-Step 1.5 on ComfyUI, or another local server through a small HTTP API.
- Voice studio with a pluggable engine registry (Piper, Coqui XTTS-v2, F5-TTS, Kokoro, Chatterbox, KittenTTS, VoxCPM2, Yovoice, a ComfyUI TTS workflow), voice cloning from a sample you provide, speech-to-text, audiobooks, dubbing with timing plan and quality check, and word-level retakes of a voice line. See [docs/VOICE.md](docs/VOICE.md).

**Design**
- Pillow renderer without a browser: photocard fronts and backs, album covers (four layouts), teaser posters, lyric cards, tracklist backs and thumbnails, with a night variant, foil, gradients and shrink-to-fit text; photocard sets for a whole group or a solo artist.
- Style cards (look, technique, palette, motion, signature transition, pitfalls) with built-in and imported directions.

**Productions**
- Scene video from a dossier and character sheet, with generated or supplied shots, first/middle/last continuity review, individual retakes and an assembled cut with per-shot provenance. Registering a take or an extracted frame on an order carries over its registered recipe inputs as material.
- A whole music video as one resumable, checkpointed production: lead and reference sheet, song, stills, lyric timing, clips, photocards, album art, the cut and its renders, plus a report. Changing shots redoes only what depends on them.
- Treatment-first mode (logline, structures, shot list, beat sheet) before anything renders; an animatic of the stills cut like the final before expensive clips; a QA director that checks flat or noisy stills, edge bands, exposure jumps, frozen clips and lyric coverage; a continuity bible with segment repair.
- Recipes: turn a finished production into a template with a `{lead}` slot and recreate it with another character.
- Narrated shorts from a topic or a script, with Pexels and Pixabay stock footage (free API key per provider) imported with its credit.
- Director: an idea becomes a narrated film with an editable shot list. Each shot records its narration, first-frame description, action, framing and camera move. Shared direction covers genre, lens, lighting, film stock, look and colour grade, with period looks from 1960 to 2020 and 28 motion and effect presets. Generate one or more stills per shot and animate shots with LTX 2.3 or Wan 2.2. Supported workflows can end a clip on the next shot's still. The cut combines narration with music when there is a track, captions timed to the voice when they are enabled, and an optional whoosh on each cut. Shot edits can be rendered individually.

**Timeline and editing**
- Beat-synced auto-cut into an editable timeline, ffmpeg renderer with Ken Burns moves, transitions that keep cuts on the beat, lyric captions, colour grade and finishing effects, and a Spotify Canvas loop.
- Video enhancement of saved clips on a spare GPU (`media_enhance`, `clip_enhance`, `enhance_benchmark`): noise reduction, upscaling, sharpening, frame-rate interpolation and HDR10, with the cost per frame measured.
- Declarative edit plans compiled to ffmpeg steps, delivery checks and contact sheets. Export a cut as FCP7 XML and EDL or transfer it to Prospero's Editing module. Editing also provides multitrack timelines, multicam, subtitles, transcript-based cuts and revision-checked timeline text.
- The common workspace transfers a generated cut into an editing project and records the source and destination revisions. See [docs/STUDIO.md](docs/STUDIO.md).

**Control and safety**
- Lineage records settings and inputs for generated assets. “Reuse recipe” runs the recorded settings again and “Vary seed” changes the seed.
- Workflow VRAM estimates and render pools use the physical GPU for each backend. Jobs that cannot be admitted can wait in `waiting_gpu` with a reason. The header shows GPU, VRAM, temperature, RAM and CPU.
- Trash can restore deleted assets and projects. Backends shows which backends were resolved, and Assistant activity shows logged Generation agent calls.

## Models

Nothing is bundled. Prospero uses whatever is installed in your ComfyUI and reports what is missing.

| Family | Used for |
| --- | --- |
| Qwen-Image 2.1 (int8) | Prompt-guided images, in-image text, multi-reference identity |
| FLUX.1 schnell / Kontext dev | Fast drafts / single-reference edits |
| SDXL, SD 1.5 | Image workflows using installed checkpoints, including low-VRAM drafts |
| Wan 2.2 (TI2V 5B, I2V 14B, S2V, Animate, Fun VACE, Bernini-R), Wan 2.1 InfiniteTalk, SVD, LTX 2.3 | Image-to-video, lip sync, motion transfer, retakes, clip edits |
| ACE-Step 1.5 | Song composition with vocals |
| Real-ESRGAN x4, BiRefNet | Upscaling, background removal |
| SDPose whole body, Depth Anything 3 | Pose and depth maps |

Workflow preflight shows where each file goes under ComfyUI's `models/` folder. See [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md). VRAM requirements depend on the workflow, hardware and settings.

## Quick start

Requirements for a source checkout include Python 3.11+ (3.13 recommended) and Node.js 22.13+ for both clients. Install ffmpeg and ffprobe for media features. `imageio-ffmpeg` provides a fallback for ffmpeg. Model-backed generation uses a configured backend such as ComfyUI. `--demo` uses a procedural substitute for ComfyUI. See [docs/STUDIO.md](docs/STUDIO.md) for optional editing engines, analysis and browser rendering.

```
git clone https://github.com/Luissalet/ProsperosHoard.git
cd ProsperosHoard
```

**Windows.** Double-click **`Iniciar Prospero's Hoard.cmd`** or run `scripts\start.ps1`. The launcher sets up `.venv`, installs the pinned dependencies and the package in editable mode, builds both clients when needed and opens http://127.0.0.1:8815. **`Detener Prospero's Hoard.cmd`** stops the app. Manual steps follow.

```powershell
python -m venv .venv
.venv\Scripts\python.exe -m pip install -r requirements-lock.txt
.venv\Scripts\python.exe -m pip install -e . --no-deps
.venv\Scripts\python.exe scripts/build_studio_assets.py
.venv\Scripts\python.exe -m prosperos_hoard            # real data in .\data
.venv\Scripts\python.exe -m prosperos_hoard --demo     # demo data in .\data-demo
```

**Linux / macOS.**

```bash
python3 -m venv .venv
.venv/bin/python -m pip install -r requirements-lock.txt
.venv/bin/python -m pip install -e . --no-deps
.venv/bin/python scripts/build_studio_assets.py
.venv/bin/python -m prosperos_hoard --demo --no-browser
```

Use `--port` to change the default port (8815), `--data-dir` or `PROSPERO_DATA_DIR` to select a data directory, and `--no-browser` to skip opening a tab. A source checkout defaults to `data/` and `--demo` defaults to `data-demo/`. An explicit `--data-dir` takes precedence. `/api/health` reports `"service": "prosperos-hoard"` and module status. `PROSPERO_ALLOWED_HOSTS` adds accepted Host names to the loopback listener.

Generation (`/generation/`) and Editing (`/editing/`) start off. Enable them from **Módulos** on the studio home page. To run the demo, enable Generation. The first activation with an empty demo workspace seeds a five-member group, portraits, stage shots, a cover, photocards, a synthetic 30 s song with timed lyrics and an auto-cut timeline. To use ComfyUI, set its URL in Settings or use the resolver's loopback default at `127.0.0.1:8188`. `PROSPERO_COMFY_TIMEOUT_S` overrides the ComfyUI job timeout.

## Connect it to Faustus

Prospero declares its [Faustus connector](faustus-plugin.json) at port 8815. In Faustus, open **Connectors > Nearby apps > Add** with Prospero running. The manifest starts `python -I -m prosperos_hoard.mcp_server` over stdio using the configured Python. The Faustus button opens the shared copilot with the current project context. Configure Faustus in Settings or `<data-dir>/backend.json`. `HOARD_FAUSTUS_URL` overrides the shared endpoint and `PROSPERO_FAUSTUS_URL` overrides the copilot endpoint.

### MCP tools

Tool discovery works before either module is enabled. Results generally return IDs and summaries. Use `studio_show` to inspect media or `include_image=true` on calls that support image previews. The table highlights common tools. See the [native MCP catalogue](prosperos_hoard/studio_mcp_catalog.json) for registered names and [docs/MCP.md](docs/MCP.md) for call details.

| Group | Tools |
| --- | --- |
| Status and services | `studio_status`, `studio_services`, `studio_service_start`, `studio_service_stop`, `studio_gpu_memory` |
| Projects and cast | `studio_projects`, `studio_create_project`, `studio_project_update`, `studio_delete_project`, `studio_cast`, `cast_import_character` |
| Modules and audiovisual projects | `studio_modules`, `studio_module_set`, `audiovisual_objects`, `audiovisual_projects`, `studio_project_create`, `studio_project_transfer` |
| Images | `studio_generate_image`, `studio_edit_image`, `studio_regional_edit`, `studio_review_character_key`, `studio_outpaint`, `studio_reframe`, `studio_prompt_enhance`, `studio_cinema`, `workflow_preflight` |
| Video and clips | `studio_video_engines`, `studio_animate`, `studio_retake`, `studio_clip_edit`, `studio_interpolate`, `studio_review_clip`, `studio_video_frames`, `studio_spaces`, `studio_graphic_shot`, `studio_graphic_render`, `manim_*` |
| Audio and voice | `studio_compose`, `studio_analyze_audio`, `studio_time_lyrics`, `studio_stems`, `studio_voice`, `voice_*` (engines, create, list, speak, transcribe, audiobook, dub, retake words) |
| Design | `studio_design`, `studio_photocard_set`, `studio_board`, `studio_style_cards` |
| Timeline and render | `studio_timeline`, `studio_render`, `studio_export_timeline`, `studio_canvas`, `studio_style_profile_*`, `studio_production_finishing`, `production_export_lumiere` |
| Productions | `studio_production*`, `studio_scene*`, `studio_video_plan`, `studio_video_from_plan`, `studio_animatic`, `studio_qa_run`, `studio_qa_report`, `studio_recipe_*`, `studio_recipes_list`, `production_from_storyboard`, `production_treatment_draft`, `production_storyboard_sheet`, `studio_short_create`, `studio_director`, `studio_director_catalog`, `studio_stock_search` |
| Dossier handoff | `production_receive_dossier`, `production_discard_dossier`, `studio_register_piece` |
| Plans and continuity | `edit_plan`, `edit_run_plan`, `edit_plan_delete`, `edit_verify`, `edit_contact_sheet`, `continuity_*` |
| Editing module | `timeline_edit`, `timeline_text`, `timeline_apply_text`, `text_cut`, `multicam_*`, `subtitles_*`, `html_motion_*`, `media_enhance`, `clip_enhance`, `enhance_benchmark` |
| Character kit | `studio_character_sheet`, `_dataset`, `_train`, `_adapters`, `_takes`, `_pack`, `_library` |
| Web video | `brand_scan`, `promo_from_url`, `contact_sheet`, `website_walkthrough`, `studio_qr_video`, `studio_qr_verify`, `studio_qr_report`, `studio_explainer`, `studio_spatial` |
| Assets and jobs | `studio_assets`, `studio_show`, `studio_lineage`, `studio_asset_update`, `studio_import`, `studio_download_media`, `studio_delete_assets`, `studio_trash`, `studio_jobs`, `studio_job`, `studio_cancel_job`, `studio_retry_job` |

For a standalone stdio client, use absolute paths to the checkout and its Python environment (`.venv/Scripts/python.exe` on Windows). `PROSPERO_URL` must be a loopback URL and defaults to `http://127.0.0.1:8815`.

```json
{"mcpServers": {"prosperos-hoard": {
  "command": "/path/to/ProsperosHoard/.venv/bin/python",
  "args": ["/path/to/ProsperosHoard/prosperos_hoard/mcp_server.py"],
  "env": {"PROSPERO_URL": "http://127.0.0.1:8815"}}}}
```

The end-to-end procedure an agent follows is in [skills/idol-production/SKILL.md](skills/idol-production/SKILL.md). The app also carries skills from the family library for agents that connect to it.

### The Hoard family

- **Shared agent contract.** `GET /api/agent/tools` lists the HTTP tool catalogue. `POST /api/agent/call` accepts `{name, arguments, reason}` with a Prospero bearer token. Set `PROSPERO_TOKEN` or `PROSPERO_TOKEN_FILE` for the MCP adapter when needed, and `HOARD_AGENT_ID` and `HOARD_AGENT_SESSION` to identify writes. To undo supported Generation writes by session, preview with `POST /api/agent/undo` and `dry_run: true` before confirming. See [accountable agents](docs/MCP.md#accountable-agents) for scopes and exceptions.
- **Shared backends.** Hoard Link resolves ComfyUI and speech backends. Link downloads use Links Hoard with yt-dlp as a fallback. Speech-to-text is a shared family service: the Hub picks its provider (Boltagon's Hoard first, Funes's Hoard still accepted as the older provider) and each transcript says in `via` who made it; without the Hub it runs here. Generation can start a configured ComfyUI service on demand when autostart is enabled.
- **Job events and notices.** Renders, songs, clips and productions emit `prospero.job.*` events; productions that need a take, the animatic or a review notify through the family hub (**Settings > Production notices**: `auto`, `hub` or `off`).
- **GPU lease.** GPU jobs use the Hub lease when available, alongside local VRAM checks. `PROSPERO_GPU_LEASE=0` disables the Hub lease.
- **Cut handoff.** `production_export_lumiere` writes FCP7 XML and EDL. When Prospero's Editing module is enabled, the tool imports the cut as a local editing project and returns its URL for the client to open. The export files remain available if the import fails.

## Characters that stay the same

1. **Canonical**: one good image of the character.
2. **Model sheet**: the canonical redrawn from set views, each landing in the dataset with a caption.
3. **Dataset**: add the best takes, fix captions, watch the readiness report.
4. **Training**. Pick a configured trainer for the rendering engine. Prospero attaches the resulting adapter and loads it for an `@Name` mention when the adapter is enabled, installed and matches the workflow.
5. **Takes**: score identity, keep the good ones, reject drifted ones, promote a better canonical.
6. **Pack / library**: export a `.hoardchar` or save a version to the library and cast it into any project or use it as a recipe's lead.

Training runs a separate trainer program, configured under `training` in `data/backend.json` (`--demo` configures a fake one). Details: [docs/CHARACTERS.md](docs/CHARACTERS.md).

## Screens

![Timeline: shots cut on the beat of the demo song, the lyric captions, the waveform, the rendered preview and the clip editor](docs/media/02-timeline.png)
*Actual application, synthetic demo data: the auto-cut of the 30 s demo song and the preview rendered with ffmpeg.*

![Library lightbox on the photocard set: ten cards and the recipe panel with reuse, vary, upscale and animate](docs/media/03-photocards.png)
*Actual application, synthetic demo data: the photocard set opened in the lightbox with its recipe and inputs.*

![Audio screen: the demo song at 120 BPM with its beat ticks and A/B/A sections, the lyrics timing tool and voice lines](docs/media/04-audio.png)
*Actual application, synthetic demo data: the demo song analysed by the built-in beat tracker, with section estimates and timed LRC lyrics.*

![Spaces: a node canvas](docs/media/05-spaces.png)
*Actual application, synthetic demo data: a space where three sheets feed a frame through its references and the frame starts a draft clip.*

<details>
<summary>A real production: an invented single, from cover to 9:16 and 16:9 cuts</summary>

The example single was composed with ACE-Step, cast with a consistent lead, and produced as a twelve-shot music video with Wan clips, a photocard set, a cover and two cuts.

![Album cover: the lantern head close-up with the title set in Prospero's typographic layer](docs/media/farol/cover.jpg)

<p><img src="docs/media/farol/clip-over-shoulder.gif" width="32%" alt="Wan clip: over the shoulder, standing still under the closer lamp, slow push-in">
<img src="docs/media/farol/clip-lantern.gif" width="32%" alt="Wan clip: the candle flame flickering inside the lantern, raindrops on the paper">
<img src="docs/media/farol/clip-fingers.gif" width="32%" alt="Wan clip: long paper fingers curling over the stairwell rail"></p>

![The best still of each of the twelve shots: the lead is the same creature in every one](docs/media/farol/stills.jpg)

![The photocard set: five idol looks, fronts and backs](docs/media/farol/photocards.jpg)

![Frames of the 9:16 cut with the horror karaoke captions](docs/media/farol/cut-9x16.jpg)

![Frames of the 16:9 cut: the story follows the lyric, section by section](docs/media/farol/cut-16x9.jpg)

</details>

## Privacy and security

The app listens on `127.0.0.1` and checks `Host` and `Origin`. It contacts configured services for features such as text and vision, generation and speech. On-demand downloads include voices, stem separation dependencies, linked media and stock footage. File imports by path are limited to the home folder, the studio inbox and configured import roots, with media type checks. Library media is served by asset ID. Settings redact the Faustus token stored in `<data-dir>/backend.json`. Voice cloning uses a supplied reference and a configured engine.

## Known limits

- The QA director's checks are heuristics; its bible, prompt and reference scores need a vision model, and picking the final take by ear is still yours.
- A recipe abstracts the lead's name, look and palette; shot prompts that describe the old lead's props are listed as warnings, not rewritten.
- Lyric auto-timing is an estimate from the song's structure; re-time by ear in **Audio > Lyrics timing** or import an aligned LRC. Section labels are "section A/B" with an energy level; very fast songs are reported at half time.
- Replay reuses the recorded settings, models and inputs where available. Output can vary with the backend, model versions and execution settings.
- Generation's timeline is edited at clip level. Its colour grades use filters. Graphic shots use Pillow and bundled fonts without complex-script shaping.
- Drafting a short from a topic requires Faustus's configured global text model. Review the script before using it. Shorts export a rendered file and publication metadata.

## Project layout

| Path | Contents |
| --- | --- |
| `prosperos_hoard/` | Backend: API, job workers, ComfyUI driver, design, audio, timeline, video, voices, productions, recipes, MCP adapter, vendored `hoard_link`, native editing modules |
| `frontend/` | React studio interface |
| `editing_frontend/` | Editing client |
| `native/` | Incorporated native editing code |
| `skills/` | Procedures for connected agents |
| `docs/` | Architecture, API, MCP, voice, characters, studio, timeline text, style profiles and more |
| `scripts/` | Launchers, screenshot capture, asset build |
| `tests/`, `editing_tests/` | Test suites |
| `data/` | Your data (database, assets, settings, token); git-ignored |

See [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) for the architecture and data model, and [docs/API.md](docs/API.md) for the HTTP reference.

## Development

```powershell
.venv\Scripts\python.exe -m pytest -q
.venv\Scripts\python.exe -m pytest editing_tests
.venv\Scripts\python.exe scripts/build_studio_assets.py
```

On Linux/macOS use `.venv/bin/python`. Tests use fake media backends and voice engines for isolated runs. CI runs backend tests on Ubuntu and Windows with Python 3.11–3.13 and builds the Generation frontend on Ubuntu with Node.js 22.

## License

MIT, see [LICENSE](LICENSE). Bundled fonts keep their own licences: SIL Open Font License (`prosperos_hoard/fonts/*/OFL.txt`), except Special Elite (Apache License 2.0). Third-party notices are in [NOTICE](NOTICE).