Skip to content

fix(wizard): move semantic_search config out of ~/.claude/settings.json#137

Open
tkavelli wants to merge 1 commit intoparcadei:mainfrom
tkavelli:fix/semantic-search-config
Open

fix(wizard): move semantic_search config out of ~/.claude/settings.json#137
tkavelli wants to merge 1 commit intoparcadei:mainfrom
tkavelli:fix/semantic-search-config

Conversation

@tkavelli
Copy link
Copy Markdown

@tkavelli tkavelli commented Feb 12, 2026

Summary

  • Wizard now writes semantic search config to ~/.config/tldr/config.json instead of ~/.claude/settings.json
  • Automatically cleans up stale semantic_search key from ~/.claude/settings.json left by previous installations
  • GPU detection and model selection logic preserved in the new location

Problem

The setup wizard injects a semantic_search key into ~/.claude/settings.json (Claude Code's global settings). Claude Code does not recognise this key and reports Found N invalid settings files on every startup.

Additionally, the tldr daemon reads this config from the project-level .claude/settings.json (or .tldr/config.json), not from the global one — so the global write never actually reached the daemon.

Fix

Write to ~/.config/tldr/config.json (a dedicated TLDR config location) and clean up the stale key from ~/.claude/settings.json on next wizard run.

Test plan

  • Run python -m scripts.setup.wizard — semantic search step writes to ~/.config/tldr/config.json
  • Verify ~/.claude/settings.json does not contain semantic_search key
  • Verify Claude Code no longer reports invalid settings files
  • Run tldr semantic search "test" . — daemon still works (uses its own defaults)

Summary by CodeRabbit

  • Bug Fixes

    • Improved semantic search configuration handling by migrating settings to a more reliable per-tool location.
    • Added automatic cleanup of outdated configuration entries from legacy settings.
  • Refactor

    • Reorganized configuration management for semantic search functionality to enhance reliability and maintainability.

WHAT CHANGED:

1. opc/scripts/setup/wizard.py:
   - Semantic search config now writes to ~/.config/tldr/config.json
     instead of ~/.claude/settings.json
   - Added cleanup: removes stale "semantic_search" key from
     ~/.claude/settings.json if present from previous installations
   - WHY: Claude Code does not recognise the "semantic_search" key
     and reports the settings file as invalid ("Found N invalid
     settings files"). The tldr daemon reads per-project config
     from <project>/.tldr/config.json at runtime anyway.

CONTEXT:
The wizard was injecting a non-standard key into Claude Code's
global settings file. Claude Code validates its settings schema
and flags unknown keys, causing a warning on every startup.
The daemon's default config already matches the wizard's defaults
(bge-large-en-v1.5, threshold=20), so the global write was mostly
redundant — but the GPU-detection logic (choosing all-MiniLM-L6-v2
for CPU-only systems) is preserved in the new location.
@greptile-apps
Copy link
Copy Markdown

greptile-apps bot commented Feb 12, 2026

PR author is not in the allowed authors list.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 12, 2026

📝 Walkthrough

Walkthrough

The configuration handling for semantic search is migrated from a global Claude settings file (/.claude/settings.json) to a per-tool TLDR config file (/.config/tldr/config.json). The change includes reading the existing TLDR config, updating its semantic section, writing it back, and removing stale semantic_search entries from the old global settings.

Changes

Cohort / File(s) Summary
Configuration Migration
opc/scripts/setup/wizard.py
Replaces semantic_search configuration write operations from global Claude settings to per-tool TLDR config. Adds logic to read existing TLDR config, update semantic section with enabled/threshold/model fields, and clean up stale entries from old settings file. Preserves user-facing messaging and control flow.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and specifically describes the main change: moving semantic_search configuration from ~/.claude/settings.json to ~/.config/tldr/config.json, which aligns with the primary objective and all file modifications.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into main

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
opc/scripts/setup/wizard.py (1)

1076-1078: ⚠️ Potential issue | 🟡 Minor

Stale reference to old config location.

Line 1078 still tells the user to enable semantic search in .claude/settings.json, but it should now point to ~/.config/tldr/config.json.

🐛 Proposed fix
-                        console.print("  [dim]Enable later in .claude/settings.json[/dim]")
+                        console.print("  [dim]Enable later in ~/.config/tldr/config.json[/dim]")
🧹 Nitpick comments (1)
opc/scripts/setup/wizard.py (1)

1032-1033: Wrap the config write in try/except for consistency with surrounding I/O.

The read (line 1021) and the cleanup write (line 1042) are both guarded by try/except, but this write is not. A permission error here would propagate up to the outer except Exception at line 1088, aborting the entire TLDR step with a generic message instead of gracefully continuing.

♻️ Proposed fix
-                        tldr_config_dir.mkdir(parents=True, exist_ok=True)
-                        tldr_config_path.write_text(json.dumps(tldr_config, indent=2))
+                        try:
+                            tldr_config_dir.mkdir(parents=True, exist_ok=True)
+                            tldr_config_path.write_text(json.dumps(tldr_config, indent=2))
+                        except Exception:
+                            console.print("  [yellow]WARN[/yellow] Could not write TLDR config to ~/.config/tldr/config.json")

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