Add a job leads inbox that finds and scores postings
The tracker recorded applications but could not find jobs. A new pipeline (services/job_leads.go, job_sources.go) polls a watch list of sources on a timer or on request, files unseen postings as leads, marks which pass a keyword and location pre-filter, and has Claude score those against a single search profile through a fourth internal Python route, /internal/jobs/score. Sources are Greenhouse, Lever and Ashby company boards (public JSON) and Adzuna and Reed keyword searches (API keys). The two search fetchers are written from the providers' documentation and tested only against stubs. Leads are their own table, not a job status, and are not soft deleted: the (source_kind, external_id) index is the dedup, so a dismissed lead has to remain a row. A lead reaches the tracker only by promotion, which goes through UpsertJobApplication. That upsert moves from the capture handler into services so promotion and the fetcher can share it; the capture endpoint's behaviour is unchanged. /cv/leads is the page: inbox, watch list and profile form. The timer is off unless JOB_LEADS_ENABLED=true and never runs at start-up, so a deploy spends no Claude calls. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
# Job application tracker. Rows come from these mutations, automatically from
|
||||
# the email sync pipeline (backend/services/email_sync.go), or from the browser
|
||||
# capture userscript (backend/handlers/handle_job_capture.go). These are
|
||||
# private data, so the queries here are @admin as well as the mutations.
|
||||
# the email sync pipeline (backend/services/email_sync.go), from the browser
|
||||
# capture userscript (backend/handlers/handle_job_capture.go), or from
|
||||
# promoting a lead (job_lead.graphql). These are private data, so the queries
|
||||
# here are @admin as well as the mutations.
|
||||
#
|
||||
# description is the captured posting text. It can run to tens of kilobytes,
|
||||
# so the tracker's list query leaves it out and asks for it per row.
|
||||
|
||||
@@ -0,0 +1,133 @@
|
||||
# Job leads: postings found automatically, as opposed to applications being
|
||||
# tracked (job_application.graphql). The fetcher in
|
||||
# backend/services/job_leads.go polls each JobSource, files what it finds as
|
||||
# JobLead rows and has Claude score them against the JobSearchProfile. A lead
|
||||
# reaches the tracker only when it is promoted from the leads page.
|
||||
#
|
||||
# All of it is private, so every field here is @admin, queries included.
|
||||
|
||||
# One place to poll. `kind` is one of greenhouse, lever, ashby (a company's
|
||||
# board: `token` is its slug and `label` the company name) or adzuna, reed (a
|
||||
# keyword search: `query` and `location`, with `label` only a display name).
|
||||
# It is a String rather than an enum because the resolver validates it and
|
||||
# the list is the fetcher's to extend (services/job_sources.go).
|
||||
#
|
||||
# The last* fields are written by the fetcher, never by a mutation.
|
||||
type JobSource {
|
||||
id: ID!
|
||||
createdAt: Time!
|
||||
updatedAt: Time!
|
||||
kind: String!
|
||||
label: String!
|
||||
token: String!
|
||||
query: String!
|
||||
location: String!
|
||||
enabled: Boolean!
|
||||
lastFetchedAt: Time
|
||||
lastCount: Int!
|
||||
lastError: String!
|
||||
}
|
||||
|
||||
input CreateJobSourceInput {
|
||||
kind: String!
|
||||
label: String!
|
||||
token: String
|
||||
query: String
|
||||
location: String
|
||||
enabled: Boolean
|
||||
}
|
||||
|
||||
input UpdateJobSourceInput {
|
||||
kind: String
|
||||
label: String
|
||||
token: String
|
||||
query: String
|
||||
location: String
|
||||
enabled: Boolean
|
||||
}
|
||||
|
||||
# description is the posting's full text, tens of kilobytes on some boards,
|
||||
# so the list query on the leads page leaves it out and asks per row — the
|
||||
# same arrangement as JobApplication.description.
|
||||
#
|
||||
# state is new, dismissed or promoted. score (0-100) and scoreReasons are
|
||||
# null until Claude has scored the lead, which only happens to matched ones.
|
||||
type JobLead {
|
||||
id: ID!
|
||||
createdAt: Time!
|
||||
sourceKind: String!
|
||||
jobTitle: String!
|
||||
company: String!
|
||||
location: String!
|
||||
url: String!
|
||||
description: String!
|
||||
postedAt: Time
|
||||
lastSeenAt: Time!
|
||||
matched: Boolean!
|
||||
state: String!
|
||||
score: Int
|
||||
scoreReasons: String
|
||||
jobAppId: ID
|
||||
}
|
||||
|
||||
# The single row a lead is judged against. profile is free text sent to
|
||||
# Claude with each posting; the three keyword lists hold one entry per line
|
||||
# and drive the pre-filter; minScore is the inbox's display threshold.
|
||||
type JobSearchProfile {
|
||||
updatedAt: Time!
|
||||
profile: String!
|
||||
includeKeywords: String!
|
||||
excludeKeywords: String!
|
||||
locations: String!
|
||||
minScore: Int!
|
||||
}
|
||||
|
||||
input UpdateJobSearchProfileInput {
|
||||
profile: String
|
||||
includeKeywords: String
|
||||
excludeKeywords: String
|
||||
locations: String
|
||||
minScore: Int
|
||||
}
|
||||
|
||||
# lastRunAt and lastError describe the most recent run in this backend
|
||||
# process; both reset when it restarts.
|
||||
type JobLeadSyncStatus {
|
||||
running: Boolean!
|
||||
lastRunAt: Time
|
||||
lastError: String!
|
||||
}
|
||||
|
||||
extend type Query {
|
||||
jobSources: [JobSource!]! @admin
|
||||
# state filters to one of new, dismissed, promoted; omitted returns all.
|
||||
# Leads that failed the pre-filter are left out unless includeUnmatched.
|
||||
jobLeads(state: String, includeUnmatched: Boolean): [JobLead!]! @admin
|
||||
jobLead(id: ID!): JobLead @admin
|
||||
jobSearchProfile: JobSearchProfile! @admin
|
||||
jobLeadSyncStatus: JobLeadSyncStatus! @admin
|
||||
}
|
||||
|
||||
extend type Mutation {
|
||||
createJobSource(input: CreateJobSourceInput!): JobSource! @admin
|
||||
updateJobSource(id: ID!, input: UpdateJobSourceInput!): JobSource! @admin
|
||||
# Errors on an id that does not exist, like the other deletes; the Boolean
|
||||
# is only ever true. The source's leads are kept.
|
||||
deleteJobSource(id: ID!): Boolean! @admin
|
||||
|
||||
dismissJobLead(id: ID!): JobLead! @admin
|
||||
# Puts a dismissed lead back in the inbox. A promoted lead cannot be
|
||||
# restored: its application exists, and is managed on the tracker.
|
||||
restoreJobLead(id: ID!): JobLead! @admin
|
||||
# Adds the lead to the tracker as a saved application — or, if the posting
|
||||
# is already tracked, links to that row instead of making a second — and
|
||||
# returns the lead, now promoted, with jobAppId set.
|
||||
promoteJobLead(id: ID!): JobLead! @admin
|
||||
|
||||
updateJobSearchProfile(input: UpdateJobSearchProfileInput!): JobSearchProfile! @admin
|
||||
|
||||
# Starts a fetch-and-score run in the background and returns at once: true
|
||||
# if it started, false if one was already running. Poll jobLeadSyncStatus
|
||||
# to see it finish.
|
||||
runJobLeadSync: Boolean! @admin
|
||||
}
|
||||
Reference in New Issue
Block a user