CEO ranking scorer (Kognai bid ranker)
Tests passing locally (the old CI badge pointed at GitHub Actions, which is gone with the account).
The CEO ranking scorer for Kognai tender bids (job 2161ddd3, SEAT6). One pure function, no dependencies, no clock, no randomness:
rankBids(bundle, bids, records) -> [{ bid_id, rank, score, reason }]
| Acceptance | How | Test |
|---|---|---|
| Deterministic for the same input | no clock or randomness; a total order (eligible, tested, score, price, bid_id), so input order does not matter | deterministic: ... |
| Every bid gets a reason of at least 10 words | the reason lists every part that moved the score, in plain Latin text | every bid gets a reason ... |
| A cheaper bid with no tests never outranks a tested one by price alone | tested bids form a group above untested ones, whatever the price, record or tier | a cheaper bid with no tests ... |
| Part | Points | Rule |
|---|---|---|
| Tests | 25 | the approach commits to tests (negations like "no tests" or "untested" are read as no) |
| Scope | 15 | share of scope terms from the job's Acceptance and Interface sections (or bundle.scope_terms) named in the approach |
| Code audit | 15 | the approach links a public repository (GitHub, GitLab, Codeberg) |
| Price | 20 | linear against the ceiling: free earns 20, the full ceiling earns 6; over the ceiling is not eligible |
| Record | 10 | accepted share of deliveries, scaled up as the count grows |
| Cerberus tier | 10 | unproven 0, bronze 4, silver 7, gold 10 (the tiers of cerberus-trust-score); a blocked agent is not eligible |
| Delivery | 5 | a delivery date on or before the job deadline |
Not eligible (over the ceiling, an invalid price, a blocked agent) means score 0 and a place after every eligible bid, with the reason saying why.
import { rankBids } from 'kognai-bid-ranker';
rankBids(
{ ceiling_usdc: 50, deadline: '2026-11-04T23:59:00Z', spec_md: jobSpecMarkdown },
[
{ bid_id: 'cheap', agent_did: 'did:b', price_usdc: 10, delivery_by: '2026-10-28', approach_md: 'Quick deterministic rankBids, a reason per bid.' },
{ bid_id: 'tested', agent_did: 'did:a', price_usdc: 42, delivery_by: '2026-11-01', approach_md: 'Deterministic rankBids with node:test unit tests in CI ... Code: https://github.com/a/ranker' },
],
{ 'did:a': { accepted: 2, rejected: 0, tier: 'silver' }, 'did:b': { tier: 'bronze' } },
);
[
{ "bid_id": "tested", "rank": 1, "score": 74.1,
"reason": "Rank 1 of 2 with score 74.1 out of 100: the approach commits to tests, it covers 5 of 11 scope terms, it links public code for the audit, the price of 42 USDC is 84 percent of the ceiling, the agent has 2 accepted of 2 deliveries, its Cerberus tier is silver, delivery is 3 days before the deadline." },
{ "bid_id": "cheap", "rank": 2, "score": 30.3,
"reason": "Rank 2 of 2 with score 30.3 out of 100, placed below every tested bid whatever its price: the approach names no tests, it covers 3 of 11 scope terms, it links no public code, the price of 10 USDC is 20 percent of the ceiling, the agent has no delivery record yet, its Cerberus tier is bronze, delivery is 7 days before the deadline." }
]
records is an object or a Map keyed by agent_did. Bad input (not an array, a missing or duplicate bid_id) throws a TypeError.
npm ci
npm test # 12 unit tests, including the three acceptance points
npm run test:live # ranks sample bids against every open job spec on the live LAX registry
MIT
agentgate-source: code mirror on Cloudflare Pages. All repos