Skip to content

Add visible-reasoning agent; fix reason.prompt.mdagi-reasoning CoT contradiction#188

Merged
Bryan-Roe merged 2 commits into
mainfrom
copilot/improve-ai
Apr 30, 2026
Merged

Add visible-reasoning agent; fix reason.prompt.mdagi-reasoning CoT contradiction#188
Bryan-Roe merged 2 commits into
mainfrom
copilot/improve-ai

Conversation

Copilot AI commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

reason.prompt.md instructed "show your reasoning at each step" while pointing at agi-reasoning, whose contract explicitly hides chain-of-thought from users. The two were irreconcilably contradictory, causing repeated issues from reviewers and tooling.

Changes

  • New agent — .github/agents/visible-reasoning.agent.md: specialist that surfaces the full reasoning trace (Analyze → Decompose → Execute → Reflect → Confidence → Answer) to the user; includes required Return-to-Agent Contract and a contrast table vs agi-reasoning
  • .github/prompts/reason.prompt.md: switches agent: agi-reasoningagent: visible-reasoning; description updated to reflect exposed CoT behavior
  • .github/copilot-instructions.md: agents table and prompts section now document both agents with their distinct CoT exposure semantics
Agent Chain-of-thought
agi-reasoning Internal only — final answer delivered
visible-reasoning Shown to user — trace + answer

Summary by Sourcery

Introduce a new visible-reasoning agent that exposes chain-of-thought to users and update the reasoning prompt and Copilot documentation to distinguish between hidden and visible reasoning behavior.

New Features:

  • Add a visible-reasoning agent that surfaces step-by-step reasoning, confidence scores, and self-reflection to users.

Enhancements:

  • Retarget the reason.prompt to use the visible-reasoning agent and clarify that it exposes chain-of-thought in its description.
  • Document the differing chain-of-thought exposure semantics for agi-reasoning and visible-reasoning in the Copilot instructions agents and prompts tables.

Copilot AI self-assigned this Apr 30, 2026
Copilot AI review requested due to automatic review settings April 30, 2026 17:03
Copilot AI removed the request for review from Copilot April 30, 2026 17:03
@Bryan-Roe Bryan-Roe marked this pull request as ready for review April 30, 2026 17:03
@Bryan-Roe Bryan-Roe self-requested a review as a code owner April 30, 2026 17:03
@Bryan-Roe Bryan-Roe requested review from Copilot and removed request for Bryan-Roe April 30, 2026 17:03
@Bryan-Roe Bryan-Roe merged commit 587033c into main Apr 30, 2026
30 of 41 checks passed
@sourcery-ai

sourcery-ai Bot commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Introduces a new visible-reasoning specialist agent that explicitly exposes its step-by-step chain-of-thought to users, retargets the reasoning prompt to this agent, and updates Copilot documentation to clarify and contrast the chain-of-thought behavior between agi-reasoning (internal CoT) and visible-reasoning (visible CoT).

Sequence diagram for visible-reasoning agent interaction and handoff

sequenceDiagram
  actor User
  participant Copilot
  participant ReasonPrompt
  participant VisibleAgent as visible-reasoning
  participant PrimaryAgent as agent

  User->>Copilot: Request with trigger (show your reasoning)
  Copilot->>ReasonPrompt: Select reason.prompt.md
  ReasonPrompt-->>Copilot: Metadata (agent_ref = visible-reasoning)
  Copilot->>VisibleAgent: Invoke with task and context

  VisibleAgent->>VisibleAgent: Analyze
  VisibleAgent->>VisibleAgent: Decompose into subtasks
  VisibleAgent->>VisibleAgent: Execute subtasks with visible trace
  VisibleAgent->>VisibleAgent: Reflect and compute confidence

  VisibleAgent-->>User: Reasoning trace + final answer

  VisibleAgent->>PrimaryAgent: Handoff(reasoningTrace, decision, assumptions, risks, nextAction)
  PrimaryAgent-->>Copilot: Acknowledgement and follow-up actions
  Copilot-->>User: Any subsequent results from primary agent
Loading

Class diagram for reasoning prompts and agents with CoT exposure

classDiagram
  class ReasonPrompt {
    +string name
    +string description
    +string argument_hint
    +string agent_ref
    +applyFramework(task)
  }

  class AgiPrompt {
    +string name
    +string description
    +string argument_hint
    +string agent_ref
    +applyFramework(task)
  }

  class VisibleReasoningAgent {
    +string name
    +string description
    +string[] tools
    +bool chainOfThoughtVisible
    +respond(task)
    +analyze(task)
    +decompose(task)
    +executeSubtasks(task)
    +reflect()
    +computeConfidence()
    +handoffToPrimaryAgent(primaryAgent, reasoningTrace, decision, assumptions, risks, nextAction)
  }

  class AgiReasoningAgent {
    +string name
    +string description
    +string[] tools
    +bool chainOfThoughtVisible
    +respond(task)
    +internalAnalyze(task)
    +internalDecompose(task)
    +internalExecute(task)
    +internalReflect()
    +internalConfidence()
  }

  class PrimaryAgent {
    +string name
    +string description
    +string[] tools
    +respond(task)
    +continueFromReasoningTrace(reasoningTrace, decision, assumptions, risks, nextAction)
  }

  ReasonPrompt --> VisibleReasoningAgent : uses
  AgiPrompt --> AgiReasoningAgent : uses
  VisibleReasoningAgent --> PrimaryAgent : returns_control_to

  VisibleReasoningAgent : chainOfThoughtVisible = true
  AgiReasoningAgent : chainOfThoughtVisible = false
Loading

File-Level Changes

Change Details Files
Add a visible-reasoning specialist agent that exposes its reasoning trace to users.
  • Create a new visible-reasoning.agent.md defining a transparent reasoning agent that shows analysis, decomposition, execution, reflection, and confidence to users.
  • Specify tools and workspace context available to the visible-reasoning agent, including execution, search, web, and task management capabilities.
  • Define a strict response structure (Reasoning trace + Answer), self-reflection protocol, and an explicit contrast table vs agi-reasoning, including a return-to-agent handoff contract.
.github/agents/visible-reasoning.agent.md
Retarget the Reason prompt to the visible-reasoning agent and clarify its visible chain-of-thought semantics.
  • Update the Reason prompt description to emphasize visible chain-of-thought, task decomposition, self-reflection, and when to use it (when users want to see the reasoning process).
  • Switch the Reason prompt configuration from using the agi-reasoning agent to the visible-reasoning agent.
.github/prompts/reason.prompt.md
Update Copilot instructions to document both reasoning agents and their distinct chain-of-thought exposure behavior.
  • Clarify in the agents table that agi-reasoning uses internal chain-of-thought and only returns the final answer.
  • Add visible-reasoning to the agents table with a description that it shows step-by-step reasoning and CoT trace to users.
  • Update the prompts section to describe reason.prompt.md as using visible-reasoning and exposing chain-of-thought, confidence, and self-reflection to the user.
.github/copilot-instructions.md

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Apr 30, 2026

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • The Return-to-Agent Contract refers to handing back to agent as the primary agent, but the agents table lists ai.agent.md as the primary autonomous agent, so it would help to clarify or align the naming to avoid confusion about which agent should receive the handoff.
  • The visible reasoning template forces a full multi-section trace on every invocation; consider documenting a brief or collapsed mode (e.g., when explicitly requested) so the agent can adapt verbosity to user preference while still honoring the ‘visible reasoning’ semantics.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The Return-to-Agent Contract refers to handing back to `agent` as the primary agent, but the agents table lists `ai.agent.md` as the primary autonomous agent, so it would help to clarify or align the naming to avoid confusion about which agent should receive the handoff.
- The visible reasoning template forces a full multi-section trace on every invocation; consider documenting a brief or collapsed mode (e.g., when explicitly requested) so the agent can adapt verbosity to user preference while still honoring the ‘visible reasoning’ semantics.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@github-actions

Copy link
Copy Markdown
Contributor

🔴 Coverage — dd6d273

Metric Value
Total coverage 59.6%
→ vs main 0.0%
Minimum threshold 60%

Updated on every push · 2026-04-30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR resolves a documentation/behavior mismatch in the repo’s prompt/agent setup by introducing a new visible-reasoning agent and updating reason.prompt.md to target it, so “show your reasoning” prompts no longer point at an agent intended for hidden/internal reasoning.

Changes:

  • Added a new .github/agents/visible-reasoning.agent.md describing a reasoning mode intended to surface step-by-step reasoning output.
  • Updated .github/prompts/reason.prompt.md to use agent: visible-reasoning and adjusted its description accordingly.
  • Updated .github/copilot-instructions.md to document both reasoning agents and clarify which prompts use which agent.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
.github/prompts/reason.prompt.md Switches the prompt to the new visible-reasoning agent and updates prompt metadata text.
.github/copilot-instructions.md Updates the agents/prompt documentation to distinguish internal vs visible reasoning modes.
.github/agents/visible-reasoning.agent.md Introduces the new agent definition and response format for visible reasoning.

@@ -1,8 +1,8 @@
---
description: "Reason through a problem using chain-of-thought analysis, task decomposition, and self-reflection. Produces structured reasoning with confidence scores and verification steps."
description: "Reason through a problem with visible chain-of-thought analysis, task decomposition, and self-reflection. Shows reasoning steps to the user, including confidence scores and verification. Use when the user wants to see the reasoning process, not just the final answer."

## Workspace Context

- **Provider chain**: Azure OpenAI → OpenAI → LMStudio → LoRA → Local
Comment on lines +29 to +30
You are a transparent reasoning agent. Your primary goal is to **show your work**: every analysis step, assumption, confidence score, and self-correction must be visible to the user. This is the opposite of the `agi-reasoning` agent, which hides its chain-of-thought.

| `ai.agent.md` | Primary autonomous agent — task decomposition, multi-step execution |
| `my-agent.agent.md` | QAI specialist — quantum-AI/ML development |
| `agi-reasoning.agent.md` | Chain-of-thought reasoning, self-reflection |
| `agi-reasoning.agent.md` | Chain-of-thought reasoning, self-reflection (CoT is internal, final answer only) |

## Workspace Context

- **Provider chain**: Azure OpenAI → OpenAI → LMStudio → LoRA → Local

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Semgrep identified an issue in your code:
Possibly found usage of AI: OpenAI

To resolve this comment:

🔧 No guidance has been designated for this issue. Fix according to your organization's approved methods.

💬 Ignore this finding

Reply with Semgrep commands to ignore this finding.

  • /fp <comment> for false positive
  • /ar <comment> for acceptable risk
  • /other <comment> for all other reasons

Alternatively, triage in Semgrep AppSec Platform to ignore the finding created by detect-generic-ai-oai.

You can view more details about this finding in the Semgrep AppSec Platform.

@bryan-roe-bot

bryan-roe-bot Bot commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

Semgrep found 1 detect-generic-ai-oai finding:

  • .github/agents/visible-reasoning.agent.md

Possibly found usage of AI: OpenAI

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

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants