Files
shane d873402ac5 raea goal is the loop, raea make the asset tools (#269)
One loop, raea goal: every rule in TypeScript, held at edit, render, publish and done (goal check, tasks, judge, seen, gates, next); the brief's contract is goal: (one goal or a list, a workflow inline), and its plan is plan:. raea make is making a finished asset: character, clothes, motion, solid, wear, splat, physics, bake, sounds, component, the kit pipeline and shots. Instruments (check, judge, ask, world, scene faults, light check) stay top-level. With it: the montage pack (MK48-MK51), JavaScriptCore fixes raea goal needs (CommonJS named exports, reserved words too, dynamic import of file URLs, process.exit from a promise, stdin for -), raea-cli-goal and raea-cli-refused split out of raea-cli, and skills at raea-skills 105aede.
2026-11-29 18:43:09 -08:00

351 lines
27 KiB
Gherkin
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
@spec
Feature: Plans: a project's plan, the brief's `plan`, kept by its agents
Shane, 2026-11-14: "create a subagent that can flesh out the skills needed for tasks/plannig to be fully carried out
by the agent right now its just blank and even if user doesnt touh it we need to have the againt use and maintain it
and actualy use it for project managemtn and make that project managemnt system extensible with the task SDK. as a
personal notel i liek or mode for managing projects so id liek to have that eb part of the base layer and make sure
it integrates well with typescript/react/jsx correctly and the larger project in a way that is integral to the system"
"or mode" is Emacs org-mode, and from 11-14 to 11-29 the plan was an Org file, plan.org. Since 11-29 (docs/goal.feature
MK40, MK44, Shane: "plan.org into TS", and every SDK file registered from brief.ts) it is the brief's `plan`:
`plan({ tasks })` from raea/brief, written inline in brief.ts or in a module brief.ts imports (plan.ts by default),
that the app, raea's own agents, agents outside raea (Claude Code in a terminal) and raea cloud all read and write
through `raea goal tasks`. What Org gave it stays: keywords, priorities, tags, dates, properties, checkboxes, subtasks, links.
The to-do list was blank because nothing wrote to it but the composer; now every agent plans in it, marks what it's
doing and closes what it made, whether or not the person ever opens it. `raea goal tasks` runs the brief and answers the plan's
value; @raea/task (sdk/task) edits it by task id and writes each edit back where that task is written, lets a plugin add keywords, properties, kinds and views, and gives React its
hooks and components. A plan.org still in a folder is moved into the brief's plan
once, and one stored by raea cloud to its value (@raea/task/from-org), the first time it's read.
# Status 11-14: landed for 0.1.4. sdk/task (@raea/task) and this file in raea; the app in raea-feed (tasks-org merged
# into integration-014 at 1214a21: vitest 242 files, 1509 tests, e2e todo, outside, messages, primary, heads,
# consolidate 36 of 36); the skill in raea-skills #75 (skills/raea/plan.md).
# Checked after the review: sdk/task 32 bun tests (org, edit, extend, tools), 35 with its react
# tests under the app's vitest; the app's vitest 237 files, 1458 tests (base 229 files, 1403 tests, the same skips),
# 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), 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.ts 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 (11-29: tsconfig maps raea/task and @raea/task).
# 11-16: PL7, agents finish what they plan (raea-feed plan-finish: plan/keeper.ts, PlanKeeper.tsx; sdk/task tools.ts).
# Checked in raea's window: e2e chat-plan 2 of 2 with a real ACP stand-in planning through the tool port, and
# chat-goal, respawn, todo, outside, heads, primary, consolidate, ai-login unchanged; vitest 1621; sdk/task 33.
# 11-29: plan.ts (MK40). sdk/task: literal.ts (the reader and printer), doc.ts, from-org.ts; org.ts deleted; 38 bun
# tests. raea-feed #128 (host/plan.ts moves a plan.org once), raea-platform #135 (each agent's plan, the /plan.ts API).
# 11-29, later (MK43-MK44): the plan is the brief's `plan`, read from the brief's run and written back where each
# task is written (sdk/task source.ts; sdk/goal tasks.ts, `raea goal tasks --json | --apply | --put`); raea PR #269.
# raea-feed #128: the host reads, edits and puts the plan through `raea goal tasks` (vitest 1778, plan 7 of 7 on the
# built raea). raea-platform #135: each agent's plan is its value's JSON in its SQLite row, no file;
# GET|PUT /v1/agents/:id/plan (bun 677).
Background:
Given the app's code is apps/app (raea-feed), the SDK sdk/task, the skill skills/raea/plan.md in raea-skills
And the plan's tests: sdk/task/test/*.test.ts (PL2, PL3, PL5, PL6; from-org.test.ts the move from Org), apps/app src/plan/plan.test.ts (PL1c, PL4, PL4c,
PL5), src/plan/agent.test.ts (PL5a, PL5b), host/plan.test.ts (PL4, PL5), src/feed/todo.test.ts and outside.test.ts
(PL4b), e2e/todo.spec.ts (PL4b), apps/app src/plan/keeper.test.ts and e2e/chat-plan.spec.ts (PL7)
Rule: PL1. A project's plan is its brief's `plan`
# Why there: brief.ts is the project's one registered root (MK43): every raea file is reached from it and run with
# it, so the plan is too, versioned with the project in the workspace's repo. Written inline or in a module the
# brief imports (plan.ts when raea makes one). Not under .raea/, which is raea's state, not the person's. One plan
# a project: the Inbox reads each project's in turn.
@done
Scenario: PL1a. The file says its title and raea's keywords
Given a project whose brief has no plan
When anything adds a task to it (the to-do list, the composer, an agent's plan_add, `raea goal tasks --apply`)
Then <project>/plan.ts is made: `import { plan } from "raea/task"`, then `export default plan({ title, keywords:
["TODO | DONE DROPPED"], tasks: [] })`, and brief.ts imports it as its `plan`
And a keyword written into a plan whose keywords don't name it (MAKING in a file written by hand, a plugin's SHOT)
adds its sequence to `keywords`; raea's own sequence needs none
@done
Scenario: PL1b. What a plan holds
Given a plan (inline in brief.ts, or in plan.ts)
Then each entry in `tasks` (and in an entry's own `tasks`) with a keyword is a task; one with none is a heading: a
stage that groups the tasks under it
And an entry may carry `id`, `priority` ("A"), `tags`, `scheduled`, `deadline`, `closed` (dates as "2026-11-20" or
"2026-11-20 14:02", a schedule's repeat after it: "2026-11-24 09:00 +1w"), `props`, `notes` (its lines:
checkboxes "- [ ] x" and "- [X] x", words, links) and `tasks`
And its properties are ID (t- and eight letters and digits; written as `id`), ITEM (the feed item it stands on),
AGENT (who has it), FROM (what asked for it), KIND and VERB; any other property is kept as written
And links are [words](target), naming feed items and tasks by id: [the door](item:i-door-2), [](id:t-ab12cd34)
And a subtask is a task under a task; raea counts its parent's progress from its subtasks, or with none its
checkboxes (nothing writes a count into the file)
And the plan itself may carry `title`, `keywords`, `tags` (every task's), `trackers` (PL8e) and `notes`
@done
Scenario: PL1c. Everything is linked by id, never by name
Given a task typed with "@grade #look due 11-20 → i-hall" (the to-do list, the composer)
Then AGENT holds the agent's id; an @name no agent has yet is kept as @name, and shows that name
And ITEM holds the item's id, the tags are the task's tags, and its deadline is that day this year
And a task the composer writes for a message has FROM the message's id; one for a comment, ITEM#COMMENT
Rule: PL2. @raea/task reads a plan as data, and loses none of it
@done
Scenario: PL2a. A round trip changes nothing
Given a plan module as raea writes it (two-space indents, keys bare where they can be, a short list on one line)
When it's read and printed with no edits
Then the text is the same, byte for byte
And a plan written by hand in any layout (quotes of any kind, trailing commas, comments) reads to the same values,
and its first edit writes it in raea's layout: a note belongs in `notes`, where it's kept
And the file is read as data (sdk/task literal.ts), never run: a template with ${}, a call or a variable is
refused, naming its line and column, and nothing is written over a plan that can't be read
@done
Scenario: PL2b. A plan as values
Given a plan (inline in brief.ts, or in plan.ts)
Then readPlan gives every entry and the ones with a keyword as tasks, each with its state (todo, making, review,
done, dropped, whatever its keyword is called), priority, tags and inherited tags, dates, properties, item,
agents, from, parent and children, its stage, checkboxes, progress, links and body
And a plan's own `keywords` add keywords; a word a plugin defined keeps its plugin's state
@done
Scenario: PL2c. A changed entry changes only its own values
Given an edit that changes one task's keyword
Then only its `keyword` changes in the printed file; its other fields, its notes and every other entry are as
they were, in the order they were in
Rule: PL3. Every change is an edit by task id
@done
Scenario: PL3a. The edits
Then applyEdits(text, edits) makes add, set, state, move, remove and check, in order, each naming its task by
id (or #N, its place among the entries, for one that has no id yet)
And add goes under a heading by its words (made when there's none), under a task (a subtask), or before or
after a task; with none of them, at the end
And every task is given an id it lacks
@done
Scenario: PL3b. Closing stamps closed; reopening takes it off
When a task's state becomes done or dropped
Then it gets `closed: "YYYY-MM-DD HH:MM"`
And opening it again removes `closed`
@done
Scenario: PL3c. A wrong edit changes nothing
When an edit names a task that isn't there (under: a task id included, which never becomes a stage heading), a
day that isn't one, a keyword the plan doesn't know or a move into the task's own subtree
Then applyEdits throws, saying what's wrong and how to find the right id, and the text is as it was
Rule: PL4. The app keeps its tasks in the plan
@done
Scenario: PL4a. The host reads and writes the brief's plan through raea goal tasks
Given POST /host/plan {op: read | apply | put, workspace, project}
Then read answers the plan's JSON (`raea goal tasks --json`, run again only when a source file changed) and a
stamp (same: true when the page's stamp still holds); a read for an agent (name: true: its turn, its plan_read)
first gives each task written without an id one, and writes it
And apply makes the edits (`raea goal tasks --apply -`), each written back where its task is written, answering
with the plan they were made on; edits naming a task by its place (#N) carry the plan that place was counted
in, and are refused when the plan has changed since
And put writes an older plan back for Undo (`raea goal tasks --put -`) only while the brief's is still the one
the page last saw
And the e2e host (RAEA_FEED_KEEP=0) keeps nothing: the page's plan is the plan
And a folder with a plan.org has it moved into the brief's plan once on the first read, the old file kept as
.raea/plan.org.was; a plan.ts the brief doesn't import is registered in it
@done
Scenario: PL4b. The to-do list, the composer and raea's own work write plan edits
Given the to-do list (feed/TodoPanel.tsx) open on a project or the Inbox
Then its rows are the plan's tasks as written (subtasks too) and the edits sent on the project's items
And a task linked to an item stands where the item does (the work is the truth)
And add, check off, reword, reorder and remove are plan edits made at once in the page and then on the file
And Undo puts the text back only while the plan hasn't changed since ("The plan has changed since: nothing
undone"), and puts back the file as the edit found it, so a task another writer added before the edit stays
And the list reads the plan again every few seconds and on focus, so an edit by hand or in a terminal shows; an
agent's turn and its plan_read read it again first
And a message sent in the composer is a task in the plan: after the last task carrying the view's tags, held by the
agent it went to, FROM the message's id
And raea's shaping, storyboards, directions and renders are its tasks under Plan and Make, each ITEM the card it
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 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
Given a project whose brief.md still has ## Tasks (every brief before this, and the starter brief's "Write the plan")
When the page has read its kept brief
Then each task is added to the plan with its mark as its keyword, its ### stage as its heading, its @agents by id,
its #tags, its due day as its deadline, its → item as ITEM and its craft verb as VERB
And the task lines, the stages and an emptied ## Tasks leave the brief; everything else in it stays
And a brief the plan can't take (the host refused the write) keeps its tasks, and is tried again next load
And each task's id comes from its stage, its words and which of the same words it is, so a brief moved twice (two
pages open on it, a reload before the brief was saved) adds nothing the second time
@done
Scenario: PL4d. Comment tasks stay where they are
Given an edit sent on an item (model/tasks.ts, raea show --working/--done)
Then it is not copied into the plan; it shows in the same to-do list, under the plan's tasks, as it did
Rule: PL5. Agents use and maintain the plan, whether the person opens it or not
@done
Scenario: PL5a. The plan tools
Given an agent the raea app launches (the feed MCP server, apps/app host/acp/feed-mcp.ts)
Then it has plan_read (the open tasks by id; full: the whole file), plan_add (tasks under a stage or a task,
held by the agent unless it names others), plan_update (mark, tick or add a checkbox, change fields, move,
remove) and plan_close (DONE with `closed` and the item it made, or dropped)
And the page answers them through its plans (@raea/task answerPlanTool), a headless run (host/acp/memory.ts) on
the folder's brief's plan through `raea goal tasks`; a session with no project has no plan, and says so
@done
Scenario: PL5b. Every turn carries the plan
Given an agent's turn in a project (src/acp/session.ts prompt)
Then the prompt carries raea://plan/<project>: the rule to keep the plan, the task this message is (by FROM),
and the open tasks by id under their stages (planDigest)
And the rule: plan work of more than one step first, mark a task MAKING as you start it and REVIEW when it waits
on the person, close it as you finish with the item it made, add what's left, drop rather than remove
And every task it names has an id: a task written without one is given one before the plan is read for the turn
And an agent launched without the plan tools is told to keep the brief's plan with `raea goal tasks`; a message whose task is already
closed says so, rather than asking for it to be marked
Scenario: PL5c. An agent outside raea keeps the same plan
Given Claude Code in a terminal in the project's folder, with the raea skill
Then it reads the plan with `raea goal tasks` and plans and marks with `raea goal tasks --apply` (skills/raea/plan.md),
or edits the plan's literal where the brief writes it, keeping each id
And the person sees its changes in the to-do list within a few seconds
Rule: PL6. A plugin extends plans; React and raea's window read them
@done
Scenario: PL6a. Keywords, properties, kinds and views
Then defineKeywords adds a sequence ("SHOT LIT GRADED | APPROVED") with each word's state; defineProperty a
property with a check; definePlanKind a kind (its keywords, required properties, a check, defaults an add
starts with; a new task of the kind starts at its sequence's first word); defineView a view any page can
build (view(plan, name)); createRegistry one of a plugin's own
And checkPlan says what's wrong by those rules: ids used twice, failing properties, unknown kinds, missing
properties, keywords outside a kind's sequence
And board, agenda and outline are the views raea ships
@done
Scenario: PL6b. React
Then usePlan(text or source) gives the plan, its text and edit; useView a registered view; TaskLine, PlanOutline,
Agenda and BoardLanes draw them, with toggled for a checkbox's edit
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,
# Render and Masters TODO (it had woken itself on a render's report, a turn raea sends no plan with); v0.1.5's
# closed five tasks with every checkbox unticked, so the list read 0/4 on finished work; and its last turn ended
# with Film v2's tasks MAKING, "waiting on three helpers", when the session stopped under them. Nothing asked any
# of them to go on: only a /goal does that, and only when the person sets one.
@done
Scenario: PL7a. Each time an agent stops with tasks of its own open, raea asks it to settle them
Given a chat in a project whose agent's turn ends (apps/app src/plan/PlanKeeper.tsx, beside GoalKeeper)
And tasks of its own are TODO or MAKING in the plan, read from the file first
Then raea's next turn to it lists them by id ("[raea plan] Ask N: ...") and says how each is settled: closed with
the item it made, done now and closed, REVIEW saying what it needs from the person, dropped with why, or a
line starting "WAITING:" naming the job of its own that will report back
And it asks again each time the agent stops while one is TODO or MAKING; REVIEW is the person's, and ends it
And the rule each turn carries says the same: finish what you planned; before you stop, every task of yours is
closed, REVIEW or waiting on a job; close what a job finished when it reports back in a turn you started
@done
Scenario: PL7b. The asks stop
Then they stop when none of its tasks is TODO or MAKING, or pause, saying why, when the person presses Stop, its
session closes or the turn fails, its reply has a WAITING: line, two asks in a row leave the plan as it was, or
12 have gone since the person's last message
And the person's next message starts them again from nothing, and Continue over the composer asks at once
And a chat with an open /goal is the goal's: its checks keep it going, and the plan's asks wait until it's met
@done
Scenario: PL7c. Which tasks are the agent's
Then a task is the chat's when its agent (or the chat) holds it; or nobody holds it and it stands on an item the
chat posted (its ITEM, or a note's item in its FROM: an agent editing the plan by hand leaves AGENT out);
or nobody holds it and it's MAKING while no other agent holds open work
And a task nobody holds otherwise is the person's (written in the to-do list or by hand, moved from a brief): never
pushed on whoever is chatting; one scheduled for a later day waits for that day
@done
Scenario: PL7d. Done means its checkboxes and subtasks are done
When an agent marks a task done (plan_close, or plan_update's state) while a checkbox under it is unticked or a
subtask open
Then the tool refuses, naming each by its place or id, and nothing is written
And plan_close with all: true ticks them and closes the subtasks with it; ticked in the same call, it closes
And dropped closes whatever is under it as it is; the person's own check-off in the to-do list isn't refused
@done
Scenario: PL7e. A post names what's still open
Given an agent's feed_post in a project
Then its answer carries the agent's open tasks and asks it to close what the post finished, with the item, so a
turn the agent started itself (a job reporting back carries no plan) still closes them
@done
Scenario: PL7f. Seen in the chat
Then each ask is a small line of its own ("Finishing the plan (2): 3 open"), never the marker in the person's words
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 their plan on @raea/task and start them from Asana, Linear, Jira and other boards.
@done
Scenario: PL8a. The brief's plan 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 brief's `plan` and nowhere else: the rest of brief.ts says what to make, and a
brief that still has old stages or a ## Tasks reads, those unread, with `raea doctor` saying they belong in
the plan
And a goal's rules (docs/goal.feature) are never copied into it: the to-do list shows them and their
state from review/goal.json beside the plan's own tasks
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 `keywords` are its sequences, each "OPEN WORDS | CLOSING WORDS"; 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 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 plan's `trackers` map each system's statuses to
keywords: `trackers: { 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 tracker status mapped to a 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