Skip to content

Enhance Command Palette with relevance-first search and recent actions #333

Description

@xcv58

Summary

Improve Command Palette as MacTools' keyboard-first launcher by adding:

  • Relevance-first ordering for typed queries
  • Recent successful actions
  • A more useful zero-query experience

The goal is to help users run or reach what they want in fewer keystrokes without turning Command Palette into a dashboard, activity center, or plugin workspace.

Current problems

Typed results lose relevance ordering

MacToolsSearchIndex calculates relevance, but the presentation layer subsequently groups results as:

  1. Navigation
  2. Settings
  3. Commands

This can place a weak navigation match above an exact command match.

Empty queries are not useful for frequent operation

Opening Command Palette without typing currently shows a fixed list of navigation destinations. It does not provide a fast path back to recently used actions.

Recent activity requires stable identity

Search-result display IDs and localized titles are not suitable persistence keys. Recent actions should resolve through canonical action identity.

Proposed behavior

Typed query

When the query is nonempty, show one relevance-ordered result list.

Ranking should preserve this order:

  1. Exact title
  2. Title prefix
  3. Title word or phrase
  4. Declared keyword or curated alias
  5. Subtitle or detail

Recency may break close ties but must never outrank a clearly better textual match.

Result rows should retain a visible primary intent such as Run, Open, or Go To so mixed result types remain understandable.

Empty query

Show recent successful actions followed by a small set of suggested destinations:

Recent
  Copy Public IP
  Toggle Dark Mode
  Open Dashboard

Suggested
  Actions & Shortcuts
  Plugin Marketplace

Behavior:

  • Recent actions appear first.
  • Suggested destinations provide a useful first-run fallback.
  • The Recent section is omitted when empty.
  • Duplicate results are removed.
  • The first nine visible results retain Command-1 through Command-9 activation.
  • Users can clear Recent activity.

Recent actions

Recent activity should be:

  • Local
  • Bounded
  • Deduplicated
  • Clearable
  • Optional
  • Free of action parameters and query text
  • Excluded from preferences backup

Only successfully completed actions should enter Recent.

Failed, cancelled, rejected, timed-out, or confirmation-cancelled executions should not be recorded. Continuing actions should only be recorded when their durable completion source reports success.

The MVP should persist only parameter-free canonical ActionReference values.

A reasonable initial limit would be approximately 30 stored actions, with up to five shown when the query is empty.

Privacy and safety

  • Do not persist search queries.
  • Do not persist parameterized action references in the MVP.
  • Do not persist localized titles, clipboard text, file paths, device identifiers, or other contextual values.
  • Provide controls to clear or disable Recent actions.
  • Confirmation-required actions must still confirm when launched from Recent, Return, or Command-number shortcuts.
  • Availability, permissions, schema version, and provider generation must be revalidated immediately before execution.
  • Recent actions must not bypass the existing ActionRegistry or ActionExecutor.
  • If an action or provider disappears, retain no executable stale copy of that action.

Architecture direction

Keep the implementation divided into three layers:

  1. An immutable searchable index
  2. A runtime ranking and availability overlay
  3. A small, versioned recent-activity store

The recent-activity store should persist canonical action identity and resolve entries against the current registry when displayed.

For nonempty queries, the presentation layer must preserve relevance order instead of regrouping results by kind.

Volatile information such as availability, permissions, and shortcut state should be resolved for visible or selected results without rebuilding the entire search index for unrelated plugin-state changes.

Accessibility and interaction

Preserve the existing keyboard model:

  • Up/Down: move selection
  • Return: run or open
  • Command-Return: open the owning feature or Settings destination
  • Command-1 through Command-9: activate visible results
  • Escape: dismiss
  • Tab/Shift-Tab: reach secondary actions

Unavailable state, permissions, and confirmation requirements must be represented through accessible text, not only color or icons.

The implementation should continue supporting:

  • VoiceOver
  • CJK input composition
  • Right-to-left layouts
  • Increase Contrast
  • Reduce Transparency
  • Reduce Motion
  • Long localized text

Non-goals

  • Favorite or pinned actions
  • Live system status or dashboard widgets
  • Needs Attention or activity feeds
  • Plugin workspaces
  • Drag-and-drop palette layouts
  • Inline plugin installation
  • Arbitrary plugin-provided preview views
  • Generic parameter-entry forms
  • Persisted or automatically learned search queries
  • Replacing Settings, Dashboard, Feature Panel, or Action Grid

Suggested implementation sequence

  1. Introduce stable semantic result identities.
  2. Preserve global relevance ordering for typed queries.
  3. Add the versioned Recent store.
  4. Add Recent and Suggested zero-query sections.
  5. Add Clear Recent and Disable Recent controls.
  6. Reduce unnecessary search-index rebuilds.
  7. Verify privacy, execution safety, accessibility, and localization.

These steps may be implemented in separate pull requests while remaining tracked by this issue.

Acceptance criteria

  • An exact command-title match appears above weaker navigation or setting matches.
  • Identical inputs and state produce deterministic ordering.
  • Recency cannot override a stronger lexical match.
  • Empty-query results show Recent and Suggested sections.
  • The Recent section is omitted when no history exists.
  • Results are deduplicated across sections.
  • Recent identities remain stable across catalog reordering and localization changes.
  • Parameterized actions are not persisted in the MVP.
  • Only successfully completed actions enter Recent.
  • Recent activity is bounded and clearable.
  • Users can disable Recent activity.
  • No query text, localized title, or action parameters are persisted.
  • Missing or retired actions cannot execute through stale history.
  • Return, mouse activation, and Command-number activation use the same confirmation and validation path.
  • Existing canonical execution, cancellation, and owner-navigation behavior remains unchanged.
  • Complete keyboard and VoiceOver flows remain usable.
  • Localization and appearance changes update visible results correctly.

Possible follow-ups

  • Curated aliases and acronym matching
  • Conservative typo tolerance
  • Searchable available-plugin discovery with Marketplace navigation
  • Navigation recents
  • Refinement through existing validated action-catalog variants
  • A compact, host-rendered selected-result detail region
  • Favorite actions, if permanent pinning proves valuable beyond global shortcuts and Action Grid

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions