Add in-REPL session restoration and read-only config inspection so the CLI can recover saved conversations and expose Claude settings without leaving interactive mode. /resume now reloads a session file into the live runtime, and /config shows discovered settings files plus the merged effective JSON.
The new commands stay on the shared slash-command surface and rebuild runtime state using the current model, system prompt, and permission mode so existing REPL behavior remains stable.
Constraint: /resume must update the live REPL session rather than only supporting top-level --resume
Constraint: /config should inspect existing settings without mutating user files
Rejected: Add editable /config writes in this slice | read-only inspection is safer and sufficient for immediate parity work
Confidence: high
Scope-risk: moderate
Reversibility: clean
Directive: Keep resume/config behavior on the shared slash command surface so non-REPL entrypoints can reuse it later
Tested: cargo fmt; cargo clippy --workspace --all-targets -- -D warnings; cargo test --workspace
Not-tested: manual interactive restore against real saved session files outside automated fixtures
Extend the Rust tools crate with concrete Agent and ToolSearch implementations. Agent now persists agent-handoff metadata and prompt payloads to a local store with Claude Code-style fields, while ToolSearch supports exact selection and keyword search over the deferred tool surface. Tests cover agent persistence and tool lookup behavior alongside the existing web, todo, and skill coverage.\n\nConstraint: Keep the implementation tools-only without relying on full agent orchestration runtime\nConstraint: Preserve exposed tool names and close schema parity with Claude Code\nRejected: No-op Agent stubs | would not provide material handoff value\nRejected: ToolSearch limited to exact matches only | too weak for discovery workflows\nConfidence: medium\nScope-risk: narrow\nReversibility: clean\nDirective: Keep Agent output contract stable so later execution wiring can reuse persisted metadata without renaming fields\nTested: cargo fmt; cargo test -p tools\nNot-tested: cargo clippy; full workspace cargo test
This replaces the single default pricing assumption with a small model-aware pricing table for Sonnet, Opus, and Haiku so CLI usage output better matches the selected model. Unknown models still fall back cleanly with explicit labeling.
The change keeps pricing lightweight and local while improving the usefulness of usage/cost reporting for resumed sessions and live turns.
Constraint: Keep pricing local and dependency-free
Constraint: Preserve graceful fallback behavior for unknown model IDs
Rejected: Add a remote pricing source now | unnecessary coupling and risk for this slice
Confidence: high
Scope-risk: narrow
Reversibility: clean
Directive: If pricing tables expand later, prefer explicit model-family matching and keep fallback labeling visible
Tested: cargo fmt; cargo clippy --all-targets --all-features -- -D warnings; cargo test -q
Not-tested: Validation against live provider billing exports
This adds a dedicated session inspect command to the Rust CLI so users can inspect a saved session's path, timestamps, size, token totals, preview text, and latest user/assistant context without opening the underlying file by hand.
It builds directly on the new session list/resume flows and keeps the UX lightweight and script-friendly.
Constraint: Keep session inspection CLI-native and read-only
Constraint: Reuse the existing saved-session format instead of introducing a secondary index format
Rejected: Add an interactive session browser now | more overhead than needed for this inspect slice
Confidence: high
Scope-risk: narrow
Reversibility: clean
Directive: Keep session inspection output stable and grep-friendly so it remains useful in scripts
Tested: cargo fmt; cargo clippy --all-targets --all-features -- -D warnings; cargo test -q
Not-tested: Manual inspection against a large corpus of real saved sessions
This upgrades Rust session compaction so summaries carry more than a flat timeline. The compacted state now calls out recent user requests, pending work signals, key files, and the current work focus so resumed sessions retain stronger execution continuity.
The change stays deterministic and local while moving the compact output closer to session-memory style handoff value.
Constraint: Keep compaction local and deterministic rather than introducing API-side summarization
Constraint: Preserve the existing resumable system-summary mechanism and compact command flow
Rejected: Add a full session-memory background extractor now | larger runtime change than needed for this incremental parity pass
Confidence: high
Scope-risk: narrow
Reversibility: clean
Directive: Keep future compaction enrichments biased toward actionable state transfer, not just verbose recap
Tested: cargo fmt; cargo clippy --all-targets --all-features -- -D warnings; cargo test -q
Not-tested: Long real-world sessions with deeply nested tool/result payloads
This improves Rust prompt-building by deduplicating repeated CLAUDE instruction content, surfacing clearer project-context metadata, and truncating oversized instruction payloads so local rules stay useful without overwhelming the runtime prompt.
The change preserves ancestor-chain discovery while making the rendered context more stable, compact, and readable for downstream compaction and CLI flows.
Constraint: Keep existing CLAUDE.md discovery semantics while reducing prompt bloat
Constraint: Avoid adding a new parser or changing user-authored instruction file formats
Rejected: Introduce a structured CLAUDE schema now | too large a shift for this parity slice
Confidence: high
Scope-risk: narrow
Reversibility: clean
Directive: If richer instruction precedence is added later, keep duplicate suppression conservative so distinct local rules are not silently lost
Tested: cargo fmt; cargo clippy --all-targets --all-features -- -D warnings; cargo test -q
Not-tested: Live end-to-end behavior with very large real-world CLAUDE.md trees
This adds a prompt-mode permission flow for the Rust CLI, surfaces permission policy details in the REPL, and improves tool output rendering with concise human-readable summaries before the raw JSON payload.
The goal is to make tool execution feel safer and more legible without changing the underlying runtime loop or adding a heavyweight UI layer.
Constraint: Keep the permission UX terminal-native and incremental
Constraint: Preserve existing allow and read-only behavior while adding prompt mode
Rejected: Build a full-screen interactive approval UI now | unnecessary complexity for this parity slice
Confidence: high
Scope-risk: narrow
Reversibility: clean
Directive: Keep raw tool JSON available even when adding richer summaries so debugging fidelity remains intact
Tested: cargo fmt; cargo clippy --all-targets --all-features -- -D warnings; cargo test -q
Not-tested: Manual prompt-mode approvals against live API-driven tool calls
Expand the shared slash registry and REPL dispatcher with real session-management commands so the CLI feels closer to Claude Code during interactive use. /permissions now reports or switches the active permission mode, /clear rebuilds a fresh local session without restarting the process, and /cost reports cumulative token usage honestly from the runtime tracker.
The implementation keeps command parsing centralized in the commands crate and preserves the existing prompt-mode path while rebuilding runtime state safely when commands change session configuration.
Constraint: Commands must be genuinely useful local behavior rather than placeholders
Constraint: Preserve REPL continuity when changing permissions or clearing session state
Rejected: Store permission-mode changes only in environment variables | would not update the live runtime for the current session
Confidence: high
Scope-risk: moderate
Reversibility: clean
Directive: Keep future stateful slash commands rebuilding from current session + system prompt instead of mutating hidden runtime internals
Tested: cargo fmt; cargo clippy --workspace --all-targets -- -D warnings; cargo test --workspace
Not-tested: manual live API session exercising permission changes mid-conversation
Centralize slash command parsing in the commands crate so the REPL can share help metadata and grow toward Claude Code parity without duplicating handlers. This adds shared /help and /model parsing, routes REPL dispatch through the shared parser, and upgrades /status to report model and token totals.
To satisfy the required verification gate, this also fixes existing workspace clippy and test blockers in runtime, tools, api, and compat-harness that were unrelated to the new command behavior but prevented fmt/clippy/test from passing cleanly.
Constraint: Preserve existing prompt-mode and REPL behavior while adding real slash commands
Constraint: cargo fmt, clippy, and workspace tests must pass before shipping command-surface work
Rejected: Keep command handling only in main.rs | would deepen duplication with commands crate and resume path
Confidence: high
Scope-risk: moderate
Reversibility: clean
Directive: Extend new slash commands through the shared commands crate first so REPL and resume entrypoints stay consistent
Tested: cargo fmt; cargo clippy --workspace --all-targets -- -D warnings; cargo test --workspace
Not-tested: live Anthropic network execution beyond existing mocked/integration coverage
This adds a lightweight session home for the Rust CLI, auto-persists REPL state, and exposes list, search, show, and named resume flows so users no longer need to remember raw JSON paths.
The change keeps the old --resume SESSION.json path working while adding friendlier session discovery. It also makes API env-based tests hermetic so workspace verification remains stable regardless of shell environment.
Constraint: Keep session UX incremental and CLI-native without introducing a new database or TUI layer
Constraint: Preserve backward compatibility for the existing --resume SESSION.json workflow
Rejected: Build a richer interactive picker now | higher implementation cost than needed for this parity slice
Confidence: high
Scope-risk: moderate
Reversibility: clean
Directive: Keep human-friendly session lookup additive; do not remove explicit path-based resume support
Tested: cargo fmt; cargo clippy --all-targets --all-features -- -D warnings; cargo test -q
Not-tested: Manual multi-session interactive REPL behavior across multiple terminals
This adds token and estimated cost reporting to runtime usage tracking and surfaces it in the CLI status and turn output. It also upgrades compaction summaries so users see a clearer resumable summary and token savings after /compact.
The verification path required cleaning existing workspace clippy and test friction in adjacent crates so cargo fmt, cargo clippy -D warnings, and cargo test succeed from the Rust workspace root in this repo state.
Constraint: Keep the change incremental and user-visible without a large CLI rewrite
Constraint: Verification must pass with cargo fmt, cargo clippy --all-targets --all-features -- -D warnings, and cargo test
Rejected: Implement a full model-pricing table now | would add more surface area than needed for this first UX slice
Confidence: high
Scope-risk: moderate
Reversibility: clean
Directive: If pricing becomes model-specific later, keep the current estimate labeling explicit rather than implying exact billing
Tested: cargo fmt; cargo clippy --all-targets --all-features -- -D warnings; cargo test -q
Not-tested: Live Anthropic API interaction and real streaming terminal sessions
Extend the Rust tools crate with concrete TodoWrite and Skill implementations. TodoWrite now validates and persists structured session todos with Claude Code-aligned item shapes, while Skill resolves local skill definitions and returns their prompt payload for execution handoff. Tests cover persistence and local skill loading without disturbing the previously added web tools.\n\nConstraint: Stay within tools-only scope and avoid depending on broader agent/runtime rewrites\nConstraint: Keep exposed tool names and schemas close to Claude Code contracts\nRejected: In-memory-only TodoWrite state | would not survive across tool calls\nRejected: Stub Skill metadata without loading prompt content | not materially useful to callers\nConfidence: medium\nScope-risk: narrow\nReversibility: clean\nDirective: Preserve TodoWrite item-field parity and keep Skill focused on local skill discovery until agent execution wiring lands\nTested: cargo fmt; cargo test -p tools\nNot-tested: cargo clippy; full workspace cargo test
Add typed runtime-facing MCP and OAuth configuration models on top of the existing merged settings loader so later parity work can consume validated structures instead of ad hoc JSON traversal.
This keeps the first slice bounded to parsing, precedence, exports, and tests. While validating the slice under the repo's required clippy gate, I also fixed a handful of pre-existing clippy failures in runtime file operations so the requested verification command can pass for this commit.
Constraint: Must keep scope to parity-unblocking primitives, not full MCP or OAuth flow execution
Constraint: cargo clippy --all-targets is a required verification gate for this repo
Rejected: Add a new integrations crate first | too much boundary churn for the first landing slice
Rejected: Leave existing clippy failures untouched | would block the required verification command for this commit
Confidence: medium
Scope-risk: moderate
Reversibility: clean
Directive: Keep future MCP/OAuth additions layered on these typed config surfaces before introducing transport orchestration
Tested: cargo fmt --all; cargo test -p runtime; cargo clippy -p runtime --all-targets -- -D warnings
Not-tested: workspace-wide clippy/test beyond the runtime crate; live MCP or OAuth network flows
Implement the first web-oriented Claude Code parity slice in the Rust tools crate. This adds concrete WebFetch and WebSearch tool specs, execution paths, lightweight HTML/search-result extraction, domain filtering, and local HTTP-backed tests while leaving the existing core file and shell tools intact.\n\nConstraint: Keep the change scoped to tools-only Rust workspace code\nConstraint: Match Claude Code tool names and JSON schemas closely enough for parity work\nRejected: Stub-only tool registrations | would not materially expand beyond MVP\nRejected: Full browser/search service integration | too large for this first logical slice\nConfidence: medium\nScope-risk: moderate\nReversibility: clean\nDirective: Treat these web helpers as a parity foundation; refine result quality without renaming the exposed tool contracts\nTested: cargo fmt; cargo test -p tools\nNot-tested: cargo clippy; full workspace cargo test
Trace the local Claude Code TS request path and align the Rust client with its
non-OAuth direct-request behavior. The Rust client now resolves the message base
URL from ANTHROPIC_BASE_URL, uses ANTHROPIC_API_KEY for x-api-key, and sends
ANTHROPIC_AUTH_TOKEN as a Bearer Authorization header when present.
Constraint: Must match the local Claude Code source request/auth split, not inferred behavior
Rejected: Treat ANTHROPIC_AUTH_TOKEN as the x-api-key source | diverges from local TS client path
Confidence: high
Scope-risk: narrow
Reversibility: clean
Directive: Keep direct /v1/messages auth handling aligned with src/services/api/client.ts and src/utils/auth.ts when changing env precedence
Tested: cargo test -p api; cargo run -p rusty-claude-cli -- prompt "say hello"
Not-tested: Non-default proxy transport features beyond ANTHROPIC_BASE_URL override
Wire the CLI to the Anthropic client, runtime conversation loop, and MVP in-tree tool executor so prompt mode and the default REPL both execute real turns instead of scaffold-only commands.
Constraint: Proxy auth uses ANTHROPIC_AUTH_TOKEN as the primary x-api-key source and may stream extra usage fields
Constraint: Must preserve existing scaffold commands while enabling real prompt and REPL flows
Rejected: Keep prompt mode on the old scaffold path | does not satisfy end-to-end CLI requirement
Rejected: Depend solely on raw SSE message_stop from proxy | proxy/event differences required tolerant parsing plus fallback handling
Confidence: medium
Scope-risk: moderate
Reversibility: clean
Directive: Keep prompt mode tool-free unless the one-shot path is explicitly expanded and reverified against the proxy
Tested: cargo test -p api; cargo test -p tools; cargo test -p runtime; cargo test -p rusty-claude-cli; cargo build; cargo run -p rusty-claude-cli -- prompt "say hello"; printf '/quit\n' | cargo run -p rusty-claude-cli --
Not-tested: Full interactive tool_use roundtrip against the proxy in REPL mode
The old tracked TypeScript snapshot has been removed from the repository history and the root directory is now a Python porting workspace. README and tests now describe and verify the Python-first layout instead of treating the exposed snapshot as the active source tree.
A local archive can still exist outside Git, but the tracked repository now presents only the Python porting surface, related essay context, and OmX workflow artifacts.
Constraint: Tracked history should collapse to a single commit while excluding the archived snapshot from Git
Rejected: Keep the exposed TypeScript tree in tracked history under an archive path | user explicitly wanted only the Python porting repo state in Git
Confidence: medium
Scope-risk: broad
Reversibility: messy
Directive: Keep future tracked additions focused on the Python port itself; do not reintroduce the exposed snapshot into Git history
Tested: python3 -m unittest discover -s tests -v; python3 -m src.main summary; git diff --check
Not-tested: Behavioral parity with the original TypeScript system beyond the current Python workspace surface