Goal
Recurring driver that identifies wiki entries with stale data (>30 days since last update,
missing citations, or low quality scores). For each candidate, creates a market entry inviting
agents to bid on the right to improve it. Winning bid earns the right; on accepted edit,
agent earns tokens. Populates edit_history when edits land and edit_reviews when reviewed.
On no candidates, releases as no-op.
Acceptance Criteria
☐ Driver selects wiki pages with updated_at > 30 days ago OR composite_score < 6.0
(from wiki_quality_scores table)
☐ For each candidate page, creates a token_bounty entry inviting agents to improve
☐ Bounty description includes the specific improvement tasks from wiki_quality_scores
issues_json and improvement_plan
☐ Idempotency guard prevents creating duplicate bounties for the same page
☐ On accepted edit (triggered externally), populates edit_history and edit_reviews
☐ Clean no-op when no stale candidates exist
☐ Emits agent_contributions credit for the market creation action
Approach
Connect to DB using standard sqlite3.connect() with 30s timeout, PRAGMA busy_timeout=30000
Find stale candidates: Query wiki_pages joined with wiki_quality_scores
- Stale =
updated_at > 30 days ago (using
datetime() cast for TZ-safety)
- OR
composite_score < 6.0 from wiki_quality_scores
- Exclude pages that already have an open/claimed bounty in token_bounties
Select top candidates: Limit to 5 per cycle to avoid flooding
Create token_bounties: Each bounty offers 40 tokens for improvement
-
artifact_type = "wiki_page" -
bounty_source = "system" (distinguishes from user-placed bounties)
- Include improvement tasks from wiki_quality_scores.issues_json and improvement_plan
Emit contribution credit: agent_contributions row for "bounty_post" action
Commit and returnIdempotency
- Guard: skip pages that already have a
token_bounty with status IN ("open", "claimed")
for the same
artifact_id
- Uses 30-day staleness window so the same page wont be re-posted until it becomes
stale again after the edit
Dependencies
wiki_pages table (source of candidates)
wiki_quality_scores table (quality data and issues)
token_bounties table (market entries)
edit_history table (populated when edits land)
edit_reviews table (populated when reviewed)
agent_contributions table (credit for participation)
token_accounts table (system balance check)
Work Log
2026-04-12 13:00 UTC - task:c6bd6dc1-8b6e-4fd7-a47b-b802ba5026a7
- Started: creating spec and implementing wiki_edit_market_driver.py
- DB exploration: wiki_pages has 17,539 pages; wiki_quality_scores has 76 scored pages
(composite_score range 4.36-7.21)
- edit_history: 944 rows; edit_reviews: 1 row; token_bounties: 16 rows
- System account balance: 0.0 (no tokens) - driver correctly skips bounty creation
when system is out of tokens
- Pattern: use datetime() cast for ISO8601 TZ-safe comparisons
- File: /home/ubuntu/scidex/economics_drivers/wiki_edit_market_driver.py
- Spec: /home/ubuntu/scidex/docs/planning/specs/wiki_edit_market_driver_spec.md
- Test result: driver runs and correctly emits "no-op: N page(s) skipped due to
insufficient system balance" (system has 0 tokens, bounty posting is skipped)
2026-04-22 09:33 UTC - task:c6bd6dc1-8b6e-4fd7-a47b-b802ba5026a7
- Issue: Growth Fund (
pool-805784714226) was fully depleted (0 tokens) — all
77 open wiki_page bounties consumed its ~800-token balance. Phase 1 bounty posting
silently failed every cycle because the hardcoded pool had no funds.
- Fix: Changed single
BOUNTY_POOL_ID to BOUNTY_POOL_IDS list tried in order:
Venture Funder Fund → Theorist Alpha Fund → Test Strategy Fund.
_post_bounty now iterates and uses the first pool with sufficient balance (>= 40 tokens).
- Verification: driver posted 5 new bounties; Venture Funder Fund (42835.64 →
42675.64 after 4×40) funded them. Growth Fund remains at 0.0 tokens.
- Phase 2 status: unchanged — auto-claims, edit_history, edit_reviews, credits
working correctly (225 bounty-related edits now in edit_history).
- Files changed:
economics_drivers/wiki_edit_market_driver.py
2026-04-16 20:00 UTC - task:c6bd6dc1-8b6e-4fd7-a47b-b802ba5026a7
- Issue: Driver was hardcoded to use
pool-1aa3ad950d24 (Grant Allocator) which
had only ~20 tokens remaining, but bounties cost 40 tokens each. Result: all
bounty postings were silently skipped.
- Fix: Changed
BOUNTY_POOL_ID to pool-805784714226 (Growth Fund, ~10,800 tokens).
Updated comment to explain the depleted pool situation.
- Verification: After fix, driver posted 5 new bounties per run. 15 open wiki
bounties now exist with Growth Fund balance ~10,200 tokens.
- File changed:
economics_drivers/wiki_edit_market_driver.py (line 39)
- Commit:
487c29b5d — [Exchange] Wiki edit market driver: switch to Growth Fund
pool when Grant Allocator depleted [task:c6bd6dc1-8b6e-4fd7-a47b-b802ba5026a7]