Skip to content
Closed
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
86 changes: 86 additions & 0 deletions BOUNTY_683_AUTO_MATCH.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# RIP-302 Auto-Matching Engine — Implementation Summary

**Bounty:** #683 Tier 3 — Auto-matching | **Reward:** 75 RTC
**Claimant:** kuanglaodi2-sudo
**Wallet:** C4c7r9WPsnEe6CUfegMU9M7ReHD1pWg8qeSfTBoRcLbg
**PR:** https://github.com/Scottcjn/Rustchain/pull/XXXX

---

## What Was Built

A reputation-weighted job-to-worker matching engine for the RIP-302 Agent Economy.

### Endpoints

| Method | Path | Description |
|--------|------|-------------|
| `GET` | `/agent/match/<job_id>` | Ranked worker suggestions for a specific job |
| `POST` | `/agent/match/<job_id>/view` | Record a worker viewing a job |
| `GET` | `/agent/match/suggest?wallet=...` | Best-fit open jobs for a worker |
| `GET` | `/agent/match/leaderboard` | Top workers per category |
| `GET` | `/agent/match/stats` | Match engine health stats |

---

## Scoring Algorithm

Each worker receives a **0–100 match score** per job:

| Component | Max Points | Description |
|-----------|-------------|-------------|
| Trust Score | 40 | Global completion rate + rating |
| Category Expertise | 35 | Per-category success rate (code gets 1.2× weight) |
| Reward Fitness | 15 | Handles similar reward tiers |
| Recency Bonus | 10 | Active within 14 days |

**Formula:** `score = trust(0–40) + category(0–35) + reward_fit(0–15) + recency(0–10)`

---

## Database Tables Added

```sql
agent_category_stats -- per-worker per-category performance
agent_match_cache -- 1-hour rate-limited cache per job
agent_job_views -- tracks which workers viewed which jobs
```

---

## Integration

Added to `node/wsgi.py`:

```python
from rip302_auto_match import register_auto_match
register_auto_match(app, DB_PATH)
```

---

## Example Usage

```bash
# Get top 10 worker suggestions for a job
curl "https://rustchain.org/agent/match/job_abc123?limit=10"

# View a job (helps improve match quality)
curl -X POST "https://rustchain.org/agent/match/job_abc123/view" \
-H "Content-Type: application/json" \
-d '{"worker_wallet": "my-agent-wallet"}'

# Find best jobs for my wallet
curl "https://rustchain.org/agent/match/suggest?wallet=my-agent-wallet&limit=10"

# Leaderboard for 'code' category
curl "https://rustchain.org/agent/match/leaderboard?category=code&limit=20"
```

---

## Files Changed

- `node/wsgi.py` — added auto-match registration
- `node/rip302_auto_match.py` — new auto-match module
- `rip302_auto_match.py` — new auto-match module (root copy)
Loading