AGENT SKILL

notes_attach_image

Attach an image file to a Notes note. Notes' AppleScript dictionary does NOT support `make new attachment` for image files, so this skill uses the clipboard-paste path: 1. Read the image into the system pasteboard via `osascript`'s `(read POSIX file "X" as JPEG picture)` coercion (works for JPEG / PNG / TIFF — checks file extension). 2. Activate Notes, select the target note, focus the body. 3. Move cursor to end of body, then Cmd+V — Notes pastes a pasteboard image as an attachment in the note. This is more robust than the Edit-menu "Attach File" UI flow, which opens a file picker that's brittle to AX-walk.

使用场景图像与多媒体
License 许可
Apache-2.0
所属仓库
LocalKinAI/kinclaw
最近更新
2026-11-01
Stars
★ 9
Forks
3

01 前言 Front Matter

args
[ "{{note}}", "{{image}}" ]
name
notes_attach_image
schema
{ "note": { "type": "string", "required": true, "description": "Exact note title" }, "image": { "type": "string", "required": true, "description": "Absolute POSIX path to JPEG / PNG / TIFF / HEIC image" } }
command
[ "sh", "-c", "NOTE=\"$1\"; IMG=\"$2\"\n[ -z \"$NOTE\" ] && { echo \"note title required\" >&2; exit 1; }\n[ -z \"$IMG\" ] && { echo \"image path required\" >&2; exit 1; }\n[ ! -f \"$IMG\" ] && { echo \"image file not found: $IMG\" >&2; exit 1; }\n\n# Detect type by extension for AppleScript pasteboard coercion\ncase \"${IMG##*.}\" in\n [Jj][Pp][Gg]|[Jj][Pp][Ee][Gg]) AS_TYPE=\"JPEG picture\" ;;\n [Pp][Nn][Gg]) AS_TYPE=\"«class PNGf»\" ;;\n [Tt][Ii][Ff]|[Tt][Ii][Ff][Ff]) AS_TYPE=\"TIFF picture\" ;;\n [Hh][Ee][Ii][Cc]) AS_TYPE=\"«class heic»\" ;;\n *) AS_TYPE=\"«class furl»\" ;; # fall back to file URL\nesac\n\n# Step 1: load image into clipboard\nLOAD_RESULT=\"$(osascript 2>&1 <<APPLE\ntry\n set the clipboard to (read POSIX file \"$IMG\" as $AS_TYPE)\n return \"loaded\"\non error e\n try\n -- Fallback: just put the file:// URL on clipboard\n set the clipboard to POSIX file \"$IMG\"\n return \"loaded_as_file_url\"\n on error e2\n return \"ERR_CLIPBOARD: \" & e2\n end try\nend try\nAPPLE\n)\"\nif [[ \"$LOAD_RESULT\" == ERR* ]]; then\n echo \"$LOAD_RESULT\" >&2\n exit 1\nfi\n\n# Step 2: paste into Notes\nosascript 2>&1 <<APPLE\ntell application \"Notes\"\n activate\n try\n show (first note whose name = \"$NOTE\")\n on error\n return \"ERR: note not found\"\n end try\nend tell\ndelay 0.8\n\ntell application \"System Events\"\n tell process \"Notes\"\n try\n set mainWin to window 1\n try\n set bodyArea to text area 1 of scroll area 1 of group 1 of splitter group 1 of mainWin\n perform action \"AXFocus\" of bodyArea\n end try\n end try\n end tell\n delay 0.3\n -- Move to end of body\n key code 125 using {command down}\n delay 0.1\n keystroke return\n delay 0.1\n -- Paste image\n keystroke \"v\" using {command down}\n delay 0.8\nend tell\nreturn \"ok: pasted (mode: $LOAD_RESULT)\"\nAPPLE\n", "_" ]
timeout
20
description
Attach an image file to a Notes note. Notes' AppleScript dictionary does NOT support `make new attachment` for image files, so this skill uses the clipboard-paste path: 1. Read the image into the system pasteboard via `osascript`'s `(read POSIX file "X" as JPEG picture)` coercion (works for JPEG / PNG / TIFF — checks file extension). 2. Activate Notes, select the target note, focus the body. 3. Move cursor to end of body, then Cmd+V — Notes pastes a pasteboard image as an attachment in the note. This is more robust than the Edit-menu "Attach File" UI flow, which opens a file picker that's brittle to AX-walk.

02 资源文件 3

03 SKILL.md 正文

notes_attach_image — paste an image as a Notes attachment

Notes attachments via AppleScript are not supported in modern macOS; the canonical path is via the clipboard. This skill loads the image into the pasteboard with the correct image-type coercion, then pastes into the focused note body — Notes recognizes the pasteboard image and stores it as a real attachment.

Examples

notes_attach_image note="KinBench Image 171" image="/Users/me/Pictures/cat.jpg"
  → ok: pasted (mode: loaded)

04 同仓库更多 Skills

LocalKinAI
LocalKinAI/kinclaw

web

Universal web tool — fetches and interacts with web pages through real Chromium (Playwright). Renders JavaScript, follows redirects, handles cookies, bypasses many anti-scrape stubs that block plain `web_fetch`. Each call launches a fresh browser, executes the requested flow, closes. ~2-3s cold start; no persistent state. Use INSTEAD of `web_fetch` when: - Target is a JS-heavy SPA (prices via XHR, lazy content) - `web_fetch` returned an anti-scrape placeholder (Zhihu's "click here" stub, JD's chrome-only HTML) - You need to interact (click, fill input) before extracting Common patterns: fetch rendered text: url=X wait for content then read: url=X wait_for=".price" extract specific element: url=X selector=".product-list" click and read result: url=X click=".search-button" fill form, then read: url=X click="input[name=q]" type_text="kinclaw" fill + Enter (React forms): url=X click="input" type_text="hi" press_enter=true wait_for=".reply" screenshot the page: url=X screenshot=true (returns image:// marker) run JS and get result: url=X js="document.title" First-time setup (one-time per machine, ~500MB Chromium download): pip install playwright playwright install chromium

文档处理测试与质量
★ 9
LocalKinAI
LocalKinAI/kinclaw

weather

Current conditions plus a three-day forecast (today / tomorrow / day after) for a place, in metric, from wttr.in. No API key. Use this for any weather question — including "明天" and "后天" — before reaching for web search.

★ 9
LocalKinAI
LocalKinAI/kinclaw

tts

Synthesize speech from text and play it through the macOS speakers. Talks to a local LocalKin Service Audio Server (default :8001 / Kokoro). When `record` is running with audio=true, the spoken audio is captured into the recording — use this in place of `shell say` for high-quality multilingual narration in demo videos. Set the TTS_ENDPOINT env var to point at a different server.

图像与多媒体Skill与智能体开发
★ 9
LocalKinAI
LocalKinAI/kinclaw

translate

Translate text between languages using the system's translate command

★ 9
LocalKinAI
LocalKinAI/kinclaw

summarize

Summarize a file's contents into key bullet points

资料检索与研究
★ 9
LocalKinAI
LocalKinAI/kinclaw

stt

Transcribe an audio file (wav/mp3/mp4/m4a) into text via a local LocalKin Service Audio Server (default :8000 / SenseVoice). Pair with `record action=start mic=true` to turn a recorded mic track into text. Set STT_ENDPOINT env var to point at a different server.

图像与多媒体
★ 9