@lightupai/polaris 0.0.15 → 0.0.17
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/docs/design-claude-desktop.md +112 -0
- package/package.json +1 -1
- package/src/cli/cli.ts +30 -10
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# Design: Claude Desktop Support
|
|
2
|
+
|
|
3
|
+
## Current State
|
|
4
|
+
|
|
5
|
+
Polaris is built for Claude Code (CLI and desktop app), which provides:
|
|
6
|
+
- Hook system for automatic event capture
|
|
7
|
+
- Skills/slash commands for `/polaris join`
|
|
8
|
+
- Status line for connection indicator
|
|
9
|
+
- MCP server support for tools
|
|
10
|
+
|
|
11
|
+
Claude Desktop supports MCP servers but lacks hooks, skills, and status line.
|
|
12
|
+
|
|
13
|
+
## What Works Without Changes
|
|
14
|
+
|
|
15
|
+
- **MCP tools**: polaris_connect, polaris_disconnect, polaris_status, polaris_reply, polaris_context, polaris_rename
|
|
16
|
+
- **Advisor injection**: messages from Slack reach the agent via the MCP channel capability
|
|
17
|
+
- **Agent collaboration**: the agent can join projects, read sibling sessions, and send replies
|
|
18
|
+
|
|
19
|
+
## What's Missing
|
|
20
|
+
|
|
21
|
+
### 1. Automatic Event Capture (critical gap)
|
|
22
|
+
|
|
23
|
+
Claude Code captures every interaction via hooks:
|
|
24
|
+
- `UserPromptSubmit` → human typed a prompt
|
|
25
|
+
- `Stop` → agent responded
|
|
26
|
+
- `PreToolUse` / `PostToolUse` → agent used a tool
|
|
27
|
+
|
|
28
|
+
Claude Desktop has no hook system. Without it, the floor is blind to what's happening in a Claude Desktop session. Slack shows nothing. The dashboard shows no activity.
|
|
29
|
+
|
|
30
|
+
#### Options for event capture
|
|
31
|
+
|
|
32
|
+
**A. Agent self-reporting via MCP tool**
|
|
33
|
+
|
|
34
|
+
Add a `polaris_log` tool. Instruct the agent (via MCP server instructions) to call it after every response:
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
After each response, call polaris_log with a brief summary of what you did.
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Pros: Works today, no platform changes needed.
|
|
41
|
+
Cons: Lossy (agent may forget), adds latency, clutters the tool call log, relies on instruction following.
|
|
42
|
+
|
|
43
|
+
**B. MCP sampling / conversation observation**
|
|
44
|
+
|
|
45
|
+
The MCP spec has a `sampling` capability where the server can request to see conversation messages. If Claude Desktop supports this, the MCP server could observe the conversation passively.
|
|
46
|
+
|
|
47
|
+
Pros: Automatic, no agent cooperation needed.
|
|
48
|
+
Cons: May not be supported, privacy implications, spec is experimental.
|
|
49
|
+
|
|
50
|
+
**C. Claude Desktop adds hook support**
|
|
51
|
+
|
|
52
|
+
Anthropic adds a hook system to Claude Desktop, similar to Claude Code.
|
|
53
|
+
|
|
54
|
+
Pros: Full parity, same code works everywhere.
|
|
55
|
+
Cons: Depends on Anthropic's roadmap, not in our control.
|
|
56
|
+
|
|
57
|
+
**D. Accept the gap**
|
|
58
|
+
|
|
59
|
+
Claude Desktop users get tools (join, reply, context) but not automatic capture. Their sessions appear on the floor only when they explicitly send a reply or when advisors inject messages.
|
|
60
|
+
|
|
61
|
+
Pros: No work needed, honest about limitations.
|
|
62
|
+
Cons: Half the value prop is missing — teammates can't see what's happening.
|
|
63
|
+
|
|
64
|
+
#### Recommendation
|
|
65
|
+
|
|
66
|
+
Start with **D** (accept the gap) + **A** (agent self-reporting) as an opt-in enhancement. Document the limitation clearly. Push for **C** as a feature request to Anthropic.
|
|
67
|
+
|
|
68
|
+
### 2. MCP Config Path
|
|
69
|
+
|
|
70
|
+
| Platform | Claude Code | Claude Desktop |
|
|
71
|
+
|----------|-------------|----------------|
|
|
72
|
+
| macOS | `~/.claude/.mcp.json` | `~/Library/Application Support/Claude/claude_desktop_config.json` |
|
|
73
|
+
| Windows | `%USERPROFILE%\.claude\.mcp.json` | `%APPDATA%\Claude\claude_desktop_config.json` |
|
|
74
|
+
| Linux | `~/.claude/.mcp.json` | `~/.config/Claude/claude_desktop_config.json` |
|
|
75
|
+
|
|
76
|
+
The `polaris install` command needs to detect which apps are installed and write to both config files.
|
|
77
|
+
|
|
78
|
+
### 3. Skills / Slash Commands
|
|
79
|
+
|
|
80
|
+
Claude Desktop doesn't have skills. The user can't type `/polaris join`. Instead:
|
|
81
|
+
- The MCP server's `instructions` field tells the agent about available tools
|
|
82
|
+
- The user says "connect to polaris project X" and the agent calls `polaris_connect`
|
|
83
|
+
- Less discoverable but functional
|
|
84
|
+
|
|
85
|
+
### 4. Status Line
|
|
86
|
+
|
|
87
|
+
No equivalent in Claude Desktop. The user can ask "are we connected to polaris?" and the agent calls `polaris_status`. Not ideal but workable.
|
|
88
|
+
|
|
89
|
+
## Implementation Plan (when ready)
|
|
90
|
+
|
|
91
|
+
### Phase 1: Basic support
|
|
92
|
+
- `polaris install` writes MCP config to both Claude Code and Claude Desktop paths
|
|
93
|
+
- Document that event capture is limited
|
|
94
|
+
- MCP server instructions are detailed enough for the agent to self-serve
|
|
95
|
+
|
|
96
|
+
### Phase 2: Agent self-reporting
|
|
97
|
+
- Add `polaris_log` tool to MCP server
|
|
98
|
+
- MCP server instructions tell the agent to log after each response
|
|
99
|
+
- Events appear on the floor with `agent:claude-desktop` identity
|
|
100
|
+
- Accept that human prompts won't be captured (only agent responses)
|
|
101
|
+
|
|
102
|
+
### Phase 3: Full parity (depends on platform)
|
|
103
|
+
- If Claude Desktop adds hooks → same capture as Claude Code
|
|
104
|
+
- If MCP sampling lands → passive observation of conversation
|
|
105
|
+
- Either way, the architecture is ready — the daemon handles everything
|
|
106
|
+
|
|
107
|
+
## Open Questions
|
|
108
|
+
|
|
109
|
+
1. Does Claude Desktop respect MCP server `instructions` reliably enough for self-reporting?
|
|
110
|
+
2. Is `sampling` capability available or planned for Claude Desktop?
|
|
111
|
+
3. Should `polaris install` auto-detect installed apps or require `--desktop` flag?
|
|
112
|
+
4. How do we handle the case where both Claude Code and Claude Desktop are installed on the same machine? Same daemon, same MCP server, different config files — should work.
|
package/package.json
CHANGED
package/src/cli/cli.ts
CHANGED
|
@@ -178,7 +178,7 @@ async function install(participantId?: string) {
|
|
|
178
178
|
name: polaris
|
|
179
179
|
description: Connect to a Polaris multiplayer collaboration session
|
|
180
180
|
allowed-tools: polaris_connect polaris_disconnect polaris_status polaris_reply polaris_context polaris_rename
|
|
181
|
-
argument-hint: [join <project>
|
|
181
|
+
argument-hint: [join <project> | rename <new-name> | disconnect | (no args for status)]
|
|
182
182
|
---
|
|
183
183
|
|
|
184
184
|
## Polaris — Multiplayer Collaboration
|
|
@@ -189,9 +189,10 @@ Manage your connection to a Polaris collaboration session.
|
|
|
189
189
|
|
|
190
190
|
Based on the arguments provided, do ONE of the following:
|
|
191
191
|
|
|
192
|
-
**\`/polaris join <project
|
|
193
|
-
1. Call \`polaris_connect\` with the given project
|
|
194
|
-
2.
|
|
192
|
+
**\`/polaris join <project>\`** — Connect to a session:
|
|
193
|
+
1. Call \`polaris_connect\` with the given project and user identity ${identity}
|
|
194
|
+
2. A session name is auto-generated
|
|
195
|
+
3. Report the connection status including the session name
|
|
195
196
|
|
|
196
197
|
**\`/polaris rename <new-name>\`** — Rename the current project:
|
|
197
198
|
1. Call \`polaris_rename\` with the new name
|
|
@@ -309,7 +310,7 @@ async function login(appUrl: string, profileName?: string) {
|
|
|
309
310
|
name: polaris
|
|
310
311
|
description: Connect to a Polaris multiplayer collaboration session
|
|
311
312
|
allowed-tools: polaris_connect polaris_disconnect polaris_status polaris_reply polaris_context polaris_rename
|
|
312
|
-
argument-hint: [join <project>
|
|
313
|
+
argument-hint: [join <project> | rename <new-name> | disconnect | (no args for status)]
|
|
313
314
|
---
|
|
314
315
|
|
|
315
316
|
## Polaris — Multiplayer Collaboration
|
|
@@ -320,9 +321,10 @@ Manage your connection to a Polaris collaboration session.
|
|
|
320
321
|
|
|
321
322
|
Based on the arguments provided, do ONE of the following:
|
|
322
323
|
|
|
323
|
-
**\`/polaris join <project
|
|
324
|
-
1. Call \`polaris_connect\` with the given project
|
|
325
|
-
2.
|
|
324
|
+
**\`/polaris join <project>\`** — Connect to a session:
|
|
325
|
+
1. Call \`polaris_connect\` with the given project and user identity ${identity}
|
|
326
|
+
2. A session name is auto-generated
|
|
327
|
+
3. Report the connection status including the session name
|
|
326
328
|
|
|
327
329
|
**\`/polaris rename <new-name>\`** — Rename the current project:
|
|
328
330
|
1. Call \`polaris_rename\` with the new name
|
|
@@ -517,7 +519,16 @@ switch (command) {
|
|
|
517
519
|
console.log("Polaris — authenticating\n");
|
|
518
520
|
await login(appUrl, profileName);
|
|
519
521
|
console.log("\n✓ Login complete!");
|
|
520
|
-
|
|
522
|
+
// Auto-start daemon in background
|
|
523
|
+
const daemonPath = join(import.meta.dir, "..", "daemon", "daemon.ts");
|
|
524
|
+
Bun.spawn(["bun", "run", daemonPath], {
|
|
525
|
+
stdout: "ignore",
|
|
526
|
+
stderr: "ignore",
|
|
527
|
+
env: { ...process.env },
|
|
528
|
+
}).unref?.();
|
|
529
|
+
console.log(" ✓ Daemon started in background");
|
|
530
|
+
|
|
531
|
+
console.log("\nNext: restart Claude Code, then run `/polaris join <project>` in your AI agent.");
|
|
521
532
|
break;
|
|
522
533
|
}
|
|
523
534
|
|
|
@@ -554,7 +565,16 @@ switch (command) {
|
|
|
554
565
|
console.log("[2/2] Authenticating...\n");
|
|
555
566
|
await login(DEFAULT_APP_URL);
|
|
556
567
|
console.log("\n✓ Polaris is set up on this machine!");
|
|
557
|
-
|
|
568
|
+
// Auto-start daemon in background
|
|
569
|
+
const daemonPath = join(import.meta.dir, "..", "daemon", "daemon.ts");
|
|
570
|
+
Bun.spawn(["bun", "run", daemonPath], {
|
|
571
|
+
stdout: "ignore",
|
|
572
|
+
stderr: "ignore",
|
|
573
|
+
env: { ...process.env },
|
|
574
|
+
}).unref?.();
|
|
575
|
+
console.log(" ✓ Daemon started in background");
|
|
576
|
+
|
|
577
|
+
console.log("\nNext: restart Claude Code, then run `/polaris join <project>` in your AI agent.");
|
|
558
578
|
break;
|
|
559
579
|
|
|
560
580
|
default:
|