Illia Polosukhin eb75a62a97 feat(debug-panel): expand Activity tab coverage with CodeAct + warnings (#2850)
* feat(debug-panel): expand Activity tab coverage with CodeAct + warnings

The Activity tab was missing most event types: CodeAct runs showed only
lossy chat summaries, WARN/ERROR logs only landed in server stdout, and
tool entries hid their parameters on success.

- Emit AppEvent::CodeExecuted (verbose-only) with raw code, stdout, and
  return value from the engine orchestrator so observers see what the
  model actually wrote.
- Bridge WARN/ERROR tracing into AppEvent::Warning via
  spawn_warning_bridge, scoped by owner_id in multi-tenant mode to
  prevent cross-tenant log bleed.
- Backfill params_summary on ActionExecuted/ActionFailed events from
  structured + scripting executors so the Activity tab shows tool args
  immediately (not just on failure) without waiting for tool_completed.
- Wire debug-panel.js to render code_executed, warning, gate_required,
  gate_resolved, approval_needed, skill_activated, plan_update,
  thread_state_changed, child/mission_thread_spawned, onboarding_state,
  image_generated, suggestions, and the full sandbox-job event family.
- Extract shared on(name, handler) wrapper to dedupe ~25 copies of the
  JSON-parse + reconnect-counter housekeeping and keep lastEventTime
  bookkeeping consistent across listeners.
- Add i18n strings (en/ko/zh-CN) and CSS icon colors for the new
  activity types.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(debug-panel): address review feedback on activity-trace PR

- summarize_params generic fallback: skip sensitive-looking parameter
  keys (token/secret/password/api_key/auth/credential/bearer) so MCP
  and unknown-tool calls can't surface secret values into
  ActionExecuted events or debug-panel SSE. Adds two regression tests.
- Cap CodeExecuted code/stdout at 8_000 chars (tail-last) before
  emission so a step that prints a large blob can't bloat persisted
  thread events. Matches the existing scripting OUTPUT_TRUNCATE_LEN.
- await_thread_outcome: skip broadcasting verbose-only AppEvents when
  no debug subscriber is connected — mirrors the send_status gate
  and keeps CodeExecuted off the shared SSE broadcast buffer for
  normal browser tabs.
- spawn_warning_bridge: same short-circuit on has_verbose_receivers.
- debug-panel.js: introduce GATE_RESOLUTION_STATUS so `expired`
  (a failure path from router.rs) no longer renders as a green
  success badge; shared STATUS_TO_ACTIVITY map is kept for jobs/
  plans/onboarding where `success` is the right default.
- debug-panel.js: migrate the remaining legacy listeners to the
  shared on() wrapper so lastEventTime / totalEventsReceived
  bookkeeping stays consistent across every activity listener.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(debug-panel): address PR #2850 follow-up review on leak / tenant scoping

- Warning bridge (`src/channels/web/mod.rs`): disable entirely in
  multi-tenant mode. The `tracing` layer captures log context at the
  global subscriber scope, not at request scope, so scoping the bridge
  to the gateway `owner_id` misroutes tenant A's WARN/ERROR log lines
  to the admin account (and prevents tenant A from ever seeing them).
  Per-request provenance would need threading through every `warn!` /
  `error!` call site — out of scope for this PR — so the safe move is
  to keep the bridge off until that lands.
- `summarize_params` (`crates/ironclaw_engine/src/types/event.rs`):
  strip URL query strings / fragments / userinfo for `http` and
  `web_fetch`, and redact auth-bearing flag values (`-H`, `--header`,
  `-u`, `--user`, `--token`, `--api-key`, `--password`, `--auth`,
  `--bearer`) plus embedded URL query strings inside `shell` commands.
  Signed URLs, inline `Authorization: Bearer …` headers, and query-
  string API keys no longer reach `ToolCompleted.parameters` on the
  debug SSE stream. Six regression tests added.
- `CodeExecuted` redaction (`src/bridge/router.rs`): apply the leak
  detector to `code` / `stdout` / `return_value` at the bridge
  boundary before SSE broadcast. The engine crate has no dependency on
  `ironclaw_safety`, so scrubbing lives here. Adds
  `SafetyLayer::leak_detector()` and `EffectBridgeAdapter::safety()`
  accessors. Handles both `Redact` and `Block`-action matches
  (scan_and_clean's `redacted_content` is `None` for Block-only
  matches, which would have passed bearer tokens / API keys through
  unchanged). Regression test covers string and nested-JSON cases.

* fix(debug-panel): address PR #2850 Copilot follow-up review

- `src/channels/web/log_layer.rs`: annotate `spawn_warning_bridge`'s
  `sse.broadcast_for_user` / `sse.broadcast` sites with
  `// projection-exempt: log source, WARN/ERROR tracing bridge →
  AppEvent::Warning` so the PROJECTION safety check (#9 in
  `scripts/pre-commit-safety.sh`) recognises the tracing
  `LogBroadcaster` as a typed source log. Added a comment block
  explaining why the source-log category isn't yet in
  `.claude/rules/gateway-events.md`'s table.
- `crates/ironclaw_engine/src/executor/orchestrator.rs`: replace
  `tail_chars` (O(n) via `chars().count()`) with a local
  `tail_utf8_bytes` helper for the `CodeExecuted` emission path. Byte
  based so it stays O(1) + ≤3-byte UTF-8 boundary walk for arbitrarily
  large `code`/`stdout`. Also add `bounded_return_value` so a CodeAct
  snippet returning a 50 MB JSON value doesn't bloat persisted thread
  events — strings are tail-truncated; structured values that
  serialize past 8 KiB are dropped to `None` (rather than truncated
  into unparseable JSON). Seven regression tests cover ASCII / emoji
  boundary / null / small struct / oversized struct / large-string
  paths.

`tail_chars` is kept unchanged for its existing callers, whose inputs
are already bounded (`OUTPUT_TRUNCATE_LEN`, 500-char error slices).

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-24 13:48:02 +09:00
2026-02-22 19:08:43 +00:00
2026-02-22 19:08:43 +00:00
2026-02-21 15:14:57 -07:00

IronClaw

IronClaw

Your secure personal AI assistant, always on your side

License: MIT OR Apache-2.0 Telegram: @ironclawAI Reddit: r/ironclawAI gitcgr

English | 简体中文 | Русский | 日本語 | 한국어

PhilosophyFeaturesInstallationConfigurationSecurityArchitecture


Philosophy

IronClaw is built on a simple principle: your AI assistant should work for you, not against you.

In a world where AI systems are increasingly opaque about data handling and aligned with corporate interests, IronClaw takes a different approach:

  • Your data stays yours - All information is stored locally, encrypted, and never leaves your control
  • Transparency by design - Open source, auditable, no hidden telemetry or data harvesting
  • Self-expanding capabilities - Build new tools on the fly without waiting for vendor updates
  • Defense in depth - Multiple security layers protect against prompt injection and data exfiltration

IronClaw is the AI assistant you can actually trust with your personal and professional life.

Features

Security First

  • WASM Sandbox - Untrusted tools run in isolated WebAssembly containers with capability-based permissions
  • Credential Protection - Secrets are never exposed to tools; injected at the host boundary with leak detection
  • Prompt Injection Defense - Pattern detection, content sanitization, and policy enforcement
  • Endpoint Allowlisting - HTTP requests only to explicitly approved hosts and paths

Always Available

  • Multi-channel - REPL, HTTP webhooks, WASM channels (Telegram, Slack), and web gateway
  • Docker Sandbox - Isolated container execution with per-job tokens and orchestrator/worker pattern
  • Web Gateway - Browser UI with real-time SSE/WebSocket streaming
  • Routines - Cron schedules, event triggers, webhook handlers for background automation
  • Heartbeat System - Proactive background execution for monitoring and maintenance tasks
  • Parallel Jobs - Handle multiple requests concurrently with isolated contexts
  • Self-repair - Automatic detection and recovery of stuck operations

Self-Expanding

  • Dynamic Tool Building - Describe what you need, and IronClaw builds it as a WASM tool
  • MCP Protocol - Connect to Model Context Protocol servers for additional capabilities
  • Plugin Architecture - Drop in new WASM tools and channels without restarting

Persistent Memory

  • Hybrid Search - Full-text + vector search using Reciprocal Rank Fusion
  • Workspace Filesystem - Flexible path-based storage for notes, logs, and context
  • Identity Files - Maintain consistent personality and preferences across sessions

Installation

Prerequisites

  • Rust 1.85+
  • PostgreSQL 15+ with pgvector extension
  • NEAR AI account (authentication handled via setup wizard)

Download or Build

Visit Releases page to see the latest updates.

Install via Windows Installer (Windows)

Download the Windows Installer and run it.

Install via powershell script (Windows)
irm https://github.com/nearai/ironclaw/releases/latest/download/ironclaw-installer.ps1 | iex
Install via shell script (macOS, Linux, Windows/WSL)
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/nearai/ironclaw/releases/latest/download/ironclaw-installer.sh | sh
Install via Homebrew (macOS/Linux)
brew install ironclaw
Compile the source code (Cargo on Windows, Linux, macOS)

Install it with cargo, just make sure you have Rust installed on your computer.

# Clone the repository
git clone https://github.com/nearai/ironclaw.git
cd ironclaw

# Build
cargo build --release

# Run tests
cargo test

For full release (after modifying channel sources), run ./scripts/build-all.sh to rebuild channels first.

Database Setup

# Create database
createdb ironclaw

# Enable pgvector
psql ironclaw -c "CREATE EXTENSION IF NOT EXISTS vector;"

Configuration

Run the setup wizard to configure IronClaw:

ironclaw onboard

The wizard handles database connection, NEAR AI authentication (via browser OAuth), and secrets encryption (using your system keychain). Settings are persisted in the connected database; bootstrap variables (e.g. DATABASE_URL, LLM_BACKEND) are written to ~/.ironclaw/.env so they are available before the database connects.

Alternative LLM Providers

IronClaw defaults to NEAR AI but supports many LLM providers out of the box. Built-in providers include Anthropic, OpenAI, GitHub Copilot, Google Gemini, MiniMax, Mistral, and Ollama (local). OpenAI-compatible services like OpenRouter (300+ models), Together AI, Fireworks AI, and self-hosted servers (vLLM, LiteLLM) are also supported.

Select your provider in the wizard, or set environment variables directly:

# Example: MiniMax (built-in, 204K context)
LLM_BACKEND=minimax
MINIMAX_API_KEY=...

# Example: OpenAI-compatible endpoint
LLM_BACKEND=openai_compatible
LLM_BASE_URL=https://openrouter.ai/api/v1
LLM_API_KEY=sk-or-...
LLM_MODEL=anthropic/claude-sonnet-4

See docs/capabilities/llm-providers.md for a full provider guide.

Security

IronClaw implements defense in depth to protect your data and prevent misuse.

WASM Sandbox

All untrusted tools run in isolated WebAssembly containers:

  • Capability-based permissions - Explicit opt-in for HTTP, secrets, tool invocation
  • Endpoint allowlisting - HTTP requests only to approved hosts/paths
  • Credential injection - Secrets injected at host boundary, never exposed to WASM code
  • Leak detection - Scans requests and responses for secret exfiltration attempts
  • Rate limiting - Per-tool request limits to prevent abuse
  • Resource limits - Memory, CPU, and execution time constraints
WASM ──► Allowlist ──► Leak Scan ──► Credential ──► Execute ──► Leak Scan ──► WASM
         Validator     (request)     Injector       Request     (response)

Prompt Injection Defense

External content passes through multiple security layers:

  • Pattern-based detection of injection attempts
  • Content sanitization and escaping
  • Policy rules with severity levels (Block/Warn/Review/Sanitize)
  • Tool output wrapping for safe LLM context injection

Data Protection

  • All data stored locally in your PostgreSQL database
  • Secrets encrypted with AES-256-GCM
  • No telemetry, analytics, or data sharing
  • Full audit log of all tool executions

Architecture

┌────────────────────────────────────────────────────────────────┐
│                          Channels                              │
│  ┌──────┐  ┌──────┐   ┌─────────────┐  ┌─────────────┐         │
│  │ REPL │  │ HTTP │   │WASM Channels│  │ Web Gateway │         │
│  └──┬───┘  └──┬───┘   └──────┬──────┘  │ (SSE + WS)  │         │
│     │         │              │         └──────┬──────┘         │
│     └─────────┴──────────────┴────────────────┘                │
│                              │                                 │
│                    ┌─────────▼─────────┐                       │
│                    │    Agent Loop     │  Intent routing       │
│                    └────┬──────────┬───┘                       │
│                         │          │                           │
│              ┌──────────▼────┐  ┌──▼───────────────┐           │
│              │  Scheduler    │  │ Routines Engine  │           │
│              │(parallel jobs)│  │(cron, event, wh) │           │
│              └──────┬────────┘  └────────┬─────────┘           │
│                     │                    │                     │
│       ┌─────────────┼────────────────────┘                     │
│       │             │                                          │
│   ┌───▼─────┐  ┌────▼────────────────┐                         │
│   │ Local   │  │    Orchestrator     │                         │
│   │Workers  │  │  ┌───────────────┐  │                         │
│   │(in-proc)│  │  │ Docker Sandbox│  │                         │
│   └───┬─────┘  │  │   Containers  │  │                         │
│       │        │  │ ┌───────────┐ │  │                         │
│       │        │  │ │Worker / CC│ │  │                         │
│       │        │  │ └───────────┘ │  │                         │
│       │        │  └───────────────┘  │                         │
│       │        └─────────┬───────────┘                         │
│       └──────────────────┤                                     │
│                          │                                     │
│              ┌───────────▼──────────┐                          │
│              │    Tool Registry     │                          │
│              │  Built-in, MCP, WASM │                          │
│              └──────────────────────┘                          │
└────────────────────────────────────────────────────────────────┘

Core Components

Component Purpose
Agent Loop Main message handling and job coordination
Router Classifies user intent (command, query, task)
Scheduler Manages parallel job execution with priorities
Worker Executes jobs with LLM reasoning and tool calls
Orchestrator Container lifecycle, LLM proxying, per-job auth
Web Gateway Browser UI with chat, memory, jobs, logs, extensions, routines
Routines Engine Scheduled (cron) and reactive (event, webhook) background tasks
Workspace Persistent memory with hybrid search
Safety Layer Prompt injection defense and content sanitization

Usage

Engine v2 is opt-in right now. If you want to run the new engine instead of the legacy agent loop, start IronClaw with ENGINE_V2=true. See Engine v2 architecture for more details.

# First-time setup (configures database, auth, etc.)
ironclaw onboard

# Start interactive REPL
cargo run

# Start interactive REPL with engine v2
ENGINE_V2=true cargo run

# Engine v2 with debug logging
ENGINE_V2=true RUST_LOG=ironclaw=debug cargo run

Development

# Format code
cargo fmt

# Lint
cargo clippy --all --benches --tests --examples --all-features

# Run tests
createdb ironclaw_test
cargo test

# Run specific test
cargo test test_name
  • Channels: See docs/channels/overview.mdx for setup of Telegram, Discord, and other channels.
  • Changing channel sources: Run ./channels-src/telegram/build.sh before cargo build so the updated WASM is bundled.

OpenClaw Heritage

IronClaw is a Rust reimplementation inspired by OpenClaw. See FEATURE_PARITY.md for the complete tracking matrix.

Key differences:

  • Rust vs TypeScript - Native performance, memory safety, single binary
  • WASM sandbox vs Docker - Lightweight, capability-based security
  • PostgreSQL vs SQLite - Production-ready persistence
  • Security-first design - Multiple defense layers, credential protection

License

Licensed under either of:

at your option.

Description
IronClaw is OpenClaw inspired implementation in Rust focused on privacy and security IronClaw 基于一个简单的原则:你的 AI 助手应该为你服务,而不是与你为敌。
Readme 1.8 GiB
Languages
Rust 86%
Python 7.5%
JavaScript 3.4%
Shell 1.9%
CSS 0.9%
Other 0.2%