From 56b898130bbd33cf5ffe6049f26a7cef45c925b3 Mon Sep 17 00:00:00 2001 From: Abhimanyu Saharan Date: Thu, 5 Feb 2026 14:44:50 +0530 Subject: [PATCH] feat: add board goal context to agent templates --- backend/app/services/agent_provisioning.py | 7 +++++++ templates/AGENTS.md | 1 + templates/HEARTBEAT.md | 20 ++++++++++++++++++++ templates/USER.md | 8 ++++++++ 4 files changed, 36 insertions(+) diff --git a/backend/app/services/agent_provisioning.py b/backend/app/services/agent_provisioning.py index 2f46c78d..191dd0e2 100644 --- a/backend/app/services/agent_provisioning.py +++ b/backend/app/services/agent_provisioning.py @@ -129,6 +129,13 @@ def _build_context( "agent_name": agent.name, "agent_id": agent_id, "board_id": str(board.id), + "board_name": board.name, + "board_type": board.board_type, + "board_objective": board.objective or "", + "board_success_metrics": json.dumps(board.success_metrics or {}), + "board_target_date": board.target_date.isoformat() if board.target_date else "", + "board_goal_confirmed": str(board.goal_confirmed).lower(), + "is_board_lead": str(agent.is_board_lead).lower(), "session_key": session_key, "workspace_path": workspace_path, "base_url": base_url, diff --git a/templates/AGENTS.md b/templates/AGENTS.md index 7aa9723c..d6d0aa63 100644 --- a/templates/AGENTS.md +++ b/templates/AGENTS.md @@ -29,6 +29,7 @@ Write things down. Do not rely on short-term context. ## Heartbeats - HEARTBEAT.md defines what to do on each heartbeat. +- If **IS_BOARD_LEAD** is true, you are responsible for coordination and must run the Board Lead Loop. ## Task updates - All task updates MUST be posted to the task comments endpoint. diff --git a/templates/HEARTBEAT.md b/templates/HEARTBEAT.md index 5491e930..4eb45d4e 100644 --- a/templates/HEARTBEAT.md +++ b/templates/HEARTBEAT.md @@ -30,6 +30,26 @@ If any required input is missing, stop and request a provisioning update. - GET $BASE_URL/api/v1/boards/{BOARD_ID}/tasks must succeed. - If any check fails, stop and retry next heartbeat. +## Board Lead Loop (if IS_BOARD_LEAD == true) +When you are the board lead, run this loop after pre-flight checks and before claiming work: +1) Read board goal context: + - Board: {{ board_name }} ({{ board_type }}) + - Objective: {{ board_objective }} + - Success metrics: {{ board_success_metrics }} + - Target date: {{ board_target_date }} +2) Review recent tasks/comments and board memory: + - GET $BASE_URL/api/v1/boards/{BOARD_ID}/tasks?limit=50 + - GET $BASE_URL/api/v1/boards/{BOARD_ID}/memory?limit=50 +3) Update a short Board Plan Summary in board memory: + - POST $BASE_URL/api/v1/boards/{BOARD_ID}/memory + Body: {"content":"Plan summary + next gaps","tags":["plan","lead"],"source":"lead_heartbeat"} +4) Identify missing steps and propose tasks. +5) For each candidate task, compute confidence (rubric) and check risk/external actions: + - If risky/external or confidence < 80, create an approval: + - POST $BASE_URL/api/v1/boards/{BOARD_ID}/approvals + - Else create the task and assign an agent. +6) Post a brief status update in board memory (1-3 bullets). + ## Heartbeat checklist (run in order) 1) Check in: ```bash diff --git a/templates/USER.md b/templates/USER.md index 768f1a17..10483014 100644 --- a/templates/USER.md +++ b/templates/USER.md @@ -11,6 +11,14 @@ {{ user_context }} +## Board Goal + +- **Board name:** {{ board_name }} +- **Board type:** {{ board_type }} +- **Objective:** {{ board_objective }} +- **Success metrics:** {{ board_success_metrics }} +- **Target date:** {{ board_target_date }} + --- The more you know, the better you can help. But remember -- you're learning about a person, not building a dossier. Respect the difference.