@nanocollective/roster 0.1.0-beta.7 → 0.1.0-beta.8
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/dist/cli.js +20 -5
- package/dist/worker/assets/assets/css/home.css +2 -0
- package/dist/worker/assets/assets/js/views/home.js +58 -28
- package/dist/worker/index.js +1 -1
- package/docs/architecture.md +22 -3
- package/docs/concepts.md +1 -1
- package/docs/developing.md +1 -1
- package/docs/memory.md +2 -1
- package/docs/portal.md +2 -1
- package/docs/session-workflow.md +10 -6
- package/docs/staff-yaml.md +5 -2
- package/package.json +1 -1
- package/templates/brain/CHARTER.md +2 -2
- package/templates/brain/STATE.md +16 -0
- package/templates/brain/memory/INDEX.md +1 -1
- package/templates/ops/.github/workflows/session.yaml +14 -1
- package/templates/ops/org/voice.md +2 -1
- package/templates/ops/prompts/daily.md +29 -11
- package/templates/ops/prompts/mention.md +5 -2
- package/templates/ops/status-week.mjs +167 -0
- package/templates/portal/css/home.css +2 -0
- package/templates/portal/js/views/home.js +58 -28
package/docs/architecture.md
CHANGED
|
@@ -51,12 +51,15 @@ directory copy:
|
|
|
51
51
|
clone: the brain with full history, each peer's brain, each product repo.
|
|
52
52
|
5. `inflight.mjs` lists open pull requests people have on the product repos, so the run
|
|
53
53
|
does not open competing work on the same files.
|
|
54
|
+
On a daily run, `status-week.mjs` opens this week's status issue if the one in `staff.yaml`
|
|
55
|
+
is from an earlier week. See [the week's status issue](#the-weeks-status-issue).
|
|
54
56
|
6. `compose.mjs` assembles the prompt from the org layer (`operating`, `guardrails`, `voice`,
|
|
55
57
|
`business`, and `priorities` when written), the charter, the work in flight, and the
|
|
56
58
|
fragment for this kind of run.
|
|
57
59
|
7. `agents.mjs` resolves which coding agent to run and how.
|
|
58
60
|
8. The agent runs with a shell, `gh` already authenticated, and the whole checkout.
|
|
59
|
-
9. It works, commits, pushes, opens issues, comments, and
|
|
61
|
+
9. It works, commits, pushes, opens issues, comments, rewrites `STATE.md` and the body of its
|
|
62
|
+
status issue, and posts a run report there.
|
|
60
63
|
**The workflow does not commit on its behalf**; the prompt tells it to and it does.
|
|
61
64
|
10. `run-record.mjs` writes down what the run was: outcome, duration, and turns and cost where
|
|
62
65
|
the agent reports them. It goes in the job summary and a `roster-run` artifact, which is
|
|
@@ -70,7 +73,7 @@ Nothing is stored outside the repos. There is no database and no service.
|
|
|
70
73
|
The prompt imposes a shape, and the shape is what makes an unattended run useful.
|
|
71
74
|
|
|
72
75
|
**Boot** is reconstituting a self that has no memory of yesterday. It reads `memory/INDEX.md`
|
|
73
|
-
in full, the
|
|
76
|
+
in full, `STATE.md` (the last run's handover), and its own charter. That is deliberately all: notes are read
|
|
74
77
|
only when a fact is in play, and the decision log is not boot context at all.
|
|
75
78
|
|
|
76
79
|
This is why memory is one line per fact. Boot context here went from about 52,000 words to
|
|
@@ -79,6 +82,22 @@ forever.
|
|
|
79
82
|
|
|
80
83
|
**Work** is one thing done properly rather than four things started.
|
|
81
84
|
|
|
85
|
+
## The week's status issue
|
|
86
|
+
|
|
87
|
+
Each staff member has one status issue a week, pinned on their tracker. Its body is written for
|
|
88
|
+
you: where each priority stands, what is on you, what they do next. Each daily run that moved
|
|
89
|
+
something posts a run report of at most three lines there. A thread that never ends turns into
|
|
90
|
+
a diary nobody reads, which is why it is a week long.
|
|
91
|
+
|
|
92
|
+
The first daily run of a week (Monday, UTC) opens the new one before the prompt is composed:
|
|
93
|
+
`status-week.mjs` opens it with last week's body, pins it, unpins the old one, takes `keep-open`
|
|
94
|
+
off it, and moves `status_issue:` in `staff.yaml` on and commits that. The run then closes last
|
|
95
|
+
week's issue with the week in five lines. A week whose summary never got written is offered to
|
|
96
|
+
the next run again. The closed issues, labelled `status`, are the history.
|
|
97
|
+
|
|
98
|
+
What the next run needs from this one lives in `STATE.md` in the brain, not in the issue, so
|
|
99
|
+
the issue never has to carry notes the agent wrote to itself.
|
|
100
|
+
|
|
82
101
|
**Hand off** is the part that makes the next run possible: open the PR, rewrite the status
|
|
83
102
|
issue (rewrite, not append), reconcile the tracker, update memory only if a fact changed, log
|
|
84
103
|
real decisions, and write to peers if something touches their patch.
|
|
@@ -122,7 +141,7 @@ See [manual steps](manual-steps.md).
|
|
|
122
141
|
| `compose.mjs` | the tenant | a run must not depend on npm or on the framework |
|
|
123
142
|
| `agents.mjs` | the tenant | same |
|
|
124
143
|
| `runner-plan.mjs` | the tenant | same |
|
|
125
|
-
| `inflight.mjs`, `run-record.mjs` | the tenant | same |
|
|
144
|
+
| `inflight.mjs`, `run-record.mjs`, `status-week.mjs` | the tenant | same |
|
|
126
145
|
| `session.yaml` | the tenant | private reusable workflows are same-org only |
|
|
127
146
|
| the CLI | the framework | runs on your machine, when you ask it to |
|
|
128
147
|
| the portal | the framework | reads the tenant's repos from GitHub, as the person using it |
|
package/docs/concepts.md
CHANGED
|
@@ -40,7 +40,7 @@ commits and pushes. A change here reaches everybody on their next run, which is
|
|
|
40
40
|
rule every staff member should follow is one edit, not one per repo.
|
|
41
41
|
|
|
42
42
|
**Everything else is machinery** and belongs to the framework: `compose.mjs`, `agents.mjs`,
|
|
43
|
-
`runner-plan.mjs`, `inflight.mjs`, `run-record.mjs`, `.github/workflows/session.yaml`. Editing these works right up until the
|
|
43
|
+
`runner-plan.mjs`, `inflight.mjs`, `run-record.mjs`, `status-week.mjs`, `.github/workflows/session.yaml`. Editing these works right up until the
|
|
44
44
|
framework changes the same file, at which point your change is a conflict at best and silently
|
|
45
45
|
reverted at worst. Fix machinery in the framework, then `roster upgrade`.
|
|
46
46
|
|
package/docs/developing.md
CHANGED
|
@@ -81,7 +81,7 @@ registers into at boot.
|
|
|
81
81
|
## The rule that matters
|
|
82
82
|
|
|
83
83
|
**Never fix a generated file in a tenant.** `compose.mjs`, `agents.mjs`, `runner-plan.mjs`,
|
|
84
|
-
`inflight.mjs`, `run-record.mjs` and `session.yaml` live in `templates/ops/`. Fix them there and run `roster upgrade`.
|
|
84
|
+
`inflight.mjs`, `run-record.mjs`, `status-week.mjs` and `session.yaml` live in `templates/ops/`. Fix them there and run `roster upgrade`.
|
|
85
85
|
|
|
86
86
|
A fix made in the tenant's copy goes unnoticed until the framework next touches that file, and
|
|
87
87
|
then it is a conflict. So `roster upgrade` reports an edit to a framework-owned file whether or
|
package/docs/memory.md
CHANGED
|
@@ -69,7 +69,8 @@ hand-off and make pruning that run's job when it is over.
|
|
|
69
69
|
- **How a thing works.** That is a draft or a strategy document.
|
|
70
70
|
- **An idea not yet acted on.** That is one line in `strategy/ideas.md`, and it becomes an issue
|
|
71
71
|
only when it needs a ruling.
|
|
72
|
-
- **What is outstanding.** That is the
|
|
72
|
+
- **What is outstanding.** That is `STATE.md`, the handover each daily run rewrites. The pinned
|
|
73
|
+
status issue is the same picture written for you.
|
|
73
74
|
|
|
74
75
|
Nothing is copied between them. Four places, four jobs, and a fact that appears in two of them
|
|
75
76
|
will disagree with itself within a month.
|
package/docs/portal.md
CHANGED
|
@@ -102,7 +102,8 @@ Where the portal opens. An Ask box at the top, then these, in order.
|
|
|
102
102
|
tracker with their `@handle` in front, which wakes them in about a minute.
|
|
103
103
|
- **Latest reports.** Each staff member's run report from the last day: the three lines they
|
|
104
104
|
post on their status issue at the end of a daily run, with the issues and pull requests it
|
|
105
|
-
names as links. Click a report to open their status issue.
|
|
105
|
+
names as links. Click a report to open their status issue. **Ask for a report** comments on
|
|
106
|
+
their status issue with their `@handle`, and they reply there in a few minutes.
|
|
106
107
|
- **Needs you.** Every ask a staff member has put on you, and every pull request ready to
|
|
107
108
|
merge, oldest first. Each card has one action on its right:
|
|
108
109
|
- a `decision` has **Reply**, and **Go with the default** when it carries one. The default
|
package/docs/session-workflow.md
CHANGED
|
@@ -75,19 +75,23 @@ Then the session:
|
|
|
75
75
|
`inflight.mjs`, for the prompt. Never fatal. See [prompts](prompts.md#human-work-in-flight).
|
|
76
76
|
10. **Set git identity** to the App.
|
|
77
77
|
11. **Set up Node and pnpm**, if the plan found a `package.json`.
|
|
78
|
-
12. **
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
78
|
+
12. **Open this week's status issue**, daily runs only, by running `status-week.mjs`: when the
|
|
79
|
+
status issue in `staff.yaml` is from an earlier week, a new one is opened, pinned and
|
|
80
|
+
committed to `staff.yaml`, and the prompt is told which earlier week still needs its summary.
|
|
81
|
+
Never fatal. See [architecture](architecture.md#the-weeks-status-issue).
|
|
82
|
+
13. **Compose the prompt**, to a step output and to `.roster-prompt.txt`.
|
|
83
|
+
14. **Check the agent has a credential.**
|
|
84
|
+
15. **Work out which agent runs this**, by running `agents.mjs`.
|
|
85
|
+
16. **Run the session**, by one of two steps: the Action-based reference runner, or the generic
|
|
82
86
|
CLI one. See [choosing a coding agent](agents.md).
|
|
83
87
|
Then, for a mention, **check the request was answered**: a reply in the thread, or the issue
|
|
84
88
|
closed. Neither fails the job, so the notice below tells the human.
|
|
85
89
|
Then, for a daily run that finished and wrote `.roster-run/continue`, **start a follow-on
|
|
86
90
|
run**: one more daily run with `trigger: follow-on`, which waits for this one to end.
|
|
87
|
-
|
|
91
|
+
17. **Write down the run**, whatever happened: staff, kind, outcome, duration, and turns, cost
|
|
88
92
|
and tokens where the agent reports them. Into the job summary, and kept as an artifact
|
|
89
93
|
called `roster-run`. Never fatal. See [cost](cost.md#what-each-run-cost).
|
|
90
|
-
|
|
94
|
+
18. **Say so if the run did not finish.** A comment on the status issue, or on the issue that
|
|
91
95
|
woke a mention, linking the run.
|
|
92
96
|
|
|
93
97
|
## When the failure is the token
|
package/docs/staff-yaml.md
CHANGED
|
@@ -62,7 +62,7 @@ labels:
|
|
|
62
62
|
| `mention` | yes | What wakes them, as in `@cto`. The caller's condition tests for this string. |
|
|
63
63
|
| `icon` | no | The icon the portal shows for them: `code`, `megaphone`, `life-buoy`, `compass`, `brush`, `bug`, `server`, `book-open`, `bar-chart`, `users` or `person`. Unset, it is picked from the role. |
|
|
64
64
|
| `brain` | yes | `owner/name` of this repo. Without it nothing can check secrets, labels or runs. |
|
|
65
|
-
| `status_issue` | yes in practice | Number of
|
|
65
|
+
| `status_issue` | yes in practice | Number of this week's pinned status issue. The prompts reference it, so a run cannot compose without it. `roster hire --apply` writes the first; the first daily run of each week moves it on. |
|
|
66
66
|
|
|
67
67
|
## Schedule and limits
|
|
68
68
|
|
|
@@ -164,7 +164,10 @@ Four labels are roster's own and are checked on every tracker whatever this list
|
|
|
164
164
|
| `decision` | An ask for the human to rule on. It carries a default and a date; past the date, the staff member acts on the default and closes it. |
|
|
165
165
|
| `review` | An ask for the human to read or approve something. |
|
|
166
166
|
| `chore` | Something only the human can do: a setting, an account, a key. |
|
|
167
|
-
| `keep-open` | A standing thread. A sweep never closes it.
|
|
167
|
+
| `keep-open` | A standing thread. A sweep never closes it. On this week's status issue; taken off last week's so it can be closed. |
|
|
168
|
+
|
|
169
|
+
A fifth, `status`, marks a week's status issue. The session creates it, so doctor does not check
|
|
170
|
+
it. An open one other than this week's is waiting for its summary.
|
|
168
171
|
|
|
169
172
|
Every ask on the human carries exactly one of the first three, which is how the portal sorts
|
|
170
173
|
what needs them. Staff close any issue on their tracker once nothing is left to do on it,
|
package/package.json
CHANGED
|
@@ -45,5 +45,5 @@ Only the additions. `org/guardrails.md` is already binding on everyone.
|
|
|
45
45
|
|
|
46
46
|
## Where the rest of it lives
|
|
47
47
|
|
|
48
|
-
Point at `memory/INDEX.md`, `log/decisions.md`, the pinned status issue, and
|
|
49
|
-
surfaces this role declares in `staff.yaml`.
|
|
48
|
+
Point at `memory/INDEX.md`, `log/decisions.md`, `STATE.md`, the pinned status issue, and
|
|
49
|
+
whatever surfaces this role declares in `staff.yaml`.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Where I am
|
|
2
|
+
|
|
3
|
+
%%NAME%%'s handover between runs. Every daily run reads it first and rewrites it last. What
|
|
4
|
+
people read is the pinned status issue.
|
|
5
|
+
|
|
6
|
+
## Situation
|
|
7
|
+
|
|
8
|
+
Just hired. Nothing done yet.
|
|
9
|
+
|
|
10
|
+
## Next, in order
|
|
11
|
+
|
|
12
|
+
1. Read the charter and the org's priorities, and pick the first piece of work.
|
|
13
|
+
|
|
14
|
+
## Parked
|
|
15
|
+
|
|
16
|
+
Nothing.
|
|
@@ -18,7 +18,7 @@ The grammar, which `roster lint` enforces:
|
|
|
18
18
|
|
|
19
19
|
- **`<slug>`** · [<%%HUMAN_MARKER%%|measured|derived>] <the fact, one line>. **So:** <what it changes>. · [note](notes/<slug>.md)
|
|
20
20
|
|
|
21
|
-
`log/decisions.md` = why things were decided.
|
|
21
|
+
`log/decisions.md` = why things were decided. `STATE.md` = what is outstanding.
|
|
22
22
|
**Nothing is copied between them.**
|
|
23
23
|
|
|
24
24
|
---
|
|
@@ -310,6 +310,18 @@ jobs:
|
|
|
310
310
|
cache: pnpm
|
|
311
311
|
cache-dependency-path: ${{ steps.plan.outputs.package_json }}
|
|
312
312
|
|
|
313
|
+
# A status issue lasts a week. The first daily run of a week opens the new one, pins it and
|
|
314
|
+
# moves staff.yaml on, before the prompt is composed from staff.yaml; the prompt is told
|
|
315
|
+
# which earlier week still needs its summary. `daily` only: a mention is not a session.
|
|
316
|
+
# Never fatal: without it the run writes to last week's issue.
|
|
317
|
+
- name: Open this week's status issue
|
|
318
|
+
id: week
|
|
319
|
+
if: inputs.kind == 'daily'
|
|
320
|
+
continue-on-error: true
|
|
321
|
+
env:
|
|
322
|
+
GH_TOKEN: ${{ steps.private.outputs.token }}
|
|
323
|
+
run: node roster-ops/status-week.mjs --staff "${{ inputs.staff }}" --ops roster-ops --brains . >> "$GITHUB_OUTPUT"
|
|
324
|
+
|
|
313
325
|
# Composed at run time rather than baked in, so editing org/voice.md reaches every staff
|
|
314
326
|
# member on their next run without regenerating anything.
|
|
315
327
|
- name: Compose the prompt
|
|
@@ -320,7 +332,8 @@ jobs:
|
|
|
320
332
|
"comment_id":"${{ inputs.comment_id }}",
|
|
321
333
|
"repo":"${{ github.repository }}",
|
|
322
334
|
"actor":"${{ github.actor }}",
|
|
323
|
-
"trigger":"${{ inputs.trigger }}"
|
|
335
|
+
"trigger":"${{ inputs.trigger }}",
|
|
336
|
+
"previous_status_issue":"${{ steps.week.outputs.previous }}"}
|
|
324
337
|
run: |
|
|
325
338
|
node roster-ops/compose.mjs --staff "${{ inputs.staff }}" --kind "${{ inputs.kind }}" --ops roster-ops --brains . > .roster-prompt.txt
|
|
326
339
|
{
|
|
@@ -16,7 +16,8 @@ bodies, run reports, briefs to other staff, and how you talk to them in a sessio
|
|
|
16
16
|
|
|
17
17
|
- **A comment or reply: 100 words.** Most need three lines.
|
|
18
18
|
- **An issue or PR body: 200 words.**
|
|
19
|
-
- **The
|
|
19
|
+
- **The status issue's body: 200 words**, readable on one phone screen.
|
|
20
|
+
- **A run report: three lines.**
|
|
20
21
|
|
|
21
22
|
Past the ceiling, the detail goes in a file in your brain and the comment links to it in one
|
|
22
23
|
line. A status {{human.name}} has to rewrite before they can use it has cost more than it saved.
|
|
@@ -10,7 +10,14 @@ your brain. Reconstitute yourself, do a day's work, hand off.
|
|
|
10
10
|
|
|
11
11
|
{{#if event.follow_on}}
|
|
12
12
|
**This is a follow-on run.** The last run ended with the next step ready and started this one.
|
|
13
|
-
Boot as usual;
|
|
13
|
+
Boot as usual; `{{staff.dir}}/STATE.md` says what it is.
|
|
14
|
+
{{/if}}
|
|
15
|
+
|
|
16
|
+
{{#if event.previous_status_issue}}
|
|
17
|
+
**A new week.** #{{staff.status_issue}} is this week's status issue, opened for you with last
|
|
18
|
+
week's body. Before you work, close last week's ({{event.previous_status_issue}}) with one comment:
|
|
19
|
+
the week in at most five lines. What moved on each priority, with the numbers; what shipped; what
|
|
20
|
+
is still on {{human.name}}. Then close it. No @-mention: the new issue is what they read.
|
|
14
21
|
{{/if}}
|
|
15
22
|
|
|
16
23
|
## Do this now, in order
|
|
@@ -18,10 +25,10 @@ Boot as usual; #{{staff.status_issue}} says what it is.
|
|
|
18
25
|
1. **Check the real date:** `date +%F`. Do not infer it from a file. A run's output was once dated
|
|
19
26
|
two days wrong that way.
|
|
20
27
|
|
|
21
|
-
2. **Read your
|
|
28
|
+
2. **Read your handover and your tracker.**
|
|
29
|
+
- **`{{staff.dir}}/STATE.md`**: what the last run did and what this one picks up, in order. If
|
|
30
|
+
it is missing or still the template, start it from the body of #{{staff.status_issue}}.
|
|
22
31
|
- `gh issue list --repo {{staff.brain}} --limit 40`
|
|
23
|
-
- Pinned **#{{staff.status_issue}} "Where we are"**: the situation, what the last run did, what
|
|
24
|
-
this one picks up.
|
|
25
32
|
- Then read comments on anything recent. A ruling {{human.name}} answered from a phone arrives
|
|
26
33
|
there and nowhere else, and folding it in comes before planned work because it changes what is
|
|
27
34
|
worth doing.
|
|
@@ -43,7 +50,7 @@ Boot as usual; #{{staff.status_issue}} says what it is.
|
|
|
43
50
|
|
|
44
51
|
## Then work. Autonomously.
|
|
45
52
|
|
|
46
|
-
Take the top item off
|
|
53
|
+
Take the top item off `STATE.md`'s ordered list that serves the org's priorities
|
|
47
54
|
(`org/priorities.md`, where there is one), unless something above changed the priority, in which
|
|
48
55
|
case say so in your report and do the more urgent thing. **Then actually do it.** You are not
|
|
49
56
|
writing a plan for {{human.name}} to approve.
|
|
@@ -61,9 +68,12 @@ writing a plan for {{human.name}} to approve.
|
|
|
61
68
|
Nothing else** - no design essay, no narration of how you built it. It is reviewed on a phone
|
|
62
69
|
and the diff is right there.
|
|
63
70
|
{{/if}}
|
|
64
|
-
2. **Rewrite
|
|
65
|
-
|
|
66
|
-
|
|
71
|
+
2. **Rewrite `{{staff.dir}}/STATE.md`**, your handover to the next run: the situation in a line,
|
|
72
|
+
what the next run picks up in priority order, and anything parked. Commands and notes to
|
|
73
|
+
yourself go here. Rewrite it, do not append, and cut anything the next run can find for itself.
|
|
74
|
+
**Then rewrite the body of #{{staff.status_issue}}**, which is for {{human.name}}, not for you:
|
|
75
|
+
where each priority stands, with the numbers; what is on them, oldest first, by issue number;
|
|
76
|
+
what you do next. Nothing they need to scroll past.
|
|
67
77
|
3. **Reconcile the tracker.** Open issues for anything new needing {{human.name}}: the
|
|
68
78
|
`{{human.marker}}` label plus one of `decision`, `review` or `chore`, assigned to
|
|
69
79
|
`{{human.github}}`. Sweep **every** open issue on your tracker, whoever opened it: close what is
|
|
@@ -89,9 +99,17 @@ writing a plan for {{human.name}} to approve.
|
|
|
89
99
|
7. **Commit and push** `{{staff.dir}}/`. Stage explicit paths in anyone else's repo - never
|
|
90
100
|
`git add -A` there.
|
|
91
101
|
8. **Post the run report** as a comment on #{{staff.status_issue}}, @-mentioning
|
|
92
|
-
`@{{human.github}}`. **
|
|
93
|
-
|
|
94
|
-
|
|
102
|
+
`@{{human.github}}`. **At most three lines:**
|
|
103
|
+
- **The result**, not the activity: what changed for the priority, with the number or link that
|
|
104
|
+
shows it. "Opened a PR" is not a result; what the PR changes for people is.
|
|
105
|
+
- **What is new on them since your last report**: issue numbers and the ask. Not the standing
|
|
106
|
+
list, which is in the body, and not another staff member's asks, which are theirs to report.
|
|
107
|
+
Leave the line out when nothing is new.
|
|
108
|
+
- **What you do next.**
|
|
109
|
+
|
|
110
|
+
No preamble, no closing line, no headers. **When the run moved nothing and nothing new is on
|
|
111
|
+
them, post nothing**: the body is enough, and a report that repeats yesterday's teaches them to
|
|
112
|
+
skip them all.
|
|
95
113
|
9. **Start the next run now, if the next step is ready.** When it serves the priorities and waits on
|
|
96
114
|
nobody (not on {{human.name}}, not on a review, not on a peer), write one line saying what it is:
|
|
97
115
|
`mkdir -p "$GITHUB_WORKSPACE/.roster-run" && echo "<the step>" > "$GITHUB_WORKSPACE/.roster-run/continue"`.
|
|
@@ -12,8 +12,8 @@ so two staff could keep waking each other. Anything you need from someone else g
|
|
|
12
12
|
or in your status issue for your next daily run.
|
|
13
13
|
{{/if}}
|
|
14
14
|
|
|
15
|
-
**This is not a session.** No boot ritual, no handoff, no rewriting
|
|
16
|
-
the question or do the small thing asked, reply, stop.
|
|
15
|
+
**This is not a session.** No boot ritual, no handoff, no rewriting `STATE.md` or
|
|
16
|
+
#{{staff.status_issue}}. Answer the question or do the small thing asked, reply, stop.
|
|
17
17
|
|
|
18
18
|
{{> prompts/_paths.md}}
|
|
19
19
|
|
|
@@ -55,6 +55,9 @@ An issue opened this way often carries a pull request somewhere else, and says w
|
|
|
55
55
|
- **Do only what was asked.** Fixing something else you noticed on the way makes the change
|
|
56
56
|
unreviewable and costs a second review. If you spot something real and separate, say so in your
|
|
57
57
|
reply and leave it alone.
|
|
58
|
+
- **Asked for a report?** Read `{{staff.dir}}/STATE.md`, the body of #{{staff.status_issue}} and
|
|
59
|
+
your open issues, then reply in at most three lines: where your priorities stand, with the
|
|
60
|
+
numbers; what is on {{human.name}}, by issue number; what you do next. Change nothing.
|
|
58
61
|
- **Only touch `memory/INDEX.md` if a durable fact or watch-out changed**, and then it is one line
|
|
59
62
|
saying what it changes. Commit and push it.
|
|
60
63
|
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Opens this week's status issue, before the prompt is composed, when the one in staff.yaml is
|
|
3
|
+
// from an earlier week.
|
|
4
|
+
//
|
|
5
|
+
// Written because one status issue that lasts forever turns into a diary. Pip's ran from August
|
|
6
|
+
// to October as forty-odd run reports in one thread, and the human stopped reading it. A week
|
|
7
|
+
// per issue keeps a thread short, and the closed ones read back as the history, a week at a time.
|
|
8
|
+
//
|
|
9
|
+
// The housekeeping is here rather than in the prompt because it has to happen every week, the
|
|
10
|
+
// same way, whatever the agent does: open the issue, pin it, carry last week's body across, and
|
|
11
|
+
// move staff.yaml on, so every reader of `status_issue` (the prompts, the portal, doctor, the
|
|
12
|
+
// failure notice) follows without knowing weeks exist. What only the agent can write, the week's
|
|
13
|
+
// summary on the old issue, is left to it: the old issue loses `keep-open` and its pin, and the
|
|
14
|
+
// prompt is told its number.
|
|
15
|
+
//
|
|
16
|
+
// Vendored alongside compose.mjs for the same reason: it runs on the runner and must not depend
|
|
17
|
+
// on npm. It asks GitHub through `gh`. It never fails a run: if anything here goes wrong, the run
|
|
18
|
+
// carries on with last week's issue, which is how every run went before this existed.
|
|
19
|
+
//
|
|
20
|
+
// Usage: node roster-ops/status-week.mjs --staff cto --ops roster-ops --brains .
|
|
21
|
+
// Prints `previous=#15` for $GITHUB_OUTPUT when a week's issue is waiting for its summary.
|
|
22
|
+
|
|
23
|
+
import { execFileSync } from "node:child_process";
|
|
24
|
+
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
25
|
+
import { join, resolve } from "node:path";
|
|
26
|
+
import { fileURLToPath } from "node:url";
|
|
27
|
+
import { parseYaml } from "./compose.mjs";
|
|
28
|
+
|
|
29
|
+
export const STATUS_LABEL = "status";
|
|
30
|
+
const MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
31
|
+
|
|
32
|
+
/** Monday 00:00 UTC of the week `now` falls in. */
|
|
33
|
+
export function weekStart(now) {
|
|
34
|
+
const d = new Date(now);
|
|
35
|
+
const back = (d.getUTCDay() + 6) % 7;
|
|
36
|
+
return new Date(Date.UTC(d.getUTCFullYear(), d.getUTCMonth(), d.getUTCDate() - back));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function weekTitle(now) {
|
|
40
|
+
const m = weekStart(now);
|
|
41
|
+
return `📍 Where we are: week of ${m.getUTCDate()} ${MONTHS[m.getUTCMonth()]}`;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Whether `issue` is this week's, and still the one to write to. */
|
|
45
|
+
export function isCurrent(issue, now) {
|
|
46
|
+
return Boolean(issue) && issue.state === "open" && new Date(issue.created_at) >= weekStart(now);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** staff.yaml with `status_issue:` moved to `n`, keeping everything else byte for byte. */
|
|
50
|
+
export function withStatusIssue(yaml, n) {
|
|
51
|
+
if (/^status_issue:.*$/m.test(yaml)) return yaml.replace(/^status_issue:.*$/m, `status_issue: ${n}`);
|
|
52
|
+
return yaml.replace(/^(brain:.*\n)/m, `$1status_issue: ${n}\n`);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const FIRST_BODY = "Nothing yet. The first run of the week rewrites this.";
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Works out the week and does the GitHub half of it. Returns the issue to write to and the
|
|
59
|
+
* earlier ones still waiting for a summary. `gh` takes argv and returns stdout, so a test
|
|
60
|
+
* drives it without the network.
|
|
61
|
+
*/
|
|
62
|
+
export function rollWeek({ repo, current, gh, now = Date.now() }) {
|
|
63
|
+
const issue = current ? JSON.parse(gh(["api", `repos/${repo}/issues/${current}`])) : null;
|
|
64
|
+
|
|
65
|
+
// Created on every run because it costs one call and an org that upgraded never had it.
|
|
66
|
+
try {
|
|
67
|
+
gh(["label", "create", STATUS_LABEL, "--repo", repo, "--color", "0e8a16",
|
|
68
|
+
"--description", "A week's status issue"]);
|
|
69
|
+
} catch {
|
|
70
|
+
// Already there, which is the usual answer.
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
let next = current;
|
|
74
|
+
let rolled = false;
|
|
75
|
+
if (!isCurrent(issue, now)) {
|
|
76
|
+
const opened = JSON.parse(
|
|
77
|
+
gh([
|
|
78
|
+
"api", `repos/${repo}/issues`, "-X", "POST",
|
|
79
|
+
"-f", `title=${weekTitle(now)}`,
|
|
80
|
+
"-f", `body=${issue?.state === "open" && issue.body?.trim() ? issue.body : FIRST_BODY}`,
|
|
81
|
+
"-f", `labels[]=${STATUS_LABEL}`,
|
|
82
|
+
"-f", "labels[]=keep-open",
|
|
83
|
+
]),
|
|
84
|
+
);
|
|
85
|
+
next = opened.number;
|
|
86
|
+
rolled = true;
|
|
87
|
+
|
|
88
|
+
// Three issues can be pinned, so the old one comes off first.
|
|
89
|
+
if (issue?.state === "open") {
|
|
90
|
+
quietly(() => gh(["api", "graphql", "-f", "query=mutation($id:ID!){unpinIssue(input:{issueId:$id}){issue{number}}}", "-f", `id=${issue.node_id}`]));
|
|
91
|
+
// Without keep-open the agent may close it, which is what the summary ends with. The
|
|
92
|
+
// label marks it as a week's issue for the sweep below, should that run not finish.
|
|
93
|
+
quietly(() => gh(["api", `repos/${repo}/issues/${current}/labels/keep-open`, "-X", "DELETE"]));
|
|
94
|
+
quietly(() => gh(["api", `repos/${repo}/issues/${current}/labels`, "-X", "POST", "-f", `labels[]=${STATUS_LABEL}`]));
|
|
95
|
+
}
|
|
96
|
+
quietly(() => gh(["api", "graphql", "-f", "query=mutation($id:ID!){pinIssue(input:{issueId:$id}){issue{number}}}", "-f", `id=${opened.node_id}`]));
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Every earlier week still open: last week's, and any week whose summary run did not finish.
|
|
100
|
+
const open = JSON.parse(
|
|
101
|
+
gh(["api", `repos/${repo}/issues?state=open&labels=${STATUS_LABEL}&per_page=20`]) || "[]",
|
|
102
|
+
);
|
|
103
|
+
const previous = open
|
|
104
|
+
.filter((i) => !i.pull_request && i.number !== next)
|
|
105
|
+
.map((i) => i.number)
|
|
106
|
+
.sort((a, b) => a - b);
|
|
107
|
+
return { current: next, rolled, previous };
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function quietly(fn) {
|
|
111
|
+
try {
|
|
112
|
+
fn();
|
|
113
|
+
} catch (err) {
|
|
114
|
+
console.error(`::warning::status-week: ${String(err.message).split("\n")[0]}`);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/** Commits staff.yaml's new number, retrying the push over anything another run pushed. */
|
|
119
|
+
function commit(brainDir, n) {
|
|
120
|
+
const git = (...a) => execFileSync("git", ["-C", brainDir, ...a], { stdio: ["ignore", "pipe", "pipe"] });
|
|
121
|
+
git("add", "staff.yaml");
|
|
122
|
+
git("commit", "-m", `roster: this week's status issue is #${n}`);
|
|
123
|
+
for (let i = 0; ; i++) {
|
|
124
|
+
try {
|
|
125
|
+
git("push");
|
|
126
|
+
return;
|
|
127
|
+
} catch (err) {
|
|
128
|
+
if (i === 2) throw err;
|
|
129
|
+
git("pull", "--rebase");
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function main(argv) {
|
|
135
|
+
const args = {};
|
|
136
|
+
for (let i = 0; i < argv.length; i += 2) args[argv[i].replace(/^--/, "")] = argv[i + 1];
|
|
137
|
+
if (!args.staff) throw new Error("--staff is required");
|
|
138
|
+
const opsDir = resolve(args.ops ?? ".");
|
|
139
|
+
const org = parseYaml(readFileSync(join(opsDir, "org.yaml"), "utf8"), "org.yaml");
|
|
140
|
+
const entry = (org.staff ?? []).find((s) => s.handle === args.staff);
|
|
141
|
+
if (!entry) throw new Error(`org.yaml has no staff member "${args.staff}"`);
|
|
142
|
+
const brainDir = join(resolve(args.brains ?? ".."), entry.dir ?? entry.handle);
|
|
143
|
+
const file = join(brainDir, "staff.yaml");
|
|
144
|
+
if (!existsSync(file)) throw new Error(`no staff.yaml at ${file}`);
|
|
145
|
+
const yaml = readFileSync(file, "utf8");
|
|
146
|
+
const manifest = parseYaml(yaml, "staff.yaml");
|
|
147
|
+
const repo = String(manifest.brain ?? `${org.org}/${entry.dir ?? entry.handle}`);
|
|
148
|
+
|
|
149
|
+
const gh = (a) => execFileSync("gh", a, { encoding: "utf8", maxBuffer: 16 * 1024 * 1024 });
|
|
150
|
+
const week = rollWeek({ repo, current: Number(manifest.status_issue) || 0, gh });
|
|
151
|
+
if (week.rolled) {
|
|
152
|
+
writeFileSync(file, withStatusIssue(yaml, week.current));
|
|
153
|
+
commit(brainDir, week.current);
|
|
154
|
+
console.error(`opened #${week.current} for this week`);
|
|
155
|
+
}
|
|
156
|
+
if (week.previous.length) {
|
|
157
|
+
process.stdout.write(`previous=${week.previous.map((n) => `#${n}`).join(", ")}\n`);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (process.argv[1] && resolve(process.argv[1]) === resolve(fileURLToPath(import.meta.url))) {
|
|
162
|
+
try {
|
|
163
|
+
main(process.argv.slice(2));
|
|
164
|
+
} catch (err) {
|
|
165
|
+
console.error(`::warning::status-week: ${err.message}`);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
@@ -88,6 +88,8 @@
|
|
|
88
88
|
.homereport:focus-visible{outline:2px solid var(--accent);outline-offset:0}
|
|
89
89
|
.homereportwho{display:flex;flex-direction:column;gap:2px;min-width:0}
|
|
90
90
|
.homereportwho .meta{padding-left:21px}
|
|
91
|
+
.homereportask{display:flex;flex-wrap:wrap;align-items:center;gap:6px;padding-left:21px;margin-top:6px}
|
|
92
|
+
.homereportask .meta{padding-left:0}
|
|
91
93
|
.homereportbody p{margin:0 0 4px;color:var(--ink-dim);font-size:13px;line-height:1.5}
|
|
92
94
|
.homereportbody p:first-child{color:var(--ink)}
|
|
93
95
|
.homereportbody a{color:var(--accent)}
|
|
@@ -55,35 +55,10 @@ export function viewHome(m) {
|
|
|
55
55
|
const page = el("div", { className: "home" });
|
|
56
56
|
page.append(askBox(staff));
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
const reporters = staff.filter((x) => x.brain && x.statusIssue);
|
|
59
|
+
if (reporters.length) {
|
|
59
60
|
page.append(section("Latest reports"));
|
|
60
|
-
|
|
61
|
-
for (const r of h.reports) {
|
|
62
|
-
/* The report is markdown the staff member wrote, with links to the work it names. The
|
|
63
|
-
whole report opens their status issue, where it was posted; a link inside it goes
|
|
64
|
-
where it points. */
|
|
65
|
-
const row = el("div", { className: "homereport homeclick", tabIndex: 0, role: "button" }, [
|
|
66
|
-
el("div", { className: "homereportwho" }, [
|
|
67
|
-
el("span", { className: "homewho2" }, [icon(staffIcon(r.staff), "ic"), el("b", { textContent: r.staff.name })]),
|
|
68
|
-
el("span", { className: "meta", textContent: ago(r.at) }),
|
|
69
|
-
]),
|
|
70
|
-
el("div", {
|
|
71
|
-
className: "md homereportbody",
|
|
72
|
-
innerHTML: mdlite(r.lines.join("\n\n"), { repo: r.staff.brain }),
|
|
73
|
-
}),
|
|
74
|
-
]);
|
|
75
|
-
row.onclick = (ev) => {
|
|
76
|
-
if (!ev.target.closest("a, button")) openThread(r.item);
|
|
77
|
-
};
|
|
78
|
-
row.onkeydown = (ev) => {
|
|
79
|
-
if (ev.target === row && (ev.key === "Enter" || ev.key === " ")) {
|
|
80
|
-
ev.preventDefault();
|
|
81
|
-
openThread(r.item);
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
box.append(row);
|
|
85
|
-
}
|
|
86
|
-
page.append(box);
|
|
61
|
+
page.append(el("div", { className: "card homereports" }, reporters.map((s) => reportRow(s, h.reports))));
|
|
87
62
|
}
|
|
88
63
|
|
|
89
64
|
page.append(section("Needs you", h.needs.length));
|
|
@@ -116,6 +91,61 @@ export function viewHome(m) {
|
|
|
116
91
|
m.append(page);
|
|
117
92
|
}
|
|
118
93
|
|
|
94
|
+
/* ------------------------------- reports -------------------------------- */
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* One staff member's last report, or a line saying there is none today, with a button that asks
|
|
98
|
+
* for one. The report is markdown the staff member wrote, with links to the work it names. The
|
|
99
|
+
* whole row opens their status issue, where it was posted; a link inside it goes where it points.
|
|
100
|
+
*/
|
|
101
|
+
function reportRow(s, reports) {
|
|
102
|
+
const r = reports.find((x) => x.staff.handle === s.handle);
|
|
103
|
+
const item = r?.item ?? { repo: s.brain, number: s.statusIssue, kind: "issue" };
|
|
104
|
+
const note = el("span", { className: "meta" });
|
|
105
|
+
const ask = el("button", { className: "ghbtn", textContent: "Ask for a report" });
|
|
106
|
+
ask.onclick = async () => {
|
|
107
|
+
ask.disabled = true;
|
|
108
|
+
note.className = "meta";
|
|
109
|
+
note.textContent = "Asking…";
|
|
110
|
+
try {
|
|
111
|
+
await post({
|
|
112
|
+
action: "comment",
|
|
113
|
+
repo: s.brain,
|
|
114
|
+
number: s.statusIssue,
|
|
115
|
+
body: `${s.mention ?? "@" + s.handle} Report, please.`,
|
|
116
|
+
});
|
|
117
|
+
ask.remove();
|
|
118
|
+
note.textContent = `Asked. ${s.name} replies in a few minutes.`;
|
|
119
|
+
refreshSoon();
|
|
120
|
+
} catch (e) {
|
|
121
|
+
note.textContent = String(e.message || e);
|
|
122
|
+
note.className = "meta err";
|
|
123
|
+
ask.disabled = false;
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
const row = el("div", { className: "homereport homeclick", tabIndex: 0, role: "button" }, [
|
|
128
|
+
el("div", { className: "homereportwho" }, [
|
|
129
|
+
el("span", { className: "homewho2" }, [icon(staffIcon(s), "ic"), el("b", { textContent: s.name })]),
|
|
130
|
+
el("span", { className: "meta", textContent: r ? ago(r.at) : "No report today" }),
|
|
131
|
+
el("div", { className: "homereportask" }, [ask, note]),
|
|
132
|
+
]),
|
|
133
|
+
r
|
|
134
|
+
? el("div", { className: "md homereportbody", innerHTML: mdlite(r.lines.join("\n\n"), { repo: s.brain }) })
|
|
135
|
+
: el("div"),
|
|
136
|
+
]);
|
|
137
|
+
row.onclick = (ev) => {
|
|
138
|
+
if (!ev.target.closest("a, button")) openThread(item);
|
|
139
|
+
};
|
|
140
|
+
row.onkeydown = (ev) => {
|
|
141
|
+
if (ev.target === row && (ev.key === "Enter" || ev.key === " ")) {
|
|
142
|
+
ev.preventDefault();
|
|
143
|
+
openThread(item);
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
return row;
|
|
147
|
+
}
|
|
148
|
+
|
|
119
149
|
/* ------------------------------- asking -------------------------------- */
|
|
120
150
|
|
|
121
151
|
function askBox(staff) {
|