Repository avatar
AI Tools
v1.1.0
active

promptforge

io.github.lis022892-dot/promptforge

AI video storyboards, cinematic prompts and Agent Skill safety checks via MCP.

Documentation

PromptForge AI 🔨

Local-first AI video toolkit: storyboard generator, character consistency sheets, Agent Skill safety checker, and an MCP server — now with optional multi-provider LLM enhancement (Grok, OpenAI, Claude, Gemini, DeepSeek, OpenRouter, or your own OpenAI-compatible endpoint). Works fully offline with no API key; add any provider's API key and the same storyboards get enhanced by that provider's model. Pure Python standard library, zero dependencies either way.

把一句话想法,变成能直接喂给 AI 视频工具的分镜表;把角色定妆锁死不串样;顺手还能给 Agent Skill 做带评分的安全体检。

English | 中文版

CI PyPI Python

Part of the Forge series — after storyboarding, slice the long video with ClipForge.

Demo

▶ Watch the demo video (52s, 1280×720) — a real run of the actual CLI, fully offline, no API key, no mocks. Every line of output in the video is what the tool printed on a real run:

TimeWhat happens
0:04promptforge storyboard "a lone swordsman in the rain at night…" → a 5-shot storyboard with beats, camera moves, per-shot prompts and voiceover lines
0:17promptforge cinematic … --genre epic --camera imax --self-check → a 5-stage film-grade prompt (IMAX + Panavision anchor, imperfections, breath-like handheld, quiet ending), self-check 10/10
0:30promptforge lint-prompt → the naive prompt "epic cinematic 4K video of a swordsman" scores 0/10; the generated cinematic prompt scores 10/10
0:42promptforge storyboard … --provider auto → no key set, so it falls back to local generation with a clear notice; set any provider key (Step 4 lists them) to enhance instead

The video file also lives in this repo at docs/demo/promptforge-demo.mp4.

Building with Grok

PromptForge is built to work with Grok: the local generator produces a deterministic storyboard skeleton (beats, camera moves, timestamps, platform presets), and the optional Grok provider sends that skeleton to a Grok model on the xAI API to rewrite every shot's visual prompt and English voiceover line — richer, more specific prompts, same structure.

  • API: xAI's OpenAI-compatible API, base URL https://api.x.ai/v1, endpoint /chat/completions, called with nothing but urllib from the standard library.
  • Model: grok-4.7 by default (the flagship Grok model in the official xAI docs). Override with --model or the PROMPTFORGE_GROK_MODEL environment variable.
  • Key handling: the key is read only from the XAI_API_KEY environment variable. It is never hard-coded, never written to a file, and never printed.
  • Offline fallback: no key, or any API error → you get the local offline storyboard plus a clear notice on stderr. Nothing breaks.
# 1) Get a key at https://console.x.ai and export it (never commit it)
export XAI_API_KEY="xai-..."        # PowerShell: $env:XAI_API_KEY = "xai-..."

# 2) Enhance a storyboard with Grok
promptforge storyboard "a funny cat chef" --provider grok
promptforge storyboard "一只小羊在海边看日落的治愈日常" --provider grok --model grok-4.7 --format json

# 3) No key set? It still works — local generation, with a fallback notice
promptforge storyboard "a funny cat chef" --provider grok

The MCP tools accept the same options: pass "provider": "grok" (and optionally "model") to make_storyboard or storyboard_srt, with XAI_API_KEY set in the MCP server's environment.

Multi-provider support

Grok is the headline provider (see above), but the same enhancement layer speaks to six more providers — each implemented against that vendor's official docs, still with nothing but urllib:

Provider (--provider)API key env varDefault modelWire formatGet a key
grokXAI_API_KEYgrok-4.7xAI, OpenAI-compatible (https://api.x.ai/v1)console.x.ai
openaiOPENAI_API_KEYgpt-6.2-astraOpenAI Chat Completionsplatform.openai.com/api-keys
claudeANTHROPIC_API_KEYclaude-opus-5-5Anthropic Messages API (native format)console.anthropic.com
geminiGEMINI_API_KEY (or GOOGLE_API_KEY)gemini-4-carbonGemini generateContent (native format)aistudio.google.com/apikey
deepseekDEEPSEEK_API_KEYdeepseek-chatOpenAI-compatibleplatform.deepseek.com
openrouterOPENROUTER_API_KEYopenai/gpt-4oOpenAI-compatible (many models, one key)openrouter.ai/keys
customPROMPTFORGE_CUSTOM_API_KEY— (set one, see below)Any OpenAI-compatible endpointyour own endpoint
# Use whichever key you have
export ANTHROPIC_API_KEY="sk-ant-..."
promptforge storyboard "a funny cat chef" --provider claude

# Or let PromptForge pick: first key found wins, in this fixed priority:
#   grok → openai → claude → gemini → deepseek → openrouter → custom
promptforge storyboard "a funny cat chef" --provider auto

# Any OpenAI-compatible endpoint (local server, gateway, another vendor):
export PROMPTFORGE_CUSTOM_BASE_URL="https://llm.example.com/v1"
export PROMPTFORGE_CUSTOM_API_KEY="..."          # optional if your endpoint needs none
export PROMPTFORGE_CUSTOM_MODEL="my-model"       # or pass --model
promptforge storyboard "a funny cat chef" --provider custom

Rules that hold for every provider:

  • Model choice: --model wins, then PROMPTFORGE_<PROVIDER>_MODEL (e.g. PROMPTFORGE_OPENAI_MODEL), then the default in the table.
  • Keys are env-only: never hard-coded, never written to a file, never printed — error messages are even scrubbed of the key before they reach you.
  • Fallback: no key, an HTTP/network error, or an unusable reply → the local offline storyboard plus a clear notice on stderr. The local skeleton (beats, camera, timestamps) is never changed by a provider; the model only rewrites the prompts, voiceover lines and music direction.
  • MCP: the same provider / model arguments work on make_storyboard and storyboard_srt, including "auto".

Honest note: the provider clients are covered by mocked-network unit tests (request construction, native-format parsing for Claude/Gemini, fallbacks, key-leak assertions). No live paid API call is made by the test suite.

Why this, why now (Dec 2026)

GitHub Trending in December 2026 is dominated by three things:

  1. Agent Skills — reusable SKILL.md packs are the new extension format for coding agents.
  2. MCP servers — one protocol so Claude Code, Cursor, Gemini CLI and Copilot can all call the same tools.
  3. AI short-video tooling — local-first video creation tools are breakout hits.

PromptForge sits exactly at that intersection — and unlike most of them, it runs fully offline with zero dependencies, so you can read every line before you trust it.

Features

  • 🎬 Storyboard generator — one-line idea → shot list with visual prompt, negative prompt, camera move, timestamps, music direction and an English voiceover line per shot.
    • 15 genres, bilingual detection (EN / 中文): healing 治愈 · comedy 搞笑 · epic 史诗 · romance 爱情 · product 产品广告 · education 教程科普 · travel 旅行 · horror 恐怖 · kids 儿童 · tech 科技 · noir 黑色电影 · cyberpunk 赛博朋克 · documentary 纪录片 · food 美食 · sports 运动
    • Platform presets: short / douyin / tiktok (9:16), youtube / bilibili (16:9), square (1:1), each with production notes
    • 10 story beats: Hook → Setup → Build → Turn → Escalation → Detail → Reaction → Payoff → Callback → Button
    • Asset numbering (v1.1): every board numbers its assets once — C01 character, S01 scene, P01 prop — and each shot references the ids it uses
    • Motion continuity (v1.1): every shot carries an action cut point (action, 50% progress, next viewpoint, resume point) and a start/end state chain — start_state of shot n+1 is the end_state of shot n, verbatim (posture, motion direction/speed, gaze, breath & fabric), so a 30-second piece continues second 29's movement instead of resetting from a statue every clip. batch chains both across segments automatically
    • Exports: Markdown, JSON, SRT subtitles, CSV shot list
  • 🧍 Character consistency sheets — the #1 AI-video pain is a character drifting between shots. Generate a lock prompt once, plus 6 turnaround and 6 expression prompts, and paste it into every shot. v1.1: the lock is a three-part identity lock (@C01 token + itemised inherit list + do-not-inherit list + cross-shot clause) and carries an action signature — the character's unique way of moving (centre of gravity, force sequence, speed curve, dominant side, breath pattern, settle habit) — so shots share not just a face but a movement.
  • 🛡️ Agent Skill checker — validates SKILL.md frontmatter and scans for hard-coded keys (OpenAI / GitHub / AWS / Google / Slack / JWT / private keys), destructive commands, pipe-to-shell installs, dynamic code execution and prompt-injection phrases. Returns a 0–100 safety score with an A–F grade, plus SARIF output for GitHub code scanning. Read-only: it never executes the skill. --full (v1.1) merges score + issues + a concrete fix per issue into one three-in-one output.
  • 🎥 Cinematic 5-stage prompt builder — promptforge cinematic "idea" writes model-ready video prompts (Sora / Veo / Kling / Seedance / Runway) in the five-stage structure used by top AI-short-film creators: core-theme tags → character & scene with deliberate imperfections → real camera/lens anchoring (IMAX + Panavision C-series, ARRI Alexa 65, anamorphic, 16mm) → breath-like handheld camera rules → per-second storyboard beats with an empty ending, production-audio-only rule and no-readable-text guardrails. Fifteen genre packs and four camera anchor cards, all data files (src/promptforge/data/genres/, src/promptforge/data/cameras/; v0.9 adds noir, cyberpunk, documentary, food and sports). v1.1: --format json emits the same prompt as structured keys (shot / subject / scene / cinematography, audio split into ambient/tempo/vocal_style, dialogue.subtitles: false as an explicit boolean) for Veo-style JSON workflows, --shot N emits a single shot with full stage context, genre packs carry style-exclusion lists, and non-final beats end on 50% action cut points with chained start states. promptforge lint-prompt scores any prompt (text or JSON) against the 15-item checklist — naive prompts score 0–3/15; a generated one self-checks at 15/15.
  • 🔧 Prompt auto-fix — promptforge fix-prompt "epic cinematic 4K video of a swordsman…" rebuilds a naive prompt with the same five-stage machinery and reports the real lint scores on both sides (the bundled example: 0/15 → 15/15). Genre auto-detects; vertical prompts stay vertical.
  • 🌐 HTML storyboard preview — promptforge preview "idea" -o plan.html renders a storyboard as one self-contained HTML page: shot cards with timestamps, camera, full prompts and voiceover, inline CSS only, no external resources — opens offline, shares as a single file. Also renders an existing storyboard JSON (--from-json).
  • 🔌 MCP server — 6 tools (make_storyboard, storyboard_srt, make_character_sheet, check_skill, preview_storyboard, fix_prompt) over stdio JSON-RPC, ready for any MCP client. The repo ships a Registry-ready server.json (official MCP Registry schema) and per-host install guides in docs/MCP.md.
  • 🎯 Model dialect validation — --model-target seedance|kling|veo|sora on storyboard / cinematic validates output against the target model's documented limits (Seedance: 4–15 s generations, @Image 1 reference roles, ≤9/≤3/≤3 reference files; Kling: 16:9/9:16/1:1 only, 2,500-char prompt cap, negatives in the separate negative_prompt field; Veo 3.1: discrete 4/6/8 s lengths, 16:9/9:16 only, negatives in the negativePrompt parameter; Sora 2: discrete 4/8/12/16/20 s seconds parameter, no negative field — steer positively). Violations print precise warnings; output is never silently rewritten. Dialect sheets live in src/promptforge/data/dialects/.
  • 🧪 Regression evals — promptforge eval runs the declarative case suite in evals/cases.json (34 cases over storyboard / cinematic / lint / fix / dialects / batch: score ranges, required phrases, warning triggers) and reports a pass rate; a failing case exits non-zero, and CI runs the suite on every push, so generator changes can't silently regress prompt quality.
  • 🗂️ Batch / project mode — promptforge batch project.json -o out/ --cinematic turns a manifest (JSON or a Markdown list, per-item overrides after a | suffix) into a folder of storyboards: Markdown + JSON per item, optional cinematic prompts, an index.html browsing page and an index.json summary. One bad item is recorded and skipped; a malformed file stops the run. v1.1: segments chain — each segment's opening is generated from the previous segment's cut point and final end state, and broken state links are auto-repaired and recorded.
  • ⚖️ Compare — promptforge compare "idea" puts the local storyboard and the cinematic prompt side by side (size, lint scores, what each carries, when to use which). Fully offline.
  • 🧩 Also an Agent Skill — skills/promptforge/SKILL.md plus .claude-plugin/ manifests package PromptForge for Claude Code / agent hosts; the skill passes PromptForge's own checker at 100/100 (grade A).
  • 🤖 Multi-provider LLM enhancement (optional) — --provider grok|openai|claude|gemini|deepseek|openrouter|custom|auto enhances storyboards with the model of your choice (see Building with Grok and Multi-provider support). Off by default; automatic local fallback without a key.
  • 📦 Zero dependencies — Python 3.10+ standard library only, including every provider API client (urllib).

Quick start

pip install promptforge-video

# (from a source checkout instead: pip install -e .)

# 1) Storyboard (add --platform youtube, --format srt|csv|json as needed)
promptforge storyboard "一只小羊在海边看日落的治愈日常" --seconds 25 --shots 5

# 2) Character consistency sheet
promptforge character "Mooncurl" "cream-yellow lamb, two moon curls on head" "mint moon pajamas, orange scarf"

# 3) Check an Agent Skill before you install it
promptforge check-skill examples/demo-skill
promptforge check-skill ~/.claude/skills/some-skill-you-downloaded --format text

# 4) Run as an MCP server
promptforge mcp

# 5) Optional: enhance with an LLM provider (needs that provider's key, see above)
promptforge storyboard "a funny cat chef" --provider grok     # or openai / claude / gemini / …
promptforge storyboard "a funny cat chef" --provider auto     # first key found wins

# 6) Share the plan as one self-contained HTML page
promptforge preview "a funny cat chef" -o plan.html

# 7) Rescue a naive prompt (prints before/after lint scores + the fixed prompt)
promptforge fix-prompt "epic cinematic 4K video of a cat chef, stunning"

# 8) Compare the two artefacts, and check a prompt against a model's real limits
promptforge compare "a funny cat chef"
promptforge cinematic "a swordsman in the rain" --duration 25 --model-target seedance   # warns: 25s > 15s per generation
promptforge cinematic "a lighthouse at dusk" --duration 5 --model-target veo            # warns: 5s is not a Veo length (4/6/8)

# 9) Run the regression eval suite (also runs in CI)
promptforge eval

# 10) Batch mode: a whole series from one manifest
promptforge batch project.json -o out/ --cinematic

Full guide: docs/USAGE.md · Recipes: docs/COOKBOOK.md · MCP details: docs/MCP.md · What's next: docs/ROADMAP.md

MCP client config:

{
  "mcpServers": {
    "promptforge": { "command": "promptforge", "args": ["mcp"] }
  }
}

Example output (abridged)

# Storyboard: a funny cat chef
- Genre: comedy | Platform: short (9:16) | Total: 25s
| 1 | Hook | 0.0–5.0s | quick zoom-in |
## Shot 1 — Hook (5.0s)
- Prompt: `a funny cat chef, beat: hook, bright daylight, exaggerated expressions, quick cuts, ...`
- Negative: `extra fingers, deformed hands, face changing between shots, flicker, watermark, ...`

Skill check: Score: 100/100 (grade A) — OK

Examples

Real runs, not mock-ups — every file in examples/ is actual CLI output, with the exact command that produced it:

Ten end-to-end workflows built from these commands live in the Cookbook — including the half-action cut (recipe 9) and the action-signature + state-chain recipe (recipe 10) for stitching long videos without the "reset" feel. Real failure modes — bad prompts, the exact lint/dialect findings and their repaired scores — are collected in the failure → fix case library.

Safety & legality

  • Defensive and creative tooling only: it generates prompts and detects risky patterns. No scraping, no account automation, no engagement manipulation, no voice/face cloning, no bypass of any platform rule. See SECURITY.md.
  • All sample content is original. MIT licensed — use it, fork it, ship it.

Roadmap

  • Genre packs: product, education, travel, horror, kids, tech
  • Character consistency sheets
  • SRT / CSV export, SARIF output, safety scoring
  • Grok / xAI API integration: OpenAI-compatible endpoint (https://api.x.ai/v1) for richer, Grok-enhanced storyboards (bring your own XAI_API_KEY, off by default, local fallback)
  • Multi-provider support: OpenAI, Claude (Messages API), Gemini (generateContent), DeepSeek, OpenRouter and custom OpenAI-compatible endpoints, plus an auto mode that picks the first configured key
  • HTML storyboard preview page (promptforge preview), prompt auto-fix (promptforge fix-prompt), examples library and cookbook
  • Model dialect layer v1 (Seedance + Kling validation), promptforge compare, MCP server.json + per-host install guides, Agent Skill packaging (skills/promptforge/ + .claude-plugin/)
  • PyPI release pipeline: full packaging metadata, a Trusted Publishing (OIDC, token-less) workflow that publishes on GitHub Release, and build/wheel smoke checks — see docs/RELEASING.md. Live since v0.9.1: pypi.org/project/promptforge-video — pip install promptforge-video.
  • Regression eval suite (promptforge eval, 22 declarative cases, wired into CI), dialect layer v2 (Veo + Sora), and genre packs as data files (src/promptforge/data/genres/ + index.json)
  • Batch / project-file mode (promptforge batch), five more genre packs (noir, cyberpunk, documentary, food, sports — 15 total), a failure → fix case library with tool-verified scores, and the eval suite grown to 31 cases including a batch kind

The forward backlog — v1.0 release criteria (PyPI listing, MCP Registry submission, shot recipe cards, check-skill spec checks) and long-term — lives in docs/ROADMAP.md.

Use it as an Agent Skill

/plugin marketplace add lis022892-dot/promptforge-ai   # in Claude Code
/plugin install promptforge@promptforge-ai

…or copy skills/promptforge/ into your host's skills directory. The skill teaches the agent every command above (and the key-safety rules: keys only from the environment, never through chat).

Contributing

See CONTRIBUTING.md. Run the tests before you push:

python -m pytest tests/ -q

Changelog

See CHANGELOG.md. Current version: 1.0.0.

License

MIT © 2026 PromptForge Contributors

PYPI
promptforge-video
Install Command
pip install promptforge-video
Runtime: uvx