Delegate prompts to Codex, Gemini, Z.AI, or local models from Claude Code β with worktree isolation and Ralph-Wiggum-inspired verification loops.
Run these commands in your terminal (not inside Claude Code):
# Add the marketplace (SSH)
claude plugin marketplace add cruzanstx/daplug
# Or via HTTPS
claude plugin marketplace add https://github.com/cruzanstx/daplug
# Install daplug
claude plugin install daplug@cruzanstxClone/copy this plugin to one of:
~/.claude/plugins/daplug/(user scope).claude/plugins/daplug/(project scope)
| Command | Description |
|---|---|
/daplug:check-config |
Verify daplug configuration status and detect legacy settings |
/daplug:cclimits |
Check AI CLI usage/quota (Claude, Codex, Gemini, Z.AI) |
/daplug:check-updates |
Check if plugin has updates available |
/daplug:codex-cli |
Run task with OpenAI Codex CLI |
/daplug:create-llms-txt |
Research and generate llms_txt documentation |
/daplug:create-prompt |
Create optimized, XML-structured prompts |
/daplug:devstral-cli |
Run task with local Devstral model via Codex CLI |
/daplug:gemini-cli |
Run task with Google Gemini CLI |
/daplug:migrate-config |
Migrate legacy CLAUDE.md settings to <daplug_config> |
/daplug:prompts |
Analyze prompts folder and recommend next steps |
/daplug:qwen-cli |
Run task with local Qwen model via Codex CLI |
/daplug:run-prompt |
Execute prompts with various AI models |
/daplug:uvc |
Update docs and push to version control |
/daplug:zai-cli |
Run task with Z.AI GLM-4.7 via Codex CLI |
| Agent | Description |
|---|---|
frontend-build-optimizer |
Optimize frontend build times (SvelteKit, Next.js, Vite) |
go-build-optimizer |
Optimize Go compilation and Docker builds |
infra-troubleshooter |
Diagnose infrastructure issues |
k8s-cicd-troubleshooter |
Troubleshoot Kubernetes and CI/CD pipelines |
readonly-log-watcher |
Monitor prompt execution logs without touching files |
| Skill | Description |
|---|---|
ai-usage |
Check AI CLI usage/quota (Claude, Codex, Gemini, Z.AI) |
config-reader |
Read and manage daplug config from CLAUDE.md (<daplug_config>) |
prompt-executor |
Execute prompts with AI models, worktrees, tmux |
prompt-finder |
Find and resolve prompts in ./prompts/ directory |
prompt-manager |
CRUD operations for prompts with subfolder support |
tmux-manager |
Manage tmux sessions for background tasks |
worktree |
Manage git worktrees for isolated development |
example-hook.json- Example hook (logs before bash commands)
servers.json- Placeholder MCP config (disabled by default)
Commands below are shown without the /daplug: prefix for readability. In Claude Code, use /daplug:<command> if you prefer namespaced commands.
/create-promptgenerates XML-structured prompts optimized for each task type, then/run-promptexecutes them with your chosen model.
Run prompt batches across Claude, Codex, Gemini, or Z.AI with parallel execution and quota-aware routing.
Execute prompts in isolated git worktrees to keep your main branch clean while tasks run.
Re-run prompts until tests pass with
--loopand completion-marker detection.
Check usage across all AI CLIs and pick the model with the most headroom.
/create-llms-txtscaffolds research prompts in your llms_txt repo and supports cross-repo execution.
# In Claude Code:
/create-prompt "add user authentication with JWT"/run-prompt 005 --model codex # OpenAI Codex
/run-prompt 005 --model gemini # Google Gemini 3 Flash
/run-prompt 005 --model zai # Z.AI GLM-4.7/run-prompt 001 002 003 --parallel --worktree/cclimits
# Shows: Claude: 18% | Codex: 0% | Gemini: 7% | Z.AI: 1%- Subfolder support: Organize prompts into topic-based subfolders (e.g.,
prompts/providers/,prompts/backend/) - New flags:
--folder/-ffor create,--treefor list,--folderfor next-number - Folder-aware resolution:
find 011searches all folders,find providers/011targets specific folder - Range expansion:
providers/011-013expands correctly with folder prefix - Auto-create folders: Folders created automatically on first prompt
- JSON output: Now includes
folder,path,statusfields - Branch naming: Includes folder path to avoid collisions (e.g.,
prompt/providers/001-name)
- Fix: Corrected marketplace name in
/check-updatescommand (cruzanstxnotdaplug)
- GPT-5.2 model support: Added
gpt52,gpt52-high,gpt52-xhighfor planning and research tasks - Model management utility: New
scripts/manage-models.pyfor listing, checking, and adding models - Documentation: Added "Managing Models" section to CLAUDE.md with checklist and templates
- New config format: Settings now stored in
<daplug_config>XML blocks in CLAUDE.md files - Migration command:
/daplug:migrate-configautomatically converts legacy plaintext settings - Config detection:
/daplug:check-configverifies config status and detects legacy settings - New skill: config-reader: Python-based config parsing with project β user fallback
- Central llms_txt prompts:
/create-llms-txtnow creates prompts in$LLMS_TXT_DIR/prompts/(the llms_txt repo) instead of the current project's./prompts/ - Auto-discovery: Reads
llms_txt_dirfrom~/.claude/CLAUDE.md, offers clone/configure flow if not set - Cross-repo execution: Uses
--prompt-fileflag for running prompts from external repos
- New skill: prompt-manager: Python-based CRUD for prompts (create, list, find, complete, delete)
- Centralized git root detection: All prompt operations now use prompt-manager, fixing zsh parsing issues
/create-promptandprompt-finderupdated to use prompt-manager
- Zsh compatibility: Fixed parse error when
$()command substitution passed through eval in zsh
- Prompts always at git root:
/create-promptnow saves to{git_root}/prompts/instead of./prompts/(relative to cwd) - Error handling:
/run-promptnow reports errors clearly instead of attempting manual CLI execution - Models will no longer go off-script when executor fails to find prompts
- Made monitor spawning mandatory in Step 2 of
/run-prompt - Auto-verify monitor permissions before spawning agents
- Added
readonly-log-watcheragent for lightweight monitoring - Refactored
/create-llms-txtto generate prompts for/run-prompt
- Edit
.claude-plugin/plugin.jsonto change name, version, description, author - Add more commands in
commands/ - Add agents in
agents/ - Add skills in
skills/<skill-name>/SKILL.md - Add hooks in
hooks/ - Configure MCP servers in
mcp/servers.json
{
"name": "plugin-name",
"version": "1.0.0",
"description": "What the plugin does",
"author": {
"name": "Your Name",
"email": "you@example.com",
"url": "https://your-site.com"
},
"homepage": "https://docs.example.com",
"repository": "https://github.com/you/plugin",
"license": "MIT",
"keywords": ["utility", "helper"]
}| Field | Required | Description |
|---|---|---|
name |
Yes | Unique identifier (kebab-case) |
version |
No | Semantic version (e.g., "1.0.0") |
description |
No | Brief plugin purpose |
author |
No | Object with name, email, url |
homepage |
No | Documentation URL |
repository |
No | Source code URL |
license |
No | License identifier |
keywords |
No | Discovery tags array |
Custom paths (optional): commands, agents, skills, hooks, mcpServers, outputStyles, lspServers
INVALID fields (will cause installation to fail): manifest_version, type, permissions, entry
This repo is configured as a Claude Code marketplace. Run in terminal:
# Add marketplace (SSH)
claude plugin marketplace add cruzanstx/daplug
# Or via HTTPS
claude plugin marketplace add https://github.com/cruzanstx/daplug
# Install the plugin
claude plugin install daplug@cruzanstxgit clone cruzanstx/daplug
cp -r daplug ~/.claude/plugins/ln -s $(pwd) ~/.claude/plugins/daplugAdd to your project's .claude/settings.json:
{
"plugins": {
"marketplaces": {
"extraKnown": ["cruzanstx/daplug"]
}
},
"enabledPlugins": ["daplug@cruzanstx"]
}Or install manually for each team member:
claude plugin marketplace add cruzanstx/daplug
claude plugin install daplug@cruzanstxClaude Code doesn't have built-in plugin update notifications yet (feature request #10265). Here are workarounds:
# Uninstall, refresh marketplace, then reinstall
claude plugin uninstall daplug@cruzanstx
claude plugin marketplace update cruzanstx
claude plugin install daplug@cruzanstxImportant: You must uninstall first - claude plugin install won't overwrite an existing cached version.
Add to .gitlab-ci.yml to notify your team when the plugin version changes:
notify-plugin-update:
stage: notify
rules:
- changes:
- .claude-plugin/plugin.json
script:
- |
VERSION=$(jq -r '.version' .claude-plugin/plugin.json)
echo "daplug updated to v${VERSION}"
# Slack notification (uncomment and configure):
# curl -X POST -H 'Content-type: application/json' \
# --data "{\"text\":\"daplug plugin updated to v${VERSION} - run: claude plugin uninstall daplug@cruzanstx && claude plugin marketplace update cruzanstx && claude plugin install daplug@cruzanstx\"}" \
# $SLACK_WEBHOOK_URL
# Email notification (uncomment and configure):
# echo "daplug v${VERSION} released" | mail -s "Plugin Update" team@example.comThis plugin includes /daplug:check-updates which compares your installed version against the marketplace:
/daplug:check-updates
Output:
daplug: v0.3.0 -> v0.3.0
UP_TO_DATE
Or when an update is available:
daplug: v0.2.0 -> v0.3.0
NEEDS_UPDATE
Update available! Run:
claude plugin uninstall daplug@cruzanstx && claude plugin marketplace update cruzanstx && claude plugin install daplug@cruzanstx
Then resume session:
claude --resume
Running --resume without an ID shows available sessions to pick from.
Note: The uninstall is required because claude plugin install won't overwrite an existing cached version.
Claude Code hooks can't trigger on startup, but you can create a reminder that fires on specific events. Add hooks/update-reminder.json:
{
"name": "update-reminder",
"description": "Periodic reminder to check for plugin updates",
"hooks": [
{
"matcher": {
"type": "event",
"event": "Notification"
},
"hooks": [
{
"type": "command",
"command": "echo 'Tip: Run /daplug:check-updates to check for plugin updates'"
}
]
}
]
}Note: This approach is limited since there's no "on startup" or "periodic" hook event. It only triggers when Claude sends a notification.
For teams, combine:
- GitLab CI (Option 1) - Automatic team-wide notifications on release
- Check command (Option 2) - On-demand version checking for individuals
On first use, daplug prompts for user settings and saves them to ~/.claude/CLAUDE.md under a <daplug_config> block:
<daplug_config>
preferred_agent: codex
worktree_dir: .worktrees/
llms_txt_dir: /storage/projects/docker/llms_txt
ai_usage_awareness: enabled
cli_logs_dir: ~/.claude/cli-logs/
</daplug_config>| Setting | When Prompted | Default |
|---|---|---|
preferred_agent |
Running /daplug:prompts |
Asks user to choose |
worktree_dir |
Running /daplug:run-prompt --worktree |
../worktrees |
llms_txt_dir |
Running /daplug:create-llms-txt |
../llms_txt |
ai_usage_awareness |
Running /daplug:create-prompt (when choosing executor) |
Asks user (enabled/disabled) |
cli_logs_dir |
Not prompted (advanced) | ~/.claude/cli-logs/ |
Settings are checked in order: project ./CLAUDE.md β user ~/.claude/CLAUDE.md
If you still have legacy plaintext settings, run /daplug:migrate-config to upgrade them.
Daplug integrates with cclimits (npm) to provide real-time quota monitoring across all AI CLI tools.
What is cclimits?
A standalone CLI tool that checks quota/usage for AI coding tools:
- Claude Code - 5-hour and 7-day rolling windows
- OpenAI Codex - Primary and secondary rate limits
- Google Gemini CLI - Per-model quotas (3-Flash, Flash, Pro tiers)
- Z.AI - Token quota percentage
- OpenRouter - Account balance
Integration with daplug:
When ai_usage_awareness is enabled, /create-prompt will:
- Run
npx cclimits --jsonbefore presenting model options - Show quota percentages for each AI model
- Warn about models near their limits (>70%
β οΈ , >90% π΄) - Suggest fallback models when preferred agent is unavailable
- Show individual Gemini model quotas
You can also check usage directly:
# Via daplug command
/daplug:cclimits
# Or directly via npx
npx cclimits # Detailed output
npx cclimits --oneline # Compact one-liner
npx cclimits --json # JSON for scriptingExample output:
Claude: 4.0% (5h) β
| Codex: 0% (5h) β
| Z.AI: 1% β
| Gemini: ( 3-Flash 7% β
| Flash 1% β
| Pro 10% β
)
Status icons:
| Icon | Meaning |
|---|---|
| β | Under 70% - plenty of capacity |
| 70-90% - moderate usage | |
| π΄ | 90-100% - near limit |
| β | 100% or unavailable |
Toggle setting:
Update ~/.claude/CLAUDE.md under <daplug_config>:
<daplug_config>
ai_usage_awareness: enabled # or 'disabled'
</daplug_config>Learn more: cclimits on GitHub | cclimits on npm
Commands that use Codex CLI (codex-cli, qwen-cli, zai-cli) check for required config on first run:
For qwen-cli (LMStudio):
# ~/.codex/config.toml
[model_providers.lmstudio-remote]
name = "LMStudio"
base_url = "http://YOUR_IP:1234/v1"
env_key = "LMSTUDIO_API_KEY"
wire_api = "chat"
[profiles.local]
model_provider = "lmstudio-remote"
model = "qwen/qwen3-next-80b"
[env]
LMSTUDIO_API_KEY = "lm-studio"For zai-cli (Z.AI):
# ~/.codex/config.toml
[model_providers.zai]
name = "Z.AI"
base_url = "https://api.z.ai/api/coding/paas/v4"
env_key = "ZAI_KEY"
wire_api = "chat"
[profiles.zai]
model_provider = "zai"
model = "glm-4.7"
[env]
ZAI_KEY = "your-api-key" # Get from https://z.ai/manage-apikeyIf config is missing, the commands will prompt you to set it up.
Commands that reference internal plugin files (like run-prompt.md calling executor.py) should read the install path from Claude's manifest:
# Get exact install path from Claude's tracking
PLUGIN_ROOT=$(jq -r '.plugins."daplug@cruzanstx"[0].installPath' ~/.claude/plugins/installed_plugins.json)
EXECUTOR="$PLUGIN_ROOT/skills/prompt-executor/scripts/executor.py"
python3 "$EXECUTOR" 123 --model codexWhy read from installed_plugins.json?
The cache directory may contain multiple plugin versions (0.1.0, 0.2.0, 0.3.0, etc.) after upgrades. Glob patterns would expand to ALL versions:
# BAD - expands to multiple paths
echo ~/.claude/plugins/cache/.../*/...executor.py
# Result: "/path/0.1.0/.../executor.py /path/0.2.0/.../executor.py ..."Reading from installed_plugins.json:
- Uses Claude's own tracking of the active install path
- No glob expansion issues
- Single source of truth
Why not use ${CLAUDE_PLUGIN_ROOT}?
Claude Code provides a ${CLAUDE_PLUGIN_ROOT} variable, but there's a known bug (#9354) where it doesn't work in command markdown files.
Where ${CLAUDE_PLUGIN_ROOT} works: Hooks JSON, MCP configs, LSP configs
Where it doesn't work: Command .md files
The executor uses stdin for codex models to avoid shell escaping issues with complex prompts:
# Codex: uses stdin with '-' flag
codex exec --full-auto - # reads from stdin
# Gemini: uses -p flag for headless mode
gemini -y -p "prompt content"This prevents issues with prompts containing newlines, quotes, backticks, and XML tags.
Gemini models share quotas in tiers (observed with Google One Premium):
| Tier | Models | Shorthand |
|---|---|---|
| Pro | gemini-2.5-pro, gemini-3-pro-preview | gemini-high, gemini-xhigh |
| Flash | gemini-2.5-flash, gemini-2.5-flash-lite | gemini25flash, gemini25lite |
| 3 Flash | gemini-3-flash-preview | gemini (default) |
Why gemini defaults to 3 Flash:
- Best coding performance (78% SWE-bench score)
- Has its own separate quota bucket
- Won't eat into Pro limits for complex tasks
Check usage: Run gemini interactively and type /usage.
Model shortcuts:
| Shorthand | Model | Use Case |
|---|---|---|
gemini |
3 Flash | Fast, daily driver (default) |
gemini-high |
2.5 Pro | Stable, more capable |
gemini-xhigh |
3 Pro | Most capable, complex tasks |
| Shorthand | Model | Best For |
|---|---|---|
codex |
gpt-5.2-codex | Fast coding execution |
codex-high |
gpt-5.2-codex (high) | Complex coding |
codex-xhigh |
gpt-5.2-codex (xhigh) | Large refactors |
gpt52 |
gpt-5.2 | Planning, research, analysis |
gpt52-high |
gpt-5.2 (high) | Deep reasoning |
gpt52-xhigh |
gpt-5.2 (xhigh) | Maximum reasoning (30+ min) |
When to use GPT-5.2 vs GPT-5.2-Codex:
- GPT-5.2-Codex: Best when plans are clear, need fast execution
- GPT-5.2: Best for ambiguous problems, research, methodical analysis
When using --worktree, the executor automatically detects and installs project dependencies after creating the worktree. This ensures verification commands (build, test, lint) work correctly in the isolated environment.
| Type | Lock File | Install Command | Search Dirs |
|---|---|---|---|
| npm | package-lock.json |
npm ci |
., frontend, web, client, app |
| pnpm | pnpm-lock.yaml |
pnpm install --frozen-lockfile |
same |
| yarn | yarn.lock |
yarn install --frozen-lockfile |
same |
| Go | go.mod |
go mod download |
. |
| pip | requirements.txt |
pip install -r requirements.txt |
. |
| poetry | poetry.lock |
poetry install |
. |
| uv | uv.lock |
uv sync |
. |
- Runs automatically after worktree creation (no flag needed)
- Logs progress to stderr:
[Worktree] Detected: frontend/package-lock.json (npm) - Install failures are logged but don't block prompt execution
- Results included in JSON output under
dependencies_installed
[Worktree] Installing dependencies...
[Worktree] Detected: frontend/package-lock.json (npm)
[Worktree] Running: npm ci
[Worktree] npm ci completed (23.4s)
[Worktree] Dependencies installed successfully
The --loop flag enables iterative execution where prompts re-run until they report completion. Useful for test/build tasks that may need multiple attempts.
This feature is inspired by the ralph-wiggum plugin from Anthropic's official plugin collection. Ralph-wiggum implements a "self-referential feedback loop" that re-runs Claude until a completion promise is found.
Compare & Contrast:
| Aspect | ralph-wiggum | daplug --loop |
|---|---|---|
| Mechanism | Stop hooks intercept Claude's exit | Python loop in executor.py |
| Loop control | Hook script feeds prompt back to Claude | Executor re-runs CLI directly |
| State file | .claude/ralph-loop.local.md |
~/.claude/loop-state/{num}.json |
| Completion marker | <promise>COMPLETE</promise> |
<verification>VERIFICATION_COMPLETE</verification> |
| Works with | Claude Code only | Any CLI (codex, gemini, zai, etc.) |
| Runs in | Interactive Claude session | Background process |
Why no hooks? Ralph-wiggum's hook approach only works within Claude Code sessions. Our implementation needs to support external CLIs (Codex, Gemini, Z.AI) that don't have Claude's hook system. The Python-based loop runs the CLI, waits for completion, checks logs for markers, and re-runs if needed - all without requiring hooks.
/daplug:run-prompt 123 --model codex --loop
/daplug:run-prompt 123 --model codex --loop --max-iterations 5The executor wraps your prompt with verification protocol instructions. The agent signals completion by outputting:
<!-- Success - task complete -->
<verification>VERIFICATION_COMPLETE</verification>
<!-- Retry needed - explain why -->
<verification>NEEDS_RETRY: Tests failing - 3 auth tests need fixing</verification>- Your prompt is wrapped with verification instructions
- Agent runs and outputs a completion marker
- If
VERIFICATION_COMPLETEfound β loop ends successfully - If
NEEDS_RETRYfound or no marker β loop continues - Retry reasons are passed into the next iteration as feedback
- Each iteration sees previous work (files, git history)
- Loop ends at max iterations (default: 3)
State is persisted in ~/.claude/loop-state/{prompt-number}.json:
{
"prompt_number": "123",
"iteration": 3,
"max_iterations": 3,
"status": "running",
"last_updated_at": "2025-12-29T18:30:00",
"history": [
{"iteration": 1, "exit_code": 0, "marker_found": false, "retry_reason": "Tests failing"},
{"iteration": 2, "exit_code": 1, "marker_found": false, "retry_reason": "Lint errors remain"}
],
"suggested_next_steps": [
{"text": "Deploy to staging", "original": "1) Deploy to staging", "source_iteration": 1}
]
}Check status: python3 "$EXECUTOR" 123 --loop-status
The executor also extracts "Next steps" / "TODO" suggestions from logs and returns them in the loop result JSON so follow-up prompts can be created automatically.
For best results with --loop:
- Include explicit verification steps - List what must pass (tests, build, lint)
- Make verification checkable - Use commands that return clear pass/fail
- Be specific about "done" - Avoid ambiguous completion criteria
Example prompt structure:
## Requirements
- Add login/logout endpoints
- Password hashing with bcrypt
## Verification Criteria
- [ ] All tests pass: `npm test`
- [ ] Build succeeds: `npm run build`
- [ ] No lint errors: `npm run lint`
When ALL criteria verified, output:
<verification>VERIFICATION_COMPLETE</verification>




