# xikhar/papercraft architecture

> Architecture diagram of the GitHub repository xikhar/papercraft, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/xikhar/papercraft
- Repository: https://github.com/xikhar/papercraft

## Overview

Papercraft is an agent skill and runtime kit for creating handcrafted paper-style games, scenes, pages, animations, and videos. The main workflow is a prompt and optional visual references guiding the skill to select a 2D or 3D harness, author a scene using the paper kit, then capture and review the result. Separate capabilities include procedural paper-texture generation and blind A/B comparison. The graph follows documented workflow links; source excerpts are limited to Python review and texture tools, so internal JavaScript call relationships are not inferred.

Main entry points: [`skills/papercraft/SKILL.md`](https://github.com/xikhar/papercraft/blob/main/skills/papercraft/SKILL.md) (Papercraft skill), [`skills/papercraft/assets/templates/popup-3d`](https://github.com/xikhar/papercraft/tree/main/skills/papercraft/assets/templates/popup-3d) (3D harness), [`skills/papercraft/assets/templates/popup-2d`](https://github.com/xikhar/papercraft/tree/main/skills/papercraft/assets/templates/popup-2d) (2D harness), [`skills/papercraft/scripts/capture.py`](https://github.com/xikhar/papercraft/blob/main/skills/papercraft/scripts/capture.py) (Capture tool)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_guidance["Design guidance"]
  node_skill["Papercraft skill<br/>[SKILL.md]"]
  node_references["Design references"]
  node_gallery["World gallery"]
end

subgraph group_runtime["Scene runtime"]
  node_harness3d["3D harness"]
  node_harness2d["2D harness"]
  node_kit3d["3D paper kit<br/>[paperkit-3d.js]"]
  node_kit2d["2D paper kit<br/>[paperkit-2d.js]"]
  node_motion["Motion and walking<br/>[paper-motion.js]"]
  node_life["World life<br/>[paper-life.js]"]
  node_sound["Paper sound<br/>[paper-sound.js]"]
  node_examples["Worked examples"]
end

subgraph group_review["Capture and review"]
  node_capture["Capture tool<br/>[capture.py]"]
  node_measure["Look metrics<br/>[measure.py]"]
  node_ab["A/B sheets<br/>[ab_sheet.py]"]
end

subgraph group_materials["Paper materials"]
  node_textures["Texture generator<br/>[paper_textures.py]"]
end

node_creator(("Creator"))
node_finished["Rendered output"]

node_creator -->|"requests creation"| node_skill
node_skill -->|"consults guidance"| node_references
node_skill -->|"reviews examples"| node_gallery
node_skill -->|"chooses 3D"| node_harness3d
node_skill -->|"chooses 2D"| node_harness2d
node_skill -->|"adapts examples"| node_examples
node_harness3d -->|"uses kit"| node_kit3d
node_harness2d -->|"uses kit"| node_kit2d
node_harness3d -->|"supports walking"| node_motion
node_harness2d -->|"supports walking"| node_motion
node_skill -->|"adds world life"| node_life
node_skill -->|"adds foley"| node_sound
node_creator -->|"requests review"| node_capture
node_capture -->|"renders frames or video"| node_finished
node_creator -->|"checks look metrics"| node_measure
node_creator -->|"compares renders"| node_ab
node_creator -->|"generates textures"| node_textures

click node_skill "https://github.com/xikhar/papercraft/blob/main/skills/papercraft/SKILL.md"
click node_references "https://github.com/xikhar/papercraft/tree/main/skills/papercraft/references"
click node_gallery "https://github.com/xikhar/papercraft/tree/main/skills/papercraft/assets/gallery"
click node_harness3d "https://github.com/xikhar/papercraft/tree/main/skills/papercraft/assets/templates/popup-3d"
click node_harness2d "https://github.com/xikhar/papercraft/tree/main/skills/papercraft/assets/templates/popup-2d"
click node_kit3d "https://github.com/xikhar/papercraft/blob/main/skills/papercraft/assets/lib/paperkit-3d.js"
click node_kit2d "https://github.com/xikhar/papercraft/blob/main/skills/papercraft/assets/lib/paperkit-2d.js"
click node_motion "https://github.com/xikhar/papercraft/blob/main/skills/papercraft/assets/lib/paper-motion.js"
click node_life "https://github.com/xikhar/papercraft/blob/main/skills/papercraft/assets/lib/paper-life.js"
click node_sound "https://github.com/xikhar/papercraft/blob/main/skills/papercraft/assets/lib/paper-sound.js"
click node_examples "https://github.com/xikhar/papercraft/tree/main/skills/papercraft/assets/examples"
click node_capture "https://github.com/xikhar/papercraft/blob/main/skills/papercraft/scripts/capture.py"
click node_measure "https://github.com/xikhar/papercraft/blob/main/skills/papercraft/scripts/measure.py"
click node_ab "https://github.com/xikhar/papercraft/blob/main/skills/papercraft/scripts/ab_sheet.py"
click node_textures "https://github.com/xikhar/papercraft/blob/main/skills/papercraft/scripts/paper_textures.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_skill,node_references,node_gallery toneBlue
class node_harness3d,node_harness2d,node_kit3d,node_kit2d,node_motion,node_life,node_sound,node_examples toneAmber
class node_capture,node_measure,node_ab toneMint
class node_textures toneRose
class node_creator,node_finished toneIndigo
```

## Components

### Design guidance

- [Papercraft skill](https://github.com/xikhar/papercraft/blob/main/skills/papercraft/SKILL.md): `skills/papercraft/SKILL.md`
- [Design references](https://github.com/xikhar/papercraft/tree/main/skills/papercraft/references): `skills/papercraft/references`
- [World gallery](https://github.com/xikhar/papercraft/tree/main/skills/papercraft/assets/gallery): `skills/papercraft/assets/gallery`

### Scene runtime

- [3D harness](https://github.com/xikhar/papercraft/tree/main/skills/papercraft/assets/templates/popup-3d): `skills/papercraft/assets/templates/popup-3d`
- [2D harness](https://github.com/xikhar/papercraft/tree/main/skills/papercraft/assets/templates/popup-2d): `skills/papercraft/assets/templates/popup-2d`
- [3D paper kit](https://github.com/xikhar/papercraft/blob/main/skills/papercraft/assets/lib/paperkit-3d.js): `skills/papercraft/assets/lib/paperkit-3d.js`
- [2D paper kit](https://github.com/xikhar/papercraft/blob/main/skills/papercraft/assets/lib/paperkit-2d.js): `skills/papercraft/assets/lib/paperkit-2d.js`
- [Motion and walking](https://github.com/xikhar/papercraft/blob/main/skills/papercraft/assets/lib/paper-motion.js): `skills/papercraft/assets/lib/paper-motion.js`
- [World life](https://github.com/xikhar/papercraft/blob/main/skills/papercraft/assets/lib/paper-life.js): `skills/papercraft/assets/lib/paper-life.js`
- [Paper sound](https://github.com/xikhar/papercraft/blob/main/skills/papercraft/assets/lib/paper-sound.js): `skills/papercraft/assets/lib/paper-sound.js`
- [Worked examples](https://github.com/xikhar/papercraft/tree/main/skills/papercraft/assets/examples): `skills/papercraft/assets/examples`

### Capture and review

- [Capture tool](https://github.com/xikhar/papercraft/blob/main/skills/papercraft/scripts/capture.py): `skills/papercraft/scripts/capture.py`
- [Look metrics](https://github.com/xikhar/papercraft/blob/main/skills/papercraft/scripts/measure.py): `skills/papercraft/scripts/measure.py`
- [A/B sheets](https://github.com/xikhar/papercraft/blob/main/skills/papercraft/scripts/ab_sheet.py): `skills/papercraft/scripts/ab_sheet.py`

### Paper materials

- [Texture generator](https://github.com/xikhar/papercraft/blob/main/skills/papercraft/scripts/paper_textures.py): `skills/papercraft/scripts/paper_textures.py`

### Other components

- **Creator**
- **Rendered output**

## Connections

- Creator → Papercraft skill: requests creation (evidence: `README.md`)
- Papercraft skill → Design references: consults guidance (evidence: `README.md`)
- Papercraft skill → World gallery: reviews examples (evidence: `README.md`)
- Papercraft skill → 3D harness: chooses 3D (evidence: `README.md`)
- Papercraft skill → 2D harness: chooses 2D (evidence: `README.md`)
- Papercraft skill → Worked examples: adapts examples (evidence: `README.md`)
- 3D harness → 3D paper kit: uses kit (evidence: `README.md`)
- 2D harness → 2D paper kit: uses kit (evidence: `README.md`)
- 3D harness → Motion and walking: supports walking (evidence: `README.md`)
- 2D harness → Motion and walking: supports walking (evidence: `README.md`)
- Papercraft skill → World life: adds world life (evidence: `README.md`)
- Papercraft skill → Paper sound: adds foley (evidence: `README.md`)
- Creator → Capture tool: requests review (evidence: `README.md`)
- Capture tool → Rendered output: renders frames or video (evidence: `README.md`)
- Creator → Look metrics: checks look metrics (evidence: `README.md`)
- Creator → A/B sheets: compares renders (evidence: `README.md`)
- Creator → Texture generator: generates textures (evidence: `README.md`)
