# AutoShorts Dashboard production workflow

## Trigger
Use this reference when the user asks to build, adjust, or operate the AutoShorts Dashboard as the source of truth for short-form video production, review, publishing, and analytics.

## Product rule
The dashboard is a production system, not a TikTok API demo. The approved workflow is:

```text
Content Library → Production Plan → Jarvis next item → Package Review → YouTube private upload/schedule → TikTok manual export → Analytics import → next recommendation
```

## Hard decisions from the session
- Pause automatic TikTok upload and TikTok mock-demo recording unless the user explicitly re-approves that direction.
- TikTok in the main workflow is manual export only: Download MP4, copy caption/hashtags, mark exported/posted, optional TikTok link later.
- YouTube is the automated platform path, but only as private upload and only after explicit confirmation.
- Website Companion remains a separate optional, QA-gated, explicit-push workflow; do not merge it into normal TikTok/YouTube review.
- Jarvis must not guess the next video from chat context. It must read the Dashboard production plan.

## Dashboard sections to preserve
- Dashboard/start: handoff cockpit only — next to produce, waiting for review, scheduled uploads, recent results, recommended next action.
- Content Library: content families, scripts, ideas, produced videos, performance, recommendation.
- Production Plan: sortable prioritized list with `locked_next` / `approved_next` as the authority for the next render.
- Review: 9:16 player, production origin, editable TikTok/YouTube metadata, TikTok manual export, YouTube private upload/schedule, needs-changes/approve.
- Calendar: planned private YouTube uploads, free slots, failed uploads, retry/reschedule/open video.
- Analytics: video results, content-family results, improvements, recommendations feeding back into the production plan.

## Required Jarvis contract
When the user says “Produziere das nächste Short”, call the Dashboard agent endpoint first:

```text
GET /api/agent/production/next
```

Only proceed if it returns a locked/approved/concept-active queue item with title, family, brief, constraints, and expected package ID/manifest. If no item is locked/approved, ask the user to choose/lock one in the dashboard or use the Production Plan API — do not improvise.

Required chat sequence:

1. Fetch `/api/agent/production/next`.
2. Call/post `/api/agent/production/{id}/concept-proposed` if not already proposed.
3. Present a detailed concept in chat: title, family, hook, script idea, visual concept, voice/tone, TikTok caption, YouTube title/description, and why this video.
4. Tell the user to confirm with `APPROVE_PRODUCTION <queue_item_id>`.
5. Only after explicit approval call `/api/agent/production/{id}/approve-generation`, then begin production.

Direct production from `locked_next` is a workflow bug; the backend should reject `mark-started` until the item is `concept_approved`.

## Production Plan requirements
The plan must be a steerable queue, not a single fixed next item. `/production-queue` should show:

- one `locked_next` / concept-active item at most, with Unlock, Hold, Archive, Replace locked, and Send to concept;
- at least 10 recommendation items with title, family, hook, brief, reason, style/format, status, priority, duplicate risk, performance reference, and rotation hint;
- manual ideas with add/edit/move/set-next/archive controls;
- recently produced items so duplicates are visible.

Recommendation engine should combine analytics, content library, package/review history, website/candidate slugs, uploaded YouTube titles, normalized title/hook/script text, package IDs, and keywords. Account-locked or other recently used themes should be surfaced as similar/duplicate warnings rather than silently becoming the only next item.

## Active workspace reset
For a clean first-real-run dashboard, archive active review/test state without deleting historical data:

```text
POST /api/dev/reset-active-workspace
python scripts/reset_active_workspace.py --archive-active-review --keep-analytics --keep-content-library
```

The active Inbox should default-filter to `ready_for_review`, `in_review`, and `needs_metadata`. After reset it should show `No videos waiting for review. Production plan ready. Next production not started yet.` Keep analytics/content library/families/scripts/upload audits/logs/website pending files.

Calendar should show actionable scheduled/failed private uploads only; archived or succeeded historical items should not clutter the active workflow.

## Review-page product shape
TikTok section:
- editable TikTok caption and hashtags;
- Download MP4;
- Copy TikTok caption / hashtags;
- synthetic-media reminder;
- Mark as exported for TikTok;
- optional Mark manually posted / TikTok link.

YouTube section:
- editable title, description, tags;
- privacy forced to `private`;
- synthetic-media/disclosure confirmation;
- explicit confirmation for private upload;
- direct Dashboard OAuth upload only when OAuth is truly configured and a connected account exists;
- otherwise create a token-free UploadRequest/outbox for the existing Jarvis uploader rather than pretending direct upload is possible;
- schedule private upload into the calendar.

## UI copy guardrails
Remove or keep out of the main creator UI:
- TikTok auto-upload promises;
- TikTok mock/demo as a primary product path;
- `publish_id`, `FILE_UPLOAD`, endpoint/scope/source/debug JSON;
- Sandbox readiness copy;
- long compliance explanations.

Those may remain in internal logs or historical verification pages only if needed, but not as the creator workflow.

## Verification checklist
Before reporting success:
- backend tests and lint pass;
- frontend typecheck/build passes;
- smoke `/api/agent/production/next`, `/api/production-queue`, `/api/calendar`, `/api/accounts/youtube/status`;
- browser QA `/dashboard`, `/production-queue`, a representative `/videos/:id/review`, `/calendar`;
- scan main UI files for old TikTok-auto/mock wording;
- verify Dashboard repo commit/push;
- verify Website repo was not pushed unless explicitly approved.

## Pitfalls
- Do not treat a missing Dashboard OAuth config as “YouTube upload works.” Say direct Dashboard OAuth is blocked and use the existing Jarvis uploader UploadRequest/outbox path if available.
- Do not create a fake “ready” state for TikTok. Manual TikTok export is enough until the user reopens the TikTok API path.
- Do not let the review page become a technical audit log. Put only creator decisions there; logs can carry details.
- Do not silently select the next video from memory, analytics, or recent chat. The Production Plan is the authority.
