feat(cli): extend resume commands and add memory inspection

Improve resumed-session parity by letting top-level --resume execute shared read-only commands such as /help, /status, /cost, /config, and /memory in addition to /compact. This makes saved sessions meaningfully inspectable without reopening the interactive REPL.

Also add a genuinely useful /memory command that reports the Claude instruction memory already discovered by the runtime from CLAUDE.md-style files in the current directory ancestry. The command stays honest by surfacing file paths, line counts, and a short preview instead of inventing unsupported persistent memory behavior.

Constraint: Resume-path improvements must operate safely on saved sessions without requiring a live model runtime

Constraint: /memory must expose real repository instruction context rather than placeholder state

Rejected: Invent editable or persistent chat memory storage | no such durable feature exists in this repo yet

Confidence: high

Scope-risk: moderate

Reversibility: clean

Directive: Reuse shared slash parsing for resume-path features so saved-session commands and REPL commands stay aligned

Tested: cargo fmt; cargo clippy --workspace --all-targets -- -D warnings; cargo test --workspace

Not-tested: manual resume against a diverse set of historical session files from real user workflows
This commit is contained in:
Yeachan-Heo
2026-03-31 19:54:09 +00:00
parent 321a1a681a
commit c024d8b21f
2 changed files with 158 additions and 48 deletions

View File

@@ -83,6 +83,11 @@ const SLASH_COMMAND_SPECS: &[SlashCommandSpec] = &[
summary: "Inspect discovered Claude config files",
argument_hint: None,
},
SlashCommandSpec {
name: "memory",
summary: "Inspect loaded Claude instruction memory files",
argument_hint: None,
},
];
#[derive(Debug, Clone, PartialEq, Eq)]
@@ -96,6 +101,7 @@ pub enum SlashCommand {
Cost,
Resume { session_path: Option<String> },
Config,
Memory,
Unknown(String),
}
@@ -125,6 +131,7 @@ impl SlashCommand {
session_path: parts.next().map(ToOwned::to_owned),
},
"config" => Self::Config,
"memory" => Self::Memory,
other => Self::Unknown(other.to_string()),
})
}
@@ -187,6 +194,7 @@ pub fn handle_slash_command(
| SlashCommand::Cost
| SlashCommand::Resume { .. }
| SlashCommand::Config
| SlashCommand::Memory
| SlashCommand::Unknown(_) => None,
}
}
@@ -227,6 +235,7 @@ mod tests {
})
);
assert_eq!(SlashCommand::parse("/config"), Some(SlashCommand::Config));
assert_eq!(SlashCommand::parse("/memory"), Some(SlashCommand::Memory));
}
#[test]
@@ -241,7 +250,8 @@ mod tests {
assert!(help.contains("/cost"));
assert!(help.contains("/resume <session-path>"));
assert!(help.contains("/config"));
assert_eq!(slash_command_specs().len(), 9);
assert!(help.contains("/memory"));
assert_eq!(slash_command_specs().len(), 10);
}
#[test]