initialPrompt not auto-submitted when using --agent flag

Resolved 💬 3 comments Opened Mar 31, 2026 by kasulani Closed May 27, 2026

Bug Description

initialPrompt in .claude/agents/*.md frontmatter is no longer auto-submitted as the first user turn when starting a session with --agent.

Expected Behavior

Per the sub-agents documentation, initialPrompt should be:

auto-submitted as the first user turn when this agent runs as the main session agent (via --agent or the agent setting). Commands and skills are processed. Prepended to any user-provided prompt.

Actual Behavior

The session opens normally with the agent's system prompt loaded, but the initialPrompt is not sent. The session just sits at the > prompt waiting for manual input.

Steps to Reproduce

  1. Create .claude/agents/my-agent.md:
---
name: my-agent
description: "test agent"
model: inherit
initialPrompt: "Hello, tell me you are ready to begin."
---

You are a helpful assistant.
  1. Run claude --agent my-agent
  2. Observe that the session starts but the initialPrompt is not auto-submitted

Environment

  • Claude Code version: 2.1.88
  • OS: macOS (Darwin 24.5.0, arm64)
  • Shell: zsh

Workaround

Passing the prompt as a positional argument works:

claude --agent my-agent "Hello, tell me you are ready to begin."

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗