Skip to content

feat: rebuild the moca-delegate-task skill on mocactl - #535

Merged
pdettori merged 1 commit into
rossoctl:mainfrom
moonlight16:feat/delegate-skill-mocactl
Oct 16, 2026
Merged

pdettori merged 1 commit into
rossoctl:mainfrom
moonlight16:feat/delegate-skill-mocactl

Conversation

@moonlight16

@moonlight16 moonlight16 commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

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.md and internal-flow.svg: the delegation flow, with the API call behind each mocactl command, 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

@pdettori pdettori added ready-for-ai-review Request automated AI code review from clawgenti and removed ready-for-ai-review Request automated AI code review from clawgenti labels Oct 15, 2026
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) <[email protected]>
Signed-off-by: Jeremy Cohn <[email protected]>
@moonlight16
moonlight16 force-pushed the feat/delegate-skill-mocactl branch from f5aec5f to 3833ac9 Compare October 15, 2026 19:36
@moonlight16
moonlight16 marked this pull request as ready for review October 15, 2026 21:57
@pdettori pdettori added the ready-for-ai-review Request automated AI code review from clawgenti label Oct 16, 2026

@ingpaolodettori-dev ingpaolodettori-dev left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 *)",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Addressed in #548 (follow-up for the #535 and #544 review).


## Cleanup

Always run `mocactl workloads delete ID` for every workload you created, and tell the user about

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Addressed in #548 (follow-up for the #535 and #544 review).

(`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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Addressed in #548 (follow-up for the #535 and #544 review).

@pdettori
pdettori merged commit 6411c21 into rossoctl:main Oct 16, 2026
14 checks passed
moonlight16 added a commit that referenced this pull request Oct 18, 2026
- 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) <[email protected]>
Signed-off-by: Jeremy Cohn <[email protected]>
moonlight16 added a commit that referenced this pull request Oct 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-ai-review Request automated AI code review from clawgenti

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants