The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
Merge batch 11-06 k1400: #3298 (#3372)
0xken153899ee1ab8fb
diff --git a/backend/integration/superTabNoticeDigest.test.ts b/backend/integration/superTabNoticeDigest.test.tsindex 663e324c2..e897391c8 100644--- a/backend/integration/superTabNoticeDigest.test.ts+++ b/backend/integration/superTabNoticeDigest.test.ts@@ -1,4 +1,5 @@import { randomUUID } from 'node:crypto'+import { latestProcessNote } from '../src/superTabs/processNotes.js'import { execFile } from 'node:child_process'import { promisify } from 'node:util'import { join } from 'node:path'@@ -68,6 +69,8 @@ async function swarm({ fresh = false, told, capable = false }: { fresh?: booleanreturn agentId}const lead = await add('lead', 'lead-host', 'Lead', true)+ // Its PM confirmed the newest note for PMs, which would otherwise wake it and head its inbox (processNotes.ts, task #3581).+ await execute({ type: 'process.confirm', projectId: 'lead', noteId: latestProcessNote()!.id }, host, lead)const group = String((await execute({ type: 'conversation.create', title: 'Ship the parser', brief: 'Implement it',checks: [] })).result.conversationId)const worker = await add(group, 'test-host', 'Worker')diff --git a/backend/integration/superTabPmSchedule.test.ts b/backend/integration/superTabPmSchedule.test.tsindex 36a841548..3ce39e869 100644--- a/backend/integration/superTabPmSchedule.test.ts+++ b/backend/integration/superTabPmSchedule.test.ts@@ -1,4 +1,5 @@import { randomUUID } from 'node:crypto'+import { latestProcessNote } from '../src/superTabs/processNotes.js'import { execFile } from 'node:child_process'import { promisify } from 'node:util'import { join } from 'node:path'@@ -70,6 +71,8 @@ async function swarm({ fresh = false, told }: { fresh?: boolean; told?: string[]return agentId}const lead = await add('lead', 'lead-host', 'Lead', true)+ // Its PM confirmed the newest note for PMs, which would otherwise wake it and head its inbox (processNotes.ts, task #3581).+ await execute({ type: 'process.confirm', projectId: 'lead', noteId: latestProcessNote()!.id }, host, lead)const group = String((await execute({ type: 'conversation.create', title: 'Ship the parser', brief: 'Implement it',checks: [] })).result.conversationId)const worker = await add(group, 'test-host', 'Worker')diff --git a/backend/src/superTabs/commands.ts b/backend/src/superTabs/commands.tsindex 5de2a8731..dfc42f2d5 100644--- a/backend/src/superTabs/commands.ts+++ b/backend/src/superTabs/commands.ts@@ -9,6 +9,7 @@ import { movableEntry } from './computerMoves.js'import { agentDisplayName, assignAgentDisplayNames } from './agentNames.js'import { addedAgentName, renameAgentTo } from './agentRename.js'import { addCrew, CREW_LANES, CREW_ROLE_MAX, removeCrew } from './crew.js'+import { noteIndex } from './processNotes.js'import { keepUsernames, setUsername, swarmUsernames, usernameOf } from './usernames.js'import { agentWrittenNameOf, setName, shownNameOf } from './personNames.js'import { z } from 'zod'@@ -235,6 +236,8 @@ export const commandSchema = z.discriminatedUnion('type', [z.object({ type: z.literal('project.delete'), projectId: id }).strict(),z.object({ type: z.literal('project.sharing'), projectId: id, visibility: z.enum(['public', 'private']), memberIds: z.array(id).max(200) }).strict(),z.object({ type: z.literal('project.cadence'), projectId: id, minutes: z.union([z.literal(1), z.literal(5), z.literal(15), z.literal(30)]) }).strict(),+ // A project's PM confirms a what-changed note for PMs (processNotes.ts, task #3581).+ z.object({ type: z.literal('process.confirm'), projectId: id, noteId: z.string().trim().min(1).max(80) }).strict(),// A local time of day ("08:00") in an IANA zone; null turns the digest off.z.object({ type: z.literal('project.digest'), projectId: id, time: z.string().regex(/^(?:[01]\d|2[0-3]):[0-5]\d$/).nullable(), timeZone: z.string().min(1).max(64) }).strict(),// `through`: each conversation's sequence the Lead read, as its wake-up names them. `throughRevision` is the tab revision a@@ -2192,6 +2195,16 @@ function applyCommandOnce(original: SuperTabState, actor: Actor, input: Command,projectOf(state, project.id).coordinatorName = command.namebreak}+ case 'process.confirm': {+ const project = readProject(state, actor, command.projectId)+ if (actor.kind !== 'agent' || ledProject(state, actor.agentId)?.id !== project.id) fail('FORBIDDEN', 'Only the project\'s PM confirms a note for PMs.', 403)+ if (noteIndex(command.noteId) < 0) fail('INVALID_NOTE', 'Confirm a note the Swarm sent: its id is in your wake or inbox.', 400)+ mutableProjects(state)+ const stored = projectOf(state, project.id)+ // Confirming an older note after a newer one never brings the newer back.+ if (noteIndex(command.noteId) > noteIndex(stored.processNote?.confirmed)) stored.processNote = { ...stored.processNote, confirmed: command.noteId }+ break+ }case 'project.digest': {const project = readProject(state, actor, command.projectId)const lead = conversation(state, project.leadConversationId).leadIddiff --git a/backend/src/superTabs/inbox.test.ts b/backend/src/superTabs/inbox.test.tsindex 2267df819..837595da9 100644--- a/backend/src/superTabs/inbox.test.ts+++ b/backend/src/superTabs/inbox.test.ts@@ -8,7 +8,8 @@ import { digestText } from './noticeDigest.js'import { crewNeedLine, gathersForInbox, INBOX_CAPABILITY, inboxSection, OWED_LINES_MAX, owedLines, personLine } from './inbox.js'import type { Author } from './model.js'import { CREW_NEED_KIND } from './crewNeeds.js'-import { projectsOf } from './projects.js'+import { agentProjectId, projectsOf } from './projects.js'+import { latestProcessNote } from './processNotes.js'import { owner, stepsFixture } from './steps.test-support.js'import { swarmUsernames } from './usernames.js'@@ -18,6 +19,10 @@ function setup() {const f = stepsFixture()const ask = (text: string) => f.run({ type: 'message.send', conversationId: 'lead', text, replyTo: null, recipientIds: [] } as Command, owner).result.messageId as stringconst project = () => projectsOf(f.state)[0]!+ // A PM that confirmed the newest note for PMs, in a project with a crew: nothing else is owed (processNotes.ts, task #3581).+ project().processNote = { confirmed: latestProcessNote()!.id }+ const member = f.state.agents.find(a => agentProjectId(f.state, a) === project().id && a.id !== f.lead)!+ member.crew = { role: 'Engineer', at: 0, by: 'owner' }return { f, ask, project }}diff --git a/backend/src/superTabs/inbox.ts b/backend/src/superTabs/inbox.tsindex 815e1c4c3..91ee5bffa 100644--- a/backend/src/superTabs/inbox.ts+++ b/backend/src/superTabs/inbox.ts@@ -9,6 +9,7 @@ import type { Agent, Author, SuperTabState } from './model.js'import { digestIsDue, noticeLine } from './noticeDigest.js'import { TURN_END_WAIT_MS } from './turnEnd.js'import { ledProject, type SwarmProject } from './projects.js'+import { noteLines } from './processNotes.js'import { swarmUsernames } from './usernames.js'/** What a host reports (machines.ts `capabilities`) when it sends its PM's turn with the PM's delivery list read (cli@@ -73,14 +74,16 @@ export function crewNeedLine(state: SuperTabState, delivery: Where, need: CrewNeexport const OWED_LINES_MAX = 10const MINUTE = 60_000-/** [project]'s owed asks as the inbox's first lines: a header, then one line each, oldest first. None when nothing is owed. */+/** [project]'s owed asks as the inbox's first lines: a what-changed note its PM has not confirmed (processNotes.ts, task #3581),+ * then a header and one line per ask, oldest first. None when nothing is owed. */export function owedLines(state: SuperTabState, project: SwarmProject, now: number): string[] {+ const process = noteLines(project)const asks = state.conversations.filter(c => !c.archived && c.owed && (c.projectId ?? 'lead') === project.id).flatMap(c => c.owed!.map(ask => ({ ...ask, conversationId: c.id }))).sort((a, b) => a.at - b.at)- if (!asks.length) return []+ if (!asks.length) return processconst names = swarmUsernames(state)const ago = (at: number) => `${Math.max(0, Math.round((now - at) / MINUTE))}m`- return [`Owed asks (${asks.length}, oldest ${ago(asks[0]!.at)}). Answer each once, in its place: harness super-tab answer GROUP MESSAGE_ID TEXT OPERATION_ID.`,+ return [...process, `Owed asks (${asks.length}, oldest ${ago(asks[0]!.at)}). Answer each once, in its place: harness super-tab answer GROUP MESSAGE_ID TEXT OPERATION_ID.`,...asks.slice(0, OWED_LINES_MAX).map(a => `- from ${names.get(a.personId) ?? 'a person'}, ${ago(a.at)} ago (message ${a.id} in ${a.conversationId})`),...asks.length > OWED_LINES_MAX ? [`And ${asks.length - OWED_LINES_MAX} more owed: the board lists them all.`] : []]}diff --git a/backend/src/superTabs/pmSchedule.test.ts b/backend/src/superTabs/pmSchedule.test.tsindex 8296ee0c4..b8e397870 100644--- a/backend/src/superTabs/pmSchedule.test.ts+++ b/backend/src/superTabs/pmSchedule.test.ts@@ -2,6 +2,7 @@ import { describe, expect, it } from 'vitest'import type { Agent, Assignment, Conversation, SuperTabState, WorkStatus } from './model.js'import { BUILT_IN_HEADING, PM_SCHEDULE_TEXT, recordTidy, recordWake, SCHEDULE_SLOT_MS, scheduleMessageId, scheduleRequest, scheduleSlot, tidyMessageId, tidyRequest, tidySaved } from './pmSchedule.js'import { ARCHIVE_QUIET_MS } from './tidy.js'+import { latestProcessNote } from './processNotes.js'/** 10:00 on 4 November in Vietnam (03:00 UTC): a slot's first millisecond. */const T = Date.UTC(2026, 10, 4, 3, 0)@@ -21,8 +22,10 @@ function swarm(...groups: Conversation[]): SuperTabState {return {version: 1, id: 'tab', name: 'Swarm', ownerId: 'owner', environment: 'prod', paused: false, invitations: [],people: [{ id: 'owner', email: '[email protected]', role: 'owner', generation: 'g' }] as SuperTabState['people'],- agents: [agent('lead'), agent('eng')],- projects: [{ id: 'p1', name: 'lampOS', ownerId: 'owner', leadConversationId: 'lead-p1', visibility: 'public', members: [], updateMinutes: 5 }],+ // Its Engineer is crew, and its PM confirmed the newest note for PMs: neither wakes it here (processNotes.ts, task #3581).+ agents: [agent('lead'), { ...agent('eng'), crew: { role: 'Engineer', at: 0, by: 'owner' } }],+ projects: [{ id: 'p1', name: 'lampOS', ownerId: 'owner', leadConversationId: 'lead-p1', visibility: 'public', members: [], updateMinutes: 5,+ processNote: { confirmed: latestProcessNote()!.id } }],conversations: [{ ...task(0, null), id: 'lead-p1', number: undefined, title: 'Lead' }, ...groups],} as SuperTabState}diff --git a/backend/src/superTabs/pmSchedule.ts b/backend/src/superTabs/pmSchedule.tsindex 21c6eb45e..fddc7a42e 100644--- a/backend/src/superTabs/pmSchedule.ts+++ b/backend/src/superTabs/pmSchedule.ts@@ -5,6 +5,7 @@ import { digestOf, localNow } from './digest.js'import { DEFAULT_TIME_ZONE } from './costs/reflection.js'import { taskLiveness } from './liveness.js'import { archivable } from './tidy.js'+import { processLines, unconfirmedNote } from './processNotes.js'// Every project's coordinator runs the same built-in schedule, woken by the Swarm on its own poll instead of a timer of its// own (Ken, 2026-11-04; docs/plans/2026-11-04-pm-built-in-schedule-design.md): a Codex PM may have no timer, and a restart@@ -113,28 +114,31 @@ export function sweepDue(state: SuperTabState, projectId: string, now: number):/** The jobs a wake carries: the open-task sweep, and what people taught the coordinator since its last wake. The daily tidy* is its own message (tidyRequest). */-export type ScheduleJob = 'sweep' | 'heard'+export type ScheduleJob = 'sweep' | 'heard' | 'process'const JOB_LINES: Record<ScheduleJob, string> = {sweep: '- Open-task sweep: every open task ends with an owner, a question to a person with a default and a time, or a close with its reason; '+ 'then archive the finished groups the Swarm left open (see the built-in PM schedule in your instructions).',heard: '- What people taught you: read only what people sent you since the last wake, and save each correction or lasting rule the '+ 'instructions don\'t have yet, naming who said it.',+ process: '- What changed for PMs: read the note below, work by it, and confirm it (task #3581).',}/** The wake's words: the slot's local time, the jobs due, and that the project's own schedule wins. It names no reread of the* instructions (anh Dee, 11-05, #3387, undoing #3151's 7-9k tokens a wake): the CLI tells the coordinator when they change* (cli swarmInstructionsSkill.ts). */-export function scheduleText(project: SwarmProject, slot: number, jobs: readonly ScheduleJob[] = ['sweep']): string {+export function scheduleText(project: SwarmProject, slot: number, jobs: readonly ScheduleJob[] = ['sweep'], owed: readonly string[] = []): string {const zone = digestOf(project)?.timeZone ?? DEFAULT_TIME_ZONEreturn [`Built-in schedule, ${localNow(zone, slot * SCHEDULE_SLOT_MS).time} (${zone}). This is a scheduled request from the Swarm, not a new task.`,...jobs.map(job => JOB_LINES[job]),+ // What the PM owes about the process (processNotes.ts, task #3581): a note to confirm, a project with no crew.+ ...owed,// Said here too: a CLI older than the built-in section shows its PM only this message.'Skip a job your project\'s instructions schedule on their own clock. Set no timer of your own for this one, and delete one you set before.'].join('\n')}/** What a due wake asks of the coordinator: its slot, its jobs and its message. */-export interface ScheduledWake { slot: number; jobs: ScheduleJob[]; draft: MessageDraft }+export interface ScheduledWake { slot: number; jobs: ScheduleJob[]; draft: MessageDraft; processNote?: string }/** The coordinator's slot and its wake, when a slot is due and a job has something to do: the sweep has a task to settle* (sweepDue), a person wrote to the coordinator since its last wake (parts/commit.ts heardAt on the chat written to: who@@ -152,13 +156,17 @@ export function scheduleRequest(state: SuperTabState, target: Agent, now: number// The chats of its project the poll loaded, each marked where a person wrote to the coordinator (parts/commit.ts).const since = schedule?.heardAt ?? 0const heard = state.conversations.some(c => !c.archived && (c.heardAt ?? 0) > since && (c.id === project.leadConversationId || inProject(c, project.id)))+ // A what-changed note the PM has not confirmed wakes it once (task #3581); after that it rides on the wakes due anyway.+ const note = unconfirmedNote(project)+ const tell = !!note && project.processNote?.told !== note.idconst jobs: ScheduleJob[] = [...sweepDue(state, project.id, now) ? ['sweep' as const] : [],...heard ? ['heard' as const] : [],+ ...tell ? ['process' as const] : [],]if (!jobs.length) return null- return { slot, jobs, draft: { id: scheduleMessageId(state.id, project.id, slot), conversationId: project.leadConversationId,- author: author(state, { kind: 'agent', agentId: target.id, machineOwnerId: target.machineOwnerId }), text: scheduleText(project, slot, jobs),+ return { slot, jobs, ...tell ? { processNote: note!.id } : {}, draft: { id: scheduleMessageId(state.id, project.id, slot), conversationId: project.leadConversationId,+ author: author(state, { kind: 'agent', agentId: target.id, machineOwnerId: target.machineOwnerId }), text: scheduleText(project, slot, jobs, processLines(state, project)),replyTo: null, recipients: [target.id], source: { kind: 'schedule-request', projectId: project.id, slot } } }}@@ -172,6 +180,7 @@ export function recordWake(project: SwarmProject, wake: ScheduledWake, now: numbreturn}project.schedule = { ...before, lastSlot: wake.slot, wakeId, ...wake.jobs.includes('heard') ? { heardAt: now } : {} }+ if (wake.processNote) project.processNote = { ...project.processNote, told: wake.processNote }}/**diff --git a/backend/src/superTabs/processNotes.test.ts b/backend/src/superTabs/processNotes.test.tsnew file mode 100644index 000000000..3b3b039dc--- /dev/null+++ b/backend/src/superTabs/processNotes.test.ts@@ -0,0 +1,161 @@+import { createHash } from 'node:crypto'+import { describe, expect, it } from 'vitest'+import { applyCommand, type Command, type CommandContext } from './commands.js'+import { owedLines } from './inbox.js'+import { createSuperTab, type Actor, type Agent, type Assignment, type Conversation, type SuperTabState } from './model.js'+import { PM_SCHEDULE_TEXT, recordWake, SCHEDULE_SLOT_MS, scheduleRequest } from './pmSchedule.js'+import { latestProcessNote, PROCESS_NOTES } from './processNotes.js'+import { projectPulse } from './pulse.js'++// Task #3581 (anh Dee, 11-06): lamp's PM did not know the Swarm v2 process, and nothing told a running PM that a release changed+// how PMs work. A release that changes the PM's text carries a "what changed" note: each PM is woken once for it, lists it as owed+// until it confirms it, and the board shows a PM that has not. A project with no crew hears so at its PM's wakes and in its inbox.++const T = Date.UTC(2026, 10, 6, 3, 0)+const SLOT = T / SCHEDULE_SLOT_MS+const agent = (id: string, over: Partial<Agent> = {}): Agent => ({ id, name: id, contributorId: 'owner', membershipGeneration: 'g', machineId: 'mac',+ harnessId: `h-${id}`, machineOwnerId: 'owner', configuration: { engine: 'claude', model: 'opus', effort: 'high', contextWindow: null, engineVersion: null }, ...over } as unknown as Agent)+const working: Assignment = { id: 'w', agentId: 'eng', status: 'working', configuration: { engine: 'claude', model: 'opus', effort: 'high', contextWindow: null, engineVersion: null },+ execution: { machineId: 'mac', harnessId: 'h-eng', machineOwnerId: 'owner' }, result: null, progressAt: T }+const task = (id: string, assignment: Assignment | null): Conversation => ({ id, projectId: 'p1', number: 1, title: 'Task', leadId: 'lead', agentIds: ['lead', 'eng'],+ archived: false, brief: 'Do it.', checks: [], assignment, lastMessageSequence: 1, lastActivityAt: new Date(T).toISOString() })++/** One project led by `lead`, its one task worked on (nothing for the sweep), its Engineer crew unless [crew] is false. */+function swarm(crew = true): SuperTabState {+ return {+ version: 1, id: 'tab', name: 'Swarm', ownerId: 'owner', environment: 'prod', paused: false, invitations: [],+ people: [{ id: 'owner', email: '[email protected]', role: 'owner', generation: 'g' }] as SuperTabState['people'],+ agents: [agent('lead'), agent('eng', crew ? { crew: { role: 'Engineer', lane: 'backend', at: T, by: 'owner' } } : {})],+ projects: [{ id: 'p1', name: 'lamp', ownerId: 'owner', leadConversationId: 'lead-p1', visibility: 'public', members: [], updateMinutes: 5 }],+ conversations: [{ ...task('lead-p1', null), number: undefined, title: 'Lead', agentIds: ['lead'] }, task('g1', working)],+ } as SuperTabState+}+const pm = (state: SuperTabState) => state.agents.find(a => a.id === 'lead')!+const project = (state: SuperTabState) => state.projects![0]!+const note = latestProcessNote()!++describe('a release\'s what-changed note for PMs', () => {+ it('pins the built-in PM schedule to the newest note: changing it needs a new note', () => {+ expect(PROCESS_NOTES.length).toBeGreaterThan(0)+ expect(createHash('sha256').update(PM_SCHEDULE_TEXT).digest('hex').slice(0, 12),+ 'the built-in PM schedule changed: add a note for it in processNotes.ts, with this fingerprint').toBe(note.schedule)+ // The first note teaches the Swarm v2 process (Faye's case).+ expect(PROCESS_NOTES[0]!.text).toMatch(/crew\.add/)+ })++ it('never says how the PM answers people: that stays in the built-in PM text alone, which a project can switch (Ken\'s spec)', () => {+ for (const each of PROCESS_NOTES) expect(each.text, each.id).not.toMatch(/answer/i)+ })++ it('wakes a PM once for a note it has not confirmed, and not again for it', () => {+ const state = swarm()+ const first = scheduleRequest(state, pm(state), T)!+ expect(first.jobs).toEqual(['process'])+ expect(first.draft.text).toContain(note.id)+ expect(first.draft.text).toContain(note.text)+ expect(first.draft.text).toContain('process.confirm')+ recordWake(project(state), first, T, first.draft.id)+ expect(scheduleRequest(state, pm(state), T + SCHEDULE_SLOT_MS)).toBeNull()+ })++ it('lists the note as owed at every wake and in the inbox until the PM confirms it, and the board shows it until then', () => {+ const state = swarm()+ const told = scheduleRequest(state, pm(state), T)!+ recordWake(project(state), told, T, told.draft.id)+ // A wake due for the sweep still names the note.+ state.conversations.push(task('g2', null))+ expect(scheduleRequest(state, pm(state), T + SCHEDULE_SLOT_MS)!.draft.text).toContain(note.id)+ expect(owedLines(state, project(state), T).join('\n')).toContain(note.id)+ expect(projectPulse(state, project(state), T).process).toEqual({ noteId: note.id })+ project(state).processNote = { ...project(state).processNote, confirmed: note.id }+ expect(scheduleRequest(state, pm(state), T + 2 * SCHEDULE_SLOT_MS)!.draft.text).not.toContain(note.id)+ expect(owedLines(state, project(state), T).join('\n')).not.toContain(note.id)+ expect(projectPulse(state, project(state), T).process).toBeNull()+ })+})++describe('every note a PM has not confirmed', () => {+ // SecAlder's review: only the newest note reached a PM, so no PM ever saw the crew note once a second note shipped.+ it('reaches a PM that confirmed nothing, in its wake and inbox, and confirming the newest clears them all', () => {+ expect(PROCESS_NOTES.length).toBeGreaterThan(1)+ const state = swarm()+ const wake = scheduleRequest(state, pm(state), T)!+ const inbox = owedLines(state, project(state), T).join('\n')+ for (const each of PROCESS_NOTES) {+ expect(wake.draft.text).toContain(each.text)+ expect(inbox).toContain(each.text)+ }+ expect(projectPulse(state, project(state), T).process).toEqual({ noteId: note.id })+ recordWake(project(state), wake, T, wake.draft.id)+ project(state).processNote = { ...project(state).processNote, confirmed: note.id }+ expect(owedLines(state, project(state), T)).toEqual([])+ })++ it('shows only the notes after the one it confirmed', () => {+ const state = swarm()+ project(state).processNote = { confirmed: PROCESS_NOTES[0]!.id }+ const inbox = owedLines(state, project(state), T).join('\n')+ expect(inbox).not.toContain(PROCESS_NOTES[0]!.text)+ expect(inbox).toContain(note.text)+ })++ it('never goes back when a PM confirms an older note after a newer one', () => {+ const f = confirmFixture()+ f.run({ type: 'process.confirm', projectId: f.app.projectId, noteId: note.id }, asAgent(f.pm))+ f.run({ type: 'process.confirm', projectId: f.app.projectId, noteId: PROCESS_NOTES[0]!.id }, asAgent(f.pm))+ expect(f.state.projects!.find(p => p.id === f.app.projectId)!.processNote).toMatchObject({ confirmed: note.id })+ })+})++describe('a project with no crew', () => {+ const confirmed = (crew: boolean) => {+ const state = swarm(crew)+ project(state).processNote = { confirmed: note.id }+ return state+ }++ it('says so in its PM\'s due wake, until an agent is marked crew', () => {+ const state = confirmed(false)+ state.conversations.push(task('g2', null))+ expect(scheduleRequest(state, pm(state), T)!.draft.text).toMatch(/no crew/i)+ const marked = confirmed(true)+ marked.conversations.push(task('g2', null))+ expect(scheduleRequest(marked, pm(marked), T)!.draft.text).not.toMatch(/no crew/i)+ expect(owedLines(marked, project(marked), T)).toEqual([])+ })++ it('wakes nobody for it alone', () => {+ const state = confirmed(false)+ expect(scheduleRequest(state, pm(state), T)).toBeNull()+ })+})++const owner: Extract<Actor, { kind: 'person' }> = { kind: 'person', userId: 'owner', email: '[email protected]' }+const configuration = { engine: 'claude', model: null, effort: null, contextWindow: null, engineVersion: null }+function confirmFixture() {+ let state = createSuperTab('tab', 'Pilot', { id: 'owner', email: owner.email }, 'prod')+ let next = 0+ const run = (command: Command, actor: Actor = owner, context: Partial<CommandContext> = {}) => {+ const effects = applyCommand(state, actor, command, { operationId: `op${next++}`, now: T,+ contribution: { machineOwnerId: 'owner', contributorId: 'owner' }, ...context })+ state = effects.state+ return effects+ }+ const app = run({ type: 'project.create', name: 'App', visibility: 'public', brief: '' }).result as { projectId: string; conversationId: string }+ const add = (harnessId: string, lead: boolean) => run({ type: 'agent.add', conversationId: app.conversationId, harnessId, machineId: 'machine', name: harnessId,+ lead, configuration }).result.agentId as string+ return { run, app, pm: add('pm', true), worker: add('worker', false), get state() { return state } }+}+const asAgent = (agentId: string): Actor => ({ kind: 'agent', agentId, machineOwnerId: 'owner' })++describe('process.confirm', () => {+ it('records the PM\'s confirmation of a note, and refuses an unknown note or another agent', () => {+ const f = confirmFixture()+ expect(() => f.run({ type: 'process.confirm', projectId: f.app.projectId, noteId: 'no-such-note' }, asAgent(f.pm)))+ .toThrow(expect.objectContaining({ code: 'INVALID_NOTE' }))+ expect(() => f.run({ type: 'process.confirm', projectId: f.app.projectId, noteId: note.id }, asAgent(f.worker)))+ .toThrow(expect.objectContaining({ code: 'FORBIDDEN' }))+ f.run({ type: 'process.confirm', projectId: f.app.projectId, noteId: note.id }, asAgent(f.pm))+ expect(f.state.projects!.find(p => p.id === f.app.projectId)!.processNote).toMatchObject({ confirmed: note.id })+ })+})diff --git a/backend/src/superTabs/processNotes.ts b/backend/src/superTabs/processNotes.tsnew file mode 100644index 000000000..2af6d5a4c--- /dev/null+++ b/backend/src/superTabs/processNotes.ts@@ -0,0 +1,68 @@+/**+ * What changed for PMs (task #3581, anh Dee 11-06: lamp's PM did not know the Swarm v2 process, and nothing told a running PM+ * that a release changed how PMs work). A release that changes the coordinator's tool sheet (cli lib/swarmToolSheets.ts, which+ * pins the note it was announced with) or the built-in PM schedule (pmSchedule.ts PM_SCHEDULE_TEXT, pinned by `schedule`)+ * adds a note here, newest last. Each project's PM is woken once for the newest note it has not confirmed, and its wakes and+ * inbox list every note it has not confirmed as owed until it confirms the newest with `process.confirm`; the board's pulse names it until then (pulse.ts).+ */+import type { SuperTabState } from './model.js'+import { agentProjectId, type SwarmProject } from './projects.js'++/** One note: its id, its words for the PM, and the built-in schedule's fingerprint when it was written. */+export interface ProcessNote { id: string; text: string; schedule: string }++export const PROCESS_NOTES: readonly ProcessNote[] = [+ {+ id: '2026-11-06-crew',+ text: 'Swarm v2: mark your project\'s standing crew once (crew.add with a role and a lane: backend, cli, desktop, mobile or docs), '+ + 'and give each task a lane (work.lane): the Swarm hands a free crew member its lane\'s next task by itself. Start a new agent only '+ + 'to replace a broken one. Your tool sheet says it; '+ + '`harness super-tab help tools` has every rule.',+ schedule: '058d05641d40',+ },+ {+ id: '2026-11-06-v2-text',+ text: 'Your built-in PM text now opens with the Swarm v2 process, which replaces every process line in your project\'s instructions: '+ + 'they keep only your project\'s own facts. Review and test steps open by themselves when a pull request is ready; don\'t open them by '+ + 'hand. Lost, stalled and idle notices are information: the Swarm hands lost work on, nudges stalled workers and stops idle Engineers '+ + 'by itself, so don\'t repeat those by hand. A rule a program can check belongs in code, not in your instructions.',+ schedule: '52cb6172d956',+ },+]++export const latestProcessNote = (): ProcessNote | undefined => PROCESS_NOTES.at(-1)++/** Every note after the newest one [project]'s PM confirmed, oldest first: all of them when it confirmed none (SecAlder's review:+ * a PM that missed a note still reads it when the next one ships). Confirming the newest clears them all. */+export function unconfirmedNotes(project: Pick<SwarmProject, 'processNote'>): ProcessNote[] {+ return PROCESS_NOTES.slice(noteIndex(project.processNote?.confirmed) + 1)+}++/** The newest note [project]'s PM has not confirmed, or null: the one a wake is for and the board names. */+export const unconfirmedNote = (project: Pick<SwarmProject, 'processNote'>): ProcessNote | null => unconfirmedNotes(project).at(-1) ?? null++/** [id]'s place in PROCESS_NOTES, or -1 for none or an unknown one. */+export const noteIndex = (id: string | undefined): number => PROCESS_NOTES.findIndex(note => note.id === id)++/** Whether [project] has an agent marked crew (crew.ts). */+export const hasCrew = (state: SuperTabState, project: SwarmProject): boolean =>+ state.agents.some(a => !!a.crew && agentProjectId(state, a) === project.id)++/** The what-changed notes [project]'s PM owes, oldest first, for its wakes and its inbox (inbox.ts owedLines), until it confirms it. */+export function noteLines(project: SwarmProject): string[] {+ const notes = unconfirmedNotes(project)+ const newest = notes.at(-1)+ if (!newest) return []+ return [...notes.map(note => `What changed for PMs (note ${note.id}): ${note.text}`),+ `Confirm you read ${notes.length > 1 ? 'them' : 'it'}: command process.confirm {"projectId":"${project.id}","noteId":"${newest.id}"}.`]+}++/** What [project]'s PM hears at each wake about the process (pmSchedule.ts): its unconfirmed notes, and, while the project has no+ * crew, that it has none (the brief: "at its next wake until it marks one"). Neither wakes the PM by itself but the note's+ * first time. */+export function processLines(state: SuperTabState, project: SwarmProject): string[] {+ return [+ ...noteLines(project),+ ...hasCrew(state, project) ? [] : ['No crew yet in this project: mark its standing agents once with crew.add {agentId, role, lane}. Until then this line comes with every wake.'],+ ]+}diff --git a/backend/src/superTabs/projects.ts b/backend/src/superTabs/projects.tsindex b2de5726e..e5f3d0383 100644--- a/backend/src/superTabs/projects.ts+++ b/backend/src/superTabs/projects.ts@@ -56,6 +56,8 @@ export interface SwarmProject {* the daily tidy was last asked, and the instructions revision its last save made; `tidyPending`: asked, and no save has* followed yet (pmSchedule.ts tidyRequest; tasks #3022, #3151). */schedule?: { lastSlot: number; wakeId?: string; heardAt?: number; tidiedOn?: string; tidiedRevision?: number; tidyPending?: boolean }+ /** The what-changed note for PMs (processNotes.ts, task #3581) its PM was last woken for, and the newest it confirmed. */+ processNote?: { told?: string; confirmed?: string }/** The oldest message a person sent its PM in the last day that the PM has not answered, and when it was sent, as the worker's* time checks last found it (timeChecks.ts owedAsk); absent when it owes none. Its PM's host restarts a PM that hangs while it* owes one (task #3385). Readers never get it: it may name a message in a person's private chat with the PM. */diff --git a/backend/src/superTabs/pulse.ts b/backend/src/superTabs/pulse.tsindex 978f192b3..9bd786a2a 100644--- a/backend/src/superTabs/pulse.ts+++ b/backend/src/superTabs/pulse.ts@@ -11,6 +11,7 @@ import { isBuddy, isBuddyChat } from './buddies.js'import { heldView, type HeldReason } from './heldReason.js'import { isLeads, type Author, type Conversation, type SuperTabState } from './model.js'import { agentProjectId, groupProject, type SwarmProject } from './projects.js'+import { unconfirmedNote } from './processNotes.js'/** One person's message to the PM not settled yet: its id, who wrote it, when, and the root of the thread it is in (its own* id for a top-level message). */@@ -99,6 +100,8 @@ export interface Pulse {lost: { count: number; since: number | null; conversationIds: string[] }held: { count: number; withoutReason: number; list: Array<{ conversationId: string; reason: string | null }> }idleSince: number | null+ /** The what-changed note for PMs its PM has not confirmed (processNotes.ts, task #3581), so the board shows who has not. */+ process: { noteId: string } | nullredAt: { asks: number | null; idle: number | null; lost: number | null; held: number | null }limits: PulseLimits}@@ -252,6 +255,7 @@ export function projectPulse(state: SuperTabState, project: SwarmProject, now: nlost: { count: counts.lost.length, since: lostAt, conversationIds: counts.lost.map(l => l.id).slice(0, PULSE_LIST_MAX) },held: { count: counts.held.length, withoutReason, list: counts.held.slice(0, PULSE_LIST_MAX) },idleSince,+ process: (note => note ? { noteId: note.id } : null)(unconfirmedNote(project)),redAt: {asks: oldest ? oldest.at + limits.askMinutes * MINUTE : null,idle: idleSince === null ? null : idleSince + limits.idleMinutes * MINUTE,diff --git a/cli/src/lib/swarmToolSheets.spec.ts b/cli/src/lib/swarmToolSheets.spec.tsindex dc0142a0f..70c55d591 100644--- a/cli/src/lib/swarmToolSheets.spec.ts+++ b/cli/src/lib/swarmToolSheets.spec.ts@@ -1,6 +1,9 @@import { describe, expect, it } from 'vitest'import { SWARM_TOOLS_SKILL } from './swarmTools.js'-import { manualBlocks, sheetEntries, sourceFingerprints, staleSheetEntries, swarmToolsSheet, TOOLS_ROLES, toolsRoleFor, type ToolsRole } from './swarmToolSheets.js'+import { createHash } from 'node:crypto'+import { readFileSync } from 'node:fs'+import { fileURLToPath } from 'node:url'+import { manualBlocks, PM_SHEET_NOTE, sheetEntries, sourceFingerprints, staleSheetEntries, swarmToolsSheet, TOOLS_ROLES, toolsRoleFor, type ToolsRole } from './swarmToolSheets.js'const bytes = (text: string) => Buffer.byteLength(text, 'utf8')const sheet = (role: ToolsRole) => swarmToolsSheet(role)@@ -23,6 +26,25 @@ describe('the role tools sheets', () => {}})+ // Task #3581 (anh Dee, 11-06): lamp's PM did not know the Swarm v2 process. Its sheet says how the crew works.+ it('explains, in the PM sheet, the crew, lanes and when to start an agent', () => {+ const pm = sheet('pm')+ for (const word of ['crew.add', 'role', 'lane', 'backend, cli, desktop, mobile, docs', 'work.lane', 'only to replace a broken one', 'process.confirm']) {+ expect(pm, word).toContain(word)+ }+ // Ken's spec (River, 11-06): how the PM answers people stays in one place, the built-in PM text, so a project can switch it.+ expect(pm.split('\n').find(line => line.includes('crew.add'))).not.toMatch(/answer/i)+ })++ // Task #3581: a release that changes the PM's sheet carries a what-changed note, which reaches each PM (backend+ // superTabs/processNotes.ts). The sheet is pinned to the note it was last announced with.+ it('pins the PM sheet to a what-changed note the backend sends: changing it needs a new note', () => {+ expect(createHash('sha256').update(sheet('pm')).digest('hex').slice(0, 12),+ 'the PM sheet changed: add a what-changed note in backend/src/superTabs/processNotes.ts and pin it in PM_SHEET_NOTE').toBe(PM_SHEET_NOTE.sheet)+ const notes = readFileSync(fileURLToPath(new URL('../../../backend/src/superTabs/processNotes.ts', import.meta.url)), 'utf8')+ expect(notes).toContain(`id: '${PM_SHEET_NOTE.id}'`)+ })+it('holds, in each other sheet, the commands that role uses', () => {const common = ['`mine`', '`task GROUP`', '`messages GROUP', '`instructions [PROJECT]`', '`post GROUP TEXT OPERATION_ID', '`react GROUP', '`command OPERATION_ID', 'work.status', 'help tools']const more: Record<Exclude<ToolsRole, 'pm'>, string[]> = {diff --git a/cli/src/lib/swarmToolSheets.ts b/cli/src/lib/swarmToolSheets.tsindex af54adfb5..7571c1a21 100644--- a/cli/src/lib/swarmToolSheets.ts+++ b/cli/src/lib/swarmToolSheets.ts@@ -111,6 +111,8 @@ const ENTRIES: readonly SheetEntry[] = [OFF('- A save posts nothing', 'pm'),T('- Add a note:', '`note.add` {projectId, text up to 300, askedBy, expiresAt} adds a note.', 'pm', 'p'),T('- Remove a note:', '`note.remove` {projectId, noteId} removes one.', 'pm', 'p'),+ T('- `crew.add` {agentId, role, lane}', 'A crew: `crew.add` {agentId, role, lane} marks a standing member, `crew.remove` unmarks it; `work.lane` gives a task its lane; a free member takes its lane\'s next task.', 'pm', 'pe',+ 'Crew: mark it once, `crew.add` {agentId, role, lane: backend, cli, desktop, mobile, docs}; `work.lane` sets a task\'s lane and a free member takes it. Start an agent only to replace a broken one. Confirm change notes: `process.confirm` {projectId, noteId}.'),T('- `route GROUP JSON', "`route GROUP JSON [--instructions-read REVISION]` lists who could do a group's work (JSON: difficulty, risk, size, why, kind); choose by the project's Routing.", 'pm', 'pe', "`route GROUP JSON [--instructions-read REVISION]` lists who could do a group's work: choose by the project's Routing, then `start OPERATION_ID JSON` (or `work.assign`) with its `routeDecisionId` and `overrideReason`; `resume START_ID` finishes an interrupted start. Also `plan` and `capacity MACHINE_ID JSON`. A step is a conversation with `reviewOf` and `step`; a `review` status wakes nobody, so name the reviewer with `--to`."),T('- Start or assign the candidate', 'Start or assign the candidate you chose with its `routeDecisionId` and `overrideReason` (the Routing rule).', 'pm', 'pe'),T('- `plan [JSON]`', '`plan [JSON]` places all open groups at once; it records nothing.', 'pm', 'p'),@@ -143,6 +145,11 @@ const ENTRIES: readonly SheetEntry[] = []export const sheetEntries = (): readonly SheetEntry[] => ENTRIES+/** The what-changed note for PMs the PM sheet was last announced with (backend superTabs/processNotes.ts, task #3581), and the+ * sheet's fingerprint then. A change to the PM sheet fails swarmToolSheets.spec.ts until a new note is added there and pinned+ * here, so every running PM hears what changed. */+export const PM_SHEET_NOTE = { id: '2026-11-06-crew', sheet: 'eaa55bffc189' } as const+/** The role a session's sheet is for: the coordinator is the PM; an agent by its project role's name (anything unknown is an* Engineer, whose sheet points to the full manual); a Reviewer started as the fallback role is a Reviewer. */export function toolsRoleFor(session: { coordinator: boolean; roleName?: string; fallback?: 'review' }): ToolsRole {@@ -235,11 +242,12 @@ const SOURCE: Readonly<Record<string, string>> = {"- A save posts nothing": "d30094543de2","- Add a note:": "ad47f2948532","- Remove a note:": "5b4559ffdc63",- "- `route GROUP JSON": "17d4d4580934",+ "- `crew.add` {agentId, role, lane}": "59256edcb9ee",+ "- `route GROUP JSON": "ad94a41a6bc6","- Start or assign the candidate": "cfc6e51b5d31","- `plan [JSON]`": "ba5881b0781b","- `capacity MACHINE_ID": "06721cd15ba5",- "- `start OPERATION_ID JSON`": "f5f512a4d50b",+ "- `start OPERATION_ID JSON`": "bf3a34fc714a","- Add a step to a task": "d42101a501d5","- Any group created with `reviewOf`": "995b60db37d8","- A group opened for a person's request": "b3c7b277a521",diff --git a/cli/src/lib/swarmTools.ts b/cli/src/lib/swarmTools.tsindex 0551f9f28..cdf40d324 100644--- a/cli/src/lib/swarmTools.ts+++ b/cli/src/lib/swarmTools.ts@@ -88,22 +88,25 @@ Swarm and machine settings (each refused unless you may change that setting; a p- Add a note: \`{"type":"note.add","projectId":"PROJECT","text":"up to 300 characters","askedBy":"PERSON","expiresAt":"optional ISO time"}\`. Only the project's coordinator adds one; anyone else tells the coordinator what to note. A note is a small thing a member told the coordinator, kept beside the instructions until it ends. A project keeps at most 100; remove one (or write what lasts into the instructions) when it is full.- Remove a note: \`{"type":"note.remove","projectId":"PROJECT","noteId":"NOTE"}\` (each note's id is in the \`instructions\` output): the coordinator, or a person who reads the project. An expired note is already gone.+## Crew and lanes+- \`crew.add\` {agentId, role, lane} marks a crew member (lanes backend, cli, desktop, mobile, docs; \`crew.remove\` unmarks it): the Swarm keeps it alive and hands it its lane's next task. \`work.lane\` {conversationId, lane} sets a task's lane. Mark the crew once; start a new agent only to replace a broken one. Confirm each "what changed" note: \`process.confirm\` {projectId, noteId}.+## Route and start- \`route GROUP JSON [--full-instructions] [--instructions-read REVISION]\` lists who could do a group's work, before you start an agent or assign it. Work you do yourself is not routed. JSON: \`{"difficulty":"low|medium|high","risk":"low|medium|high","size":"small|medium|large","why":"one sentence","kind":"${ROUTE_KIND_HELP}","local":true,"model":"optional","needs":{"tools":[],"devices":[],"cwd":"/absolute/repo"}}\`.- size is how long the work runs: small about 20 minutes, medium about an hour, large about three hours.- - \`local\` only when a person asked for a local model. When a person names a model, set \`model\` to their words ("deepseek 4.1 flash"): the route then offers that model alone, unrated when the catalog does not list it.- - It leaves out what cannot run (a machine offline, paused or full, an engine signed out or suspended, tools or devices the work needs, a machine that cannot take a teammate's project), and says why.+ - \`local\` only when a person asks for a local model. A model a person names goes in \`model\` in their words ("deepseek 4.1 flash"): the route offers it alone, unrated when the catalog lacks it.+ - It leaves out, and says why, what cannot run: a machine offline, paused or full, an engine signed out or suspended, missing tools or devices, a machine that cannot take a teammate's project.- ${CHEAP_FIRST_HELP}- - Its answer is short: the instructions' Routing section and revision; the whole text with \`--full-instructions\`; only the revision with \`--instructions-read REVISION\` (the revision you read) while that is still current, so pass it on every route after you read them.- - It ranks nothing and names no pick: the rest come by machine name, then engine. \`candidates\` is keyed by each machine's line (its name, \`machineId\`, agents, and \`cwd\` where it differs from the answer's \`cwd\`), each holding one line per candidate: its id, new or the member (agent id, idle or working), engine model effort, quota fit as "fits 62% · resets 5d", and its notes, each cut to a short clause. What else it knows is a note on the candidate: a used-up quota, a lost task, a machine whose last starts failed, a task requirement naming another machine, a model not offered by default, an account a project's PM runs on (which PM), a plug-in's finding. The first row is first by its machine's name, not by merit: choose by your project's Routing instructions.- - A candidate on a model served on the Swarm's grid starts with the \`gridModel\` and \`gridName\` its row gives, in place of model and effort.+ - It answers with the instructions' Routing section and revision; \`--full-instructions\` gives the whole text, and \`--instructions-read REVISION\` (the one you read) only the revision while current, so pass it after reading them.+ - It ranks nothing and names no pick: the rest come by machine name, then engine. \`candidates\` is keyed by each machine's line (name, \`machineId\`, agents, \`cwd\` where it differs), one line per candidate: id, new or the member (agent id, idle or working), engine model effort, quota fit ("fits 62% · resets 5d") and short notes (used-up quota, lost task, failing starts, another machine required, model not offered by default, a PM's account, a plug-in's finding). The first row is first by machine name, not merit: choose by your project's Routing instructions.+ - A candidate on a model of the Swarm's grid starts with its row's \`gridModel\` and \`gridName\` in place of model and effort.- Start or assign the candidate you chose with the decision's \`routeDecisionId\` and \`overrideReason\`: the Routing rule that chose it, in one sentence. The decision records the candidate the start or assignment matches.- \`plan [JSON]\` places all open groups at once on machines and models (needs Python 3 and OR-Tools; without them it says how to install). JSON optional: \`{"groups":{"GROUP":{"difficulty":"...","risk":"...","size":"...","kind":"optional","after":["GROUP"]}}}\`. It records nothing: route each group, then start the plan's pick with the route's \`routeDecisionId\`.- \`capacity MACHINE_ID JSON\` inspects a machine's, engine's and quota headroom (JSON: the start fields). Unknown allowances are not reported as free tokens.- \`start OPERATION_ID JSON\` creates one agent in a conversation on a machine in the Swarm's Machines list; it does not assign work. JSON:\`{"conversationId":"GROUP","machineId":"MACHINE","engine":"codex","name":"AGENT NAME","cwd":"/absolute/repo/on/that/machine","worktree":true,"branchRef":"refs/remotes/origin/BASE_BRANCH","model":"opus","effort":"high","routeDecisionId":"DECISION","roleName":"optional"}\`- \`worktree: true\` starts from the repository's default branch, fetched first; \`branchRef\` (refs/heads/BRANCH, or refs/remotes/origin/BRANCH to fetch it first) starts from another branch, such as the one the work builds on.- - \`roleName\` is optional: the role the agent starts in, free text taken from the project's instructions, up to 40 characters. An older Swarm refuses the key: start again without it.+ - \`roleName\` (optional): the role it starts in, from the project's instructions, up to 40 characters. An older Swarm refuses the key: start again without it.- Start only on the Swarm's listed machines; to use another, a person adds it first. \`resume START_ID\` finishes a pending start without creating another agent; repeat \`start\` with the same id after an interruption. Two failed starts in a row suspend the engine on that machine; the route says so.- A start that fails is reported (\`START_FAILED\`, with why) and moved nowhere: you decide what next, and the project's coordinator is told too.- Starts can be refused when too many starts are pending.diff --git a/docs/plans/2026-11-06-pm-learns-process-plan.md b/docs/plans/2026-11-06-pm-learns-process-plan.mdnew file mode 100644index 000000000..d7d1b18c3--- /dev/null+++ b/docs/plans/2026-11-06-pm-learns-process-plan.md@@ -0,0 +1,83 @@+# Every PM learns the current process (task #3581)++> Implemented by its Engineer test first, by superpowers:test-driven-development, as the project's instructions say+> (Engineer role). No subagent-driven-development and no execution handoff.++**Goal:** lamp's PM (Faye) did not know the Swarm v2 process (anh Dee, 11-06). Every project's PM learns it from its own+tools, hears once when a release changes how PMs work and confirms it, and is told while its project has no crew.++**As built:** the no-crew line rides on the PM's wakes only, as the brief says ("at its next wake until it marks one"),+not on every inbox digest; the what-changed note is in both until confirmed. To fit the manual's 24 KB, the route and+start blocks say the same in fewer words, and the manual has 2 bytes left: the next addition needs a trim or a new cap.+After SecAlder's review, a PM's wakes and inbox list every note after the newest it confirmed (oldest first), not only the+newest, and confirming the newest clears them all; confirming an older note after a newer one never brings the newer back.++**Architecture:**+1. The manual (cli/src/lib/swarmTools.ts) gains a "Crew and lanes" section, carried by the coordinator's sheet+ (swarmToolSheets.ts) in one line: mark a standing crew once (`crew.add` with role and lane), give each task a lane+ (`work.lane`), start a new agent only to replace a broken one, answer each person's message once in its place+ (`answer`), confirm each what-changed note (`process.confirm`).+2. What changed for PMs is a list of notes in the backend (backend/src/superTabs/processNotes.ts), newest last. The newest+ note pins fingerprints of the PM sheet and of the built-in PM schedule (pmSchedule.ts PM_SCHEDULE_TEXT): a test fails in+ the CLI when the PM sheet changes, and in the backend when the schedule changes, until a note is added for it. A project+ whose PM has not confirmed the newest note is woken once for it (a `process` job in the schedule's wake), and every+ wake and inbox after lists it as owed until the PM sends `process.confirm`. The board's pulse names the note a project's+ PM has not confirmed.+3. A project with no agent marked crew: its PM's wake and inbox say so, until it marks one. That line never wakes the PM+ by itself.++**Tech Stack:** TypeScript, vitest (backend), the CLI's spec runner.++**Spec:** task #3581's brief (River, 11-06).++## Global Constraints++- The PM sheet stays within its 3 KB (swarmToolSheets.spec.ts); the manual keeps one row per block.+- A note wakes a PM once; the crew line rides on wakes already due, so an idle project is never woken every 30 minutes.+- Swarm code stays out of cli/src/core.++## Design++- growth: one small record per project (`processNote`: the note it was told and the one it confirmed); notes are code.+- concurrency: written in the PM poll's own write (recordWake) and in the `process.confirm` command, as the schedule is.+- read cost: none; the wake already reads the project and its agents.+- scale: one wake per project per note; at 10x projects the wake count per release grows linearly, the first warning.+- compatibility: an older CLI ignores the wake's extra lines' meaning but shows them; an older backend ignores the record.+- migration + rollback: none; a project with no record has confirmed nothing and is told the newest note once.+- audience: only the project's PM confirms its note; the pulse shows only a note id, which names no person.+- identity: the PM by its agent id, never a login.+- failure: an unknown note id is refused; nothing else is.+- platforms: server and CLI text only.++## Review Focus++- A PM is woken once per note, never every poll; confirming ends the owed line and the pulse entry.+- The fingerprint tests fail when PM text changes without a note.++## Tasks++### Task 1: the coordinator's sheet explains the crew++**Files:** cli/src/lib/swarmTools.ts, swarmToolSheets.ts, swarmToolSheets.spec.ts.++- [ ] Failing test: the PM sheet names crew.add with role and lane, work.lane, starting an agent only to replace a broken+ one, answering once in place, and process.confirm; it stays within 3 KB.+- [ ] Code.++### Task 2: a release's what-changed note reaches each PM once, owed until confirmed++**Files:** backend/src/superTabs/processNotes.ts (new), pmSchedule.ts, inbox.ts, pulse.ts, commands.ts, model/projects+types; cli/src/lib/swarmToolSheets.ts (the sheet's pinned note).++- [ ] Failing tests: a PM that has not confirmed the newest note gets one wake naming it, not a second; its wakes and+ inbox list it as owed until `process.confirm`; the pulse names it until then; the schedule's and the sheet's+ fingerprints match the newest note.+- [ ] Code.++### Task 3: a project without a crew says so in its PM's inbox++**Files:** pmSchedule.ts, inbox.ts.++- [ ] Failing test: with no crew, a due wake and the inbox say so; once an agent is marked crew they don't; the line+ alone wakes nobody.+- [ ] Code.