Summarise every saved or liked role whatever its rank, queue it at once on save or like, and shorten the order labels to Agent match, CV match and Newest so they fit one line

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Sonnet 5.5 committed 2026-10-03 23:14:12 +02:00
1 parent 1d0a4c37f2
commit ee8e450640
20 files changed
+208 -60

No files matched your search

+1 -1
View File
@@ -52,7 +52,7 @@ Three tabs, and a cog for settings.
| | |
|---|---|
| **Roles** | newsdesk's feed: a filter rail (Viewing as, Show read, Best first or Newest first, first seen, tags, and under more filters company and place chips, seniority from, to and track, function, remote, pay and votes), the open roles with company, place, age, tags and a summary, votes (▲ like ● neither way ▼ pass) and a Save button. A title opens the reader beside the list; on a phone it takes the screen. `j`/`k` move, `Enter` opens, `/` searches |
| **Roles** | newsdesk's feed: a filter rail (Viewing as, Show read, Agent match or Newest, first seen, tags, and under more filters company and place chips, seniority from, to and track, function, remote, pay and votes), the open roles with company, place, age, tags and a summary, votes (▲ like ● neither way ▼ pass) and a Save button. A title opens the reader beside the list; on a phone it takes the screen. `j`/`k` move, `Enter` opens, `/` searches |
| **Applications** | the saved roles and their status, each change recorded as an event |
| **Watchlist** | the companies whose board the app cannot read, for going through their careers pages by hand: Yes or No marks whether one is worth checking (a filter shows the unrated, the yes, the no or all), the careers page opens in a new tab and notes when, and a missing or wrong link is set in the row. A company whose board is failing is listed too. Separate from the affinity a search agent has |
+4 -3
View File
@@ -56,9 +56,10 @@ class ExtractConfig(ModelTaskConfig):
class SummariseConfig(ModelTaskConfig):
"""About 60 words on a role, for the list and the read page. See
app/jobs/summarise.py. Off by default like extract; on, a pull summarises
only the best of each enabled agent, as deep and as low as that agent's
own `limits` say, so the cost is bounded whatever the backlog. The read
page's Summarise button asks for one role whether this is on or not."""
the best of each enabled agent, as deep and as low as that agent's
own `limits` say, so the cost is bounded whatever the backlog, and every
role that is saved or liked, whatever its rank. The read page's Summarise button asks for one
role whether this is on or not."""
enabled: bool = False
model: str = "claude-haiku-4-5-20251001"
+1 -1
View File
@@ -6,7 +6,7 @@ written profile and scores skills, experience and career 0 to 100, with one
to three strengths and gaps. The total is `app.models.cv_score`, the three
numbers under the agent's `cv_*` weights, worked out when a role is served and
not stored, so the weights are no part of `input_key`; it is what the feed's
Best CV match sorts by. The model also reports a verdict on each of the
CV match sorts by. The model also reports a verdict on each of the
agent's must-haves (one per line of its must text, numbered M1..Mn in the
prompt); it does not apply them. The rule is code's: a "broken" one makes
career count as at most `app.models.BROKEN_CAP`, when the role is served. Culture and location are left out: the first
+12 -6
View File
@@ -5,12 +5,18 @@ this module is the content (which roles are waiting, what one batch carries,
what the model is told, the schema it answers in, what to do with the
answer), and running it is `desk.modeltask`'s.
A role is waiting while it has no summary, has some text, and is in the top
of an enabled agent's ungated scores as deep and as low as that agent's own
`limits` say (`summarise_top`, `summarise_min`). That bound is what keeps the
cost flat: a pull summarises the roles somebody will look at, not the 30k
that are open. A batch built for named uids (the read page's Summarise
button) takes those roles whatever their rank. See `Store.summarise_waiting`.
A role is waiting while it has no summary, has some text, is open and no copy,
and is either in the top of an enabled agent's ungated scores as deep and as
low as that agent's own `limits` say (`summarise_top`, `summarise_min`), or
one the owner cares about whatever its rank: saved (it has an application, the
star) or voted up by an enabled agent. The limits keep the cost flat: a pull
summarises the roles somebody will look at, not the 30k that are open, and the
saved and liked roles are a handful the owner picked. Each is summarised
once, with the same give-up rule (`GIVE_UP_AFTER` replies that left it
without). Saving or liking a role queues a batch for that one uid at once,
while the stage is on (`web.api`), rather than waiting for the next pull. A
batch built for named uids (the read page's Summarise button) takes those
roles whatever their rank. See `Store.summarise_waiting`.
The text is `article_text` when the posting page was fetched, else
`description`. A role with neither is not waiting at all, so it is never sent.
+3 -2
View File
@@ -1,4 +1,4 @@
/* The Search agents page: what Best match on the Roles tab is measured
/* The Search agents page: what Agent match on the Roles tab is measured
* against, one agent at a time.
*
* Every agent from `/api/agents` is a card, newest first: its name, its
@@ -42,7 +42,8 @@
cv_skills: 30, cv_experience: 25, cv_career: 30 };
// What the model reads after a pull, per agent: the best `extract_top`
// roles scoring at least `extract_min` get their gate columns filled, the
// best `summarise_top` at `summarise_min` or more a summary.
// best `summarise_top` at `summarise_min` or more a summary, and so does any
// role that is saved or liked, whatever its score.
const DEFAULT_LIMITS = { extract_top: 500, extract_min: 0.55, summarise_top: 30, summarise_min: 0.65,
judge_top: 150, judge_min: 0.55 };
// The levels of a language, the order of the server's ladder, and how big a
+7 -3
View File
@@ -575,10 +575,14 @@ kbd {
.seg { display: flex; }
#sort, #f-track { padding: 0 .3rem; }
#rail .seg button {
flex: 1; text-align: center;
font-size: .8rem; padding: .18rem .55rem;
flex: 1 1 auto; text-align: center;
font-size: .8rem; padding: .18rem .3rem;
border: 1px solid var(--line);
}
/* The three order labels share one line: Agent match is the longest and
would otherwise wrap in a 240px rail. Cells grow to the width, each by its
own text. */
#sort button { white-space: nowrap; }
/* Square everything first; only the ends are ends. Every cell but the first
eats its neighbour's border, so the joins are one rule wide rather than two. */
.seg > * { border-radius: 0; }
@@ -714,7 +718,7 @@ body[data-reader="open"] .row[data-open="true"] {
font-variant-numeric: tabular-nums;
}
/* Newest first hides the score, because in that order it is not what put the
/* Newest hides the score, because in that order it is not what put the
row where it is. Done here rather than in the row template so the markup is
the same either way and only the stylesheet knows about the order -- the
gutter goes with it, since a bar with no number beside it is a measurement
+1 -1
View File
@@ -62,7 +62,7 @@
const DOES = {
extract: "fills in country, seniority, salary and the like from what the posting says",
summarise: "writes a short summary and tags for the best roles",
judge: "scores the best roles against a search agent's CV, for Best CV match",
judge: "scores the best roles against a search agent's CV, for CV match",
enrich: "reads the own page of the best roles whose list gave no text",
};
+17 -17
View File
@@ -9,8 +9,8 @@
* from app.js, so a failure is one toast carrying the server's own sentence.
*
* A row is newsdesk's `.row`: the score gutter and number (hidden under
* Newest first, since the score is not what put the row there, and the CV
* match under Best CV match, a dash for a role not judged yet), the title,
* Newest, since the score is not what put the row there, and the CV
* match under CV match, a dash for a role not judged yet), the title,
* company · place · badges · age · tags, the summary or the description's
* opening, and ▼ ● ▲ ★ from judge.js. A passed role and a hidden company's
* are dimmed, never dropped, so a stray tap stays visible to be undone.
@@ -32,12 +32,12 @@
* Picking another reloads the feed and the counts under the reader, which
* stays open and is fetched again for that agent's vote.
*
* Order is Best first (`order=score`, the agent's score moved by its votes),
* Newest first (`order=newest`) or Best CV match (`order=cv`, the roles the
* Order is Agent match (`order=score`, the agent's score moved by its votes),
* Newest (`order=newest`) or CV match (`order=cv`, the roles the
* agent's `judge` read against its CV first, by that total), the same three
* whichever agent is viewed, and all carry the agent's votes and hidden
* companies. Best CV match needs a CV: an agent without one is shown Best
* first, as an agentless page is shown Newest first.
* companies. CV match needs a CV: an agent without one is shown Agent
* match, as an agentless page is shown Newest.
*
* The filters are in the query string, so a reload or a link keeps them, and
* each one set is a history entry, so back takes it off again: a tag, the
@@ -119,10 +119,10 @@
};
const TRACKS = { "": "Both", ic: "Individual", people: "People" };
// What the list is in the order of. Best first is the viewing agent's
// score, moved by its votes; Newest first is first seen; Best CV match is
// What the list is in the order of. Agent match is the viewing agent's
// score, moved by its votes; Newest is first seen; CV match is
// the agent's `judge` total, the roles not judged after by score.
const SORTS = { score: "Best first", time: "Newest first", cv: "Best CV match" };
const SORTS = { score: "Agent match", cv: "CV match", time: "Newest" };
// The route's `order` for each.
const ORDERS = { score: "score", time: "newest", cv: "cv" };
// How many days ahead a deadline earns a badge: today to today + 4, the
@@ -215,13 +215,13 @@
/** The viewing agent, once the agents are in. */
const viewed = () => state.agents.find((a) => a.id === state.filter.agent) || null;
/** Whether Best CV match has a CV to go by: the viewed agent has one, or
/** Whether CV match has a CV to go by: the viewed agent has one, or
the agents are not in yet, when the address is taken at its word. */
const hasCv = () => !state.agentsLoaded || Boolean(viewed()?.cv_text?.trim());
/** The order the list is in. Best first needs an agent to score by: with
/** The order the list is in. Agent match needs an agent to score by: with
none enabled the server answers newest first, and so does this. Best
CV match needs that agent's CV too, and without one is Best first. */
CV match needs that agent's CV too, and without one is Agent match. */
function sortShown() {
const { sort, agent } = state.filter;
if (sort === "time" || agent === null) return "time";
@@ -652,8 +652,8 @@
renderAgent();
// The order, the same three whatever is viewed. Best first needs an
// agent to score by, and Best CV match that agent's CV, so without one
// The order, the same three whatever is viewed. Agent match needs an
// agent to score by, and CV match that agent's CV, so without one
// each is greyed and says why.
const none = state.agentsLoaded && !state.agents.length;
const why = {
@@ -1041,7 +1041,7 @@
}
/* The gutter's number, of 100, and what it says: the agent's score, or
under Best CV match the CV match, where a role `judge` has not read yet
under CV match the CV match, where a role `judge` has not read yet
shows a dash and an empty bar. */
function gutterOf(role) {
if (sortShown() === "cv") {
@@ -1130,7 +1130,7 @@
const rowAt = (i) => $(`#roles-list .row[data-idx="${i}"]`);
function renderFeed() {
// Which order the list is in, for the stylesheet: under Newest first the
// Which order the list is in, for the stylesheet: under Newest the
// score gutter goes, since the score is not what put the row where it is.
$("#list").dataset.sort = sortShown();
sync($("#roles-list"), state.items.map((role, i) => [role.uid, { role, i }]), makeRow, fillRow);
@@ -1949,7 +1949,7 @@
// known, and either way bring the reader's affinity control and judge
// buttons up to date, since `companies` was still empty when it first
// painted.
// Best CV match asked of an agent with no CV is Best first.
// CV match asked of an agent with no CV is Agent match.
if (state.filter.agent !== before || sortShown() !== sortBefore) reload();
else renderFeed();
if (state.readingUid) {
+1 -1
View File
@@ -491,7 +491,7 @@ CREATE INDEX IF NOT EXISTS idx_role_remote_place ON role_remote(place_id, uid);
CREATE INDEX IF NOT EXISTS idx_roles_prep_due ON roles(prep_due) WHERE prep_due > 0;
-- The feed's Closing soon filter. Partial: most roles state no deadline.
CREATE INDEX IF NOT EXISTS idx_roles_deadline ON roles(deadline) WHERE deadline IS NOT NULL;
-- An agent's judgements, for its feed under Best CV match.
-- An agent's judgements, for its feed under CV match.
CREATE INDEX IF NOT EXISTS idx_role_judgements_agent ON role_judgements(agent_id, cv_score DESC);
"""
+13 -5
View File
@@ -145,7 +145,7 @@ def _cv_sql(weights: Weights | None) -> str:
def _by_cv(expression: str) -> str:
"""The order of Best CV match: the judged roles by `cv_score` (its SQL
"""The order of CV match: the judged roles by `cv_score` (its SQL
`expression`), then the rest by score, as `roles` orders them."""
return f"{expression} IS NULL, {expression} DESC, "
@@ -1143,7 +1143,7 @@ class Store:
no score.
With `by_cv` as well, the roles the agent's `judge` read come first
by `cv_score`, then the others by score (Best CV match). Every row
by `cv_score`, then the others by score (CV match). Every row
carries the agent's `cv_score` (None when not judged), computed
from the three numbers under the agent's weights at read time, and the
language flag of its languages against the agent's
@@ -1787,7 +1787,9 @@ class Store:
"""The `WHERE` for a role `summarise` may be sent: no summary yet and
some text to summarise. Given `uids`, those of them and nothing else,
open or not and given up or not, because somebody asked for them.
Otherwise open, not given up, and in `_top_scope`."""
Otherwise open, not given up, and in `_top_scope` or one the owner
cares about whatever its rank: saved (it has an application) or voted
up by an enabled agent."""
where = ["r.summary = ''",
"(TRIM(r.article_text) <> '' OR TRIM(r.description) <> '')"]
if uids is not None:
@@ -1800,7 +1802,12 @@ class Store:
f"""NOT EXISTS (SELECT 1 FROM state
WHERE key = '{self._SUMMARY_MISSED}' || r.uid
AND CAST(value AS INTEGER) >= {GIVE_UP_AFTER})""",
top,
f"""({top}
OR r.uid IN (SELECT role_uid FROM applications
WHERE role_uid IS NOT NULL)
OR r.uid IN (SELECT v.uid FROM role_votes v
JOIN agents a ON a.id = v.agent_id AND a.enabled = 1
WHERE v.vote = 1))""",
]
return " AND ".join(where), params
@@ -1813,7 +1820,8 @@ class Store:
"""Roles `summarise` has yet to write, newest first: the top of every
enabled agent's scores, as deep and as low as that agent's own
`limits` say, so the backlog is bounded by the agents rather than by
the number of open roles; given `uids`, those still without a
the number of open roles, and every open role that is saved or voted
up by an enabled agent, whatever its rank; given `uids`, those still without a
summary, whatever their rank. A batch asks again when it runs."""
where, params = self._summary_scope(uids)
return [Role.from_row(r) for r in self._rows(
+2 -2
View File
@@ -55,8 +55,8 @@
</section>
<section>
<h3>Order</h3>
{# Best first is the viewing agent's score, Newest first is first seen,
Best CV match the agent's `judge` total against its CV; all carry
{# Agent match is the viewing agent's score, Newest is first seen,
CV match the agent's `judge` total against its CV; all carry
that agent's votes. #}
<div class="seg" id="sort" role="group" aria-label="Order"></div>
<label class="rail-field" for="period">First seen</label>
+2 -2
View File
@@ -80,7 +80,7 @@
</fieldset>
<fieldset class="terms cv">
<legend>Your CV</legend>
<span class="hint">Optional. With a CV, the judge stage reads each of this agent's best roles against it and scores skills, experience and career, which Best CV match on Roles sorts by. A role is read at most once per change of the CV, the prompts or the texts below. The CV stays in this app and goes only to the model you set up.</span>
<span class="hint">Optional. With a CV, the judge stage reads each of this agent's best roles against it and scores skills, experience and career, which CV match on Roles sorts by. A role is read at most once per change of the CV, the prompts or the texts below. The CV stays in this app and goes only to the model you set up.</span>
<label>CV
<textarea id="a-cv-text" rows="10" placeholder="Paste your CV or career summary here"></textarea></label>
<label>or read it from a file
@@ -122,7 +122,7 @@
<label>Judge against the CV the best <input type="number" id="a-judge-top" min="0" step="10" value="150"></label>
<label>down to a score of <input type="number" id="a-judge-min" min="0" max="1" step="0.05" value="0.55"></label>
</fieldset>
<span class="hint">Every pull scores every open role for free; these bound what the model then reads, per agent. The count is the backstop, the score the real stop. Fit is a level, the same in every run: a new role with the worst fit scores about 0.27, a perfect one about 0.87. An agent with no prompt feeds neither extract nor summarise, and one with no CV feeds not the judge.</span>
<span class="hint">Every pull scores every open role for free; these bound what the model then reads, per agent. The count is the backstop, the score the real stop. Fit is a level, the same in every run: a new role with the worst fit scores about 0.27, a perfect one about 0.87. Roles you saved or liked are summarised too, whatever their score. An agent with no prompt feeds neither extract nor summarise, and one with no CV feeds not the judge.</span>
<details class="advanced">
<summary>Advanced</summary>
<div class="advanced-body">
+1 -1
View File
@@ -104,7 +104,7 @@
<section class="card" id="company-boards" data-section>
<h2>Company boards</h2>
<p class="lede">Every company roledesk has seen, and how many of its roles are open. Switching a board off stops reading it and closes its roles; hiding a company keeps reading it but leaves its roles out of the list and unscored, and favourite or like lifts one instead, in Best match.</p>
<p class="lede">Every company roledesk has seen, and how many of its roles are open. Switching a board off stops reading it and closes its roles; hiding a company keeps reading it but leaves its roles out of the list and unscored, and favourite or like lifts one instead, in Agent match.</p>
<form id="board-form" class="agent-form source-form" autocomplete="off">
<h3>Follow a company</h3>
+35 -8
View File
@@ -15,6 +15,7 @@ from fastapi import APIRouter, Depends, HTTPException, Query, Response
from pydantic import BaseModel, Field
from app import jobs, places
from app.config import Config
from app.models import (
AFFINITY, RUNGS, TRACKS, Agent, Application, Company, CvLanguage, CvLanguages, FetchTerms,
Gate, Limits, Prompts, Role, RoleRow,
@@ -163,15 +164,21 @@ def get_role(uid: str, store: StoreDep, agent: int | None = None) -> ScoredRole:
@router.post("/roles/{uid}/vote")
def vote_role(uid: str, body: VoteBody, store: StoreDep) -> ScoredRole:
def vote_role(uid: str, body: VoteBody, store: StoreDep, config: ConfigDep,
queue: QueueDep) -> ScoredRole:
"""1 like, 0 neither way, -1 pass, for `body.agent` or the default agent.
The role stays listed either way; the vote moves it in that agent's
ranking, see `Store.roles`, and shapes its taste at the next `score`."""
ranking, see `Store.roles`, and shapes its taste at the next `score`. A
like from an enabled agent also queues the role's summary, see
`_queue_summary`."""
owner = _agent_or_default(store, body.agent)
try:
return store.set_vote(owner.id, uid, body.value)
voted = store.set_vote(owner.id, uid, body.value)
except KeyError:
raise HTTPException(404, f"no such role: {uid}") from None
if body.value == 1 and owner.enabled:
_queue_summary(voted, store, config, queue)
return voted
@router.delete("/roles/{uid}/vote")
@@ -231,7 +238,7 @@ def list_roles(
passed. With `order=score` (the default) the roles are the ones that
agent scored, best first, carrying `score` and `gated_reason`, a gated
one only with `gated=1`; with `order=newest` every open role, newest
first, with no score; with `order=cv` (Best CV match) the scored roles
first, with no score; with `order=cv` (CV match) the scored roles
the agent's `judge` read come first by `cv_score`, the rest after them
by score. Without `agent` the default agent's votes and
hidden companies apply, the order is newest and there is no score; with
@@ -414,6 +421,22 @@ def fetch_text(uid: str, store: StoreDep, agent: int | None = None) -> ScoredRol
return role
def _queue_summary(role: Role, store: Store, config: Config, queue: Any) -> None:
"""Queue the summary of a role the owner just saved or liked, without
waiting for the next pull: one batch of this uid, under the key the read
page's button uses, so a double tap and the button share one job. Only
while the summarise stage is on (`jobs.stages`), for a role with no summary
yet and some text, and with a model reachable; otherwise nothing, and the
save or vote is not the place to say why."""
if (role.summary or not (role.article_text.strip() or role.description.strip())
or not jobs.stages.stage_on(config, store, "summarise")
or not agent.backend(config.agent)):
return
queue.enqueue(f"{jobs.summarise.TASK.kind}_batch", {"uids": [role.uid]},
label=f"Summarising {role.title or role.uid}",
dedup_key=f"summarise:{role.uid}")
@router.post("/roles/{uid}/summarise", status_code=202)
def summarise_role(uid: str, store: StoreDep, config: ConfigDep, queue: QueueDep) -> Job:
"""Queue a summary of one role, whatever its rank and whether or not the
@@ -745,7 +768,7 @@ def set_affinity(key: str, body: AffinityBody, store: StoreDep,
"""-1 hidden, 0 neutral, 1 liked, 2 favourite, for `body.agent` or the
default agent. A key with roles and no company row gets one first (see
`Store.set_affinity`); 404 for a key with neither. A change here is not
seen in Best match until `score` has run, so it queues one
seen in Agent match until `score` has run, so it queues one
(`_score_after_change`) and answers with its id."""
if body.affinity not in AFFINITY:
raise HTTPException(422, "affinity is -1, 0, 1 or 2")
@@ -1140,10 +1163,12 @@ class SaveBody(BaseModel):
@router.post("/applications", status_code=201)
def save_role(body: SaveBody, store: StoreDep) -> Application:
def save_role(body: SaveBody, store: StoreDep, config: ConfigDep,
queue: QueueDep) -> Application:
"""Track one role: the ★ on a role. Pressing it twice does not
double-track it: the existing row comes back rather than a second one
starting at `saved` over whatever status it has since moved to."""
starting at `saved` over whatever status it has since moved to. A saved
role is also queued for its summary, see `_queue_summary`."""
existing = next((a for a in store.applications() if a.role_uid == body.role_uid), None)
if existing is not None:
return existing
@@ -1153,7 +1178,9 @@ def save_role(body: SaveBody, store: StoreDep) -> Application:
application = Application(
role_uid=role.uid, company_key=role.company_key, role_title=role.title,
url=role.original_url, status=body.status, source=role.source)
return store.save_application(application)
saved = store.save_application(application)
_queue_summary(role, store, config, queue)
return saved
@router.delete("/applications/{app_id}", status_code=204)
+1 -1
View File
@@ -83,7 +83,7 @@ summarise:
# Each search agent's best roles read against its CV: skills, experience and
# career 0 to 100, a total, and 1 to 3 strengths and gaps (app/jobs/judge.py),
# for the Best CV match order on Roles. Off by default. On, each pull judges
# for the CV match order on Roles. Off by default. On, each pull judges
# the best roles of every enabled agent with a CV, by that agent's judge
# limits, and only those not judged yet or judged from another CV, prompt,
# avoid or must text, or role text. The CV rides in every call, so batches are
+4 -4
View File
@@ -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), 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 third order, 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 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.
@@ -280,7 +280,7 @@ What was decided for roledesk and the one reason for each. The longer reasoning
**Every link built from someone else's data goes through `safeUrl`.** A board, a search result, a discovered careers page and a saved application's `url` are all free text from outside the app; an `http(s)` check before it lands in an `href` is what keeps a stray `javascript:` link or a bare string typed into a field from being clickable. The reader needed this first, for `original_url`, so `safeUrl` moved to `app.js` beside the app's other shared helpers rather than staying roles.js's own; companies.js (`careers_url`), sources.js (a search sample's `url`) and applications.js (`application.url`) now use the same one.
**A vote moves the rank at read time and never hides.** `Store.roles` multiplies the served score by the vote (`0.5` passed, `1.2` liked, capped at 1) instead of triggering a rescore, so a vote's effect on Best match shows at once and needs no job. A vote never removes a role from the list either, because a stray tap must stay visible and a single further tap must be able to undo it.
**A vote moves the rank at read time and never hides.** `Store.roles` multiplies the served score by the vote (`0.5` passed, `1.2` liked, capped at 1) instead of triggering a rescore, so a vote's effect on Agent match shows at once and needs no job. A vote never removes a role from the list either, because a stray tap must stay visible and a single further tap must be able to undo it.
**Read state is a column on `roles`, and a vote stamps it too.** `read_at` sits beside `vote`, the same shape as newsdesk's `items.read_at`, so the feed filters and counts by it directly rather than joining a side table on every page load. `set_vote` stamps it only when it is still NULL, since voting is reading in newsdesk as well; clearing a vote leaves it alone, because taking back an opinion is not un-reading the posting.
@@ -292,11 +292,11 @@ What was decided for roledesk and the one reason for each. The longer reasoning
**"Hidden" is the word the UI uses for affinity -1; the code keeps `mute` and `hide_muted`.** Renaming the columns would touch every reader of `agents` and `companies` for no behavioural gain, so only the toggle's title, the filter label and the dimmed row say "hidden" in the UI.
**A company affinity change or an agent save queues a `score` that will see it.** `POST /api/companies/{key}/affinity` and `POST /api/score`, which the Search agents page calls after a save, answer with the id of that job, and the page waits on it. `score` is `solo`, so the queue dedupes a plain request into the live job keyed `score`; a queued one has not read anything yet and sees the change, but a running one read the old state, and deduping into it reported "Saved and scored" for a score that did not include the save. So a request during a run queues one follow-up with `depends_on` the running job, `after="done"` and the key `score:after:<id>`, which makes ten clicks during one run one extra pass, and a queued follow-up is the answer until it starts. Without a score after it, an affinity change is invisible in Best match until the next 6-hourly pull, and an unmuted company's roles have no score rows until then.
**A company affinity change or an agent save queues a `score` that will see it.** `POST /api/companies/{key}/affinity` and `POST /api/score`, which the Search agents page calls after a save, answer with the id of that job, and the page waits on it. `score` is `solo`, so the queue dedupes a plain request into the live job keyed `score`; a queued one has not read anything yet and sees the change, but a running one read the old state, and deduping into it reported "Saved and scored" for a score that did not include the save. So a request during a run queues one follow-up with `depends_on` the running job, `after="done"` and the key `score:after:<id>`, which makes ten clicks during one run one extra pass, and a queued follow-up is the answer until it starts. Without a score after it, an affinity change is invisible in Agent match until the next 6-hourly pull, and an unmuted company's roles have no score rows until then.
**A search role's posting text is fetched on demand, not in the pull.** `POST /api/roles/{uid}/text` (`app/jobs/posting.py`) fetches it only when the read page asks, because following Jobindex's link for every role during a pull would count as a click in Jobindex's own statistics; one click for a posting somebody actually opened is fair. A Jobindex role's `vis-job` page is a short ad with a "Se jobbet" link to the posting itself (the employer's site, The Hub, or Jobindex's `jobannonce`); the fetch keeps that link as `roles.posting_url` (migration 26, never written by a pull), reads the text from it, and falls back to the `vis-job` page's own text. The reader's link-out prefers `posting_url`, so it leads to the full posting once the text was fetched.
**Summarising is bounded to the top roles of each agent, by that agent's own `limits`, and off unless switched on.** The pull's `summarise` stage only considers roles with no summary yet that are in the top `summarise_top` (default 30) of an enabled agent's scores and at `summarise_min` (default 0.65, about 35 roles for the starter agent, stricter than extract's since a summary is the long answer), so the cost stays flat whatever the backlog of open roles is. The bounds live on the agent, beside its gates and weights, for the same reason as extract's: a wide monitoring search and a narrow hunt want different depths, and the agent is where the difference is already expressed. Whether the stage runs is the switch under Runs, or `summarise.enabled` in config.yaml until the switch is used, and both default to off like `extract`; the read page's Summarise button asks for one role's summary either way.
**Summarising is bounded to the top roles of each agent, by that agent's own `limits`, and off unless switched on.** The pull's `summarise` stage only considers roles with no summary yet that are in the top `summarise_top` (default 30) of an enabled agent's scores and at `summarise_min` (default 0.65, about 35 roles for the starter agent, stricter than extract's since a summary is the long answer), so the cost stays flat whatever the backlog of open roles is. The bounds live on the agent, beside its gates and weights, for the same reason as extract's: a wide monitoring search and a narrow hunt want different depths, and the agent is where the difference is already expressed. Whether the stage runs is the switch under Runs, or `summarise.enabled` in config.yaml until the switch is used, and both default to off like `extract`; the read page's Summarise button asks for one role's summary either way. The roles the owner marked are summarised whatever their rank (2026-10-03): every open role with an application (the star) or an ▲ from an enabled agent joins the waiting set beside the top lists, once each and under the same give-up rule, since a handful the owner picked is not the backlog the bounds exist for. Saving or liking such a role queues a `summarise_batch` for that one uid at once, under the key the button uses so a double tap is one job, when the stage is on, the role has text and no summary and a model is reachable.
**`extract` and `summarise` are switched on the page, and a stored setting beats config.yaml.** `extract.enabled` and `summarise.enabled` were read at startup and both false, and nothing in the UI said so: an agent's card read "reads 500 at 0.55 · summarises 30 at 0.65" while neither stage had ever run. The `state` keys `stage:extract` and `stage:summarise` ("on" or "off") override the file, `stages.stage_on` in `app/jobs/stages.py` is the one function that decides, and the finders of both tasks ask it, so the stage in a pull, `app job extract` and `app job summarise` agree; with no key the file applies, so config.yaml is the default for a fresh database and an existing deployment behaves as before until someone uses the switch. It is a stored setting rather than a rewrite of config.yaml because rewriting config.yaml from the app would lose its comments and a restart is what the switch is meant to avoid. The switch is under Runs (`GET` and `PUT /api/stages`, `app stages`), beside "Run the pull now": turning a stage on starts nothing, the next pull runs it. It works with no model reachable and says who would answer, since a pull passes a model stage quietly then. A search agent's card says "extract is off" and links to the switch; its limits stay editable either way, since they are what the stage reads once on. The Summarise button queues `summarise_batch` for one uid and never asked the switch.
+1 -1
View File
@@ -15,7 +15,7 @@ What is known and not yet fixed, checked against the code on 2026-09-30. What la
- **The owner's agent has no rule on seniority.** Fit compares subject, not level. The ladder and the rail's From/To/Track filter exist (`LADDER` in `app/models.py`), and the level is filled for about half of open roles. A gate still names words (`principal`, `senior_manager`, `director`, `exec`); a gate on "at least a rung" would read as the rail's filter does.
- **Votes train `taste` only.** The liked-minus-passed centroid weighs 0.2 on both agents. Feeding votes into the prompt vectors is worth doing once there are a few hundred.
- **A starred company's roles crowd the top of Best first.** With the companies weight at 0.2 a favourite's roles gain about 0.13; after starring Databricks it held 33 of the top 60 rows. Lower the weight on the agent's card, or star fewer companies.
- **A starred company's roles crowd the top of Agent match.** With the companies weight at 0.2 a favourite's roles gain about 0.13; after starring Databricks it held 33 of the top 60 rows. Lower the weight on the agent's card, or star fewer companies.
## Sources
+1 -1
View File
@@ -1,4 +1,4 @@
"""The CV match in the feed and the API: Best CV match, Closing soon, the
"""The CV match in the feed and the API: CV match, Closing soon, the
new row and role fields, the agent's CV fields over `/api/agents`, and the
languages suggested from a CV. Nothing here reaches a model."""
+44
View File
@@ -214,3 +214,47 @@ def test_summarise_follows_score_and_finds_nothing_without_a_model(
[batch] = stage.finder(config, store)
assert len(batch.payload["uids"]) == 2
assert stage.kind == "summarise_batch" and stage.callback == cascade.STEP
def test_saved_and_liked_roles_are_waiting_whatever_their_rank(
store: Store, config: Config) -> None:
"""The owner's picks join the top lists: an application (the star) or an
up vote from an enabled agent. A vote from a disabled agent, a pass, a
closed role and a role given up on do not."""
from app.models import Application
first, second, saved, liked, passed, disabled_like, closed, given_up = ranked(
store, "1", "2", "3", "4", "5", "6", "7", "8")
backend = store.agents()[0]
quiet = store.save_agent("Quiet", "python", enabled=False)
store.save_application(Application(role_uid=saved, company_key="acme", role_title="B"))
store.save_application(Application(role_uid=closed, company_key="acme", role_title="B"))
store.save_application(Application(role_uid=given_up, company_key="acme", role_title="B"))
store.set_vote(backend.id, liked, 1)
store.set_vote(backend.id, passed, -1)
store.set_vote(quiet.id, disabled_like, 1)
with store.transaction() as conn:
conn.execute("UPDATE roles SET closed_at = ? WHERE uid = ?", (store.now(), closed))
store.summarise_missed([given_up])
store.summarise_missed([given_up])
store.summarise_missed([given_up])
waiting = {r.uid for r in store.summarise_waiting(20)}
assert waiting == {first, second, saved, liked}
assert store.summarise_pending() == 4
def test_a_saved_role_is_summarised_once_by_the_stage(
store: Store, config: Config, monkeypatch: pytest.MonkeyPatch) -> None:
from app.models import Application
*_, deep = ranked(store, "1", "2", "3")
store.save_application(Application(role_uid=deep, company_key="acme", role_title="B"))
model = stub(monkeypatch)
modeltask.run(summarise.TASK, config, store)
modeltask.run(summarise.TASK, config, store)
asked = [i["uid"] for batch in model.asked for i in batch]
assert sorted(asked) == sorted({deep, posting("1").uid, posting("2").uid})
+57
View File
@@ -1807,3 +1807,60 @@ def test_suggest_companies_matches_through_an_alias(client: TestClient, store: S
for q in ("orsted", "ørsted", "dong"):
res = client.get("/api/suggest/companies", params={"q": q})
assert [(c["key"], c["name"]) for c in res.json()] == [("ørsted", "Ørsted")]
def _summary_jobs(queue: Any) -> list[Any]:
return [j for j in queue.jobs.snapshot().queued if j.kind == "summarise_batch"]
def test_saving_or_liking_a_role_queues_its_summary_once(
app: FastAPI, store: Store, queue: Any, monkeypatch: pytest.MonkeyPatch) -> None:
"""With the stage on, a model reachable and the role without a summary, the
star and an up vote from an enabled agent queue a batch of that uid under
the button's key, so double taps and both together are one job."""
from desk.tools import agent
monkeypatch.setattr(agent, "backend", lambda settings: "api")
app.state.config.summarise.enabled = True
client = TestClient(app)
upsert(store, posting("1"))
upsert(store, posting("2"))
saved, liked = posting("1").uid, posting("2").uid
owner = store.save_agent("A", "python")
assert client.post("/api/applications", json={"role_uid": saved}).status_code == 201
client.post("/api/applications", json={"role_uid": saved})
assert [j.payload for j in _summary_jobs(queue)] == [{"uids": [saved]}]
assert client.post(f"/api/roles/{liked}/vote", json={"value": -1, "agent": owner.id}).status_code == 200
assert len(_summary_jobs(queue)) == 1
client.post(f"/api/roles/{liked}/vote", json={"value": 1, "agent": owner.id})
client.post(f"/api/roles/{liked}/vote", json={"value": 1, "agent": owner.id})
assert sorted(j.payload["uids"][0] for j in _summary_jobs(queue)) == sorted([saved, liked])
# The button shares the key.
assert client.post(f"/api/roles/{liked}/summarise").status_code == 202
assert len(_summary_jobs(queue)) == 2
def test_saving_queues_no_summary_when_the_stage_is_off_or_it_has_one(
app: FastAPI, store: Store, queue: Any, monkeypatch: pytest.MonkeyPatch) -> None:
from desk.tools import agent
monkeypatch.setattr(agent, "backend", lambda settings: "api")
client = TestClient(app)
upsert(store, posting("1"))
upsert(store, posting("2"))
off, done = posting("1").uid, posting("2").uid
client.post("/api/applications", json={"role_uid": off})
assert _summary_jobs(queue) == []
app.state.config.summarise.enabled = True
store.set_summary(done, "Already written, long enough.")
client.post("/api/applications", json={"role_uid": done})
assert _summary_jobs(queue) == []
monkeypatch.setattr(agent, "backend", lambda settings: "")
store.upsert_role(posting("3"))
client.post("/api/applications", json={"role_uid": posting("3").uid})
assert _summary_jobs(queue) == []