packages/docs/plugins/plugin-eject.md
The eject system lets you clone an upstream plugin's source code locally, modify it, and have the runtime load your local copy instead of the npm package. This enables rapid plugin development, debugging, and contribution back to upstream repositories.
Ejecting a plugin clones its upstream Git repository into a local directory (~/.eliza/plugins/ejected/), creates tracking metadata (.upstream.json), and configures the runtime to load the local copy instead of the npm-installed version.
This is useful when you need to:
The complete workflow for working with ejected plugins:
eject → edit → build → test → sync → PR → reinject
Clone the upstream plugin source:
Via agent chat:
eject the telegram plugin so I can edit its source
Or manually:
git clone --branch 1.x https://github.com/elizaos-plugins/plugin-telegram.git \
~/.eliza/plugins/ejected/plugin-telegram
cd ~/.eliza/plugins/ejected/plugin-telegram
bun install
bun run build
Make your changes in the ejected plugin's src/ directory:
cd ~/.eliza/plugins/ejected/plugin-telegram/src/
# Edit files...
After editing, rebuild the plugin:
cd ~/.eliza/plugins/ejected/plugin-telegram
bun run build
Restart Eliza. The runtime auto-discovers ejected plugins and loads them instead of the npm versions:
eliza start
Look for log messages like Loading ejected plugin: to confirm.
Pull upstream changes while preserving your local edits:
Via agent chat:
sync the ejected telegram plugin
Or manually:
cd ~/.eliza/plugins/ejected/plugin-telegram
git fetch origin
git pull --rebase origin 1.x
bun run build
When done, remove the local copy and revert to the npm version:
Via agent chat:
reinject the telegram plugin
Or manually:
rm -rf ~/.eliza/plugins/ejected/plugin-telegram
# Restart Eliza — it loads the npm version again
In addition to plugins, you can eject @elizaos/core itself for deep customization. Core eject clones the entire elizaOS monorepo and configures TypeScript path mapping to load the local core.
https://github.com/elizaos/eliza.gitdeveloppackages/core within the monorepo~/.eliza/core/eliza/The core status interface provides:
interface CoreStatus {
ejected: boolean;
ejectedPath: string;
monorepoPath: string;
corePackagePath: string;
coreDistPath: string;
version: string;
npmVersion: string;
commitHash: string | null;
localChanges: boolean;
upstream: UpstreamMetadata | null;
}
The agent has built-in actions for managing ejected plugins and core:
| Action | Description |
|---|---|
EJECT_PLUGIN | Clone a plugin's upstream source for local editing |
SYNC_PLUGIN | Pull upstream changes and merge with local edits |
REINJECT_PLUGIN | Remove local source and revert to npm version |
LIST_EJECTED_PLUGINS | Show all ejected plugins with upstream status |
| Action | Description |
|---|---|
EJECT_CORE | Clone @elizaos/core source locally |
SYNC_CORE | Pull upstream changes to local core |
REINJECT_CORE | Remove local core, revert to npm |
CORE_STATUS | Show current core eject status |
~/.eliza/
├── plugins/
│ ├── installed/ # npm-installed plugins (managed by plugin-installer)
│ ├── custom/ # Hand-written drop-in plugins
│ └── ejected/ # Git-cloned upstream plugins for editing
│ └── plugin-telegram/
│ ├── .upstream.json # Upstream tracking metadata
│ ├── package.json
│ ├── src/ # Editable source code
│ ├── dist/ # Built output (runtime loads this)
│ └── node_modules/ # Plugin's own dependencies
└── core/
└── eliza/ # Ejected @elizaos/core monorepo
├── .upstream.json
└── packages/
└── core/
├── src/
└── dist/
When the runtime resolves plugins, ejected versions always take precedence:
~/.eliza/plugins/ejected/) -- highest prioritynode_modules/@elizaos/plugin-*) -- with install record repair~/.eliza/plugins/installed/)import(name))This means you can eject any plugin and your local version automatically takes over without any additional configuration.
Every ejected plugin (and core) has a .upstream.json file at its root that tracks the upstream relationship:
{
"$schema": "eliza-upstream-v1",
"source": "github:elizaos-plugins/plugin-telegram",
"gitUrl": "https://github.com/elizaos-plugins/plugin-telegram.git",
"branch": "1.x",
"commitHash": "093613e...",
"ejectedAt": "2026-02-16T08:00:00Z",
"npmPackage": "@elizaos/plugin-telegram",
"npmVersion": "1.6.4",
"lastSyncAt": null,
"localCommits": 0
}
| Field | Description |
|---|---|
$schema | Always "eliza-upstream-v1" |
source | Short source identifier (e.g., github:org/repo) |
gitUrl | Full Git clone URL |
branch | Upstream branch being tracked |
commitHash | Commit hash at time of eject (or last sync) |
ejectedAt | ISO 8601 timestamp when the plugin was ejected |
npmPackage | npm package name being replaced |
npmVersion | npm version at time of eject |
lastSyncAt | ISO 8601 timestamp of last upstream sync (null if never synced) |
localCommits | Number of local commits since eject or last sync |
The sync operation returns:
interface SyncResult {
success: boolean;
pluginName: string;
ejectedPath: string;
upstreamCommits: number; // How many new commits from upstream
localChanges: boolean; // Whether local modifications exist
conflicts: string[]; // List of conflicted file paths
commitHash: string; // Current commit after sync
error?: string;
}
cd ~/.eliza/plugins/ejected/plugin-telegram
# Check what changed upstream
git fetch origin
git log HEAD..origin/1.x --oneline
# Pull changes (fast-forward if no local commits)
git pull --ff-only origin 1.x
# Or if you have local commits
git pull --rebase origin 1.x
# Rebuild after sync
bun run build
If merge conflicts occur, resolve them manually, then git add the resolved files and continue.
The ejected plugin is a real Git repository. You can push changes upstream:
cd ~/.eliza/plugins/ejected/plugin-telegram
# Add your fork as a remote
git remote add fork [email protected]:YOUR_USER/plugin-telegram.git
# Create a feature branch
git checkout -b feat/my-improvement
# Commit your changes
git add -A
git commit -m "feat: add typing indicators and smart chunking"
# Push to your fork
git push fork feat/my-improvement
# Open PR against upstream
gh pr create --repo elizaos-plugins/plugin-telegram --base 1.x
GET /api/plugins/ejected
Returns all ejected plugins with their .upstream.json metadata.
"eject the telegram plugin" -- triggers EJECT_PLUGIN"sync the ejected telegram plugin" -- triggers SYNC_PLUGIN"reinject the telegram plugin" -- triggers REINJECT_PLUGIN"list ejected plugins" -- triggers LIST_EJECTED_PLUGINS"eject core" -- triggers EJECT_CORE"sync core" -- triggers SYNC_CORE"reinject core" -- triggers REINJECT_CORE"core status" -- triggers CORE_STATUSbun run build succeeded and a dist/ directory existspackage.json has a valid name field matching the expected plugin nameLoading ejected plugin: messages in the runtime logsbun install first -- ejected plugins have their own node_modules/conflicts arraygit add <resolved-file> for each resolved filebun run buildgit is installed and available in PATHGIT_TERMINAL_PROMPT=0 to prevent interactive auth prompts