Skip to content

elithril/blender-kiln / plugin

Makes and fixes 3D assets in Blender, for games, the web and AR. Use when the user wants a 3D model, prop, character or GLB/glTF/FBX/USDZ file made — from a text brief, a reference image, a free marketplace (PolyHaven, Sketchfab) or AI generation — AND when they bring an existing 3D file to fix: too heavy or too many polygons (optimize, compress, LODs), broken normals, scale or origin, materials lost on glTF export, conversion between GLB, FBX and USDZ, texturing, rigging for animation, animating it (walk and idle cycles, text-to-motion, looping clips, articulated props), or inspection. Drives Blender through a Blender MCP server (ahujasid's or the official Blender Lab one). Batch mode produces many consistent assets unattended. Kiln Studio (`/kiln studio`) opens the project's models in the browser, where the user reviews them and pins notes for Claude to act on.

FileKindSize
.claude-plugin/plugin.jsonconfig1.2 KB
.mcp.jsonconfig236 B
LICENSEother1.0 KB
NOTICEother2.5 KB
SKILL.mdskill md29.0 KB
references/ai-generation.mdmarkdown21.0 KB
references/animation.mdmarkdown21.6 KB
references/batch-mode.mdmarkdown19.5 KB
references/blender-mcp.mdmarkdown9.4 KB
references/characters.mdmarkdown52.8 KB
references/cli-tools.mdmarkdown6.5 KB
references/commands.mdmarkdown10.7 KB
references/export-targets.mdmarkdown14.3 KB
references/log-format.mdmarkdown2.2 KB
references/naming-conventions.mdmarkdown5.8 KB
references/photo-projection.mdmarkdown6.3 KB
references/pipeline-brief.mdmarkdown4.2 KB
references/pipeline-import-cleanup.mdmarkdown6.3 KB
references/pipeline-optimize-export.mdmarkdown6.4 KB
references/pipeline-rig-animate.mdmarkdown5.8 KB
references/pipeline-source.mdmarkdown9.7 KB
references/print.mdmarkdown41.5 KB
references/reference-fidelity.mdmarkdown31.8 KB
references/review-rounds.mdmarkdown10.4 KB
references/setup-install.mdmarkdown2.8 KB
references/setup.mdmarkdown9.2 KB
references/sourcing-strategy.mdmarkdown6.1 KB
references/studio.mdmarkdown38.9 KB
references/texturing-strategy.mdmarkdown14.4 KB
references/topology-rules.mdmarkdown3.9 KB
references/uv-materials.mdmarkdown6.8 KB
references/validation-checklist.mdmarkdown10.5 KB
studio/approval_hook.pyscript14.2 KB
studio/blender_live.pyscript2.3 KB
studio/checks.pyscript38.1 KB
studio/estimate.pyscript4.2 KB
studio/example/barrel/barrel_final.glbbinary111.9 KB
studio/example/barrel/barrel_log.mdmarkdown445 B
studio/handoff.pyscript17.8 KB
studio/mcp_server.pyscript32.7 KB
studio/phoneshare.pyscript17.1 KB
studio/server.pyscript47.9 KB
studio/setup_status.pyscript7.5 KB
studio/static/app.jsscript241.4 KB
studio/static/apple-touch-icon.pngbinary20.6 KB
studio/static/fonts/OFL-JetBrainsMono.txtmarkdown4.3 KB
studio/static/fonts/OFL-Sora.txtmarkdown4.3 KB
studio/static/fonts/jetbrains-mono-latin-ext.woff2binary11.3 KB
studio/static/fonts/jetbrains-mono-latin.woff2binary30.6 KB
studio/static/fonts/sora-latin-ext.woff2binary11.8 KB
studio/static/fonts/sora-latin.woff2binary24.6 KB
studio/static/i18n.jsscript6.2 KB
studio/static/i18n/fr.jsonconfig101.2 KB
studio/static/icon-32.pngbinary2.6 KB
studio/static/icon-64.pngbinary6.6 KB
studio/static/icon-96.pngbinary12.8 KB
studio/static/index.htmlother39.5 KB
studio/static/style.cssother114.5 KB
studio/static/tutorial.jsscript49.0 KB
studio/static/tutorial/barrel_after.glbbinary117.3 KB
studio/static/tutorial/barrel_before.glbbinary111.9 KB
studio/static/tutorial/fixtures.jsonconfig13.5 KB
studio/static/tutorial/lantern_1_blockout.glbbinary83.1 KB
studio/static/tutorial/lantern_2_details.glbbinary101.8 KB
studio/static/tutorial/lantern_3_materials.glbbinary102.0 KB
studio/static/tutorial/lantern_4_final.glbbinary141.1 KB
studio/static/tutorial/make_tutorial.pyscript4.9 KB
studio/static/viewer.jsscript41.4 KB
studio/studio.pyscript29.2 KB
studio/studiolib.pyscript77.8 KB
studio/test_studio.pyscript90.2 KB
studio/test_worker.pyscript31.5 KB
studio/worker.pyscript56.8 KB
studio/worker_blender.pyscript2.7 KB
tools/autorig.pyscript44.1 KB
tools/bind_rigid_parts.pyscript3.6 KB
tools/blender_mcp_start.pyscript1.5 KB
tools/check_usdz.pyscript1004 B
tools/cutout.swiftscript2.0 KB
tools/export_outputs.pyscript5.2 KB
tools/fidelity_check.pyscript39.0 KB
tools/fit_coupon.pyscript11.3 KB
tools/fixtures/skintokens_raw_child.glbbinary88.8 KB
tools/fixtures/skintokens_skeletons.jsonconfig6.5 KB
tools/flatten.pyscript14.9 KB
tools/glb_to_fbx.pyscript2.1 KB
tools/glb_to_usdz.pyscript6.2 KB
tools/motion_loop.pyscript5.9 KB
tools/motion_measure.pyscript15.2 KB
tools/motions/LICENSE-image-to-3dlab.txtmarkdown11.1 KB
tools/motions/cheer.npzbinary48.4 KB
tools/motions/cheer_b.npzbinary48.1 KB
tools/motions/dance.npzbinary78.2 KB
tools/motions/dance_b.npzbinary78.9 KB
tools/motions/death.npzbinary45.9 KB
tools/motions/death_b.npzbinary46.5 KB
tools/motions/fight_stance.npzbinary60.3 KB
tools/motions/fight_stance_b.npzbinary61.3 KB
tools/motions/flying_kick.npzbinary39.7 KB
tools/motions/flying_kick_b.npzbinary39.9 KB
tools/motions/hit_react.npzbinary31.9 KB
tools/motions/hit_react_b.npzbinary31.8 KB
tools/motions/idle.npzbinary51.8 KB
tools/motions/idle_b.npzbinary57.7 KB
tools/motions/jump.npzbinary39.8 KB
tools/motions/jump_b.npzbinary39.9 KB
tools/motions/kata.npzbinary77.4 KB
tools/motions/kata_b.npzbinary75.3 KB
tools/motions/kick.npzbinary32.4 KB
tools/motions/kick_b.npzbinary32.5 KB
tools/motions/presets.jsonconfig9.6 KB
tools/motions/punch.npzbinary32.0 KB
tools/motions/punch_b.npzbinary32.1 KB
tools/motions/punch_combo.npzbinary47.4 KB
tools/motions/punch_combo_b.npzbinary47.5 KB
tools/motions/roll.npzbinary46.7 KB
tools/motions/roll_b.npzbinary47.5 KB
tools/motions/roundhouse.npzbinary39.7 KB
tools/motions/roundhouse_b.npzbinary39.9 KB
tools/motions/run.npzbinary47.2 KB
tools/motions/run_b.npzbinary47.7 KB
tools/motions/sit.npzbinary47.2 KB
tools/motions/sit_b.npzbinary47.2 KB
tools/motions/sneak.npzbinary61.6 KB
tools/motions/sneak_b.npzbinary61.8 KB
tools/motions/strafe_left.npzbinary45.9 KB
tools/motions/strafe_left_b.npzbinary47.1 KB
tools/motions/sword_swing.npzbinary39.7 KB
tools/motions/sword_swing_b.npzbinary39.4 KB
tools/motions/walk.npzbinary62.8 KB
tools/motions/walk_b.npzbinary62.6 KB
tools/motions/walk_woman.npzbinary62.9 KB
tools/motions/wave.npzbinary46.3 KB
tools/motions/wave_b.npzbinary46.3 KB
tools/open_blender.pyscript5.0 KB
tools/photo_project.pyscript37.8 KB
tools/presets.pyscript16.3 KB
tools/print_check.pyscript47.2 KB
tools/quadruped.pyscript19.4 KB
tools/retarget.pyscript46.9 KB
tools/review_renders.pyscript13.8 KB
tools/review_sheet.pyscript11.0 KB
tools/skintokens-requirements.txtmarkdown2.4 KB
tools/skintokens.patchother9.2 KB
tools/template_profile.pyscript5.8 KB
tools/test_autorig.pyscript15.9 KB
tools/test_fidelity_check.pyscript20.7 KB
tools/test_fit_coupon.pyscript6.4 KB
tools/test_flatten.pyscript15.0 KB
tools/test_open_blender.pyscript1.3 KB
tools/test_photo_project.pyscript12.6 KB
tools/test_presets.pyscript17.6 KB
tools/test_print_check.pyscript33.1 KB
tools/test_review_renders.pyscript11.4 KB
tools/test_review_sheet.pyscript4.0 KB
tools/test_template_profile.pyscript3.6 KB
tools/test_uv_check.pyscript5.0 KB
tools/test_verify_docs.pyexecutablescript7.9 KB
tools/unimate.patchother3.5 KB
tools/unimate.pyscript17.5 KB
tools/uv_check.pyscript8.4 KB
tools/verify_blender.pyexecutablescript29.2 KB
tools/verify_docs.pyexecutablescript16.6 KB

tools/flatten.py

View on GitHub
"""Make the nearly flat surfaces of a model exactly flat, for printing — and touch nothing else.

    blender -b --factory-startup --python-exit-code 1 --python tools/flatten.py -- \\
        model.stl --out model_flat.stl [--tol-mm 0.3] [--bed] [--json report.json]

A model finished by hand often has faces that should be flat and are not: a top nudged by a
few tenths, a base a degree off. The slicer prints those as they are. This finds them, and
only them:

- faces are grouped into regions by distance to the region's plane (within --tol-mm), a face
  turning less than --grow-deg from it — so a bevel or a chamfer stays its own face;
- each region gets its best plane; it is flattened only if no vertex is further from that
  plane than --tol-mm, AND it is not a shape: a region a quadric fits much better than a
  plane (a dome, a strip of a cylinder), or whose distance to the plane varies smoothly from
  a vertex to its neighbours (a fold, a wave), or that runs on into its neighbours without an
  edge (a patch of a curved surface; --edge-deg), is kept, and said so;
- a vertex shared by several flattened or already flat regions lands where their planes
  meet (least squares), so edges and corners stay sharp; a vertex that would move past
  --tol-mm is held where it was, and counted;
- a flattened plane within --snap-deg of an axis becomes that axis: meant level, made level;
- --bed turns the model so its largest downward flat face lies on Z = 0 (only when that face
  is within --bed-deg of down), and reports the angle.

It never writes over the input, never fills a hole (print_check says where they are, the
slicer closes small ones), and never changes the triangle list: only vertices move. The same
loader and edge counts as print_check, so before and after are counted alike.
Exit 0 when the result has no open and no non-manifold edge, 3 when it still has some (they
were there before: flattening does not repair), 1 on an error.
"""
import json, math, os, sys

import numpy as np

sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
import print_check as pc                                          # noqa: E402


def args():
    p = pc.Parser(prog="flatten.py")
    p.add_argument("model")
    p.add_argument("--out", required=True, help="a new STL (mm); never the input")
    p.add_argument("--tol-mm", type=float, default=0.3, help="the furthest a vertex may move")
    p.add_argument("--min-area-mm2", type=float, default=25.0, help="smaller regions are left alone")
    p.add_argument("--curve-mm", type=float, default=0.02,
                   help="a region a quadric fits this much better than a plane is a curve, kept")
    p.add_argument("--grow-deg", type=float, default=8.0,
                   help="a face joins a region only if it turns less than this from its plane")
    p.add_argument("--edge-deg", type=float, default=30.0,
                   help="a region is a face only if its edges turn at least this much")
    p.add_argument("--snap-deg", type=float, default=1.0,
                   help="a flattened plane this close to an axis becomes that axis (0: off)")
    p.add_argument("--bed", action="store_true", help="lay the largest downward flat face on Z = 0")
    p.add_argument("--bed-deg", type=float, default=5.0)
    p.add_argument("--json")
    argv = sys.argv[sys.argv.index("--") + 1:] if "--" in sys.argv else []
    return p.parse_args(argv)


def neighbours(F):
    """Faces sharing an edge with exactly one other face: (face, face) pairs."""
    e = np.sort(F[:, [0, 1, 1, 2, 2, 0]].reshape(-1, 2), axis=1)
    owner = np.repeat(np.arange(len(F)), 3)
    order = np.lexsort((e[:, 1], e[:, 0]))
    e, owner = e[order], owner[order]
    same = np.all(e[1:] == e[:-1], axis=1)
    pairs = []
    i = 0
    while i < len(e):
        j = i + 1
        while j < len(e) and same[j - 1]:
            j += 1
        if j - i == 2:
            pairs.append((owner[i], owner[i + 1]))
        i = j
    adj = [[] for _ in range(len(F))]
    for a, b in pairs:
        adj[a].append(b); adj[b].append(a)
    return adj


def regions(V, F, n, area, adj, tol, max_deg):
    """Region growing from the largest faces, by distance to the region's plane: a face joins
    while its three vertices lie within tol of that plane and it turns less than max_deg from
    it. The plane is refitted as the region doubles. Measured both ways: by orientation alone
    (10 degrees), a windmill nudged by 0.1-0.2 mm split into 4,453 regions too small to touch;
    by distance with a 30 degree turn allowed, a chest's 0.2 mm plank bevels were flattened
    away. 8 degrees keeps a 20 degree bevel and still joins a hand-placed face's triangles."""
    from collections import deque
    cos_max = math.cos(math.radians(max_deg))
    label = -np.ones(len(F), dtype=np.int64)
    out = []
    for seed in np.argsort(-area):
        if label[seed] >= 0 or area[seed] <= 0:
            continue
        rid = len(out); label[seed] = rid
        pn = n[seed].copy(); pd = float(pn @ V[F[seed]].mean(axis=0))
        members, queue, refit_at = [seed], deque([seed]), 2
        while queue:
            f = queue.popleft()
            for g in adj[f]:
                if label[g] >= 0 or area[g] <= 0 or float(n[g] @ pn) < cos_max:
                    continue
                if np.abs(V[F[g]] @ pn - pd).max() > tol:
                    continue
                label[g] = rid; members.append(g); queue.append(g)
                if len(members) >= refit_at:
                    P = V[np.unique(F[members])]
                    c = P.mean(axis=0)
                    nn = np.linalg.svd(P - c, full_matrices=False)[2][-1]
                    pn = nn if nn @ pn >= 0 else -nn
                    pd = float(pn @ c); refit_at *= 2
        out.append(np.array(members))
    return out, label


def fit(P, mean_normal):
    """Best plane through points P: (normal, offset, residuals along the normal, local u, v)."""
    c = P.mean(axis=0)
    _, _, vt = np.linalg.svd(P - c, full_matrices=False)
    nrm = vt[-1]
    if nrm @ mean_normal < 0:
        nrm = -nrm
    e1 = vt[0]; e2 = np.cross(nrm, e1)
    Q = P - c
    return nrm, float(nrm @ c), Q @ nrm, Q @ e1, Q @ e2


def lay_on_bed(V, F, o):
    """Turn V so its largest downward face lying within --bed-deg of down, and within the
    tolerance of a plane, faces straight down. Done BEFORE flattening: flattening first snapped
    a box's sides upright while the box was still tilted, and its top came out 0.04 mm off level."""
    _, n, area = pc.face_data(V, F)
    regs, _ = regions(V, F, n, area, neighbours(F), o.tol_mm, o.grow_deg)
    best = None
    for r in regs:
        a = float(area[r].sum()); vid = np.unique(F[r])
        if a < o.min_area_mm2 or len(vid) < 3:
            continue
        nrm, _, h, _, _ = fit(V[vid], (n[r] * area[r][:, None]).sum(axis=0))
        if nrm[2] < -math.cos(math.radians(o.bed_deg)) and float(np.abs(h).max()) <= o.tol_mm:
            if best is None or a > best[0]:
                best = (a, nrm)
    if best is None:
        return V, 0.0
    nrm = best[1]; target = np.array([0.0, 0.0, -1.0])
    axis = np.cross(nrm, target); s = float(np.linalg.norm(axis)); c = float(nrm @ target)
    deg = math.degrees(math.atan2(s, c))
    if s > 1e-12:
        k = axis / s
        K = np.array([[0, -k[2], k[1]], [k[2], 0, -k[0]], [-k[1], k[0], 0]])
        R = np.eye(3) + s * K + (1 - c) * (K @ K)
        ctr = V.mean(axis=0)
        V = (V - ctr) @ R.T + ctr
    return V, deg


def main():
    o = args()
    if not os.path.exists(o.model):
        pc.die(f"{o.model}: no such file")
    if os.path.realpath(o.out) == os.path.realpath(o.model):
        pc.die(f"--out is the input ({o.out}): flatten.py never writes over the model it reads")
    if not (o.tol_mm > 0 and o.edge_deg > 0):
        pc.die("--tol-mm and --edge-deg must be above 0")
    V, F = pc.load(o.model)
    bed_deg = 0.0
    if o.bed:
        V, bed_deg = lay_on_bed(V, F, o)          # level first, then flatten in that frame
    V0 = V.copy()
    before = pc.topology(V, F)[0]
    _, n, area = pc.face_data(V, F)
    adj = neighbours(F)
    regs, label = regions(V, F, n, area, adj, o.tol_mm, o.grow_deg)
    cos_sharp = math.cos(math.radians(o.edge_deg))

    planes = []                                 # (normal, offset, vertex ids) to satisfy
    counts = dict(flattened=0, snapped=0, already_flat=0, curved=0, past_tolerance=0, small=0)
    flat_area = 0.0
    where = []                                  # every region that moved, for the report
    for r in regs:
        a = float(area[r].sum())
        vid = np.unique(F[r])
        if a < o.min_area_mm2 or len(vid) < 4:
            counts["small"] += 1
            continue
        mean_n = (n[r] * area[r][:, None]).sum(axis=0)
        nrm, d, h, u, v = fit(V[vid], mean_n)
        dev = float(np.abs(h).max())
        if dev < 1e-4:
            counts["already_flat"] += 1
            planes.append((nrm, d, vid, a, mean_n))
            continue
        if dev > o.tol_mm:                      # first: past the tolerance, whatever its shape
            counts["past_tolerance"] += 1
            continue
        # A piece of a larger surface: its neighbours across a soft edge, measured against the
        # same plane. Past the tolerance there, the region is a lucky flat patch of a rough or
        # curved surface (a top with 1 mm of noise left flat islands in it until this).
        rid = int(label[r[0]])
        nside = nrm if nrm @ mean_n >= 0 else -nrm
        ring = [g for f in r for g in adj[f] if label[g] != rid and float(n[g] @ nside) > cos_sharp]
        if ring and float(np.abs(V[np.unique(F[ring])] @ nrm - d).max()) > o.tol_mm:
            counts["past_tolerance"] += 1
            continue
        rms_p = float(np.sqrt((h ** 2).mean())); rms_q = rms_p; smooth = 0.0
        # A face meant flat is bounded by edges: a box's top meets its sides at 90 degrees. A
        # patch of a curved surface runs on into its neighbours. A strip of a two-ring cylinder,
        # or a patch of a ghost's side, has few vertices and no edge: never a face.
        out_n = [n[g] for f in r for g in adj[f] if label[g] != rid]
        soft = sum(1 for m in out_n if float(m @ (nrm if nrm @ mean_n >= 0 else -nrm)) > cos_sharp)
        if out_n and soft > 0.1 * len(out_n) and dev > o.curve_mm:
            counts["curved"] += 1
            continue
        # A quadric fits any 4 to 6 points exactly: the shape tests need 12.
        if len(vid) >= 12 and dev > o.curve_mm:
            # A curve is systematic: a quadric takes it away. Noise is not: a quadric barely helps.
            A = np.stack([u * u, u * v, v * v, u, v, np.ones_like(u)], axis=1)
            coef, *_ = np.linalg.lstsq(A, h, rcond=None)
            rms_q = float(np.sqrt(((h - A @ coef) ** 2).mean()))
            # A shape varies smoothly from a vertex to its neighbours; noise jumps. The ghost's
            # folds were neither a quadric nor noise, and became 0.3 mm facets until this test.
            pos = {int(x): k for k, x in enumerate(vid)}
            ed = np.unique(np.sort(F[r][:, [0, 1, 1, 2, 2, 0]].reshape(-1, 2), axis=1), axis=0)
            hi, hj = h[[pos[int(a)] for a in ed[:, 0]]], h[[pos[int(b)] for b in ed[:, 1]]]
            smooth = float((hi * hj).sum() / max(((hi ** 2 + hj ** 2) / 2).sum(), 1e-30))
            if rms_q < 0.5 * rms_p or smooth > 0.5:
                counts["curved"] += 1
                continue
        # A face meant flat is almost always meant level or upright: the best plane through a
        # jittered top was 0.14 degrees off, 0.1 mm across 40 mm. Snap it — a real slope is
        # further than --snap-deg from every axis and keeps its own plane.
        ax = np.eye(3)[int(np.argmax(np.abs(nrm)))] * np.sign(nrm[int(np.argmax(np.abs(nrm)))])
        if o.snap_deg > 0 and math.degrees(math.acos(min(1.0, float(nrm @ ax)))) <= o.snap_deg:
            nrm = ax; d = float((V[vid] @ nrm).mean()); counts["snapped"] += 1
        counts["flattened"] += 1
        flat_area += a
        c = V[vid].mean(axis=0)
        where.append(dict(centre_mm=[round(float(x), 2) for x in c], normal=[round(float(x), 3) for x in nrm],
                          area_mm2=round(a, 1), deviation_mm=round(dev, 3),
                          plane_rms_mm=round(rms_p, 4), quadric_rms_mm=round(rms_q, 4),
                          neighbour_correlation=round(smooth, 3)))
        planes.append((nrm, d, vid, a, mean_n))

    # Every constrained vertex lands where its planes meet, as close as possible to where it was.
    lam = 1e-9
    M = np.zeros((len(V), 3, 3)); b = np.zeros((len(V), 3)); hit = np.zeros(len(V), bool)
    for nrm, d, vid, _, _ in planes:
        M[vid] += np.outer(nrm, nrm); b[vid] += nrm * d; hit[vid] = True
    idx = np.flatnonzero(hit)
    if len(idx):
        A = M[idx] + lam * np.eye(3)
        V[idx] = np.linalg.solve(A, (b[idx] + lam * V0[idx])[..., None])[..., 0]
    move = np.linalg.norm(V - V0, axis=1)
    held = move > o.tol_mm + 1e-9
    V[held] = V0[held]

    if o.bed:
        V[:, 2] -= V[:, 2].min()

    after = pc.topology(V, F)[0]
    pc.write_stl(o.out, V, F)
    total_area = float(area.sum())
    rep = dict(model=os.path.abspath(o.model), out=os.path.abspath(o.out), tol_mm=o.tol_mm,
               regions=len(regs), regions_flattened=counts["flattened"],
               regions_snapped_to_axis=counts["snapped"], regions_already_flat=counts["already_flat"], regions_curved=counts["curved"],
               regions_past_tolerance=counts["past_tolerance"], regions_small=counts["small"],
               area_flattened_pct=round(100 * flat_area / max(total_area, 1e-30), 2),
               max_move_mm=round(float(move[~held].max()) if (~held).any() else 0.0, 4),   # by flattening, before --bed
               vertices_moved=int(((move > 1e-6) & ~held).sum()), vertices_held=int(held.sum()),
               bed_rotation_deg=round(bed_deg, 3), flattened=where,
               before={k: before[k] for k in ("open_edges", "nonmanifold_edges", "inconsistent_edges")},
               after={k: after[k] for k in ("open_edges", "nonmanifold_edges", "inconsistent_edges")})
    print("FLATTEN " + json.dumps(rep))
    print(f"{os.path.basename(o.model)} → {os.path.basename(o.out)}: {counts['flattened']} region(s) flattened "
          f"({rep['area_flattened_pct']} % of the area), {counts['already_flat']} already flat, "
          f"{counts['curved']} curved kept, {counts['past_tolerance']} past {o.tol_mm} mm kept; "
          f"largest move {rep['max_move_mm']} mm, {rep['vertices_held']} vertex(es) held"
          + (f"; laid on the bed, turned {rep['bed_rotation_deg']}°" if o.bed else ""))
    if after["open_edges"] or after["nonmanifold_edges"]:
        print(f"  still {after['open_edges']} open and {after['nonmanifold_edges']} non-manifold edges "
              f"(before: {before['open_edges']}, {before['nonmanifold_edges']}) — flattening does not repair; "
              f"run print_check", file=sys.stderr)
    if o.json:
        with open(o.json, "w") as f:
            json.dump(rep, f, indent=1)
    sys.exit(3 if after["open_edges"] or after["nonmanifold_edges"] else 0)


if __name__ == "__main__":
    main()
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall