Score roles per search agent, and run pull into extract, embed and score

embed stores one vector per open role; score rates every open role for
every enabled agent from require and prefer gates, fit against the
agent's intent, recency and company affinity, keeping gated rows with a
reason. Schema v3 adds vectors and the cached intent vector. The page
gets an agent order, the score on each row, and an Agents tab. Two
starter agents in roles.yaml are imported once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Opus 5.5 committed 2026-09-23 12:14:21 +02:00
1 parent 4dfb8831aa
commit bc60324fab
22 files changed
+1457 -44

No files matched your search

+27
View File
@@ -14,6 +14,7 @@ import yaml
from pydantic import Field, ValidationError
from desk.config import AgentConfig, ModelTaskConfig, Section, WorkersConfig
from roledesk.models import Gate, Weights
DEFAULT_PATH = Path(os.environ.get("ROLEDESK_CONFIG", "roles.yaml"))
@@ -28,6 +29,29 @@ class ExtractConfig(ModelTaskConfig):
batch_size: int = Field(20, ge=1)
class EmbedConfig(Section):
"""Turning a role into a vector for `fit`. Needs sentence-transformers;
without it `embed` says so and does nothing, and `score` leaves fit out.
See roledesk/jobs/embed.py."""
#: Recorded on every vector. Changing it drops the old vectors, which are
#: a different geometry and never comparable.
model: str = "sentence-transformers/all-MiniLM-L6-v2"
#: Roles embedded per run at most, newest first.
per_run: int = Field(50_000, ge=1)
class AgentSeed(Section):
"""A search agent as `roles.yaml` lists it. Imported into an empty
`agents` table once; after that the table is the answer."""
name: str
intent: str = ""
gates: list[Gate] = Field(default_factory=list)
weights: Weights = Field(default_factory=Weights)
enabled: bool = True
class Config(Section):
"""The whole file."""
@@ -36,6 +60,9 @@ class Config(Section):
workers: WorkersConfig = Field(default_factory=WorkersConfig)
agent: AgentConfig = Field(default_factory=AgentConfig)
extract: ExtractConfig = Field(default_factory=ExtractConfig)
embed: EmbedConfig = Field(default_factory=EmbedConfig)
#: Starter agents, imported once into an empty table.
agents: list[AgentSeed] = Field(default_factory=list)
#: One block per plugin: `enabled`, and whatever that plugin reads.
sources: dict[str, Any] = Field(default_factory=dict)
#: Where this was loaded from. Never written back into the file.