Repository navigation
Closed
Description
Context
An agent run's only direct output is a free-form, human-readable report. A recurring agent must see its own prior reports so it can say "what changed since last time" instead of repeating itself. This issue builds the pure prompt-assembly module used by the report executor (issue 7). Keeping it pure (no I/O beyond what the caller passes in) makes the most product-sensitive part — exactly what the model is told — trivial to unit test and review.
The prompt deliberately does not ask for any structured action schema. ProPR never parses the report (explicit requirement). Acting on it is a separate agent step (issue 10).
Requirements
- New
src/jobs/agentRuns/reportPrompt.tsexportingbuildAgentReportPrompt(input)whereinputcontains:definition(frozen snapshot),run(id, trigger, triggerSource, createdAt),previousReports: Array<{ runId, reportedAt, report }>(newest first, already loaded by the caller withlistPreviousReports),attachments: Array<{ originalName, workspacePath }>(paths inside the container workspace),workspace: { repositoriesReadable: boolean; primaryRepository: string; contextRepositories: string[] }.
- Prompt sections, in order:
- Role & boundaries: "You are running a ProPR Agent. Produce a report. Do not modify files, do not commit, do not open pull requests." When
propr_mcpis enabled for the report step, state that MCP tools are available for reading context only; acting happens in a later, separate step. - Capability statement generated from the definition (repository code: available at
<path>/ not available; web: allowed / not allowed; ProPR MCP: available / not available) — the model must be told what it cannot do so it does not fabricate. - The user's task prompt, fenced inside
<agent-task>tags. - Input files list.
- Previous reports (if
includePreviousReports), each fenced in<previous-report run="…" reported-at="…">, truncated toAGENT_PREVIOUS_REPORT_MAX_CHARSwith a visible[truncated]marker, plus the instruction: "Compare with the previous report(s). Lead with what is new, changed or resolved since then; do not repeat unchanged findings in full." - Output contract: "Your final message is the report. Write Markdown for a human reader. Start with a one-paragraph summary, then details, then recommended next steps in plain prose." No JSON required.
- Role & boundaries: "You are running a ProPR Agent. Produce a report. Do not modify files, do not commit, do not open pull requests." When
- Untrusted-data guard: previous reports and attachments are wrapped and labelled as data, not instructions (prompt-injection hygiene, same principle as MCP "provider text is untrusted data").
- Escape any literal
</agent-task>/</previous-report>sequences inside user content so a report cannot close its own fence. - Tests
test/agentReportPrompt.test.ts.
Implementation Specification
- Pure function, string in → string out; no
@propr/coreimports except constants from@propr/shared. - Total prompt must stay below 200k characters: if over, drop the oldest previous reports first (they are the least relevant), then truncate attachments list.
- Export
extractAgentReport(result)helper: pickssummary, falling back to the last assistant text inconversationLog, thenrawOutput; passes the text throughsanitizeAgentReportandredactSecretsfrom core. (Lives here because it is the inverse contract of the output instruction.)
Acceptance Criteria
- With
includePreviousReports=falseno previous report text appears. - Previous reports appear newest first, each truncated with a marker when too long.
- A report containing
</previous-report>cannot break out of its fence. - Capabilities off → prompt states repository code and web are unavailable.
-
extractAgentReportstrips commit housekeeping and redactsghp_tokens.
Created by ProPR AI Planner
Activity
propr-dev commentedon Oct 6, 2026
Suggested Implementation:
Implementation Approach
The report prompt is assembled by a pure function so the exact text the model sees is reviewable and unit-tested. Previous reports are treated as first-class input (their own fenced section with a diff instruction) rather than concatenated into the user prompt, because a diff instruction only works if the model can clearly distinguish "my task" from "what I said last time".
We wrap all re-injected content (previous reports, file names) in labelled tags and tell the model it is data. Reports are model-written and may quote issue text from the internet; without the guard, a past report could inject instructions into the next run. The output instruction asks for Markdown prose and explicitly not a schema — the acting step reads prose with judgment.
File:
src/jobs/agentRuns/reportPrompt.ts(new file)Why this file: Owns the prompt contract (input) and report extraction (output) of a report run. The executor (issue 7) only does I/O around these two functions.
File:
test/agentReportPrompt.test.ts(new file)Why this file: Locks down the most product-sensitive text in the feature.
propr-dev commentedon Oct 6, 2026
🤖 AI processing has started for this issue using claude agent with claude-opus-5-5 model.
I'll analyze the problem and work on a solution. This may take a few minutes.
Processing Details:
claudeclaude-opus-5-52805/claude-opus-5-5-agents-v1-6-17-report-run-20261006-1538-nhz2800-epic-agents-v1-y7tissue-2805-20261006-1538-claude-opus-5-5-nhz🔍 Track Task Execution
I've added the report-run prompt builder for issue #2805 in `src/jobs…
I've added the report-run prompt builder for issue integry#2805 in `s…