From c5c87e2cfb14181ae7c3156d3cd42b64eb9da676 Mon Sep 17 00:00:00 2001 From: shane Date: Thu, 3 Dec 2026 17:50:07 -0800 Subject: [PATCH] raea guide brief: brief.ts's types and an example, and a cut's beats typed as they are (#321) Dutch's plan turn (12-03) spent about 2 minutes looking for raea/brief's types: raea guide brief had no guide, so it read sdk/raea/src under /opt/raea. And what it found was wrong: brief-goal.gen.ts imported the screenplay's Beat (onScreen, lines, cues) for a cut's beats, while cut.rs's own Beat (at, feel, story, asl, tempo, MK48) is what raea reads and validates. tsc refused a correct cut beat and accepted a wrong one. - core/brief: a cut's beat is CutBeat in TypeScript and declared in brief-goal.gen.ts (regenerated); montage.ts uses it. - sdk/guides/craft/motion/brief.md: the Brief fields, a cut goal's contract, rules and who judges a says rule (raea, never the agent), and a fictional example that type-checks against the SDK; the router points to it. Co-authored-by: shinyobjectz --- core/brief/src/cut.rs | 2 +- core/brief/src/lib.rs | 6 +- sdk/goal/src/packs/montage.ts | 2 +- sdk/guides/craft/ROUTER.md | 3 +- sdk/guides/craft/motion/brief.md | 126 +++++++++++++++++++++++++++++++ sdk/raea/src/brief-goal.gen.ts | 25 +++++- 6 files changed, 156 insertions(+), 8 deletions(-) create mode 100644 sdk/guides/craft/motion/brief.md diff --git a/core/brief/src/cut.rs b/core/brief/src/cut.rs index 000ee4bf..2c659d92 100644 --- a/core/brief/src/cut.rs +++ b/core/brief/src/cut.rs @@ -83,7 +83,7 @@ pub struct CutPlan { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] #[serde(rename_all = "camelCase", deny_unknown_fields)] #[ts(optional_fields)] -#[ts(rename = "Beat")] +#[ts(rename = "CutBeat")] pub struct Beat { /// where it starts, in seconds from the cut's start (0 for the first) pub at: f64, diff --git a/core/brief/src/lib.rs b/core/brief/src/lib.rs index 21034c9c..de97651c 100644 --- a/core/brief/src/lib.rs +++ b/core/brief/src/lib.rs @@ -54,11 +54,11 @@ pub fn declarations() -> String { /// The goal's declarations (what the work is held to: goal.rs, cut.rs, playable.rs, rules.rs): sdk/raea/src/brief-goal.gen.ts pub fn goal_declarations() -> String { let cfg = Config::new(); - // a cut's beats are a script's (script.rs Beat) - let mut out = vec!["// Generated from raea-core-brief (core/brief) by its `goal_declarations`; edit the Rust, not this.\nimport type { Beat } from \"./brief.gen\";".to_string()]; + // a cut's beats are its own (cut.rs Beat, CutBeat in TypeScript: feel, story, asl, tempo), not a script's + let mut out = vec!["// Generated from raea-core-brief (core/brief) by its `goal_declarations`; edit the Rust, not this.".to_string()]; out.extend(decls!(cfg; goal::Goal, goal::Kind, goal::Source, goal::DialValue, goal::Dial, goal::Route, goal::Origin, goal::Pick, goal::Object, goal::Shot, goal::Goals, - cut::Cut, cut::Quoted, cut::CutPlan, cut::Phrase, cut::Cta, cut::Open, + cut::Cut, cut::Quoted, cut::CutPlan, cut::Beat, cut::Phrase, cut::Cta, cut::Open, playable::Playable, playable::Orientation, rules::Rule, )); diff --git a/sdk/goal/src/packs/montage.ts b/sdk/goal/src/packs/montage.ts index 7571b66c..f47d8426 100644 --- a/sdk/goal/src/packs/montage.ts +++ b/sdk/goal/src/packs/montage.ts @@ -17,7 +17,7 @@ import { mkdtempSync, readFileSync, rmSync, statSync, writeFileSync } from "node import { tmpdir } from "node:os" import path from "node:path" import { check, found } from "raea/check" -import type { Beat } from "raea/brief.gen" +import type { CutBeat as Beat } from "raea/brief.gen" import type { FileFacts } from "../facts.ts" import { type Faces, Unmet } from "../media.ts" import { cutOf } from "./cut.ts" diff --git a/sdk/guides/craft/ROUTER.md b/sdk/guides/craft/ROUTER.md index 846a8b6a..12b79927 100644 --- a/sdk/guides/craft/ROUTER.md +++ b/sdk/guides/craft/ROUTER.md @@ -20,7 +20,8 @@ Run `raea context PROJECT` before anything else and read all of it. It prints, i every project. A line there beats any guide. 2. **The brief** (`brief.ts`): who it's for (`audience`), the one thing they should think afterwards (`believe`), what kind of piece it is (`mode`), the narrator and tone (`voice`), what it delivers, the tasks and the agents. - Deliverables can have their own briefs, with a storyboard (`NAME.script.ts`) and a direction. + Deliverables can have their own briefs, with a storyboard (`NAME.script.ts`) and a direction. To write one, + `raea guide brief` has its types, a cut goal's contract and an example. 3. **The look** (the brief's `look`, and `brand/brand.css` when there is one): the project's committed world. 4. **The floor**: what breaks a piece, read again right before every edit. 5. **One guide per mode**: what that kind of piece has to do. diff --git a/sdk/guides/craft/motion/brief.md b/sdk/guides/craft/motion/brief.md new file mode 100644 index 00000000..4e97cb64 --- /dev/null +++ b/sdk/guides/craft/motion/brief.md @@ -0,0 +1,126 @@ +# brief.ts: the brief as code + +A project's brief.ts is a module whose default export is `brief({...})` from `raea/brief`. raea runs it, `raea goal +check` holds the work to its `goal`, and tsc checks it against the same types raea reads. Everything you need to write +one is on this page, so you don't need to open the SDK. + +## The shape + +```ts +import { brief, cut, rules } from "raea/brief" + +export default brief({ + title: string, // the project as people name it + for?: string, // the client or person it's for + audience?: string, // who watches, and where + believe?: string, // the one thing they should think afterwards + voice?: string, look?: string, sound?: string, + notDoing?: string[], // the anti-goals + assumed?: string[], // facts you wrote that the person hasn't confirmed, by key ("audience") + sections?: { heading: string, text: string }[], + goal?: Goal | Goal[], // what the work is held to: cut(), rules(), scene(), kit(), shot(), playable() + plan?: PlanFile, // tasks (raea/task plan()), inline or imported +}) +``` + +A goal made with `cut({...})` or `rules({...})` takes these fields: + +| Field | What it is | +| --- | --- | +| `aim` | what the goal is, in the person's words | +| `rules` | `{ id, run? , timeout?, file?, says? }[]`: what must hold before you stop (below) | +| `cut` | a cut job's contract, the brief as rules (below) | +| `deliverables` | files that must exist when it's done, relative to brief.ts (a cut goal lists its own) | +| `previews` | what it shows but never delivers (`review/` and `previews/` when left out) | +| `checks` | the project's own `check()`s from raea/check, imported into brief.ts | +| `name`, `after`, `step` | for several goals in order: a goal's name, the goals before it, its workflow step | + +## A cut job's contract (`cut: {...}`) + +Every `from` is the brief's own words, copied from its text file as they are, so a person can find the line the +rule came from. raea refuses a `from` it can't find. + +| Field | Type | What it holds | +| --- | --- | --- | +| `brief` | `string` | the brief as text, relative to brief.ts (`pdftotext -layout brief.pdf brief_docs/brief.txt`) | +| `count` | `{ value: number, from }` | how many cuts the brief asks for. Fewer planned stays open until a person answers an `open` item about `"count"` | +| `seconds` | `[least, most]` | a cut's length when the cut doesn't give its own | +| `formats` | `string[]` | `"9:16"`, `"16:9"`, `"1:1"`, `"4:5"`: every cut's formats when the cut doesn't give its own | +| `cuts` | `CutPlan[]` | one per cut: `{ id, angle?, kind?, hook?, text?, formats?, seconds?, beats? }` | +| `say` | `{ text, from, every? }[]` | what is said or shown in every cut (`every: false`: one cut is enough) | +| `never` | `{ text, from }[]` | what no cut says or shows: a banned claim, a word, a name | +| `cta` | `{ text, from, also?, within? }` | the line every cut ends on, heard or shown in its last `within` seconds (8 by default); `also` lists other lines the brief rotates | +| `open` | `{ question, from, about?, answer?, by? }[]` | the brief's open items (TBD, to confirm). Each holds the job open until a person's answer is written in, with who gave it | +| `frames` | `boolean` | every face whole and every text big enough, in every frame (true by default) | + +A cut's `id` is `[a-z0-9_]` and unique. Each format lands as `out/cuts/_.mp4`, for example +`out/cuts/a1_s1_9x16.mp4`. `text` is `"captions"`, `"hook"` or `"none"`. `kind` is `"solo"` or `"mashup"`. `hook` is +one of the brief's hook types, as the brief names it. + +A cut's `beats` are decided before it's cut, in order: `{ at, feel, story?, asl?, tempo? }[]`. `at` is where the beat +starts, in seconds from the cut's start (0 for the first). `feel` is what the viewer feels there, in the person's +words, and `story` is what they understand by its end. A fresh critic watches each beat for both. `asl` is the beat's +average shot length in seconds, and `tempo` is how its shot lengths move: `"build"` (shorter as it goes), `"release"` +(longer) or `"hold"` (even). The montage check holds the cut to them. + +## Rules + +| Kind | Example | How it's checked | +| --- | --- | --- | +| `run` | `{ id: "tests", run: "bun test" }` | the command must exit 0 in brief.ts's folder (300 s unless `timeout` says otherwise) | +| `file` | `{ id: "sheet", file: "review/sheet.png" }` | the file must exist (`a\|b`: either one; `dir/`: three or more pictures in it) | +| `says` | `{ id: "logo_end", says: "The wordmark is on screen in each cut's last 3 seconds" }` | words that must be true of the work, judged by a fresh critic, never by you | + +You don't run the critic yourself or choose it: `raea goal check` asks for a verdict when one is missing or older than +the work. A `says` rule about a video ("in each cut's last 3 seconds") is watched and heard. One about files or text +is read. + +## An example + +```ts +// brief.ts +import { brief, cut } from "raea/brief" + +export default brief({ + title: "Juniper Tea ยท street interviews, round 1", + for: "Juniper Tea", + audience: "TikTok and Reels, 25-40, already buying loose-leaf", + believe: "Juniper tastes like the tea shop, at home", + goal: cut({ + aim: "Ten 9:16 cuts from the street interviews, each ending on the free-trial line", + cut: { + brief: "brief_docs/brief.txt", + count: { value: 10, from: "10 unique cuts total" }, + seconds: [20, 40], + formats: ["9:16"], + cuts: [ + { + id: "a1_s1", angle: "Angle 1", kind: "solo", hook: "Direct Problem", text: "captions", + beats: [ + { at: 0, feel: "caught off guard, curious", story: "she's a real tea drinker, not an actor", asl: 1.5, tempo: "build" }, + { at: 4, feel: "the small sadness of bad tea at home", story: "bagged tea tastes like paper to her", asl: 3, tempo: "hold" }, + { at: 14, feel: "the surprise of a good first sip", story: "Juniper is the shop's taste at home", asl: 2, tempo: "release" }, + ], + }, + { id: "a1_s2", angle: "Angle 1", kind: "mashup", hook: "Reaction", text: "captions" }, + ], + say: [{ text: "free shipping over $35", from: "Mention: free shipping over $35", every: false }], + never: [{ text: "cures", from: "Never claim the tea cures or treats anything" }], + cta: { text: "Try Juniper free for 30 days", from: "CTA: \"Try Juniper free for 30 days\"" }, + open: [ + { + question: "The footage holds 4 usable interviews, not 10: deliver 4 this round?", + from: "10 unique cuts total", about: "count", + // left out until the person answers; then their words and who gave them + answer: "Yes, 4 now and the rest after the reshoot", by: "the client's producer", + }, + ], + }, + rules: [ + { id: "wordmark_end", says: "The Juniper wordmark is on screen in each cut's last 3 seconds" }, + ], + }), +}) +``` + +Write it, then run `raea goal check`. It names each rule that doesn't hold and the line of the brief it came from. diff --git a/sdk/raea/src/brief-goal.gen.ts b/sdk/raea/src/brief-goal.gen.ts index 3896002a..8cd0d09f 100644 --- a/sdk/raea/src/brief-goal.gen.ts +++ b/sdk/raea/src/brief-goal.gen.ts @@ -1,5 +1,4 @@ // Generated from raea-core-brief (core/brief) by its `goal_declarations`; edit the Rust, not this. -import type { Beat } from "./brief.gen"; export type Goal = { kind: GoalKind, /** @@ -233,7 +232,29 @@ text?: string, formats?: Array, seconds?: [number, number], * the cut's beats in order (docs/goal.feature MK48): what each must make the viewer feel and understand, decided * before the cut (Murch: emotion and story weigh most), and its pace */ -beats?: Array, }; +beats?: Array, }; + +export type CutBeat = { +/** + * where it starts, in seconds from the cut's start (0 for the first) + */ +at: number, +/** + * what the viewer feels here, in the person's words ("the itch of a chore left undone") + */ +feel: string, +/** + * what the viewer understands by its end ("the app does the reminding") + */ +story?: string, +/** + * its average shot length in seconds: the shots inside it average within a third of this + */ +asl?: number, +/** + * how its shot lengths move: "build" (shorter as it goes), "release" (longer) or "hold" (even) + */ +tempo?: string, }; export type Phrase = { /**