eve-hub 0.16.113 → 0.16.115
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/hub/functions/.well-known/workflow/v1/flow.func/hub/hub.mjs +4 -4
- package/hub/functions/api/index.func/api/index.mjs +4 -4
- package/onboarding/SKILL.md +72 -30
- package/onboarding/check-report.mjs +105 -16
- package/onboarding/files.gen.mjs +1 -1
- package/onboarding/lead-posts.callscript.js +1 -1
- package/onboarding/slack-facts.callscript.js +1 -1
- package/onboarding/team-channel.callscript.js +1 -1
- package/package.json +1 -1
- package/skills/onboarding-profile.gen.mjs +1 -1
package/onboarding/SKILL.md
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: onboarding-profile
|
|
3
|
-
description: "Right after sign-in: ask for the Kit access you need, fan out over their Slack, Notion, GitHub and LLM usage, then write a short cited read of how they work, propose the bot team that fits them for them to pick from, and draft schedules that keep them on track. Reads only;
|
|
3
|
+
description: "Right after sign-in: ask for the Kit access you need, fan out over their Slack, Notion, GitHub and LLM usage, then write a short cited read of how they work, propose the bot team that fits them for them to pick from, and draft schedules that keep them on track. Reads only; its writes are a pull request the user approves by merging and any bot they tap in the team pick, which it creates."
|
|
4
4
|
license: MIT
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Profile the user from Slack, Notion, GitHub and their LLM usage
|
|
8
8
|
|
|
9
|
-
The profile is built from many small reads run at the same time, not one pass. You gather the raw facts (step 1), split them into slices that each read one source or one piece of a source (steps 2 and 3, wave 1), merge the slices into three areas (step 4, wave 2), and
|
|
9
|
+
The profile is built from many small reads run at the same time, not one pass. You gather the raw facts (step 1), split them into slices that each read one source or one piece of a source (steps 2 and 3, wave 1), merge the slices into three areas (step 4, wave 2), draft each area's part of the facts appendix as soon as that area is checked (step 4), and turn the areas into a read of the user in three passes: a read pass, a critique pass and a write pass (step 5). Every claim cites a URL or `fact:` reference that is in the facts, and everything you could not read is said, never guessed.
|
|
10
10
|
|
|
11
11
|
The result is two files. `read.md` is about one page on how the user works and the team that fits them. `facts.md` is the appendix it cites: the ten questions below, answered from the facts, with facts from a record kept apart from guesses (5c).
|
|
12
12
|
|
|
13
|
-
Nothing is posted to Slack and nothing is committed by the run itself; its own writes are the pull request in step 6 (the schedule drafts and the first `memory/human.md`), which the user approves by merging,
|
|
13
|
+
Nothing is posted to Slack and nothing is committed by the run itself; its own writes are the pull request in step 6 (the schedule drafts and the first `memory/human.md`), which the user approves by merging, a wake-up in this thread for any need that runs once (step 5c), a bot the user taps in the team `ask`, which `create_agent` commits to the workspace repo (step 7), and the work the user starts with a tap on an offer (below) pushes its branch from that tap and merges only on their "Merge it" tap in its thread. The user sees three messages: the first one within 30 seconds, which greets them and offers up to three pieces of work to start with one tap; one about ten minutes in, with up to three findings and one `ask` to confirm what the facts say they would hand off; and one about seventeen minutes in, with the read, their team and the schedules, ending in one `ask` to pick team changes, including new bots one tap creates and, when `memory/human.md` has guesses, one last `ask` to confirm them (step 7). They also get one message with every Kit approve link if access is pending (step 1), and your answers to anything they ask. The step 0 message to the Mac bot is a handoff to that bot, not a message for the user. Between the messages the thread's timeline fills in with notes ("Write the timeline as you go", below). If a step cannot finish, the final message says which and what the user must do; never write the read as if every source had been read.
|
|
14
14
|
|
|
15
15
|
The whole run is capped at 35 minutes. Every directory below is under `/tmp/onboarding-skill/`.
|
|
16
16
|
|
|
@@ -65,7 +65,7 @@ You do only what a subagent can't or shouldn't:
|
|
|
65
65
|
|
|
66
66
|
### Post to the user while the subagents read
|
|
67
67
|
|
|
68
|
-
The read
|
|
68
|
+
The read and its write take about seventeen minutes, so the user gets something to act on first. Before step 7 you post only these: the first message with its offers (step 1), the one line that links a tapped offer's thread ("When the user taps an offer"), the access post of step 1 if access is pending, the findings and the handoff `ask` as one message ("Post the findings and confirm what they would hand off", below), and your answers to anything they ask.
|
|
69
69
|
|
|
70
70
|
A post for the user @-mentions their handle from `<team_status>` (the human line, for example `me: alex`), never `@all`: `@all` also wakes every bot in the welcome thread. A bot handoff mentions only that bot. The checker fails `@all` in `first.md`, a finding and the step 7 post; the handoff message is not checked, so keep it free of `@all` too.
|
|
71
71
|
|
|
@@ -94,7 +94,7 @@ The message is one greeting line, the only greeting the run sends, then one bubb
|
|
|
94
94
|
- `label` is at most 40 characters and names the outcome, for example "Fix the failing check on acme/api#412".
|
|
95
95
|
- `line` is at most 160 characters of plain text, with no link: the fact behind the offer, such as a count, a state, a date or a branch, for example "Approved 3 days ago, but 1 of 6 checks fails and the branch conflicts".
|
|
96
96
|
- `id` is a short lowercase slug, and each id is used once.
|
|
97
|
-
- Offer only what the files hold. With only one candidate, or none, post no `ask`: the bubble says the full read lands in about
|
|
97
|
+
- Offer only what the files hold. With only one candidate, or none, post no `ask`: the bubble says the full read lands in about seventeen minutes and names no offer. Never invent a second offer to reach three.
|
|
98
98
|
|
|
99
99
|
Hard rules, which hold whatever the goal:
|
|
100
100
|
|
|
@@ -140,7 +140,7 @@ When you wait, use `eve__task_wait`: it returns on a task result or on a new mes
|
|
|
140
140
|
|
|
141
141
|
### Log when each step ends
|
|
142
142
|
|
|
143
|
-
The run's length is judged against the time each step took, so log it. `onboarding_scripts` starts a fresh `/tmp/onboarding-skill/`, so right after it returns, run `echo "start $(date -u +%T)" > /tmp/onboarding-skill/phases.log`. When each of these ends, append one line the same way: `quick` (`gh onboarding-facts --quick` returned), `first` (the first message posted), `offer` (the same moment, written only when that message holds an `ask`), `tap` (the user tapped an offer), `ready` and `merged` (from the task's thread, as "When the user taps an offer" says), `facts` (the full `gh onboarding-facts` returned), `slices` (every wave 1 report is written and checked), `areas` (every wave 2 area is checked), `ask` (the findings and handoff message posted; leave it out if it never posts), `read` (5a returned), `critique` (5b returned), `write` (5c's checker prints nothing), `pr` (step 6
|
|
143
|
+
The run's length is judged against the time each step took, so log it. `onboarding_scripts` starts a fresh `/tmp/onboarding-skill/`, so right after it returns, run `echo "start $(date -u +%T)" > /tmp/onboarding-skill/phases.log`. When each of these ends, append one line the same way: `quick` (`gh onboarding-facts --quick` returned), `first` (the first message posted), `offer` (the same moment, written only when that message holds an `ask`), `tap` (the user tapped an offer), `ready` and `merged` (from the task's thread, as "When the user taps an offer" says), `facts` (the full `gh onboarding-facts` returned), `slices` (every wave 1 report is written and checked), `areas` (every wave 2 area is checked), `ask` (the findings and handoff message posted; leave it out if it never posts), `read` (5a returned), `critique` (5b returned), `write` (5c's checker prints nothing), `facts-role`, `facts-work`, `facts-more` and `facts-llm` (each facts part's apply returned: step 4), `pr` (step 6 opened the PR, which is not waiting on its checks: the PR URL and `open`, or `pr none` when the workspace has no repo), `post` (step 7 posted), `checks` (after `post`, optional: the PR's checks finished, as `checks pass` or `checks fail`). Step 7 never posts before the `pr` line is written. After step 7 posts, run `node check-report.mjs --phases phases.log`: it prints any step that is missing, repeated or out of order. Keep `phases.log` with `read.md`.
|
|
144
144
|
|
|
145
145
|
## 0. Hand the Mac half to the bot on the Mac
|
|
146
146
|
|
|
@@ -150,7 +150,7 @@ Its recent-sessions post links one file, `sessions-facts.mjs --days 7`: the work
|
|
|
150
150
|
|
|
151
151
|
Its LLM-usage post links one facts file per coding agent, written by `agent-usage-facts.mjs --usage-only`: names and counts, with no web permalinks. When it arrives, fetch each linked file with `fetch_upload` into `/tmp/onboarding-skill/facts/local/usage-<source>.json` (`claude-code`, `codex`, `opencode`, `cursor`). These files, not the post's table, are what the profile cites, with `fact:` references (step 5).
|
|
152
152
|
|
|
153
|
-
If the files arrive after the `llm` synthesizer of step 4 has started, its area did not read them. Fetch them into `facts/local/`, start one `agent` copy as the `llm` synthesizer on them alone, and check its `areas/llm-local.md` with `node check-report.mjs --profile areas/llm-local.md --facts facts`. Then hand `areas/llm-local.md` on as "Evidence that arrives late" (step 5) says.
|
|
153
|
+
If the files arrive after the `llm` synthesizer of step 4 has started, its area did not read them. Fetch them into `facts/local/`, start one `agent` copy as the `llm` synthesizer on them alone, and check its `areas/llm-local.md` with `node check-report.mjs --profile areas/llm-local.md --facts facts`. Then run the `llm` facts part again on it (step 4, "Late `areas/llm-local.md`"), and hand `areas/llm-local.md` on as "Evidence that arrives late" (step 5) says.
|
|
154
154
|
|
|
155
155
|
With no bot that runs `local`, skip this step and say nothing about a Mac; question 9 then rests on GitHub's agent-assisted share alone, and "Could not tell" says the Mac's agent logs were not read.
|
|
156
156
|
|
|
@@ -196,7 +196,7 @@ From the files of step 1, pick the slices. A slice with no data isn't started, s
|
|
|
196
196
|
|
|
197
197
|
## 3. Wave 1: one slice per source, all at once
|
|
198
198
|
|
|
199
|
-
Start every slice in one step, then wait; the leadership slice is already running from step 1. Each slice reads only its own inputs and writes `slices/<name>.md`: its findings as list items, each citing a URL from its facts, and a `## Could not tell` section. A slice cites the URL itself, copied whole from its facts, query string included (a Slack reply permalink keeps its `?thread_ts=…`, or the checker can't find it); the write pass (5c) turns each one into a labeled link in the final files. A fact with a URL cites the URL. A count or total with no URL of its own (the calendar's weekday, hour and weekly counts, Slack's `own.total`, a repo's `activeDays`) cites the value itself as `fact:github/<file>#<JSON pointer>`
|
|
199
|
+
Start every slice in one step, then wait; the leadership slice is already running from step 1. Each slice reads only its own inputs and writes `slices/<name>.md`: its findings as list items, each citing a URL from its facts, and a `## Could not tell` section. A slice cites the URL itself, copied whole from its facts, query string included (a Slack reply permalink keeps its `?thread_ts=…`, or the checker can't find it); the write pass (5c) turns each one into a labeled link in the final files. A fact with a URL cites the URL. A count or total with no URL of its own (the calendar's weekday, hour and weekly counts, Slack's `own.total`, a repo's `activeDays`) cites the value itself as `fact:github/<file>#<JSON pointer>` `fact:slack/base.json#<JSON pointer>` or, for a count in a Kit slice's file (a channel's message, thread and poster totals), `fact:kit/<slice>.json#<JSON pointer>`, for example `fact:github/calendar.json#/weekly/0`, never an unrelated URL such as the profile it sits beside. Any other `fact:` path but `fact:local/` and `fact:interview/` fails the checker. Tell each slice the user's login, Slack name, time zone and the window, the exact file paths it reads, the path it writes, and this format.
|
|
200
200
|
|
|
201
201
|
| Area | Slice | Count | Reads | Runs as |
|
|
202
202
|
|---|---|---|---|---|
|
|
@@ -242,62 +242,84 @@ Start three `agent` copies in one step. Each reads its area's slice files and wr
|
|
|
242
242
|
- `work`: the work slices and `facts/github/base.json`. Answers questions 6 to 8, plus what they shipped and own, review requests, and which open PRs to close (stale, conflicted, superseded) or focus on.
|
|
243
243
|
- `llm`: the LLM slices, and `facts/local/` if the Mac bot's files have arrived. Answers questions 9 and 10. A claim from a local file cites the value it rests on as `fact:local/usage-<source>.json#<JSON pointer>`, for example `fact:local/usage-codex.json#/usage/codex/models/0`; the times are in the file's `timeZone`.
|
|
244
244
|
|
|
245
|
+
Check each area the moment its synthesizer returns, and have it fixed once if it has problems:
|
|
246
|
+
|
|
245
247
|
```sh
|
|
246
|
-
cd /tmp/onboarding-skill && node check-report.mjs --profile areas
|
|
248
|
+
cd /tmp/onboarding-skill && node check-report.mjs --profile areas/<area>.md --facts facts
|
|
247
249
|
```
|
|
248
250
|
|
|
251
|
+
### Draft each area's part of `facts.md` as soon as the area passes
|
|
252
|
+
|
|
253
|
+
The facts appendix is written in four parts (`role`, `work`, `more` and `llm`), while the other areas and the read are still running, so the read never waits behind it. In the same step as the checker run that passes an area, start an `agent` copy, `facts-<part>`, with 6 turns, cancelled at 10 minutes; the `work` area starts two, `facts-work` and `facts-more`, so the longest area's appendix is drafted by two copies at once. Give it the area file, `facts/` and the "shape of `facts.md`" bullets of 5c word for word. It writes `facts-<part>-draft.md`: that part's questions in that shape, with every sentence and table row citing the fact it rests on.
|
|
254
|
+
|
|
255
|
+
- `role`: questions 1 to 5.
|
|
256
|
+
- `work`: questions 6 to 8.
|
|
257
|
+
- `more`: the four more, from the `work` area file.
|
|
258
|
+
- `llm`: questions 9 and 10.
|
|
259
|
+
|
|
260
|
+
Each part holds its topic sections (headings, charts and cited lines), then its own `## From a record` and `## Guesses, and what each rests on` tables, with no `figures` block and no `## Could not tell`: 5c writes those once for the whole file.
|
|
261
|
+
|
|
262
|
+
When `facts-<part>` returns, start a fresh `critique-<part>` copy (6 turns): it answers the facts questions of 5b for `facts-<part>-draft.md` alone, and writes its own `critique-<part>.md`. When it returns, continue `facts-<part>` by its `taskId` with the path of `critique-<part>.md`: it applies it once and writes `facts-<part>.md`. Run `node check-report.mjs --profile facts-<part>.md --facts facts`, have it fixed until it prints nothing, then append `facts-<part>` to `phases.log`. These copies never block the read pass.
|
|
263
|
+
|
|
264
|
+
Late `areas/llm-local.md` runs only the `llm` part again: the same copies in the same order, with that file beside `areas/llm.md`.
|
|
265
|
+
|
|
249
266
|
## 5. Turn the areas into the read, in three passes
|
|
250
267
|
|
|
251
|
-
Three passes, one after another. Each runs as an `agent` copy that never calls `git__gh` and never posts. The critique is a fresh copy, so it sees only the draft and the files, not the reasoning that wrote the draft.
|
|
268
|
+
Three passes on the read, one after another. Each runs as an `agent` copy that never calls `git__gh` and never posts. The critique is a fresh copy, so it sees only the draft and the files, not the reasoning that wrote the draft. The facts appendix is not one of the passes: its four parts are drafted, critiqued and applied in step 4, and 5c only joins them.
|
|
252
269
|
|
|
253
270
|
### 5a. Read pass
|
|
254
271
|
|
|
255
|
-
Start one `agent` copy, `read`, with 6 turns, and cancel it at 10 minutes. Keep its `taskId`: steps 5c and late answers continue it. Give it:
|
|
272
|
+
Start one `agent` copy, `read`, with 6 turns, and cancel it at 10 minutes. Keep its `taskId`: steps 5c and late answers continue it. Start it the moment the last area passes, in the same step as the findings and handoff post when that post is due, not after it: write the roster and standing-decisions files it needs while the areas are still running, so nothing sits between the last area and this start. Give it:
|
|
256
273
|
|
|
257
274
|
- the paths of the three area files, `facts/interview.md` (it may not exist yet), `facts/local/` and `facts/`;
|
|
258
275
|
- the current roster: your `list_agents` output, pasted in, with each bot's `name`, `role`, `kind`, `model`, `runsOn` and subagents;
|
|
259
276
|
- the standing decisions in effect, pasted in;
|
|
260
277
|
- the "`read.md` is the core read" section above, word for word, and the rules below.
|
|
261
278
|
|
|
262
|
-
It writes
|
|
279
|
+
It writes `read-draft.md`, with the five sections of `read.md`, and returns its path. It writes no facts file: the facts parts exist already or are being written beside it (step 4). Tell it to load the forms skill for the table syntax.
|
|
263
280
|
|
|
264
281
|
- Every trait cites at least two different sources. Every row of `## Your team` names the trait behind it and the setting it changes: an agent entry in `hub.workspace.json` (`name`, `role`, `kind`, `model`, `runsOn`, `subagents`), a schedule, a standing decision, or a sandbox `prepare` step from the Mac half.
|
|
265
|
-
- It proposes at most four changes, because the user picks them from one `ask` (step 7).
|
|
282
|
+
- It proposes at most four changes, added bots included, because the user picks them from one `ask` (step 7).
|
|
283
|
+
- For each need in the facts that no current bot covers (work the user does by hand that a bot on the roster does not own, a role the roster has no one for), it considers adding a bot: either a `create_agent` `starter` (`planner`, `builder`, `reviewer` or `mac`) that is not already on the roster, or a named bot with a `name` not on the roster, a `role`, a `model`, `runsOn`, `instructions` and `preset` (`builder` or `read-only`; no `domains` unless the workspace has that memory folder). It judges whether the need is real; no rule forces a count, and when no need goes uncovered, `## Your team` says in one sentence why no bot fits. An added bot's row names its trait and the `create_agent` input as a `json` block under the table, headed by the bot's name.
|
|
266
284
|
- When the user tapped an offer, `## Act on first` links its thread (give it the link) as its first item, with what the task is waiting on. With no tap, the three items all come from the facts.
|
|
267
285
|
- It proposes only what the kit can create today. A bot that would need a new tool or a new kind of integration is a "Would need" line under the table, not a row.
|
|
268
286
|
- Judge; the scripts only counted. No scoring formula and no thresholds from code: say why in a sentence.
|
|
269
287
|
|
|
270
288
|
### 5b. Critique pass
|
|
271
289
|
|
|
272
|
-
Start one more `agent` copy, `critique`, with 6 turns. Give it the paths of `read-draft.md`,
|
|
290
|
+
Start one more `agent` copy, `critique`, with 6 turns. Give it the paths of `read-draft.md`, the three area files, `facts/interview.md` and the `facts/` directory. For each trait and each `## Your team` row of `read-draft.md` it answers:
|
|
273
291
|
|
|
274
292
|
- Would this be true of most engineers on the user's team? If so, it is generic: cut it, or say what sharper claim the facts support.
|
|
275
293
|
- Do the two cited sources each support it, or does one only repeat the other?
|
|
276
294
|
- Does an area's `## Conflicts` section contradict it?
|
|
277
|
-
- Does the team change follow from the trait, or would the same roster be proposed for anyone?
|
|
295
|
+
- Does the team change follow from the trait, or would the same roster be proposed for anyone? A bot that is added follows from a need the facts show no current bot covers, and its `create_agent` input names a bot not already on the roster.
|
|
296
|
+
|
|
297
|
+
It writes one line per item to `/tmp/onboarding-skill/critique.md` itself: `keep`, `cut` or `rewrite`, the item's heading or row, and one line on why. It returns only the line count. You never retype its judgment, so a reviewer can check each cut against the draft. The model makes the judgment; no score, threshold or checker rule decides it.
|
|
278
298
|
|
|
279
|
-
|
|
299
|
+
#### The facts critique
|
|
300
|
+
|
|
301
|
+
The `critique-<part>` copies of step 4 answer these for each sentence, list item and table row of their `facts-<part>-draft.md`, after opening the fact it cites (the string value that holds the URL in `facts/`, or the value a `fact:` reference names):
|
|
280
302
|
|
|
281
303
|
- Does the item say more than that fact says? Examples: a date's meaning (`startDate` is the start date on the Slack profile, not "joined Slack"), an author count (a post with nine authors is "one of nine authors", not "wrote"), a count's window or `total` against `listed`.
|
|
282
304
|
- Is a guess stated as a record, or a record kept out of the table that names where it is recorded?
|
|
283
305
|
|
|
284
|
-
|
|
306
|
+
Each writes one line per item to `critique-<part>.md`: `keep`, `cut` or `rewrite`, the item's heading or row, and one line on why, and returns only the line count.
|
|
285
307
|
|
|
286
308
|
### 5c. Write pass
|
|
287
309
|
|
|
288
|
-
Continue the `read` copy by its `taskId` with the critique
|
|
310
|
+
Continue the `read` copy by its `taskId` with the path of `critique.md` and any late evidence that has arrived (below). It applies the critique once to `read-draft.md` and writes:
|
|
289
311
|
|
|
290
312
|
- `read.md`: the five sections, with every `cut` gone and every `rewrite` rewritten.
|
|
291
|
-
- `facts.md
|
|
313
|
+
- `facts.md`, joined from the four parts once `facts-role.md`, `facts-work.md`, `facts-more.md` and `facts-llm.md` all exist. Write `read.md` first. If a part is still missing when the copy gets here, it checks for the files in `bash` steps of at most 30 seconds and joins when all four exist, so you send one continuation, never one for `read.md` and a second for `facts.md`. The joined file has: the `figures` block, then the four parts in the order role, work, more, llm, with each part's `## From a record` rows under one `## From a record` table and each part's guess rows under one guesses table, then `## Could not tell`. Joining changes no sentence of a part.
|
|
292
314
|
|
|
293
315
|
The shape of `facts.md`. Load the forms skill for the block syntax; the doc pane draws every block named here.
|
|
294
316
|
|
|
295
|
-
- It opens with a `figures` block of up to 3 tiles, each a count the doc cites further down. The hub refuses the upload when a block breaks the forms skill's limits, and the checker fails them first: a chart's `unit` is at most 8 characters ("h", "PRs", "msgs"; the time zone goes in the title), a tile's `label` at most 40 and its `value` at most 24.
|
|
317
|
+
- It opens with a `figures` block (written once, when the parts are joined) of up to 3 tiles, each a count the doc cites further down. The hub refuses the upload when a block breaks the forms skill's limits, and the checker fails them first: a chart's `unit` is at most 8 characters ("h", "PRs", "msgs"; the time zone goes in the title), a tile's `label` at most 40 and its `value` at most 24.
|
|
296
318
|
- Headings are plain topic headings with no numbers ("Your team and role", not "1. Team, title, start date").
|
|
297
319
|
- `## From a record` is a table `| Fact | Value | Where it is recorded |` with a row for anything a record states: a Slack profile field, a PR, a post's author line. "Where it is recorded" is a labeled link to that record.
|
|
298
320
|
- `## Guesses, and what each rests on` is a table `| Guess | What it rests on |` with a row for anything inferred: a manager, a lead, an owner. One sentence opens it: nothing the run read states these, and the user can tell chief which is wrong. Question 2's answers live here. No heading or sentence outside this table states a guess as true.
|
|
299
321
|
- People (question 2 and 4) and identity are tables. Each numeric question (6, 7, 9 and 10) leads with a `chart` block, a `bar` chart for counts and a `schedule` chart for an hour or weekday pattern, then its cited lines.
|
|
300
|
-
- `## Could not tell` keeps its heading and holds its list inside `<details><summary>What the run could not read</summary> ... </details>`. The list names every `unreadable` source, `notJudged` mentions, that reactions were not read, the Slack window, a Kit grant the user declined, a slice that timed out, and the Mac half if it hasn't reported.
|
|
322
|
+
- `## Could not tell` is written once, from the `## Could not tell` of the area files, and keeps its heading and holds its list inside `<details><summary>What the run could not read</summary> ... </details>`. The list names every `unreadable` source, `notJudged` mentions, that reactions were not read, the Slack window, a Kit grant the user declined, a slice that timed out, and the Mac half if it hasn't reported.
|
|
301
323
|
- One schedule draft per recurring need it found (a morning pass over unanswered mentions, a weekly stale-PR pass), as `schedules/<bot>/<id>.md` for a bot on the current roster:
|
|
302
324
|
|
|
303
325
|
```md
|
|
@@ -314,26 +336,26 @@ A schedule file has only `cron`, so it runs every time the cron matches: `0 14 2
|
|
|
314
336
|
|
|
315
337
|
main also runs the kit's `workspace-review` schedule (Mondays 08:00 UTC), which every workspace has without a draft: it scores the week, keeps `memory/human.md` and the memory entries current from the user's corrections, proposes bot and schedule changes in a second draft PR, and ranks hub and kit proposals. Its row in the step 7 Schedule table says why it is there in the user's own words when the facts have them: link one or two of the user's corrections (a reply that tells a person or an agent to redo it their way) in "What it reports". With none in the facts, it says it starts from the corrections they make in this workspace.
|
|
316
338
|
|
|
317
|
-
Rules for
|
|
339
|
+
Rules for `read.md` and every part of `facts.md`:
|
|
318
340
|
|
|
319
|
-
- Every list item, and in `facts.md` every table row outside `## Could not tell`, cites at least one URL that is in the facts, or a `fact:` reference: `fact:local/usage-<source>.json#<JSON pointer>` for a value in the Mac's files, `fact:github/<file>#<JSON pointer
|
|
341
|
+
- Every list item, and in `facts.md` every table row outside `## Could not tell`, cites at least one URL that is in the facts, or a `fact:` reference: `fact:local/usage-<source>.json#<JSON pointer>` for a value in the Mac's files, `fact:github/<file>#<JSON pointer>`, `fact:slack/base.json#<JSON pointer>` or `fact:kit/<slice>.json#<JSON pointer>` for a count that has no URL of its own, `fact:interview/handoff` for the user's pick from the handoff `ask`. No URL or reference appears that isn't in the facts. Never cite a web URL for a local count. State counts as the facts give them, with the window.
|
|
320
342
|
- A URL appears only as the target of a labeled link, `[short label](url)`, copied whole from the facts, query string included. The label names the source in plain words ("his standup post", "Introducing eve", "eve#5358"), never the URL, and a bare URL or `<url>` fails the checker. A `fact:` reference stays as written, in parentheses.
|
|
321
343
|
- A sentence or row states no more than its fact says. The Slack profile's `startDate` is "Start date, from your Slack profile", never "joined Slack". A post with several authors in its author line is "one of N authors", never "wrote". A count keeps the window and the `total` the fact gives. When the fact is a guess's basis, the row goes in the guesses table, with what it rests on.
|
|
322
344
|
- Don't quote messages beyond the snippets, and don't name people beyond what a claim needs. Both files name the user's repos and colleagues, so they are posted only in this thread. Neither is committed. The one thing committed besides schedule drafts is `memory/human.md` (step 6), which is written separately, in its own format, from different sources, and only to a private workspace repo.
|
|
323
345
|
|
|
324
346
|
```sh
|
|
325
347
|
cd /tmp/onboarding-skill && node check-report.mjs --read read.md --profile facts.md --facts facts \
|
|
326
|
-
--critique critique.md --schedules schedules
|
|
348
|
+
--critique critique.md critique-role.md critique-work.md critique-llm.md --schedules schedules
|
|
327
349
|
```
|
|
328
350
|
|
|
329
|
-
`--read` checks citations (and fails a bare URL in `read.md`; on `facts.md`, `--profile` fails a bare URL, a table row that cites nothing and a `figures` or `chart` block the hub would refuse) and also fails a trait under `## How you work` that cites fewer than two different sources. `--critique` fails when
|
|
351
|
+
`--read` checks citations (and fails a bare URL in `read.md`; on `facts.md`, `--profile` fails a bare URL, a table row that cites nothing and a `figures` or `chart` block the hub would refuse) and also fails a trait under `## How you work` that cites fewer than two different sources. `--critique` fails when any of its files is missing or holds no `keep`, `cut` or `rewrite` line; it checks presence only. `--schedules` fails a draft without a five-field `cron`, a draft that says it runs once, and a date-pinned or self-deleting draft whose prompt and read lines don't say it recurs until its deletion is merged and deployed. The copy fixes every line the checker prints and reruns until it prints nothing. When it returns, run the checker yourself once more; it must print nothing. Keep `read.md`, `facts.md`, `phases.log` and `critique.md`.
|
|
330
352
|
|
|
331
353
|
### Evidence that arrives late
|
|
332
354
|
|
|
333
355
|
Late evidence is the user's handoff answer (the whole `## handoff` entry of `facts/interview.md`: asked, offered and picked), or the Mac's `areas/llm-local.md`, that arrives after the read copy started. Evidence that is in before 5a starts goes to 5a like the rest: `facts/interview.md`, and `areas/llm-local.md` beside the three area files. Late evidence never goes into a pass that is running, and it is never dropped.
|
|
334
356
|
|
|
335
357
|
- **Before 5c starts**, it goes to 5c with the critique's list.
|
|
336
|
-
- **Once 5c has started**, wait for the read copy to return, then continue it by its `taskId` with only the new evidence. It judges again every trait, `## Your team` row and schedule draft the evidence bears on, including one it contradicts, rewrites them in `read.md`, updates the affected answers in `facts.md
|
|
358
|
+
- **Once 5c has started**, wait for the read copy to return, then continue it by its `taskId` with only the new evidence. It judges again every trait, `## Your team` row and schedule draft the evidence bears on, including one it contradicts, rewrites them in `read.md`, updates the affected answers in `facts.md` (a part rerun by step 4's late `areas/llm-local.md` replaces that part's text there), and returns the list of what it changed. When that list adds or rewrites a trait or a team row, start a fresh `critique` copy (5b) on just those items, giving it the same new evidence (for a handoff answer, the whole `## handoff` entry), and continue the read copy with its list. Run the checker until it prints nothing.
|
|
337
359
|
- **Once step 6 has opened its PR**, a refresh that adds, changes or removes a schedule draft changes the PR the same way: write, edit or delete its `agents/<bot>/agent/schedules/<id>.md` on the PR's branch, push, and watch its checks (`gh pr checks`) until they pass, as in step 6. Before you touch its branch, check its state (`gh pr view <number> --json state`). If it is `MERGED`, never push to its branch: open a new PR from the default branch with only the changed, added or deleted schedule files, watch its checks the same way, and say the revised schedule is not deployed: the one running is the merged one, and the new one runs only once the user merges the new PR and it deploys. The changed schedule is posted only after its PR passes, or with what failed.
|
|
338
360
|
- **After step 7 has posted**, do the same, then post only what changed: the rewritten lines of the read, the changed team and schedule rows, and a new `ask` if the proposed team changed.
|
|
339
361
|
|
|
@@ -353,7 +375,7 @@ When the workspace is backed by a GitHub repo, open one PR on it that adds the s
|
|
|
353
375
|
cd /tmp/onboarding-skill && node check-report.mjs --human <repo>/memory/human.md
|
|
354
376
|
```
|
|
355
377
|
|
|
356
|
-
Commit it only when `gh repo view --json isPrivate --jq .isPrivate` prints `true`, because it holds what the user said in the workspace. When it prints `false`, the command fails, or the repo already has a `memory/human.md`, leave it out and say so in the message. With no drafts and no profile to add, open no PR. The user merging it is their approval; the deploy that follows is what makes the schedules run.
|
|
378
|
+
Commit it only when `gh repo view --json isPrivate --jq .isPrivate` prints `true`, because it holds what the user said in the workspace. When it prints `false`, the command fails, or the repo already has a `memory/human.md`, leave it out and say so in the message. With no drafts and no profile to add, open no PR. The user merging it is their approval; the deploy that follows is what makes the schedules run. Append `pr <url> open` to `phases.log` as soon as `gh pr create` returns (`pr none` without a repo), and go straight to step 7: the read posts without waiting for the PR's checks, and the links line says they are running. The checks include the deploy's build, which rejects a bad cron or a bot that does not exist. After step 7 posts, watch them (`gh pr checks`), fix the draft and push again until they pass, and append `checks pass` or `checks fail` to `phases.log`. Post one follow-up, mentioning the user, only when a check still fails after your fixes: what failed and what the user must do. Without a repo the drafts stay in the thread and the message says so.
|
|
357
379
|
|
|
358
380
|
## 7. Post the read, the team and the schedules
|
|
359
381
|
|
|
@@ -392,18 +414,38 @@ Each part is its own bubble, and a bubble is at most 700 characters, link target
|
|
|
392
414
|
|
|
393
415
|
```sh
|
|
394
416
|
node /tmp/onboarding-skill/check-report.mjs --post /tmp/onboarding-skill/post.md \
|
|
395
|
-
--schedules /tmp/onboarding-skill/schedules
|
|
417
|
+
--team-ask /tmp/onboarding-skill/facts/team-ask.md --schedules /tmp/onboarding-skill/schedules
|
|
396
418
|
```
|
|
397
419
|
|
|
398
420
|
Fix every line it prints and rerun until it prints nothing, then post the file's text in this thread as one `post_message`, with `read.md` and `facts.md` linked as uploads. Then write the `outcome` timeline note ("Write the timeline as you go").
|
|
399
421
|
|
|
400
422
|
- The first bubble, everything above the first `---`, is at most two sentences, and every bubble is at most 700 characters.
|
|
401
423
|
- Below it, the two tables, then the lines under them and nothing else:
|
|
402
|
-
- The links line. Without a repo, it says the drafts stay in the thread.
|
|
424
|
+
- The links line. Without a repo, it says the drafts stay in the thread. Otherwise it says the PR's checks are running and merging it turns the drafts on.
|
|
403
425
|
- One line per source you could not read or Kit grant the user declined: what was not read and what they must do.
|
|
404
426
|
- If you handed the Mac half over in step 0 and that bot hasn't posted yet, one line: its half hasn't reported yet, and if the Hub app is closed on their Mac, it runs once they open it.
|
|
405
427
|
- No data tables in the chat: counts, windows, the ten answers and the "Could not tell" section stay in `facts.md`.
|
|
406
|
-
- Last come the `ask` blocks, in the same post, after the links lines. The team `ask` has one option per proposed change in the "Your team" table (an added, changed or removed bot), plus "None for now". When `memory/human.md` has `guess` lines, the guess `ask` ("Confirm the guesses") is the last bubble of this post, after the team `ask`. Neither is a separate post. An `ask` holds at most 5 options, so the read proposes at most four changes.
|
|
428
|
+
- Last come the `ask` blocks, in the same post, after the links lines. The team `ask` has one option per proposed change in the "Your team" table (an added, changed or removed bot), plus "None for now". When `memory/human.md` has `guess` lines, the guess `ask` ("Confirm the guesses") is the last bubble of this post, after the team `ask`. Neither is a separate post. An `ask` holds at most 5 options, so the read proposes at most four changes. Before the post, write `/tmp/onboarding-skill/facts/team-ask.md`, one section per option but "None for now", as the checker reads it:
|
|
429
|
+
|
|
430
|
+
````md
|
|
431
|
+
## add-deep-diver
|
|
432
|
+
Label: Add deep-diver
|
|
433
|
+
Kind: add
|
|
434
|
+
|
|
435
|
+
```json
|
|
436
|
+
{"name":"deep-diver","model":"anthropic/claude-opus-5.5","runsOn":"hosted","role":"Digs into a failing check.","preset":"read-only"}
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
## swap-reviewer
|
|
440
|
+
Label: Change reviewer
|
|
441
|
+
Kind: change
|
|
442
|
+
````
|
|
443
|
+
|
|
444
|
+
The section's heading is the option's `id`, `Label:` is the option's label word for word (a tap sends it back), and `Kind:` is `add`, `change` or `remove`. An added bot's section holds its `create_agent` input as a `json` block, the same input the read's `## Your team` gave it. The checker fails an option with no section, a label that differs, and an added bot whose input the tool's schema would refuse.
|
|
445
|
+
|
|
446
|
+
### When the user taps a team option
|
|
447
|
+
|
|
448
|
+
A tap comes back as a message from the user whose text is exactly one option's label. Match it to `facts/team-ask.md`. "None for now" needs nothing. For an added bot (`Kind: add`), call `create_agent` yourself with that section's input, and post one line to the user: the bot's name and that, in a hosted workspace, it joins with the next deployment of the workspace repo (the tool's own `note` says which repo). If the call fails (a workspace with no linked repo answers 409, a name already taken), post the error in one line and say the builder can add it by a PR. For a change or a removal, route the work to the builder as normal work in this thread: it edits `hub.workspace.json` and the role files in its own PR, because a change to a running bot is a deploy. A tap after the user already picked another option is handled the same way.
|
|
407
449
|
|
|
408
450
|
### Confirm the guesses
|
|
409
451
|
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
// and `chart` block is one the hub would draw (the limits of hosted-hub/lib/forms-schema.mjs)
|
|
9
9
|
// A `fact:<file>#<JSON pointer>` reference cites a fact with no web permalink: the path is relative to a --facts directory, and the
|
|
10
10
|
// pointer must name a value in it. `fact:local/...` is the Mac's LLM usage (fact:local/usage-codex.json#/usage/codex/models/0);
|
|
11
|
-
// `fact:github/...` and `fact:
|
|
11
|
+
// `fact:github/...`, `fact:slack/...` and `fact:kit/...` are a count or total that has no URL of its own (fact:github/calendar.json#/weekly/0,
|
|
12
|
+
// fact:kit/team-eve.json#/counts/messages).
|
|
12
13
|
// Every other fact has a URL, so any other `fact:` path fails. A reference counts as the source its directory names, so a service
|
|
13
14
|
// still counts as one source, whether cited by URL or by reference.
|
|
14
15
|
// `fact:interview/<name>` cites the user's own answer, saved under a `## <name>` heading in interview.md in a --facts directory
|
|
@@ -18,7 +19,10 @@
|
|
|
18
19
|
// --human memory/human.md the file is a valid description (profile.mjs), the format memory/human.md is recalled in,
|
|
19
20
|
// with at most MAX_GUESSES open guess lines, the most the run's closing ask lists
|
|
20
21
|
// --phases phases.log the run's step lines are all there and in order: start, quick, first, facts, slices,
|
|
21
|
-
// areas, read, critique, write, pr, post;
|
|
22
|
+
// areas, read, critique, write, pr, post; facts-role, facts-work, facts-more and facts-llm (each facts part's
|
|
23
|
+
// apply returned) each once anywhere after slices and before post; checks, optional, once after post,
|
|
24
|
+
// followed by pass or fail (the PR's checks, watched after the read posts); ask, optional, comes after
|
|
25
|
+
// first and before read
|
|
22
26
|
// and offer, tap, ready, merged, optional, each at most once, an HH:MM:SS time after its name, in that order of time,
|
|
23
27
|
// and none without the ones before it (the first message's offers and what became of the tapped one)
|
|
24
28
|
// --finding f.md as --profile, and the file is one `- ` list item of exactly two sentences (the fact and why
|
|
@@ -28,9 +32,12 @@
|
|
|
28
32
|
// --profile first.md, --finding f.md neither text mentions @all (a post for the user mentions their handle); --post post.md checks the same
|
|
29
33
|
// --post post.md the first bubble (everything above the first `---` line) is at most two sentences, no bubble is
|
|
30
34
|
// over 700 characters (link targets not counted), and below the first are the "Your team" table (| Bot | Change | Why |) and the Schedule table
|
|
31
|
-
// (| Schedule | Bot | When | What it reports |), with a `workspace-review` row for `main
|
|
32
|
-
//
|
|
33
|
-
//
|
|
35
|
+
// (| Schedule | Bot | When | What it reports |), with a `workspace-review` row for `main`;
|
|
36
|
+
// with --team-ask facts/team-ask.md, every option of the post's first `ask` (the team `ask`) but `none`
|
|
37
|
+
// is an entry there with the same label, and an entry of kind `add` holds a `create_agent` input
|
|
38
|
+
// that the tool's schema (tools/create_agent.ts) accepts
|
|
39
|
+
// --critique critique.md [critique-<area>.md...] each file exists and holds one `keep`, `cut` or `rewrite` line or more; a presence
|
|
40
|
+
// check only, it cannot prove the critique copy wrote what it judged
|
|
34
41
|
// --schedules dir [--read r.md] [--post p.md] every `<bot>/<id>.md` draft has a five-field `cron` and a prompt. A draft runs every
|
|
35
42
|
// time its cron matches, so none says it runs once; a draft whose cron pins a date (day
|
|
36
43
|
// and month) or that deletes its own file says it "recurs until" that deletion is "merged
|
|
@@ -62,7 +69,7 @@ export function factUrls(facts) {
|
|
|
62
69
|
const unescape = (t) => decodeURIComponent(t).replaceAll("~1", "/").replaceAll("~0", "~");
|
|
63
70
|
export function resolveFact(ref, files) {
|
|
64
71
|
const [file, pointer = ""] = ref.slice("fact:".length).split("#");
|
|
65
|
-
if (!/^(local|interview|github|slack)\//.test(file)) return { problem: `${ref}: only fact:local/..., fact:github/..., fact:slack/... and fact:interview/<name> can be cited; cite the URL instead` };
|
|
72
|
+
if (!/^(local|interview|github|slack|kit)\//.test(file)) return { problem: `${ref}: only fact:local/..., fact:github/..., fact:slack/..., fact:kit/... and fact:interview/<name> can be cited; cite the URL instead` };
|
|
66
73
|
if (!Object.hasOwn(files, file)) return { problem: `${ref} names no facts file` };
|
|
67
74
|
let v = files[file];
|
|
68
75
|
for (const t of pointer.split("/").slice(1).map(unescape)) {
|
|
@@ -104,7 +111,9 @@ export function bareUrlProblems(profile) {
|
|
|
104
111
|
return problems;
|
|
105
112
|
}
|
|
106
113
|
|
|
107
|
-
|
|
114
|
+
// The facts doc is written in three parts, one per area, and assembled into facts.md; each part is checked like the whole.
|
|
115
|
+
const FACTS_PARTS = ["role", "work", "llm"].flatMap((area) => [`facts-${area}.md`, `facts-${area}-draft.md`]);
|
|
116
|
+
const FINAL_FILES = ["read.md", "read-draft.md", "facts.md", ...FACTS_PARTS];
|
|
108
117
|
|
|
109
118
|
// The `figures` and `chart` blocks a document draws, checked against the limits of hosted-hub/lib/forms-schema.mjs (the hub refuses an
|
|
110
119
|
// upload that breaks them). The checker runs in the bot's sandbox, where that module and its zod are not, so the limits are written
|
|
@@ -176,7 +185,7 @@ const HOST_SOURCES = [[/(^|\.)slack\.com$/, "Slack"], [/(^|\.)github\.com$/, "Gi
|
|
|
176
185
|
export function sourceOf(citation) {
|
|
177
186
|
if (citation.startsWith("fact:")) {
|
|
178
187
|
const file = citation.slice("fact:".length).split("#")[0];
|
|
179
|
-
return file.startsWith("interview/") ? "the user's answers" : file.startsWith("local/") ? "the Mac's files" : file.startsWith("github/") ? "GitHub" : file.startsWith("slack/") ? "Slack" : citation;
|
|
188
|
+
return file.startsWith("interview/") ? "the user's answers" : file.startsWith("local/") ? "the Mac's files" : file.startsWith("github/") ? "GitHub" : file.startsWith("slack/") ? "Slack" : file.startsWith("kit/notion") ? "Notion" : file.startsWith("kit/") ? "Slack" : citation;
|
|
180
189
|
}
|
|
181
190
|
let host;
|
|
182
191
|
try { host = new URL(citation).hostname; } catch { return citation; }
|
|
@@ -222,6 +231,8 @@ export function returnedProblems(doc, file) {
|
|
|
222
231
|
const PHASES = ["start", "quick", "first", "facts", "slices", "areas", "read", "critique", "write", "pr", "post"];
|
|
223
232
|
const ASK_STEP = "ask";
|
|
224
233
|
const TASK_EVENTS = ["offer", "tap", "ready", "merged"];
|
|
234
|
+
const FACTS_STEPS = ["facts-role", "facts-work", "facts-more", "facts-llm"];
|
|
235
|
+
const CHECKS_STEP = "checks";
|
|
225
236
|
|
|
226
237
|
const clock = (t) => t.split(":").reduce((sum, part) => sum * 60 + Number(part), 0);
|
|
227
238
|
|
|
@@ -229,14 +240,20 @@ const clock = (t) => t.split(":").reduce((sum, part) => sum * 60 + Number(part),
|
|
|
229
240
|
export function phaseProblems(log) {
|
|
230
241
|
const names = log.split("\n").map((l) => l.trim().split(/\s+/)[0]).filter(Boolean);
|
|
231
242
|
const problems = [];
|
|
232
|
-
for (const n of names) if (!PHASES.includes(n) && n !== ASK_STEP && !TASK_EVENTS.includes(n)) problems.push(`phases.log: unknown line "${n}"`);
|
|
243
|
+
for (const n of names) if (!PHASES.includes(n) && n !== ASK_STEP && n !== CHECKS_STEP && !FACTS_STEPS.includes(n) && !TASK_EVENTS.includes(n)) problems.push(`phases.log: unknown line "${n}"`);
|
|
233
244
|
for (const n of new Set(names)) if (names.indexOf(n) !== names.lastIndexOf(n)) problems.push(`phases.log: "${n}" is logged more than once`);
|
|
234
|
-
for (const n of PHASES) if (!names.includes(n)) problems.push(`phases.log: no "${n}" line`);
|
|
245
|
+
for (const n of [...PHASES, ...FACTS_STEPS]) if (!names.includes(n)) problems.push(`phases.log: no "${n}" line`);
|
|
235
246
|
const steps = names.filter((n) => PHASES.includes(n));
|
|
236
247
|
const order = PHASES.filter((n) => steps.includes(n));
|
|
237
248
|
if (steps.join() !== order.join()) problems.push(`phases.log: steps are logged as ${steps.join(", ")}; the order is ${order.join(", ")}`);
|
|
238
249
|
const at = (n) => names.indexOf(n);
|
|
239
250
|
if (names.includes(ASK_STEP) && ((at("first") >= 0 && at(ASK_STEP) < at("first")) || (at("read") >= 0 && at(ASK_STEP) > at("read")))) problems.push(`phases.log: ${ASK_STEP} is logged outside first..read`);
|
|
251
|
+
for (const n of FACTS_STEPS) if (names.includes(n) && ((at("slices") >= 0 && at(n) < at("slices")) || (at("post") >= 0 && at(n) > at("post")))) problems.push(`phases.log: ${n} is logged outside slices..post`);
|
|
252
|
+
if (names.includes(CHECKS_STEP)) {
|
|
253
|
+
if (at("post") >= 0 && at(CHECKS_STEP) < at("post")) problems.push(`phases.log: ${CHECKS_STEP} is logged before post`);
|
|
254
|
+
const verdict = log.split("\n").map((l) => l.trim().split(/\s+/)).find(([n]) => n === CHECKS_STEP)?.[1];
|
|
255
|
+
if (verdict !== "pass" && verdict !== "fail") problems.push(`phases.log: ${CHECKS_STEP} needs pass or fail after it`);
|
|
256
|
+
}
|
|
240
257
|
const times = Object.fromEntries(log.split("\n").map((l) => l.trim().split(/\s+/)).filter(([n]) => TASK_EVENTS.includes(n)).map(([n, t]) => [n, t]));
|
|
241
258
|
const logged = TASK_EVENTS.filter((n) => names.includes(n));
|
|
242
259
|
logged.forEach((n, i) => {
|
|
@@ -360,7 +377,69 @@ export function postProblems(post) {
|
|
|
360
377
|
}
|
|
361
378
|
|
|
362
379
|
export function critiqueProblems(text) {
|
|
363
|
-
return /^\s*[-*]?\s*`?(keep|cut|rewrite)\b/im.test(text) ? [] : ["critique
|
|
380
|
+
return /^\s*[-*]?\s*`?(keep|cut|rewrite)\b/im.test(text) ? [] : ["the critique has no `keep`, `cut` or `rewrite` line; the critique copy writes its own judgment to the file"];
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
// create_agent's input, as tools/create_agent.ts declares it (test/onboarding-profile-facts.test.mjs checks the two agree). The tool's
|
|
384
|
+
// own schema makes every field optional; the hub's POST /api/agents then needs a name, model, role and runsOn unless a starter brings them.
|
|
385
|
+
const oneOf = (...words) => (v) => (words.includes(v) ? [] : [`must be one of ${words.join(", ")}`]);
|
|
386
|
+
const str = (v) => (typeof v === "string" ? [] : ["must be a string"]);
|
|
387
|
+
const matching = (re) => (v) => (typeof v === "string" && re.test(v) ? [] : [`must match ${re}`]);
|
|
388
|
+
const CREATE_AGENT = shape({
|
|
389
|
+
starter: [oneOf("planner", "builder", "reviewer", "mac")],
|
|
390
|
+
name: [matching(/^[a-z][a-z0-9-]{1,30}$/)],
|
|
391
|
+
model: [str],
|
|
392
|
+
reasoning: [oneOf("low", "medium", "high", "xhigh")],
|
|
393
|
+
runsOn: [oneOf("hosted", "local")],
|
|
394
|
+
role: [str],
|
|
395
|
+
instructions: [str],
|
|
396
|
+
domains: [listOf(0, Infinity, matching(/^[a-z][a-z0-9-]*(\/[a-z][a-z0-9-]*)*$/))],
|
|
397
|
+
preset: [oneOf("builder", "read-only")],
|
|
398
|
+
});
|
|
399
|
+
|
|
400
|
+
export function createAgentProblems(input) {
|
|
401
|
+
const problems = CREATE_AGENT(input);
|
|
402
|
+
if (problems.length || input.starter) return problems;
|
|
403
|
+
return ["name", "model", "role", "runsOn"].filter((k) => !Object.hasOwn(input, k)).map((k) => `${k} is required without a starter`);
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
const TEAM_KINDS = ["add", "change", "remove"];
|
|
407
|
+
|
|
408
|
+
// facts/team-ask.md: one `## <option id>` section per option of the team `ask`, with a `Label:` line (the text a tap sends back), a `Kind:` line
|
|
409
|
+
// (add, change or remove) and, for an added bot, a ```json block holding the `create_agent` input a tap runs.
|
|
410
|
+
export function teamAskEntries(teamAsk) {
|
|
411
|
+
return [...teamAsk.matchAll(/^##[ \t]+(\S+)[ \t]*\n([\s\S]*?)(?=^##[ \t]|(?![\s\S]))/gm)].map(([, id, body]) => ({
|
|
412
|
+
id,
|
|
413
|
+
label: /^Label:[ \t]*(.+?)[ \t]*$/m.exec(body)?.[1],
|
|
414
|
+
kind: /^Kind:[ \t]*(\S+)[ \t]*$/m.exec(body)?.[1],
|
|
415
|
+
input: /```json[ \t]*\n([\s\S]*?)\n[ \t]*```/.exec(body)?.[1],
|
|
416
|
+
}));
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
export function teamAskProblems(post, teamAsk) {
|
|
420
|
+
const problems = [];
|
|
421
|
+
const entries = teamAskEntries(teamAsk);
|
|
422
|
+
for (const e of entries) {
|
|
423
|
+
if (!TEAM_KINDS.includes(e.kind)) { problems.push(`team-ask.md: ${e.id} needs a "Kind:" line of ${TEAM_KINDS.join(", ")}`); continue; }
|
|
424
|
+
if (!e.label) problems.push(`team-ask.md: ${e.id} has no "Label:" line`);
|
|
425
|
+
if (e.kind !== "add") continue;
|
|
426
|
+
if (e.input === undefined) { problems.push(`team-ask.md: ${e.id} adds a bot but holds no \`\`\`json create_agent input`); continue; }
|
|
427
|
+
let json;
|
|
428
|
+
try { json = JSON.parse(e.input); } catch (err) { problems.push(`team-ask.md: ${e.id}: create_agent input is invalid JSON (${err.message})`); continue; }
|
|
429
|
+
if (json === null || typeof json !== "object" || Array.isArray(json)) problems.push(`team-ask.md: ${e.id}: create_agent input must be an object`);
|
|
430
|
+
else problems.push(...createAgentProblems(json).map((m) => `team-ask.md: ${e.id}: create_agent input: ${m}`));
|
|
431
|
+
}
|
|
432
|
+
const ask = /^[ \t]*```ask[ \t]*\n([\s\S]*?)\n[ \t]*```[ \t]*$/m.exec(post);
|
|
433
|
+
if (!ask) return [...problems, "the post has no team `ask` block"];
|
|
434
|
+
let options;
|
|
435
|
+
try { options = JSON.parse(ask[1]).options; } catch { return [...problems, "the team `ask` is not valid JSON"]; }
|
|
436
|
+
for (const o of Array.isArray(options) ? options : []) {
|
|
437
|
+
if (o?.id === "none") continue;
|
|
438
|
+
const e = entries.find((x) => x.id === o?.id);
|
|
439
|
+
if (!e) problems.push(`team ask option "${o?.id}" is not in team-ask.md`);
|
|
440
|
+
else if (e.label !== o.label) problems.push(`team ask option "${o.id}" is labeled "${o.label}", but team-ask.md says "${e.label}"; a tap sends the label back`);
|
|
441
|
+
}
|
|
442
|
+
return problems;
|
|
364
443
|
}
|
|
365
444
|
|
|
366
445
|
const ONE_TIME = /\bone[- ]time\b|\bsingle run\b|\bruns? (just )?once\b|\bonce only\b/i;
|
|
@@ -406,7 +485,11 @@ if (import.meta.url === pathToFileURL(process.argv[1] ?? "").href) {
|
|
|
406
485
|
const profiles = [...reads, ...after("--profile"), ...findings];
|
|
407
486
|
if (profiles.length) {
|
|
408
487
|
const factPaths = after("--facts");
|
|
409
|
-
const
|
|
488
|
+
const unreadable = [];
|
|
489
|
+
const docs = factPaths.flatMap(jsonFiles).flatMap(([key, f]) => {
|
|
490
|
+
try { return [[key, JSON.parse(readFileSync(f, "utf8"))]]; } catch (e) { unreadable.push(`${key}: invalid JSON (${e.message}); it may still be written`); return []; }
|
|
491
|
+
});
|
|
492
|
+
problems.push(...unreadable);
|
|
410
493
|
const interview = factPaths.map((d) => join(d, "interview.md")).filter((f) => existsSync(f) && statSync(f).isFile()).map((f) => interviewFacts(readFileSync(f, "utf8")));
|
|
411
494
|
const files = Object.assign(Object.fromEntries(docs), ...interview);
|
|
412
495
|
for (const [key, doc] of docs) problems.push(...returnedProblems(doc, key));
|
|
@@ -415,7 +498,7 @@ if (import.meta.url === pathToFileURL(process.argv[1] ?? "").href) {
|
|
|
415
498
|
const text = readFileSync(p, "utf8");
|
|
416
499
|
const final = FINAL_FILES.includes(basename(p));
|
|
417
500
|
const firstMessage = basename(p) === "first.md";
|
|
418
|
-
problems.push(...named(p, citationProblems(text, docs.map(([, d]) => d), files, { tableRows: basename(p) === "facts.md" })));
|
|
501
|
+
problems.push(...named(p, citationProblems(text, docs.map(([, d]) => d), files, { tableRows: basename(p) === "facts.md" || FACTS_PARTS.includes(basename(p)) })));
|
|
419
502
|
if (final) problems.push(...named(p, bareUrlProblems(text)), ...named(p, formProblems(text)));
|
|
420
503
|
if (firstMessage) problems.push(...named(p, [...formProblems(text), ...bubbleProblems(text)]));
|
|
421
504
|
if (reads.includes(p)) problems.push(...named(p, traitProblems(text)));
|
|
@@ -427,9 +510,15 @@ if (import.meta.url === pathToFileURL(process.argv[1] ?? "").href) {
|
|
|
427
510
|
const [phases] = after("--phases");
|
|
428
511
|
if (phases) problems.push(...phaseProblems(readFileSync(phases, "utf8")));
|
|
429
512
|
const [post] = after("--post");
|
|
430
|
-
if (post)
|
|
431
|
-
|
|
432
|
-
|
|
513
|
+
if (post) {
|
|
514
|
+
const text = readFileSync(post, "utf8");
|
|
515
|
+
problems.push(...postProblems(text));
|
|
516
|
+
const [teamAsk] = after("--team-ask");
|
|
517
|
+
if (!teamAsk) problems.push("--post needs --team-ask facts/team-ask.md, the file that says what a tap on each team option does");
|
|
518
|
+
else if (!existsSync(teamAsk)) problems.push(`${teamAsk} is missing; step 7 writes it before the post`);
|
|
519
|
+
else problems.push(...teamAskProblems(text, readFileSync(teamAsk, "utf8")));
|
|
520
|
+
}
|
|
521
|
+
for (const critique of after("--critique")) problems.push(...(existsSync(critique) ? critiqueProblems(readFileSync(critique, "utf8")).map((m) => `${basename(critique)}: ${m}`) : [`${critique} is missing; the critique copy writes it`]));
|
|
433
522
|
const [schedules] = after("--schedules");
|
|
434
523
|
if (schedules) {
|
|
435
524
|
const drafts = readdirSync(schedules, { recursive: true }).map((f) => f.split(sep).join("/")).filter((f) => f.endsWith(".md")).sort().map((f) => [f, readFileSync(join(schedules, f), "utf8")]);
|