Generation, Audio & Workspace
Durable AI media generation jobs, multi-asset generation project graphs, local audio finishing (room tone, ducking, microphone capture), S3/R2 storage and shared outputs, caches, and agent workspace tools.
Skywrite pairs optional, durable OpenRouter generation jobs with deterministic local FFmpeg audio finishing, explicit S3/R2 storage workflows, and a personal workspace for skills, style prompts, model defaults, and feedback.
Durable Generation Jobs & Upscaling
Generation commands run exclusively through OpenRouter (OPENROUTER_API_KEY) and persist durable job state under ~/.skywrite/jobs/ (relocatable via SKYWRITE_HOME):
# Discover models and capabilities first (free catalog requests)
skywrite models list --task image-generation
skywrite models list --task speech-generation
skywrite models list --task music-generation
# Generate images (supports repeatable local PNG/JPEG/WebP --reference files)
skywrite generate image --model black-forest-labs/flux-3-image-klein \
--prompt 'An orange origami fox with a blue scarf' --output fox.png
skywrite generate image --model black-forest-labs/flux-3-image-klein \
--reference fox.png --prompt 'Same fox sitting down' --output pose.png
# Generate video (--first-frame, --last-frame, or repeatable --reference; do not mix keyframes and references)
skywrite generate video --model minimax/hailuo-3-max \
--first-frame fox.png --prompt 'The paper fox turns its head' \
--duration 5 --resolution 480p --aspect-ratio 16:9
# Track and retrieve durable jobs
skywrite jobs list
skywrite jobs status JOB_ID --refresh
skywrite jobs resume JOB_ID --wait 60 --output fox.mp4
# AI video upscaling (--source-job, --source-url https://..., or --upload via configured S3/R2)
skywrite upscale video --source-job JOB_ID \
--model black-forest-labs/flux-video-upscale --factor 2 --creativity 0
skywrite jobs resume UPSCALE_JOB_ID --wait 60 --output fox-large.mp4
# Local non-AI FFmpeg Lanczos image resize (no API call)
skywrite upscale image fox.png --factor 2 --output fox-large.png
Generated Narration & Music
# Narration (MP3 or converted 48-kHz stereo PCM16 WAV)
skywrite generate speech --file narration.txt \
--model hexgrad/kokoro-82m --voice af_heart --output narration.mp3
# Instrumental music bed
skywrite generate music --model google/lyria-3-clip-preview \
--prompt 'Original gentle electronic bed, warm chords, 96 BPM, clean ending' \
--instrumental --output bed.mp3
- Long narration splitting. Scripts up to 64 KiB that exceed a single request budget (provider-specific limit, catalog
context_length, or conservative 2,000 chars; always ≤ 8,192 bytes) are split automatically on paragraph breaks (falling back to sentences, then words), generated as individual durable section jobs, decoded to 48-kHz mono, joined sample-exactly with--paragraph-pausesilence (default0.3s, range0–5s) at paragraph seams, and encoded once as gapless MP3 (up to 1 hour joined).split.sectionslists each section’sstart_seconds,end_seconds, andjob_id. - Billing & loudness caveats. Zero generic prompt/completion token prices do not mean free video or music—check
pricing_skusand provider pages. Generated audio is not loudness-managed and can clip (a Lyria 3 Clip bed measured+0.81 dBFSpeak); every completed job reportsartifact.levels(peak_dbfs,rms_dbfs) and warns above full scale. Normalize withskywrite audiobefore mixing.
Durability, No-Duplicate Safety & Bounds
- Fsync before POST & lock per job. Request identity hashes model, prompt, parameters, reference bytes, and
--take. Rerunning the same request reuses the existing job; pass--take secondto intentionally request a new paid variation. - No automatic duplicate paid retries. Connection failures before any byte is sent return to
preparedwith exit code1andcode: "not_sent"(safe to rerun). Interruptions or timeouts after connecting leave the jobjob_uncertain; inspect OpenRouter activity and adopt a known video ID withskywrite jobs resume JOB_ID --remote-id PROVIDER_ID. Audio jobs return bytes inline and have no remote job ID to adopt. - Full decode validation. Before marking a job complete, FFmpeg decodes the returned image frame (30 s deadline) or full primary video + audio stream (180 s deadline). Invalid responses stay in
job_receivedwithout publishing or resubmitting. - Bounds. 32 KiB image/video/music prompts (64 KiB narration text), 16 MiB per reference image (32 MiB combined), 64 MP per image/frame, 32 MiB decoded image output, 512 MiB video output, 32 MiB / 600 s per audio response, 1,800 s max poll wait. Preview capabilities without paying using
--dry-run(--offlineuses cached catalogs only).
Multi-Asset Generation Projects (skywrite project)
skywrite project (alias batch) executes a declarative, versioned JSON graph of image, video, speech, and music nodes using the same durable job engine—never executing shell commands from a manifest.
skywrite project schema
skywrite project init story.json
skywrite project validate story.json --check-models --offline
skywrite project run story.json --concurrency 2
skywrite project status story.json
skywrite project resume story.json --concurrency 2
Example manifest (version: 1, 1–256 nodes):
{
"version": 1,
"output_root": "generated",
"nodes": [
{
"id": "character",
"output": "character.png",
"action": { "type": "image", "prompt": "A consistent illustrated cloud character, plain background." }
},
{
"id": "opening",
"output": "opening.mp4",
"shot": { "size": "wide", "angle": "eye level", "motion": "gentle push in" },
"action": {
"type": "video",
"prompt": "The cloud character enters a sunlit garden.",
"first_frame": { "node": "character" },
"duration": 6
}
},
{
"id": "narration",
"output": "narration.mp3",
"action": { "type": "speech", "text": "Every small cloud has a story.", "voice": "af_heart" }
},
{
"id": "score",
"output": "score.mp3",
"action": { "type": "music", "prompt": "Gentle whimsical instrumental storybook score.", "instrumental": true }
}
]
}
- Dependencies & inputs. Reference local images via
{"file": "assets/character.png"}(16 MiB/file, 256 MiB total) or upstream generated images via{"node": "character"}(automatically creates a dependency edge), plus explicitdepends_onordering. Three identicalshotmetadata labels emit a repetition warning. - Frozen models & safe recovery. Model selections freeze in private state under
$SKYWRITE_HOME/projects/<manifest-path-hash>on the first run; resuming pending nodes keeps their frozen models. Concurrency defaults to2(bounded1–8),--keep-goingallows independent branches to finish after a failure, and--waitbounds per-node video polling (max1800s). Lock order is strictlyproject → job → storage. After a crash, started nodes read or resume their recorded job receipts without resubmitting uncertain requests.
Local Audio Finishing (skywrite audio)
All skywrite audio subcommands run locally through FFmpeg with zero model calls. Finishing outputs are 48-kHz stereo PCM16 WAV (preferred for stems) or 192 kbps MP3, verified by a fresh full decode before atomic publication. Mono inputs upmix to stereo at −3 dB per channel (equal power).
# Two-pass EBU R128 loudness normalization (default -18 LUFS) + true-peak ceiling
skywrite audio normalize narration.mp3 -o narration.wav --lufs -18 --peak-db -2
# Pitch-preserving tempo adjustment (--stretcher auto|rubberband|atempo)
skywrite audio tempo narration.wav -o faster.wav --tempo 1.1
# Loop one cue with overlapping linear crossfades to an exact sample duration
skywrite audio loop cue.wav -o bed.wav --duration 180 --crossfade 2 \
--lufs -24 --peak-db -4 --fade-in 1.5 --fade-out 5
# Composable single-command pipeline (order: select -> tempo -> normalize -> loop -> duck -> pad/trim -> fades)
skywrite audio finish speech.mp3 -o finished.wav --start 0.1 --length 12 \
--tempo 1.05 --lufs -18 --peak-db -2 --fade-in 0.025 --duration 14
Room Tone Under Generated Speech (audio roomtone)
Dry TTS narration has digital-black pauses that sound unnatural against camera footage. audio roomtone normalizes speech (--lufs -18, --peak-db -2), optionally high-passes a room-tone bed (--bed-highpass 20..400 Hz for hum), gains the bed to --bed-dbfs (default -58 dBFS, range -80 to -40), loops short beds with equal-power quarter-sine crossfades (--crossfade 0.5 s), and sums them to the exact decoded speech duration so existing word timestamps stay valid:
skywrite audio roomtone narration.mp3 --bed room.wav -o narration-room.wav \
--bed-dbfs -62 --bed-highpass 120
Refuses digital silence, beds shorter than 1 second, beds louder than −30 dBFS RMS, or beds requiring > +40 dB gain.
Deterministic Narration Ducking (audio duck)
Dip a music bed under a narration stem using FFmpeg sidechaincompress fed with fixed 1024-sample frames (measured sample-identical across FFmpeg 5.1.2 through 9.1):
skywrite audio duck bed.wav -o ducked.wav --sidechain narration-stem.wav \
--threshold 0.035 --ratio 4 --attack-ms 15 --release-ms 600 --duration 180
The output contains only the ducked bed; short narration stems are padded with silence so the music recovers cleanly.
Recording Room Tone (audio inputs & audio record-bed)
# List system capture devices without recording
skywrite audio inputs
# Record room tone (requires explicit --confirm; agents must ask the user first)
skywrite audio record-bed --seconds 30 -o room.wav --confirm [--device ID]
- Captures
--seconds(5–120, default30) of mono 48-kHz PCM16 WAV after discarding a 4-second startup lead (measured to clear microphone DC settling transients) and never uploads anything. - Analyzes the recording and warns on high levels (> −40 dBFS RMS), > 50% power below 150 Hz (suggests
--bed-highpass 120), transients, DC offset (> 0.01 FS), orspeech_likeness(unlikely/possible/likely). - On macOS, the first capture triggers the system Microphone permission prompt for the host terminal/editor app.
[!IMPORTANT]
audio record-bedcaptures the user’s real environment and fails without--confirm. Coding agents must obtain explicit user consent before invoking it.
S3 / R2 Storage & Cross-Machine Outputs
OpenRouter’s AI video upscaler requires an accessible HTTPS URL (it rejects inline video data URLs). Skywrite integrates Apache Arrow’s Rust object_store S3 client directly—no AWS CLI needed. Credentials are read strictly from AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, and optional AWS_SESSION_TOKEN (never saved, no IMDS or profile auto-discovery). Non-secret settings live in ~/.skywrite/storage.json.
export AWS_ACCESS_KEY_ID='your-bucket-scoped-key'
export AWS_SECRET_ACCESS_KEY='your-secret-key'
skywrite storage configure \
--endpoint https://ACCOUNT_ID.r2.cloudflarestorage.com \
--bucket editor-media --region auto \
--public-base-url https://media.example.com \
--prefix skywrite/uploads/project-01/
skywrite storage status
skywrite storage upload camera.mp4 --dry-run
skywrite storage check-public 'skywrite/uploads/project-01/HASH.mp4'
# Upload a local MP4 (<= 512 MiB), upscale it, and delete the upload after local verification
skywrite upscale video camera.mp4 --upload \
--model black-forest-labs/flux-video-upscale --factor 2 \
--delete-upload-after
# Scoped cleanup of marked temporary uploads (skips active local jobs unless --include-active)
skywrite storage purge --dry-run
skywrite storage purge --limit 500
- Verified backend. Cloudflare R2 upload reuse, R2-backed upscaling, active-job cleanup deferral (
deferred_active_job), scoped purge, and cross-machine transfers were live-verified; AWS S3 and other S3-compatible providers have not been certified. - Hash reuse & safety. Objects are staged, hashed, and stored under
skywrite/uploads/<optional-project>/<sha256>.mp4with conditional create and ownership metadata.storage purgeremoves only marked Skywrite upload objects and never touches unrelated keys or the outputs namespace. - Cross-machine shared outputs (
skywrite outputs). Publish finished assets under friendly names underskywrite/outputs/(separate fromstorage purge), discover them from another machine, and retrieve them with 4 MiB range GETs and full SHA-256 verification:
skywrite outputs upload ./final.mp4 --name explainer.mp4
skywrite outputs list --limit 50
skywrite outputs download explainer.mp4 ./output.mp4
skywrite outputs url explainer.mp4 --check # verifies anonymous 1 KiB prefix match
Shared Caches & Agent Workspace
Skywrite cleanly separates regeneratable caches from personal workspace data:
| Location | Override | Contents |
|---|---|---|
~/.cache/skywrite (or $XDG_CACHE_HOME/skywrite) |
--cache-dir / SKYWRITE_CACHE_DIR |
media-sha256-v1/ (stat-validated file hashes), assets/ (extracted frames), responses/, frame-descriptions/, video-descriptions/, focus-answers/, audio-timing-v2/, models/ (24 h catalog TTL), fonts/google/, and ondevice/ (downloaded Parakeet weights; deleted only by models remove) |
~/.skywrite |
SKYWRITE_HOME |
config.json (model defaults & custom providers), storage.json, jobs/, projects/, styles/*.md, skills/*.md, nits/*.json |
--no-cache disables response cache reads/writes only; it does not delete extracted frames, media hashes, or on-device weights.
Skills, Styles, Defaults & Nits
# Built-in workflow skills (Hyperframes, Remotion, FCPXML, FFmpeg, Takumi, sync, composing-tools, technical-explainer)
skywrite skills list
skywrite skills read synchronization
skywrite skills create my-workflow --file workflow.md # shadows a built-in skill if same name
# Reusable Markdown creative style prompts (max 256 KiB UTF-8, atomic writes)
skywrite styles list
skywrite styles create warm-documentary --content 'Warm, natural light; restrained cuts.'
skywrite styles read warm-documentary
skywrite styles update warm-documentary --file revised-style.md
# Saved task model defaults (precedence: --model > SKYWRITE_<TASK>_MODEL > saved default > scribe-v2 fallback)
skywrite defaults
skywrite defaults image set black-forest-labs/flux-3-image-klein
skywrite defaults image unset
# Local-only feedback capture (~/.skywrite/nits/*.json; never uploaded, captures no secrets or media)
skywrite nit 'Premiere XML rounded sub-frame source_in on 23.976 clip'