From f97d35178a82b327246862ea6bea827739d17b8a Mon Sep 17 00:00:00 2001 From: geobelsky Date: Wed, 8 Apr 2026 18:22:03 +0000 Subject: [PATCH 1/2] fix: pass pathToClaudeCodeExecutable to SDK query options SDK fallback uses import.meta.url to find claude binary, which is undefined in CJS bundles (esbuild replaces import.meta with {}). Now explicitly find and pass claude path via `which claude`. Also: improved error logging in init.ts (stack trace on scan failure). Co-Authored-By: Claude Opus 4.6 (1M context) --- src/tools/init.ts | 5 ++++- src/utils/agent-options.ts | 17 +++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/tools/init.ts b/src/tools/init.ts index f983ec4..cd8644d 100644 --- a/src/tools/init.ts +++ b/src/tools/init.ts @@ -174,7 +174,10 @@ export async function initProjectWithLLM(projectPath: string, opts?: { log(` [${projectName}] Scanners complete, processing results...`); for (const settled of scanners) { if (settled.status === "rejected") { - errors.push(`LLM scan failed: ${settled.reason?.message ?? settled.reason}`); + const err = settled.reason; + const msg = err?.message ?? String(err); + const stack = err?.stack ? `\n${err.stack.split("\n").slice(0, 3).join("\n")}` : ""; + errors.push(`LLM scan failed: ${msg}${stack}`); continue; } const val = settled.value; diff --git a/src/utils/agent-options.ts b/src/utils/agent-options.ts index 2da5895..f7c9c9e 100644 --- a/src/utils/agent-options.ts +++ b/src/utils/agent-options.ts @@ -2,8 +2,22 @@ * Shared agent query options builder for LLM scanner agents. */ +import { execSync } from "node:child_process"; + type Options = import("@anthropic-ai/claude-agent-sdk").Options; +/** Find claude binary path. Cached after first lookup. */ +let _claudePath: string | undefined; +function findClaudePath(): string | undefined { + if (_claudePath !== undefined) return _claudePath || undefined; + try { + _claudePath = execSync("which claude", { encoding: "utf-8" }).trim(); + } catch { + _claudePath = ""; + } + return _claudePath || undefined; +} + export type AgentRole = "scanner" | "tester" | "reviewer" | "engineer" | "architect" | "auditor"; const ROLE_TOOLS: Record = { @@ -41,6 +55,8 @@ export function buildAgentQueryOptions(base: { }, role: AgentRole): Options { const tools = ROLE_TOOLS[role]; + const claudePath = findClaudePath(); + return { cwd: base.cwd, model: base.model, @@ -49,6 +65,7 @@ export function buildAgentQueryOptions(base: { : { type: "preset" as const, preset: "claude_code" as const }, settingSources: ["project"], ...(base.maxTurns !== undefined ? { maxTurns: base.maxTurns } : {}), + ...(claudePath ? { pathToClaudeCodeExecutable: claudePath } : {}), permissionMode: "bypassPermissions", allowDangerouslySkipPermissions: true, allowedTools: tools.allowed, From c2b533c77552108c8752246a4eb3a0f68b3842dd Mon Sep 17 00:00:00 2001 From: geobelsky Date: Wed, 8 Apr 2026 18:34:02 +0000 Subject: [PATCH 2/2] fix: remove alpha debug verification step from close checklist Step 3 "Verify AXME Code Functionality" was internal debug prompt, not for end users. Removed from axme_begin_close output. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/server.ts | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/src/server.ts b/src/server.ts index 5aaa4a9..f7a90c2 100644 --- a/src/server.ts +++ b/src/server.ts @@ -680,21 +680,7 @@ server.tool( "- `worklog_entry`: narrative summary (5-15 lines markdown)", "- `startup_text`: ready-to-paste text for next session", "", - "## Step 3: Verify AXME Code Functionality (ALPHA - MANDATORY)", - "", - "AXME Code is in alpha. Before finalizing, verify that core functionality worked correctly in this session.", - "Run these checks and report results to the user:", - "", - "1. **Context loading**: call `axme_status` - verify it returns data (not error)", - "2. **Saves**: if you saved any memories/decisions in this session, verify files exist on disk:", - " - `ls .axme-code/decisions/` and `ls .axme-code/memory/` in the target storage", - "3. **Pending audits**: check `axme_context` output for 'Pending audits' section - report if any are stuck", - "4. **Safety hooks**: verify `.claude/settings.json` has PreToolUse + PostToolUse + SessionEnd hooks configured", - "5. **Session tracking**: verify current session meta exists: `ls .axme-code/sessions/` should have current session dir", - "", - "Report results as a table to the user. If anything is broken, flag it BEFORE calling finalize_close.", - "", - "## Step 4: Call `axme_finalize_close`", + "## Step 3: Call `axme_finalize_close`", "", "Pass everything in one call. MCP writes all files atomically.", "After it returns:",