Ai photos

From LeoYeAI/openclaw-master-skills · View interactive version

Ai photos is an AI agent skill from the GitHub repository LeoYeAI/openclaw-master-skills. Personal AI photo album for OpenClaw. Use when users say: - "index my photos" - "set up an AI photo album" - "search my photo library" - "reconnect my photo album" - "find photos of ...

How to use this skill

Skill file

ai-photos

ai-photos turns one or more local photo sources into a searchable AI photo album for OpenClaw.

Supported formats:

When talking to users:

Suggested user-facing capability summary:

Required outcome

This task is not complete until all of the following are true:

  1. at least one photo source is chosen and readable for a new album
  2. image analysis is verified to work in the current OpenClaw runtime
  3. the album backend is created or reconnected and writable
  4. the first import succeeds, or an existing album is verified reachable
  5. the user explicitly approved automatic indexing or explicitly declined it
  6. if automatic indexing was approved, OpenClaw heartbeat is configured without breaking existing heartbeat tasks, the ai-photos block is present in HEARTBEAT.md, and one verification heartbeat has run
  7. the user has been told the album is ready and has been invited to try a search
  8. the user has been sent the final handoff

Internal terms

Use these terms for agent reasoning, troubleshooting, or recovery only.

Do not introduce them to the user unless needed.

If the user asks what to save for later, explain that OpenClaw saves the reconnect information automatically at ~/.openclaw/ai-photos/albums/default.json, and that they only need to keep that file if they want a manual backup.

Caption schema

Each captioned JSONL line should contain the original manifest fields plus vision-model output.

Required base fields:

Vision fields:

Optional fields:

Example:

{
  "file_path": "/photos/2026/03/cat.jpg",
  "filename": "cat.jpg",
  "sha256": "abc123",
  "mime_type": "image/jpeg",
  "size_bytes": 231231,
  "width": 3024,
  "height": 4032,
  "taken_at": "2026-03-12T09:12:00+00:00",
  "exif": {"Make": "Apple", "Model": "iPhone 15 Pro"},
  "caption": "A white cat resting on a gray sofa near a sunlit window.",
  "tags": ["cat", "sofa", "indoor", "sunlight", "pet"],
  "scene": "living room",
  "objects": ["cat", "sofa", "window"],
  "text_in_image": null,
  "metadata": {"source": "demo"}
}

CLI runtime

This skill does not depend on a local Python environment or a checked-out Go source tree.

It uses the latest published ai-photos CLI release from:

At the start of every ai-photos task, run the bootstrap flow exactly once and reuse the resulting binary path for the rest of the task.

Bootstrap flow

Run this shell block and capture its stdout as AI_PHOTOS_BIN:

ensure_ai_photos() {
  AI_PHOTOS_REPO="zoubingwu/openclaw-ai-photos"
  AI_PHOTOS_BIN_DIR="$HOME/.openclaw/ai-photos/bin"
  AI_PHOTOS_BIN="$AI_PHOTOS_BIN_DIR/ai-photos"

  mkdir -p "$AI_PHOTOS_BIN_DIR"

  os="$(uname -s | tr '[:upper:]' '[:lower:]')"
  case "$os" in
    darwin) goos="darwin" ;;
    linux) goos="linux" ;;
    *)
      echo "unsupported platform: $os" >&2
      return 1
      ;;
  esac

  arch="$(uname -m)"
  case "$arch" in
    x86_64|amd64) goarch="amd64" ;;
    arm64|aarch64) goarch="arm64" ;;
    *)
      echo "unsupported architecture: $arch" >&2
      return 1
      ;;
  esac

  archive_name="ai-photos_${goos}_${goarch}.tar.gz"
  archive_url="https://github.com/${AI_PHOTOS_REPO}/releases/latest/download/${archive_name}"
  tmp_dir="$(mktemp -d)"
  had_existing_binary=0
  if [ -x "$AI_PHOTOS_BIN" ]; then
    had_existing_binary=1
  fi

  if curl -fL "${archive_url}" -o "$tmp_dir/${archive_name}" \
    && tar -xzf "$tmp_dir/${archive_name}" -C "$tmp_dir" \
    && install -m 0755 "$tmp_dir/ai-photos" "$AI_PHOTOS_BIN"; then
    rm -rf "$tmp_dir"
    printf '%s\n' "$AI_PHOTOS_BIN"
    return 0
  fi

  rm -rf "$tmp_dir"
  if [ "$had_existing_binary" -eq 1 ]; then
    printf '%s\n' "$AI_PHOTOS_BIN"
    return 0
  fi

  echo "could not download ai-photos release archive" >&2
  return 1
}

AI_PHOTOS_BIN="$(ensure_ai_photos)"

Rules:

Onboarding

Step 0 - Choose mode

User-facing:

[AGENT] Branching:

Step 1 - Ask for photo folders

User-facing:

[AGENT]

Do not continue until the user has provided at least one photo source.

Step 2 - Run preflight

User-facing:

[AGENT]

Before indexing anything, verify:

Suggested preflight sequence:

  1. choose one real sample image from the provided sources
  2. run "$AI_PHOTOS_BIN" prepare-image --mode caption <sample-file>
  3. on macOS, also run "$AI_PHOTOS_BIN" prepare-image --mode preview <sample-file>
  4. inspect the JSON result

If the image backend check fails:

If preflight fails:

Step 3 - Choose the backend

[AGENT]

Step 4 - Create or reconnect the album

User-facing for a new album:

[AGENT]

For a new album, run exactly one setup command:

# db9
"$AI_PHOTOS_BIN" setup --source <photo-source-a> --source <photo-source-b> --backend db9 --target <db>

# TiDB
"$AI_PHOTOS_BIN" setup --source <photo-source-a> --source <photo-source-b> --backend tidb --target /path/to/tidb-target.json

Read the JSON output:

[AGENT] For reconnect:

Suggested reconnect check:

"$AI_PHOTOS_BIN" search --recent --limit 1

Do not continue until the backend is confirmed reachable.

Step 5 - Run the shared record ingestion flow

Use this same flow for:

User-facing:

[AGENT]

Input:

Before generating records, read the Caption schema section in this file.

[AGENT] For each record in the input manifest:

  1. run "$AI_PHOTOS_BIN" prepare-image --mode caption <file_path>
  2. send the returned output_path to the vision-capable model
  3. preserve the original manifest fields from the source image
  4. add caption, tags, scene, objects, and text_in_image
  5. write one JSON object per line into a captioned JSONL file
  6. import it with:
"$AI_PHOTOS_BIN" import /tmp/photos.captioned.jsonl

Rules:

Step 6 - Enable automatic indexing

User-facing:

[AGENT]

If the user declines:

If the user says yes:

Then update <workspace>/HEARTBEAT.md without removing unrelated content:

<!-- ai-photos:auto-indexing:start -->
## ai-photos automatic indexing

- Read and learn how to use `ai-photos` skill
- Use `~/.openclaw/ai-photos/bin/ai-photos sync` to scan the configured photo folders for changes.
- Check the configured photo folders for changes and keep the album index up to date.
- If `to_caption` is `0`, it means nothing needs attention, reply `HEARTBEAT_OK`.
- If `to_caption` is greater than `0`, run the shared record ingestion flow using `incremental_manifest_jsonl`.
- Stay quiet unless indexing failed or user action is needed.
<!-- ai-photos:auto-indexing:end -->

Do not rewrite the whole file just to add this block.

Then verify once:

Then tell the user the result:

Step 7 - Final handoff

User-facing handoff should include:

Keep the handoff short and user-facing.

Default to readiness, status, and next actions.

Only include implementation details when the user asks or recovery requires them.

[AGENT]

Immediately after setup:

Search flow

When the user asks to find photos, run:

"$AI_PHOTOS_BIN" search --text "cat on sofa"
"$AI_PHOTOS_BIN" search --tag cat
"$AI_PHOTOS_BIN" search --date 2026-03
"$AI_PHOTOS_BIN" search --recent

When answering:

Local web search

When the user asks to open a browser view for the album:

  1. start the local web service
  2. prefer the saved album profile; use environment variables only to fill missing backend fields
  3. wait for the JSON startup line and return the local URL to the user
  4. keep the process running while the user is browsing

If the user wants to open the gallery from another device:

Run:

"$AI_PHOTOS_BIN" serve

If the user wants a specific album profile:

"$AI_PHOTOS_BIN" serve --profile default

The web service provides:

When handing the web UI to the user:

Heartbeat run behavior

When a heartbeat arrives for a configured album:

  1. run:
"$AI_PHOTOS_BIN" sync
  1. read the JSON output
  2. if to_caption is 0, return HEARTBEAT_OK
  3. if to_caption is greater than 0, run the shared record ingestion flow using incremental_manifest_jsonl
  4. stay quiet unless indexing failed or user attention is needed
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.