> ## Documentation Index
> Fetch the complete documentation index at: https://kive.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Remix

# Public remix pages

`/remix/{publicItemId}` uses the published global `REMIX` skill and source resolver from #7412 with the public Agent runtime from #7520. Eligible public image and video detail pages expose the entry link. Private, hidden-from-Discover, missing and promptless sources return 404; disabled profiles retain the source landing page but hide generation and entry links. Source access is checked again at start and on every turn.

`PUBLIC` and `WITH_LINK` items can be remixed through their item link. Link-shared sources retain their visibility and private-input filtering; their Remix pages emit `noindex` and are not added to discovery or sitemaps. GraphQL returns `isIndexable` from the source item's visibility for web-public's metadata.

## Activate in an environment

Complete the foundation's service identity and Turnstile setup first (see [README](README.md)). Publish exactly one global skill with trigger `REMIX`. The authenticated `agent-remix` flag continues to govern web-core's original remix entry points; public execution is controlled by these separate admin profiles.

At `/admin/public-agent`, create `remix-image` and `remix-video`. Start disabled, configure each profile, then enable when ready. No profile is seeded by deployment.

| Field                                 | `remix-image`                                                                         | `remix-video`                                                           |
| ------------------------------------- | ------------------------------------------------------------------------------------- | ----------------------------------------------------------------------- |
| Output type                           | image                                                                                 | video                                                                   |
| Allowed tools                         | `ask_user_choice`, `resolve_subjects`, `inspect_images`, `create_image`, `edit_image` | `ask_user_choice`, `resolve_subjects`, `inspect_images`, `create_video` |
| Opening steps (both modes)            | Empty                                                                                 | Empty                                                                   |
| User prompt                           | `{input}`                                                                             | `{input}`                                                               |
| System prompt                         | Follow the Remix skill and the visitor's request.                                     | Follow the Remix skill and the visitor's request.                       |
| Guest rules                           | Keep the default guest rules                                                          | Keep the default guest rules                                            |
| Output count                          | 1                                                                                     | 1                                                                       |
| Image limit per turn                  | 1                                                                                     | 2                                                                       |
| Step cap                              | 8                                                                                     | 12                                                                      |
| Credit escrow                         | 100                                                                                   | 500                                                                     |
| Free refinements                      | 1                                                                                     | 1                                                                       |
| Deadline                              | 240000 ms                                                                             | 600000 ms                                                               |
| Maximum clip length                   | Not applicable                                                                        | 15 seconds                                                              |
| Daily cap / average-credit auto-pause | Start with a small daily cap; tune in admin                                           | Start with a small daily cap; tune in admin                             |

For the image profile, add to the system prompt: “For refinements to an existing image, prefer `edit_image`. Put the image being edited first in `images`, followed by still-relevant permitted references. Preserve the existing composition and content unless the visitor requests a change.” Image edits count toward the public image limit per turn and use the same credit escrow.

For the video profile, add to the system prompt: “Use `create_video` for the initial remix and all video refinements. Use the latest accepted result as context unless the visitor selects an earlier output, and recreate the requested variation using permitted references. The Remix skill owns reference selection, framing, and generation prompts. Do not promise exact frame or audio preservation.” This formula belongs in the editable profile, not in a second backend prompt.

These are starting configurations, not bypasses: admission, IP limits, draft quality, watermarks, credit reservations and auto-pause retain the foundation's enforcement. Image/video profiles cannot be interchanged by the caller. The image completion limit applies only to image profiles; video workflows remain bounded by their credit budget, step cap and deadline so generating a frame does not end the run before animation.

Before activating production routing, check Firestore for an existing workspace with URL `remix`. Both workspace-name validators reserve it for new workspaces. If a collision exists, resolve it before deploying the URL router. Deploy the worker explicitly with the existing Cloudflare workflow (`wrangler deploy` in `apps/cloudflare-workers/url-router-kive-dot-ai`); a web deployment alone does not activate `/remix/*` routing.

## Conversation and continuation

Remix conversations are restored from sessionStorage, scoped to the source item and browser tab. Reloading resumes the saved conversation. The landing URL does not select a task. There are no public Stop or Start over actions. The private signup claim stays in sessionStorage and is passed only to the signup continuation URL. Photos share a 1,800 KiB base64 budget per request, leaving room within GraphQL’s 2 MB JSON limit; the browser downsizes decodable images to fit.

A run accepts at most five product images across its turns. Choice and upload tools can pause and resume up to five times without spending the refinement allowance; their model/tool usage still spends the same credit escrow. Answers bind to one pending tool call and are committed with the next turn in a transaction. Public callers cannot answer paid tools or supply output URLs.

The Remix skill chooses references, framing, aspect ratio, audio and duration. The backend validates reference access without adding uploads, requiring source frame structure, or overriding creative settings. Permitted references include public source images, independently public source assets, visitor uploads, images created in this task, and persisted thumbnails of this task’s video outputs; private source frames/models remain unavailable. Video refinements use `create_video`; `edit_video` is not exposed in this public flow. Guest quality, credit and duration limits still apply.

Signup carries the claim to web-core. Log In is a normal login link and does not carry a chat claim. Web-core imports originals and the transcript with #7520's permission checks and idempotent import. Pending questions remain answerable. Download/refinement selections become a draft in the copied conversation; continuation does not automatically spend credits. The web-core entry module captures the claim in sessionStorage and removes it from the URL before app telemetry initializes, including nested signup return URLs. Auth and onboarding keep only the task ID in the URL. If tab storage is blocked, an in-memory claim retains the current SPA handoff. The task marker stays in the URL so a reload that loses the claim shows recovery guidance instead of silently dropping the import. Sentry and analytics redact residual claim URLs; import mutations use no-cache.

## Follow-ups

* [ ] Add “Paste product URL” alongside product uploads. Accept URL answers at the product-selection step, enable the existing `retrieve_product_from_url` tool for Remix profiles, and feed retrieved product details/images into the Remix skill. Verify the real URL → references → generation flow without adding a separate system prompt.
* [ ] Handle undersized video references in the shared generation pipeline for both public and logged-in Agents. A 128 × 128 upload remains unchanged by `preprocessStyleReferenceImage` (`withoutEnlargement: true`), but MiniMax H3 reference-to-video rejects images below 256 × 256. Apply provider-specific minimum-size handling before generation, preserve a useful validation error instead of “Generation failed,” and prevent retries with the same invalid input. Cover small and narrow images with regression tests and verify the real provider path.

## Verification and deployment

Start the isolated local stack with `./bin/dev-isolated-ports.sh`, using its printed GraphQL, web-public and web-core URLs. Set web-public’s `NEXT_PUBLIC_WEB_CORE_URL` to that web-core origin. Run the file-processing service from the stack and point local GraphQL’s `FILE_PROCESSING_URL` at it; the deployed TEST version may not yet include the foundation’s watermark routes. Video imports also require GraphQL's existing Cloudflare account, customer and API key settings. Configure the TEST service identity and profiles above, then use a named `agent-browser` session with real TEST public sources. Verify product uploads → Agent question → answer → watermarked generation → signup → imported conversation and selected action. Check persisted task status, generation outputs and credits in the GraphQL backend; do not substitute browser or API responses. Restore any temporary TEST configuration afterward.

Both production consumers require successful GraphQL and subscription deployments for the same commit when producer files change. The preview workflow passes the matching web-core deployment URL directly to web-public for signup continuation whenever both previews run. The PR is based on master and reuses the guest engine and shared remix source resolver.
