{
  "id": 17481128,
  "title": "Your Half-Typed Prompt Lives Inside the Agent, Not the Terminal. Injected Commands Hit It",
  "url": "https://urgent.news/2026/10/31/your-half-typed-prompt-lives-inside-the-agent-not-the-terminal",
  "topic": "culture",
  "section": "Culture",
  "published": "2026-10-31T22:01:15.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/gabrielanhaia/your-half-typed-prompt-lives-inside-the-agent-not-the-terminal-injected-commands-hit-it-2011"
  },
  "original_language": "en",
  "account": "In the world of prompt engineering, a half-typed prompt actually resides inside a full-screen agent, not the terminal. When you're halfway through a sentence in Claude Code, like \"fix the flaky login test but don't touch\", the command you type, including \"/compact\", doesn't actually run as a command. This is because the agent owns the terminal and processes the input differently than a normal shell.\n\nThe source material explains that in a normal shell, input is processed line by line, with line editing enabled. However, full-screen agents, such as Claude Code, switch this off. By using libraries like Ink, Node's setRawMode, and crossterm, the agent reads keys character-by-character, without line buffering or line editing. This means every keystroke goes straight to the agent, which keeps the draft in its own memory and decides how to handle backspace or enter keystrokes.\n\nTo demonstrate this, the source provides two small Python scripts. The first, \"toy_agent.py\", switches its terminal to raw mode and keeps its own draft. The second, \"inject.py\", starts the toy agent in a pseudo-terminal, then simulates typing half of a prompt and then \"/help\" command. This shows how the agent processes the input, regardless of what is typed in the terminal.\n\nThe key takeaway is that in modern prompt engineering tools, the half-typed prompt lives inside the agent, not the terminal. The terminal is just a display for the agent's output. Understanding this can help developers deal with commands that are injected into running agents, and avoid unexpected behavior.",
  "summary": "Book: Prompt Engineering Pocket Guide The series: Pocket Guides for Developers — 8 short books on agents, RAG, prompts, observability, events, databases and system design — the whole series My project: Hermes IDE | GitHub — an IDE for developers who ship with Claude Code and other AI coding tools Me: xgabriel.com | GitHub You are halfway through a sentence in Claude Code : fix the flaky login…",
  "key_points": [
    "Half-typed prompt resides inside agent, not terminal",
    "Agent processes input character-by-character, no line buffering",
    "Injected commands like /help are handled by the agent"
  ],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}