v0.2.0: probe install + refresh-before-search#1
Merged
Conversation
Spec covers two 0.2.0 features: a `probe install` command that registers probe as a user-scope MCP server in Claude Code, and refresh-before-search that incrementally re-indexes changed files before each query. Awaiting review before implementation planning.
15-task bottom-up plan covering DB migration, _index_file refactor, RefreshGate, two-phase refresh_changed, CLI/MCP integration, install & uninstall commands, README updates, version bump, and manual e2e validation against /Users/dilawar/tmp/probe-toy.
- Remove unused pytest import; split compound for-loops (ruff F401/E701). - Document that should_refresh() is not a single-flight guard.
…index) Hash-confirm each stat candidate: re-index on content change (new or edited file), update signature only on metadata-only change (touch), and skip unchanged files entirely. Expand save-gate to cover all mutation paths. Remove unused old_ids variable in _index_file.
…efresh errors Move RefreshGate from a per-call local to _ServerState so the debounce window survives across MCP tool invocations. Time the refresh at the call site so the error branch reports real elapsed_ms instead of hard-coded 0.
Registers the install subcommand with --api-key, --no-embed-key, and --force flags. First step of install flow detects whether the claude CLI is on PATH; exits with helpful message if not found. Remaining install flow (API-key resolution and MCP registration) will be implemented in Task 9.
…cation Replaces the placeholder install body with the full flow: check already-installed via `claude mcp get`, resolve API key (flag / env / 3-retry prompt), resolve probe binary, call `claude mcp add --scope user`. Adds `import subprocess` and three new tests covering the key-resolution paths.
…ll paths Add three tests for existing install behavior: - test_install_no_embed_key_omits_env: verify -e flag omitted and -- separator precedes probe argv - test_install_already_registered_cancels_without_force: confirm reinstall prompt defaults to no - test_install_force_skips_confirmation: verify --force skips confirmation and removes/re-adds All three behaviors implemented in Task 9 already; tests validate Task 9 logic.
Bump version across pyproject.toml and __init__.py to 0.2.0. Add CHANGELOG.md with entries for the 0.2.0 release. Update test_version to expect 0.2.0.
Sorts imports, removes unused pytest/pathlib/yaml/RerankResult imports, wraps a long MagicMock list onto three lines. No behavior change.
claude mcp add's -e flag is variadic and greedily consumes the positional server name as another env var. Switching to add-json, which takes a single JSON config and avoids the ambiguity entirely. Also drop --scope from the mcp get probe call; get doesn't support that flag.
Removes 'probe' from projects.<path>.disabledMcpServers in ~/.claude.json after claude mcp add-json succeeds. Narrowly scoped: only removes the literal 'probe' string from those specific lists; doesn't touch any other key or project entry. Atomic write via temp + os.replace. Silent no-op on missing file; yellow warning (no failure) on malformed JSON.
…v hygiene On CI runners with low system uptime, time.monotonic() can be small enough that the TTL=60 check in test_probe_search_gate_persists_across_calls blocks the first refresh call, making the test fail. Patching the clock to a large constant makes the assertion deterministic. Also replace os.environ[...] = ... in test_search_calls_refresh_when_gate_allows with monkeypatch.setenv so the env var doesn't leak across tests.
855de69 to
6c76a43
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two independent features that together make probe feel invisible in Claude Code:
probe install/probe uninstall— one command registers probe as a user-scope MCP server viaclaude mcp add-json --scope user. Resolves the API key from--api-key,ZEROENTROPY_API_KEYenv (with confirm), or an interactive 3-retry prompt. Post-registration, also clearsprobefrom any project'sdisabledMcpServerslist in~/.claude.jsonso the server is enabled out of the box.probe_searchcall, a two-phase (stat → SHA-256) scan re-indexes only files that actually changed since last index. ARefreshGate(TTL,PROBE_REFRESH_TTLenv var, default 5s) debounces back-to-back calls. Theprobe_searchJSON response gains arefreshedfield with{added, changed, removed, elapsed_ms}. Refresh failures are non-blocking — search runs against whatever's in the current index.Version bump:
0.1.0→0.2.0. DB migration for newfiles.mtime_ns/files.sizecolumns is automatic and idempotent.Design + plan (committed to the branch)
docs/superpowers/specs/2026-04-17-smoother-ux-and-auto-reindex-design.mddocs/superpowers/plans/2026-04-17-smoother-ux-and-auto-reindex.mdCHANGELOG.mdEach of the 15 plan tasks was implemented via a fresh subagent + two-stage review (spec compliance then code quality). Two late-breaking bugs were caught and fixed during manual end-to-end validation: claude's
-eflag is variadic (eats the server-name positional), and new user-scope MCP servers can land indisabledMcpServersper project.Test plan
uv run pytest).src/andtests/.probe installagainst realclaudeCLI succeeds;/mcpshows probe enabled; querying an indexed toy project returns results with non-zerorefreshed.addedon first call.refreshed.changed > 0on the next query.probe uninstallremoves the registration.Known follow-ups (not blockers for 0.2.0)
searchshould auto-create.probe/on first run for parity with MCP's auto-index path (spec-compliant; UX asymmetry only).refresh_changed()would benefit from an explicitproject_rootparameter so tests and callers don't depend onPath.cwd()fallback._claude_mcp(...)helper extraction to dedupe theshutil.which+subprocess.runpattern betweeninstallanduninstall.🤖 Generated with Claude Code