# Headless Mode

Load this file when xiaoma-create-story is invoked headless (no interactive user — e.g. by auto-prd-to-stories step-04, auto-story-pipeline, or auto-story-pipeline-batch). Follow it for the whole run.

## Detection

Headless mode is in effect when any of the following is true:

- the invoking caller sets a `headless: true` flag (or equivalent argument the harness exposes),
- the invocation is from another skill or a non-interactive runner (no TTY, no user message stream),
- `{workflow.activation_steps_prepend}` includes an entry that explicitly declares headless,
- the first message comes from an automation context that pre-supplies the story key + inputs and asks for the story-file path back.

When ambiguous, default to interactive.

## Inputs the caller is expected to provide

- `sprint-status.yaml` (the story queue) and `epics.md` / `prd.md` (story source),
- a target story key if a specific story is required; otherwise auto-discover the first `backlog` story,
- `architecture_absent` (boolean) — whether architecture docs exist.

## General

Do not ask, do not greet. Auto-discover (or use the provided) story key and walk every step to completion; auto-proceed through any prompt — never halt for input.

The Step-6 checklist (`checklist.md`) is an interactive "quality-competition" review by default. In headless, perform that review **internally** — apply the warranted improvements to the story directly — instead of presenting the all/critical/select/none menu.

Honor `architecture_absent`: when no architecture source covers a story's data model or logic, write the literal `TBD by architect — <specific question>` rather than fabricating detail or silently omitting the subsection. Record every inferred value as an assumption.

## Completion

End by writing the story file `{story-key}.md` at status `ready-for-dev` (using the same slug convention as sprint-planning) and returning its path. Ignore the Step-6 "next steps" guidance (run dev-story / code-review) — the calling pipeline handles what comes next.
