logs
Flagged{"isSafe":false,"isSuspicious":true,"riskLevel":"high","findings":[{"category":"shell_command","severity":"high","description":"Dynamically selects and executes an external control.sh script from multiple locations (including a user-writable plugins cache) without integrity verification, enabling potential arbitrary code execution if the located script is compromised.","evidence":"The code builds CONTROL_SCRIPT from multiple locations and then executes: bash \"$CONTROL_SCRIPT\" logs. It may pick a script from CLAUDE_PLUGIN_ROOT/scripts/control.sh, ./plugin/scripts/control.sh, or a cached path under $HOME/.claude/plugins/cache/.../scripts/control.sh, without validating its origin or integrity."}],"summary":"The snippet ends up executing an external control.sh script whose path is derived from various locations, including user-writable directories, and does not perform any integrity or origin validation. This creates a potential attack surface for arbitrary code execution if the control.sh encountered is malicious. Recommendations: pin to a trusted, version-controlled script; add checksum/signature verification; avoid glob-based discovery of executable scripts; consider sandboxing or running with restricted privileges; log/monitor any changes to the control script path."}
npx machina-cli add skill cyrus-cai/claude-cobrain/logs --openclawlogs
Use direct python3 logs via controller script.
if [[ -n "${CLAUDE_PLUGIN_ROOT:-}" && -f "${CLAUDE_PLUGIN_ROOT}/scripts/control.sh" ]]; then
CONTROL_SCRIPT="${CLAUDE_PLUGIN_ROOT}/scripts/control.sh"
elif [[ -f "./plugin/scripts/control.sh" ]]; then
CONTROL_SCRIPT="./plugin/scripts/control.sh"
else
CONTROL_SCRIPT="$(ls -dt "$HOME"/.claude/plugins/cache/*/claude-cobrain/*/scripts/control.sh 2>/dev/null | head -1)"
fi
[[ -n "${CONTROL_SCRIPT:-}" && -f "$CONTROL_SCRIPT" ]] || { echo "control.sh not found. Run: /claude-cobrain:cobrain install"; exit 1; }
bash "$CONTROL_SCRIPT" logs
Source
git clone https://github.com/cyrus-cai/claude-cobrain/blob/main/plugin/skills/logs/SKILL.mdView on GitHub Overview
This skill fetches the cobrain daemon's runtime logs by invoking the plugin's controller script. It locates control.sh from CLAUDE_PLUGIN_ROOT, the plugin path, or a cached location, then runs the logs command. Accessing logs is essential for debugging, monitoring, and verifying daemon health.
How This Skill Works
It resolves the path to control.sh by checking CLAUDE_PLUGIN_ROOT, then falls back to the plugin/scripts directory or a cached path. When found, it executes bash "$CONTROL_SCRIPT" logs to emit the cobrain daemon logs for review.
When to Use It
- Debug a crash or error in the cobrain daemon.
- Verify that the daemon started and is emitting logs after install or update.
- Troubleshoot environments where the plugin is installed in different locations.
- Automate log retrieval in scripts or CI by invoking the control script.
- When control.sh is missing, run the install workflow to restore logging access.
Quick Start
- Step 1: Ensure the control.sh script is discoverable (via CLAUDE_PLUGIN_ROOT, ./plugin/scripts, or the cached path).
- Step 2: Run the command to fetch logs: bash "$CONTROL_SCRIPT" logs.
- Step 3: Review the logged output and take action as needed.
Best Practices
- Always resolve CONTROL_SCRIPT first and verify it exists before running.
- Prefer using the official control.sh interface instead of direct file access.
- Run from an environment where CLAUDE_PLUGIN_ROOT or the plugin path is accessible.
- Review logs securely; avoid leaking sensitive data in shared environments.
- If control.sh is missing, follow the recommended install command to restore functionality.
Example Use Cases
- bash "$CONTROL_SCRIPT" logs
- CONTROL_SCRIPT="${CLAUDE_PLUGIN_ROOT}/scripts/control.sh"; bash "$CONTROL_SCRIPT" logs
- CONTROL_SCRIPT="./plugin/scripts/control.sh"; bash "$CONTROL_SCRIPT" logs
- CONTROL_SCRIPT="$(ls -dt "$HOME/.claude/plugins/cache/*/claude-cobrain/*/scripts/control.sh 2>/dev/null | head -1)"; [[ -n "$CONTROL_SCRIPT" && -f "$CONTROL_SCRIPT" ]] && bash "$CONTROL_SCRIPT" logs
- If control.sh is missing, the script will print 'control.sh not found. Run: /claude-cobrain:cobrain install' and exit.