Skip to content
This repository was archived by the owner on Mar 23, 2026. It is now read-only.
This repository was archived by the owner on Mar 23, 2026. It is now read-only.

Feature request: Add newChat option to agent handoffs and a command to invoke prompt files programmatically #14161

@jonathan-vella

Description

@jonathan-vella

Problem

When building multi-agent workflows with custom agents (.agent.md), handoffs always continue in the same chat session. For long, multi-step workflows this causes real problems:

  1. Context window saturation — By step 5 of a 7-step workflow, the context window is heavily loaded with prior conversation history from steps 1–4. The agent has less effective working memory for the current task.
  2. No clean separation of concerns — Each step produces file-based artifacts that the next agent reads from disk. The in-memory conversation history is redundant and sometimes contradictory (e.g., earlier drafts that were revised).
  3. No way to programmatically start a fresh session — Prompt files (.prompt.md) already encode per-step instructions with the correct agent, model, and tools, but there's no mechanism to invoke them automatically from a handoff or hook.

Real-World Use Case

I maintain azure-agentic-infraops, a multi-agent system with 14 agents spanning a 7-step workflow for Azure infrastructure:

Requirements → Architecture → Design → Governance → IaC Plan → IaC Code → Deploy → As-Built Docs

Each agent writes artifacts to agent-output/{project}/ and the next agent reads them from disk. We have 18 prompt files (/step0-kickoff, /step1-requirements, /step2-architecture, etc.) that perfectly encode each step's agent, model, and instructions. But there's no way to chain them across fresh chat sessions.

By the time we reach Step 5 (IaC Code Generation), the context window has accumulated 4+ prior steps worth of conversation. The code generation agent would perform significantly better with a clean context that only includes its own instructions plus the artifact files on disk.

Proposed Solutions (any of these would work)

Option A: newChat field in handoff schema

Add an optional newChat: boolean field to the handoffs: frontmatter:

handoffs:
  - label: "Step 5: Generate Bicep"
    agent: 06b-Bicep CodeGen
    prompt: "Implement Bicep templates per agent-output/{project}/04-implementation-plan.md"
    send: true
    newChat: true  # ← Opens a new chat session with the target agent

Option B: VS Code command to run a prompt file

Expose a command like copilot.chat.runPrompt that opens a new chat and invokes a specific .prompt.md:

// Could be used from hooks, keybindings, or tasks
{
  "command": "copilot.chat.runPrompt",
  "args": { "prompt": "step5b-bicep-codegen", "newChat": true }
}

This would also enable hooks (e.g., the Stop lifecycle event) to chain to the next step.

Option C: chat.promptFilesRecommendations with agent awareness

The existing chat.promptFilesRecommendations setting shows prompts when starting a new chat, but it could be smarter — surface the most relevant next prompt based on the last active agent. For example, after 05b-Bicep Planner finishes, a new chat could prominently suggest /step5b-bicep-codegen.

Current Workaround

Users must manually:

  1. Open a new chat
  2. Select the correct agent from the picker
  3. Type /step5b-bicep-codegen or paste the handoff prompt

This breaks the flow and is error-prone for non-technical users following the workflow.

Environment

  • VS Code: 1.111.0
  • OS: Linux (dev container) / Windows / macOS
  • Copilot Extension: Latest

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