Skip to main content

BookStack task lifecycle enforcement — ANVIL Claude Code

BookStack task lifecycle enforcement — ANVIL Claude Code

Status: PRE-WORK / implementation in progress
Date: 2026-08-21
Scope: /Users/makinja/system and the active Claude Code hook configuration on ANVIL

Problem

The active Claude Code configuration did not enforce the operating requirement that task documentation be read before work and updated after work. The task-scoped pilot-discover-inject.py path returned immediately when MC_TASK_ID was present, mc.js start only warned for a subset of tasks, and mc.js done accepted an unverified URL string in free text.

Before-work plan

  1. Add a deterministic BookStack task-page verifier that uses the BookStack API, accepts only canonical https://docs.alai.no/... pages, and checks task-specific lifecycle markers.
  2. Make mc.js start fail closed for every real MC task unless its linked page exists and contains a task-specific BEFORE marker.
  3. Make mc.js ready and mc.js done fail closed unless the same page contains the AFTER marker and its API updated_at is newer than the baseline captured at start.
  4. Store the API verification timestamps/page identity on the MC task so a pasted URL or unrelated old page cannot satisfy the gate.
  5. Repair task-scoped context injection so the linked BookStack page content is placed in front of the worker instead of being skipped.
  6. Add bidirectional tests: valid lifecycle passes; missing URL, wrong host, missing marker, stale page, changed page, and API failure block.
  7. Re-run the hook inventory and targeted negative tests; list residual hook problems honestly instead of claiming all hooks are healthy.

Acceptance criteria

  • BEFORE proof is mandatory before the task can transition to active work.
  • AFTER proof is mandatory before review/completion.
  • Free-text docs.alai.no mentions do not satisfy completion.
  • API failure is UNKNOWN and blocks lifecycle transitions; it is never treated as PASS.
  • Tests do not contact or mutate production BookStack or the live Mission Control database.

After-work results

Pending implementation and independent verification.