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:
|
||||
|
||||
Reference in new issue
Block a user