From 6d69443f5128367ec81be58f1ba9414638105e65 Mon Sep 17 00:00:00 2001 From: Matthew Jackson Date: Fri, 6 Mar 2026 15:12:35 -0800 Subject: [PATCH] Pass placeholder format hints to AI for inputs and textareas Captures placeholder from textareas in snapshot. When AI fallback is used, includes placeholder as a format hint so the AI knows expected format (dates, phone numbers, URLs, etc). Co-Authored-By: Claude Opus 4.6 --- lib/form_filler.mjs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/form_filler.mjs b/lib/form_filler.mjs index 3a04d5a..c0abdfd 100644 --- a/lib/form_filler.mjs +++ b/lib/form_filler.mjs @@ -437,7 +437,7 @@ Answer:`; if (!isVisible(ta)) return; const tag = 'ta-' + (idx++); ta.setAttribute('data-claw-idx', tag); - result.textareas.push({ tag, label: _extractLabel(ta), value: ta.value || '', required: _checkRequired(ta) }); + result.textareas.push({ tag, label: _extractLabel(ta), value: ta.value || '', placeholder: ta.placeholder || '', required: _checkRequired(ta) }); }); // Fieldsets @@ -568,9 +568,10 @@ Answer:`; continue; } + const formatHint = field.placeholder ? `(format: ${field.placeholder})` : ''; let answer = this.answerFor(lbl); if (!answer && field.required) { - answer = await this.aiAnswerFor(lbl); + answer = await this.aiAnswerFor(formatHint ? `${lbl} ${formatHint}` : lbl); if (answer) this.saveAnswer(lbl, answer); } if (answer && answer !== this.profile.cover_letter) { @@ -588,9 +589,10 @@ Answer:`; // --- Textareas --- for (const field of snap.textareas) { if (field.value?.trim()) continue; + const taFormatHint = field.placeholder ? `(format: ${field.placeholder})` : ''; let answer = this.answerFor(field.label); if (!answer && field.required) { - answer = await this.aiAnswerFor(field.label); + answer = await this.aiAnswerFor(taFormatHint ? `${field.label} ${taFormatHint}` : field.label); if (answer) this.saveAnswer(field.label, answer); } if (answer) {