Available in
Marketplaces, most starred first
Tags
Add to README
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
By ubuntudroidv0.3.0MITIn 1 marketplace
Leases each Android device and emulator to one agent at a time. A PreToolUse hook gates adb, Gradle install and instrumentation tasks, Maestro, and the android CLI, so concurrent agents cannot install over each other's build or drive the same UI.
Run automatically on Claude Code events. Claude doesn't decide.
Executables (bin/) — files in this plugin's bin/ directory are added to the Bash tool's PATH while the plugin is enabled.
1 caution to review before installing
A hook runs when Claude uses the Bash tool
Static checks of hooks, mods, MCP servers and commands. Not a security audit.
1 marketplace, most starred first
android, adb, emulator, maestro, gradle, hooks, multi-agent, concurrency
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Leases each Android device and emulator to one coding agent at a time.
Run two or three agents on one Android codebase and they will eventually reach for
the same device. One installs a build while another is mid-instrumentation-run; one
resets app state under another's UI test; one runs adb kill-server and every other
agent's session dies. The failures are intermittent and read like flaky tests.
devlease is a PreToolUse hook. Before any command that touches a device, it works
out which device that is and takes an exclusive lease on it. A second agent asking
for the same device waits briefly, then gets told who holds it and to do something
else. Nothing else about how agents work changes.
As a Claude Code plugin
/plugin marketplace add ubuntudroid/devlease
/plugin install devlease
That wires the hooks. Plugin hooks load when a session starts, so open a new session before expecting the gate to fire.
To put the CLI on your PATH, point at the installed version explicitly:
ln -sf "$(ls -d ~/.claude/plugins/cache/devlease/devlease/*/ | tail -1)bin/devlease" ~/bin/devlease
Re-run that after upgrading, or clone the repo and symlink bin/devlease from
the clone instead, which survives version changes.
Standalone
Clone anywhere, then add to ~/.claude/settings.json:
{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "\"$HOME/src/devlease/bin/devlease\" hook",
"timeout": 120
}
]
}
],
"SessionEnd": [
{
"hooks": [
{
"type": "command",
"command": "\"$HOME/src/devlease/bin/devlease\" hook",
"timeout": 10
}
]
}
]
}
}
Edits to settings.json take effect immediately, with no restart — unlike the
plugin route, where hooks load at session start.
The matcher above covers the Bash tool. If you use a plugin that runs shell
commands through its own MCP tool, add those tool names to the alternation; the
shipped hooks/hooks.json does this for context-mode's sandbox tools.
Codex
Codex sends its hooks the same payload, so the same script works. Add this to
~/.codex/config.toml, with the path pointing at your devlease:
[[hooks.PreToolUse]]
matcher = "^Bash$"
[[hooks.PreToolUse.hooks]]
type = "command"
command = '"$HOME/src/devlease/bin/devlease" hook'
timeout = 120
[[hooks.SessionEnd]]
[[hooks.SessionEnd.hooks]]
type = "command"
command = '"$HOME/src/devlease/bin/devlease" hook'
Then start codex, run /hooks and trust both hooks: Codex skips a hook until
you trust it. Install them for your user, not in a project's .codex/: Codex
also skips project hooks in a project you have not trusted, and every new
worktree is a new project. A tool that starts Codex with its own CODEX_HOME
reads that directory's config.toml instead.
Requires python3 (standard library only) and adb on PATH.
| Command | How the target is resolved |
|---|---|
adb … (except devices, version, help) | -s <serial> |
gradlew install* / uninstall* / connected* | ANDROID_SERIAL (AGP has no serial flag) |
maestro … test / record / studio / hierarchy | --device <serial> |
android install / run / screen / layout | --device=<serial> |
Falling back, in order: -Pdevice=<serial>, ANDROID_SERIAL (env or inline on the
command), then the only attached device. If none of those resolve and more than one
device is attached, the command is refused rather than guessed at — the same mistake
./gradlew installDebug makes on its own.
Build-only work is never gated: assembleDebugAndroidTest and
compileDebugAndroidTestKotlin build the test APK without touching a device, and
maestro start-device is what creates an emulator in the first place.
The command is split the way a shell would split it, and only words in command
position are considered. grep -rn "adb kill-server" docs/ runs grep, not
adb, and is left alone; so is a sed that edits a script whose name mentions
adb. Wrappers are followed through — timeout 30 adb …, env FOO=bar adb …,
bash -c "adb …", and the far side of && or | all resolve to the real
command. So do a new line, ; or && without spaces, $( … ) and backticks
(in double quotes or unquoted), <( … ), time, and the command after if,
then or do. An escaped \$( … ) is text.
A heredoc's body and a comment are data, so they are not checked, though
the shell does run a $( … ) in a heredoc whose delimiter is unquoted.
Redirections such as >log or 2>&1 are ignored.
Built from public signals: copy clicks on this site, GitHub stars and activity, the README and the manifest. Not a security audit or an endorsement.
npx claudepluginhub ubuntudroid/devlease --plugin devleasePlugins from other owners that cover similar ground