---
name: capture-answer
description: "Ingests an expert's answers to an L2 questionnaire in the abap_wiki knowledge base: transforms the answers (filled in the interviews/ file or given verbally) into a canonical citable expert-answer (slices/<id>/inputs/expert-answers/), moves gaps to 'answered' and closes the questions. Use this skill when the owner/expert has answered the functional questions generated by research-l2."
---

# Capture-answer - ingesting expert answers

The expert's answers close the residual load-bearing gaps that auto-research could not
verify. They become **canonical expert-answers** (`slices/<id>/inputs/expert-answers/`),
citable with cite-back in the functional sections; if they contradict the code they are marked
`[ANOMALY]` (the `raw/` source is never touched).

## Procedure

1. **Collect the answers.** The expert has filled in the **Expert answer** blocks in the
   file `slices/<id>/interviews/<date>-<slice>-<dest>.md`, or has answered verbally.
   For each answer, identify the `gap_id` it refers to (these appear in the title of each
   questionnaire question, e.g. `example-slice-g003`).

2. **Build the YAML payload** `output/l2/<slice-id>/answers-<date>.yaml`:
   ```yaml
   expert: user@example.com
   scope: "Trigger and purpose of the custom process"
   kind: clarification          # clarification | confirmation | correction | sign-off
   answers:
     - gaps: [example-slice-g001]
       text: |
         The program ZPROGRAM_BATCH feeds a business data flow used by the
         custom process for daily operational checks.
     - gaps: [example-slice-g003]
       text: |
         Launched by the batch job ZEXAMPLE_JOB_DAILY via an external scheduler,
         with an example technical schedule and variant.
     - gaps: [example-slice-g007]
       anomaly: true            # the answer contradicts the code: mark [ANOMALY]
       text: |
         The flag ZZSTATUS='X' should exclude returns, but the code includes it: known bug.
   ```
   A single `text` can answer multiple related gaps (`gaps: [g1, g2]`).

3. **Ingest:**
   ```
   .venv/Scripts/python core/src/tools/pipeline.py capture-answer --slice <slice-id> --file output/l2/<slice-id>/answers-<date>.yaml
   ```
   Creates `slices/<id>/inputs/expert-answers/<date>-<slug>.md`, moves the gaps to `answered`
   (with `resolution_ref` pointing to the expert-answer), closes the `questions` and records the evidence
   (`source: expert`). Regenerates `gaps.yaml`.

4. **Verify and commit** (manual - committing the answers is the user's responsibility):
   ```
   .venv/Scripts/python core/src/tools/pipeline.py l2-progress --slice <slice-id>
   .venv/Scripts/python core/src/tools/lint_wiki.py
   git add slices/<slice-id> state/ && git commit -m "L2 <slice-id>: expert answers"
   ```

When the PURPOSE/TRIGGER gaps are closed `[VERIFIED]`/`answered` and the load-bearing ones are
resolved, the slice is ready for functional synthesis + L2 gate (Phase 4).

## Rules
- Do not invent answers: `capture-answer` ingests ONLY what the expert said.
- `[ANOMALY]` signals a contradiction with the code; it never modifies `raw/`.
- The expert-answer is citable (`[VERIFIED: slices/<id>/inputs/expert-answers/<file>:N-M]`);
  the interview (`interviews/`) is NOT: it contains questions, not evidence.
- No auto-commit: committing is the user's responsibility.
