create-pmos 0.829.0 → 0.831.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.
- package/package.json +149 -49
- package/payload/KIT-VERSION +1 -1
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/workspace/briefing-premium-board-test.js +1 -1
- package/workspace/briefing-premium-insights-test.js +1 -1
- package/workspace/changelog.json +148 -22
- package/workspace/guide/agent-capabilities.md +1 -1
- package/workspace/guide/backlog.md +12 -1
- package/workspace/guide/cli.md +20 -1
- package/workspace/guide/home.md +1 -1
- package/workspace/guide/layout.md +3 -0
- package/workspace/lib/anchor-id.js +226 -0
- package/workspace/lib/artefacts-cli.js +25 -1
- package/workspace/lib/code-map.js +8 -2
- package/workspace/lib/factory-floor.js +16 -8
- package/workspace/lib/features.json +14 -13
- package/workspace/lib/initiative-cli.js +67 -2
- package/workspace/lib/lessons-draft.js +242 -0
- package/workspace/lib/people-cli.js +9 -1
- package/workspace/lib/people-prep.js +140 -0
- package/workspace/lib/pmos-verbs.js +2 -0
- package/workspace/lib/prefs-sync.js +1 -1
- package/workspace/lib/print-cli.js +49 -0
- package/workspace/lib/print-pdf.js +96 -0
- package/workspace/lib/review-reasons.js +121 -9
- package/workspace/lib/route-modules.js +1 -0
- package/workspace/lib/routes-c3-strategy.js +2 -1
- package/workspace/lib/routes-proposals.js +2 -2
- package/workspace/lib/routes-report-design.js +3 -1
- package/workspace/lib/routes-skill-map.js +39 -0
- package/workspace/lib/routes-strategy-card.js +13 -6
- package/workspace/lib/skill-map.js +199 -0
- package/workspace/lib/team-cli.js +20 -1
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/action-keys.js +1 -0
- package/workspace/public/pm/ask-here-ctx.js +25 -1
- package/workspace/public/pm/ask-here.css +7 -0
- package/workspace/public/pm/ask-here.js +15 -2
- package/workspace/public/pm/bd-backlog.css +61 -0
- package/workspace/public/pm/bd-backlog.js +62 -8
- package/workspace/public/pm/bd-work.js +12 -1
- package/workspace/public/pm/card-fold.js +123 -0
- package/workspace/public/pm/code-map.js +15 -4
- package/workspace/public/pm/cozy-board.css +5 -1
- package/workspace/public/pm/cozy-ev.css +7 -0
- package/workspace/public/pm/cozy-nav.js +2 -0
- package/workspace/public/pm/cozy-pop-work.js +2 -0
- package/workspace/public/pm/cozy-search.js +2 -2
- package/workspace/public/pm/factory.js +199 -0
- package/workspace/public/pm/pop-cap.js +5 -3
- package/workspace/public/pm/premium-board.js +4 -0
- package/workspace/public/pm/premium-report-read.js +11 -2
- package/workspace/public/pm/print-pdf.js +191 -0
- package/workspace/public/pm/readonly.js +2 -0
- package/workspace/public/pm/review-reasons.js +19 -5
- package/workspace/public/pm/skill-map.js +57 -0
- package/workspace/public/premium-board.html +2 -0
- package/workspace/test-lists/anchor-id.json +9 -0
- package/workspace/test-lists/card-fold.json +9 -0
- package/workspace/test-lists/factory-page-ui.json +9 -0
- package/workspace/test-lists/lessons-on-close.json +9 -0
- package/workspace/test-lists/people-prep.json +9 -0
- package/workspace/test-lists/print-pdf.json +9 -0
- package/workspace/test-lists/skill-map.json +9 -0
- package/workspace/test-lists/surface-ask-card.json +9 -0
- package/workspace/test-lists/voice-files.json +9 -0
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
{
|
|
2
|
-
"about": "The user features of PMOS, one row each, for the chat's / menu, the typed-words suggestion, the What PMOS can do directory, Ctrl+K and the ? sheet (initiative feature-directory). Only audience user rows are shown. A row with cmd names a pmos verb (lib/pmos-verbs.js) that its prompt runs; place is a page key of the menu (pm/cozy-nav.js). since is the first version that has the feature. features.test.js F1 checks every row.",
|
|
2
|
+
"about": "The user features of PMOS, one row each, for the chat's / menu, the typed-words suggestion, the What PMOS can do directory, Ctrl+K and the ? sheet (initiative feature-directory). Only audience user rows are shown. A row with cmd names a pmos verb (lib/pmos-verbs.js) that its prompt runs; place is a page key of the menu (pm/cozy-nav.js). since is the first version that has the feature. ask lists the record kinds the Ask card offers the feature on (pm/ask-here-ctx.js actionsOf: one press asks it about the pressed record). features.test.js F1 checks every row.",
|
|
3
3
|
"groups": ["Plan and decide", "Before you ship", "Catch up", "Your product", "What PMOS did", "Find your way"],
|
|
4
4
|
"features": [
|
|
5
5
|
{"id": "goal", "audience": "user", "status": "ga", "group": "Plan and decide", "name": "Give PMOS a goal", "say": "PMOS asks a few questions, then works on the goal after you press Start.", "cmd": "/goal", "phrases": ["work on this until", "keep going until", "make it happen"], "since": "0.560.0"},
|
|
6
|
-
{"id": "why", "audience": "user", "status": "ga", "group": "Plan and decide", "name": "Why this work exists", "say": "Three lines on an initiative or a task: its goal, its problem and the evidence.", "cmd": "/why", "verb": "why", "hint": "<initiative or task>", "phrases": ["why does this exist", "why are we doing", "why are we building", "what is the point of", "reason for this work", "why this initiative"], "phone": true, "since": "0.700.0"},
|
|
6
|
+
{"id": "why", "audience": "user", "status": "ga", "group": "Plan and decide", "name": "Why this work exists", "say": "Three lines on an initiative or a task: its goal, its problem and the evidence.", "cmd": "/why", "verb": "why", "hint": "<initiative or task>", "phrases": ["why does this exist", "why are we doing", "why are we building", "what is the point of", "reason for this work", "why this initiative"], "phone": true, "since": "0.700.0", "ask": ["initiative", "task"]},
|
|
7
7
|
{"id": "rehearse", "audience": "user", "status": "ga", "group": "Plan and decide", "name": "Rehearse a change", "say": "Move a task by some days and see what else slips, before anything changes.", "cmd": "/rehearse", "verb": "rehearse", "sub": "move", "hint": "<task> <days>", "place": "board", "phrases": ["what if slips", "what happens if slips", "what if move", "push back", "delay by", "slips a week", "what breaks if", "move the date", "what if we cut"], "since": "0.600.0"},
|
|
8
8
|
{"id": "decisions", "audience": "user", "status": "ga", "group": "Plan and decide", "name": "Decision journal", "say": "Write one line per decision, with what you expect and the date to check it.", "cmd": "/decide", "verb": "decisions", "sub": "add", "hint": "<the decision>", "phrases": ["we decided", "log a decision", "record a decision", "note the decision", "decision journal", "list decisions"], "since": "0.640.0"},
|
|
9
9
|
{"id": "questions", "audience": "user", "status": "ga", "group": "Plan and decide", "name": "Open questions", "say": "Every question nobody has answered yet, oldest first, in one list.", "cmd": "/questions", "verb": "questions", "phrases": ["open questions", "unanswered questions", "what is still open", "questions nobody answered", "what do we not know"], "phone": true, "since": "0.660.0"},
|
|
10
|
-
{"id": "press-release", "audience": "user", "status": "ga", "group": "Plan and decide", "name": "Press release and FAQ", "say": "A one-page press release and FAQ for a bet, drafted from its record, for you to edit.", "cmd": "/press-release", "verb": "press-release", "hint": "<initiative>", "phrases": ["press release", "working backwards", "write the faq", "announce this"], "since": "0.690.0"},
|
|
11
|
-
{"id": "launch", "audience": "user", "status": "ga", "group": "Before you ship", "name": "What is not ready", "say": "Before a launch date: the tasks, sign-offs and documents still open.", "cmd": "/launch", "verb": "launch", "sub": "check", "hint": "<initiative>", "phrases": ["ready to launch", "what is not ready", "before launch", "launch checklist", "can we ship", "ready to ship", "is it ready for launch"], "since": "0.650.0"},
|
|
12
|
-
{"id": "ready", "audience": "user", "status": "ga", "group": "Before you ship", "name": "Ready for engineers", "say": "The five basics the engineers need before the tickets go to them.", "cmd": "/ready", "verb": "ready", "sub": "check", "hint": "<initiative>", "phrases": ["ready for engineering", "ready for engineers", "ready for dev", "hand over to engineers", "ready for development"], "since": "0.650.0"},
|
|
13
|
-
{"id": "critic", "audience": "user", "status": "ga", "group": "Before you ship", "name": "Critic before you share", "say": "Reads a document as a sceptical reviewer and lists the hardest questions.", "cmd": "/critic", "verb": "critic", "hint": "<document>", "phrases": ["poke holes", "review this doc", "critique this", "before I share", "hardest questions", "sceptical review", "skeptical review", "what would they ask"], "since": "0.680.0"},
|
|
10
|
+
{"id": "press-release", "audience": "user", "status": "ga", "group": "Plan and decide", "name": "Press release and FAQ", "say": "A one-page press release and FAQ for a bet, drafted from its record, for you to edit.", "cmd": "/press-release", "verb": "press-release", "hint": "<initiative>", "phrases": ["press release", "working backwards", "write the faq", "announce this"], "since": "0.690.0", "ask": ["initiative"]},
|
|
11
|
+
{"id": "launch", "audience": "user", "status": "ga", "group": "Before you ship", "name": "What is not ready", "say": "Before a launch date: the tasks, sign-offs and documents still open.", "cmd": "/launch", "verb": "launch", "sub": "check", "hint": "<initiative>", "phrases": ["ready to launch", "what is not ready", "before launch", "launch checklist", "can we ship", "ready to ship", "is it ready for launch"], "since": "0.650.0", "ask": ["initiative"]},
|
|
12
|
+
{"id": "ready", "audience": "user", "status": "ga", "group": "Before you ship", "name": "Ready for engineers", "say": "The five basics the engineers need before the tickets go to them.", "cmd": "/ready", "verb": "ready", "sub": "check", "hint": "<initiative>", "phrases": ["ready for engineering", "ready for engineers", "ready for dev", "hand over to engineers", "ready for development"], "since": "0.650.0", "ask": ["initiative"]},
|
|
13
|
+
{"id": "critic", "audience": "user", "status": "ga", "group": "Before you ship", "name": "Critic before you share", "say": "Reads a document as a sceptical reviewer and lists the hardest questions.", "cmd": "/critic", "verb": "critic", "hint": "<document>", "phrases": ["poke holes", "review this doc", "critique this", "before I share", "hardest questions", "sceptical review", "skeptical review", "what would they ask"], "since": "0.680.0", "ask": ["document"]},
|
|
14
14
|
{"id": "missed", "audience": "user", "status": "ga", "group": "Catch up", "name": "What you might have missed", "say": "What each of the last weeks would have shown you, in one list.", "cmd": "/missed", "verb": "drift", "sub": "show", "phrases": ["what did I miss", "what have I missed", "catch me up", "while I was away", "what changed this week", "what changed since"], "phone": true, "since": "0.620.0"},
|
|
15
15
|
{"id": "past", "audience": "user", "status": "ga", "group": "Catch up", "name": "Ask about the past", "say": "The decisions, notes and records that answer a question, each with its source.", "cmd": "/past", "verb": "past", "sub": "ask", "hint": "<question>", "phrases": ["when did we decide", "why did we decide", "who decided", "what did we agree", "last time we", "history of"], "phone": true, "since": "0.630.0"},
|
|
16
16
|
{"id": "parked", "audience": "user", "status": "ga", "group": "Catch up", "name": "Parked work", "say": "Each initiative on hold, why it is parked and what brings it back.", "cmd": "/parked", "verb": "parked", "sub": "list", "phrases": ["parked work", "what is on hold", "what is parked", "paused initiatives"], "since": "0.700.0"},
|
|
17
17
|
{"id": "people", "audience": "user", "status": "ga", "group": "Catch up", "name": "People you work with", "say": "Each person with their role, how often you talk and their tone.", "cmd": "/people", "verb": "people", "sub": "list", "phrases": ["who do I work with", "stakeholders list", "people on this", "who is involved"], "since": "0.610.0"},
|
|
18
|
-
{"id": "strategy", "audience": "user", "status": "ga", "group": "Your product", "name": "Five-line strategy", "say": "Who it is for, the problem, the bet, how you win and what you will not do.", "cmd": "/strategy", "verb": "strategy", "sub": "show", "place": "board", "phrases": ["our strategy", "product strategy", "draft the strategy", "how we win"], "since": "0.776.0"},
|
|
19
|
-
{"id": "code", "audience": "user", "status": "ga", "group": "Your product", "name": "Code map", "say": "One line per main part of the code: what it is, how it is tested, who changed it last.", "cmd": "/code", "verb": "code", "sub": "show", "place": "board", "since": "0.826.0"},
|
|
18
|
+
{"id": "strategy", "audience": "user", "status": "ga", "group": "Your product", "name": "Five-line strategy", "say": "Who it is for, the problem, the bet, how you win and what you will not do.", "cmd": "/strategy", "verb": "strategy", "sub": "show", "place": "board", "phrases": ["our strategy", "product strategy", "draft the strategy", "how we win"], "since": "0.776.0", "ask": ["product"]},
|
|
19
|
+
{"id": "code", "audience": "user", "status": "ga", "group": "Your product", "name": "Code map", "say": "One line per main part of the code: what it is, how it is tested, who changed it last.", "cmd": "/code", "verb": "code", "sub": "show", "place": "board", "since": "0.826.0", "ask": ["product"]},
|
|
20
20
|
{"id": "connectors", "audience": "user", "status": "ga", "group": "Your product", "name": "What connectors read and write", "say": "What PMOS reads and writes through each connector, and what leaves this computer.", "cmd": "/connectors", "verb": "connectors", "sub": "data", "since": "0.825.0"},
|
|
21
21
|
{"id": "positioning", "audience": "user", "status": "ga", "group": "Your product", "name": "Positioning and key messages", "say": "A positioning statement and key messages, each citing a strategy line.", "cmd": "/positioning", "verb": "positioning", "sub": "list", "phrases": ["positioning statement", "key messages", "messaging for"], "since": "0.740.0"},
|
|
22
22
|
{"id": "principles", "audience": "user", "status": "ga", "group": "Your product", "name": "Product principles", "say": "Four to six principles drafted from your past decisions, each citing them.", "cmd": "/principles", "verb": "principles", "sub": "list", "phrases": ["product principles", "our principles", "design principles for"], "since": "0.720.0"},
|
|
23
23
|
{"id": "glossary", "audience": "user", "status": "ga", "group": "Your product", "name": "Glossary", "say": "The product's own words; every page shows a word's meaning on hover.", "cmd": "/glossary", "verb": "glossary", "sub": "list", "hint": "<word>", "phrases": ["define the word", "glossary", "add to glossary", "meaning of the word"], "since": "0.690.0"},
|
|
24
|
-
{"id": "health", "audience": "user", "status": "ga", "group": "Your product", "name": "Health score", "say": "This product's health from 0 to 100, and the three parts that make it.", "cmd": "/health", "verb": "health", "sub": "score", "phrases": ["health score", "how healthy is", "product health"], "phone": true, "since": "0.737.0"},
|
|
24
|
+
{"id": "health", "audience": "user", "status": "ga", "group": "Your product", "name": "Health score", "say": "This product's health from 0 to 100, and the three parts that make it.", "cmd": "/health", "verb": "health", "sub": "score", "phrases": ["health score", "how healthy is", "product health"], "phone": true, "since": "0.737.0", "ask": ["product"]},
|
|
25
25
|
{"id": "outcomes", "audience": "user", "status": "ga", "group": "Your product", "name": "Did it work?", "say": "Each initiative's expected outcome and the date to check it.", "cmd": "/outcomes", "verb": "outcomes", "sub": "list", "phrases": ["did it work", "expected outcome", "outcomes due", "check the outcome"], "since": "0.640.0"},
|
|
26
26
|
{"id": "changed", "audience": "user", "status": "ga", "group": "What PMOS did", "name": "What PMOS changed by itself", "say": "Every change PMOS made on its own today, with its source and its Undo.", "cmd": "/changed", "verb": "factory", "sub": "today", "phrases": ["what did pmos change", "what did you change", "changes pmos made", "what did the agents do"], "phone": true, "since": "0.700.0"},
|
|
27
27
|
{"id": "autonomy", "audience": "user", "status": "ga", "group": "What PMOS did", "name": "What agents applied", "say": "What agents applied by themselves in the last 14 days, each with its Undo.", "cmd": "/applied", "verb": "autonomy", "sub": "status", "phrases": ["what did agents apply", "applied by themselves", "auto applied"], "since": "0.680.0"},
|
|
28
|
-
{"id": "describe", "audience": "user", "status": "ga", "group": "Plan and decide", "name": "Task descriptions", "say": "What, why and done-when for each task, drafted from its sources.", "cmd": "/describe", "verb": "task", "sub": "describe", "hint": "<task>", "place": "board", "phrases": ["describe this task", "task description", "write the description", "what is this task about"], "since": "0.770.0"},
|
|
28
|
+
{"id": "describe", "audience": "user", "status": "ga", "group": "Plan and decide", "name": "Task descriptions", "say": "What, why and done-when for each task, drafted from its sources.", "cmd": "/describe", "verb": "task", "sub": "describe", "hint": "<task>", "place": "board", "phrases": ["describe this task", "task description", "write the description", "what is this task about"], "since": "0.770.0", "ask": ["task"]},
|
|
29
29
|
{"id": "search", "audience": "user", "status": "ga", "group": "Find your way", "name": "Search and ask", "say": "Ctrl+K finds work, pages and features, and answers questions from your files.", "keys": "Ctrl K", "since": "0.737.0"},
|
|
30
30
|
{"id": "action-keys", "audience": "user", "status": "ga", "group": "Find your way", "name": "Keys for the five common actions", "say": "Yes, open, next sprint, park and undo, one key each. Press ? to see them.", "keys": "?", "since": "0.730.0"},
|
|
31
31
|
{"id": "guide", "audience": "user", "status": "ga", "group": "Find your way", "name": "The Guide", "say": "How each part of PMOS works, page by page.", "action": "guide", "since": "0.500.0"},
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
{"id": "report", "audience": "user", "status": "ga", "group": "Your product", "name": "Draft and issue a report", "say": "Draft a cadence report with every number filled in, then issue it.", "cmd": "/report", "verb": "report", "hint": "<cadence>"},
|
|
39
39
|
{"id": "jira", "audience": "user", "status": "ga", "group": "Plan and decide", "name": "Jira tickets from the spec", "say": "Draft Jira tickets from the PRD, approve them and see their status.", "cmd": "/jira", "verb": "jira"},
|
|
40
40
|
{"id": "docs", "audience": "user", "status": "ga", "group": "Your product", "name": "Linked documents in step", "say": "Is each linked document the same as, ahead of or behind its Google Docs or Confluence copy.", "cmd": "/docs", "verb": "docs"},
|
|
41
|
-
{"id": "signoff", "audience": "user", "status": "ga", "group": "Before you ship", "name": "Sign-offs", "say": "Ask for, answer and list the sign-offs an initiative waits on.", "cmd": "/signoff", "verb": "signoff", "hint": "<initiative>"},
|
|
41
|
+
{"id": "signoff", "audience": "user", "status": "ga", "group": "Before you ship", "name": "Sign-offs", "say": "Ask for, answer and list the sign-offs an initiative waits on.", "cmd": "/signoff", "verb": "signoff", "hint": "<initiative>", "ask": ["initiative"]},
|
|
42
42
|
{"id": "my-work", "audience": "user", "status": "ga", "group": "Catch up", "name": "Your assigned work", "say": "The Jira tickets and plan items assigned to you, ranked.", "cmd": "/my-work", "verb": "my-work"},
|
|
43
43
|
{"id": "tracker", "audience": "user", "status": "ga", "group": "Catch up", "name": "When the tracker was last read", "say": "When tracker items were last read and how much matches the last Jira read.", "cmd": "/tracker", "verb": "tracker"},
|
|
44
44
|
{"id": "mention", "audience": "user", "status": "ga", "group": "Catch up", "name": "Mentions that wait on you", "say": "What waits on you in your tools, with a reply PMOS drafts for you to send.", "cmd": "/mention", "verb": "mention"},
|
|
@@ -56,8 +56,9 @@
|
|
|
56
56
|
{"id": "away", "audience": "user", "status": "ga", "group": "Catch up", "name": "Away days", "say": "Set your away days, read the handover note and see what moved while you were away.", "cmd": "/away", "verb": "away"},
|
|
57
57
|
{"id": "try", "audience": "user", "status": "ga", "group": "What PMOS did", "name": "Try what shipped", "say": "The changes your recent updates brought, how to try each, and your answer.", "cmd": "/try", "verb": "try"},
|
|
58
58
|
{"id": "rules", "audience": "user", "status": "ga", "group": "What PMOS did", "name": "Rules PMOS learned", "say": "The standing rules PMOS learned from your corrections, and edit or retire one.", "cmd": "/rules", "verb": "rules"},
|
|
59
|
-
{"id": "line", "audience": "user", "status": "ga", "group": "Catch up", "name": "Where each initiative stands", "say": "Days in its stage, what is missing, the next move, and whether it is stuck.", "cmd": "/line", "verb": "line", "hint": "<initiative>"},
|
|
59
|
+
{"id": "line", "audience": "user", "status": "ga", "group": "Catch up", "name": "Where each initiative stands", "say": "Days in its stage, what is missing, the next move, and whether it is stuck.", "cmd": "/line", "verb": "line", "hint": "<initiative>", "ask": ["initiative"]},
|
|
60
60
|
{"id": "hire", "audience": "user", "status": "ga", "group": "Plan and decide", "name": "The next hire", "say": "The role your open work most needs, and a one-page role brief to edit.", "cmd": "/hire", "verb": "hire"},
|
|
61
|
+
{"id": "print", "audience": "user", "status": "ga", "group": "Your product", "name": "Print or PDF", "say": "One clean page of a report or an initiative, to print or save as PDF.", "cmd": "/print", "verb": "print", "hint": "<file or initiative>"},
|
|
61
62
|
{"id": "prototype", "audience": "user", "status": "ga", "group": "Before you ship", "name": "Simulated users try the prototype", "say": "Where simulated users, one per persona, got stuck on a prototype, and the personas that walk it.", "cmd": "/prototype", "verb": "prototype", "hint": "findings <initiative>"},
|
|
62
63
|
{"id": "goals", "audience": "user", "status": "ga", "group": "Your product", "name": "Starter goals", "say": "Up to three goals drafted from your own product, each with its source; keep one and it becomes a goal.", "cmd": "/goals", "verb": "goals"},
|
|
63
64
|
{"id": "approver", "audience": "user", "status": "ga", "group": "Before you ship", "name": "What an approver asks", "say": "What each approver asked or objected to before, ahead of the next sign-off.", "cmd": "/approver", "verb": "approver", "hint": "<name>"},
|
|
@@ -72,7 +73,7 @@
|
|
|
72
73
|
{"id": "setup", "audience": "user", "status": "ga", "group": "Find your way", "name": "Set up a new product", "say": "The tracker read, an agreed goal and an owner for a new product.", "cmd": "/setup", "verb": "setup"},
|
|
73
74
|
{"id": "loop", "audience": "user", "status": "ga", "group": "Plan and decide", "name": "A goal agents work on", "say": "Start, check and stop a goal agents work on until it is done.", "cmd": "/loop", "verb": "loop"},
|
|
74
75
|
{"id": "scan", "audience": "user", "status": "ga", "group": "Catch up", "name": "Horizon scan", "say": "The portfolio watch list and what the scan found.", "cmd": "/scan", "verb": "scan"},
|
|
75
|
-
{"id": "artefacts", "audience": "user", "status": "ga", "group": "Plan and decide", "name": "The seven artefacts", "say": "Intent, Goal, Narrative, Experiment, Specimens, Done test and Lessons of an initiative.", "cmd": "/artefacts", "verb": "artefacts", "hint": "<initiative>"},
|
|
76
|
+
{"id": "artefacts", "audience": "user", "status": "ga", "group": "Plan and decide", "name": "The seven artefacts", "say": "Intent, Goal, Narrative, Experiment, Specimens, Done test and Lessons of an initiative.", "cmd": "/artefacts", "verb": "artefacts", "hint": "<initiative>", "ask": ["initiative"]},
|
|
76
77
|
{"id": "forecast", "audience": "user", "status": "ga", "group": "Your product", "name": "Goal forecasts", "say": "A goal forecast's kept baseline, and the forecasts that turned.", "cmd": "/forecast", "verb": "forecast"},
|
|
77
78
|
{"id": "git-identity", "audience": "user", "status": "ga", "group": "Find your way", "name": "Your git identity", "say": "Which git identity and GitHub login this repository uses.", "cmd": "/git-identity", "verb": "git-identity"},
|
|
78
79
|
{"id": "voice", "audience": "user", "status": "ga", "group": "Your product", "name": "Customer voice", "say": "Survey comments and app-store reviews grouped by reason, the fastest-growing first.", "cmd": "/voice", "verb": "voice"},
|
|
@@ -42,6 +42,7 @@ const rowsLib = require('./initiative-rows.js');
|
|
|
42
42
|
const planRules = require('./plan-rules.js');
|
|
43
43
|
const breakdownExport = require('./breakdown-export.js');
|
|
44
44
|
const triage = require('./triage.js');
|
|
45
|
+
const AID = require('./anchor-id.js');
|
|
45
46
|
const lifecycle = require('./lifecycle-stage.js');
|
|
46
47
|
const { parseArgs } = require('./schedule-cli');
|
|
47
48
|
|
|
@@ -79,11 +80,11 @@ function docNote(docs) {
|
|
|
79
80
|
return `Not on the Roadmap · ${docs.length} on a document lane: ${names}. A document lane does not show on Today or Work. If it is work, set lane: in its record to ${WORK_LANES}.`;
|
|
80
81
|
}
|
|
81
82
|
|
|
82
|
-
const COMMANDS = { initiative: ['new', 'top', 'up', 'down', 'bottom', 'after', 'check-by', 'adopt', 'drop', 'list', 'export', 'describe', 'raised-by', 'kind', 'role', 'status', 'status-migrate', 'status-undo'] };
|
|
83
|
+
const COMMANDS = { initiative: ['new', 'top', 'up', 'down', 'bottom', 'after', 'check-by', 'adopt', 'drop', 'list', 'export', 'describe', 'raised-by', 'kind', 'role', 'status', 'status-migrate', 'status-undo', 'anchor', 'anchors'] };
|
|
83
84
|
/** The horizon verbs D105 retired: they answer with what to use instead. */
|
|
84
85
|
const RETIRED = Object.freeze(['now', 'next', 'later']);
|
|
85
86
|
const USAGE = [
|
|
86
|
-
'usage: pmos initiative new|top|up|down|bottom|after|check-by|adopt|drop|list|export|describe|raised-by|kind|role|status|status-migrate|status-undo — initiatives on the Roadmap',
|
|
87
|
+
'usage: pmos initiative new|top|up|down|bottom|after|check-by|adopt|drop|list|export|describe|raised-by|kind|role|status|status-migrate|status-undo|anchor|anchors — initiatives on the Roadmap',
|
|
87
88
|
' pmos initiative new "<title>" --lane <lane> --anchor <KR|health:id> [--intent "<text>"] [--id <id>] [--kind product|sdlc|project] [--raised-by "<who>"]',
|
|
88
89
|
' pmos initiative new --from capture-YYYY-MM-DD-<n> [--anchor <anchor>] [--lane <lane>] [--title "<title>"]',
|
|
89
90
|
' pmos initiative top|up|down|bottom <id> reorder it on the Roadmap',
|
|
@@ -100,6 +101,10 @@ const USAGE = [
|
|
|
100
101
|
' pmos initiative status <id> ["<text>"] [--line "<12 words>"] its status line and log; with text, save it: the whole text to the log, the line (yours, else its first 12 words) to the record',
|
|
101
102
|
' pmos initiative status-migrate [--apply] every status over 12 words: count them (dry run), or with --apply give each its line and move the whole text to the log',
|
|
102
103
|
' pmos initiative status-undo <batch> undo a status-migrate: each line not edited since gets its whole text back',
|
|
104
|
+
' pmos initiative anchor <id> ["<anchor>"] its anchor; with one, change it (an id the OKR files or health budgets declare, else refused with the nearest)',
|
|
105
|
+
' pmos initiative anchors the anchor ids you can pick: key results, health budgets, domains',
|
|
106
|
+
' pmos initiative anchors fold [--apply] anchors with text after the id: list them (dry run), or with --apply keep the id and move the text to anchor_note',
|
|
107
|
+
' pmos initiative anchors undo <batch> undo a fold: each record not edited since gets its whole anchor back',
|
|
103
108
|
' --lane is a work lane of this repository: new-feature, improvement, bug-fix, discovery or chore in a product repository',
|
|
104
109
|
' (scripts/lane-defs.js; the PMOS repository itself uses feature, discovery, chore, incident, content and prototype)',
|
|
105
110
|
' every command: [--json] [--root <dir>]',
|
|
@@ -175,9 +180,17 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), isT
|
|
|
175
180
|
if (flags.title) input.title = flags.title;
|
|
176
181
|
for (const k of ['lane', 'anchor', 'intent', 'id', 'kind']) if (flags[k]) input[k] = flags[k];
|
|
177
182
|
if (flags['raised-by']) input.raised_by = flags['raised-by'];
|
|
183
|
+
// anchor-ids (A547): the anchor is one declared id; a refused id names the nearest, and text after the id goes to anchor_note
|
|
184
|
+
let anchorNote = '';
|
|
185
|
+
if (input.anchor) {
|
|
186
|
+
const c = AID.check(root, input.anchor);
|
|
187
|
+
if (!c.ok) return fail(c.error);
|
|
188
|
+
input.anchor = c.id; anchorNote = c.note;
|
|
189
|
+
}
|
|
178
190
|
const actor = actorLib.fromCli(who);
|
|
179
191
|
const r = writer.createInitiative(root, input, { actor, now });
|
|
180
192
|
if (!r.ok) return fail(r.error);
|
|
193
|
+
if (anchorNote) AID.foldAnchor(root, r.id, { anchor: input.anchor, note: anchorNote, expect: input.anchor }, { actor });
|
|
181
194
|
startOnDefault(root, r, actor);
|
|
182
195
|
// no initiative without an expected outcome (outcome-for-every-initiative): say what Claude drafts next, or that the PM names it
|
|
183
196
|
return done({ id: r.id, path: r.path }, `✓ ${r.id} added at the end of the Roadmap (${r.path}). Commit the record to keep it.\n`
|
|
@@ -303,6 +316,58 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), isT
|
|
|
303
316
|
return done({ role: pos[0] }, `✓ New work starts as ${WK.LABEL[pos[0]]}. Settings shows it now. Each initiative can still change its own kind.`);
|
|
304
317
|
}
|
|
305
318
|
|
|
319
|
+
if (verb === 'anchors') {
|
|
320
|
+
const stateDir = require('./state-root.js').defaultRoot({ env: who.env });
|
|
321
|
+
const actor = actorLib.fromCli(who);
|
|
322
|
+
if (!pos.length) {
|
|
323
|
+
const all = AID.list(root);
|
|
324
|
+
if (json) { say(JSON.stringify({ ok: true, anchors: all })); return 0; }
|
|
325
|
+
if (!all.length) return fail('no anchor is declared: the OKR files and the health budgets name none');
|
|
326
|
+
let g = null;
|
|
327
|
+
for (const a of all) { if (a.group !== g) { g = a.group; say(g); } say(` ${a.value.padEnd(22)}${a.label}`); }
|
|
328
|
+
return 0;
|
|
329
|
+
}
|
|
330
|
+
if (pos[0] === 'fold') {
|
|
331
|
+
if (pos.length !== 1) { say('usage: pmos initiative anchors fold [--apply]'); return 2; }
|
|
332
|
+
const r = AID.fold(root, { apply: !!flags.apply, actor, stateDir, now: now == null ? Date.now() : now });
|
|
333
|
+
if (!r.ok) return fail(r.error);
|
|
334
|
+
if (json) { say(JSON.stringify(r)); return 0; }
|
|
335
|
+
if (!flags.apply) {
|
|
336
|
+
say(`${r.items.length} of ${r.total} anchors have text after the id.`);
|
|
337
|
+
for (const it of r.items.slice(0, 20)) say(` ${it.id}: ${it.anchor} (note: ${it.note.slice(0, 70)}${it.note.length > 70 ? '…' : ''})`);
|
|
338
|
+
if (r.items.length > 20) say(` … and ${r.items.length - 20} more`);
|
|
339
|
+
for (const k of r.kept) say(` kept ${k.id}: ${k.why}`);
|
|
340
|
+
if (r.items.length) say('Run it again with --apply to keep each id and move its text to anchor_note. Nothing was written.');
|
|
341
|
+
return 0;
|
|
342
|
+
}
|
|
343
|
+
say(`✓ ${r.folded} anchors now hold one id; the text after each is in anchor_note.${r.kept.length ? ` ${r.kept.length} kept as they were.` : ''}${r.folded ? ` Undo: pmos initiative anchors undo ${r.batch}` : ''}`);
|
|
344
|
+
return 0;
|
|
345
|
+
}
|
|
346
|
+
if (pos[0] === 'undo') {
|
|
347
|
+
if (pos.length !== 2) { say('usage: pmos initiative anchors undo <batch>'); return 2; }
|
|
348
|
+
const r = AID.undo(root, pos[1], { actor, stateDir, now: now == null ? Date.now() : now });
|
|
349
|
+
if (!r.ok) return fail(r.error, r.status === 400 ? 2 : 1);
|
|
350
|
+
return done(r, r.already ? `${pos[1]} was undone already.` : `✓ ${r.restored} anchors have their whole text back${r.kept ? `; ${r.kept} edited since keep their edit` : ''}.`);
|
|
351
|
+
}
|
|
352
|
+
say('usage: pmos initiative anchors [fold [--apply] | undo <batch>]'); return 2;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
if (verb === 'anchor') {
|
|
356
|
+
const id = pos[0];
|
|
357
|
+
if (!id || pos.length > 2) { say('usage: pmos initiative anchor <id> ["<anchor>"]'); return 2; }
|
|
358
|
+
const cur = AID.readAnchorLine(root, id);
|
|
359
|
+
if (!cur.ok) return fail(cur.error);
|
|
360
|
+
if (pos.length === 1) return done({ id, anchor: AID.anchorId(cur.text), note: AID.split(cur.text).note }, cur.text ? `${id}: ${AID.anchorId(cur.text)}` : `${id} has no anchor yet.`);
|
|
361
|
+
const c = AID.check(root, pos[1]);
|
|
362
|
+
if (!c.ok) return fail(c.error);
|
|
363
|
+
if (c.note && cur.hasNote) return fail(`${id} has an anchor_note already: give the id alone, ${c.id}`);
|
|
364
|
+
const actor = actorLib.fromCli(who);
|
|
365
|
+
const r = writer.setAnchor(root, id, c.id, { actor });
|
|
366
|
+
if (!r.ok) return fail(r.error);
|
|
367
|
+
if (c.note) AID.foldAnchor(root, id, { anchor: c.id, note: c.note, expect: c.id }, { actor });
|
|
368
|
+
return done({ id, anchor: c.id, from: r.from }, `✓ ${id} is anchored to ${c.id}${r.from && r.from !== c.id ? ` (was ${r.from})` : ''}. Work shows it now.`);
|
|
369
|
+
}
|
|
370
|
+
|
|
306
371
|
if (verb === 'status' || verb === 'status-migrate' || verb === 'status-undo') {
|
|
307
372
|
// status-line (A505): the record's status in one line of at most 12 words; the whole text stays in the item's log
|
|
308
373
|
const SL = require('./status-line.js');
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* lessons-draft.js — PMOS drafts an initiative's Lessons when its experiment closes (initiative lessons-on-close, job #1971, idea A542; done
|
|
3
|
+
* test planning/done-tests/lessons-on-close.md).
|
|
4
|
+
*
|
|
5
|
+
* D107 made Lessons one of the seven artefacts (lib/artefacts.js). An experiment closes when an outcome check is recorded on it, or when the PM
|
|
6
|
+
* keeps the ✦ that stops it (a met kill line or a refuted check: the D70 lifecycle line, state cancelled). Then PMOS reads what the experiment
|
|
7
|
+
* set out to do and what happened, and writes up to five Lessons lines on experiment:<id>, each with its sources. Every line is an agent's
|
|
8
|
+
* set: `pmos artefacts undo <a-id>` takes it back.
|
|
9
|
+
*
|
|
10
|
+
* factsOf(root, id) → { id, title, expected, kill, intent, goal, doneRows: [text], result: { kind, disposition?, evidence, date } | null,
|
|
11
|
+
* decisions: [text], sources: { experiment, done, result, decision } } | null READ-ONLY
|
|
12
|
+
* closedOf(root, id) → the result that closed it ({ kind: 'check'|'stopped', … }) or null
|
|
13
|
+
* promptOf(F) · parse(text, F) the session's prompt and its answer read back ([{ text, sources }], at most MAX) PURE
|
|
14
|
+
* fallbackOf(F) → [{ text, sources }] a plain draft from the facts' own words, when no session answers PURE
|
|
15
|
+
* lessonsHere(state, id) → { pm: [set], agent: [set] } the Lessons lines on experiment:<id>, by who wrote them PURE
|
|
16
|
+
* draft(ctx, { root, id, dir, now }) → { ok, wrote: [line], made: 'session'|'facts' } | { ok: true, wrote: [], why }
|
|
17
|
+
* onClose(ctx, { root, id }) the hook: drafts once, in the background, after a check is recorded or an experiment is stopped
|
|
18
|
+
* due(root, { dir }) → [id] closed experiments with no Lessons line yet
|
|
19
|
+
* kept(dir, { now, days }) → the drafted lines still standing that were written in the last `days` days (the health number)
|
|
20
|
+
*
|
|
21
|
+
* NEVER over the PM: an initiative with a Lessons line the PM wrote gets no draft, and nothing here undoes or edits a line. A second check on
|
|
22
|
+
* an initiative that has drafted Lessons drafts nothing more. The session is one normal PMOS session (`claude -p` through the existing
|
|
23
|
+
* read-only `briefing-ask:` ask kind, no tools but Read), as lib/task-describe.js uses. Tests inject ctx.askClaude(prompt, { job, key }).
|
|
24
|
+
* The copy says PMOS, never the model's name. */
|
|
25
|
+
const fs = require('fs');
|
|
26
|
+
const path = require('path');
|
|
27
|
+
const crypto = require('crypto');
|
|
28
|
+
const A = require('./artefacts.js');
|
|
29
|
+
|
|
30
|
+
const MAX = 5;
|
|
31
|
+
const BY = 'agent:lessons-draft';
|
|
32
|
+
const ID_RE = /^[A-Za-z0-9][A-Za-z0-9._-]{0,79}$/;
|
|
33
|
+
const DAY = 864e5;
|
|
34
|
+
const clip = (s, n) => { const t = String(s == null ? '' : s).replace(/\s+/g, ' ').trim(); return t.length <= n ? t : t.slice(0, n - 1).replace(/[,;:\s]+$/, '') + '…'; };
|
|
35
|
+
const linesOf = (f) => { try { return fs.readFileSync(f, 'utf8').replace(/\r\n?/g, '\n').split('\n'); } catch { return null; } };
|
|
36
|
+
const rel = (root, f) => path.relative(root, f).split(path.sep).join('/');
|
|
37
|
+
const unquote = (v) => String(v || '').trim().replace(/^"(.*)"$/, '$1').replace(/^'(.*)'$/, '$1');
|
|
38
|
+
function jsonRows(file) { const L = linesOf(file); if (!L) return []; const out = []; for (const s of L) { if (!s.trim()) continue; try { const o = JSON.parse(s); if (o && typeof o === 'object') out.push(o); } catch { /* torn */ } } return out; }
|
|
39
|
+
|
|
40
|
+
function layoutOf(root) {
|
|
41
|
+
const kit = fs.existsSync(path.join(root, 'pmos', 'state'));
|
|
42
|
+
return { kit, initiatives: kit ? path.join(root, 'pmos', 'state', 'initiatives') : path.join(root, 'planning', 'initiatives'), runsDir: kit ? path.join(root, 'pmos', 'state') : path.join(root, 'planning', 'runs') };
|
|
43
|
+
}
|
|
44
|
+
const ledger = (root, L, name) => [...new Set([path.join(L.runsDir, name), path.join(root, 'pmos', 'state', name), path.join(root, 'planning', 'runs', name)])].flatMap(jsonRows);
|
|
45
|
+
function frontOf(L) {
|
|
46
|
+
const fm = {}; let end = 0;
|
|
47
|
+
if (!L || !/^---\s*$/.test(L[0] || '')) return { fm, end };
|
|
48
|
+
for (let i = 1; i < L.length && i < 200; i++) { if (/^---\s*$/.test(L[i])) { end = i + 1; break; } const m = /^([A-Za-z_][A-Za-z0-9_]*):\s*(.*)$/.exec(L[i]); if (m && !(m[1] in fm)) fm[m[1]] = unquote(m[2]); }
|
|
49
|
+
return { fm, end };
|
|
50
|
+
}
|
|
51
|
+
/** The first paragraph under "## <name>". */
|
|
52
|
+
function sectionOf(L, name) {
|
|
53
|
+
const at = L.findIndex((l) => new RegExp('^##\\s+' + name + '\\s*$', 'i').test(l));
|
|
54
|
+
if (at < 0) return '';
|
|
55
|
+
const out = [];
|
|
56
|
+
for (let i = at + 1; i < L.length && !/^#{1,2}\s/.test(L[i]); i++) { if (!L[i].trim()) { if (out.length) break; continue; } out.push(L[i].trim()); }
|
|
57
|
+
return clip(out.join(' '), 400);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** The result that closed the experiment: its standing outcome check, else the D70 line that stopped it. null while it runs. */
|
|
61
|
+
function closedOf(root, id) {
|
|
62
|
+
root = path.resolve(root);
|
|
63
|
+
const L = layoutOf(root);
|
|
64
|
+
let checks = [];
|
|
65
|
+
try { checks = require('./outcomes.js').liveChecks(ledger(root, L, 'outcome_checks.jsonl')); } catch { checks = []; }
|
|
66
|
+
const c = checks.filter((r) => r.initiative_id === id && r.disposition).pop();
|
|
67
|
+
let life = null;
|
|
68
|
+
for (const r of ledger(root, L, 'lifecycle.jsonl')) if (r && r.initiative_id === id && r.state) life = r;
|
|
69
|
+
if (life && life.state === 'cancelled') return { kind: 'stopped', evidence: clip(life.reason || 'Stopped.', 400), date: String(life.at || '').slice(0, 10), ref: rel(root, path.join(L.runsDir, 'lifecycle.jsonl')) };
|
|
70
|
+
if (c) return { kind: 'check', disposition: c.disposition, evidence: clip(c.evidence, 400), date: c.date || String(c.at || '').slice(0, 10), ref: rel(root, path.join(L.runsDir, 'outcome_checks.jsonl')) };
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function factsOf(root, id) {
|
|
75
|
+
root = path.resolve(root);
|
|
76
|
+
if (!ID_RE.test(String(id || ''))) return null;
|
|
77
|
+
const L = layoutOf(root), file = path.join(L.initiatives, id + '.md'), R = linesOf(file);
|
|
78
|
+
if (!R) return null;
|
|
79
|
+
const { fm } = frontOf(R);
|
|
80
|
+
const doneFile = fm.done_test_path ? path.resolve(root, String(fm.done_test_path).replace(/^\//, '')) : null;
|
|
81
|
+
const D = doneFile && doneFile.startsWith(root + path.sep) ? linesOf(doneFile) : null;
|
|
82
|
+
const doneRows = (D || []).map((l) => /^\|\s*([A-Z]{1,3}\d{1,3})\s*\|\s*(.+?)\s*\|/.exec(l)).filter(Boolean).map((m) => clip(m[1] + ': ' + m[2], 240)).slice(0, 8);
|
|
83
|
+
const decFile = path.join(root, 'pm-decisions.md'), DL = linesOf(decFile) || [];
|
|
84
|
+
const idRe = new RegExp('(^|[^a-z0-9-])' + id.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') + '([^a-z0-9-]|$)', 'i');
|
|
85
|
+
const decisions = DL.filter((l) => idRe.test(l) && l.trim().length > id.length + 8).slice(-3).map((l) => clip(l.replace(/^\s*[-*#|>]+\s*/, ''), 300));
|
|
86
|
+
return {
|
|
87
|
+
id, title: fm.title || id, expected: clip(fm.expected_outcome || '', 300), kill: clip(fm.kill || '', 300),
|
|
88
|
+
intent: sectionOf(R, 'Intent'), goal: sectionOf(R, 'Goal'), doneRows, result: closedOf(root, id), decisions,
|
|
89
|
+
sources: { experiment: rel(root, file), done: D ? rel(root, doneFile) : '', result: '', decision: decisions.length ? 'pm-decisions.md' : '' },
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const SRC = { experiment: 'the experiment', done: 'the done test', result: 'the result', decision: 'a decision' };
|
|
94
|
+
function srcList(F, keys) {
|
|
95
|
+
const out = [];
|
|
96
|
+
for (const k of keys) {
|
|
97
|
+
const ref = k === 'result' ? (F.result && F.result.ref) || '' : F.sources[k];
|
|
98
|
+
if (ref && !out.some((x) => x.ref === ref)) out.push({ label: SRC[k], ref });
|
|
99
|
+
}
|
|
100
|
+
return out;
|
|
101
|
+
}
|
|
102
|
+
const WORD = { worked: 'worked', confirmed: 'worked', refuted: 'did not work', 'did-not-work': 'did not work', inconclusive: 'was inconclusive' };
|
|
103
|
+
const resultWord = (r) => (!r ? '' : r.kind === 'stopped' ? 'was stopped' : WORD[r.disposition] || 'was checked (' + r.disposition + ')');
|
|
104
|
+
|
|
105
|
+
/** PURE. */
|
|
106
|
+
function promptOf(F) {
|
|
107
|
+
const r = F.result;
|
|
108
|
+
return [
|
|
109
|
+
'You write the Lessons of one closed product experiment for a product manager. Write from the facts below only. Invent nothing.',
|
|
110
|
+
'Write 1 to 5 lines. Each line is one lesson in plain words (at most 200 characters): what this experiment teaches the next one.',
|
|
111
|
+
'End each line with its source in brackets, one of [experiment], [done test], [result], [decision]. A line with no source is dropped.',
|
|
112
|
+
'Start each line with "- ". Write nothing else.',
|
|
113
|
+
'',
|
|
114
|
+
`Experiment: ${F.title} (${F.id})`,
|
|
115
|
+
F.intent ? `Intent: ${F.intent}` : '',
|
|
116
|
+
F.goal ? `Goal: ${F.goal}` : '',
|
|
117
|
+
F.expected ? `Expected outcome: ${F.expected}` : '',
|
|
118
|
+
F.kill ? `Kill line: ${F.kill}` : '',
|
|
119
|
+
F.doneRows.length ? 'Done test:\n' + F.doneRows.map((x) => ' ' + x).join('\n') : '',
|
|
120
|
+
r ? `Result (${r.date}): it ${resultWord(r)}. ${r.evidence}` : '',
|
|
121
|
+
F.decisions.length ? 'Decisions:\n' + F.decisions.map((x) => ' ' + x).join('\n') : '',
|
|
122
|
+
].filter(Boolean).join('\n');
|
|
123
|
+
}
|
|
124
|
+
const TAG = { experiment: 'experiment', 'done test': 'done', result: 'result', decision: 'decision' };
|
|
125
|
+
/** PURE. The session's lines with a known source, at most MAX. */
|
|
126
|
+
function parse(text, F) {
|
|
127
|
+
const out = [];
|
|
128
|
+
for (const raw of String(text || '').split('\n')) {
|
|
129
|
+
const m = /^\s*[-*]\s+(.+?)\s*\[(experiment|done test|result|decision)\]\s*\.?\s*$/i.exec(raw);
|
|
130
|
+
if (!m) continue;
|
|
131
|
+
const k = TAG[m[2].toLowerCase()], t = clip(m[1].replace(/\s*[—–-]\s*$/, ''), 300);
|
|
132
|
+
const sources = srcList(F, [k]);
|
|
133
|
+
if (t.length < 12 || !sources.length || /\bclaude\b/i.test(t)) continue;
|
|
134
|
+
out.push({ text: t, sources });
|
|
135
|
+
if (out.length >= MAX) break;
|
|
136
|
+
}
|
|
137
|
+
return out;
|
|
138
|
+
}
|
|
139
|
+
/** PURE. A plain draft in the facts' own words. */
|
|
140
|
+
function fallbackOf(F) {
|
|
141
|
+
const r = F.result, out = [];
|
|
142
|
+
if (r) out.push({ text: clip(`${F.title} ${resultWord(r)} (${r.date}): ${r.evidence.replace(/[.\s]+$/, '')}.`, 300), sources: srcList(F, ['result']) });
|
|
143
|
+
if (F.expected && r) out.push({ text: clip(`It set out to show: ${F.expected.replace(/[.\s]+$/, '')}.`, 300), sources: srcList(F, ['experiment']) });
|
|
144
|
+
if (F.kill && r && r.kind === 'stopped') out.push({ text: clip(`Its kill line was: ${F.kill.replace(/[.\s]+$/, '')}.`, 300), sources: srcList(F, ['experiment']) });
|
|
145
|
+
if (F.doneRows.length && r) out.push({ text: clip(`The done test checked ${F.doneRows.length} ${F.doneRows.length === 1 ? 'thing' : 'things'}, first ${F.doneRows[0].replace(/[.\s]+$/, '')}.`, 300), sources: srcList(F, ['done']) });
|
|
146
|
+
return out.filter((x) => x.sources.length).slice(0, MAX);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/** PURE. */
|
|
150
|
+
function lessonsHere(state, id) {
|
|
151
|
+
const x = state && state.get('experiment:' + id), m = x && x.get('lessons');
|
|
152
|
+
const sets = m ? m.sets.filter((l) => l.field === 'line') : [];
|
|
153
|
+
return { pm: sets.filter((l) => /^pm:/.test(String(l.by || ''))), agent: sets.filter((l) => !/^pm:/.test(String(l.by || ''))) };
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/* ── the session ── */
|
|
157
|
+
const MODEL = 'claude-sonnet-5-5';
|
|
158
|
+
const LEAN = Object.freeze([{ flag: '--strict-mcp-config' }, { flag: '--disable-slash-commands' }, { flag: '--setting-sources', value: 'user' }, { flag: '--tools', value: 'Read' }]);
|
|
159
|
+
const TIMEOUT_MS = 90000;
|
|
160
|
+
function viaSession(ctx, prompt, key) {
|
|
161
|
+
if (typeof ctx.askClaude === 'function') return Promise.resolve(ctx.askClaude(prompt, { job: 'lessons-draft', key })).catch(() => null);
|
|
162
|
+
const origin = 'briefing-ask:lessons-draft:' + key;
|
|
163
|
+
let headless = null; try { headless = require('./headless.js'); } catch { headless = null; }
|
|
164
|
+
if (typeof ctx.spawnSession !== 'function' || !headless || headless.kindFor({ agent: 'claude', origin }) !== 'ask') return Promise.resolve(null);
|
|
165
|
+
return new Promise((resolve) => {
|
|
166
|
+
let settled = false; const done = (v) => { if (settled) return; settled = true; clearTimeout(t); resolve(v); };
|
|
167
|
+
const t = setTimeout(() => done(null), TIMEOUT_MS);
|
|
168
|
+
let s = null;
|
|
169
|
+
try {
|
|
170
|
+
s = ctx.spawnSession({ name: 'lessons: draft them', agent: 'claude', origin, initialInput: prompt,
|
|
171
|
+
modelAsk: { explicit: { model: MODEL, effort: 'low' } }, launchFlags: LEAN.map((f) => ({ ...f })),
|
|
172
|
+
onDone: (d) => { const r = d && d.result; done(r && r.ok && !r.isError ? String(r.text || '') : null); } });
|
|
173
|
+
} catch { s = null; }
|
|
174
|
+
if (!s || s.state === 'exited') done(null);
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const RUNNING = new Set();
|
|
179
|
+
async function draft(ctx, { root, id, dir = null, now = Date.now() } = {}) {
|
|
180
|
+
root = path.resolve(root || '.');
|
|
181
|
+
if (!ID_RE.test(String(id || ''))) return { ok: false, error: 'name the initiative by its id' };
|
|
182
|
+
let d = dir; if (!d) { try { d = A.dirOf(root); } catch (e) { return { ok: false, error: String((e && e.message) || e) }; } }
|
|
183
|
+
const f = A.file(d);
|
|
184
|
+
const here = lessonsHere(A.fold(A.readLines(f)), id);
|
|
185
|
+
if (here.pm.length) return { ok: true, wrote: [], why: 'you wrote its lessons: PMOS leaves them as they are' };
|
|
186
|
+
if (here.agent.length) return { ok: true, wrote: [], why: 'PMOS drafted its lessons already' };
|
|
187
|
+
const F = factsOf(root, id);
|
|
188
|
+
if (!F) return { ok: false, error: `no initiative ${id} here` };
|
|
189
|
+
if (!F.result) return { ok: true, wrote: [], why: `${id} is still running: its lessons are drafted when its outcome check or kill line closes it` };
|
|
190
|
+
const key = crypto.createHash('sha1').update(root + '\n' + id + '\n' + promptOf(F)).digest('hex').slice(0, 12);
|
|
191
|
+
const said = await viaSession(ctx || {}, promptOf(F), key);
|
|
192
|
+
const got = said != null ? parse(said, F) : [];
|
|
193
|
+
const L = got.length ? got : fallbackOf(F), made = got.length ? 'session' : 'facts';
|
|
194
|
+
// the PM may have written while the session ran: read again, and write nothing over their lessons
|
|
195
|
+
const again = lessonsHere(A.fold(A.readLines(f)), id);
|
|
196
|
+
if (again.pm.length || again.agent.length) return { ok: true, wrote: [], why: again.pm.length ? 'you wrote its lessons: PMOS leaves them as they are' : 'PMOS drafted its lessons already' };
|
|
197
|
+
const wrote = [];
|
|
198
|
+
for (const x of L) {
|
|
199
|
+
const r = A.set(f, { scope: 'experiment:' + id, artefact: 'lessons', field: 'line', text: x.text, sources: x.sources }, { by: BY, via: 'pmos' }, { now });
|
|
200
|
+
if (r.ok) wrote.push(r.line);
|
|
201
|
+
}
|
|
202
|
+
console.info(`[lessons-draft] drafted ${id} lines=${wrote.length} made=${made} closed=${F.result.kind}`);
|
|
203
|
+
return { ok: true, wrote, made };
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/** The hook (lib/routes-proposals.js): after a check is recorded or an experiment is stopped. Drafts in the background, once per id at a time. */
|
|
207
|
+
function onClose(ctx, { root, id, dir = null } = {}) {
|
|
208
|
+
const k = String(root) + '|' + id;
|
|
209
|
+
if (RUNNING.has(k)) return null;
|
|
210
|
+
RUNNING.add(k);
|
|
211
|
+
const p = Promise.resolve().then(() => draft(ctx, { root, id, dir })).catch((e) => { console.warn('[lessons-draft] ' + id + ': ' + String((e && e.message) || e).slice(0, 160)); return null; })
|
|
212
|
+
.finally(() => RUNNING.delete(k));
|
|
213
|
+
return p;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
function due(root, { dir = null } = {}) {
|
|
217
|
+
root = path.resolve(root);
|
|
218
|
+
const L = layoutOf(root);
|
|
219
|
+
let d = dir; if (!d) { try { d = A.dirOf(root); } catch { d = null; } }
|
|
220
|
+
const S = d ? A.fold(A.readLines(A.file(d))) : new Map();
|
|
221
|
+
const ids = new Set();
|
|
222
|
+
for (const r of ledger(root, L, 'outcome_checks.jsonl')) if (r && r.initiative_id && r.disposition) ids.add(r.initiative_id);
|
|
223
|
+
for (const r of ledger(root, L, 'lifecycle.jsonl')) if (r && r.initiative_id && r.state === 'cancelled') ids.add(r.initiative_id);
|
|
224
|
+
return [...ids].filter((id) => ID_RE.test(id) && closedOf(root, id) && fs.existsSync(path.join(L.initiatives, id + '.md'))).filter((id) => { const h = lessonsHere(S, id); return !h.pm.length && !h.agent.length; }).sort();
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
function kept(dir, { now = Date.now(), days = 7 } = {}) {
|
|
228
|
+
const lines = A.readLines(A.file(dir));
|
|
229
|
+
const undone = new Set(lines.filter((l) => l.ev === 'undo').map((l) => l.ref));
|
|
230
|
+
return lines.filter((l) => l.ev === 'set' && l.artefact === 'lessons' && l.by === BY && !undone.has(l.id) && Date.parse(l.at) >= now - days * DAY).length;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
module.exports = { MAX, BY, factsOf, closedOf, promptOf, parse, fallbackOf, lessonsHere, draft, onClose, due, kept };
|
|
234
|
+
|
|
235
|
+
// `node lib/lessons-draft.js kept [--days N]`: the health number on its last line
|
|
236
|
+
if (require.main === module) {
|
|
237
|
+
const a = process.argv.slice(2), i = a.indexOf('--days'), days = i >= 0 ? Number(a[i + 1]) || 7 : 7;
|
|
238
|
+
if (a[0] !== 'kept') { console.log('usage: node lib/lessons-draft.js kept [--days N]'); process.exit(2); }
|
|
239
|
+
let root = process.cwd(); try { root = require('child_process').execFileSync('git', ['rev-parse', '--show-toplevel'], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] }).trim() || root; } catch { /* cwd */ }
|
|
240
|
+
let dir = null; try { dir = A.dirOf(root); } catch { dir = null; }
|
|
241
|
+
console.log(String(dir ? kept(dir, { days }) : 0));
|
|
242
|
+
}
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* pmos people settings [--json] whether calendar attendee names are kept
|
|
9
9
|
* pmos people map <initiative> [--json] who decides, must agree, needs to know, and when each last heard (A371)
|
|
10
10
|
* pmos people keep|drop|told|undo <initiative> <person> [--group decides|agree|know] the PM's word on one name (lib/stakeholder-map.js)
|
|
11
|
+
* pmos people prep <person> [--days N] [--json] a 1:1 brief from the tasks they own (lib/people-prep.js, idea A85)
|
|
11
12
|
*
|
|
12
13
|
* The same module the People place reads (lib/people-store.js), so a terminal line and the page cannot disagree.
|
|
13
14
|
* `list` and `show` first record the names this repository's records hold (plan item owners, Live notes speakers), as
|
|
@@ -22,7 +23,7 @@ const path = require('path');
|
|
|
22
23
|
const store = require('./people-store');
|
|
23
24
|
const { parseArgs } = require('./schedule-cli');
|
|
24
25
|
|
|
25
|
-
const COMMANDS = { people: ['list', 'show', 'record', 'settings', 'map', 'keep', 'drop', 'told', 'undo'] };
|
|
26
|
+
const COMMANDS = { people: ['list', 'show', 'record', 'settings', 'map', 'keep', 'drop', 'told', 'undo', 'prep'] };
|
|
26
27
|
const USAGE = [
|
|
27
28
|
'usage: pmos people [list|show|record|settings] — the people you work with in this repository',
|
|
28
29
|
' pmos people [list] [--json] each person, and what waits for you in the review list',
|
|
@@ -32,6 +33,7 @@ const USAGE = [
|
|
|
32
33
|
' pmos people map <initiative> [--json] who decides, who must agree, who needs to know, and when each last heard from you',
|
|
33
34
|
' pmos people keep <initiative> <person> [--group decides|agree|know] keep a name on the map (in that group)',
|
|
34
35
|
' pmos people drop|told|undo <initiative> <person> take a name off, mark that you sent them an update, or take back the last of these',
|
|
36
|
+
' pmos people prep <person> [--days N] [--json] a 1:1 brief: what they shipped, where they are stuck, one thing to recognise',
|
|
35
37
|
'Nothing here removes a person, merges, sets a tone or writes a note. Do that in People. PMOS never sends an update: you do.',
|
|
36
38
|
];
|
|
37
39
|
const BOOL = new Set(['json', 'help']);
|
|
@@ -64,6 +66,12 @@ const toneWord = (t) => (t.confirmed ? t.confirmed : t.proposed ? `${t.proposed}
|
|
|
64
66
|
const handleText = (h) => `${h.kind} ${h.value}`;
|
|
65
67
|
|
|
66
68
|
async function run(argv, { say = console.log, cwd = process.cwd(), env = process.env, now = Date.now() } = {}) {
|
|
69
|
+
// a 1:1 brief reads only the tasks (lib/people-prep.js): its own options, before the people store is scanned
|
|
70
|
+
if (argv[1] === 'prep') {
|
|
71
|
+
const rest = argv.slice(2), r = rest.indexOf('--root');
|
|
72
|
+
const root = r >= 0 && rest[r + 1] ? path.resolve(cwd, rest[r + 1]) : repoRoot(cwd);
|
|
73
|
+
return require('./people-prep.js').run(r >= 0 ? rest.filter((_, i) => i !== r && i !== r + 1) : rest, { say, root, env, now });
|
|
74
|
+
}
|
|
67
75
|
const { pos, flags } = parse(argv.slice(1));
|
|
68
76
|
const sub = pos[0] || 'list';
|
|
69
77
|
if (flags.help || sub === 'help') { USAGE.forEach((l) => say(l)); return 0; }
|