Skip to content

feat: generalize executor to support arbitrary shell commands (not just Claude Code) #7

@jimmy-claw

Description

@jimmy-claw

Problem

Currently the executor framework only supports one payload type: a Claude Code prompt. Long-running background tasks (nix builds, cargo builds, sequencer runs) need tracking too — but today we handle these with fragile nohup ... & + cron monitor patterns.

Proposal

Generalize the Task abstraction to support two payload types:

pub enum TaskPayload {
    ClaudeCode { prompt: String, max_turns: u32, workspace: Option<PathBuf> },
    ShellCommand { command: String, args: Vec<String>, env: HashMap<String, String>, working_dir: Option<PathBuf> },
}

SSH/container/local executors already run remote processes — they just need to branch on payload type instead of always invoking claude.

CLI interface

# New: arbitrary command
openclaw-agent run --executor crib --cmd "nix build" --workdir ~/logos-lez-multisig-module
openclaw-agent run --executor crib --cmd "cargo test --workspace" --workdir ~/lez-framework

All existing features unchanged: task IDs, log streaming, dashboard visibility, completion callbacks.

Benefits

  • For Jimmy (agent): no more nohup ... & + cron monitor patterns. Dispatch a build, get notified when done.
  • For Václav: all background work (coding tasks AND builds/jobs) visible in one dashboard panel.
  • OpenClaw integration: main session can call openclaw-agent run to dispatch heavy work without blocking.

Implementation notes

  • Add ShellCommand variant to TaskPayload in executor-core
  • SSH/container/local executors: branch on payload type
  • CLI: add run subcommand (or extend start with --cmd flag)
  • Dashboard: show task type (🤖 Claude / ⚙️ Command) in task list

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions