decompose
Skill16 starsChanged 7 months agoApache-2.0View on GitHub
Decompose an image into editable semantic layers using Vulca SDK. Invoke when the user asks to "decompose", "split into layers", "拆图", or mentions layer extraction from a specific image path.
15 other projects use a version of this.
Adopted by
Most recently taken up by
- chippingway/chipping-orchestratortheir own version, first seen Oct 4, 2026
- TserenTserenov/FMT-exocortex-templatetheir own version, first seen Oct 1, 2026
- stormlightlabs/thunderustheir own version, first seen Sep 19, 2026
- miztertea/sergeant-rstheir own version, first seen Aug 25, 2026
- zcaceres/skillstheir own version, first seen Aug 19, 2026
- flpbalada/fb-skillstheir own version, first seen Aug 3, 2026
Used with
Projects with it also use review and implement.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.Other versions15 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 15
- TserenTserenov/FMT-exocortex-template★ 62same name
- drafthq/draft★ 40same name
- jesgarram/arete★ 40same name
- chippingway/chipping-orchestrator★ 16same name
- matt-k-wong/mkw-DAG-architect★ 15same name
- teklabsdigital/x2-method★ 15same name
- tercel/spec-forge★ 10same name
- flpbalada/fb-skills★ 8same name
- zcaceres/skills★ 7same name
- HartreeWorks/research-skills★ 4same name
5 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository20 other files it gives its agents.
- decomposeSkill
- evaluateSkill
- using-vulca-skillsSkill
- visual-brainstormSkill
- visual-discoverySkill
- visual-planSkill
- visual-specSkill
- evaluateSkill
- using-vulca-skillsSkill
- visual-brainstormSkill
- visual-discoverySkill
- visual-planSkill
- visual-specSkill
- decomposeSkill
- evaluateSkill
- using-vulca-skillsSkill
- visual-brainstormSkill
- visual-discoverySkill
- visual-planSkill
- visual-specSkill
The file
We split this skill into the rules it gives an agent
9 rules. 0 are common, 5 are distinctive, and 4 are very specific to this project.
0
Common
Most of the 13 edited versions we read keep these.
5
Distinctive
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 10
Use the Read tool on the user's image path.
- Distinctive: line 17
Start simple. Minimum viable shape:
- Distinctive: line 32
Start with 2-4 entities. Add more only if residual > 20% AND the previous iteration did not increase residual.
- Very specific: line 45
Use plan (inline) unless you already have a file.
- Very specific: line 122
E1 — No per-person face-part entities: Never author face_person_a, face_person_b, etc.
- Very specific: line 125
E4 — Surface hint-heavy warning: If detection_report["warning"] fires (requested > 2 AND bbox_hint ratio > 0.5), tell the user their plan …
- Very specific: line 130
If the session has been running for hours and new decompose calls slow down or OOM, call unload_models() to free ~3GB.
- Distinctive: line 134
Do not modify the Vulca SDK code.
- Distinctive: line 135
If the user wants a capability the SDK cannot produce, say so plainly.
“Common” is measured: kept by at least 6 in 10 of the 13 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
You are decomposing an image into semantic layers via the Vulca SDK. The pipeline stitches YOLO + Grounding DINO + SAM + SegFormer; you (the agent) author a JSON plan and call the MCP tool. No LLM runs inside the SDK.
Step 1: Read the image
Use the Read tool on the user's image path. Identify:
- Major subjects (persons, objects, background elements)
- Lighting / domain (portrait, news, painting, concert, etc.)
- Visible occlusions or crowded regions
Step 2: Author a minimal plan
Start simple. Minimum viable shape:
{
"domain": "portrait_photograph",
"entities": [
{"name": "subject", "label": "short description", "detector": "auto"},
{"name": "background", "label": "short description",
"semantic_path": "background", "detector": "dino", "threshold": 0.2}
]
}Pick domain from: portrait_photograph, concert_photograph, news_photograph_2024, renaissance_painting, post_impressionist_painting, american_regionalist_painting, booking_photograph, or photograph as fallback. domain picks DOMAIN_PROFILES (thresholds, person chain, tiling) — get it right.
Start with 2-4 entities. Add more only if residual > 20% AND the previous iteration did not increase residual.
Step 3: Call the MCP tool
layers_split(
image_path="/abs/path/to/img.jpg",
output_dir="/abs/path/to/output",
mode="orchestrated",
plan='<inline JSON string>'
)Use plan (inline) unless you already have a file; then use plan_path. Passing both returns an error.
Step 4: Inspect the result
The return dict has: status, manifest_path, output_dir, reason, detection_report, stage_timings, layers.
status enum: ok | partial | error | skipped | unknown
Walk this decision tree in order; take the FIRST match.
Per-entity signals (highest priority)
| Branch | Condition | Fix |
| A | any detection_report[entity].status == "missed" | rewrite label or switch detector (auto → dino → sam_bbox) |
| B | any status == "suspect" (from empty_mask, low_bbox_fill, mask_outside_bbox — sam_bbox only) | adjust bbox_hint_pct or tighten label |
| C | any layer quality_flag == "area_ballooned" (pre 0.01%-0.5% AND post > pre×3) | tighten bbox or raise threshold |
| D | any layer quality_flag == "over_eroded" (pre > 0.1% AND post/pre < 0.5) | promote order: 10 or move semantic_path to foreground.* |
| E | any person quality_flag == "face_parse_skipped" AND that person's pct > 3% | head+body split (exactly TWO entities per occluded person — one head bbox + one body bbox, composite with PIL alpha_composite after). Different from the E3 ban below. Alternative: crop face region + 2× upscale + ~20% brightness + re-decompose. |
Delta-residual guard
| Branch | Condition | Fix |
| F | residual layer exists AND pct > prev_residual.pct + 1pp | revert to the prior entity set; do not continue decomposing that region |
Residual-driven additions
| Branch | Condition | Action |
| G | residual layer pct > 20% | Look at the emitted residual.png under layers[]. Add the missing entity. |
| H | residual pct in 5-20% | Judgment call: add if payoff clear. |
| I | residual layer absent OR pct < 5% | STOP adding. (Over-decomposition guard — splitting further will reduce coverage.) |
Honesty signal
| Branch | Condition | Action |
| J | detection_report["warning"] present (requested > 2 AND hint ratio > 0.5) | Surface to user: plan is hint-heavy and fragile. |
Face-parse rescue ladder
The pipeline does not return a face_parts_count field. To count, filter layers[] where semantic_path starts with subject.person[N]. followed by one of: {eyes, nose, lips, eyebrows, ears, hair, neck, skin, cloth, hat}. If any person's count < 6 AND you judge (via Read tool on the original) the face is small/dark, try in order — accept only when the count increases:
- Crop face region → new slug → re-decompose
- Add 2× upscale
- Add ~20% brightness/contrast
face_parse_skipped flag is distinct from sparse face parts — it fires only when SegFormer returns zero parts.
Error handling
| Error | Response |
{"error": "pass either plan (inline JSON) or plan_path, not both"} | Fix call, pass only one. |
{"error": "orchestrated mode requires 'plan' (inline JSON) or 'plan_path'"} | Author plan, retry. |
{"error": "plan validation failed: ..."} | Read details, fix specific field. |
error contains MemoryError, OutOfMemoryError, OutOfMemory, or CUDA out of memory (any OOM variant) | (1) Call unload_models(). (2) Reduce image to ≤2 MP (resize or crop). (3) Reduce to 2-3 entities. Then retry ONCE. |
error contains ConnectionError, HTTPError, ConnectTimeout, or OSError with huggingface in message | HuggingFace weights failed to download. Report to user. Do not auto-retry. |
error contains RuntimeError AND (MPS, Metal, mps, or mps_kernels in the message) — treat as transient | 1 soft retry after unload_models(); if it recurs, suggest session restart. |
{"error": "pipeline error: PermissionError: ..."} | Change output_dir. |
{"error": "pipeline error: FileNotFoundError: ..."} | Verify image_path. |
error contains UnidentifiedImageError, cannot identify image, decode, or Invalid image | Convert WebP/HEIC to PNG/JPG, or check the image file is not corrupted. |
{"error": "pipeline error: <other>: ..."} | Report full error. Do not auto-retry. |
status == "error" | Read reason. If image_load: ... → fix image. If pipeline produced no manifest → stop, no retry. |
status == "skipped" | Cached manifest returned; ensure force=True when retrying. |
status == "unknown" | Manifest missing status; treat as error. |
all entities status == "missed" | Retry ONCE with swapped domain first, then with rewritten labels. |
Hard iteration cap
- Maximum 5
layers_splitcalls per source image. - Also stop early if the previous iteration improved residual by < 2 percentage points (diminishing returns).
- Cap is per-image, not per-session.
Skill bans (rules the pipeline cannot enforce; you must)
- E1 — No per-person face-part entities. Never author
face_person_a,face_person_b, etc. The Phase 1.11 sibling-mask only isolates face parts within aface_person_Nsubtree — it cannot deduplicate across entities you author manually. Declaresubject.person[N]; face parts are auto-generated whenexpand_face_partsis true. - E2 — No foreground objects under
background.*. The person-overlap leak-fix skips any entry whosesemantic_pathstarts withbackground. If an object overlaps a person, put it underforeground.*orsubject.*, notbackground.*. - E3 — No manual head/torso/limbs split (3+ entities per person).
body_remainderauto-generates only whensubparts_keptis populated by face-parsing. Manually splitting into head + torso + legs will produce holes. Exception: the Branch E head+body split (exactly TWO entities per person) is allowed — it applies when face-parsing itself failed and nobody_remainderexists to preserve. - E4 — Surface hint-heavy warning. If
detection_report["warning"]fires (requested > 2 AND bbox_hint ratio > 0.5), tell the user their plan is over-hinted and fragile. Do not silently iterate. - E5 — Never dispatch two
layers_splitcalls in parallel. The pipeline mutates module-global state (cop.ORIG_DIR,OUT_DIR,PLANS_DIR); concurrent calls corrupt each other.
Memory management
If the session has been running for hours and new decompose calls slow down or OOM, call unload_models() to free ~3GB. Next decompose will cold-start (~3-4s).
Out of scope
- Do not modify the Vulca SDK code. Iterate by changing the plan.
- If the user wants a capability the SDK cannot produce, say so plainly.
- The skill's decision tree covers ~90% of cases; when a 6th iteration is tempting, stop and show the user what you have.
Reference
Full thesis + rescue-pattern writeup: [docs/agent-native-workflow.md](<vulca-repo-root>/docs/agent-native-workflow.md).
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
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.

