feat: initial agent-builder plugin (v0.1.0)
Build complete autonomous agent systems with Claude Code. 7-phase guided workflow: map work, CLAUDE.md, agent team, pipeline, security, deployment, test. Components: - commands/build.md: main guided workflow - agents/builder.md: scaffolding agent - skills/agent-system-design: architecture knowledge + 4 references - scripts/templates: hooks, automation, launchd, systemd Covers 22 OpenClaw capabilities across 4 deployment targets (local, Mac Mini, VPS, Managed Agents). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
commit
075383990f
17 changed files with 1895 additions and 0 deletions
22
scripts/templates/automation.sh
Executable file
22
scripts/templates/automation.sh
Executable file
|
|
@ -0,0 +1,22 @@
|
|||
#!/bin/bash
|
||||
# Headless Claude Code automation wrapper.
|
||||
#
|
||||
# Schedule this script with cron, launchd, or systemd to run
|
||||
# a skill or prompt on a recurring schedule.
|
||||
#
|
||||
# Customize:
|
||||
# - SKILL_NAME: the skill to run (e.g., /weekly-report)
|
||||
# - OUTPUT_DIR: where to save output files
|
||||
# - MAX_TURNS: safety ceiling on autonomous turns
|
||||
|
||||
SKILL_NAME="/YOUR-SKILL-NAME"
|
||||
OUTPUT_DIR="pipeline-output"
|
||||
MAX_TURNS=15
|
||||
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
mkdir -p "$OUTPUT_DIR"
|
||||
|
||||
claude -p "Run $SKILL_NAME and save output to $OUTPUT_DIR/$(date +%Y-%m-%d).md" \
|
||||
--output-format text \
|
||||
--max-turns "$MAX_TURNS"
|
||||
48
scripts/templates/launchd.plist
Normal file
48
scripts/templates/launchd.plist
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
|
||||
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<!-- CUSTOMIZE: Change to your reverse-DNS label -->
|
||||
<key>Label</key>
|
||||
<string>com.example.claude-agent</string>
|
||||
|
||||
<key>ProgramArguments</key>
|
||||
<array>
|
||||
<string>/bin/bash</string>
|
||||
<!-- CUSTOMIZE: Absolute path to your automation script -->
|
||||
<string>/path/to/your-project/automation/run-pipeline.sh</string>
|
||||
</array>
|
||||
|
||||
<!-- Run daily at 07:00. Adjust Hour/Minute as needed. -->
|
||||
<key>StartCalendarInterval</key>
|
||||
<dict>
|
||||
<key>Hour</key>
|
||||
<integer>7</integer>
|
||||
<key>Minute</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
|
||||
<!-- CUSTOMIZE: Log paths -->
|
||||
<key>StandardOutPath</key>
|
||||
<string>/tmp/claude-agent.log</string>
|
||||
<key>StandardErrorPath</key>
|
||||
<string>/tmp/claude-agent.err</string>
|
||||
|
||||
<key>RunAtLoad</key>
|
||||
<false/>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
<!--
|
||||
SETUP:
|
||||
1. Copy to ~/Library/LaunchAgents/com.example.claude-agent.plist
|
||||
2. Customize Label, ProgramArguments path, and log paths
|
||||
3. Load: launchctl load ~/Library/LaunchAgents/com.example.claude-agent.plist
|
||||
4. Verify: launchctl list | grep claude
|
||||
|
||||
UNLOAD:
|
||||
launchctl unload ~/Library/LaunchAgents/com.example.claude-agent.plist
|
||||
|
||||
NOTE: The claude binary must be in PATH or use its full path.
|
||||
-->
|
||||
19
scripts/templates/post-tool-use.sh
Executable file
19
scripts/templates/post-tool-use.sh
Executable file
|
|
@ -0,0 +1,19 @@
|
|||
#!/bin/bash
|
||||
# PostToolUse hook: Log all tool executions to an audit trail.
|
||||
#
|
||||
# Appends a timestamped entry to hooks/audit.log for every tool call.
|
||||
# Useful for reviewing what Claude Code did during a session.
|
||||
#
|
||||
# Customize: Change log_file path or add filtering logic.
|
||||
|
||||
input=$(cat)
|
||||
tool_name=$(echo "$input" | python3 -c "import sys,json; print(json.load(sys.stdin).get('tool_name',''))" 2>/dev/null)
|
||||
tool_input=$(echo "$input" | python3 -c "import sys,json; d=json.load(sys.stdin).get('tool_input',{}); print(d.get('command', d.get('file_path', d.get('pattern', str(d)[:100])))" 2>/dev/null)
|
||||
|
||||
timestamp=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
|
||||
log_dir="$(dirname "$0")"
|
||||
log_file="$log_dir/audit.log"
|
||||
|
||||
echo "$timestamp | $tool_name | $tool_input" >> "$log_file"
|
||||
|
||||
exit 0
|
||||
50
scripts/templates/pre-tool-use.sh
Executable file
50
scripts/templates/pre-tool-use.sh
Executable file
|
|
@ -0,0 +1,50 @@
|
|||
#!/bin/bash
|
||||
# PreToolUse hook: Block dangerous shell commands before execution.
|
||||
#
|
||||
# How it works:
|
||||
# - Claude Code calls this script BEFORE executing any Bash command
|
||||
# - If the script exits with code 2, the command is BLOCKED
|
||||
# - Exit 0 allows the command to proceed
|
||||
#
|
||||
# Customize: Add or remove patterns in the blocked_patterns array.
|
||||
# All patterns are matched case-insensitively against the full command.
|
||||
|
||||
input=$(cat)
|
||||
tool_name=$(echo "$input" | python3 -c "import sys,json; print(json.load(sys.stdin).get('tool_name',''))" 2>/dev/null)
|
||||
command=$(echo "$input" | python3 -c "import sys,json; print(json.load(sys.stdin).get('tool_input',{}).get('command',''))" 2>/dev/null)
|
||||
|
||||
# Only check Bash commands
|
||||
if [ "$tool_name" != "Bash" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Blocked patterns -- customize this list for your use case
|
||||
blocked_patterns=(
|
||||
"rm -rf /"
|
||||
"rm -rf ~"
|
||||
"rm -rf \$HOME"
|
||||
"mkfs"
|
||||
"dd if="
|
||||
":(){:|:&};:"
|
||||
"chmod -R 777 /"
|
||||
"curl.*|.*bash"
|
||||
"wget.*|.*bash"
|
||||
"curl.*|.*sh"
|
||||
"wget.*|.*sh"
|
||||
"> /dev/sda"
|
||||
"sudo rm"
|
||||
"shutdown"
|
||||
"reboot"
|
||||
"init 0"
|
||||
"init 6"
|
||||
)
|
||||
|
||||
for pattern in "${blocked_patterns[@]}"; do
|
||||
if echo "$command" | grep -qi "$pattern"; then
|
||||
echo '{"decision": "block", "reason": "Blocked by security hook: command matches dangerous pattern '"'$pattern'"'"}'
|
||||
exit 2
|
||||
fi
|
||||
done
|
||||
|
||||
# Allow everything else
|
||||
exit 0
|
||||
40
scripts/templates/systemd-service.unit
Normal file
40
scripts/templates/systemd-service.unit
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
[Unit]
|
||||
Description=Claude Code Agent Pipeline
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
# CUSTOMIZE: User that runs the agent
|
||||
User=deploy
|
||||
# CUSTOMIZE: Working directory (your project root)
|
||||
WorkingDirectory=/home/deploy/my-agent-project
|
||||
# CUSTOMIZE: Path to your automation script
|
||||
ExecStart=/bin/bash /home/deploy/my-agent-project/automation/run-pipeline.sh
|
||||
# Environment variables (API keys etc.)
|
||||
EnvironmentFile=/home/deploy/.env
|
||||
# Timeout for the pipeline run
|
||||
TimeoutStartSec=600
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
# SETUP:
|
||||
# 1. Copy to /etc/systemd/system/claude-agent.service
|
||||
# 2. Customize User, WorkingDirectory, ExecStart, EnvironmentFile
|
||||
# 3. Enable: sudo systemctl enable claude-agent
|
||||
#
|
||||
# For recurring runs, create a timer:
|
||||
# /etc/systemd/system/claude-agent.timer
|
||||
#
|
||||
# [Unit]
|
||||
# Description=Run Claude agent pipeline daily
|
||||
#
|
||||
# [Timer]
|
||||
# OnCalendar=*-*-* 07:00:00
|
||||
# Persistent=true
|
||||
#
|
||||
# [Install]
|
||||
# WantedBy=timers.target
|
||||
#
|
||||
# Then: sudo systemctl enable --now claude-agent.timer
|
||||
Loading…
Add table
Add a link
Reference in a new issue