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.

PL8: one way to keep work, and any tracker beside it

shinyobjectz5f55c55d5790
diff --git a/docs/plan.feature b/docs/plan.feature
index d8099ae8..f4774c78 100644
--- a/docs/plan.feature
+++ b/docs/plan.feature
@@ -21,7 +21,7 @@ Feature: Plans: a project's plan.org, kept by its agents
# src/plan/agent.test.ts driving a turn's plan tools end to end on a faked host; tsc -b clean; e2e todo.spec.ts and
# outside.spec.ts (7) and messages, primary, heads, consolidate (26) in Chrome; todo.spec.ts (4) and outside.spec.ts
# (3) in raea's window (BLITZ_E2E bundle, node blitz/pw-run.mjs). The board (feed/Board.tsx, board/Lanes.tsx,
- # board/CardSheet.tsx) reads the plan now, but no route mounts it. Not done: `raea project new` writes no plan.org yet
+ # board/CardSheet.tsx), which no route mounted, was removed with PL8: the to-do list is the plan's one view. Not done: `raea project new` writes no plan.org yet
# (Rust, engine/cli), so reference/files.md, generated from it, doesn't list one; the page makes it on the first
# write. The brief page (BriefView, unmounted) still draws a brief's own ## Tasks. Compositions can't import
# @raea/task until sdk/tsconfig.base.json and raea's bundler map it.
@@ -140,8 +140,8 @@ Feature: Plans: a project's plan.org, kept by its agents
waits on; a critique's gate is "<title> passes check and critique" with :ITEM: the newest critique
And an item carries the tags of the tasks linked to it, a workflow field places a channel by its plan's tasks, and
a session outside raea holds the tasks whose :AGENT: is @its-name or its inbox
- And the board (feed/Board.tsx, board/Lanes.tsx, board/CardSheet.tsx) reads and edits the plan the same way, by
- task id; no route mounts it yet
+ And the to-do list (feed/TodoPanel.tsx) reads and edits the plan the same way, by task id (the board that did
+ too, never mounted, went with PL8)
@done
Scenario: PL4c. A brief's tasks move into the plan once
@@ -203,6 +203,8 @@ Feature: Plans: a project's plan.org, kept by its agents
And none of it uses a dynamic import or dangerouslySetInnerHTML, so raea's window bundle (one IIFE) holds it
Rule: PL7. An agent finishes what it planned
+ # 11-20 (PL8): the keeper's asks (PL7a, PL7b, PL7c, PL7f) are gone. Closing follows the work instead (PL8c), and the
+ # task per message and the starter task that filled plans with tasks nobody closed are gone too. PL7d and PL7e stay.
# Shane, 2026-11-16: "i notice often that it makes tasks but never completes them itself". His plans that morning:
# TarotChess's agent posted a first pass and left its own follow-ups TODO (frame rate, a clipping score, a dark
# encode); Cadence's said "all six masters are finished and posted" over a plan still saying Track MAKING and Build,
@@ -258,3 +260,67 @@ Feature: Plans: a project's plan.org, kept by its agents
And over the composer, while it asks or after it pauses with tasks open, one line: "Plan 3 of its tasks open",
"Finishing · ask 2" with × to stop asking until the next message, or "Paused · Continue" with why on hover
+ Rule: PL8. One way to keep work, and any tracker beside it
+ # Shane, 2026-11-20: "we continually in the desktop app get issues with tasks and starting or adding tasks and it
+ # never actually closes any out. so maybe we should align plan to be simpler", then "make sure the project management
+ # structure is clear dry and we dont have competing methods", and "the planning api will need to be able to easily
+ # sync and extend to whatever system enterprise clients use so we dont want to be too opinionated about planning as
+ # long as its consistent and fixable by the agent itself too". Read 11-20 in his workspaces: plans kept by an agent in
+ # a terminal close their tasks (gambit 82 of 133, driveeasier 13 of 13, castle-busters 11 of 13); plans made in the
+ # app don't (ten new projects hold only the app's own "Write the plan", open; p-pong 0 of 5), with PL7's keeper
+ # installed. Tasks were written in four places (brief.ts stages, the composer's task per message, the starter task,
+ # the agents' plan tools) and closed in one: an agent remembering to. Agreed with raea cloud (11-20), whose
+ # agents keep their projects in plan.org on @raea/task and start them from Asana, Linear, Jira and other boards.
+
+ @done
+ Scenario: PL8a. plan.org is the one list
+ # core/brief (brief.rs, parts.rs, tests.rs), apps/workspace doctor.rs, the app's src/brief/spec.ts and format.ts
+ Then a project's tasks are in its plan.org and nowhere else: brief.ts says what to make (core/brief's Brief has no
+ stages or tasks), and a brief that still has them reads, its tasks unread, with `raea doctor` saying they
+ belong in plan.org
+ And the app's brief writer (src/brief/spec.ts) writes no stages, its starter brief has no ## Tasks, and a brief
+ that has them moves them into the plan once (PL4c, as before)
+ And core/brief's object plan, which was also called a plan, is `parts()` in NAME.parts.ts (`raea spec --as parts`)
+
+ @done
+ Scenario: PL8b. A message is a message, not a task
+ # the app's src/plan/turn.ts and plan.test.ts; e2e/chat-plan.spec.ts in raea's window
+ Then the composer writes no task for a message sent: an agent plans tasks when the work is more than its turn
+ (the skill's plan.md), and the person adds their own in the to-do list
+ And a new project's plan starts empty, with no "Write the plan" task
+
+ @done
+ Scenario: PL8c. Closing follows the work
+ Given a task linked to an item (:ITEM:)
+ When the person approves that item, or any version of it
+ Then the task closes DONE, stamped CLOSED, by the person, with no agent asked
+ And where an open task stands (making, waiting on the person) is read from its item and from a session at work
+ on it, as the to-do list already shows it (plan/words.ts standing), never from a keyword an agent must remember
+ to set
+ And it's checked in the app: src/plan/approve.test.ts, and e2e/todo.spec.ts in raea's window (checking off a
+ task on an item writes that task DONE)
+
+ @done
+ Scenario: PL8d. The keywords are the file's
+ # sdk/task newPlan (test/trackers.test.ts); the app's src/plan/keywords.ts and host/plan.test.ts
+ Then a plan's #+TODO: lines are its keywords and Org's | says which close a task; raea reads any sequence that way
+ And a plan the app makes keeps TODO | DONE DROPPED; raea cloud's TODO MAKING REVIEW | DONE DROPPED and a client's
+ own words read the same, and newPlan(title, keywords) takes the sequence its caller keeps
+
+ @done
+ Scenario: PL8e. A task kept in step with another tracker
+ # sdk/task src/trackers.ts; test/trackers.test.ts (with a raea cloud plan.org that passes checkPlan unflagged).
+ Then a task names its items in other trackers with one property, :LINK: linear:ENG-12 asana:1209876543 (each the
+ tracker's own key, never a URL; one per system), and the head maps each system's statuses to keywords, one line
+ a system: #+LINK_STATES: linear In Progress=MAKING; In Review=REVIEW; Done=DONE
+ And keywordFor(plan, system, status) is a status coming in and statusFor(plan, system, keyword) the status written
+ back (the first one listed for the keyword), so a sync needs a mapping, not code per client
+ And trackersOf(task) and trackerStates(plan) read them for a sync or a trigger's match
+
+ @done
+ Scenario: PL8f. An agent can fix its own plan
+ Then checkPlan says each problem with its fix: an id on two tasks, a :LINK: entry that isn't SYSTEM:ID or is a
+ URL, a system named twice on one task, one tracker item on two tasks, a #+LINK_STATES: keyword the plan doesn't
+ know, and a plugin's kinds and properties (PL6)
+ And nothing else is required: no :ID:, no keyword on a heading, no property, so headings that group, hold notes or
+ hold a cloud agent's settings are never flagged
diff --git a/sdk/task/src/edit.ts b/sdk/task/src/edit.ts
index db0c2b9c..b3ce1688 100644
--- a/sdk/task/src/edit.ts
+++ b/sdk/task/src/edit.ts
@@ -65,7 +65,9 @@ export const tagOf = (s: string) => s.trim().replace(/^[#:]+/, "").replace(/[^\p
export const toggled = (t: { ref: string; state?: State }): PlanEdit => ({ op: "state", ref: t.ref, state: isClosed(t.state) ? "todo" : "done" })
/** A new project's plan: its title, and raea's keywords spelled out for Emacs and any other Org reader. */
-export const newPlan = (title: string) => `#+TITLE: ${title.replace(/\s+/g, " ").trim()}\n#+TODO: TODO MAKING REVIEW | DONE DROPPED\n\n`
+/** A new plan.org's text. `keywords` is its #+TODO: sequence: raea's whole one unless the caller keeps fewer (the app
+ * keeps TODO | DONE DROPPED: where a linked task stands is its item's, PL8). */
+export const newPlan = (title: string, keywords = "TODO MAKING REVIEW | DONE DROPPED") => `#+TITLE: ${title.replace(/\s+/g, " ").trim()}\n#+TODO: ${keywords}\n\n`
const oneLine = (s: string) => s.replace(/\s+/g, " ").trim()
const propOf = (s: Section, key: string) => s.props?.find(([k]) => k.toUpperCase() === key)?.[1]
diff --git a/sdk/task/src/extend.ts b/sdk/task/src/extend.ts
index 7368b338..0cd1ad8b 100644
--- a/sdk/task/src/extend.ts
+++ b/sdk/task/src/extend.ts
@@ -4,6 +4,7 @@
// (TODO MAKING REVIEW | DONE DROPPED), its properties and its views are in every registry from the start.
import type { TaskFields } from "./edit.ts"
import type { Plan, State, Task } from "./model.ts"
+import { trackerProblems } from "./trackers.ts"
import { agenda, board, outline } from "./views.ts"
export const STATES: readonly State[] = ["todo", "making", "review", "done", "dropped"]
@@ -127,7 +128,9 @@ export interface Diagnostic {
}
/** What is wrong in a plan by the registry's rules: ids used twice, properties that fail their check, kinds nobody
- * defined, a kind's missing properties, keywords outside a kind's sequence, and the kinds' own checks. */
+ * defined, a kind's missing properties, keywords outside a kind's sequence, the kinds' own checks, and its links to
+ * other trackers (trackers.ts: an entry that isn't SYSTEM:ID, one tracker item on two tasks, a #+LINK_STATES:
+ * keyword the plan doesn't know). Nothing else is required: no :ID:, no keyword on a heading, no property. */
export function checkPlan(plan: Plan, reg: PlanRegistry = plans): Diagnostic[] {
const out: Diagnostic[] = []
const seen = new Map<string, Task>()
@@ -153,5 +156,6 @@ export function checkPlan(plan: Plan, reg: PlanRegistry = plans): Diagnostic[] {
const why = kind.check?.(t, plan)
if (why) say(why)
}
+ for (const p of trackerProblems(plan)) out.push({ ref: p.task?.ref ?? "head", line: p.task?.line ?? p.line ?? 0, severity: "error", message: p.message })
return out
}
diff --git a/sdk/task/src/index.ts b/sdk/task/src/index.ts
index 2a40d5a3..65f0028c 100644
--- a/sdk/task/src/index.ts
+++ b/sdk/task/src/index.ts
@@ -9,3 +9,4 @@ export { checkPlan, createRegistry, defineKeywords, definePlanKind, defineProper
export { agenda, board, outline, type Agenda, type AgendaDay, type Lane, type OutlineNode } from "./views.ts"
export { planDigest, taskLine } from "./digest.ts"
export { answerPlanTool, PLAN_TOOLS, planToolEdits, type NewTaskInput, type PlanTool, type PlanToolHost, type TaskChange } from "./tools.ts"
+export { keywordFor, statusFor, trackerStates, trackersOf, type Tracker, type TrackerStates } from "./trackers.ts"
diff --git a/sdk/task/src/trackers.ts b/sdk/task/src/trackers.ts
new file mode 100644
index 00000000..e7c41976
--- /dev/null
+++ b/sdk/task/src/trackers.ts
@@ -0,0 +1,99 @@
+// A task kept in step with another tracker (Asana, Linear, Jira, ...: raea cloud's board triggers, a client's own
+// system), with no code per client: the file says it all (docs/plan.feature PL8).
+// :LINK: linear:ENG-12 asana:1209876543 on a task: one SYSTEM:ID per system, the tracker's own key, never a URL
+// #+LINK_STATES: linear In Progress=MAKING; In Review=REVIEW; Done=DONE in the head: one line per system
+// A status comes in as its keyword (trimmed, any case); a keyword goes out as the FIRST status the line lists for it.
+import type { Plan, Task } from "./model.ts"
+
+export interface Tracker {
+ system: string
+ id: string
+}
+
+export interface TrackerStates {
+ /** a status (lower case, trimmed) to its keyword */
+ toKeyword: Map<string, string>
+ /** a keyword to the first status listed for it, as written */
+ toStatus: Map<string, string>
+}
+
+const SYSTEM = /^[a-z0-9][a-z0-9-]*$/
+const STATES_LINE = /^[ \t]*#\+LINK_STATES:[ \t]*(\S+)[ \t]*(.*)$/i
+
+/** One :LINK: entry, or why it isn't one. */
+function entry(s: string): Tracker | string {
+ const at = s.indexOf(":")
+ const system = at > 0 ? s.slice(0, at) : ""
+ const id = at > 0 ? s.slice(at + 1) : ""
+ if (!SYSTEM.test(system) || !id) return `"${s}" isn't SYSTEM:ID (linear:ENG-12)`
+ if (/^\/\/|^https?:/i.test(id) || /^https?$/.test(system)) return `"${s}" is a URL; :LINK: takes the tracker's own key, the URL goes in the task's text`
+ return { system, id }
+}
+
+/** The trackers a task is kept in step with, in the order its :LINK: names them (what isn't SYSTEM:ID is left out). */
+export function trackersOf(task: Task): Tracker[] {
+ return (task.props.LINK ?? "").split(/\s+/).filter(Boolean).map(entry).filter((e): e is Tracker => typeof e !== "string")
+}
+
+/** Each system's status map, from the head's #+LINK_STATES: lines. */
+export function trackerStates(plan: Plan): Map<string, TrackerStates> {
+ const out = new Map<string, TrackerStates>()
+ for (const line of plan.doc.head) {
+ const m = STATES_LINE.exec(line)
+ if (!m) continue
+ const system = m[1].toLowerCase()
+ const s = out.get(system) ?? { toKeyword: new Map(), toStatus: new Map() }
+ for (const pair of m[2].split(";")) {
+ const eq = pair.lastIndexOf("=")
+ const status = pair.slice(0, eq).trim()
+ const keyword = pair.slice(eq + 1).trim()
+ if (eq < 0 || !status || !keyword) continue
+ s.toKeyword.set(status.toLowerCase(), keyword)
+ if (!s.toStatus.has(keyword)) s.toStatus.set(keyword, status)
+ }
+ out.set(system, s)
+ }
+ return out
+}
+
+/** The keyword a system's status means here, or undefined when the head doesn't map it. */
+export const keywordFor = (plan: Plan, system: string, status: string): string | undefined =>
+ trackerStates(plan).get(system.toLowerCase())?.toKeyword.get(status.trim().toLowerCase())
+
+/** The status to write back to a system for a keyword: the first one its line lists, or undefined. */
+export const statusFor = (plan: Plan, system: string, keyword: string): string | undefined => trackerStates(plan).get(system.toLowerCase())?.toStatus.get(keyword)
+
+/** What's wrong with the plan's links, for checkPlan: an entry that isn't SYSTEM:ID, a system named twice on one task,
+ * one SYSTEM:ID on two tasks, and a #+LINK_STATES: keyword the plan doesn't know. Each says its fix. */
+export function trackerProblems(plan: Plan): { task?: Task; line?: number; message: string }[] {
+ const out: { task?: Task; line?: number; message: string }[] = []
+ const owner = new Map<string, Task>()
+ for (const t of plan.entries) {
+ const systems = new Set<string>()
+ for (const raw of (t.props.LINK ?? "").split(/\s+/).filter(Boolean)) {
+ const e = entry(raw)
+ if (typeof e === "string") {
+ out.push({ task: t, message: `:LINK: ${e}` })
+ continue
+ }
+ if (systems.has(e.system)) out.push({ task: t, message: `:LINK: names ${e.system} twice; a task is one item in each system` })
+ systems.add(e.system)
+ const key = `${e.system}:${e.id}`
+ const was = owner.get(key)
+ if (was) out.push({ task: t, message: `:LINK: ${key} is also ${was.text}'s; one tracker item is one task, so keep it on one of them`, })
+ else owner.set(key, t)
+ }
+ }
+ plan.doc.head.forEach((line, i) => {
+ const m = STATES_LINE.exec(line)
+ if (!m) return
+ if (!SYSTEM.test(m[1].toLowerCase())) out.push({ line: i, message: `#+LINK_STATES: starts with its system's name (linear), not "${m[1]}"` })
+ for (const pair of m[2].split(";").map((p) => p.trim()).filter(Boolean)) {
+ const eq = pair.lastIndexOf("=")
+ const keyword = eq < 0 ? "" : pair.slice(eq + 1).trim()
+ if (eq <= 0 || !keyword) out.push({ line: i, message: `#+LINK_STATES: "${pair}" isn't Status=KEYWORD` })
+ else if (!plan.words.has(keyword)) out.push({ line: i, message: `#+LINK_STATES: ${keyword} isn't one of this plan's keywords (${[...plan.words.keys()].join(" ")}); add it to #+TODO: or map the status to one that is` })
+ }
+ })
+ return out
+}
diff --git a/sdk/task/test/trackers.test.ts b/sdk/task/test/trackers.test.ts
new file mode 100644
index 00000000..c7f23537
--- /dev/null
+++ b/sdk/task/test/trackers.test.ts
@@ -0,0 +1,149 @@
+// PL8: a task kept in step with another tracker by :LINK: and #+LINK_STATES:, with checkPlan saying what's wrong, and
+// a raea cloud plan.org (the cloud's writer, 11-20) passing it with nothing flagged.
+import { describe, expect, test } from "vitest"
+import { checkPlan, keywordFor, newPlan, readPlan, statusFor, trackersOf, trackerStates } from "../src/index.ts"
+
+const LINKED = `#+TITLE: Launch
+#+TODO: TODO MAKING REVIEW | DONE DROPPED
+#+LINK_STATES: linear In Progress=MAKING; In Review=REVIEW; Done=DONE; Canceled=DROPPED; Duplicate=DROPPED
+
+* Cut
+** TODO Hero cut
+:PROPERTIES:
+:ID: t-hero
+:LINK: linear:ENG-12 asana:1209876543
+:END:
+`
+
+describe("PL8: links to other trackers", () => {
+ test("a task's trackers are its :LINK: entries, in order", () => {
+ const p = readPlan(LINKED)
+ expect(trackersOf(p.tasks[0])).toEqual([{ system: "linear", id: "ENG-12" }, { system: "asana", id: "1209876543" }])
+ // each tracker's own key, as raea cloud writes them (11-20): GitHub's org/repo#12, Slack's channel/ts, Trello's shortLink
+ const keys = readPlan(LINKED.replace("linear:ENG-12 asana:1209876543", "github:acme/site#12 slack:C0123/1700000000.123 trello:aB3dE9 jira:PROJ-7"))
+ expect(trackersOf(keys.tasks[0]).map((t) => t.id)).toEqual(["acme/site#12", "C0123/1700000000.123", "aB3dE9", "PROJ-7"])
+ expect(checkPlan(keys)).toEqual([])
+ })
+
+ test("a status comes in as its keyword, and a keyword goes out as the first status listed for it", () => {
+ const p = readPlan(LINKED)
+ expect(keywordFor(p, "linear", " in review ")).toBe("REVIEW")
+ expect(keywordFor(p, "Linear", "Duplicate")).toBe("DROPPED")
+ expect(statusFor(p, "linear", "DROPPED")).toBe("Canceled")
+ expect(keywordFor(p, "linear", "Backlog")).toBeUndefined()
+ expect(keywordFor(p, "jira", "Done")).toBeUndefined()
+ expect([...trackerStates(p).keys()]).toEqual(["linear"])
+ expect(checkPlan(p)).toEqual([])
+ })
+
+ test("checkPlan says what's wrong with a link, and how to fix it", () => {
+ const bad = `${LINKED.replace("asana:1209876543", "linear:ENG-13 https://linear.app/x ENG-14")}** TODO Same item
+:PROPERTIES:
+:LINK: linear:ENG-12
+:END:
+`.replace("Duplicate=DROPPED", "Blocked=WAITING")
+ const says = checkPlan(readPlan(bad)).map((d) => d.message)
+ expect(says.some((m) => /names linear twice/.test(m))).toBe(true)
+ expect(says.some((m) => /is a URL/.test(m))).toBe(true)
+ expect(says.some((m) => /"ENG-14" isn't SYSTEM:ID/.test(m))).toBe(true)
+ expect(says.some((m) => /linear:ENG-12 is also Hero cut's/.test(m))).toBe(true)
+ expect(says.some((m) => /WAITING isn't one of this plan's keywords/.test(m))).toBe(true)
+ })
+
+ test("a new plan keeps the keywords it's given", () => {
+ expect(newPlan("Pong")).toContain("#+TODO: TODO MAKING REVIEW | DONE DROPPED")
+ expect(newPlan("Pong", "TODO | DONE DROPPED")).toContain("#+TODO: TODO | DONE DROPPED\n")
+ })
+})
+
+// what raea cloud writes (11-20): an * Agent heading, triggers under * Triggers (and the old * Inputs),
+// projects with their properties, a project's own sections, checkpoints, team stage checklists and logbook notes
+const CLOUD = `#+TITLE: Cutter
+#+TODO: TODO MAKING REVIEW | DONE DROPPED
+#+LINK_STATES: linear In Progress=MAKING; In Review=REVIEW; Done=DONE
+
+* Agent
+:PROPERTIES:
+:FOR: Acme's paid social
+:AT_A_TIME: no limit
+:TOOLS: computer judge web
+:END:
+- [X] Client review (amber): where its review goes
+- [ ] Legal (red): [email protected]
+
+* Triggers
+** Linear: In Review on ENG
+:PROPERTIES:
+:TRIGGER: tr-lin1
+:APP: linear
+:WHERE: ENG
+:SIGNAL: status
+:VALUE: In Review
+:FIELD: state
+:FILTERS: label=video; priority=high
+:REPLY: webhook https://hooks.acme.com/raea
+:END:
+** Every Monday
+:PROPERTIES:
+:TRIGGER: tr-sched
+:AT: 09:00
+:REPEAT: weekly
+:END:
+
+* Inputs
+** Old form
+:PROPERTIES:
+:INPUT: in-1
+:END:
+
+* Projects
+** REVIEW Spring sale cut [1/2]
+:PROPERTIES:
+:ID: pj-1
+:AGENT: ag-cutter
+:BOT: bot-1
+:SKILL: sk-cut
+:REPO: project-pj-1
+:ASSIGNEE: email:[email protected] Ana Ruiz
+:FROM: tr-lin1
+:REPLY: email [email protected]
+:CLIENT: Acme
+:BRAND: Acme
+:CREATED: [2026-11-20 Fri 10:02]
+:SPENT: 0.039
+:RESPONSES: 3
+:WAITING: Client review
+:LINK: linear:ENG-12
+:END:
+:LOGBOOK:
+- Note taken on [2026-11-20 Fri 10:10] \\\\
+ first cut posted
+:END:
+- [X] Approve the plan
+- [ ] Client review: Review the first cut
+*** Input
+[[https://linear.app/acme/issue/ENG-12][ENG-12]]
+*** Attachments
+*** Expected output
+*** Checkpoint: Approve the plan
+:PROPERTIES:
+:AT: [2026-11-20 Fri 10:05]
+:ANSWER: approve
+:NOTE: go
+:END:
+** DROPPED Old idea
+:PROPERTIES:
+:ID: pj-0
+:OUTCOME: failed
+:END:
+*** What went wrong
+*** Last answer
+*** Delivered
+`
+
+test("PL8: a raea cloud plan.org passes checkPlan with nothing flagged", () => {
+ const p = readPlan(CLOUD)
+ expect(checkPlan(p)).toEqual([])
+ expect(p.tasks.map((t) => t.keyword)).toEqual(["REVIEW", "DROPPED"])
+ expect(trackersOf(p.tasks[0])).toEqual([{ system: "linear", id: "ENG-12" }])
+})