prompt

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package prompt is the review prompt this module ships: the instructions the generate-and-repair loop (agent.Generator) gives a model backend. It also holds the fix instructions (Fix): fix-public-v1.md, with fix-conflicts.md and fix-checks.md for what a fix is for, and the instructions of a chat turn (Chat): chat-public-v1.md.

Five review files are embedded:

review-public-v6.md   the review instructions shared by every backend,
                      ending with the "## 10. Submitting" heading
group-public-v1.md    what changes for a review group's combined
                      review, inserted before that heading by
                      GroupPrompts
submit-claude.md      how a StructuredOutput backend submits the document
submit-codex.md       how a final-message backend returns the document
submit-cursor.md      the same for cursor-agent, which has no schema
                      enforcement and stops a run on any tool that does
                      not read

Instructions joins the shared text with the backend's submit text under the trailing heading, sets Version to Version and Digest to the sha256 of the joined Body. The repair wording stays in agent.RepairText and the tile guidance in tilecatalogue, so neither belongs in these files.

A staged review (agent.Generator.StagedReview, StagedPrompts) has four more, derived from review-public-v6.md:

review-shared-public-v1.md   what every stage shares: the stages and what
                             each writes, the ground rules, the inputs,
                             checking a change, anchors, writing and
                             calibration; with the bundle and the source
                             excerpts, the prefix of every stage's prompt
review-outline-public-v1.md  the overview and the sections' outline
review-details-public-v1.md  the sections' details
review-context-public-v1.md  the summary's codebase context

Each stage file ends with a "## Submitting" heading, under which the backend's stage submit block goes (submit-stage-claude.md, submit-stage-codex.md, submit-stage-cursor.md, with {part} replaced by what the stage returns), and names its schema file (agent.TaskSchemaFile).

Index

Constants

View Source
const ChatVersion = "chat-public-v1"

ChatVersion is the version of the chat instructions; change it with the text of chat-public-v1.md or the submit lines below.

View Source
const FixVersion = "fix-public-v1"

FixVersion is the version of the fix instructions, which change with the text of fix-public-v1.md, fix-conflicts.md, fix-checks.md and fix-threads.md and fix-chat.md.

View Source
const GroupVersion = "group-review-public-v4"

GroupVersion is the prompt version of a review group's combined review. Change it with the text of group-public-v1.md or review-public-v6.md.

View Source
const StagedVersion = "review-staged-public-v1"

StagedVersion is the prompt version of a staged review. Change it with the text of any review-*-public-v1.md file of the staged review.

View Source
const Version = "review-public-v6"

Version is the prompt version recorded in the document's generator block. Change it with the text of review-public-v6.md.

Variables

This section is empty.

Functions

func Chat

func Chat(backend string) string

Chat returns the instructions of one turn of a chat with the agent that wrote a review (internal/chat): the reframing from writing the review to answering the reviewer's question, and how the backend submits its answer. They go in the user prompt of every turn, because a resumed or forked session keeps the system prompt it was recorded with. The caller appends the question and its focus, delimited as untrusted data.

func Fix

func Fix(conflicts, checks, threads, chat bool) string

Fix returns the instructions of a fix an agent makes with write access to a pull request's checkout (agent.Fixer): the shared rules, then the sections for what it fixes: merge conflicts, failing checks, review comments, a change from a conversation. The caller appends the data the sections refer to, delimited as untrusted.

Types

type GroupPrompts

type GroupPrompts struct{}

GroupPrompts implements agent.Prompts for a review group's combined review: the public review prompt with the group instructions (group-public-v1.md) inserted before its Submitting heading, then the backend's submit block.

func (GroupPrompts) Instructions

func (GroupPrompts) Instructions(_ context.Context, backend string) (agent.Prompt, error)

Instructions returns the group prompt for a backend, as Prompts does.

type Prompts

type Prompts struct{}

Prompts implements agent.Prompts with this module's public review prompt.

func (Prompts) Instructions

func (Prompts) Instructions(_ context.Context, backend string) (agent.Prompt, error)

Instructions returns the review prompt for a backend: the shared text with the backend's submit block appended. The claude and anthropic backends submit through the StructuredOutput tool; codex and cursor-agent return the document as their final message, cursor-agent with the schema the backend appends to the prompt. Any other backend is an error.

type StagedPrompts

type StagedPrompts struct{}

StagedPrompts implements agent.StagedPrompts with this module's public staged review prompts.

func (StagedPrompts) StagedInstructions

func (StagedPrompts) StagedInstructions(_ context.Context, backend string) (agent.StagedPrompt, error)

StagedInstructions returns the staged review prompts for a backend: the shared text, and each stage's text with the backend's stage submit block appended, naming what the stage returns, as Prompts appends the submit block for a review written in one pass. Digest is the sha256 of the four texts, each followed by a NUL byte. Any other backend is an error.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL