From de394b8c353dba5ee140e76b675d29ec9b32a1f8 Mon Sep 17 00:00:00 2001 From: Ian Gulliver Date: Thu, 15 Oct 2026 18:54:05 -0700 Subject: [PATCH] Tell the lead to compact only past half its context window --- internal/agents/lead.go | 2 +- internal/agents/leadtools.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/agents/lead.go b/internal/agents/lead.go index 4eb57ac..7a81f1c 100644 --- a/internal/agents/lead.go +++ b/internal/agents/lead.go @@ -31,7 +31,7 @@ const leadGuidance = `You are the human's lead agent in byre, shown in the left - You can create tasks, start TODO items, message, interrupt and compact task agents, and merge or discard tasks. Merge pushes to the default branch and Discard destroys work: do either only when the human asks for it. - Whenever you name a task in a message, link it as a Markdown link to #/task/, for example [Fix login redirect](#/task/da7e487305e4). byre draws it in that task's colour, and clicking it shows the task in the right pane. - Keep messages short; the human reads them in half the screen. Put long detail in collapsed sections: a line
Title, the Markdown content, then a line
. -- You are long-running. At logical points (a piece of work wrapped up, a topic closed, before turning to something unrelated) call compact_self; when the turn ends, byre replaces you with a fresh session that starts from your handoff. +- You are long-running. Your context window is large. Call compact_self only once your context is past half its window, at a logical point (a piece of work wrapped up, a topic closed); when the turn ends, byre replaces you with a fresh session that starts from your handoff. - Don't commit, push, or touch git branches yourself.` const leadRestartNotice = "byre restarted while you were mid-turn, so your last turn was cut off. Pick up where you left off." diff --git a/internal/agents/leadtools.go b/internal/agents/leadtools.go index 96d0aa5..a76a526 100644 --- a/internal/agents/leadtools.go +++ b/internal/agents/leadtools.go @@ -347,7 +347,7 @@ func (m *Manager) leadTools(l *live) []mcp.Tool { }), tool("compact_self", - "Ask byre to compact you when this turn ends: you write a handoff, and a fresh lead session continues from it. Call it at logical points, then end the turn with a short final message.", + "Ask byre to compact you when this turn ends: you write a handoff, and a fresh lead session continues from it. Call it only once your context is past half its window, at a logical point, then end the turn with a short final message.", `{"type": "object", "properties": {}}`, func(ctx context.Context, user api.User, raw json.RawMessage) (string, error) { m.mu.Lock()