You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Include today's plan tasks in daily prompt generation
- Accept optional todays_plan in generate_daily_prompts and read today's plan in generate_prompts_for_date (entry_type="plan").
- Extract "## Action Items" from plan content (regex), parse markdown task lines, and categorize completed (- [x]) vs incomplete (- [ ]) tasks.
- Add plan context to LLM input and dynamically inject instructions so at least one question addresses tasks using celebratory language for completed tasks and curious/exploratory language for incomplete tasks.
- Improve LLM-response handling/logging: log parsed prompt count and include original count when padding.
- Add re import and remove unused logging_config import.
logger.debug(f"Generating daily prompts with {len(recent_entries)} recent entries")
96
134
97
135
system_prompt="""You are a thoughtful journaling assistant. Generate 3 reflective questions
98
-
based on the user's recent diary entries. Questions should:
136
+
based on the user's recent diary entries and today's plan tasks. Questions should:
99
137
- MUST reference at least one specific entry using [[YYYY-MM-DD]] format in each question
100
138
- Build on themes, questions, or situations mentioned in the referenced entries
139
+
- If today's plan tasks are provided, include at least ONE question about tasks
101
140
- Encourage deeper reflection
102
141
- Be personal and specific (not generic)
103
142
- Do NOT use emojis in your questions
104
143
- Use plain text only
105
144
145
+
TASK-SPECIFIC LANGUAGE:
146
+
- For COMPLETED tasks: Use celebratory/reflective language (e.g., "How did completing X feel?", "What did you learn from X?", "What went well with X?")
147
+
- For INCOMPLETE tasks: Use curious/exploratory language (e.g., "What prevented you from completing X?", "Do you still want to pursue X?", "What would help you complete X?")
148
+
106
149
CRITICAL: Each of the 3 questions MUST address DIFFERENT topics from the entries.
107
-
- Question 1: Focus on one theme/topic
150
+
- Question 1: Focus on one theme/topic (can be about today's tasks if provided)
108
151
- Question 2: Focus on a DIFFERENT theme/topic
109
152
- Question 3: Focus on yet ANOTHER distinct theme/topic
110
153
@@ -114,11 +157,25 @@ def generate_daily_prompts(
114
157
115
158
Format each question on a new line, numbered 1-3. Be concise."""
116
159
117
-
user_prompt=f"""Based on these recent diary entries, generate 3 thoughtful reflection prompts:
160
+
has_plan=todays_planand"Today's Plan"incontext
161
+
has_completed=completed_tasksandhas_plan
162
+
has_incomplete=incomplete_tasksandhas_plan
163
+
164
+
plan_instruction=""
165
+
ifhas_plan:
166
+
ifhas_completedandhas_incomplete:
167
+
plan_instruction="\n\nIMPORTANT: Today's plan includes both completed and incomplete tasks. Generate at least ONE question that:\n- Uses CELEBRATORY language for completed tasks (e.g., 'How did completing X feel from [[date]]?', 'What did you learn from finishing X from [[date]]?')\n- Uses CURIOUS language for incomplete tasks (e.g., 'What prevented you from completing X from [[date]]?', 'Do you still want to pursue X from [[date]]?')"
168
+
elifhas_completed:
169
+
plan_instruction="\n\nIMPORTANT: Today's plan tasks were completed. Generate at least ONE question using CELEBRATORY language (e.g., 'How did completing X feel from [[date]]?', 'What did you learn from finishing X from [[date]]?', 'What went well with X from [[date]]?')."
170
+
elifhas_incomplete:
171
+
plan_instruction="\n\nIMPORTANT: Today's plan tasks were not completed. Generate at least ONE question using CURIOUS/EXPLORATORY language (e.g., 'What prevented you from completing X from [[date]]?', 'Do you still want to pursue X from [[date]]?', 'What would help you complete X from [[date]]?')."
172
+
173
+
user_prompt=f"""Based on these recent diary entries{' and today\'s plan tasks'ifhas_planelse''}, generate 3 thoughtful reflection prompts:
118
174
119
175
{context}
120
176
121
177
STEP 1: Scan ALL topics mentioned across the entries. List distinct themes like:
178
+
- Today's planned tasks/goals (if provided - focus on completion/progress)
122
179
- Professional work (teaching, projects, sessions)
123
180
- Personal relationships (partner, family, friends, colleagues)
124
181
- Health & wellness (sleep, diet, exercise, mental health)
@@ -130,7 +187,7 @@ def generate_daily_prompts(
130
187
STEP 3: Generate 1 question for EACH of those 3 different themes.
131
188
132
189
Example of GOOD diversity:
133
-
- Q1: About teaching/work [[date]]
190
+
- Q1: About task completion from today's plan [[date]]
134
191
- Q2: About relationship with partner [[date]]
135
192
- Q3: About sleep/health habits [[date]]
136
193
@@ -139,7 +196,7 @@ def generate_daily_prompts(
139
196
- Q2: About Spanish office hours [[date]] ← Same topic area!
140
197
- Q3: About teaching community [[date]] ← Same topic area!
141
198
142
-
Each prompt MUST include at least one [[YYYY-MM-DD]] backlink."""
199
+
Each prompt MUST include at least one [[YYYY-MM-DD]] backlink.{plan_instruction}"""
0 commit comments