Skip to content

armgit / raea

Public Imported from GitHub
0

Render Anything Engine: tell your AI what to make. Videos, motion graphics, 3D and games as React and TypeScript, rendered on your own GPU. Rust + Bevy, macOS, Linux and Windows.

DR5: a person's notes become files the work is held to, restated as asks before anything changes. raea notes take writes each note sent from the raea app (each edit comment, with its pin) or said in a session (--said) to notes/ROUND/nN.ts, the words verbatim and no asks; a note already taken isn't taken again. raea notes ls says where each stands (to restate, to check) and what its restatement still owes: a second reading where one ask came from several sentences, each medium its words name (2D, 3D, flat, extruded, real, modelled, voxel) that no ask asks for or turns down, and what a redesign keeps. raea notes post shows a restated note's asks on its comment in the app (raea show --on ITEM --working ID --ask TEXT...), once per restatement, and none that still owes something; the person's correction comes back with the next take as a new line of the note, kept, with its ask in `corrected` until restated. Note, Ask, Pin and Proof are world facts (core/facts note.rs) with their TS types, and sdk/raea/src/note.ts gives note({...}). The notes are a crate of their own (apps/notes), not apps/direction, which is near its size; the feature file says why.

shinyobjectza4fd51bebe1e
diff --git a/Cargo.lock b/Cargo.lock
index 2bde493d..29fb95d0 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -13669,6 +13669,15 @@ dependencies = [
"serde_json",
]
+[[package]]
+name = "raea-app-notes"
+version = "0.1.0"
+dependencies = [
+ "raea-core-facts",
+ "serde_json",
+ "tempfile",
+]
+
[[package]]
name = "raea-app-play"
version = "0.1.0"
@@ -13968,6 +13977,7 @@ dependencies = [
"raea-app-game",
"raea-app-judge",
"raea-app-media",
+ "raea-app-notes",
"raea-app-play",
"raea-app-solid",
"raea-app-sound",
diff --git a/Cargo.toml b/Cargo.toml
index c5419a54..01d375c4 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -154,6 +154,7 @@ members = [
"runtime/shared",
"apps/check",
"apps/direction",
+ "apps/notes",
"apps/sound",
"apps/workspace",
"apps/workspace/registry",
diff --git a/apps/notes/Cargo.toml b/apps/notes/Cargo.toml
new file mode 100644
index 00000000..50f7feb8
--- /dev/null
+++ b/apps/notes/Cargo.toml
@@ -0,0 +1,15 @@
+[package]
+name = "raea-app-notes"
+version = "0.1.0"
+edition = "2024"
+license = "FSL-1.1-ALv2"
+publish = false
+description = "A person's notes on a project as files the work is held to (docs/direction.feature DR5): `raea notes take`, `ls` and `post`"
+
+[dependencies]
+# Note and Ask, the project found by its .raea/project, and the world a note is an entity in
+raea-core-facts = { path = "../../core/facts" }
+serde_json = "1"
+
+[dev-dependencies]
+tempfile = "3"
diff --git a/apps/notes/src/lib.rs b/apps/notes/src/lib.rs
new file mode 100644
index 00000000..db613b8d
--- /dev/null
+++ b/apps/notes/src/lib.rs
@@ -0,0 +1,161 @@
+//! A person's notes on a project (docs/direction.feature DR5). `raea notes take` writes each note the person sends
+//! from the raea app (an edit comment with its pin, or a note on an item) or says in a session to a file,
+//! notes/<round>/<id>.ts, with their words verbatim and no asks. The agent restates each as its asks before anything
+//! in the work changes, and `raea notes ls` says where each stands and what its restatement still owes. `raea notes
+//! post` shows the asks on the person's comments in the app, and their corrections come back with the next take. In a
+//! project's world each note is an entity with a Note, for the checks that hold it (DR6).
+
+use std::collections::BTreeMap;
+use std::path::{Path, PathBuf};
+
+use raea_core_facts::{Facts, Note, record};
+use serde_json::json;
+
+mod post;
+mod take;
+
+pub const USAGE: &str = "raea notes take [PROJECT] [--inbox NAME] [--said WORDS]... | raea notes ls [PROJECT] [--json] | raea notes post [PROJECT] (a person's notes as files the work is held to: take writes each note sent from the raea app or said in a session to notes/ROUND/ID.ts, the words verbatim, to be restated as asks before anything changes, and writes in each correction the person made to a restatement; ls says where each note stands, to restate or to check, and what its restatement still owes; post shows each restated note's asks on its comment in the raea app, for the person to correct)";
+
+/// Evaluates a .ts file's default export to its JSON (the CLI's spec host).
+pub type Eval = fn(&Path) -> Result<String, String>;
+
+pub(crate) type R<T> = Result<T, String>;
+
+/// The flags `raea notes` takes, and whether each takes a value.
+const FLAGS: [(&str, bool); 3] = [("--inbox", true), ("--said", true), ("--json", false)];
+
+/// One note file: where it is in the project, and the note, or why it can't be read.
+pub struct Kept {
+ pub file: PathBuf,
+ pub note: R<Note>,
+}
+
+/// `raea notes VERB ...`, printed; its exit code (1: a note that can't be read, 2: the command was wrong).
+pub fn cli(args: &[String], eval: Eval) -> i32 {
+ match run(args, eval) {
+ Ok((out, code)) => {
+ println!("{out}");
+ code
+ }
+ Err(e) => {
+ eprintln!("raea notes: {e}");
+ 2
+ }
+ }
+}
+
+fn run(args: &[String], eval: Eval) -> R<(String, i32)> {
+ let Some(verb) = args.first().map(String::as_str).filter(|v| !matches!(*v, "--help" | "-h" | "help")) else {
+ return Ok((USAGE.into(), 0));
+ };
+ let rest = &args[1..];
+ let mut target = None;
+ let mut it = rest.iter();
+ while let Some(a) = it.next() {
+ match FLAGS.iter().find(|(f, _)| f == a) {
+ Some((_, true)) => {
+ it.next().ok_or_else(|| format!("{a} takes a value\n{USAGE}"))?;
+ }
+ Some(_) => {}
+ None if a.starts_with("--") => return Err(format!("no flag {a}\n{USAGE}")),
+ None if target.is_none() => target = Some(a.as_str()),
+ None => return Err(format!("one project at a time ({a} is a second)\n{USAGE}")),
+ }
+ }
+ let target = target.unwrap_or(".");
+ let project = record::up(Path::new(target), ".raea/project").ok_or_else(|| format!("{target} isn't in a raea project (no .raea/project at or above it)\n{USAGE}"))?;
+ match verb {
+ "take" => take::take(&project, rest).map(|s| (s, 0)),
+ "ls" => Ok(ls(&project, rest.iter().any(|a| a == "--json"), eval)),
+ "post" => Ok(post::post(&project, eval, post::run_raea)),
+ v => Err(format!("no verb {v}\n{USAGE}")),
+ }
+}
+
+/// The values a flag was given, in order.
+pub(crate) fn values<'a>(args: &'a [String], flag: &str) -> Vec<&'a str> {
+ args.iter().zip(args.iter().skip(1)).filter_map(|(f, v)| (f == flag).then_some(v.as_str())).collect()
+}
+
+/// A note file's round and number: notes/2/n7.ts is (2, 7); anything else under notes/ isn't a note.
+pub(crate) fn place(project: &Path, f: &Path) -> Option<(u32, u32)> {
+ let rel = f.strip_prefix(project.join("notes")).ok()?;
+ let round = rel.parent()?.to_str()?.parse().ok()?;
+ let n = rel.file_name()?.to_str()?.strip_prefix('n')?.strip_suffix(".ts")?.parse().ok()?;
+ Some((round, n))
+}
+
+/// The project's note files, by round and number.
+pub fn files(project: &Path) -> Vec<PathBuf> {
+ let dirs = std::fs::read_dir(project.join("notes")).into_iter().flatten().flatten().map(|e| e.path());
+ let mut out: Vec<((u32, u32), PathBuf)> = dirs.flat_map(|d| std::fs::read_dir(d).into_iter().flatten().flatten().map(|e| e.path())).filter_map(|f| Some((place(project, &f)?, f))).collect();
+ out.sort();
+ out.into_iter().map(|(_, f)| f).collect()
+}
+
+/// Every note in the project, read through its file's default export.
+pub fn read(project: &Path, eval: Eval) -> Vec<Kept> {
+ let of = |f: &Path| eval(f).and_then(|j| serde_json::from_str::<Note>(&j).map_err(|e| format!("not a note ({e})")));
+ files(project).into_iter().map(|f| Kept { note: of(&f), file: f.strip_prefix(project).map(Path::to_path_buf).unwrap_or(f) }).collect()
+}
+
+/// The notes as entities in a world, one with a Note each.
+pub fn spawn(world: &mut Facts, notes: &[Kept]) {
+ for n in notes.iter().filter_map(|k| k.note.as_ref().ok()) {
+ let e = world.spawn(None);
+ world.put(e, n);
+ }
+}
+
+/// A note's first line, quoted and cut to `n` characters.
+pub(crate) fn quoted(words: &str, n: usize) -> String {
+ let line = words.lines().next().unwrap_or("").trim();
+ if line.chars().count() > n { format!("\"{}…\"", line.chars().take(n).collect::<String>().trim_end()) } else { format!("\"{line}\"") }
+}
+
+/// `raea notes ls`: each note with where it stands, its asks and what its restatement still owes; 1 when a note
+/// can't be read.
+fn ls(project: &Path, as_json: bool, eval: Eval) -> (String, i32) {
+ let notes = read(project, eval);
+ let code = i32::from(notes.iter().any(|k| k.note.is_err()));
+ if as_json {
+ let v: Vec<_> = notes
+ .iter()
+ .map(|k| match &k.note {
+ Ok(n) => json!({ "file": k.file, "note": n, "state": n.state(), "flags": n.flags() }),
+ Err(e) => json!({ "file": k.file, "error": e }),
+ })
+ .collect();
+ return (serde_json::to_string_pretty(&v).unwrap_or_default(), code);
+ }
+ if notes.is_empty() {
+ return ("no notes yet: `raea notes take` writes each one the person sends from the raea app or says".into(), 0);
+ }
+ let mut out = Vec::new();
+ let mut tally: BTreeMap<&str, usize> = BTreeMap::new();
+ for k in &notes {
+ let file = k.file.display();
+ let Ok(n) = &k.note else {
+ out.push(format!("{file}: can't be read: {}", k.note.as_ref().err().map_or("", String::as_str)));
+ *tally.entry("can't be read").or_default() += 1;
+ continue;
+ };
+ *tally.entry(n.state()).or_default() += 1;
+ out.push(format!("{file}: round {}, {}: {}", n.round, n.state(), quoted(n.words.first().map_or("", String::as_str), 90)));
+ for a in &n.asks {
+ let medium = a.medium.as_deref().map(|m| format!(" [{m}]")).unwrap_or_default();
+ let not = if a.not.is_empty() { String::new() } else { format!("; not: {}", a.not.join(", ")) };
+ out.push(format!(" - {}{medium}{not}", a.text));
+ }
+ out.extend(n.flags().into_iter().map(|f| format!(" ! {f}")));
+ }
+ let counts: Vec<String> = tally.iter().map(|(s, c)| format!("{c} {s}")).collect();
+ out.push(format!("{} note{}: {}", notes.len(), if notes.len() == 1 { "" } else { "s" }, counts.join(", ")));
+ if tally.contains_key("to restate") {
+ out.push(take::RESTATE.into());
+ }
+ (out.join("\n"), code)
+}
+
+#[cfg(test)]
+mod tests;
diff --git a/apps/notes/src/post.rs b/apps/notes/src/post.rs
new file mode 100644
index 00000000..ad2b5806
--- /dev/null
+++ b/apps/notes/src/post.rs
@@ -0,0 +1,108 @@
+//! `raea notes post`: each restated note sent from the raea app gets its asks shown back on its comment (DR5), through
+//! `raea show --on ITEM --working COMMENT --ask TEXT...`, before the work starts. The person reads them there and can
+//! correct one in a word; `raea notes take` writes their correction into the note, which is then restated again.
+
+use std::collections::BTreeMap;
+use std::path::{Path, PathBuf};
+
+use crate::{Eval, R, read};
+
+/// What was last shown for each note, by where it came from (`.raea/notes-shown.json`): a note shown with these asks
+/// already isn't shown again, so a comment the agent has since settled isn't marked working again.
+fn shown_at(project: &Path) -> PathBuf {
+ project.join(".raea/notes-shown.json")
+}
+
+/// The note from `from` as not shown: the person corrected it, so its next restatement is shown even in the same words
+/// (the app takes new asks as the answer to their correction).
+pub(crate) fn forget(project: &Path, from: &str) -> R<()> {
+ let f = shown_at(project);
+ let Ok(t) = std::fs::read_to_string(&f) else { return Ok(()) };
+ let mut shown: BTreeMap<String, Vec<String>> = serde_json::from_str(&t).unwrap_or_default();
+ if shown.remove(from).is_some() {
+ let t = serde_json::to_string_pretty(&shown).map_err(|e| e.to_string())?;
+ std::fs::write(&f, t + "\n").map_err(|e| format!("{}: {e}", f.display()))?;
+ }
+ Ok(())
+}
+
+/// Runs raea with these arguments: what it printed, or why it failed.
+pub type Run = fn(&[String]) -> R<String>;
+
+/// This raea, run again with `args`.
+pub fn run_raea(args: &[String]) -> R<String> {
+ let exe = std::env::current_exe().map_err(|e| e.to_string())?;
+ let out = std::process::Command::new(exe).args(args).output().map_err(|e| e.to_string())?;
+ let said = |b: &[u8]| String::from_utf8_lossy(b).trim().to_string();
+ if out.status.success() { Ok(said(&out.stdout)) } else { Err(said(&out.stderr).lines().last().unwrap_or("raea show failed").to_string()) }
+}
+
+/// The item and comment a note sent from the app came from ("app ITEM cm-N"); a note on an item as a whole has none.
+pub(crate) fn comment_of(from: &str) -> Option<(&str, &str)> {
+ let mut it = from.strip_prefix("app ")?.split(' ');
+ let (item, comment) = (it.next()?, it.next()?);
+ (comment.starts_with("cm-") && it.next().is_none()).then_some((item, comment))
+}
+
+/// The arguments that show a note's asks on its comment.
+pub(crate) fn args(item: &str, comment: &str, asks: &[&str]) -> Vec<String> {
+ let mut a: Vec<String> = ["show", "--on", item, "--working", comment].map(String::from).to_vec();
+ a.extend(asks.iter().flat_map(|t| ["--ask".to_string(), t.to_string()]));
+ a
+}
+
+/// `raea notes post`: what was shown where, and what wasn't and why; 1 when one couldn't be posted.
+pub(crate) fn post(project: &Path, eval: Eval, run: Run) -> (String, i32) {
+ let mut out = Vec::new();
+ let mut code = 0;
+ let mut shown: BTreeMap<String, Vec<String>> = std::fs::read_to_string(shown_at(project)).ok().and_then(|t| serde_json::from_str(&t).ok()).unwrap_or_default();
+ let before = shown.clone();
+ for k in read(project, eval) {
+ let file = k.file.display().to_string();
+ let n = match k.note {
+ Ok(n) => n,
+ Err(e) => {
+ out.push(format!("{file}: can't be read: {e}"));
+ code = 1;
+ continue;
+ }
+ };
+ let owed = n.flags();
+ let Some((item, comment)) = comment_of(&n.from) else {
+ if n.from.starts_with("app ") {
+ out.push(format!("{file}: a note on its item as a whole has no comment to show its asks on: say them to the person"));
+ }
+ continue;
+ };
+ if n.state() == "to restate" || !owed.is_empty() {
+ out.push(format!("{file}: not posted: {}", if owed.is_empty() { "it's still to restate".to_string() } else { format!("its restatement still owes: {}", owed.join("; ")) }));
+ continue;
+ }
+ let asks: Vec<&str> = n.asks.iter().map(|a| a.text.as_str()).collect();
+ if shown.get(&n.from).is_some_and(|s| s.iter().eq(asks.iter().copied())) {
+ out.push(format!("{file}: its asks are shown on {comment} of {item} already"));
+ continue;
+ }
+ match run(&args(item, comment, &asks)) {
+ Ok(_) => {
+ out.push(format!("{file}: its {} ask{} shown on {comment} of {item}, where the person can correct one", asks.len(), if asks.len() == 1 { "" } else { "s" }));
+ shown.insert(n.from.clone(), asks.iter().map(|a| a.to_string()).collect());
+ }
+ Err(e) => {
+ out.push(format!("{file}: not posted: {e}"));
+ code = 1;
+ }
+ }
+ }
+ if shown != before {
+ let written = serde_json::to_string_pretty(&shown).map_err(|e| e.to_string()).and_then(|t| std::fs::write(shown_at(project), t + "\n").map_err(|e| e.to_string()));
+ if let Err(e) = written {
+ out.push(format!("what was shown isn't kept ({}: {e}): the next post shows these again", shown_at(project).display()));
+ code = 1;
+ }
+ }
+ if out.is_empty() {
+ out.push("no notes from the raea app to post: `raea notes ls` lists them".into());
+ }
+ (out.join("\n"), code)
+}
diff --git a/apps/notes/src/take.rs b/apps/notes/src/take.rs
new file mode 100644
index 00000000..050eb981
--- /dev/null
+++ b/apps/notes/src/take.rs
@@ -0,0 +1,225 @@
+//! `raea notes take`: what the person sent from the raea app to this project (the inbox lines it wrote: each edit
+//! comment of a send, with its pin, or a note on an item) and what they said in a session (`--said`), each written
+//! as a note file with their words verbatim and no asks, all in one new round. A note already taken isn't taken again.
+
+use std::path::{Path, PathBuf};
+
+use raea_core_facts::{Pin, note};
+use serde_json::Value;
+
+use crate::{R, files, place, quoted, values};
+
+/// What a note asks of the agent before anything changes, said where notes are taken and listed.
+pub(crate) const RESTATE: &str = "restate each note before changing anything: one ask for each thing it asks for, the medium where its words name one (2D, 3D, flat, extruded, real, modelled, voxel), what it is about, and what it doesn't ask for (`not`), so a change keeps the rest";
+
+/// A note to write: the person's words, where they came from, its pin, and where it was as the app said it.
+pub(crate) struct New {
+ pub words: String,
+ pub from: String,
+ pub pin: Option<Pin>,
+ pub at: Option<String>,
+}
+
+/// Where the raea app writes what the person sends (the app's host, inbox.ts).
+fn inbox_dir() -> PathBuf {
+ match std::env::var_os("RAEA_INBOX_DIR") {
+ Some(dir) => dir.into(),
+ None => Path::new(&std::env::var_os("HOME").unwrap_or_default()).join(".raea/inbox"),
+ }
+}
+
+/// The app's pin ({kind: "place", x, y, t, part} or {kind: "time", t}) as a note's.
+fn pin_of(v: &Value) -> Option<Pin> {
+ v.is_object().then(|| Pin { t: v["t"].as_f64(), x: v["x"].as_f64(), y: v["y"].as_f64(), part: v["part"].as_str().map(Into::into) })
+}
+
+/// The notes in one inbox line sent to `project`: each comment of a send of edits, or a note on an item.
+pub(crate) fn of_line(v: &Value, project: &str) -> Vec<New> {
+ if v["project"].as_str() != Some(project) {
+ return Vec::new();
+ }
+ let item = v["item"].as_str().unwrap_or("");
+ let said = |v: &Value| v.as_str().map(str::trim).filter(|s| !s.is_empty()).map(String::from);
+ match v["kind"].as_str() {
+ // a send's own text is its comments listed again
+ Some("edits") => v["comments"].as_array().into_iter().flatten().filter_map(|c| {
+ Some(New { words: said(&c["text"])?, from: format!("app {item} {}", c["id"].as_str()?), pin: pin_of(&c["pin"]), at: said(&c["at"]) })
+ }).collect(),
+ Some("note") => said(&v["text"]).map(|words| New { words, from: format!("app {item} {}", v["when"].as_str().unwrap_or("")), pin: pin_of(&v["pin"]), at: None }).into_iter().collect(),
+ _ => Vec::new(),
+ }
+}
+
+/// A correction the person made in the app to a restated note: the note (by where it came from), the ask (1 is the
+/// first; none: the note as a whole), and their line.
+pub(crate) struct Correction {
+ pub from: String,
+ pub ask: u32,
+ pub text: String,
+}
+
+/// The correction in one inbox line sent to `project`, if it is one.
+pub(crate) fn correction_of(v: &Value, project: &str) -> Option<Correction> {
+ if v["project"].as_str() != Some(project) || v["kind"].as_str() != Some("correction") {
+ return None;
+ }
+ let text = v["text"].as_str().map(str::trim).filter(|t| !t.is_empty())?;
+ let ask = v["ask"].as_u64().and_then(|n| u32::try_from(n).ok()).unwrap_or(0);
+ Some(Correction { from: format!("app {} {}", v["item"].as_str()?, v["comment"].as_str()?), ask, text: text.into() })
+}
+
+/// Where the list that opens at `open` (its `[`) in `t` closes, past what is quoted in it.
+fn close_of(t: &str, open: usize) -> Option<usize> {
+ let (mut depth, mut quote, mut escaped) = (0, None, false);
+ for (i, c) in t[open..].char_indices() {
+ match (quote, c) {
+ (Some(_), _) if escaped => escaped = false,
+ (Some(_), '\\') => escaped = true,
+ (Some(q), c) if c == q => quote = None,
+ (Some(_), _) => {}
+ (None, '"' | '\'' | '`') => quote = Some(c),
+ (None, '[') => depth += 1,
+ (None, ']') => {
+ depth -= 1;
+ if depth == 0 {
+ return Some(open + i);
+ }
+ }
+ _ => {}
+ }
+ }
+ None
+}
+
+/// A note file's text with the person's correction added: their line last in its words, and its ask in `corrected`.
+/// None when the file has no words list or asks to add them beside.
+pub(crate) fn corrected(t: &str, c: &Correction) -> Option<String> {
+ let line = if c.ask == 0 { c.text.clone() } else { format!("on ask {}: {}", c.ask, c.text) };
+ let open = t.find("words: [")? + "words: ".len();
+ let end = close_of(t, open)?;
+ let mut out = format!("{}, {}{}", t[..end].trim_end().trim_end_matches(','), serde_json::to_string(&line).ok()?, &t[end..]);
+ match out.find("corrected: [") {
+ Some(at) => {
+ let at = at + "corrected: [".len();
+ let sep = if out[at..].starts_with(']') { "" } else { ", " };
+ out.insert_str(at, &format!("{}{sep}", c.ask));
+ }
+ None => {
+ // `asks:` where it starts its line, so a word in a quote is never taken for it
+ let at = out.match_indices("asks:").map(|(i, _)| i).find(|&i| out[..i].rsplit('\n').next().is_some_and(|l| l.trim().is_empty()))?;
+ let start = out[..at].rfind('\n').map_or(0, |i| i + 1);
+ let indent = out[start..at].to_string();
+ out.insert_str(start, &format!("{indent}corrected: [{}],\n", c.ask));
+ }
+ }
+ Some(out)
+}
+
+/// Each correction applied to its note's file, once: what was done, or why it wasn't.
+fn apply(project: &Path, kept: &[PathBuf], corrections: &[Correction]) -> R<Vec<String>> {
+ let s = |v: &str| serde_json::to_string(v).unwrap_or_default();
+ let mut out = Vec::new();
+ for c in corrections {
+ let line = if c.ask == 0 { c.text.clone() } else { format!("on ask {}: {}", c.ask, c.text) };
+ let Some(f) = kept.iter().find(|f| std::fs::read_to_string(f).is_ok_and(|t| t.contains(&format!("from: {}", s(&c.from))))) else {
+ out.push(format!("a correction for a note not in notes/ ({}): {}", c.from, quoted(&c.text, 90)));
+ continue;
+ };
+ let t = std::fs::read_to_string(f).map_err(|e| format!("{}: {e}", f.display()))?;
+ if t.contains(&s(&line)) {
+ continue;
+ }
+ let rel = f.strip_prefix(project).unwrap_or(f).display().to_string();
+ match corrected(&t, c) {
+ Some(new) => {
+ std::fs::write(f, new).map_err(|e| format!("{}: {e}", f.display()))?;
+ crate::post::forget(project, &c.from)?;
+ let which = if c.ask == 0 { "the note".to_string() } else { format!("ask {}", c.ask) };
+ out.push(format!("{rel}: the person corrected {which}: {}: restate it again", quoted(&c.text, 90)));
+ }
+ None => out.push(format!("{rel}: a correction can't be written in (no `words: [` and `asks:` to put it beside): {}", quoted(&c.text, 90))),
+ }
+ }
+ Ok(out)
+}
+
+/// A note's file: its words and where they came from, its round, its pin, and no asks.
+pub(crate) fn file_text(n: &New, round: u32) -> String {
+ let s = |v: &str| serde_json::to_string(v).unwrap_or_default();
+ // what the pin doesn't say is left out, as the type has it (a key with no value isn't written as null)
+ let pin = n.pin.as_ref().and_then(|p| serde_json::to_value(p).ok()).map(|mut p| {
+ if let Some(o) = p.as_object_mut() {
+ o.retain(|_, v| !v.is_null());
+ }
+ format!(" pin: {p},\n")
+ });
+ let redesign = if note::redesign(&n.words) { " redesign: true,\n" } else { "" };
+ let words: Vec<String> = n.words.lines().map(s).collect();
+ format!(
+ "// A note from the person, as they wrote it (raea notes take). Keep its words; restate it as asks below, one for each\n// thing it asks for, before anything in the work changes.\nimport {{ note }} from \"raea/note\";\n\nexport default note({{\n words: [{}],\n from: {},\n round: {round},\n{pin}{redesign} asks: [],\n}});\n",
+ words.join(", "),
+ s(&n.from),
+ pin = pin.unwrap_or_default()
+ )
+}
+
+pub(crate) fn take(project: &Path, args: &[String]) -> R<String> {
+ take_from(&inbox_dir(), project, args)
+}
+
+/// `take`, reading the inbox files in `dir`.
+pub(crate) fn take_from(dir: &Path, project: &Path, args: &[String]) -> R<String> {
+ let name = project.file_name().map(|n| n.to_string_lossy().into_owned()).unwrap_or_default();
+ let inboxes: Vec<PathBuf> = match values(args, "--inbox").first() {
+ Some(n) => vec![dir.join(format!("{}.jsonl", n.trim_end_matches(".jsonl")))],
+ None => {
+ let mut v: Vec<PathBuf> = std::fs::read_dir(dir).into_iter().flatten().flatten().map(|e| e.path()).filter(|p| p.extension().is_some_and(|x| x == "jsonl")).collect();
+ v.sort();
+ v
+ }
+ };
+ let (mut new, mut fixes): (Vec<New>, Vec<Correction>) = (Vec::new(), Vec::new());
+ for f in &inboxes {
+ let text = std::fs::read_to_string(f).map_err(|e| format!("{}: {e}", f.display()))?;
+ for v in text.lines().filter_map(|l| serde_json::from_str::<Value>(l).ok()) {
+ new.extend(of_line(&v, &name));
+ fixes.extend(correction_of(&v, &name));
+ }
+ }
+ new.extend(values(args, "--said").into_iter().map(str::trim).filter(|w| !w.is_empty()).map(|w| New { words: w.into(), from: "session".into(), pin: None, at: None }));
+
+ // a note already in notes/ (by where it came from; one said in a session, by its words too) isn't taken again
+ let kept = files(project);
+ let texts: Vec<String> = kept.iter().filter_map(|f| std::fs::read_to_string(f).ok()).collect();
+ let s = |v: &str| serde_json::to_string(v).unwrap_or_default();
+ let mut seen: Vec<(String, String)> = Vec::new();
+ new.retain(|n| {
+ let had = texts.iter().any(|t| t.contains(&format!("from: {}", s(&n.from))) && (n.from != "session" || n.words.lines().all(|l| t.contains(&s(l)))));
+ let twice = seen.contains(&(n.from.clone(), n.words.clone()));
+ seen.push((n.from.clone(), n.words.clone()));
+ !had && !twice
+ });
+ let mut out = Vec::new();
+ if !new.is_empty() {
+ let at = kept.iter().filter_map(|f| place(project, f));
+ let (round, mut last) = at.fold((0, 0), |(r, n), (fr, fnum)| (r.max(fr), n.max(fnum)));
+ let round = round + 1;
+ let folder = project.join("notes").join(round.to_string());
+ std::fs::create_dir_all(&folder).map_err(|e| format!("{}: {e}", folder.display()))?;
+ for n in &new {
+ last += 1;
+ let file = folder.join(format!("n{last}.ts"));
+ std::fs::write(&file, file_text(n, round)).map_err(|e| format!("{}: {e}", file.display()))?;
+ let at = n.at.as_deref().map(|a| format!(" (at {a})")).unwrap_or_default();
+ let redesign = if note::redesign(&n.words) { ", a redesign" } else { "" };
+ out.push(format!("notes/{round}/n{last}.ts: to restate{redesign}: {}{at}", quoted(&n.words, 90)));
+ }
+ out.push(format!("round {round}: {} note{} taken. {RESTATE}", new.len(), if new.len() == 1 { "" } else { "s" }));
+ }
+ // corrections last, so one for a note taken just now finds its file
+ out.extend(apply(project, &files(project), &fixes)?);
+ if out.is_empty() {
+ return Ok(format!("no new notes for {name}: what was sent to it from the raea app ({} inbox file{}) or said is in notes/ already (raea notes ls)", inboxes.len(), if inboxes.len() == 1 { "" } else { "s" }));
+ }
+ Ok(out.join("\n"))
+}
diff --git a/apps/notes/src/tests.rs b/apps/notes/src/tests.rs
new file mode 100644
index 00000000..32222aaa
--- /dev/null
+++ b/apps/notes/src/tests.rs
@@ -0,0 +1,205 @@
+use std::path::Path;
+
+use super::*;
+use crate::take::take_from;
+
+/// A note file's object as JSON, for a test without raea's TS host: its keys quoted and a comma before a close
+/// dropped (the files take writes are in that form).
+fn eval(f: &Path) -> Result<String, String> {
+ let t = std::fs::read_to_string(f).map_err(|e| e.to_string())?;
+ let body = t.split_once("note(").ok_or("no note(")?.1.rsplit_once(");").ok_or("no );")?.0;
+ let line = |l: &str| match l.trim().split_once(':') {
+ Some((k, v)) if !k.is_empty() && k.chars().all(char::is_alphanumeric) => format!("\"{k}\":{v}"),
+ _ => l.trim().to_string(),
+ };
+ Ok(body.lines().map(line).collect::<String>().replace(",}", "}").replace(",]", "]"))
+}
+
+/// A project folder named `shop`, and an inbox folder beside it.
+fn project() -> (tempfile::TempDir, PathBuf, PathBuf) {
+ let tmp = tempfile::tempdir().unwrap();
+ let p = tmp.path().join("shop");
+ std::fs::create_dir_all(p.join(".raea")).unwrap();
+ std::fs::write(p.join(".raea/project"), "").unwrap();
+ let inbox = tmp.path().join("inbox");
+ std::fs::create_dir_all(&inbox).unwrap();
+ (tmp, p, inbox)
+}
+
+fn args(a: &[&str]) -> Vec<String> {
+ a.iter().map(|s| s.to_string()).collect()
+}
+
+const SENT: &str = r#"{"item":"i-show-1","project":"shop","title":"Spring ad","kind":"edits","text":"1. [0:04.5] the lamp","when":"2026-11-10T10:00:00Z","comments":[{"id":"cm-1","text":"I want 2D text with occlusion, not 3D. Think of a lyric video.","kind":"edit","pin":{"kind":"place","x":0.57,"y":0.67,"t":4.5},"at":"0:04.5 · 57%, 67%"},{"id":"cm-2","text":"the \"jug\" isn't visible","kind":"edit"}]}
+{"item":"i-show-9","project":"other","kind":"note","text":"not this project's","when":"2026-11-10T10:01:00Z"}"#;
+
+#[test]
+fn what_the_person_sends_or_says_is_taken_once_as_notes_to_restate() {
+ let (_tmp, p, inbox) = project();
+ std::fs::write(inbox.join("claude-code-1.jsonl"), SENT).unwrap();
+ let out = take_from(&inbox, &p, &args(&["--said", "redo the intro from scratch"])).unwrap();
+ assert!(out.contains("notes/1/n1.ts: to restate: \"I want 2D text with occlusion, not 3D. Think of a lyric video.\" (at 0:04.5 · 57%, 67%)"), "{out}");
+ assert!(out.contains("notes/1/n3.ts: to restate, a redesign: \"redo the intro from scratch\""), "{out}");
+ assert!(out.contains("round 1: 3 notes taken."), "{out}");
+ let notes = read(&p, eval);
+ let n: Vec<&Note> = notes.iter().map(|k| k.note.as_ref().unwrap()).collect();
+ assert_eq!(n[0].words, ["I want 2D text with occlusion, not 3D. Think of a lyric video."]);
+ assert_eq!((n[0].from.as_str(), n[0].round), ("app i-show-1 cm-1", 1));
+ assert_eq!(n[0].pin.as_ref().map(|p| (p.t, p.part.clone())), Some((Some(4.5), None)));
+ assert_eq!(n[1].words, ["the \"jug\" isn't visible"], "words kept as written");
+ assert_eq!((n[2].from.as_str(), n[2].redesign), ("session", Some(true)));
+ assert!(!std::fs::read_to_string(p.join("notes/1/n1.ts")).unwrap().contains("null"), "a pin's missing keys aren't written");
+
+ // taken again: nothing new; a later send is the next round
+ let again = take_from(&inbox, &p, &args(&["--said", "redo the intro from scratch"])).unwrap();
+ assert!(again.starts_with("no new notes for shop"), "{again}");
+ let later = r#"{"item":"i-show-2","project":"shop","kind":"note","text":"hold the end card longer","when":"2026-11-10T11:00:00Z","pin":{"kind":"time","t":28.0}}"#;
+ std::fs::write(inbox.join("claude-code-1.jsonl"), format!("{SENT}\n{later}")).unwrap();
+ let out = take_from(&inbox, &p, &[]).unwrap();
+ assert!(out.starts_with("notes/2/n4.ts: to restate: \"hold the end card longer\""), "{out}");
+}
+
+#[test]
+fn ls_says_where_each_note_stands_and_what_it_owes() {
+ let (_tmp, p, inbox) = project();
+ std::fs::write(inbox.join("a.jsonl"), SENT).unwrap();
+ take_from(&inbox, &p, &[]).unwrap();
+ let (out, code) = ls(&p, false, eval);
+ assert_eq!(code, 0);
+ assert!(out.contains("notes/1/n1.ts: round 1, to restate: \"I want 2D text"), "{out}");
+ assert!(out.ends_with(take::RESTATE), "{out}");
+ assert!(out.contains("2 notes: 2 to restate"), "{out}");
+
+ // restated as one ask with no medium: read again, and its 2D said
+ let f = p.join("notes/1/n1.ts");
+ let t = std::fs::read_to_string(&f).unwrap().replace("asks: [],", "asks: [{ \"text\": \"the lyric is flat type behind the singer\", \"not\": [] }],");
+ std::fs::write(&f, t).unwrap();
+ std::fs::write(p.join("notes/1/n9.ts"), "export default 3;").unwrap();
+ let (out, code) = ls(&p, false, eval);
+ assert_eq!(code, 1, "a note that can't be read");
+ assert!(out.contains("notes/1/n1.ts: round 1, to check: ") && out.contains(" - the lyric is flat type behind the singer"), "{out}");
+ assert!(out.contains(" ! one ask from 2 sentences: read it again for what else it asks"), "{out}");
+ assert!(out.contains(" ! its words say 2D and no ask says it, as its medium or in its `not`") && out.contains(" ! its words say 3D and no ask says it"), "{out}");
+ assert!(out.contains("notes/1/n9.ts: can't be read"), "{out}");
+}
+
+#[test]
+fn notes_are_found_in_round_and_number_order_and_nothing_else_is_one() {
+ let (_tmp, p, _) = project();
+ for f in ["notes/2/n10.ts", "notes/2/n9.ts", "notes/1/n1.ts", "notes/1/check.ts", "notes/x/n2.ts"] {
+ std::fs::create_dir_all(p.join(f).parent().unwrap()).unwrap();
+ std::fs::write(p.join(f), "").unwrap();
+ }
+ let got: Vec<String> = files(&p).iter().map(|f| f.strip_prefix(&p).unwrap().display().to_string()).collect();
+ assert_eq!(got, ["notes/1/n1.ts", "notes/2/n9.ts", "notes/2/n10.ts"]);
+}
+
+#[test]
+fn a_note_is_an_entity_in_the_world() {
+ let (_tmp, p, inbox) = project();
+ std::fs::write(inbox.join("a.jsonl"), SENT).unwrap();
+ take_from(&inbox, &p, &[]).unwrap();
+ let mut w = Facts::new(0, 1920, 1080, 30.0);
+ spawn(&mut w, &read(&p, eval));
+ assert_eq!(w.find(&["Note"]).len(), 2);
+}
+
+/// n1 of SENT restated as two asks that owe nothing.
+fn restate_n1(p: &Path, asks: &str) {
+ let f = p.join("notes/1/n1.ts");
+ let t = std::fs::read_to_string(&f).unwrap();
+ let at = t.find("asks: [").unwrap();
+ let end = at + t[at..].find("],\n").unwrap() + 2;
+ std::fs::write(&f, format!("{}asks: [{asks}],{}", &t[..at], &t[end..])).unwrap();
+}
+
+const TWO: &str = r#"{ "text": "the lyric is flat type the singer passes in front of", "medium": "2D", "not": ["3D text"] }, { "text": "the words arrive as a lyric video's do", "medium": "2D", "not": [] }"#;
+
+#[test]
+fn a_correction_from_the_app_is_written_into_its_note_once_and_it_is_restated_again() {
+ let (_tmp, p, inbox) = project();
+ std::fs::write(inbox.join("a.jsonl"), SENT).unwrap();
+ take_from(&inbox, &p, &[]).unwrap();
+ restate_n1(&p, TWO);
+ assert_eq!(read(&p, eval)[0].note.as_ref().unwrap().state(), "to check");
+
+ let fix = |ask: &str, text: &str, comment: &str| format!(r#"{{"kind":"correction","item":"i-show-1","project":"shop","title":"Spring ad","comment":"{comment}",{ask}"text":"{text}"}}"#);
+ let lines = [SENT.to_string(), fix(r#""ask":2,"#, "no, keep the font as it is", "cm-1"), fix("", "it's about the chorus only", "cm-1"), fix("", "lost", "cm-7")];
+ std::fs::write(inbox.join("a.jsonl"), lines.join("\n")).unwrap();
+ let out = take_from(&inbox, &p, &[]).unwrap();
+ assert!(out.contains("notes/1/n1.ts: the person corrected ask 2: \"no, keep the font as it is\": restate it again"), "{out}");
+ assert!(out.contains("notes/1/n1.ts: the person corrected the note: \"it's about the chorus only\": restate it again"), "{out}");
+ assert!(out.contains("a correction for a note not in notes/ (app i-show-1 cm-7): \"lost\""), "{out}");
+ assert!(!out.contains("no new notes"), "{out}");
+
+ let n = read(&p, eval).remove(0).note.unwrap();
+ assert_eq!(n.words, ["I want 2D text with occlusion, not 3D. Think of a lyric video.", "on ask 2: no, keep the font as it is", "it's about the chorus only"]);
+ assert_eq!(n.corrected, Some(vec![0, 2]));
+ assert_eq!(n.state(), "to restate");
+ assert_eq!(n.asks.len(), 2, "the asks are kept for the agent to restate again");
+
+ // taken again: each correction is in already
+ let again = take_from(&inbox, &p, &[]).unwrap();
+ assert!(!again.contains("corrected"), "{again}");
+ assert_eq!(read(&p, eval).remove(0).note.unwrap().words.len(), 3);
+}
+
+thread_local! {
+ static RAN: std::cell::RefCell<Vec<Vec<String>>> = const { std::cell::RefCell::new(Vec::new()) };
+}
+
+fn ran(a: &[String]) -> R<String> {
+ RAN.with(|r| r.borrow_mut().push(a.to_vec()));
+ Ok("Marked cm-1 working".into())
+}
+
+fn refused(_: &[String]) -> R<String> {
+ Err("the raea app isn't running".into())
+}
+
+#[test]
+fn post_shows_each_restated_note_on_its_comment_once_and_none_still_owing() {
+ let (_tmp, p, inbox) = project();
+ let whole = r#"{"item":"i-show-2","project":"shop","kind":"note","text":"hold the end card longer","when":"2026-11-10T11:00:00Z"}"#;
+ std::fs::write(inbox.join("a.jsonl"), format!("{SENT}\n{whole}")).unwrap();
+ take_from(&inbox, &p, &[]).unwrap();
+
+ let (out, code) = post::post(&p, eval, refused);
+ assert_eq!(code, 0, "nothing restated, nothing run: {out}");
+ assert!(out.contains("notes/1/n1.ts: not posted: it's still to restate"), "{out}");
+ assert!(out.contains("notes/1/n3.ts: a note on its item as a whole has no comment to show its asks on"), "{out}");
+
+ // one ask for two sentences still owes a reading: not posted
+ restate_n1(&p, r#"{ "text": "the lyric is flat type", "medium": "2D", "not": ["3D text"] }"#);
+ let (out, _) = post::post(&p, eval, refused);
+ assert!(out.contains("notes/1/n1.ts: not posted: its restatement still owes: one ask from 2 sentences"), "{out}");
+
+ restate_n1(&p, TWO);
+ let (out, code) = post::post(&p, eval, refused);
+ assert_eq!((code, out.contains("notes/1/n1.ts: not posted: the raea app isn't running")), (1, true), "{out}");
+ let (out, code) = post::post(&p, eval, ran);
+ assert_eq!(code, 0, "{out}");
+ assert!(out.contains("notes/1/n1.ts: its 2 asks shown on cm-1 of i-show-1, where the person can correct one"), "{out}");
+ let want = args(&["show", "--on", "i-show-1", "--working", "cm-1", "--ask", "the lyric is flat type the singer passes in front of", "--ask", "the words arrive as a lyric video's do"]);
+ assert_eq!(RAN.with(|r| r.borrow().clone()), [want]);
+
+ // shown already: not again (a comment settled since isn't marked working again), until its asks change
+ let (out, _) = post::post(&p, eval, ran);
+ assert!(out.contains("notes/1/n1.ts: its asks are shown on cm-1 of i-show-1 already"), "{out}");
+ assert_eq!(RAN.with(|r| r.borrow().len()), 1);
+ restate_n1(&p, &TWO.replace("as a lyric video's do", "one by one on the beat"));
+ post::post(&p, eval, ran);
+ assert_eq!(RAN.with(|r| r.borrow().len()), 2);
+
+ // the person corrects ask 1; restated again in the same words, it's shown again, as the answer to their correction
+ let fix = r#"{"kind":"correction","item":"i-show-1","project":"shop","title":"Spring ad","comment":"cm-1","ask":1,"text":"yes, that"}"#;
+ std::fs::write(inbox.join("a.jsonl"), format!("{SENT}\n{whole}\n{fix}")).unwrap();
+ take_from(&inbox, &p, &[]).unwrap();
+ let f = p.join("notes/1/n1.ts");
+ let (out, _) = post::post(&p, eval, ran);
+ assert!(out.contains("notes/1/n1.ts: not posted: its restatement still owes: the person corrected ask 1"), "{out}");
+ std::fs::write(&f, std::fs::read_to_string(&f).unwrap().replace(" corrected: [1],\n", "")).unwrap();
+ let (out, _) = post::post(&p, eval, ran);
+ assert!(out.contains("notes/1/n1.ts: its 2 asks shown on cm-1"), "{out}");
+ assert_eq!(RAN.with(|r| r.borrow().len()), 3);
+}
diff --git a/core/facts/src/components.rs b/core/facts/src/components.rs
index 28c2b5f8..8e90e17f 100644
--- a/core/facts/src/components.rs
+++ b/core/facts/src/components.rs
@@ -243,7 +243,7 @@ pub fn declarations() -> Vec<String> {
let cfg = Config::default().with_large_int("number");
macro_rules! decls { ($($t:ty),*) => { vec![$(format!("export {}", <$t as TS>::decl(&cfg))),*] }; }
use crate::rendered::*;
- decls!(Source, Medium, Layer, Text, Part, Camera, Shot, Word, Clip, Cue, Line, Contrast, Ocr, Picture, Onset, Covered, Covers, Mix, Rendered, Waits, crate::Level, crate::About, crate::Measure, crate::Finding)
+ decls!(Source, Medium, Layer, Text, Part, Camera, Shot, Word, Clip, Cue, Line, Contrast, Ocr, Picture, Onset, Covered, Covers, Mix, Rendered, Waits, crate::Pin, crate::Proof, crate::Ask, crate::Note, crate::Level, crate::About, crate::Measure, crate::Finding)
}
#[cfg(test)]
diff --git a/core/facts/src/lib.rs b/core/facts/src/lib.rs
index b70c66dc..d11c2b79 100644
--- a/core/facts/src/lib.rs
+++ b/core/facts/src/lib.rs
@@ -23,6 +23,10 @@ pub mod record;
pub mod rule;
pub use rule::Rule;
+// a person's note, its words verbatim and the asks it is restated as (DR5)
+pub mod note;
+pub use note::{Ask, Note, Pin, Proof};
+
/// A JSON value as text: a string as it is, anything else as its JSON (a list key may be a number, a stamp a string).
pub fn text_of(v: &serde_json::Value) -> String {
match v {
diff --git a/core/facts/src/note.rs b/core/facts/src/note.rs
new file mode 100644
index 00000000..4dea67a8
--- /dev/null
+++ b/core/facts/src/note.rs
@@ -0,0 +1,210 @@
+//! A person's note, and the asks it holds once restated (docs/direction.feature DR5). A note is a file in the project,
+//! notes/<round>/<id>.ts, whose default export is `note({...})` (raea/note): the person's words verbatim, where they
+//! came from, where on the work they were left, and the asks the agent restates them as, one for each thing they ask
+//! for. Nothing in the work changes before a note's asks are written. In a world, a note is an entity with a Note.
+
+use serde::{Deserialize, Serialize};
+use serde_json::{Map, Value};
+use ts_rs::TS;
+
+/// Where on the work a note was left: a moment (seconds), a place on the frame (0 to 1 across and down), and the
+/// part there, as the app's pin has them.
+#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize, TS)]
+#[ts(optional_fields)]
+pub struct Pin {
+ pub t: Option<f64>,
+ pub x: Option<f64>,
+ pub y: Option<f64>,
+ pub part: Option<String>,
+}
+
+/// Where an ask that can't be measured is shown, for the person to sign (DR6): a shot or a range of frames.
+#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)]
+#[ts(optional_fields)]
+pub struct Proof {
+ pub shot: Option<String>,
+ pub frames: Option<[i64; 2]>,
+ pub sign: bool,
+}
+
+/// One thing a note asks for, in the agent's words.
+#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)]
+#[ts(optional_fields)]
+pub struct Ask {
+ /// the one thing asked
+ pub text: String,
+ /// the medium the person's words name for it, in their word: "2D", "3D", "flat", "extruded", "real",
+ /// "modelled", "voxel"
+ pub medium: Option<String>,
+ /// what it is about: the part the pin is on (found in the world), or what a check would query
+ pub about: Option<String>,
+ /// what the note does not ask for, so a change keeps it (for a redesign: what is kept)
+ pub not: Vec<String>,
+ /// the craft verb this ask is (skills/skills/raea/craft/verbs): one per ask, not one per note
+ pub verb: Option<String>,
+ /// the check that shows it met (DR6): one of raea's by name, or a .ts check by its path, as a rule names one
+ pub check: Option<String>,
+ /// the values its check is held to
+ #[ts(type = "Record<string, unknown>", optional)]
+ pub values: Option<Map<String, Value>>,
+ /// where it can't be measured: the clip the person signs
+ pub proof: Option<Proof>,
+}
+
+/// A person's note: their words, verbatim (the first line as sent; each later line a correction they made, kept),
+/// where it came from ("app ITEM COMMENT" for a comment sent from the app, "session" for one said in a session), the
+/// round it came in, its pin, whether it asks for a redesign, the asks the person corrected since it was restated (1
+/// is the first, 0 the note as a whole: each restated again, then taken off), and its asks (none yet: to restate).
+#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)]
+#[ts(optional_fields)]
+pub struct Note {
+ pub words: Vec<String>,
+ pub from: String,
+ pub round: u32,
+ pub pin: Option<Pin>,
+ pub redesign: Option<bool>,
+ pub corrected: Option<Vec<u32>>,
+ pub asks: Vec<Ask>,
+}
+
+crate::components::component!(Note);
+
+/// Words that ask for a thing to be made again rather than changed.
+const REDESIGN: [&str; 7] = ["from scratch", "redesign", "not the vibe", "start over", "rethink", "redo", "all over again"];
+
+/// The media a person's words can name, each as said and the forms it is said in.
+const MEDIA: [(&str, &[&str]); 7] = [
+ ("2D", &["2d"]),
+ ("3D", &["3d"]),
+ ("flat", &["flat"]),
+ ("extruded", &["extruded", "extrusion", "extrude"]),
+ ("real", &["real"]),
+ ("modelled", &["modelled", "modeled", "modelling", "modeling"]),
+ ("voxel", &["voxel", "voxels"]),
+];
+
+/// How many sentences `words` holds: ends of sentence (. ! ? ;) and line breaks, between which there is something.
+pub fn sentences(words: &str) -> usize {
+ words.split(['.', '!', '?', ';', '\n']).filter(|s| s.chars().any(char::is_alphanumeric)).count()
+}
+
+/// Whether `words` ask for a redesign.
+pub fn redesign(words: &str) -> bool {
+ let w = words.to_lowercase();
+ REDESIGN.iter().any(|r| w.contains(r))
+}
+
+/// The media `words` name, each as a person would write it ("2D").
+pub fn mediums(words: &str) -> Vec<&'static str> {
+ let said: Vec<String> = words.split(|c: char| !c.is_alphanumeric()).map(str::to_lowercase).collect();
+ MEDIA.iter().filter(|(_, forms)| said.iter().any(|w| forms.contains(&w.as_str()))).map(|(m, _)| *m).collect()
+}
+
+impl Note {
+ /// Where it stands: "to restate" (no asks yet, or the person corrected one), "to check" (an ask has no check and
+ /// no clip to sign: DR6), or "checked".
+ pub fn state(&self) -> &'static str {
+ if self.asks.is_empty() || self.corrected.as_ref().is_some_and(|c| !c.is_empty()) {
+ "to restate"
+ } else if self.asks.iter().any(|a| a.check.is_none() && a.proof.is_none()) {
+ "to check"
+ } else {
+ "checked"
+ }
+ }
+
+ /// What its restatement still owes, once it has asks: a second reading where many sentences gave one ask, what a
+ /// redesign keeps, and each medium its words name that no ask asks for or turns down.
+ pub fn flags(&self) -> Vec<String> {
+ if self.asks.is_empty() {
+ return Vec::new();
+ }
+ // all its words, the correction lines after the first
+ let said = self.words.join("\n");
+ let mut out: Vec<String> = self.corrected.iter().flatten().map(|n| match n {
+ 0 => "the person corrected the note (their line is the last of its words): restate it again, then take 0 off `corrected`".to_string(),
+ n => format!("the person corrected ask {n} (their line is the last of its words): restate it again, then take {n} off `corrected`"),
+ }).collect();
+ // the note as first sent: a correction refines the asks, it isn't more of them
+ let n = sentences(self.words.first().map_or("", String::as_str));
+ if self.asks.len() == 1 && n > 1 {
+ out.push(format!("one ask from {n} sentences: read it again for what else it asks"));
+ }
+ if self.redesign == Some(true) && self.asks.iter().all(|a| a.not.is_empty()) {
+ out.push("it asks for a redesign: say what is kept (an ask's `not`)".into());
+ }
+ // a medium the words name is asked for (an ask's medium) or turned down (in an ask's `not`)
+ let given: Vec<&str> = self.asks.iter().flat_map(|a| a.medium.iter().chain(&a.not)).flat_map(|s| mediums(s)).collect();
+ for m in mediums(&said).into_iter().filter(|m| !given.contains(m)) {
+ out.push(format!("its words say {m} and no ask says it, as its medium or in its `not`"));
+ }
+ out
+ }
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ fn ask(text: &str, medium: Option<&str>, not: &[&str]) -> Ask {
+ Ask { text: text.into(), medium: medium.map(Into::into), about: None, not: not.iter().map(|s| s.to_string()).collect(), verb: None, check: None, values: None, proof: None }
+ }
+
+ fn note(words: &str, asks: Vec<Ask>) -> Note {
+ Note { words: vec![words.into()], from: "session".into(), round: 1, pin: None, redesign: redesign(words).then_some(true), corrected: None, asks }
+ }
+
+ #[test]
+ fn a_corrected_ask_is_restated_again() {
+ let mut n = note("make the title 2D", vec![ask("the title is flat type", Some("2D"), &[])]);
+ n.words.push("on ask 1: and it sits behind the singer".into());
+ n.corrected = Some(vec![1]);
+ assert_eq!(n.state(), "to restate");
+ assert_eq!(n.flags(), ["the person corrected ask 1 (their line is the last of its words): restate it again, then take 1 off `corrected`"]);
+ n.corrected = Some(vec![]);
+ assert_eq!((n.state(), n.flags().len()), ("to check", 0));
+ }
+
+ #[test]
+ fn a_note_is_to_restate_until_it_has_asks_then_to_check_until_each_has_a_check() {
+ let mut n = note("make the title 2D", vec![]);
+ assert_eq!((n.state(), n.flags().len()), ("to restate", 0));
+ n.asks = vec![ask("the title is flat type", Some("2D"), &[])];
+ assert_eq!(n.state(), "to check");
+ n.asks[0].check = Some("text-flat".into());
+ assert_eq!(n.state(), "checked");
+ }
+
+ #[test]
+ fn many_sentences_restated_as_one_ask_are_read_again() {
+ let n = note("The desks face the wall. And why are there kitchen props on them? Make it an office.", vec![ask("turn the desks", None, &[])]);
+ assert_eq!(n.flags(), ["one ask from 3 sentences: read it again for what else it asks"]);
+ let n = note("turn the desks around", vec![ask("turn the desks", None, &[])]);
+ assert!(n.flags().is_empty());
+ }
+
+ #[test]
+ fn the_medium_the_words_name_is_an_asks() {
+ let n = note("i want 2D animated text with occlusion", vec![ask("lyrics behind the singer", None, &[])]);
+ assert_eq!(n.flags(), ["its words say 2D and no ask says it, as its medium or in its `not`"]);
+ let n = note("i want 2D animated text with occlusion", vec![ask("lyrics behind the singer", Some("2D"), &[])]);
+ assert!(n.flags().is_empty());
+ // what the person turns down is said too: in an ask's `not`
+ let n = note("2D animated text, not 3D text extrusion", vec![ask("lyrics behind the singer", Some("2D"), &["3D type"])]);
+ assert_eq!(n.flags(), ["its words say extruded and no ask says it, as its medium or in its `not`"]);
+ let n = note("2D animated text, not 3D text extrusion", vec![ask("lyrics behind the singer", Some("2D"), &["3D type", "extruded letters"])]);
+ assert!(n.flags().is_empty());
+ assert_eq!(mediums("real modeled places, not voxel or 3d text extrusion"), ["3D", "extruded", "real", "modelled", "voxel"]);
+ assert!(mediums("really flatter").is_empty(), "a word that only starts like a medium isn't one");
+ }
+
+ #[test]
+ fn a_redesign_says_what_it_keeps() {
+ let n = note("this isn't the vibe, redo it from scratch", vec![ask("a new look for the room", None, &[])]);
+ assert_eq!(n.redesign, Some(true));
+ assert_eq!(n.flags(), ["it asks for a redesign: say what is kept (an ask's `not`)"]);
+ let n = note("this isn't the vibe, redo it from scratch", vec![ask("a new look for the room", None, &["the camera moves", "the cut"])]);
+ assert!(n.flags().is_empty());
+ assert!(!redesign("move the lamp left"));
+ }
+}
diff --git a/docs/direction.feature b/docs/direction.feature
index 4f85e938..db751a39 100644
--- a/docs/direction.feature
+++ b/docs/direction.feature
@@ -416,8 +416,13 @@ Feature: Direction that holds: one world of facts, findings and rules, so a pers
Scenario: DR5. A note is restated before anything changes
Given the plan
| crate | file | lines | job |
- | raea-core-facts | core/facts/src/note.rs | 200 | Note: words, from, round, pin, asks; Ask: text, medium, about, not, check, proof |
- | raea-app-direction | apps/direction/src/notes.rs | 320 | `raea notes take, ls, check, retire, keep`; a note as an entity in the world |
+ | raea-core-facts | core/facts/src/note.rs | 230 | Note: words, from, round, pin, asks; Ask: text, medium, about, not, check, proof |
+ | raea-app-notes | apps/notes/src/lib.rs | 220 | `raea notes take, ls, post`; the project's notes read; a note as an entity in the world |
+ | raea-app-notes | apps/notes/src/take.rs | 280 | what the app sent and what was said, as note files; the person's corrections written in |
+ | raea-app-notes | apps/notes/src/post.rs | 120 | each restated note's asks posted back on its comment in the app, once |
+ # Fixed in the code (DR5): the notes are a crate of their own, raea-app-notes (apps/notes), not apps/direction
+ # notes.rs. apps/direction is 1,504 of its 2,000 lines with its tests, and DR6 and DR7 add to it; `raea notes
+ # check, retire, keep` come with DR6, DR7 and DR8, in this crate, which apps/direction reads the notes through.
And sdk/raea/src/note.ts (about 90 lines): `note({...})` for notes/<round>/<id>.ts
And notes sent from the app (review.feature R3a: their words, their pin with its frame, place and part), or
said in a session
diff --git a/docs/manual/reference/cli/index.md b/docs/manual/reference/cli/index.md
index 951e5fd9..69aa503c 100644
--- a/docs/manual/reference/cli/index.md
+++ b/docs/manual/reference/cli/index.md
@@ -116,6 +116,7 @@ What an agent reads and shows the person, and the tools raea installs.
| --- | --- |
| [`raea guide`](guide.md) | Print raea's craft guides: the floor read before any edit, the modes, the notes and the 3D guides. |
| [`raea context`](context.md) | Print what to read before working on a project: its taste, brief and look, the floor and its modes' guides. |
+| [`raea notes`](notes.md) | A person's notes as files the work is held to: each taken word for word, then restated as asks before anything changes. |
| [`raea show`](show.md) | Show the person something in the raea app, as an item they can use and answer: stills, a video, a sound, a script, an interactive .tsx or a question. |
| [`raea skill`](skill.md) | Print the agent skill this raea ships, matched to its version, or one of its references. |
| [`raea skills`](skills.md) | Install raea's agent skill where Claude Code, Codex, Kimi or Gemini read skills, with its MCP server and hook. |
diff --git a/docs/manual/reference/cli/notes.md b/docs/manual/reference/cli/notes.md
new file mode 100644
index 00000000..73e779aa
--- /dev/null
+++ b/docs/manual/reference/cli/notes.md
@@ -0,0 +1,68 @@
+---
+title: "raea notes"
+summary: "A person's notes as files the work is held to: each taken word for word, then restated as asks before anything changes."
+order: 124
+sources: ["apps/notes/src/lib.rs", "apps/notes/src/take.rs", "apps/notes/src/post.rs", "core/facts/src/note.rs", "sdk/raea/src/note.ts"]
+---
+
+A note can hold several things, and a note that is only patched gets one of them answered. `raea notes take` writes
+each note the person sent from the raea app (each edit comment, with where it was pinned) or said in a session
+(`--said`) to a file in the project, `notes/ROUND/ID.ts`, with their words exactly as written and no asks yet.
+Everything taken at once is one round, and a note already taken isn't taken again.
+
+Before anything in the work changes, each note is restated as its asks: one for each separate thing it asks for, the
+medium where its words name one (2D, 3D, flat, extruded, real, modelled, voxel), what it is about, and what it doesn't
+ask for (`not`), so a change keeps the rest. A note that asks for a redesign is marked so in its file, and its asks say
+what is kept.
+
+```sh
+raea notes take
+raea notes take --said "hold the end card a second longer"
+raea notes ls
+raea notes post
+```
+
+```ts
+// notes/1/n1.ts
+import { note } from "raea/note";
+
+export default note({
+ words: ["I want 2D animated text with occlusion, not 3D text extrusion. Think of how a lyric video would be."],
+ from: "app i-show-mw9k-2 cm-4",
+ round: 1,
+ pin: { t: 12.4, x: 0.52, y: 0.31 },
+ asks: [
+ { text: "each lyric line is flat type, masked by the singer where they meet", medium: "2D", about: "lyric", not: ["the camera"] },
+ { text: "each lyric arrives word by word on its sung time", medium: "2D", about: "lyric", not: ["the font"] },
+ ],
+});
+```
+
+`raea notes ls` says where each note stands (to restate; then to check, until each ask has a check that holds it)
+and what its restatement still owes: a second reading where several sentences became one ask, a medium its words name
+that no ask asks for or turns down, and what a redesign keeps. It exits 1 when a note's file can't be read.
+
+`raea notes post` shows each restated note's asks back on its comment in the raea app, before the work starts, and
+posts none whose restatement still owes something. The person reads them there and can correct one in a word. The
+next `raea notes take` writes their correction into the note as a new line of its words, kept, and lists the ask it
+corrected in `corrected`, so the note is to restate again until that ask is restated and taken off the list.
+
+<!-- generated:begin by tools/manual-ref/cli.ts from `raea help --json`; edit only the flag descriptions -->
+
+## Usage
+
+```sh
+raea notes take [PROJECT] [--inbox NAME] [--said WORDS]... | raea notes ls [PROJECT] [--json] | raea notes post [PROJECT] (a person's notes as files the work is held to: take writes each note sent from the raea app or said in a session to notes/ROUND/ID.ts, the words verbatim, to be restated as asks before anything changes, and writes in each correction the person made to a restatement; ls says where each note stands, to restate or to check, and what its restatement still owes; post shows each restated note's asks on its comment in the raea app, for the person to correct)
+```
+
+Needs the raea app's host running on this machine (to show post's asks on the person's comments; take and ls run headless). Takes up to 2 arguments besides its flags.
+
+## Flags
+
+| Flag | Takes | What it does |
+| --- | --- | --- |
+| `--inbox` | `NAME` | With `take`: read only this inbox, `~/.raea/inbox/NAME.jsonl` (`RAEA_INBOX_DIR` moves the folder); every inbox when left out. |
+| `--json` | – | With `ls`: each note as JSON, with its file, its state and what its restatement still owes. |
+| `--said` | `WORDS` | With `take`: a note the person said in this session, taken as written; give it once per note. |
+
+<!-- generated:end -->
diff --git a/docs/manual/reference/cli/setup.md b/docs/manual/reference/cli/setup.md
index ac99a9d2..f5da09d9 100644
--- a/docs/manual/reference/cli/setup.md
+++ b/docs/manual/reference/cli/setup.md
@@ -1,7 +1,7 @@
---
title: "raea setup"
summary: "Find Blender, or download its current LTS, and install its MCP add-on."
-order: 127
+order: 128
sources: ["apps/tools/src/blender.rs"]
---
diff --git a/docs/manual/reference/cli/show.md b/docs/manual/reference/cli/show.md
index 3863a9b3..999557b4 100644
--- a/docs/manual/reference/cli/show.md
+++ b/docs/manual/reference/cli/show.md
@@ -1,7 +1,7 @@
---
title: "raea show"
summary: "Show the person something in the raea app, as an item they can use and answer: stills, a video, a sound, a script, an interactive .tsx or a question."
-order: 124
+order: 125
sources: ["engine/cli/src/show.ts"]
---
@@ -22,6 +22,8 @@ or a browser.
The person's edit comments are tasks they watch. The inbox line that carries them gives each one's id; `--on ITEM
--working ID` marks one as being worked (with `--sub NAME` when a subagent has it), and `--done ID` marks it settled,
or, with files and `--replaces`, settled by that version. Done stays in view, checked, until the person resolves it.
+Each `--ask` with `--working` is one ask you read the comment as, shown on it so the person can correct your reading
+before the work starts; `raea notes post` sends a restated note's asks this way.
```sh
raea show out/look-1.png out/look-2.png out/look-3.png --ask "Which of these three?"
@@ -38,7 +40,7 @@ raea show out/cut-v2.mp4 --replaces i-show-2f9c --done c-3 --done c-4 --note "Wa
## Usage
```sh
-raea show FILE... [--title T] [--ask LINE] [--project P] [--replaces ITEM] [--as NAME] [--role ROLE] [--inbox NAME] [--open] | raea show --question Q --choice A --choice B [STILL...] | raea show [--title T] --question Q [--preview FILE] --choice A [--preview FILE] --choice B ... [--question Q2] ... | raea show --on ITEM [--working ID] [--done ID] [--note LINE] [--sub NAME] (shown in the raea app as an item the person can use and answer, posted quietly with a notice, the window left where they are unless --open: stills (several, a storyboard), a video, a sound, a NAME.script.ts or .md, a .tsx (an interactive artifact; a project's composition opens in its editor), or questions, all of them one item, each question and choice with a --preview to play or read while answering (a still, a video, a sound, a script or .md; after a --choice that choice's, else the question's); what they send comes to ~/.raea/inbox/INBOX.jsonl; their edit comments are tasks: --working ID as you start one, --done ID when it's settled, or with the version that settles it, FILE --replaces ITEM --done ID; never open media in Preview while the app is installed)
+raea show FILE... [--title T] [--ask LINE] [--project P] [--replaces ITEM] [--as NAME] [--role ROLE] [--inbox NAME] [--open] | raea show --question Q --choice A --choice B [STILL...] | raea show [--title T] --question Q [--preview FILE] --choice A [--preview FILE] --choice B ... [--question Q2] ... | raea show --on ITEM [--working ID] [--ask TEXT] [--done ID] [--note LINE] [--sub NAME] (shown in the raea app as an item the person can use and answer, posted quietly with a notice, the window left where they are unless --open: stills (several, a storyboard), a video, a sound, a NAME.script.ts or .md, a .tsx (an interactive artifact; a project's composition opens in its editor), or questions, all of them one item, each question and choice with a --preview to play or read while answering (a still, a video, a sound, a script or .md; after a --choice that choice's, else the question's); what they send comes to ~/.raea/inbox/INBOX.jsonl; their edit comments are tasks: --working ID as you start one (each --ask with it one ask you read it as, for the person to correct), --done ID when it's settled, or with the version that settles it, FILE --replaces ITEM --done ID; never open media in Preview while the app is installed)
```
Needs the raea app's host running on this machine; then waits for a person's click in the raea app (to answer). Takes any number of arguments besides its flags.
@@ -48,7 +50,7 @@ Needs the raea app's host running on this machine; then waits for a person's cli
| Flag | Takes | What it does |
| --- | --- | --- |
| `--as` | `NAME` | Who's showing it, as the feed names them (your harness's name when left out: Claude Code, Codex, Gemini). |
-| `--ask` | `LINE` | What you want from the person, shown with the item. |
+| `--ask` | `LINE` | What you want from the person, shown with the item. With `--on` and `--working`: one ask you read the comment as (give it once per ask), shown on the comment for the person to correct. |
| `--choice` | `A` | With `--question`: one answer to pick; give it once per answer. Stills given instead are the choices. |
| `--done` | `ID` | Marks the person's edit comment done (give it once per comment), on the item named by `--on`, or with files on the item they `--replaces`. |
| `--inbox` | `NAME` | The inbox the answers go to, `~/.raea/inbox/NAME.jsonl` (one per session when left out). |
diff --git a/docs/manual/reference/cli/skill.md b/docs/manual/reference/cli/skill.md
index d8d4a2b2..de88ce6c 100644
--- a/docs/manual/reference/cli/skill.md
+++ b/docs/manual/reference/cli/skill.md
@@ -1,7 +1,7 @@
---
title: "raea skill"
summary: "Print the agent skill this raea ships, matched to its version, or one of its references."
-order: 125
+order: 126
sources: ["engine/cli/src/skill.rs"]
---
diff --git a/docs/manual/reference/cli/skills.md b/docs/manual/reference/cli/skills.md
index 8bf00dbf..d3b5c407 100644
--- a/docs/manual/reference/cli/skills.md
+++ b/docs/manual/reference/cli/skills.md
@@ -1,7 +1,7 @@
---
title: "raea skills"
summary: "Install raea's agent skill where Claude Code, Codex, Kimi or Gemini read skills, with its MCP server and hook."
-order: 126
+order: 127
sources: ["engine/cli/src/skill.rs"]
---
diff --git a/docs/manual/reference/sdk/check.md b/docs/manual/reference/sdk/check.md
index ed5e1814..bff984df 100644
--- a/docs/manual/reference/sdk/check.md
+++ b/docs/manual/reference/sdk/check.md
@@ -37,7 +37,7 @@ export default check({ id: "caption", text: "a caption clears the platform's but
import { check, declared, found, runChecks } from "raea/check"
```
-`raea/check` exports 5 functions, 1 class, 32 types. Source: [sdk/raea/src/check.ts](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/src/check.ts).
+`raea/check` exports 5 functions, 1 class, 36 types. Source: [sdk/raea/src/check.ts](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/src/check.ts).
## Functions
@@ -128,6 +128,12 @@ A world of entities: rows in tables by kind.
type About = { name: string, key?: string, }
```
+### `Ask`
+
+```ts
+type Ask = { /** * the one thing asked */ text: string, /** * the medium the person's words name for it, in their word: "2D", "3D", "flat", "extruded", "real", * "modelled", "voxel" */ medium?: string, /** * what it is about: the part the pin is on (found in the world), or what a check would query */ about?…
+```
+
### `Camera`
```ts
@@ -272,6 +278,12 @@ type Medium = "2d-type" | "2d-graphic" | "3d" | "footage" | "page"
type Mix = { lufs?: number, peak?: number, }
```
+### `Note`
+
+```ts
+type Note = { words: Array<string>, from: string, round: number, pin?: Pin, redesign?: boolean, corrected?: Array<number>, asks: Array<Ask>, }
+```
+
### `Ocr`
```ts
@@ -296,6 +308,12 @@ type Part = { /** * what draws it: "mesh", "model", "text3d" ... */ kind: string
type Picture = { luma: number, motion?: number, frames?: number, }
```
+### `Pin`
+
+```ts
+type Pin = { t?: number, x?: number, y?: number, part?: string, }
+```
+
### `Planned`
Which check runs on which frames with which values, as raea check plans it from a rule: the rule's level (none:
@@ -309,6 +327,12 @@ the check's own) and where the rule was written.
| `level` | `Level \| null` | the rule's level, which its findings take where they don't say their own |
| `by` | `string` | where the rule was written, which its findings carry |
+### `Proof`
+
+```ts
+type Proof = { shot?: string, frames?: [number, number], sign: boolean, }
+```
+
### `Rendered`
```ts
diff --git a/docs/manual/reference/sdk/index.md b/docs/manual/reference/sdk/index.md
index 5c5aeed5..847b2129 100644
--- a/docs/manual/reference/sdk/index.md
+++ b/docs/manual/reference/sdk/index.md
@@ -27,13 +27,14 @@ mirrors a Bevy type and has no comment of its own, the page shows Bevy's doc for
## Start here
-The composition, the app and the specs an agent writes.
+The composition, the app, and the specs and notes an agent writes.
| Import | What it's for | Exports |
| --- | --- | --- |
| [`raea`](raea.md) | The main entry: compositions, sequences, time, interpolation, springs, footage, sound and words. | 18 components, 8 hooks, 52 functions, 8 values, 91 types |
| [`raea/app`](app.md) | The App, its plugins and schedules, and the registry a video's compositions are kept in. | 1 component, 4 functions, 3 classes, 17 values, 8 types |
| [`raea/brief`](brief.md) | The specs an agent writes as data: brief, script, taste, plan and controller, checked against raea's schemas. | 5 functions, 28 types |
+| [`raea/note`](note.md) | A person's note as a file in the project: their words kept as written, and the asks the agent restates it as. | 1 function, 4 types |
## Time and motion
@@ -92,7 +93,7 @@ Checks, lints and a headless App you can drive.
| Import | What it's for | Exports |
| --- | --- | --- |
-| [`raea/check`](check.md) | A check written as a system over a composition's world: what `raea check` runs for a rule a controller holds. | 5 functions, 1 class, 32 types |
+| [`raea/check`](check.md) | A check written as a system over a composition's world: what `raea check` runs for a rule a controller holds. | 5 functions, 1 class, 36 types |
| [`raea/dev_tools`](dev_tools.md) | Checks and lints you can run from code: a motion performance's lint report. | 2 functions, 3 types |
| [`raea/remote`](remote.md) | A headless Bevy App you open, step and query from TypeScript, through Bevy's remote protocol. | 1 class, 1 type |
diff --git a/docs/manual/reference/sdk/note.md b/docs/manual/reference/sdk/note.md
new file mode 100644
index 00000000..5dac644a
--- /dev/null
+++ b/docs/manual/reference/sdk/note.md
@@ -0,0 +1,79 @@
+---
+title: "raea/note"
+summary: "A person's note as a file in the project: their words kept as written, and the asks the agent restates it as."
+order: 5
+sources: ["sdk/raea/src/note.ts", "core/facts/src/note.rs"]
+---
+
+A note is a TypeScript module under `notes/<round>/<id>.ts` whose default export is data. [`raea notes
+take`](../cli/notes.md) writes one for each note the person sends from the raea app (an edit comment, with where it
+was pinned) or says in a session: their words as written, where they came from, and no asks yet. Before anything in
+the work changes, the agent restates it as its asks: one for each separate thing it asks for, the medium where the
+words name one, what it is about, and what it doesn't ask for (`not`), so a change keeps the rest. Each ask is one
+move (`verb`). A correction the person makes in the app is a new line of `words`, kept, with its ask in `corrected`
+until it is restated. The types are generated from the Rust raea reads notes with, so what TypeScript accepts is what
+raea accepts.
+
+```ts
+// notes/1/n3.ts
+import { note } from "raea/note";
+
+export default note({
+ words: ["I want 2D animated text with occlusion, not 3D text extrusion. Think of how a lyric video would be."],
+ from: "app i-show-mw9k-2 cm-4",
+ round: 1,
+ pin: { t: 12.4, x: 0.52, y: 0.31, part: "lyric" },
+ asks: [
+ { text: "each lyric line is flat type, masked by the singer where they meet", medium: "2D", about: "lyric",
+ not: ["the camera", "the timing of the lines"], verb: "layout" },
+ { text: "every lyric arrives word by word on its sung time, as a lyric video's do", medium: "2D", about: "lyric",
+ not: ["the font"], verb: "animate" },
+ ],
+});
+```
+
+<!-- generated:begin by tools/manual-ref/sdk.ts from the SDK's exports and doc comments; edit outside this block -->
+
+```ts
+import { note } from "raea/note"
+```
+
+`raea/note` exports 1 function, 4 types. Source: [sdk/raea/src/note.ts](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/src/note.ts).
+
+## Functions
+
+### `note`
+
+A note as written: its words and where they came from are `raea notes take`'s, its asks the agent's.
+
+```ts
+function note(n: Note): Note
+```
+
+## Types
+
+### `Ask`
+
+```ts
+type Ask = { /** * the one thing asked */ text: string, /** * the medium the person's words name for it, in their word: "2D", "3D", "flat", "extruded", "real", * "modelled", "voxel" */ medium?: string, /** * what it is about: the part the pin is on (found in the world), or what a check would query */ about?…
+```
+
+### `Note`
+
+```ts
+type Note = { words: Array<string>, from: string, round: number, pin?: Pin, redesign?: boolean, corrected?: Array<number>, asks: Array<Ask>, }
+```
+
+### `Pin`
+
+```ts
+type Pin = { t?: number, x?: number, y?: number, part?: string, }
+```
+
+### `Proof`
+
+```ts
+type Proof = { shot?: string, frames?: [number, number], sign: boolean, }
+```
+
+<!-- generated:end -->
diff --git a/engine/cli/Cargo.toml b/engine/cli/Cargo.toml
index 7bd0bda9..daf35517 100644
--- a/engine/cli/Cargo.toml
+++ b/engine/cli/Cargo.toml
@@ -51,6 +51,8 @@ regex = "1"
# the app crates' verbs: `raea check`, `raea ci`, and the local tools' (sao, tokensynth, setup-audio, sounds, splat)
raea-app-check = { path = "../../apps/check" }
raea-app-direction = { path = "../../apps/direction" }
+# `raea notes`: a person's notes as files the work is held to (docs/direction.feature DR5)
+raea-app-notes = { path = "../../apps/notes" }
raea-app-sound = { path = "../../apps/sound" }
raea-app-ci = { path = "../../apps/ci" }
raea-app-tools = { path = "../../apps/tools" }
diff --git a/engine/cli/conformance/surface.test.ts b/engine/cli/conformance/surface.test.ts
index bae7d54e..86982fc2 100644
--- a/engine/cli/conformance/surface.test.ts
+++ b/engine/cli/conformance/surface.test.ts
@@ -26,7 +26,7 @@ const checkout = ownCheckout && existsSync(join(ownCheckout, "engine/cli/src/cli
* later). Another lane's uncommitted edit counts from the commit alone, so it can't fail this check, and a file HEAD
* doesn't have doesn't count. Undefined without git history (an L1 export uses the binary's own checkout) */
const rustIn = (dir: string) => readdirSync(join(checkout, dir), { recursive: true }).map(String).filter((f) => f.endsWith(".rs")).map((f) => `${dir}/${f}`);
-const helpSources = ["runtime/react/src/scene.rs", ...rustIn("runtime/react/src/scene"), ...rustIn("engine/cli/src"), ...rustIn("apps/check/src"), ...rustIn("apps/game/src"), ...rustIn("apps/tools/src")];
+const helpSources = ["runtime/react/src/scene.rs", ...rustIn("runtime/react/src/scene"), ...rustIn("engine/cli/src"), ...rustIn("apps/check/src"), ...rustIn("apps/game/src"), ...rustIn("apps/tools/src"), ...rustIn("apps/notes/src")];
const git = (...a: string[]) => spawnSync("git", ["-C", checkout, ...a], { encoding: "utf8" });
const committed = git("rev-parse", "-q", "--verify", "HEAD").status !== 0 ? undefined : Math.max(0, ...helpSources.map((f) => {
if (git("cat-file", "-e", `HEAD:${f}`).status !== 0) return 0;
diff --git a/engine/cli/src/cli.rs b/engine/cli/src/cli.rs
index 6cc68efe..c262c21f 100644
--- a/engine/cli/src/cli.rs
+++ b/engine/cli/src/cli.rs
@@ -127,11 +127,11 @@ pub fn run(args: &[String]) -> R<String> {
IN_HELP.set(was);
// `raea library` (engine/cli/src/library.ts) and `raea show` (show.ts: in the raea app, not Preview, Shane 11-09), under render's usage
let usage = format!("{usage}\n raea library [new NAME [--cloud] | add LIBRARY PATH | files LIBRARY | tag SHA TAGS | status | scan ...] | raea library search \"WORDS\" [--library LIBRARY] [--kind KIND] [--limit N] [--sound] (the person's libraries in the raea app: folders and drives indexed on this machine, searched by meaning; a folder an agent adds waits for the person's yes)");
- let usage = format!("{usage}\n raea show FILE... [--title T] [--ask LINE] [--project P] [--replaces ITEM] [--as NAME] [--role ROLE] [--inbox NAME] [--open] | raea show --question Q --choice A --choice B [STILL...] | raea show [--title T] --question Q [--preview FILE] --choice A [--preview FILE] --choice B ... [--question Q2] ... | raea show --on ITEM [--working ID] [--done ID] [--note LINE] [--sub NAME] (shown in the raea app as an item the person can use and answer, posted quietly with a notice, the window left where they are unless --open: stills (several, a storyboard), a video, a sound, a NAME.script.ts or .md, a .tsx (an interactive artifact; a project's composition opens in its editor), or questions, all of them one item, each question and choice with a --preview to play or read while answering (a still, a video, a sound, a script or .md; after a --choice that choice's, else the question's); what they send comes to ~/.raea/inbox/INBOX.jsonl; their edit comments are tasks: --working ID as you start one, --done ID when it's settled, or with the version that settles it, FILE --replaces ITEM --done ID; never open media in Preview while the app is installed)");
+ let usage = format!("{usage}\n raea show FILE... [--title T] [--ask LINE] [--project P] [--replaces ITEM] [--as NAME] [--role ROLE] [--inbox NAME] [--open] | raea show --question Q --choice A --choice B [STILL...] | raea show [--title T] --question Q [--preview FILE] --choice A [--preview FILE] --choice B ... [--question Q2] ... | raea show --on ITEM [--working ID] [--ask TEXT] [--done ID] [--note LINE] [--sub NAME] (shown in the raea app as an item the person can use and answer, posted quietly with a notice, the window left where they are unless --open: stills (several, a storyboard), a video, a sound, a NAME.script.ts or .md, a .tsx (an interactive artifact; a project's composition opens in its editor), or questions, all of them one item, each question and choice with a --preview to play or read while answering (a still, a video, a sound, a script or .md; after a --choice that choice's, else the question's); what they send comes to ~/.raea/inbox/INBOX.jsonl; their edit comments are tasks: --working ID as you start one (each --ask with it one ask you read it as, for the person to correct), --done ID when it's settled, or with the version that settles it, FILE --replaces ITEM --done ID; never open media in Preview while the app is installed)");
// a workspace's files and specs (docs/projects.feature), listed under render's usage like library
let usage = format!("{usage}\n raea spec FILE.ts [--as brief|script|taste|plan|controller] (a spec's default export as JSON, checked against its schema: brief.ts, script.ts, taste.ts, plan.ts, controllers/ID.ts)\n raea workspace init [NAME] [--layout LAYOUT] | raea workspace adopt DIR [--name NAME] | raea workspace [--json] (a workspace: a git repo of projects and controllers under raea.root, ~/Documents/raea unless git config says)\n raea project new NAME [--storage inline|submodule] | raea project split NAME [--remote URL] | raea project join NAME | raea project [--json] (a project in the workspace: its folder, brief.ts, media/, out/; split and join keep its history)\n raea controller ls [--json] | raea controller get PATH [--json] | raea controller set PATH VALUE [--project] [--by NAME] | raea controller write FILE.ts [--by NAME] | raea controller rm ID [--by NAME] (the workspace's controllers, controllers/ID.ts; PATH is controller.group.field; every change a commit)\n raea check EDIT.tsx --quick [--shape S] [--platform P] [--taste T] [-o check.json] (three stills of a composition checked for text: clipped, cramped, safe areas, sizes; about a second)\n raea hook [claude|codex|gemini|kimi] (every agent's tool hooks, which raea skills install adds: before a shell command, media opened in the Mac's viewer while the raea app is installed is stopped once for raea show (the same command again goes through); after a save, the quick check on a composition)\n raea next [DIR] (the two or three useful next steps for the project, from its brief, compositions, renders and checks)\n raea doctor [--fix] [DIR] (what doesn't match this raea: old brief files, an older workspace format, an agent's skill from another version)\n raea app run|check|bundle APP.tsx [--target web|native] [--size WxH] [--script steps.json] [--png DIR] [-o App.app] (a TSX app on @raea/ui: its window, the headless check, a Mac app; web is Blitz on Bevy, native is Rune; the app's `export const app` sets the target, web when it doesn't; raea rune ... is --target native)\n {}\n {}", skill::USAGE, tools::blender::USAGE);
let (export_game, scene, physics, splat) = (raea_app_game::USAGE, export::SCENE_USAGE, motion::physics::USAGE, tools::splat::USAGE);
- let apps = format!(" {}\n {}\n {}\n {}\n {}\n {}\n", raea_app_direction::check::USAGE, raea_app_check::USAGE, raea_app_solid::USAGE, raea_app_judge::USAGE, raea_app_direction::USAGE, raea_app_direction::findings::USAGE);
+ let apps = format!(" {}\n {}\n {}\n {}\n {}\n {}\n {}\n", raea_app_direction::check::USAGE, raea_app_check::USAGE, raea_app_solid::USAGE, raea_app_judge::USAGE, raea_app_direction::USAGE, raea_app_direction::findings::USAGE, raea_app_notes::USAGE);
return Ok(format!("raea: renders, plays and checks raea compositions (React and TypeScript) on the GPU.\n\nusage: {usage}\n raea init (a project's files where they're missing: edit.tsx, cuts.ts, components/, AGENTS.md)\n raea cut TAKE \"line\" ... | --at A-B ... [--append] (cuts.ts and words.json: a take under media/ cut in the pauses around each line it says, transcribed first if it has no TAKE.words.json; or at those seconds)\n raea frame TAKE [--at S] (how a take fits the edit: a talking take for <FaceFrame>, a screen for <ScreenFit>, from where its face is)\n raea part list | raea part add NAME ... [--force] (a ready part copied into components/, yours to change)\n raea brand DOMAIN|URL (the brand kit read from its website on this machine: brand/brand.css, brand/brand.json, BRAND.md, logos in media/brand; says when a plain fetch saw too little)\n raea guide [NAME] (craft, the floor read before any edit; the modes: pitch, explain, story, play, tool; motion, music, layout and the rest; bevy and bevy/NAME for 3D)\n raea context PROJECT (what to read before working on a project: taste, brief, look, the floor and its modes' guides)\n{apps} raea play EDIT.tsx [--input | --input-script KEYS.json] [--size WxH] [--seconds N|end] (a game, live; also: --input-log FILE --offscreen --snapshot T FILE --json FILE --seek F FILE --pick X,Y --view YAW,PITCH,DISTANCE --scrub N --baked --autoplay --no-vsync --master --3d)\n {export_game} (a game as a program of its own: a Mac app or a command)\n {scene} (what each 3D part rests on: floating, sunk and clipping parts; light: the scene's lighting)\n {physics} (the bakes <Physics> and <Goo> make)\n {splat} (footage trained into a Gaussian splat for <Splat>; setup installs its tools)\n raea run SCRIPT.ts (a TypeScript program on the engine, headless: its default export is called, what it prints is the answer; a check like a room's checkLayout; also: --timeout S)\n raea gen image|video|music|sfx|speech|mesh|text \"PROMPT\" | gen plan|run FLOW.ts|FLOW.json | gen comfy import|export|run|schema FILE | gen models | gen balance (generated media through made.app, fal, Replicate, OpenRouter, Modal or ComfyUI; ComfyUI workflows both ways: raea gen alone lists its flags)\n {neural_usage} (DLSS 5 neural rendering on a `render --aov` folder, with its motion and depth: your own MLX-DLSS build and weights, RAEA_MLXDLSS and RAEA_DLSS_MODEL)\n raea mezz [--check] PATH... (an intra-only ProRes copy of each long-GOP source over 1080p, for smooth scrubbing; --check says which would get one)\n raea traces [show [N|last|DIR]] (the sessions raea left, newest first: how each ended, its glitches; show tells one in full)"));
}
// `--version`: the release's version, which a skill's front matter names (docs/skills.feature SK6)
@@ -209,6 +209,7 @@ pub fn run(args: &[String]) -> R<String> {
}
if args[0] == "world" { std::process::exit(raea_app_direction::cli(&args[1..])); } // a frame as one world of facts (docs/direction.feature DR1)
if args[0] == "findings" { return raea_app_direction::findings::cli(args); } // the project's record read back (DR3)
+ if args[0] == "notes" { std::process::exit(raea_app_notes::cli(&args[1..], spec::spec_json)); } // a person's notes as files, restated as asks (DR5)
if args[0] == "traces" { return traces(args); }
if args.first().map(String::as_str) == Some("play") {
return raea_app_play::play(args);
diff --git a/engine/cli/src/show.ts b/engine/cli/src/show.ts
index 50c5d4a6..1d3338b4 100644
--- a/engine/cli/src/show.ts
+++ b/engine/cli/src/show.ts
@@ -24,10 +24,11 @@ raea show [--title T] --question Q1 [--preview FILE] --choice A [--preview FILE]
FILE: stills (several make a storyboard), a video, a sound, a NAME.script.ts or .md, or a .tsx (an interactive
artifact; one of the project's compositions opens in its editor). P: the project's id, title or Workspace/project;
else the one this folder is in. Who's showing it: --as NAME [--role ROLE] [--inbox NAME], else your harness's.
-raea show --on ITEM --working ID... | --done ID... [--note LINE] [--sub NAME]
+raea show --on ITEM --working ID... [--ask TEXT]... | --done ID... [--note LINE] [--sub NAME]
raea show FILE... --replaces ITEM --done ID...
The person's edit comments are tasks they watch: mark each working as you start it and done when it's settled
- (the version that settles them, with --replaces); --sub names a subagent when several split them.
+ (the version that settles them, with --replaces); --sub names a subagent when several split them. With --working,
+ each --ask is one ask you read the comment as, shown on it for the person to correct (raea notes post).
`;
const WITH_VALUE = new Set(["--title", "--ask", "--project", "--replaces", "--as", "--role", "--inbox", "--question", "--choice", "--preview", "--on", "--working", "--done", "--note", "--sub"]);
@@ -86,7 +87,7 @@ export function parseShow(args: string[], cwd: string) {
// several questions, or any preview: one item with them all (host/show.ts questions); else the one question as before
const questions = asked.length > 1 || asked.some((q) => q.preview || q.choices.some((c) => c.preview)) ? asked : undefined;
if (questions && files.length) throw new Error(`with several questions or previews, each file is a --preview of the question or choice it shows\n${SHOW_USAGE}`);
- return { files, choices, questions, open: args.includes("--open"), title: one("--title"), ask: one("--ask"), project: one("--project"), replaces: one("--replaces"), question: questions ? undefined : one("--question"), as: one("--as"), role: one("--role"), inbox: one("--inbox"), on: one("--on"), working: many("--working"), done: many("--done"), note: one("--note"), sub: one("--sub") };
+ return { files, choices, questions, open: args.includes("--open"), title: one("--title"), ask: one("--ask"), asks: many("--ask"), project: one("--project"), replaces: one("--replaces"), question: questions ? undefined : one("--question"), as: one("--as"), role: one("--role"), inbox: one("--inbox"), on: one("--on"), working: many("--working"), done: many("--done"), note: one("--note"), sub: one("--sub") };
}
export function showVerb(ask: Ask, args: string[], cwd: string, env: Record<string, string | undefined>): string {
@@ -101,9 +102,10 @@ export function showVerb(ask: Ask, args: string[], cwd: string, env: Record<stri
};
const by = posterOf(env, a.as, a.role, a.inbox, cwd, a.as && a.inbox ? undefined : parent());
// the person's edit comments as tasks (docs/review.feature R3): marked working or done on their item, or done by
- // the version shown with --replaces
+ // the version shown with --replaces; a working mark carries the asks the agent read the comments as (DR5), for the
+ // person to correct
const mark = (item: string, comments: string[], state: "working" | "done", version?: string) =>
- ask("task", { item, comments, state, by, sub: a.sub, note: state === "done" ? a.note : undefined, version }) as { item: string; comments: string[] };
+ ask("task", { item, comments, state, by, sub: a.sub, note: state === "done" ? a.note : undefined, asks: state === "working" && a.asks.length ? a.asks : undefined, version }) as { item: string; comments: string[] };
const said = (m: { item: string; comments: string[] }, state: string) => `Marked ${m.comments.join(", ")} ${state} on ${m.item}: the person sees ${a.sub ? `${by.name} · ${a.sub}` : by.name} ${state === "working" ? "on them" : "finished them"}.`;
if (!a.files.length && !a.question && !a.questions && (a.working.length || a.done.length)) {
const item = a.on ?? a.replaces;
diff --git a/engine/cli/src/tests.rs b/engine/cli/src/tests.rs
index f40668ed..febfd4dc 100644
--- a/engine/cli/src/tests.rs
+++ b/engine/cli/src/tests.rs
@@ -32,7 +32,7 @@ fn help_lists_every_verb() {
let listed = |v: &str| [format!("raea {v} "), format!("raea {v}\n"), format!("| {v} ")].iter().any(|l| help.contains(l.as_str()));
let missing: Vec<_> = verbs.iter().filter(|v| !listed(v) && !unlisted.contains(&v.as_str())).collect();
assert!(missing.is_empty(), "not in raea help: {missing:?}");
- for usage in [raea_app_check::USAGE, raea_app_direction::check::USAGE, raea_app_direction::USAGE, raea_app_game::USAGE, raea_runtime_export::SCENE_USAGE, motion::physics::USAGE, tools::splat::USAGE, tools::sound::SAO_USAGE, tools::sound::TOKENSYNTH_USAGE, tools::song::USAGE, motion::track::USAGE, raea_app_solid::USAGE, raea_app_judge::USAGE, tools::blender::USAGE] {
+ for usage in [raea_app_check::USAGE, raea_app_direction::check::USAGE, raea_app_direction::USAGE, raea_app_notes::USAGE, raea_app_game::USAGE, raea_runtime_export::SCENE_USAGE, motion::physics::USAGE, tools::splat::USAGE, tools::sound::SAO_USAGE, tools::sound::TOKENSYNTH_USAGE, tools::song::USAGE, motion::track::USAGE, raea_app_solid::USAGE, raea_app_judge::USAGE, tools::blender::USAGE] {
assert!(help.contains(usage), "{usage}");
}
}
diff --git a/engine/cli/src/usage.rs b/engine/cli/src/usage.rs
index f031e3c8..f97d940d 100644
--- a/engine/cli/src/usage.rs
+++ b/engine/cli/src/usage.rs
@@ -190,6 +190,8 @@ fn access(verb: &str) -> &'static str {
// in the raea app's host: a folder an agent adds waits for the person's yes; what's shown is theirs to answer
"library" => "HOST, then PERSON to add a folder",
"show" => "HOST (starts the app), then PERSON to answer",
+ // take and ls read files; post shows the asks on the person's comments through show
+ "notes" => "HOST to show post's asks on the person's comments; take and ls run headless",
_ => "HEADLESS",
}
}
diff --git a/sdk/raea/src/facts.gen.ts b/sdk/raea/src/facts.gen.ts
index 94a7b9bd..e110a5d9 100644
--- a/sdk/raea/src/facts.gen.ts
+++ b/sdk/raea/src/facts.gen.ts
@@ -117,6 +117,47 @@ export type Rendered = { out: string, manifest: string, record?: string, stale:
export type Waits = { [key in string]: string };
+export type Pin = { t?: number, x?: number, y?: number, part?: string, };
+
+export type Proof = { shot?: string, frames?: [number, number], sign: boolean, };
+
+export type Ask = {
+/**
+ * the one thing asked
+ */
+text: string,
+/**
+ * the medium the person's words name for it, in their word: "2D", "3D", "flat", "extruded", "real",
+ * "modelled", "voxel"
+ */
+medium?: string,
+/**
+ * what it is about: the part the pin is on (found in the world), or what a check would query
+ */
+about?: string,
+/**
+ * what the note does not ask for, so a change keeps it (for a redesign: what is kept)
+ */
+not: Array<string>,
+/**
+ * the craft verb this ask is (skills/skills/raea/craft/verbs): one per ask, not one per note
+ */
+verb?: string,
+/**
+ * the check that shows it met (DR6): one of raea's by name, or a .ts check by its path, as a rule names one
+ */
+check?: string,
+/**
+ * the values its check is held to
+ */
+values?: Record<string, unknown>,
+/**
+ * where it can't be measured: the clip the person signs
+ */
+proof?: Proof, };
+
+export type Note = { words: Array<string>, from: string, round: number, pin?: Pin, redesign?: boolean, corrected?: Array<number>, asks: Array<Ask>, };
+
export type Level = "error" | "warn" | "note";
export type About = { name: string, key?: string, };
diff --git a/sdk/raea/src/note.ts b/sdk/raea/src/note.ts
new file mode 100644
index 00000000..5debc991
--- /dev/null
+++ b/sdk/raea/src/note.ts
@@ -0,0 +1,29 @@
+// raea/note: a person's note as a file in the project (docs/direction.feature DR5). `raea notes take` writes one for
+// each note the person sends from the raea app (an edit comment, with its pin) or says in a session, under
+// notes/<round>/<id>.ts: their words verbatim, where they came from, and no asks yet. Before anything in the work
+// changes, the agent restates the note as its asks: one for each separate thing it asks for, the medium where the
+// words name one, what it is about, and what it doesn't ask for, so a change keeps the rest. `raea notes ls` says
+// where each note stands and what its restatement still owes. The types are generated from the Rust (raea-core-facts
+// note.rs), so what tsc checks is what raea reads.
+//
+// // notes/1/n3.ts
+// import { note } from "raea/note";
+// export default note({
+// words: ["I want 2D animated text with occlusion, not 3D text extrusion. Think of how a lyric video would be."],
+// from: "app i-show-mw9k-2 cm-4",
+// round: 1,
+// pin: { t: 12.4, x: 0.52, y: 0.31, part: "lyric" },
+// asks: [
+// { text: "each lyric line is flat type, masked by the singer where they meet", medium: "2D", about: "lyric",
+// not: ["the camera", "the timing of the lines"], verb: "layout" },
+// { text: "every lyric arrives word by word on its sung time, as a lyric video's do", medium: "2D", about: "lyric",
+// not: ["the font"], verb: "animate" },
+// ],
+// });
+
+import type { Ask, Note, Pin, Proof } from "./facts.gen";
+
+export type { Ask, Note, Pin, Proof };
+
+/** A note as written: its words and where they came from are `raea notes take`'s, its asks the agent's. */
+export const note = (n: Note): Note => n;
diff --git a/tools/layers.toml b/tools/layers.toml
index 7fad4601..b49b6b93 100644
--- a/tools/layers.toml
+++ b/tools/layers.toml
@@ -142,6 +142,7 @@ raea-runtime-shared = "runtime"
raea-page = "runtime"
raea-app-check = "apps"
raea-app-direction = "apps"
+raea-app-notes = "apps"
raea-app-sound = "apps"
raea-app-ci = "apps"
raea-app-tools = "apps"
diff --git a/tools/manual-ref/cli.ts b/tools/manual-ref/cli.ts
index 46b074ba..5bb16752 100644
--- a/tools/manual-ref/cli.ts
+++ b/tools/manual-ref/cli.ts
@@ -31,7 +31,7 @@ const GROUPS: [string, string, string[]][] = [
["Footage", "Takes, cuts and the camera, from your own media.", ["media", "cut", "frame", "track", "splat", "mezz", "neural"]],
["Sound", "Music read, foley and instruments made on this machine.", ["song", "sounds", "sao", "tokensynth", "setup-audio"]],
["Generate and 3D tools", "Generated media, physics bakes and Blender.", ["gen", "physics", "blender"]],
- ["Agents and setup", "What an agent reads and shows the person, and the tools raea installs.", ["guide", "context", "show", "skill", "skills", "setup"]],
+ ["Agents and setup", "What an agent reads and shows the person, and the tools raea installs.", ["guide", "context", "notes", "show", "skill", "skills", "setup"]],
]
const groupOf = new Map(GROUPS.flatMap(([g, , vs]) => vs.map((v, i) => [v, { g, i }] as const)))
diff --git a/tools/manual-ref/sdk.ts b/tools/manual-ref/sdk.ts
index e81279ad..a9f2111c 100644
--- a/tools/manual-ref/sdk.ts
+++ b/tools/manual-ref/sdk.ts
@@ -22,7 +22,7 @@ const problems: string[] = []
// the index's groups, in the order a reader meets them; every import path is in one
const GROUPS: [string, string, string[]][] = [
- ["Start here", "The composition, the app and the specs an agent writes.", ["raea", "app", "brief"]],
+ ["Start here", "The composition, the app, and the specs and notes an agent writes.", ["raea", "app", "brief", "note"]],
["Time and motion", "Frames, animation, springs, states and input.", ["time", "animation", "math", "state", "input"]],
["Video, sound and text", "Footage, pictures, sound, words and colour.", ["video", "audio", "text", "image", "asset", "color"]],
["3D", "Bevy's 3D: cameras, lights, materials, meshes and the frame after it's drawn.", ["3d", "camera", "light", "pbr", "mesh", "transform", "post_process", "picking", "gizmos"]],