Skip to content

PoseMaker scripts

Maintenance tooling for the pose-maker library (MongoDB collection poseMakerLibrary).

All scripts read MONGODB_URI from .env; LLM-driven scripts also need OPENAI_API_KEY.

Inspection

listPoses.ts — read-only catalog dump

Prints every pose in Mongo, grouped by category, with each pose's tool-call count.

npx ts-node scripts/poseMaker/listPoses.ts

Use this to confirm what's in the DB, sanity-check after a migration, or share a human-readable inventory.

Authoring new poses

seedPoseLibrary.ts — hand-curated seeds

Runs the director→rigger pipeline against a small, in-script list of { id, name, category, description } seeds and upserts the resulting tool-call sequences into Mongo. Edit SEED_ENTRIES in the file when you want to add or re-tune the canonical baseline poses. Idempotent: same id → upsert.

npx ts-node scripts/poseMaker/seedPoseLibrary.ts

seedPoseLibraryFromJson.ts — bulk seeds from a JSON file

Companion to the above for batch additions when you only have terse pose names (no anatomical description). Reads poseLibrarySeeds.json (or a path you pass), expands each name into a director-style description via OpenAI, then runs the standard pipeline.

# Default JSON path:
npx ts-node scripts/poseMaker/seedPoseLibraryFromJson.ts

# Explicit JSON, dry run, skip ids already in Mongo:
npx ts-node scripts/poseMaker/seedPoseLibraryFromJson.ts path/to/poses.json --dry-run --skip-existing

JSON shape:

[
  { "category": "neutral-standing", "poses": ["slouch", "wide stance", ...] },
  ...
]

Refreshing existing poses

regeneratePoseLibrary.ts — re-run rigger on existing descriptions

Re-runs the director→rigger pipeline on poses that already exist in Mongo, using their saved descriptions. Used after rigger-prompt changes to refresh the library. Three-step workflow keeps you from paying for LLM calls twice and lets you review results before they hit Mongo.

# 1. Preview which entries would regen — no LLM, no DB writes:
npx ts-node scripts/poseMaker/regeneratePoseLibrary.ts --unverified --dry-run

# 2. Run director+rigger for each, cache results to disk:
#    Writes scripts/poseMaker/.regenCache/<runId>/<id>.json files shaped
#    as { "expected": [...], "actual": [...] } so you can paste either array
#    into the FE pose-debug renderer to compare.
npx ts-node scripts/poseMaker/regeneratePoseLibrary.ts --unverified

# 3. Apply approved cached results to Mongo (no LLM):
npx ts-node scripts/poseMaker/regeneratePoseLibrary.ts --apply-from-cache <runId>

Filters (mutually exclusive): - --all — every pose - --unverified — only isVerified !== true (recommended; verified poses are ground truth, don't overwrite them) - --category <cat> — e.g. standing - --id <id> — single pose

Other flags: - --verbose — print per-pose director output and tool calls during step 2

If you decide a cached entry is bad, just delete the file under .regenCache/<runId>/; the apply step skips anything missing or with actual.length <= 1 (which usually means the rigger timed out and only the resetPose survived).

Marking poses verified

markVerifiedPoses.ts — sync isVerified flag

Reads python_eval/scripts/verified_poses.json and flips each Mongo pose's isVerified flag to match. The flag controls two things at runtime: 1. Production poseMaker shows only verified poses in the director's reference catalog 2. The export script (python_eval/scripts/export_pose_library.py) only exports verified poses as test fixtures

# Dry run — preview which entries would flip on/off:
npx ts-node scripts/poseMaker/markVerifiedPoses.ts

# Apply:
npx ts-node scripts/poseMaker/markVerifiedPoses.ts --apply

Run this after editing verified_poses.json (after visually verifying a pose in the FE pose-debug page).

Typical workflow when adding a pose

  1. Add a seed in seedPoseLibrary.ts (or hand-edit the row directly in Mongo)
  2. Run the seed script to create the row
  3. Visually inspect in the FE pose-debug page; tweak the description and re-run regeneratePoseLibrary.ts --id <id> if the tool calls look wrong
  4. Once happy, add the id to python_eval/scripts/verified_poses.json
  5. npx ts-node scripts/poseMaker/markVerifiedPoses.ts --apply
  6. cd python_eval && python scripts/export_pose_library.py to refresh test fixtures

Cache directory

scripts/poseMaker/.regenCache/ is gitignored. Each <runId> subfolder is a review queue — keep, edit, or delete files inside it before running --apply-from-cache. Old folders are safe to delete once you've applied (or abandoned) the run.