Skip to content

Commit 3f212ba

Browse files
committed
fix: use minimal system prompt for journal writing, generate fallback when agent returns empty
1 parent f95f4da commit 3f212ba

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

internal/evolution/phases_communicate.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,13 +168,15 @@ func (e *Engine) issueAlreadyCommented(ctx context.Context, issueNum int, day st
168168

169169
// writeJournalEntry generates and writes the journal entry for this session.
170170
func (e *Engine) writeJournalEntry(ctx context.Context, p iteragent.Provider, tools []iteragent.Tool, systemPrompt string, skills *iteragent.SkillSet, day string) {
171-
// Use a fresh context so journal writing can't be starved by earlier phase work.
172-
journalCtx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
171+
journalCtx, cancel := context.WithTimeout(context.Background(), 3*time.Minute)
173172
defer cancel()
174173

175174
// Read recent commits to give the agent context without requiring a tool call.
176175
recentCommits, _ := e.runTool(journalCtx, "bash", map[string]string{"cmd": "git log --oneline -8"})
177176

177+
// Use a minimal system prompt — no tools, no skills. Just write.
178+
minimalPrompt := "You are iterate, a self-evolving coding agent. You write honest journal entries about your evolution sessions."
179+
178180
journalMsg := `Write a journal entry for this evolution session. Reply with ONLY the journal entry — no explanation, no preamble, no markdown fences.
179181
180182
Recent commits:
@@ -192,7 +194,7 @@ Rules:
192194
- If nothing was implemented, write "Evolution session completed." as the body
193195
- Start your reply with "## Day" — nothing before it`
194196

195-
a := e.newAgent(p, nil, systemPrompt, skills) // no tools — pure text response
197+
a := e.newAgent(p, nil, minimalPrompt, nil) // no tools, no skills — pure text
196198
var journalEntry string
197199
for ev := range a.Prompt(journalCtx, journalMsg) {
198200
if e.eventSink != nil {
@@ -213,8 +215,10 @@ Rules:
213215
// persistJournalEntry extracts and writes a valid journal entry to JOURNAL.md.
214216
func (e *Engine) persistJournalEntry(journalEntry string, day string) {
215217
if journalEntry == "" {
216-
e.logger.Warn("journal entry is empty — skipping journal write")
217-
return
218+
e.logger.Warn("journal entry is empty — generating fallback from git log")
219+
dayNum, _ := strconv.Atoi(day)
220+
now := time.Now().UTC().Format("15:04")
221+
journalEntry = fmt.Sprintf("## Day %d — %s — Evolution session\n\nEvolution session completed.\n", dayNum, now)
218222
}
219223

220224
// Try to find the journal header. Agents format things differently.

0 commit comments

Comments
 (0)