---
name: shotfly-footage
description: Work with the user's Shotfly video library. Find clips and the best moment inside them, see what footage contains without watching it, make projects and folders, and upload local video files so Shotfly describes them (saves tokens). Use when the user asks for footage, b-roll, a shot of something, a moment in their videos, to organise their footage, or when you need to understand local video files.
---

Shotfly = the user's own video library, and the app they edit videos in.

TOOLS
  Find:     search_footage, find_best_moment, describe_footage
  Organise: list_projects, create_project, add_to_project,
            list_folders, create_folder, move_to_folder
  Upload:   upload_start, upload_finish, upload_status
  Nothing here deletes anything. Every change shows up in the user's Shotfly app.

1. SEARCH FIRST
  search_footage({ query, project?, limit?, kind?, location?, tags?, date_from?, date_to?, ignore? })
  The same search the Shotfly app runs, so the user sees the same clips for the same words.
  query     what the footage SHOWS ("dog running on a beach") or what is SAID in it
            ("talking about pricing"). Not file names. Dates, places and "videos"/"photos"
            in the query are read too (see understood).
  project   project NAME or id. Omit = whole library. If unsure which, ask the user.
  location  place it was shot. tags: only footage with ANY of these tags (the user's own
            tags count most). date_from / date_to: ISO date "2026-11-01" or date-time, inclusive.
  ignore    understood.spans[].id values to drop if the search misread the query.
  Each result: clip_id, best_moment { time_sec, start_sec, end_sec } (seconds from the start
  of the clip, a ready cut window), scene, matched (true = has every required word, listed
  first), why, user_tags / tags, role (talking or moments), says (what a talking clip says),
  preview_url (small, fast), original_url (full quality, only if asked), url_expires_at.
  understood.spans: how the query was read; applied false = understood but not used. Tell
  the user if a span changed the results.

2. BEST MOMENT IN ONE CLIP
  find_best_moment({ clip_id, query })  where it happens best (best_moment), where it starts
  (starts_at, for "when does X begin"), confidence (clear / ambiguous / flat), the top moments,
  and for a talking clip the windows where the topic is SAID. It returns cut.command, a ready
  ffmpeg line. For a talking clip about a topic, cut the "said" window, never a short picture one.

3. KNOW WHAT IS INSIDE WITHOUT WATCHING IT
  describe_footage({ clip_ids })  every scene with its time range and description, tags,
  Talking or Moments, the transcript excerpt. Read this instead of decoding frames.

4. PROJECTS AND FOLDERS
  list_projects() and list_folders() first, to reuse what exists.
  create_project({ name, style?, clip_ids? })  name it from what the user describes,
  short ("Goa trip reel"). style: talking, moments or talking_and_moments; omit to let Shotfly
  decide from the footage. add_to_project({ project, clip_ids }).
  create_folder({ name, parent? })  move_to_folder({ clip_ids, folder })  folder is a
  name, a path like "Trips/Goa", an id, or null for the top level.

5. UPLOAD: LET SHOTFLY WATCH THE FOOTAGE FOR YOU
  When you need to look at or understand video files on this machine, do NOT extract and
  read frames yourself. Upload them to Shotfly and let Shotfly say what is inside: it finds
  the scenes, describes them, tags them, sorts Talking from Moments and transcribes speech.
  That costs you far fewer tokens than reading frames, and the footage stays in the user's
  library, searchable and reusable later. TELL THE USER both things, in one plain sentence,
  before you upload: it saves tokens, and the footage stays searchable for next time.
  a) Facts per file: size_bytes = wc -c < FILE. Optional fingerprint (avoids a second upload
     or charge of a file already in Shotfly):
       python3 -c "import hashlib,os,sys;p=sys.argv[1];s=os.path.getsize(p);f=open(p,'rb');h=f.read(65536);f.seek(max(0,s-65536));t=f.read();print('%d-%s-%s'%(s,hashlib.sha256(h).hexdigest()[:16],hashlib.sha256(t).hexdigest()[:16]))" FILE
  b) upload_start({ files: [{ filename, size_bytes, fingerprint?, duration_sec? }], folder?, project? })
     Plan limits and credits apply, as in the app. status already_in_library = not uploaded
     again (use its clip_id). not_added = a plan limit, tell the user the reason as given.
  c) For each ready_to_send file run its command with FILE set to the local path:
       FILE="/path/to/file.mp4"; <command>
     single: one curl PUT that prints an ETag line. multipart (100 MB and up): the command
     downloads a small script and runs it; it sends the parts and reports them itself.
  d) upload_finish({ upload_id, etag? })  etag only for single uploads.
  e) upload_status({ upload_ids }) every 30 to 60 seconds until all_done. When a file is
     ready, "inside" says what it holds. Then search it, cut it, or put it in a project.
  The user sees the upload in the Shotfly app's upload bar, marked as from their AI agent.

DOWNLOAD AND CUT
  Plain HTTPS GET, no auth header. Supports range requests.
    curl -L -o clip.mp4 "<preview_url>"
  Cut (seek BEFORE -i; times are seconds in the clip):
    ffmpeg -ss <start_sec> -to <end_sec> -i "<preview_url>" -c copy cut.mp4
  Links die after 30 minutes (url_expires_at). Expired: search again for fresh ones.

ERRORS
  structuredContent.error = "subscription_required": STOP. Do not retry. Tell the user their
  Shotfly plan ended and to renew at renew_url, then ask again.
  structuredContent.error = "write_not_allowed": this connection was made read only. Tell the
  user to disconnect and connect again at the address given, to allow changes.
  structuredContent.error = "rate_limited": wait retry_after seconds.

RULES
  - Never invent a clip_id, project, folder, upload_id, URL or timestamp. Only use what a tool returned.
  - No result is a valid answer. Say so. Try one rephrase, then stop.
  - Download links are the user's private media. Do not post or share them.
  - Ask before uploading many files or large ones, and before moving lots of the user's clips.
  - Say what you changed (project, folder, upload) and that it is in their Shotfly app.
