rtistree 0.5.1 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/CONTRIBUTING.md +47 -0
  3. package/README.md +14 -5
  4. package/SECURITY.md +20 -0
  5. package/THIRD_PARTY_NOTICES.md +1 -1
  6. package/dist/cli.js +17 -3
  7. package/dist/cli.js.map +1 -1
  8. package/dist/commands.d.ts +12 -0
  9. package/dist/index.d.ts +1 -0
  10. package/dist/index.js +1 -0
  11. package/dist/index.js.map +1 -1
  12. package/dist/mcp.js +18 -2
  13. package/dist/mcp.js.map +1 -1
  14. package/dist/print-scene.d.ts +6 -0
  15. package/dist/program.js +3 -1
  16. package/dist/program.js.map +1 -1
  17. package/dist/project-config.js +2 -1
  18. package/dist/project-config.js.map +1 -1
  19. package/dist/render.js +21 -1
  20. package/dist/render.js.map +1 -1
  21. package/dist/schema.d.ts +46 -0
  22. package/dist/schema.js +107 -0
  23. package/dist/schema.js.map +1 -1
  24. package/dist/sprites.d.ts +31 -0
  25. package/dist/sprites.js +142 -0
  26. package/dist/sprites.js.map +1 -0
  27. package/dist/studio-reference.js +1 -1
  28. package/dist/studio-reference.js.map +1 -1
  29. package/docs/agent-art-workflow.md +10 -0
  30. package/docs/agent-setup.md +8 -3
  31. package/docs/atelier.md +12 -1
  32. package/docs/cli-reference.md +76 -25
  33. package/docs/core-concepts.md +95 -0
  34. package/docs/decisions/004-print-production-and-projects.md +1 -1
  35. package/docs/decisions/005-programmable-digital-art.md +1 -1
  36. package/docs/engine-overview.md +121 -165
  37. package/docs/evolution.md +12 -9
  38. package/docs/getting-started.md +15 -8
  39. package/docs/next-milestone.md +4 -4
  40. package/docs/production.md +22 -16
  41. package/docs/releasing.md +99 -43
  42. package/docs/scene-format.md +44 -7
  43. package/docs/sprites.md +166 -0
  44. package/docs/studio.md +25 -10
  45. package/examples/hello/README.md +4 -0
  46. package/package.json +8 -5
  47. package/schemas/authoring.schema.json +359 -229
  48. package/schemas/command.schema.json +462 -332
  49. package/schemas/patch.schema.json +462 -332
  50. package/schemas/scene.schema.json +347 -217
  51. package/schemas/sprites.schema.json +41 -0
@@ -1,174 +1,130 @@
1
- # Rtistree
2
-
3
- A deterministic raster graphics engine that agents can inspect, edit, verify, and replay. A persistent scene is the source of truth; PNG, JPEG, TIFF, PDF and SVG are outputs.
4
-
5
- Version 0.4 adds a programmable digital-art studio: seeded raster programs, pressure brushes, texture fields, warps, displacement, height-field lighting and dense regional edits. Programs bake to pinned assets with portable, replayable recipes; normal rendering never executes code. See the [studio guide](studio.md), [decision](decisions/005-programmable-digital-art.md) and [wheel trial made without image generation](../examples/manual-wheel-trial/README.md).
6
-
7
- TypeScript provides the scene schema, transactions, CLI, and MCP tool server. The next-stage implementation includes attached painting, adaptive patches, incremental layer rendering, visual critique and source rebasing. **Native CPU Skia** performs rendering through `@napi-rs/canvas`. No browser, WebGL, GPU, model API key, or external service is required.
8
-
9
- ![Poster rendered by Rtistree](previews/poster.png)
10
-
11
- ## Print production and new projects
12
-
13
- Version 0.3 adds physical documents, ICC-managed CMYK exports, embedded PDF fonts/vector geometry, project creation, source crops/perspective, mask algebra, tonal adjustments, clone/heal, path booleans and richer typography. See the [production guide](production.md), [recorded decisions](decisions/004-print-production-and-projects.md) and [masked generated-asset print trial](../examples/print-trial/README.md).
14
-
15
- ```sh
16
- graphics project new artwork --size A3 --orientation landscape --ppi 300 --bleed 3mm
17
- graphics render artwork --preset screen
18
- # Configure the printer/paper ICC profile in rtistree.yaml before CMYK export.
19
- graphics preflight artwork --preset print
20
- graphics export artwork --preset print --format pdf
21
- ```
22
-
23
- Print PDFs encode exact trim/bleed dimensions and are reopened for validation. PDF/X certification, spot colours and overprint are not claimed. The engine remains an 8-bit sRGB working renderer with explicit colour-managed output.
24
-
25
- ## Run it
26
-
27
- Requires Node.js 22 or newer. Dependencies and bundled fonts are pinned in `package-lock.json`.
28
-
29
- ```sh
30
- npm ci
31
- npm run build
32
- npm test
33
- npm run demo
34
- ```
35
-
36
- The demo renders a poster, measures an underlit region, applies a local correction, and checks replay, undo, redo, and a self-contained export. It writes before/after images and evidence into `examples/poster/renders/`, plus a landscape into `examples/landscape/renders/`. Every demo run uses a fresh working project and leaves the example's authoring files untouched.
37
-
38
- The recorded poster benchmark changes **4,704 pixels inside a 56 × 84 region, zero pixels outside**, improves rule verification from fail to pass, and reproduces identical PNG bytes after reopen, undo/redo, and export. This establishes mechanical correctness, not a general measure of artistic quality. See [recorded evidence](previews/benchmark.json).
39
-
40
- Use the executable after building:
41
-
42
- ```sh
43
- node dist/cli.js render examples/poster/scene.yaml -o /tmp/poster.png
44
- node dist/cli.js inspect examples/poster/scene.yaml
45
- node dist/cli.js inspect-region examples/poster/scene.yaml 755 610 56 84
46
- node dist/cli.js apply examples/poster/scene.yaml examples/poster/refine.json
47
- node dist/cli.js verify examples/poster/scene.yaml
48
- node dist/cli.js render examples/poster/scene.yaml -o /tmp/refined.png
49
- node dist/cli.js undo examples/poster/scene.yaml
50
- node dist/cli.js redo examples/poster/scene.yaml
51
- node dist/cli.js export examples/poster/scene.yaml -o /tmp/rtistree-export/scene.json
52
- ```
53
-
54
- `npm run graphics -- …` runs the same CLI from source. Installing the package exposes the `graphics` executable. `graphics --help` lists commands. JSON goes to stdout; errors go to stderr. Verification failures exit with code 2, other failures with code 1.
55
-
56
- ## Compose a project from files
57
-
58
- A manifest can reference as many independently authored fragments as needed:
59
-
60
- ```yaml
61
- version: 1
62
- canvas:
63
- width: 1024
64
- height: 1024
65
- background: '#102c31'
66
- include:
67
- - layers/background.yaml
68
- - layers/product.yaml
69
- - layers/typography.yaml
70
- ```
71
-
72
- Each fragment contains `layers`, optional `assets`, and optional nested `include` paths. Paths resolve relative to the declaring file and must stay inside the project. Layer and asset IDs share a project namespace. Included layers compose in declaration order, followed by local layers; sibling `z` values determine paint order. Groups preserve hierarchy.
73
-
74
- The [poster example](../examples/poster/scene.yaml) uses this format. [Scene format documentation](scene-format.md) describes coordinates, layout, operations, and validation.
1
+ # Engine overview
2
+
3
+ Rtistree is a local TypeScript/Node.js graphics engine with a CLI, SDK and stdio MCP
4
+ server. Native CPU Skia renders the scene; Sharp and PDFKit handle artwork exports.
5
+ The renderer needs no browser, GPU, model API key or external service. An agent host
6
+ supplies its own model, image inspection and visual judgment.
7
+
8
+ Start with [getting started](getting-started.md) for an installed npm package.
9
+ The commands in the development section below require a repository checkout.
10
+
11
+ ## Scene and authoring model
12
+
13
+ JSON/YAML source scenes can include fragments and parameterized components. The loader
14
+ expands them into one validated layer tree. Layers support groups, paths, text,
15
+ local image assets, procedural fills, layouts, transforms, masks and adjustments.
16
+ Raster operations, sparse palette tiles and promoted regions add focused pixel edits.
17
+ See [scene format](scene-format.md) and [editing workflows](evolution.md).
18
+
19
+ Pixel-art scenes can opt into explicit integer, palette and nearest-neighbour
20
+ guardrails. Sprite manifests describe frame rectangles, pivots, durations, tags and
21
+ animation ordering; the sprite exporter packs them into a deterministic atlas without
22
+ making Rtistree responsible for a game engine's runtime. See [pixel art, sprites and
23
+ spritesheets](sprites.md).
24
+
25
+ Layer IDs are unique throughout the tree. Assets, fonts and components each have their
26
+ own ID map; they do not share the layer-ID namespace. Relative include and asset paths
27
+ resolve from the declaring source file and must remain inside the root scene directory.
28
+
29
+ For painting, trusted JavaScript programs use Canvas, seeded brushes, fields and pixels.
30
+ Programs bake to ordinary image assets and pin source, parameters and inputs in recipes.
31
+ [Explicit pipelines](atelier.md) rebuild changed dependencies with caching. Rendering and
32
+ opening a scene do not execute those programs. The VM is not a security sandbox.
33
+
34
+ Physical document dimensions and print sampling resolution are separate from design pixels.
35
+ [Print production](production.md) covers PNG/JPEG/TIFF/PDF/SVG exports, profiles,
36
+ physical page boxes, preflight and soft proofs. The working renderer is 8-bit sRGB;
37
+ PDF/X certification, spot colours and overprint are not implemented.
38
+
39
+ ## Editing and persistence
40
+
41
+ `Project.open(path)` accepts a scene file, `rtistree.yaml` or a configured project directory.
42
+ `project.scene()` returns the current resolved state. `project.render()` returns PNG bytes,
43
+ pixels and evidence; `project.inspect()` and `project.inspectLayer(id)` return structure.
44
+ `project.apply({reason, expected_hash, commands})` validates and commits a typed transaction.
45
+ The SDK exports `Project`, `SkiaRenderer`, schemas, command helpers, render/verification
46
+ functions, `runProgram`, `buildPipeline`, `exportSpriteSheet`, `production` and the
47
+ art-direction guide.
48
+
49
+ Authoring files remain the baseline. Mutations append to
50
+ `history/<scene-filename>.operations.jsonl`; journal records include state snapshots,
51
+ commands, hashes, timestamps and measured locality. Failed transactions leave the working
52
+ scene unchanged. Scoped raster edits compare the final composite before and after and
53
+ reject pixels changed outside the allowed area. Structural edits have no general locality promise.
54
+
55
+ Undo and redo append records. After manual source changes, `rebase` merges disjoint edits
56
+ against the retained baseline and reports conflicts without committing. `compact` compresses
57
+ journal records while retaining undo/redo; replay still reads the full history. Remove a stale
58
+ lock only after confirming its recorded writer is no longer active.
59
+
60
+ Portable export creates a new baseline with referenced assets, custom fonts, recipes and
61
+ configured print profiles. It preserves the current artwork and inline pipeline graph,
62
+ but does not copy edit history, critiques or production-session reviews and candidates.
75
63
 
76
64
  ## Agent interface
77
65
 
78
- Art-direction guidance ships with the engine. MCP clients receive concise rules
79
- at connection time and can read the full versioned guide through `studioHelp` or
80
- the `rtistree://guides/art-direction` resource. CLI agents use `graphics art-guide`
81
- without opening a project. SDK hosts can include `rtistreeAgentInstructions` in
82
- their agent context and expose `artDirectionGuide`.
83
-
84
- The guide includes representative-sample workflows, connected figure construction,
85
- shared prop perspective, ground-contact animation checks, lessons from failed
86
- asset trials and a starter production plan using existing review gates. Technical,
87
- functional and visual acceptance are separate. This makes the knowledge available
88
- to new agents; it does not guarantee that every client presents it or every model
89
- follows it. See [the agent workflow](agent-art-workflow.md).
90
-
91
- Start the MCP server with a scene:
92
-
93
- ```sh
94
- node dist/cli.js serve /absolute/path/to/scene.yaml
95
- ```
96
-
97
- Configure an MCP client to launch `node`, with the absolute path to `dist/cli.js`, `serve`, and the absolute scene path as arguments. Transport is stdio; the server writes only protocol messages to stdout.
98
-
99
- Tools: `inspectScene`, `inspectLayer`, `inspectRegion`, `render`, `renderRegion`, `apply`, `undo`, `redo`, `verify`, `history`, `recordCritique`, `readCritique`, `rebase`, `compactHistory`, `exportArtwork`, `preflight`, `softProof`, `studioHelp`, `runProgram`, `replayProgram`, `readRasterRegion`, `writeRasterRegion`. Image tools return PNG image content so a vision-capable agent can inspect the result. `apply` advertises a typed command schema and requires an explanation. Supply the scene hash returned by inspection to reject stale edits.
100
-
101
- ```json
102
- {
103
- "reason": "Brighten the underlit detail without changing the surrounding composition",
104
- "expected_hash": "sha256:…",
105
- "commands": [
106
- {
107
- "type": "applyRasterOperation",
108
- "target": "cover",
109
- "operation": {
110
- "type": "brightness",
111
- "bounds": [755, 610, 56, 84],
112
- "amount": 0.06
113
- }
114
- }
115
- ]
116
- }
117
- ```
118
-
119
- The SDK also exposes `Project`, `SkiaRenderer`, `parseScene`, layout and verification functions, and `runIterations(project, editingAgent, options)`. The injected agent receives the scene, PNG, and verifier report and returns a patch or `null`. Iteration budgets, stale-state checks, stall thresholds, and cancellation bound the loop. An optional typed `critic` callback adds visual feedback; `requireCritique: true` requires a current critique before passing, and unresolved medium/high findings prevent success. Model choice and vision critique stay outside the renderer; there is no built-in LLM or diffusion service.
120
-
121
- ## Persistence and reproducibility
122
-
123
- Authoring fragments remain intact. Successful mutations append a transaction to `history/<scene-filename>.operations.jsonl`. Each record stores its commands, reason, full resolved state, previous-record hash, input/output scene hashes, asset hashes, and measured locality. Reads replay this journal over the original scene. Undo/redo append records rather than deleting history. Full state snapshots favor correctness and recovery over storage efficiency in this MVP.
124
-
125
- A failed batch leaves the scene unchanged. A project lock prevents concurrent writers; an expected scene hash handles stale agents. Incomplete or altered journal records are rejected. If a writer crashes, inspect the PID in the `.lock` file before removing the stale lock. After manual source edits, run `graphics rebase scene.yaml` to merge nonconflicting changes into the working state. Conflicts report exact paths without committing. `graphics compact scene.yaml` compresses history while retaining every undo/redo state. New histories retain their source baseline; legacy histories require restoring/exporting the original source before rebasing. Changed raster asset bytes are also rejected after history exists.
126
-
127
- Exports copy raster assets and custom fonts into content-addressed files and pin their hashes. Every PNG has a `.evidence.json` sidecar recording renderer/backend/runtime versions, scene hash, asset hashes, bundled font hashes, dimensions, quality, and PNG hash. Byte identity is tested on the same pinned runtime and platform. Cross-platform Skia byte identity is **not** promised.
128
-
129
- ## Implemented scope
130
-
131
- - JSON/YAML scenes and recursive multi-file composition; strict validation and JSON Schema generation.
132
- - Groups, semantic roles, shapes and SVG-style paths, text wrapping, local PNG/JPEG/WebP assets, gradients, seeded noise, transforms, row/column layouts, anchors, percentages, opacity, and nine blend modes.
133
- - Rectangle, ellipse, polygon and semantic-alpha masks; feathering, layer blur, and adjustment layers.
134
- - Scoped fill, paint/erase strokes, blur, brightness, contrast, saturation, hue shifts, noise, colour replacement, direct pixels, and palette tiles. Binary rasters remain external assets.
135
- - Exact region crops, structural/color inspection, append-only transactions, undo/redo, self-contained export, CLI, and MCP.
136
- - Text overflow, declared contrast, safe-area, overlap, copy/role and region-luma rules, issue heatmaps, measured edit locality, and bounded agent iterations.
137
-
138
- The remaining extensions are automatic quadtree subdivision, a general dirty-tile compositor, advanced SVG import, mesh warp/smudge, general segmentation, provider-specific model integrations, learned asset generation, and animation. Draft still downsamples after rendering. Safe pointwise region scenes use smaller viewport surfaces; antialias-sensitive scenes fall back to a full composite and exact crop.
139
-
140
- ## Next-stage examples and agent trials
141
-
142
- See [the new API and workflows](evolution.md) and [ADR 003](decisions/003-editing-refinement-and-agent-validation.md). New features include mutable effects/operations, object-relative paint, promoted patches at 1–4× resolution, layer caching, rendered contrast/visibility rules, hash-bound visual critiques, component instances, custom fonts, source rebasing and compressed history.
143
-
144
- Three interactive trials are recorded in [agent-trials/results.json](../examples/agent-trials/results.json), with before/after images, briefs, complete audit snapshots and portable final scenes. Corrections were selected after inspecting the images. The visual scores are same-agent judgments; these are not independent quality evaluations, and token usage was unavailable. All three final scenes passed their configured checks and reproduced after export. The pear trial preserved every checked nonfruit pixel.
145
-
146
- ```sh
147
- node dist/cli.js render examples/agent-trials/reading-club/final/scene.json -o /tmp/reading-club.png
148
- node dist/cli.js render examples/agent-trials/pear/final/scene.json -o /tmp/pear.png
149
- npm run performance
150
- ```
151
-
152
- The performance probe records cache counters and local timings in `docs/previews/performance.json`. Its 16-layer edit reuses 15 surfaces and rasterizes one, while matching an uncached render exactly.
153
-
154
- See [architecture decisions](decisions/001-runtime-and-renderer.md), [multi-file persistence decision](decisions/002-composable-scenes-and-history.md), and the original [architecture proposal](../agentic-raster-graphics-architecture.md).
155
-
156
- ## Development
66
+ The [agent setup guide](agent-setup.md) explains CLI, MCP and SDK integration.
67
+ MCP tools are:
68
+
69
+ - Inspection and images: `inspectScene`, `inspectLayer`, `inspectRegion`, `render`, `renderRegion`.
70
+ - Editing and history: `apply`, `undo`, `redo`, `history`, `rebase`, `compactHistory`.
71
+ - Verification and review: `verify`, `recordCritique`, `readCritique`.
72
+ - Painting: `studioHelp`, `runProgram`, `replayProgram`, `readRasterRegion`, `writeRasterRegion`.
73
+ - Staged work: `buildPipeline`, `production`.
74
+ - Artwork export: `exportArtwork`, `exportSprites`, `preflight`, `softProof`.
75
+
76
+ MCP rendering/crop tools return PNG image content. Production capture and comparison return
77
+ artifact paths in JSON; the host needs a way to open those images. The MCP server operates
78
+ on the project passed to `serve`; project creation, SVG import, portable scene export and
79
+ interactive benchmarks are available through the CLI/SDK, not separate MCP tools.
80
+
81
+ The exported `runIterations(project, editingAgent, options)` supports bounded edit loops.
82
+ The injected agent receives the scene, PNG and verifier report and returns a patch or `null`.
83
+ An optional `critic` callback supplies visual feedback. `requireCritique: true` requires a
84
+ current critique before passing, and unresolved medium/high findings prevent success.
85
+ There is no built-in model client or automatic visual critic.
86
+
87
+ ## Evidence and limits
88
+
89
+ The [art-direction guide](agent-art-workflow.md) separates technical correctness, functional
90
+ behaviour and observed visual quality. Production gates enforce declared criteria and hashes;
91
+ they cannot authenticate reviewers, judge taste or prove that images were inspected.
92
+
93
+ PNG writes through the CLI/artifact helper include an evidence sidecar. SDK `render()` returns
94
+ evidence in memory; use `writeRender()` to write both files. Same-runtime/platform replay,
95
+ undo and portable export are tested. Cross-platform or cross-version byte identity is not promised.
96
+
97
+ A bounded layer cache reuses unchanged surfaces. Simple pointwise region scenes use a smaller
98
+ viewport; antialias-sensitive cases use a full render and exact crop. `cache: false` and
99
+ `regionMode: 'full'` request reference paths. Draft downsamples after rendering. A general
100
+ dirty-tile compositor, automatic quadtree refinement, a native animation timeline, mesh warp,
101
+ smudge and general segmentation remain unimplemented. Sprite manifests and atlas export
102
+ package authored frames but do not provide inverse kinematics, retargeting or automatic
103
+ visual approval. Procedural programs can still author individual animation frames, as the
104
+ [asset trial](https://github.com/Coly010/rtistree/tree/main/examples/warden-asset-trial) demonstrates.
105
+
106
+ The [poster benchmark](previews/benchmark.json) records 4,704 changed pixels inside a
107
+ 56 × 84 region and zero outside, with successful replay/undo/export checks. It is recorded
108
+ mechanical evidence, not a visual-quality benchmark. The [performance probe](previews/performance.json)
109
+ records local timings and cache reuse; it is not a portable speed guarantee.
110
+
111
+ ## Repository development
157
112
 
158
113
  ```sh
114
+ git clone https://github.com/Coly010/rtistree.git
115
+ cd rtistree
116
+ npm ci
159
117
  npm run check
160
- npm run format:check
161
- npm run schema
118
+ npm run demo
119
+ npm run docs:check
120
+ npm run package:check
162
121
  ```
163
122
 
164
- Subsystems are separate modules in `src/`: schema, loader, layout, assets, paint, renderer, commands, project transactions, verification, workflow, CLI and MCP. The `Renderer` interface makes backend replacement independent of scene authoring or agent logic. The original proposal's package boundaries are module boundaries until independent packaging has a concrete benefit.
165
-
166
- Bundled fonts are Inter and DM Serif Display from Fontsource, under their bundled SIL Open Font Licenses. They cover Latin text; custom project fonts can supply broader script coverage. Arbitrary system-font fallback remains disabled. Example artwork and book-cover raster are built from this engine's own primitives; regenerate the cover with `node --import tsx scripts/create-fixtures.ts`.
167
-
168
- ## Staged 2D art production
169
-
170
- Dependency-aware painting pipelines, immutable candidate comparisons, hash-bound visual reviews and gated production stages are available through the CLI, SDK and MCP. Seeded oil/filbert/scumble/ink brushes complement native Canvas paths and raw pixels. See [the atelier workflow](atelier.md) and the hand-authored dragon trial in `examples/dragon-oil-trial`. No image-generation or 3D dependency is used.
171
-
172
- Read [Art direction for agents](agent-art-workflow.md) before making art. The foundation-first protocol, named 2D construction guides, explicit blocking issues and parent-linked revisions are also discoverable through `graphics studio-help`. The [grayscale dragon study](../examples/dragon-foundation/README.md) demonstrates the process and records its unresolved artistic failures.
123
+ `npm run rtistree -- ...` runs the CLI from source. `npm run schema` regenerates the
124
+ schemas. `npm run performance` reruns the cache/timing probe. The demo uses a temporary
125
+ working project and writes preview images/evidence without editing the example source scenes.
173
126
 
174
- The [dragon head lighting experiment](../examples/dragon-head-study/README.md) uses the existing 2D tools for an original head, reflected green fire and two local revisions. It remains below the supplied artistic quality reference; code-only reproduction is verified separately from that verdict.
127
+ The [architecture decisions](decisions/001-runtime-and-renderer.md) retain historical
128
+ context. The [original proposal](https://github.com/Coly010/rtistree/blob/main/agentic-raster-graphics-architecture.md)
129
+ is not an API reference. See [contributing](https://github.com/Coly010/rtistree/blob/main/CONTRIBUTING.md)
130
+ for development setup and [releasing](releasing.md) for maintainer release instructions.
package/docs/evolution.md CHANGED
@@ -1,8 +1,10 @@
1
1
  # Editing and agent workflows
2
2
 
3
- ## Complete edits
3
+ ## Core edit commands
4
4
 
5
5
  `apply` is still a transaction containing `reason`, optional `expected_hash` and `commands`. The generated [command schema](../schemas/command.schema.json) is authoritative.
6
+ The table covers core edits; [print production and editing](production.md) lists the
7
+ additional document, path, crop, text and adjustment commands.
6
8
 
7
9
  | Area | Commands |
8
10
  | ---------------- | -------------------------------------------------------------------------------------------------------------------------- |
@@ -110,7 +112,7 @@ For visual critique, render and inspect the PNG, then submit:
110
112
  }
111
113
  ```
112
114
 
113
- `graphics critique scene.yaml critique.json` or the MCP `recordCritique` tool stores it. Stale scene/PNG hashes are rejected. `readCritique` returns only the current critique. A callback of type `VisualCritic` can perform this review in `runIterations`; use `requireCritique: true` to require it for success. Visual and rule scores inform stall detection; unresolved medium/high visual findings prevent a pass. The adapter is provider-neutral and requires the caller to supply the actual vision-capable reviewer. No synthetic review is substituted when one is absent.
115
+ `rtistree critique scene.yaml critique.json` or the MCP `recordCritique` tool stores it. Stale scene/PNG hashes are rejected. `readCritique` returns only the current critique. A callback of type `VisualCritic` can perform this review in `runIterations`; use `requireCritique: true` to require it for success. Visual and rule scores inform stall detection; unresolved medium/high visual findings prevent a pass. The adapter is provider-neutral and requires the caller to supply the actual vision-capable reviewer. No synthetic review is substituted when one is absent.
114
116
 
115
117
  ## Components and fonts
116
118
 
@@ -142,7 +144,7 @@ Components can live in included fragments. Instance children become `new-badge-p
142
144
  fonts:
143
145
  brand-display:
144
146
  source: fonts/BrandDisplay.otf
145
- hash: sha256:...
147
+ # Optional hash: sha256: followed by the font file’s 64 hex digest characters
146
148
  ```
147
149
 
148
150
  Choose `style.font: brand-display`. Fonts are registered under content-based aliases; changing a font file without updating its expected hash fails. History checks custom-font provenance, and exports copy font files. A custom file supplies one face; register a separate ID for another weight. Bundled names are reserved.
@@ -154,13 +156,13 @@ Layout supports `aspect_ratio`, positive `grow` weights and `layout.justify: sta
154
156
  After changing a source fragment or a component definition:
155
157
 
156
158
  ```sh
157
- graphics rebase scene.yaml
159
+ npx rtistree rebase scene.yaml
158
160
  ```
159
161
 
160
162
  This merges disjoint source and agent changes using the retained authoring baseline. Conflicts report paths such as `/layers/headline/style/colour` and leave history untouched. Resolve the conflicting source fields and retry, or export the working scene into a new project. Rebase is audited and undoable. Histories created before baseline retention require their original source to be restored and exported first.
161
163
 
162
164
  ```sh
163
- graphics compact scene.yaml
165
+ npx rtistree compact scene.yaml
164
166
  ```
165
167
 
166
168
  Compaction compresses full records into an immutable gzip archive with a content-hashed pointer, then starts an empty active log. Every undo/redo state remains accessible. It reduces storage; replay still reads all records. Missing/tampered archives fail closed. Do not delete archives referenced by the pointer.
@@ -170,10 +172,11 @@ Compaction compresses full records into an immutable gzip archive with a content
170
172
  `BenchmarkSession` requires visual review before each checkpoint. Briefs describe the objective and optional allowed region; the driver does not contain a solution or choose an edit.
171
173
 
172
174
  ```sh
173
- graphics benchmark scene.yaml brief.json before
175
+ # Render and record a current critique before the first checkpoint.
176
+ npx rtistree benchmark scene.yaml brief.json before
174
177
  # Inspect, critique, apply edits, then inspect and critique again.
175
- graphics benchmark scene.yaml brief.json after
176
- graphics benchmark scene.yaml brief.json finish
178
+ npx rtistree benchmark scene.yaml brief.json after
179
+ npx rtistree benchmark scene.yaml brief.json finish
177
180
  ```
178
181
 
179
- The report records actual edit/command counts, rule results, visual scores, locality, uncached equality and self-contained export equality. Token counts are nullable rather than guessed. The [recorded trials](../examples/agent-trials/results.json) were performed interactively by the assistant in this task, with self-authored briefs and same-agent visual critique. They establish a usable end-to-end workflow; broader held-out evaluation and independent human review remain future evidence to collect.
182
+ The report records actual edit/command counts, rule results, visual scores, locality, uncached equality and self-contained export equality. Token counts are nullable rather than guessed. The [recorded trials](https://github.com/Coly010/rtistree/blob/main/examples/agent-trials/results.json) were performed interactively by the assistant in this task, with self-authored briefs and same-agent visual critique. They establish a usable end-to-end workflow; broader held-out evaluation and independent human review remain future evidence to collect.
@@ -1,5 +1,8 @@
1
1
  # Make your first image
2
2
 
3
+ New to Rtistree? Read [Core concepts: an agent is the interface](core-concepts.md)
4
+ for how you, your agent and the engine work together.
5
+
3
6
  Create a small artwork, render it, change one part, and undo that change.
4
7
  You need **Node.js 22 or newer** and npm. No GPU or model API key is required.
5
8
 
@@ -17,19 +20,19 @@ If npm asks to install Rtistree for the first command, accept. `init` creates a
17
20
  It refuses existing paths, so choose a different name if `my-art` already exists.
18
21
 
19
22
  Open **hello.png** in the new directory. You should see a green disc and the text
20
- “Hello, Rtistree.” on a dark background. Rendering also writes an evidence JSON file.
23
+ “Hello, Rtistree.” on a dark background. Rendering also writes `hello.png.evidence.json`.
21
24
 
22
25
  The commands below run from inside `my-art` and use the locally installed package.
23
26
  The executable is `rtistree`; older installations used `graphics`, which remains an alias.
24
27
 
25
28
  ## Understand the starter
26
29
 
27
- | File | Purpose |
28
- | -------------- | ------------------------------------------------------ |
29
- | `scene.json` | Canvas, disc and title, each with an editable ID |
30
- | `refine.json` | A sample patch that brightens only the disc |
31
- | `render.mjs` | The same rendering workflow through the JavaScript SDK |
32
- | `package.json` | Pinned dependency and the `npm run render` script |
30
+ | File | Purpose |
31
+ | -------------- | ------------------------------------------------------- |
32
+ | `scene.json` | Canvas settings and disc/title layers with editable IDs |
33
+ | `refine.json` | A sample patch that brightens only the disc |
34
+ | `render.mjs` | The same rendering workflow through the JavaScript SDK |
35
+ | `package.json` | Pinned dependency and the `npm run render` script |
33
36
 
34
37
  `npm run render` runs `rtistree render scene.json -o hello.png`.
35
38
  To inspect the scene's layers and bounds:
@@ -86,7 +89,9 @@ npx rtistree export scene.json -o portable/scene.json
86
89
  npx rtistree render portable/scene.json -o portable.png
87
90
  ```
88
91
 
89
- The export includes referenced assets and fonts. Keep the exported directory together.
92
+ The export includes the current resolved scene, referenced assets, fonts and any baked
93
+ program recipes. It starts a new baseline: edit history, critiques and production-session
94
+ reviews are not copied. Keep the exported directory together.
90
95
 
91
96
  ## Use an agent
92
97
 
@@ -127,5 +132,7 @@ The SDK and CLI use the same engine. For an existing Node project, install with
127
132
 
128
133
  - [CLI reference](cli-reference.md) — inspect, edit, render and export commands.
129
134
  - [Scene format](scene-format.md) — layers, coordinates, assets and effects.
135
+ - [Pixel art, sprites and spritesheets](sprites.md) — indexed tiles, frame metadata,
136
+ deterministic atlases and animation review.
130
137
  - [Studio](studio.md) — trusted JavaScript painting programs and replayable recipes.
131
138
  - [Staged production](atelier.md) — compare candidates and record visual review.
@@ -1,4 +1,4 @@
1
- # Proposed next milestone: print documents and coherent projects
1
+ # Historical proposal: print documents and coherent projects
2
2
 
3
3
  Status: delivered as the v0.3 milestone. This document retains the original proposal; see [the production guide](production.md) and [ADR 004](decisions/004-print-production-and-projects.md) for the implemented scope, selected backends and explicit limits.
4
4
 
@@ -9,11 +9,11 @@ Status: delivered as the v0.3 milestone. This document retains the original prop
9
9
  3. Preserve text and vector geometry in PDF; add practical compositing, selection and path tools.
10
10
  4. Run a more demanding generated-asset integration trial, including subject extraction or seamless extension, and print the result through the new export pipeline.
11
11
 
12
- The first generated-asset fitting trial is already recorded in [the example](../examples/generated-asset-trial/README.md). It uses one built-in image-generation call followed by deterministic Rtistree composition. It establishes asset ingestion, aspect-preserving placement, editable surrounding content and exact preservation of the placed photograph. It does not establish seamless photographic outpainting, segmentation or print readiness.
12
+ The first generated-asset fitting trial is already recorded in [the example](https://github.com/Coly010/rtistree/blob/main/examples/generated-asset-trial/README.md). It uses one built-in image-generation call followed by deterministic Rtistree composition. It establishes asset ingestion, aspect-preserving placement, editable surrounding content and exact preservation of the placed photograph. It does not establish seamless photographic outpainting, segmentation or print readiness.
13
13
 
14
14
  ## Project creation
15
15
 
16
- Proposed syntax (not current commands):
16
+ Syntax proposed at the time (now implemented; use the current production guide):
17
17
 
18
18
  ```sh
19
19
  rtistree project new alpine --size A3 --orientation landscape --ppi 300 --bleed 3mm --output-dir output
@@ -32,7 +32,7 @@ Keep physical trim dimensions authoritative, independently of pixel dimensions.
32
32
 
33
33
  Record the PDF MediaBox, TrimBox and BleedBox correctly; actually render artwork into the bleed. Offer crop marks as an explicit option outside trim. Report effective ppi of placed source images and whether the requested output resamples them. The file can encode exact size, but downstream printer/viewer scaling remains outside the engine's control.
34
34
 
35
- The current schema caps canvas dimensions at 4,096 pixels and the renderer holds full-canvas layer surfaces. A3 at 300 ppi is about 4,961 by 3,508 pixels before bleed. Print therefore needs a bounded-memory strategy and expanded dimension support, not merely a new encoder or a higher schema limit. Tiled rendering must retain context for filters and match reference crops.
35
+ At the time of this proposal, the schema capped canvas dimensions at 4,096 pixels and the renderer held full-canvas layer surfaces. A3 at 300 ppi is about 4,961 by 3,508 pixels before bleed. Print therefore needs a bounded-memory strategy and expanded dimension support, not merely a new encoder or a higher schema limit. Tiled rendering must retain context for filters and match reference crops.
36
36
 
37
37
  ## Colour and formats
38
38
 
@@ -1,16 +1,22 @@
1
- # Projects, print production and editing in v0.3
1
+ # Projects, print production and editing
2
2
 
3
3
  ## Start a project
4
4
 
5
+ Run these commands from a directory where `npm install rtistree` has completed.
6
+ `project new` creates the artwork files and presets, not a Node package or dependency installation.
7
+
5
8
  ```sh
6
- rtistree project new alpine --size A3 --orientation landscape --ppi 300 --bleed 3mm --output-dir output
7
- rtistree render alpine --preset screen
8
- rtistree preflight alpine --preset print
9
+ npx rtistree project new alpine --size A3 --orientation landscape --ppi 300 --bleed 3mm --output-dir output
10
+ npx rtistree render alpine --preset screen
11
+ npx rtistree preflight alpine --preset screen
9
12
  ```
10
13
 
11
14
  `project new` accepts A3, A4, A5, Letter, or a custom pair such as `160x100` (mm) or `8.5inx11in`. It creates `rtistree.yaml`, a scene with layer fragments, assets/fonts/profiles/history directories, local JSON Schemas, a README and a designated output directory. The destination must be new. Existing scene-file commands remain available; opening a configured entry-point scene also discovers its project settings.
12
15
 
13
- Generated projects start with an sRGB screen preset and a CMYK print preset. Before using the print preset, copy your printer/paper ICC file into `profiles/` and set `presets.print.profile`. Set `profile_hash` to its SHA-256 digest to pin it. CMYK export rejects missing, invalid, changed or non-CMYK profiles. The demo profile is for exercising the pipeline, not a recommendation for a printing process.
16
+ Generated projects start with an sRGB screen preset and a CMYK print preset. Before using the print preset, copy your printer/paper ICC file into `profiles/` and set `presets.print.profile`. Set `profile_hash` to `sha256:` followed by its 64-character hexadecimal digest to pin it. CMYK export rejects missing, invalid, changed or non-CMYK profiles. The demo profile is for exercising the pipeline, not a recommendation for a printing process.
17
+ An unconfigured print preset fails preflight with exit code 2; the first example deliberately
18
+ uses the screen preset. After configuring a real profile, run `npx rtistree preflight alpine --preset print`
19
+ before the CMYK export and proof commands below.
14
20
 
15
21
  Project paths are local to the project root. CLI/MCP renders and artwork exports use `output_dir`; CLI verification and preflight reports use it too. History and critique records remain persistent project state. Explicit CLI `--output` paths override artifact destinations.
16
22
 
@@ -37,12 +43,12 @@ The renderer accepts edges up to 8,192 pixels. Print preflight also enforces a 3
37
43
  ## Formats and colour
38
44
 
39
45
  ```sh
40
- rtistree export alpine --preset print --format pdf
41
- rtistree export alpine --preset print --format tiff
42
- rtistree export alpine --preset screen --format jpeg
43
- rtistree export alpine --format svg -o alpine/output/artwork.svg
44
- rtistree proof alpine --preset print
45
- rtistree export alpine --format project -o /tmp/alpine-copy/scene.json
46
+ npx rtistree export alpine --preset print --format pdf
47
+ npx rtistree export alpine --preset print --format tiff
48
+ npx rtistree export alpine --preset screen --format jpeg
49
+ npx rtistree export alpine --format svg -o alpine/output/artwork.svg
50
+ npx rtistree proof alpine --preset print
51
+ npx rtistree export alpine --format project -o /tmp/alpine-copy/scene.json
46
52
  ```
47
53
 
48
54
  Known artwork extensions are inferred for `export` and full `render`. Region renders remain PNG. A filename extension must agree with the actual format. Portable scene export keeps its original meaning with `--format project` or a JSON/YAML destination, and copies configured print profiles/presets when exporting a project.
@@ -71,7 +77,7 @@ Preflight checks physical geometry, render capacity, output profiles, font glyph
71
77
 
72
78
  Each artwork export has a `.evidence.json` containing the scene hash, output hash, resolved settings, ICC hash, backend versions and inspection of the actual encoded bytes. Raster inspection reads format, dimensions, channels, profile and density. PDF inspection reads page boxes, image colour-space declarations, embedded font descriptors and profile streams. This complements visual proof inspection; it does not replace press validation.
73
79
 
74
- ## New editing operations
80
+ ## Editing operations
75
81
 
76
82
  Commands are available through `apply` in the CLI, SDK and MCP. See generated command/patch schemas for complete inputs.
77
83
 
@@ -93,15 +99,15 @@ Shapes support stroke caps, joins, dash arrays and dash offsets. Text styles sup
93
99
 
94
100
  Masks now support editable SVG-style paths, image alpha/luminance/colour-range selections, and union/intersection/subtraction/XOR. Combined masks use one coordinate space; children inherit the outer space and reference size. The processing order is selection/algebra, inversion, grow/shrink, then feathering. Image masks reference an asset directly, making external segmentation masks usable without a visible mask layer.
95
101
 
96
- New scoped operations are levels, piecewise-linear RGB/channel curves, white balance, clone and heal. Cloning samples a frozen copy of the target using `source_offset`. Healing adds a local mean-colour correction to that cloned texture; this is a deterministic colour-matched clone, not a Poisson or learned healing algorithm. All operate non-destructively through the existing history and scoped-pixel checks.
102
+ Additional scoped operations are levels, piecewise-linear RGB/channel curves, white balance, clone and heal. Cloning samples a frozen copy of the target using `source_offset`. Healing adds a local mean-colour correction to that cloned texture; this is a deterministic colour-matched clone, not a Poisson or learned healing algorithm. All operate non-destructively through the existing history and scoped-pixel checks.
97
103
 
98
104
  ## SVG interchange and trial
99
105
 
100
106
  ```sh
101
- rtistree import-svg drawing.svg -o drawing.scene.json
102
- rtistree export drawing.scene.json --format svg -o drawing.svg
107
+ npx rtistree import-svg drawing.svg -o drawing.scene.json
108
+ npx rtistree export drawing.scene.json --format svg -o drawing.svg
103
109
  ```
104
110
 
105
111
  The importer supports static paths, rectangles, circles, ellipses, lines, polygons, polylines, groups, transforms and basic stroke/fill styling. Unsupported elements/attributes, remote resources, scripts and entities are rejected rather than silently dropped. Text, filters and arbitrary CSS are not imported. Exported text is outlined; complex export fallbacks are embedded images. Full round-trip equivalence for arbitrary SVG is not promised.
106
112
 
107
- The [print trial](../examples/print-trial/README.md) generates a ceramic vase/leaf photograph, extracts its silhouette using the new masks, adds a contact shadow and colour adjustment, adapts it to two aspect ratios, and exports CMYK PDF/TIFF/JPEG. The source, exact prompt, edits, critiques, final scenes and output evidence are retained.
113
+ The [print trial](https://github.com/Coly010/rtistree/blob/main/examples/print-trial/README.md) used an external image-generation tool to create a ceramic vase/leaf photograph. Rtistree then extracted its silhouette with masks, added a contact shadow and colour adjustment, adapted it to two aspect ratios, and exported CMYK PDF/TIFF/JPEG. The source, exact prompt, edits, critiques, final scenes and output evidence are retained.