--- title: "Agent resources and lifecycle" description: "How Plugins, Memory, MCP, Tools, and Skills fit together during an OpenIDEA agent task, including what enters the LLM context window." --- An OpenIDEA agent task coordinates five distinct resources: **Plugin**, **Memory**, **MCP**, **Tool**, and **Skill**. Each has a different responsibility, persistence lifetime, and footprint in the LLM context window. ## Mental model at a glance | Resource | What it is | Lives across tasks? | Loaded into the LLM context window? | | ---------- | ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------- | | **Plugin** | Installable capability bundle (an OpenIDEA WASM plugin or an agent CLI plugin) packaging MCP tools and skills | Yes (installed in the host or CLI) | **Never directly.** Plugin code stays outside the prompt; only tool schemas and skill metadata/bodies are exposed. | | **Memory** | Persistent facts, user preferences, and repository rules (`AGENTS.md`, custom instructions, notes, checkpoints) | Yes | **Yes** — relevant rules and recalled facts are injected at session start or on demand. | | **MCP** | Model Context Protocol bridge connecting an agent to OpenIDEA or external servers (`tools/list`, `tools/call`) | Server config persists; live connection is per session | **No** — MCP is the transport/registry. Only the **tool definitions** it advertises enter context. | | **Tool** | Single executable function with a JSON Schema (`view`, `edit`, `bash`, `OpenIDEA-check_files`, `k8s__get_pod_logs`) | Registered per session | **Yes** — tool schema at session start (unless disabled/deferred), plus each call and result per turn. | | **Skill** | Reusable playbook (`SKILL.md`) teaching the model how to combine tools for a workflow | Yes (on disk) | **Two-stage:** only `name` + short `description` at session start; full `SKILL.md` body **on demand** when invoked. | In short: **Plugins** _package_ capabilities, **MCP** _connects_ them, **Tools** _execute_ actions, **Skills** _instruct_ how to orchestrate tools, and **Memory** _remembers_ context and rules across tasks. ## Architecture and data flow ```mermaid flowchart LR subgraph Host["OpenIDEA Host (Persistent)"] P["OpenIDEA WASM Plugin
(plugin.toml)"] IMCP["OpenIDEA Built-in MCP Server
(ide-host/src/mcp)"] SH["Skills Hub
(SKILL.md registry)"] P -- "contributes.mcpTools" --> IMCP P -- "contributes.skills" --> SH end subgraph Ext["Agent CLI Plugin / External (Persistent Config)"] EP["CLI Plugin (.mcp.json)"] EMCP["Standalone MCP Server
(process / HTTP)"] EP -- "bundles / launches" --> EMCP end MEM["Memory
(AGENTS.md, user rules, notes)"] subgraph Session["Agent Task Session (LLM Context Window)"] SYS["System Prompt
(Memory + Skill Index)"] CAT["Tool Catalog
(Built-in + MCP Tool Schemas)"] CONV["Conversation Turns
(Active Skill Body + Tool Calls/Results)"] end MEM --> SYS SH -- "name + description (init)" --> SYS SH -- "full SKILL.md (on demand)" --> CONV IMCP -- "tools/list -> schemas" --> CAT EMCP -- "tools/list -> schemas" --> CAT CONV -. "tools/call (JSON-RPC)" .-> IMCP CONV -. "tools/call (JSON-RPC)" .-> EMCP ``` ## Plugin tools vs. the LLM context window It helps to separate **(a) where a plugin tool is registered and executed** from **(b) whether its schema enters the LLM context window**. ### OpenIDEA WASM plugin (`plugin.toml`) - **Registered in OpenIDEA's built-in MCP server:** A plugin declaring `[[contributes.mcpTools]]` registers its tools into OpenIDEA's built-in [MCP server](/en/guide/mcp) under `__` (see [Plugin MCP tools](/en/plugins/guides/mcp)). - **Enters context indirectly via MCP:** When a task starts, OpenIDEA attaches its built-in `OpenIDEA` MCP server to the session. The agent CLI calls `tools/list` and loads the returned tool names, descriptions, and JSON Schemas into the LLM's tool catalog — unless the `OpenIDEA` MCP server is disabled for that session via `/mcp`, or the agent uses deferred/lazy tool loading. - **Code stays out of context:** The plugin's WASM binary and source code never enter the prompt. On `tools/call`, OpenIDEA dispatches to the sandboxed plugin host under its granted capabilities and `readOnly` / `destructive` approval rules. ### Agent CLI plugin bundling `.mcp.json` - OpenIDEA plugins (`plugin.toml`) do not spawn standalone MCP server processes; they export WASM tools into OpenIDEA's built-in MCP server. - **Agent CLI plugins** (for example Copilot CLI plugins with `.mcp.json` or Claude plugins with `mcpServers` in `.claude-plugin/plugin.json`) bundle their own standalone MCP servers. When active or imported under **Settings › Agents › MCP › External Servers**, the agent connects to that separate MCP server at session start, calls `tools/list`, and injects its tool schemas into the LLM context window in the same way — as a sibling MCP server alongside `OpenIDEA`. | Dimension | OpenIDEA WASM plugin (`plugin.toml`) | Agent CLI plugin (`.mcp.json` / `plugin.json`) | | ----------------------------- | -------------------------------------------------------- | ----------------------------------------------------- | | **Hosting / registry** | OpenIDEA's built-in MCP server (`ide-host`) | Standalone MCP server process or remote URL | | **Execution sandbox** | In-process `wasmtime` actor + OpenIDEA capability grants | External process or network service | | **How schemas reach the LLM** | `tools/list` on `OpenIDEA` MCP server → LLM tool catalog | `tools/list` on bundled MCP server → LLM tool catalog | | **Code in context window?** | No (only schema + call arguments/result) | No (only schema + call arguments/result) | ## End-to-end lifecycle walkthrough Suppose you have: - **Plugin:** A `kubernetes` OpenIDEA plugin that contributes an MCP tool (`k8s__get_pod_logs`) and a skill (`/debug-crashloop`). - **External MCP:** A GitHub/Slack MCP server configured for your workspace. - **Memory:** Persistent instructions stating _"staging namespace is `payments-stg`; always rebase onto `origin/main` before pushing."_ You start a new agent task and send: ```text /debug-crashloop Fix why the payments pod is crashing in staging and open a PR ``` ```mermaid sequenceDiagram autonumber actor User participant Host as OpenIDEA Host & Plugins participant MCP as MCP Servers (Built-in + External) participant Agent as Agent Runtime (Context Window) Note over Host: Phase 1 — Host Startup (before task exists) Host->>Host: Load kubernetes WASM plugin Host->>MCP: Register k8s__get_pod_logs in built-in MCP Host->>Host: Index /debug-crashloop SKILL.md in Skills Hub Note over Agent: Phase 2 — Session Initialization Host->>Agent: Inject Memory (AGENTS.md + user rules) Host->>Agent: Inject lightweight Skill index (name + description) Agent->>MCP: Connect & call tools/list MCP-->>Agent: Return tool JSON schemas -> LLM Tool Catalog Note over User,Agent: Phase 3 — Skill Activation (Turn 1) User->>Agent: /debug-crashloop Fix why payments pod is crashing... Agent->>Host: Load full debug-crashloop/SKILL.md playbook Host-->>Agent: Playbook injected into conversation context Note over Agent,Host: Phase 4 — Execution Loop (Think -> Tool -> Observe) Agent->>MCP: tools/call k8s__get_pod_logs(ns="payments-stg") MCP->>Host: Route to kubernetes WASM plugin (permission check) Host-->>Agent: Stack trace: BillingService.java:84 Agent->>Agent: Built-in view + edit patch line 84 Agent->>MCP: OpenIDEA-check_files + bash tests MCP-->>Agent: Build & tests pass Agent->>Agent: Follow Memory rules -> rebase & open PR via gh Note over Agent,Host: Phase 5 — Completion & Teardown Agent->>Host: Save durable Memory updates / checkpoints Agent-xMCP: Close per-session MCP connections & clear tool catalog ``` OpenIDEA loads enabled **Plugins** in its sandboxed host. The `kubernetes` plugin registers `k8s__get_pod_logs` in OpenIDEA's built-in **MCP** server and indexes `debug-crashloop/SKILL.md` in the **Skills** hub. Nothing is in an LLM context window yet. **Memory** is injected into the system prompt (`AGENTS.md`, user rules, recalled facts). **MCP** clients connect to enabled servers and call `tools/list`, populating the **Tool** catalog with built-in and MCP tool schemas. **Skills** contribute only their compact `name` + `description` index, keeping unused playbooks out of the token budget. Because you invoked `/debug-crashloop` (or the model matched its description in **Auto** mode), the agent loads the full `debug-crashloop/SKILL.md` playbook into the conversation context, giving the model a structured recipe: *fetch pod logs → locate stack trace → patch and test → open PR*. Combining the **Skill** recipe with **Memory** (`payments-stg`), the model invokes `k8s__get_pod_logs` over **MCP**. OpenIDEA routes the call to the sandboxed `kubernetes` **Plugin**, returning `BillingService.java:84`. Built-in **Tools** (`view`, `edit`) patch the bug, OpenIDEA's **MCP Tool** (`OpenIDEA-check_files`) and `bash` verify compilation and tests, and **Memory** rules guide rebasing and opening the pull request. **Plugins**, **Memory** (including any newly saved durable facts or checkpoints), and **Skill** files remain on disk for future tasks. Per-session **MCP** connections close or idle out, the session **Tool** catalog clears, and the loaded **Skill** body stays scoped to that conversation. ## Related guides Configure built-in and ACP agents, external MCP servers, and skills in OpenIDEA. Enable OpenIDEA's built-in MCP server and connect IDE or external clients. Contribute sandboxed WASM tools from an OpenIDEA plugin to the built-in MCP server. Declare skills, MCP tools, and capabilities in `plugin.toml`.