mavis_session_rotate
Archive the current session and create a new one with a handoff prompt to reset context and continue fresh.
Instructions
Rotate the current session — archives the old session and creates a fresh one with a handoff prompt.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.js:172-177 (registration)Tool registration for 'mavis_session_rotate' in the tools array. It has no execFn (defaults to execMavisJSON) and no outputMode (defaults to JSON output). Its buildArgs builds ['session', 'rotate']. Input schema is empty (no params needed).
{ name: 'mavis_session_rotate', description: 'Rotate the current session — archives the old session and creates a fresh one with a handoff prompt.', inputSchema: z.object({}), buildArgs: () => ['session', 'rotate'] }, - src/index.js:175-175 (schema)Input schema for mavis_session_rotate: an empty zod object (z.object({})), meaning no arguments are accepted.
inputSchema: z.object({}), - src/index.js:77-92 (handler)The runTool function that handles execution of all tools including mavis_session_rotate. Since mavis_session_rotate has no execFn, it falls through to execMavisJSON, which calls execMavis and parses JSON output.
function runTool(spec, parsedArgs) { const { execFn, outputMode, stdin, buildArgs } = spec; const args = buildArgs(parsedArgs); const input = typeof stdin === 'function' ? stdin(parsedArgs) : stdin; const execPromise = execFn ? execMavis(args, input || '') : execMavisJSON(args); return execPromise.then(result => { const text = outputMode === OUTPUT_RAW ? (result || '') : JSON.stringify(result, null, 2); return [{ type: 'text', text }]; }); } - src/index.js:32-53 (helper)The execMavis helper function that spawns the Mavis CLI binary and runs the command. For mavis_session_rotate, buildArgs returns ['session', 'rotate'], which execMavis executes via child_process.spawn.
function execMavis(args, input = '') { return new Promise((resolve, reject) => { const SESSION_COMMANDS = new Set(['communication', 'session', 'spawn']); const sessionId = process.env.__MAVIS_PARENT_SESSION_ID; const subcmd = args[0]; const needsSession = SESSION_COMMANDS.has(subcmd) && sessionId; const finalArgs = needsSession ? [...args, '--session', sessionId] : args; const proc = spawn(MAVIS_BIN, finalArgs, { stdio: ['pipe', 'pipe', 'pipe'] }); let stdout = ''; let stderr = ''; proc.stdout.on('data', d => stdout += d.toString()); proc.stderr.on('data', d => stderr += d.toString()); proc.on('close', code => { if (code === 0) resolve(stdout.trim()); else reject(new Error(stderr.split('\n')[0] || `exit code ${code}`)); }); proc.on('error', reject); if (input) proc.stdin.write(input), proc.stdin.end(); }); }