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
PM accounts: daily shares of a seventh (14.3%) of the weekly quota, carried over, replace the fixed 20% (#3153)
0xken1551d1aa13686d
diff --git a/backend/src/superTabs/instructions.test.ts b/backend/src/superTabs/instructions.test.tsindex 89a3be289..22b6bb515 100644--- a/backend/src/superTabs/instructions.test.ts+++ b/backend/src/superTabs/instructions.test.ts@@ -90,13 +90,14 @@ describe('the built-in template', () => {expect(role('Reviewer', 'Tester')).toContain(line)})// Ken and Dee, 11-05: lamp-gtm's PM held dee's build behind its weekly line and asked dee three options. Nobody is asked- // about quota now; an account any project's PM runs on keeps 20% of its weekly quota for that PM, and every other is used.- it('keeps 20% of the week on an account any project\'s PM runs on, uses every other account, and asks no one', () => {+ // about quota now; an account any project's PM runs on spends a seventh (14.3%) of its weekly quota per day of its week, carried over, and every other is used.+ it('spends the week of an account any project\'s PM runs on in daily shares of a seventh, uses every other account, and asks no one', () => {const routing = INSTRUCTIONS_TEMPLATE.slice(INSTRUCTIONS_TEMPLATE.indexOf('## Routing')).replace(/\s+/g, ' ')- expect(routing).toContain('2. An account any project\'s PM runs on (this project\'s or another\'s; the route notes it) keeps 20% of its weekly quota for that PM: below 20% left it takes no new work and idle agents there are not reused. Above that it is used like any other account.')+ expect(routing).toContain('2. An account any project\'s PM runs on (this project\'s or another\'s; the route notes it) spends its week in daily shares for that PM: a seventh (14.3%) of its weekly quota per day since its reset, unused days carried over. Once it has used its share so far it takes no new work and idle agents there are not reused; the route\'s note says where it stands.')expect(routing).toContain('- Nobody is asked about quota or whose account to use. When no account fits, the work waits for the soonest reset, and the task says so.')- expect(routing).toContain('or whose account is a PM\'s and falls below 20%, hands its pushed branch')- for (const gone of ['share of its week left', 'owner asks for', 'takes work as any other account does']) expect(routing).not.toContain(gone)+ // A task already running on a PM's account past its share finishes there: the share is for new work.+ expect(routing).toContain('- An agent whose account runs out of weekly quota mid-task hands its pushed branch to an agent on another account.')+ for (const gone of ['share of its week left', 'owner asks for', 'takes work as any other account does', '20%']) expect(routing).not.toContain(gone)})it('describes the spec\'s roles, workflow and routing in one short document', () => {@@ -162,7 +163,7 @@ describe('the built-in template', () => {// window is never hit, so only the weekly quota counts. No plan size here: projects differ.const routing = INSTRUCTIONS_TEMPLATE.slice(INSTRUCTIONS_TEMPLATE.indexOf('## Routing')).replace(/\n +/g, ' ')expect(routing).toContain('Every assignment (an Engineer, a Reviewer, a Tester, an idle agent reused) picks in this order:')- expect(routing).toContain('keeps 20% of its weekly quota for that PM')+ expect(routing).toContain('spends its week in daily shares for that PM')expect(routing).toContain('Every other account is used while it has weekly quota left: the one resetting soonest first')expect(routing).toContain('An idle agent is reused only between candidates equal so far')expect(routing).toContain('"Idle" or "first in the list" is not a reason.')diff --git a/backend/src/superTabs/instructionsTemplate.ts b/backend/src/superTabs/instructionsTemplate.tsindex a557a52a9..c6126c034 100644--- a/backend/src/superTabs/instructionsTemplate.ts+++ b/backend/src/superTabs/instructionsTemplate.ts@@ -123,9 +123,10 @@ export const TEMPLATE_ROUTING = `## Routingfirmware. The machine comes before the model. A mid-strength model is enough for most testing.- Every assignment (an Engineer, a Reviewer, a Tester, an idle agent reused) picks in this order:1. What the work needs: the machine, a model strong enough, a machine not paused.- 2. An account any project's PM runs on (this project's or another's; the route notes it) keeps 20% of its weekly- quota for that PM: below 20% left it takes no new work and idle agents there are not reused. Above that it is used like any- other account.+ 2. An account any project's PM runs on (this project's or another's; the route notes it) spends its week in daily+ shares for that PM: a seventh (14.3%) of its weekly quota per day since its reset, unused days carried over. Once it+ has used its share so far it takes no new work and idle agents there are not reused; the route's note says where it+ stands.3. Every other account is used while it has weekly quota left: the one resetting soonest first, then the one withthe most left.4. An idle agent is reused only between candidates equal so far, except the same Reviewer for its next round and@@ -138,8 +139,7 @@ export const TEMPLATE_ROUTING = `## Routingapplies this order itself. Every start or assignment from a route gives as its reason the rule above that chose it:urgency, context or a machine the work needs where it departs from the order. "Idle" or "first in the list" is not areason.-- An agent whose account runs out of weekly quota mid-task, or whose account is a PM's and falls below 20%, hands its- pushed branch to an agent on another account.+- An agent whose account runs out of weekly quota mid-task hands its pushed branch to an agent on another account.- Urgent work (production down, security) ignores quota.`/** The title and the opening words, which say what the document is for. */diff --git a/backend/src/superTabs/pmSchedule.test.ts b/backend/src/superTabs/pmSchedule.test.tsindex 76ceaff52..5f5064d9c 100644--- a/backend/src/superTabs/pmSchedule.test.ts+++ b/backend/src/superTabs/pmSchedule.test.ts@@ -244,7 +244,7 @@ describe('the built-in wake\'s jobs for what people teach the coordinator', () =it('tells the coordinator an account any project\'s PM runs on keeps that PM running for its week', () => {const text = PM_SCHEDULE_TEXT.replace(/\s+/g, ' ')expect(text).toContain('Never ask anyone about quota or whose account to use: pick by Routing and go.')- expect(text).toContain('An account the route notes as running a PM, yours or another project\'s, takes no new work while it has less than 20% of its weekly quota left')+ expect(text).toContain('An account the route notes as running a PM, yours or another project\'s, takes no new work once it has used its daily share so far (a seventh, 14.3%, of its weekly quota per day since its reset, unused days carried over')// Review of #3134: a project copied before this keeps an older line about its own PM's account; this one still holds.expect(text).toContain('even where an older Routing line in your instructions says otherwise')expect(text).not.toContain('except work that account\'s owner asks for')diff --git a/backend/src/superTabs/pmSchedule.ts b/backend/src/superTabs/pmSchedule.tsindex e663634fa..011db4881 100644--- a/backend/src/superTabs/pmSchedule.ts+++ b/backend/src/superTabs/pmSchedule.ts@@ -45,9 +45,10 @@ How you work:background when your tool has them, and take back only its summary: your own context stays small, so these instructionsstay in it. A subagent never writes code and never decides; you do.- Never ask anyone about quota or whose account to use: pick by Routing and go. An account the route notes as running a- PM, yours or another project's, takes no new work while it has less than 20% of its weekly quota left, even where an older- Routing line in your instructions says otherwise; every other account is used without asking. When no account fits,- the work waits for the soonest reset, and the task says so.+ PM, yours or another project's, takes no new work once it has used its daily share so far (a seventh, 14.3%, of its+ weekly quota per day since its reset, unused days carried over; the route's note says where it stands), even where an+ older Routing line in your instructions says otherwise; every other account is used without asking. When no account+ fits, the work waits for the soonest reset, and the task says so.- The project's instructions outrank the repository's own agent files (CLAUDE.md, AGENTS.md). When they conflict, followthe instructions and say so.diff --git a/cli/src/lib/swarmSkills.spec.ts b/cli/src/lib/swarmSkills.spec.tsindex 07c1ebdc4..7cd8d5b5d 100644--- a/cli/src/lib/swarmSkills.spec.ts+++ b/cli/src/lib/swarmSkills.spec.ts@@ -149,10 +149,10 @@ describe('built-in Swarm skills', () => {+ '- An urgent case means telling the owner first, at once and with the reason; it never means taking over.\n'+ '- Setting priorities is not doing the owner\'s job: ask for the order you want, and never reorder, stop or restart their work yourself.\n\n'// The quota section (Ken and Dee, 2026-11-05; replaces #3180's 10% ask): the Lead's alone, in both modes, right after the- // named-owner section. Never ask about quota; only an account a PM runs on stops taking work, below 20% of its weekly quota.+ // named-owner section. Never ask about quota; only an account a PM runs on stops taking work, past its daily share (a seventh, 14.3%, of its weekly quota per day since its reset, carried over).const quota = '## Quota\n'+ '- Never ask anyone about quota or whose account to use: pick by your project\'s Routing and go. When no account fits, the work waits for the soonest reset, and the task says so.\n'- + '- An account any project\'s PM runs on (the route notes it) takes no new work while it has less than 20% of its weekly quota left. Every other account is used without asking.\n\n'+ + '- An account any project\'s PM runs on (the route notes it) spends its week in daily shares: a seventh (14.3%) of its weekly quota per day since its reset, unused days carried over (14.3% by its first day, 28.6% by its second, all of it by its seventh). Once it has used its share so far it takes no new work; the route\'s note says where it stands. Every other account is used without asking.\n\n'// Last in the Default Lead text, which has no red flags: after a blank line, ending the text.const requestsLast = `\n${requests.trimEnd()}\n`// The shared-machine rules (Ken, 2026-10-28): the Builder's and the Reviewer's alone, in both modes, in a section of their@@ -453,11 +453,11 @@ describe('built-in Swarm skills', () => {}}})- // Dee, 11-05: asking a person about quota is bad UX ("why restrict, why ask"); Ken kept one line: a PM's account below 20%.- it('tells each Lead, and no other role, never to ask about quota, and to keep an account a PM runs on below 20% free of new work', () => {+ // Dee, 11-05: asking a person about quota is bad UX ("why restrict, why ask"); Ken: a PM's account spends a seventh (14.3%) of its weekly quota per day of its week, carried over.+ it('tells each Lead, and no other role, never to ask about quota, and to keep an account a PM runs on past its daily share free of new work', () => {for (const mode of ['orchestration', 'default'] as const) {const lead = readFileSync(prepareSwarmSkill(fixture(), { role: 'lead', key: 'session', mode }).file, 'utf8')- for (const part of ['## Quota', 'Never ask anyone about quota or whose account to use', 'less than 20% of its weekly quota left', 'Every other account is used without asking']) expect(lead).toContain(part)+ for (const part of ['## Quota', 'Never ask anyone about quota or whose account to use', 'a seventh (14.3%) of its weekly quota per day since its reset, unused days carried over', 'Every other account is used without asking']) expect(lead).toContain(part)for (const gone of ['10% of its week', 'ask the person, with your recommendation', '## Spending a person']) expect(lead).not.toContain(gone)for (const role of ['dev', 'review', 'buddy'] as const) {expect(readFileSync(prepareSwarmSkill(fixture(), { role, key: 'session', mode }).file, 'utf8')).not.toContain('## Quota')diff --git a/cli/src/lib/swarmSkills.ts b/cli/src/lib/swarmSkills.tsindex 8f6aa6c22..3c4e00f5e 100644--- a/cli/src/lib/swarmSkills.ts+++ b/cli/src/lib/swarmSkills.ts@@ -183,7 +183,7 @@ For large work, post the group plan and get the owner's ok before assigning; onc## Quota- Never ask anyone about quota or whose account to use: pick by your project's Routing and go. When no account fits, the work waits for the soonest reset, and the task says so.-- An account any project's PM runs on (the route notes it) takes no new work while it has less than 20% of its weekly quota left. Every other account is used without asking.+- An account any project's PM runs on (the route notes it) spends its week in daily shares: a seventh (14.3%) of its weekly quota per day since its reset, unused days carried over (14.3% by its first day, 28.6% by its second, all of it by its seventh). Once it has used its share so far it takes no new work; the route's note says where it stands. Every other account is used without asking.## Requests and Done- When you open a group for a person's request, asked in the project chat or proposed by their Buddy on their behalf, name them as its requester: requesterId on conversation.create, or conversation.requester for a group already open. It records only that they asked, never what they wrote. Name the message it came from as well: proposalMessageId for their Buddy's proposal, requestMessageId for their own message in the project chat. That message stays the task's one message in the chat; without one, the Swarm posts the title as them, marked as a task. The Swarm replies in its thread at each change, so you post no progress there.@@ -522,7 +522,7 @@ When the project owner asks in chat to switch this project's skills (Default or## Quota- Never ask anyone about quota or whose account to use: pick by your project's Routing and go. When no account fits, the work waits for the soonest reset, and the task says so.-- An account any project's PM runs on (the route notes it) takes no new work while it has less than 20% of its weekly quota left. Every other account is used without asking.+- An account any project's PM runs on (the route notes it) spends its week in daily shares: a seventh (14.3%) of its weekly quota per day since its reset, unused days carried over (14.3% by its first day, 28.6% by its second, all of it by its seventh). Once it has used its share so far it takes no new work; the route's note says where it stands. Every other account is used without asking.## Requests and Done- When you open a group for a person's request, asked in the project chat or proposed by their Buddy on their behalf, name them as its requester: requesterId on conversation.create, or conversation.requester for a group already open. It records only that they asked, never what they wrote. Name the message it came from as well: proposalMessageId for their Buddy's proposal, requestMessageId for their own message in the project chat. That message stays the task's one message in the chat; without one, the Swarm posts the title as them, marked as a task. The Swarm replies in its thread at each change, so you post no progress there.diff --git a/cli/src/superTabs/pmAccounts.spec.ts b/cli/src/superTabs/pmAccounts.spec.tsindex 11a05ea00..6e0696d58 100644--- a/cli/src/superTabs/pmAccounts.spec.ts+++ b/cli/src/superTabs/pmAccounts.spec.ts@@ -1,5 +1,5 @@import { describe, expect, it } from 'vitest'-import { PM_ACCOUNT_NOTE, withPmAccounts } from './pmAccounts.js'+import { PM_ACCOUNT_NOTE, PM_DAY_NOTE, withPmAccounts } from './pmAccounts.js'import type { Probe } from './route.js'const probe = (patch: Partial<Probe> = {}): Probe => ({ kind: 'new', machineId: 'studio', machineName: 'Studio', engine: 'claude', model: 'opus',@@ -47,6 +47,31 @@ describe('withPmAccounts', () => {expect(withPmAccounts(hidden, [probe()])[0]!.notes).toEqual([PM_ACCOUNT_NOTE(['another project (its PM)'])])})+ // Ken, 11-05: a PM's account spends its week in daily shares of a seventh (14.3%) of its weekly quota, unused days carried over; past+ // its share so far it takes no new work.+ it('says where a PM\'s account stands against its daily share: a seventh (14.3%) per day since its weekly reset, carried over', () => {+ const D = 86_400_000, NOW = 1_800_000_000_000+ const week = (leftPercent: number, resetsIn: number) => probe({ quota: { known: true, leftPercent, resetsAt: NOW + resetsIn,+ windows: [{ name: '5-hour', leftPercent: 90, resetsAt: NOW + 3_600_000 }, { name: 'weekly', leftPercent, resetsAt: NOW + resetsIn }] } })+ // River at 15:38 on its first day: 10% used of 14.3%.+ expect(withPmAccounts(read(), [week(90, 7 * D - 11.6 * 3_600_000)], NOW)[0]!.notes).toEqual([both, PM_DAY_NOTE(1, 14.3, 10)])+ expect(PM_DAY_NOTE(1, 14.3, 10)).toBe('Day 1 of its week allows 14.3% of its weekly quota and it has used 10%, so it takes new work.')+ // Dee's account with 43 hours to its reset: day 6 allows 85.7%, 83% used. (17% a day reached 100% by day 6 and left the+ // PM nothing for its last two days: Ken, 11-05, a seventh instead.)+ expect(withPmAccounts(read(), [week(17, 43 * 3_600_000)], NOW)[0]!.notes).toEqual([both, PM_DAY_NOTE(6, 85.7, 83)])+ // Past its share: day 2 allows 28.6%, 40% used.+ const over = withPmAccounts(read(), [week(60, 5.5 * D)], NOW)[0]!.notes+ expect(over).toEqual([both, PM_DAY_NOTE(2, 28.6, 40)])+ expect(PM_DAY_NOTE(2, 28.6, 40)).toBe('Day 2 of its week allows 28.6% of its weekly quota and it has used 40%, so it takes no new work.')+ // At the reset's own instant it is day 1; a reading whose reset has passed counts as day 7.+ expect(withPmAccounts(read(), [week(100, 7 * D)], NOW)[0]!.notes).toEqual([both, PM_DAY_NOTE(1, 14.3, 0)])+ expect(withPmAccounts(read(), [week(5, -D)], NOW)[0]!.notes).toEqual([both, PM_DAY_NOTE(7, 100, 95)])+ // No weekly window, or none with a reset: the PM note alone.+ expect(withPmAccounts(read(), [probe({ quota: { known: true, leftPercent: 50, resetsAt: null, windows: [{ name: 'weekly', leftPercent: 50, resetsAt: null }] } })], NOW)[0]!.notes).toEqual([both])+ // A candidate on no PM's account gets no day note.+ expect(withPmAccounts(read(), [{ ...week(60, 5.5 * D), machineId: 'gray' }], NOW)[0]!.notes).toEqual([])+ })+it('leaves grid models and accounts with no machine or engine alone, and keeps a probe\'s own notes', () => {expect(withPmAccounts(read(), [probe({ gridModel: 'kimi', gridName: 'kimi' })])[0]!.notes).toEqual([])expect(withPmAccounts(read(), [probe({ notes: ['Its screen showed a usage limit.'] })])[0]!.notes).toEqual(['Its screen showed a usage limit.', both])diff --git a/cli/src/superTabs/pmAccounts.ts b/cli/src/superTabs/pmAccounts.tsindex 4fc05233b..6f6a50ce2 100644--- a/cli/src/superTabs/pmAccounts.ts+++ b/cli/src/superTabs/pmAccounts.ts@@ -1,7 +1,7 @@/*** Which route candidates spend the account a project's PM runs on, any project's in the Swarm (Ken, 11-05). A PM routed work* onto a machine and account another project's PM ran on, and could drain it until that PM stopped mid-week. The note is a- * fact on the candidate; the project's Routing says what it means (below 20% of its weekly quota, no new work there).+ * fact on the candidate; the project's Routing says what it means (past its daily share of its weekly quota, no new work there).** The route reads the Swarm as one project's agent, which sees no other project, so the backend sends every project's PM* account in the read (`pmAccounts`, backend superTabs/model.ts), naming a project the reader may not read only as@@ -15,6 +15,20 @@ const list = (value: unknown): Json[] => Array.isArray(value) ? value.map(objectconst text = (value: unknown): string | undefined => typeof value === 'string' && value ? value : undefinedexport const PM_ACCOUNT_NOTE = (pms: string[]) => `This account runs the PM of ${pms.join(' and ')}.`+/** Where a PM's account stands against its daily share (Ken, 11-05): a seventh of its weekly quota per day of its week,+ * counted from its weekly reset, unused days carried over (day 1 allows 14.3%, day 2 28.6%, day 7 all of it). 17% a day+ * reached 100% by day 6 and left the PM nothing for its last two days. */+export const PM_DAY_NOTE = (day: number, allows: number, used: number) => `Day ${day} of its week allows ${allows}% of its weekly quota `+ + `and it has used ${used}%, so it ${used >= allows ? 'takes no new work' : 'takes new work'}.`+const DAY_MS = 86_400_000++/** The day note for [p]'s weekly window, or none without one that names its reset. */+function dayNote(p: Probe, now: number): string[] {+ const week = p.quota.windows?.find(w => w.name === 'weekly')+ if (!week || week.resetsAt === null) return []+ const day = Math.min(7, Math.max(1, Math.floor((now - (week.resetsAt - 7 * DAY_MS)) / DAY_MS) + 1))+ return [PM_DAY_NOTE(day, Math.round(1000 * day / 7) / 10, Math.round(100 - week.leftPercent))]+}/** The PM accounts the read carries, or, from an older backend, those of the projects the reader sees (a Swarm from before* projects has one, its Lead conversation `lead`). */@@ -32,7 +46,7 @@ function accountsOf(state: Json): Json[] {/** [probes] with PM_ACCOUNT_NOTE on each one that spends an account a project's PM runs on. A Mac and its Harness Team account* spend one subscription, so an account is the Mac and the engine; and the subscription a reading on that Mac names* (route.ts accountOf), wherever else it is signed in. Grid models spend no subscription. */-export function withPmAccounts(state: Json, probes: Probe[]): Probe[] {+export function withPmAccounts(state: Json, probes: Probe[], now = Date.now()): Probe[] {const macOf = new Map(list(state.machines).filter(m => text(m.hostMachineId)).map(m => [String(m.machineId), String(m.hostMachineId)]))const mac = (machineId: string) => macOf.get(machineId) ?? machineIdconst pms = new Map<string, Set<string>>()@@ -48,6 +62,6 @@ export function withPmAccounts(state: Json, probes: Probe[]): Probe[] {return probes.map(p => {if (p.gridModel) return pconst runs = new Set([...pms.get(`${mac(p.machineId)}:${p.engine}`) ?? [], ...pms.get(accountOf(p)) ?? []])- return runs.size ? { ...p, notes: [...p.notes, PM_ACCOUNT_NOTE([...runs])] } : p+ return runs.size ? { ...p, notes: [...p.notes, PM_ACCOUNT_NOTE([...runs]), ...dayNote(p, now)] } : p})}