Rewrote README from 1686 lines to ~420 lines with clearer organization:
- Quick Start: Required env vars and properties upfront
- Property Mapping: New dedicated section explaining defaults and overrides
- Owner Resolution: Consolidated priority flow with heading proximity rules
- Other People Resolution: New dedicated section for AI-extracted names
- Due Date Resolution: Simplified explanation
- Relation Mapping: Clear strategy breakdown with Projects-only whitelist note
- Configuration Reference: All env vars in organized tables
- Advanced Topics: Technical details moved to end
Fixed bug where owner could be added to wrong property when multiple relations target the same database. Previously used cache.relations.find(r => r.targetDatabaseId === cache.ownerTargetDbId) which could return the wrong relation if Steels DB appeared before DRI in the array. Now uses TODOS_PROPERTIES.owner directly.
Headings now only apply to uninterrupted stacks of todo blocks directly beneath them. Any non-heading, non-todo block (empty line, paragraph, list item, etc.) resets the heading context to null. This prevents distant, unrelated headings from being incorrectly matched to todos.
Also added stopword filtering to heading matching to prevent common words like "the", "in", "see", "what", "database" from matching against contact names.
Tightened owner name matching to only allow exact matches or prefix matches (entry starts with search word). Removed reverse prefix matching that allowed "brad" to match any contact with a short word like "b" or "br".
AI now extracts names of people mentioned in todo text (not @mentions) and adds them to the Other People relation when configured as a relation type. For example, "Taylor to call Jamie R about the project" will add Jamie Rodriguez to Other People if they exist in the Contacts database.
Matching rules:
- Exact name match first (case-insensitive)
- Falls back to prefix matching: "Jamie R" matches "Jamie Rodriguez" (all words must be prefixes)
- Skipped if ambiguous (multiple matches)
- Skipped if already in Owner or @mentions
- Task targets ARE included (e.g., "call Jamie" will match Jamie)
When a user (not the integration bot) last edited a todo page in the Todos database, sync now skips updating that page to preserve the user's changes. Logs show "Skipping update for block X: page was edited by user (not bot)".
Contextual matching (Strategy 2a/2b/2c) now only applies to the Projects relation. All other relations (Owner, otherPeople, etc.) require explicit @mentions. This prevents source page relations like DRI or Additional Members from polluting the Contacts field.
Only relations with explicit TODOS_PROP_xxx mappings are loaded from Notion. Unmapped relations are discovered but not loaded, reducing API calls and preventing false positive matches.
Owner relation is excluded from contextual matching strategies. Owner resolution uses its dedicated flow: heading match, @mention, or AI extraction.
Removed "contact" as an owner source. Owner now comes from:
- Heading match (with AI disambiguation if multiple)
- @mention (exact match priority)
- AI extraction (validated against owner DB)
Fuzzy matching code was already removed in a prior session. Relation matching now uses only @mentions (Strategy 1a/1b) and contextual matching (Strategy 2a/2b/2c, Projects only).