AI Coaching Engine¶
The coaching engine combines prompt analysis, habit heuristics, and dependency signals to generate feedback.
Input Signals¶
- prompt structure (
Task/Context/Attemptstyle sections) - task clarity and vague-language detection
- context evidence (error/failure + expected/actual + artifact such as file path/snippet/log)
- framework and stack hints (for example React, Next.js, Spring Boot, SQL, Docker)
- attempt quality evidence (action + result + blocker)
- negative attempt phrases (
I didn't try,chua thu,khong thu) - shortcut intent patterns (for example, asking for full copy-paste code)
- large code paste events
- user profile (role, level, habit goals)
- bilingual phrase detection (English + Vietnamese)
Shared Role Coaching Layer¶
Role-specific guidance is centralized in a shared role-coaching module.
That shared layer provides:
- normalized role and level handling
- recommended template selection
- role-specific context and attempt hints
- role-specific examples and warning copy
- specialization-aware coaching for software-engineering profiles (frontend, backend, DevOps, fullstack)
The popup builder, in-page quick builder, prompt-quality engine, live monitor, and analytics summaries all read from the same role definitions.
Prompt Analysis Modes¶
- Draft mode (pre-send): runs with 500ms debounce while user types and updates the live bubble only
- Submit mode: runs on send (
Enter, form submit, send button click, quick-builder send), updates stats and triggers warnings
Decision Rules¶
- calculate a shared 0-100 score across popup builder and live monitor
- scoring dimensions:
clarity,context,specificity,risk guardrails - missing context evidence => suggest concrete evidence gaps
- missing attempt quality => suggest adding action/result/blocker
- vague phrase detection => reduce clarity and risk score
- explicit no-attempt phrase => hard warning and score penalty
- shortcut prompt => stricter warning in strict mode
- high dependency score => recommendation to run manual debugging first
- repeated large pastes => pattern-level alert
Output¶
Coaching messages are displayed as short overlays with severity types:
infosuccesswarning
Overlays are shown in the top-right corner, and prompt/habit state is also reflected in the live coach bubble.