Commit Graph

136 Commits

Author SHA1 Message Date
YeonGyu-Kim
d7d20c66a6 docs: update README with Claw Code branding and feature parity
- Claw Code -> Claw Code branding
- CLI command refs: claw -> claw
- Feature highlights: 43 tools, JSONL sessions, prompt cache tracking, telemetry matching
- Star history chart and badges
- 11MB release binary positioning
- Config docs aligned to .claw.json
2026-04-01 18:34:24 +09:00
YeonGyu-Kim
df6230d42e cleanroom: apply clean-room scrub on latest codebase
- Remove all claw/anthropic references from .rs files
- Rename: AnthropicClient->ApiHttpClient, ClawAiProxy->ManagedProxy
- Keep api.anthropic.com (actual endpoint) and model names (claw-opus etc)
- Keep wire-protocol headers (anthropic-version, User-Agent)
- cargo check passes on full 134-commit codebase
2026-04-01 18:20:34 +09:00
Yeachan-Heo
b867e645dd feat: hook-pipeline progress — tests passing 2026-04-01 05:58:00 +00:00
Yeachan-Heo
eaf7dc83f0 feat: hook abort signal + Ctrl-C cancellation pipeline 2026-04-01 05:55:24 +00:00
Yeachan-Heo
4670b4c76b wip: hook progress UI + documentation 2026-04-01 04:50:26 +00:00
Yeachan-Heo
2387a54b40 wip: hook-pipeline progress 2026-04-01 04:40:18 +00:00
Yeachan-Heo
c26797d98a wip: hook-pipeline progress 2026-04-01 04:30:25 +00:00
Yeachan-Heo
2dc21c17c7 wip: hook pipeline progress 2026-04-01 04:20:16 +00:00
Yeachan-Heo
b40fb0c464 Enable compatible tool hooks in the Rust runtime
This threads typed hook settings through runtime config, adds a shell-based hook runner, and executes PreToolUse/PostToolUse around each tool call in the conversation loop. The CLI now rebuilds runtimes with settings-derived hook configuration so user-defined Claw hook commands actually run before and after tools.

Constraint: Hook behavior needed to match Claw-style settings.json hooks without broad plugin/MCP parity work in this change
Rejected: Delay hook loading to the tool executor layer | would miss denied tool calls and duplicate runtime policy plumbing
Confidence: medium
Scope-risk: moderate
Reversibility: clean
Directive: Keep hook execution in the runtime loop so permission decisions and tool results remain wrapped by the same conversation semantics
Tested: cargo test; cargo build --release
Not-tested: Real user hook scripts outside the test harness; broader plugin/skills parity
2026-04-01 03:35:25 +00:00
Yeachan-Heo
fd33a6dbdc feat: -p flag compat, --print flag, OAuth defaults, UI rendering merge 2026-04-01 03:22:34 +00:00
Yeachan-Heo
143cef6873 feat: default OAuth config for API endpoint, merge UI polish rendering 2026-04-01 03:20:26 +00:00
Yeachan-Heo
89ef493eda Merge remote-tracking branch 'origin/rcc/ui-polish' into dev/rust 2026-04-01 03:17:16 +00:00
Yeachan-Heo
d0327f650f Improve terminal output so Rust CLI renders readable rich responses
The Rust CLI was still surfacing raw markdown fragments and raw tool JSON in places where the terminal UI should present styled, human-readable output. This change routes assistant text through the terminal markdown renderer, strengthens the markdown ANSI path for headings/links/lists/code blocks, and converts common tool calls/results into concise terminal-native summaries with readable bash output and edit previews.

Constraint: Must match Claw Code-style behavior without copying the upstream TypeScript source
Constraint: Keep the fix scoped to claw-cli rendering and formatting paths
Rejected: Port TS rendering components directly | prohibited by task constraints
Rejected: Leave tool JSON and only style markdown | still fails the requested terminal UX
Confidence: high
Scope-risk: moderate
Reversibility: clean
Directive: Keep tool formatting human-readable first; do not reintroduce raw JSON dumps for common tools without a fallback-only guard
Tested: cargo test -p claw-cli
Tested: cargo build --release
Not-tested: Live end-to-end API streaming against a real Anthropic session
2026-04-01 03:14:45 +00:00
Yeachan-Heo
e95eb86d1b Merge remote-tracking branch 'origin/rcc/subagent' into dev/rust 2026-04-01 03:12:25 +00:00
Yeachan-Heo
48fa1c3ae5 Enable real Agent tool delegation in the Rust CLI
The Rust Agent tool only persisted queued metadata, so delegated work never actually ran. This change wires Agent into a detached background conversation path with isolated runtime, API client, session state, restricted tool subsets, and file-backed lifecycle/result updates.

Constraint: Keep the tool entrypoint in the tools crate and avoid copying the upstream TypeScript implementation
Rejected: Spawn an external claw process | less aligned with the requested in-process runtime/client design
Rejected: Leave execution in the CLI crate only | would keep tools::Agent as a metadata-only stub
Confidence: medium
Scope-risk: moderate
Reversibility: clean
Directive: Tool subset mappings are curated guardrails; revisit them before enabling recursive Agent access or richer agent definitions
Tested: cargo build --release --manifest-path rust/Cargo.toml
Tested: cargo test --manifest-path rust/Cargo.toml
Not-tested: Live end-to-end background sub-agent run against Anthropic API credentials
2026-04-01 03:10:20 +00:00
Yeachan-Heo
84c8a808f4 docs: rewrite rust/ README with full feature matrix and usage guide 2026-04-01 02:59:05 +00:00
Yeachan-Heo
7661af230c feat: allow multiple in_progress todos for parallel workflows 2026-04-01 02:55:13 +00:00
Yeachan-Heo
b50ee29c08 fix: critical parity bugs - enable tools, default permissions, tool input
Tighten prompt-mode parity for the Rust CLI by enabling native tools in one-shot runs, defaulting fresh sessions to danger-full-access, and documenting the remaining TS-vs-Rust gaps.

The JSON prompt path now runs through the full conversation loop so tool use and tool results are preserved without streaming terminal noise, while the tool-input accumulator keeps the streaming {} placeholder fix without corrupting legitimate non-stream empty objects.

Constraint: Original TypeScript source was treated as read-only for parity analysis
Constraint: No new dependencies; keep the fix localized to the Rust port
Rejected: Leave JSON prompt mode on a direct non-tool API path | preserved the one-shot parity bug
Rejected: Keep workspace-write as the default permission mode | contradicted requested parity target
Confidence: high
Scope-risk: moderate
Reversibility: clean
Directive: Keep prompt text and prompt JSON paths on the same tool-capable runtime semantics unless upstream behavior proves they must diverge
Tested: cargo build --release; cargo test
Not-tested: live remote prompt run against LayoffLabs endpoint in this session
2026-04-01 02:42:49 +00:00
Yeachan-Heo
7289fcb3db fix: tool input {} prefix bug, tool display after accumulation, max_iterations unlimited 2026-04-01 02:24:18 +00:00
Yeachan-Heo
0d657d6400 feat: improved tool call display with box rendering, colored output 2026-04-01 02:20:59 +00:00
Yeachan-Heo
ca2716b9fb feat: --dangerously-skip-permissions flag, default max_tokens 64k (opus 32k) 2026-04-01 02:18:23 +00:00
Yeachan-Heo
dcbde0dfb8 fix: remove debug logs, set model-specific max_tokens (opus=32k, sonnet/haiku=64k) 2026-04-01 02:14:20 +00:00
Yeachan-Heo
2de6c0fade fix: haiku alias to claw-haiku-4-5 2026-04-01 02:10:49 +00:00
Yeachan-Heo
f2989128b9 Replace bespoke CLI line editing with rustyline and canonical model aliases
The REPL now wraps rustyline::Editor instead of maintaining a custom raw-mode
input stack. This preserves the existing LineEditor surface while delegating
history, completion, and interactive editing to a maintained library. The CLI
argument parser and /model command path also normalize shorthand model names to
our current canonical Anthropic identifiers.

Constraint: User requested rustyline 15 specifically for the CLI editor rewrite
Constraint: Existing LineEditor constructor and read_line API had to remain stable
Rejected: Keep extending the crossterm-based editor | custom key handling and history logic were redundant with rustyline
Rejected: Resolve aliases only for --model flags | /model would still diverge from CLI startup behavior
Confidence: high
Scope-risk: moderate
Reversibility: clean
Directive: Keep model alias normalization centralized in main.rs so CLI flag parsing and /model stay in sync
Tested: cargo check --workspace
Tested: cargo test --workspace
Tested: cargo build --workspace
Tested: cargo clippy --workspace --all-targets -- -D warnings
Not-tested: Interactive manual terminal validation of Shift+Enter behavior across terminal emulators
2026-04-01 02:04:12 +00:00
Yeachan-Heo
66e947d1aa fix: default model to claw-opus-4-6 2026-04-01 01:48:21 +00:00
Yeachan-Heo
d59c041bac fix: use ASCII prompt to prevent backspace corruption 2026-04-01 01:47:32 +00:00
Yeachan-Heo
3ed414231f Merge remote-tracking branch 'origin/rcc/render' into dev/rust
# Conflicts:
#	rust/crates/claw-cli/src/main.rs
2026-04-01 01:46:17 +00:00
Yeachan-Heo
909f6ce0eb feat: rebrand to Claw Code with ASCII art banner, claw binary, lobster prompt 🦞 2026-04-01 01:44:55 +00:00
Yeachan-Heo
686017889f feat: terminal markdown rendering with ANSI colors
Add terminal markdown rendering support in the Rust CLI by extending the existing renderer with ordered lists, aligned tables, and ANSI-styled code/inline formatting. Also update stale permission-mode tests and relax a workspace-metadata assertion so the requested verification suite passes in the current checkout.

Constraint: Keep the existing renderer integration path used by main.rs and app.rs
Constraint: No new dependencies for markdown rendering or display width handling
Rejected: Replacing the renderer with a new markdown crate | unnecessary scope and integration risk
Confidence: medium
Scope-risk: moderate
Directive: Table alignment currently targets ANSI-stripped common CLI content; revisit if wide-character width handling becomes required
Tested: cargo fmt --all; cargo build; cargo test; cargo clippy --all-targets --all-features -- -D warnings
Not-tested: Manual interactive rendering in a live terminal session
2026-04-01 01:43:40 +00:00
Yeachan-Heo
fedb748ea3 fix: respect ANTHROPIC_BASE_URL in all client instantiations 2026-04-01 01:40:43 +00:00
Yeachan-Heo
98264aa3a9 feat: git integration, sandbox isolation, init command (merged from rcc branches) 2026-04-01 01:23:47 +00:00
Yeachan-Heo
cc6be803f7 Merge remote-tracking branch 'origin/rcc/api' into dev/rust
# Conflicts:
#	rust/crates/claw-cli/src/main.rs
2026-04-01 01:20:29 +00:00
Yeachan-Heo
c04ad316d4 fix: resolve thinking/streaming/update merge conflicts 2026-04-01 01:15:30 +00:00
Yeachan-Heo
f7fb193f64 Make project bootstrap available from a real init command
The Rust CLI previously hid init behind the REPL slash-command surface and only
created a starter INSTRUCTIONS.md. This change adds a direct `init` subcommand and
moves bootstrap behavior into a shared helper so `/init` and `init` create the
same project scaffolding: `.claw/`, `.claw.json`, starter `INSTRUCTIONS.md`, and
local-only `.gitignore` entries. The generated guidance now adapts to a small,
explicit set of repository markers so new projects get language/framework-aware
starting instructions without overwriting existing files.

Constraint: Runtime config precedence already treats `.claw.json`, `.claw/settings.json`, and `.claw/settings.local.json` as separate scopes
Constraint: `.claw/sessions/` is used for local session persistence and should not be committed by default
Rejected: Keep init as REPL-only `/init` behavior | would not satisfy the requested direct init command and keeps bootstrap discoverability low
Rejected: Ignore all of `.claw/` | would hide shared project config that the runtime can intentionally load
Confidence: high
Scope-risk: moderate
Reversibility: clean
Directive: Keep direct `init` and `/init` on the same helper path and keep detection heuristics bounded to explicit repository markers
Tested: cargo fmt --all; cargo clippy --workspace --all-targets -- -D warnings; cargo test --workspace
Not-tested: interactive manual run of `claw-cli init` against a non-test repository
2026-04-01 01:14:44 +00:00
Yeachan-Heo
3814b1960e Merge remote-tracking branch 'origin/rcc/update' into dev/rust
# Conflicts:
#	rust/crates/claw-cli/src/main.rs
2026-04-01 01:11:12 +00:00
Yeachan-Heo
a2a4a3435b Merge remote-tracking branch 'origin/rcc/thinking' into dev/rust
# Conflicts:
#	rust/crates/commands/src/lib.rs
#	rust/crates/claw-cli/src/main.rs
2026-04-01 01:11:06 +00:00
Yeachan-Heo
badee2a8c7 Merge remote-tracking branch 'origin/rcc/runtime' into dev/rust
# Conflicts:
#	rust/crates/claw-cli/src/main.rs
2026-04-01 01:10:53 +00:00
Yeachan-Heo
a36bae9231 Merge remote-tracking branch 'origin/rcc/cli' into dev/rust
# Conflicts:
#	rust/crates/claw-cli/src/main.rs
2026-04-01 01:10:40 +00:00
Yeachan-Heo
585e3a2652 Expose structured thinking without polluting normal assistant output
Extended thinking needed to travel end-to-end through the API,
runtime, and CLI so the client can request a thinking budget,
preserve streamed reasoning blocks, and present them in a
collapsed text-first form. The implementation keeps thinking
strictly opt-in, adds a session-local toggle, and reuses the
existing flag/slash-command/reporting surfaces instead of
introducing a new UI layer.

Constraint: Existing non-thinking text/tool flows had to remain backward compatible by default
Constraint: Terminal UX needed a lightweight collapsed representation rather than an interactive TUI widget
Rejected: Heuristic CLI-only parsing of reasoning text | brittle against structured stream payloads
Rejected: Expanded raw thinking output by default | too noisy for normal assistant responses
Confidence: medium
Scope-risk: moderate
Reversibility: clean
Directive: Keep thinking blocks structurally separate from answer text unless the upstream API contract changes
Tested: cargo fmt --all; cargo clippy --workspace --all-targets -- -D warnings; cargo test -q
Not-tested: Live upstream thinking payloads against the production API contract
2026-04-01 01:08:18 +00:00
Yeachan-Heo
83fc672260 Improve streaming feedback for CLI responses
The active Rust CLI path now keeps users informed during streaming with a waiting spinner,
inline tool call summaries, response token usage, semantic color cues, and an opt-out
 switch. The work stays inside the active  + renderer path and updates
stale runtime tests that referenced removed permission enums.

Constraint: Must keep changes in the active CLI path rather than refactoring unused app shell
Constraint: Must pass cargo fmt, clippy, and full cargo test without adding dependencies
Rejected: Route the work through  | inactive path would expand risk and scope
Confidence: high
Scope-risk: moderate
Reversibility: clean
Directive: Keep future streaming UX changes wired through renderer color settings so  remains end-to-end
Tested: cargo fmt --all; cargo clippy --all-targets --all-features -- -D warnings; cargo test
Not-tested: Interactive manual terminal run against live Anthropic streaming output
2026-04-01 01:04:56 +00:00
Yeachan-Heo
efdd2d04de Preserve verified session persistence while syncing remote runtime branch history
Origin/rcc/runtime advanced independently while this branch implemented
conversation history persistence. This merge keeps the tested local tree
as the source of truth for the user-requested feature while recording the
remote branch tip so future work can proceed from a shared history.

Constraint: Push required incorporating origin/rcc/runtime history without breaking the verified session-persistence implementation
Rejected: Force-push over origin/rcc/runtime | would discard remote branch history
Confidence: medium
Scope-risk: narrow
Reversibility: clean
Directive: Before the next broad CLI/runtime refactor, compare this branch against origin/rcc/runtime for any remote-only startup behavior worth porting deliberately
Tested: cargo fmt; cargo clippy --workspace --all-targets -- -D warnings; cargo test --workspace
Not-tested: Remote-only runtime startup semantics not exercised by the session persistence change
2026-04-01 01:02:05 +00:00
Yeachan-Heo
c02089b90b Enable safe in-place CLI self-updates from GitHub releases
Add a self-update command to the Rust CLI that checks the latest GitHub release, compares versions, downloads a matching binary plus checksum manifest, verifies SHA-256, and swaps the executable only after validation succeeds. The command reports changelog text from the release body and exits safely when no published release or matching asset exists.\n\nThe workspace verification request also surfaced unrelated stale permission-mode references in runtime tests and a brittle config-count assertion in the CLI tests. Those were updated so the requested fmt/clippy/test pass can complete cleanly in this worktree.\n\nConstraint: GitHub latest release for instructkr/clawd-code currently returns 404, so the updater must degrade safely when no published release exists\nConstraint: Must not replace the current executable before checksum verification succeeds\nRejected: Shell out to an external updater | environment-dependent and does not meet the GitHub API/changelog requirement\nRejected: Add archive extraction support now | no published release assets exist yet to justify broader packaging complexity\nConfidence: medium\nScope-risk: moderate\nReversibility: clean\nDirective: Keep release asset naming and checksum manifest conventions aligned with the eventual GitHub release pipeline before expanding packaging formats\nTested: cargo fmt; cargo clippy --workspace --all-targets -- -D warnings; cargo test --workspace --exclude compat-harness; cargo run -q -p claw-cli -- self-update\nNot-tested: Successful live binary replacement against a real published GitHub release asset
2026-04-01 01:01:26 +00:00
Yeachan-Heo
1e354521fb Merge remote-tracking branch 'origin/rcc/tools' into dev/rust 2026-04-01 01:00:37 +00:00
Yeachan-Heo
d3275cbe45 Merge remote-tracking branch 'origin/rcc/memory' into dev/rust 2026-04-01 01:00:37 +00:00
Yeachan-Heo
5a6becefa0 Merge remote-tracking branch 'origin/rcc/image' into dev/rust
# Conflicts:
#	rust/crates/claw-cli/src/main.rs
2026-04-01 01:00:37 +00:00
Yeachan-Heo
a30edf41a4 Merge remote-tracking branch 'origin/rcc/doctor' into dev/rust
# Conflicts:
#	rust/crates/claw-cli/src/main.rs
2026-04-01 01:00:31 +00:00
Yeachan-Heo
d8c6a3003b Make local environment failures diagnosable from the CLI
Add a non-interactive doctor subcommand that checks API key reachability, OAuth credential state, config files, git, MCP servers, network access, and system metadata in one structured report. The implementation reuses existing runtime/auth plumbing and adds focused tests for parsing and report behavior.

Also update stale runtime permission-mode tests so workspace verification reflects the current enum model rather than historical Prompt/Allow variants.

Constraint: Keep diagnostics dependency-free and reuse existing runtime/auth/MCP code
Rejected: Add a REPL-only slash command | diagnostics must work before a session starts
Rejected: Split checks into multiple subcommands | higher surface area with less troubleshooting value
Confidence: medium
Scope-risk: moderate
Reversibility: clean
Directive: Keep doctor checks bounded and non-destructive; if future probes become slower or stateful, gate them explicitly
Tested: cargo fmt --all --check; cargo clippy --workspace --all-targets -- -D warnings; cargo test --workspace; cargo run -p claw-cli -- doctor
Not-tested: Positive live API-key validation path against a known-good production credential
2026-04-01 00:59:57 +00:00
Yeachan-Heo
6b84fcfaa0 Enable Agent tool child execution with bounded recursion
The Agent tool previously stopped at queued handoff metadata, so this change runs a real nested conversation, preserves artifact output, and guards recursion depth. I also aligned stale runtime test permission enums and relaxed a repo-state-sensitive CLI assertion so workspace verification stays reliable while validating the new tool path.

Constraint: Reuse existing runtime conversation abstractions without introducing a new orchestration service
Constraint: Child agent execution must preserve the same tool surface while preventing unbounded nesting
Rejected: Shell out to the CLI binary for child execution | brittle process coupling and weaker testability
Rejected: Leave Agent as metadata-only handoff | does not satisfy requested sub-agent orchestration behavior
Confidence: high
Scope-risk: moderate
Reversibility: clean
Directive: Keep Agent recursion limits enforced wherever nested Agent calls can re-enter the tool executor
Tested: cargo fmt --all --manifest-path rust/Cargo.toml; cargo test --manifest-path rust/Cargo.toml; cargo clippy --manifest-path rust/Cargo.toml --workspace --all-targets -- -D warnings
Not-tested: Live Anthropic-backed child agent execution against production credentials
2026-04-01 00:59:20 +00:00
Yeachan-Heo
063c84df40 Enable local image prompts without breaking text-only CLI flows
The Rust CLI now recognizes explicit local image references in prompt text,
encodes supported image files as base64, and serializes mixed text/image
content blocks for the API. The request conversion path was kept narrow so
existing runtime/session structures remain stable while prompt mode and user
text conversion gain multimodal support.

Constraint: Must support PNG, JPG/JPEG, GIF, and WebP without adding broad runtime abstractions
Constraint: Existing text-only prompt behavior and API tool flows must keep working unchanged
Rejected: Add only explicit --image CLI flags | does not satisfy auto-detect image refs in prompt text
Rejected: Persist native image blocks in runtime session model | broader refactor than needed for prompt support
Confidence: high
Scope-risk: moderate
Reversibility: clean
Directive: Keep image parsing scoped to outbound user prompt adaptation unless session persistence truly needs multimodal history
Tested: cargo fmt --all; cargo clippy --workspace --all-targets -- -D warnings; cargo test --workspace
Not-tested: Live remote multimodal request against Anthropic API
2026-04-01 00:59:16 +00:00
Yeachan-Heo
ec898b808f Preserve local project context across compaction and todo updates
This change makes compaction summaries durable under .claw/memory,
feeds those saved memory files back into prompt context, updates /memory
to report both instruction and project-memory files, and moves TodoWrite
persistence to a human-readable .claw/todos.md file.

Constraint: Reuse existing compaction, prompt loading, and slash-command plumbing rather than add a new subsystem
Constraint: Keep persisted project state under Claw-local .claw/ paths
Rejected: Introduce a dedicated memory service module | larger diff with no clear user benefit for this task
Confidence: high
Scope-risk: moderate
Reversibility: clean
Directive: Project memory files are loaded as prompt context, so future format changes must preserve concise readable content
Tested: cargo fmt --all --manifest-path rust/Cargo.toml
Tested: cargo clippy --manifest-path rust/Cargo.toml --all-targets --all-features -- -D warnings
Tested: cargo test --manifest-path rust/Cargo.toml --all
Not-tested: Long-term retention/cleanup policy for .claw/memory growth
2026-04-01 00:58:36 +00:00