Skip to content

Commit 6b85d79

Browse files
authored
Merge pull request #7 from namos2502/dev
0.6.0 Beta
2 parents 619af8b + c95d170 commit 6b85d79

18 files changed

Lines changed: 658 additions & 196 deletions

File tree

.claude-plugin/plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "cortexlink",
33
"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.",
4-
"version": "0.5.5",
4+
"version": "0.5.7",
55
"author": {
66
"name": "namos2502"
77
},

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Enforce consistent line endings
2+
hooks/session-start text eol=lf
3+
hooks/run-hook.cmd text eol=crlf

CHANGELOG.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,25 @@
22

33
All notable changes to CortexLink will be documented here.
44

5+
## [0.5.7] — 2026-03-24
6+
7+
### Improved
8+
- **Commands:** Added `allowed-tools` frontmatter to `setup` (Read, Edit, Bash) and `cleanup` (Read, Edit) — restricts tool availability to the minimum required set (does not suppress permission prompts; use `--allow-tool` at session level for that)
9+
- **Commands:** Fixed `help` command directive style — replaced indirect "Reply to the user with..." with direct output instruction
10+
- **Skills:** All three skill descriptions rewritten to third-person trigger format ("This skill should be used when...") for reliable auto-activation
11+
- **Skills:** Added `user-invocable: false` to `orchestration`, `copilot-cli`, and `claude-cli` skills — these are internal protocol skills, not user-invocable actions
12+
- **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
13+
14+
## [0.5.6] — 2026-03-23
15+
16+
### Fixed
17+
- Removed `-s` flag from all Copilot CLI invocation patterns — causes exit code 1, not a valid flag for programmatic use
18+
- 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
19+
- `--allow-tool` values corrected to no-space format (`'write,read'`, `'write,shell(git:*),read'`)
20+
- Model updated to `--model=claude-sonnet-4-5` for real tasks (was "omit"); `--model=claude-haiku-4.5` kept for availability checks only
21+
- Claude CLI: added `--cwd $(git rev-parse --show-toplevel)` to all invocation patterns — same sandbox restriction applies
22+
- Orchestration detection command: removed `-s`, added `cd` to repo root
23+
524
## [0.5.5] — 2026-03-23
625

726
### Changed
@@ -43,7 +62,7 @@ All notable changes to CortexLink will be documented here.
4362
### Fixed
4463
- `/cortexlink:help` — removed stray `---` from command body that was being parsed as a second frontmatter block, causing Claude to show its default greeting instead of the help content
4564

46-
## [0.5.0-beta]
65+
## [0.5.0-beta] — 2026-03-21
4766

4867
### Changed — Breaking
4968
- **Architecture:** Complete redesign from passive flag-reference plugin to active control center orchestration system

README.md

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ No context bloat. No manual coordination. The workflow just happens.
3838

3939
**Reduce your token spend.** Every delegated subtask runs in a separate subprocess. Only the final result comes back into your context — no reasoning chains, no intermediate tool calls.
4040

41+
## Prerequisites
42+
43+
- **Claude Code** — CortexLink is a Claude Code plugin
44+
- **At least one supported CLI agent** installed and authenticated (see Get started below)
45+
4146
## Get started
4247

4348
Before installing, make sure you have at least one supported CLI agent set up.
@@ -62,15 +67,16 @@ Then install CortexLink from inside Claude Code:
6267
/reload-plugins
6368
```
6469

65-
> **Note:** If commands don't appear after `/reload-plugins`, restart Claude Code completely — a full restart is sometimes needed to pick up new commands.
70+
> [!WARNING]
71+
> If commands don't appear after `/reload-plugins`, fully quit Claude Code (Cmd+Q on macOS, close the window on Windows) and relaunch. `/reload-plugins` does not always pick up new commands without a full restart.
6672
6773
Then run setup once:
6874

6975
```
7076
/cortexlink:setup
7177
```
7278

73-
This detects which CLI agents are installed, verifies authentication, and registers CortexLink in your `~/.claude/CLAUDE.md` so it's active in every future session — no need to run anything again.
79+
This detects which CLI agents are installed, verifies authentication, and activates CortexLink — the `SessionStart` hook will inject orchestration context automatically on every future session.
7480

7581
## Updating
7682

@@ -90,14 +96,28 @@ To remove CortexLink completely:
9096
1. Run `/cortexlink:cleanup` — removes the CortexLink sections added to `~/.claude/CLAUDE.md` and `~/.copilot/copilot-instructions.md`
9197
2. Run `/plugin uninstall cortexlink@agent-plugins` — removes the plugin files
9298

93-
Requires Claude Code v1.0.33+.
99+
## Troubleshooting
100+
101+
**Commands don't appear after `/reload-plugins`**
102+
Fully quit Claude Code (Cmd+Q on macOS, close the window on Windows) and relaunch. `/reload-plugins` does not always pick up new commands without a full restart.
103+
104+
**The SessionStart hook doesn't seem to be injecting context**
105+
Run `/cortexlink:doctor` — it checks the hook script, verifies `jq` is installed, and test-runs the hook to confirm it produces valid output.
106+
107+
**Setup reports an agent as not found but it's installed**
108+
The agent binary may not be on Claude Code's PATH. Open a terminal and run `which copilot` or `which claude`. If it's found there but not in setup, your shell PATH may differ from Claude Code's environment — check your shell config (`~/.zshrc`, `~/.bashrc`).
109+
110+
**Auth check fails but I'm already logged in**
111+
Re-run the login command (`copilot login` or `claude auth login`). Plugin sandboxing can sometimes make cached tokens appear invalid — a fresh login usually fixes it.
112+
113+
**Delegation fails or the agent doesn't respond**
114+
Run `/cortexlink:doctor` to check agent auth and hook status. Verify the agent binary is on PATH (see above). Make sure the agent isn't already running interactively in another terminal.
94115

95-
## Commands
96116

97117
| Command | What it does |
98118
|---------|-------------|
99119
| `/cortexlink:setup` | One-time setup — detects agents, authenticates, registers CortexLink as always-on in `~/.claude/CLAUDE.md` |
100-
| `/cortexlink:auto` | Explicitly load all skills and activate orchestration mode for this session |
120+
| `/cortexlink:doctor` | Diagnose the SessionStart hook, plugin files, and agent auth — asks about symptoms before running checks |
101121
| `/cortexlink:cleanup` | Remove CortexLink configuration added by setup |
102122
| `/cortexlink:help` | Show plugin information and commands |
103123

@@ -118,7 +138,7 @@ skills/
118138
SKILL.md
119139
```
120140

121-
After `/cortexlink:setup`, the `~/.claude/CLAUDE.md` block makes CortexLink always-on — the orchestration protocol activates automatically every session. `/cortexlink:auto` is available as an explicit override if needed.
141+
After `/cortexlink:setup`, the `SessionStart` hook injects the orchestration protocol automatically on every new session — no extra command needed. Run `/cortexlink:doctor` if anything seems off.
122142

123143
## Routing
124144

commands/auto.md

Lines changed: 0 additions & 33 deletions
This file was deleted.

commands/cleanup.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
description: "Remove CortexLink configuration added by /cortexlink:setup"
3+
allowed-tools: Read, Edit
34
---
45

56
Remove the CortexLink sections that were added during setup. Run the following steps in order.

commands/doctor.md

Lines changed: 207 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,207 @@
1+
---
2+
description: "Diagnose CortexLink issues — asks about symptoms, runs targeted checks, and confirms before fixing anything"
3+
allowed-tools: Read, Bash
4+
---
5+
6+
**BEFORE ANYTHING ELSE — verify the environment:**
7+
8+
```bash
9+
echo "${CLAUDE_PLUGIN_ROOT:-NOT_SET}"
10+
```
11+
12+
If the output is `NOT_SET`:
13+
> **STOP. Do not proceed.**
14+
> Tell the user: ⚠️ `CLAUDE_PLUGIN_ROOT` is not set. Run this command inside Claude Code or Copilot CLI with the CortexLink plugin loaded.
15+
16+
---
17+
18+
**Ask the user:**
19+
20+
> What are you experiencing? Describe what's happening and I'll run the right checks.
21+
>
22+
> Examples:
23+
> - "The hook doesn't seem to fire / I don't see orchestration context injected"
24+
> - "Commands aren't showing up after install"
25+
> - "Agent delegation isn't working or auth is failing"
26+
> - "Setup seems incomplete or broken"
27+
> - "full checkup" — run everything
28+
29+
Wait for the user's response before continuing.
30+
31+
---
32+
33+
Map their symptom(s) to the checks below and run only those — unless they said "full checkup", in which case run all five.
34+
35+
| Symptom | Checks to run |
36+
|---------|--------------|
37+
| Hook not firing / no orchestration context | 1, 3 |
38+
| Commands missing / plugin not loading | 1, 2 |
39+
| Delegation failing / auth issues | 1, 4 |
40+
| Setup incomplete or broken | 1, 5 |
41+
| Full checkup | 1, 2, 3, 4, 5 |
42+
43+
**Rule for every check:** report the finding first. If a fix is possible, tell the user exactly what you found and what you're about to do — then ask for confirmation before doing it.
44+
45+
---
46+
47+
## Check 1 — Platform & Environment
48+
49+
```bash
50+
echo "CLAUDE_PLUGIN_ROOT=${CLAUDE_PLUGIN_ROOT}"
51+
echo "COPILOT_CLI=${COPILOT_CLI:-not set}"
52+
```
53+
54+
- `CLAUDE_PLUGIN_ROOT` set, `COPILOT_CLI` not set → **Claude Code**
55+
- Both set → **Copilot CLI**
56+
- Report the detected platform. Note it for the summary.
57+
58+
---
59+
60+
## Check 2 — Plugin File Integrity
61+
62+
```bash
63+
for f in \
64+
"$CLAUDE_PLUGIN_ROOT/hooks/hooks.json" \
65+
"$CLAUDE_PLUGIN_ROOT/hooks/run-hook.cmd" \
66+
"$CLAUDE_PLUGIN_ROOT/hooks/session-start" \
67+
"$CLAUDE_PLUGIN_ROOT/skills/orchestration/SKILL.md" \
68+
"$CLAUDE_PLUGIN_ROOT/skills/orchestration/references/agent-context.md" \
69+
"$CLAUDE_PLUGIN_ROOT/skills/orchestration/references/delegation-template.md" \
70+
"$CLAUDE_PLUGIN_ROOT/skills/orchestration/references/report-format.md" \
71+
"$CLAUDE_PLUGIN_ROOT/skills/agents/copilot-cli/SKILL.md" \
72+
"$CLAUDE_PLUGIN_ROOT/skills/agents/claude-cli/SKILL.md"; do
73+
[ -f "$f" ] && echo "OK: $f" || echo "MISSING: $f"
74+
done
75+
```
76+
77+
- ✅ All 9 files present
78+
- ❌ Any missing → tell the user which files are missing and suggest reinstalling: `/plugin install cortexlink@agent-plugins`
79+
80+
---
81+
82+
## Check 3 — Hook Health
83+
84+
**3a. Executable bit:**
85+
86+
```bash
87+
ls -la "$CLAUDE_PLUGIN_ROOT/hooks/session-start"
88+
```
89+
90+
If `session-start` is not executable (no `x` in the permission bits):
91+
- Tell the user: "session-start is not executable — this will prevent the hook from firing."
92+
- Ask: "Should I fix the permissions now? (`chmod +x`)"
93+
- If yes: run `chmod +x "$CLAUDE_PLUGIN_ROOT/hooks/session-start"` and confirm ✅ Fixed
94+
95+
**3b. jq dependency:**
96+
97+
```bash
98+
jq --version 2>/dev/null || echo "NOT_FOUND"
99+
```
100+
101+
- ✅ jq installed (show version)
102+
- ❌ Not found → tell the user: the hook script requires `jq` to build its JSON output. Install with:
103+
- macOS: `brew install jq`
104+
- Linux: `sudo apt install jq`
105+
- Windows: `winget install jqlang.jq`
106+
107+
**3c. Hook test run:**
108+
109+
Tell the user: "Running the session-start hook to verify it produces valid output…"
110+
111+
```bash
112+
"$CLAUDE_PLUGIN_ROOT/hooks/run-hook.cmd" session-start 2>&1
113+
```
114+
115+
- ✅ Output is valid JSON containing `hookSpecificOutput` (Claude Code) or `additionalContext` (Copilot CLI) — show the first 200 characters of the context value as a preview
116+
- ❌ Output is invalid JSON, empty, or contains an error — show the raw output and tell the user this means the SessionStart hook is not injecting orchestration context into sessions
117+
118+
---
119+
120+
## Check 4 — CLI Agents
121+
122+
**4a. Copilot CLI — installed?**
123+
124+
```bash
125+
which copilot && copilot --version 2>/dev/null || echo "NOT_FOUND"
126+
```
127+
128+
If found, ask the user: "Copilot CLI is installed. Do you want me to run an authentication check? (This makes a live network call.)"
129+
130+
If yes:
131+
132+
```bash
133+
cd "$(git rev-parse --show-toplevel 2>/dev/null || echo "$HOME")" && \
134+
copilot -p "ping" --no-ask-user --no-auto-update --no-color --allow-tool='read' --model=claude-haiku-4.5 2>/dev/null \
135+
&& echo "AUTH_OK" || echo "AUTH_FAIL"
136+
```
137+
138+
- ✅ Authenticated
139+
- ⚠️ Auth failed → run `copilot login`
140+
- ❌ Not installed → `brew install copilot-cli` (or see README)
141+
142+
**4b. Claude CLI — installed?**
143+
144+
```bash
145+
which claude && claude --version 2>/dev/null || echo "NOT_FOUND"
146+
```
147+
148+
If found, ask the user: "Claude CLI is installed. Do you want me to run an authentication check? (This makes a live network call.)"
149+
150+
If yes:
151+
152+
```bash
153+
claude -p "ping" --output-format text --allowedTools "Read" --max-turns 1 --no-session-persistence 2>/dev/null \
154+
&& echo "AUTH_OK" || echo "AUTH_FAIL"
155+
```
156+
157+
- ✅ Authenticated
158+
- ⚠️ Auth failed → run `claude auth login`
159+
- ❌ Not installed → `npm install -g @anthropic-ai/claude-code`
160+
161+
---
162+
163+
## Check 5 — Setup State
164+
165+
Read `~/.claude/CLAUDE.md`. Check for a `## CortexLink` section.
166+
167+
- ✅ Present
168+
- ⚠️ Absent — not required if the hook is active (Claude Code), but can be added by running `/cortexlink:setup`
169+
170+
Read `~/.copilot/copilot-instructions.md`. Check for a `## CortexLink` section.
171+
172+
- ✅ Present
173+
- ❌ Absent — Copilot CLI needs this to have CortexLink context. Run `/cortexlink:setup` to add it.
174+
175+
---
176+
177+
## Summary
178+
179+
After all targeted checks complete, print this block filled in with results:
180+
181+
```
182+
Platform: [Claude Code / Copilot CLI / Unknown]
183+
184+
Hook
185+
[✅/❌] session-start script present
186+
[✅/❌/✅ Fixed] session-start executable
187+
[✅/❌] jq installed
188+
[✅/❌] hook test run valid
189+
190+
Plugin files
191+
[✅ All 9 present / ❌ Missing: list them]
192+
193+
Agents
194+
[✅/⚠️/❌] Copilot CLI [version / not installed / auth not checked]
195+
[✅/⚠️/❌] Claude CLI [version / not installed / auth not checked]
196+
197+
Setup
198+
[✅/⚠️] ~/.claude/CLAUDE.md
199+
[✅/❌] ~/.copilot/copilot-instructions.md
200+
201+
Status: [✅ Healthy / ⚠️ Needs attention]
202+
```
203+
204+
If status is healthy:
205+
> ✅ CortexLink is healthy. The SessionStart hook will inject orchestration context automatically on every new session.
206+
207+
If there are unresolved issues, list each one with its fix command.

commands/help.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
description: "Show CortexLink plugin information and how to get started"
33
---
44

5-
Reply to the user with the following information:
5+
Output the following to the user:
66

77
**CortexLink** — One plugin. Every CLI. Stay in flow.
88

@@ -13,13 +13,12 @@ CortexLink turns your active AI agent into a control center that decomposes task
1313
| Step | Command |
1414
|------|---------|
1515
| 1. One-time setup — detect agents, authenticate, register CortexLink | `/cortexlink:setup` |
16-
| 2. Activate multi-agent mode for this session | `/cortexlink:auto` |
1716

1817
**Commands:**
1918

2019
| Command | What it does |
2120
|---------|-------------|
2221
| `/cortexlink:setup` | Detect CLI agents, verify auth, register CortexLink as always-on |
23-
| `/cortexlink:auto` | Load all skills and activate orchestration mode for this session |
22+
| `/cortexlink:doctor` | Diagnose the SessionStart hook, plugin files, and agent auth |
2423
| `/cortexlink:cleanup` | Remove CortexLink configuration added by setup |
2524
| `/cortexlink:help` | Show this information |

0 commit comments

Comments
 (0)