# Headless Mode

Load this file when xiaoma-create-architecture is invoked headless (no interactive user — e.g. by an auto-\* pipeline such as auto-requirements-pipeline step-07 or auto-full-pipeline). 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 inputs and asks for the architecture artifact path back.

When ambiguous, default to interactive.

## Inputs the caller is expected to provide

The caller passes inputs in their first message (free-form; every field below should be present when applicable):

- the `prd.md` path (or a workspace containing one) — the primary input,
- `epics.md` if epics drive the architecture scope,
- `current-architecture-analysis.md` if a brownfield / existing-codebase analysis exists,
- the output location if a specific run folder is required (otherwise bind the default `{planning_artifacts}`).

Anything not provided is inferred from the inputs/workspace or recorded as an assumption — do not invent technology choices, scale targets, or scope decisions to fill gaps; record them.

## General

Do not ask, do not greet. Complete every step using what is provided, what exists in the workspace, or what you can discover yourself. Walk all step files in order to completion; at every `[C] Continue` / approval / menu prompt, auto-select the proceed/continue option and keep going — never halt for input. The `[A] Advanced Elicitation` / `[P] Party Mode` menu options are skipped in headless (auto-select `[C]`).

Record every value you inferred without caller confirmation as an assumption inside the architecture document (or its decision log), and every gap that needs a human decision as an explicit open question — rather than fabricating a confident answer.

## Mode-specific overrides

- **Stale artifact.** If a prior `architecture.md` already exists for this workspace, auto-select the "Start over" / overwrite option (do not prompt) and regenerate from the current PRD + epics.
- **Greenfield input.** If no `current-architecture-analysis.md` exists (greenfield), design from the PRD + epics from scratch; do not block on the absence of an existing-codebase analysis.
- **Completion.** End by writing `architecture.md` to the output location and returning its path. If a required input was missing and could not be inferred, still produce the best-effort artifact and mark the unresolved gaps as open questions rather than halting.
