task-delegate 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json ADDED
@@ -0,0 +1,66 @@
1
+ {
2
+ "name": "task-delegate",
3
+ "version": "0.1.0",
4
+ "description": "Low-context multi-backend delegation for CLI coding agents through compact briefs, bundled adapters, and structured results.",
5
+ "type": "module",
6
+ "bin": {
7
+ "task-delegate": "bin/task-delegate.mjs"
8
+ },
9
+ "scripts": {
10
+ "check": "node --check skills/task-delegate/scripts/relay.mjs && find skills/task-delegate/scripts -name '*.mjs' -not -path '*/node_modules/*' -print0 | xargs -0 -n1 node --check",
11
+ "test": "node --test test/*.test.mjs",
12
+ "dry-run": "node bin/task-delegate.mjs run --backend opencode --mode plan --brief examples/brief.sample.md --cd . --dry-run --allow-dirty",
13
+ "start": "node bin/task-delegate.mjs --help",
14
+ "pack:dry-run": "npm pack --dry-run",
15
+ "prepublishOnly": "npm run check && npm test && npm run pack:dry-run",
16
+ "doctor": "node bin/task-delegate.mjs doctor",
17
+ "list-backends": "node bin/task-delegate.mjs list-backends",
18
+ "init-brief": "node bin/task-delegate.mjs init-brief --out task-delegate.brief.md --force"
19
+ },
20
+ "keywords": [
21
+ "agent-skills",
22
+ "delegation",
23
+ "opencode",
24
+ "codex",
25
+ "claude-code",
26
+ "low-context",
27
+ "coding-agent"
28
+ ],
29
+ "license": "Apache-2.0",
30
+ "engines": {
31
+ "node": ">=18.17.0"
32
+ },
33
+ "devDependencies": {},
34
+ "main": "bin/task-delegate.mjs",
35
+ "files": [
36
+ "bin/",
37
+ "skills/",
38
+ "examples/",
39
+ "AGENTS.md",
40
+ "README.md",
41
+ "LICENSE",
42
+ "skills.sh.json",
43
+ "PUBLISHING.md",
44
+ "NOTICE",
45
+ "scripts/",
46
+ "GITHUB_PROFILE_SETUP.md"
47
+ ],
48
+ "repository": {
49
+ "type": "git",
50
+ "url": "git+https://github.com/MOHJRNL/task-delegate.git"
51
+ },
52
+ "bugs": {
53
+ "url": "https://github.com/MOHJRNL/task-delegate/issues"
54
+ },
55
+ "homepage": "https://github.com/MOHJRNL/task-delegate#readme",
56
+ "publishConfig": {
57
+ "access": "public"
58
+ },
59
+ "exports": {
60
+ ".": "./bin/task-delegate.mjs",
61
+ "./skill": "./skills/task-delegate/SKILL.md",
62
+ "./relay": "./skills/task-delegate/scripts/relay.mjs",
63
+ "./package.json": "./package.json"
64
+ },
65
+ "author": "Noah Hendy"
66
+ }
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ OWNER="MOHJRNL"
5
+ REPO="task-delegate"
6
+ DESCRIPTION="Low-context multi-backend delegation for CLI coding agents through compact briefs, bundled adapters, and structured results."
7
+ VISIBILITY="public"
8
+
9
+ if ! command -v gh >/dev/null 2>&1; then
10
+ echo "GitHub CLI (gh) is required. Install it first: https://cli.github.com/" >&2
11
+ exit 1
12
+ fi
13
+
14
+ if ! gh auth status >/dev/null 2>&1; then
15
+ echo "Run: gh auth login" >&2
16
+ exit 1
17
+ fi
18
+
19
+ if gh repo view "$OWNER/$REPO" >/dev/null 2>&1; then
20
+ echo "Repository already exists: https://github.com/$OWNER/$REPO"
21
+ else
22
+ gh repo create "$OWNER/$REPO" --$VISIBILITY --description "$DESCRIPTION" --source=. --remote=origin --push
23
+ echo "Created and pushed: https://github.com/$OWNER/$REPO"
24
+ exit 0
25
+ fi
26
+
27
+ if git remote get-url origin >/dev/null 2>&1; then
28
+ git remote set-url origin "https://github.com/$OWNER/$REPO.git"
29
+ else
30
+ git remote add origin "https://github.com/$OWNER/$REPO.git"
31
+ fi
32
+
33
+ git branch -M main
34
+ git push -u origin main
@@ -0,0 +1,103 @@
1
+ ---
2
+ name: task-delegate
3
+ description: Use this skill when the user wants to delegate a bounded coding task from Claude, Cursor, Codex, Gemini, or another orchestrator agent to CLI coding agents with low context usage. TaskDelegate creates a compact brief, runs a selected backend adapter, captures compact structured results, and keeps review/commit responsibility with the orchestrator. Use OpenCode as the stable default backend. Codex and Claude are experimental/manual backends in v0.1. Do not use for tiny inline edits, vague discovery, direct production changes without review, or tasks requiring GitHub PR automation.
4
+ license: Apache-2.0
5
+ metadata:
6
+ version: "0.1.0"
7
+ backends:
8
+ opencode: stable
9
+ codex: experimental
10
+ claude: experimental
11
+ ---
12
+
13
+ # TaskDelegate
14
+
15
+ You are the orchestrator. The backend CLI agent is the implementer.
16
+
17
+ Your job is to compress the user's task into a small, complete brief, send it to the selected backend, collect the compact result, then review the diff and gates before accepting anything.
18
+
19
+ ## Use this skill when
20
+
21
+ - The task is implementation-heavy.
22
+ - The task is bounded enough to describe clearly.
23
+ - The user wants efficient delegation with low context usage.
24
+ - A backend CLI agent can work from the repository plus a compact brief.
25
+ - The final decision should remain with the orchestrator or human reviewer.
26
+
27
+ ## Do not use this skill when
28
+
29
+ - The edit is tiny and faster to do directly.
30
+ - The task is vague, strategic, or product-discovery-only.
31
+ - The task requires secrets, credentials, or private tokens.
32
+ - The task requires GitHub PR automation.
33
+ - The user expects the backend agent to commit or push.
34
+
35
+ ## Backend policy v0.1
36
+
37
+ - `opencode` is stable and should be the default.
38
+ - `codex` is experimental and should use `manual` unless the user explicitly accepts a different mode.
39
+ - `claude` is experimental and should use `manual` or `plan` unless the user explicitly accepts a different mode.
40
+
41
+ ## Core rules
42
+
43
+ - Backend agents must not commit.
44
+ - Backend agents must not push.
45
+ - Backend agents must not reset, clean, or rewrite git history.
46
+ - Backend agents must not read `.env`, key, certificate, or secret files.
47
+ - Backend agents must not modify files outside the project directory.
48
+ - Backend agents must not install new packages unless explicitly allowed in the brief.
49
+ - The orchestrator must review the final diff before accepting the result.
50
+ - The orchestrator must re-run gates or clearly report that gates were not run.
51
+
52
+ ## Low-context rules
53
+
54
+ - Preferred brief size: 40-80 lines.
55
+ - Default maximum brief size: 120 lines.
56
+ - Do not paste full chat history into the brief.
57
+ - Do not paste large files unless necessary.
58
+ - On retry, send a delta brief only.
59
+ - Load backend-specific references only when needed.
60
+
61
+ ## Default process
62
+
63
+ 1. Decide whether delegation is appropriate.
64
+ 2. Select backend:
65
+ - simple/mechanical: `opencode`
66
+ - reasoning-heavy: `codex`
67
+ - architecture-sensitive: `claude`
68
+ 3. Write a compact brief using `references/brief-template.md`.
69
+ 4. Run the relay:
70
+
71
+ ```bash
72
+ node skills/task-delegate/scripts/relay.mjs --backend opencode --mode safe-auto --brief /path/to/brief.md --cd /path/to/project
73
+ ```
74
+
75
+ 5. Read `result.json`.
76
+ 6. Inspect changed files and diff stat.
77
+ 7. Re-run tests/lint/build where practical.
78
+ 8. Summarize:
79
+ - what changed
80
+ - files changed
81
+ - gates run
82
+ - risks
83
+ - next action
84
+
85
+ ## References
86
+
87
+ - `references/brief-template.md`
88
+ - `references/backend-selection.md`
89
+ - `references/permission-policy.md`
90
+ - `references/result-schema.md`
91
+ - `references/review-checklist.md`
92
+ - `references/roadmap.md`
93
+
94
+
95
+ ## Public usage
96
+
97
+ TaskDelegate can be used either as an installed Agent Skill or through the bundled npm CLI:
98
+
99
+ ```bash
100
+ npx task-delegate run --backend opencode --mode safe-auto --brief brief.md --cd .
101
+ ```
102
+
103
+ The OpenCode, Codex, and Claude adapter scripts are bundled with the skill. Backend CLIs themselves must be installed and authenticated separately.
@@ -0,0 +1,42 @@
1
+ # Backend selection
2
+
3
+ TaskDelegate v0.1 uses manual backend selection. Do not add a smart router yet.
4
+
5
+ ## Backend matrix
6
+
7
+ | Backend | Status | Best for | Default mode |
8
+ |---|---|---|---|
9
+ | OpenCode | Stable | Mechanical edits, tests, simple features, repetitive implementation | `safe-auto` |
10
+ | Codex | Experimental | Reasoning-heavy implementation, bug fixing, second pass | `manual` |
11
+ | Claude | Experimental | Planning, architecture-sensitive changes, complex refactors | `manual` or `plan` |
12
+
13
+ ## Selection rules
14
+
15
+ Use OpenCode when:
16
+
17
+ - The task is clear and bounded.
18
+ - The change is mostly implementation.
19
+ - Cost/context efficiency matters most.
20
+ - You want non-interactive execution with deny rules.
21
+
22
+ Use Codex when:
23
+
24
+ - The task needs deeper reasoning than a mechanical edit.
25
+ - You want a second implementation or review pass.
26
+ - OpenCode failed or produced a weak result.
27
+
28
+ Use Claude when:
29
+
30
+ - The task involves architecture tradeoffs.
31
+ - The codebase is complex.
32
+ - You want a high-quality plan before editing.
33
+ - The change is sensitive enough to prefer manual permissions.
34
+
35
+ ## Do not route automatically in v0.1
36
+
37
+ Automatic routing adds complexity and may waste tokens when it picks the wrong backend. The v0.1 design uses an adapter layer, not a smart router.
38
+
39
+ Roadmap:
40
+
41
+ - v0.3: `--backend auto` rule-based router
42
+ - v0.5: `--profile cheap|balanced|best` cost-aware router
@@ -0,0 +1,87 @@
1
+ # TaskDelegate brief template
2
+
3
+ Use this template to create a compact backend prompt. Keep the brief self-contained, but not bloated.
4
+
5
+ ## Recommended size
6
+
7
+ - Preferred: 40-80 lines.
8
+ - Maximum default: 120 lines.
9
+ - Never paste full chat history.
10
+ - Never paste large files unless the backend cannot read the repo.
11
+
12
+ ## Template
13
+
14
+ ```markdown
15
+ # Task
16
+
17
+ Describe the exact implementation task in 3-6 lines.
18
+
19
+ # Goal
20
+
21
+ What should be true when the task is complete?
22
+
23
+ # Scope
24
+
25
+ Allowed:
26
+ -
27
+
28
+ Not allowed:
29
+ - Do not commit.
30
+ - Do not push.
31
+ - Do not reset, clean, or rewrite git history.
32
+ - Do not read secrets, `.env`, keys, certificates, or credentials.
33
+ - Do not modify unrelated files.
34
+ - Do not install packages unless explicitly allowed.
35
+
36
+ # Files / areas likely involved
37
+
38
+ -
39
+
40
+ # Acceptance criteria
41
+
42
+ -
43
+ -
44
+ -
45
+
46
+ # Gates to run
47
+
48
+ ```bash
49
+ # examples
50
+ npm test
51
+ npm run lint
52
+ npm run build
53
+ ```
54
+
55
+ # Output required
56
+
57
+ Return:
58
+ - summary of changes
59
+ - files changed
60
+ - commands run
61
+ - gate results
62
+ - unresolved issues
63
+ ```
64
+
65
+ ## Retry template
66
+
67
+ For retries, use a delta brief only:
68
+
69
+ ```markdown
70
+ # Delta task
71
+
72
+ Fix only the following issue from the previous run:
73
+
74
+ # Failure / error
75
+
76
+ Paste the exact failing command and short error.
77
+
78
+ # Constraint
79
+
80
+ Do not redo unrelated work. Do not change files outside the previously touched scope unless necessary.
81
+
82
+ # Gate to re-run
83
+
84
+ ```bash
85
+ ...
86
+ ```
87
+ ```
@@ -0,0 +1,74 @@
1
+ # Permission policy
2
+
3
+ TaskDelegate optimizes for efficient delegation without giving backend agents ownership of the repository.
4
+
5
+ ## Universal hard rules
6
+
7
+ Backend agents must not:
8
+
9
+ - commit
10
+ - push
11
+ - reset hard
12
+ - clean files
13
+ - rewrite history
14
+ - read secrets
15
+ - read `.env` files
16
+ - write outside the project directory
17
+ - install packages unless explicitly allowed
18
+
19
+ ## Modes
20
+
21
+ | Mode | Description |
22
+ |---|---|
23
+ | `plan` | Analyze and propose a plan only. |
24
+ | `manual` | Use conservative/manual backend permissions. |
25
+ | `safe-auto` | Non-interactive execution with deny rules. Stable only for OpenCode in v0.1. |
26
+
27
+ ## OpenCode `safe-auto`
28
+
29
+ OpenCode supports `--auto`, which auto-approves permission requests that are not explicitly denied. TaskDelegate sets `OPENCODE_PERMISSION` with restrictive deny/ask rules for `safe-auto`.
30
+
31
+ Default OpenCode permission profile:
32
+
33
+ ```json
34
+ {
35
+ "read": {
36
+ "*": "allow",
37
+ "*.env": "deny",
38
+ "*.env.*": "deny",
39
+ "*.pem": "deny",
40
+ "*.key": "deny",
41
+ "id_rsa*": "deny"
42
+ },
43
+ "edit": {
44
+ "*": "allow",
45
+ "*.env": "deny",
46
+ "*.env.*": "deny"
47
+ },
48
+ "bash": {
49
+ "*": "ask",
50
+ "git status*": "allow",
51
+ "git diff*": "allow",
52
+ "git log*": "allow",
53
+ "git show*": "allow",
54
+ "git add*": "deny",
55
+ "git commit*": "deny",
56
+ "git push*": "deny",
57
+ "git reset*": "deny",
58
+ "git clean*": "deny",
59
+ "rm *": "deny",
60
+ "rm -rf*": "deny"
61
+ },
62
+ "webfetch": "deny",
63
+ "websearch": "deny",
64
+ "external_directory": "deny"
65
+ }
66
+ ```
67
+
68
+ ## Codex v0.1
69
+
70
+ Codex is experimental/manual in v0.1. TaskDelegate does not use dangerous bypass modes. The adapter sends strong prompt-level boundaries and relies on Codex CLI sandbox/approval behavior.
71
+
72
+ ## Claude v0.1
73
+
74
+ Claude is experimental/manual in v0.1. Use `plan` for planning and `manual` for implementation. Do not default to Claude auto mode.
@@ -0,0 +1,46 @@
1
+ # Result schema
2
+
3
+ TaskDelegate writes a compact `result.json` for every run. The orchestrator should read this first and open logs only when needed.
4
+
5
+ ## Schema v0.1
6
+
7
+ ```json
8
+ {
9
+ "schemaVersion": "0.1",
10
+ "skill": "task-delegate",
11
+ "backend": "opencode",
12
+ "backendStatus": "stable",
13
+ "mode": "safe-auto",
14
+ "projectDir": "/path/to/project",
15
+ "runDir": "/path/to/project/.task-delegate/runs/...",
16
+ "startedAt": "2026-07-08T00:00:00.000Z",
17
+ "endedAt": "2026-07-08T00:00:00.000Z",
18
+ "durationMs": 12345,
19
+ "exitCode": 0,
20
+ "timedOut": false,
21
+ "brief": {
22
+ "path": "brief.md",
23
+ "lines": 48,
24
+ "maxLines": 120
25
+ },
26
+ "git": {
27
+ "dirtyBefore": false,
28
+ "dirtyAfter": true,
29
+ "changedFiles": ["src/example.ts"],
30
+ "diffStatPath": "diff-stat.txt",
31
+ "changedFilesPath": "changed-files.txt"
32
+ },
33
+ "artifacts": {
34
+ "promptPath": "prompt.md",
35
+ "stdoutPath": "stdout.log",
36
+ "stderrPath": "stderr.log"
37
+ },
38
+ "warnings": [],
39
+ "reviewRequired": true,
40
+ "commitAllowed": false
41
+ }
42
+ ```
43
+
44
+ ## Design principle
45
+
46
+ Keep `result.json` compact. Do not embed full stdout, stderr, or diff content. Store paths instead.
@@ -0,0 +1,43 @@
1
+ # Review checklist
2
+
3
+ Use this after every delegated run.
4
+
5
+ ## Required checks
6
+
7
+ - Read `result.json` first.
8
+ - Check `exitCode` and `warnings`.
9
+ - Review `changed-files.txt`.
10
+ - Review `diff-stat.txt`.
11
+ - Inspect the actual git diff.
12
+ - Re-run gates from the brief where practical.
13
+ - Confirm no secrets or `.env` files were touched.
14
+ - Confirm no package/dependency changes unless allowed.
15
+ - Confirm no unrelated files were changed.
16
+ - Commit only after review. The backend agent must never commit.
17
+
18
+ ## Red flags
19
+
20
+ Reject or retry with a delta brief if:
21
+
22
+ - The backend changed unrelated files.
23
+ - The backend skipped the requested gates without explanation.
24
+ - The backend installed packages without permission.
25
+ - The backend modified lockfiles unexpectedly.
26
+ - The backend touched auth/payment/security/infra files without explicit scope.
27
+ - The backend produced broad try/catch wrappers instead of fixing root cause.
28
+ - Tests were faked, disabled, or weakened.
29
+
30
+ ## Acceptance summary template
31
+
32
+ ```markdown
33
+ ## Delegated run review
34
+
35
+ Backend:
36
+ Mode:
37
+ Changed files:
38
+ Gates run:
39
+ Gates passed:
40
+ Gates failed/not run:
41
+ Risks:
42
+ Decision: accept / retry / reject
43
+ ```
@@ -0,0 +1,76 @@
1
+ # TaskDelegate roadmap
2
+
3
+ ## v0.1 — Multi-adapter MVP
4
+
5
+ - OpenCode stable adapter
6
+ - Codex experimental adapter
7
+ - Claude experimental adapter
8
+ - Node.js relay
9
+ - compact brief format
10
+ - compact `result.json`
11
+ - no commit boundary
12
+ - dirty working tree preflight
13
+ - OpenCode safe-auto permission profile
14
+
15
+ ## v0.2 — Cost and context discipline
16
+
17
+ - brief budget enforcement improvements
18
+ - output budget warnings
19
+ - delta retry helper
20
+ - optional OpenCode `stats` capture
21
+ - backend capability report
22
+
23
+ ## v0.3 — Router Lite
24
+
25
+ - `--backend auto`
26
+ - simple task classifier: simple / standard / complex / sensitive
27
+ - backend recommendation before execution
28
+ - allow human/orchestrator override
29
+
30
+ ## v0.4 — Efficient backend expansion
31
+
32
+ Add experimental adapters:
33
+
34
+ - Kimi Code / Kimi CLI
35
+ - Qwen Code
36
+ - Gemini CLI
37
+ - Aider
38
+
39
+ Potential later adapters:
40
+
41
+ - Cursor CLI
42
+ - Goose
43
+ - Crush
44
+ - Devin/Copilot if CLI/API workflow is appropriate
45
+
46
+ ## v0.5 — Cost-aware profiles
47
+
48
+ - `--profile cheap`
49
+ - `--profile balanced`
50
+ - `--profile best`
51
+ - fallback chain
52
+ - token/cost summary where backend exposes usage
53
+
54
+ ## v0.6 — Review/guard layer
55
+
56
+ - dependency change warning
57
+ - suspicious file change detection
58
+ - auth/payment/infra file warning
59
+ - basic secret scan integration
60
+ - generated review summary
61
+
62
+ ## v1.0 — Professional DevSecOps/Product workflow
63
+
64
+ - GitHub issue to brief
65
+ - branch and draft PR flow
66
+ - CI result reader
67
+ - PR review checklist
68
+ - release readiness checklist
69
+ - Python reporting layer
70
+
71
+ ## Out of scope for v0.x
72
+
73
+ - Hugging Face model/dataset/Space delivery
74
+ - fully autonomous GitHub PR merging
75
+ - unrestricted auto execution
76
+ - background task monitoring
@@ -0,0 +1,33 @@
1
+ export const backend = {
2
+ name: 'claude',
3
+ status: 'experimental',
4
+ binary: 'claude',
5
+ defaultMode: 'manual',
6
+ supportedModes: ['plan', 'manual', 'safe-auto']
7
+ };
8
+
9
+ function permissionMode(mode) {
10
+ if (mode === 'plan') return 'plan';
11
+ if (mode === 'safe-auto') return 'acceptEdits';
12
+ return 'default';
13
+ }
14
+
15
+ export function buildInvocation({ prompt, mode, model }) {
16
+ const args = ['-p', prompt, '--permission-mode', permissionMode(mode)];
17
+ if (model) args.push('--model', model);
18
+
19
+ const warnings = [
20
+ 'Claude adapter is experimental in TaskDelegate v0.1.'
21
+ ];
22
+
23
+ if (mode === 'safe-auto') {
24
+ warnings.push('Claude safe-auto maps to acceptEdits and is not recommended as default. Prefer manual or plan.');
25
+ }
26
+
27
+ return {
28
+ command: backend.binary,
29
+ args,
30
+ env: {},
31
+ warnings
32
+ };
33
+ }
@@ -0,0 +1,27 @@
1
+ export const backend = {
2
+ name: 'codex',
3
+ status: 'experimental',
4
+ binary: 'codex',
5
+ defaultMode: 'manual',
6
+ supportedModes: ['plan', 'manual']
7
+ };
8
+
9
+ export function buildInvocation({ prompt, mode, model }) {
10
+ const effectivePrompt = mode === 'plan'
11
+ ? `PLAN MODE ONLY. Do not edit files. Do not run destructive commands. Produce a concise implementation plan.\n\n${prompt}`
12
+ : prompt;
13
+
14
+ const args = ['exec'];
15
+ if (model) args.push('-m', model);
16
+ args.push(effectivePrompt);
17
+
18
+ return {
19
+ command: backend.binary,
20
+ args,
21
+ env: {},
22
+ warnings: [
23
+ 'Codex adapter is experimental in TaskDelegate v0.1.',
24
+ 'TaskDelegate does not use dangerous bypass/yolo modes for Codex.'
25
+ ]
26
+ };
27
+ }