# Phase 1 — Ingest Project Resources & Map Evidence

INPUT: `$ARGUMENTS` MUST be one project slug plus an optional output language (`es` or `en`). OUTPUT: an evidence map built from all `ready` resource records in `docs/inputs/<project-slug>/index.json`, plus the resolved output language. Do NOT draft the proposal yet.

Run the following:

```
1. Resolve the project slug and output language:
   - `$ARGUMENTS` MUST contain one kebab-case project slug, optionally followed by `es` or `en`.
   - If missing or invalid, STOP with `⚠️ NEEDS INPUT: indica el project slug, por ejemplo /machine-business:business-proposal acme-demo`.
   - If more than two arguments are present, STOP with `⚠️ NEEDS INPUT: use /machine-business:business-proposal <project-slug> plus at most one optional language code`.
   - If a second argument is present and is not exactly `es` or `en`, STOP with `⚠️ NEEDS INPUT: language must be es or en`.
   - If the language argument is present, it wins.
   - If no language argument is present but the current user request clearly asks for a specific output language, use that language.
   - If no language is explicit, use the language the user is speaking in the current request.
   - If ambiguous, default to `es`.

2. Resolve the index:
   - Path: `docs/inputs/<project-slug>/index.json`.
   - If missing, unreadable, empty, or invalid JSON -> STOP with `⚠️ NEEDS INPUT`.
   - `project` MUST equal `<project-slug>`.
   - `inputs` MUST be an array.

3. Select source resources:
   - Include only entries in `inputs[]` with `status: ready`.
   - Preserve `inputs[]` order.
   - For each ready entry, read `md` relative to `docs/inputs/<project-slug>/`.
   - If any ready entry has a missing/unreadable/empty `md`, STOP with `⚠️ NEEDS INPUT` and list the broken `src`/`md`.
   - Ignore `failed` and `ignored` entries.

4. Note the output path:
   - Proposal output will be `docs/business/<project-slug>/proposal.md`.
   - If it already exists, note the collision for Phase 3. Do not resolve it yet.

5. Detect the source language only for evidence handling. The proposal itself is written in the resolved output language.

6. Build the EVIDENCE MAP:
   - For each required section, extract short paraphrases or brief quotes from the ready resource records.
   - Attribute evidence with resource paths or resource slugs.
   - Where the input is silent, record GAP. Phase 2 covers it with a conservative inference in clean prose or omits it.

RULES:
- This phase only reads and organizes. It does NOT write the proposal and does NOT invent content.
- Quote/paraphrase faithfully; do not editorialize in the map.
- A GAP is normal and expected. Flag it; do not silently fill it here.
- Do not read raw audio files in this phase.
- Do not write any file in this phase.
```

Sections to map against (canonical titles by output language live in Phase 2):

0. **Project subtitle** — `<solution or initiative> — <client/brand>`.
1. **Target market & ideal client** — sector, company size, geography if known, needs.
2. **Problem definition** — business needs and end-client/user needs.
3. **Key solution components** — main features, workflows, technical considerations.
4. **Project execution approach** — methodology, work organization, delivery model, checkpoints, communication, quality, risks, dependencies.
5. **Key success factors** — 2-4 client/project conditions required for success.
6. **Discovery estimate / internal sales note** — a single positive integer of Discovery hours (the rest is template boilerplate).

OUTPUT FORMAT — present the map as a table:

| # | Component | Evidence from ready resources | Gap? |
|---|-----------|-------------------------------|------|
| 0 | Project subtitle | `memo-inicial`: "..." | covered |
| 1 | Target market & ideal client | `notas-cliente`: "..." (paraphrase) | partial — size not stated |
| 2 | Problem definition | `memo-inicial`: "..." | covered |
| 3 | Key solution components | `sesion-2`: "..." | covered |
| 4 | Project execution approach | — | GAP — resolve in Phase 2 |
| 5 | Key success factors | `notas-cliente`: "..." | partial |
| 6 | Discovery estimate | — | Phase 2 supplies the integer |

Source language: `<source-lang>` · Output language: `<es|en>` · Project slug: `<project-slug>` · Ready resources: `<N>` · Proposal will be `docs/business/<project-slug>/proposal.md`

ADVANCE: continue straight to Phase 2 without asking for approval. Show the evidence map for transparency, then start drafting.

STOP only if the project slug, index, or ready resource records are missing/invalid.
