Clear Advisor Log
clear_advisor_logClear the consultation log and metadata to reset the advisor state for a new project.
Instructions
Clear the consultation log and metadata to start fresh for this project.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:636-654 (handler)Handler function for clear_advisor_log tool. Writes an empty/inital advisor-log.md and clears advisor-meta.jsonl.
}, async () => { try { await ensureAdvisorDir(); await writeFile( ADVISOR_LOG, `# Opus Advisor Log\n\nProject: ${basename(process.cwd())}\nPath: ${process.cwd()}\n\n---\n`, ); await writeFile(ADVISOR_META, ""); return { content: [{ type: "text" as const, text: "Advisor log and metadata cleared." }], }; } catch (err) { const message = err instanceof Error ? err.message : "Unknown error clearing log"; return { content: [{ type: "text" as const, text: `Error: ${message}` }], isError: true, }; } - src/index.ts:632-632 (schema)Schema: no input parameters required.
inputSchema: {}, - src/index.ts:629-655 (registration)Registration of clear_advisor_log tool with title, description, empty input schema, destructive hint annotation, and handler.
server.registerTool("clear_advisor_log", { title: "Clear Advisor Log", description: "Clear the consultation log and metadata to start fresh for this project.", inputSchema: {}, annotations: { destructiveHint: true, }, }, async () => { try { await ensureAdvisorDir(); await writeFile( ADVISOR_LOG, `# Opus Advisor Log\n\nProject: ${basename(process.cwd())}\nPath: ${process.cwd()}\n\n---\n`, ); await writeFile(ADVISOR_META, ""); return { content: [{ type: "text" as const, text: "Advisor log and metadata cleared." }], }; } catch (err) { const message = err instanceof Error ? err.message : "Unknown error clearing log"; return { content: [{ type: "text" as const, text: `Error: ${message}` }], isError: true, }; } }); - src/index.ts:53-55 (helper)Helper function that ensures the advisor directory exists before writing logs.
async function ensureAdvisorDir(): Promise<void> { await mkdir(ADVISOR_DIR, { recursive: true }); } - src/index.ts:30-32 (helper)Constants defining the path to the advisor log and metadata files.
const ADVISOR_DIR = getAdvisorDir(); const ADVISOR_LOG = join(ADVISOR_DIR, "advisor-log.md"); const ADVISOR_META = join(ADVISOR_DIR, "advisor-meta.jsonl");