Phase 1 ticket T10. Depends on #657 (T9 GraphRAG init).
Context
The ask tool's NL→Cypher quality depends heavily on the system prompts. Today the prompts live in api/prompts.py (CYPHER_GEN_SYSTEM, CYPHER_GEN_PROMPT, GRAPH_QA_SYSTEM, GRAPH_QA_PROMPT — lines 1-113) and are tuned for the existing FastAPI chat endpoint. The MCP ask tool may want slightly different framing in the future (e.g. "the user is an AI agent inspecting code, not a human asking conceptual questions"), so this ticket creates a dedicated prompt module that re-exports the existing prompts and provides a clean hook for future divergence.
For v1, the module is mostly a re-export. The value is the seam — once T11 ships, prompt iteration happens in api/mcp/code_prompts.py without touching api/prompts.py.
Scope
In:
- New
api/mcp/code_prompts.py:
from api.prompts import (
CYPHER_GEN_SYSTEM,
CYPHER_GEN_PROMPT,
GRAPH_QA_SYSTEM,
GRAPH_QA_PROMPT,
)
__all__ = ["CYPHER_GEN_SYSTEM", "CYPHER_GEN_PROMPT", "GRAPH_QA_SYSTEM", "GRAPH_QA_PROMPT"]
Plus a docstring explaining the seam and a # TODO marker for where to start diverging.
- Update
api/mcp/graphrag_init.py (from T9) to import from api.mcp.code_prompts instead of api.prompts directly. This should be a one-line change since T9 left a TODO(T10) marker.
- New
tests/mcp/test_code_prompts.py:
- Snapshot test: pin the text of all four prompt constants. If
api/prompts.py is edited unexpectedly, this test fails — catches accidental drift.
- Re-export test: assert all four constants are importable from
api.mcp.code_prompts and equal the originals from api.prompts.
Out:
- Actually changing prompts (Phase 1.5 prompt iteration).
- The
ask tool itself (T11).
Files to create / modify
- new
api/mcp/code_prompts.py
- modified
api/mcp/graphrag_init.py (one-line import swap)
- new
tests/mcp/test_code_prompts.py
Acceptance criteria
Dependencies
Out of scope (do NOT do in this PR)
- Actual prompt content changes — that's Phase 1.5 prompt iteration with real-LLM E2E.
- The
ask tool (T11).
- A separate prompt-config file format / hot-reload (overengineering).
Notes for the implementer
- This ticket is intentionally tiny (a re-export module + a snapshot test). It exists to create a stable seam, not to do work.
- The snapshot test should compare against an inline string constant rather than a separate snapshot file. Keeps the "what is pinned" obvious.
- Document in the module docstring why this layer exists ("seam for future MCP-specific prompt divergence — see Phase 1.5 prompt iteration").
Phase 1 ticket T10. Depends on #657 (T9 GraphRAG init).
Context
The
asktool's NL→Cypher quality depends heavily on the system prompts. Today the prompts live inapi/prompts.py(CYPHER_GEN_SYSTEM,CYPHER_GEN_PROMPT,GRAPH_QA_SYSTEM,GRAPH_QA_PROMPT— lines 1-113) and are tuned for the existing FastAPI chat endpoint. The MCPasktool may want slightly different framing in the future (e.g. "the user is an AI agent inspecting code, not a human asking conceptual questions"), so this ticket creates a dedicated prompt module that re-exports the existing prompts and provides a clean hook for future divergence.For v1, the module is mostly a re-export. The value is the seam — once T11 ships, prompt iteration happens in
api/mcp/code_prompts.pywithout touchingapi/prompts.py.Scope
In:
api/mcp/code_prompts.py:# TODOmarker for where to start diverging.api/mcp/graphrag_init.py(from T9) to import fromapi.mcp.code_promptsinstead ofapi.promptsdirectly. This should be a one-line change since T9 left aTODO(T10)marker.tests/mcp/test_code_prompts.py:api/prompts.pyis edited unexpectedly, this test fails — catches accidental drift.api.mcp.code_promptsand equal the originals fromapi.prompts.Out:
asktool itself (T11).Files to create / modify
api/mcp/code_prompts.pyapi/mcp/graphrag_init.py(one-line import swap)tests/mcp/test_code_prompts.pyAcceptance criteria
api/mcp/code_prompts.pyexists and re-exports the four constants.api/mcp/graphrag_init.pyimports prompts fromapi.mcp.code_prompts(no longer fromapi.promptsdirectly).api/prompts.pyrequires either updating the snapshot (intentional) or seeing this test fail (catches accidental edits).Dependencies
Out of scope (do NOT do in this PR)
asktool (T11).Notes for the implementer