Give an agent a soft profile of likes and dislikes and take the must-haves off the form (wp-likes)
Add agents.like_text (migration 30) beside avoid_text, now shown as "What I don't like". The judge reads both under <likes> and <dislikes>, its career rubric judges against the prompts, the likes and the dislikes, and FORMAT 3 makes earlier judgements be made again. The form drops the must-haves box and no longer sends must_text, so a stored one is kept and still caps career in code. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
82afa831f2
commit
8c6cbdf002
18 files changed
+144
-75
No files matched your search
+18
-12
@@ -15,7 +15,7 @@ is guessed from ad text, the second is what the gates do.
|
||||
The work is pairs, `(agent, role)`: an enabled agent with a CV, and a role
|
||||
among its best ungated scores as deep and as low as its own `limits` say
|
||||
(`judge_top`, `judge_min`) with some text, that has no judgement yet, or one
|
||||
read from another CV, prompts, avoid or must text or role text than today's
|
||||
read from another CV, prompts, like, avoid or must text or role text than today's
|
||||
(`input_key`). A pair is named by the composite key `"<agent_id>:<uid>"`,
|
||||
which is what `desk.modeltask` hands round as a uid, so `desk/` is untouched.
|
||||
A batch holds one agent's pairs, since the profile is in the system prompt;
|
||||
@@ -59,16 +59,18 @@ EXCERPT = 8000
|
||||
#: The format of what the judge asks and stores, part of `input_key`: a
|
||||
#: change to the prompt's contract makes every judgement be made again.
|
||||
#: 2: the verdict on each numbered must-have (`musts`), the cap in code.
|
||||
FORMAT = 2
|
||||
#: 3: what the person likes (`like_text`) beside what they do not, and the
|
||||
#: career rubric reading both.
|
||||
FORMAT = 3
|
||||
|
||||
#: How many strengths and gaps are kept, and how long each may be.
|
||||
MOST, LONGEST = 3, 300
|
||||
|
||||
SYSTEM = """You judge job postings for one person: how well each fits their CV and what they want.
|
||||
|
||||
Below the rules is the person: their CV, what they want and what excites
|
||||
them, what drains them and environments to avoid, and their must-haves and
|
||||
deal-breakers. Each item is one posting with a key, its title, company, place
|
||||
Below the rules is the person: their CV, what they want, what they like and
|
||||
what they do not like (the work, the workplace, situations), and their
|
||||
must-haves and deal-breakers when they gave any. Each item is one posting with a key, its title, company, place
|
||||
and text. Answer one judgement per item.
|
||||
|
||||
Score three dimensions, each 0 to 100:
|
||||
@@ -79,11 +81,12 @@ Score three dimensions, each 0 to 100:
|
||||
literal job title, and on its level. 80-100 direct experience in the same
|
||||
domain and role type; 60-79 related, with transferable skills clear; 40-59
|
||||
adjacent, the person would need to make the case; 0-39 unrelated.
|
||||
- career: against what the person wants and what drains them. 80-100 strongly
|
||||
- career: against what the person wants (the prompts), what they like and
|
||||
what they do not like. 80-100 strongly
|
||||
aligned with their direction, with clear growth; 60-79 a good role, partly
|
||||
aligned; 40-59 a decent job that does not build toward their goals; 0-39 a
|
||||
dead end or a step backwards. Judge whether the tasks would energise them,
|
||||
not only whether they could do them.
|
||||
dead end or a step backwards. Judge whether the tasks and the setting would
|
||||
energise them, not only whether they could do them.
|
||||
|
||||
Their must-haves and deal-breakers are numbered M1, M2 and so on. Give a
|
||||
verdict on every one of them, in `musts`, for each item:
|
||||
@@ -173,10 +176,10 @@ def _text(row: Any) -> str:
|
||||
|
||||
def input_key(agent: Agent, text: str) -> str:
|
||||
"""A hash of everything a judgement reads: the CV, the prompts, the
|
||||
avoid and must texts, and the role's text as sent. A judgement stored
|
||||
like, avoid and must texts, and the role's text as sent. A judgement stored
|
||||
under another key is read again."""
|
||||
blob = json.dumps([FORMAT, agent.cv_text, [[p.name, p.text] for p in agent.prompts],
|
||||
agent.avoid_text, agent.must_text, text], ensure_ascii=False)
|
||||
agent.like_text, agent.avoid_text, agent.must_text, text], ensure_ascii=False)
|
||||
return hashlib.sha1(blob.encode()).hexdigest()[:16]
|
||||
|
||||
|
||||
@@ -227,9 +230,12 @@ def system(agent: Agent) -> str:
|
||||
for p in agent.prompts if p.text.strip())
|
||||
if wants:
|
||||
parts.append(f"\n<wants title=\"what they want and what excites them\">\n{wants}\n</wants>")
|
||||
if agent.like_text.strip():
|
||||
parts.append("\n<likes title=\"what they like: work, workplace, situations\">\n"
|
||||
f"{agent.like_text.strip()}\n</likes>")
|
||||
if agent.avoid_text.strip():
|
||||
parts.append("\n<avoid title=\"what drains them and environments to avoid\">\n"
|
||||
f"{agent.avoid_text.strip()}\n</avoid>")
|
||||
parts.append("\n<dislikes title=\"what they do not like\">\n"
|
||||
f"{agent.avoid_text.strip()}\n</dislikes>")
|
||||
if musts := must_lines(agent.must_text):
|
||||
lines = "\n".join(f"M{n}: {line}" for n, line in enumerate(musts, start=1))
|
||||
parts.append(f"\n<must title=\"must-haves and deal-breakers\">\n{lines}\n</must>")
|
||||
|
||||
+7
-4
@@ -1553,10 +1553,12 @@ class Agent(Model):
|
||||
union over the enabled agents, and an agent with none means no board is
|
||||
narrowed by words. They decide what is fetched, not what ranks.
|
||||
|
||||
`cv_text`, `cv_languages`, `avoid_text` and `must_text` are what
|
||||
`judge` reads a role against: the CV, the languages it states with a
|
||||
level, what drains the person, and their must-haves and deal-breakers
|
||||
(soft, read by the model only; a hard rule is a gate). An agent without
|
||||
`cv_text`, `cv_languages`, `like_text`, `avoid_text` and `must_text` are
|
||||
what `judge` reads a role against: the CV, the languages it states with
|
||||
a level, what the person likes and does not like (the work, the
|
||||
workplace, situations; both feed the career score), and their
|
||||
must-haves and deal-breakers (set through the API only, not on the
|
||||
form; soft, read by the model only; a hard rule is a gate). An agent without
|
||||
a CV is not judged, and one without languages flags none
|
||||
(`language_flag`)."""
|
||||
|
||||
@@ -1569,6 +1571,7 @@ class Agent(Model):
|
||||
fetch_terms: FetchTerms = []
|
||||
cv_text: str = ""
|
||||
cv_languages: CvLanguages = []
|
||||
like_text: str = ""
|
||||
avoid_text: str = ""
|
||||
must_text: str = ""
|
||||
enabled: bool = True
|
||||
|
||||
+14
-10
@@ -20,12 +20,14 @@
|
||||
*
|
||||
* The CV fieldset holds what the judge stage reads a role against: the CV as
|
||||
* text (typed, or read from a .md/.txt file by the browser), the languages it
|
||||
* states as rows of a code and a level, and the avoid and must-have texts.
|
||||
* The must-have text is one must-have per line, which the judge answers one
|
||||
* verdict each; a broken one caps career at 39 in code (the hint in
|
||||
* settings/agents.html says so).
|
||||
* Every save sends all four, and the card's switch re-posts the row as the
|
||||
* server gave it, so neither drops them.
|
||||
* states as rows of a code and a level, and the two soft texts, what the
|
||||
* person likes and what they do not like (the work, the workplace,
|
||||
* situations), which the judge reads for the career score. The must-have text
|
||||
* is no longer on the form: a save leaves `must_text` out, so the stored one
|
||||
* is kept (it is set through the API, and still caps career at 39 in code
|
||||
* when the judge reports one broken).
|
||||
* Every save sends the CV, languages and the two texts, and the card's switch
|
||||
* re-posts the row as the server gave it, so neither drops them.
|
||||
*
|
||||
* Every request goes through `api()` from app.js, so a failure is one toast
|
||||
* carrying the server's own sentence.
|
||||
@@ -502,12 +504,14 @@
|
||||
}
|
||||
|
||||
// The CV on a card: whether the judge has one to read roles against, and
|
||||
// the languages it states, as "da fluent, en native".
|
||||
// the languages it states, as "da fluent, en native", and whether the
|
||||
// likes and dislikes are written.
|
||||
function cvLine(row) {
|
||||
const langs = row.cv_languages || [];
|
||||
const said = langs.length ? `Languages: ${langs.map((l) => `${l.language} ${l.level}`).join(", ")}.` : "No languages stated.";
|
||||
const has = Boolean((row.cv_text || "").trim());
|
||||
return el("p", "agent-terms", has ? `CV set. ${said}` : `No CV, so roles are not judged against one. ${said}`);
|
||||
const soft = `Likes ${(row.like_text || "").trim() ? "set" : "not set"}, dislikes ${(row.avoid_text || "").trim() ? "set" : "not set"}.`;
|
||||
return el("p", "agent-terms", `${has ? "CV set." : "No CV, so roles are not judged against one."} ${said} ${soft}`);
|
||||
}
|
||||
|
||||
// A prompt as a row: its name and Remove on a line, its text under them.
|
||||
@@ -646,8 +650,8 @@
|
||||
// is cleared in the store.
|
||||
const cvText = $("#a-cv-text", f);
|
||||
cvText.value = row ? row.cv_text || "" : "";
|
||||
$("#a-like-text", f).value = row ? row.like_text || "" : "";
|
||||
$("#a-avoid-text", f).value = row ? row.avoid_text || "" : "";
|
||||
$("#a-must-text", f).value = row ? row.must_text || "" : "";
|
||||
const languages = [];
|
||||
const dropLanguage = (node) => {
|
||||
languages.splice(languages.findIndex((l) => l.node === node), 1);
|
||||
@@ -898,8 +902,8 @@
|
||||
fetch_terms: read.terms(),
|
||||
cv_text: $("#a-cv-text", f).value,
|
||||
cv_languages: cvLanguages,
|
||||
like_text: $("#a-like-text", f).value,
|
||||
avoid_text: $("#a-avoid-text", f).value,
|
||||
must_text: $("#a-must-text", f).value,
|
||||
// Saving an agent means it is wanted, so a new one starts on; the
|
||||
// card's switch is where an existing one is switched.
|
||||
enabled: row ? row.enabled : true,
|
||||
|
||||
+18
-4
@@ -328,9 +328,10 @@ END;
|
||||
-- as JSON: a key it lacks means the `Limits` default. fetch_terms is a JSON
|
||||
-- list of words that narrow what big boards send (app/jobs/reach.py); empty
|
||||
-- means no narrowing. cv_text, cv_languages (a JSON list of {language,
|
||||
-- level}), avoid_text (what drains) and must_text (must-haves and
|
||||
-- deal-breakers) are what judge reads a role against; an agent with no CV
|
||||
-- is not judged.
|
||||
-- level}), like_text (what they like: the work, the workplace, situations),
|
||||
-- avoid_text (what they do not like) and must_text (must-haves and
|
||||
-- deal-breakers, set through the API only) are what judge reads a role
|
||||
-- against; an agent with no CV is not judged.
|
||||
CREATE TABLE IF NOT EXISTS agents (
|
||||
id INTEGER PRIMARY KEY,
|
||||
name TEXT NOT NULL UNIQUE,
|
||||
@@ -343,7 +344,8 @@ CREATE TABLE IF NOT EXISTS agents (
|
||||
cv_text TEXT NOT NULL DEFAULT '',
|
||||
cv_languages TEXT NOT NULL DEFAULT '[]',
|
||||
avoid_text TEXT NOT NULL DEFAULT '',
|
||||
must_text TEXT NOT NULL DEFAULT ''
|
||||
must_text TEXT NOT NULL DEFAULT '',
|
||||
like_text TEXT NOT NULL DEFAULT ''
|
||||
);
|
||||
|
||||
-- What an agent looks for, as several named texts in order; a role's fit is
|
||||
@@ -707,6 +709,10 @@ UPDATE roles SET seniority = COALESCE(NULLIF(seniority_model, ''),
|
||||
# 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)),
|
||||
# A Python step: it adds the column only where it is missing. The judge
|
||||
# reads every role again (judge.FORMAT).
|
||||
(30, "agents.like_text: what the person likes, beside what they do not like",
|
||||
lambda conn: _add_like_text(conn)),
|
||||
)
|
||||
|
||||
#: What a file created from `SCHEMA` today is already at.
|
||||
@@ -1047,6 +1053,14 @@ def _add_musts(conn: sqlite3.Connection) -> None:
|
||||
conn.execute(f"ALTER TABLE role_judgements ADD COLUMN {column} {ddl}")
|
||||
|
||||
|
||||
def _add_like_text(conn: sqlite3.Connection) -> None:
|
||||
"""Migration 30's step: `agents.like_text`, empty on every agent. Runs
|
||||
twice without harm."""
|
||||
columns = {r[1] for r in conn.execute("PRAGMA table_info(agents)")}
|
||||
if "like_text" not in columns:
|
||||
conn.execute("ALTER TABLE agents ADD COLUMN like_text TEXT NOT NULL DEFAULT ''")
|
||||
|
||||
|
||||
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
|
||||
|
||||
+10
-6
@@ -2093,13 +2093,14 @@ class Store:
|
||||
cv_text: str | None = None,
|
||||
cv_languages: Sequence[CvLanguage] | None = None,
|
||||
avoid_text: str | None = None,
|
||||
must_text: str | None = None) -> Agent:
|
||||
must_text: str | None = None,
|
||||
like_text: str | None = None) -> Agent:
|
||||
"""Create an agent, or with `agent_id` replace that one's fields and
|
||||
prompts. Without `prompts`, a non-empty `intent` is its one prompt,
|
||||
named after the agent. Without `fetch_terms` an update keeps the
|
||||
stored ones and a new agent has none, so a caller that does not know
|
||||
them (the CLI's prompt edit) loses none; `cv_text`, `cv_languages`,
|
||||
`avoid_text` and `must_text` are kept the same way. A prompt whose text is
|
||||
`like_text`, `avoid_text` and `must_text` are kept the same way. A prompt whose text is
|
||||
unchanged keeps its cached vector, whatever its name or place, so an
|
||||
edit re-embeds only the prompts it changed. A save gives every role
|
||||
`judge` gave up on for the agent its tries back, since what it is
|
||||
@@ -2120,16 +2121,18 @@ class Store:
|
||||
(limits or Limits()).model_dump_json(), int(enabled), terms,
|
||||
None if cv_text is None else cv_text.strip(), spoken,
|
||||
None if avoid_text is None else avoid_text.strip(),
|
||||
None if must_text is None else must_text.strip())
|
||||
None if must_text is None else must_text.strip(),
|
||||
None if like_text is None else like_text.strip())
|
||||
try:
|
||||
with self.transaction() as conn:
|
||||
if agent_id is None:
|
||||
agent_id = conn.execute(
|
||||
"""INSERT INTO agents (name, gates, weights, limits, enabled,
|
||||
fetch_terms, cv_text, cv_languages, avoid_text,
|
||||
must_text, created_at)
|
||||
must_text, like_text, created_at)
|
||||
VALUES (?,?,?,?,?,COALESCE(?, '[]'),COALESCE(?, ''),
|
||||
COALESCE(?, '[]'),COALESCE(?, ''),COALESCE(?, ''),?)""",
|
||||
COALESCE(?, '[]'),COALESCE(?, ''),COALESCE(?, ''),
|
||||
COALESCE(?, ''),?)""",
|
||||
(*fields, self.now())).lastrowid
|
||||
elif not conn.execute(
|
||||
"""UPDATE agents SET name=?, gates=?, weights=?, limits=?, enabled=?,
|
||||
@@ -2137,7 +2140,8 @@ class Store:
|
||||
cv_text=COALESCE(?, cv_text),
|
||||
cv_languages=COALESCE(?, cv_languages),
|
||||
avoid_text=COALESCE(?, avoid_text),
|
||||
must_text=COALESCE(?, must_text)
|
||||
must_text=COALESCE(?, must_text),
|
||||
like_text=COALESCE(?, like_text)
|
||||
WHERE id=?""",
|
||||
(*fields, agent_id)).rowcount:
|
||||
raise KeyError(agent_id)
|
||||
|
||||
@@ -93,11 +93,11 @@
|
||||
<button type="button" id="a-add-language" class="secondary">Add language</button>
|
||||
<button type="button" id="a-suggest-languages" class="secondary">Suggest languages</button>
|
||||
<span class="hint">A two-letter code such as <code>en</code> or <code>da</code>, and how well. Roles that ask for a language you lack, or a level above yours, get a warning on Roles; a role that names one of yours as a plus gets a star. With none, no role is flagged. Suggest languages reads them from the CV with one model call and replaces the rows above; nothing is saved until Save.</span>
|
||||
<label>Avoid / drains me
|
||||
<label>What I like
|
||||
<textarea id="a-like-text" rows="4" placeholder="Building a team from scratch, close work with the product side, small companies, a say in the roadmap"></textarea></label>
|
||||
<label>What I don't like
|
||||
<textarea id="a-avoid-text" rows="4" placeholder="Constant on-call, sales targets, large consultancies, open-plan offices"></textarea></label>
|
||||
<label>Must-haves and deal-breakers
|
||||
<textarea id="a-must-text" rows="4" placeholder="Permanent contract A say in the roadmap At most one day a week in the office"></textarea></label>
|
||||
<span class="hint">One must-have per line. The judge reports for each whether a posting meets it, clearly breaks it or does not say; a broken one caps the role's career score at 39 in code, whatever the model scored. Rules that must hold go under Where or Other rules instead.</span>
|
||||
<span class="hint">The work, the workplace, situations; read by the CV match for the career score. Rules that must hold go under Where or Other rules instead.</span>
|
||||
</fieldset>
|
||||
<fieldset class="weights">
|
||||
<legend>How much each counts</legend>
|
||||
|
||||
+4
-2
@@ -1205,7 +1205,7 @@ class AgentBody(BaseModel):
|
||||
it is stored as one prompt named after the agent. `fetch_terms` narrow
|
||||
what big boards send (`app/jobs/reach.py`); `[]` narrows nothing, and
|
||||
leaving the key out keeps an existing agent's. `cv_text`,
|
||||
`cv_languages`, `avoid_text` and `must_text` are what `judge` reads a
|
||||
`cv_languages`, `like_text`, `avoid_text` and `must_text` are what `judge` reads a
|
||||
role against (`app/jobs/judge.py`), kept the same way when left out or
|
||||
null."""
|
||||
|
||||
@@ -1219,6 +1219,7 @@ class AgentBody(BaseModel):
|
||||
fetch_terms: FetchTerms | None = None
|
||||
cv_text: str | None = None
|
||||
cv_languages: CvLanguages | None = None
|
||||
like_text: str | None = None
|
||||
avoid_text: str | None = None
|
||||
must_text: str | None = None
|
||||
enabled: bool = True
|
||||
@@ -1260,7 +1261,8 @@ def save_agent(body: AgentBody, store: StoreDep, queue: QueueDep) -> Agent:
|
||||
body.enabled, agent_id=body.id, limits=body.limits,
|
||||
prompts=body.prompts, fetch_terms=body.fetch_terms,
|
||||
cv_text=body.cv_text, cv_languages=body.cv_languages,
|
||||
avoid_text=body.avoid_text, must_text=body.must_text)
|
||||
like_text=body.like_text, avoid_text=body.avoid_text,
|
||||
must_text=body.must_text)
|
||||
except ValueError as exc:
|
||||
raise HTTPException(409, str(exc)) from exc
|
||||
except KeyError:
|
||||
|
||||
+1
-1
@@ -208,7 +208,7 @@ What was decided for roledesk and the one reason for each. The longer reasoning
|
||||
|
||||
**`extract_batch` and `summarise_batch` are `isolate=True`, with a timeout.** `context.check()` only runs between the calls `modeltask.one` makes, not inside one, so a call that hangs on either backend was otherwise unkillable short of restarting the server; a process boundary is what lets a Kill, or the timeout itself, actually end it. One call is already bounded at `agent.timeout`, so the deadline is a few calls' worth (30 minutes for extract, 15 for summarise): a batch still running after that is stuck, not slow. The cost: an isolated job's context has no working `stop`, `task` or `fan_out` (see `pipeline/child.py`'s `context_for`), so a refusal or an account-level failure inside a batch can no longer stop the rest of that task's queued siblings, which run on to the same failure instead of being spared it.
|
||||
|
||||
**A third order, Best CV match, from a model reading each agent's best roles against its CV (2026-10-03).** Taken from the `/rank` of github.com/MadsLorentzen/ai-job-search, which has a model score a posting against a written profile on five dimensions. Fit compares topics; it cannot tell a step down, years of experience or a stated deal-breaker, which a model reading both texts can. An agent may hold a CV (pasted, or a `.md`/`.txt` file the browser reads into the box), its languages with a level (suggested from the CV by one model call, then edited), an "avoid / drains me" text and a "must-haves and deal-breakers" text; the prompts stay what the owner wants. The stage `judge` (after summarise in the pull, switched under Runs like extract, Haiku by default) reads the pairs of an enabled agent with a CV within its `judge_top` and `judge_min` limits, once per `input_key` (a hash of the CV, prompts, both texts and the role's text), and stores skills, experience and career (0 to 100, their rubric bands verbatim), 1 to 3 strengths and gaps in `role_judgements`, which rescoring and closing never touch. The CV match is the weighted mean of the three, with the weights per agent (`cv_skills`, `cv_experience`, `cv_career` in `agents.weights`, default 30, 25, 30) applied when a role is served, so changing them needs no model call. Culture is left out (guessed from ad text) and location too (the gates do it): a must-haves text that names a place makes the model mark location down, so places belong in the Where rules. The model reports facts and code applies the rules: the must-haves text is read as one must-have per line (leading bullets and numbers dropped), the judge's profile numbers them M1..Mn, and for each judgement the model answers `musts`, a verdict per must-have, "met", "broken" only when the posting text clearly contradicts it, or "unclear" when the text does not say (never inferred from silence; a must-have the model leaves out counts as unclear). It scores career on its rubric as before and the career is stored as given. The cap is code's: when a role is served, any "broken" verdict makes career count as `min(career, BROKEN_CAP)` with `BROKEN_CAP = 39` (`app.models`), in `cv_score`, in `Store.judgement` (which serves the model's career, `career_capped` and the must-haves with their text) and in `store._cv_sql`, which reads a `broken` count stored beside the verdicts (`role_judgements.musts` and `.broken`, migration 29), so Best CV match orders by the capped value too. The verdicts store each line's text, so the reader still shows the must-haves a judgement was made against after the text is edited. The judge's `input_key` carries a format version (`judge.FORMAT`, 2), so judgements made before the verdicts existed are made again; until then they serve with no must-haves and no cap. The reader shows each must-have with ✓ met, ✗ broken or ? unclear, and career as "39 (capped: breaks a must-have; model said 55)". Their scale is ten postings a run; ours is the top of a ranking that has already scored every role for free.
|
||||
**A third order, Best CV match, from a model reading each agent's best roles against its CV (2026-10-03).** Taken from the `/rank` of github.com/MadsLorentzen/ai-job-search, which has a model score a posting against a written profile on five dimensions. Fit compares topics; it cannot tell a step down, years of experience or a stated deal-breaker, which a model reading both texts can. An agent may hold a CV (pasted, or a `.md`/`.txt` file the browser reads into the box), its languages with a level (suggested from the CV by one model call, then edited), and a soft profile of two free texts, "What I like" (`like_text`) and "What I don't like" (`avoid_text`, the column keeps its name), each covering the work, the workplace and situations, with no split into tasks versus environment; the prompts stay what the owner wants. Both texts feed the career score, which the rubric judges against what the person wants (the prompts), what they like and what they do not like, and whether the tasks and the setting would energise them. A deal-breaker is a hard rule and lives in the agent's gates, so the form has no must-haves box; `must_text` stays a column that only the API sets, and the verdicts and the cap below apply whenever it is non-empty. The stage `judge` (after summarise in the pull, switched under Runs like extract, Haiku by default) reads the pairs of an enabled agent with a CV within its `judge_top` and `judge_min` limits, once per `input_key` (a hash of the CV, prompts, both texts and the role's text), and stores skills, experience and career (0 to 100, their rubric bands verbatim), 1 to 3 strengths and gaps in `role_judgements`, which rescoring and closing never touch. The CV match is the weighted mean of the three, with the weights per agent (`cv_skills`, `cv_experience`, `cv_career` in `agents.weights`, default 30, 25, 30) applied when a role is served, so changing them needs no model call. Culture is left out (guessed from ad text) and location too (the gates do it): a must-haves text (set through the API) that names a place makes the model mark location down, so places belong in the Where rules. The model reports facts and code applies the rules: the must-haves text, when set, is read as one must-have per line (leading bullets and numbers dropped), the judge's profile (`<likes>`, `<dislikes>` and, when set, `<must>`) numbers them M1..Mn, and for each judgement the model answers `musts`, a verdict per must-have, "met", "broken" only when the posting text clearly contradicts it, or "unclear" when the text does not say (never inferred from silence; a must-have the model leaves out counts as unclear). It scores career on its rubric as before and the career is stored as given. The cap is code's: when a role is served, any "broken" verdict makes career count as `min(career, BROKEN_CAP)` with `BROKEN_CAP = 39` (`app.models`), in `cv_score`, in `Store.judgement` (which serves the model's career, `career_capped` and the must-haves with their text) and in `store._cv_sql`, which reads a `broken` count stored beside the verdicts (`role_judgements.musts` and `.broken`, migration 29), so Best CV match orders by the capped value too. The verdicts store each line's text, so the reader still shows the must-haves a judgement was made against after the text is edited. The judge's `input_key` carries a format version (`judge.FORMAT`, 3) and the likes text (`agents.like_text`, migration 30), so judgements made before the verdicts or the likes existed are made again; until then they serve with the verdicts they have, or none and no cap. The reader shows each must-have with ✓ met, ✗ broken or ? unclear, and career as "39 (capped: breaks a must-have; model said 55)". Their scale is ten postings a run; ours is the top of a ranking that has already scored every role for free.
|
||||
|
||||
**A posting's languages and deadline, and a flag rather than a score.** Extract reads `languages_required` as objects (language, level on the ladder basic, conversational, professional, fluent, native, and required or plus) and a deadline, from the opening and the closing lines of the text, since both usually sit at the end. Jobnet and Jobbank state a deadline, kept as `deadline_host`; prep composes `deadline` host first. The language flag is computed when a role is served from the posting's languages and the agent's: ⚠ when a required one is missing or its level is above the agent's, ★ when a plus one is the agent's; it never changes a score. Closing soon is the deadline from today to today plus four days, in UTC.
|
||||
|
||||
|
||||
@@ -148,7 +148,7 @@ def test_migration_20_seeds_an_old_file_and_leaves_collisions(tmp_path: Path) ->
|
||||
"VALUES (?, ?, '', '')", (key, name))
|
||||
conn.execute("PRAGMA user_version = 19")
|
||||
reopened = Store(path)
|
||||
assert reopened.migrations_applied == [20, 21, 22, 23, 24, 25, 26, 27, 28, 29]
|
||||
assert reopened.migrations_applied == [20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]
|
||||
assert reopened.duplicate_companies() == [("orsted", ["orsted", "ørsted"])]
|
||||
assert len(reopened.companies()) == 3
|
||||
|
||||
@@ -186,7 +186,7 @@ def test_migration_21_tags_the_favourites_and_the_boards_that_read_all_roles(tmp
|
||||
conn.execute("ALTER TABLE companies DROP COLUMN all_countries")
|
||||
conn.execute("PRAGMA user_version = 20")
|
||||
reopened = Store(path)
|
||||
assert reopened.migrations_applied == [21, 22, 23, 24, 25, 26, 27, 28, 29]
|
||||
assert reopened.migrations_applied == [21, 22, 23, 24, 25, 26, 27, 28, 29, 30]
|
||||
# The tag of 21 is All countries and All roles since 24.
|
||||
tagged = {"mistral-ai": 1, "acme": 0, "black-forest-labs": 1, "liked": 0}
|
||||
assert {c.key: c.all_roles for c in reopened.companies()} == tagged
|
||||
|
||||
@@ -212,7 +212,7 @@ def test_an_agent_without_languages_flags_nothing(client: TestClient, store: Sto
|
||||
|
||||
|
||||
def test_the_cv_fields_round_trip_and_are_kept_when_left_out(client: TestClient) -> None:
|
||||
body = {"name": "Data", "cv_text": "VP Data.", "avoid_text": "Reporting.",
|
||||
body = {"name": "Data", "cv_text": "VP Data.", "like_text": "Teams.", "avoid_text": "Reporting.",
|
||||
"must_text": "Permanent.",
|
||||
"cv_languages": [{"language": "da", "level": "native"},
|
||||
{"language": "EN", "level": "fluent"}]}
|
||||
@@ -220,8 +220,8 @@ def test_the_cv_fields_round_trip_and_are_kept_when_left_out(client: TestClient)
|
||||
assert made["cv_languages"] == [{"language": "da", "level": "native"},
|
||||
{"language": "en", "level": "fluent"}]
|
||||
kept = client.post("/api/agents", json={"id": made["id"], "name": "Data"}).json()
|
||||
assert (kept["cv_text"], kept["avoid_text"], kept["must_text"]) == \
|
||||
("VP Data.", "Reporting.", "Permanent.")
|
||||
assert (kept["cv_text"], kept["like_text"], kept["avoid_text"], kept["must_text"]) == \
|
||||
("VP Data.", "Teams.", "Reporting.", "Permanent.")
|
||||
assert len(kept["cv_languages"]) == 2
|
||||
nulls = client.post("/api/agents", json={"id": made["id"], "name": "Data",
|
||||
"cv_text": None, "cv_languages": None}).json()
|
||||
|
||||
+31
-11
@@ -44,21 +44,24 @@ def test_an_agent_keeps_its_cv_fields_when_a_save_leaves_them_out(store: Store)
|
||||
cv_languages=[CvLanguage(language="DA", level="native"),
|
||||
CvLanguage(language="en", level="fluent"),
|
||||
CvLanguage(language="da", level="basic")],
|
||||
avoid_text="Pure reporting.", must_text="Permanent contract.")
|
||||
like_text=" Building teams. ", avoid_text="Pure reporting.",
|
||||
must_text="Permanent contract.")
|
||||
assert made.cv_text == "VP Data."
|
||||
assert [(lang.language, lang.level) for lang in made.cv_languages] == \
|
||||
[("da", "native"), ("en", "fluent")]
|
||||
assert (made.avoid_text, made.must_text) == ("Pure reporting.", "Permanent contract.")
|
||||
assert (made.like_text, made.avoid_text, made.must_text) == \
|
||||
("Building teams.", "Pure reporting.", "Permanent contract.")
|
||||
|
||||
kept = store.save_agent("Data", "data leadership", agent_id=made.id)
|
||||
assert (kept.cv_text, kept.avoid_text, kept.must_text) == \
|
||||
("VP Data.", "Pure reporting.", "Permanent contract.")
|
||||
assert (kept.cv_text, kept.like_text, kept.avoid_text, kept.must_text) == \
|
||||
("VP Data.", "Building teams.", "Pure reporting.", "Permanent contract.")
|
||||
assert len(kept.cv_languages) == 2
|
||||
|
||||
cleared = store.save_agent("Data", "data leadership", agent_id=made.id, cv_text="",
|
||||
cv_languages=[], avoid_text="", must_text="")
|
||||
assert (cleared.cv_text, cleared.cv_languages, cleared.avoid_text, cleared.must_text) \
|
||||
== ("", [], "", "")
|
||||
cv_languages=[], like_text="", avoid_text="",
|
||||
must_text="")
|
||||
assert (cleared.cv_text, cleared.cv_languages, cleared.like_text, cleared.avoid_text,
|
||||
cleared.must_text) == ("", [], "", "", "")
|
||||
|
||||
|
||||
def test_a_cv_language_is_a_code_and_a_level_of_the_ladder() -> None:
|
||||
@@ -93,7 +96,7 @@ def test_v28_adds_the_cv_columns_and_the_host_deadline_and_runs_twice(tmp_path:
|
||||
|
||||
migrated = Store(path)
|
||||
|
||||
assert migrated.migrations_applied == [28, 29]
|
||||
assert migrated.migrations_applied == [28, 29, 30]
|
||||
rows = {r["source_id"]: r for r in migrated._rows(
|
||||
"SELECT source_id, languages_required, deadline_host, deadline FROM roles")}
|
||||
assert (rows["a"]["deadline_host"], rows["a"]["deadline"]) == ("2026-10-18", None)
|
||||
@@ -105,7 +108,7 @@ def test_v28_adds_the_cv_columns_and_the_host_deadline_and_runs_twice(tmp_path:
|
||||
assert migrated.role(posting("a").uid).deadline == "2026-10-18"
|
||||
with sqlite3.connect(path) as conn:
|
||||
conn.execute("PRAGMA user_version = 27")
|
||||
assert Store(path).migrations_applied == [28, 29]
|
||||
assert Store(path).migrations_applied == [28, 29, 30]
|
||||
|
||||
|
||||
# ---------------------------------------------------------------- deadline
|
||||
@@ -246,12 +249,29 @@ def test_v29_adds_the_musts_and_broken_columns_and_runs_twice(tmp_path: Path) ->
|
||||
conn.execute(f"ALTER TABLE role_judgements DROP COLUMN {column}")
|
||||
conn.execute("PRAGMA user_version = 28")
|
||||
|
||||
assert Store(path).migrations_applied == [29]
|
||||
assert Store(path).migrations_applied == [29, 30]
|
||||
with sqlite3.connect(path) as conn:
|
||||
columns = {r[1] for r in conn.execute("PRAGMA table_info(role_judgements)")}
|
||||
assert {"musts", "broken"} <= columns
|
||||
conn.execute("PRAGMA user_version = 28")
|
||||
assert Store(path).migrations_applied == [29]
|
||||
assert Store(path).migrations_applied == [29, 30]
|
||||
|
||||
|
||||
def test_v30_adds_like_text_and_runs_twice(tmp_path: Path) -> None:
|
||||
path = tmp_path / "v29.db"
|
||||
Store(path).save_agent("Data", "data leadership", avoid_text="Reporting.")
|
||||
with sqlite3.connect(path) as conn:
|
||||
conn.execute("ALTER TABLE agents DROP COLUMN like_text")
|
||||
conn.execute("PRAGMA user_version = 29")
|
||||
|
||||
migrated = Store(path)
|
||||
|
||||
assert migrated.migrations_applied == [30]
|
||||
[data] = migrated.agents()
|
||||
assert (data.like_text, data.avoid_text) == ("", "Reporting.")
|
||||
with sqlite3.connect(path) as conn:
|
||||
conn.execute("PRAGMA user_version = 29")
|
||||
assert Store(path).migrations_applied == [30]
|
||||
|
||||
|
||||
def test_the_musts_text_is_one_must_have_per_line() -> None:
|
||||
|
||||
@@ -261,7 +261,7 @@ def test_a_v17_file_gains_dup_of_with_its_first_rebuild(tmp_path: Path) -> None:
|
||||
|
||||
migrated = Store(path)
|
||||
|
||||
assert migrated.migrations_applied == [18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29]
|
||||
assert migrated.migrations_applied == [18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]
|
||||
assert dup_of(migrated) == {first.uid: None, second.uid: first.uid}
|
||||
with sqlite3.connect(path) as conn:
|
||||
assert conn.execute("SELECT 1 FROM sqlite_master WHERE name = 'idx_roles_dup_of'"
|
||||
|
||||
@@ -434,7 +434,7 @@ def test_migration_23_gives_every_agent_no_terms(tmp_path: Path) -> None:
|
||||
conn.execute("ALTER TABLE agents DROP COLUMN fetch_terms")
|
||||
conn.execute("PRAGMA user_version = 22")
|
||||
migrated = Store(path)
|
||||
assert migrated.migrations_applied == [23, 24, 25, 26, 27, 28, 29]
|
||||
assert migrated.migrations_applied == [23, 24, 25, 26, 27, 28, 29, 30]
|
||||
assert migrated.agents()[0].fetch_terms == []
|
||||
|
||||
|
||||
|
||||
+16
-1
@@ -75,7 +75,8 @@ def config(tmp_path: Path) -> Config:
|
||||
|
||||
def hunter(store: Store, name: str = "Data", cv: str = CV, **kwargs: Any) -> Any:
|
||||
return store.save_agent(name, prompts=[Prompt(name="AI lead", text="Head of AI")],
|
||||
cv_text=cv, avoid_text="Pure reporting.",
|
||||
cv_text=cv, like_text="Building teams.",
|
||||
avoid_text="Pure reporting.",
|
||||
must_text="A permanent contract.", **kwargs)
|
||||
|
||||
|
||||
@@ -109,6 +110,10 @@ def test_a_run_writes_the_judgement_and_its_total(
|
||||
[system] = model.systems
|
||||
assert CV in system and "Pure reporting." in system and "A permanent contract." in system
|
||||
assert "- AI lead: Head of AI" in system and "deal-breaker" in system
|
||||
assert '<likes title="what they like: work, workplace, situations">\nBuilding teams.' \
|
||||
in system
|
||||
assert '<dislikes title="what they do not like">\nPure reporting.' in system
|
||||
assert "<avoid" not in system
|
||||
|
||||
|
||||
def test_the_musts_are_numbered_in_the_profile_and_stored_with_their_text(
|
||||
@@ -163,6 +168,16 @@ def test_judgements_made_before_the_format_are_made_again(store: Store) -> None:
|
||||
assert judge.input_key(owner, "text") != hashlib_old_key(owner, "text")
|
||||
|
||||
|
||||
def test_what_the_person_likes_is_part_of_what_a_judgement_read(store: Store) -> None:
|
||||
owner = hunter(store)
|
||||
liked = store.save_agent("Data", prompts=owner.prompts, agent_id=owner.id,
|
||||
like_text="Small teams.")
|
||||
assert judge.input_key(liked, "text") != judge.input_key(owner, "text")
|
||||
assert "Small teams." in judge.system(liked) and "Building teams." not in judge.system(liked)
|
||||
assert "<likes" not in judge.system(
|
||||
store.save_agent("Data", prompts=owner.prompts, agent_id=owner.id, like_text=""))
|
||||
|
||||
|
||||
def hashlib_old_key(agent: Any, text: str) -> str:
|
||||
blob = json.dumps([agent.cv_text, [[p.name, p.text] for p in agent.prompts],
|
||||
agent.avoid_text, agent.must_text, text], ensure_ascii=False)
|
||||
|
||||
@@ -120,7 +120,7 @@ def test_migration_24_splits_the_tag_and_moves_terms_off(tmp_path: Path) -> None
|
||||
conn.execute("UPDATE companies SET all_roles=1 WHERE key='mistral-ai'")
|
||||
conn.execute("PRAGMA user_version = 23")
|
||||
migrated = Store(path)
|
||||
assert migrated.migrations_applied == [24, 25, 26, 27, 28, 29]
|
||||
assert migrated.migrations_applied == [24, 25, 26, 27, 28, 29, 30]
|
||||
flags = {c.key: (c.all_countries, c.all_roles) for c in migrated.companies()}
|
||||
assert flags == {"mistral-ai": (1, 1), "acme": (0, 1), "plain": (0, 0)}
|
||||
params = {s.target: s.params for s in migrated.subscriptions(source="ats")}
|
||||
|
||||
+1
-1
@@ -316,7 +316,7 @@ def test_migration_22_fills_the_host_words_from_raw(tmp_path: Path) -> None:
|
||||
|
||||
migrated = Store(path)
|
||||
|
||||
assert migrated.migrations_applied == [22, 23, 24, 25, 26, 27, 28, 29]
|
||||
assert migrated.migrations_applied == [22, 23, 24, 25, 26, 27, 28, 29, 30]
|
||||
one = row(migrated, "1")
|
||||
assert (one["seniority_host"], one["employment_host"], one["remote_host"],
|
||||
one["country_host"]) == ("senior", "full_time", "true", "DK")
|
||||
|
||||
@@ -530,7 +530,7 @@ def test_migration_27_keeps_an_older_readers_remote_as_the_hosts_word(tmp_path:
|
||||
|
||||
migrated = Store(path)
|
||||
|
||||
assert migrated.migrations_applied == [27, 28, 29]
|
||||
assert migrated.migrations_applied == [27, 28, 29, 30]
|
||||
assert migrated.gazetteer().anywhere is not None
|
||||
row = migrated._row("SELECT remote_host, remote_model, remote_where_model FROM roles "
|
||||
"WHERE uid = ?", (board,))
|
||||
@@ -540,7 +540,7 @@ def test_migration_27_keeps_an_older_readers_remote_as_the_hosts_word(tmp_path:
|
||||
assert area(migrated, search.uid) == ("", "")
|
||||
with sqlite3.connect(path) as conn:
|
||||
conn.execute("PRAGMA user_version = 26")
|
||||
assert Store(path).migrations_applied == [27, 28, 29]
|
||||
assert Store(path).migrations_applied == [27, 28, 29, 30]
|
||||
|
||||
|
||||
def test_a_role_waits_for_extract_until_it_was_asked_where(store: Store) -> None:
|
||||
|
||||
+10
-9
@@ -70,7 +70,7 @@ def test_schema_creates_on_an_empty_file(tmp_path: Path) -> None:
|
||||
"application_events", "agents", "scores", "state"} <= tables
|
||||
assert "idx_roles_cluster" in indexes
|
||||
assert store.migrations_applied == []
|
||||
assert LATEST == 29
|
||||
assert LATEST == 30
|
||||
# A second open finds it current and applies nothing.
|
||||
assert Store(path).migrations_applied == []
|
||||
|
||||
@@ -170,6 +170,7 @@ def test_a_v1_file_migrates_to_the_shape_a_new_file_has(tmp_path: Path) -> None:
|
||||
conn.execute(f"DROP TABLE {table}")
|
||||
for column in ("musts", "broken"): # v29
|
||||
conn.execute(f"ALTER TABLE role_judgements DROP COLUMN {column}")
|
||||
conn.execute("ALTER TABLE agents DROP COLUMN like_text") # v30
|
||||
conn.execute("PRAGMA user_version = 1")
|
||||
|
||||
assert Store(old).migrations_applied == list(range(2, LATEST + 1))
|
||||
@@ -189,7 +190,7 @@ def test_a_v14_file_gains_the_watchlist_columns_and_leaves_companies_unrated(
|
||||
|
||||
migrated = Store(path)
|
||||
|
||||
assert migrated.migrations_applied == [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29]
|
||||
assert migrated.migrations_applied == [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]
|
||||
acme = migrated.company("acme")
|
||||
assert acme is not None
|
||||
assert (acme.ats, acme.careers_url) == ("teamtailor", "https://a.example")
|
||||
@@ -394,7 +395,7 @@ def test_v14_makes_each_intent_the_agents_one_prompt_with_its_vector(tmp_path: P
|
||||
|
||||
migrated = Store(path)
|
||||
|
||||
assert migrated.migrations_applied == [14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29]
|
||||
assert migrated.migrations_applied == [14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]
|
||||
assert migrated.agent(backend.id).prompts == [ # type: ignore[union-attr]
|
||||
Prompt(name="Backend", text="python backend")]
|
||||
assert migrated.agent(blank.id).prompts == [] # type: ignore[union-attr]
|
||||
@@ -418,7 +419,7 @@ def test_v16_gives_a_company_no_reason_and_keeps_its_row(tmp_path: Path) -> None
|
||||
|
||||
migrated = Store(path)
|
||||
|
||||
assert migrated.migrations_applied == [16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29]
|
||||
assert migrated.migrations_applied == [16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]
|
||||
acme = migrated.company("acme")
|
||||
assert acme is not None
|
||||
assert (acme.careers_url, acme.notes, acme.hand_reason) == (
|
||||
@@ -447,7 +448,7 @@ def test_v17_folds_every_place_and_levels_the_titles_extract_has_not_read(
|
||||
|
||||
migrated = Store(path)
|
||||
|
||||
assert migrated.migrations_applied == [17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29]
|
||||
assert migrated.migrations_applied == [17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]
|
||||
with sqlite3.connect(path) as conn:
|
||||
rows = {uid: (fold, level) for uid, fold, level in conn.execute(
|
||||
"SELECT uid, place_fold, seniority FROM roles")}
|
||||
@@ -690,7 +691,7 @@ def test_v19_gives_every_role_its_places_and_splits_its_level(tmp_path: Path) ->
|
||||
|
||||
migrated = Store(path)
|
||||
|
||||
assert migrated.migrations_applied == [19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29]
|
||||
assert migrated.migrations_applied == [19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]
|
||||
assert [p.name for p in migrated.role_places(joined.uid)] == ["Copenhagen", "Malmö"]
|
||||
assert [p.name for p in migrated.role_places(detailed.uid)] == ["Aarhus"]
|
||||
assert migrated.role_places(stated.uid) == []
|
||||
@@ -732,7 +733,7 @@ def test_v25_clears_the_model_levels_the_ladder_splits_and_sets_the_level(
|
||||
|
||||
migrated = Store(path)
|
||||
|
||||
assert migrated.migrations_applied == [25, 26, 27, 28, 29]
|
||||
assert migrated.migrations_applied == [25, 26, 27, 28, 29, 30]
|
||||
with sqlite3.connect(path) as conn:
|
||||
found = {sid: rest for sid, *rest in conn.execute(
|
||||
"SELECT source_id, seniority_model, seniority_stated, seniority_title, seniority "
|
||||
@@ -750,12 +751,12 @@ def test_v26_adds_posting_url_empty_and_runs_twice_without_harm(tmp_path: Path)
|
||||
|
||||
migrated = Store(path)
|
||||
|
||||
assert migrated.migrations_applied == [26, 27, 28, 29]
|
||||
assert migrated.migrations_applied == [26, 27, 28, 29, 30]
|
||||
role = migrated.role(posting("a").uid)
|
||||
assert role is not None and role.posting_url == ""
|
||||
with sqlite3.connect(path) as conn:
|
||||
conn.execute("PRAGMA user_version = 25") # the column is there already
|
||||
assert Store(path).migrations_applied == [26, 27, 28, 29]
|
||||
assert Store(path).migrations_applied == [26, 27, 28, 29, 30]
|
||||
|
||||
|
||||
def test_a_pull_keeps_the_posting_url(store: Store) -> None:
|
||||
|
||||
Reference in new issue
Block a user