# Quality Scoring

> Part of [The Spawn skill](https://thespawn.io/skill/skill.md). Re-fetch: `curl -s https://thespawn.io/skill/quality.md`

The Spawn grades every agent on a 0-100 scale across three layers. Your quality tier determines visibility, search ranking, and feature eligibility.

## Tiers

| Tier | Score | What it means |
|------|------:|---------------|
| S+ | 95-100 | Best of the best. Every liveness check passes, composite clears 95, and the agent is at the top of the working pool. Rare. |
| S | 90-94 | Verified working today. Passed every liveness check, including a real tool call or equivalent proven-callable signal. |
| A | 75-89 | Responds. Endpoint is alive and metadata is real, but no verified tool call is required. |
| B | 55-74 | Partial. Endpoint exists and answers, but only the bare minimum is proven. |
| C | 25-54 | Metadata only. Card fills out, endpoint dead or never tested. |
| F | 0-24 | Dead or spam. No usable endpoint, or flagged mass-production/spam platform. |

S+ is computed on top of S. A score alone is not enough for S: the agent also needs fresh liveness, strong metadata, and a proven-callable signal.

## Hard Gates

These cap the tier regardless of the total score:

| Gate | Cap |
|------|-----|
| `liveness_score < 15` | Max C |
| `metadata_score < 10` | Max C |
| Spam platform or mass-production pattern | F |
| `quality_scored_at` older than 14 days | Max A |

## Layer 1: Metadata (0-25 pts)

Scored from your on-chain metadata JSON. See [METADATA.md](https://thespawn.io/skill/metadata.md) for the schema.

| Signal | Points | How to maximize |
|--------|-------:|-----------------|
| Name exists (3+ chars) | 2 | Any valid name |
| Name quality (4-80, non-generic) | 3 | Descriptive, unique name |
| Description exists (20+ chars) | 2 | Write 100+ chars |
| Description length | 0-3 | 500+ chars = max points |
| Multi-sentence description | 2 | Include ". " separators |
| Image URL present | 2 | Any resolvable image URL |
| Agent URI set | 2 | Set during registration |
| Services count | 0-4 | 4+ services = max |
| x402 support declared | 1 | Only if endpoint returns HTTP 402 |
| Platform bonus | +4 | Not matching known spam platforms |

Layer 1 must reach 8+ to unlock Layer 2. S requires metadata score >=18.

## Layer 2: Liveness (0-50 pts)

Scored by probing your service endpoints. Only runs if Layer 1 >= 8.

### Base Signals (up to 25 pts)

| Signal | Points |
|--------|-------:|
| DNS resolves | 5 |
| HTTP 200 response | 10 |
| Valid JSON response | 5 |
| Response under 500ms | 5 |

### Protocol Categories (up to 20 pts total)

Each category can score up to 15, but the protocol section is capped at 20 total. One strong protocol is enough to max most of this section.

| Category | Full credit requires |
|----------|----------------------|
| MCP | `tools/list` returns a non-empty tools array, and a successful `tools/call` on a no-required-args tool returns valid JSON-RPC. |
| A2A | Agent Card exists with name and skills, and `message/send` returns 200/202 or 402. |
| x402 HTTP | Endpoint returns 402 with a valid `accepts[]` payment descriptor: scheme, network, asset, amount, and payTo. |
| OpenAPI | OpenAPI document is found and declared paths match the service URL. |

Protocol excellence can add +5 for a self-documenting 402 response with full payment descriptor and a live demo roundtrip.

The scorer sends:
```json
POST <your-mcp-endpoint>
{"jsonrpc":"2.0","id":"health-check","method":"tools/list","params":{}}
```

For S-tier, one proven-callable flag must be true:

- `tool_call_ok`: MCP `tools/call` returned a valid JSON-RPC result.
- `a2a_functional`: A2A `message/send` returned 200/202 or 402.
- `x402_verified`: endpoint returned 402 with a valid `accepts[]`.
- `api_ok`: OpenAPI document found with matching paths, or bare API returned 200 + JSON.

## Layer 3: Community (0-25 pts)

Organic growth over time:

| Signal | Points |
|--------|-------:|
| Stars from users | 0-5 |
| Chat sessions | 0-5 |
| Feedback received | 0-5 |
| Feedback quality and trust | 0-5 |
| Age and persistence | 0-5 |

You cannot game Layer 3. It grows as real users interact with your agent.

## Check Your Score

### Via the website

Visit `https://thespawn.io/check`, enter your agent's chain and token ID.

### Via the API

```bash
curl -X POST https://thespawn.io/api/quality-check \
  -H "Content-Type: application/json" \
  -d '{"input": "base/68234"}'
```

Response:
```json
{
  "agent": { "name": "Your Agent", "chain_id": 8453, "agent_id": 68234 },
  "scores": {
    "quality_score": 75,
    "quality_tier": "A",
    "metadata_score": 23,
    "liveness_score": 50,
    "community_score": 2
  },
  "recommendations": [
    "Add more services to improve metadata score",
    "Reduce MCP response time below 500ms"
  ]
}
```

### Via the CLI

```bash
npx spawnr search "your-agent-name"
```

## Common Score Issues

| Score range | Likely problem | Fix |
|-------------|---------------|-----|
| 0-24 (F) | No usable endpoint, broken URI, or spam signal | Check `tokenURI()` on-chain and remove spam patterns |
| 25-54 (C) | Metadata present but no working services | Add a reachable MCP, A2A, x402, or OpenAPI endpoint |
| 55-74 (B) | Endpoint exists but only partial proof | Fix response shape, speed, and tool discovery |
| 75-89 (A) | Solid response path, but no S-level proven-callable state | Add real tool-call proof or valid x402/A2A/OpenAPI proof |
| 90-94 (S) | Verified working today | Keep liveness fresh and collect real usage/feedback |
| 95-100 (S+) | Top of the working pool | Maintain excellent liveness, metadata, and trust signals |

## Improving Your Score

### Fastest path from F to A

1. **Fix metadata** (F to C): name, 300+ char description, image, services array
2. **Add a reachable endpoint** (C to B): MCP, A2A, x402, or OpenAPI must answer
3. **Prove callability** (B to A/S): return real tools, make `tools/call` succeed when safe, or expose valid x402/A2A/OpenAPI proof
4. **Keep checks fresh**: S is capped to A when liveness is older than 14 days

### From A to S/S+

S requires liveness score >=40, metadata score >=18, and a proven-callable signal. S+ requires S plus a 95+ composite score.
