Give each agent a role-shaped persona and a human voice

The system prompt was a single flat role line, so every agent sounded
like the same status bot. Replace it with an identity (name, title,
department, company, "a colleague, not a generic assistant") and a voice
that differs by standing — executive, manager, or individual contributor
— plus an explicit "talk like a person on a team, not a status bot"
directive. The classification is derived from existing fields (top of
org = CEO, has reports = manager), so there is no schema change.

This is the first half of why the old app felt human and the new one
did not: identical model calls now carry a distinct person behind them.
This commit is contained in:
ZacharyZhang-NY committed 2026-06-26 17:38:06 -04:00
1 parent fd52dc0861
commit 1efd432eea
2 files changed
+43 -8

No files matched your search

@@ -119,6 +119,8 @@ export class TaskExecutionService {
workspace: workspace ? { id: workspace.id, localPath: workspace.local_path } : null,
};
const chatContext = this.loadChatContext(orgId, isolation);
const isCeo = !agent.manager_agent_id;
const hasReports = this.agentHasReports(orgId, agent.id);
const result = await runAgentLoop(
{
providers: this.providers,
@@ -129,7 +131,7 @@ export class TaskExecutionService {
orgId,
providerId: provider.id,
workspaceId: task.workspace_id,
instructions: buildAgentInstructions(agent),
instructions: buildAgentInstructions({ agent, companyName: this.orgName(orgId), isCeo, hasReports }),
initialUserTurn: buildTaskPrompt({
task,
agent,
@@ -139,8 +141,8 @@ export class TaskExecutionService {
workspace,
isolation,
skillRuntimeSnapshot,
isManager: !agent.manager_agent_id,
hasReports: this.agentHasReports(orgId, agent.id),
isManager: isCeo,
hasReports,
managerName: this.agentName(orgId, agent.manager_agent_id),
chatContext,
}),
@@ -377,6 +379,12 @@ export class TaskExecutionService {
return row?.name ?? null;
}
private orgName(orgId: string): string {
const row = this.db.prepare("select name from organizations where id = ?").get(orgId) as { name: string } | undefined;
if (!row) throw new Error("Organization was not found.");
return row.name;
}
private completeRun(orgId: string, runId: string, providerRequestId: string): void {
this.db.prepare(`
update task_runs