Skip to content

fix(pi-extension): use search --list flag for CLI v0.3.x compatibility#171

Open
wooksong wants to merge 2 commits into
iamtouchskyer:mainfrom
wooksong:fix/pi-extension-search-list-flag
Open

fix(pi-extension): use search --list flag for CLI v0.3.x compatibility#171
wooksong wants to merge 2 commits into
iamtouchskyer:mainfrom
wooksong:fix/pi-extension-search-list-flag

Conversation

@wooksong

Copy link
Copy Markdown

Problem

memex CLI v0.3.x changed the behavior of memex search (no args): it now returns guidance text ("No query provided. To search your knowledge base...") instead of listing all cards.

The Pi extension was calling memex search without --list, which broke three workflows:

  1. memex_recall with no query — fallback path after read index failed showed CLI help text instead of card listing
  2. memex_search with no query — tool docs say "Omit query to list all cards" but returned guidance text
  3. /memex slash command — showed card count from search output, broken by guidance text

Fix

Added --list flag to all three memex search calls in pi-extension/index.ts. Also added defensive detection of CLI usage-text in memex_recall to handle future CLI changes gracefully.

Tests

Added tests/pi-extension/cli-patterns.test.ts with 6 integration tests verifying the exact CLI call patterns the Pi extension relies on:

  • memex_recall: read index → fallback search --list
  • memex_search (no query): search --list
  • /memex command: card count from search --list output

Full test suite passes (774 tests, 40 files).

wooksong added 2 commits June 13, 2026 22:30
CLI v0.3.x changed memex search (no query) from listing all cards to
showing guidance/help text. Listing all cards now requires --list flag.

This broke three integration points in the Pi extension:
- memex_recall fallback (when no index card exists)
- memex_search tool (when called with no query)
- /memex command (card count was based on wrong output)

All three now pass --list when query is empty. Also adds defensive
usage text detection in memex_recall as safety net against future
CLI changes.

This caused the confusing "No query provided. To search your
knowledge base..." message to appear in every Pi session start.
Verify the exact CLI commands the Pi extension issues, ensuring
CLI behavior changes dont silently break the extension:

- memex_recall (no query): read index → fallback search --list
- memex_search (no query): search --list
- /memex command: search --list returns card count

6 tests covering: index hit, index miss fallback, fresh memory,
search --list listing, search with query, and card count pattern.

Regression protection against the v0.3.x CLI change where memex
search (no args) changed from listing cards to showing guidance text.
@wooksong wooksong force-pushed the fix/pi-extension-search-list-flag branch from c2c6036 to 055de23 Compare June 13, 2026 13:30
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