feat(agents): enforce QMAS 12-item eligibility threshold with 3-layer validation

根据2024年11月1日更新的优才计划政策,实现12项基本门槛评核准则的
系统级强制校验(需满足至少6项才具备申请资格)。

**Layer 1 — Assessment Expert Prompt (assessment-expert-prompt.ts):**
- QMAS评估新增强制性3步流程:门槛评核 → 成就计分制 → 综合计分制
- 12项评核准则逐一列出,含判定依据(年龄≤50、硕士/博士、STEM、
  双语能力、英文能力、≥5年工作经验、跨国/知名企业≥3年、
  特定行业≥3年、国际经验≥2年、年收入≥100万港币、
  业务实体盈利≥500万港币、上市公司)
- 每项判定为 met/not_met/unknown,unknown不计为符合
- 门槛不通过 → eligible=false, score上限29分
- 输出JSON新增 thresholdCheck 结构化字段(items数组+metCount+passed)

**Layer 2 — Code-level 后置校验 (immigration-tools.service.ts):**
- Step 4.5 安全网:解析评估结果后校验QMAS thresholdCheck一致性
- 门槛不通过但score>29 → 自动降级修正(score=29, eligible=false)
- 门槛通过但eligible=false且score>29 → 自动修正eligible=true
- 缺少thresholdCheck → 记录警告日志

**Layer 3 — Coordinator System Prompt (coordinator-system-prompt.ts):**
- Section 10.1 新增"基本门槛(2024年11月更新)"小节
- 明确说明门槛不通过者不具备申请资格(即使计分制达80分)
- 更新4条常见问题速答,融入门槛准则解释

**数据收集增强 (collection-expert-prompt.ts):**
- 新增3个附加字段:company_type、business_ownership、listed_company
- QMAS类别映射扩展,覆盖门槛评核12项所需全部数据点

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-02-10 07:40:47 -08:00
parent 1f6d473649
commit 60a74fc3b0
4 changed files with 99 additions and 8 deletions

View File

@ -45,14 +45,41 @@ export function buildAssessmentExpertPrompt(adminDirectives?: string): string {
### QMAS ### QMAS
**** **202411**
2024111 **12** **6** /
| # | | |
|---|---------|---------|
| 1 | 50 | age 50 |
| 2 | | education_level / |
| 3 | /STEM | education_field STEM |
| 4 | | language_ability |
| 5 | | language_ability |
| 6 | | work_experience_years 5 |
| 7 | | company_type/company_name 2000500500 |
| 8 | / | work_industry |
| 9 | | overseas_experience 2 |
| 10 | 100 | annual_income 100 |
| 11 | 500 | business_ownership 500 |
| 12 | | listed_company true |
****
- \`met\`(符合)/ \`not_met\`(不符合)/ \`unknown\`(信息不足无法判定)
- \`unknown\` **不计为符合**
- \`met\` 数量,≥ 6 为通过门槛
- **** QMAS eligible falsescore 29 concerns
- ****/
- QMAS \`thresholdCheck\` 字段(格式见下方"输出格式"部分)
****
- -
- / - /
- -
- -
- 245 - 245
**245** **245**
- 3018-3940-4445-5051 - 3018-3940-4445-5051
- /70>> - /70>>
- 75 - 75
@ -180,10 +207,30 @@ export function buildAssessmentExpertPrompt(adminDirectives?: string): string {
{ {
"category": "QMAS", "category": "QMAS",
"categoryName": "优才计划", "categoryName": "优才计划",
"thresholdCheck": {
"items": [
{ "id": 1, "criterion": "50岁或以下", "met": true, "evidence": "用户35岁" },
{ "id": 2, "criterion": "硕士或博士学位", "met": true, "evidence": "硕士学位" },
{ "id": 3, "criterion": "STEM学科", "met": "unknown", "evidence": "专业方向未提供" },
{ "id": 4, "criterion": "两种语言能力", "met": true, "evidence": "中英文良好" },
{ "id": 5, "criterion": "英文能力", "met": true, "evidence": "英文良好" },
{ "id": 6, "criterion": "≥5年工作经验", "met": true, "evidence": "10年工作经验" },
{ "id": 7, "criterion": "跨国/知名企业经验", "met": true, "evidence": "在世界500强企业工作" },
{ "id": 8, "criterion": "特定领域经验", "met": true, "evidence": "金融行业10年" },
{ "id": 9, "criterion": "≥2年国际经验", "met": "unknown", "evidence": "海外经历未提供" },
{ "id": 10, "criterion": "年收入≥100万港币", "met": true, "evidence": "年收入约150万人民币≈165万港币" },
{ "id": 11, "criterion": "业务实体盈利≥500万港币", "met": "not_met", "evidence": "未拥有业务实体" },
{ "id": 12, "criterion": "拥有上市公司", "met": "not_met", "evidence": "未拥有上市公司" }
],
"metCount": 7,
"requiredCount": 6,
"passed": true
},
"eligible": true, "eligible": true,
"score": 75, "score": 75,
"confidence": 0.8, "confidence": 0.8,
"highlights": [ "highlights": [
"基本门槛评核通过7/12项符合",
"硕士学历,工作经验丰富", "硕士学历,工作经验丰富",
"年龄在最佳区间内30-39岁" "年龄在最佳区间内30-39岁"
], ],
@ -193,7 +240,7 @@ export function buildAssessmentExpertPrompt(adminDirectives?: string): string {
], ],
"missingInfo": [ "missingInfo": [
"具体毕业院校(影响学历加分)", "具体毕业院校(影响学历加分)",
"语言能力详情" "专业方向影响STEM判定和人才清单"
], ],
"subClass": "综合计分制" "subClass": "综合计分制"
}, },
@ -215,7 +262,7 @@ export function buildAssessmentExpertPrompt(adminDirectives?: string): string {
"overallRecommendation": "建议优先申请高才通A类审批速度快且条件完全满足同时可准备优才计划作为备选方案。", "overallRecommendation": "建议优先申请高才通A类审批速度快且条件完全满足同时可准备优才计划作为备选方案。",
"topRecommended": ["GEP", "QMAS"], "topRecommended": ["GEP", "QMAS"],
"suitabilityScore": 82, "suitabilityScore": 82,
"summary": "该申请人为高收入专业人士最适合通过高才通A类快速获批。优才计划综合计分制也有一定竞争力,可作为第二选择。" "summary": "该申请人为高收入专业人士最适合通过高才通A类快速获批。优才计划基本门槛通过7/12项综合计分制也有一定竞争力,可作为第二选择。"
} }
\`\`\` \`\`\`
@ -223,6 +270,8 @@ export function buildAssessmentExpertPrompt(adminDirectives?: string): string {
- JSON - JSON
- assessments 6 Coordinator - assessments 6 Coordinator
- scoreconfidencehighlightsconcerns - scoreconfidencehighlightsconcerns
- **QMAS thresholdCheck ** items(12)metCountrequiredCount(6)passed(boolean)
- thresholdCheck.items met true / "not_met" / "unknown"evidence
- missingInfo - missingInfo
- subClass TTPS A/B/C QMAS / - subClass TTPS A/B/C QMAS /

View File

@ -38,6 +38,9 @@ export function buildCollectionExpertPrompt(adminDirectives?: string): string {
- investment_capability: 投资能力 CIES - investment_capability: 投资能力 CIES
- hk_education: 香港院校毕业背景 IANG - hk_education: 香港院校毕业背景 IANG
- tech_field: 具体科技领域 TechTAS - tech_field: 具体科技领域 TechTAS
- company_type: 公司类型 /2000/500/500/ QMAS 7
- business_ownership: 业务实体 QMAS 11
- listed_company: 上市公司 QMAS 12
--- ---
@ -45,7 +48,7 @@ export function buildCollectionExpertPrompt(adminDirectives?: string): string {
- **QMAS**: age, education, work_experience, special_achievements, language_ability - **QMAS**: age, education, work_experience, special_achievements, language_ability, company_type, overseas_experience, annual_income, business_ownership12
- **GEP A类**: annual_income250 - **GEP A类**: annual_income250
- **GEP B/C类**: education_institution - **GEP B/C类**: education_institution
- **IANG**: hk_education, education_level - **IANG**: hk_education, education_level

View File

@ -1290,7 +1290,12 @@ ${categoriesList}
- 3+3+2 - 3+3+2
- **** - ****
**** **202411**
- **12** **6**
- 12(50)/STEM专业(5)/(32000/500/500)(3//)(2)(100)(500)
- ****使80
****
1. **** **80** 1. **** **80**
- 18-39(30), 40-44(20), 45-50(15), 51(0) - 18-39(30), 40-44(20), 45-50(15), 51(0)
- /2(45), /2(30), (10) - /2(45), /2(30), (10)
@ -1301,8 +1306,9 @@ ${categoriesList}
2. **** 2. ****
****Tier 1 ****Tier 1
- "大专能申优才吗?" (50)(30)(20)80线 - "优才计划有什么基本要求?" 20241112680线使
- "超过50岁能申请吗" 080 - "大专能申优才吗?" 12"硕士/博士学位""STEM学位"6
- "超过50岁能申请吗" 12"50岁或以下"116080
- "人才清单有哪些?" 51AI search_knowledge - "人才清单有哪些?" 51AI search_knowledge
## 10.2 (GEP / ) ## 10.2 (GEP / )

View File

@ -1577,6 +1577,39 @@ export class ImmigrationToolsService {
parsedResult = null; parsedResult = null;
} }
// ── Step 4.5: QMAS Threshold Post-validation ──
// Safety net: ensure assessment expert's QMAS score is consistent with 12-item threshold check
const pr = parsedResult as Record<string, any> | null;
if (pr?.assessments && Array.isArray(pr.assessments)) {
const qmasAssessment = pr.assessments.find((a: any) => a.category === 'QMAS');
if (qmasAssessment) {
const tc = qmasAssessment.thresholdCheck;
if (tc && typeof tc.metCount === 'number' && typeof tc.requiredCount === 'number') {
const passed = tc.metCount >= tc.requiredCount;
tc.passed = passed;
if (!passed && qmasAssessment.score > 29) {
console.warn(
`[QMAS Threshold] Score ${qmasAssessment.score} inconsistent with failed threshold ` +
`(${tc.metCount}/${tc.requiredCount}). Capping to 29.`,
);
qmasAssessment.score = 29;
qmasAssessment.eligible = false;
if (!qmasAssessment.concerns) qmasAssessment.concerns = [];
qmasAssessment.concerns.unshift(
`基本门槛评核未通过:仅满足 ${tc.metCount}/12 项需至少6项`,
);
}
if (passed && !qmasAssessment.eligible && qmasAssessment.score > 29) {
qmasAssessment.eligible = true;
}
} else {
console.warn('[QMAS Threshold] Assessment expert did not return valid thresholdCheck for QMAS');
}
}
}
// ── Step 5: Persist as artifact ── // ── Step 5: Persist as artifact ──
const contentToSave = parsedResult ? JSON.stringify(parsedResult) : assessmentResult; const contentToSave = parsedResult ? JSON.stringify(parsedResult) : assessmentResult;
const title = '移民资格评估报告'; const title = '移民资格评估报告';