◊
FallRecruitPaper
v1 · prime 991
.
');w.document.close();w.print()} function renderDocuments(v){const docs=state.documents.sort((a,b)=>b.createdAt-a.createdAt);v.innerHTML=`

Documents

${docs.length}
${docs.length?`${docs.map(d=>``).join('')}
DateTemplateCodeStatusHash
${dateStr(d.createdAt)}${esc(d.templateName)}${esc(d.code)}${d.status}${esc(d.hash)}
`:'
No documents.
'}`} function renderAgency(v){const f=state.firm||{};v.innerHTML=`

Agency Setup

`} async function saveAgencyForm(){const f=state.firm||{id:uid('fi'),ts:now()};f.name=$('#fName').value.trim();f.companyNo=$('#fCoNo').value.trim();f.address=$('#fAddr').value.trim();f.phone=$('#fPhone').value.trim();f.email=$('#fEmail').value.trim();f.updatedAt=now();state.firm=f;await idbPut('firms',f);await auditLog('agency.saved');toast('Saved');render()} const T0_QA=[ {q:/tob|terms.?of.?business|hirer.?terms|client.?terms/i,a:'Conduct Regulations 2003 Reg 18: written terms must be agreed with the hirer BEFORE services begin. Must include: fees (including transfer fees), payment terms, notice periods, authority to act, complaints procedure, which party is responsible for paying the worker. Reg 14: cannot make the supply of a worker conditional on the hirer using other services. Best practice: signed TOB with schedule of fees, rebate structure, AWR obligations, IR35 responsibilities.'}, {q:/candidate.?terms|work.?seeker|tob.?c/i,a:'Conduct Regulations 2003 Reg 17: written terms to work-seekers before services. Must include: type of work, minimum rate of pay, whether employment business or agency, notice period, holiday entitlement/pay, that no fee is charged for finding work (s.6 EAA 1973). Opt-out provisions (Reg 10): work-seeker can opt out in writing, 7-day cooling-off. Agency must not withhold pay owed regardless of client payment.'}, {q:/assignment|schedule|temp/i,a:'Assignment schedules should confirm: role, location, hours, duration, pay rate, holiday pay method, expenses, notice period, reporting instructions. Conduct Regs require informing the worker of the nature of work, health and safety risks, experience/qualifications required, expenses. AWR qualifying period starts from assignment start date — track weeks carefully.'}, {q:/awr|12.?week|agency.?worker|equal/i,a:'Agency Workers Regulations 2010: after 12 qualifying weeks, equal treatment on basic pay, overtime, shift pay, annual leave. Day-one rights: access to collective facilities, vacancy information. Breaks in assignment: new role/substantively different work resets the clock; breaks of 6+ weeks reset (with exceptions for sickness up to 28 weeks, annual leave, jury duty, pregnancy/maternity up to 26 weeks). Notification letter recommended at week 10-11.'}, {q:/ir35|sds|status.?determination|off.?payroll/i,a:'Off-payroll (IR35): medium/large clients issue SDS before engagement. Agency must pass SDS to worker with client\'s reasons. Worker can appeal — client must respond within 45 days. If "inside", fee-payer (often agency) operates PAYE. Cover letter should explain determination, reasons, and appeal rights. CEST tool recommended but not conclusive. Factors: control, substitution, mutuality.'}, {q:/transfer|temp.?to.?perm|fee|regulation.?10/i,a:'Conduct Regulations 2003 Reg 10: transfer fee provisions. Hirer can either: (1) pay the transfer fee, or (2) agree an extended hire period (max 8 months from Regulation amendment). After the extended period, no fee is payable. Transfer fee must be reasonable and reflect actual costs. Fee reduces over time — cannot charge the same fee after 6 months as after 1 month.'}, {q:/reference|check|suitability/i,a:'Conduct Regs Reg 22: take reasonably practicable steps to verify suitability — qualifications, experience, authorisation. References not mandatory but best practice. GDPR applies: candidate consent required, reference processed under legitimate interest. Retain reference for duration of relationship + 6 months. Cannot disclose reference content to candidate without referee\'s consent (unless required by law).'}, {q:/rebate|refund|guarantee/i,a:'Fee rebate: standard market practice for permanent placements. Typical structure: pro-rata refund if candidate leaves within guarantee period (usually 8-13 weeks). Conditions: client must notify agency promptly (usually 7 days), allow agency to find replacement. Rebate does not apply if: client changes role significantly, redundancy, constructive dismissal. Not required by law but expected by clients.'}]; function askT0(q){for(const r of T0_QA){if(r.q.test(q))return {answer:r.a,source:'T0 · UK recruitment rules'}}return null} async function askT3(q){if(!state.settings.anthropicKey)return null;try{const res=await fetch('https://api.anthropic.com/v1/messages',{method:'POST',headers:{'x-api-key':state.settings.anthropicKey,'anthropic-version':'2023-06-01','content-type':'application/json'},body:JSON.stringify({model:'claude-sonnet-4-20250514',max_tokens:600,messages:[{role:'user',content:'You are a UK recruitment agency document expert. Conduct Regulations 2003, AWR 2010, IR35, EAA 1973, GDPR. Concise.\n\n'+q}]})});if(!res.ok)return null;const j=await res.json();return {answer:j.content?.[0]?.text,source:'T3 · Anthropic'}}catch(e){return null}} function renderQA(v){v.innerHTML=`

Q & A

T0 + T3 BYOK
${(state.ui.chat||[]).map(m=>`
${esc(m.text)}${m.source?`
${esc(m.source)}
`:''}
`).join('')}
`;const box=$('#chatBox');if(box)box.scrollTop=box.scrollHeight} async function askQ(){const inp=$('#chatIn');if(!inp)return;const q=inp.value.trim();if(!q)return;inp.value='';if(!state.ui.chat)state.ui.chat=[];state.ui.chat.push({role:'user',text:q});render();let r=askT0(q);if(!r)r=await askT3(q);state.ui.chat.push(r?{role:'bot',text:r.answer,source:r.source}:{role:'bot',text:'No T0 match. Add BYOK key for T3.',source:'system'});persistUI();render()} function openModal(type){const modal=$('#modal');$('#modalTitle').textContent='Settings';modal.classList.add('open');$('#modalBody').innerHTML=`
`} function closeModal(){$('#modal').classList.remove('open')} function saveSettings(){state.settings.anthropicKey=$('#sKey').value.trim();state.settings.auditChain=$('#sAudit').checked;$('#tierBadge').textContent=state.settings.anthropicKey?'T3':'T0';persistUI();closeModal();toast('Saved');render()} function exportAll(){const d={tool:TOOLNAME,v:VERSION,ts:now(),firm:state.firm,candidates:state.candidates,clients:state.clients,documents:state.documents};const b=new Blob([JSON.stringify(d,null,2)],{type:'application/json'});const u=URL.createObjectURL(b);const a=document.createElement('a');a.href=u;a.download='fallrecruitpaper-export.json';a.click();URL.revokeObjectURL(u);toast('Exported')} function importAll(){const inp=document.createElement('input');inp.type='file';inp.accept='.json';inp.onchange=async()=>{const f=inp.files[0];if(!f)return;try{const d=JSON.parse(await f.text());if(d.firm){state.firm=d.firm;await idbPut('firms',d.firm)}for(const k of['candidates','clients','documents']){if(Array.isArray(d[k]))for(const r of d[k]){state[k].push(r);await idbPut(k,r)}}persistUI();toast('Imported');render()}catch(e){toast('Failed')}};inp.click()} async function wipeAll(){if(!confirm('Wipe ALL data?'))return;for(const s of['firms','candidates','clients','documents','audit','state']){const tx=db.transaction(s,'readwrite');tx.objectStore(s).clear();await new Promise(r=>{tx.oncomplete=r})}location.reload()} async function seedDemo(){if(state.candidates.length||state.firm)return; const firm={id:uid('fi'),name:'Apex Talent Partners',address:'28 Chancery Lane, London WC2A 1EN',email:'hello@apextalent.co.uk',phone:'020 7946 0958',companyNo:'12345678',updatedAt:now(),isDemo:true}; state.firm=firm;await idbPut('firms',firm); const c1={id:uid('cn'),name:'Alex Turner',email:'a.turner@email.com',phone:'07700 900333',address:'12 High Street, London EC2A 4NE',ts:now(),isDemo:true}; const c2={id:uid('cn'),name:'Fatima Khan',email:'f.khan@email.com',phone:'07700 900666',address:'45 Park Lane, Manchester M1 2AB',ts:now(),isDemo:true}; state.candidates.push(c1,c2);await idbPut('candidates',c1);await idbPut('candidates',c2); const cl1={id:uid('cl'),company:'TechVault Ltd',contact:'James Harper',email:'james@techvault.io',address:'100 Shoreditch High St, London E1 6JJ',ts:now(),isDemo:true}; const cl2={id:uid('cl'),company:'Meridian Financial',contact:'Priya Sharma',email:'p.sharma@meridian.co.uk',address:'50 Canary Wharf, London E14 5AB',ts:now(),isDemo:true}; state.clients.push(cl1,cl2);await idbPut('clients',cl1);await idbPut('clients',cl2); await auditLog('demo.seeded',{reasoning:'first boot'});await persistUI()} (async function boot(){try{await openDB();await loadAll();await seedDemo();initMesh();$('#tierBadge').textContent=state.settings.anthropicKey?'T3':'T0';render()}catch(e){console.error('[fallrecruitpaper] boot error:',e);document.getElementById('view').innerHTML='
Boot error: '+esc(e.message)+'
'}})();