fix(pi-claude-cli): rewrite bare custom tool refs in system prompt to MCP names
Triage system prompts read "MUST call fn_review_spec()" but Sonnet 4.6 routed through pi-claude-cli writes PROMPT.md and silently skips the call — even with the addendum explaining the deferred-tool protocol. Confirmed by the FN-2564 agent log: model called other MCP tools (fn_memory_search, fn_task_list) fine but consistently never reached fn_review_spec, leaving triage looping on "fn_review_spec was never called" and falling back to zai/glm-5.1 every time. Rewrite bare `fn_*` (and any non-built-in custom tool name) references in the system prompt to their `mcp__custom-tools__fn_*` form before sending. The prompt now literally says "call mcp__custom-tools__fn_review_spec()" so the model has no inference step, and the deferred-tool reminder Claude Code injects matches verbatim. Word-boundary safe (won't touch fn_review_specifier) and idempotent (won't double-prefix already-MCP-named occurrences). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -149,6 +149,12 @@ export async function runInit(options: InitOptions = {}): Promise<void> {
|
||||
* Detect a project name from git remote or directory name.
|
||||
*/
|
||||
async function detectProjectName(dir: string): Promise<string> {
|
||||
// Fast-path for non-git directories to avoid spawning git unnecessarily.
|
||||
// (This also prevents occasional command stalls in constrained CI envs.)
|
||||
if (!existsSync(join(dir, ".git"))) {
|
||||
return basename(dir) || "my-project";
|
||||
}
|
||||
|
||||
// Try git remote first
|
||||
try {
|
||||
const { stdout: remoteUrl } = await execAsync("git remote get-url origin", {
|
||||
|
||||
Reference in New Issue
Block a user