agentleFS
Dqz00116Dqz00116/skill-lib/kimicode-vision-bridge/SKILL.md

kimicode-vision-bridge

Skill22 starsChanged 7 months agoMITView on GitHub

Use when the current Agent LLM cannot process images directly and visual analysis is needed — bridges images through KimiCode CLI print mode to a multimodal Kimi model for text description

  • Reads credentials

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 2 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill when:

    line 32
  2. Distinctive:

    Do NOT use when:

    line 37
  3. Very specific:

    If config uses env vars (e.g., $KIMI_API_KEY), verify those are set

    line 77

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

KimiCode Vision Bridge

Overview

Routes images through KimiCode CLI's print mode (kimi --print) to give a non-vision Agent LLM visual understanding. Kimi is a multimodal model; print mode provides a non-interactive, programmatic pipe — the Agent submits an image + question via CLI, Kimi returns a text description on stdout.

Agent (no vision)                KimiCode CLI                  Kimi multimodal model
     │                                │                              │
     │  image + question              │                              │
     ├───────────────────────────────→│                              │
     │  kimi --print -p "..."         │                              │
     │                                ├─────────────────────────────→│
     │                                │     API call with image      │
     │                                │←─────────────────────────────┤
     │                                │     text response            │
     │←───────────────────────────────┤                              │
     │  text on stdout                │                              │
     ▼                                ▼                              ▼

Print mode docs: https://www.kimi-cli.com/en/customization/print-mode.html

When to Use

Use this skill when:

  • The current Agent LLM cannot process images directly (no vision capability)
  • An image needs to be read or analyzed — screenshots, photos, diagrams, charts, document scans, UI mockups
  • KimiCode CLI is installed and configured with a vision-capable model on the system

Do NOT use when:

  • The Agent already has native image input — this skill adds an unnecessary hop
  • The task is pure text analysis with no visual component
  • KimiCode is not installed or lacks a vision model

Prerequisites (MUST verify before proceeding)

Both checks must pass. If either fails, stop and report the failure.

Check 1: KimiCode CLI (kimi) is installed

Windows (PowerShell):

Get-Command kimi -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Source

macOS / Linux:

which kimi || command -v kimi
ResultAction
FoundPass
Not foundFail. "KimiCode CLI not found. Install from https://www.kimi-cli.com"

Check 2: A multimodal (vision-capable) model is configured

Locate the config file and verify an API key and a vision model are set.

Config locations (try in order):

WindowsmacOSLinux
%APPDATA%\kimi\config.json~/Library/Application Support/kimi/config.json~/.config/kimi/config.json
%USERPROFILE%\.kimi\config.json~/.kimi/config.json~/.kimi/config.json

Verify:

  1. A non-empty API key (fields: apiKey, token, api_key, or under providers)
  2. A model name (fields: model, defaultModel) — must be vision-capable
  3. If config uses env vars (e.g., $KIMI_API_KEY), verify those are set
ResultAction
API key + vision model setPass
API key missingFail. "No API key configured. Run kimi config set or edit the config file."
Model missing or text-onlyFail. "No vision model configured. Set a multimodal model via kimi config set model <name> (e.g., moonshot-v1-vision, gpt-4o, claude-3.5-sonnet)."

The Pipe: Core Workflow

Once prerequisites pass, the bridge has two steps.

Step A: Submit image + question to Kimi via print mode

The Agent already has an image (from the user, from a file, from a prior tool call). Combine it with a clear instruction and pipe it through kimi --print.

Approach 1 — File reference (recommended)

Point Kimi at the image file on disk. KimiCode's file-read tool loads and analyzes it.

kimi --quiet -p "Describe every visible element in this image in detail: /path/to/image.png"

Approach 2 — Inline base64 via JSONL stdin (fully programmatic)

Pipe the image as base64 directly — no temp file needed.

BASE64=$(base64 -w 0 /path/to/image.png)
echo "{\"role\":\"user\",\"content\":[{\"type\":\"image_url\",\"image_url\":{\"url\":\"data:image/png;base64,$BASE64\"}},{\"type\":\"text\",\"text\":\"Describe every visible element in this image in detail.\"}]}" \
  | kimi --print --input-format=stream-json --output-format=stream-json

Windows PowerShell equivalent:

$base64 = [Convert]::ToBase64String([IO.File]::ReadAllBytes("C:\path\to\image.png"))
$msg = '{"role":"user","content":[{"type":"image_url","image_url":{"url":"data:image/png;base64,' + $base64 + '"}},{"type":"text","text":"Describe every visible element in this image in detail."}]}'
$msg | kimi --print --input-format=stream-json --output-format=stream-json

Effective prompts for the image question:

ScenarioPrompt
Generic"Describe every visible element — text, layout, colors, positions, any errors or warnings."
UI/dialog"Read every label, button text, input field value, and error message in this screenshot."
Code"Read all visible code including line numbers, syntax highlighting, and any squiggly/error indicators."
Chart/graph"Describe the chart type, axes labels, data ranges, trend direction, and any annotations."
Document"Transcribe the visible text exactly. Note any formatting (bold, headers, tables)."

Step B: Read the text result and feed into Agent context

FlagsOutput formatHow to parse
--quietPlain text, final message onlyRead directly
--output-format=stream-jsonJSONL, one JSON per linegrep '"role":"assistant"' | tail -1 | jq -r '.content'

Inject into Agent context:

[Vision bridge: KimiCode print mode]
<text from stdout>
[End vision bridge]

Complete pipeline example

IMAGE="/path/to/image.png"
RESULT=$(kimi --quiet -p "Describe every visible element in $IMAGE in detail" 2>/dev/null)
echo "[Vision bridge: KimiCode print mode]"
echo "$RESULT"
echo "[End vision bridge]"

Image Sources

The bridge works with any image the Agent can reference. Common sources:

  • User-provided file path — kimi --quiet -p "Describe ~/Downloads/screenshot.png"
  • Screenshot captured on-the-fly — capture with OS tool first, then feed the saved file (macOS: screencapture, Windows: PowerShell GDI+, Linux: ImageMagick/gnome-screenshot)
  • Image from a prior tool call — pass the path from a previous download/generation step
  • Clipboard image — save to temp file first, then bridge

Screenshot capture is not part of the bridge skill itself — use platform-native tools.

Iterative Refinement

  1. Narrow the question: "Focus only on reading every text string in the dialog box."
  2. Compare states: Submit two images and ask "Compare these two screenshots and describe what changed."
  3. Crop and retry: Crop to a sub-region with OS tools and re-submit

Common Mistakes

MistakeFix
Using a text-only modelRun kimi config set model <vision-model> to switch
Image path contains spaces or special charsWrap path in quotes or use a temp file with a simple name
Expecting KimiCode to take screenshotsUse OS tools; KimiCode is the analysis pipe, not the capture tool
Forgetting to verify prerequisites firstAlways run Check 1 and Check 2 before attempting the bridge
Not checking exit codes0=success, 1=permanent error (auth/config), 75=transient (rate limit, retry)

Error Recovery

SymptomLikely causeAction
kimi: command not foundCLI not on PATHInstall from https://www.kimi-cli.com
Exit code 75Rate limit / transientWait 10s, retry
Exit code 1Auth or config errorRun kimi config to check API key and model
Empty or nonsensical outputModel may not be vision-capableVerify the model supports multimodal input
"Image input not supported" in outputModel is text-onlySwitch to a vision model in KimiCode config
Base64 too large for stdinImage too bigUse file-reference approach (Approach 1)
Output appears truncatedLong responseUse --output-format=stream-json for reliable capture

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.