diff --git a/docs/configuration.md b/docs/configuration.md index d4a35f2..5a296fe 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -93,6 +93,7 @@ They cover source, web templates and styles, .NET and WPF markup and project fil file mask lives in `MASK` in `shared/qmd/qmd-lib.mjs` and is reapplied to existing repository collections. Where the Claude sandbox is enabled (macOS, Linux, WSL2), the exact search command is listed in `sandbox.excludedCommands`, because the sandbox blocks the localhost daemon and the index under the home directory. +Disabling local search removes that exclusion, including on update. Auto thresholds can be overridden with `QMD_BENCHMARK_MAX_QUERY_SECONDS` and `QMD_BENCHMARK_MIN_CHUNKS_PER_SECOND`. The benchmark uses a temporary database and a deterministic 100-document fixture; its measurements are not an end-to-end estimate for a user's repository. diff --git a/scripts/lib/install-options.py b/scripts/lib/install-options.py index 4ebe9ac..c3c9e43 100644 --- a/scripts/lib/install-options.py +++ b/scripts/lib/install-options.py @@ -58,6 +58,12 @@ def filter_options(path, flashbang_enabled=True, statusline_enabled=True, semant settings['hooks']['SessionStart'] = remaining else: settings.get('hooks', {}).pop('SessionStart', None) + sandbox = settings.get('sandbox', {}) + excluded = [command for command in sandbox.get('excludedCommands', []) if 'qmd-search.mjs' not in command] + if excluded: + sandbox['excludedCommands'] = excluded + else: + sandbox.pop('excludedCommands', None) if not statusline_enabled: settings.pop('statusLine', None) return json.dumps(settings, indent=2, ensure_ascii=False) + '\n' @@ -109,6 +115,11 @@ def merge_json(current, managed): result = dict(current) if 'statusLine' not in managed: result.pop('statusLine', None) + sandbox = result.get('sandbox') + if isinstance(sandbox, dict) and isinstance(sandbox.get('excludedCommands'), list): + # The QMD exclusion is owned; managed settings re-add it only while semantic retrieval is enabled. + excluded = [command for command in sandbox['excludedCommands'] if 'qmd-search.mjs' not in str(command)] + result['sandbox'] = dict(sandbox, excludedCommands=excluded) if excluded else {k: v for k, v in sandbox.items() if k != 'excludedCommands'} for key, value in managed.items(): if key == 'hooks' and isinstance(value, dict) and isinstance(result.get(key), dict): hooks = dict(result[key]) diff --git a/scripts/tests/test-install-options.py b/scripts/tests/test-install-options.py index 667bcb2..209d82e 100644 --- a/scripts/tests/test-install-options.py +++ b/scripts/tests/test-install-options.py @@ -99,6 +99,19 @@ class InstallOptionsTests(unittest.TestCase): commands = [hook['command'] for group in result['hooks']['SessionStart'] for hook in group['hooks']] self.assertEqual(commands, ['bash "/c/hooks/scripts/show-session-state-pointer.sh"']) + def test_semantic_retrieval_disabled_removes_qmd_sandbox_exclusion(self): + with tempfile.TemporaryDirectory() as directory: + settings = Path(directory) / 'settings.json' + qmd = 'node "$HOME/.my-ai-configuration/qmd/qmd-search.mjs" *' + settings.write_text(json.dumps({'sandbox': {'enabled': True, 'excludedCommands': [qmd, 'docker *']}}), encoding='utf-8') + self.assertEqual(json.loads(OPTIONS.filter_options(settings, semantic_retrieval_enabled=False))['sandbox']['excludedCommands'], ['docker *']) + settings.write_text(json.dumps({'sandbox': {'enabled': True, 'excludedCommands': [qmd]}}), encoding='utf-8') + self.assertEqual(json.loads(OPTIONS.filter_options(settings, semantic_retrieval_enabled=False))['sandbox'], {'enabled': True}) + self.assertEqual(json.loads(OPTIONS.filter_options(settings, semantic_retrieval_enabled=True))['sandbox']['excludedCommands'], [qmd]) + current = {'sandbox': {'enabled': True, 'excludedCommands': [qmd, 'docker *']}} + self.assertEqual(OPTIONS.merge_json(current, {'sandbox': {'enabled': True}})['sandbox']['excludedCommands'], ['docker *']) + self.assertEqual(OPTIONS.merge_json(current, {'sandbox': {'excludedCommands': [qmd]}})['sandbox']['excludedCommands'], [qmd, 'docker *']) + def test_semantic_retrieval_disabled_removes_codex_session_hook(self): with tempfile.TemporaryDirectory() as directory: config = Path(directory) / 'config.toml' diff --git a/shared/agents/architect/instructions.md b/shared/agents/architect/instructions.md index f0b1064..0d74030 100644 --- a/shared/agents/architect/instructions.md +++ b/shared/agents/architect/instructions.md @@ -4,4 +4,4 @@ Start from the parent's requirements and references. Identify relevant boundarie Before accepting a design that relies on external technology behavior, MUST apply the planning checkpoint in `technical-research`. Carry supporting evidence or unresolved assumptions into the handoff. -Use shell commands for inspection and required research tools, including semantic search and MCPorter. Do not modify implementation code unless assigned. +Use shell commands for inspection and required research tools, including semantic search (when installed) and MCPorter. Do not modify implementation code unless assigned. diff --git a/shared/agents/researcher/instructions.md b/shared/agents/researcher/instructions.md index ad57b36..2ff7005 100644 --- a/shared/agents/researcher/instructions.md +++ b/shared/agents/researcher/instructions.md @@ -2,4 +2,4 @@ Start with the parent's question and references. Inspect only code, patterns, documentation, and constraints needed to answer it; expand when evidence requires it. Return conclusions, concrete references, and unknowns using the shared orchestration handoff protocol. Avoid modifying implementation code by default. -Use shell commands for inspection and required research tools, including semantic search and MCPorter. +Use shell commands for inspection and required research tools, including semantic search (when installed) and MCPorter. diff --git a/shared/agents/reviewer/instructions.md b/shared/agents/reviewer/instructions.md index 2c3b53d..e4b5322 100644 --- a/shared/agents/reviewer/instructions.md +++ b/shared/agents/reviewer/instructions.md @@ -2,7 +2,7 @@ Provide static and semantic correctness review using the acceptance criteria and actual git diff. Inspect changed symbols first, then direct callers, dependencies, tests, and contracts needed to judge correctness. Expand for shared state, configuration, persistence, security, generated code, or public API effects; avoid broad repository exploration by default. -Use shell commands to inspect diffs and run required research tools, including semantic search and MCPorter. Do not run tests, builds, or runtime checks; reuse supplied execution evidence and report gaps to the parent or verifier. +Use shell commands to inspect diffs and run required research tools, including semantic search (when installed) and MCPorter. Do not run tests, builds, or runtime checks; reuse supplied execution evidence and report gaps to the parent or verifier. For each finding, report SEVERITY (blocking, important, or minor), LOCATION, IMPACT, EVIDENCE, and SCOPE (introduced, pre-existing, or uncertain). Do not report stylistic preferences or pre-existing issues unless they materially affect the requested change. Prioritize actionable correctness defects, keep unrelated cleanup out of scope, and use blocking only for security, data-loss, broken contracts, or deterministic failures.