Files
gastown/.beads/formulas/mol-digest-generate.formula.toml
max 37ae702427 docs: Clarify formula vs molecule semantics - formulas are NOT instructions
PROBLEM: Agents were reading formula files directly and manually creating beads
for each step, rather than using the cook→pour→molecule pipeline.

FIXES:
- polecat-CLAUDE.md: Changed "following the formula" to "work through your
  pinned molecule" and added explicit anti-pattern warning
- mol-polecat-work.formula.toml: Added note that formula defines template,
  use bd ready to find step beads
- docs/molecules.md: Added "Common Mistake" section with WRONG/RIGHT examples
- mol-*.formula.toml (5 files): Changed "execute this formula" to "work
  through molecules (poured from this formula)"

The key insight: Formulas are source templates (like source code). You never
read them directly. The cook → pour pipeline creates step beads for you.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-02 17:26:08 -08:00

228 lines
5.2 KiB
TOML

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 <rig> # Polecat activity
gt feed --since={{since}} # Activity feed entries
```
c) **Merges:**
```bash
# Git log for merges to main
git -C <rig-path> 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 <<EOF
{{formatted_digest}}
EOF
)"
```
**2. Archive as bead:**
Create a digest bead for permanent record:
```bash
bd create --title="Digest: {{date}}" --type=digest \
--description="{{formatted_digest}}" \
--label=digest,{{period}}
```
**3. Sync:**
```bash
bd sync
```
**Exit criteria:** Digest sent to Mayor and archived as bead."""
[[steps]]
id = "return-to-kennel"
title = "Signal completion and return to kennel"
needs = ["send-digest"]
description = """
Signal work complete and return to available pool.
**1. Signal completion to Deacon:**
```bash
gt mail send deacon/ -s "DOG_DONE $(hostname)" -m "Task: digest-generate
Period: {{period}}
Date range: {{since}} to {{until}}
Status: COMPLETE
Digest sent to Mayor.
Ready for next assignment."
```
**2. Return to kennel:**
Dog returns to available state in the pool.
**Exit criteria:** Deacon notified, dog ready for next work."""
[vars]
[vars.period]
description = "The digest period type (daily, weekly, custom)"
required = true
default = "daily"