Skip to content

feat(ai): give the stage and alternatives prompts their project values #5638

Open

Description

@devops-cli-service

Split from #4633.

The issue names stage_change, stage_split, stage_tools_research and alternatives as prompts that get project values through the new Jinja context, but it names no fact for them, and they hold no {{ }} marker today. This follow-up adds the project fact of each prompt and passes it as context, so the prompt takes the fact instead of a Python copy. Why deferred: the loader, the implement step tables and the prompt version can ship without them, and the fact of each prompt is a product decision with no source in the repository. Acceptance criteria: each of the four prompts SHALL take its project fact through a {{ }} context; a test SHALL render each with its real context and raise no UndefinedError; stage_plan_record.prompt_version SHALL cover the new context values.

Proposed design

Problem statement

The prompts stage_change, stage_split, stage_tools_research and alternatives keep project facts in Python copies. They hold no Jinja marker for a project fact. This change gives each prompt the project profile through a {{ project_profile }} context value. The stage plan record prompt version then covers the new context value.

Acceptance criteria

Requirement: Prompt project profile marker

Each of the four prompt templates SHALL hold a {{ project_profile }} marker.

Scenario: Template marker

  • WHEN a test reads the template of stage_change, stage_split, stage_tools_research and alternatives.
  • THEN each template text holds {{ project_profile }}.

Requirement: Real context render

Each of the four prompts SHALL render with its real context and raise no jinja2.UndefinedError.

Scenario: Real context render

  • WHEN a test calls load_task_prompt for stage_change, stage_split, stage_tools_research and alternatives with the project profile context.
  • THEN each call returns text and raises no jinja2.UndefinedError.

Requirement: Context passes the project profile

The stage and alternatives jobs SHALL pass the project profile from the repository into the prompt context.

Scenario: Build the prompt context

  • WHEN a test builds the prompt context for each of the four prompts from a project profile that holds a known value.
  • THEN each context holds that known value under project_profile.

Requirement: Prompt version covers the project profile

The stage plan record prompt version SHALL include the project_profile context value.

Scenario: Change the project profile

  • WHEN a test computes stage_plan_record.prompt_version with two different project_profile values.
  • THEN the two version strings differ.

Existing Tool Considered

No alternatives check has run. The repository already uses Jinja2 in src/devops_cli/ai/task_loader.py. Jinja2 is open, maintained, and covers {{ }} rendering and UndefinedError. Jinja2 lacks the project facts, so the change supplies them from the project profile as project_profile.

Key questions

  • Which project fact SHALL stage_change, stage_split, stage_tools_research and alternatives take from the Jinja context?: Use one context value, project_profile, that holds the project profile as a JSON string. Each of the four prompts gets a {{ project_profile }} marker. The prompt reads the fields it needs. (best practice) [sources: CONTEXT.md, src/devops_cli/ai/task_loader.py, openspec/specs/ai-task-prompts/spec.md]
    • Chosen: Shared project_profile context value. The project profile is the repository record of project facts, and one value gives each prompt the same source without a Python copy.
    • Rejected: One context value for each prompt. It needs four product decisions with no source in the repository and multiplies context keys.
    • Rejected: Keep the Python copy. It keeps the duplication that the issue removes and cannot raise UndefinedError for a missing fact.
  • How does the loader behave when a prompt names a context value that the caller does not supply?: load_task_prompt raises jinja2.UndefinedError. [sources: src/devops_cli/ai/task_loader.py, openspec/specs/ai-task-prompts/spec.md:31]
  • How SHALL stage_plan_record.prompt_version cover the new context values?: Hash the four prompt names and the project_profile value into stage_plan_record.prompt_version. (best practice) [sources: src/devops_cli/roadmap/stage/stage_plan_record.py, src/devops_cli/ai/task_loader.py]
    • Chosen: Include the context value in the version hash. The issue requires the version to cover the new context values, and a hash detects a changed profile.
    • Rejected: Bump a manual version number. A manual bump does not cover the actual context value and can be forgotten.
    • Rejected: Hash the prompt text only. The prompt text does not change when the project profile changes.
  • Where does the project profile come from?: The project profile merges field defaults, the type template in src/devops_cli/templates/profiles/, detection in the repository files, and .devops/project.toml. Each value records its source. [sources: CONTEXT.md]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    type/feature
    scope/ai
    status/new
    value/medium
    effort/medium
    on Nov 14, 2026
  2. devops-cli-service commented on Nov 14, 2026

    @devops-cli-service
    ContributorAuthor
    • Priority: P3-Low. The body states the work is deferred and depends on a product decision with no source in the repository.
    • Related: feat(ai): the prompt loader renders Jinja with project values #4633, which asks for a different change. Both work on Jinja project values in prompts; #4633 builds the loader, the candidate adds project facts to four named prompts.
  3. added
    priority/p3-low
    on Nov 14, 2026
  4. devops-cli-service commented on Nov 20, 2026

    @devops-cli-service
    ContributorAuthor

    Next step: the alternatives check records a verdict. See the section Proposed design of the body.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/mediumpriority/p3-lowscope/aisource/agentstatus/newtype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions