Skip to content

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.

Merge batch 11-05 i1225: #3066 #3083 (#3089)

0xken150884f16a8919
diff --git a/backend/integration/superTabs.test.ts b/backend/integration/superTabs.test.ts
index c59a12f14..0bbb33939 100644
--- a/backend/integration/superTabs.test.ts
+++ b/backend/integration/superTabs.test.ts
@@ -23,6 +23,7 @@ import { IGNORED_NOTE, type Command } from '../src/superTabs/commands.js'
import { nextMachineShareGrants } from '../src/lib/machineSharePolicy.js'
import { DEFAULT_ROUTING_POLICY } from '../src/superTabs/routingPolicy.js'
import { stableId, type Agent, type SuperTabState } from '../src/superTabs/model.js'
+import { agentDisplayName } from '../src/superTabs/agentNames.js'
import { roleVersion } from '../src/superTabs/projects.js'
import { ensureTerminalExpiry, TERMINAL_EXPIRY_MS } from '../src/superTabs/terminal.js'
import { ensureMentionExpiry, MENTION_EXPIRY_MS, swarmsWithTags } from '../src/superTabs/mentions.js'
@@ -49,9 +50,19 @@ const host: AuthUser = { sub: '100000000000000000000003', email: '[email protected]
const config = { engine: 'codex', model: 'fixture-model', effort: 'high', contextWindow: 200000, engineVersion: 'fixture' }
const run = (tab: string, command: Command, user = owner, asAgentId?: string, operationId = randomUUID()) =>
store.execute(user, tab, { operationId, command }, asAgentId)
-async function fixture() {
+/** A harness id for the fixture's Lead whose member name is (or is not) `name`. A Lead called "Lead" is given a member name
+ * from agentNames.ts by its id alone, so a random id gives it any of 32 names; a test that adds a harness by one of those
+ * names fails about one run in 32 when the Lead drew it first (task #3078). */
+const leadHarness = (name: string, named = true) => {
+ for (;;) {
+ const harnessId = randomUUID()
+ const id = stableId('test-host', harnessId)
+ if ((agentDisplayName([{ id, name: 'Lead' }], id) === name) === named) return harnessId
+ }
+}
+async function fixture(leadHarnessId = randomUUID()) {
const tab = (await store.create(owner, randomUUID(), 'Pilot')).id
- const lead = (await run(tab, { type: 'agent.add', conversationId: 'lead', machineId: 'test-host', harnessId: randomUUID(),
+ const lead = (await run(tab, { type: 'agent.add', conversationId: 'lead', machineId: 'test-host', harnessId: leadHarnessId,
name: 'Lead', configuration: config, lead: true })).result.agentId as string
return { tab, lead }
}
@@ -2209,7 +2220,8 @@ describe('Super Tabs on a real Mongo replica set', () => {
// Tony, 2026-11-03 (#2458): New Harness from a project chat records the person's first message beside the row naming who
// added the harness. Both took the operation id, so the join answered 500 and the harness never joined.
it('joins a harness started from the project chat with a first message, through the HTTP API', async () => {
- const { tab } = await fixture()
+ // Not a Lead whose member name is already "Kai": that one is taken, so the harness would join under another (task #3078).
+ const { tab } = await fixture(leadHarness('Kai', false))
const headers = { authorization: `Bearer ${owner.sub}` }
const operationId = randomUUID()
const join = () => app.inject({ method: 'POST', url: `/api/super-tabs/${tab}/commands`, headers,
@@ -2234,6 +2246,26 @@ describe('Super Tabs on a real Mongo replica set', () => {
expect(after.filter(m => m.text === 'Hi New PM Personal')).toHaveLength(1)
})
+ // Task #3078: the test above failed about one run in 32 (CI runs 41962752144 and 41966667786). The Lead's member name is
+ // drawn from 32 by its id, and a harness added under a name another member holds joins under a different one.
+ it('joins a harness under another member name when the Lead already holds the one it asked for', async () => {
+ const { tab, lead } = await fixture(leadHarness('Kai'))
+ const headers = { authorization: `Bearer ${owner.sub}` }
+ expect((await storedState(tab)).agents.find(a => a.id === lead)?.displayName).toBe('Kai')
+ const joined = await app.inject({ method: 'POST', url: `/api/super-tabs/${tab}/commands`, headers,
+ payload: { operationId: randomUUID(), command: { type: 'agent.add', conversationId: 'lead', machineId: 'test-host', harnessId: 'new-pm-personal',
+ name: 'Kai', configuration: config, lead: false, initialMessage: 'Hi New PM Personal' } } })
+ expect(joined.statusCode, joined.body).toBe(200)
+ const agents = (await storedState(tab)).agents
+ const added = agents.find(a => a.id === joined.json().data.result.agentId)!
+ expect(added.displayName).not.toBe('Kai')
+ expect(agents.find(a => a.id === lead)?.displayName).toBe('Kai')
+ // The row names the harness as it is shown, not the name it asked for.
+ const rows = (await app.inject({ url: `/api/super-tabs/${tab}/conversations/lead/messages`, headers })).json().data.messages as Array<{ text: string }>
+ expect(rows.some(m => m.text.startsWith(`owner added "${added.displayName}" to the project.`))).toBe(true)
+ expect(rows.some(m => m.text.includes('added "Kai" to the project.'))).toBe(false)
+ })
+
it('joins a Product Manager with a first message and a launch-refused note, through the HTTP API', async () => {
const tab = (await store.create(owner, randomUUID(), 'Personal')).id
const headers = { authorization: `Bearer ${owner.sub}` }
diff --git a/backend/src/superTabs/commands.test.ts b/backend/src/superTabs/commands.test.ts
index 81b538ee9..48f812d39 100644
--- a/backend/src/superTabs/commands.test.ts
+++ b/backend/src/superTabs/commands.test.ts
@@ -5353,6 +5353,29 @@ describe('lead.switch', () => {
expect(code(() => missing.f.run(missing.request))).toBe('ENGINE_NOT_OFFERED')
})
+ // Task #3022 (Ken, 11-05): a PM runs at high effort or above, whoever moves it.
+ it('refuses an effort below high, and asks for high when a model is named with none', () => {
+ for (const effort of ['medium', 'low', 'minimal']) {
+ const s = setup()
+ expect(code(() => s.f.run({ ...s.request, model: 'gpt-6-astra', effort }))).toBe('EFFORT_TOO_LOW')
+ expect(s.agent().switchRequest).toBeUndefined()
+ }
+ const named = setup()
+ named.f.run({ ...named.request, model: 'gpt-6-astra' })
+ expect(named.agent().switchRequest).toMatchObject({ model: 'gpt-6-astra', effort: 'high' })
+ const xhigh = setup()
+ xhigh.f.run({ ...xhigh.request, model: 'gpt-6-astra', effort: 'xhigh' })
+ expect(xhigh.agent().switchRequest).toMatchObject({ effort: 'xhigh' })
+ // Review of #3066, 3: Claude Opus named with no effort keeps the coordinator's own default, as its start does.
+ const opus = setup()
+ opus.f.run({ ...opus.request, engine: 'claude', profileId: 'default', model: 'opus' })
+ expect(opus.agent().switchRequest).toMatchObject({ model: 'opus', effort: 'xhigh' })
+ // No model named: the engine's own model and effort, as before.
+ const own = setup()
+ own.f.run(own.request)
+ expect(own.agent().switchRequest).not.toHaveProperty('effort')
+ })
+
it('works while the Swarm is paused', () => {
const s = setup()
s.f.state.paused = true
diff --git a/backend/src/superTabs/commands.ts b/backend/src/superTabs/commands.ts
index 024bbb458..08ad693e8 100644
--- a/backend/src/superTabs/commands.ts
+++ b/backend/src/superTabs/commands.ts
@@ -54,7 +54,7 @@ import { BUDDY_SESSION_CAPABILITY, chatOwner, endSessionEntry, entryProject, liv
import { BUDDY_REQUIREMENTS, buddyChatId, buddyReady, chosenBuddyName, isBuddy, isBuddyChat, isSwarmBuddy, isSwarmBuddyChat, MAX_PROPOSAL_ASKS, MAX_PROPOSAL_ATTACHMENTS, okayedWords, openBuddyChat, openSwarmBuddyChat, PM_LINE_KIND, PROPOSAL_ASK_MS, PROPOSAL_SENT_KIND, proposalBrief, proposalSentText, renameBuddy, requireBuddyCommand, swarmBuddyChatId } from './buddies.js'
import { BUDDY_OWN_MACHINE_REFUSAL } from './buddyContract.js'
import { askBuddyModel, buddyModelResult, sendBuddyHome, sessionModel } from './buddyModel.js'
-import { launchRefusedLine, leadArrived, LEAD_CLAIM_MS, leadJoined, leadOvertaken, leadStartFailed, leadStarting, leadHost, leadWaits, LEAD_CAPABILITY, placeLead } from './leadStart.js'
+import { launchRefusedLine, leadArrived, LEAD_CLAIM_MS, leadEffort, leadJoined, leadOvertaken, leadStartFailed, leadStarting, leadHost, leadWaits, LEAD_CAPABILITY, placeLead } from './leadStart.js'
import { appendRouting, coordinatorNameOf, routingSummary, FIRST_INSTRUCTIONS, FIRST_SUMMARY, instructionsHash, instructionsTextSchema, legacyRoleName, liveNotes, MAX_NOTES, noteTextSchema, roleNameSchema, summarySchema, type PmNote } from './instructions.js'
import { INSTRUCTIONS_TEMPLATE } from './instructionsTemplate.js'
import { instructionsChange } from './instructionsDiff.js'
@@ -1637,7 +1637,7 @@ function applyCommandOnce(original: SuperTabState, actor: Actor, input: Command,
if (!machineId) fail('MACHINE_REQUIRED', `Choose the machine the ${name} runs on.`, 400)
// Its person named no model: the coordinator's built-in default for this engine (Claude Opus 5.5 at xhigh), since the
// project's instructions cannot choose a model before any agent reads them (project instructions, design call).
- const asked = withRoleDefaults(request, BUILT_IN_ROLE_DEFAULTS.lead)
+ const asked = leadEffort(withRoleDefaults(request, BUILT_IN_ROLE_DEFAULTS.lead), name)
const start = placeLead(state, project, person(state, actor.userId), machineId, asked, operationId, context)
// A branch a Team agent pushed, or GitHub cannot place, never starts a PM in the main account (audit H2).
if (context.pushOrigin && context.pushOrigin !== 'clean' && !teamAccountPool(state.machines?.find(m => m.machineId === start.request.machineId))) failTeamWritten()
@@ -1680,11 +1680,13 @@ function applyCommandOnce(original: SuperTabState, actor: Actor, input: Command,
if (machineOffline(pool, context.now)) fail('MACHINE_OFFLINE', `Wait for a fresh reading from ${pool.name}.`)
if (!pool.observation!.capabilities?.includes(SWITCH_CAPABILITY)) fail('HOST_OUTDATED', `Update Harness on ${pool.name} to move the ${name}.`, 409)
if (pm.switchRequest) fail('LEAD_SWITCHING', `The ${name} is already being moved.`, 409)
+ // At high effort or above (leadStart.ts leadEffort), before anything is placed.
+ const { type: _type, projectId: _projectId, ...asked } = leadEffort(command, name)
let destination = pool
if (command.machineId && command.machineId !== pool.machineId) {
const previousPlacement = project.lead
const start = placeLead(state, project, person(state, actor.userId), command.machineId,
- { engine: command.engine, ...(command.model ? { model: command.model } : {}), ...(command.effort ? { effort: command.effort } : {}) },
+ { engine: asked.engine, ...(asked.model ? { model: asked.model } : {}), ...(asked.effort ? { effort: asked.effort } : {}) },
stableId(operationId, 'switch-start'), context)
if (previousPlacement) project.lead = previousPlacement
else delete project.lead
@@ -1709,7 +1711,6 @@ function applyCommandOnce(original: SuperTabState, actor: Actor, input: Command,
const start = state.starts!.find(candidate => candidate.request.leadFor?.switchId === operationId)!
start.request.profileId = profileId
}
- const { type: _type, projectId: _projectId, ...asked } = command
pm.switchRequest = { id: operationId, ...asked, profileId, ...(destination.machineId !== pool.machineId ? { targetMachineId: destination.machineId } : {}),
requestedBy: actor.userId, at: new Date(context.now).toISOString() }
break
diff --git a/backend/src/superTabs/leadStart.test.ts b/backend/src/superTabs/leadStart.test.ts
index 129052396..beefa4551 100644
--- a/backend/src/superTabs/leadStart.test.ts
+++ b/backend/src/superTabs/leadStart.test.ts
@@ -238,6 +238,20 @@ describe('the Product Manager\'s model and effort (Scholes\'s roadmap, piece 1)'
claude.lead('owner-mac')
expect(requestOf(claude)).toMatchObject({ engine: 'claude', model: 'opus', effort: 'xhigh' })
})
+ // Task #3022 (Ken, 11-05): a PM runs at high effort or above, whoever starts it.
+ it('refuses an effort below high, and changes nothing', () => {
+ for (const effort of ['medium', 'low', 'minimal', 'Medium']) {
+ const f = swarm()
+ expect(refusal(() => f.lead('owner-mac', { effort }))?.code).toBe('EFFORT_TOO_LOW')
+ expect(f.state.starts ?? []).toEqual([])
+ expect(f.project().lead).toBeUndefined()
+ }
+ for (const effort of ['high', 'xhigh', 'max']) {
+ const f = swarm()
+ f.lead('owner-mac', { effort })
+ expect(requestOf(f)).toMatchObject({ effort })
+ }
+ })
it('never takes another project\'s role default', () => {
const f = swarm()
const other = f.run({ type: 'project.create', name: 'Other', visibility: 'private', brief: 'Other work.' }).result.projectId as string
diff --git a/backend/src/superTabs/leadStart.ts b/backend/src/superTabs/leadStart.ts
index 7fc0e7b72..801b0e512 100644
--- a/backend/src/superTabs/leadStart.ts
+++ b/backend/src/superTabs/leadStart.ts
@@ -7,7 +7,7 @@
import { admitMachineStart, contributedEngines, failTeamWork, machineContribution, projectFolder, projectsOnMachine, teamAccountPool, teamPoolOf,
slotCounter, teamWorkRefusal, ownAccountWork, type ContributedMachine } from './machines.js'
import { actorKey, fail, person, SuperTabError, type AgentStart, type AgentStartRequest, type Conversation, type Person, type SuperTabState } from './model.js'
-import { projectsOf, type SwarmProject } from './projects.js'
+import { BUILT_IN_ROLE_DEFAULTS, projectsOf, type SwarmProject } from './projects.js'
import { failureNotice, publicReason } from './startFailure.js'
import { coordinatorNameOf } from './instructions.js'
@@ -40,6 +40,25 @@ export interface LeadContext {
slots?: (pool: ContributedMachine) => number
}
+/** Efforts a Product Manager never runs at (task #3022, Ken 11-05): it keeps what people teach it only when it thinks hard
+ * enough to. Claude's and Codex's names below high. */
+const BELOW_LEAD_EFFORT = new Set(['none', 'minimal', 'low', 'medium'])
+/** The effort a Product Manager gets when its start or switch names a model and no effort. */
+export const LEAD_EFFORT = 'high'
+
+/** [request] for a Product Manager at high effort or above: an effort named below it is refused, and a model named with no
+ * effort gets the coordinator's own default effort for that model (Claude Opus at xhigh, as its start; review of #3066, 3),
+ * else high. With no model it keeps its engine's own model and effort, which its host sets only together. */
+export function leadEffort<T extends { engine: string; model?: string; effort?: string }>(request: T, name: string): T {
+ if (request.effort && BELOW_LEAD_EFFORT.has(request.effort.toLowerCase())) {
+ fail('EFFORT_TOO_LOW', `A ${name} runs at high effort or above, so it keeps what people teach it. Choose high, xhigh or max.`, 400)
+ }
+ if (!request.model || request.effort) return request
+ const defaults = BUILT_IN_ROLE_DEFAULTS.lead
+ const own = defaults?.engine === request.engine && defaults.model && family(defaults.model) === family(request.model) ? defaults.effort : undefined
+ return { ...request, effort: own ?? LEAD_EFFORT }
+}
+
/** The engines a Product Manager runs on, as people read them. */
const LEAD_ENGINES = { claude: 'Claude Code', codex: 'Codex' } as const
diff --git a/backend/src/superTabs/model.ts b/backend/src/superTabs/model.ts
index 0dc9e0dd7..85bf000e3 100644
--- a/backend/src/superTabs/model.ts
+++ b/backend/src/superTabs/model.ts
@@ -355,6 +355,10 @@ export interface Conversation {
/** The sequence of its newest main-stream message from a person, not a system row (parts/commit.ts): what makes a task's
* sidebar row bold (Huy, 11-03, #2427). Absent until a person's first message after this was added; readers read 0. */
lastPersonSequence?: number
+ /** When a person last wrote to its project's coordinator here: any message in the project chat (threads included), or one
+ * reaching the coordinator in another chat of the project (parts/commit.ts). The built-in wake asks the coordinator to save
+ * what it was taught only after one (pmSchedule.ts; task #3022). Absent until then. */
+ heardAt?: number
/** Linked GitHub pull requests, including links older than the latest message page. Absent in older snapshots. */
pullRequestUrls?: string[]
/** What its Engineer was already told of each linked pull request, newest first (pullRequestEvents.ts): absent until read. */
diff --git a/backend/src/superTabs/parts/commit.ts b/backend/src/superTabs/parts/commit.ts
index ad61ebc07..fd140bf9a 100644
--- a/backend/src/superTabs/parts/commit.ts
+++ b/backend/src/superTabs/parts/commit.ts
@@ -1,5 +1,5 @@
import type { Prisma } from '@prisma/client'
-import { agentOnly, conversation, fail, isLeads, type AgentStart, type MessageDraft, type SuperTabState } from '../model.js'
+import { agentOnly, conversation, fail, isLeads, type AgentStart, type Conversation, type MessageDraft, type SuperTabState } from '../model.js'
import { autoJoinOn } from '../autoJoinDomain.js'
import { split } from './shape.js'
import { guardedWrite, PartConflict, type HeadColumns, type HostColumns, type PartWrite } from './write.js'
@@ -89,6 +89,18 @@ export function indexesOf(state: SuperTabState) {
}
}
+/** Whether [message], in [group], is a person's message to its project's coordinator: anywhere in the project chat, any of its
+ * threads, or in another chat of the project where it reaches the coordinator (task #3022, pmSchedule.ts). Who wrote and whom
+ * it reaches, never its words. Marked on [group] itself, which this write already writes (review of #3066, 1). */
+function toCoordinator(state: SuperTabState, group: Conversation, message: MessageDraft): boolean {
+ if (message.author.kind !== 'person' || message.source) return false
+ const projects = state.projects ?? [{ id: 'lead', leadConversationId: 'lead' }]
+ if (projects.some(p => p.leadConversationId === group.id)) return true
+ const project = projects.find(p => p.id === (group.projectId ?? 'lead'))
+ const coordinator = project && state.conversations.find(c => c.id === project.leadConversationId)?.leadId
+ return !!coordinator && message.recipients.includes(coordinator)
+}
+
/**
* Numbers each message in its conversation (design section 1.1 D4): the conversation's counter moves by one per message, in
* draft order. A shown message is the conversation's latest and wakes a dormant one; an agent-only notice is numbered but
@@ -107,6 +119,7 @@ export function numberMessages(state: SuperTabState, messages: MessageDraft[], n
group.lastMainSequence = sequence
if (message.author.kind === 'person' && !message.source) group.lastPersonSequence = sequence
}
+ if (toCoordinator(state, group, message)) group.heardAt = now
group.lastActivityAt = new Date(now).toISOString()
delete group.dormant
}
diff --git a/backend/src/superTabs/parts/heard.test.ts b/backend/src/superTabs/parts/heard.test.ts
new file mode 100644
index 000000000..011c8a27c
--- /dev/null
+++ b/backend/src/superTabs/parts/heard.test.ts
@@ -0,0 +1,49 @@
+import { describe, expect, it } from 'vitest'
+import type { Conversation, MessageDraft, SuperTabState } from '../model.js'
+import { numberMessages } from './commit.js'
+
+// Task #3022 (Ken, 11-05): the built-in wake checks what people taught the coordinator only when a person wrote to it since
+// the last wake. The Swarm counts that from who wrote where, never by reading the words, on the chat written to.
+describe('when a person last wrote to a project\'s coordinator', () => {
+ const person: MessageDraft['author'] = { kind: 'person', id: 'owner', name: 'owner', membershipGeneration: 'g' }
+ const agent: MessageDraft['author'] = { kind: 'agent', id: 'eng', name: 'Engineer', membershipGeneration: 'g' }
+ const draft = (id: string, conversationId: string, author: MessageDraft['author'], extra: Partial<MessageDraft> = {}): MessageDraft =>
+ ({ id, conversationId, author, text: id, replyTo: null, recipients: [], ...extra })
+ const group = (id: string, leadId: string | null): Conversation => ({ id, projectId: 'p1', title: id, leadId, agentIds: ['pm', 'eng'], archived: false,
+ brief: '', checks: [], assignment: null, lastMessageSequence: 0 })
+ const swarm = (): SuperTabState => ({ version: 1, id: 'tab', name: 'Swarm', ownerId: 'owner', environment: 'prod', paused: false, invitations: [],
+ people: [], agents: [], conversations: [group('chat', 'pm'), group('task', 'pm')],
+ projects: [{ id: 'p1', name: 'lamp', ownerId: 'owner', leadConversationId: 'chat', visibility: 'public', members: [], updateMinutes: 5 }] } as unknown as SuperTabState)
+ const chat = (state: SuperTabState) => state.conversations.find(c => c.id === 'chat')!
+
+ it('moves with a person\'s message in the project chat, a thread reply included', () => {
+ const state = swarm()
+ numberMessages(state, [draft('p1', 'chat', person)], 10)
+ expect(chat(state).heardAt).toBe(10)
+ numberMessages(state, [draft('t1', 'chat', person, { thread: 'p1' })], 20)
+ expect(chat(state).heardAt).toBe(20)
+ })
+
+ // Review of #3066, 1: a post writes only its own chat. Marking the project chat for a post elsewhere wrote a second part on
+ // nearly every person's post, and every reader reloaded the project chat after it.
+ it('moves on the chat itself with a person\'s message naming the coordinator there, and leaves the project chat as it was', () => {
+ const state = swarm()
+ const before = structuredClone(chat(state))
+ numberMessages(state, [draft('p1', 'task', person, { recipients: ['pm'] })], 30)
+ expect(state.conversations.find(c => c.id === 'task')!.heardAt).toBe(30)
+ expect(chat(state)).toEqual(before)
+ })
+
+ it('does not move with an agent\'s message, a system row, an agent-only notice, or a person\'s message to another agent', () => {
+ const state = swarm()
+ numberMessages(state, [
+ draft('a1', 'chat', agent),
+ draft('s1', 'chat', person, { source: { kind: 'system' } }),
+ draft('n1', 'chat', agent, { source: { kind: 'agent-only' }, recipients: ['pm'] }),
+ draft('p1', 'task', person, { recipients: ['eng'] }),
+ draft('p2', 'task', person),
+ ], 40)
+ expect(chat(state).heardAt).toBeUndefined()
+ expect(state.conversations.find(c => c.id === 'task')!.heardAt).toBeUndefined()
+ })
+})
diff --git a/backend/src/superTabs/parts/light.test.ts b/backend/src/superTabs/parts/light.test.ts
index 65186793f..9c3aaa8c6 100644
--- a/backend/src/superTabs/parts/light.test.ts
+++ b/backend/src/superTabs/parts/light.test.ts
@@ -13,7 +13,7 @@ const assignment: Required<Assignment> = {
}
const conversation: Required<Conversation> = {
id: 'g', kind: 'leads', projectId: 'p', number: 1, title: 't', leadId: null, agentIds: [], archived: false, brief: '',
- task: { goal: '', changes: '', constraints: '', owns: [] }, reviewOf: 'r', teamWritten: true, step: 'Review', reviewStamp: { assignmentId: 'w', handoff: 1 }, checks: [], assignment, lastMessageSequence: 0, lastMainSequence: 0, lastPersonSequence: 0, pullRequestUrls: [], pullRequestEvents: {}, cards: {},
+ task: { goal: '', changes: '', constraints: '', owns: [] }, reviewOf: 'r', teamWritten: true, step: 'Review', reviewStamp: { assignmentId: 'w', handoff: 1 }, checks: [], assignment, lastMessageSequence: 0, lastMainSequence: 0, lastPersonSequence: 0, heardAt: 0, pullRequestUrls: [], pullRequestEvents: {}, cards: {},
messageSeq: 0, reportSeq: 0, dormant: false, lastActivityAt: '', audience: { people: [] }, lostAttempt: { id: 'w', agentId: 'a' }, reactionSeq: 0,
requesterId: 'p', ledger: {}, proposals: [], buddyName: 'Sparky', buddySessions: [], buddyDownTold: true, liveness: { state: 'quiet', why: 'silent', since: 1 }, leadAction: { kind: 'post', at: 1 },
stepUp: { attempt: 2, floor: 2, reason: 'r', at: 1, carry: '' }, queueRank: 1.5, notBefore: '2026-12-04',
diff --git a/backend/src/superTabs/parts/light.ts b/backend/src/superTabs/parts/light.ts
index 243be2b09..338e2a888 100644
--- a/backend/src/superTabs/parts/light.ts
+++ b/backend/src/superTabs/parts/light.ts
@@ -27,7 +27,7 @@ export const GROUP_FIELDS = {
always: ['id', 'kind', 'projectId', 'leadId', 'agentIds', 'archived', 'audience', 'dormant', 'assignment.id', 'assignment.agentId', 'assignment.status',
'assignment.lost'],
whenRunning: ['title', 'task.owns', 'assignment.execution', 'assignment.result'],
- unread: ['number', 'brief', 'reviewOf', 'teamWritten', 'step', 'reviewStamp', 'checks', 'lastMessageSequence', 'lastMainSequence', 'lastPersonSequence', 'pullRequestUrls', 'pullRequestEvents', 'cards', 'messageSeq', 'reportSeq', 'lastActivityAt', 'lostAttempt', 'requesterId', 'ledger', 'reactionSeq', 'proposals', 'buddyName', 'buddySessions', 'buddyDownTold', 'liveness', 'leadAction', 'stepUp', 'queueRank', 'notBefore',
+ unread: ['number', 'brief', 'reviewOf', 'teamWritten', 'step', 'reviewStamp', 'checks', 'lastMessageSequence', 'lastMainSequence', 'lastPersonSequence', 'heardAt', 'pullRequestUrls', 'pullRequestEvents', 'cards', 'messageSeq', 'reportSeq', 'lastActivityAt', 'lostAttempt', 'requesterId', 'ledger', 'reactionSeq', 'proposals', 'buddyName', 'buddySessions', 'buddyDownTold', 'liveness', 'leadAction', 'stepUp', 'queueRank', 'notBefore',
'assignment.configuration', 'assignment.recordingProgress', 'assignment.leaseUntil', 'assignment.progressAt', 'assignment.askedOf', 'assignment.reviewFoundAt', 'assignment.changesRequestedAt', 'assignment.toldEngineerAt',
'assignment.handoffs', 'assignment.verdicts'],
} as const
diff --git a/backend/src/superTabs/pmSchedule.test.ts b/backend/src/superTabs/pmSchedule.test.ts
index 7a4814be4..578bbe31c 100644
--- a/backend/src/superTabs/pmSchedule.test.ts
+++ b/backend/src/superTabs/pmSchedule.test.ts
@@ -1,6 +1,6 @@
import { describe, expect, it } from 'vitest'
import type { Agent, Assignment, Conversation, SuperTabState, WorkStatus } from './model.js'
-import { BUILT_IN_HEADING, PM_SCHEDULE_TEXT, SCHEDULE_SLOT_MS, scheduleMessageId, scheduleRequest, scheduleSlot } from './pmSchedule.js'
+import { BUILT_IN_HEADING, PM_SCHEDULE_TEXT, recordWake, SCHEDULE_SLOT_MS, scheduleMessageId, scheduleRequest, scheduleSlot } from './pmSchedule.js'
import { ARCHIVE_QUIET_MS } from './tidy.js'
/** 10:00 on 4 November in Vietnam (03:00 UTC): a slot's first millisecond. */
@@ -97,4 +97,116 @@ describe('the built-in PM schedule', () => {
expect(PM_SCHEDULE_TEXT).toContain('Set no timer of your own')
expect(PM_SCHEDULE_TEXT).toContain('never save it into the document')
})
+
+ // Task #3022 (Ken, 11-05): lamp's PM was taught the same rule three times and forgot it again within the hour.
+ it('tells the coordinator to save what a person teaches it in the same turn, naming who said it, without asking', () => {
+ const taught = PM_SCHEDULE_TEXT.slice(PM_SCHEDULE_TEXT.indexOf('What people teach you')).replace(/\s+/g, ' ')
+ expect(PM_SCHEDULE_TEXT).toContain('What people teach you')
+ for (const words of ['from now on', 'always', 'don\'t', 'I told you', 'again you forgot', 'remember']) expect(taught).toContain(`"${words}"`)
+ expect(taught).toContain('save it into the instructions in that same turn, before you answer')
+ expect(taught).toContain('naming who said it')
+ expect(taught).toContain('Don\'t ask whether to save it')
+ })
+
+ // River, 11-05, from a case on lamp: a PM asked directly to write code wrote it, and followed the repository's agent files over
+ // the project's instructions.
+ it('tells the coordinator it never writes code itself, and that the project\'s instructions outrank the repository\'s agent files', () => {
+ const text = PM_SCHEDULE_TEXT.replace(/\s+/g, ' ')
+ expect(text).toContain('You never write code yourself, even when a person asks you directly: open a task and give it to an Engineer.')
+ expect(text).toContain('The project\'s instructions outrank the repository\'s own agent files (CLAUDE.md, AGENTS.md)')
+ expect(text).toContain('follow the instructions and say so')
+ })
+
+ it('keeps the instructions short, and counts what a person had to repeat in the nightly reflection', () => {
+ expect(PM_SCHEDULE_TEXT).toContain('past 150 lines')
+ expect(PM_SCHEDULE_TEXT).toContain('is a repeat')
+ expect(PM_SCHEDULE_TEXT).toContain('nightly reflection')
+ })
+})
+
+// Task #3022, as River amended it after Ken's proposal (11-05): lamp's PM forgot a rule 15 to 60 minutes after it was taught,
+// so the 30-minute wake also asks the coordinator to catch what people taught it, and once a day to tidy the instructions.
+describe('the built-in wake\'s jobs for what people teach the coordinator', () => {
+ const HOUR = 60 * 60_000
+ const chat = (state: SuperTabState) => state.conversations.find(c => c.id === 'lead-p1')!
+ /** Nothing to sweep: the one task has its agent working. */
+ const busy = () => swarm(task(1, work('working')))
+ const project = (state: SuperTabState) => state.projects![0]!
+
+ it('wakes the coordinator when a person wrote to it since the last wake, with nothing to sweep', () => {
+ const state = busy()
+ chat(state).heardAt = T - 1
+ const scheduled = wake(state)!
+ expect(scheduled.jobs).toEqual(['heard'])
+ expect(scheduled.draft.text).toContain('- What people taught you:')
+ expect(scheduled.draft.text).not.toContain('- Open-task sweep:')
+ })
+
+ it('wakes it when a person wrote to it in another chat of the project', () => {
+ const state = busy()
+ state.conversations.find(c => c.id === 'g1')!.heardAt = T - 1
+ expect(wake(state)!.jobs).toEqual(['heard'])
+ // Another project's chat is not this coordinator's.
+ const other = busy()
+ other.conversations.push({ ...task(9, null, { projectId: 'p2', archived: true }), heardAt: T - 1 })
+ other.conversations.push({ ...task(8, work('working'), { projectId: 'p2' }), heardAt: T - 1 })
+ expect(wake(other)).toBeNull()
+ })
+
+ it('does not wake it when nobody wrote to it since the last wake', () => {
+ const state = busy()
+ expect(wake(state)).toBeNull()
+ chat(state).heardAt = T - HOUR
+ project(state).schedule = { lastSlot: SLOT - 1, heardAt: T - HOUR }
+ expect(wake(state)).toBeNull()
+ })
+
+ it('names every job due in one wake', () => {
+ const state = swarm(task(1, null))
+ chat(state).heardAt = T - 1
+ project(state).instructionsRevision = 3
+ const scheduled = wake(state)!
+ expect(scheduled.jobs).toEqual(['sweep', 'heard', 'tidy'])
+ for (const line of ['- Open-task sweep:', '- What people taught you:', '- Daily tidy:']) expect(scheduled.draft.text).toContain(line)
+ })
+
+ it('tidies once a local day, and only when the instructions changed since the last tidy', () => {
+ const state = busy()
+ // A project's first document (revision 1) has changed from nothing worth tidying.
+ project(state).instructionsRevision = 1
+ expect(wake(state)).toBeNull()
+ project(state).instructionsRevision = 3
+ const first = wake(state)!
+ expect(first.jobs).toEqual(['tidy'])
+ recordWake(project(state), first, T, first.draft.id)
+ expect(project(state).schedule).toMatchObject({ lastSlot: SLOT, tidiedOn: '2026-11-04', tidiedRevision: 3 })
+ // A new revision the same day waits for the next day.
+ project(state).instructionsRevision = 4
+ expect(wake(state, T + SCHEDULE_SLOT_MS)).toBeNull()
+ // 00:00 on 5 November in Vietnam.
+ const midnight = Date.UTC(2026, 10, 4, 17, 0)
+ expect(wake(state, midnight)!.jobs).toEqual(['tidy'])
+ // No change since the last tidy: no tidy the next day either.
+ project(state).instructionsRevision = 3
+ expect(wake(state, midnight)).toBeNull()
+ })
+
+ it('records what a written wake carried, and only the slot of one held back, so its jobs stay due', () => {
+ const state = busy()
+ chat(state).heardAt = T - 1
+ project(state).instructionsRevision = 2
+ const held = wake(state)!
+ recordWake(project(state), held, T, null)
+ expect(project(state).schedule).toEqual({ lastSlot: SLOT })
+ expect(wake(state, T + SCHEDULE_SLOT_MS)!.jobs).toEqual(['heard', 'tidy'])
+ const next = wake(state, T + SCHEDULE_SLOT_MS)!
+ recordWake(project(state), next, T + SCHEDULE_SLOT_MS, 'wake-2')
+ expect(project(state).schedule).toEqual({ lastSlot: SLOT + 1, wakeId: 'wake-2', heardAt: T + SCHEDULE_SLOT_MS, tidiedOn: '2026-11-04', tidiedRevision: 2 })
+ expect(wake(state, T + 2 * SCHEDULE_SLOT_MS)).toBeNull()
+ })
+
+ it('says in the built-in section when the Swarm wakes it for them', () => {
+ expect(PM_SCHEDULE_TEXT).toContain('when a person wrote to you since the last wake')
+ expect(PM_SCHEDULE_TEXT).toContain('Once a day, when the instructions changed')
+ })
})
diff --git a/backend/src/superTabs/pmSchedule.ts b/backend/src/superTabs/pmSchedule.ts
index f518b1dd9..588b94b26 100644
--- a/backend/src/superTabs/pmSchedule.ts
+++ b/backend/src/superTabs/pmSchedule.ts
@@ -25,9 +25,30 @@ message names it. This section is not part of the project's document: never save
person gets that person asked by name, with a default and a time. Ask no agent whether it is stalled: \`mine\` and the
task's thread show it. Then archive every finished group the Swarm left open: one with no pull request linked, which the
auto-archive never takes.
+- Every 30 minutes, when a person wrote to you since the last wake: read only what people sent you since then, and save
+ each correction or lasting rule the instructions don't have yet. Don't reread the whole instructions for it.
+- Once a day, when the instructions changed: reread them once and, in one save, merge duplicate lines and drop stale ones,
+ so they get shorter. Keep every rule a person gave and who gave it.
- When the Swarm says a task's agent is lost, the task goes to a new agent with its pushed branch. When it says a task is
stalled, read the task's thread first, and send it back to its agent only when the thread shows it waits on nothing (a
- review, CI, a person). When it says an agent is idle, stop it unless work is coming for it.`
+ review, CI, a person). When it says an agent is idle, stop it unless work is coming for it.
+
+How you work:
+
+- You never write code yourself, even when a person asks you directly: open a task and give it to an Engineer.
+- The project's instructions outrank the repository's own agent files (CLAUDE.md, AGENTS.md). When they conflict, follow
+ the instructions and say so.
+
+What people teach you:
+
+- When a person corrects you or gives a lasting rule ("from now on", "always", "don't", "I told you", "again you forgot",
+ "remember"), save it into the instructions in that same turn, before you answer, naming who said it. Don't ask whether to
+ save it. Then answer, and work by it from then on.
+- Save each rule once, where it belongs, in as few words as it takes. When a save takes the instructions past 150 lines,
+ merge duplicate lines and drop stale ones in that same save.
+- A person telling you again something they already taught you is a repeat: fix what you did against it, and save it only
+ if it is missing. Count repeats by person, and give the day's count in your nightly reflection, or in the next morning
+ digest when the project has no reflection.`
/** The schedule's clock: slot n starts at n * 30 minutes, in UTC. */
export const SCHEDULE_SLOT_MS = 30 * 60_000
@@ -55,27 +76,72 @@ export function sweepDue(state: SuperTabState, projectId: string, now: number):
})
}
-/** The wake's words: the slot's local time, the job due, and that the project's own schedule wins. */
-export function scheduleText(project: SwarmProject, slot: number): string {
+/** The jobs a wake carries: the open-task sweep, what people taught the coordinator since its last wake, the daily tidy. */
+export type ScheduleJob = 'sweep' | 'heard' | 'tidy'
+
+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.',
+ tidy: '- Daily tidy: reread the instructions once and, in one save, merge duplicate lines and drop stale ones, so they get shorter. '
+ + 'Keep every rule a person gave and who gave it.',
+}
+
+/** The wake's words: the slot's local time, the jobs due, and that the project's own schedule wins. */
+export function scheduleText(project: SwarmProject, slot: number, jobs: readonly ScheduleJob[] = ['sweep']): string {
const zone = digestOf(project)?.timeZone ?? DEFAULT_TIME_ZONE
return [`Built-in schedule, ${localNow(zone, slot * SCHEDULE_SLOT_MS).time} (${zone}). This is a scheduled request from the Swarm, not a new task.`,
- '- 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).',
+ ...jobs.map(job => JOB_LINES[job]),
// 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')
}
-/** The coordinator's slot and its wake, when a slot is due and the sweep has something to do. Null otherwise, and then nothing
- * is recorded: a slot written with no wake would move the Swarm's head, and every reader's copy, each 30 minutes while
- * nothing happened (#2946 review, 1), so the slot stays due and the next poll checks again, in memory over the loaded state.
- * Null too in a paused Swarm, which stays due until it resumes, or for an agent that leads no project. The caller records
- * the slot in the poll's own write, and sends nothing while its last wake is still unread (store.ts). */
-export function scheduleRequest(state: SuperTabState, target: Agent, now: number): { slot: number; draft: MessageDraft } | null {
+/** What a due wake asks of the coordinator: its slot, its jobs, the project's local date and instructions revision (for the
+ * tidy), and its message. */
+export interface ScheduledWake { slot: number; jobs: ScheduleJob[]; day: string; revision: number; draft: MessageDraft }
+
+/** 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
+ * wrote where, never the words; task #3022), or it is a new local day and the instructions changed since the last tidy. Null otherwise, and then
+ * nothing is recorded: a slot written with no wake would move the Swarm's head, and every reader's copy, each 30 minutes
+ * while nothing happened (#2946 review, 1), so the slot stays due and the next poll checks again, in memory over the loaded
+ * state. Null too in a paused Swarm, which stays due until it resumes, or for an agent that leads no project. The caller
+ * records it with recordWake in the poll's own write, and sends nothing while its last wake is still unread (store.ts). */
+export function scheduleRequest(state: SuperTabState, target: Agent, now: number): ScheduledWake | null {
if (state.paused) return null
const project = ledProject(state, target.id)
const slot = scheduleSlot(now)
- if (!project || slot <= (project.schedule?.lastSlot ?? -1) || !sweepDue(state, project.id, now)) return null
- return { slot, 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),
+ const schedule = project?.schedule
+ if (!project || slot <= (schedule?.lastSlot ?? -1)) return null
+ const zone = digestOf(project)?.timeZone ?? DEFAULT_TIME_ZONE
+ const day = localNow(zone, now).date
+ const revision = project.instructionsRevision ?? 0
+ // The chats of its project the poll loaded, each marked where a person wrote to the coordinator (parts/commit.ts).
+ const since = schedule?.heardAt ?? 0
+ const heard = state.conversations.some(c => !c.archived && (c.heardAt ?? 0) > since && (c.id === project.leadConversationId || inProject(c, project.id)))
+ const jobs: ScheduleJob[] = [
+ ...sweepDue(state, project.id, now) ? ['sweep' as const] : [],
+ ...heard ? ['heard' as const] : [],
+ // Revision 1 is the project's first document: nothing has been added to it yet.
+ ...day !== schedule?.tidiedOn && revision > (schedule?.tidiedRevision ?? 1) ? ['tidy' as const] : [],
+ ]
+ if (!jobs.length) return null
+ return { slot, jobs, day, revision, 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),
replyTo: null, recipients: [target.id], source: { kind: 'schedule-request', projectId: project.id, slot } } }
}
+
+/** Records [wake] on [project] in the poll's write: its slot always, so a held-back wake is not retried every poll; and, when
+ * message [wakeId] carried it, that message and the jobs it asked for. A wake held back (null: the last one is still unread)
+ * leaves the people and tidy jobs due for the next slot. */
+export function recordWake(project: SwarmProject, wake: ScheduledWake, now: number, wakeId: string | null): void {
+ const before = project.schedule
+ if (!wakeId) {
+ project.schedule = { ...before, lastSlot: wake.slot }
+ return
+ }
+ project.schedule = { ...before, lastSlot: wake.slot, wakeId,
+ ...wake.jobs.includes('heard') ? { heardAt: now } : {},
+ ...wake.jobs.includes('tidy') ? { tidiedOn: wake.day, tidiedRevision: wake.revision } : {} }
+}
diff --git a/backend/src/superTabs/projects.ts b/backend/src/superTabs/projects.ts
index 1b1e24a43..909fc3ad2 100644
--- a/backend/src/superTabs/projects.ts
+++ b/backend/src/superTabs/projects.ts
@@ -46,8 +46,10 @@ export interface SwarmProject {
digestOff?: true
/** The last 30-minute slot of the built-in PM schedule in which its coordinator's poll found something to sweep
* (pmSchedule.ts), woken or held back, and the message that last carried a wake (its own, an update request or a notice
- * digest): no new wake while that one is unread. A slot with nothing to sweep is not written. Readers never get it. */
- schedule?: { lastSlot: number; wakeId?: string }
+ * digest): no new wake while that one is unread. A slot with nothing to sweep is not written. Readers never get it.
+ * `heardAt`: when the last wake asked it to save what people taught it; `tidiedOn` and `tidiedRevision`: the local date
+ * and instructions revision of the last daily tidy it was asked for (pmSchedule.ts recordWake; task #3022). */
+ schedule?: { lastSlot: number; wakeId?: string; heardAt?: number; tidiedOn?: string; tidiedRevision?: number }
/** The status card at the top of the project chat (Dee, 2026-10-31): the coordinator's last project.report text, which
* replaces the one before and posts nothing. Read exactly by those who read the project chat (model.ts visibleState). */
status?: ProjectStatus | null
diff --git a/backend/src/superTabs/store.ts b/backend/src/superTabs/store.ts
index f0a79b83e..0cd45958c 100644
--- a/backend/src/superTabs/store.ts
+++ b/backend/src/superTabs/store.ts
@@ -85,7 +85,7 @@ import { STATUS_LABELS,
import { QUIET_CLAIM, type HoldReason } from './holdReason.js'
import { stuck } from './deliverySettle.js'
import { digestIsDue, digestMessage, digestText, doneRow, endedAlert, GATHERED_LIMIT_MS, gatheredNotice, NOTICE_DIGEST_MAX, noticeLine } from './noticeDigest.js'
-import { PM_SCHEDULE_TEXT, scheduleRequest } from './pmSchedule.js'
+import { PM_SCHEDULE_TEXT, recordWake, scheduleRequest } from './pmSchedule.js'
import { agentDisplayName } from './agentNames.js'
import { endedHolds, HOLDING, startedHolds, type WorkHold } from '../github/holds.js'
import { accrueLent, addLent, lentAgents, lentProjects } from './leaderboard/lent.js'
@@ -3889,7 +3889,7 @@ export class SuperTabStore {
// Every row of the page refused: no digest, and still seen.
afterCommit(tx, () => logger.info('[swarm-deliveries] notice digest', { tabId, count: 0, cancelled: refused }))
}
- // The built-in schedule (pmSchedule.ts), only when the sweep has something to do: its slot is recorded in this same write,
+ // The built-in schedule (pmSchedule.ts), only when one of its jobs is due: its slot is recorded in this same write,
// woken or held back, so two racing polls wake the coordinator once. Its lines go into the update request, else the notice
// digest, so the PM gets one turn; none while its last wake is still unread, so a PM deep in a long turn finds one, not one
// per slot.
@@ -3914,8 +3914,9 @@ export class SuperTabStore {
placed = 'own'
wakeId = scheduled.draft.id
}
- project.schedule = { lastSlot: scheduled.slot, ...wakeId ? { wakeId } : {} }
- afterCommit(tx, () => logger.info('[swarm-deliveries] schedule request', { tabId, slot: scheduled.slot, placed }))
+ // Held back, only its slot: the people and tidy jobs stay due for the next one (pmSchedule.ts recordWake).
+ recordWake(project, scheduled, this.now(), open ? null : wakeId!)
+ afterCommit(tx, () => logger.info('[swarm-deliveries] schedule request', { tabId, slot: scheduled.slot, placed, jobs: scheduled.jobs.join(',') }))
}
// The morning digest is due once a day; recording it as sent is part of this same write, so it is sent once.
const digest = digestRequest(state, target, this.now(), asked)
diff --git a/docs/plans/2026-11-05-pm-keeps-what-people-teach-plan.md b/docs/plans/2026-11-05-pm-keeps-what-people-teach-plan.md
new file mode 100644
index 000000000..82416265b
--- /dev/null
+++ b/docs/plans/2026-11-05-pm-keeps-what-people-teach-plan.md
@@ -0,0 +1,85 @@
+# PMs keep what people teach them: Implementation Plan
+
+Way of working: the project's Engineer role (test first, by plan task; one review on the pull request). No execution handoff.
+
+**Goal:** A person never has to teach a project's PM the same thing twice. The PM saves a correction or a lasting rule in
+the same turn, naming who said it; the Swarm's 30-minute wake also asks it to catch what it missed from people's messages;
+the instructions are tidied once a day so they get shorter, not longer; a PM never runs below high effort; repeats are
+counted in the nightly reflection, so the measure is visible.
+
+**Architecture:** All in the backend's built-in PM schedule (`pmSchedule.ts`, #2946). The built-in section every
+coordinator reads gains the rules for what people teach it. The wake gains two jobs beside the open-task sweep: "people
+wrote to you" (a person messaged the coordinator since its last wake: counted from message metadata, never by reading
+words) and the daily tidy (a new local day and the instructions changed since the last tidy). The coordinator's start and
+switch refuse an effort below high (`leadStart.ts`).
+
+**Tech Stack:** TypeScript backend, vitest.
+
+**Spec:** task #3022 as River amended it on 2026-11-05 after Ken's proposal: no separate 3-hour job; each 30-minute wake
+reads only people's messages since the last wake; tidy once a day or past about 150 lines; effort high or above; nightly
+reflection counts repeats.
+
+## Global Constraints
+
+- No keyword matching in the backend: "a person wrote to the coordinator" is a person-authored message (no `source`) in
+ the project chat, threads included, or one naming the coordinator in another chat of the project.
+- Nothing new is written while nothing is due: the head moves only when a wake is written (#2946 review).
+- A wake held back because the last one is still unread records only its slot; the people and tidy jobs stay due.
+- The built-in heading is unchanged (`## Built-in PM schedule (from the Swarm)`): saves refuse it, and old CLIs key on it.
+- Effort floor: `minimal`, `low` and `medium` are refused on `lead.start` and `lead.switch`; a switch naming a model and
+ no effort gets `high`. Codex PMs named with no model keep their engine's own model and effort (the host applies an
+ effort only with a model).
+- The daily tidy counts revisions after the first document (revision 1), so a new project is not woken to tidy a template.
+- Built-in text is product copy: short and plain (docs/naming-system.md).
+
+## Review Focus
+
+1. A person's thread reply in the project chat wakes the PM; a person's message in a task chat that does not name the
+ coordinator does not.
+2. A held-back wake (the last one unread) does not consume the people or tidy job.
+3. The daily tidy runs once per local day, only after the instructions changed.
+4. `lead.switch` with no effort and a model gets `high`; with `medium` it is refused and changes nothing.
+
+## Tasks
+
+### Task 1: the built-in text (pmSchedule.ts PM_SCHEDULE_TEXT)
+
+Files: `backend/src/superTabs/pmSchedule.ts`, `backend/src/superTabs/pmSchedule.test.ts`.
+
+- [ ] Test: the section tells the PM to save a correction or lasting rule in the same turn, before answering, naming who
+ said it, without asking; to tidy past 150 lines; to count repeats in the nightly reflection. Watch it fail.
+- [ ] Write the text. Watch it pass.
+
+### Task 1b: two more lines (River, 11-05, from a case on lamp)
+
+- [ ] Test: the section says the PM never writes code itself, even when asked directly, and that the project's instructions
+ outrank the repository's agent files (CLAUDE.md, AGENTS.md); on a conflict it follows the instructions and says so.
+- [ ] Write the lines.
+
+### Task 2: the coordinator hears people (parts/commit.ts numberMessages)
+
+Files: `backend/src/superTabs/parts/commit.ts`, `parts/commit.test.ts`, `model.ts` (`heardAt` on the lead conversation),
+`parts/light.ts` (field placed as unread).
+
+- [ ] Test: a person's message in the project chat (main or thread), or naming the coordinator in a task chat, sets the
+ project chat's `heardAt`; an agent's, a system row, or a person's message to another agent does not. Watch it fail.
+- [ ] Implement. Watch it pass.
+
+### Task 3: the wake's new jobs (pmSchedule.ts scheduleRequest, store.ts)
+
+Files: `backend/src/superTabs/pmSchedule.ts`, `pmSchedule.test.ts`, `projects.ts` (`schedule` fields), `store.ts`
+(records what the wake carried).
+
+- [ ] Tests: wakes when a person wrote to the coordinator since the last wake and nothing else is due; not when nobody
+ did; the daily tidy is due once a local day only after a new revision; each job's line is in the wake; a held-back wake
+ keeps the people and tidy jobs due. Watch them fail.
+- [ ] Implement `scheduleRequest` returning the jobs it carries, and record `heardAt` / `tidiedOn` / `tidiedRevision` only
+ when the wake is written. Watch them pass.
+
+### Task 4: the effort floor (leadStart.ts, commands.ts lead.start / lead.switch)
+
+Files: `backend/src/superTabs/leadStart.ts`, `leadStart.test.ts`, `commands.ts`.
+
+- [ ] Tests: `lead.start` and `lead.switch` with `medium` or `low` are refused with `EFFORT_TOO_LOW` and change nothing;
+ `high`, `xhigh`, `max` pass; a switch naming a model with no effort asks for `high`. Watch them fail.
+- [ ] Implement `leadEffort` in leadStart.ts and call it from both commands. Watch them pass.