A 3D model pipeline, pushed by GPT-6.2-Astra
agent (cont.)
+50:08exec_command, view_imagePYTHONPATH=review/high-water python3 - <<'PY' (+1 more)
input
text((await tools.exec_command({cmd:`PYTHONPATH=review/high-water python3 - <<'PY' from pathlib import Path import marsh marsh.CACHE=Path('review/out/tide-keeper'); marsh.compose(marsh.CACHE/'crossing.jpg') from PIL import Image im=Image.open(marsh.CACHE/'crossing.jpg');im.thumbnail((1000,700));im.save(marsh.CACHE/'scene-check.jpg') PY`,max_output_tokens:100})).output);image((await tools.view_image({path:"~/work/lowmarch/review/out/tide-keeper/scene-check.jpg"})).image_url)result, 4 lines
Script completed Wall time 3.9 seconds Output:
exec_commandpython3 - <<'PY'
command
python3 - <<'PY' from pathlib import Path p=Path('review/tide-keeper/tailoring.py');s=p.read_text().replace('radial=rad+.083*v+.068*v**2+fold+hip_ease','radial=rad+.083*v+.068*v**2+fold+hip_ease*(.42 if i==3 else 1)') p.write_text(s) p=Path('review/tide-keeper/shot.js');s=p.read_text().replace('const vec =','let portraitCentre;\nconst vec =').replace('full?850:1280','full?850:1440').replace('full?960:910','full?960:960').replace('head.clone().add(vec(.065,-.025,0))','head.clone().add(vec(.055,.047,0))') s=s.replace(' if(plain) {',' if (kind==="lens") portraitCentre=centre.clone();\n if(plain) {') s=s[:s.index('\nwindow.probeKeeper')] + ''' // Hold the lens still. Only the keyed skeleton and cloth weights advance. window.motionFrame = seconds => { const w=960,h=640; R.setSize(w,h,false); actor.actions["Read the tide"].play(); actor.mixer.setTime(seconds); scene.updateMatrixWorld(true); frameAt(portraitCentre,.89,w,h,3); lensAndFlat({lens:40,flat:.48},portraitCentre,.89,w,h,3); render(); return R.domElement.toDataURL("image/png"); }; ''' p.write_text(s) p=Path('review/tide-keeper/shoot.cjs');s=p.read_text();a=s.index(' const png =');s=s[:a]+''' if (view==="motion") { await page.evaluate(()=>window.drawKeeper("lens")); const frames=path.join(cache,"frames"); await fs.mkdir(frames,{recursive:true}); for (let i=0;i<64;i++) { const frame=await page.evaluate(t=>window.motionFrame(t),i/20); await fs.writeFile(path.join(frames,String(i).padStart(3,"0")+".png"),Buffer.from(frame.split(",")[1],"base64")); } if(errors.length) throw new Error(errors.join("\\n")); continue; } '''+s[a:];a=s.index(' if(view==="crossing" &&');b=s.index(' if(view==="crossing")',a);s=s[:a]+s[b:];p.write_text(s) PY OPENBLAS_NUM_THREADS=1 python3 -u review/tide-keeper/build.py > review/out/tide-keeper/build.log 2>&1 && node review/tide-keeper/shoot.cjs crossing lens rear side pbr motion > review/out/tide-keeper/render.log 2>&1result, 4 lines
Script completed Wall time 0.5 seconds Output: {"chunk_id":"1e33f1","wall_time_seconds":0.252468994,"session_id":43935,"original_token_count":0,"output":""}exec_command, view_imagels -lh review/out/tide-keeper/ione.glb; ls ~/context/sortie-node_modules/@gltf-transform; python3 - <<'PY' (+1 more)
input
text((await tools.exec_command({cmd:"ls -lh review/out/tide-keeper/ione.glb; ls ~/context/sortie-node_modules/@gltf-transform; python3 - <<'PY'\nfrom pathlib import Path\nfrom PIL import Image\nim=Image.open('~/out/high-water.jpg'); im.thumbnail((700,420));im.save('review/out/tide-keeper/original-small.jpg')\nPY" ,max_output_tokens:110})).output);image((await tools.view_image({path:"~/work/lowmarch/review/out/tide-keeper/original-small.jpg"})).image_url)result, 8 lines
Script completed Wall time 0.4 seconds Output: -rw------- 1 runner runner 12M Nov 17 23:33 review/out/tide-keeper/ione.glb core extensions functions
exec_commandPYTHONPATH=tools python3 - <<'PY'
command
PYTHONPATH=tools python3 - <<'PY' from vrm import VRM import numpy as np m=VRM('review/out/tide-keeper/ione.glb');j=m.j print('verts/triangles',sum(j['accessors'][p['attributes']['POSITION']]['count'] for mesh in j['meshes'] for p in mesh['primitives']),sum(j['accessors'][p['indices']]['count']//3 for mesh in j['meshes'] for p in mesh['primitives'])) print('mats,bones,maps',len(j['materials']), len(j['skins'][0]['joints']),len(j['images'])) print('unit exceptions',[(mesh['name'],sum(abs(np.linalg.norm(m.accessor(p['attributes']['NORMAL']),axis=1)-1)>.003)) for mesh in j['meshes'] for p in mesh['primitives'] if (abs(np.linalg.norm(m.accessor(p['attributes']['NORMAL']),axis=1)-1)>.003).any()][:30]) print('extensions',j.get('extensionsUsed')) PY cat review/out/tide-keeper/build.log && date -uresult, 11 lines
Script completed Wall time 0.6 seconds Output: verts/triangles 118999 213757 mats,bones,maps 42 59 21 unit exceptions [('Fastenings_brass', 20), ('case_fastening', 2), ('Pauldrons_brass', 32), ('Fastenings_coral', 4), ('ear_drop', 2), ('ear_drop', 2)] extensions None Fit, hair, coat and armour 23.10s Base GLB 2.09s Tue Nov 17 23:35:34 UTC 2026exec_commandrg -A16 '^def ball\(' tools/outfit.py; du -h review/out/tide-keeper/*.glb; which gltf-validator || true; ls ~/context/sortie-node_modules | rg -i 'validator|ffmpeg|gltf'
command
rg -A16 '^def ball\(' tools/outfit.py; du -h review/out/tide-keeper/*.glb; which gltf-validator || true; ls ~/context/sortie-node_modules | rg -i 'validator|ffmpeg|gltf'result, 24 lines
Script completed Wall time 0.1 seconds Output: def ball(name, role, centre, r, seg=14, rows=8, squash=(1, 1, 1)): th = np.linspace(0, math.pi, rows) ph = np.linspace(0, 2 * math.pi, seg + 1) P = np.zeros((seg + 1, rows, 3)) for j, t in enumerate(th): P[:, j, 0] = np.sin(t) * np.cos(ph) * r * squash[0] P[:, j, 1] = np.cos(t) * r * squash[1] P[:, j, 2] = np.sin(t) * np.sin(ph) * r * squash[2] P += np.asarray(centre) pos, tri = grid_mesh(P) return piece(name, role, pos, tri, outward_from=centre) def ribbon(name, role, curve, width=0.006, lift=0.002, normals=None, away=None, closed=False): """A band along a 3D polyline, lifted off a surface. normals: the surface normal at each point (the band lies flat on it); otherwise it faces away from `away`.""" C = np.asarray(curve, float) 8.9M review/out/tide-keeper/base.glb 12M review/out/tide-keeper/ione.glb @gltf-transformexec_commandcat > review/tide-keeper/pictures.py <<'PY'
command
cat > review/tide-keeper/pictures.py <<'PY' """Compose the unchanged crossing and the perspective insert for the review page.""" import argparse from pathlib import Path import sys import numpy as np from PIL import Image,ImageFilter,ImageOps HERE=Path(__file__).resolve().parent CACHE=HERE.parent/"out/tide-keeper" sys.path.insert(0,str(HERE.parent/"high-water")) import marsh def backdrop(output): # The close camera still sees the sun and sluice beyond her shoulder. plate=Image.open(output/"high-water.jpg").crop((797,159,1373,543)) plate=plate.resize((1440,960),Image.Resampling.BICUBIC).filter(ImageFilter.GaussianBlur(9)) a=np.asarray(plate,dtype=float) yy,xx=np.mgrid[:960,:1440] dusk=np.clip(.09+(.13*(1-xx/1440))+.04*(yy/960),0,1) a=a*(1-dusk[...,None])+np.array([90,117,119])*dusk[...,None] grain=np.random.default_rng(214).normal(0,.78,a.shape[:2]) return Image.fromarray(np.uint8(np.clip(a+grain[...,None],0,255))) def compose(out): marsh.CACHE=CACHE marsh.compose(out/"ione-crossing.jpg") bg=backdrop(out) bg.resize((960,640),Image.Resampling.LANCZOS).save(CACHE/"lens-backdrop.png") actor=Image.open(CACHE/"lens.png").convert("RGBA") assert bg.size==actor.size img=Image.alpha_composite(bg.convert("RGBA"),actor).convert("RGB") img.save(out/"ione-lens.jpg",quality=94,subsampling=0,optimize=True) if __name__=="__main__": p=argparse.ArgumentParser();p.add_argument("out",type=Path) compose(p.parse_args().out) PY cat > review/tide-keeper/movie.sh <<'SH' #!/usr/bin/env bash set -eu artifacts="$(dirname "$0")/../out/tide-keeper" ffmpeg -hide_banner -loglevel error -y -loop 1 -framerate 20 -i "$artifacts/lens-backdrop.png" \ -framerate 20 -start_number 0 -i "$artifacts/frames/%03d.png" \ -filter_complex '[0:v][1:v]overlay=shortest=1:format=auto,format=yuv420p[out]' \ -map '[out]' -frames:v 64 -c:v libx264 -preset slow -crf 18 -movflags +faststart -an "$1" SH cat review/out/tide-keeper/build.log; cat review/out/tide-keeper/render.log && ls -lh review/out/tide-keeper/frames | tail -2; date -uresult, 12 lines
Script completed Wall time 0.1 seconds Output: Fit, hair, coat and armour 23.10s Base GLB 2.09s Animation, dye maps and packaging 11.60s Build total 36.79s staff contact [ 734.6179301225967, 730.545138319172 ] -rw------- 1 runner runner 331K Nov 17 23:36 008.png -rw------- 1 runner runner 332K Nov 17 23:36 009.png Tue Nov 17 23:36:11 UTC 2026
exec_command, view_imagepython3 review/tide-keeper/pictures.py ~/out && python3 - <<'PY' (+1 more)
input
text((await tools.exec_command({cmd:"python3 review/tide-keeper/pictures.py ~/out && python3 - <<'PY'\nfrom PIL import Image\nim=Image.open('~/out/ione-lens.jpg')\nim.thumbnail((850,570));im.save('review/out/tide-keeper/close.jpg')\nPY",max_output_tokens:90})).output);image((await tools.view_image({path:"~/work/lowmarch/review/out/tide-keeper/close.jpg"})).image_url)result, 4 lines
Script completed Wall time 3.6 seconds Output:
exec_commandpython3 - <<'PY'
command
python3 - <<'PY' from pathlib import Path p=Path('review/tide-keeper');cache=Path('review/out/tide-keeper') s=(p/'shoot.cjs').read_text().replace('path.resolve(__dirname, "../..")','path.resolve(__dirname, "../../..")').replace(' const html =',''' const inspection = ` window.hits=(pts)=>pts.map(([x,y])=>{ const ray=new THREE.Raycaster(); ray.setFromCamera(new THREE.Vector2(2*x-1,1-y*2),camera); return ray.intersectObjects(actor.meshes,false).slice(0,3).map(h=>[h.object.name,h.uv?.toArray().map(v=>Math.round(v*100)/100),h.object.userData.mats.painted.uniforms.uPigment.value]); });`; const html =''').replace('+ shot + "\\n</script>"','+ shot + inspection + "\\n</script>"').replace('path.join(__dirname, "shot.js")','path.join(root,"review/tide-keeper/shot.js")').replace(' if (!png || errors.length)',' console.log(JSON.stringify(await page.evaluate(pts=>window.hits(pts),JSON.parse(process.env.PTS))));\n if (!png || errors.length)') (cache/'inspect.cjs').write_text(s) PY PTS='[[0.30,0.69],[0.33,0.66],[0.29,0.705],[0.32,0.74],[0.303,0.775],[0.34,0.764],[0.315,0.845],[0.405,0.837],[0.54,0.78],[0.59,0.62]]' node review/out/tide-keeper/inspect.cjs lens > review/out/tide-keeper/angles.log 2>&1result, 4 lines
Script completed Wall time 0.5 seconds Output: {"chunk_id":"073f63","wall_time_seconds":0.250673414,"session_id":60896,"original_token_count":0,"output":""}exec_commandcat review/out/tide-keeper/angles.log; ls review/out/tide-keeper/frames | tail -1; rg -n 'uSkinRamp|uFaceTex' review/out/tide-keeper/index.html | head -11; du -h ~/out/*
command
cat review/out/tide-keeper/angles.log; ls review/out/tide-keeper/frames | tail -1; rg -n 'uSkinRamp|uFaceTex' review/out/tide-keeper/index.html | head -11; du -h ~/out/*
result, 18 lines
Script completed Wall time 0.1 seconds Output: Warning: truncated output (original token count: 711) Total output lines: 17 [[["N00_000_00_Face_00_SKIN_(Instance)_62",[0.55,0.54],0],["N00_000_00_Body_00_SKIN_(Instance)_67",null,0],["Locks_umberhair_171",[0.73,0.99],1]],[["N00_000_00_Face_00_SKIN_(Instance)_62",[0.55,0.54],0],["N00_000_00_Body_00_SKIN_(Instance)_67",null,0],["Locks_umberhair_171",[0.81,0.98],1]],[["N00_000_00_Face_00_SKIN_(Instance)_62",[0.55,0.55],0],["N00_000_00_Body_00_SKIN_(Instance)_67",null,0],["Locks_umberhair_171",[0.72,0.99],1]],[["N00_000_00_Face_00_SKIN_(Instance)_62",[0.55,0.55],0],["N00_000_00_Body_00_SKIN_(Instance)_67",null,0],["Locks_umberhair_171",[0.83,0.99],1]],[["N00_000_00_Face_00_SKIN_(Instance)_62",[0.55,0.55],0],["N00_000_00_Body_00_SKIN_(Instance)_67",null,0],["Locks_umberhair_171",[0.81,0.99],1]],[["N00_000_00_Face_00_SKIN_(Instance)_62",[0.55,0.55],0],["N00_000_00_Body_00_SKIN_(Instance)_67",null,0],["Locks_umberhair_171",[0.92…281 tokens truncated…& vUv.y < 0.84) { 464: if (uSkinRamp == 0) col *= uSkinTone; // older builds: one tint over the light skin 516: col *= uKind == 1 && uSkinRamp == 1 ? mix(vec3(1.0), grade, 0.3) : grade; // a designed skin ramp takes less of it 877: uGrain: { value: 0.05 }, uFaceTex: { value: 0 }, uDecal: { value: decal ? 1 : 0 }, uBand: { value: null }, 879: uSkinRamp: { value: 0 }, uSkinL: { value: new THREE.Color() }, uSkinS: { value: new THREE.Color() }, uSkinC: { value: new THREE.Color() }, 888: u.uSkinRamp.value = 1; u.uSkinL.value = hex(P.ramp[0]); u.uSkinS.value = hex(P.ramp[1]); u.uSkinC.value = hex(P.ramp[2]); 893: if (role === "face" && map) u.uFaceTex.value = 1; 436K ~/out/high-water.jpg 8.0K ~/out/index.html 464K ~/out/ione-crossing.jpg 344K ~/out/ione-lens.jpgexec_commandpython3 - <<'PY'
command
python3 - <<'PY' from pathlib import Path p=Path('review/out/tide-keeper/inspect.cjs');s=p.read_text().replace('ray.setFromCamera(new THREE.Vector2(2*x-1,1-y*2),camera);','ray.set(camera.position,new THREE.Vector3(2*x-1,1-y*2,.5).unproject(camera).sub(camera.position).normalize());');p.write_text(s) PY PTS='[[0.30,0.69],[0.33,0.66],[0.29,0.705],[0.32,0.74],[0.303,0.775],[0.34,0.764],[0.315,0.845],[0.405,0.837],[0.54,0.78],[0.59,0.62]]' node review/out/tide-keeper/inspect.cjs lens > review/out/tide-keeper/angles.log 2>&1result, 4 lines
Script completed Wall time 0.4 seconds Output: {"chunk_id":"e86d5b","wall_time_seconds":0.25155637,"session_id":68745,"original_token_count":0,"output":""}exec_commandsed -n '447,471p' review/out/tide-keeper/index.html && cat review/out/tide-keeper/angles.log && cat review/out/tide-keeper/render.log && ls review/out/tide-keeper/frames | tail -1 && date -u
command
sed -n '447,471p' review/out/tide-keeper/index.html && cat review/out/tide-keeper/angles.log && cat review/out/tide-keeper/render.log && ls review/out/tide-keeper/frames | tail -1 && date -u
result, 33 lines
Script completed Wall time 0.1 seconds Output: if (uKind == 5) col *= 0.965 + 0.07 * vnoise(vObj * 22.0); // mottled leather } else if (uKind == 1) { // skin: pale, nearly unshaded from the front vec3 sL = vec3(0.973, 0.882, 0.835), sS = vec3(0.776, 0.659, 0.608), sC = vec3(0.451, 0.322, 0.310); if (uSkinRamp == 1) { sL = uSkinL; sS = uSkinS; sC = uSkinC; } // the character's tone, designed per tone col = mix(sC, sS, st(lit, 0.20)); col = mix(col, sL, st(lit, 0.38)); if (uFaceTex == 1) col *= clamp(tex.rgb / uSkinRef, 0.55, 1.05); if (uFaceTex == 1 && vUv.x > 0.38 && vUv.x < 0.62 && vUv.y > 0.68 && vUv.y < 0.84) { // the closed mouth: VRoid paints a 2-texel line that the clamp above leaves faint; ink it and widen it // (the darkest of a few taps), so it follows the mouth's shape keys as a drawn line float d = 0.0, sl = dot(uSkinRef, vec3(1.0 / 3.0)); for (int k = -2; k <= 2; k++) for (int j = -1; j <= 1; j++) { vec3 t = texture2D(uMap, vUv + vec2(float(j) * 1.2, float(k) * 0.8) / 512.0).rgb; d = max(d, 1.0 - dot(t, vec3(1.0 / 3.0)) / sl); } float taper = 1.0 - 0.55 * smoothstep(0.035, 0.065, abs(vUv.x - 0.5)); // a brush stroke: lighter at the corners col = mix(col, vec3(0.42, 0.22, 0.22), smoothstep(0.10, 0.22, d) * taper); } if (uSkinRamp == 0) col *= uSkinTone; // older builds: one tint over the light skin } else if (uKind == 2) { // hair: four even bands, hard strand highlights float strand = dot(tex.rgb, vec3(1.0 / 3.0)); vec3 c0 = tone(uBase, 0.72, 0.07, 1.10, 0.45), c1 = tone(uBase, 0.72, 0.035, 1.05, 0.68); vec3 c2 = tone(uBase, 0.56, 0.02, 0.92, 1.10), c3 = tone(uBase, 0.56, 0.03, 0.55, 1.42); float l = lit + (strand - 0.6) * 0.12; col = mix(c0, c1, st(l, 0.40)); col = mix(col, uBase, st(l, 0.56)); col = mix(col, c2, st(l, 0.84)); float sp = dot(n, normalize(uKey + v)) + (strand - 0.6) * 0.18; [[["shoulder_R_1_129",null,0],["shoulder_R_0_126",[0.86,0.29],1],["cravat_tail_1_106",[0.23,0.04],1]],[["shoulder_R_1_129",null,0],["shirt_68",null,0],["shirt_68",null,0]],[["shoulder_R_1_129",null,0],["shoulder_R_0_126",[0.83,0.34],1]],[["Pauldrons_brass_127",null,0],["Pauldrons_brass_127",null,0],["shoulder_R_2_130",null,0]],[["shoulder_R_2_130",null,0],["shirt_68",null,0],["shirt_68",null,0]],[["shoulder_R_2_130",null,0],["shoulder_R_3_131",null,0],["shirt_68",null,0]],[["shoulder_R_2_130",null,0],["shoulder_R_3_131",null,0],["rolled_sleeve_R_120",[0.19,0.11],1]],[["rolled_sleeve_R_120",[0.43,0.34],1],["rolled_sleeve_R_lining_121",null,0],["shirt_68",null,0]],[["clasp_needle_88",null,0],["clasp_needle_88",null,0],["corselet_2_76",[0.42,0.94],1]],[["rolled_sleeve_L_112",[0.61,0.31],1],["rolled_sleeve_L_lining_113",null,0],["shirt_68",null,0]]] staff contact [ 734.6179301225967, 730.545138319172 ] 060.png Tue Nov 17 23:37:23 UTC 2026exec_commandpython3 - <<'PY'
command
python3 - <<'PY' from pathlib import Path p=Path('review/out/tide-keeper/inspect.cjs');s=p.read_text().replace('h.uv?.toArray().map(v=>Math.round(v*100)/100)','(h.uv?.toArray() || [Math.floor(h.face.a/15)/54,(h.face.a%15)/14]).map(v=>Math.round(v*100)/100)');p.write_text(s) PY PTS='[[0.30,0.69],[0.33,0.66],[0.29,0.705],[0.32,0.74],[0.303,0.775],[0.34,0.764],[0.315,0.845],[0.309,0.792],[0.338,0.738],[0.269,0.788]]' node review/out/tide-keeper/inspect.cjs lens > review/out/tide-keeper/angles.log 2>&1result, 4 lines
Script completed Wall time 0.4 seconds Output: {"chunk_id":"ea92a5","wall_time_seconds":0.252032165,"session_id":19096,"original_token_count":0,"output":""}exec_commandcat review/out/tide-keeper/angles.log; cat review/tide-keeper/coiffure.py | tail -31; sed -n '92,150p' tools/hair.py; git status --short --branch && date -u
command
cat review/out/tide-keeper/angles.log; cat review/tide-keeper/coiffure.py | tail -31; sed -n '92,150p' tools/hair.py; git status --short --branch && date -u
result, 65 lines
Script completed Wall time 0.1 seconds Output: Warning: truncated output (original token count: 1406) Total output lines: 94 [[["shoulder_R_1_129",[0.43,0.43],0],["shoulder_R_0_126",[0.86,0.29],1],["cravat_tail_1_106",[0.23,0.04],1]],[["shoulder_R_1_129",[0.37,0.43],0],["shirt_68",[7.11,0.29],0],["shirt_68",[4.91,0.79],0]],[["shoulder_R_1_129",[0.44,0.43],0],["shoulder_R_0_126",[0.83,0.34],1]],[["Pauldrons_brass_127",[2.54,0.71],0],["Pauldrons_brass_127",[2.54,0.57],0],["shoulder_R_2_130",[0.43,0.36],0]],[["shoulder_R_2_130",[0.46,0.43],0],["shirt_68",[7.26,0.36],0],["shirt_68",[7.09,0.86],0]],[["shoulder_R_2_130",[0.41,0.71],0],["shoulder_R_3_131",[0.41,0.07],0],["shirt_68",[1.7,0.86],0]],[["shoulder_R_2_130",[0.5,0.93],0],["shoulder_R_3_131",[0.5,0.36],0],["rolled_sleeve_R_120",[0.19,0.11],1]],[["shoulder_R_2_130",[0.46,0.57],0],["shoulder_R_3_131",[0.46,0],0],["shirt_68",[7.37,0.07],0]],[["shoulder_R_2_130",[0.41,0.5],0],["shirt_68",[1.7,0.57],0],["shoulder_R_1_129",[0.91,0],0]],[["shoulder_R_1_129",[0.52,0.79],0],["shoulder_R_2_130",[0.54,0.21],0],["shoulder_R_1_129",[0.72,0.14],0]]] phase=2*np.pi*(2.45*t+j/3)+(1.1 if j==3 else 0) amp=(.027 if j<3 else .048)*(1-.70*t) centre=path+amp[:,None]*(across*np.cos(phase)[:,None]+up*np.sin(phase)[:,None]) pc=O.pipe("plait_"+str(j),role,centre,r=radius,seg=12) section=pc["pos"].reshape(len(t),13,3) section[:]=centre[:,None]+(section-centre[:,None])*(1-.72*t[:,None,None]) pc["nrm"]=vertex_normals(pc["pos"],pc["tri"]) pc["gust"]=np.repeat(gust,13,axis=0) out.append(attach(fit,pc,HEAD)) for j,k in enumerate([7,78,84]): rad=.041 if j==0 else .020 p=ring(fit,"braid_cuff_"+str(j),"brass",path[k],across[k],up[k],rad,rad,.0055,HEAD) p["gust"]=np.tile(gust[k],(len(p["pos"]),1)) out.append(p) for j in range(3): p=hair.lock("free_end_"+str(j),ch,[("xyz",*path[-11]),("xyz",*path[-1]), ("xyz",*(path[-1]+[.003*j,-.024+j*.019…456 tokens truncated…idth if root_width is None else root_width w = np.where(t < 0.12, w0 + (width - w0) * t / 0.12, width) k = np.clip((t - taper[0]) / max(taper[1] - taper[0], 1e-6), 0, 1) w = w * (1 - k ** 1.6) + tip * 0.01 * k if profile is not None: # a clump: profile(t) = width as a fraction of `width` w = width * np.array([profile(x) for x in t]) + 0.0004 k = np.clip((t - 0.6) / 0.4, 0, 1) th = thick * np.maximum(1 - k ** 1.3, 0.15) a = np.linspace(0, 2 * np.pi, seg + 1) G = (C[:, None] + Bv[:, None] * (w[:, None] / 2 * np.cos(a)[None, :])[..., None] + N[:, None] * (th[:, None] / 2 * np.sin(a)[None, :])[..., None]) from outfit import grid_mesh pos, tri = grid_mesh(G) pc = piece(name, role, pos, tri, outward_from=None) from fitting import vertex_normals fn = vertex_normals(pos, tri) radial = (pos - np.repeat(C, seg + 1, 0)) if (np.einsum("ij,ij->i", fn, radial) < 0).mean() > 0.5: pc["tri"] = tri[:, ::-1] pc["nrm"] = -fn uu, vv = np.meshgrid(a / (2 * np.pi), t, indexing="xy") pc["uv"] = np.stack([uu.ravel(), vv.ravel()], 1) pc["strands"] = True pc["group"] = "hair" return pc def cap(name, chart, hairline, lift=0.010, crown=0.006, nu=72, nv=26, role="hair"): """The hair's base volume: a shell over the scalp from the crown down to hairline(u) (degrees of v), lifted `lift` off the scalp plus `crown` more at the top.""" from outfit import piece, grid_mesh U = np.linspace(-180, 180, nu) G = np.zeros((nu, nv, 3)) UV = np.zeros((nu, nv, 2)) for i, u in enumerate(U): vmax = hairline(u) for j, s in enumerate(np.linspace(0, 1, nv)): v = vmax * s # from the crown itself (a gap there showed as a dot) ## astra62 ?? review/tide-keeper/ Tue Nov 17 23:38:29 UTC 2026exec_commandpython3 - <<'PY'
command
python3 - <<'PY' from pathlib import Path p=Path('review/tide-keeper/tailoring.py');s=p.read_text().replace('("tern" if side=="R" else "armour") if j==0 else None','"tern" if side=="R" and j==2 else "armour" if j==0 else None');p.write_text(s) p=Path('review/tide-keeper/dyes.py');s=p.read_text();a=s.index(' for cx in (int(w*.37)');b=s.index(' d.line([(0,h-16)',a) s=s[:a]+''' for cx in (int(w*.455),int(w*.835)): cy=int(h*.54) # A wrap round the arm is much longer than it is tall. These UV # dimensions give a round badge once printed onto the curved lame. sx,sy=.48,2.48 def loc(x,y):return (cx+sx*x,cy+sy*y) d.ellipse([loc(-90,-99),loc(90,99)],fill=ink,outline=ochre,width=5) d.arc([loc(-78,-87),loc(78,87)],25,322,fill="#86a79c",width=3) pts=[(-68,17),(-45,4),(-28,-31),(-3,-55),(-14,-19),(3,-3),(38,-19),(68,-17), (38,-4),(14,16),(-5,23),(-34,51),(-26,25),(-47,40),(-34,17)] d.polygon([loc(x,y) for x,y in pts],fill=ivory) d.polygon([loc(39,-18),loc(73,-18),loc(43,-9)],fill="#d66c49") for n in range(7): xx=-44+n*14 d.line([loc(xx,70),loc(xx,70-(6 if n%3 else 14))],fill=ochre,width=2) '''+s[b:];p.write_text(s) p=Path('review/tide-keeper/forms.py');s=p.read_text().replace(' return attach(fit,O.ball(name,role,point,r,seg=16,rows=10,squash=shape),bone)',''' p=O.ball(name,role,point,r,seg=16,rows=10,squash=shape) # Analytic ellipsoid normals remain defined at the coincident pole vertices. normal=(p["pos"]-point)/(np.asarray(shape)**2) p["nrm"]=normal/np.linalg.norm(normal,axis=1)[:,None] return attach(fit,p,bone)''');p.write_text(s) p=Path('review/tide-keeper/coiffure.py');s=p.read_text().replace(' pc["gust"]=np.repeat(gust,13,axis=0)',''' if j<3: uu,vv=np.meshgrid(np.linspace(0,1,13),t) pc["uv"]=np.stack([uu,vv],axis=-1).reshape(-1,2) pc["strands"]=True pc["gust"]=np.repeat(gust,13,axis=0)''') a=s.index(' for j,k in enumerate([7,78,84]):') s=s[:a]+''' # The plait is tightly dressed at the ferrules and looser in between. # A few tapered sections slip out in the gust; each follows its own arc. for j,(start,end,bulge,colour) in enumerate([(14,53,.046,"umberhair"),(32,78,-.062,"bluehair"),(57,88,.044,"umberhair")]): mid=(start+end)//2 trace=[path[start],path[mid]+.025*across[mid]+bulge*up[mid], path[end]+.017*across[end]+.36*bulge*up[end]] loose=hair.lock("escaped_lock_"+str(j),ch,[("xyz",*pt) for pt in trace],.011-j*.001, thick=.003,n=30,seg=8,root_width=.002,taper=(.28,1)) d=gust[np.round(np.linspace(start,end,30)).astype(int)] loose["gust"]=np.repeat(d,9,axis=0) out.append(attach(fit,loose,HEAD)) '''+s[a:];p.write_text(s) p=Path('review/tide-keeper/portable.py');s=p.read_text();s=s.replace(' c=np.array(ImageColor.getrgb(colours[role]))\n return',''' c=np.array(ImageColor.getrgb(colours[role])) if role=="silk": # A grown-out ivory streak retains auburn roots and darker # filaments at the sides, like the neighbouring locks. root=np.clip((v-.08)*3.8+.12*np.cos(12*np.pi*u),0,1) root*=.83+.17*np.cos(8*np.pi*u+.7*np.sin(4*v)) c=np.array([97,70,65])+(c-np.array([97,70,65]))*root[...,None] return''') p.write_text(s) p=Path('review/tide-keeper/shoot.cjs');s=p.read_text().replace(' .replace("uniform float uGrain;"',''' .replace("col = mix(col, sL, st(lit, 0.38));", "col = mix(col, sL, uFaceTex == 1 ? smoothstep(0.54,0.72,lit) : st(lit,0.38));") .replace("uniform float uGrain;"''');p.write_text(s) PY OPENBLAS_NUM_THREADS=1 python3 -u review/tide-keeper/build.py > review/out/tide-keeper/build.log 2>&1 && node review/tide-keeper/shoot.cjs crossing lens rear side pbr > review/out/tide-keeper/render.log 2>&1result, 4 lines
Script completed Wall time 0.5 seconds Output: {"chunk_id":"4109df","wall_time_seconds":0.250914978,"session_id":71123,"original_token_count":0,"output":""}exec_commandpython3 - <<'PY'
command
python3 - <<'PY' import json j=json.load(open('review/out/tide-keeper/camera.json'))['characters'][0]['info'] print([(k,len(v) if isinstance(v,(list,dict)) else str(v)[:30]) for k,v in j.items()]) PY cat review/out/tide-keeper/build.log; date -uresult, 6 lines
Script completed Wall time 0.2 seconds Output: [('roles', 25), ('light', 3), ('sun', 3), ('capsules', 13), ('cloth', 0), ('face_marks', 'iVBORw0KGgoAAAANSUhEUgAABAAAAA'), ('paint', 41), ('mouth_curve', 24), ('mouth_bone', 'J_Bip_C_Head'), ('ink', 3), ('skin', 5), ('depth_gap', '0.012')] Tue Nov 17 23:39:34 UTC 2026exec_commandpython3 - <<'PY'
command
python3 - <<'PY' from pathlib import Path p=Path('review/tide-keeper/shoot.cjs');s=p.read_text().replace(' for (const view of views) {',' for (const view of views) {\n const start=performance.now();').replace(' if(errors.length) throw new Error(errors.join("\\n"));\n continue;',' if(errors.length) throw new Error(errors.join("\\n"));\n console.log("motion",(0.001*(performance.now()-start)).toFixed(2)+"s");\n continue;').replace(' if(view==="crossing") console.log',' console.log(view,(0.001*(performance.now()-start)).toFixed(2)+"s");\n if(view==="crossing") console.log');p.write_text(s) p=Path('review/tide-keeper/portable.py');s=p.read_text().replace(' from pack import compact',''' doc["asset"]["extras"]["lowmarch"]={"character":info,"portrait":{"lensMM":40,"sensorWidthMM":36,"flattice":.48}} from pack import compact''');p.write_text(s) PY cat > review/tide-keeper/validate.py <<'PY' """Check portability, mesh indices, skinned vertices, morph targets and loop closure.""" from pathlib import Path import json,sys import numpy as np sys.path.insert(0,str(Path(__file__).resolve().parents[2]/"tools")) from vrm import VRM def verify(path): asset=VRM(path); j=asset.j; get=asset.accessor assert all("uri" not in obj for obj in j["buffers"]+j["images"]) assert not j.get("extensionsRequired") and len(j["skins"])==1 skin=j["skins"][0];n=len(skin["joints"]) assert np.isfinite(get(skin["inverseBindMatrices"])).all() assert all(np.isfinite(get(i)).all() for i in range(len(j["accessors"]))) for node in j["nodes"]: if "mesh" in node:assert node["skin"]==0 if "rotation" in node:assert abs(np.linalg.norm(node["rotation"])-1)<1e-4 verts=tris=targets=0 for mesh in j["meshes"]: for pr in mesh["primitives"]: attrs=pr["attributes"];pos=get(attrs["POSITION"]); normals=get(attrs["NORMAL"]) assert np.max(abs(np.linalg.norm(normals,axis=1)-1))<.001,mesh["name"] joints=get(attrs["JOINTS_0"]);weights=get(attrs["WEIGHTS_0"]) assert joints.min()>=0 and joints.max()<n and weights.min()>=0 assert np.max(abs(weights.sum(axis=1)-1))<1e-5 indices=get(pr["indices"]); assert indices.min()>=0 and indices.max()<len(pos) for target in pr.get("targets",[]): assert get(target["POSITION"]).shape==pos.shape targets+=1 tris+=len(indices)//3;verts+=len(pos) clip,=j["animations"];duration=0 for sampler in clip["samplers"]: t=get(sampler["input"]).reshape(-1);a=get(sampler["output"]) assert (np.diff(t)>0).all() and np.allclose(a[0],a[-1],atol=1e-5) duration=max(duration,float(t[-1])) return dict(meshes=len(j["meshes"]),triangles=tris,vertices=verts,materials=len(j["materials"]), images=len(j["images"]),joints=n,morphMeshes=targets,clip=clip["name"], seconds=round(duration,2),bytes=Path(path).stat().st_size) if __name__=="__main__": print(json.dumps(verify(sys.argv[1]),indent=2)) PY cat review/out/tide-keeper/build.log && tail -2 review/out/tide-keeper/render.log && date -uresult, 10 lines
Script completed Wall time 0.1 seconds Output: Fit, hair, coat and armour 25.23s Base GLB 1.87s Animation, dye maps and packaging 6.21s Build total 33.31s staff contact [ 734.6179301225967, 730.545138319172 ] Tue Nov 17 23:40:05 UTC 2026
exec_command, view_imagepython3 review/tide-keeper/validate.py review/out/tide-keeper/ione.glb && python3 - <<'PY' (+1 more)
input
text((await tools.exec_command({cmd:`python3 review/tide-keeper/validate.py review/out/tide-keeper/ione.glb && python3 - <<'PY' from PIL import Image im=Image.open('review/out/tide-keeper/lens.png');bg=Image.open('review/out/tide-keeper/lens-backdrop.png').resize(im.size);bg.paste(im,mask=im.getchannel('A'));bg.thumbnail((850,570));bg.save('review/out/tide-keeper/check-final.jpg') PY`,max_output_tokens:205})).output);image((await tools.view_image({path:"~/work/lowmarch/review/out/tide-keeper/check-final.jpg"})).image_url)result, 16 lines
Script completed Wall time 0.4 seconds Output: { "meshes": 131, "triangles": 213757, "vertices": 118999, "materials": 38, "images": 21, "joints": 59, "morphMeshes": 22, "clip": "Read the tide", "seconds": 3.2, "bytes": 12536144 }exec_commandrg -n 'escaped|plait_|if j<3|analytic|Analytic' review/tide-keeper/{coiffure,forms}.py; PYTHONPATH=tools python3 - <<'PY'
command
rg -n 'escaped|plait_|if j<3|analytic|Analytic' review/tide-keeper/{coiffure,forms}.py; PYTHONPATH=tools python3 - <<'PY' from vrm import VRM j=VRM('review/out/tide-keeper/ione.glb').j print([m['name'] for m in j['meshes'] if 'escape' in m['name'] or 'plait' in m['name']]);print(j['asset']['extras'].keys()) PY ls -lt review/out/tide-keeper/ione.glb review/tide-keeper/coiffure.py; head -15 review/tide-keeper/build.py; git branch --show-currentresult, 27 lines
Script completed Wall time 0.4 seconds Output: Warning: truncated output (original token count: 304) Total output lines: 25 review/tide-keeper/forms.py:46: # Analytic ellipsoid normals remain defined at the coincident pole vertices. review/tide-keeper/coiffure.py:58: amp=(.027 if j<3 else .048)*(1-.70*t) review/tide-keeper/coiffure.py:60: pc=O.pipe("plait_"+str(j),role,centre,r=radius,seg=12) review/tide-keeper/coiffure.py:64: if j<3: review/tide-keeper/coiffure.py:76: loose=hair.lock("escaped_lock_"+str(j),ch,[("xyz",*pt) for …84 tokens truncated… Only reads the armory cache.""" from pathlib import Path import sys, json, time import numpy as np HERE=Path(__file__).resolve().parent ROOT=HERE.parents[1] CACHE=ROOT/"review/out/tide-keeper" sys.path[:0]=[str(ROOT/"tools"),str(ROOT/"art/cast"),str(ROOT/"review/high-water")] from cast import CAST import cage, vroid_portrait as vp, poses, rig, export_glb from vrm import VRM from tailoring import outfit import figure as first astra62exec_commandPYTHONPATH=tools python3 - <<'PY'
command
PYTHONPATH=tools python3 - <<'PY' from vrm import VRM m=VRM('review/out/tide-keeper/ione.glb'); j=m.j print([n.get('name') for n in j['meshes'] if 'escape' in n['name'] or 'plait' in n['name']]) print([n['name'] for n in j['meshes'][-22:]]);print(j['asset']['extras'].keys()) PY rg -n 'strands|hair.*role|role.*hair' tools/vroid_portrait.py | tail -25result, 14 lines
Script completed Wall time 0.3 seconds Output: ['plait_0', 'plait_1', 'plait_2', 'plait_3'] ['plumb_top', 'plumb_tip', 'ink_underlayer', 'Locks_umberhair', 'Locks_inkhair', 'Locks_bluehair', 'forelock_0', 'plait_0', 'plait_1', 'plait_2', 'plait_3', 'braid_cuff_0', 'braid_cuff_1', 'braid_cuff_2', 'Locks_umberhair', 'free_end_1', 'Fastenings_coral', 'earring', 'ear_drop', 'earring', 'ear_drop', 'SHADOW_nose'] dict_keys(['units', 'front', 'study', 'clip']) 393:def face_normals(prims, roles, lm, amount, hair=0.0, forward=0.0, pull=0.5, neck=None): 403: middle). Hair is off by default: in the painted renderer it flattens the strands into one plastic sheen.""" 1027: face_normals(self.prims, self.roles, lm_now, sh["face_normals"], sh["hair_normals"], neck=neck) 1040: if self.roles[k] in ("line", "brow", "iris", "highlight", "white", "hair", "mouth"): 1137: if k in self.tex and self.roles[k] in ("line", "brow", "iris", "highlight", "white", "hair", "mouth")} 1228: hm = role == "hair" 1249: """Silhouette outline, separation lines between hair strands, jaw over neck, hair over skin.exec_commandsed -n '55,97p' review/tide-keeper/coiffure.py; rg --files tools art/cast review/high-water | rg '(coiffure|forms|tailoring|assembly|portable|pack|dyes|figure)\.py' && cat review/out/tide-keeper/build.log && ls -l --full-time review/tide-keeper/coiffure.py review/out/tide-keeper/ione.glb
command
sed -n '55,97p' review/tide-keeper/coiffure.py; rg --files tools art/cast review/high-water | rg '(coiffure|forms|tailoring|assembly|portable|pack|dyes|figure)\.py' && cat review/out/tide-keeper/build.log && ls -l --full-time review/tide-keeper/coiffure.py review/out/tide-keeper/ione.glb
result, 52 lines
Script completed Wall time 0.1 seconds Output: Warning: truncated output (original token count: 711) Total output lines: 50 gust=np.column_stack([.026*t**2,-.085*t**1.55,-.028*t**2]) for j,(role,radius) in enumerate([("umberhair",.026),("inkhair",.026),("bluehair",.026),("redcord",.0048)]): phase=2*np.pi*(2.45*t+j/3)+(1.1 if j==3 else 0) amp=(.027 if j<3 else .048)*(1-.70*t) centre=path+amp[:,None]*(across*np.cos(phase)[:,None]+up*np.sin(phase)[:,None]) pc=O.pipe("plait_"+str(j),role,centre,r=radius,seg=12) section=pc["pos"].reshape(len(t),13,3) section[:]=centre[:,None]+(section-centre[:,None])*(1-.72*t[:,None,None]) pc["nrm"]=vertex_normals(pc["pos"],pc["tri"]) if j<3: uu,vv=np.meshgrid(np.linspace(0,1,13),t) pc["uv"]=np.stack([uu,vv],axis=-1).reshape(-1,2) pc["strands"]=True pc["gust"]=np.repeat(gust,13,axis=0) out.append(attach(fit,pc,HEAD)) # The plait is tightly dressed at the ferrules and looser in between. # A few tapered sections slip out in the gust; each follows its own arc. for j,(start,end,bulge,colour) in enumerate([(14,53,.046,"umberhair"),(32,78,-.062,"bluehair"),(57,88,.044,"umberhair")]): mid=(start+end)//2 trace=[path[start],path[mid]+.025*across[mid]+bulge*up[mid], path[end]+.01…81 tokens truncated…ppend(attach(fit,loose,HEAD)) for j,k in enumerate([7,78,84]): rad=.041 if j==0 else .020 p=ring(fit,"braid_cuff_"+str(j),"brass",path[k],across[k],up[k],rad,rad,.0055,HEAD) p["gust"]=np.tile(gust[k],(len(p["pos"]),1)) out.append(p) for j in range(3): p=hair.lock("free_end_"+str(j),ch,[("xyz",*path[-11]),("xyz",*path[-1]), ("xyz",*(path[-1]+[.003*j,-.024+j*.019,.098-.014*j]))], width=.037-j*.005,thick=.009,n=26,role="silk" if j==1 else "umberhair") p["gust"]=np.tile(gust[-1],(len(p["pos"]),1)) out.append(attach(fit,p,HEAD)) # Two blade-shaped hairpins over the exposed ear. for j in range(2): a=ch.point(67+j*8,60,off=.024) b=ch.point(118+j*7,79+j*3,off=.021) out.append(rod(fit,"hairpin","brass",a,b,.0035,.002,HEAD)) out.append(bead(fit,"pinhead","coral",a,.006,HEAD)) review/high-water/figure.py Fit, hair, coat and armour 25.23s Base GLB 1.87s Animation, dye maps and packaging 6.21s Build total 33.31s -rw------- 1 runner runner 12536144 2026-11-17 23:39:48.969510472 +0000 review/out/tide-keeper/ione.glb -rw------- 1 runner runner 5572 2026-11-17 23:39:14.972714419 +0000 review/tide-keeper/coiffure.pyexec_commandrg -n -A12 'rawTex =' review/out/tide-keeper/index.html; sed -n '70,84p' review/tide-keeper/coiffure.py; python3 - <<'PY'
command
rg -n -A12 'rawTex =' review/out/tide-keeper/index.html; sed -n '70,84p' review/tide-keeper/coiffure.py; python3 - <<'PY' import json,struct a=open('review/out/tide-keeper/ione.glb','rb');a.seek(12);l,_=struct.unpack('<I4s',a.read(8));d=json.loads(a.read(l));print(d['samplers']); print(d['asset']['extras']['front']) PY cat review/tide-keeper/shot.js | tail -20result, 31 lines
Script completed Wall time 0.1 seconds Output: Warning: truncated output (original token count: 664) Total output lines: 50 294:const rawTex = t => { if (!t) return null; const c = t.clone(); c.colorSpace = THREE.NoColorSpace; c.needsUpdate = true; return c; }; 295-const gradient = (() => { 296- const d = new Uint8Array([70, 70, 70, 255, 140, 140, 140, 255, 205, 205, 205, 255, 255, 255, 255, 255]); 297- const t = new THREE.DataTexture(d, 4, 1, THREE.RGBAFormat); t.minFilter = t.magFilter = THREE.NearestFilter; t.needsUpdate = true; return t; 298-})(); 299-const white = (() => { const t = new THREE.DataTexture(new Uint8Array([255, 255, 255, 255]), 1, 1, THREE.RGBAFormat); t.…384 tokens truncated…oints.push([(v.x+1)*w*.28+190,(1-v.y)*h*.28-2]); } points.sort((a,b)=>b[1]-a[1]);window.contact=points[0]; } return snapshot; }; // Hold the lens still. Only the keyed skeleton and cloth weights advance. window.motionFrame = seconds => { const w=960,h=640; R.setSize(w,h,false); actor.actions["Read the tide"].play(); actor.mixer.setTime(seconds); scene.updateMatrixWorld(true); frameAt(portraitCentre,.89,w,h,3); lensAndFlat({lens:40,flat:.48},portraitCentre,.89,w,h,3); render(); return R.domElement.toDataURL("image/png"); };exec_commandpython3 - <<'PY'
command
python3 - <<'PY' from pathlib import Path p=Path('review/tide-keeper/coiffure.py');s=p.read_text().replace('thick=.003,n=30,seg=8,root_width=.002,taper=(.28,1))','thick=.003,n=30,seg=8,root_width=.002,taper=(.28,1),role=colour)');p.write_text(s) p=Path('review/tide-keeper/build.py');s=p.read_text().replace('import sys, json, time','import sys, time').replace('from vrm import VRM\n','');s=s.replace(' (CACHE/"camera.json").write_text(json.dumps({"characters":[{"name":"figure","info":info}]}))\n','');p.write_text(s) p=Path('review/tide-keeper/shoot.cjs');s=p.read_text().replace(' const browser =',''' const gltf=JSON.parse(binary.subarray(20,20+binary.readUInt32LE(12)).toString("utf8")); const cameraData={characters:[{name:"figure",info:gltf.asset.extras.lowmarch.character}]}; const browser =''').replace('return route.fulfill({ path: path.join(cache, "camera.json") });','return route.fulfill({ json: cameraData });');p.write_text(s) p=Path('review/tide-keeper/shot.js');s=p.read_text().replace(' u.uPigment =',' if (u.uMap.value) u.uMap.value.anisotropy=Math.min(8,R.capabilities.getMaxAnisotropy());\n u.uPigment =').replace('h=crossing?1416:full?960:960','h=crossing?1416:960');p.write_text(s) PY OPENBLAS_NUM_THREADS=1 python3 -u review/tide-keeper/build.py > review/out/tide-keeper/build.log 2>&1 && node review/tide-keeper/shoot.cjs crossing lens rear side pbr motion > review/out/tide-keeper/render.log 2>&1result, 4 lines
Script completed Wall time 0.4 seconds Output: {"chunk_id":"eec823","wall_time_seconds":0.250979928,"session_id":28871,"original_token_count":0,"output":""}



