Skip to content

Prompt Injection Node

Vitor Lima edited this page Mar 19, 2026 · 1 revision

The Prompt Injection node lets your agent insert dynamic text into the AI's context — without it appearing as a visible chat message to the user. This is how you feed instructions, world state, or context to characters behind the scenes.

Inputs

Input Type Required Description
Prompt Content String Yes The text to inject into the AI's prompt.

Outputs

This node has no outputs. It's a "sink" — it receives data and acts on it.

Configuration

Click the settings icon to configure how and where the injection works:

Behavior

  • Next Generation Only — The injected text is used once, for the very next character generation. After that, it disappears.
  • Global (Persistent) — The injected text stays active for all future generations until it's replaced.

Global Options (only when Behavior is "Global")

  • Global Tag — A label for this injection. Injections with the same tag replace each other. For example, if you tag an injection as "mood", the next injection tagged "mood" will replace it instead of stacking.
  • Agent Only — When enabled, the tag is scoped to this specific agent. Other agents using the same tag won't overwrite this injection.

Role

Who the injected text "appears as" in the AI's context:

  • System — Appears as a system instruction.
  • User — Appears as if the user said it.
  • Character — Appears as if a character said it.

Position

Where in the conversation the injected text is placed:

  • Top of Conversation — At the very beginning, before all messages.
  • Bottom of Conversation — At the end, after all messages.
  • At Specific Depth — Inserted a specific number of messages from the bottom. Depth 1 = right before the last message.
  • Before User Input Text — Right before the user's latest message (only available with User role).
  • After User Input Text — Right after the user's latest message (only available with User role).

How It Works

  1. The node receives text from its input.
  2. It creates a special system message in the chat that carries the injection configuration.
  3. During the next (or all future) AI generations, the injected text is placed into the prompt at the configured position and role.
  4. The injection is invisible to the user in normal chat view — it only affects what the AI sees.

Common Uses

  • Dynamic instructions: "After User Message" trigger → JavaScript (analyzes mood) → Prompt Injection (tells the AI the current emotional tone).
  • World state: Inject updated game state, location descriptions, or time-of-day information that the AI should know about.
  • Memory summaries: Periodically summarize old messages and inject the summary so characters "remember" without needing the full history.
  • Character instructions: Inject scene-specific behavior for characters, like "You are currently nervous because..." before they generate.

Tips

  • This is one of the best debugging tools — use it to see what text your workflow is producing by making it appear in the prompt context.
  • "Next Generation Only" is safer for one-off instructions. Use "Global" when you want persistent context.
  • Global Tags prevent stacking — without a tag, every global injection adds up. With tags, new injections replace old ones of the same tag.

Clone this wiki locally