Codebase intelligence for AI and humans: code health scores, auto-generated docs, git analytics, dead code detection, and architectural decisions via MCP.
Python aicode-complexitycode-healthcode-intelligencecode-qualitydead-codedeveloper-toolsdocumentationgit-analyticsmcpopen-sourcepythonrefactoringstatic-analysistechnical-debt
chore(mcp): remove redundant MCP tools and reconcile tool-count docs (#519)
Raghav Chamadiyac3b5e30cb24c
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.mdindex 825124d1c..506ecb28b 100644--- a/docs/CHANGELOG.md+++ b/docs/CHANGELOG.md@@ -11,6 +11,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0## [Unreleased]+### Changed+- **Consolidated the MCP tool surface.** Removed six redundant MCP tools (`annotate_file`, `get_callers_callees`, `get_community`, `get_graph_metrics`, `get_architecture_diagram`, `update_decision_records`) whose capabilities are already covered by `get_context(include=[...])` and `get_why`. The MCP server exposes 13 tools: 10 in single-repo mode plus three workspace-only tools (`get_blast_radius`, `get_conformance`, `get_architecture`). Documentation and tool counts across the project were reconciled to match.+---## [0.20.0] — 2026-06-16diff --git a/docs/COMPUTED_GLOSSARY.md b/docs/COMPUTED_GLOSSARY.mdindex 52c05b179..8c21e0099 100644--- a/docs/COMPUTED_GLOSSARY.md+++ b/docs/COMPUTED_GLOSSARY.md@@ -367,14 +367,8 @@ workspace overlays, MCP responses, and CLI output.| `get_risk` | Per-file risk, trend, risk type, owners, co-change partners, test gaps, security signals, top hotspots, optional PR blast radius. | `{results: [{risk_summary, hotspot_score}], top_hotspots: [...]}` || `get_dead_code` | Tiered, grouped, and summarized dead-code findings. | `{summary: {total_findings: 12}, tiers: {...}}` || `get_dependency_path` | Dependency-path or bridge context between files/symbols. | `{path: ["src/a.py", "src/b.py"]}` |-| `get_architecture_diagram` | Mermaid architecture diagram text. | `{mermaid_syntax: "graph TD\n..."}` |-| `update_decision_records` | Decision create/update/list/delete payloads. | `{status: "ok", decision: {...}}` || `get_symbol` | Exact symbol metadata and source slice. | `{name: "create_app", signature: "def create_app(...)"}` |-| `get_callers_callees` | Caller/callee neighborhood for a symbol. | `{callers: [...], callees: [...]}` |-| `get_graph_metrics` | Centrality percentiles, community, entry-point score, and graph metrics for a node. | `{pagerank_percentile: 92, community_label: "api"}` |-| `get_community` | Community details, cohesion, members, and neighboring communities. | `{label: "auth", cohesion: 0.21, members: [...]}` || `get_execution_flows` | Entry-point traces through call edges. | `{flows: [{entry_point, trace, crosses_community}]}` |-| `annotate_file` | Persistent human notes on a wiki page. | `{status: "ok", human_notes: "Watch migration path."}` || Blast radius API | Direct risks, transitive affected files, co-change warnings, reviewers, test gaps, overall score. | `{overall_risk_score: 7.25}` || Knowledge map API | Top owners, knowledge silos, onboarding targets. | `{top_owners: [...], knowledge_silos: [...]}` || Cost summary API | Grouped costs and totals. | `{groups: [...], total_cost_usd: 3.21}` |diff --git a/docs/architecture/ARCHITECTURE.md b/docs/architecture/ARCHITECTURE.mdindex 7970cbda8..fa49b0e9e 100644--- a/docs/architecture/ARCHITECTURE.md+++ b/docs/architecture/ARCHITECTURE.md@@ -1048,7 +1048,7 @@ and supports two transports:- **stdio** — for Claude Code, Cursor, Cline (add to their MCP config)- **SSE** — for web-based MCP clients (served on port 7338)-### Tools (11 total)+### Tools (9 total)| Tool | What it answers | When to call ||------|----------------|-------------|@@ -1056,14 +1056,11 @@ and supports two transports:| `get_context(targets, include?)` | Docs, ownership, history, decisions, freshness for files/modules/symbols. Pass multiple targets in one call. | When you need to understand specific code before reading or modifying it. || `get_risk(targets)` | Hotspot score, dependents, co-change partners, risk summary per target. Also returns top 5 global hotspots. | Before modifying files — assess what could break. || `get_why(query?)` | Three modes: NL search over decisions, path-based decisions for a file, no-arg health dashboard. | Before making architectural changes — understand existing intent. |-| `update_decision_records(action, ...)` | Full CRUD on decision records: create, update, update_status, delete, list, get. | After every coding task — record new decisions and keep existing ones current. || `search_codebase(query)` | Semantic search over the full wiki. Natural language. | When you don't know where something lives. || `get_dependency_path(from, to)` | Connection path between two files/modules in the dependency graph. | When you need to understand how two things are connected. || `get_dead_code` | Dead/unused code findings sorted by confidence and cleanup impact. | Before cleanup tasks. |-| `get_architecture_diagram` | Mermaid diagram for repo or specific module. | For documentation or presentation. || `get_answer` | One-call RAG: confidence-gated synthesis with cited answers and question cache. | First call on any code question — collapses search → read → reason. || `get_symbol` | Resolve a qualified symbol id to source body, signature, and docstring. | When the question names a specific class, function, or method. |-| `annotate_file` | Attach human-authored notes to a wiki page — survives re-indexing. | Adding rationale, known issues, or context the LLM shouldn't overwrite. |### Auto-generated Configdiff --git a/docs/architecture/implementation-deep-dive.md b/docs/architecture/implementation-deep-dive.mdindex 449073c5a..55e34b82b 100644--- a/docs/architecture/implementation-deep-dive.md+++ b/docs/architecture/implementation-deep-dive.md@@ -930,7 +930,7 @@ Max 10 iterations per request. Streamed via SSE (Server-Sent Events).## 8. MCP Tools-MCP (Model Context Protocol) lets AI coding assistants (Claude Code, Cursor, Windsurf, Cline) call Repowise tools directly. There are 10 tools, each answering a specific question.+MCP (Model Context Protocol) lets AI coding assistants (Claude Code, Cursor, Windsurf, Cline) call Repowise tools directly. There are 13 tools (10 single-repo + 3 workspace-only), each answering a specific question. The most commonly used single-repo tools are described below.### Tool 1: `get_overview` — "What is this codebase?"@@ -1065,20 +1065,6 @@ co_change_signal: If no import link but frequent co-changes → logical coup**Supports rollup by directory or owner** — so you can say "show me all dead code owned by Alice in the payments/ directory."-### Tool 8: `get_architecture_diagram` — "Show me the structure"--**When to use:** Getting a visual understanding of the codebase architecture.--**Three scopes:**--| Scope | What you get |-|-------|-------------|-| `"repo"` | Full architecture diagram (from pre-generated page) |-| `"module"` | Subgraph of a specific module and its dependencies |-| `"file"` | Single file with its imports and importers |--Returns Mermaid syntax that renders as a flowchart in any Mermaid-compatible viewer.----## 9. Frontend (Web UI)diff --git a/packages/cli/src/repowise/cli/commands/mcp_cmd.py b/packages/cli/src/repowise/cli/commands/mcp_cmd.pyindex c2af690ae..ab96ed6ff 100644--- a/packages/cli/src/repowise/cli/commands/mcp_cmd.py+++ b/packages/cli/src/repowise/cli/commands/mcp_cmd.py@@ -87,9 +87,10 @@ def _print_network_startup(def mcp_command(path: str | None, transport: str, port: int) -> None:"""Start the MCP server for editor integration.- Exposes 17 tools for querying the repowise wiki via the MCP protocol.- Supports stdio (for Claude Code, Codex, Cursor, Cline), streamable HTTP,- and legacy SSE transports.+ Exposes 13 tools for querying the repowise wiki via the MCP protocol+ (ten in single-repo mode, plus three workspace-only tools in workspace+ mode). Supports stdio (for Claude Code, Codex, Cursor, Cline), streamable+ HTTP, and legacy SSE transports.Loads ``<repo>/.repowise/.env`` into the environment before starting sothat MCP tools (e.g. ``get_answer``) can resolve the configured LLMdiff --git a/packages/core/alembic/versions/0017_graph_query_indexes.py b/packages/core/alembic/versions/0017_graph_query_indexes.pyindex 78c856758..69af6e6b7 100644--- a/packages/core/alembic/versions/0017_graph_query_indexes.py+++ b/packages/core/alembic/versions/0017_graph_query_indexes.py@@ -1,7 +1,8 @@"""Add composite indexes for performant graph queries.-Indexes support the new MCP graph query tools (get_callers_callees,-get_community, get_graph_metrics, get_execution_flows) which filter+Indexes support graph queries used by get_context enrichment+(include=["callers", "callees", "community", "metrics"]), the+get_execution_flows traces, and the graph REST endpoints, which filterby (repo, node_type, community) and (repo, source/target, edge_type).Revision ID: 0017diff --git a/packages/core/src/repowise/core/generation/templates/agents_md.j2 b/packages/core/src/repowise/core/generation/templates/agents_md.j2index 06f1e9e6b..fc928dc11 100644--- a/packages/core/src/repowise/core/generation/templates/agents_md.j2+++ b/packages/core/src/repowise/core/generation/templates/agents_md.j2@@ -39,8 +39,7 @@ Last indexed: {{ data.indexed_at }}{% if data.indexed_commit %} (commit {{ data.- Risk: call `get_risk(targets=["path/to/file.py"])` before modifying shared utilities, public APIs, hotspots, high-coupling modules, or files with unknown dependents.- Why: call `get_why(query="...")` before architectural changes or when the user asks why code is structured a certain way.- Dead code: call `get_dead_code(safe_only=true)` before cleanup or removal work; treat lower-confidence findings as candidates to investigate.-- Connections: call `get_dependency_path(source="...", target="...")` when tracing how modules connect.-- Diagrams: call `get_architecture_diagram(scope="...")` when a visual structure would clarify the change.+- Connections: call `get_context(targets=["..."], include=["callers", "callees"])` when tracing how a symbol connects to the rest of the code.{% if data.build_commands %}### Commandsdiff --git a/packages/server/README.md b/packages/server/README.mdindex 857d59915..cfcaccab9 100644--- a/packages/server/README.md+++ b/packages/server/README.md@@ -232,7 +232,7 @@ Job progress events (`JobProgressEvent`) carry: `event` type, `file` currently b## MCP Server-repowise exposes 16 MCP tools for AI coding assistants. Start the MCP server via:+repowise exposes 10 MCP tools for AI coding assistants. Start the MCP server via:```bashrepowise mcp # stdio transport (Claude Code, Cursor, Cline)@@ -249,15 +249,9 @@ repowise mcp --transport sse # legacy SSE transport on port 7338| `search_codebase(query)` | Semantic search over full wiki | When you don't know where something lives || `get_dependency_path(from, to)` | Connection path between two files/modules | When you need to understand how two things are connected || `get_dead_code` | Unused/unreachable code sorted by cleanup impact | Before cleanup tasks |-| `get_architecture_diagram` | Mermaid diagram for repo or module | For documentation or presentation || `get_answer(question)` | One-call RAG with confidence gating and caching | First call on any code question || `get_symbol(symbol_id)` | Source body, signature, docstring for a qualified symbol | When the question names a specific function or class |-| `annotate_file(target, notes)` | Attach human-authored notes to a wiki page | Adding context that survives re-indexing |-| `get_callers_callees(symbol_id)` | Callers, callees, and class hierarchy (extends/implements) | Understanding call relationships for any symbol |-| `get_community(target)` | Community membership, cohesion, neighboring communities | Understanding module boundaries and refactoring safety |-| `get_graph_metrics(target)` | PageRank/betweenness percentiles, degree, community label | Assessing file or symbol importance in the graph || `get_execution_flows(top_n?)` | Entry point scoring with BFS call-path traces | Understanding how the codebase executes |-| `update_decision_records(action)` | Create, update, list, or deprecate decision records | After architectural changes |**Claude Code / Cursor / Cline setup** — add to your MCP config:diff --git a/packages/server/src/repowise/server/mcp_server/__init__.py b/packages/server/src/repowise/server/mcp_server/__init__.pyindex 7e95dfafa..72fb7c597 100644--- a/packages/server/src/repowise/server/mcp_server/__init__.py+++ b/packages/server/src/repowise/server/mcp_server/__init__.py@@ -1,4 +1,9 @@-"""repowise MCP Server — 19 tools for AI coding assistants.+"""repowise MCP Server — 13 tools for AI coding assistants.++Ten tools are available in single-repo mode (get_answer, get_context,+get_symbol, search_codebase, get_overview, get_risk, get_why, get_dead_code,+get_health, list_repos); three more (get_blast_radius, get_conformance,+get_architecture) are workspace-only.Exposes the full repowise wiki as queryable tools via the MCP protocol.Supports stdio transport (Claude Code, Cursor, Cline), streamable HTTP, anddiff --git a/packages/server/src/repowise/server/mcp_server/tool_annotate.py b/packages/server/src/repowise/server/mcp_server/tool_annotate.pydeleted file mode 100644index 383035813..000000000--- a/packages/server/src/repowise/server/mcp_server/tool_annotate.py+++ /dev/null@@ -1,76 +0,0 @@-"""``annotate_file`` — attach human notes to a wiki page.--Notes survive LLM-driven re-generation and appear in ``get_context`` responses.-"""--from __future__ import annotations--from typing import Any--from sqlalchemy import select--from repowise.core.persistence.database import get_session-from repowise.server.mcp_server._helpers import (- _get_exclude_spec,- _get_repo,- _resolve_repo_context,- _unsupported_repo_all,- is_excluded,-)-from repowise.core.registry import mcp_tool_registry as mcp---async def annotate_file(- target: str,- notes: str,- repo: str | None = None,-) -> dict[str, Any]:- """Attach human-authored notes to a file's wiki page.-- Notes persist across re-indexing — use them for rationale, known issues,- or context that the LLM shouldn't overwrite. Pass an empty string to- clear existing notes.-- Args:- target: file path (e.g. "src/auth/service.py").- notes: the note text to attach (empty string to clear).- repo: repository identifier; usually omitted.- """- if repo == "all":- return _unsupported_repo_all("annotate_file")- ctx = await _resolve_repo_context(repo)- if is_excluded(target, _get_exclude_spec(ctx.path)):- return {"target": target, "error": f"'{target}' is excluded by exclude_patterns."}-- from repowise.core.persistence.models import Page-- async with get_session(ctx.session_factory) as session:- await _get_repo(session) # validates repo exists-- # Try file_page first, then module_page- page_id = f"file_page:{target}"- result = await session.execute(select(Page).where(Page.id == page_id))- page = result.scalar_one_or_none()-- if page is None:- page_id = f"module_page:{target}"- result = await session.execute(select(Page).where(Page.id == page_id))- page = result.scalar_one_or_none()-- if page is None:- return {- "status": "error",- "message": f"No wiki page found for '{target}'. Run 'repowise init' first.",- }-- page.human_notes = notes if notes else None- await session.flush()-- action = "cleared" if not notes else "updated"- return {- "status": "ok",- "target": target,- "action": action,- "human_notes": page.human_notes,- }diff --git a/packages/server/src/repowise/server/mcp_server/tool_callers.py b/packages/server/src/repowise/server/mcp_server/tool_callers.pydeleted file mode 100644index eb5e47054..000000000--- a/packages/server/src/repowise/server/mcp_server/tool_callers.py+++ /dev/null@@ -1,234 +0,0 @@-"""MCP Tool: get_callers_callees — find who calls a symbol and what it calls.--Provides symbol-level call graph navigation for AI coding assistants.-Supports call edges, heritage edges (extends/implements), and any other-edge type stored in the graph. Heritage queries use the same code path-via the ``edge_types`` parameter — no separate tool needed.--Resolution strategy:- 1. Exact match on GraphNode.node_id (the canonical "{path}::{name}" key)- 2. Fuzzy match on GraphNode.name column (bare name, e.g. "verify_token")-"""--from __future__ import annotations--import json-import time-from typing import Any--from sqlalchemy import select--from repowise.core.persistence.crud import (- get_graph_edges_for_node,- get_graph_node,- get_graph_nodes_by_ids,-)-from repowise.core.persistence.database import get_session-from repowise.core.persistence.models import GraphNode-from repowise.server.mcp_server._helpers import (- _get_exclude_spec,- _get_repo,- _resolve_repo_context,- _unsupported_repo_all,- filter_dicts_by_key,- is_excluded,-)-from repowise.server.mcp_server._meta import build_meta as _build_meta-from repowise.core.registry import mcp_tool_registry as mcp--_DEFAULT_EDGE_TYPES = ["calls"]---async def _resolve_symbol_node(- session: Any, repo_id: str, symbol_id: str-) -> GraphNode | None:- """Resolve a symbol ID to a GraphNode, with fuzzy fallback."""- # 1. Exact match- node = await get_graph_node(session, repo_id, symbol_id)- if node and node.node_type == "symbol":- return node-- # 2. Fuzzy: extract bare name and search- bare_name = symbol_id- if "::" in symbol_id:- bare_name = symbol_id.split("::")[-1]- # Try matching by the name column- result = await session.execute(- select(GraphNode).where(- GraphNode.repository_id == repo_id,- GraphNode.node_type == "symbol",- GraphNode.name == bare_name,- )- )- rows = list(result.scalars().all())- if not rows:- return None-- # If the symbol_id contains a file path hint, prefer matching file- if "::" in symbol_id:- file_hint = symbol_id.split("::")[0]- for r in rows:- if r.file_path == file_hint:- return r-- # Return the first match (deterministic: lowest node_id)- rows.sort(key=lambda r: r.node_id)- return rows[0]---def _node_summary(node: GraphNode) -> dict[str, Any]:- """Build a compact summary dict for a graph node."""- out: dict[str, Any] = {- "symbol_id": node.node_id,- "name": node.name or node.node_id,- "kind": node.kind,- "file": node.file_path or node.node_id,- }- if node.start_line is not None:- out["start_line"] = node.start_line- if node.signature:- out["signature"] = node.signature- return out---async def get_callers_callees(- symbol_id: str,- direction: str = "both",- edge_types: list[str] | None = None,- limit: int = 20,- repo: str | None = None,-) -> dict:- """Find who calls a symbol and what it calls. Also works for class hierarchy.-- Use direction="callers" to find what calls/extends this symbol.- Use edge_types=["extends","implements"] for class hierarchy queries.- Default edge_types is ["calls"].-- Args:- symbol_id: "path/to/file.py::FunctionName" format from get_context.- direction: "callers", "callees", or "both".- edge_types: Filter by edge type. Default ["calls"].- limit: Max results per direction (default 20).- repo: Usually omitted.- """- if repo == "all":- return _unsupported_repo_all("get_callers_callees")- ctx = await _resolve_repo_context(repo)-- t0 = time.perf_counter()- if not symbol_id or not symbol_id.strip():- return {- "symbol_id": symbol_id,- "error": "symbol_id is required",- "_meta": _build_meta(timing_ms=(time.perf_counter() - t0) * 1000),- }-- if edge_types is None:- edge_types = _DEFAULT_EDGE_TYPES-- if direction not in ("callers", "callees", "both"):- direction = "both"-- async with get_session(ctx.session_factory) as session:- repository = await _get_repo(session)- repo_id = repository.id-- # Resolve symbol- exclude_spec = _get_exclude_spec(ctx.path)- node = await _resolve_symbol_node(session, repo_id, symbol_id)- node_path = node.node_id if node and node.node_type == "file" else getattr(node, "file_path", None)- if node is None or is_excluded(node_path, exclude_spec):- return {- "symbol_id": symbol_id,- "error": (- f"Symbol not found in graph: {symbol_id!r}. Use get_context "- "to list available symbols, then try with the exact "- "symbol_id from that response."- ),- "_meta": _build_meta(timing_ms=(time.perf_counter() - t0) * 1000),- }-- # Map direction to CRUD direction param- crud_direction = direction- if direction == "both":- crud_direction = "both"-- edges = await get_graph_edges_for_node(- session,- repo_id,- node.node_id,- direction=crud_direction,- edge_types=edge_types,- limit=limit,- )-- # Collect node IDs to hydrate- other_ids: list[str] = []- for e in edges:- if e.source_node_id != node.node_id:- other_ids.append(e.source_node_id)- if e.target_node_id != node.node_id:- other_ids.append(e.target_node_id)-- node_map = await get_graph_nodes_by_ids(session, repo_id, list(set(other_ids)))-- # Build caller/callee lists- callers: list[dict[str, Any]] = []- callees: list[dict[str, Any]] = []-- for e in edges:- is_caller = e.target_node_id == node.node_id- other_id = e.source_node_id if is_caller else e.target_node_id- other_node = node_map.get(other_id)-- entry: dict[str, Any] = {- "symbol_id": other_id,- "name": other_node.name if other_node else other_id.split("::")[-1] if "::" in other_id else other_id,- "kind": other_node.kind if other_node else None,- "file": other_node.file_path if other_node else (other_id.split("::")[0] if "::" in other_id else other_id),- "confidence": e.confidence,- "edge_type": e.edge_type,- }- if other_node and other_node.start_line is not None:- entry["start_line"] = other_node.start_line-- if is_caller:- callers.append(entry)- else:- callees.append(entry)-- # Drop callers/callees that live in excluded files.- callers = filter_dicts_by_key(callers, "file", exclude_spec)- callees = filter_dicts_by_key(callees, "file", exclude_spec)-- # Sort by confidence DESC, then by name- callers.sort(key=lambda x: (-x.get("confidence", 0), x.get("name", "")))- callees.sort(key=lambda x: (-x.get("confidence", 0), x.get("name", "")))-- result: dict[str, Any] = {- "symbol_id": node.node_id,- "symbol": _node_summary(node),- }-- if direction in ("callers", "both"):- result["callers"] = callers- result["caller_count"] = len(callers)- if direction in ("callees", "both"):- result["callees"] = callees- result["callee_count"] = len(callees)-- truncated = (- (direction in ("callers", "both") and len(callers) >= limit)- or (direction in ("callees", "both") and len(callees) >= limit)- )- result["truncated"] = truncated-- hint = None- if callers or callees:- hint = "Use get_symbol(symbol_id) to read the source of any caller/callee."- result["_meta"] = _build_meta(- timing_ms=(time.perf_counter() - t0) * 1000,- hint=hint,- )- return resultdiff --git a/packages/server/src/repowise/server/mcp_server/tool_community.py b/packages/server/src/repowise/server/mcp_server/tool_community.pydeleted file mode 100644index baa6ecd9e..000000000--- a/packages/server/src/repowise/server/mcp_server/tool_community.py+++ /dev/null@@ -1,183 +0,0 @@-"""MCP Tool: get_community — explore architectural communities/clusters.--Returns the community a file belongs to, its members, cohesion score,-label, and neighboring communities. Helps Claude Code understand module-boundaries, refactoring safety, and architectural coupling.-"""--from __future__ import annotations--import json-import time-from typing import Any--from repowise.core.persistence.crud import (- get_community_members,- get_cross_community_edges,- get_graph_node,-)-from repowise.core.persistence.database import get_session-from repowise.core.persistence.models import GraphNode-from repowise.server.mcp_server._helpers import (- _get_exclude_spec,- _get_repo,- _resolve_repo_context,- _unsupported_repo_all,- filter_graph_nodes,-)-from repowise.server.mcp_server._meta import build_meta as _build_meta-from repowise.core.registry import mcp_tool_registry as mcp---def _parse_community_meta(node: GraphNode) -> dict[str, Any]:- """Extract label and cohesion from community_meta_json."""- try:- meta = json.loads(node.community_meta_json or "{}")- except (json.JSONDecodeError, TypeError):- meta = {}- return meta---async def get_community(- target: str,- include_members: bool = True,- member_limit: int = 30,- repo: str | None = None,-) -> dict:- """Show the architectural community/cluster a file belongs to.-- Returns community label, cohesion score, members, and neighboring- communities. Useful for understanding module boundaries and- refactoring safety.-- Args:- target: File path (resolves to its community) or community ID (e.g. "3").- include_members: Include member file list (default true).- member_limit: Max members to return (default 30).- repo: Usually omitted.- """- if repo == "all":- return _unsupported_repo_all("get_community")- ctx = await _resolve_repo_context(repo)-- t0 = time.perf_counter()- if not target or not target.strip():- return {- "target": target,- "error": "target is required",- "_meta": _build_meta(timing_ms=(time.perf_counter() - t0) * 1000),- }-- async with get_session(ctx.session_factory) as session:- repository = await _get_repo(session)- repo_id = repository.id-- community_id: int | None = None- label: str = ""- cohesion: float = 0.0-- # Resolve target to community_id- if target.strip().isdigit():- community_id = int(target.strip())- else:- node = await get_graph_node(session, repo_id, target)- if node is None:- return {- "target": target,- "error": f"Node not found in graph: {target!r}. Check the file path.",- "_meta": _build_meta(timing_ms=(time.perf_counter() - t0) * 1000),- }- community_id = node.community_id- meta = _parse_community_meta(node)- label = meta.get("label", "")- cohesion = meta.get("cohesion", 0.0)-- if community_id is None:- return {- "target": target,- "error": "Could not resolve community ID",- "_meta": _build_meta(timing_ms=(time.perf_counter() - t0) * 1000),- }-- # Get members- members_list: list[dict[str, Any]] = []- member_count = 0- if include_members:- members = filter_graph_nodes(- list(- await get_community_members(- session, repo_id, community_id, limit=member_limit- )- ),- _get_exclude_spec(ctx.path),- )- member_count = len(members)- for m in members:- entry: dict[str, Any] = {- "path": m.node_id,- "pagerank": round(m.pagerank, 6) if m.pagerank else 0.0,- "is_entry_point": m.is_entry_point,- }- members_list.append(entry)-- # If we haven't found label/cohesion yet (target was a community ID),- # grab it from the first member- if not label:- meta = _parse_community_meta(m)- label = meta.get("label", "")- cohesion = meta.get("cohesion", 0.0)- else:- # Still need count- members = await get_community_members(- session, repo_id, community_id, limit=1000- )- member_count = len(members)- if not label and members:- meta = _parse_community_meta(members[0])- label = meta.get("label", "")- cohesion = meta.get("cohesion", 0.0)-- # Get neighboring communities- cross_edges = await get_cross_community_edges(session, repo_id, community_id)-- # Resolve labels for neighbor communities from any member node- neighbor_communities: list[dict[str, Any]] = []- for ce in cross_edges[:10]: # cap at 10 neighbors- neighbor_id = ce["target_community_id"]- # Get one member to read the label- neighbor_members = await get_community_members(- session, repo_id, neighbor_id, limit=1- )- neighbor_label = ""- if neighbor_members:- nmeta = _parse_community_meta(neighbor_members[0])- neighbor_label = nmeta.get("label", "")- neighbor_communities.append({- "community_id": neighbor_id,- "label": neighbor_label,- "cross_edge_count": ce["edge_count"],- })-- result: dict[str, Any] = {- "target": target,- "community_id": community_id,- "label": label or f"cluster_{community_id}",- "cohesion": round(cohesion, 3),- "member_count": member_count,- }-- if include_members:- result["members"] = members_list- result["truncated"] = member_count >= member_limit-- result["neighboring_communities"] = neighbor_communities-- hint = None- if neighbor_communities:- hint = "Use get_callers_callees on key symbols to understand cross-community coupling."- result["_meta"] = _build_meta(- timing_ms=(time.perf_counter() - t0) * 1000,- hint=hint,- )- return resultdiff --git a/packages/server/src/repowise/server/mcp_server/tool_decision_records.py b/packages/server/src/repowise/server/mcp_server/tool_decision_records.pydeleted file mode 100644index 9b06ffabc..000000000--- a/packages/server/src/repowise/server/mcp_server/tool_decision_records.py+++ /dev/null@@ -1,251 +0,0 @@-"""MCP Tool 9: update_decision_records — CRUD operations on architectural decision records."""--from __future__ import annotations--import json-from typing import Any--from repowise.core.persistence import crud-from repowise.core.persistence.database import get_session-from repowise.core.persistence.models import DecisionRecord-from repowise.server.mcp_server._helpers import (- _get_exclude_spec,- _get_repo,- _resolve_repo_context,- _unsupported_repo_all,- filter_path_list,- is_excluded,-)-from repowise.core.registry import mcp_tool_registry as mcp--_VALID_ACTIONS = frozenset({"create", "update", "update_status", "delete", "list", "get"})---def _serialize_decision(rec: DecisionRecord, spec: Any = None) -> dict[str, Any]:- """Convert a DecisionRecord ORM object to a plain dict.-- When *spec* is given, affected_files / evidence_file pointing at excluded- files are dropped so excluded paths never surface in query results.- """- evidence_file = None if is_excluded(rec.evidence_file, spec) else rec.evidence_file- return {- "id": rec.id,- "repository_id": rec.repository_id,- "title": rec.title,- "status": rec.status,- "context": rec.context,- "decision": rec.decision,- "rationale": rec.rationale,- "alternatives": json.loads(rec.alternatives_json),- "consequences": json.loads(rec.consequences_json),- "affected_files": filter_path_list(json.loads(rec.affected_files_json), spec),- "affected_modules": json.loads(rec.affected_modules_json),- "tags": json.loads(rec.tags_json),- "source": rec.source,- "evidence_file": evidence_file,- "confidence": rec.confidence,- "staleness_score": rec.staleness_score,- "superseded_by": rec.superseded_by,- "created_at": rec.created_at.isoformat() if rec.created_at else None,- "updated_at": rec.updated_at.isoformat() if rec.updated_at else None,- }---async def update_decision_records(- action: str,- repo: str | None = None,- # --- Identifier ---- decision_id: str | None = None,- # --- Content fields (for create / update) ---- title: str | None = None,- status: str | None = None,- context: str | None = None,- decision: str | None = None,- rationale: str | None = None,- alternatives: list[str] | None = None,- consequences: list[str] | None = None,- affected_files: list[str] | None = None,- affected_modules: list[str] | None = None,- tags: list[str] | None = None,- # --- Status change ---- superseded_by: str | None = None,- # --- List filters ---- filter_status: str | None = None,- filter_source: str | None = None,- filter_tag: str | None = None,- filter_module: str | None = None,- include_proposed: bool = True,- limit: int = 50,- offset: int = 0,-) -> dict:- """Create, update, or manage architectural decision records.-- Six actions:- 1. create — Record a new decision. Requires `title`. Optional: context,- decision, rationale, alternatives, consequences, affected_files,- affected_modules, tags, status (defaults to "proposed").- 2. update — Update content fields of an existing decision by `decision_id`.- Pass only the fields you want to change.- 3. update_status — Change the status of a decision. Requires `decision_id`- and `status` (proposed | active | deprecated | superseded).- Optionally pass `superseded_by` with the ID of the replacement decision.- 4. delete — Remove a decision by `decision_id`.- 5. list — List decisions. Optional filters: filter_status, filter_source,- filter_tag, filter_module, include_proposed, limit, offset.- 6. get — Get a single decision by `decision_id`.-- Always call this after making architectural changes to keep decision records- current. Use action="create" to record new decisions and action="update" to- refine existing ones.-- Args:- action: One of: create, update, update_status, delete, list, get.- repo: Repository path, name, or ID.- decision_id: Required for get, update, update_status, delete.- title: Decision title (required for create).- status: Decision status (for create defaults to "proposed").- context: What forced this decision.- decision: What was chosen.- rationale: Why this was chosen.- alternatives: Rejected alternatives.- consequences: Tradeoffs / consequences.- affected_files: File paths affected by this decision.- affected_modules: Module paths affected.- tags: Category tags (e.g. auth, database, api, performance).- superseded_by: ID of the replacement decision (for update_status).- filter_status: Filter list by status.- filter_source: Filter list by source.- filter_tag: Filter list by tag.- filter_module: Filter list by module.- include_proposed: Include proposed decisions in list (default True).- limit: Max results for list (default 50).- offset: Offset for list pagination.- """- if repo == "all":- return _unsupported_repo_all("update_decision_records")- ctx = await _resolve_repo_context(repo)- exclude_spec = _get_exclude_spec(ctx.path)-- if action not in _VALID_ACTIONS:- return {- "error": f"Unknown action {action!r}. Valid actions: {', '.join(sorted(_VALID_ACTIONS))}"- }-- # --- create ---- if action == "create":- if not title:- return {"error": "action 'create' requires 'title'"}- async with get_session(ctx.session_factory) as session:- repository = await _get_repo(session)- rec = await crud.upsert_decision(- session,- repository_id=repository.id,- title=title,- status=status or "proposed",- context=context or "",- decision=decision or "",- rationale=rationale or "",- alternatives=alternatives,- consequences=consequences,- affected_files=affected_files,- affected_modules=affected_modules,- tags=tags,- source="mcp_tool",- confidence=1.0,- )- return {"action": "created", "decision": _serialize_decision(rec)}-- # --- get ---- if action == "get":- if not decision_id:- return {"error": "action 'get' requires 'decision_id'"}- async with get_session(ctx.session_factory) as session:- rec = await crud.get_decision(session, decision_id)- if rec is None:- return {"error": f"Decision {decision_id} not found"}- return {"action": "get", "decision": _serialize_decision(rec, exclude_spec)}-- # --- list ---- if action == "list":- async with get_session(ctx.session_factory) as session:- repository = await _get_repo(session)- decisions = await crud.list_decisions(- session,- repository.id,- status=filter_status,- source=filter_source,- tag=filter_tag,- module=filter_module,- include_proposed=include_proposed,- limit=limit,- offset=offset,- )- return {- "action": "list",- "count": len(decisions),- "decisions": [_serialize_decision(d, exclude_spec) for d in decisions],- }-- # --- update ---- if action == "update":- if not decision_id:- return {"error": "action 'update' requires 'decision_id'"}- fields: dict[str, Any] = {}- if title is not None:- fields["title"] = title- if context is not None:- fields["context"] = context- if decision is not None:- fields["decision"] = decision- if rationale is not None:- fields["rationale"] = rationale- if alternatives is not None:- fields["alternatives"] = alternatives- if consequences is not None:- fields["consequences"] = consequences- if affected_files is not None:- fields["affected_files"] = affected_files- if affected_modules is not None:- fields["affected_modules"] = affected_modules- if tags is not None:- fields["tags"] = tags- if not fields:- return {"error": "action 'update' requires at least one field to change"}- async with get_session(ctx.session_factory) as session:- rec = await crud.update_decision_by_id(session, decision_id, **fields)- if rec is None:- return {"error": f"Decision {decision_id} not found"}- return {"action": "updated", "decision": _serialize_decision(rec)}-- # --- update_status ---- if action == "update_status":- if not decision_id:- return {"error": "action 'update_status' requires 'decision_id'"}- if not status:- return {"error": "action 'update_status' requires 'status'"}- async with get_session(ctx.session_factory) as session:- try:- rec = await crud.update_decision_status(- session,- decision_id,- status,- superseded_by=superseded_by,- )- except ValueError as exc:- return {"error": str(exc)}- if rec is None:- return {"error": f"Decision {decision_id} not found"}- return {"action": "status_updated", "decision": _serialize_decision(rec)}-- # --- delete ---- if action == "delete":- if not decision_id:- return {"error": "action 'delete' requires 'decision_id'"}- async with get_session(ctx.session_factory) as session:- deleted = await crud.delete_decision(session, decision_id)- if not deleted:- return {"error": f"Decision {decision_id} not found"}- return {"action": "deleted", "decision_id": decision_id}-- return {"error": f"Unhandled action {action!r}"}diff --git a/packages/server/src/repowise/server/mcp_server/tool_diagram.py b/packages/server/src/repowise/server/mcp_server/tool_diagram.pydeleted file mode 100644index e3028d3f8..000000000--- a/packages/server/src/repowise/server/mcp_server/tool_diagram.py+++ /dev/null@@ -1,221 +0,0 @@-"""MCP Tool 8: get_architecture_diagram — Mermaid diagram generation."""--from __future__ import annotations--import re--from sqlalchemy import select--from repowise.core.persistence.database import get_session-from repowise.core.persistence.models import (- GitMetadata,- GraphEdge,- GraphNode,- Page,-)-from repowise.server.mcp_server._helpers import (- _get_exclude_spec,- _get_repo,- _resolve_repo_context,- _unsupported_repo_all,- filter_graph_nodes,-)-from repowise.core.registry import mcp_tool_registry as mcp---def _sanitize_mermaid_id(node_id: str) -> str:- """Replace all non-alphanumeric/non-underscore chars with underscore."""- return re.sub(r"[^a-zA-Z0-9_]", "_", node_id)---def _short_label(node_id: str) -> str:- """Shorten a full path to at most parent/filename for readable diagram labels.-- ``packages/core/src/repowise/core/persistence/models.py``- → ``persistence/models.py``- """- parts = node_id.replace("\\", "/").split("/")- if len(parts) >= 2:- return "/".join(parts[-2:])- return parts[-1]---async def get_architecture_diagram(- scope: str = "repo",- path: str | None = None,- diagram_type: str = "auto",- show_heat: bool = False,- repo: str | None = None,-) -> dict:- """Get a Mermaid diagram for the codebase or a specific module.-- Args:- scope: "repo", "module", or "file".- path: Module or file path (required for module/file scope).- diagram_type: "auto", "flowchart", "class", or "sequence".- show_heat: Annotate nodes with churn heat colors (red=hot, yellow=warm, green=cold).- repo: Repository path, name, or ID.- """- if repo == "all":- return _unsupported_repo_all("get_architecture_diagram")- ctx = await _resolve_repo_context(repo)-- async with get_session(ctx.session_factory) as session:- repository = await _get_repo(session)-- if scope == "repo":- # Return the architecture diagram page- result = await session.execute(- select(Page).where(- Page.repository_id == repository.id,- Page.page_type == "architecture_diagram",- )- )- page = result.scalar_one_or_none()- if page:- return {- "diagram_type": diagram_type if diagram_type != "auto" else "flowchart",- "mermaid_syntax": page.content,- "description": page.title,- }-- # For module/file scope or fallback, build diagram from graph- filter_prefix = path or ""-- result = await session.execute(- select(GraphNode).where(- GraphNode.repository_id == repository.id,- GraphNode.node_id.like(f"{filter_prefix}%")- if filter_prefix- else GraphNode.repository_id == repository.id,- )- )- nodes = filter_graph_nodes(list(result.scalars().all()), _get_exclude_spec(ctx.path))-- result = await session.execute(- select(GraphEdge).where(- GraphEdge.repository_id == repository.id,- )- )- edges = result.scalars().all()-- node_ids = {n.node_id for n in nodes}- pr_map = {n.node_id: n.pagerank for n in nodes}- # Keep only edges whose BOTH endpoints survived exclude filtering — an- # edge with one surviving endpoint would still render the excluded one.- relevant_edges = sorted(- [e for e in edges if e.source_node_id in node_ids and e.target_node_id in node_ids],- key=lambda e: pr_map.get(e.source_node_id, 0.0),- reverse=True,- )-- # Load git churn data for heat map- churn_map: dict[str, float] = {}- if show_heat:- git_res = await session.execute(- select(GitMetadata.file_path, GitMetadata.churn_percentile).where(- GitMetadata.repository_id == repository.id,- )- )- churn_map = {row[0]: row[1] for row in git_res.all()}-- # Build Mermaid flowchart- lines = ["graph TD"]- seen_nodes: set[str] = set()- node_classes: dict[str, str] = {} # mermaid_id → class-- # For module-scoped diagrams, clip cross-boundary nodes to a single- # "[external]" stub so the diagram stays focused on the target module.- external_id = "external_deps"- _external_added = False-- for e in relevant_edges[:50]: # Limit to 50 edges for readability- src_id = e.source_node_id- tgt_id = e.target_node_id-- # Clip nodes outside the module boundary- src_external = bool(filter_prefix and not src_id.startswith(filter_prefix))- tgt_external = bool(filter_prefix and not tgt_id.startswith(filter_prefix))-- # Skip edges where both ends are external- if src_external and tgt_external:- continue-- if src_external:- src = external_id- src_label = "external"- else:- src = _sanitize_mermaid_id(src_id)- src_label = _short_label(src_id)-- if tgt_external:- tgt = external_id- tgt_label = "external"- else:- tgt = _sanitize_mermaid_id(tgt_id)- tgt_label = _short_label(tgt_id)-- # Skip self-loops created by clipping- if src == tgt:- continue-- if src not in seen_nodes:- if src == external_id:- if not _external_added:- lines.append(f' {external_id}[/"external"/]')- _external_added = True- node_classes[external_id] = "ext"- else:- lines.append(f' {src}["{src_label}"]')- if show_heat:- pct = churn_map.get(src_id, 0.0)- node_classes[src] = (- "hot" if pct >= 0.75 else ("warm" if pct >= 0.4 else "cold")- )- seen_nodes.add(src)-- if tgt not in seen_nodes:- if tgt == external_id:- if not _external_added:- lines.append(f' {external_id}[/"external"/]')- _external_added = True- node_classes[external_id] = "ext"- else:- lines.append(f' {tgt}["{tgt_label}"]')- if show_heat:- pct = churn_map.get(tgt_id, 0.0)- node_classes[tgt] = (- "hot" if pct >= 0.75 else ("warm" if pct >= 0.4 else "cold")- )- seen_nodes.add(tgt)-- # Differentiate arrow style by edge type- etype = getattr(e, "edge_type", None) or "imports"- if etype == "calls":- arrow = "-.->"- elif etype in ("extends", "implements"):- arrow = "--|>"- else:- arrow = "-->"- lines.append(f" {src} {arrow} {tgt}")-- # Apply heat + external classes- if node_classes:- for nid, cls in node_classes.items():- lines.append(f" class {nid} {cls}")- if show_heat:- lines.append(" classDef hot fill:#ff6b6b,color:#000")- lines.append(" classDef warm fill:#ffd93d,color:#000")- lines.append(" classDef cold fill:#6bcb77,color:#000")- if _external_added:- lines.append(" classDef ext fill:#ccc,stroke-dasharray:5 5,color:#666")-- mermaid = "\n".join(lines) if len(lines) > 1 else "graph TD\n A[No graph data available]"-- return {- "diagram_type": diagram_type if diagram_type != "auto" else "flowchart",- "mermaid_syntax": mermaid,- "description": f"Dependency graph for {scope}: {path or 'entire repo'}"- + (" (with churn heat map)" if show_heat else ""),- }diff --git a/packages/server/src/repowise/server/mcp_server/tool_metrics.py b/packages/server/src/repowise/server/mcp_server/tool_metrics.pydeleted file mode 100644index 999c34ef7..000000000--- a/packages/server/src/repowise/server/mcp_server/tool_metrics.py+++ /dev/null@@ -1,134 +0,0 @@-"""MCP Tool: get_graph_metrics — importance metrics for a file or symbol.--Returns PageRank, betweenness centrality, community info, degree counts,-and percentile ranks. Helps Claude Code assess how central/important a-file or symbol is in the dependency graph.-"""--from __future__ import annotations--import json-import time-from typing import Any--from repowise.core.persistence.crud import (- get_all_file_metrics,- get_graph_node,- get_node_degree_counts,-)-from repowise.core.persistence.database import get_session-from repowise.core.persistence.models import GraphNode-from repowise.server.mcp_server._helpers import (- _get_exclude_spec,- _get_repo,- _resolve_repo_context,- _unsupported_repo_all,- is_excluded,-)-from repowise.server.mcp_server._meta import build_meta as _build_meta-from repowise.core.registry import mcp_tool_registry as mcp---def _percentile_rank(value: float, all_values: list[float]) -> int:- """Compute percentile rank (0-100) of *value* within *all_values*."""- if not all_values:- return 0- count_below = sum(1 for v in all_values if v < value)- return round(100 * count_below / len(all_values))---async def get_graph_metrics(- target: str,- repo: str | None = None,-) -> dict:- """Get importance metrics for a file or symbol: PageRank, centrality, community.-- Returns raw scores plus percentile ranks across the repo. Helps assess- how central/important a file or symbol is in the dependency graph.-- Args:- target: File path (e.g. "src/auth/service.py") or symbol ID ("path::Name").- repo: Usually omitted.- """- if repo == "all":- return _unsupported_repo_all("get_graph_metrics")- ctx = await _resolve_repo_context(repo)-- t0 = time.perf_counter()- if not target or not target.strip():- return {- "target": target,- "error": "target is required",- "_meta": _build_meta(timing_ms=(time.perf_counter() - t0) * 1000),- }-- async with get_session(ctx.session_factory) as session:- repository = await _get_repo(session)- repo_id = repository.id-- # Try exact lookup first- node = await get_graph_node(session, repo_id, target)- node_path = node.node_id if node and node.node_type == "file" else getattr(node, "file_path", None)- if node is None or is_excluded(node_path, _get_exclude_spec(ctx.path)):- return {- "target": target,- "error": (- f"Node not found in graph: {target!r}. "- "Use get_context to find exact file paths or symbol IDs."- ),- "_meta": _build_meta(timing_ms=(time.perf_counter() - t0) * 1000),- }-- # Parse community metadata- try:- meta = json.loads(node.community_meta_json or "{}")- except (json.JSONDecodeError, TypeError):- meta = {}-- community_label = meta.get("label", "")- entry_point_score = meta.get("entry_point_score")-- # Degree counts- degrees = await get_node_degree_counts(session, repo_id, node.node_id)-- # Percentile computation — compare against same node_type peers- all_nodes = await get_all_file_metrics(session, repo_id)- pr_values = [n.pagerank for n in all_nodes if n.pagerank is not None]- bt_values = [n.betweenness for n in all_nodes if n.betweenness is not None]-- pr_pct = _percentile_rank(node.pagerank or 0.0, pr_values)- bt_pct = _percentile_rank(node.betweenness or 0.0, bt_values)-- result: dict[str, Any] = {- "target": node.node_id,- "node_type": node.node_type,- "pagerank": round(node.pagerank or 0.0, 6),- "pagerank_percentile": pr_pct,- "betweenness": round(node.betweenness or 0.0, 6),- "betweenness_percentile": bt_pct,- "community_id": node.community_id,- "community_label": community_label or None,- "is_entry_point": node.is_entry_point,- "in_degree": degrees["in_degree"],- "out_degree": degrees["out_degree"],- }-- if node.node_type == "symbol":- result["entry_point_score"] = (- round(entry_point_score, 3) if entry_point_score is not None else None- )- result["kind"] = node.kind- result["file"] = node.file_path-- hint = None- if node.node_type == "file" and node.community_id is not None:- hint = f"Use get_community('{node.node_id}') to see all community members."- elif node.node_type == "symbol":- hint = f"Use get_callers_callees('{node.node_id}') to explore call relationships."-- result["_meta"] = _build_meta(- timing_ms=(time.perf_counter() - t0) * 1000,- hint=hint,- )- return resultdiff --git a/plugins/claude-code/DEVELOPER.md b/plugins/claude-code/DEVELOPER.mdindex 3f98e3733..995402206 100644--- a/plugins/claude-code/DEVELOPER.md+++ b/plugins/claude-code/DEVELOPER.md@@ -140,8 +140,9 @@ The plugin version tracks the repowise release it ships alongside (e.g. `0.16.0`4. **Only `plugin.json` goes in `plugins/claude-code/.claude-plugin/`.** Everythingelse (`commands/`, `skills/`, `hooks/`) sits at the plugin root. The**marketplace** manifest lives at the **repo** root, not the plugin's.-5. **There are 9 exposed MCP tools.** `get_dependency_path` and- `get_architecture_diagram` exist in the server but are **not** exposed — never+5. **There are 13 exposed MCP tools** (10 single-repo, plus 3 workspace-only:+ `get_blast_radius`, `get_conformance`, `get_architecture`). `get_dependency_path`+ and `get_execution_flows` exist in the server but are **not** exposed — neverreference them in commands/skills.6. **Verify CLI flags against the source.** Easy ones to get wrong:`--index-only` (not `--no-llm`), `--concurrency` (not `--concurrent`),diff --git a/plugins/codex/skills/codebase-exploration/SKILL.md b/plugins/codex/skills/codebase-exploration/SKILL.mdindex 22fc1b759..81ab3d80d 100644--- a/plugins/codex/skills/codebase-exploration/SKILL.md+++ b/plugins/codex/skills/codebase-exploration/SKILL.md@@ -19,11 +19,7 @@ Call `get_overview()` first. It returns the architecture summary, module map, en## Understanding Connections Between Modules-Call `get_dependency_path(source="module_a", target="module_b")` when the user asks how two areas connect.--## Getting Diagrams--Call `get_architecture_diagram(scope="module", path="path/to/module")` for a subsystem diagram, or `get_architecture_diagram()` for the full repository.+Call `get_context(targets=["path/or/symbol"], include=["callers", "callees"])` when the user asks how two areas connect, then follow the callers and callees it returns.## Error Handlingdiff --git a/tests/integration/test_mcp.py b/tests/integration/test_mcp.pyindex 1e7fb97b9..223d755d0 100644--- a/tests/integration/test_mcp.py+++ b/tests/integration/test_mcp.py@@ -352,8 +352,7 @@ async def test_mcp_full_exploration_flow(mcp_env):overview = await get_overview()assert "Sample Project" in overview["content_md"]assert len(overview["key_modules"]) == 2- # `architecture_diagram_mermaid` was deliberately removed from get_overview- # — agents can request the diagram via get_architecture_diagram() instead.+ # `architecture_diagram_mermaid` is deliberately not part of get_overview.assert "architecture_diagram_mermaid" not in overview# Step 2: Drill into auth module via get_context.diff --git a/tests/unit/server/mcp/test_mcp_exclude_filter.py b/tests/unit/server/mcp/test_mcp_exclude_filter.pyindex 1443d01dc..f7e660245 100644--- a/tests/unit/server/mcp/test_mcp_exclude_filter.py+++ b/tests/unit/server/mcp/test_mcp_exclude_filter.py@@ -161,21 +161,6 @@ def _set_excluded(monkeypatch, tmp_path, pattern: str) -> None:monkeypatch.setattr(mcp_mod._state, "_repo_path", str(tmp_path))-async def test_diagram_excludes_node_and_its_edges(setup_mcp, tmp_path, monkeypatch):- """An excluded endpoint must not render even though it has a surviving- neighbor (service.py -> models.py edge)."""- from repowise.server.mcp_server.tool_diagram import get_architecture_diagram-- _set_excluded(monkeypatch, tmp_path, "src/db/")- # scope="module" forces the graph-computed path (scope="repo" returns a- # stored page that bypasses node/edge filtering).- result = await get_architecture_diagram(scope="module")- mermaid = result["mermaid_syntax"]- assert "src_db_models_py" not in mermaid # excluded endpoint not rendered- assert "src_auth_service_py" in mermaid # non-excluded node still present--@pytest.mark.asyncioasync def test_dependency_path_excludes_intermediate(setup_mcp, tmp_path, monkeypatch):"""middleware.py -> models.py only routes through service.py; excludingdiff --git a/website/concepts.md b/website/concepts.mdindex 715f7f570..4868b5866 100644--- a/website/concepts.md+++ b/website/concepts.md@@ -153,7 +153,7 @@ Stored at `.repowise/lancedb/`. You can rebuild it at any time with `repowise re### In-memory graph (NetworkX)-The dependency graph is loaded into memory at server startup for fast traversal. Used by `get_dependency_path`, `get_architecture_diagram`, and cascade analysis during `update`.+The dependency graph is loaded into memory at server startup for fast traversal. Used by `get_dependency_path`, `get_context` graph enrichment, and cascade analysis during `update`.**Why it matters for you:** Three stores means three access patterns. Simple lookups hit SQL. Natural language queries hit the vector store. Graph traversal hits NetworkX. The MCP server abstracts all of this — you ask one question, it queries the right store.@@ -161,7 +161,7 @@ The dependency graph is loaded into memory at server startup for fast traversal.## The MCP server-The MCP server sits on top of the persistence layer and exposes everything to AI coding assistants via 10 tools. It's the primary interface between repowise and Claude Code, Codex, Cursor, Cline, or any other MCP-compatible editor.+The MCP server sits on top of the persistence layer and exposes everything to AI coding assistants via 13 tools (10 single-repo + 3 workspace-only). It's the primary interface between repowise and Claude Code, Codex, Cursor, Cline, or any other MCP-compatible editor.When you run `repowise mcp`, the server starts in stdio mode and your editor can begin calling tools. The tools are designed to answer the questions an AI needs to make good decisions about your code — not just "what is this file" but "should I edit it", "why is it structured this way", and "what will break if I change it".diff --git a/website/mcp-server.md b/website/mcp-server.mdindex 4eaf86e93..dd9be8346 100644--- a/website/mcp-server.md+++ b/website/mcp-server.md@@ -22,7 +22,7 @@ Connect repowise to Claude Code, Codex, Cursor, Cline, or any MCP-compatible edi## Overview-The MCP (Model Context Protocol) server is how repowise talks to AI coding assistants. Once connected, your editor's AI can call 10 tools to query your codebase wiki — synthesizing answers, looking up symbols, fetching docs, ownership, risk signals, dependency paths, and architectural decisions.+The MCP (Model Context Protocol) server is how repowise talks to AI coding assistants. Once connected, your editor's AI can call 13 tools (10 single-repo + 3 workspace-only) to query your codebase wiki — synthesizing answers, looking up symbols, fetching docs, ownership, risk signals, dependency paths, and architectural decisions.Start the server with:@@ -170,7 +170,7 @@ Clients connect to `http://localhost:7338/sse` and receive server-sent events.----## The 10 tools+## The single-repo tools### `get_answer(question, scope?)`@@ -387,31 +387,6 @@ Returns a tiered report of unused code.----### `get_architecture_diagram(scope?, path?, diagram_type?, show_heat?)`--Generates a Mermaid diagram of the architecture.--**Parameters:**-- `scope` — `"repo"` (default), `"module"`, or `"file"`-- `path` — required for module/file scope-- `diagram_type` — `"auto"`, `"flowchart"`, `"class"`, or `"sequence"`-- `show_heat` — boolean; colors nodes by churn intensity (red = hot, green = cold)--**When to use:** For documentation, architecture reviews, or understanding unfamiliar areas.--**Example output:**-```mermaid-graph TD- cli["CLI (init, update, mcp...)"]- core["Core (ingestion, analysis, generation)"]- server["Server (FastAPI + MCP)"]- cli --> core- cli --> server- server --> core-```------## How AI editors use these toolsThe tools are designed to form a decision workflow:@@ -421,6 +396,6 @@ The tools are designed to form a decision workflow:3. **Before editing a file** → `get_risk(targets=[...])` to assess impact4. **When facing an architectural question** → `get_why(query="...")` before changing structure5. **When locating code** → `search_codebase(query="...")` before grep-6. **After making changes** → `update_decision_records(action="create", ...)` to record decisions+6. **After making changes** → `get_why(query="...")` to confirm the change aligns with recorded architectural decisionsThe [CLAUDE.md generator](claude-md-generator) writes these instructions directly into your project's CLAUDE.md, so Claude Code follows this workflow automatically. Codex setup writes the same workflow into managed `AGENTS.md`.