• בלוג
  • האם פרומפט הוא טקסט טוב להודעת קומיט?

האם פרומפט הוא טקסט טוב להודעת קומיט?

08/06/2025

בניסוי מעניין של קלאודפלייר הם הלכו לממש ספריית oauth באמצעות קלוד קוד והמפתח הראשי הקפיד לתת לקלוד לכתוב כמה שיותר מהקוד ובכל אינטרקציה רשם את הפרומפט בהודעת הקומיט וגם את התפתחויות השיחה. זו הודעת קומיט לדוגמה משם:

Ask Claude to merge the auth code into the grant records.
Prompt: Let's give auth codes the same treatment we did refresh tokens, that is, store them in the grants table rather than separately. So, an auth code should have the format `{userId}:{grantId}:{randomSecret}` just like tokens do, and we should store the auth code hash inside the grant record. We should also make the grant record itself expire (by setting a TTL on the KV record) if the auth code is not claimed within (by default) ten minutes. But, once it is claimed and exchanged for a refresh token, then it no longer expires.

Once again there was some sort of technical glitch where Claude's changes to `completeAuthorization()` were not applied, so I had to ask it to read them out and copy/paste manually.

Also Claude did not fully update the doc, so I tried an additional prompt:

Additional prompt: You updated the storage schema to show that authCodeId is now part of grant: records, but you didn't remove the documentation of auth_code: records. Since those no longer exist, can you please remove that from the doc?

But Claude just edited some other parts without actually removing the docs about auth_code. So I will remove it myself in the next commit.

מצד אחד בכתיבת קוד בסיוע AI הפרומפט יכול לכלול מידע סופר רלוונטי לגבי כוונת המפתח. בנוסף שמירת היסטוריה של השיחות יכולה לעזור לנו להשתפר בכתיבת פרומפטים כי עכשיו ב Code Review אפשר לדבר ולזהות תבניות שעבדו וכאלה שלא.

מצד שני לא תמיד קל לקרוא ולהבין כל מה שמופיע בפרומפט, במיוחד כשיש פרומפט מתגלגל שבו אני מבקש מה AI משהו ואז ה AI מגיב ואז ממשיכים את השיחה. יש פה גם סימפטום של "איך" במקום "מה" כלומר ההודעה מתארת איך צריך לשנות את הקוד במקום מה ההגיון או הסיבה לשינוי. ועדיין מדובר בתוספת מעניינת שיכולה לעזור בעתיד לפענח את כוונת המפתח ולעזור לחקור באגים והתנהגות של מערכת.

אני כן אשמח לראות את הפרומפטים מצורפים ל git repo אבל לא במקום הודעות קומיט. אני חושב שמנגנון כמו git-notes יכול לעבוד טוב יותר מהודעת הקומיט עצמה, ואז כלי כמו aider יוכל באופן אוטומטי אחרי כל קומיט להוסיף note עם כל פירוט השיחה שהובילה לקומיט זה, ואולי אפשר גם לכתוב תוספים ל VS Code או Cursor שיוכלו לקחת את כל השיחות שבוצעו בין שני קומיטים ולהפוך אותן ל note לקומיט האחרון.