--- title: "raea goal" summary: "The loop: the brief's goals, every rule each is held to, run at four moments (a save, a render's end, a hand-over, a stop) by `raea goal check`; the brief's plan by `raea goal tasks`; the next steps, the critic and a scene, kit or shot goal's gates." order: 42 sources: ["sdk/goal/src/run.ts", "sdk/goal/src/contract.ts", "sdk/goal/src/tasks.ts", "sdk/goal/src/packs/index.ts", "core/brief/src/goal.rs", "apps/make/src/gates.rs", "apps/check/src/hook.rs", "engine/cli/src/verbs.rs"] --- `raea goal check` holds the work to every rule it has, from what's on disk and never from what the agent says. The rules are the brief's `goal`: one goal, or a list of them done in order (a workflow inline, or `workflow({ name, steps })`), each a `cut({...})`, `rules({...})`, `scene({...})`, `kit({...})` or `shot({...})` from `raea/brief`. A goal's `name` is how the report and other goals' `after` name it, and `after` holds it until those goals pass. Each kind turns its packs on, `packs` switches any by name, and `checks` adds the project's own (`check()`s from raea/check, imported into brief.ts). With no goal, a project is held to the floor: every made video's frames, its floor measure and its look, and every composition's stills as it's saved. Each check runs at its moments, and raea runs `raea goal check` at each one itself: | Moment | When | Who runs it | | --- | --- | --- | | `edit` | a composition, or any file under a goal, is saved | the agent's after-save hook (`raea hook`) | | `render` | a render's export is written | `raea render`, on a Mac and on a raea cloud box | | `publish` | the agent hands a video over | raea cloud's publish tool | | `done` | the agent's turn ends; a raea cloud stop or delivery | the Stop hook; raea cloud | The packs, and what each holds: | Pack | On for | Holds | | --- | --- | --- | | `words` | cut | every word CUT.lines.txt says is heard whole in the export, none faded under a crossfade | | `sound` | cut | edit points in the pauses, every line within 6 dB of the others, every effect heard (from the render's manifest against each take) | | `frames` | cut, floor | no face cut by the frame or a split screen's seam, no text under 40 px of a 1080-wide frame | | `montage` | cut | each cut's beats kept to their pace (`asl`, `tempo`); eye trace, screen direction and tone across every cut, in Murch's order (a break at most cuts is an error) | | `place` | cut | no text over a face, a person or what the shot is about where a clear place of its size exists | | `floor` | cut, floor | no clipped text, low contrast, freeze, flash or loudness out of range | | `stills` | every kind, floor | a composition's three stills as it's saved: no clipped or cramped text, nothing out of the safe areas | | `seen` | cut, floor | its contact sheet looked at since its last render (`raea goal seen FILE`, then `raea goal seen FILE "..."`) | | `surprise` | when a brief turns it on | one earned surprise named with its moment in seconds | | `naming` | cut | every video and still named client_concept_variant_v#_size | | `sizes` | cut | one size first: no other size before a person approves the first | | `quotes`, `count`, `open` | cut | every rule quotes the brief; as many cuts as it asks for; each open item answered by a person | | `say`, `never`, `cta`, `shape` | cut | each cut says its phrases, none it bans, ends on the CTA, in its format and length | | `run`, `says` | rules, cut | each command rule exits 0; each `says` rule found true by a fresh critic since the work last changed (a cut's beats are `says` rules: what each part makes the viewer feel and understand, judged on the cut in sequence) | | `deliverables` | rules, scene, kit, shot | every file the goal names exists | | `record`, `critic`, `notes` | scene, kit, shot | every composition rendered clean since it changed; the critic's rounds; NOTES.md's "What the skill got wrong" | A finding says what to change (the out point to move to, the gainDb that evens a line, the place a caption is clear). `raea goal check` prints each, writes review/goal.json (and FILE.check.json beside each file named), and exits 1 on an error. A check that needs what the machine hasn't (people and faces are read by raea cloud's farm) waits and says so; it holds nothing. The Stop hook keeps an agent working in a project whose brief has a `goal` until `--at done` passes; the same open items block a session three times at most. A scene, kit or shot job is delivered short at its round cap (8 by default) or after three rounds that haven't beaten the best before them: its record and critic findings are then warnings. A rules goal (`rules({...})`, what raea.app's `/goal` writes) is any other work: the aim in your words and the rules that must hold before the agent stops. A `run` rule is a command that must exit 0 in the brief's folder (300 seconds unless its `timeout` says otherwise); a `file` rule is a deliverable; a `says` rule is words that must be true of the work, judged by a fresh critic that may only read: `raea goal judge` asks one (`--by claude` or `kimi`) and keeps its verdict in review/judge/NAME.json, and the rule clears only while that verdict is no older than the work's newest file. ```ts import { brief, rules } from "raea/brief" import clearOfButtons from "./checks/clear.ts" export default brief({ title: "Spring drop", goal: rules({ aim: "the export plays and the README says how to run it", rules: [ { id: "tests", run: "bun test" }, { id: "export", file: "out/final.mp4" }, { id: "readme", says: "README.md says how to install and run it, in order" }, ], checks: [clearOfButtons], }), }) ``` ```sh raea goal check # done: everything, as the Stop hook runs it raea goal check out/cuts/acme_dog_hook1_v2_9x16.mp4 --at render raea goal seen out/cuts/acme_dog_hook1_v2_9x16.mp4 && raea goal seen out/cuts/acme_dog_hook1_v2_9x16.mp4 "..." raea goal tasks --json # the brief's plan, every task raea goal next ``` The brief's plan is its `plan` (`plan({...})` from `raea/brief`, inline or in a module brief.ts imports): `raea goal tasks` reads it from the brief's run, `--apply` makes edits by task id and writes each back where that task is written, and `--put` writes a whole plan back only while the brief's is still the one it replaces (an app's Undo). A goal's rules are never copied into the plan: the plan is the work, the goal is what the work is held to. ## Usage ```sh raea goal check [FILE...] [--at edit|render|publish|done] [--goal NAME] [--only ID,...] [--manifest render.json] [--json] (every rule each goal of brief.ts is held to at that moment: its kind's packs, its rules and its own checks; with no goal, the floor; every project is also held to `registered`, every raea file reached from brief.ts; review/goal.json; exit 1 on an error. The hook runs it at every save (edit) and stop (done), a render at its end, raea cloud at publish) raea goal tasks [DIR] [--json] | raea goal tasks [DIR] --apply EDITS.json|- | raea goal tasks [DIR] --put PUT.json|- (the brief's plan as the brief's run gives it: open tasks by id, or all as JSON; --apply writes edits by task id back where each task is written, refusing one made by code; a project with no plan gets plan.ts, imported by brief.ts; --put {plan, base} writes the whole plan back only while the brief's is still base) raea goal seen FILE ["what you see and would change"] [--surprise "SECONDS s: what it is"] (FILE's contact sheet beside it, to look at every frame; with words, what was seen of FILE as it is now) raea goal judge [--goal NAME] [--by claude|kimi] (a goal's `says` rules judged by a fresh critic that only reads; review/judge/NAME.json) raea goal next [DIR] (the two or three useful next steps for the project, from its brief, its goals, compositions, renders and checks) raea goal gates [DIR] [--goal NAME] --json (a scene, kit or shot goal's record and critic gates, as raea/goal's packs read them) ``` Headless: it needs nothing running and opens no window. Takes any number of arguments besides its flags. ## Flags | Flag | Takes | What it does | | --- | --- | --- | | `--apply` | `EDITS.json\|-` | plan edits (JSON, `-` for stdin), each written where its task is written | | `--at` | `edit\|render\|publish\|done` | The moment `check` runs the rules of (default `done`); for `place`, the seconds to read (`S[,S...]`). | | `--by` | `claude\|kimi` | The critic `judge` asks, a fresh session that may only read (default `claude`). | | `--goal` | `NAME` | only this goal of the brief's (by its name) | | `--json` | – | `check`: print the report (review/goal.json's shape). `gates`: the record and critic gates as JSON. | | `--manifest` | `render.json` | the render's manifest, for the sound pack's takes and effects | | `--only` | `ID,...` | `check`: only these checks. Otherwise only these objects (refs, gen, pick-sheet, prep) or shots (framing), by id or name. | | `--put` | `PUT.json\|-` | `{plan, base}`: the whole plan written back only while the brief's is still `base` | | `--surprise` | `"SECONDS s:` | `seen`: the one surprise and its moment, for a brief with the surprise pack on. |