## Backlog Context (pre-injected by WXP)
**Idea:**
**Timestamp:**
**State:**
**Roadmap Analysis:**
---
Park an idea as a backlog entry (999.x numbered phase) in ROADMAP.md. Zero friction — one command captures an idea without interrupting current work. The idea sits in the backlog until promoted by `/gsd-review-backlog`.
Check that `.planning/ROADMAP.md` exists (from `state` JSON field `roadmap_exists`).
**If roadmap missing:**
```
Error: No ROADMAP.md found. Run /gsd-new-project or /gsd-new-milestone first.
```
Exit.
**If idea is empty (no $ARGUMENTS):**
Ask the user: "What's the idea? (one sentence description)"
Use the response as `idea`.
From the roadmap analysis JSON, extract the `phases` array. Find all phases where `phase_number` starts with `999` (e.g., `999.1`, `999.2`).
Compute next backlog number:
- If no 999.x entries exist → use `999.1`
- Otherwise → use `999.(max_decimal + 1)`, e.g., if `999.3` exists → `999.4`
Set `BACKLOG_NUM` = next available 999.x slot.
Append to `.planning/ROADMAP.md` under a `## Backlog` section (create the section if missing):
```markdown
- [ ] **Phase {BACKLOG_NUM}**: {idea}
```
Use the roadmap `roadmap add-phase` command if available, or append directly:
```bash
pi-gsd-tools roadmap add-phase "{BACKLOG_NUM}" "{idea}" --raw
```
If the CLI command fails or is unavailable, append manually to ROADMAP.md.
```bash
pi-gsd-tools commit "docs: add backlog entry {BACKLOG_NUM} - {idea_slug}" --files .planning/ROADMAP.md
```
```
✓ Backlog entry added
Phase {BACKLOG_NUM}: {idea}
---
Review and promote backlog: /gsd-review-backlog
```
- [ ] ROADMAP.md has new 999.x entry
- [ ] 999.x number is sequential (no gaps or duplicates)
- [ ] Entry committed to git
- [ ] User sees confirmation with the assigned phase number