Skip to content
Merged
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
31 changes: 19 additions & 12 deletions pkg/campaign/prompts/orchestrator_instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,27 +154,31 @@ Execute these steps in sequence each time this orchestrator runs:

4.5 **Deterministic planner step (required when objective/KPIs are present)**

Before choosing additions/updates, produce a small, bounded plan that is rule-based and reproducible from the discovered state:
- Output at most **3** planned actions.
- Prefer actions that are directly connected to improving the **primary** KPI.
- If signals indicate risk or uncertainty, prefer smaller, reversible actions.
Before executing board synchronization, produce a small strategic commentary that is rule-based and reproducible from the discovered state:
- Output at most **3** strategic observations or recommendations.
- Focus on actions that are directly connected to improving the **primary** KPI.
- If signals indicate risk or uncertainty, note smaller, reversible next steps.
- **IMPORTANT**: This planning step is for strategic commentary only. It does NOT limit the number of items added to the board in steps 5-9.5. All discovered items must still be synchronized to the board per the rules below.

Plan format (keep under 2KB):
```json
{
"objective": "...",
"primary_kpi": "...",
"kpi_trends": [{"name": "...", "trend": "Improving|Flat|Regressing"}],
"actions": [
{"type": "add_to_project|update_status|comment", "why": "...", "target_url": "..."}
"strategic_observations": [
{"observation": "...", "recommendation": "..."}
]
}
```

5. **Decide additions (with pacing)** - For each new item discovered:
- Decision: Add to board? (Default: yes for all items with tracker label or worker tracker-id)
- If `governance.max-new-items-per-run` is set, add at most that many new items
- Prefer adding oldest (or least recently updated) missing items first
- **CRITICAL**: All discovered items (both tracker-labeled from step 1 AND worker-created from step 2) MUST be added to the board to maintain synchronization between the campaign state and the project board.
- Decision: Add to board? (Default: **YES** for all items with tracker label or worker tracker-id)
- If `governance.max-new-items-per-run` is set, add at most that many new items in this single run (remaining items will be added in subsequent runs)
- When applying the governance limit, prioritize in this order:
1. Tracker-labeled items (campaign tasks) - add oldest first
2. Worker-created items (worker outputs) - add oldest first
- Determine initial status field value based on item state:
- Open issue/PR/discussion → "Todo" status
- Closed issue/discussion → "Done" status
Expand Down Expand Up @@ -202,10 +206,12 @@ Plan format (keep under 2KB):
#### Phase 3: Write State (Execution)

8. **Execute additions** - Add new items to project board
- Add ALL items identified in step 5 (both tracker-labeled and worker-created), up to the governance limit if set
- Use `update-project` safe-output for each new item
- Set predefined fields: `status` (required), optionally `priority`, `size`
- If worker tracker-id is found in item body (issue/PR/discussion), populate `worker_workflow` field
- Record outcome: success or failure with error details
- If governance limit is reached, log remaining items and note they will be processed in the next run

9. **Execute status updates** - Update existing board items with status changes
- Use `update-project` safe-output for each status change
Expand All @@ -225,11 +231,12 @@ Plan format (keep under 2KB):
#### Phase 4: Report (Output)

11. **Generate status report** - Summarize execution results:
- Total items discovered via tracker label and worker tracker-ids (by type: issues, PRs, discussions)
- Items added to board this run (count and URLs, by type)
- Total items discovered via tracker label (by type: issues, PRs)
- Total items discovered via worker tracker-ids (by type: issues, PRs, discussions)
- Items added to board this run (count and URLs, broken down by: tracker-labeled vs worker-created)
- Items updated on board this run (count and status changes)
- Items with fields populated this run (count and which fields, e.g., worker_workflow)
- Items skipped due to governance limits (and why)
- Items skipped due to governance limits (count, type, and why - noting they will be added in next run)
- Current campaign metrics: open vs closed, progress percentage
- Any failures encountered during writes
- Campaign completion status
Expand Down