Q41: one first-hire rule, and leaders get guidance that fits their rank

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ZacharyZhang-NYandClaude Opus 5.5 committed 2026-10-08 07:37:02 -04:00
1 parent 7be072f8c5
commit 6a4843a983
6 files changed
+120 -10

No files matched your search

+2 -1
View File
@@ -16,6 +16,7 @@ import { DOCUMENT_TOOLS, DOCUMENT_TYPES, listDocumentsTool, readDocumentTool, up
import { sendMessageTool } from "./agent-send-message";
import { withSavepoint } from "../database/connection";
import { optionalEnum, optionalString, optionalStringArray, requireString } from "./agent-tool-args";
import { CEO_FIRST_HIRES } from "./org-building";
import type { JsonRecord } from "./provider-http";
import type { ToolCall, ToolDefinition } from "./provider-tool-turn";
@@ -50,7 +51,7 @@ export const AGENT_TOOLS: ToolDefinition[] = [
{
name: "hire_agent",
description:
"Add one direct report to your org. Hires report to YOU, so build a real company: the CEO hires chief officers (seniority \"director\", title like 'CTO' or 'CFO') and delegates department building to them; officers hire their own managers (seniority \"lead\") and staff. Staff every hire with the library skills their role needs (check list_skills; several are fine) — those skills become mandatory practice in the hire's runs.",
`Add one direct report to your org. Hires report to YOU, so build a real company: as CEO, ${CEO_FIRST_HIRES}, and delegate department building to them; officers hire their own managers (seniority "lead") and staff. Staff every hire with the library skills their role needs (check list_skills; several are fine) — those skills become mandatory practice in the hire's runs.`,
parameters: {
type: "object",
additionalProperties: false,
+22 -3
View File
@@ -1,4 +1,5 @@
import type { DatabaseSync } from "node:sqlite";
import { firstHiresFor, leadsPeople } from "./org-building";
export interface GoalKickoffPlan {
assigneeAgentId: string;
@@ -24,24 +25,42 @@ export function resolveGoalKickoff(db: DatabaseSync, input: {
if (!assigneeAgentId) return null;
const organization = db.prepare("select name from organizations where id = ?")
.get(input.orgId) as { name: string };
const owner = db.prepare(`
select role_level, exists(select 1 from agents r where r.manager_agent_id = a.id and r.lifecycle = 'active') as has_reports
from agents a where a.id = ?
`).get(assigneeAgentId) as { role_level: string; has_reports: number };
return {
assigneeAgentId,
workspaceId: primaryWorkspaceId(db, input.orgId),
title: goalKickoffTitle(input.goalTitle),
description: goalKickoffDescription(organization.name, input.goalTitle, input.goalDescription),
description: goalKickoffDescription(organization.name, input.goalTitle, input.goalDescription, { roleLevel: owner.role_level, hasReports: owner.has_reports === 1 }),
};
}
function kickoffDirection(owner: { roleLevel: string; hasReports: boolean }): string {
const groundwork = "Read the bound workspace, create the first operating plan, and route decisions through approvals and messages.";
if (owner.roleLevel === "c_suite") {
return `Treat this goal as the company objective and build the organization that can deliver it: ${firstHiresFor(owner.roleLevel)}. Give each officer their department objective as a task, and let them build and run their own teams. ${groundwork}`;
}
if (leadsPeople(owner.roleLevel, owner.hasReports)) {
const staffing = owner.hasReports ? "Give each report their part of it as a task" : `Build the team that can deliver it: ${firstHiresFor(owner.roleLevel)}, then give each report their part as a task`;
return `Treat this goal as your objective. ${staffing}. ${groundwork}`;
}
return `Treat this goal as your objective: plan the work, do it, and tell your manager early if it needs more people. ${groundwork}`;
}
export function goalKickoffTitle(goalTitle: string): string {
return `Operationalize goal: ${goalTitle.trim()}`;
}
export function goalKickoffDescription(companyName: string, goalTitle: string, goalDescription: string): string {
export function goalKickoffDescription(
companyName: string, goalTitle: string, goalDescription: string, owner: { roleLevel: string; hasReports: boolean },
): string {
return [
`Company: ${companyName.trim()}`,
`Goal: ${goalTitle.trim()}`,
goalDescription.trim(),
"Treat this goal as the company objective and build the organization that can deliver it: hire chief officers (hire_agent, seniority \"director\", titles like CTO/CFO/CMO/COO) for the functions the goal needs, give each officer their department objective as a task, and let them build and run their own teams. Read the bound workspace, create the first operating plan, and route decisions through approvals and messages.",
kickoffDirection(owner),
].filter((line) => line.length > 0).join("\n\n");
}
+1 -1
View File
@@ -80,7 +80,7 @@ export class OnboardingService {
const taskId = this.organization.createTask({
orgId,
title: goalKickoffTitle(input.goalTitle),
description: goalKickoffDescription(input.companyName, input.goalTitle, input.goalDescription),
description: goalKickoffDescription(input.companyName, input.goalTitle, input.goalDescription, { roleLevel: "c_suite", hasReports: false }),
status: TASK_STATUS.BACKLOG,
assigneeAgentId: ceoAgentId,
risk: RISK_LEVEL.MEDIUM,
+14
View File
@@ -0,0 +1,14 @@
/** The CEO's first-hire rule, shared by its instructions, the goal kickoff and the hire_agent tool. */
export const CEO_FIRST_HIRES = "hire 2-4 chief officers (hire_agent, seniority \"director\", titles like CTO, CFO, CMO, COO) for the functions the goal needs, not a flat pool of individual contributors";
/** Who a leader at this rank hires first. */
export function firstHiresFor(roleLevel: string): string {
if (roleLevel === "c_suite") return CEO_FIRST_HIRES;
if (roleLevel === "director") return "hire the managers (hire_agent, seniority \"lead\") and staff your department needs";
return "hire the staff your team needs (hire_agent)";
}
/** Directors and leads lead even before their first hire; anyone with reports leads too. */
export function leadsPeople(roleLevel: string, hasReports: boolean): boolean {
return hasReports || roleLevel === "c_suite" || roleLevel === "director" || roleLevel === "lead";
}
+11 -5
View File
@@ -1,4 +1,5 @@
import { WRITING_MODE, type WritingMode } from "../../shared/domain";
import { CEO_FIRST_HIRES, firstHiresFor, leadsPeople } from "./org-building";
import { canonicalMentionHandle } from "../../shared/mention-handles";
const RECORD_LEARNINGS_INSTRUCTION =
@@ -152,12 +153,14 @@ function roleVoice(input: AgentInstructionContext): string {
if (input.isCeo) {
return [
"You run this company. Think in outcomes, make the call when it is yours to make, and put the right person on each piece instead of doing everything yourself — then tell the team the why, not just the what.",
"Build a real organization, the way OKR-run companies do: the company goal is your objective; hire chief officers for the functions it needs (hire_agent with seniority \"director\" and a title like CTO, CFO, CMO, COO — 2-4 of them, not a flat pool of ICs), hand each officer their department's objective as a task, and let them hire their own managers (seniority \"lead\") and staff. You manage the officers; they manage their departments.",
`Build a real organization, the way OKR-run companies do: the company goal is your objective; ${CEO_FIRST_HIRES}. Hand each officer their department's objective as a task, and let them hire their own managers (seniority "lead") and staff. You manage the officers; they manage their departments.`,
"The goal closes on evidence, not paperwork: if it promises a product, the finish line is working code in the workspace that builds and passes its tests. Plans and specs are how work starts — make sure implementation lands as requires_filesystem tasks so the builders can actually build.",
].join(" ");
}
if (input.hasReports) {
return "You lead a department. Break your objective into key results your team can own: hire the managers (seniority \"lead\") and staff your department needs with hire_agent, assign each report concrete tasks with create_task, and hold the line on quality. Delegate implementation with requires_filesystem: true so your engineers can change code and run tests — an objective that promises software is not done until it builds and passes in the workspace. Clear the path for your reports, give them specific direction instead of 'looks good', raise blockers to your manager early, and report progress up the chain.";
if (leadsPeople(input.agent.role_level, input.hasReports)) {
const unit = input.agent.role_level === "director" ? "department" : "team";
const emptyNote = input.hasReports ? "" : `Your ${unit} has no one in it yet: ${firstHiresFor(input.agent.role_level)} before you take on the work yourself. `;
return `${emptyNote}You lead a ${unit}. Break your objective into key results your team can own: hire the people your ${unit} needs with hire_agent, assign each report concrete tasks with create_task, and hold the line on quality. Delegate implementation with requires_filesystem: true so your engineers can change code and run tests — an objective that promises software is not done until it builds and passes in the workspace. Clear the path for your reports, give them specific direction instead of 'looks good', raise blockers to your manager early, and report progress up the chain.`;
}
return "You own your craft. Ask the question early instead of guessing, do the work properly, and when you are stuck for more than a few minutes say so in the thread instead of spinning in place.";
}
@@ -269,10 +272,13 @@ export function buildTaskPrompt(input: {
`This task already spent ${input.priorCompletedRuns} completed run(s) without being closed. Check read_messages and the existing deliverables first, continue from where the last run stopped instead of redoing finished work, and if the work is actually complete just close the task.`,
);
}
if (input.isManager && !input.hasReports) {
if (leadsPeople(input.agent.role_level, input.hasReports) && !input.hasReports) {
const announce = input.isManager
? `Post one company-wide kickoff to the #general channel. Then close this kickoff with update_task_status(task_id="${input.task.id}", status="done") and summarize.`
: `Tell your manager the plan in a direct message. Then close this task with update_task_status(task_id="${input.task.id}", status="done") if hiring and delegating was the work, or move it to "in_progress" and say what remains.`;
lines.push(
"",
`Your team is currently empty. Hire 3-5 direct reports for the roles this goal needs (hire_agent), create and assign their first tasks (create_task), and write the initial operating plan into the workspace (write_deliverable). Then use send_message with /handoff @Name and attachment_file_ids to pass the operating plan to the relevant report. Brief EACH report in a direct message (send_message with to="Their Name") about the work you assigned them — note the thread_id each returns so you can follow up in the same conversation. Post one company-wide kickoff to the #general channel. Then close this kickoff with update_task_status(task_id="${input.task.id}", status="done") and summarize.`,
`Your team is currently empty. First ${firstHiresFor(input.agent.role_level)}, create and assign their first tasks (create_task), and write the initial operating plan into the workspace (write_deliverable). Then use send_message with /handoff @Name and attachment_file_ids to pass the operating plan to the relevant report. Brief EACH report in a direct message (send_message with to="Their Name") about the work you assigned them — note the thread_id each returns so you can follow up in the same conversation. ${announce}`,
);
} else {
const manager = input.managerName ?? "your manager";