EMBED-002: Contract/Intent Semantic Matching for Bidding #125

Closed
opened 2026-04-11 02:49:33 +00:00 by Mark · 0 comments
Owner

Overview

Replace exact string matching with semantic vector similarity for contract-to-worker bidding.

Current State

-- Exact string match (broken)
WHERE capability_id = 'writer'

Target State

# Semantic similarity matching
intent_vector = embed(intent.description)
worker_vectors = get_all_worker_skill_vectors()
similarities = cosine_similarity(intent_vector, worker_vectors)
eligible_workers = workers[similarities > threshold]

Implementation

Intent Processing

  • Generate embedding for intent payload
  • Store intent vector in backplane/redis
  • Intent-to-contract vector mapping

Worker Advertisement

  • Workers advertise skill descriptions
  • Generate embeddings for each skill
  • Store worker skill vectors in ledger

Bidding Logic

  • Semantic similarity calculation
  • Threshold-based filtering (configurable, default 0.7)
  • Bid amount weighted by similarity score
  • Top-k nearest neighbor search

Contract Discovery

  • Intake coordinator finds contracts by vector similarity
  • Contract evolution tracks vector drift
  • Overlapping contracts via vector clustering

Bid Calculation Formula

similarity = cosine_similarity(intent_vector, worker_skill_vector)
if similarity >= threshold:
    bid_amount = base_bond * similarity  # Higher similarity = higher confidence bid
    return bid_amount

Acceptance Criteria

  • Intent "write_article" matches worker with "writer" skill (similarity > 0.8)
  • Intent "compose_essay" matches same worker (semantic equivalence)
  • No exact string match required
  • Bidding completes in <500ms

Priority

CRITICAL - Required for basic mesh operation

  • EMBED-001: Embedding Engine Infrastructure
  • #118: Mesh accepts intents but no workers found
  • #104: worker_factory bootstrap
## Overview Replace exact string matching with semantic vector similarity for contract-to-worker bidding. ## Current State ```sql -- Exact string match (broken) WHERE capability_id = 'writer' ``` ## Target State ```python # Semantic similarity matching intent_vector = embed(intent.description) worker_vectors = get_all_worker_skill_vectors() similarities = cosine_similarity(intent_vector, worker_vectors) eligible_workers = workers[similarities > threshold] ``` ## Implementation ### Intent Processing - [ ] Generate embedding for intent payload - [ ] Store intent vector in backplane/redis - [ ] Intent-to-contract vector mapping ### Worker Advertisement - [ ] Workers advertise skill descriptions - [ ] Generate embeddings for each skill - [ ] Store worker skill vectors in ledger ### Bidding Logic - [ ] Semantic similarity calculation - [ ] Threshold-based filtering (configurable, default 0.7) - [ ] Bid amount weighted by similarity score - [ ] Top-k nearest neighbor search ### Contract Discovery - [ ] Intake coordinator finds contracts by vector similarity - [ ] Contract evolution tracks vector drift - [ ] Overlapping contracts via vector clustering ## Bid Calculation Formula ```python similarity = cosine_similarity(intent_vector, worker_skill_vector) if similarity >= threshold: bid_amount = base_bond * similarity # Higher similarity = higher confidence bid return bid_amount ``` ## Acceptance Criteria - [ ] Intent "write_article" matches worker with "writer" skill (similarity > 0.8) - [ ] Intent "compose_essay" matches same worker (semantic equivalence) - [ ] No exact string match required - [ ] Bidding completes in <500ms ## Priority CRITICAL - Required for basic mesh operation ## Related - EMBED-001: Embedding Engine Infrastructure - #118: Mesh accepts intents but no workers found - #104: worker_factory bootstrap
Mark 2026-06-16 03:55:59 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Mark/mesh-seed#125
No description provided.