Enhanced chat autocomplete with smart suggestions and entity mentions. Users can reference tasks, projects, and areas inline using @ and # triggers, with context automatically injected for Claude.
| Trigger | Entity Type | Search Target |
|---|---|---|
@ |
Unified search | Tasks, Projects, AND Hub files |
# |
Areas | Area names |
/ |
Commands | Slash commands (existing) |
Unified @ Search:
- Single trigger searches all entity types
- Results grouped by type (Tasks, Projects, Hub Files)
- Smart ranking based on query match
- Hub files: partial filename matching (
@email-tips→2024-01-15-email-tips.md)
Mentions stored as: [[type:id|displayText]]
Entity mentions:
- Tasks:
[[task:42|Review wireframes]] - Projects:
[[project:7|Client Website]] - Areas:
[[area:1|Work]]
Hub file mentions:
[[hub:Jason/content/newsletters/2024-01-15-email-tips.md|email-tips]]- Path relative to
hub/directory - Display text is the matched portion
Example: Check [[hub:Jason/content/newsletters/2024-01-15-email-tips.md|email-tips]] and update [[task:42|Review wireframes]]
New Search Endpoint:
GET /api/search/autocomplete?q=review&limit=10Returns grouped results:
{
"data": {
"tasks": [{ "id": 42, "type": "task", "title": "Review wireframes", "subtitle": "Client Website · Work" }],
"projects": [{ "id": 7, "type": "project", "title": "Review Portal", "subtitle": "Work" }],
"hub_files": [{ "path": "Jason/content/newsletters/2024-01-review.md", "type": "hub", "title": "2024-01-review.md", "subtitle": "Jason · Newsletter" }]
}
}Hub File Indexing:
- Scans
hub/for content files (.md, excluding.cursor/rules/) - Matches against filename (not full path)
- Returns path relative to
hub/
MentionContextBuilder Service:
- Extracts mentions from message content using regex
- For entities: fetches full data (task details, project info, area)
- For Hub files: reads file content from disk
- Builds context string appended to Claude's prompt
- Stores mention metadata in message.metadata JSONB
New Components:
components/chat/
├── AutocompleteMenu.tsx # Unified menu for all triggers
├── MentionChip.tsx # Styled mention pill in messages
├── MentionRenderer.tsx # Parses/renders mentions in text
└── hooks/
├── useAutocomplete.ts # Trigger detection, state management
└── useDebouncedSearch.ts # API calls with 150ms debounce
Trigger Detection:
- Works anywhere in text (not just at start)
- Looks backwards from cursor for trigger character
- Extracts filter text between trigger and cursor
Flow:
- User types
@revmid-sentence useAutocompletedetects@trigger, filter = "rev"useDebouncedSearchcalls API after 150msAutocompleteMenushows matching tasks- User selects → mention syntax inserted
- On send,
MentionRendererdisplays as styled chip - Backend extracts mentions, injects context for Claude
When message contains mentions, backend builds context:
User message: Check [[hub:Jason/content/newsletters/2024-01-email-tips.md|email-tips]] and update [[task:42|Review wireframes]]
---
Context for referenced entities:
Referenced Hub Files:
--- hub/Jason/content/newsletters/2024-01-email-tips.md ---
[Full file content here]
---
Referenced Tasks:
- Review wireframes (pending)
Area: Work
Project: Client Website
Due: Feb 5
Description: Review the new dashboard wireframes...
Claude receives this enriched prompt with full file contents for Hub files.
app/frontend/components/shell/ChatPanel.tsx- Replace SlashCommandMenu integration, add cursor trackingapp/controllers/api/messages_controller.rb- Extract mentions, build context, store metadataconfig/routes.rb- Add search/autocomplete route
app/controllers/api/search_controller.rb- Autocomplete endpoint (tasks, projects, hub files)app/services/mention_context_builder.rb- Extract and format entity contextapp/services/hub_file_indexer.rb- Scan and search hub/ directoryapp/frontend/components/chat/AutocompleteMenu.tsx- Unified autocomplete UI with grouped resultsapp/frontend/components/chat/MentionChip.tsx- Styled mention displayapp/frontend/components/chat/MentionRenderer.tsx- Parse and render mentionsapp/frontend/components/chat/hooks/useAutocomplete.ts- Trigger detection logicapp/frontend/components/chat/hooks/useDebouncedSearch.ts- Debounced API search
- 150ms debounce on API calls
- Max 10 suggestions per request
- Slash commands searched locally (no API)
- Request cancellation on query change
- Type
@mid-sentence → see grouped results (Tasks, Projects, Hub Files) - Type
@email→ Hub files matching "email" appear in results - Type
#→ see area suggestions - Arrow keys navigate, Enter/Tab selects, Escape closes
- Selected mention appears as styled chip in message
- Hub file mention → Claude receives full file content
- Task/Project mention → Claude receives entity details
- Works on mobile (touch-friendly)