[kimi] Implement token quest system for agents (#713) #789

Merged
kimi merged 1 commits from kimi/issue-713 into main 2026-03-21 20:45:35 +00:00
Collaborator

Fixes #713

Summary

Implement a comprehensive token quest system that allows agents to earn bonus tokens by completing special objectives.

Changes

Quest Definitions (config/quests.yaml)

7 initial quests defined:

  • Flaky Test Hunter: Close 3 flaky-test issues (150 tokens)
  • Priority Firefighter: Reduce P1 issues by 2 (200 tokens)
  • Coverage Champion: Improve test coverage by 5% (300 tokens)
  • Daily Runner: Complete 5 Daily Run sessions (250 tokens)
  • Documentation Hero: Improve automation docs (100 tokens)
  • Micro Fix Master: Close 5 micro-fix issues (125 tokens)
  • Bug Squasher: Close 10 bug issues (500 tokens)
  • First Steps: Make first contribution (50 tokens)

Quest System Module (src/timmy/quest_system.py)

  • Load quest definitions from YAML
  • Track quest progress per agent
  • Detect quest completion based on criteria
  • Award tokens via Lightning ledger
  • Support repeatable quests with cooldowns
  • Leaderboard for agent competition

Dashboard Routes (src/dashboard/routes/quests.py)

  • GET /quests/api/definitions - List all quest definitions
  • GET /quests/api/status/{agent_id} - Get agent quest status
  • POST /quests/api/claim - Claim quest rewards
  • POST /quests/api/evaluate - Manually evaluate quest progress
  • GET /quests/api/leaderboard - Get quest leaderboard
  • POST /quests/api/reload - Reload quest config
  • GET /quests - Quest dashboard UI
  • GET /quests/panel/{agent_id} - HTMX panel for live updates

Daily Run Integration

Quest completions are automatically detected when Daily Run metrics are fetched at /daily-run/metrics.

Templates

  • src/dashboard/templates/quests.html - Main quest dashboard
  • src/dashboard/templates/partials/quests_panel.html - Live quest panel

Tests (tests/unit/test_quest_system.py)

Comprehensive unit tests covering:

  • Quest definition loading
  • Progress tracking
  • Completion detection
  • Token rewards
  • Cooldown handling
  • Leaderboard
  • Reset functionality

Acceptance Criteria

  • Quests can be defined and adjusted easily via config/quests.yaml
  • At least one quest ties directly into Daily Run or test-improvement work
  • Quest completion triggers visible token rewards via Lightning ledger

Testing

All tests pass:

tox -e format  # OK
tox -e lint    # OK
tox -e unit    # 2711 passed, 1 skipped
Fixes #713 ## Summary Implement a comprehensive token quest system that allows agents to earn bonus tokens by completing special objectives. ## Changes ### Quest Definitions (config/quests.yaml) 7 initial quests defined: - **Flaky Test Hunter**: Close 3 flaky-test issues (150 tokens) - **Priority Firefighter**: Reduce P1 issues by 2 (200 tokens) - **Coverage Champion**: Improve test coverage by 5% (300 tokens) - **Daily Runner**: Complete 5 Daily Run sessions (250 tokens) - **Documentation Hero**: Improve automation docs (100 tokens) - **Micro Fix Master**: Close 5 micro-fix issues (125 tokens) - **Bug Squasher**: Close 10 bug issues (500 tokens) - **First Steps**: Make first contribution (50 tokens) ### Quest System Module (src/timmy/quest_system.py) - Load quest definitions from YAML - Track quest progress per agent - Detect quest completion based on criteria - Award tokens via Lightning ledger - Support repeatable quests with cooldowns - Leaderboard for agent competition ### Dashboard Routes (src/dashboard/routes/quests.py) - `GET /quests/api/definitions` - List all quest definitions - `GET /quests/api/status/{agent_id}` - Get agent quest status - `POST /quests/api/claim` - Claim quest rewards - `POST /quests/api/evaluate` - Manually evaluate quest progress - `GET /quests/api/leaderboard` - Get quest leaderboard - `POST /quests/api/reload` - Reload quest config - `GET /quests` - Quest dashboard UI - `GET /quests/panel/{agent_id}` - HTMX panel for live updates ### Daily Run Integration Quest completions are automatically detected when Daily Run metrics are fetched at `/daily-run/metrics`. ### Templates - `src/dashboard/templates/quests.html` - Main quest dashboard - `src/dashboard/templates/partials/quests_panel.html` - Live quest panel ### Tests (tests/unit/test_quest_system.py) Comprehensive unit tests covering: - Quest definition loading - Progress tracking - Completion detection - Token rewards - Cooldown handling - Leaderboard - Reset functionality ## Acceptance Criteria - [x] Quests can be defined and adjusted easily via config/quests.yaml - [x] At least one quest ties directly into Daily Run or test-improvement work - [x] Quest completion triggers visible token rewards via Lightning ledger ## Testing All tests pass: ```bash tox -e format # OK tox -e lint # OK tox -e unit # 2711 passed, 1 skipped ```
kimi added 1 commit 2026-03-21 20:45:04 +00:00
feat: implement token quest system for agents (#713)
Some checks failed
Tests / lint (pull_request) Has been cancelled
Tests / test (pull_request) Has been cancelled
6f4642efd8
Implement a comprehensive token quest system that allows agents to earn
bonus tokens by completing special objectives.

Features:
- Quest definitions in config/quests.yaml with 7 initial quests:
  - Flaky Test Hunter: Close 3 flaky-test issues
  - Priority Firefighter: Reduce P1 issues by 2
  - Coverage Champion: Improve test coverage
  - Daily Runner: Complete 5 Daily Run sessions
  - Documentation Hero: Improve automation docs
  - Micro Fix Master: Close 5 micro-fix issues
  - Bug Squasher: Close 10 bug issues
  - First Steps: Make first contribution

- QuestSystem module (src/timmy/quest_system.py) for:
  - Loading quest definitions from YAML
  - Tracking quest progress per agent
  - Detecting quest completion based on criteria
  - Awarding tokens via Lightning ledger
  - Supporting repeatable quests with cooldowns

- Dashboard routes (src/dashboard/routes/quests.py) for:
  - Listing quests and their status
  - Claiming quest rewards
  - Quest leaderboard
  - Daily Run integration for auto-detection

- Daily Run integration for quest completion detection
- HTML templates for quest dashboard UI
- Comprehensive unit tests

Refs #713
kimi merged commit a95cf806c8 into main 2026-03-21 20:45:35 +00:00
kimi deleted branch kimi/issue-713 2026-03-21 20:45:36 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Rockachopa/Timmy-time-dashboard#789