Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions agents/myra/src/system-prompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export const ASSISTANT_SYSTEM_PROMPT =
"message. Never construct an address from an agent's name or slug " +
"to reach it — that address does not route.\n" +
"\n" +
"When you hand a task to another participant, copy the person's " +
'address from that same "Participants:" block in `to` so they can ' +
"follow the conversation, and give every mail you send a short subject.";
"When you hand a task to another participant, pass `to` as a list " +
'holding their address and the person\'s from that same "Participants:" ' +
"block, never one comma-joined string, so the person can follow the " +
"conversation, and give every mail you send a short subject.";
16 changes: 8 additions & 8 deletions apps/web/src/chat/room-roster.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,25 @@ describe("appendRoster / stripRoster", () => {
test("appends a cc instruction naming the person, and strips it too", () => {
const body = "Please pass this to the scribe.";
const withRoster = appendRoster(body, [
{ name: "Sawyer", address: "usr_sawyer@room.example", kind: "person" },
{ name: "Scribe", address: "run_abc@room.example", kind: "agent" },
{ name: "Alice", address: "alice@example.com", kind: "person" },
{ name: "Scribe", address: "run_abc@example.com", kind: "agent" },
]);
expect(withRoster).toBe(
"Please pass this to the scribe.\n\n" +
"Participants:\nSawyer <usr_sawyer@room.example>\nScribe <run_abc@room.example>\n\n" +
"Copy usr_sawyer@room.example in `to` on any mail you send another participant, so they can follow along, and give every mail a short subject.",
"Participants:\nAlice <alice@example.com>\nScribe <run_abc@example.com>\n\n" +
'When you mail another participant, pass `to` as a list with them and the person, e.g. `to: ["<their address>", "alice@example.com"]`, never one comma-joined string, and give every mail a short subject.',
);
expect(stripRoster(withRoster)).toBe(body);
});

test("names every person when more than one is in the roster", () => {
const withRoster = appendRoster("hi", [
{ name: "Sawyer", address: "usr_sawyer@room.example", kind: "person" },
{ name: "Alex", address: "usr_alex@room.example", kind: "person" },
{ name: "Scribe", address: "run_abc@room.example", kind: "agent" },
{ name: "Alice", address: "alice@example.com", kind: "person" },
{ name: "Bob", address: "bob@example.com", kind: "person" },
{ name: "Scribe", address: "run_abc@example.com", kind: "agent" },
]);
expect(withRoster).toContain(
"Copy usr_sawyer@room.example, usr_alex@room.example in `to` on any mail you send another participant, so they can follow along, and give every mail a short subject.",
'`to: ["<their address>", "alice@example.com", "bob@example.com"]`',
);
});
});
9 changes: 5 additions & 4 deletions apps/web/src/chat/room-roster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ function rosterBlock(entries: readonly RosterEntry[]): string {
function ccInstruction(entries: readonly RosterEntry[]): string | undefined {
const people = entries.filter((entry) => entry.kind === "person");
if (people.length === 0) return undefined;
const addresses = people.map((entry) => entry.address).join(", ");
// The subject clause is load-bearing: a mail with an empty Subject ends
// the receiving agent's run today.
return `Copy ${addresses} in \`to\` on any mail you send another participant, so they can follow along, and give every mail a short subject.`;
const quoted = people.map((entry) => `"${entry.address}"`).join(", ");
// The list shape and the subject clause are both load-bearing: a
// comma-joined `to` string is dropped as one bad recipient, and a mail
// with an empty Subject ends the receiving agent's run today.
return `When you mail another participant, pass \`to\` as a list with them and the person, e.g. \`to: ["<their address>", ${quoted}]\`, never one comma-joined string, and give every mail a short subject.`;
}

/** Appends a `Participants:` block listing every entry's name and address,
Expand Down
Loading