Skip to content

Commit c1b0c6d

Browse files
rodion-mclaude
andcommitted
Enforce chat-only-on-explicit-request policy across all tool surfaces
- chat.py: remove promotional capabilities list, replace soft Note with hard "disabled by default" rule - codealive_mcp_server.py: rewrite instructions — separate default workflow from user-invoked chat, remove "after search" justification - codebase_consultant: add explicit invocation policy matching chat - Bump version to 2.0.1 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent df6cbf5 commit c1b0c6d

2 files changed

Lines changed: 24 additions & 17 deletions

File tree

src/codealive_mcp_server.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,27 +52,32 @@
5252
- Answer questions about code implementation details
5353
- Integrate with local git repositories for seamless code exploration
5454
55-
When working with a codebase, follow this workflow:
55+
Default workflow (used for ALL tasks unless the user explicitly requests `chat`):
5656
1. First use `get_data_sources` to identify available repositories and workspaces
5757
2. Use `semantic_search` for natural-language retrieval by meaning
5858
3. Use `grep_search` for literal string or regex matching when the pattern matters
59-
3. To get full content:
59+
4. To get full content:
6060
- For repos in your working directory: use `Read()` on the local files
6161
- For external repos: use `fetch_artifacts` with identifiers from search results
62-
4. Use `get_artifact_relationships` or `fetch_artifacts` to drill into the most relevant hits
63-
5. If your environment supports subagents and you need the highest reliability or depth,
62+
5. Use `get_artifact_relationships` or `fetch_artifacts` to drill into the most relevant hits
63+
6. If your environment supports subagents and you need the highest reliability or depth,
6464
prefer an agentic workflow where a subagent combines `semantic_search`, `grep_search`,
6565
artifact fetches, relationship inspection, and local file reads
66-
6. Use `chat` only when you specifically need a synthesized answer after search;
67-
it is usually not the default choice and can take up to 30 seconds
66+
67+
User-invoked tool — `chat`:
68+
- `chat` is disabled by default. Call it ONLY when the user has explicitly
69+
named the tool (e.g. "use chat", "ask CodeAlive", "use codebase_consultant").
70+
- For every other case — lookups, architecture understanding, debugging,
71+
summaries — use semantic_search, grep_search, fetch_artifacts, and
72+
get_artifact_relationships. Do not treat "after search" as a justification
73+
for calling chat.
6874
6975
For effective code exploration:
7076
- Start with broad natural-language queries in `semantic_search` to understand the overall structure
7177
- Use `grep_search(regex=false)` for exact strings and `grep_search(regex=true)` for regex patterns
7278
- Use specific function/class names or file path scopes when looking for particular implementations
7379
- Treat `semantic_search` and `grep_search` as the default discovery tools
7480
- Prefer `semantic_search` over the deprecated `codebase_search` legacy alias
75-
- Reserve `chat` for synthesis after search, not for first-pass evidence gathering
7681
- Remember that context from previous messages is maintained in the same conversation
7782
7883
Flexible data source usage:

src/tools/chat.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,10 @@ async def chat(
4343
UNLESS the user has explicitly provided specific data source names OR you are continuing an
4444
existing conversation with a `conversation_id`.
4545
46-
This tool understands the indexed codebase and can help with:
47-
- Architecture and design decisions
48-
- Implementation strategies
49-
- Code explanations and walkthroughs
50-
- Best practices and optimization advice
51-
- Debugging and problem-solving
46+
When invoked by the user, this tool can produce synthesized answers about
47+
architecture, design decisions, code walkthroughs, debugging, etc.
48+
These topics do NOT by themselves justify calling the tool — only an
49+
explicit user request does.
5250
5351
Args:
5452
question: What you want to know about the codebase
@@ -84,8 +82,8 @@ async def chat(
8482
)
8583
8684
Note:
87-
- `chat` is usually not needed for simple lookups or evidence gathering
88-
- Prefer `semantic_search` and `grep_search` as the default tools
85+
- `chat` is disabled by default; see top of docstring for the single
86+
condition that permits calling it.
8987
- Either conversation_id OR data_sources is typically provided
9088
- When creating a new conversation, data_sources is optional if your API key has exactly one assigned data source
9189
- When continuing a conversation, conversation_id is required to maintain context
@@ -110,8 +108,12 @@ async def codebase_consultant(
110108
"""Deprecated alias for `chat`.
111109
112110
Keep this for backward compatibility with older prompts and MCP clients.
113-
New integrations should prefer `chat`, while default discovery should still
114-
start with `semantic_search` and `grep_search`.
111+
New integrations should prefer the canonical `chat` tool name.
112+
113+
**Same invocation policy as `chat`**: do NOT call unless the user explicitly
114+
named the tool (e.g. "use codebase_consultant", "ask CodeAlive", "use chat").
115+
For all other tasks use `semantic_search`, `grep_search`, `fetch_artifacts`,
116+
and `get_artifact_relationships`.
115117
"""
116118
return await _chat_impl(
117119
ctx,

0 commit comments

Comments
 (0)