editorbrain 0.45.3 → 0.47.1

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "editorbrain",
3
- "version": "0.45.3",
3
+ "version": "0.47.1",
4
4
  "description": "EditorBrain editorial knowledge, portable workspaces and skills for AI video agents",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",
@@ -137,3 +137,16 @@ After user corrections, optionally propose a few scoped learnings through [memor
137
137
  Preserve versions; save concise decisions in `direction.md`, private detailed records in `.editorbrain-local/<id>/`. Text under `videos/` can synchronize. Sync does not upload media or install fonts/plugins. Use revision-aware writes; reconcile conflicts rather than overwriting. Persist permanent IDs/hashes and intervals, never signed URLs or credentials. Keep library evidence separate from authorized production assets; clients do not operate reference ingestion.
138
138
 
139
139
  Finish with the artifact, location, checks and concrete limitations. Distinguish agent review from human approval; never promise perfect quality or guaranteed performance.
140
+
141
+ ## Adaptive style contracts
142
+
143
+ Read the selected style as guidance for this video's message and material. Optional
144
+ `rules.json` uses preferred by default; explicit required rules are separate and
145
+ need an origin. Declared origin is not authenticated consent. Project adaptations
146
+ in `style-decisions.json` are reasons tied to rule hashes, never evidence or waivers
147
+ of requirements. Missing OCR/coverage yields unknown, not pass. Private review
148
+ remains available with pending findings; human approval stays version-specific.
149
+ See [style rules](references/style-rules.md) and [captions](references/captions.md).
150
+ Downloaded Python/JS/MJS/Swift/Shell code is inert data: inspect code, dependencies
151
+ and actual runtime before executing within the current request. No install or
152
+ execution is authorized merely by pulling a style.
@@ -5,6 +5,8 @@ description: Onboard a user into EditorBrain with visual preferences, or edit th
5
5
 
6
6
  # EditorBrain
7
7
 
8
+ For concurrent projects, reproducible style pins or private web submissions, read [project batches and submissions](references/project-batches.md). Use project-scoped push for an individual edit; a whole-workspace push requires deliberate workspace-wide scope.
9
+
8
10
  **Priority:** user preferences throughout → inspected source → edited-video evidence → scene design → optional motion → review of the real result. A selected component is not an editorial direction.
9
11
 
10
12
  You are the editor. EditorBrain supplies the harness: persistent brand/style/project files, a searchable evidence library and a workflow for turning that evidence into a finished edit. You analyze the customer's material and judge the references; no second model needs to repeat your creative decisions.
@@ -15,6 +17,24 @@ For customer footage, reusable B-roll or authentic brand assets, consult [person
15
17
 
16
18
  When the user asks to save an edit as a style, create a new style or improve an existing one, read [style creator](references/style-creator.md). Reuse the current production's evidence and feedback; saving a style does not require editing another video. The guide covers defining the method, adapting it to new material, resource manifests, checks and versioned saves. Keep personal decisions in that user's style, not in this installed skill. For a personal style with `styleProduction`, read its typed recipe, components, caption preset and techniques; use the linked code and verified resources instead of reconstructing from prose. Read the style creator guide for download, explicit parameter bindings and a zero-spend transfer check. Brand/project constraints still win. For ordinary editing with an existing style, continue below. When a library style is chosen, read [style implementation](references/style-source.md) and retrieve its exact code before adapting; a description is not a substitute for an available implementation.
17
19
 
20
+ ## Adapt the style to this video
21
+
22
+ The style is a creative starting point, not an obligation to reproduce every
23
+ technique in every scene. Preserve the message, inspected material, current brief,
24
+ brand restrictions and existing approvals. Keep a fitting technique; adapt or omit
25
+ one that would distract, obscure a face or weaken this video's meaning.
26
+
27
+ When supported, read `styles rules inspect --project ID` or
28
+ `get_project_style_policy`. Preferred rules are adaptable with a concise reason in
29
+ `videos/ID/style-decisions.json`, bound to the effective rule hash. Explicit required
30
+ rules remain separate; neither a reason nor a successful render waives them.
31
+ Read [style rules](references/style-rules.md) only when saving/checking these
32
+ contracts, and [caption presets](references/captions.md) when preparing subtitles.
33
+ A private sample with pending observations may still be submitted for feedback;
34
+ unknown evidence is never a pass or human approval. Do not turn every line of prose
35
+ into a required rule. Confirm an explicit requirement when the user's intent is
36
+ unclear; creative preferences need no repetitive permission gates.
37
+
18
38
  ## Start here, including a first installation
19
39
 
20
40
  For a new request, use [adaptive entry](references/starting-an-edit.md) to choose
@@ -0,0 +1,205 @@
1
+ # Captions declarativos: preparar, probar y exportar
2
+
3
+ Un preset es una **preferencia adaptable**, no una obligación de subtitular cada
4
+ video. Conserva la intención visual cuando encaje, adapta tamaño/posición y omite
5
+ el tratamiento si estorba al material. Las restricciones y la fuente de la marca,
6
+ el pedido del usuario y los captions desactivados del proyecto/output tienen
7
+ prioridad. Comprueba `editorbrain --help` en el CLI instalado antes de usar los
8
+ subcomandos nuevos.
9
+
10
+ `captions.json` v1 sigue siendo compatible: `phrase` (por defecto) o `karaoke`,
11
+ tamaños en píxeles de salida y cues explícitos. No cambies una versión v1 a v2
12
+ sin revisar el resultado. V2 añade agrupación y un renderer builtin identificado;
13
+ no carga módulos arbitrarios ni ejecuta scripts del estilo.
14
+
15
+ ## Preset v2 completo
16
+
17
+ Guardar en `.editorbrain/styles/adaptive/captions.json`, con el mismo `id` que el
18
+ estilo. También se puede crear desde un archivo nuevo con
19
+ `editorbrain styles captions create --style adaptive --file preset.json`.
20
+ La creación no sobrescribe un documento existente.
21
+
22
+ ```json
23
+ {
24
+ "schemaVersion": 2,
25
+ "id": "adaptive",
26
+ "renderer": "builtin-captions-v2",
27
+ "usage": "preferred",
28
+ "enabled": true,
29
+ "mode": "marker",
30
+ "referenceSize": {"width": 1080, "height": 1920},
31
+ "font": {
32
+ "family": "Example Sans",
33
+ "resourceId": "caption-font",
34
+ "weight": 600,
35
+ "size": 64,
36
+ "color": "#FFFFFF"
37
+ },
38
+ "activeBox": {"color": "#C97730", "padding": 12},
39
+ "position": {"x": 0.5, "y": 0.78},
40
+ "forbiddenZones": [],
41
+ "hideDuringCrossings": true,
42
+ "chunk": {
43
+ "maxWords": 4,
44
+ "punctuation": true,
45
+ "noEndWith": ["de", "la", "el", "y", "con", "para"]
46
+ },
47
+ "pop": {"durationSeconds": 0.16, "scale": 0.88},
48
+ "marker": {"scope": "word", "roughness": 0.6, "drawOnSeconds": 0.2, "seed": 42}
49
+ }
50
+ ```
51
+
52
+ Este ejemplo requiere declarar `caption-font` en `resources.json` como `kind:
53
+ "font"`, con los bytes reales de una fuente permitida y SHA-256 verificado.
54
+ `font.family` debe corresponder a la fuente elegida; no uses el nombre del ejemplo
55
+ como sustituto de la marca. Prepare incrusta WOFF/WOFF2/TTF/OTF, hasta 8 MiB. V2
56
+ habilitado falla si falta la fuente exacta; no recurre a una fuente del sistema.
57
+ Una fuente corrupta falla al cargar en el navegador. El hash no certifica licencia
58
+ ni cobertura de todos los glifos.
59
+
60
+ Campos y límites:
61
+
62
+ - `renderer`: exactamente `builtin-captions-v2`. Su comportamiento visual está
63
+ versionado; un cambio futuro necesita otra identidad de renderer.
64
+ - `usage`: opcional; sólo `preferred`, también el comportamiento por defecto.
65
+ - `mode`: `box` muestra una caja para todo el bloque; `karaoke` conserva la frase
66
+ y resalta la palabra activa; `marker` dibuja una banda irregular sólo bajo la
67
+ palabra activa por defecto, manteniendo visible la frase completa. En los huecos
68
+ temporales no hay resaltado.
69
+ - `referenceSize`: ancho/alto enteros 16–8192. `font.size` 8–300 y
70
+ `activeBox.padding` 0–100 son píxeles de esa referencia. Se escalan uniformemente
71
+ por el menor cociente entre salida y referencia; no deforman la tipografía.
72
+ - `font.weight`: entero 100–900; colores `#RRGGBB`. `resourceId` obligatorio en v2.
73
+ - `position`: centro del bloque en `x,y` normalizados 0–1.
74
+ `forbiddenZones`: hasta 20 rectángulos `{x,y,width,height}`, normalizados y
75
+ contenidos en el lienzo. Colisión/desbordamiento oculta el bloque; no lo recoloca.
76
+ - `chunk`: obligatorio; `maxWords` entero 1–30 es un límite firme;
77
+ `punctuation` corta tras `. ! ? … , : ;` (incluyendo cierres de comillas);
78
+ `noEndWith` admite hasta 100 palabras individuales de 1–80 caracteres.
79
+ Se compara sin distinguir mayúsculas y omitiendo puntuación periférica.
80
+ Evitar un final colgante es best effort: mueve la frontera hacia atrás si puede,
81
+ sin cambiar tiempos, perder palabras ni exceder `maxWords`. Si no puede, avisa.
82
+ - `pop`: opcional; duración explícita `>0..2` segundos y escala inicial `0.5..1.5`.
83
+ Interpola hasta 1 desde el inicio del cue; no depende de frames anteriores.
84
+ - `marker`: obligatorio sólo en modo marker; `scope` opcional `word|phrase`,
85
+ con `word` por defecto. Word exige tiempos medidos y reinicia el trazo en
86
+ `word.start`; `scope: phrase` es una elección explícita para marcar el bloque
87
+ completo, con inicio en `cue.start`, y no exige tiempos de palabras.
88
+ `roughness` 0–1, `drawOnSeconds` 0–2 (0 significa inmediato), `seed` entero
89
+ 0–4294967295. Los otros modos rechazan este campo. La semilla y el tiempo hacen
90
+ el dibujo reproducible incluso al buscar hacia atrás.
91
+ - `tokenBindings`: opcional, igual que v1; `{fontFamily:"typography.body",
92
+ color:"color.text",boxColor:"color.accent"}` usa claves semánticas resueltas.
93
+ Si la marca cambia la familia, actualiza conjuntamente la fuente declarada;
94
+ prepare rechaza la combinación de una familia nueva y los bytes anteriores.
95
+
96
+ Los campos no documentados se rechazan. No se admiten `module`, callbacks,
97
+ imports ni código dentro del preset. Las zonas y `crossing` son datos medidos del
98
+ video, no detección de caras ni una evaluación automática de encaje editorial.
99
+
100
+ ## Tiempos reales y agrupación
101
+
102
+ Para agrupar palabras medidas con v2:
103
+
104
+ ```json
105
+ {
106
+ "schemaVersion": 1,
107
+ "timeUnit": "seconds",
108
+ "timing": "measured",
109
+ "words": [
110
+ {"text": "Una", "start": 0.2, "end": 0.48},
111
+ {"text": "idea", "start": 0.5, "end": 0.85},
112
+ {"text": "clara.", "start": 0.88, "end": 1.3}
113
+ ]
114
+ }
115
+ ```
116
+
117
+ Cada token tiene tiempos absolutos en **segundos**, ordenados y sin solaparse;
118
+ duración positiva, fin máximo 86400, hasta 50000 palabras de 500 caracteres.
119
+ No pegues tiempos en milisegundos sin convertirlos ni uses offsets del texto como
120
+ tiempos. `timing: measured` declara la procedencia que verificó el agente; no
121
+ prueba por sí mismo que una transcripción sea correcta.
122
+
123
+ También se aceptan cues ya agrupados en v1/v2: `[{start,end,text,active?,crossing?,
124
+ words?:[{text,start,end}]}]`. No se reagrupan. Máximo 5000 cues, texto 1–500
125
+ caracteres, hasta 100 palabras por cue; las palabras reproducen el texto y sus
126
+ tiempos quedan dentro del cue. Karaoke y marker con scope word (el default)
127
+ requieren esas palabras medidas; prepare y el renderer rechazan cues sin ellas.
128
+ No se estiman. `active` controla la caja del modo phrase v1; en v2 box la caja acompaña
129
+ al bloque completo. Los huecos entre palabras no resaltan ninguna en karaoke ni en marker-word.
130
+
131
+ ```sh
132
+ editorbrain styles captions prepare --project demo --file words.json --out videos/demo/captions.html
133
+ ```
134
+
135
+ Con `--project` se aplican marca, output y estilo fijado del proyecto. Añadir
136
+ `--style otro` prueba ese estilo sin cambiar la selección ni el pin guardado del
137
+ proyecto; las restricciones de destino siguen aplicando. Sin proyecto,
138
+ `--style adaptive` usa 1080×1920 y avisa que no aplica preferencias de marca.
139
+
140
+ La salida es HTML transparente con fuente incrustada, no un video compuesto.
141
+ Expone `await window.editorbrainReady`, `await window.editorbrainSeek(seconds)`
142
+ y `await window.renderAt(seconds)`. El render no usa reloj de pared ni reproducción
143
+ acumulada. Compón la capa con el video y comprueba tamaño, glifos, safe areas,
144
+ rostro/footage y el tiempo real de cada palabra.
145
+
146
+ ## Preview explícito de tres segundos
147
+
148
+ ```sh
149
+ editorbrain styles captions preview --project demo --file words.json --out videos/demo/caption-preview.html --start 12 --duration 3
150
+ editorbrain styles captions preview --style adaptive --demo-text "Una idea clara" --out caption-demo.html --video-out caption-demo.mp4
151
+ ```
152
+
153
+ Usa **exactamente uno** de `--file` o `--demo-text`. Por defecto, la ventana empieza
154
+ en 0 y dura 3 segundos; `--duration` admite 0.25–15 segundos en frames completos
155
+ a 24 fps. `--start` usa segundos de la fuente. Elige una ventana representativa,
156
+ no necesariamente los primeros tres segundos.
157
+
158
+ El modo demo es explícito, sólo empieza en 0, distribuye tiempos sintéticos para
159
+ mostrar el tratamiento y los **etiqueta en la imagen y en el resultado**. No es
160
+ evidencia de transcripción ni material temporal válido para el edit final. Prepare
161
+ y export rechazan un envelope marcado `synthetic-demo`.
162
+
163
+ El comando guarda HTML y un `.manifest.json` vecino con `purpose: preview`, hashes
164
+ y la duración. `editorbrainSeek(0)` corresponde al `--start` de la fuente;
165
+ `renderAt(t)` mantiene segundos absolutos. No arranca un job cloud. El manifest
166
+ sirve para `render-cloud preflight --file ...` y el flujo explícito de render.
167
+
168
+ `--video-out` opta por un MP4 **local**: exige Playwright ya instalado en el
169
+ workspace, Chrome disponible y FFmpeg en PATH. `--browser-executable` permite
170
+ elegir el navegador local cuando se pide video. No instala herramientas, no
171
+ descarga scripts ni llama proveedores. Si falta tooling, conserva el HTML y
172
+ manifest y explica el error. El MP4 es silencioso, H.264/yuv420p sobre fondo
173
+ `#202020`, sin alpha; es una copia de inspección, no una entrega final. Todos los
174
+ outputs deben ser rutas relativas nuevas, sin symlinks ni sobrescritura.
175
+
176
+ `styles check` no renderiza previews ni interpreta la calidad visual.
177
+
178
+ ## Exportaciones SRT y ASS
179
+
180
+ ```sh
181
+ editorbrain styles captions export --project demo --file words.json --format srt --out videos/demo/captions.srt
182
+ editorbrain styles captions export --project demo --file words.json --format ass --out videos/demo/captions.ass
183
+ ```
184
+
185
+ Exportan la línea temporal original, sin el desplazamiento de una ventana preview.
186
+ Los captions desactivados producen cero cues. Los cues marcados `crossing` se
187
+ omiten si `hideDuringCrossings` está activo. Cada resultado trae warnings y
188
+ `rendererEquivalent: false`:
189
+
190
+ | Formato | Conserva | Límites explícitos |
191
+ |---|---|---|
192
+ | SRT | Texto y tiempos de cue redondeados a milisegundos | Omite fuente, color, posición, cajas, karaoke, pop y marker; escapa `&<>` y colapsa líneas vacías para impedir markup/cues inyectados. |
193
+ | ASS | Texto, tiempos en centésimas, fuente/tamaño/color y posición estáticos; caja aproximada en v2 box | No incrusta la fuente exacta; peso se reduce a normal/negrita; omite karaoke/highlight, active boxes v1, pop y marker/draw-on. Wrapping y shaping dependen del player. |
194
+
195
+ Ninguno reproduce la ocultación por zonas/desbordamiento calculada por el HTML.
196
+ ASS rechaza llaves, backslashes y controles en texto para no aceptar override
197
+ tags. Un cue que desapareciera por la precisión temporal del formato provoca
198
+ error; no se descarta silenciosamente. Conserva el JSON temporal y el HTML como
199
+ fuente de verdad visual. Inspecciona la exportación en el reproductor de destino;
200
+ un archivo ASS válido no certifica equivalencia del marcador.
201
+
202
+ Un proyecto con estilo fijado conserva su documento de captions y recursos por
203
+ hash. Cambiar un estilo compartido no actualiza ese proyecto automáticamente.
204
+ Una variación editorial específica del video debe adaptarse en el proyecto;
205
+ no reescribas el estilo compartido para forzar un resultado local.
@@ -106,7 +106,7 @@ Skill installation is offline and independent of login. CLI 0.19+ installs sibli
106
106
 
107
107
  Existing root `AGENTS.md`/`CLAUDE.md` are preserved. Read the install result's instruction paths and conflict reports. A preserved root guide does not mean the native skill failed; a conflicting existing skill needs a deliberate merge, not an overwrite. Do not replace the user's custom instructions to finish setup.
108
108
 
109
- For a separate local workspace, `editorbrain init --dir ./new-video --brand <id> --style <id> --project <id>` creates portable context and installs guidance. Do not initialize over a pulled workspace to reset it. `pull` prepares selected project documents. `push` uploads changed documents already present in the local folder, not the entire remote workspace. Keep unrelated projects in separate local folders and inspect `push --dry-run` before uploading. Neither command synchronizes installed native skill folders or local render media.
109
+ For a separate local workspace, `editorbrain init --dir ./new-video --brand <id> --style <id> --project <id>` creates portable context and installs guidance. Do not initialize over a pulled workspace to reset it. `pull` prepares selected project documents. `push` uploads changed documents already present in the local folder, not the entire remote workspace. In shared folders use `push --project ID --dry-run` then `push --project ID` to exclude unrelated projects, brands and shared styles. Read [project batches](project-batches.md) for style pins and concurrent writers. A deliberate whole-workspace push remains available. Neither command synchronizes installed native skill folders or local render media.
110
110
 
111
111
  `setup --project <id>` prepares only that project's immediate brand/style/output
112
112
  context. With multiple projects and no remembered selection it reports
@@ -201,7 +201,7 @@ Save through local portable documents plus `push`, or MCP `write_document` with
201
201
  ```sh
202
202
  editorbrain validate --dir ./my-videos
203
203
  editorbrain resolve <project-id> --dir ./my-videos
204
- editorbrain push --dir ./my-videos
204
+ editorbrain push --project my-project --dir ./my-videos
205
205
  ```
206
206
 
207
207
  `push` is not a media upload. Use `assets upload <file>` for authorized production files within current limits and then record returned IDs/hashes. Keep large renders/evidence in the appropriate media store, with permanent identifiers in the project. Preserve old revisions and disclose unsynchronized local work if saving fails.
@@ -55,7 +55,9 @@ use the local artifact below, with no cloud upload. If web/cloud review wins, fo
55
55
  and deliver a verified private web player; localhost alone does not satisfy it.
56
56
  A local approval is not a registered web approval; do not invent server progress.
57
57
 
58
- For web review, reuse existing exact bytes/revisions. Upload through `assets upload`,
58
+ For an authorized web review, prefer `production submit --project ID --file relative.mp4 --title TEXT` when installed. Read [recoverable submissions](project-batches.md): one command prepares a checked review copy, uploads it, and links the output privately without changing editorial media. Use `--parent UUID` for a correction, or `--parent latest` only when there is one active leaf; ambiguity requires choosing the intended UUID. Omit parent for A/B alternatives. Never migrate or reinterpret historical approvals.
59
+
60
+ The following manual path remains compatible with older clients and supports explicit transcript registration. For web review, reuse existing exact bytes/revisions. Upload through `assets upload`,
59
61
  link the returned assets in `videos/ID/media.json`, then check workflow again because
60
62
  these documents affect the context. Register privately:
61
63
 
@@ -0,0 +1,110 @@
1
+ # Independent projects and recoverable review submissions
2
+
3
+ Check installed help and the connected API/tools first. These commands require a
4
+ matching release; installing guidance alone does not update a server. A 404 is
5
+ not permission to invent a route or fall back to a whole-workspace push.
6
+
7
+ ## Several agents in one workspace
8
+
9
+ Each edit owns its `videos/ID/` and `.editorbrain-local/ID/` directories. Use
10
+ `editorbrain push --project ID --dry-run`, then `push --project ID` after validating
11
+ the intended files. This excludes every other project, brand and shared style.
12
+ Publish changes to shared brand/style documents deliberately as separate work;
13
+ the scoped push does not silently publish dependencies. Continue honoring batch
14
+ assignments and workflow review mode; a filesystem lock does not grant a turn.
15
+
16
+ `projects create` also writes the remote baseline locally. If local files already
17
+ differ, it reports partial materialization and preserves them. Reconcile the
18
+ returned files/revisions; do not delete a workspace or force a global push.
19
+
20
+ Before parallel production with a selected personal style, use
21
+ `projects pin-style --project ID --dry-run`, inspect its documents, then
22
+ `projects pin-style --project ID`. This freezes present AND absent style
23
+ documents by content hash. It does not freeze the brand or project directions.
24
+ Changing a pin is an explicit editorial update, not a way to revive an approval.
25
+ New shared-style revisions do not change already pinned projects. Existing
26
+ unpinned projects retain their prior behavior; never silently migrate them.
27
+
28
+ `pull --project ID` hydrates the verified pin into
29
+ `videos/ID/style-snapshots/STYLE/DIGEST/`. These are immutable local caches, never
30
+ uploaded by push and never substituted with latest when history is unavailable.
31
+ Referenced resources still require their exact hashes and authorized asset IDs;
32
+ a pin alone does not download missing media. Raw history is restricted for scoped
33
+ teammates: use `resolve_project`/`check_workflow` for their permitted context, not
34
+ another member's credential or raw document-history calls.
35
+
36
+ ## One private review submission
37
+
38
+ Only use cloud review when the user's request or saved preference permits it.
39
+ Keep local review local when selected. For an actual rendered MP4 inside the
40
+ workspace:
41
+
42
+ ```sh
43
+ editorbrain production submit --project ID --file .editorbrain-local/ID/final.mp4 --title "Muestra A"
44
+ editorbrain production submit --project ID --file .editorbrain-local/ID/revised.mp4 --title "Corrección" --parent REVISION_UUID --notes "Ajusté el título; conservé la voz y las demás escenas."
45
+ ```
46
+
47
+ The CLI synchronizes only this project's documents, checks the upload policy,
48
+ prepares/verifies a review copy (720 by default, `--quality 480` optional), uploads
49
+ by hash, and registers it privately. It never approves, creates a public link,
50
+ renders the original scene, or spends creative/render credits. Storage quota and
51
+ upload permission still apply. Do not use `review create` as an equivalent: that
52
+ command creates a share link.
53
+
54
+ Review outputs are linked by their revision, separately from editorial inputs.
55
+ Submitting another A/B output therefore does not alter `media.json`, change the
56
+ project's editorial context or stale sibling samples. Existing legacy samples
57
+ keep their original media-manifest link/unlink behavior.
58
+
59
+ Use `--parent` for a correction: the prior pending sample is marked superseded.
60
+ Its comments remain unresolved until addressed through the existing feedback
61
+ workflow. An approved parent's history is preserved and approval never transfers
62
+ to a child. For independent A/B alternatives omit the parent. The web defaults to
63
+ active samples and retains a separate historical view.
64
+
65
+ Receipts live in `.editorbrain-local/ID/submissions/`. Repeat the EXACT command
66
+ after a connection failure: the source hash, title, quality, notes and parent
67
+ select the same receipt. Do not change the title or invent another UUID to retry.
68
+ The CLI reconciles uncertain uploads/registration before writing again. If it
69
+ returns `partial`/`recovery_required`, preserve the receipt and inspect its issue;
70
+ `WORKSPACE_BUSY` can be retried once the current writer finishes. A content
71
+ conflict requires reconciliation, never replacing another agent's files.
72
+
73
+ MCP/REST use the same contract:
74
+
75
+ 1. `plan_production_submission` / GET `/v1/projects/ID/production-submissions/plan`.
76
+ 2. Reuse or upload an authorized asset; retain the plan context/media revision.
77
+ 3. `submit_production_review` / POST the same collection with a stable
78
+ `submissionId`, `assetId`, `contextVersion`, `expectedMediaRevision`, title,
79
+ optional notes/parent and `supersedeParent`.
80
+ 4. After an uncertain response, `get_production_submission` / GET
81
+ `/v1/projects/ID/production-submissions/UUID`. Preserve the UUID.
82
+
83
+ The response records exact bytes and availability, not human playback approval.
84
+ Read `staleReasons` when a sample is obsolete. Updating a shared style, changing
85
+ the brief and changing review preferences have different remedies. Re-registering
86
+ an asset does not prove it implements new instructions; inspect it first. Never
87
+ copy an old approval to a new context.
88
+
89
+ ## Milestones and diagnostics
90
+
91
+ Use the hash returned by `resume` as `checkpoint --expected-checkpoint HASH` to protect work based on that earlier session. `--expected-checkpoint current` reads the hash at this command's start and checks it again inside the lock; it protects only concurrent writes during this invocation, not decisions based on an older read. The response names this distinction. `PROJECT_LINK_STALE` supplies exact local relinking argv/command: verify identity and paths first; never silently relink across accounts or brands. Brief search accepts at most two eventQueries per request; split purposeful follow-ups rather than dropping a query.
92
+
93
+ ## Latest correction and changed context
94
+
95
+ `production submit --parent latest` selects the single active leaf after reading
96
+ the entire review graph. A/B ambiguity or incomplete pagination stops before
97
+ uploads; pick an explicit UUID. The receipt freezes the resolved UUID: retry the
98
+ exact command without selecting latest again. This is not a global queue lock;
99
+ concurrent children of an approved revision remain valid independent alternatives.
100
+ Approval is never transferred or silently re-anchored.
101
+
102
+ `workflow check --project ID --previous-context resolved.json` (or a saved
103
+ project.lock.json) submits prior source hashes for actionable `contextChanges`.
104
+ MCP uses `previousSourceHashes`, bounded to 256. Only currently authorized paths
105
+ are reported; unavailable previous paths are counted without disclosure. Missing
106
+ comparison evidence is `comparison_unavailable`, not proof that nothing changed.
107
+ `mediaAcquisition.state=guidance` is nonblocking planning context, not a pending
108
+ job; registered assets in `mediaProgress` do not prove inspection or visible use.
109
+ `resume ID` and `resume --project ID` are equivalent; resumed reviews preserve
110
+ `staleReasons`, superseded status and `needsReview`.
@@ -94,7 +94,7 @@ editorbrain styles test build-journal --project episode-two
94
94
 
95
95
  `create --from-project` without an ID chooses `<project>-style`. It scans `videos/<id>/` and `.editorbrain-local/<id>/`, including nested production folders and `direction.md`/`review.md`, plus safe declared dependencies for that project: direction/review, renders, recognized receipts/manifests, measured beat intervals. It saves candidate resources with hashes, pilot evidence and sanitized prompt examples, not an inferred finished recipe. It never switches the project or changes brand preferences. Audit the candidate list before uploading; dynamic imports and receipt formats the CLI does not understand remain explicit gaps. Capture is bounded to 2,000 entries/depth 8, 200 unique portable resources, 90 MiB/file and 512 MiB portable bytes. Scene dependencies come first; hashes deduplicate copies. Vendor/QA/source frames/copied scenes do not fill the budget unless explicitly referenced. Final exports under renders/exports/out-styles are streamed as hash-only examples with a separate 2 GiB budget and explicit warnings. They are never uploaded. If several reviewed scenes exist, choose --scene <workspace-relative scene.html>; never silently combine discarded versions. Receipts are recognized by content. Prompt examples require a resolvable output used by the selected scene (including image anchors of used generated clips); nested plans/arrays work. Unlinked or conflicting prompts are omitted with warnings. Paths and hashes do not certify creative approval or a complete dynamic dependency graph.
96
96
 
97
- Selected `styles push` touches only that style's flat text documents. `--with-resources` uploads supported media, SVG/HTML/JS/MJS/JSON and fonts through private workspace assets, verifies downloaded hashes **before** pushing documents, and rewrites local resources to permanent IDs. Inspect `--dry-run` and the local manifest first; code/assets are private but may include customer material. Do not upload unauthorized files or credentials. Generic push reports a local-only dependency warning. Pull verifies bytes into `production-assets/styles/<id>/<hash>.<ext>`, preserves local edits, and keeps portable asset IDs. Interrupted multi-file saves can leave verified assets or some committed document revisions: inspect state and retry, never force overwrite. Restricted team editors cannot modify shared styles; their downloads are limited to styles selected by assigned editable projects.
97
+ Selected `styles push` touches only that style's flat text documents. `--with-resources` uploads supported media, SVG/HTML/JS/MJS/Python/Swift/Shell/JSON and fonts through private workspace assets, verifies downloaded hashes **before** pushing documents, and rewrites local resources to permanent IDs. Inspect `--dry-run` and the local manifest first; code/assets are private but may include customer material. Do not upload unauthorized files or credentials. Generic push reports a local-only dependency warning. Pull verifies bytes into `production-assets/styles/<id>/<hash>.<ext>`, preserves local edits, and keeps portable asset IDs. Interrupted multi-file saves can leave verified assets or some committed document revisions: inspect state and retry, never force overwrite. Restricted team editors cannot modify shared styles; their downloads are limited to styles selected by assigned editable projects.
98
98
 
99
99
  ### Code-backed components
100
100
 
@@ -140,3 +140,20 @@ Caption presets accept mode: phrase|karaoke (default phrase). Karaoke cues must
140
140
  Without --project, captions prepare --style <id> creates a standalone 1080×1920 preset preview, with an explicit warning that no brand/project preferences apply. For a final edit always resolve with --project.
141
141
 
142
142
  Scene-prioritized capture with hash deduplication, linked prompt selection, grouped skipped upload types and active-word karaoke require CLI 0.43.0+. Inspect installed command help before relying on them.
143
+
144
+ ## Portable code and explicit exclusions
145
+
146
+ Personal components accept HTML or JavaScript modules (`.js`/`.mjs`). Extraction records `sourceFormat`, explicit literal bindings and verified declared dependencies; preparation never runs code or infers timings hidden in source. A module stays a module, not an HTML wrapper. Inspect and explicitly execute with the appropriate renderer only within the editing task.
147
+
148
+ `styles push --with-resources` accepts Python, Swift and Shell as inert, hash-verified octet-stream code alongside JS/MJS. Downloads are private non-executable files. Literal credentials/host paths and unsafe traversal are rejected without printing secrets; moving code is not authorization to run it. Swift and Shell also travel as inert files; declare runtime/dependencies explicitly. These tools are not portable merely because their source arrived. `--ignore-resource ID` is repeatable and skips transport explicitly, preserving the resource manifest and required flag. It does not make an incomplete style portable.
149
+
150
+ A pinned project uses its frozen captions, recipes and components. Update the project pin explicitly only when the new style is intended for that edit; never overwrite the shared style to repair one project.
151
+
152
+ ### Optional adaptive rules and caption v2
153
+
154
+ Read [style rules](style-rules.md) for optional rules.json and project adaptation
155
+ records. Do not infer required from a preferred look: choose techniques for the
156
+ actual video. `styles check` validates structure only; it never renders, runs OCR
157
+ or certifies a final video. [Captions](captions.md) defines the backward-compatible
158
+ v2 marker/box/karaoke renderer, explicit local preview and lossy SRT/ASS export.
159
+ Inspect a source module before execution; transport does not install dependencies.
@@ -0,0 +1,134 @@
1
+ # Adaptive style rules and local evidence
2
+
3
+ Read when a style has `rules.json`, when adapting its preferences for a project,
4
+ or when checking its rendered output. A style is creative guidance by default.
5
+ Do not turn every reference observation into a mandatory rule.
6
+
7
+ ## Inspect, adapt, then check
8
+
9
+ ```sh
10
+ editorbrain styles rules inspect --project VIDEO_ID
11
+ editorbrain styles rules create --style STYLE_ID --file rules.json
12
+ editorbrain styles rules decisions --project VIDEO_ID --file decisions.json
13
+ editorbrain production verify --project VIDEO_ID --file final.mp4
14
+ editorbrain production verify --project VIDEO_ID --file final.mp4 --ocr --ocr-language eng+spa
15
+ ```
16
+
17
+ Inspect returns the effective style, including the project's pin, rule hashes and
18
+ recorded project decisions. `create` writes a new rules document without replacing
19
+ an existing file. `styles check` validates document structure; it does not render,
20
+ recognize text or approve the video. `production verify` reads the effective
21
+ project rules, not an arbitrary style override.
22
+
23
+ OCR is explicit and local. Install Tesseract and the selected language data
24
+ separately if needed; the command does not install tools or contact a provider.
25
+ Without `--ocr`, or when Tesseract is absent, text evidence remains unknown.
26
+ Neither rules, tool availability nor saved preferences authorize generation,
27
+ GPU rental, purchases or paid API calls.
28
+
29
+ ## Portable rules schema
30
+
31
+ Save `.editorbrain/styles/<style-id>/rules.json`. `id` matches the style ID.
32
+ The document has `schemaVersion:1`, `id` and `rules` only. There are at most
33
+ 64 rules in a document of at most 64 KiB. Every rule has a unique portable `id`
34
+ and a `check` from the fixed catalogue below. Unknown fields, executable modules
35
+ and user-supplied regular expressions are rejected.
36
+
37
+ `strength` defaults to `preferred`. A preferred failure or unknown observation is
38
+ an adaptable warning. Explicit `required` needs `origin:{kind,reference}`;
39
+ `kind` is `user`, `brand` or `style`, and `reference` documents why it is required.
40
+ This is declared provenance, not authentication of a human instruction or a grant
41
+ of permission. Preserve the user's actual constraints and creative choices.
42
+
43
+ | Check | Parameters | Evidence and limits |
44
+ |---|---|---|
45
+ | `frame.content` | `timeSeconds` defaults to `0`; `content` is a nonempty unique array of `image`, `text`; optional `text` requires text content. | Decodes the first frame at/after the requested output time and records actual PTS. High-confidence OCR can establish text presence at that frame. Pixel variation does not establish image semantics: image presence remains unknown. |
46
+ | `text.forbidden` | `phrases`: 1–32 literal phrases; `caseSensitive` defaults to `false`. | Matching uses Unicode NFKC, whitespace normalization and optional case folding, not regex. A high-confidence OCR match fails the check with a linked thumbnail. No match in sampled frames remains unknown; it does not prove absence across the video. |
47
+ | `layout.safeZone` | `insets:{top,right,bottom,left}` as fractions in `[0,1)` with positive remaining area; optional `text` selects 1–32 exact OCR word sequences. | OCR boxes crossing the zone produce a finding. OCR boxes approximate text, and sparse samples cannot certify every frame or logo. Supplied geometry is checked as declared geometry and cannot by itself produce a visible-ink pass. |
48
+ | `audio.loudness` | `target:{targetIntegratedLufs,toleranceLu,maxTruePeakDbtp}`. | Full decode of every final audio stream, after codec effects. Every stream must meet the explicit target. Missing/non-finite/incomplete measurements remain unknown. No universal loudness target is inferred. |
49
+ | `manual` | `instruction`: nonempty text up to 1,000 characters. | Remains unknown until separate review; the checker does not invent completion. |
50
+
51
+ Phrases are at most 300 characters. Frame times are finite output seconds from
52
+ 0 through 86,400; a frame outside the actual artifact cannot be verified.
53
+ An introductory example, with only preferences:
54
+
55
+ ```json
56
+ {
57
+ "schemaVersion": 1,
58
+ "id": "notebook",
59
+ "rules": [
60
+ { "id": "opening", "check": "frame.content", "content": ["image", "text"] },
61
+ { "id": "draft-text", "check": "text.forbidden", "phrases": ["PLACEHOLDER", "Lorem ipsum"] },
62
+ { "id": "safe-text", "check": "layout.safeZone", "insets": { "top": 0.08, "right": 0.15, "bottom": 0.25, "left": 0.05 } },
63
+ { "id": "readability", "check": "manual", "instruction": "Read the opening at delivery size and inspect its hold duration." }
64
+ ]
65
+ }
66
+ ```
67
+
68
+ Those insets are an example, not a platform guarantee. A deliberately required
69
+ rule adds both fields, for example:
70
+
71
+ ```json
72
+ {
73
+ "id": "delivery-mix",
74
+ "check": "audio.loudness",
75
+ "strength": "required",
76
+ "origin": { "kind": "user", "reference": "The delivery brief explicitly specifies this mix target." },
77
+ "target": { "targetIntegratedLufs": -16, "toleranceLu": 1, "maxTruePeakDbtp": -2 }
78
+ }
79
+ ```
80
+
81
+ The numbers are illustrative. Use the target actually requested for the project.
82
+
83
+ ## Per-project adaptations
84
+
85
+ Save choices in `videos/<project-id>/style-decisions.json`, not by changing a
86
+ shared style. The strict shape is `schemaVersion:1`, `projectId`, and `decisions`,
87
+ with at most 64 unique rule decisions. Each decision has `ruleId`, `ruleSha256`,
88
+ `action` (`adapt` or `omit`) and a nonempty `reason` up to 1,000 characters.
89
+
90
+ Copy the current `ruleSha256` from `styles rules inspect`. The hash is SHA-256 of
91
+ `stableJson` of the **validated, default-expanded rule**: recursively sorted
92
+ object keys, two-space indentation and one trailing newline. It is not a hash of
93
+ the original raw JSON text. `rulesSha256` likewise hashes the validated document;
94
+ the project context separately tracks source-file hashes.
95
+
96
+ `styles rules decisions` refuses stale/absent rules and attempts to waive a
97
+ required rule. It creates a decisions file only when absent. Policy inspect returns the current raw `decisionsSha256` (null when absent). To update one,
98
+ first inspect its current contents and pass `--expected-version` with its current
99
+ file SHA-256. An applied decision is an annotation: it does not change a failed
100
+ check into a pass, hide the finding or grant approval. A changed rule hash makes
101
+ the prior decision stale. Sync only the intended project with `push --project`.
102
+
103
+ ## Interpret the report
104
+
105
+ Each rule reports `pass`, `fail`, `unknown` or `not_applicable`, method, coverage,
106
+ reason, rule hash and available timestamp/thumbnail evidence. The report binds
107
+ the artifact hash, validated rules hash and context hash, and rechecks artifact
108
+ stability at the end. A hash establishes byte identity, not factual truth or
109
+ human review. Changed artifact/context requires a new check.
110
+
111
+ `readiness.requiredReady` is false for any required failure or unknown.
112
+ `requiredRuleEvidenceSatisfied` in production verification additionally requires
113
+ its technical checks to pass. Preferred failures/unknowns remain warnings and
114
+ never become blockers merely because a style contains them. These fields describe
115
+ local evidence; they are not server attestation, creative approval or permission
116
+ to publish. Human review remains separate. Private review samples stay allowed
117
+ when findings need feedback or correction.
118
+
119
+ Visual checks select up to 12 frames (normally opening, midpoint and near end,
120
+ plus requested rule times), with a 120-second sampling budget. PNG evidence is
121
+ bounded to 1,920 pixels per side. Each Tesseract call has a 15-second deadline
122
+ and a 1-MiB output cap; parsing permits at most 512 words per frame, each up to
123
+ 128 characters, and only confidence at least 80 participates in findings.
124
+ Up to three language codes can be selected. Missing tools, unsupported color or
125
+ display transforms, parse errors and limits do not create synthetic observations.
126
+ Full audio decode uses the existing bounded FFmpeg audio check.
127
+
128
+ Inspect recognition failures against their thumbnails. OCR can omit stylized,
129
+ small, moving or occluded text; its boxes are not exact rendered ink. Geometry
130
+ annotations and hypothetical `EB.mark()` declarations are self-reported and do
131
+ not prove visibility. This release does not implement an `EB.mark()` runtime or
132
+ semantic image detector. Reports and thumbnails stay in `.editorbrain-local/`;
133
+ the full report preserves evidence omitted from compact CLI summaries, with an
134
+ explicit count when repetitive forbidden-text evidence is bounded.
@@ -54,7 +54,7 @@ videos/<project-id>/
54
54
 
55
55
  The native skill folders are local instructions, not portable documents synchronized by `push`. Local media/render folders are not media uploads. `.editorbrain/.sync.json` is CLI-managed sync state; do not edit it to bypass conflicts. An older valid workspace may omit the optional files and local production directories.
56
56
 
57
- The resolver requires the selected brand's `brand.md`, `tokens.json`, `language.json`, `assets.json`; the selected style's `style.md`, `style.json`, `examples.json`; the selected output profile; and the project's `project.json`, `brief.md`, `direction.md`. Preserve them even when a declaration is empty. Scoped `preferences.json` files and the selected style's optional `resources.json` are resolver inputs with pinned hashes; only confirmed memory entries are returned as active memory. The four optional typed style files above are selected resolver inputs returned in `styleProduction`; their hashes participate in context/version checks. Downloaded asset bytes live in `production-assets/styles/<id>/`, outside text sync. The resource manifest describes dependencies, not proof they are installed or remotely accessible. Additional guidance such as a series playbook, QA checklist, `adaptation-rules.json`, library indexes or legacy memory may be present: discover/read it explicitly when relevant. It is not automatically included in `resolve` merely because it exists.
57
+ The resolver requires the selected brand's `brand.md`, `tokens.json`, `language.json`, `assets.json`; the selected style's `style.md`, `style.json`, `examples.json`; the selected output profile; and the project's `project.json`, `brief.md`, `direction.md`. Preserve them even when a declaration is empty. Scoped `preferences.json` files and the selected style's optional `resources.json` are resolver inputs with pinned hashes; only confirmed memory entries are returned as active memory. The optional typed style files above are selected resolver inputs returned in `styleProduction`; their hashes participate in context/version checks. Downloaded asset bytes live in `production-assets/styles/<id>/`, outside text sync. The resource manifest describes dependencies, not proof they are installed or remotely accessible. Additional guidance such as a series playbook, QA checklist, `adaptation-rules.json`, library indexes or legacy memory may be present: discover/read it explicitly when relevant. It is not automatically included in `resolve` merely because it exists.
58
58
 
59
59
  ## Brand, style and project exceptions
60
60
 
@@ -268,3 +268,10 @@ Optional `project.json.memoryContext` (`formatId`, `seriesId`, `mode:use|fresh`)
268
268
  selects conditional editorial memories. It does not change permissions or required
269
269
  branding. See [memory and review](memory-and-review.md); do not assign a format just
270
270
  to activate a remembered aesthetic.
271
+
272
+ Optional `.editorbrain/styles/<id>/rules.json` enters `styleProduction.rules`;
273
+ `videos/<id>/style-decisions.json` enters `styleDecisions` with the same project ID.
274
+ Both participate in hashes. Pin schema 1 retains its original eleven documents;
275
+ schema 2 additionally freezes rules.json. Old pins do not inherit new shared rules.
276
+ Caption document schema 2 is accepted only for captions.json; other contracts keep
277
+ their own schema validation. See [rules](style-rules.md) and [captions](captions.md).