/** * Intent classifier rules — code-of-record per Mia spec §5 Q4. * * **Purpose** * * Centralises every keyword set and structural pattern the L0/L1/L2/L3 * classifier consumes. Both production classifier paths * (`backend/src/types/intent-task.types.ts:classifyIntentLevel/Category` * and `backend/src/services/v3/v3-data.service.ts:classifyIntent`) read * from this file so a rule update lands in exactly one place. * * **Why a separate file?** * * Per Mia: "Easier review than buried regex." A reviewer auditing rule * coverage scans this file's exports rather than walking the classifier's * inline regex. Adding ZH parity to a category is a single-edit operation * here; in the inline shape it would be a ~10-line walk. * * **Spec source-of-truth** * * `specs/2026-05-06-intent-classifier-rules.md` (Mia, 2026-05-06). * Section references (§2.1, §2.2, etc.) below correspond to that doc. * * @module services/intent-task/intent-classifier.rules */ /** * Quantifier tokens that, when paired with a state-changing verb AND a * plural deliverable noun, force L1 → L2 promotion (§2.1). * * Anti-pattern guard (§3 last paragraph): quantifier alone is NOT enough. * "Show me all 3 statuses" stays L0 because the verb is read-only. * Promotion requires quantifier + state-changing verb + plural deliverable * noun — see {@link L2_QUANTIFIER_PROMOTERS_TRIGRAM}. */ export declare const QUANTIFIER_TOKENS: { /** EN: both/all/every/each + numeric + numeric-words. */ readonly en: RegExp; /** ZH: 这两/三/四/五/.../多个/所有/全部/每个/几个. */ readonly zh: RegExp; }; /** * Plural deliverable noun tokens that, paired with a quantifier + state- * changing verb, force L2 promotion (§2.1). * * The ZH measure-words (份/个/张/篇/段/章/项/条) double as deliverable-noun * proxies because Chinese uses measure-words in lieu of pluralisation. */ export declare const DELIVERABLE_NOUN_TOKENS: { readonly en: RegExp; /** * ZH: 文档/文件/规范 + measure-words (份/个/张/篇/段/章/项/条). Combined * because Chinese parses noun + measure-word as the deliverable proxy. */ readonly zh: RegExp; }; /** * Quantifier-trigram tokens (§2.1 + §3 anti-pattern guard). * * **Implementation note:** rather than constraining token order in a * single regex, the classifier checks all three axes (quantifier + * state-change verb + deliverable noun) for presence within the same * input. This handles all natural orderings (VERB-QUANT-NOUN as in * "create three reports" / "做这两份 md 文档"; QUANT-NOUN-VERB as in * "three reports to make" / "三份报告要做"; QUANT-VERB-NOUN; etc.) * without explosion of permutations. * * The anti-promotion guard in `classifyIntentLevel` ensures * "Show me all 3 statuses" stays L0 by checking that the verb axis is * NOT exclusively read-only ({@link L0_READ_VERB_PATTERN}) before * promoting on this trigram. */ export declare const L2_QUANTIFIER_TRIGRAM: { /** * EN: requires all three axes — quantifier + state-change verb + * deliverable noun — present in the input. Order-agnostic. * * The exposed regex matches the QUANTIFIER axis only; the consumer * checks the other two axes via the helper below. */ readonly en: RegExp; /** ZH quantifier axis. */ readonly zh: RegExp; }; /** * State-change verb axis for the quantifier-trigram. Distinct from * {@link ACTION_VERB_EN}/{@link ACTION_VERB_ZH} because the trigram * specifically excludes ambiguous-shape verbs (e.g. `run`, `check`) * that are common in read-only contexts. */ export declare const L2_TRIGRAM_STATE_CHANGE_VERB: { readonly en: RegExp; readonly zh: RegExp; }; /** * Plural-deliverable axis for the quantifier-trigram. Mirrors * {@link DELIVERABLE_NOUN_TOKENS} but kept distinct so a future tuning * of "what counts as deliverable in a trigram context" doesn't drift. */ export declare const L2_TRIGRAM_DELIVERABLE: { readonly en: RegExp; readonly zh: RegExp; }; /** * Doc/spec creation triggers (§2.2 row 1). These promote to L2 even with * a tiny verb because authoring a doc is multi-step by nature. */ export declare const L2_DOC_CREATION_TRIGGER: { readonly en: RegExp; readonly zh: RegExp; }; /** * File-with-extension reference (§2.2 row 2). Any path with extension * promotes to L2 unless the verb is read-only — the read-only guard is * applied at the classifier level, not here, because read-only verbs are * a separate axis (see {@link L0_READ_VERB_PATTERN}). */ export declare const L2_FILE_EXTENSION_TRIGGER: RegExp; /** * PR / commit / branch artifact (§2.2 row 3). Order-agnostic — both * "open a PR" (VERB-NOUN) and "PR to open" (NOUN-VERB) match, with the * VERB-NOUN form being far more common. */ export declare const L2_PR_ARTIFACT_TRIGGER: { readonly en: RegExp; readonly zh: RegExp; }; /** * Migration / schema (§2.2 row 4). */ export declare const L2_MIGRATION_TRIGGER: { readonly en: RegExp; readonly zh: RegExp; }; /** * Build/implement + system-noun (§2.3 row 1). The canonical L2 shape — * pre-existing in the EN classifier; ZH parity is the new contribution. */ export declare const L2_BUILD_SYSTEM_NOUN: { readonly en: RegExp; readonly zh: RegExp; }; /** * Deploy/migrate + env-noun (§2.3 row 2). */ export declare const L2_DEPLOY_ENV_NOUN: { readonly en: RegExp; readonly zh: RegExp; }; /** * End-to-end / full-stack scope (§2.3 row 3). */ export declare const L2_E2E_SCOPE: { readonly en: RegExp; readonly zh: RegExp; }; /** * Coordinate / orchestrate (§2.3 row 4). Single-token signal — by the * time someone says "coordinate", the work is multi-agent by definition. */ export declare const L2_COORDINATE: { readonly en: RegExp; readonly zh: RegExp; }; /** * Sequenced verbs (§2.4 row 1). "X then Y" / "X 然后 Y". */ export declare const L2_SEQUENCED_VERBS: { readonly en: RegExp; readonly zh: RegExp; }; /** * Numbered/bulleted list (§2.4 row 3). Two or more numbered items in the * same input is structurally L2. */ /** * Numbered list trigger. Matches "1. … 2. …" / "(1) … (2) …" / "① … ②". * The `\s?` after the marker is OPTIONAL because Chinese-encoded numbered * lists ("①修复 ②测试") have no whitespace between the marker and the * content. */ export declare const L2_NUMBERED_LIST: RegExp; /** * Restart/recovery + redirect (§2.5). Status-update clause followed by a * directive that references prior multi-step context. The "this/这个" * referent points to a prior plan the classifier can't resolve, but the * SHAPE is reliable enough to promote. */ export declare const L2_CROSS_SYSTEM_PIVOT: { readonly en: RegExp; /** * ZH: status-clause (重启/回来/上线/跑起来/好了/恢复) + ≤16-char gap + * directive prefix (现在/那/你?) + (再/继续/接着/开始) + verb (做/搞/跑/继续). */ readonly zh: RegExp; }; /** * Sprint / milestone / epic markers (§2.6 row 1). These are L3 CANDIDATES * — combined with §2.3 they classify L3; alone they classify L2. */ export declare const L3_SPRINT_OKR_MARKERS: { readonly en: RegExp; readonly zh: RegExp; }; /** * Multi-day timebox (§2.6 row 2). Time markers like "this week" / * "by Friday" / "这周" / "下周" combined with a verb suggest sprint-level * scope. */ export declare const L3_TIMEBOX_MARKERS: { readonly en: RegExp; readonly zh: RegExp; }; /** * Deliver / ship verbs (§2.6 row 3). Distinct from §2.3 deploy axis — * "ship" / "上线" carry a sprint-completion semantic. */ export declare const L3_DELIVER_SHIP_VERBS: { readonly en: RegExp; readonly zh: RegExp; }; /** * Read-only / status-lookup verbs. If the only verb in the input is a * read verb, do NOT promote even if a quantifier is present * (§3 last paragraph: "Show me all 3 statuses" stays L0). */ export declare const L0_READ_VERB_PATTERN: { readonly en: RegExp; readonly zh: RegExp; }; /** * EN action verb pattern. Used as a positive signal for actionability * when no non-actionable pattern matches. Pre-existing — kept here to * keep all classifier inputs in one file. */ export declare const ACTION_VERB_EN: RegExp; /** * ZH action verb pattern. Mirrors §2.3 + §2.6 verb sets plus the canonical * Chinese imperatives Mia called out in the spec preamble (§0 root cause * 1): 做/写/搞/搞定/重启/检查 etc. * * **Strictness on dual-use verbs (Mia 2026-05-06):** the bare imperatives * 做 and 搞 are conversational-filler-ambiguous (做了 = "did already", * 搞砸 = "messed up", 搞不定 = "can't do"). To follow Mia's * stricter-promotion default ("false-negative is fixable; false-positive * over-decomposes"), we use negative lookaheads on those two so the * completed/denial forms don't match. Other actionable forms (做完, 搞定, * 做+deliverable) are explicit fall-through tokens further in the pattern. * * The companion {@link NON_ACTIONABLE_PATTERNS_ZH} set includes * sentence-shape filters for "I just did X" / "I can't do X" cases that * the lookahead alone cannot catch — both layers together produce the * stricter behaviour Mia asked for. */ export declare const ACTION_VERB_ZH: RegExp; /** * Non-actionable ZH patterns that should be filtered out by * `isActionableIntent` before classification (§3 filtered rows). * * Exported as an array for composition with the existing EN * NON_ACTIONABLE_PATTERNS in `intent-task.types.ts`. */ export declare const NON_ACTIONABLE_PATTERNS_ZH: RegExp[]; /** * Length floors for L2 promotion when no rule fires. ZH has no spaces, so * word-count alone under-estimates message density — char-count is the * complementary axis. */ export declare const L2_LENGTH_FLOORS: { /** EN/space-tokenised word count above which the message is L2. */ readonly wordCount: 35; /** Total character count above which the message is L2 (catches ZH). */ readonly charCount: 80; }; /** * Category-specific keyword sets. Each category combines an EN pattern * with a ZH pattern; the classifier matches if EITHER fires. * * Exported as a structured object so the consumer code reads * `CATEGORY_KEYWORDS.debugging.zh.test(input)` rather than digging into * nested ternaries. * * Order is significant — see `classifyIntentCategory` in * `intent-task.types.ts`. The most-specific categories run first. */ export declare const CATEGORY_KEYWORDS: { readonly debugging: { readonly en: RegExp; readonly zh: RegExp; }; readonly deployment: { readonly en: RegExp; readonly zh: RegExp; }; readonly release: { readonly en: RegExp; readonly zh: RegExp; }; readonly ciCdContext: { readonly en: RegExp; readonly zh: RegExp; }; readonly ciCdAction: { readonly en: RegExp; readonly zh: RegExp; }; readonly review: { readonly en: RegExp; readonly zh: RegExp; }; readonly research: { readonly en: RegExp; readonly zh: RegExp; }; readonly planning: { readonly en: RegExp; readonly zh: RegExp; }; readonly communication: { readonly en: RegExp; readonly zh: RegExp; }; readonly codeChange: { readonly en: RegExp; readonly zh: RegExp; }; readonly query: { readonly en: RegExp; readonly zh: RegExp; }; readonly growth: { readonly en: RegExp; readonly zh: RegExp; }; }; //# sourceMappingURL=intent-classifier.rules.d.ts.map