Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 1 addition & 15 deletions src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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:",
Expand Down
5 changes: 4 additions & 1 deletion src/tools/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
17 changes: 17 additions & 0 deletions src/utils/agent-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<AgentRole, { allowed: string[]; disallowed: string[] }> = {
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down