(directory, sessionID, job, client)
| 758 | const text = await readSmallTextFile(path.resolve(directory, job.goalFile), 120_000) |
| 759 | if (text.trim()) sections.push(`Goal file ${job.goalFile}:\n${text.trim()}`) |
| 760 | else sections.push(`Goal file ${job.goalFile} was requested but could not be read. Continue from the inline goal objective.`) |
| 761 | } |
| 762 | if (job.promptFile) { |
| 763 | const text = await readSmallTextFile(path.resolve(directory, job.promptFile), 120_000) |
| 764 | if (text.trim()) sections.push(`Extra goal instructions from ${job.promptFile}:\n${text.trim()}`) |
| 765 | } |
| 766 | if (job.goalAcceptance?.length) sections.push("Acceptance criteria:\n" + job.goalAcceptance.map((item, index) => `${index + 1}. ${item}`).join("\n")) |
| 767 | if (job.goalChecks?.length) sections.push("Verification commands that define useful evidence:\n" + job.goalChecks.map((item, index) => `${index + 1}. ${item}`).join("\n")) |
| 768 | if (job.verifyCommand) sections.push(`Post-turn verify command configured by the loop: ${job.verifyCommand}`) |
| 769 | if (job.lastGoalChecks?.length) sections.push("Latest goal check results:\n" + job.lastGoalChecks.map((item) => `- ${item.command}: exit ${item.code}`).join("\n")) |
| 770 | if (job.lastVerifyFailure) sections.push("Previous verify/check failure summary:\n" + String(job.lastVerifyFailure).slice(0, 1600)) |
| 771 | if (job.goalCompletionRejectedReason) sections.push(`Previous completion attempt was rejected:\n${job.goalCompletionRejectedReason}`) |
| 772 | if ((job.maxNoProgress ?? DEFAULT_GOAL_MAX_NO_PROGRESS) > 0) sections.push(`No-progress guard:\n${job.noProgressCount || 0}/${job.maxNoProgress ?? DEFAULT_GOAL_MAX_NO_PROGRESS} recent turn(s) without recorded meaningful progress.`) |
| 773 | if (job.goalProgress?.length) sections.push("Recent goal progress:\n" + job.goalProgress.slice(-5).map((item) => `- ${item.time}: ${item.summary}`).join("\n")) |
| 774 | for (const file of job.includeFiles || []) { |
| 775 | const text = await readSmallTextFile(path.resolve(directory, file), 80_000) |
| 776 | if (text.trim()) sections.push(`Context from ${file}:\n${text.trim().slice(0, 20_000)}`) |
| 777 | } |
| 778 | |
| 779 | return `${GOAL_PROMPT_PREFIX}. |
| 780 | |
| 781 | You are pursuing an experimental persistent goal for this OpenCode session. This is not a timer loop and not a one-shot prompt. Keep working toward the goal until it is completed, blocked, paused, cleared, or stopped by safety limits. |
| 782 |
no test coverage detected