From e9224b18b85363fe3a5682ac6d9e222b25281e2e Mon Sep 17 00:00:00 2001 From: Snider Date: Sun, 22 Mar 2026 15:27:09 +0000 Subject: [PATCH] refactor(devops): convert operational skills to agent tasks Skills I trigger (not the user) become agent tasks: - clean-workspaces, repair-core-agent, merge-workspace, health-check Keeps as skills (user-invoked CLI wrappers): - forge commands (issue/pr/repo), workspace-list/clean, build-prompt, update-deps Agent tasks use haiku/sonnet for fast autonomous execution. Co-Authored-By: Virgil --- .../agents/agent-task-clean-workspaces.md | 34 ++++++++++ .../devops/agents/agent-task-health-check.md | 19 ++++++ .../agents/agent-task-merge-workspace.md | 51 ++++++++++++++ .../agents/agent-task-repair-core-agent.md | 53 +++++++++++++++ .../devops/skills/clean-workspaces/SKILL.md | 44 ------------ claude/devops/skills/health-check/SKILL.md | 23 ------- claude/devops/skills/merge-workspace/SKILL.md | 56 --------------- .../devops/skills/repair-core-agent/SKILL.md | 68 ------------------- 8 files changed, 157 insertions(+), 191 deletions(-) create mode 100644 claude/devops/agents/agent-task-clean-workspaces.md create mode 100644 claude/devops/agents/agent-task-health-check.md create mode 100644 claude/devops/agents/agent-task-merge-workspace.md create mode 100644 claude/devops/agents/agent-task-repair-core-agent.md delete mode 100644 claude/devops/skills/clean-workspaces/SKILL.md delete mode 100644 claude/devops/skills/health-check/SKILL.md delete mode 100644 claude/devops/skills/merge-workspace/SKILL.md delete mode 100644 claude/devops/skills/repair-core-agent/SKILL.md diff --git a/claude/devops/agents/agent-task-clean-workspaces.md b/claude/devops/agents/agent-task-clean-workspaces.md new file mode 100644 index 0000000..0999c8d --- /dev/null +++ b/claude/devops/agents/agent-task-clean-workspaces.md @@ -0,0 +1,34 @@ +--- +name: agent-task-clean-workspaces +description: Removes completed/failed/blocked agent workspaces. Use when workspaces are piling up, the user asks to "clean workspaces", or before starting a fresh sweep. +tools: Bash +model: haiku +color: green +--- + +Clean stale agent workspaces using the core-agent CLI. + +## Steps + +1. List current workspaces: +```bash +core-agent workspace/list +``` + +2. Clean based on context: +```bash +# Remove all non-running (default) +core-agent workspace/clean all + +# Or specific status +core-agent workspace/clean completed +core-agent workspace/clean failed +core-agent workspace/clean blocked +``` + +3. Report what was removed. + +## Rules + +- NEVER remove workspaces with status "running" +- Report the count and what was removed diff --git a/claude/devops/agents/agent-task-health-check.md b/claude/devops/agents/agent-task-health-check.md new file mode 100644 index 0000000..4aaa145 --- /dev/null +++ b/claude/devops/agents/agent-task-health-check.md @@ -0,0 +1,19 @@ +--- +name: agent-task-health-check +description: Runs a health check on the core-agent system. Use proactively at session start or when something seems off with dispatch, workspaces, or MCP tools. +tools: Bash +model: haiku +color: green +--- + +Quick health check of the core-agent system. + +## Steps + +```bash +core-agent check +core-agent workspace/list +core-agent version +``` + +Report the results concisely. Flag anything that looks wrong. diff --git a/claude/devops/agents/agent-task-merge-workspace.md b/claude/devops/agents/agent-task-merge-workspace.md new file mode 100644 index 0000000..e9b9cc3 --- /dev/null +++ b/claude/devops/agents/agent-task-merge-workspace.md @@ -0,0 +1,51 @@ +--- +name: agent-task-merge-workspace +description: Reviews and merges completed agent workspace changes into the source repo. Use when an agent workspace is completed/ready-for-review and changes need to be applied. +tools: Bash, Read +model: sonnet +color: blue +--- + +Merge a completed agent workspace into the source repo. + +## Steps + +1. Check workspace status: +```bash +cat /Users/snider/Code/.core/workspace/{name}/status.json +``` +Only proceed if status is `completed` or `ready-for-review`. + +2. Show the diff: +```bash +git -C /Users/snider/Code/.core/workspace/{name}/repo diff --stat HEAD +git -C /Users/snider/Code/.core/workspace/{name}/repo diff HEAD +``` + +3. Check for untracked new files (git diff misses these): +```bash +git -C /Users/snider/Code/.core/workspace/{name}/repo ls-files --others --exclude-standard +``` + +4. Present a summary to the user. Ask for confirmation before applying. + +5. Apply changes via patch: +```bash +cd /Users/snider/Code/.core/workspace/{name}/repo && git diff HEAD > /tmp/agent-patch.diff +cd /Users/snider/Code/core/{repo}/ && git apply /tmp/agent-patch.diff +``` + +6. Copy any new untracked files manually. + +7. Verify build: +```bash +cd /Users/snider/Code/core/{repo}/ && go build ./... +``` + +## Rules + +- Always show the diff BEFORE applying +- Always check for untracked files (new files created by agent) +- Always verify the build AFTER applying +- Never commit — the user commits when ready +- If the patch fails, show the conflict and stop diff --git a/claude/devops/agents/agent-task-repair-core-agent.md b/claude/devops/agents/agent-task-repair-core-agent.md new file mode 100644 index 0000000..f2c2e6f --- /dev/null +++ b/claude/devops/agents/agent-task-repair-core-agent.md @@ -0,0 +1,53 @@ +--- +name: agent-task-repair-core-agent +description: Diagnoses and repairs core-agent when MCP tools fail, dispatch breaks, or the binary is stale. Use when something isn't working with the agent system. +tools: Bash, Read +model: haiku +color: red +--- + +Diagnose and fix core-agent issues. + +## Diagnosis Steps (run in order, stop at first failure) + +1. Does it compile? +```bash +cd /Users/snider/Code/core/agent && go build ./cmd/core-agent/ +``` + +2. Health check: +```bash +core-agent check +``` + +3. Is a stale process running? +```bash +ps aux | grep core-agent | grep -v grep +``` + +4. Are workspaces clean? +```bash +core-agent workspace/list +``` + +5. Is agents.yaml readable? +```bash +cat /Users/snider/Code/.core/agents.yaml +``` + +## Common Fixes + +| Symptom | Fix | +|---------|-----| +| MCP tools not found | User needs to restart core-agent | +| Dispatch always queued | Check concurrency in agents.yaml | +| Workspaces not prepping | Check template: `ls pkg/lib/workspace/default/` | +| go.work missing | Rebuild — template was updated | +| Codex can't find core.Env | Core dep too old — needs update-deps | + +## Rules + +- Do NOT run `go install` — tell the user to do it +- Do NOT kill processes without asking +- Do NOT delete workspaces without asking +- Report what's wrong, suggest the fix, let the user decide diff --git a/claude/devops/skills/clean-workspaces/SKILL.md b/claude/devops/skills/clean-workspaces/SKILL.md deleted file mode 100644 index 64e2073..0000000 --- a/claude/devops/skills/clean-workspaces/SKILL.md +++ /dev/null @@ -1,44 +0,0 @@ ---- -name: clean-workspaces -description: This skill should be used when the user asks to "clean workspaces", "clean up old agents", "remove stale workspaces", "nuke completed workspaces", or needs to remove finished/failed agent workspaces from the dispatch queue. -argument-hint: [--all | --completed | --failed | --blocked] -allowed-tools: ["Bash"] ---- - -# Clean Agent Workspaces - -Remove stale agent workspaces from the dispatch system. - -## Steps - -1. List all workspaces with their status: - ```bash - for ws in /Users/snider/Code/.core/workspace/*/status.json; do - dir=$(dirname "$ws") - name=$(basename "$dir") - status=$(python3 -c "import json; print(json.load(open('$ws'))['status'])" 2>/dev/null || echo "unknown") - echo "$status $name" - done | sort - ``` - -2. Based on the argument: - - `--completed` — remove workspaces with status "completed" - - `--failed` — remove workspaces with status "failed" - - `--blocked` — remove workspaces with status "blocked" - - `--all` — remove completed + failed + blocked (NOT running) - - No argument — show the list and ask the user what to remove - -3. Show the user what will be removed and get confirmation BEFORE deleting. - -4. Remove confirmed workspaces: - ```bash - rm -rf /Users/snider/Code/.core/workspace// - ``` - -5. Report how many were removed. - -## Important - -- NEVER remove workspaces with status "running" — they have active processes -- ALWAYS ask for confirmation before removing -- Show the count and names before removing diff --git a/claude/devops/skills/health-check/SKILL.md b/claude/devops/skills/health-check/SKILL.md deleted file mode 100644 index 5ec040d..0000000 --- a/claude/devops/skills/health-check/SKILL.md +++ /dev/null @@ -1,23 +0,0 @@ ---- -name: health-check -description: This skill should be used when the user asks to "check health", "is core-agent working", "check agent", "health check", "system status", or needs to verify the core-agent binary, config, and workspace are healthy. -argument-hint: (no arguments needed) -allowed-tools: ["Bash"] ---- - -# Core Agent Health Check - -Verify binary, agents.yaml, workspace directory, and environment. - -```bash -core-agent check -``` - -Also useful: -```bash -# Show all environment keys and values -core-agent env - -# Show version and build info -core-agent version -``` diff --git a/claude/devops/skills/merge-workspace/SKILL.md b/claude/devops/skills/merge-workspace/SKILL.md deleted file mode 100644 index f7c74c1..0000000 --- a/claude/devops/skills/merge-workspace/SKILL.md +++ /dev/null @@ -1,56 +0,0 @@ ---- -name: merge-workspace -description: This skill should be used when the user asks to "merge workspace", "bring over the changes", "review and merge agent work", "pull in the agent's diff", or needs to take a completed agent workspace and merge its changes into the dev branch. Checks the diff, verifies the build, and applies changes. -argument-hint: -allowed-tools: ["Bash", "Read"] ---- - -# Merge Agent Workspace - -Take a completed agent workspace and merge its changes into the repo's dev branch. - -## Steps - -1. Find the workspace. The argument is the workspace name (e.g., `agent-1774177216443021000`). The full path is: - ``` - /Users/snider/Code/.core/workspace// - ``` - -2. Check status: - ```bash - cat /Users/snider/Code/.core/workspace//status.json - ``` - Only proceed if status is `completed` or `ready-for-review`. - -3. Show the diff from the workspace's src/ directory: - ```bash - cd /Users/snider/Code/.core/workspace//src && git diff HEAD - ``` - Present a summary of what changed to the user. - -4. Ask the user if the changes look good before proceeding. - -5. Find the original repo path from status.json (`repo` field). The repo lives at: - ``` - /Users/snider/Code/core// - ``` - -6. Cherry-pick or apply the changes. Use `git diff` to create a patch and apply it: - ```bash - cd /Users/snider/Code/.core/workspace//src && git diff HEAD > /tmp/agent-patch.diff - cd /Users/snider/Code/core// && git apply /tmp/agent-patch.diff - ``` - -7. Verify the build passes: - ```bash - cd /Users/snider/Code/core// && go build ./... - ``` - -8. Report results. Do NOT commit — let the user decide when to commit. - -## Important - -- Always show the diff BEFORE applying -- Always verify the build AFTER applying -- Never commit — the user commits when ready -- If the patch fails to apply, show the conflict and stop diff --git a/claude/devops/skills/repair-core-agent/SKILL.md b/claude/devops/skills/repair-core-agent/SKILL.md deleted file mode 100644 index 458e40a..0000000 --- a/claude/devops/skills/repair-core-agent/SKILL.md +++ /dev/null @@ -1,68 +0,0 @@ ---- -name: repair-core-agent -description: This skill should be used when core-agent is broken, MCP tools aren't responding, dispatch fails, the agent binary is stale, or the user says "fix core-agent", "repair the agent", "core-agent is broken", "MCP not working", "dispatch broken". Diagnoses and guides repair of the core-agent MCP server. -argument-hint: (no arguments needed) -allowed-tools: ["Bash", "Read"] ---- - -# Repair core-agent - -Diagnose and fix core-agent when it's broken. - -## Diagnosis Steps - -Run these in order, stop at the first failure: - -### 1. Is the binary installed? -```bash -which core-agent -``` -Should be at `~/.local/bin/core-agent` or `~/go/bin/core-agent`. If BOTH exist, the wrong one might take precedence — check PATH order. - -### 2. Does it compile? -```bash -cd /Users/snider/Code/core/agent && go build ./cmd/core-agent/ -``` -If this fails, there's a code error. Report it and stop. - -### 3. Is a stale process running? -```bash -ps aux | grep core-agent | grep -v grep -``` -If yes, the user needs to restart it to pick up the new binary. - -### 4. Can it start? -```bash -core-agent mcp 2>&1 | head -5 -``` -Should show subsystem loading messages. - -### 5. Are workspaces clean? -```bash -ls /Users/snider/Code/.core/workspace/ 2>/dev/null -``` -Should only have `events.jsonl`. Stale workspaces with "running" status but dead PIDs cause phantom slot usage. - -### 6. Is agents.yaml readable? -```bash -cat /Users/snider/Code/.core/agents.yaml -``` -Check concurrency settings, agent definitions. - -## Common Fixes - -| Symptom | Fix | -|---------|-----| -| Wrong binary running | Remove stale binary, user reinstalls | -| MCP tools not found | Restart core-agent process | -| Dispatch always queued | Check concurrency limits in agents.yaml | -| Workspaces not prepping | Check workspace template: `ls pkg/lib/workspace/default/` | -| go.work missing from workspace | Rebuild core-agent — template was updated | -| Codex can't find core.Env | Core dep too old — run update-deps skill | - -## Important - -- Do NOT run `go install` — tell the user to do it -- Do NOT kill processes without asking -- Do NOT delete workspaces without asking -- Report what's wrong, suggest the fix, let the user decide