`atomic agent explain` over ExplainTurns — the session record resolves CLIENT-SIDE (the session store is a working-copy file read, not redb) and its fields ride the request; the handler loads the turns, extracts the transcripts, generates the reasoning via the Claude CLI, anchors the learnings, and performs the save-backs. The CLI renders the local body's exact lines from the wire-carried per-turn
(args: &super::agent::explain::Explain)
| 6167 | /// the learnings, and performs the save-backs. The CLI renders the local |
| 6168 | /// body's exact lines from the wire-carried per-turn results. |
| 6169 | pub fn agent_explain(args: &super::agent::explain::Explain) -> CliResult<bool> { |
| 6170 | use atomic_agent::turn::session::SessionStore; |
| 6171 | let repo_root = crate::commands::find_repository_root()?; |
| 6172 | let session_store = |
| 6173 | SessionStore::for_repo(&repo_root).map_err(|e| CliError::InvalidRepository { |
| 6174 | reason: format!("Failed to open session store: {}", e), |
| 6175 | })?; |
| 6176 | let session = session_store |
| 6177 | .load(&args.session_id) |
| 6178 | .map_err(|e| CliError::Internal(anyhow::anyhow!("Failed to load session: {}", e)))? |
| 6179 | .ok_or_else(|| CliError::InvalidArgument { |
| 6180 | message: format!( |
| 6181 | "Session '{}' not found. Use 'atomic agent status' to see available sessions.", |
| 6182 | args.session_id |
| 6183 | ), |
| 6184 | })?; |
| 6185 | let Some(service_session) = Service::open()? else { |
| 6186 | return Ok(false); |
| 6187 | }; |
| 6188 | let request = pb::ExplainTurnsRequest { |
| 6189 | repository: Some(service_session.reference.clone()), |
| 6190 | meta: request_meta(), |
| 6191 | session_id: args.session_id.clone(), |
| 6192 | turn: args.turn, |
| 6193 | all: args.all, |
| 6194 | save: args.save, |
| 6195 | model: args.model.clone(), |
| 6196 | view_name: session.view_name.clone(), |
| 6197 | transcript_path: session |
| 6198 | .transcript_path |
| 6199 | .as_ref() |
| 6200 | .map(|path| path.display().to_string()), |
| 6201 | files_touched: session.files_touched.clone(), |
| 6202 | agent_name: session.agent_name.clone(), |
| 6203 | }; |
| 6204 | let response = service_session.explain_turns(request)?; |
| 6205 | |
| 6206 | if response.session_has_no_turns { |
| 6207 | println!( |
| 6208 | "Session '{}' has no recorded turns on view '{}'.", |
| 6209 | args.session_id, session.view_name, |
| 6210 | ); |
| 6211 | return Ok(true); |
| 6212 | } |
| 6213 | |
| 6214 | // The Claude CLI availability check — the local body's exact early-out. |
| 6215 | let generator = atomic_agent::transcript::ClaudeCliGenerator::new().with_model(&args.model); |
| 6216 | use atomic_agent::transcript::ReasoningGenerator as _; |
| 6217 | if !generator.is_available() { |
| 6218 | crate::output::print_error( |
| 6219 | "Claude CLI not found. Install from https://docs.anthropic.com/en/docs/claude-code", |
| 6220 | ); |
| 6221 | println!(); |
| 6222 | println!("The 'explain' command uses Claude CLI to generate reasoning summaries."); |
| 6223 | println!("Make sure 'claude' is in your PATH and authenticated."); |
| 6224 | return Ok(true); |
| 6225 | } |
| 6226 |
no test coverage detected