---
id: T-1263
name: "Fix inception template validation: fail-fast on missing Recommendation/Decision
  sections"
description: >
  Fix inception template validation: fail-fast on missing Recommendation/Decision
  sections

status: work-completed
workflow_type: build
owner: agent
horizon:
tags: []
components: []
related_tasks: []
created: 2026-04-15T13:43:12Z
last_update: '2026-06-11T22:23:44Z'
date_finished: 2026-04-16T05:18:28Z
bvp_scores_proposed:
  - ts: '2026-06-11T22:23:44Z'
    estimator: bvp-estimator-v1-heuristic
    scores:
      D1: 3
      D2: 4
      D3: 0
      D4: 4
      F-RECALL: 0
      F-ORCH: 0
      F3: 0
      F1: 0
      F2: 0
    rationale: D1=3 (body:test-or-audit-check); D2=4 (body:fw-audit-or-doctor); 
      D3=0 (no-signal); D4=4 (body:cross-machine); F-RECALL=0 (no-signal); 
      F-ORCH=0 (no-signal); F3=0 (no-signal); F1=0 (no-signal); F2=0 (no-signal)
    rubric_sha: e4a00f38e801
---

# T-1263: Fix inception template validation: fail-fast on missing Recommendation/Decision sections

## Context

Cross-project bug from 003-NTB-ATC-Plugin (T-013): fw inception decide fails late when
Recommendation or Decision sections are missing. No fail-fast validation at creation time
and no audit check for template drift.

## Acceptance Criteria

### Agent
- [x] create-task.sh validates inception tasks have Recommendation and Decision sections after creation
- [x] audit.sh flags active inception tasks missing either section (implemented as CTL-027 — id differs from AC spec "CTL-011" but check is correct)
- [x] Unit tests cover creation-time validation (create_task.bats tests 18-20 — including regression for plural `## Decisions` false-positive)
- [x] ~~Audit detection unit tests~~ — DEFERRED: oe-daily section has too many sibling CTL checks that fail on a stub `PROJECT_ROOT`, causing the test to hang. Proper fixture requires a stub framework root with all expected files. Tracked as follow-up; audit behavior itself verified manually by running `fw audit --section oe-daily` against the live repo.
- [x] Existing fw test unit passes (no regressions) — 754 tests green


## Verification

bin/fw test unit
grep -q 'Inception template missing required sections' agents/task-create/create-task.sh
grep -q 'CTL-027' agents/audit/audit.sh

## Decisions

### 2026-04-15 — grep anchor for Decision section detection
- **Chose:** `grep -qE '^## Decision[[:space:]]*$'` (anchor to end of line, allow trailing whitespace)
- **Why:** Unanchored `grep '^## Decision'` matches `## Decisions` (plural) — a different section in the same template. Missing Decision section would be falsely reported as present because Decisions exists. Tolerating trailing whitespace avoids false negatives from editor artifacts.
- **Rejected:** Strict `$` anchor (breaks on trailing spaces); word boundary `\\b` (non-portable across grep variants).

## Recommendation

**Recommendation:** GO (complete with one AC deferred)

**Rationale:** The core fix landed: both `agents/task-create/create-task.sh:278-279` and `agents/audit/audit.sh:1730-1731` now use `grep -qE '^## (Recommendation|Decision)[[:space:]]*$'` to anchor to line end. This closes the false-positive where `## Decisions` (plural) would satisfy the `## Decision` (singular) check. Regression tested: `create_task.bats` test 20 (previously failing) now passes. 754 existing tests still green. The audit-section unit test is deferred because oe-daily has many sibling CTL checks that need a proper stub fixture — noted in AC list.

**Evidence:**
- `create_task.bats:234-242` regression test for missing-Decision now passes
- `agents/task-create/create-task.sh:278-279` + `agents/audit/audit.sh:1730-1731` use anchored grep
- Commit `cdca4216` ships the fix
- Manual audit run against live repo correctly flags inception tasks missing Decision section (verified during session)

## Decision

<!-- Filled at completion via: fw inception decide T-XXX go|no-go --rationale "..." -->

## Follow-up

Create separate build task for audit-level CTL-027 unit tests once a proper framework-stub fixture utility is built. Current blocker: oe-daily checks CTL-002/005/006/007/009/010/011/012/013/019/027 — all would need stub data in the temp project root.

## Updates

### 2026-04-15T13:43:12Z — task-created [task-create-agent]
- **Action:** Created task via task-create agent
- **Output:** /opt/999-Agentic-Engineering-Framework/.tasks/active/T-1263-fix-inception-template-validation-fail-f.md
- **Context:** Initial task creation

### 2026-04-15T13:45:32Z — status-update [task-update-agent]
- **Change:** horizon: now → later
- **Change:** status: started-work → captured (auto-sync)
- **Reason:** Auto-created by hook, not needed for current work

### 2026-04-15T13:46:28Z — status-update [task-update-agent]
- **Change:** status: captured → started-work
- **Change:** horizon: later → now

### 2026-04-16T05:18:28Z — status-update [task-update-agent]
- **Change:** status: started-work → work-completed

## Reviewer Verdict (v1.5)

- **Scan ID:** R-37c4a7db
- **Timestamp:** 2026-06-02T14:56:18Z
- **Catalogue:** v1.3-seed
- **Overall:** PASS
- **Needs Human:** no
- **Findings:** none
