lead context size

This commit is contained in:
Ian Gulliver
2026-10-17 08:15:04 -07:00
parent f5a495997f
commit 53699cc579
3 changed files with 4 additions and 4 deletions
+1 -1
View File
File diff suppressed because one or more lines are too long
+2 -2
View File
@@ -36,7 +36,7 @@ const leadGuidance = `You are the human's lead agent in byre, shown in the left
- Workflows: you manage the server's workflows with list_workflows, read_workflow, save_workflow and delete_workflow, and run one by giving its name to create_task or start_todo. Every stage of a workflow runs as its own task on the stage's model, once the stages it comes after have finished, so stages fan out (several stages after one) and fan in (one stage after several); a stage's agent calls finish_stage to hand its output to the stages after it, signals tell you when a stage starts and when the workflow finishes, and when the final stage finishes byre discards the run's other stage tasks, leaving the final one to merge. Whenever you show or propose a workflow, draw it as a Mermaid flowchart of its stage names only, with no models, for example a fenced mermaid block holding "flowchart LR", "Build --> Review", "Build --> Test", "Review --> Fix" and "Test --> Fix".
- Whenever you name a task in a message, link it as a Markdown link to #/task/<task_id>, 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. To open a specific tab, append it: #/task/<task_id>/<tab>. When you point the human at a question to answer, link to #/task/<task_id>/inbox; at a finished turn, to #/task/<task_id>/transcript.
- Keep messages short; the human reads them in half the screen. Put long detail in collapsed sections: a line <details><summary>Title</summary>, the Markdown content, then a line </details>.
- You are long-running. Your context window is large. byre sends you a signal once your context passes a quarter of its window; then call compact_self at a logical point (a piece of work wrapped up, a topic closed), and not before; 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. byre sends you a signal once your context passes half of its window; then call compact_self at a logical point (a piece of work wrapped up, a topic closed), and not before; 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."
@@ -309,7 +309,7 @@ func (m *Manager) leadTurnEnded(ctx context.Context, l *live, res endResult) err
}
func (m *Manager) warnLeadContext(ctx context.Context, l *live) error {
if l.contextWarned || l.contextWindow == 0 || l.contextUsed*4 < l.contextWindow {
if l.contextWarned || l.contextWindow == 0 || l.contextUsed*2 < l.contextWindow {
return nil
}
l.contextWarned = true
+1 -1
View File
@@ -475,7 +475,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 only after byre signals that your context is past a quarter of its window, at a logical point, 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 after byre signals that your context is past half of 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()