[
    {
        "role": "user",
        "content": "to%20do%20openclaw%20interactively%2C%20we%20run%20openclaw%20tty.%20how%20can%20we%20just%20ask%20a%20question%20from%20command%20line%2C%20similar%20to%20claude%20-p"
    },
    {
        "role": "assistant",
        "content": "You can, but as of now OpenClaw doesn\u2019t offer a built-in \u201cask in non-interactive mode via command-line only\u201d (like a `claude -p \"Your prompt\"` style) option in its CLI. Here\u2019s what the current functionality and limitations look like, plus some potential workarounds.\n\n---\n\n### \u2705 What *is* possible today\n\n- The CLI reference docs say that if you run  \n  `openclaw` *without* a message argument, it will start an **interactive chat session**. ([clawdocs.org](https://clawdocs.org/reference/cli/?utm_source=openai))  \n- There are commands like `openclaw status`, `openclaw gateway start`, `openclaw models list`, etc. useful for managing and inspecting the system. ([clawguides.ai](https://clawguides.ai/tools/cli-reference?utm_source=openai))  \n- You *can* add channels, configure skills, view logs, etc.\u2014basically, administration and usage configuration all through the command line. ([clawguides.ai](https://clawguides.ai/tools/cli-reference?utm_source=openai))  \n\n---\n\n### \u26a0\ufe0f What *isn\u2019t* currently supported\n\n- There is **no documented flag or command** that lets you pass a prompt through the CLI, get a response, and exit without going into the interactive mode.  \n- The docs make it clear: \u201cwithout a message argument, starts an interactive chat session.\u201d That implies that there *is* a message argument\u2014but I couldn\u2019t find any evidence in the CLI docs that a `--message`, `-m`, or similar flag is implemented. ([clawdocs.org](https://clawdocs.org/reference/cli/?utm_source=openai))  \n- Users on Reddit also seem to be asking for headless or scriptable prompt-responses, but there aren\u2019t solid workarounds offered so far. ([reddit.com](https://www.reddit.com/r/openclaw/comments/1s7wmih/headless_setup_without_tuiweb/?utm_source=openai))  \n\n---\n\n### \ud83d\udca1 Possible workarounds\n\nIf you need to \u201cask a question\u201d from the command line (non-interactive), here are a few hacks people might try; none of them are officially supported, so tread carefully, especially security wise.\n\n1. **Use CLI + expect / script**  \n   You could spawn the `openclaw` command in a TTY with `expect`, feeding it the prompt, reading the output, then exiting. But OpenClaw might require interactive approval steps or approvals if tools are enabled, making automation brittle.\n\n2. **Modify the config / write a small wrapper**  \n   If you're comfortable tinkering: inspect how `openclaw` stores data, maybe bypass the interactive prompt path by tweaking the configuration files or implement a wrapper that calls the internal API.\n\n3. **Use the gateway HTTP API**  \n   OpenClaw\u2019s gateway has endpoints you can possibly call with HTTP. If there is an API for sending messages to the agent (you\u2019ll need to check your version\u2019s API docs), then you can send a prompt to that endpoint and read the response. (Note: this might require an API token.)\n\n4. **Fork / request a feature**  \n   If this capability is important, submitting a feature request to the OpenClaw GitHub repo could help. Given its open-source nature, community contributions are possible.  \n\n---\n\nIf you tell me your OpenClaw version (output of `openclaw --version`) and what host OS you're on (Linux / macOS / Windows), I can try digging into whether the version you have supports any hidden or undocumented \u201cprompt flag\u201d feature. Do you want me to check that for your version?"
    }
]