Let the model report a verdict per must-have and cap career at 39 in code when one is broken

The judge numbers an agent's must-haves (one per line) and answers met, broken or unclear for each; career is stored as the model gave it and counts as at most BROKEN_CAP when a role is served, in cv_score, Store.judgement and the SQL of Best CV match. Migration 29 adds role_judgements.musts and broken; the judge's input_key carries a format version so earlier judgements are made again. The reader lists the must-haves with their verdicts and the cap.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Sonnet 5.5 committed 2026-10-03 22:40:54 +02:00
1 parent 64fecf57ad
commit 001fc9002b
19 files changed
+336 -61

No files matched your search

+24 -2
View File
@@ -400,8 +400,11 @@ CREATE TABLE IF NOT EXISTS scores (
-- and the role closing. skills, experience and career are 0 to 100,
-- cv_score their weighted total, strengths and gaps JSON lists. input_key
-- is a hash of the CV, prompts, avoid text and the role's text it read: a
-- different one is read again. tries counts replies that left the role
-- without one since; at 3 it is given up until the agent is saved again. A
-- different one is read again. musts is a JSON list of {id, text, verdict},
-- the model's verdict on each of the agent's must-haves (one per line of its
-- must text), broken how many are "broken": career counts as at most 39 then
-- (app.models.BROKEN_CAP), applied when the role is served. tries counts
-- replies that left the role without one since; at 3 it is given up until the agent is saved again. A
-- row with judged_at NULL holds only tries.
CREATE TABLE IF NOT EXISTS role_judgements (
uid TEXT NOT NULL REFERENCES roles(uid) ON DELETE CASCADE,
@@ -412,6 +415,8 @@ CREATE TABLE IF NOT EXISTS role_judgements (
cv_score REAL,
strengths TEXT NOT NULL DEFAULT '[]',
gaps TEXT NOT NULL DEFAULT '[]',
musts TEXT NOT NULL DEFAULT '[]',
broken INTEGER NOT NULL DEFAULT 0,
input_key TEXT NOT NULL DEFAULT '',
tries INTEGER NOT NULL DEFAULT 0,
judged_at TEXT,
@@ -698,6 +703,10 @@ UPDATE roles SET seniority = COALESCE(NULLIF(seniority_model, ''),
(28, "agents.cv_text, cv_languages, avoid_text and must_text, roles.languages_required and the "
"deadline columns, and role_judgements: the CV match, the language flag and the "
"deadline", lambda conn: _add_cv_match(conn)),
# A Python step: it adds the columns only where they are missing. Rows
# keep their numbers; the judge reads them again (judge.FORMAT).
(29, "role_judgements.musts and broken: the verdict on each must-have, and how many are "
"broken", lambda conn: _add_musts(conn)),
)
#: What a file created from `SCHEMA` today is already at.
@@ -1025,6 +1034,19 @@ def _add_cv_match(conn: sqlite3.Connection) -> None:
PRIMARY KEY (uid, agent_id))""")
def _add_musts(conn: sqlite3.Connection) -> None:
"""Migration 29's step: `role_judgements.musts`, a JSON list, and
`broken`, the count of must-haves it holds as broken, empty and 0 on
every row. `judge.input_key` changed with it, so each judgement is read
again; until then it serves with no must-haves and no cap. Runs twice
without harm."""
columns = {r[1] for r in conn.execute("PRAGMA table_info(role_judgements)")}
for column, ddl in (("musts", "TEXT NOT NULL DEFAULT '[]'"),
("broken", "INTEGER NOT NULL DEFAULT 0")):
if column not in columns:
conn.execute(f"ALTER TABLE role_judgements ADD COLUMN {column} {ddl}")
def _add_all_roles(conn: sqlite3.Connection) -> None:
"""Migration 21's step. The column; the tag for every company that is a
favourite of any agent, since favourite no longer widens what a pull