From b6c5dd5a8b9675dd726077ad3efee87453457239 Mon Sep 17 00:00:00 2001 From: ftaakash Date: Tue, 13 Oct 2026 23:53:04 +0530 Subject: [PATCH 1/2] =?UTF-8?q?Feat:=20OpenClaw=20auto-apply=20=E2=80=94?= =?UTF-8?q?=20filters,=20per-job=20tailored=20r=C3=A9sum=C3=A9s,=20partner?= =?UTF-8?q?=20ATS=20submission,=20browser=20extension=20(ADR-004)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Job filters (roles, cities/remote, min CTC, blocked companies, must-mention and skip keywords) shared by the nightly agent and the extension - Full résumé tailored to each job from the student's uploaded résumé (lib/resume/tailor.ts), shared with the Résumé Builder; previously only the summary was tailored - Opt-in auto-submit through the employer's Greenhouse/Lever API for employers that issued SkillGraph a key (ATS_PARTNER_KEYS); stops for review on questions only the student can answer - Browser extension (extension/, Chrome MV3) for LinkedIn, Naukri, Glassdoor and Superset: reads the job, checks filters, tailors the résumé, fills the form; the student submits - Extension API with revocable hashed 30-day tokens, per-token rate limiting; connect/revoke UI - Migration 20261018000000_openclaw_auto_apply (additive); privacy policy and README updated - Rejected: storing students' job-site session tokens/passwords and automating those sites (ADR-001 C3: terms violations, account bans, credential-store risk) --- README.md | 18 +- docs/adr/ADR-004-openclaw-auto-apply.md | 78 +++++++ extension/README.md | 32 +++ extension/autofill.js | 118 +++++++++++ extension/background.js | 40 ++++ extension/content.js | 129 ++++++++++++ extension/manifest.json | 28 +++ extension/popup.html | 34 +++ extension/popup.js | 44 ++++ extension/sites.js | 91 ++++++++ skillgraph-web/.env.example | 5 + skillgraph-web/app/(app)/openclaw/page.tsx | 96 +++++++-- .../app/api/extension/applied/route.ts | 31 +++ .../app/api/extension/connect/route.ts | 53 +++++ skillgraph-web/app/api/extension/me/route.ts | 21 ++ .../app/api/extension/prepare/route.ts | 110 ++++++++++ .../app/api/openclaw/config/route.ts | 8 + .../app/api/openclaw/trigger/route.ts | 15 +- .../app/api/resume-builder/build/route.ts | 72 +------ skillgraph-web/app/privacy/page.tsx | 13 +- .../components/openclaw/ExtensionConnect.tsx | 110 ++++++++++ .../components/openclaw/PipelineDashboard.tsx | 2 +- skillgraph-web/lib/authTokens.ts | 26 ++- skillgraph-web/lib/extension.ts | 65 ++++++ skillgraph-web/lib/openclaw/agent.ts | 199 ++++++------------ skillgraph-web/lib/openclaw/filters.ts | 106 ++++++++++ skillgraph-web/lib/openclaw/submit.ts | 162 ++++++++++++++ skillgraph-web/lib/rateLimit.ts | 3 +- skillgraph-web/lib/resume/tailor.ts | 131 ++++++++++++ skillgraph-web/lib/validateEnv.ts | 1 + .../migration.sql | 7 + skillgraph-web/prisma/schema.prisma | 8 +- skillgraph-web/proxy.ts | 12 +- skillgraph-web/tests/openclaw.test.ts | 126 +++++++++++ 34 files changed, 1752 insertions(+), 242 deletions(-) create mode 100644 docs/adr/ADR-004-openclaw-auto-apply.md create mode 100644 extension/README.md create mode 100644 extension/autofill.js create mode 100644 extension/background.js create mode 100644 extension/content.js create mode 100644 extension/manifest.json create mode 100644 extension/popup.html create mode 100644 extension/popup.js create mode 100644 extension/sites.js create mode 100644 skillgraph-web/app/api/extension/applied/route.ts create mode 100644 skillgraph-web/app/api/extension/connect/route.ts create mode 100644 skillgraph-web/app/api/extension/me/route.ts create mode 100644 skillgraph-web/app/api/extension/prepare/route.ts create mode 100644 skillgraph-web/components/openclaw/ExtensionConnect.tsx create mode 100644 skillgraph-web/lib/extension.ts create mode 100644 skillgraph-web/lib/openclaw/filters.ts create mode 100644 skillgraph-web/lib/openclaw/submit.ts create mode 100644 skillgraph-web/lib/resume/tailor.ts create mode 100644 skillgraph-web/prisma/migrations/20261018000000_openclaw_auto_apply/migration.sql create mode 100644 skillgraph-web/tests/openclaw.test.ts diff --git a/README.md b/README.md index 2bab625..081e5ed 100644 --- a/README.md +++ b/README.md @@ -15,15 +15,20 @@ SkillGraph is an end-to-end AI career mentor and assisted job-application platfo ## 🚀 Features -### 1. OpenClaw — Assisted Apply -OpenClaw does the research and preparation; **the student always submits**. -- **Compliant job sources**: official public ATS APIs (Greenhouse, Lever, Ashby), licensed aggregators (JSearch, optional Adzuna) and company career pages. For LinkedIn, Naukri, Indeed and Glassdoor, students paste the job description — SkillGraph never logs into, scrapes or automates those sites, and never stores third-party credentials. +### 1. OpenClaw — Auto-Apply ([ADR-004](docs/adr/ADR-004-openclaw-auto-apply.md)) +OpenClaw finds jobs inside the student's filters, tailors a résumé to each, and applies where that's allowed. +- **Student filters**: target roles, cities/remote, minimum CTC, blocked companies, must-mention and skip keywords. Nothing outside them is prepared or submitted automatically. +- **Résumé tailored per job**, rebuilt from the student's own uploaded résumé (no invented experience). +- **Auto-submit (opt-in)** through the employer's own Greenhouse or Lever API for employers that have connected to SkillGraph (`ATS_PARTNER_KEYS`). If a form asks a question only the student can answer, it waits for them. +- **Browser extension** ([`extension/`](extension/README.md)) for LinkedIn, Naukri, Glassdoor and Superset: checks the job against the filters, tailors the résumé and fills the application form in the student's own browser. The student presses Submit. +- **Never** logs into, scrapes or automates job sites from our servers, and never stores students' passwords, cookies or session tokens for them (ADR-001 C3). +- **Compliant job sources**: official public ATS APIs (Greenhouse, Lever, Ashby), licensed aggregators (JSearch, optional Adzuna) and company career pages. - **10-dimension fit evaluation** with strengths, gaps and negotiation leverage for any job link or pasted description. -- **Nightly preparation**: for active students the worker discovers roles, scores fit, and queues strong matches as *Ready to apply* with a tailored résumé. +- **Nightly run**: for active students the worker discovers roles, applies the filters, scores fit, and submits (partner employers, opt-in) or queues strong matches as *Ready to apply*. - **Interview prep**: STAR story bank and salary-negotiation scripts per role. ### 2. Resume-First Engine -- **Authenticity by design**: the student's real uploaded résumé is the source of truth; AI tailors *only* the 2–3 sentence summary for each posting — no fabricated experience or contact details. +- **Authenticity by design**: the student's real uploaded résumé is the source of truth; AI reorders and rewords it for each posting and may not add employers, projects, numbers or skills. - **ATS-friendly PDF export**, stored privately and downloaded through short-lived signed links. ### 3. Faculty & Recruiter Operating Systems @@ -84,7 +89,8 @@ and long-running jobs into a *separate worker service*, and make OpenClaw *compl | **3 — Trust & operations** | Email verification, password reset, mutual-consent recruiter reveal, DPDP/GDPR data rights, observability, tests | ✅ Done | | **4 — Commercial** | Razorpay billing & plan limits, college workspaces with tenant isolation, caching, load testing | ✅ Done (Razorpay keys pending) | | **5 — Academics & drives** ([ADR-002](docs/adr/ADR-002-academics-and-placement-drives.md)) | Attendance, Smart Adjust, marks, timetable; Haveloc-style drives; college CSV imports; university sync providers | 🟡 In review — SRM API key and Academia connector pending | -| **6 — Placement workflow** ([ADR-003](docs/adr/ADR-003-placement-workflow.md)) | Hiring rounds, job tracker, round confirmation & check-in, placement calendar, notice board, drive chats | 🟡 In review — migration pending | +| **6 — Placement workflow** ([ADR-003](docs/adr/ADR-003-placement-workflow.md)) | Hiring rounds, job tracker, round confirmation & check-in, placement calendar, notice board, drive chats | ✅ Done | +| **7 — OpenClaw auto-apply** ([ADR-004](docs/adr/ADR-004-openclaw-auto-apply.md)) | Job filters, per-job tailored résumés, opt-in submission through partner employers' ATS APIs, browser extension for LinkedIn/Naukri/Glassdoor/Superset | 🟡 In review — partner keys and live-site checks pending | ``` Browser ──► Next.js (Vercel, stateless) ──► lib/services ──► Postgres (migrations, backups) diff --git a/docs/adr/ADR-004-openclaw-auto-apply.md b/docs/adr/ADR-004-openclaw-auto-apply.md new file mode 100644 index 0000000..3bcadea --- /dev/null +++ b/docs/adr/ADR-004-openclaw-auto-apply.md @@ -0,0 +1,78 @@ +# ADR-004: OpenClaw Auto-Apply — Filters, Tailored Résumés, Partner ATS Submission, Browser Extension + +**Status:** Accepted, in review +**Date:** 2026-10-13 +**Deciders:** Product owner (Aakash), engineering + +## Context + +The product owner asked for OpenClaw to apply to jobs automatically on LinkedIn, Naukri, Glassdoor and +Superset, using each student's user id or session token for those sites, with a résumé customised to +each job and only for jobs that pass the student's own filters. + +ADR-001 (finding C3) removed exactly this design in Phase 2. Logging in as the student, or replaying +their session cookies, to automate those sites: +- breaks those sites' terms, which forbid automated access and applications; +- gets **students'** accounts restricted or banned, often during placement season; +- turns SkillGraph into a store of live third-party sessions, the most valuable thing an attacker could take from us. + +Two findings shaped the alternative: +1. **Public ATS "apply" APIs need the employer's key.** Greenhouse's Job Board API and Lever's Postings API + accept applications only with an API key the employer issues. A third party can't submit to them on its own. + So genuine auto-submit is possible only for employers who connect their hiring system to SkillGraph. +2. **The old agent tailored only the summary.** Other sections came from saved Résumé Builder versions, + so a student who had only uploaded a PDF got a résumé with no experience or projects. + +## Decision + +1. **Job filters** (`lib/openclaw/filters.ts`). Target roles, cities (including remote), minimum CTC + (parsed from the band in LPA), blocked companies, and two new filters: + - **must mention:** the job has to mention at least one of these keywords; + - **skip if mentioning:** the job is skipped if it mentions any of these. + + One pure function, `checkFilters`, is used by the nightly agent and by the extension. A job outside the filters is never + prepared or submitted automatically. In the extension the student can choose "Tailor anyway". +2. **Full tailored résumé** (`lib/resume/tailor.ts`). It is built from the student's uploaded résumé and + profile for each job, with the same no-invention rules as the Résumé Builder. It is stored privately as a + `ResumeVersion` and shared by the Résumé Builder, the agent and the extension. +3. **Partner ATS auto-submit, opt-in** (`lib/openclaw/submit.ts`). + - **When it runs:** only if the student turns on *Submit for me where the employer allows it* and the posting is on a Greenhouse + board or Lever site whose employer key is in `ATS_PARTNER_KEYS`. + - **What it sends:** OpenClaw reads the application form and answers only standard fields from the profile (name, email, phone, + links, college), then attaches the tailored résumé. + - **When it stops:** if any required question can't be answered from the profile (expected CTC, notice period, essays), nothing is sent and + the application waits as `ReadyToApply` with the reason. + - **What it records:** submitted applications are `Applied` with `submittedVia = ats_api` and the ATS's application id. +4. **Browser extension for LinkedIn, Naukri, Glassdoor and Superset** (`extension/`, Chrome MV3). + - **Flow:** on a job page it reads the job, checks the filters through SkillGraph, gets the tailored résumé + and fills the application form in the student's own signed-in browser. + - **What it fills:** empty fields only, never overwriting the student's answers. It attaches the PDF and + highlights questions only the student can answer. + - **What it never does:** it never clicks Submit. *I submitted it* records the application as `Applied` with `submittedVia = extension`. + - **Authentication:** a 30-day bearer token stored hashed (`AuthToken` type `extension`). It is created, shown once and revoked on the OpenClaw page. + - **What it reads:** the extension reads nothing from job sites except the job shown, and sends nothing + of the student's sessions or cookies anywhere. +5. **Superset** is a college-run platform. Beyond the extension, deeper integration should come through the + placement cell's official export, like the Haveloc CSV import in ADR-002, never through student logins. + +Rejected: storing students' job-site session tokens or passwords and automating applications server-side +(the request as stated), for the reasons in *Context*. + +## Consequences + +- Students get one-click assisted applications on the four sites and true auto-apply where employers allow it, with a résumé + tailored to each job. +- Auto-submit stays inactive until an employer issues a key. Getting partner employers is a business task, not an engineering one. +- Job sites change their markup. The extension's readers (`extension/sites.js`) need maintenance, and students can always + select the job text manually. +- The extension is distributed unpacked for now. Publishing to the Chrome Web Store needs a privacy policy entry (done in + `/privacy`, pending legal review) and a store listing. +- Schema: `OpenClawConfig.includeKeywords`, `excludeKeywords` and `autoSubmit`, plus `OpenClawApplication.submittedVia` and + `externalRef` (migration `20261018000000_openclaw_auto_apply`, additive only). + +## Action items +1. [x] Filters, tailored résumé, partner ATS submitter, agent integration, settings UI. +2. [x] Extension API (`/api/extension/*`), per-token rate limiting, extension (MV3), connect/revoke UI. +3. [ ] Verify the Greenhouse and Lever submit calls against a real partner's sandbox before enabling `ATS_PARTNER_KEYS` in production. +4. [ ] Check the extension's site readers against live LinkedIn, Naukri, Glassdoor and Superset pages (they are written from public markup and need a signed-in check). +5. [ ] Chrome Web Store listing once legal has reviewed the privacy text. diff --git a/extension/README.md b/extension/README.md new file mode 100644 index 0000000..5c544a4 --- /dev/null +++ b/extension/README.md @@ -0,0 +1,32 @@ +# SkillGraph OpenClaw — browser extension + +Assisted apply on **LinkedIn, Naukri, Glassdoor and Superset** (ADR-004). + +On a job page the extension: +1. reads the job (role, company, location, pay, description); +2. checks it against your OpenClaw filters in SkillGraph; +3. builds a résumé tailored to that job from your uploaded résumé (no invented experience); +4. fills the application form with your profile and attaches the tailored résumé. + +**You review the form and press Submit yourself.** Then click *I submitted it* to track the job as Applied. + +## Privacy and safety +- SkillGraph never receives your passwords, cookies or session tokens for job sites. The + extension works inside your own signed-in browser. +- The extension stores one SkillGraph token, which expires after 30 days. Disconnect it any time in SkillGraph → OpenClaw. That stops it working immediately. +- It fills only empty fields, never overwrites what you typed, and never clicks buttons. + Questions only you can answer (expected CTC, notice period, experience, personal details) are + highlighted in amber and left blank. + +## Install (developer mode) +1. Open `chrome://extensions`, turn on **Developer mode**, click **Load unpacked**, choose this `extension/` folder. +2. In SkillGraph → OpenClaw → **Browser extension**, click **Connect extension** and copy the token. +3. Click the extension icon, paste the token, then press **Connect**. + +To use a local server, enter its address (e.g. `http://localhost:3000`) in the popup. Only the +addresses listed in `manifest.json` → `host_permissions` are allowed. + +## Limits +Job sites change their page markup. If the role or description isn't detected, select the job +description text on the page and press the button again. Form filling is best effort: always +check every field before submitting. diff --git a/extension/autofill.js b/extension/autofill.js new file mode 100644 index 0000000..231e562 --- /dev/null +++ b/extension/autofill.js @@ -0,0 +1,118 @@ +// Fills the application form on the page with the student's SkillGraph profile and attaches the +// tailored résumé. It only fills empty fields, never changes an answer the student typed, and +// never clicks a button: the student reviews the form and submits it themselves. +/* exported fillApplicationForm */ + +// Field descriptor (label, name, placeholder…) → profile key. First match wins. +const SG_RULES = [ + [/first[\s_-]*name|given[\s_-]*name|fname/, 'firstName'], + [/last[\s_-]*name|surname|family[\s_-]*name|lname/, 'lastName'], + [/linked[\s_-]*in/, 'linkedin'], + [/git[\s_-]*hub|portfolio|personal[\s_-]*(web)?site|website/, 'github'], + [/e-?mail/, 'email'], + [/phone|mobile|contact[\s_-]*(no|number)|whatsapp/, 'phone'], + [/college|university|institut|school/, 'college'], + [/degree|qualification|course/, 'degree'], + [/branch|major|speciali[sz]ation|discipline|stream|department/, 'branch'], + [/cgpa|\bgpa\b|grade[\s_-]*point/, 'cgpa'], + [/graduation[\s_-]*year|year[\s_-]*of[\s_-]*(passing|graduation)|batch|passing[\s_-]*year/, 'year'], + [/current[\s_-]*(city|location)|\bcity\b|location/, 'city'], + [/full[\s_-]*name|^name$|your[\s_-]*name|candidate[\s_-]*name|applicant[\s_-]*name/, 'fullName'], +] + +// Questions only the student can answer: highlighted, never guessed +const SG_ASK_STUDENT = /ctc|salary|notice|experience|years|relocat|visa|sponsor|why|cover|gender|disab|veteran|race|ethnic|date of birth|dob|aadhaar|pan\b/ + +function SG_describe(el) { + const parts = [el.getAttribute('aria-label'), el.name, el.id, el.placeholder, el.getAttribute('autocomplete')] + if (el.id) { + const label = document.querySelector(`label[for="${CSS.escape(el.id)}"]`) + if (label) parts.push(label.innerText) + } + const labelledBy = el.getAttribute('aria-labelledby') + if (labelledBy) labelledBy.split(/\s+/).forEach(id => parts.push(document.getElementById(id)?.innerText)) + const wrapping = el.closest('label') + if (wrapping) parts.push(wrapping.innerText) + // Many forms put the question text in the field's container rather than a