Repository navigation
feat: rebuild the moca-delegate-task skill on mocactl - #535
Conversation
The skill now delegates with contextctl ctx pack and mocactl workloads/spawn/subagents/get instead of the remote_task.py helper. Adds a Claude Code permission allowlist example so delegation keeps working when auto mode's classifier is unavailable, and updates the internal flow diagram to the merged design. Assisted-By: Claude (Anthropic AI) <noreply@anthropic.com> Signed-off-by: Jeremy Cohn <Jeremy.Cohn@ibm.com>
f5aec5f to
3833ac9
Compare
ingpaolodettori-dev
left a comment
There was a problem hiding this comment.
Summary
Adds skills/moca-delegate-task/ (SKILL.md, README, Codex agents/openai.yaml, a Claude Code permission allowlist, and a flow reference with SVG), built on contextctl ctx pack → mocactl workloads create → mocactl spawn --workload [--writable] → subagents/get → workloads delete. I checked every command, flag, JSON shape, state name, exit code and limit against main 4c93f24 and context-service 7951826, and they're accurate. The SVG has no scripts or external references. Nothing blocking; a few suggestions on the allowlist and cleanup.
Author: moonlight16 (MEMBER — maintainer)
Areas reviewed: Docs/skill content, JSON/YAML config, SVG (checked for script/href/foreignObject: clean)
Agent/IDE config (.claude/.vscode): none changed in this repo (settings.example.json is an example a user copies; see the inline comment)
Commits: 1 commit, all signed-off: yes
CI status: passing
Drafted with AI assistance (github-pr-review skill); reviewed by a maintainer before posting.
| { | ||
| "permissions": { | ||
| "allow": [ | ||
| "Bash(contextctl ctx pack *)", |
There was a problem hiding this comment.
suggestion — these rules remove Claude Code's per-command confirmation for exactly the two steps that send local data off the machine (ctx pack of any path, then workloads create). After that, SKILL.md's "Before you send anything" step 4 (get the user's go-ahead) is the only gate, and it's an instruction to the model rather than a control. Please say so plainly where the rules are offered (SKILL.md "Claude Code permissions" and the README Install note), so users opt in knowingly. Something like: "with these rules Claude Code will not ask before uploading a directory; the skill asks instead". Optionally, offer a narrower variant that keeps ctx pack and workloads create on prompt and allows only spawn/subagents/get/workloads get|delete.
|
|
||
| ## Cleanup | ||
|
|
||
| Always run `mocactl workloads delete ID` for every workload you created, and tell the user about |
There was a problem hiding this comment.
nit — cleanup covers the remote workload but not the local repo.context from step 1. That file is a full copy of the packed directory, and step 1 writes it to the current directory, often inside the user's working tree, where it can be committed or packed again later. Suggest packing to a temp path (-o "$(mktemp -d)/repo.context", or tell the agent to choose one) and deleting it here alongside the workload.
| (`POST /internal{ctx}/freeze`). | ||
| 5. **Session:** `mocactl spawn --workload <id> "…"` creates a session for the task on the control | ||
| plane (`POST /v1/sessions`). Fan-out is one `spawn` per task, all on the same workload. | ||
| 6. **Run:** the spawned task sends `POST /runs` naming the workload. The supervisor picks a shared |
There was a problem hiding this comment.
nit — mocactl's worker posts POST /v1/runs (leaf-turn.ts; /runs is the alias in routes.ts). The CLI reference says /v1/runs too, so naming the canonical path here and in the SVG keeps them consistent.
- Say plainly that the skill's allowlist removes Claude Code's prompt before uploads, and offer a restricted set that keeps ctx pack and workloads create on prompt. - Pack into a temporary directory outside the working tree and delete it at cleanup. - Name POST /v1/runs in the flow doc and diagram. - Pin the demo's SH_CONTROL_PLANE_URL and SH_HARNESS_URL so a real deployment's exported URLs never receive the demo token or upload. - --delete removes only a marked demo state directory; --skip-build fails fast when the Context Service image is missing. - deploy/k8s/setup.sh honours KIND_CLUSTER (default moca). Assisted-By: Claude (Anthropic AI) <noreply@anthropic.com> Signed-off-by: Jeremy Cohn <Jeremy.Cohn@ibm.com>
Part of the work split out of #455 (the original context-delegation PR), which carried this skill with a Python helper. Its dependencies, rossoctl/context-service#56 (workspace bundles) and #534 (workload runs start in their context), are merged, and the skill's full flow passed end to end on Kind (see #517, seed sandbox files before a leaf runs). The Kind demo scripts follow in a separate PR.
What this adds (
skills/moca-delegate-task/)SKILL.md: the instructions a local agent (Claude Code, Codex) follows to delegate tasks to MOCA with a packed folder as context:contextctl ctx pack→mocactl workloads create→mocactl spawn --workload [--writable](one spawn per task for fan-out) →mocactl subagents/get→mocactl workloads delete. It covers when to delegate, checking the folder for secrets, prompt advice, the limits (synchronous runs, per-run copies, size limits, shared sandboxes are not a security boundary between users) and cleanup.settings.example.json: a Claude Code permission allowlist for exactly those commands, so delegation keeps working when Claude Code's auto-mode classifier is unavailable (Context handling during classifier outage in Claude Code #530).references/internal-flow.mdandinternal-flow.svg: the delegation flow, with the API call behind eachmocactlcommand, updated from feat: let local agents delegate tasks to Moca #455 to the merged design.README.md: what the skill is and how to install it into a harness.The workflows table now lives in
docs/concepts/context-workflows.md.🤖 Generated with Claude Code