Skip to content

Add a user-defined prompt template library for issue and PR workflows #89

Description

@jerome-benoit

Problem

Agent-assisted handling of a GitHub item cannot use one generic prompt:

  • bug triage and feature assessment require different evidence and outputs;
  • an initial PR review and a rereview after changes require different context and rules;
  • implementation, review, and CI-repair workflows should not hard-code the same policy.

Without a reusable abstraction, each future action must hard-code a prompt or make users paste the same instructions repeatedly. This request concerns agent prompts, not GitHub issue forms or PR-description templates.

Proposal

Add a structured library of user-defined prompt templates. A minimal manifest could look like:

[[templates]]
id = "pr.initial-review"
label = "Initial PR review"
target = "pull_request"
workflow = "review"
prompt_file = "pr-initial-review.md"
required_context = ["repo", "number", "head_sha"]

The design should provide:

  • a stable template id and label;
  • issue / pull_request applicability plus an extensible workflow tag such as bug_triage, feature_assessment, initial_review, or rereview;
  • prompt bodies stored in a documented user-owned location, with paths resolved relative to the library root;
  • documented, bounded variables for the selected GitHub item;
  • an applicable-template picker, exact rendered-prompt preview, and explicit confirmation before an agent session is created;
  • strict validation of duplicate ids, unknown or missing variables, missing files, and path escapes.

Repository, issue, PR, review, and comment content is untrusted data. It must never define or override the prompt library, and rendered context must remain clearly separated from template instructions.

Agent dispatch can use the existing sessions.create initial-turn RPC, with the required session.create and session.prompt grants declared explicitly. No silent generic fallback should run when template resolution fails.

Acceptance criteria

  • Users can load, validate, and list templates from a documented structured format.
  • The picker shows only templates applicable to the selected issue or PR and workflow.
  • The exact rendered prompt and target repository/item are previewed before dispatch.
  • Missing context, invalid placeholders, duplicate ids, and escaping paths fail with actionable errors.
  • GitHub or repository content cannot add, replace, or select a template implicitly.
  • Parser, selection, rendering, and dispatch payloads have deterministic no-network tests.
  • Documentation includes at least one issue workflow and one PR workflow example.

Out of scope

  • automatic issue classification or unattended dispatch;
  • GitHub issue-form and PR-body templates;
  • forcing one project-specific review policy on every repository.

Related work

AI usage

The feature idea and workflow distinctions came from the human discussion. Codex inspected the current plugin, searched both repositories for duplicates, and helped structure and draft this issue; the human operator requested publication.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions