Skip to content

Fix migration regex matching 'port' and docs heuristic text-only matching#98

Draft
cursor[bot] wants to merge 1 commit intofeat/session-workflow-fingerprintsfrom
cursor/workflow-archetype-heuristics-2c1d
Draft

Fix migration regex matching 'port' and docs heuristic text-only matching#98
cursor[bot] wants to merge 1 commit intofeat/session-workflow-fingerprintsfrom
cursor/workflow-archetype-heuristics-2c1d

Conversation

@cursor
Copy link

@cursor cursor bot commented Mar 13, 2026

Summary

Fixes two logic bugs in workflow_profile_service.py archetype heuristics:

1. Migration regex matches common "port" network term

_MIGRATION_TEXT_RE included \bport\b which matched the standalone word "port" — an extremely common term for network ports (e.g., "listen on port 3000"). Combined with the weak secondary check requiring only files_touched_count >= 2, this caused sessions about server configuration or networking to be falsely classified as migration archetype.

Fix: Changed regex from \bport\b to \bport(?:ing|ed)\b to only match verb forms relevant to code migration ("porting", "ported") while avoiding the noun form.

2. Docs heuristic too aggressive on text-only matching

_looks_like_docs returned True immediately when _DOC_TEXT_RE matched the prompt/summary text, bypassing the file-based check entirely. Words like "guide", "doc", "readme", and "changelog" commonly appear in prompts that aren't about documentation work.

Fix: Removed the text-only early return. Now a text regex match requires at least one documentation file in named_files to classify as docs. Without a text match, the existing threshold (half of files must be doc files) still applies.

Open in Web Open in Cursor 

…hing

- Change migration regex from \bport\b to \bport(?:ing|ed)\b to avoid
  matching the common networking term 'port' (e.g., 'port 3000')
- Require at least one documentation file in named_files before text-only
  regex match can classify a session as docs archetype
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant