{
  "@context": "https://schema.org",
  "@id": "https://aggr.aymericbeaumet.com/items/ampcode-com/2025-07-24-amp-dash-x/#webpage",
  "@type": [
    "WebPage",
    "ArchiveComponent"
  ],
  "articleBody": "The [Amp CLI](https://ampcode.com/manual#getting-started-command-line-interface) has a new flag: `--execute`.\n\n`-x` for short.\n\nThat flag turns on execute mode, which allows for programmatic use of the Amp CLI.\n\nThe CLI sends the given prompt to the agent and waits until the agent is done. Then it prints the agent's last message.\n\n```shell-session\n$ amp -x \"Give me a list of targets in this Makefile. Only the names.\"\ngit\nzsh\nghostty\natuin\njj\nall\n```\n\n```shell-session\n$ amp -x \"Rename all .markdown files to .md then print the new names.\"\n- readme.markdown → readme.md\n- ghostty.markdown → ghostty.md\n```\n\nYou can also pipe input to it:\n\n```shell-session\n$ echo \"what package manager do we use here? reply only with name.\" | amp -x\npnpm\n```\n\nExecute mode is automatically turned on when you redirect stdout:\n\n```shell-session\n$ echo \"list all markdown files in here\" | amp > output.txt\n$ cat output.txt\nREADME.md\nCONTRIBUTING.md\nYOURE_ABSOLUTELY_RIGHT.md\n```\n\nYou can also use execute mode with `threads continue`:\n\n```shell-session\n$ amp -x \"what is 2+2?\"\n4\n\n$ amp threads continue -x \"add 5 to that\"\n9\n\n$ amp threads continue -x \"now minus 3\"\n6\n```\n",
  "authors": [],
  "captured_at": "2026-10-04T12:50:30.804479567+00:00",
  "category": "programming",
  "content_html": "<p>The <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://ampcode.com/manual#getting-started-command-line-interface\">Amp CLI</a> has a new flag: <code>--execute</code>.</p>\n<p><code>-x</code> for short.</p>\n<p>That flag turns on execute mode, which allows for programmatic use of the Amp CLI.</p>\n<p>The CLI sends the given prompt to the agent and waits until the agent is done. Then it prints the agent's last message.</p>\n<pre><code class=\"language-shell-session\"><span class=\"code-snippet\" data-language=\"Shell-session\">$ amp -x &quot;Give me a list of targets in this Makefile. Only the names.&quot;\ngit\nzsh\nghostty\natuin\njj\nall\n</span></code></pre>\n<pre><code class=\"language-shell-session\"><span class=\"code-snippet\" data-language=\"Shell-session\">$ amp -x &quot;Rename all .markdown files to .md then print the new names.&quot;\n- readme.markdown → readme.md\n- ghostty.markdown → ghostty.md\n</span></code></pre>\n<p>You can also pipe input to it:</p>\n<pre><code class=\"language-shell-session\"><span class=\"code-snippet\" data-language=\"Shell-session\">$ echo &quot;what package manager do we use here? reply only with name.&quot; | amp -x\npnpm\n</span></code></pre>\n<p>Execute mode is automatically turned on when you redirect stdout:</p>\n<pre><code class=\"language-shell-session\"><span class=\"code-snippet\" data-language=\"Shell-session\">$ echo &quot;list all markdown files in here&quot; | amp &gt; output.txt\n$ cat output.txt\nREADME.md\nCONTRIBUTING.md\nYOURE_ABSOLUTELY_RIGHT.md\n</span></code></pre>\n<p>You can also use execute mode with <code>threads continue</code>:</p>\n<pre><code class=\"language-shell-session\"><span class=\"code-snippet\" data-language=\"Shell-session\">$ amp -x &quot;what is 2+2?&quot;\n4\n\n$ amp threads continue -x &quot;add 5 to that&quot;\n9\n\n$ amp threads continue -x &quot;now minus 3&quot;\n6\n</span></code></pre>\n",
  "content_markdown": "The [Amp CLI](https://ampcode.com/manual#getting-started-command-line-interface) has a new flag: `--execute`.\n\n`-x` for short.\n\nThat flag turns on execute mode, which allows for programmatic use of the Amp CLI.\n\nThe CLI sends the given prompt to the agent and waits until the agent is done. Then it prints the agent's last message.\n\n```shell-session\n$ amp -x \"Give me a list of targets in this Makefile. Only the names.\"\ngit\nzsh\nghostty\natuin\njj\nall\n```\n\n```shell-session\n$ amp -x \"Rename all .markdown files to .md then print the new names.\"\n- readme.markdown → readme.md\n- ghostty.markdown → ghostty.md\n```\n\nYou can also pipe input to it:\n\n```shell-session\n$ echo \"what package manager do we use here? reply only with name.\" | amp -x\npnpm\n```\n\nExecute mode is automatically turned on when you redirect stdout:\n\n```shell-session\n$ echo \"list all markdown files in here\" | amp > output.txt\n$ cat output.txt\nREADME.md\nCONTRIBUTING.md\nYOURE_ABSOLUTELY_RIGHT.md\n```\n\nYou can also use execute mode with `threads continue`:\n\n```shell-session\n$ amp -x \"what is 2+2?\"\n4\n\n$ amp threads continue -x \"add 5 to that\"\n9\n\n$ amp threads continue -x \"now minus 3\"\n6\n```\n",
  "dateCreated": "2026-10-04T12:50:30.804479567+00:00",
  "date_created": "2025-07-24T00:00:00+00:00",
  "date_modified": "2025-07-24T00:00:00+00:00",
  "date_published": "2025-07-24T00:00:00+00:00",
  "description": "The Amp CLI has a new flag: --execute. -x for short. That flag turns on execute mode, which allows for programmatic use of the Amp CLI. The CLI sends the given prompt to the agent and waits until the agent is done. Then it prints the…",
  "external_url": "https://ampcode.com/news/amp-x",
  "git": {
    "commit": "ebb0941c5c06a2ab2377342d607535262a3e969e",
    "path": "items/ampcode-com/2025/07/2025-07-24-amp-dash-x.md",
    "permalink": "https://github.com/aymericbeaumet/aggr-instance/blob/ebb0941c5c06a2ab2377342d607535262a3e969e/items/ampcode-com/2025/07/2025-07-24-amp-dash-x.md"
  },
  "id": "urn:aggr:item:07791e74a538852aa26f2a6f819bcabb5fe0f80f",
  "isBasedOn": {
    "@id": "https://ampcode.com/news/amp-x"
  },
  "mainEntity": {
    "@id": "https://ampcode.com/news/amp-x",
    "@type": "CreativeWork",
    "archivedAt": {
      "@id": "https://aggr.aymericbeaumet.com/items/ampcode-com/2025-07-24-amp-dash-x/#webpage"
    },
    "dateModified": "2025-07-24T00:00:00+00:00",
    "datePublished": "2025-07-24T00:00:00+00:00",
    "headline": "amp dash x",
    "timeRequired": "PT1M",
    "url": "https://ampcode.com/news/amp-x",
    "wordCount": 165
  },
  "name": "Archived snapshot: amp dash x",
  "preview": null,
  "reading_minutes": 1,
  "replicated_at": null,
  "source": "ampcode-com",
  "source_name": "Amp News",
  "summary": "The Amp CLI has a new flag: --execute. -x for short. That flag turns on execute mode, which allows for programmatic use of the Amp CLI. The CLI sends the given prompt to the agent and waits until the agent is done. Then it prints the agent's last message. $ amp -x \"Give me a list of targets in this Makefile. Only the names.\" git zsh ghostty atuin jj all $ amp -x \"Rename all .markdown files to .md then print the new names.\" - readme.markdown → readme.md - ghostty.markdown → ghostty.md You can also pipe input to it: $ echo \"what package manager do we use here? reply only with name.\" | amp -x pnpm Execute mode is automatically turned on when you redirect stdout: $ echo \"list all markdown files in here\" | amp > output.txt $ cat output.txt README.md CONTRIBUTING.md YOURE_ABSOLUTELY_RIGHT.md You can also use execute mode with threads continue: $ amp -x \"what is 2+2?\" 4 $ amp threads continue -x \"add 5 to that\" 9 $ amp threads continue -x \"now minus 3\" 6",
  "tags": [],
  "temporalCoverage": "2026-10-04T12:50:30.804479567+00:00",
  "title": "amp dash x",
  "url": "https://aggr.aymericbeaumet.com/items/ampcode-com/2025-07-24-amp-dash-x/",
  "word_count": 165
}