TODO: Non-heading block anchor_ids

todo-block-anchor-ids Todo

todo done

TODO: Non-heading block anchor_ids

Problem

The pal-e-docs HTML parser only generates anchor_id for heading blocks. Paragraphs, lists, and tables get anchor_id: null. This means update_block(slug, anchor_id) and delete_block(slug, anchor_id) only work on headings — non-heading content cannot be surgically edited via the block API.

Impact

  • ~262 notes have blocks with null anchor_ids (all non-heading blocks from original backfill)
  • To edit a paragraph or list, agents must use update_note() with the entire note HTML — expensive, error-prone, defeats block-level editing
  • Discovered in basketball project session when trying to fix a single line in the Westside App plan context section

Fix

Generate anchor_ids for all block types in the parser, not just headings. Options:
  • Position-based: block-{position} (simple but fragile if blocks reorder)
  • Content-hash: first N chars of content, slugified (stable but collision risk)
  • Use block id (database PK) as the anchor_id for non-heading blocks

Scope

pal-e-docs app repo — parser module + re-backfill existing blocks. Also update SDK and MCP tools if anchor_id semantics change.
  • phase-postgres-7-block-content — original block implementation
  • phase-postgres-epilogue-cleanup — tracked as Epilogue item
  • convention-block-first-access — the convention that depends on block-level editing