description = """ Generate daily digest for overseer (Mayor). Dogs work through molecules (poured from this formula) on a scheduled basis (daily, or triggered by plugin) to create summary digests of Gas Town activity. This aggregates: - Work completed across all rigs - Issues filed and closed - Incidents and escalations - Agent health metrics - Key statistics and trends ## Dog Contract This is infrastructure work. You: 1. Receive digest period via hook_bead (e.g., daily, weekly) 2. Collect data from all rigs you have access to 3. Generate formatted digest 4. Send to overseer 5. Archive digest as bead 6. Return to kennel ## Variables | Variable | Source | Description | |----------|--------|-------------| | period | hook_bead | Time period for digest (daily, weekly) | | since | computed | Start timestamp for data collection | | until | computed | End timestamp (usually now) | ## Why Dogs? Digest generation requires reading from multiple rigs. Dogs have multi-rig worktrees. This is also a periodic task that doesn't need a dedicated polecat.""" formula = "mol-digest-generate" version = 1 [squash] trigger = "on_complete" template_type = "work" include_metrics = true [[steps]] id = "determine-period" title = "Determine digest time period" description = """ Establish the time range for this digest. **1. Check assignment:** ```bash gt hook # Shows period type ``` **2. Calculate time range:** | Period | Since | Until | |--------|-------|-------| | daily | Yesterday 00:00 | Today 00:00 | | weekly | Last Monday 00:00 | This Monday 00:00 | | custom | From hook_bead | From hook_bead | ```bash # For daily digest since=$(date -v-1d +%Y-%m-%dT00:00:00) until=$(date +%Y-%m-%dT00:00:00) ``` **3. Record period for reporting:** Note the exact timestamps for the digest header. **Exit criteria:** Time period established with precise timestamps.""" [[steps]] id = "collect-rig-data" title = "Collect activity data from all rigs" needs = ["determine-period"] description = """ Gather activity data from each rig in the town. **1. List accessible rigs:** ```bash gt rigs # Returns list of rigs: gastown, beads, etc. ``` **2. For each rig, collect:** a) **Issues filed and closed:** ```bash # From rig beads bd list --created-after={{since}} --created-before={{until}} bd list --status=closed --updated-after={{since}} ``` b) **Agent activity:** ```bash gt polecats # Polecat activity gt feed --since={{since}} # Activity feed entries ``` c) **Merges:** ```bash # Git log for merges to main git -C log --merges --since={{since}} --oneline main ``` d) **Incidents:** ```bash # Issues tagged as incident or high-priority bd list --label=incident --created-after={{since}} ``` **3. Aggregate across rigs:** Sum counts, collect notable items, identify trends. **Exit criteria:** Raw data collected from all accessible rigs.""" [[steps]] id = "generate-digest" title = "Generate formatted digest" needs = ["collect-rig-data"] description = """ Transform collected data into formatted digest. **1. Calculate summary statistics:** - Total issues filed - Total issues closed - Net change (closed - filed) - By type (task, bug, feature) - By rig **2. Identify highlights:** - Biggest completions (epics, large features) - Incidents (any P0/P1 issues) - Notable trends (increasing backlog, fast closure rate) **3. Generate digest text:** ```markdown # Gas Town Daily Digest: {{date}} ## Summary - **Issues filed**: N (tasks: X, bugs: Y, features: Z) - **Issues closed**: N - **Net change**: +/-N ## By Rig | Rig | Filed | Closed | Active Polecats | |-----|-------|--------|-----------------| | gastown | X | Y | Z | | beads | X | Y | Z | ## Highlights ### Completed - {{epic or feature}} - completed by {{polecat}} ### Incidents - {{incident summary if any}} ## Agent Health - Polecats spawned: N - Polecats retired: N - Average work duration: Xh ## Trends - Backlog: {{increasing/stable/decreasing}} - Throughput: {{issues/day}} ``` **Exit criteria:** Formatted digest ready for delivery.""" [[steps]] id = "send-digest" title = "Send digest to overseer" needs = ["generate-digest"] description = """ Deliver digest to the Mayor. **1. Send via mail:** ```bash gt mail send mayor/ -s "Gas Town Digest: {{date}}" -m "$(cat <