anthropics / anthropics/claude-code
[BUG] Four shipped plugin agents fail YAML frontmatter parsing and load as placeholders or not at all
- 主要言語
- Python
- スター
- 145k
- フォーク
- 23.1k
- PR マージ指標
- PR 指標を取得中
説明
### Preflight Checklist
- [x] I have searched [existing issues](https://github.com/anthropics/claude-code/issues?q=is%3Aissue%20state%3Aopen%20label%3Abug) and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
### What's Wrong?
Four agent files that ship in this repository have frontmatter that Claude Code 2.1.259 cannot parse:
- `plugins/plugin-dev/agents/agent-creator.md`
- `plugins/plugin-dev/agents/plugin-validator.md`
- `plugins/plugin-dev/agents/skill-reviewer.md`
- `plugins/pr-review-toolkit/agents/code-simplifier.md`
Their `description:` value spans several lines, the continuation lines (``, `Context:`, `user:`, ...) are not indented, and the first line ends in `Examples:`. What happens depends on how the file is loaded:
- **As a plugin** (`claude --plugin-dir plugins/plugin-dev`): the debug log says `Failed to parse YAML frontmatter`, and the agent is registered anyway with the placeholder description `Agent from plugin-dev plugin`. The agent roster handed to the model then reads `plugin-dev:agent-creator: Agent from plugin-dev plugin (Tools: All tools)` with none of the triggering examples, so the model has nothing to trigger on.
- **Copied to `.claude/agents/`**: the log says `YAML frontmatter in failed to parse and was ignored`, and the agent is absent from the roster.
The other 11 agent files under `plugins/*/agents/` load, and the model receives their descriptions verbatim.
Three properties of the current shape are each fatal on their own (measured with single-variable mutants of agent-creator.md): a plain value that ends in `:`; continuation lines that are not indented; and `: ` inside indented continuation lines (`Context: ...`). The only forms that survive are block scalars (`description: |-`) or a quoted string.
The same shape is what `plugins/plugin-dev/skills/agent-development/SKILL.md` (Complete Format, Minimal Agent), its examples and references, and agent-creator's own system prompt teach, so agents generated with the plugin inherit the defect. `validate-agent.sh` never parses YAML, so it passes these files; the extractors proposed in #89404 and #76985 also accept the shape.
### What Should Happen?
The four agents load with their full descriptions and `` blocks on both paths. At minimum, a frontmatter parse failure in a shipped plugin agent should be visible without `--debug` instead of silently registering a placeholder.
### Error Messages/Logs
```shell
# .claude/agents/ path (claude -p --debug)
[ERROR] YAML frontmatter in /.claude/agents/agent-creator.md failed to parse and was ignored: YAML Parse error: Unexpected token
[ERROR] YAML frontmatter in /.claude/agents/plugin-validator.md failed to parse and was ignored: YAML Parse error: Unexpected token
[ERROR] YAML frontmatter in /.claude/agents/skill-reviewer.md failed to parse and was ignored: YAML Parse error: Unexpected token
[ERROR] YAML frontmatter in /.claude/agents/code-simplifier.md failed to parse and was ignored: YAML Parse error: Unexpected token
# plugin path (claude -p --debug --plugin-dir plugins/plugin-dev)
[WARN] Failed to parse YAML frontmatter in /plugins/plugin-dev/agents/agent-creator.md: YAML Parse error: Unexpected token
[WARN] Failed to parse YAML frontmatter in /plugins/plugin-dev/agents/plugin-validator.md: YAML Parse error: Unexpected token
[WARN] Failed to parse YAML frontmatter in /plugins/plugin-dev/agents/skill-reviewer.md: YAML Parse error: Unexpected token
```
### Steps to Reproduce
1. Clone the repository and copy the plugin-dev agents into a fresh project:
```bash
git clone --depth 1 https://github.com/anthropics/claude-code
mkdir -p /tmp/agents-probe/.claude/agents
cp claude-code/plugins/plugin-dev/agents/*.md /tmp/agents-probe/.claude/agents/
```
2. Start a one-turn session there with the debug log on:
```bash
cd /tmp/agents-probe
claude -p --debug --debug-file /tmp/loader.log --max-turns 1 "hi" >/dev/null
grep -c 'failed to parse and was ignored' /tmp/loader.log # prints 3
```
3. Repeat on the plugin path from an empty directory:
```bash
mkdir -p /tmp/empty && cd /tmp/empty
claude -p --debug --debug-file /tmp/plug.log --plugin-dir /path/to/claude-code/plugins/plugin-dev --max-turns 1 "List the agent types available to you, verbatim."
grep 'Failed to parse YAML frontmatter' /tmp/plug.log # 3 lines
```
The model's answer lists the three plugin-dev agents with the placeholder text `Agent from plugin-dev plugin` and no examples.
4. Convert one file's description to `description: |-` with every line indented by two spaces and repeat: the log line disappears and the agent's full description reaches the model.
### Claude Model
Other
### Is this a regression?
I don't know
### Last Working Version
_No response_
### Claude Code Version
2.1.259 (Claude Code)
### Platform
Anthropic API
### Operating System
Ubuntu/Debian Linux
### Terminal/Shell
Non-interactive/CI environment
### Additional Information
- The roster observations above were taken from the request body sent to the model (a local stand-in for the API endpoint), not from the model's own account of itself. Interactive mode was not measured; `claude -p` was.
- The bug is in file loading, before any model is called, so the Claude Model field does not apply.
- The fix is on the branch `fix/agent-description-block-scalars` of konsta95/claude-code: [compare view against main](https://github.com/anthropics/claude-code/compare/main...konsta95:fix/agent-description-block-scalars), [commit e830ff6](https://github.com/konsta95/claude-code/commit/e830ff6701cc867bd01ff0b6ae2d406f8ad59704). It converts the four files to `description: |-` (text unchanged), updates the skill docs and agent-creator's template to teach that form, and changes `validate-agent.sh` to reject the three fatal shapes, with a regression test. Pull request creation is restricted to collaborators on this repository, so a maintainer would need to pull the branch.
- Related: #83803 (origin of #89404), #89404, #76985, #85323, #84427, #66416 all change `validate-agent.sh`; none changes the agent files.
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
調査の方向性
Start by inspecting the four listed agent files and the Complete Format and Minimal Agent sections of plugins/plugin-dev/skills/agent-development/SKILL.md, then run the provided copied-agent and plugin-path reproductions. Compare the behavior with the linked fix branch and regression test; done means all four agents load with their full descriptions and example blocks on both paths, with failures no longer hidden as placeholders.
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- markdown, shell, yaml
- 領域
- testing-qa, tooling
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 活発
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 68/100