{"record":{"id":"ad4a25fba4d80668","repo":"sigoden/aichat","slug":"use-empty-session-instead","errorCode":null,"errorMessage":"Use '.empty session' instead","messagePattern":"Use '\\.empty session' instead","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"info","filePath":"src/repl/mod.rs","lineNumber":700,"sourceCode":"                        config.write().exit_agent_session()?;\n                    } else {\n                        config.write().exit_session()?;\n                    }\n                }\n                Some(\"rag\") => {\n                    config.write().exit_rag()?;\n                }\n                Some(\"agent\") => {\n                    config.write().exit_agent()?;\n                }\n                Some(_) => unknown_command()?,\n                None => {\n                    return Ok(true);\n                }\n            },\n            \".clear\" => match args {\n                Some(\"messages\") => {\n                    bail!(\"Use '.empty session' instead\");\n                }\n                _ => unknown_command()?,\n            },\n            _ => unknown_command()?,\n        },\n        None => {\n            let input = Input::from_str(config, line, None);\n            ask(config, abort_signal.clone(), input, true).await?;\n        }\n    }\n\n    if !config.read().macro_flag {\n        println!();\n    }\n\n    Ok(false)\n}\n","sourceCodeStart":682,"sourceCodeEnd":718,"githubUrl":"https://github.com/sigoden/aichat/blob/82976d349ad97ac9aae0655ad631dace5e2a6385/src/repl/mod.rs#L682-L718","documentation":"The deprecated `.clear messages` command is explicitly rejected with 'Use '.empty session' instead'. The library renamed this operation: clearing messages is now performed via `.empty session`, so the old form always errors to push users to the new command.","triggerScenarios":"Typing `.clear messages` at the REPL prompt; macros or startup scripts still containing the old `.clear messages` command from a prior version.","commonSituations":"Following outdated documentation or tutorials; muscle memory from an older version of the tool; legacy macro files not updated after the command rename.","solutions":["Replace `.clear messages` with `.empty session`","Update any macros or scripts that still call .clear messages","Check .help for the current command list"],"exampleFix":"// before\n.clear messages\n// after\n.empty session","handlingStrategy":"validation","validationCode":"// sanitize legacy commands before sending to the REPL\nfn normalize(cmd: &str) -> String {\n    match cmd.trim() {\n        \".clear messages\" => \".empty session\".into(),\n        other => other.into(),\n    }\n}","typeGuard":null,"tryCatchPattern":"match repl(cmd) {\n    Err(e) if e.to_string().contains(\".empty session\") => {\n        eprintln!(\"Deprecated command; use .empty session\");\n    }\n    other => other?,\n}","preventionTips":["Replace .clear messages with .empty session in scripts and macros","Check .help after version upgrades for renamed commands","Keep a personal alias/reference of current REPL commands"],"tags":["repl","deprecated","command-rename"],"backgroundTag":"deprecated-api-usage","analyzedSha":"82976d349ad97ac9aae0655ad631dace5e2a6385","analyzedAt":"2026-09-09T18:33:06.139Z","contentChangedAt":"2026-09-09T18:33:06.139Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}