create-pmos 0.764.0 → 0.765.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/package.json +38 -20
  2. package/payload/AGENTS.md +1 -1
  3. package/payload/KIT-VERSION +1 -1
  4. package/payload/planning/evals/eval-calibration.md +1 -1
  5. package/payload/planning/okrs/health-budgets.md +1 -1
  6. package/payload/state/discoveries.md +1 -1
  7. package/workspace/changelog.json +37 -0
  8. package/workspace/guide/breakdown.md +1 -1
  9. package/workspace/guide/cli.md +8 -0
  10. package/workspace/guide/home.md +1 -1
  11. package/workspace/guide/initiatives-and-next-steps.md +2 -2
  12. package/workspace/lib/briefing-premium-agent.js +4 -1
  13. package/workspace/lib/cos-chat.js +1 -1
  14. package/workspace/lib/engine/boards.js +9 -2
  15. package/workspace/lib/initiative-chat.js +1 -1
  16. package/workspace/lib/pmos-verbs.js +1 -1
  17. package/workspace/lib/program-chat.js +11 -6
  18. package/workspace/lib/program-cli.js +150 -2
  19. package/workspace/lib/programs.js +2 -1
  20. package/workspace/lib/routes-boards.js +62 -5
  21. package/workspace/lib/task-cli.js +45 -12
  22. package/workspace/lib/task-describe.js +228 -0
  23. package/workspace/lib/task-store.js +2 -2
  24. package/workspace/package-lock.json +2 -2
  25. package/workspace/package.json +1 -1
  26. package/workspace/premium-chat-viewer-test.js +3 -0
  27. package/workspace/premium-vw-jira-test.js +1 -1
  28. package/workspace/public/pm/bd-prog-panel.js +2 -0
  29. package/workspace/public/pm/cozy-home.css +1 -0
  30. package/workspace/public/pm/cozy-popup.js +2 -2
  31. package/workspace/public/pm/cozy-task-pop.css +10 -0
  32. package/workspace/public/pm/cozy-task-pop.js +46 -2
  33. package/workspace/public/pm/home-app.js +1 -1
  34. package/workspace/public/pm/home-chat.js +16 -6
  35. package/workspace/public/pm/home-ini.js +2 -1
  36. package/workspace/public/pm/library-open.js +1 -0
  37. package/workspace/public/pm/page-chat.js +7 -2
  38. package/workspace/public/pm/premium-board.js +2 -1
  39. package/workspace/public/pm/task-card.js +2 -0
  40. package/workspace/public/pm/vw-ds.js +38 -0
  41. package/workspace/test-lists/chat-subtasks.json +9 -0
  42. package/workspace/test-lists/task-descriptions.json +9 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-pmos",
3
- "version": "0.764.0",
3
+ "version": "0.765.0",
4
4
  "description": "Scaffold the PMOS portable kit — run the PMOS product-management workflow (initiative → lane-fit spec → contract → build → three gates, with work-type lanes for features, research, maintenance, incidents, and content) entirely inside your own repo, with all state as git-versioned files. Includes `workflow-sweep`, which audits the state every board derives from and separates real defects from work you simply have not done. `create-pmos workspace` also installs + launches the local Terminal Workspace GUI. No database, no network, no telemetry.",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -33,6 +33,43 @@
33
33
  "audit"
34
34
  ],
35
35
  "pmosChanges": [
36
+ {
37
+ "v": "0.765.0",
38
+ "at": "2026-11-24T07:12:50.601Z",
39
+ "f": 4,
40
+ "prs": [
41
+ {
42
+ "n": 1726,
43
+ "t": "Chat creates subtasks — pmos task add/set take --parent with an Undo line",
44
+ "s": "Chat creates subtasks — pmos task add/set take --parent with an Undo line",
45
+ "k": "fix"
46
+ },
47
+ {
48
+ "n": 1721,
49
+ "t": "A document's chat sends, and a send that fails says why",
50
+ "s": "A document's chat sends, and a send that fails says why",
51
+ "k": "fix"
52
+ },
53
+ {
54
+ "n": 1724,
55
+ "t": "A chat saves program changes, and the Board shows them at once",
56
+ "s": "A chat saves program changes, and the Board shows them at once",
57
+ "k": "fix"
58
+ },
59
+ {
60
+ "n": 1725,
61
+ "t": "An initiative opened from Today opens in the full popup again",
62
+ "s": "An initiative opened from Today opens in the full popup again",
63
+ "k": "fix"
64
+ },
65
+ {
66
+ "n": 1722,
67
+ "t": "Every task has a description PMOS writes",
68
+ "s": "Every task has a description PMOS writes",
69
+ "k": "new"
70
+ }
71
+ ]
72
+ },
36
73
  {
37
74
  "v": "0.764.0",
38
75
  "at": "2026-11-24T06:08:25.279Z",
@@ -339,25 +376,6 @@
339
376
  "k": "new"
340
377
  }
341
378
  ]
342
- },
343
- {
344
- "v": "0.745.0",
345
- "at": "2026-11-23T10:30:13.712Z",
346
- "f": 4,
347
- "prs": [
348
- {
349
- "n": 1659,
350
- "t": "Start a chat about a product from Work, and a program's chat answers its first message",
351
- "s": "Start a chat about a product from Work, and a program's chat answers its first message",
352
- "k": "fix"
353
- },
354
- {
355
- "n": 1669,
356
- "t": "A date suggestion names the days it moves work to",
357
- "s": "A date suggestion names the days it moves work to",
358
- "k": "fix"
359
- }
360
- ]
361
379
  }
362
380
  ]
363
381
  }
package/payload/AGENTS.md CHANGED
@@ -48,7 +48,7 @@ It refuses frontmatter, fenced and indented code, table rows, headings, delibera
48
48
  | `log_friction` / `log_discovery` | append to `pmos/state/discoveries.md` (ISO date, `#friction` tag where applicable) |
49
49
  | `get_agent_runs` / `get_friction` | read those same files (your episodic memory — consult before contracting) |
50
50
 
51
- **Programs** (the level above initiatives, across products) are not an initiative key. A program is a line in `pmos/state/programs.jsonl`: `{"kind":"program",…}` is the charter and `{"kind":"member","program":"<id>","initiative":"<id>"}` puts an initiative in it. Never add `kind`, `program`, `programme`, `parent_program` or `parent_programme` to an initiative record: nothing reads them. You do not write `programs.jsonl`: the PM makes a program on the Board (an initiative's ⋯ → **Turn into a program**, or + → **New program**).
51
+ **Programs** (the level above initiatives, across products) are not an initiative key. A program is a line in `pmos/state/programs.jsonl`: `{"kind":"program",…}` is the charter and `{"kind":"member","program":"<id>","initiative":"<id>"}` puts an initiative in it. Never add `kind`, `program`, `programme`, `parent_program` or `parent_programme` to an initiative record: nothing reads them. Never write `programs.jsonl` by hand. When the PM asks for a program change, or says yes to one you drafted, make it with `pmos program` (`new`, `charter`, `join`, `leave`, `milestone`, `check`, `task`, `order`, `archive`; `pmos program help`) and give the Undo it prints. The Board shows it when your turn ends.
52
52
 
53
53
  State files are **append-only**: never rewrite or delete an existing line or initiative record; correct by appending. When a vendored skill names a hosted tool, apply this table — the skill bodies are single-sourced from the PMOS kernel and are not forked for file mode.
54
54
 
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@4915181c
1
+ kernel-source: pmos@5bf77c3b
2
2
  assembled: 2026-11-24
3
3
  mode: vendor
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Eval calibration log"
4
4
  description: "Append-only record of every PM override of an evaluator verdict."
5
- generated: {by: process:create-pmos, at: "2026-11-24T06:08:21Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-24T07:12:47Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Health budgets"
4
4
  description: "Closed registry of health-budget anchors (D59), edited only by the PM."
5
- generated: {by: process:create-pmos, at: "2026-11-24T06:08:21Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-24T07:12:47Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Discoveries and friction log"
4
4
  description: "Append-only record of what runs discovered and where the process rubbed."
5
- generated: {by: process:create-pmos, at: "2026-11-24T06:08:21Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-24T07:12:47Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -1,4 +1,41 @@
1
1
  [
2
+ {
3
+ "v": "0.765.0",
4
+ "at": "2026-11-24T07:12:50.601Z",
5
+ "f": 4,
6
+ "prs": [
7
+ {
8
+ "n": 1726,
9
+ "t": "Chat creates subtasks — pmos task add/set take --parent with an Undo line",
10
+ "s": "Chat creates subtasks — pmos task add/set take --parent with an Undo line",
11
+ "k": "fix"
12
+ },
13
+ {
14
+ "n": 1721,
15
+ "t": "A document's chat sends, and a send that fails says why",
16
+ "s": "A document's chat sends, and a send that fails says why",
17
+ "k": "fix"
18
+ },
19
+ {
20
+ "n": 1724,
21
+ "t": "A chat saves program changes, and the Board shows them at once",
22
+ "s": "A chat saves program changes, and the Board shows them at once",
23
+ "k": "fix"
24
+ },
25
+ {
26
+ "n": 1725,
27
+ "t": "An initiative opened from Today opens in the full popup again",
28
+ "s": "An initiative opened from Today opens in the full popup again",
29
+ "k": "fix"
30
+ },
31
+ {
32
+ "n": 1722,
33
+ "t": "Every task has a description PMOS writes",
34
+ "s": "Every task has a description PMOS writes",
35
+ "k": "new"
36
+ }
37
+ ]
38
+ },
2
39
  {
3
40
  "v": "0.764.0",
4
41
  "at": "2026-11-24T06:08:25.279Z",
@@ -30,7 +30,7 @@ When a stage has 8 or more tasks and several of them share a go-live date, PMOS
30
30
 
31
31
  A parent shows a fold arrow and "n of m done". Its dates are the earliest start and the latest end of the tasks under it. A parent with more than five subtasks is folded until you open it. When you tick a parent that has open subtasks, PMOS asks once if it must tick them too.
32
32
 
33
- In the terminal, `pmos task set <task> --parent <task>` sets the parent, and `--parent none` moves the task back to the top level. `pmos task list` shows each subtask under its parent.
33
+ In the terminal or the initiative chat, `pmos task set <task> [<task> …] --parent <task>` puts one or more tasks under a parent, and `--parent none` moves them back to the top level. The answer prints an `Undo:` line that puts each task back under the parent it had. `pmos task add <initiative> "<title>" --parent <task>` adds a new subtask. `pmos task list` shows each subtask under its parent. Ask the chat to group a long stage into task and subtask, and it makes the parent tasks and moves the tasks under them; every task keeps its state.
34
34
 
35
35
  ## Sprint and priority
36
36
 
@@ -559,7 +559,9 @@ An agent adds and closes tasks when you ask, so you do not have to find the task
559
559
  - `pmos task list <initiative>` lists the initiative's open tasks (To do and In progress) with their ids. `--all` adds the Done, Won't do and Archived tasks.
560
560
  - `pmos task state <task> [<task> …] --to <state>` sets the state of one or more tasks: To do, In progress, Done, Won't do or Archived. `--why` adds the reason, and for Done it is the evidence you read. Each change writes the same line as the page's press, under the agent's name. Won't do on a breakdown item withdraws it, and it cannot come back.
561
561
  - `pmos task set <task> [<task> …] --stage <stage>` puts one or more tasks under a stage of the initiative's workflow, by the stage's key or name. `--stage none` takes them out of every stage. The Tasks section groups the tasks by these stages. A task's stage is its place in the plan: it does not change the task's state, and it does not move the initiative. `set` also takes `--due`, `--start`, `--owner` and `--notes`; `--due none` and `--start none` clear a day.
562
+ - `pmos task set <task> [<task> …] --parent <task>` puts tasks under a parent task as subtasks; `--parent none` moves them back to the top level. A loop or a parent that does not exist is refused. The answer prints an `Undo:` line, one command per old parent. `pmos task add … --parent <task>` adds a new task as a subtask.
562
563
  - `pmos task remove <task> [<task> …]` deletes a task that was added by mistake, such as a placeholder or a duplicate. The task goes from every list, and the Undo on the page brings it back. For work that stopped, use Archived or Won't do instead. A breakdown item cannot be deleted: set it to Won't do.
564
+ - `pmos task describe <task>` prints the task's description and its sources. `pmos task describe <task> "<text>"` writes it: what the task is, why it matters, and when it is done. `none` clears it. The task page shows it at once, with Undo. When a task has no description, PMOS writes one by itself from the initiative's record, PRD and plan documents, and names its sources. A Jira ticket keeps its description in Jira.
563
565
  - `pmos task link <from> <to>` makes `<to>` wait on `<from>`. `--type` sets how they wait: `fs` (start after it finishes, the default), `ss` (start when it starts), `ff` (finish when it finishes) or `sf` (finish when it starts). `--lag` adds days, or takes them away with a negative number. Make a link only when the PM asks for it. To suggest a link, add `--propose --why "<reason>"`: the link shows under the blue ✦ in the Tasks header, and the PM approves it or drops it. A link that loops back to a task is refused.
564
566
  - `pmos task unlink <from> <to>` removes the link. The dates stay as they are.
565
567
 
@@ -626,6 +628,12 @@ The program line moves a program through four stations. Each station has an exit
626
628
 
627
629
  An initiative with no plan end is "can't tell". PMOS never guesses its date.
628
630
 
631
+ - `pmos program new "<title>"` makes a program in this repository. `--from <initiative>` turns that initiative into the program, and it joins. `--goal` and `--target` set the card.
632
+ - `pmos program join <id> <initiative>` puts an initiative of this repository in a program. It leaves any other program. `pmos program leave <id> <initiative>` takes it out, and off the milestones that waited on it.
633
+ - `pmos program milestone <id> add "<name>" --date YYYY-MM-DD` adds a milestone (`--waits <initiative>,…` for the initiatives it waits on). `move <milestone> --date`, `rename <milestone> "<name>"` and `drop <milestone>` change one. `pmos program check <id> <milestone>` marks a milestone that waits on no initiative as done.
634
+ - `pmos program task <id> "<title>"` adds a program task (`--owner`, `--due`, `--key` to change one). `pmos program task-done <id> <key>` marks it done.
635
+ - `pmos program archive <id>` takes a program off the Board. `pmos program unarchive <id>` puts it back.
636
+ - Each of these writes the line the Board's own press writes, prints the command that undoes it, and shows on the Board when the chat turn ends.
629
637
  - `pmos program line [<id>]` shows each open program: its station, what is missing, the next move and the forecast against the target. A program across several products gets one forecast from all of them. When two products need one team in Build and the team has no free place, PMOS shows one decision row with a recommendation: the initiative whose program has the earlier target goes first. It reads every product on this computer and writes nothing. Add `--json` for the whole answer.
630
638
  - `pmos program draft <id>` files PMOS's milestone drafts as suggestions. The program shows them with Keep and Decline. Nothing changes until you keep one.
631
639
  - `pmos program order <id> [<id>,<id>,…]` saves the order of the program's initiatives. With no list, it saves the order PMOS proposes. `--clear` goes back to A to Z. It prints the command that undoes it.
@@ -220,7 +220,7 @@ There is no My work page. The list on Home is your list:
220
220
  - **Recording.** Record a note now, with no calendar event.
221
221
  - **Initiative.** The Board opens with **New initiative**, in the open product.
222
222
  - **Sessions.** A session row names its agent. The coloured dot beside it is its state: blue waits on you, amber may be blocked, green is running. A session PMOS started itself (a skill or a background job) shows on Home only while it works or asks you something. Once it finishes its prompt, it leaves the list. On an initiative's page, a session that waits on you shows once, under **Needs you**, not again under **Sessions**. **Finished sessions** does not list an old run of a chat that is open again.
223
- - **One chat box.** Every conversation has the same box: **+** (attach a file, notes, the terminal, and **Link to an initiative** for a loose chat), **/** for commands, **@** inside an initiative, the To or In chip, the mic, and Send. A chat opens at its newest message.
223
+ - **One chat box.** Every conversation has the same box: **+** (attach a file, notes, the terminal, and **Link to an initiative** for a loose chat), **/** for commands, **@** inside an initiative, the To or In chip, the mic, and Send. A chat opens at its newest message. If a message cannot be sent, a red **Not sent:** line under the box says why, and your words and files stay in the box. The chat beside a document (Library, an initiative's artefacts) is about that document and reads its file.
224
224
  - **While PMOS works.** A line at the top of the chat shows what PMOS is trying to do. If PMOS keeps a to-do list, the line shows the to-do in progress and how many are done, for example **2 of 5 done**. Tap the line to see the full list. If PMOS has no to-do list, the line shows PMOS's newest one-line status and the time since your message. The line never shows raw commands. To see the commands, tap the terminal icon.
225
225
  - **A session's terminal.** **Watch its terminal** in **+**, or a session row such as **Claude sign-in**, opens the session's terminal in the Viewer. While the session runs, it is a real terminal: type in it to answer PMOS or paste a code. It fills the Viewer and fits its lines again when you resize the Viewer or the window. The chat goes on showing every answer while the terminal is open and after you close it: the terminal is a second view of the same session. When the session has ended, the Viewer shows it read only and says so.
226
226
  - **Setting up your first project opens by itself** until a registered folder holds an initiative or setup has finished. The `PMOS` folder that the one-line installer makes holds no initiative yet, so a new user who opens PMOS from the Start menu or the Dock still gets the setup conversation, not an empty Home.
@@ -2,12 +2,12 @@
2
2
  type: Guide
3
3
  title: "Initiatives: the Roadmap, next steps, the Driver and done"
4
4
  description: "The ranked list of initiatives, how PMOS works out the next steps, the Initiative Driver, and integrated work."
5
- timestamp: 2026-11-23
5
+ timestamp: 2026-11-24
6
6
  ---
7
7
 
8
8
  # Initiatives: the Roadmap, next steps, the Driver and done
9
9
 
10
- Open an initiative from Home's list. It opens as a page in the Viewer. Its stage card shows the stage, how many of its steps are done, and the steps still open: yours first, then a running agent, then late or blocked steps, then the ones waiting on someone. The last node is the next stage. [Home](home.md) explains the initiative's page.
10
+ Open an initiative from Home's list. It opens as a page in the Viewer. On a computer, an initiative that you open from Today, Work or a link always opens in the full popup (Overview, The case, Stages, Work breakdown). The older page with the stage card and the Experiment is ⋯ › **Every part**. Its stage card shows the stage, how many of its steps are done, and the steps still open: yours first, then a running agent, then late or blocked steps, then the ones waiting on someone. The last node is the next stage. [Home](home.md) explains the initiative's page.
11
11
 
12
12
  This page explains the rules behind those steps: where they come from, who owns each one, and what an agent session started on a step may do. The console drew a **prepare** and **go** control under each step, and it was removed. The same plan can still be prepared, approved and started with `pmos proactive prepare`, under the same rules (see [Today and the proactive engine](proactive-engine.md)).
13
13
 
@@ -108,8 +108,11 @@ function popRow(c) {
108
108
  /** A chat that may start from what the page says it is about, when the server's model has no row for it: an initiative (init:), and a
109
109
  * program or a whole product (board:, bug 2026-11-23: the Board model holds initiatives only, so a program's or a product's chat answered
110
110
  * 404 and the first message went nowhere). A board: chat needs the page's words; with none it still needs a row. */
111
+ /** A chat the server's models have no row for, that still starts: an initiative's (it reads its own record), a program's or a product's with the
112
+ * page's words, and a document's (bug 2026-11-24: a Library or artefact document's chat, doc:doc:<ws>:<path>, matched no row, so its first
113
+ * message failed with "that row is not on the page" and the popup's chat did nothing). The page's words, when it sends them, name the file. */
111
114
  function scopedByContext(key, context) {
112
- return /^init:/.test(String(key)) || (/^board:/.test(String(key)) && typeof context === 'string' && !!context.trim());
115
+ return /^(init|doc):/.test(String(key)) || (/^board:/.test(String(key)) && typeof context === 'string' && !!context.trim());
113
116
  }
114
117
  function contextRow(key, context) {
115
118
  const say = typeof context === 'string' ? clip(context, 600) : '';
@@ -54,7 +54,7 @@ const RULE = [
54
54
  'You are the PM\'s chief of staff in PMOS. This chat has no scope: it reads everything the PM works on.',
55
55
  'Read with the `pmos` commands (pmos today, pmos board, pmos jira, pmos calendar, pmos past, pmos mention, pmos outcomes, pmos metrics, pmos people, pmos docs, pmos report list), never by opening PMOS record files (*.jsonl, planning/ records) yourself: the commands apply the same rules the pages do. Run `pmos <verb> help` when unsure.',
56
56
  'End every answer that rests on a read with one fenced code block with the language tag pmos-src holding one JSON array: [{"name":"Board","fresh":"read now"},{"name":"Jira","fresh":"read 4 min ago"}]. Name each source and how fresh it is; say "not read" for one you could not reach. The page shows it under your answer.',
57
- 'Five kinds of work, one rule each. A read runs at once and asks nothing. Upkeep with one right answer (repair a record, close an ask a decision retired, refresh a stale read) you finish, and say it once. A change inside PMOS (move a date, add a task, set a state, draft a report) is a proposal the PM keeps with ✓: file it with `pmos propose` or `pmos task`, never write it yourself. Anything that leaves PMOS (email, Slack, a Jira comment, an invite) is a draft in the outbox that the PM sends: never send it. A longer job (a report, a grill, an update, a clean-up) runs to its end; stop only for a call that is the PM\'s, and save those for one proposal.',
57
+ 'Five kinds of work, one rule each. A read runs at once and asks nothing. Upkeep with one right answer (repair a record, close an ask a decision retired, refresh a stale read) you finish, and say it once. A change inside PMOS (move a date, add a task, set a state, a program\'s goal) that the PM asked for in their own words, or said yes to, you make at once with its `pmos` command and give the Undo it prints: the page shows it when your turn ends (Wawan 2026-11-23: a chat write always lands). A change the PM did not ask for is a proposal the PM keeps with ✓: file it with `pmos propose` or `pmos task`. Never write a record file by hand. Anything that leaves PMOS (email, Slack, a Jira comment, an invite) is a draft in the outbox that the PM sends: never send it. A longer job (a report, a grill, an update, a clean-up) runs to its end; stop only for a call that is the PM\'s, and save those for one proposal.',
58
58
  'Never from this chat: accept a run, anchor or dispose an initiative, approve a contract, merge a pull request. These stay on the PM-only pages. Say where each one waits and stop.',
59
59
  'You are the chief: the one live session over every Program, Product and Project. Each unit has one owner, a record with a daily brief, never a session; an initiative in a program is the program\'s, else its product\'s. Never ask another session; read the records. `pmos units` lists the units and their briefs. You may run these yourself: `pmos owner brief [<unit>]` (a fresh brief now), `pmos team dispatch --unit <unit>` (the roles for the unit\'s first open initiative), `pmos team pause|resume --unit <unit>` (stop or restart the role runs on a unit). When the same lesson shows in two units, file it with `pmos propose` as a workspace rule the PM keeps or drops.',
60
60
  'Answer in plain sentences, the answer first. Never start with "I can help with".',
@@ -38,6 +38,7 @@
38
38
  * task { task, type: Task|Epic, initiative, title, epic, owner, state, start, due } a PMOS task (or PMOS epic) on the board
39
39
  * task-update { task, state?, start?, due?, title?, owner?, notes?, initiative?, why } a status move, a reschedule, a rename or an edit in the Viewer
40
40
  * ticket-note { ref, notes } the PM's own notes on a Jira ticket (Jira keeps its fields)
41
+ * task-description { task, description, sources? } a task's description (task-descriptions): '' clears; sources [{ path, line, title }]
41
42
  * task-section { task, section } a task's place in the breakdown (one view, feedback batch 6 item 1): the key
42
43
  * of a stage of its initiative's workflow, '' for "Not in a stage". It is the task's place, never its state, and moving a task
43
44
  * never moves the initiative. `task` is a Board task or a breakdown item; the last line wins.
@@ -192,7 +193,9 @@ const KINDS = new Set(['board', 'workflow', 'move', 'assign', 'ask', 'ask-accept
192
193
  // Delete an initiative with its tasks, and its Undo (feedback batch 16 item 5d)
193
194
  'ini-delete', 'ini-restore',
194
195
  // a task's priority, set in the row (initiative inline-sprint-priority): P1, P2 or P3; '' takes it out
195
- 'task-priority']);
196
+ 'task-priority',
197
+ // a task's description (initiative task-descriptions): what it is, why, and when it is done; '' clears it
198
+ 'task-description']);
196
199
  // A task's state is its only stage (Wawan, 2026-10-25): the same five every workflow ends in. An old 'In review' reads as In progress (taskState).
197
200
  const TASK_STATES = Object.freeze(['To do', 'In progress', 'Done', "Won't do", 'Archived']);
198
201
  const taskState = (s) => (s === 'In review' ? 'In progress' : TASK_STATES.includes(s) ? s : null);
@@ -226,6 +229,7 @@ function fold(events) {
226
229
  const parents = new Map(); // task id (or Jira key) → the id of its parent task (subtasks, initiative work-subtasks); the last task-parent line wins
227
230
  const orders = new Map(); // key(initiative, section) → the task ids in the PM's order inside that stage; the last task-order line wins
228
231
  const pins = new Map(); // task id (or Jira key) → true | false: the PM's pin on a milestone; a null line takes it out (the rule again)
232
+ const descriptions = new Map(); // task id → { text, by, at, sources }: the task's description (task-descriptions); the last line wins, '' clears
229
233
  const priorities = new Map(); // task id → 'P1' | 'P2' | 'P3': the PM's priority (inline-sprint-priority); a '' line takes it out, the last line wins
230
234
  const removed = new Map(); // task id → the task a task-remove took out, so a task-restore (Delete's Undo) puts it back
231
235
  const ticketNotes = new Map(); // key(board, Jira key) → the PM's notes on that ticket (the last ticket-note line wins)
@@ -332,6 +336,9 @@ function fold(events) {
332
336
  } else if (e.kind === 'task-order' && typeof e.initiative === 'string' && e.initiative && typeof e.section === 'string' && Array.isArray(e.tasks)) {
333
337
  const ids = e.tasks.filter((x) => typeof x === 'string' && x);
334
338
  if (ids.length) orders.set(key(e.initiative, e.section), ids); else orders.delete(key(e.initiative, e.section));
339
+ } else if (e.kind === 'task-description' && typeof e.task === 'string' && e.task && typeof e.description === 'string') {
340
+ if (e.description) descriptions.set(e.task, { text: e.description, by: e.by || null, at: e.at || null, sources: Array.isArray(e.sources) ? e.sources.filter((x) => x && typeof x.path === 'string').slice(0, 8) : [] });
341
+ else descriptions.delete(e.task);
335
342
  } else if (e.kind === 'task-priority' && typeof e.task === 'string' && e.task && typeof e.priority === 'string' && /^(P[1-3])?$/.test(e.priority)) {
336
343
  if (e.priority) priorities.set(e.task, e.priority); else priorities.delete(e.task);
337
344
  } else if (e.kind === 'task-pin' && typeof e.task === 'string' && e.task && (typeof e.pinned === 'boolean' || e.pinned === null)) {
@@ -415,7 +422,7 @@ function fold(events) {
415
422
  suggestNo.set(e.id, { kind: e.of === 'merge' ? 'merge' : 'split', fp: e.fp, at: e.at || null });
416
423
  }
417
424
  }
418
- return { boards, moves, assigns, asks, stages, iniWorkflows, tasks, removed, sections, parents, orders, milestones, pins, priorities, ticketNotes, ticketDates, epics, archives, deleted, notDup, iniWf, ends, judged, autoOver, ticketMoves, backlogRank, smOps, smUndone, suggestNo, events: list };
425
+ return { boards, moves, assigns, asks, stages, iniWorkflows, tasks, removed, sections, parents, orders, milestones, pins, priorities, descriptions, ticketNotes, ticketDates, epics, archives, deleted, notDup, iniWf, ends, judged, autoOver, ticketMoves, backlogRank, smOps, smUndone, suggestNo, events: list };
419
426
  }
420
427
 
421
428
  /** The stages an initiative runs on a board: its own workflow when one is recorded, else the board's. */
@@ -55,7 +55,7 @@ function rule(info, id) {
55
55
  `The workflow stage is on the initiative: the stage card and the Board show it. \`pmos workflow of ${ini}\` reads it. When the PM asks to move the initiative, run \`pmos workflow move ${ini} --stage <key> --why "<reason>"\`. When the PM asks to change its workflow, run \`pmos workflow switch ${ini} --to <workflow id>\`. Both write what the page's press writes, under your name.`,
56
56
  'There is one kind of task: the ones the PM sees in the initiative\'s Tasks section. The stage card\'s To finish entries and the older breakdown items are tasks too. '
57
57
  + 'A task\'s state is To do, In progress, Done, Won\'t do or Archived. The Tasks section groups the tasks under the stages of this initiative\'s workflow: a task\'s group is its place in the breakdown, never its state. When the PM asks to add, close, group or change a task, '
58
- + `do it yourself, never send the PM to the Board: \`pmos task add ${ini} "<title>" [--stage <stage>] [--due YYYY-MM-DD]\` adds one, \`pmos task list ${ini}\` names them all, \`pmos task state <task> [<task> …] --to "<state>" --why "<what shows it>"\` sets their state and \`pmos task set <task> [<task> …] --stage <stage>|none\` groups them (it also takes --due, --start, --owner, --notes; none clears a date). \`pmos task remove <task> [<task> …]\` deletes a task added by mistake when the PM asks; work that stopped is Archived instead. Never use \`pmos item add\` for new work, and never change tasks to move the initiative.`,
58
+ + `do it yourself, never send the PM to the Board: \`pmos task add ${ini} "<title>" [--stage <stage>] [--due YYYY-MM-DD] [--parent <task>]\` adds one, \`pmos task list ${ini}\` names them all, \`pmos task state <task> [<task> …] --to "<state>" --why "<what shows it>"\` sets their state and \`pmos task set <task> [<task> …] --stage <stage>|none\` groups them (it also takes --due, --start, --owner, --notes; none clears a date). Tasks nest: \`pmos task set <task> [<task> …] --parent <task>|none\` puts tasks under a parent task as subtasks, or back at the top level with none, and \`--parent\` on add makes a new subtask. When the PM asks to group tasks into task and subtask, make the parent tasks and move the tasks under them, keeping each task and its state; never close tasks as Won't do to group them. Tell the PM the Undo line the command prints. \`pmos task describe <task> "<text>"\` writes a task's description (What, Why, Done when) and \`pmos task describe <task>\` reads it. \`pmos task remove <task> [<task> …]\` deletes a task added by mistake when the PM asks; work that stopped is Archived instead. Never use \`pmos item add\` for new work, and never change tasks to move the initiative.`,
59
59
  // batch 31 (Wawan 2026-11-18): the chat offered to rewrite a closed initiative's dates to clear "145 days over"; the count was the page's bug
60
60
  'The "N days over" badge counts from the planned finish (the latest due of its tasks). While the initiative is open it counts to today. Once it is in its workflow\'s last stage (Closed, Done) it counts to when the work really finished: the end of its last Done task, else the day it moved into that stage. On time, the badge goes away and the card says Done with that date; late, it reads "Finished N days late" and that number never grows. '
61
61
  + 'Never change a date, a task or the stage to clear or shorten the badge: the dates are the record. When the PM asks why it shows, explain this rule.',
@@ -92,7 +92,7 @@ const VERBS = Object.freeze({
92
92
  blueprint: Object.freeze({ module: 'blueprint-cli.js', run: null, guide: 'cli.md',
93
93
  help: 'pmos blueprint [list|show|unplaced|check] — every feature of the product with a status worked out from its evidence (pmos blueprint help)' }),
94
94
  program: Object.freeze({ module: 'program-cli.js', run: null, guide: 'cli.md',
95
- help: 'pmos program line|draft|order|capacity|decide|outcome|charter|suggest — the program line (Charter, Sequence, Track, Land) and the milestone suggestions for a program (pmos program help)' }),
95
+ help: 'pmos program new|charter|join|leave|milestone|check|task|archive|line|draft|order|capacity|decide|outcome|suggest — make and change programs from the chat, the program line (Charter, Sequence, Track, Land) and the milestone suggestions (pmos program help)' }),
96
96
  // Not a pm-os-absorb verb (run: null): c3-meet-extension added it through the same table.
97
97
  extension: Object.freeze({ module: 'extension-cli.js', run: null, guide: 'cli.md',
98
98
  help: 'pmos extension — the folder of the Chrome extension for Google Meet, and the three steps to load it' }),
@@ -4,7 +4,8 @@
4
4
  * <state>/programs.jsonl (lib/programs.js), not a key on an initiative record. Without this rule a chat looked for "a program marker", found
5
5
  * none, and invented one (`kind: programme` in the initiative's front matter, children linked by `parent_programme`). Nothing reads those keys.
6
6
  * When a message is about a program, the chat route types it into the session with this rule first, as lib/report-chat.js does for reports.
7
- * Every program write is a page press (lib/routes-programs.js, pm-guard requirePagePress): the chat points the PM at the press and makes none. */
7
+ * The Board's presses go through lib/routes-programs.js (a page press). The chat makes the same writes with `pmos program` (lib/program-cli.js)
8
+ * once the PM asked or said yes, and gives the Undo (initiative chat-saves-to-cards, bug 2026-11-24: "Yes, save it" was refused). */
8
9
 
9
10
  // The first line of every message PMOS wraps. The page reads it to show the PM's turn as typed (public/pm/goal-chat.js shownUser).
10
11
  const MARK = '[PMOS program]';
@@ -18,11 +19,15 @@ const RULE = [
18
19
  'PMOS has programs. A program is the level above initiatives (Program > Initiative > Epic) and can span products. It has no stages of its own: its state, products and stage spread come from its initiatives.',
19
20
  'A program is a record in programs.jsonl in a workspace state folder (pmos/state/ or the workspace state folder), one JSON line each: {"kind":"program",…} is the charter, {"kind":"member","program":"<id>","initiative":"<id>"} puts an initiative in it, and "leave", "task", "check", "order" (the PM\'s sequence of its initiatives) and "archive" lines follow the same pattern. A program id is its title in lower case with dashes, for example project-horizon.',
20
21
  'A program is NOT a key on an initiative. Never add kind, program, programme, parent_program or parent_programme to an initiative record or any front matter: nothing reads them.',
21
- 'You never make, change, join, leave or archive a program yourself, and you never write programs.jsonl: the routes refuse an agent session, and the PM presses on the Board.',
22
- 'Tell the PM which press does what they asked:',
23
- '- An initiative becomes a program (for example "set X as a program"): on the Board, open the initiative, press ⋯, then Turn into a program. The initiative joins the new program, and the program panel opens with a card to sort its tasks.',
24
- '- A new, empty program: on the Board, press + (New), then New program.',
25
- '- To see a program: press its name on the Board, or open /premium-board.html?program=<id>.',
22
+ 'When the PM asks for a program change, or says yes to one you drafted, make it at once with the `pmos program` command below, run in the repository where the program was made (join and leave: where the initiative is). Never write programs.jsonl by hand. Each command prints an Undo: tell the PM the change is saved and give the Undo in one line. The Board shows the change when your turn ends.',
23
+ '- The card\'s Goal, For, target date or owner: pmos program charter <id> --goal "<text>" | --why "<text>" | --target YYYY-MM-DD | --owner "<name>"',
24
+ '- A new program: pmos program new "<title>" [--goal "<text>"] [--target YYYY-MM-DD]. An initiative becomes a program ("set X as a program"): pmos program new "<title>" --from <initiative id>.',
25
+ '- An initiative joins or leaves: pmos program join <id> <initiative> · pmos program leave <id> <initiative>',
26
+ '- Milestones: pmos program milestone <id> add "<name>" --date YYYY-MM-DD [--waits <initiative>,…] · move <milestone id> --date YYYY-MM-DD · rename <milestone id> "<name>" · drop <milestone id>. A milestone that waits on no initiative is marked done with pmos program check <id> <milestone id>.',
27
+ '- Program tasks: pmos program task <id> "<title>" [--owner "<name>"] [--due YYYY-MM-DD] · pmos program task-done <id> <key>',
28
+ '- The order of its initiatives: pmos program order <id> <id>,<id>,… · Archive it: pmos program archive <id> (Undo: pmos program unarchive <id>).',
29
+ 'Run `pmos program help` when unsure. If a command refuses, say what it printed and what would let it through; never send the PM to the Board for a change a command makes.',
30
+ 'To see a program: press its name on the Board, or open /premium-board.html?program=<id>.',
26
31
  'You can read programs.jsonl to answer a question about a program. If the PM asks you to sort a turned program\'s tasks into program, initiative or epic, propose a level for each task in a list and let the PM decide.',
27
32
  ].join('\n');
28
33
 
@@ -15,7 +15,7 @@ const fs = require('fs');
15
15
  const pmItems = require('./pm-items.js');
16
16
  const MS = require('./milestone-suggest.js');
17
17
 
18
- const COMMANDS = { program: ['suggest', 'charter', 'line', 'draft', 'order', 'capacity', 'decide', 'outcome'] };
18
+ const COMMANDS = { program: ['suggest', 'charter', 'new', 'join', 'leave', 'task', 'task-done', 'check', 'milestone', 'archive', 'unarchive', 'line', 'draft', 'order', 'capacity', 'decide', 'outcome'] };
19
19
  const USAGE = [
20
20
  'usage: pmos program suggest — PMOS\'s milestone suggestions for a program',
21
21
  ' pmos program suggest --json <file|->',
@@ -25,6 +25,19 @@ const USAGE = [
25
25
  ' It answers filed, duplicate or declined for each. The PM keeps, changes or drops it on the page. Nothing is sent.',
26
26
  ' pmos program charter <id> [--goal "<text>"] [--why "<text>"] [--target YYYY-MM-DD] [--owner "<name>"]',
27
27
  ' The program card\'s Goal, For, target date and owner, after the user said yes in the chat. Run it in the repository where the program was made.',
28
+ ' pmos program new "<title>" [--from <initiative>] [--goal "<text>"] [--target YYYY-MM-DD]',
29
+ ' Make a program in this repository. --from turns an initiative into the program: it joins it. Prints the Undo.',
30
+ ' pmos program join <id> <initiative> | pmos program leave <id> <initiative>',
31
+ ' Put an initiative of this repository in a program (it leaves any other), or take it out. Prints the Undo.',
32
+ ' pmos program task <id> "<title>" [--owner "<name>"] [--due YYYY-MM-DD] [--key <key>] | pmos program task-done <id> <key> [--undo]',
33
+ ' Add or change a program task, or mark it done. Prints the Undo.',
34
+ ' pmos program milestone <id> add "<name>" --date YYYY-MM-DD [--waits <initiative>,…] | move <milestone> --date YYYY-MM-DD',
35
+ ' | rename <milestone> "<name>" | drop <milestone> Change the charter\'s milestones. Prints the Undo.',
36
+ ' pmos program check <id> <milestone> [--undo]',
37
+ ' Mark a milestone that waits on no initiative as done (--undo opens it again).',
38
+ ' pmos program archive <id> | pmos program unarchive <id>',
39
+ ' Take a program off the Board, or put it back.',
40
+ ' Every write above is one the user asked for in the chat. It shows on the Board when the chat turn ends.',
28
41
  ' pmos program line [<id>] [--json] [--root <dir>]',
29
42
  ' Where each program stands: Charter, Sequence, Track or Land, what is missing, the next move, the forecast against the target,',
30
43
  ' and one decision row for each team two products need in Build beyond its capacity. Reads every product on this computer, or only',
@@ -48,6 +61,7 @@ async function run(argv, { say = (s) => console.log(s), env = process.env, stdin
48
61
  if (!verb || verb === 'help' || verb === '--help' || verb === '-h') { for (const l of USAGE) say(l); return verb ? 0 : 1; }
49
62
  if (!COMMANDS.program.includes(verb)) { say(`unknown program command "${verb}" — one of ${COMMANDS.program.join(', ')}`); return 2; }
50
63
  if (verb === 'charter') return charter(args.slice(1), { say, cwd: process.cwd() });
64
+ if (EDIT_VERBS.includes(verb)) return editVerb(verb, args.slice(1), { say, cwd: process.cwd() });
51
65
  if (LINE_VERBS.includes(verb)) return lineVerb(verb, args.slice(1), { say, cwd: process.cwd(), env });
52
66
  const i = args.indexOf('--json'), src = i >= 0 ? args[i + 1] : null;
53
67
  if (!src) { say('usage: pmos program suggest --json <file|->'); return 2; }
@@ -102,6 +116,140 @@ function charter(args, { say, cwd }) {
102
116
  return 0;
103
117
  }
104
118
 
119
+ const EDIT_VERBS = ['new', 'join', 'leave', 'task', 'task-done', 'check', 'milestone', 'archive', 'unarchive'];
120
+ const DAY = /^\d{4}-\d{2}-\d{2}$/;
121
+ const q = (t) => JSON.stringify(String(t == null ? '' : t));
122
+
123
+ /** The program writes a chat makes after the PM said yes (initiative chat-saves-to-cards): the same lines the Board's presses write
124
+ * (lib/routes-programs.js), in this repository's <state>/programs.jsonl. A line about the charter (milestones, checks, archive) goes where the
125
+ * charter is; join and leave go to this repository, where the initiative is. Each prints the command that undoes it. Exit 0, 1 refused, 2 usage. */
126
+ function editVerb(verb, args, { say, cwd, now = Date.now() } = {}) {
127
+ const path = require('path');
128
+ const P = require('./programs.js');
129
+ const driver = require('./driver.js');
130
+ const pos = [], flags = {};
131
+ for (let k = 0; k < args.length; k++) {
132
+ const a = args[k];
133
+ if (a === '--undo') flags.undo = true;
134
+ else if (/^--(root|from|goal|target|owner|due|key|date|waits)$/.test(a)) flags[a.slice(2)] = args[++k];
135
+ else if (a.startsWith('--')) { say(`✗ unknown flag ${a}`); return 2; }
136
+ else pos.push(a);
137
+ }
138
+ const use = () => { say(USAGE.find((l) => l.includes('pmos program ' + verb)) || USAGE[0]); return 2; };
139
+ const root = flags.root ? path.resolve(cwd, flags.root) : gitTop(cwd);
140
+ const dir = driver.stateDirOf(root);
141
+ if (!dir) { say('✗ this repository has no PMOS state folder'); return 1; }
142
+ const here = path.join(dir, 'programs.jsonl');
143
+ const at = new Date(now);
144
+ const add = (file, line) => pmItems.appendEvent(file, line, at);
145
+ const linesOf = (f) => (fs.existsSync(f) ? pmItems.readLines(f).filter(Boolean) : []);
146
+ // the charter's own file: this repository's state folders, as `pmos program charter` looks
147
+ const charterOf = (id) => {
148
+ const files = [['pmos', 'state'], ['state'], ['.pmos'], ['planning', 'runs']].map((r) => path.join(root, ...r, 'programs.jsonl')).filter((f) => fs.existsSync(f));
149
+ for (const f of files) { const p = P.fold(linesOf(f))[id]; if (p && p.charter) return { file: f, prog: p }; }
150
+ return null;
151
+ };
152
+ const done = (msg, undo) => { say(`✓ ${msg}. The Board shows it.${undo ? ' Undo: ' + undo : ''}`); return 0; };
153
+
154
+ if (verb === 'new') {
155
+ const title = String(pos[0] || '').trim();
156
+ if (!title) return use();
157
+ if (flags.from && !P.INI_RE.test(flags.from)) { say('✗ --from names an initiative id'); return 2; }
158
+ const v = P.validProgram({ title, goal: flags.goal, target: flags.target, owner: flags.owner });
159
+ if (v.error) { say('✗ ' + v.error); return 1; }
160
+ if (charterOf(v.id)) { say(`✗ a program ${v.id} exists already. Change it with pmos program charter ${v.id}`); return 1; }
161
+ add(here, flags.from ? { ...v, from: flags.from } : v);
162
+ if (flags.from) add(here, { kind: 'member', program: v.id, initiative: flags.from });
163
+ return done(`program ${v.id} made${flags.from ? ' with ' + flags.from + ' in it' : ''}`, `pmos program archive ${v.id}`);
164
+ }
165
+
166
+ const id = pos[0];
167
+ if (!id) return use();
168
+ if (!P.ID_RE.test(id)) { say('✗ the program id is lower-case letters, numbers and dashes'); return 2; }
169
+ const ch = charterOf(id);
170
+ if (!ch) { say(`✗ no charter of ${id} in this repository. Run it in the product where the program was made`); return 1; }
171
+ const { file, prog } = ch;
172
+
173
+ if (verb === 'archive' || verb === 'unarchive') {
174
+ if (verb === 'archive' && prog.archived) { say(`${id} is archived already.`); return 0; }
175
+ if (verb === 'unarchive' && !prog.archived) { say(`${id} is not archived.`); return 0; }
176
+ add(file, { kind: verb, program: id });
177
+ return done(`${id} ${verb === 'archive' ? 'archived' : 'is back on the Board'}`, `pmos program ${verb === 'archive' ? 'unarchive' : 'archive'} ${id}`);
178
+ }
179
+
180
+ if (verb === 'join' || verb === 'leave') {
181
+ const ini = pos[1];
182
+ if (!ini || !P.INI_RE.test(ini)) return use();
183
+ const mine = P.fold(linesOf(here));
184
+ if (verb === 'leave' && !(mine[id] && mine[id].members.includes(ini))) { say(`${ini} is not in ${id} in this repository.`); return 0; }
185
+ if (verb === 'join' && mine[id] && mine[id].members.includes(ini)) { say(`${ini} is in ${id} already.`); return 0; }
186
+ let undo = `pmos program ${verb === 'join' ? 'leave' : 'join'} ${id} ${ini}`;
187
+ // an initiative is in one program at most: joining one leaves the other (as the Board's press does)
188
+ if (verb === 'join') for (const o of Object.values(mine)) if (o.id !== id && o.members.includes(ini)) { add(here, { kind: 'leave', program: o.id, initiative: ini }); undo = `pmos program join ${o.id} ${ini}`; }
189
+ // a milestone that waits on an initiative that leaves could never be done: the leave takes it off the charter's milestones
190
+ if (verb === 'leave') {
191
+ const ms = prog.milestones.map((m) => ((m.waits || []).includes(ini) ? { ...m, waits: m.waits.filter((x) => x !== ini) } : m));
192
+ if (ms.some((m, i) => m !== prog.milestones[i])) { const v = P.validProgram({ ...prog, id, milestones: ms }); if (!v.error) add(file, { ...v, from: prog.from || undefined }); }
193
+ }
194
+ add(here, { kind: verb === 'join' ? 'member' : 'leave', program: id, initiative: ini });
195
+ return done(`${ini} ${verb === 'join' ? 'joined' : 'left'} ${id}`, undo);
196
+ }
197
+
198
+ if (verb === 'task') {
199
+ const title = String(pos[1] || '').replace(/\s+/g, ' ').trim().slice(0, 200);
200
+ if (!title) return use();
201
+ if (flags.due && !DAY.test(flags.due)) { say('✗ --due is YYYY-MM-DD'); return 2; }
202
+ const key = /^[A-Za-z0-9._-]{1,40}$/.test(String(flags.key || '')) ? String(flags.key) : 'pt' + now.toString(36);
203
+ const was = (P.fold(linesOf(file))[id] || { tasks: [] }).tasks.find((t) => t.key === key);
204
+ add(file, { kind: 'task', program: id, key, title, owner: String(flags.owner || '').slice(0, 80), due: flags.due || '' });
205
+ const undo = was ? `pmos program task ${id} ${q(was.title)} --key ${key}${was.owner ? ' --owner ' + q(was.owner) : ''}${was.due ? ' --due ' + was.due : ''}` : `pmos program task-done ${id} ${key}`;
206
+ return done(`task ${key} ${was ? 'changed' : 'added'} on ${id}`, undo);
207
+ }
208
+
209
+ if (verb === 'task-done') {
210
+ const key = pos[1];
211
+ if (!key) return use();
212
+ if (!prog.tasks.some((t) => t.key === key)) { say(`✗ ${id} has no task ${key}`); return 1; }
213
+ add(file, { kind: 'task-done', program: id, key, done: !flags.undo });
214
+ return done(`task ${key} ${flags.undo ? 'open again' : 'done'}`, `pmos program task-done ${id} ${key}${flags.undo ? '' : ' --undo'}`);
215
+ }
216
+
217
+ if (verb === 'check') {
218
+ const m = prog.milestones.find((x) => x.id === pos[1]);
219
+ if (!m) { say(`✗ ${id} has no milestone ${pos[1] || ''}`.trim()); return 1; }
220
+ if ((m.waits || []).length) { say('✗ this milestone waits on initiatives: it is done when they pass Deliver'); return 1; }
221
+ add(file, { kind: 'check', program: id, milestone: m.id, done: !flags.undo });
222
+ return done(`${m.name} ${flags.undo ? 'open again' : 'done'}`, `pmos program check ${id} ${m.id}${flags.undo ? '' : ' --undo'}`);
223
+ }
224
+
225
+ // milestone add|move|rename|drop: one charter line with the milestones changed, every other key kept (the last line wins)
226
+ const op = pos[1], ms = prog.milestones.map((m) => ({ ...m }));
227
+ let msg;
228
+ if (op === 'add') {
229
+ const name = String(pos[2] || '').trim();
230
+ if (!name || !DAY.test(String(flags.date || ''))) return use();
231
+ const waits = flags.waits ? String(flags.waits).split(',').map((x) => x.trim()).filter(Boolean) : [];
232
+ if (waits.some((x) => !P.INI_RE.test(x))) { say('✗ --waits names initiative ids, comma separated'); return 2; }
233
+ ms.push({ name, date: flags.date, waits });
234
+ msg = `milestone "${name}" added to ${id}`;
235
+ } else if (op === 'move' || op === 'rename' || op === 'drop') {
236
+ const i = ms.findIndex((m) => m.id === pos[2]);
237
+ if (i < 0) { say(`✗ ${id} has no milestone ${pos[2] || ''}`.trim()); return 1; }
238
+ if (op === 'move') { if (!DAY.test(String(flags.date || ''))) return use(); ms[i].date = flags.date; msg = `${ms[i].name} moved to ${flags.date}`; }
239
+ if (op === 'rename') { const name = String(pos[3] || '').trim(); if (!name) return use(); msg = `${ms[i].name} renamed to "${name}"`; ms[i].name = name; }
240
+ if (op === 'drop') { msg = `${ms[i].name} dropped from ${id}`; ms.splice(i, 1); }
241
+ } else return use();
242
+ const v = P.validProgram({ ...prog, id, milestones: ms });
243
+ if (v.error) { say('✗ ' + v.error); return 1; }
244
+ add(file, { ...v, from: prog.from || undefined });
245
+ const back = op === 'add' ? `pmos program milestone ${id} drop ${v.milestones[v.milestones.length - 1].id}`
246
+ : op === 'move' ? `pmos program milestone ${id} move ${pos[2]} --date ${prog.milestones.find((m) => m.id === pos[2]).date || ''}`
247
+ : op === 'rename' ? `pmos program milestone ${id} rename ${pos[2]} ${q(prog.milestones.find((m) => m.id === pos[2]).name)}`
248
+ : '';
249
+ const dropped = op === 'drop' ? prog.milestones.find((m) => m.id === pos[2]) : null;
250
+ return done(msg, back || (dropped ? `pmos program milestone ${id} add ${q(dropped.name)} --date ${dropped.date}${(dropped.waits || []).length ? ' --waits ' + dropped.waits.join(',') : ''}` : ''));
251
+ }
252
+
105
253
  const LINE_VERBS = ['line', 'draft', 'order', 'capacity', 'decide', 'outcome'];
106
254
  const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
107
255
  const short = (d) => (d ? MON[+d.slice(5, 7) - 1] + ' ' + (+d.slice(8, 10)) + ' ' + d.slice(0, 4) : '');
@@ -242,4 +390,4 @@ function gitTop(cwd) {
242
390
  try { return require('child_process').execFileSync('git', ['rev-parse', '--show-toplevel'], { cwd, encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] }).trim() || cwd; } catch { return cwd; }
243
391
  }
244
392
 
245
- module.exports = { run, COMMANDS, USAGE, charter, lineVerb };
393
+ module.exports = { run, COMMANDS, USAGE, charter, editVerb, lineVerb };
@@ -21,7 +21,7 @@
21
21
  * { kind: 'leave', program, initiative }
22
22
  * { kind: 'task', program, key, title, owner?, due? } a task on the program itself; the last line for a key wins
23
23
  * { kind: 'task-done', program, key, done: true|false }
24
- * { kind: 'archive', program }
24
+ * { kind: 'archive', program } · { kind: 'unarchive', program } the last one wins (`pmos program archive` / `unarchive`)
25
25
  * { kind: 'order', program, order: [initiative id] } the PM's sequence of the program's initiatives (canvas RoADrag, RoASuggest); the last
26
26
  * line wins. It is a line of its own, not a charter key, so a charter save never drops it
27
27
  * A PROGRAM'S SPAN is `start` to `target` (canvas PgProgram, "Sep 2026 to Jun 2028"): a program can run for years, longer than any one
@@ -134,6 +134,7 @@ function fold(lines) {
134
134
  } else if (l.kind === 'check' && ID_RE.test(String(l.milestone || ''))) p.checks[String(l.milestone)] = !!l.done;
135
135
  else if (l.kind === 'order' && Array.isArray(l.order)) { const v = validOrder(l.order); if (!v.error) { p.order = v; p.orderSet = true; } }
136
136
  else if (l.kind === 'archive') p.archived = true;
137
+ else if (l.kind === 'unarchive') p.archived = false; // `pmos program unarchive`, the Undo of an archive
137
138
  }
138
139
  for (const p of Object.values(out)) p.milestones = withChecks(p.milestones, p.checks);
139
140
  return out;