Skip to content
Open
Show file tree
Hide file tree
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
38 changes: 38 additions & 0 deletions examples/deepwork/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Deepwork Examples

Production examples from the Deepwork multi-agent swarm — a Gas Town running 6 rigs with 15+ agents, private wasteland federation, and external contributor onboarding.

## Packs

### `packs/deepwork-org/`

Full org config pack for running a multi-agent Gas Town with:

- **Private wasteland federation** — DoltHub-based task board with bidirectional sync
- **Deterministic effort estimation** — pattern-based task sizing (trivial → epic)
- **Self-evolving knowledge** — 19 knowledge files, auto-harvested from closed beads every 6h
- **Gitea → GitHub mirror** — hourly sync with auto-release creation
- **10 agent roles** — mayor, deacon, witness, refinery, polecat, crew, coordinator, planner, reviewer, worker
- **7 cron jobs** — thread guardrail, log rotation, knowledge evolution, GitHub mirror, wasteland push, pack update, auto-release
- **12 wasteland governance rules** — enforced via deepwork-governance.yaml

### Key Features

**Wasteland Integration in Formulas:**
- `mol-polecat-work` — polecats auto-detect wasteland items at start (3 cases: direct link, fuzzy match, auto-create), claim them, and complete on `gt done`
- `mol-witness-patrol` — witnesses check wasteland each patrol cycle and dispatch unclaimed work
- Smart internal filter ensures only externally meaningful work reaches wasteland

**External Contributor Onboarding:**
- Complete onboarding guide at `docs/wasteland/ONBOARDING.md`
- Task posting template at `docs/wasteland/POST_TEMPLATE.md`
- Effort/priority guide, reputation system, project catalog

### Prerequisites

This pack requires a [patched gt binary](https://github.com/gastownhall/gastown/pull/3501) that reads wasteland config from `mayor/wasteland.json` instead of hardcoding `hop/wl-commons`.

### Source

- GitHub: [<your-github-org>/deepwork-org-config-pack](https://github.com/<your-github-org>/deepwork-org-config-pack)
- Maintainer: [@<your-github-handle>](https://github.com/<your-github-handle>)
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Coordinator Crons — installed on planner/coordinator nodes
# These run on the parent GT that manages workers.

role: "coordinator"
requires:
- cron
- bash
- dolt # for DoltHub sync

crons:
dolthub-sync:
schedule: "*/2 * * * *"
script: "sync-dolthub.sh"
script_path: "$GT_ROOT/mayor/sync-dolthub.sh"
log: "/tmp/dolthub-sync.log"
purpose: "Sync DoltHub mail database for cross-GT communication"

mesh-sync:
schedule: "*/2 * * * *"
script: "mesh-sync.sh"
log: "/tmp/gt-mesh-sync.log"
purpose: "Mesh heartbeat, knowledge sync, mail handler trigger"

deacon-pr-review:
schedule: "*/30 * * * *"
script: "deacon-pr-review.sh"
purpose: "Auto-review and merge approved PRs across repos"

mesh-improve-review:
schedule: "*/10 * * * *"
script: "mesh-improve.sh review"
log: "/tmp/mesh-improve.log"
purpose: "Self-improving loop: review and graduate improvements"

mesh-autosync-digest:
schedule: "0 */2 * * *"
script: "mesh-auto-sync.sh digest"
log: "/tmp/mesh-autosync.log"
purpose: "Broadcast work digest to mesh peers every 2 hours"

mesh-work-watchdog:
schedule: "*/5 * * * *"
script: "mesh-work-watchdog.sh"
purpose: "Check worker container sessions alive, restart if dead"

mesh-mayor-daemon:
schedule: "*/10 * * * *"
script: "mesh-mayor-daemon.sh"
purpose: "Mayor daemon health check"

mesh-github-sync:
schedule: "0 6 * * *"
script: "mesh-github-sync.sh"
purpose: "Daily sync to GitHub public repos"

mesh-pack-updater:
schedule: "0 */2 * * *"
script: "mesh-pack-updater.sh"
purpose: "Update blueprint packs from DoltHub"

cron-audit:
schedule: "0 6 * * *"
script: "cron-audit.sh --enforce"
log: "/tmp/cron-audit.log"
purpose: "Daily audit: verify crontab matches cron-registry.yaml"
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Release & Documentation Automation — Blueprint Level
# Applied to ALL rigs via deepwork-base pack

# Daily README check: regenerate if code changed
readme_update:
schedule: "0 6 * * *" # 6am daily
command: "mesh-readme-update.sh"
description: "Check for code changes and update README if needed"
scope: "all-rigs"
executor: "chad-ji" # Content work → Kimi

# Release detection: check if enough work accumulated for a release
release_check:
schedule: "0 8 * * 1" # Monday 8am
command: "mesh-release-check.sh"
description: "Check if dev has enough changes for a release PR"
scope: "all-rigs"
executor: "mayor"

# Changelog generation: auto-generate from git log
changelog_gen:
schedule: "on-release" # Triggered, not cron
command: "mesh-changelog-gen.sh"
description: "Generate CHANGELOG.md from conventional commits"
scope: "all-rigs"
executor: "chad-ji"

# Daily status to Telegram
daily_status:
schedule: "0 9 * * *" # 9am daily
command: "mesh-daily-status.sh"
description: "Post daily status to Telegram Status topic"
scope: "coordinator"
executor: "mayor"
telegram_topic: 13
73 changes: 73 additions & 0 deletions examples/deepwork/packs/deepwork-org/crons/town-crons.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Town Crons — Active cron jobs for Gas Town
# Updated: 2026-04-01
# Context: Single orchestrator (gt v0.13), local Gitea, wasteland federation

# Active crons (in actual crontab)
active:
thread-guardrail:
schedule: "* * * * *"
script: "scripts/mayor/thread-guardrail.sh"
log: "logs/thread-guardrail.log"
purpose: "Kill orphan node/gt/bd processes before they exhaust ulimit (16384)"

log-rotation:
schedule: "0 0 * * *"
script: "scripts/mayor/log-rotate.sh"
log: "logs/log-rotate.log"
purpose: "Rotate GT-related logs exceeding 10MB, keep 2 copies"

knowledge-evolve:
schedule: "0 */6 * * *"
script: "scripts/knowledge/cron-evolve.sh"
log: "logs/knowledge-evolve.log"
purpose: "Scan closed beads for lessons, append to knowledge base and changelog"

gitea-to-github:
schedule: "0 * * * *"
script: "scripts/mayor/gitea-to-github.sh"
log: "logs/gitea-github-sync.log"
purpose: "Mirror Gitea repos to <your-github-org> GitHub org, create releases for 5+ commits"

wasteland-push:
schedule: "*/15 * * * *"
script: "scripts/mayor/wasteland-push.sh"
log: "logs/wasteland-push.log"
purpose: "Push wasteland changes to DoltHub so federation friends see updates"

pack-update:
schedule: "30 */6 * * *"
script: "scripts/mayor/pack-update.sh"
log: "logs/pack-update.log"
purpose: "Sync knowledge, changelog, formulas, docs to org config pack (Gitea + GitHub)"

readme-release:
schedule: "0 3 * * *"
script: "scripts/mayor/readme-release.sh"
log: "logs/readme-release.log"
purpose: "Create GitHub releases for repos with 10+ new commits since last release"

# Disabled crons (kept for reference)
disabled:
flywheel-v4: "<your-worker> load balancer — obsolete (gt --agent handles providers)"
sync-dolthub: "DoltHub mesh sync — no remote GT instances currently"
batch-dispatch-<your-worker>: "<your-worker> dispatch — obsolete"
metrics-collector: "gascity-otel — removed"
<your-worker>-healer: "<your-worker> health — removed"

# Recommended additions (not yet implemented)
recommended:
orphan-sweep:
schedule: "*/5 * * * *"
purpose: "Reset beads assigned to dead agents"
gate-sweep:
schedule: "*/1 * * * *"
purpose: "Evaluate timer/condition gates on beads"
wisp-compact:
schedule: "0 * * * *"
purpose: "TTL-based cleanup of ephemeral beads"
prune-branches:
schedule: "0 */6 * * *"
purpose: "Clean stale polecat branches"
spawn-storm-detect:
schedule: "*/5 * * * *"
purpose: "Detect beads stuck in crash loops"
42 changes: 42 additions & 0 deletions examples/deepwork/packs/deepwork-org/crons/worker-crons.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Worker Crons — auto-installed on mesh join
# These run inside worker containers/nodes.
# Variables: $GT_ROOT resolves to the GT workspace root.
#
# On install, cron-audit.sh reads this file and writes the crontab.
# On daily audit, cron-audit.sh ensures crontab matches this definition.

role: "worker"
requires:
- cron # apt-get install -y cron
- bash

crons:
worker-mesh-sync:
schedule: "*/2 * * * *"
script: "mesh-sync.sh"
log: "/tmp/mesh-sync.log"
purpose: "Mesh heartbeat + DoltHub sync"

worker-inbox-check:
schedule: "*/5 * * * *"
script: "mesh-inbox.sh"
log: "/tmp/mesh-inbox.log"
purpose: "Check inbox for work assignments from coordinator"

worker-watchdog:
schedule: "*/5 * * * *"
script: "mesh-work-watchdog.sh"
log: "/tmp/mesh-watchdog.log"
purpose: "Check for stale claims, idle sessions, restart if needed"

worker-autosync-digest:
schedule: "0 */2 * * *"
script: "mesh-auto-sync.sh digest"
log: "/tmp/mesh-autosync.log"
purpose: "Broadcast activity digest to coordinator"

worker-cron-audit:
schedule: "0 6 * * *"
script: "cron-audit.sh --enforce"
log: "/tmp/cron-audit.log"
purpose: "Daily audit: ensure crontab matches registry"
28 changes: 28 additions & 0 deletions examples/deepwork/packs/deepwork-org/docs/GLOSSARY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Gas Town Glossary

| Term | Definition |
|------|-----------|
| **Bead** | Unit of work tracked in Dolt. ID format: `prefix-hash` (e.g., `of-lj5`). |
| **Rig** | Self-contained project workspace with its own repo, beads DB, and agents. |
| **Town** | Top-level Gas Town deployment. One machine, one town. |
| **Mayor** | Human-facing coordinator. Dispatches work, reviews, merges. |
| **Deacon** | Automated patrol agent. Spawns witnesses, runs plugins. |
| **Witness** | Per-rig lifecycle agent. Monitors health, recovers orphans. |
| **Refinery** | Per-rig merge processor. Rebases, tests, merges. |
| **Polecat** | Disposable worker. Spawned per-bead via `gt sling`. |
| **Crew** | Persistent worker with domain expertise. |
| **Dog** | Short-lived helper for deacon. |
| **Sling** | Dispatching a bead to an agent. `gt sling <bead> <target>`. |
| **Convoy** | Group of related beads tracked together. |
| **Molecule** | Instance of a formula — a multi-step workflow being executed. |
| **Formula** | Workflow template (TOML) defining steps for agents. |
| **Wisp** | Lightweight, ephemeral bead (patrol reports, status checks). |
| **Hook** | Bead attached to an agent — the agent's current work assignment. |
| **Plugin** | Deacon patrol task on a cooldown gate. |
| **Mesh** | Cross-town communication via DoltHub sync. |
| **Wasteland** | Shared federation board on DoltHub for collaborative work. |
| **bd** | Beads CLI for issue tracking. |
| **gt** | Gas Town CLI for agent orchestration. |
| **Tap** | Guard/hook system intercepting certain gt commands. |
| **Boot** | Ephemeral deacon watchdog agent. |
| **Ralph Loop** | Fresh-context-per-step execution for multi-step work. |
Loading