GitHub Repo Scan Generate Deploy Optimize PR Merged

Quick Start

# Scan a Go repo for optimization candidates
bounty-factory scan https://github.com/lightningnetwork/lnd

# Generate eval scripts + target configs from the scan
bounty-factory generate scan-report.json -o lnd-targets/

# Deploy targets to the satwork coordinator
bounty-factory deploy lnd-targets/ --coordinator https://satwork.ai

# After workers find improvements, generate a PR
bounty-factory pr lnd-ban-management --repo https://github.com/lightningnetwork/lnd

Supported Languages

LanguageWhat it scansTested on
Go Named constants (Default*, Min*, Max*), duration constants, TODO:tune comments, channel buffers, retry loops, benchmarks lightningnetwork/lnd — 244 candidates, 40 benchmarks
Python Module constants (UPPER_SNAKE), class defaults, function parameter defaults, config files, TODO:tune, pytest-benchmark psf/requests — 5 candidates, 339 tests
Rust const/static declarations, Default trait implementations, TODO:tune, criterion benchmarks, #[bench] tokio-rs/tokio — 32 candidates, 44 benchmarks
JavaScript / TypeScript const declarations, config objects, .env.example defaults, TODO:tune, benchmark suites webpack/webpack — 4 candidates, 3,395 tests

How It Works

Phase 1: Scan

bounty-factory scan <github-url> clones the repo, detects the language, and runs two passes:

Each candidate is semantically classified (timeout? buffer? probability? threshold?) and grouped into logical optimization targets. Output: scan-report.json.

Phase 2: Generate

bounty-factory generate <report> creates a complete satwork target for each group:

Phase 3: Deploy

bounty-factory deploy <targets-dir> pushes targets to the coordinator and hot-reloads. Workers discover new targets automatically via /api/discover.

Phase 4: PR

bounty-factory pr <target-id> --repo <url> fetches the winning parameters, maps them back to source code, and generates a PR with annotated diffs, benchmark comparisons, and verification instructions.

Semantic Classification

The scanner classifies each parameter by its variable name and surrounding context:

CategoryDetected byBounds strategy
timeouttimeout, deadline, expiry, ttl0.1x to 10x current value
buffer_sizebuffer, page_size, batch_size, pool0.25x to 4x
probabilityprob, weight, factor, ratio, decay[0, 1]
retryretry, retries, max_attempts, backoff±50%
concurrencyworkers, threads, conns, goroutines0.25x to 4x
intervalinterval, period, tick, flush, rotation0.1x to 10x
cachecache_size, evict, lru, prealloc0.25x to 4x
thresholdthreshold, limit, max_, min_, cap±50%
feefee, cost, price, rate_ppm, budget±50%

Eval Templates

Generated eval scripts use domain-specific simulation templates:

DomainTriggered bySimulates
routingrouting/, htlcswitch/, autopilot/Synthetic LN graph, payment routing, success rate + fees
databasechanneldb/, sqldb/, graph/db/Query patterns, batch commits, cache hit rates
gossipdiscovery/Message propagation, bandwidth, peer banning
connectionpeer/, server, watchtower/Peer connections, reconnection, keepalive
cachecache/Hit rates, eviction, memory efficiency
sweepsweep/, contractcourt/Fee environment, UTXO batching, deadline management
genericeverything elseMulti-metric sensitivity analysis

Live Results

0

Active targets

Live on the coordinator right now

0

Total proposals

Evaluated by distributed workers

0

Improvements found

Verified, reproducible, ready for PRs

Try it now. The Bounty Factory scanned lightningnetwork/lnd and generated live targets. Workers have found improvements of +4% to +19.8%. See the Lightning Labs presentation for the full demo.

Example: Scan Output

$ bounty-factory scan https://github.com/lightningnetwork/lnd

Cloning https://github.com/lightningnetwork/lnd...
  Language: go
  Commit: db765a752b63
  Found 308 candidates, 40 benchmarks, 1733 tests
  After confidence filter (>=0.3): 244 candidates
  Grouped into 107 targets

============================================================
SCAN SUMMARY: https://github.com/lightningnetwork/lnd
============================================================
  Candidates: 244
  Benchmarks: 40
  Tests: 1733
  Target groups: 107

  lnd-lncfg-timeout                         10 params  timeout
  lnd-htlcswitch-timeout                     7 params  timeout
  lnd-sqldb-buffer_size                      6 params  buffer_size
  lnd-routing-probability                    5 params  probability
  lnd-discovery-threshold                    7 params  threshold       [TODO:tune x3]
  lnd-graph-db-cache                         3 params  cache
  ...

Example: Generated PR

$ bounty-factory pr lnd-ban-management --repo https://github.com/lightningnetwork/lnd

PR GENERATED: perf: optimize LND Gossip Ban Management (TODO: tune) (+19.8%)
  Branch: bounty-factory/optimize-lnd-ban-management
  Changes: 4 parameters across 1 files

--- a/discovery/ban.go
+++ b/discovery/ban.go
- DefaultBanThreshold = 100
+ DefaultBanThreshold = 57

- maxBannedPeers = 10_000
+ maxBannedPeers = 1_000

- banTime = time.Hour * 48
+ banTime = time.Hour * 149

- resetDelta = time.Hour * 48
+ resetDelta = time.Hour * 57