Skip to content

fix: split agi-reasoning into hidden-CoT and visible-reasoning agents#185

Merged
Bryan-Roe merged 5 commits into
mainfrom
copilot/fix-reason-prompt-issue
May 9, 2026
Merged

fix: split agi-reasoning into hidden-CoT and visible-reasoning agents#185
Bryan-Roe merged 5 commits into
mainfrom
copilot/fix-reason-prompt-issue

Conversation

Copilot AI commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

reason.prompt.md promised visible chain-of-thought output but was wired to agi-reasoning, which explicitly suppresses CoT in responses. This caused incorrect tool routing and misleading documentation.

Changes

New agent: visible-reasoning

  • .github/agents/visible-reasoning.agent.md — agent whose outputs always expose reasoning steps (classify → decompose → execute → reflect → synthesize), with confidence scores and a self-check table shown in the response

Updated prompt wiring

  • .github/prompts/reason.prompt.mdagent: agi-reasoningagent: visible-reasoning; description updated to state CoT is visible

Cross-references added

  • .github/agents/agi-reasoning.agent.md — appended "Difference from visible-reasoning" section so users know when to use which agent
  • .github/copilot-instructions.md — split the single agi-reasoning table row into two distinct entries; updated reason.prompt.md description in the prompts list
Agent CoT visibility Best for
agi-reasoning Internal only Autonomous execution, concise answers
visible-reasoning Shown in response Explanation, decisions, tutoring

Summary by Sourcery

Introduce a dedicated visible reasoning agent and update prompts and docs to distinguish it from the hidden chain-of-thought AGI reasoning agent.

New Features:

  • Add a visible-reasoning agent that exposes step-by-step chain-of-thought reasoning in responses.

Enhancements:

  • Wire reason.prompt.md to use the new visible-reasoning agent and clarify that it shows explicit chain-of-thought in outputs.
  • Document the behavioral difference between agi-reasoning and visible-reasoning in the AGI agent spec.

Documentation:

  • Update Copilot instructions to list both agi-reasoning and visible-reasoning agents with clarified CoT visibility and adjust the reason.prompt.md description accordingly.

…eating visible-reasoning agent

Agent-Logs-Url: https://github.com/Bryan-Roe/Aria/sessions/5192c609-b7f9-4805-9fff-b3e278367040

Co-authored-by: Bryan-Roe <74067792+Bryan-Roe@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot April 30, 2026 16:35
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Apr 30, 2026
Copilot AI changed the title [WIP] Fix inconsistency in reason.prompt.md for chain-of-thought exposure fix: split agi-reasoning into hidden-CoT and visible-reasoning agents Apr 30, 2026
Copilot AI requested a review from Bryan-Roe April 30, 2026 16:36
@github-actions

github-actions Bot commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

🔴 Coverage — a34cddb

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

Updated on every push · 2026-05-09

@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


## Workspace Context

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

@bryan-roe-bot bryan-roe-bot Bot Apr 30, 2026

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.

Possibly found usage of AI: OpenAI

🧹 Fixed in commit 7f5acb1 🧹

@Bryan-Roe Bryan-Roe marked this pull request as ready for review April 30, 2026 18:09
Copilot AI review requested due to automatic review settings April 30, 2026 18:09
@sourcery-ai

sourcery-ai Bot commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Introduces a new visible-reasoning agent that exposes chain-of-thought in responses, rewires the reason.prompt.md to use it instead of agi-reasoning, and updates documentation to clearly distinguish between hidden and visible reasoning behaviors for correct tool selection.

Flow diagram for selecting agi-reasoning vs visible-reasoning agent

flowchart TD
  start([User request])
  intent{User wants visible step-by-step<br/>reasoning or CoT?}

  start --> intent

  intent -->|Yes, show reasoning| visible_agent
  intent -->|No, concise final answer| agi_agent

  visible_agent["Use visible-reasoning.agent.md<br/>via reason.prompt.md"]
  agi_agent["Use agi-reasoning.agent.md<br/>via agi.prompt.md or other autonomous flows"]

  visible_agent --> visible_output["Response includes explicit chain-of-thought,<br/>classification, decomposition, reflection table"]
  agi_agent --> agi_output["Response hides chain-of-thought,<br/>only final answer shown"]
Loading

File-Level Changes

Change Details Files
Add a dedicated visible-reasoning agent whose chain-of-thought and reasoning steps are always shown in responses.
  • Create visible-reasoning agent definition with tools, purpose, and behavior emphasizing transparent reasoning.
  • Define a structured reasoning framework (analyze, decompose, execute, reflect, synthesize) with explicit confidence scores, verification table, and visible intermediate steps.
  • Document trigger phrases and usage examples to guide correct invocation when users request step-by-step explanations.
.github/agents/visible-reasoning.agent.md
Rewire the Reason prompt to use the visible-reasoning agent and clarify that CoT is visible to the user.
  • Update prompt description to state that each reasoning step and chain-of-thought are explicitly shown in the response.
  • Change the associated agent from agi-reasoning to visible-reasoning to align behavior with documentation.
.github/prompts/reason.prompt.md
Clarify the role of agi-reasoning and distinguish it from the new visible-reasoning agent in documentation.
  • Add a "Difference from visible-reasoning" section describing that agi-reasoning keeps chain-of-thought internal and when to prefer the visible agent.
  • Refine the agi-reasoning description in the agent list to emphasize hidden internal CoT and autonomous execution.
.github/agents/agi-reasoning.agent.md
.github/copilot-instructions.md
Update Copilot instructions to document both reasoning agents and the behavior of the Reason prompt.
  • Split the single agi-reasoning table entry into two separate entries for hidden vs visible reasoning agents with clear CoT visibility descriptions.
  • Update the reason.prompt.md description in the prompts list to highlight visible step-by-step reasoning and that it uses the visible-reasoning agent.
.github/copilot-instructions.md

Assessment against linked issues

Issue Objective Addressed Explanation
#184 Ensure reason.prompt.md is consistent with actual agent behavior by wiring it to an agent that exposes visible chain-of-thought reasoning and updating its description accordingly.
#184 Update related agent and Copilot documentation so the distinction between hidden chain-of-thought (agi-reasoning) and visible chain-of-thought (visible-reasoning) is clear, avoiding misleading tool routing.

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

@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 visible-reasoning and agi-reasoning agent specs now duplicate the “difference between agents” section; consider centralizing this comparison (e.g., in copilot-instructions.md only) and keeping the agent files narrowly focused on behavior to avoid divergence over time.
  • The visible-reasoning agent enforces fully visible chain-of-thought for every non-trivial request; if you anticipate using this in contexts with stricter CoT redaction requirements, consider adding a short preamble about when it should not expose reasoning (e.g., sensitive or policy-limited scenarios).
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The visible-reasoning and agi-reasoning agent specs now duplicate the “difference between agents” section; consider centralizing this comparison (e.g., in copilot-instructions.md only) and keeping the agent files narrowly focused on behavior to avoid divergence over time.
- The visible-reasoning agent enforces fully visible chain-of-thought for every non-trivial request; if you anticipate using this in contexts with stricter CoT redaction requirements, consider adding a short preamble about when it should not expose reasoning (e.g., sensitive or policy-limited scenarios).

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.

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

Aligns the repo’s “Reason” prompt with the intended reasoning-visibility behavior by introducing a dedicated visible-reasoning agent and updating documentation cross-references so the correct agent is selected for step-by-step explanations.

Changes:

  • Added a new .github/agents/visible-reasoning.agent.md that explicitly outputs step-by-step reasoning.
  • Rewired .github/prompts/reason.prompt.md to use agent: visible-reasoning and updated its description to match.
  • Updated .github/agents/agi-reasoning.agent.md and .github/copilot-instructions.md to clarify the distinction between hidden vs visible reasoning agents.

Reviewed changes

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

File Description
.github/prompts/reason.prompt.md Switches the Reason prompt to route to visible-reasoning and updates the prompt description accordingly.
.github/copilot-instructions.md Documents the split between hidden-CoT and visible-CoT agents and updates the prompts list entry for reason.prompt.md.
.github/agents/visible-reasoning.agent.md Introduces the new visible reasoning agent definition and output framework.
.github/agents/agi-reasoning.agent.md Adds a cross-reference section clarifying when to use visible-reasoning instead.

Comment on lines +98 to +102
- **Provider chain**: Azure OpenAI → OpenAI → LMStudio → LoRA → Local
- **Config precedence**: YAML base < CLI flags < per-job YAML < env vars
- **Data immutability**: Read-only `datasets/`, write-only `data_out/`
- **Testing**: `python scripts/test_runner.py --unit` before committing
- **Safety**: `--dry-run` all orchestrators before execution

Copilot AI Apr 30, 2026

Copy link

Choose a reason for hiding this comment

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

The “Provider chain” listed here (Azure OpenAI → OpenAI → LMStudio → LoRA → Local) doesn’t match the actual provider auto-detection priority used by detect_provider() (LM Studio → Ollama → AGI/Quantum → Azure → OpenAI → Local, with LoRA only when explicitly selected). Please update this bullet to reflect the real order so the agent doesn’t give users incorrect operational guidance.

Copilot uses AI. Check for mistakes.
Comment on lines +26 to +30
You are a structured reasoning agent whose primary purpose is to **show your reasoning process transparently** to the user. Every reasoning step must appear in the response — chain-of-thought is visible, not hidden.

## Core Principle

Unlike autonomous AGI agents that internalize reasoning, this agent **always shows its work**. Each analysis step, assumption, confidence score, and verification check must appear in the final response so the user can follow, critique, and learn from the reasoning process.

Copilot AI Apr 30, 2026

Copy link

Choose a reason for hiding this comment

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

This agent instructs that “every reasoning step must appear in the response” and to show intermediate reasoning/results. Without an explicit redaction rule, this can cause accidental leakage of secrets (API keys, tokens), private prompt text, or sensitive tool outputs when reasoning about repository configuration. Consider adding a constraint to keep reasoning high-level when needed and to never include secrets or internal/system prompt content verbatim.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

@copilot apply changes based on this feedback

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6350a103bd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/prompts/reason.prompt.md Outdated
name: "Reason"
argument-hint: "Problem or question to analyze (example: decision + relevant context + constraints or trade-offs)"
agent: agi-reasoning
agent: visible-reasoning

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep notebook-capable agent for /reason workflows

Switching reason.prompt.md to visible-reasoning removes notebook execution/read capabilities that were available through agi-reasoning (execute/runNotebookCell, read/getNotebookSummary, read/readNotebookCellOutput are not in the new agent’s tools list). As a result, /reason requests that need to inspect or run .ipynb cells can no longer complete end-to-end, which is a functional regression from the previous routing.

Useful? React with 👍 / 👎.

@Bryan-Roe

Copy link
Copy Markdown
Owner

@copilot resolve the merge conflicts in this pull request

Copilot AI and others added 2 commits May 9, 2026 05:51
- Merge origin/main into branch (visible-reasoning.agent.md, reason.prompt.md, copilot-instructions.md)
- Fix provider chain order to match detect_provider() priority: LM Studio → Ollama → AGI → Quantum → Azure → OpenAI → Local
- Add Security Constraints section to visible-reasoning.agent.md to prevent accidental leakage of secrets/internal prompts in visible reasoning output

Co-authored-by: Bryan-Roe <74067792+Bryan-Roe@users.noreply.github.com>

Copilot AI commented May 9, 2026

Copy link
Copy Markdown
Contributor Author

@copilot resolve the merge conflicts in this pull request

Merge conflicts resolved in commit 7f5acb17. The three conflicting files (visible-reasoning.agent.md, reason.prompt.md, copilot-instructions.md) have been merged with origin/main. I also addressed the two code-review issues in the same commit:

  • Fixed the provider chain order to match detect_provider() (LM Studio → Ollama → AGI → Quantum → Azure → OpenAI → Local)
  • Added a Security Constraints section to visible-reasoning.agent.md to prevent accidental leakage of credentials or internal prompt text in visible CoT output

Signed-off-by: Bryan <74067792+Bryan-Roe@users.noreply.github.com>
@Bryan-Roe Bryan-Roe merged commit 752e831 into main May 9, 2026
29 of 36 checks passed
@Bryan-Roe Bryan-Roe deleted the copilot/fix-reason-prompt-issue branch May 9, 2026 05:52
@github-actions

github-actions Bot commented May 9, 2026

Copy link
Copy Markdown
Contributor

⚠️ Deprecation Warning: The deny-licenses option is deprecated for possible removal in the next major release. For more information, see issue 997.

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

Comment thread .github/prompts/reason.prompt.md Outdated
- Note any remaining uncertainties

**Codebase context:**
- **Provider chain**: LM StudioOllamaAGIQuantumAzure → OpenAI → Local (LoRA only when `provider=lora`)

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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fc61153545

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

## Workspace Context

- **Provider chain**: Azure OpenAIOpenAILMStudioLoRA → Local
- **Provider chain**: LM StudioOllamaAGIQuantumAzure → OpenAI → Local (LoRA only when `provider=lora`)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Align provider chain with detect_provider behavior

The updated provider chain states AGI and Quantum are checked before Azure/OpenAI, but detect_provider() only enters those branches when the user explicitly sets --provider agi or --provider quantum (ai-projects/chat-cli/src/chat_providers.py around lines 1370-1404), and auto mode skips directly from LM Studio/Ollama to Azure/OpenAI/local (1498-1549). This mismatch can cause the visible reasoning agent to give incorrect troubleshooting or routing advice for default /reason runs because it describes an auto-fallback order that does not exist.

Useful? React with 👍 / 👎.

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

3 participants