# Recipe Manager — Agentic Harness Task Plan (Workflow Stabilization)

## Goal
Implement and validate a reliable automated workflow run + reporting + failure alert loop, in small isolated chunks.

## Task 1 — Add scheduler script + npm script
**Scope**
- Create `scripts/schedule-workflow.ts` that:
  - Runs workflow in resume mode
  - Generates morning report afterward
  - Exits non-zero on hard failure
- Add npm script in `package.json`:
  - `workflow:schedule`: `ts-node scripts/schedule-workflow.ts`

**Constraints**
- Keep script focused (no external integrations yet)
- Reuse existing runner/report code

**Success criteria**
- `npm run workflow:schedule` executes without TypeScript/runtime errors
- Commit with conventional commit message

---

## Task 2 — Add failure-state detector utility
**Scope**
- Create `scripts/check-workflow-health.ts` that reads status file and exits:
  - `0` for healthy (`running|completed|idle`)
  - `1` for unhealthy (`failed|blocked`)
- Print concise machine-readable output for automations

**Success criteria**
- Script behavior validated by direct execution + simple tests (or assertions)
- Conventional commit

---

## Task 3 — Add tests for schedule + health check scripts
**Scope**
- Add tests under `scripts/__tests__/`:
  - scheduler happy path
  - scheduler failure propagation
  - health check status mapping

**Success criteria**
- `npm test` passes
- Conventional commit

---

## Task 4 — Wire lightweight local automation docs
**Scope**
- Update README/RUNBOOK with exact commands for periodic execution (cron/systemd example)
- Include troubleshooting for failed/blocked status

**Success criteria**
- Docs are accurate to current scripts
- Conventional commit

---

## Task 5 — End-to-end verification pass
**Scope**
- Run:
  - `npm run workflow:run -- --mode restart`
  - `npm run workflow:schedule`
  - `npm test`
- Capture outputs in final summary

**Success criteria**
- All commands succeed
- Final conventional commit if needed

