From ad02febf6a5a75b9ddb894c9c8231358289f686f Mon Sep 17 00:00:00 2001 From: namos2502 Date: Mon, 23 Mar 2026 18:57:59 -0400 Subject: [PATCH 1/5] fix: correct Copilot CLI invocation patterns and sandbox handling - Remove -s flag (causes exit code 1) - Fix sandbox: cd to repo root instead of nonexistent --cwd flag - Fix --allow-tool format: no spaces (write,read) - Update model: claude-sonnet-4-5 for real tasks, haiku for pings - Add --cwd to all Claude CLI invocation patterns - Fix orchestration detection command: remove -s, add cd to root - Bump version to 0.5.6 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .claude-plugin/plugin.json | 2 +- CHANGELOG.md | 10 ++++++ skills/agents/claude-cli/SKILL.md | 21 +++++++++-- skills/agents/copilot-cli/SKILL.md | 58 ++++++++++++++++++++---------- skills/orchestration/SKILL.md | 3 +- 5 files changed, 71 insertions(+), 23 deletions(-) diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json index ba227c1..3f24424 100644 --- a/.claude-plugin/plugin.json +++ b/.claude-plugin/plugin.json @@ -1,7 +1,7 @@ { "name": "cortexlink", "description": "Cross-agent workflow plugin — gives your agent the full programmatic reference for every CLI tool you use. One plugin. Every CLI. Stay in flow.", - "version": "0.5.5", + "version": "0.5.6", "author": { "name": "namos2502" }, diff --git a/CHANGELOG.md b/CHANGELOG.md index a7f5449..20059f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,16 @@ All notable changes to CortexLink will be documented here. +## [0.5.6] — 2026-03-23 + +### Fixed +- Removed `-s` flag from all Copilot CLI invocation patterns — causes exit code 1, not a valid flag for programmatic use +- Copilot CLI sandbox fix: no `--cwd` flag exists; all invocations now `cd` to repo root first (`cd $(git rev-parse --show-toplevel) &&`) — prevents silent file access failures under `--no-ask-user` when invoked from a subdirectory +- `--allow-tool` values corrected to no-space format (`'write,read'`, `'write,shell(git:*),read'`) +- Model updated to `--model=claude-sonnet-4-5` for real tasks (was "omit"); `--model=claude-haiku-4.5` kept for availability checks only +- Claude CLI: added `--cwd $(git rev-parse --show-toplevel)` to all invocation patterns — same sandbox restriction applies +- Orchestration detection command: removed `-s`, added `cd` to repo root + ## [0.5.5] — 2026-03-23 ### Changed diff --git a/skills/agents/claude-cli/SKILL.md b/skills/agents/claude-cli/SKILL.md index b6723b2..82d4e76 100644 --- a/skills/agents/claude-cli/SKILL.md +++ b/skills/agents/claude-cli/SKILL.md @@ -66,11 +66,22 @@ Shell access (`Bash(...)`) is a separate, deliberate decision. Use `--disallowed Use short aliases (`sonnet`, `opus`) for the latest version, or full IDs (e.g. `claude-sonnet-4-6`) to pin a specific model. +## Working Directory + +Claude CLI is sandboxed to its working directory — the same restriction as Copilot CLI. + +⛔ **Always invoke from the repo root.** Use `--cwd` or `cd` before invoking. + +```bash +claude -p "..." --cwd $(git rev-parse --show-toplevel) --output-format text ... +``` + ## Invocation Patterns **Read-only delegation (question, analysis):** ```bash claude -p "[delegation prompt]" --output-format text \ + --cwd $(git rev-parse --show-toplevel) \ --allowedTools "Read" --model claude-haiku-4-5 \ --no-session-persistence --max-turns 3 ``` @@ -78,6 +89,7 @@ claude -p "[delegation prompt]" --output-format text \ **Write delegation (fix, implement):** ```bash claude -p "[delegation prompt]" --output-format text \ + --cwd $(git rev-parse --show-toplevel) \ --allowedTools "Read" "Edit" "Write" \ --no-session-persistence ``` @@ -85,6 +97,7 @@ claude -p "[delegation prompt]" --output-format text \ **Write delegation + shell (runs commands):** ```bash claude -p "[delegation prompt]" --output-format text \ + --cwd $(git rev-parse --show-toplevel) \ --allowedTools "Read" "Edit" "Bash(git *)" \ --no-session-persistence ``` @@ -92,12 +105,14 @@ claude -p "[delegation prompt]" --output-format text \ **Planning / analysis only (no writes):** ```bash claude -p "[delegation prompt]" --output-format text \ + --cwd $(git rev-parse --show-toplevel) \ --permission-mode plan --no-session-persistence --max-turns 5 ``` **Piped input:** ```bash cat file.ts | claude -p "[delegation prompt]" --output-format text \ + --cwd $(git rev-parse --show-toplevel) \ --allowedTools "Read" --no-session-persistence ``` @@ -116,7 +131,9 @@ Follow the template from `skills/orchestration/SKILL.md`. Include the structured The agent's stdout is its report. Capture it directly: ```bash -REPORT=$(claude -p "[prompt]" --output-format text --allowedTools "Read" --no-session-persistence 2>/dev/null) +REPORT=$(claude -p "[prompt]" --output-format text \ + --cwd $(git rev-parse --show-toplevel) \ + --allowedTools "Read" --no-session-persistence 2>/dev/null) ``` Read STATUS first. If ⚠️ or ❌, read ISSUES before deciding next action. @@ -126,8 +143,8 @@ Read STATUS first. If ⚠️ or ❌, read ISSUES before deciding next action. | | Copilot CLI | Claude CLI | |--|-------------|------------| | Tool permissions | `--allow-tool='write, read'` | `--allowedTools "Read" "Edit"` | -| Silence | `-s` | `--output-format text` | | Prevent questions | `--no-ask-user` | implied by `-p` | +| Working directory | `--cwd PATH` | `--cwd PATH` | | Model flag | `--model=claude-haiku-4.5` | `--model claude-haiku-4-5` | ## Error Handling diff --git a/skills/agents/copilot-cli/SKILL.md b/skills/agents/copilot-cli/SKILL.md index 1a9b4d5..f10b638 100644 --- a/skills/agents/copilot-cli/SKILL.md +++ b/skills/agents/copilot-cli/SKILL.md @@ -23,12 +23,26 @@ description: Behavioral reference for GitHub Copilot CLI. Use when delegating Gi | Flag | Purpose | |------|---------| | `-p "PROMPT"` | Programmatic mode — executes prompt and exits | -| `-s` | Silent — output only the agent response (no usage stats) | -| `--no-ask-user` | Agent works autonomously, no questions | -| `--no-auto-update` | Suppress update checks | -| `--no-color` | Plain text output | +| `--no-ask-user` | Suppresses interactive permission prompts — required for non-interactive use | +| `--no-auto-update` | Prevents Copilot from updating itself mid-run | +| `--no-color` | Clean output, no ANSI escape codes | +| `-s` | ❌ Causes exit code 1 — do not use | -Always combine `-s --no-ask-user --no-auto-update --no-color` for clean programmatic output. +Always combine `--no-ask-user --no-auto-update --no-color` for clean programmatic output. + +## Sandbox Limitation + +Copilot CLI is sandboxed to its working directory. With `--no-ask-user`, any file access outside that directory silently fails — no error, no output. There is no `--cwd` flag; the only fix is to `cd` to the repo root before invoking. + +⛔ **Always `cd` to the repo root before invoking.** Never call from a subdirectory. + +```bash +# ❌ Sandboxed to client/ — reads outside it silently fail +copilot -p "..." --no-ask-user ... + +# ✅ Correct — full repo accessible +cd $(git rev-parse --show-toplevel) && copilot -p "..." --no-ask-user ... +``` ## Tool Permissions (`--allow-tool`) @@ -37,15 +51,15 @@ Pre-approves tools so the agent doesn't pause to prompt. | Use case | Flag | |----------|------| | Questions, analysis, review | `--allow-tool='read'` | -| Modify or create files | `--allow-tool='write, read'` | -| Modify files + run git commands | `--allow-tool='write, shell(git:*), read'` | +| Modify or create files | `--allow-tool='write,read'` | +| Modify files + run git commands | `--allow-tool='write,shell(git:*),read'` | Shell access (`shell(...)`) is a separate, deliberate decision — not an automatic addition to write access. Only grant it when the task genuinely requires running commands. Use `--deny-tool` to block specific commands within an allowed scope: ```bash # Allow git reads but block pushes ---allow-tool='shell(git:*), read' --deny-tool='shell(git push)' +--allow-tool='shell(git:*),read' --deny-tool='shell(git push)' ``` Deny rules always override allow rules. @@ -53,33 +67,37 @@ Deny rules always override allow rules. | Task | Flag | |------|-------| -| Quick question, analysis | `--model=claude-haiku-4.5` | -| Complex fix, multi-step | omit (uses session default) | +| Availability check / quick question | `--model=claude-haiku-4.5` | +| Real tasks — analysis, fix, review | `--model=claude-sonnet-4-5` | ## Invocation Patterns **Read-only delegation (question, analysis):** ```bash -copilot -p "[delegation prompt]" -s --no-ask-user --no-auto-update --no-color \ - --allow-tool='read' --model=claude-haiku-4.5 +cd $(git rev-parse --show-toplevel) && \ +copilot -p "[delegation prompt]" --no-ask-user --no-auto-update --no-color \ + --allow-tool='read' --model=claude-sonnet-4-5 ``` **Write delegation (fix, implement):** ```bash -copilot -p "[delegation prompt]" -s --no-ask-user --no-auto-update --no-color \ - --allow-tool='write, read' +cd $(git rev-parse --show-toplevel) && \ +copilot -p "[delegation prompt]" --no-ask-user --no-auto-update --no-color \ + --allow-tool='write,read' --model=claude-sonnet-4-5 ``` **Write delegation + git (runs git commands):** ```bash -copilot -p "[delegation prompt]" -s --no-ask-user --no-auto-update --no-color \ - --allow-tool='write, shell(git:*), read' +cd $(git rev-parse --show-toplevel) && \ +copilot -p "[delegation prompt]" --no-ask-user --no-auto-update --no-color \ + --allow-tool='write,shell(git:*),read' --model=claude-sonnet-4-5 ``` **Code review (built-in /review agent):** ```bash -copilot -p "/review [scope]" -s --no-ask-user --no-auto-update --no-color \ - --allow-tool='shell(git:*), read' +cd $(git rev-parse --show-toplevel) && \ +copilot -p "/review [scope]" --no-ask-user --no-auto-update --no-color \ + --allow-tool='shell(git:*),read' --model=claude-sonnet-4-5 ``` Redirect stderr if needed: add `2>/dev/null` @@ -95,7 +113,9 @@ Follow the template from `skills/orchestration/SKILL.md`. Include the structured The agent's stdout is its report. Capture it directly: ```bash -REPORT=$(copilot -p "[prompt]" -s --no-ask-user --no-auto-update --no-color --allow-tool='read' 2>/dev/null) +REPORT=$(cd $(git rev-parse --show-toplevel) && \ + copilot -p "[prompt]" --no-ask-user --no-auto-update --no-color \ + --allow-tool='read' --model=claude-sonnet-4-5 2>/dev/null) ``` Read STATUS first. If ⚠️ or ❌, read ISSUES before deciding next action. diff --git a/skills/orchestration/SKILL.md b/skills/orchestration/SKILL.md index 241caac..b136695 100644 --- a/skills/orchestration/SKILL.md +++ b/skills/orchestration/SKILL.md @@ -147,7 +147,8 @@ Execute → Verify → (fix if needed) → Report. ```bash # Copilot CLI -which copilot 2>/dev/null && copilot -p "ping" -s --no-ask-user --no-auto-update --no-color --allow-tool='read' --model=claude-haiku-4.5 2>/dev/null | head -1 +which copilot 2>/dev/null && cd $(git rev-parse --show-toplevel) && \ + copilot -p "ping" --no-ask-user --no-auto-update --no-color --allow-tool='read' --model=claude-haiku-4.5 2>/dev/null | head -1 # Claude CLI which claude 2>/dev/null && claude -p "ping" --output-format text --allowedTools "Read" --max-turns 1 --no-session-persistence 2>/dev/null | head -1 From 2ec87f05c3edf411fcf1446e890161b50ace22f4 Mon Sep 17 00:00:00 2001 From: namos2502 Date: Tue, 24 Mar 2026 14:57:58 -0400 Subject: [PATCH 2/5] feat: apply plugin-dev eval improvements (v0.5.7) Commands: - Add allowed-tools frontmatter to setup (Read, Edit, Bash) and cleanup (Read, Edit) - Fix help directive style to direct output instruction Skills: - Rewrite all 3 skill descriptions to third-person trigger format - Add user-invocable: false to orchestration, copilot-cli, claude-cli skills - Split orchestration/SKILL.md (8.8KB -> 5.3KB): extract delegation template and report format into references/ for progressive disclosure Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .claude-plugin/plugin.json | 2 +- CHANGELOG.md | 9 ++ commands/cleanup.md | 1 + commands/help.md | 2 +- commands/setup.md | 1 + skills/agents/claude-cli/SKILL.md | 4 +- skills/agents/copilot-cli/SKILL.md | 4 +- skills/orchestration/SKILL.md | 115 +++--------------- .../references/delegation-template.md | 36 ++++++ .../orchestration/references/report-format.md | 72 +++++++++++ 10 files changed, 139 insertions(+), 107 deletions(-) create mode 100644 skills/orchestration/references/delegation-template.md create mode 100644 skills/orchestration/references/report-format.md diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json index 3f24424..06fbb39 100644 --- a/.claude-plugin/plugin.json +++ b/.claude-plugin/plugin.json @@ -1,7 +1,7 @@ { "name": "cortexlink", "description": "Cross-agent workflow plugin — gives your agent the full programmatic reference for every CLI tool you use. One plugin. Every CLI. Stay in flow.", - "version": "0.5.6", + "version": "0.5.7", "author": { "name": "namos2502" }, diff --git a/CHANGELOG.md b/CHANGELOG.md index 20059f0..350589f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,15 @@ All notable changes to CortexLink will be documented here. +## [0.5.7] — 2026-03-24 + +### Improved +- **Commands:** Added `allowed-tools` frontmatter to `setup` (Read, Edit, Bash) and `cleanup` (Read, Edit) — prevents unexpected permission prompts during the most critical user interactions +- **Commands:** Fixed `help` command directive style — replaced indirect "Reply to the user with..." with direct output instruction +- **Skills:** All three skill descriptions rewritten to third-person trigger format ("This skill should be used when...") for reliable auto-activation +- **Skills:** Added `user-invocable: false` to `orchestration`, `copilot-cli`, and `claude-cli` skills — these are internal protocol skills, not user-invocable actions +- **Skills:** Split `orchestration/SKILL.md` (8.8 KB → 5.3 KB) — delegation prompt template and report format details extracted to `references/delegation-template.md` and `references/report-format.md` for progressive disclosure + ## [0.5.6] — 2026-03-23 ### Fixed diff --git a/commands/cleanup.md b/commands/cleanup.md index 04f95f3..5836f08 100644 --- a/commands/cleanup.md +++ b/commands/cleanup.md @@ -1,5 +1,6 @@ --- description: "Remove CortexLink configuration added by /cortexlink:setup" +allowed-tools: Read, Edit --- Remove the CortexLink sections that were added during setup. Run the following steps in order. diff --git a/commands/help.md b/commands/help.md index ab7a76f..486d22f 100644 --- a/commands/help.md +++ b/commands/help.md @@ -2,7 +2,7 @@ description: "Show CortexLink plugin information and how to get started" --- -Reply to the user with the following information: +Output the following to the user: **CortexLink** — One plugin. Every CLI. Stay in flow. diff --git a/commands/setup.md b/commands/setup.md index 9784632..2712475 100644 --- a/commands/setup.md +++ b/commands/setup.md @@ -1,5 +1,6 @@ --- description: "One-time setup — detects installed CLI agents, authenticates, and registers CortexLink as always-on in ~/.claude/CLAUDE.md and ~/.copilot/copilot-instructions.md" +allowed-tools: Read, Edit, Bash --- Run the following steps in order and report the results clearly to the user. diff --git a/skills/agents/claude-cli/SKILL.md b/skills/agents/claude-cli/SKILL.md index 82d4e76..799e929 100644 --- a/skills/agents/claude-cli/SKILL.md +++ b/skills/agents/claude-cli/SKILL.md @@ -1,7 +1,7 @@ --- name: claude-cli -description: Behavioral reference for Claude CLI. Use when delegating general code tasks, analysis, or tasks requiring Anthropic-native reasoning via `claude -p`. - +description: This skill should be used when delegating general code tasks — explanations, refactors, fixes, analysis — via `claude -p`. Also use when context isolation or a specific Anthropic model is needed for the subtask. +user-invocable: false --- # Claude CLI Agent diff --git a/skills/agents/copilot-cli/SKILL.md b/skills/agents/copilot-cli/SKILL.md index f10b638..32fd6c5 100644 --- a/skills/agents/copilot-cli/SKILL.md +++ b/skills/agents/copilot-cli/SKILL.md @@ -1,7 +1,7 @@ --- name: copilot-cli -description: Behavioral reference for GitHub Copilot CLI. Use when delegating GitHub-specific or GitHub-adjacent tasks via `copilot -p`. - +description: This skill should be used when delegating GitHub-specific tasks — PRs, issues, repos, Actions, branches, code review — via `copilot -p`. Use it when Copilot CLI's GitHub-native tooling is an advantage over the host agent. +user-invocable: false --- # Copilot CLI Agent diff --git a/skills/orchestration/SKILL.md b/skills/orchestration/SKILL.md index b136695..de82c6d 100644 --- a/skills/orchestration/SKILL.md +++ b/skills/orchestration/SKILL.md @@ -1,7 +1,7 @@ --- name: orchestration -description: Cross-agent orchestration protocol. Teaches the host AI agent to act as a persistent control center — decomposing tasks, fanning out to peer CLI agents, receiving verified reports, and synthesizing results. - +description: This skill should be used when a multi-step task can benefit from cross-CLI delegation — decomposing work into subtasks, routing them to Copilot CLI or Claude CLI agents, and synthesizing their structured reports back to the user. +user-invocable: false --- # CortexLink Orchestration @@ -31,7 +31,7 @@ CONTROL CENTER (your AI agent — decomposes, routes, reviews) └── [own tools & sub-agents — internal, platform-native] ``` -The control center IS your active AI agent — it holds the plan and directs the work. Each Agent is a full CLI agent in its own right, not a dumb executor. It can use its own platform-native tools and sub-agents internally to complete the task. The tree is one level deep: Agents are peers, they don't chain to each other. Width scales as you add agents; depth stays fixed. +The control center IS your active AI agent — it holds the plan and directs the work. Each Agent is a full CLI agent in its own right, not a dumb executor. The tree is one level deep: Agents are peers, they don't chain to each other. Width scales as you add agents; depth stays fixed. ## Task Complexity @@ -39,17 +39,17 @@ Classify every task before routing. This determines how much spec detail to writ | Level | Signals | Delegation style | |-------|---------|-----------------| -| **Simple** | Single operation, read-only, unambiguous output (a list, a status, a count) | Handle inline — no cross-CLI | +| **Simple** | Single operation, read-only, unambiguous output | Handle inline — no cross-CLI | | **Standard** | 2–4 operations, may write, clear success criteria, low rework cost | Full spec: problem + acceptance criteria | -| **Complex** | 5+ operations, writes/commits/PRs, judgment calls, OR high rework cost if misunderstood | Full spec + Q&A turn before execution | +| **Complex** | 5+ operations, writes/commits/PRs, judgment calls, OR high rework cost | Full spec + Q&A turn before execution | -**Key signal for Complex:** rework cost. If the agent misunderstands and you must redo the work — how expensive is that? Tasks with irreversible steps (PRs, commits, deploys) or required judgment calls always qualify. +**Key signal for Complex:** rework cost. Tasks with irreversible steps (PRs, commits, deploys) or required judgment calls always qualify. ## When to Delegate Cross-CLI **Delegate when:** 1. **Platform-specific** — GitHub ops (PRs, repos, Actions) → Copilot; Anthropic reasoning or Claude-specific model → Claude CLI -2. **Context isolation** — offload a long subtask so its intermediate work never enters your context (the final result DOES return via stdout) +2. **Context isolation** — offload a long subtask so its intermediate work never enters your context 3. **Different model needed** — the target CLI runs a model the host cannot 4. Task is **Standard or Complex** — the work inside the agent justifies the delegation overhead @@ -58,7 +58,7 @@ Classify every task before routing. This determines how much spec detail to writ 2. The host has a native subagent that can handle it 3. The target CLI is not installed or not authenticated 4. You have no clear reason — "big task" is not a reason -5. Task is **Simple** — handle inline or use a native subagent; a full agent session costs more than the task itself +5. Task is **Simple** — handle inline; a full agent session costs more than the task itself **Decision tree:** ``` @@ -78,101 +78,11 @@ New task → ## Control Center Protocol 1. **Decompose** — Break into scoped, independently executable subtasks. Each must be verifiable by the agent itself. -2. **Route** — Apply decision tree. Check agent availability (see below). -3. **Dispatch** — Use delegation prompt template. Always include scope, success criteria, report format. +2. **Route** — Apply decision tree. Check agent availability (see `references/report-format.md`). +3. **Dispatch** — Use delegation prompt template (see `references/delegation-template.md`). Always include scope, success criteria, report format. 4. **Review** — Read STATUS first. Spot-check if needed (`git diff`, tests). Decide: proceed, re-assign, or adjust. 5. **Track** — Update state (done / pending / failed). Never skip to the next subtask without reviewing the current report. -6. **Synthesize** — When all subtasks are done, consolidate into one output for the user. Never surface raw agent output. Lead with issues (🔴 blocker / 🟠 should fix / 🟡 minor), then a one-sentence verdict on what to do next. If any subtask is ❌, hold the verdict until resolved. - -## Delegation Prompt Template - -``` -[Task]: -[Context]: -[Success criteria]: -[Report format]: Return ONLY this when finished. Plain text labels only — no **bold**, no # headers: - STATUS: ✅ Verified / ⚠️ Partial / ❌ Failed - SUMMARY: <1-2 sentences> - STEPS: - FILES: - ISSUES: - Max 150 words. -``` - -Keep prompts lean. No project dumps. - -**For Complex tasks only**, append this block to the delegation prompt before the report format: - -``` -[Before executing]: This task is complex. In your first response, list any questions -or ambiguities — 1 turn only. Do not perform any actions until I confirm. -``` - -The agent surfaces questions, you refine the spec if needed, then issue the execution follow-up. - -## Structured Report Format - -Every agent, every tier, every time: - -``` -STATUS: ✅ Verified / ⚠️ Partial / ❌ Failed -SUMMARY: <1-2 sentences> -STEPS: - - - - -FILES: -ISSUES: -``` - -**Never return raw output or tool call dumps to the control center.** - -## Self-Verify Before Reporting (when YOU are the agent) - -Execute → Verify → (fix if needed) → Report. - -1. Run the task -2. Check your own work — tests, file contents, expected state -3. If verification fails → fix, then verify again -4. Only then → write the structured report - -| Status | Meaning | -|--------|---------| -| ✅ Verified | You actively checked. It works. | -| ⚠️ Partial | Some parts verified, some could not be checked. Explain in ISSUES. | -| ❌ Failed | Describe what was attempted and what failed. | - -**Never mark ✅ without actually checking.** - -## Agent Detection - -```bash -# Copilot CLI -which copilot 2>/dev/null && cd $(git rev-parse --show-toplevel) && \ - copilot -p "ping" --no-ask-user --no-auto-update --no-color --allow-tool='read' --model=claude-haiku-4.5 2>/dev/null | head -1 - -# Claude CLI -which claude 2>/dev/null && claude -p "ping" --output-format text --allowedTools "Read" --max-turns 1 --no-session-persistence 2>/dev/null | head -1 -``` - -If unavailable: fall back to another agent, handle natively, or tell the user to run `/cortexlink:setup`. - -## Error Handling - -| STATUS | Control center action | -|--------|-----------------------| -| ✅ | Accept, proceed | -| ⚠️ | Read ISSUES, accept partial or re-assign unverified parts | -| ❌ | Read ISSUES. Re-assign, adjust scope, or handle natively | -| No output | Retry once. If still failing, handle natively. | -| Auth failure | Tell user: `/cortexlink:setup` | - -**After 2 consecutive ❌ on the same subtask — stop and discuss with the user before retrying.** - -## Cross-Agent Chaining - -Fan out to multiple Agents in parallel when tasks are independent. Pass a report excerpt (SUMMARY + STEPS) as context into the next delegation prompt — never raw output. Agents do not chain to each other; all coordination happens at the control center. - -**Avoid duplicate fetches:** When multiple agents need the same source data (e.g. a PR diff, a file's contents), fetch it once in the control center and pass it as `[Context]` in each delegation prompt. Do not let each agent re-fetch the same data independently. +6. **Synthesize** — Consolidate into one output for the user. Lead with issues (🔴 blocker / 🟠 should fix / 🟡 minor), then a one-sentence verdict. If any subtask is ❌, hold the verdict until resolved. ## Red Flags — STOP @@ -190,6 +100,9 @@ Fan out to multiple Agents in parallel when tasks are independent. Pass a report |------------|---------| | GitHub task | Copilot — see `skills/agents/copilot-cli/SKILL.md` | | General code task | Claude CLI — see `skills/agents/claude-cli/SKILL.md` | +| Delegation prompt | See `references/delegation-template.md` | +| Report format / self-verify | See `references/report-format.md` | | Add a new agent | Drop `skills/agents//SKILL.md` — follow existing format | | Handle auth failure | Tell user: `/cortexlink:setup` | | Handle ❌ report | Read ISSUES. Re-assign or handle natively. Never retry blindly. | + diff --git a/skills/orchestration/references/delegation-template.md b/skills/orchestration/references/delegation-template.md new file mode 100644 index 0000000..b841439 --- /dev/null +++ b/skills/orchestration/references/delegation-template.md @@ -0,0 +1,36 @@ +# Delegation Prompt Template + +Use this template for every cross-CLI delegation. Keep prompts lean — no project dumps. + +``` +[Task]: +[Context]: +[Success criteria]: +[Report format]: Return ONLY this when finished. Plain text labels only — no **bold**, no # headers: + STATUS: ✅ Verified / ⚠️ Partial / ❌ Failed + SUMMARY: <1-2 sentences> + STEPS: + FILES: + ISSUES: + Max 150 words. +``` + +**For Complex tasks only**, append this block before the report format: + +``` +[Before executing]: This task is complex. In your first response, list any questions +or ambiguities — 1 turn only. Do not perform any actions until I confirm. +``` + +The agent surfaces questions, you refine the spec if needed, then issue the execution follow-up. + +⛔ **Critical (Copilot CLI only):** Always include this line in the prompt body: +*"Return ONLY the structured report. No reasoning steps, no 'Let me...' output before the report."* + +--- + +# Cross-Agent Chaining + +Fan out to multiple Agents in parallel when tasks are independent. Pass a report excerpt (SUMMARY + STEPS) as context into the next delegation prompt — never raw output. Agents do not chain to each other; all coordination happens at the control center. + +**Avoid duplicate fetches:** When multiple agents need the same source data (e.g. a PR diff, a file's contents), fetch it once in the control center and pass it as `[Context]` in each delegation prompt. Do not let each agent re-fetch the same data independently. diff --git a/skills/orchestration/references/report-format.md b/skills/orchestration/references/report-format.md new file mode 100644 index 0000000..09dc3f5 --- /dev/null +++ b/skills/orchestration/references/report-format.md @@ -0,0 +1,72 @@ +# Structured Report Format + +Every agent, every tier, every time: + +``` +STATUS: ✅ Verified / ⚠️ Partial / ❌ Failed +SUMMARY: <1-2 sentences> +STEPS: + - + - +FILES: +ISSUES: +``` + +**Never return raw output or tool call dumps to the control center.** + +--- + +# Self-Verify Before Reporting (when YOU are the agent) + +Execute → Verify → (fix if needed) → Report. + +1. Run the task +2. Check your own work — tests, file contents, expected state +3. If verification fails → fix, then verify again +4. Only then → write the structured report + +| Status | Meaning | +|--------|---------| +| ✅ Verified | You actively checked. It works. | +| ⚠️ Partial | Some parts verified, some could not be checked. Explain in ISSUES. | +| ❌ Failed | Describe what was attempted and what failed. | + +**Never mark ✅ without actually checking.** + +**Status semantics for analysis tasks:** +- ✅ Verified = you read the code and completed the analysis — even if you cannot *run* it +- ⚠️ Partial = you could not access required files, or the diff was truncated +- ❌ Failed = the command failed or the data was inaccessible + +⛔ Do NOT use ⚠️ just because you cannot execute the code being reviewed. Completed static analysis = ✅. + +--- + +# Agent Detection + +Run these before delegating to verify agents are available: + +```bash +# Copilot CLI +which copilot 2>/dev/null && cd $(git rev-parse --show-toplevel) && \ + copilot -p "ping" --no-ask-user --no-auto-update --no-color --allow-tool='read' --model=claude-haiku-4.5 2>/dev/null | head -1 + +# Claude CLI +which claude 2>/dev/null && claude -p "ping" --output-format text --allowedTools "Read" --max-turns 1 --no-session-persistence 2>/dev/null | head -1 +``` + +If unavailable: fall back to another agent, handle natively, or tell the user to run `/cortexlink:setup`. + +--- + +# Error Handling + +| STATUS | Control center action | +|--------|-----------------------| +| ✅ | Accept, proceed | +| ⚠️ | Read ISSUES, accept partial or re-assign unverified parts | +| ❌ | Read ISSUES. Re-assign, adjust scope, or handle natively | +| No output | Retry once. If still failing, handle natively. | +| Auth failure | Tell user: `/cortexlink:setup` | + +**After 2 consecutive ❌ on the same subtask — stop and discuss with the user before retrying.** From a9256d222480c1b4f9509f65c7c63a044e82b231 Mon Sep 17 00:00:00 2001 From: namos2502 Date: Wed, 25 Mar 2026 10:25:42 -0400 Subject: [PATCH 3/5] fix: correct claude-cli SKILL.md invocation example and comparison table - Add missing 'Write' to 'Write delegation + shell' allowedTools example (was inconsistent with the Tool Permissions table above it) - Fix Key Differences table: Copilot CLI has no --cwd flag; correct to 'cd $(git rev-parse --show-toplevel) &&' pattern Fixes CodeRabbit findings on PR #6. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- skills/agents/claude-cli/SKILL.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/skills/agents/claude-cli/SKILL.md b/skills/agents/claude-cli/SKILL.md index 799e929..b5b3926 100644 --- a/skills/agents/claude-cli/SKILL.md +++ b/skills/agents/claude-cli/SKILL.md @@ -98,7 +98,7 @@ claude -p "[delegation prompt]" --output-format text \ ```bash claude -p "[delegation prompt]" --output-format text \ --cwd $(git rev-parse --show-toplevel) \ - --allowedTools "Read" "Edit" "Bash(git *)" \ + --allowedTools "Read" "Edit" "Write" "Bash(git *)" \ --no-session-persistence ``` @@ -144,7 +144,7 @@ Read STATUS first. If ⚠️ or ❌, read ISSUES before deciding next action. |--|-------------|------------| | Tool permissions | `--allow-tool='write, read'` | `--allowedTools "Read" "Edit"` | | Prevent questions | `--no-ask-user` | implied by `-p` | -| Working directory | `--cwd PATH` | `--cwd PATH` | +| Working directory | `cd $(git rev-parse --show-toplevel) &&` | `--cwd PATH` | | Model flag | `--model=claude-haiku-4.5` | `--model claude-haiku-4-5` | ## Error Handling From d4de4a217d74c8c842d40eb4b95973871a997f04 Mon Sep 17 00:00:00 2001 From: namos2502 Date: Mon, 30 Mar 2026 19:42:55 -0400 Subject: [PATCH 4/5] feat: add SessionStart hook and agent context injection - Add hooks/hooks.json (Claude Code) and hooks/hooks-cursor.json (Cursor) to register a SessionStart hook that fires on startup|clear|compact - Add hooks/run-hook.cmd cross-platform polyglot shim (Windows + Unix) - Add hooks/session-start: injects orchestration/SKILL.md as additionalContext into every host session from turn 1 via hookSpecificOutput (Claude Code) or additional_context (Cursor) - Add skills/orchestration/references/agent-context.md: compact CortexLink agent protocol (report format + self-verify) for delegated agents - Update claude-cli/SKILL.md: all invocation patterns now include --append-system-prompt with inlined agent context (system prompt layer) - Update copilot-cli/SKILL.md: delegation prompt now opens with CortexLink agent context preamble (no --append-system-prompt equivalent available) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- hooks/hooks-cursor.json | 10 ++++ hooks/hooks.json | 16 +++++++ hooks/run-hook.cmd | 46 +++++++++++++++++++ hooks/session-start | 43 +++++++++++++++++ skills/agents/claude-cli/SKILL.md | 21 +++++++-- skills/agents/copilot-cli/SKILL.md | 15 ++++-- .../orchestration/references/agent-context.md | 44 ++++++++++++++++++ 7 files changed, 187 insertions(+), 8 deletions(-) create mode 100644 hooks/hooks-cursor.json create mode 100644 hooks/hooks.json create mode 100755 hooks/run-hook.cmd create mode 100755 hooks/session-start create mode 100644 skills/orchestration/references/agent-context.md diff --git a/hooks/hooks-cursor.json b/hooks/hooks-cursor.json new file mode 100644 index 0000000..6df4461 --- /dev/null +++ b/hooks/hooks-cursor.json @@ -0,0 +1,10 @@ +{ + "version": 1, + "hooks": { + "sessionStart": [ + { + "command": "./hooks/session-start" + } + ] + } +} diff --git a/hooks/hooks.json b/hooks/hooks.json new file mode 100644 index 0000000..79d8cee --- /dev/null +++ b/hooks/hooks.json @@ -0,0 +1,16 @@ +{ + "hooks": { + "SessionStart": [ + { + "matcher": "startup|clear|compact", + "hooks": [ + { + "type": "command", + "command": "\"${CLAUDE_PLUGIN_ROOT}/hooks/run-hook.cmd\" session-start", + "async": false + } + ] + } + ] + } +} diff --git a/hooks/run-hook.cmd b/hooks/run-hook.cmd new file mode 100755 index 0000000..ceec3a7 --- /dev/null +++ b/hooks/run-hook.cmd @@ -0,0 +1,46 @@ +: << 'CMDBLOCK' +@echo off +REM Cross-platform polyglot wrapper for hook scripts. +REM On Windows: cmd.exe runs the batch portion, which finds and calls bash. +REM On Unix: the shell interprets this as a script (: is a no-op in bash). +REM +REM Hook scripts use extensionless filenames (e.g. "session-start" not +REM "session-start.sh") so Claude Code's Windows auto-detection -- which +REM prepends "bash" to any command containing .sh -- doesn't interfere. +REM +REM Usage: run-hook.cmd [args...] + +if "%~1"=="" ( + echo run-hook.cmd: missing script name >&2 + exit /b 1 +) + +set "HOOK_DIR=%~dp0" + +REM Try Git for Windows bash in standard locations +if exist "C:\Program Files\Git\bin\bash.exe" ( + "C:\Program Files\Git\bin\bash.exe" "%HOOK_DIR%%~1" %2 %3 %4 %5 %6 %7 %8 %9 + exit /b %ERRORLEVEL% +) +if exist "C:\Program Files (x86)\Git\bin\bash.exe" ( + "C:\Program Files (x86)\Git\bin\bash.exe" "%HOOK_DIR%%~1" %2 %3 %4 %5 %6 %7 %8 %9 + exit /b %ERRORLEVEL% +) + +REM Try bash on PATH (e.g. user-installed Git Bash, MSYS2, Cygwin) +where bash >nul 2>nul +if %ERRORLEVEL% equ 0 ( + bash "%HOOK_DIR%%~1" %2 %3 %4 %5 %6 %7 %8 %9 + exit /b %ERRORLEVEL% +) + +REM No bash found - exit silently rather than error +REM (plugin still works, just without SessionStart context injection) +exit /b 0 +CMDBLOCK + +# Unix: run the named script directly +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +SCRIPT_NAME="$1" +shift +exec bash "${SCRIPT_DIR}/${SCRIPT_NAME}" "$@" diff --git a/hooks/session-start b/hooks/session-start new file mode 100755 index 0000000..c689bc6 --- /dev/null +++ b/hooks/session-start @@ -0,0 +1,43 @@ +#!/usr/bin/env bash +# SessionStart hook for CortexLink plugin + +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +PLUGIN_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)" + +# Read orchestration skill — the CortexLink meta skill +orchestration_content=$(cat "${PLUGIN_ROOT}/skills/orchestration/SKILL.md" 2>&1 || echo "Error reading orchestration skill") + +# Escape string for JSON embedding. +# Each ${s//old/new} is a single C-level pass — fast and heredoc-safe. +escape_for_json() { + local s="$1" + s="${s//\\/\\\\}" + s="${s//\"/\\\"}" + s="${s//$'\n'/\\n}" + s="${s//$'\r'/\\r}" + s="${s//$'\t'/\\t}" + printf '%s' "$s" +} + +orchestration_escaped=$(escape_for_json "$orchestration_content") + +session_context="\nYou have CortexLink — a cross-agent workflow plugin.\n\nBelow is your orchestration skill. It defines when and how to delegate tasks across CLI agents (Copilot CLI, Claude CLI). Follow it whenever multi-agent delegation could apply.\n\n${orchestration_escaped}\n" + +# Platform detection: emit the field consumed by the current platform only. +# Cursor sets CURSOR_PLUGIN_ROOT (may also set CLAUDE_PLUGIN_ROOT). +# Claude Code sets CLAUDE_PLUGIN_ROOT only. +# Emitting both fields would cause double injection in Claude Code. +# +# Uses printf instead of heredoc to avoid a bash 5.3+ bug where heredoc +# variable expansion hangs when content exceeds ~512 bytes. +if [ -n "${CURSOR_PLUGIN_ROOT:-}" ]; then + printf '{\n "additional_context": "%s"\n}\n' "$session_context" +elif [ -n "${CLAUDE_PLUGIN_ROOT:-}" ]; then + printf '{\n "hookSpecificOutput": {\n "hookEventName": "SessionStart",\n "additionalContext": "%s"\n }\n}\n' "$session_context" +else + printf '{\n "additional_context": "%s"\n}\n' "$session_context" +fi + +exit 0 diff --git a/skills/agents/claude-cli/SKILL.md b/skills/agents/claude-cli/SKILL.md index b5b3926..ae9ac68 100644 --- a/skills/agents/claude-cli/SKILL.md +++ b/skills/agents/claude-cli/SKILL.md @@ -78,12 +78,19 @@ claude -p "..." --cwd $(git rev-parse --show-toplevel) --output-format text ... ## Invocation Patterns +Always include `--append-system-prompt` with the CortexLink agent context below. This teaches the agent the report format and self-verify protocol via the system prompt — separate from the task prompt. + +``` +CORTEXLINK_AGENT_CONTEXT="You are operating as a CortexLink agent. Your output is consumed directly by a control center. Execute the task, verify your own work (Execute → Verify → fix if needed → Report), then return ONLY this structured report — plain text labels, no bold, no headers:\nSTATUS: ✅ Verified / ⚠️ Partial / ❌ Failed\nSUMMARY: <1-2 sentences>\nSTEPS:\n - \nFILES: \nISSUES: \nMax 150 words. Never mark ✅ without actually checking. For analysis tasks, ✅ = completed the analysis even if you cannot run the code." +``` + **Read-only delegation (question, analysis):** ```bash claude -p "[delegation prompt]" --output-format text \ --cwd $(git rev-parse --show-toplevel) \ --allowedTools "Read" --model claude-haiku-4-5 \ - --no-session-persistence --max-turns 3 + --no-session-persistence --max-turns 3 \ + --append-system-prompt "$CORTEXLINK_AGENT_CONTEXT" ``` **Write delegation (fix, implement):** @@ -91,7 +98,8 @@ claude -p "[delegation prompt]" --output-format text \ claude -p "[delegation prompt]" --output-format text \ --cwd $(git rev-parse --show-toplevel) \ --allowedTools "Read" "Edit" "Write" \ - --no-session-persistence + --no-session-persistence \ + --append-system-prompt "$CORTEXLINK_AGENT_CONTEXT" ``` **Write delegation + shell (runs commands):** @@ -99,21 +107,24 @@ claude -p "[delegation prompt]" --output-format text \ claude -p "[delegation prompt]" --output-format text \ --cwd $(git rev-parse --show-toplevel) \ --allowedTools "Read" "Edit" "Write" "Bash(git *)" \ - --no-session-persistence + --no-session-persistence \ + --append-system-prompt "$CORTEXLINK_AGENT_CONTEXT" ``` **Planning / analysis only (no writes):** ```bash claude -p "[delegation prompt]" --output-format text \ --cwd $(git rev-parse --show-toplevel) \ - --permission-mode plan --no-session-persistence --max-turns 5 + --permission-mode plan --no-session-persistence --max-turns 5 \ + --append-system-prompt "$CORTEXLINK_AGENT_CONTEXT" ``` **Piped input:** ```bash cat file.ts | claude -p "[delegation prompt]" --output-format text \ --cwd $(git rev-parse --show-toplevel) \ - --allowedTools "Read" --no-session-persistence + --allowedTools "Read" --no-session-persistence \ + --append-system-prompt "$CORTEXLINK_AGENT_CONTEXT" ``` ## Delegation Prompt diff --git a/skills/agents/copilot-cli/SKILL.md b/skills/agents/copilot-cli/SKILL.md index 32fd6c5..153235e 100644 --- a/skills/agents/copilot-cli/SKILL.md +++ b/skills/agents/copilot-cli/SKILL.md @@ -104,10 +104,19 @@ Redirect stderr if needed: add `2>/dev/null` ## Delegation Prompt -Follow the template from `skills/orchestration/SKILL.md`. Include the structured report format instructions at the end of every prompt. +Copilot CLI has no `--append-system-prompt` flag, so CortexLink agent context must be prepended to every delegation prompt. **Always open every delegation prompt with this block:** -⛔ **Critical:** Always include this exact line in your delegation prompt: -*"Return ONLY the structured report. No reasoning steps, no 'Let me...' output before the report."* +``` +You are operating as a CortexLink agent. Your output is consumed directly by a control center — not displayed to a user. Execute the task, verify your own work (Execute → Verify → fix if needed → Report), then return ONLY the structured report below. No reasoning steps, no "Let me..." output before the report. + +--- + +[Task]: ... +``` + +The report format goes at the end (from the delegation template). The opening block teaches the agent the protocol — the closing block specifies this task's expected output. + +⛔ **Critical:** Never omit the opening CortexLink agent context block. Without it, Copilot CLI has no way to learn the report format or self-verify protocol. ## Handling the Report diff --git a/skills/orchestration/references/agent-context.md b/skills/orchestration/references/agent-context.md new file mode 100644 index 0000000..fa6845c --- /dev/null +++ b/skills/orchestration/references/agent-context.md @@ -0,0 +1,44 @@ +# CortexLink Agent Context + +You are operating as a **CortexLink agent**. Your output is consumed directly by a control center — not displayed to a user. Follow this protocol exactly. + +## Your Job + +Execute the task. Verify your own work. Return the structured report below. Nothing else. + +## Self-Verify Before Reporting + +Execute → Verify → (fix if needed) → Report. + +- Run the task +- Check your own work (tests, file contents, expected state) +- If verification fails → fix, then verify again +- Only then → write the report + +## Report Format + +Return ONLY this. Plain text labels — no **bold**, no # headers: + +``` +STATUS: ✅ Verified / ⚠️ Partial / ❌ Failed +SUMMARY: <1-2 sentences> +STEPS: + - + - +FILES: +ISSUES: +``` + +Max 150 words. + +## Status Semantics + +| Status | Meaning | +|--------|---------| +| ✅ Verified | You actively checked. It works. | +| ⚠️ Partial | Some parts verified, some could not be checked. Explain in ISSUES. | +| ❌ Failed | Describe what was attempted and what failed in ISSUES. | + +For analysis tasks: ✅ = you read the code and completed the analysis (even if you cannot *run* it). Do NOT use ⚠️ just because you cannot execute the code being reviewed. + +**Never mark ✅ without actually checking.** From bc5ec72f248b8ab022cd075f432434d27af39694 Mon Sep 17 00:00:00 2001 From: namos2502 Date: Mon, 30 Mar 2026 22:28:59 -0400 Subject: [PATCH 5/5] fix: enforce one-agent-per-subtask and peer direction constraints MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Delete hooks/hooks-cursor.json (Cursor IDE format — not a supported CortexLink platform; Copilot CLI uses hooks/hooks.json via CLAUDE_PLUGIN_ROOT) - Update hooks/session-start: inject PEER DIRECTION RULES block — Claude Code delegates to Copilot CLI (GitHub) or Claude CLI (last resort); Copilot CLI delegates to Claude CLI; ONE agent per subtask; bash -p only - Update orchestration/SKILL.md: - Iron Law: add ONE AGENT PER SUBTASK rule + peer direction by host identity - When to Delegate: add peer direction preamble and routing exclusivity - Dispatch: add one-agent-per-subtask rule + programmatic-mode requirement - Red Flags: add 3 new entries (same subtask to >1 agent, interactive terminal, Claude→Claude-CLI when native tools suffice) - Update claude-cli/SKILL.md: add ⛔ last-resort note when host is Claude Code Fixes: model spawning both Copilot CLI and Claude CLI for a single task Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- hooks/hooks-cursor.json | 10 ---------- hooks/session-start | 8 +++++--- skills/agents/claude-cli/SKILL.md | 4 ++++ skills/orchestration/SKILL.md | 14 +++++++++++++- 4 files changed, 22 insertions(+), 14 deletions(-) delete mode 100644 hooks/hooks-cursor.json diff --git a/hooks/hooks-cursor.json b/hooks/hooks-cursor.json deleted file mode 100644 index 6df4461..0000000 --- a/hooks/hooks-cursor.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "version": 1, - "hooks": { - "sessionStart": [ - { - "command": "./hooks/session-start" - } - ] - } -} diff --git a/hooks/session-start b/hooks/session-start index c689bc6..81bf513 100755 --- a/hooks/session-start +++ b/hooks/session-start @@ -23,11 +23,13 @@ escape_for_json() { orchestration_escaped=$(escape_for_json "$orchestration_content") -session_context="\nYou have CortexLink — a cross-agent workflow plugin.\n\nBelow is your orchestration skill. It defines when and how to delegate tasks across CLI agents (Copilot CLI, Claude CLI). Follow it whenever multi-agent delegation could apply.\n\n${orchestration_escaped}\n" +peer_direction="PEER DIRECTION RULES (apply these every time you delegate):\n- If you are Claude Code (Claude): GitHub tasks → Copilot CLI. Isolated code/analysis tasks → Claude CLI (last resort only — prefer native tools first).\n- If you are Copilot CLI: code tasks, analysis, and refactors → Claude CLI.\n- ONE agent per subtask. Never route the same subtask to more than one agent.\n- Always use bash with -p flag (programmatic mode). Never open an interactive terminal session.\n- Violating any of these rules violates the spirit of CortexLink." + +session_context="\nYou have CortexLink — a cross-agent workflow plugin.\n\nBelow is your orchestration skill. It defines when and how to delegate tasks across CLI agents (Copilot CLI, Claude CLI). Follow it whenever multi-agent delegation could apply.\n\n${orchestration_escaped}\n\n${peer_direction}\n" # Platform detection: emit the field consumed by the current platform only. -# Cursor sets CURSOR_PLUGIN_ROOT (may also set CLAUDE_PLUGIN_ROOT). -# Claude Code sets CLAUDE_PLUGIN_ROOT only. +# Claude Code and Copilot CLI both set CLAUDE_PLUGIN_ROOT (shared plugin architecture). +# Cursor IDE sets CURSOR_PLUGIN_ROOT (not a supported CortexLink platform — kept as fallback). # Emitting both fields would cause double injection in Claude Code. # # Uses printf instead of heredoc to avoid a bash 5.3+ bug where heredoc diff --git a/skills/agents/claude-cli/SKILL.md b/skills/agents/claude-cli/SKILL.md index ae9ac68..c86f2f4 100644 --- a/skills/agents/claude-cli/SKILL.md +++ b/skills/agents/claude-cli/SKILL.md @@ -8,6 +8,10 @@ user-invocable: false ## When to Use +⛔ If the host is **Claude Code**: use Claude CLI only when you specifically need context isolation or a different Anthropic model AND native tools (Task tool, inline work) are insufficient. Claude Code → Claude CLI is last resort. Prefer Copilot CLI for GitHub tasks; prefer Claude Code's native Task tool for general code tasks. + +--- + **Use Claude CLI for:** - General code tasks — explanations, refactors, fixes, analysis - Tasks needing Anthropic-specific models (Sonnet, Opus, Haiku) diff --git a/skills/orchestration/SKILL.md b/skills/orchestration/SKILL.md index de82c6d..3ef9b0f 100644 --- a/skills/orchestration/SKILL.md +++ b/skills/orchestration/SKILL.md @@ -19,6 +19,9 @@ CortexLink turns your active AI agent into a **control center** that fans out ta ``` NO CROSS-CLI DELEGATION WITHOUT A CLEAR REASON. NO PROCEEDING WITHOUT REVIEWING THE REPORT. +ONE AGENT PER SUBTASK — never delegate the same subtask to more than one agent. +Claude Code → Copilot CLI (GitHub tasks) or Claude CLI (last resort for isolated tasks). +Copilot CLI → Claude CLI. ``` ## The Two-Tier Model @@ -47,6 +50,12 @@ Classify every task before routing. This determines how much spec detail to writ ## When to Delegate Cross-CLI +Each subtask goes to exactly **ONE agent** — the decision tree picks which one, then stop. Never route the same subtask to both agents simultaneously. + +**Peer direction by host:** +- **Claude Code** → Copilot CLI for GitHub tasks; Claude CLI only as last resort (when context isolation or a specific Anthropic model is needed AND native tools are insufficient) +- **Copilot CLI** → Claude CLI for code tasks, analysis, and refactors + **Delegate when:** 1. **Platform-specific** — GitHub ops (PRs, repos, Actions) → Copilot; Anthropic reasoning or Claude-specific model → Claude CLI 2. **Context isolation** — offload a long subtask so its intermediate work never enters your context @@ -79,7 +88,7 @@ New task → 1. **Decompose** — Break into scoped, independently executable subtasks. Each must be verifiable by the agent itself. 2. **Route** — Apply decision tree. Check agent availability (see `references/report-format.md`). -3. **Dispatch** — Use delegation prompt template (see `references/delegation-template.md`). Always include scope, success criteria, report format. +3. **Dispatch** — Use delegation prompt template (see `references/delegation-template.md`). Always include scope, success criteria, report format. Each subtask goes to ONE agent — never dispatch the same work to two agents. Always use bash with `-p` (programmatic/print mode); never open an interactive terminal session. 4. **Review** — Read STATUS first. Spot-check if needed (`git diff`, tests). Decide: proceed, re-assign, or adjust. 5. **Track** — Update state (done / pending / failed). Never skip to the next subtask without reviewing the current report. 6. **Synthesize** — Consolidate into one output for the user. Lead with issues (🔴 blocker / 🟠 should fix / 🟡 minor), then a one-sentence verdict. If any subtask is ❌, hold the verdict until resolved. @@ -93,6 +102,9 @@ New task → - Retrying a ❌ task without reading ISSUES first - Delegating a task that needs current session context - Agents chaining to each other (all coordination goes through the control center) +- Delegating the same subtask to more than one agent (one subtask → one agent, always) +- Opening an interactive terminal session for delegation (always use `-p` programmatic mode) +- Claude Code delegating to Claude CLI when native tools (Task tool, inline work) would suffice ## Quick Reference