@lightupai/polaris 0.0.16 → 0.0.18

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.
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env bash
2
+ # Polaris MCP server — runs as a child process of Claude Code
3
+ SCRIPT="$(realpath "$0" 2>/dev/null || readlink -f "$0" 2>/dev/null || echo "$0")"
4
+ DIR="$(cd "$(dirname "$SCRIPT")/.." && pwd)"
5
+
6
+ if command -v bun &>/dev/null; then
7
+ exec bun "$DIR/src/client/client.ts" "$@"
8
+ elif command -v bunx &>/dev/null; then
9
+ exec bunx bun "$DIR/src/client/client.ts" "$@"
10
+ else
11
+ exec npx --yes bun "$DIR/src/client/client.ts" "$@"
12
+ fi
@@ -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
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@lightupai/polaris",
3
- "version": "0.0.16",
3
+ "version": "0.0.18",
4
4
  "type": "module",
5
5
  "bin": {
6
- "polaris": "bin/polaris"
6
+ "polaris": "bin/polaris",
7
+ "polaris-mcp": "bin/polaris-mcp"
7
8
  },
8
9
  "scripts": {
9
10
  "test": "bun test"
package/src/cli/cli.ts CHANGED
@@ -110,12 +110,14 @@ async function install(participantId?: string) {
110
110
  await mkdir(CLAUDE_DIR, { recursive: true });
111
111
 
112
112
  // MCP server config
113
- const clientPath = join(import.meta.dir, "..", "client", "client.ts");
113
+ // Use npx to run polaris-mcp from the published package. This avoids
114
+ // dangling file paths when installed via npx (temp directory gets cleaned up).
115
+ // The polaris-mcp bin entry resolves to src/client/client.ts within the package.
114
116
  const mcpConfig = {
115
117
  mcpServers: {
116
118
  polaris: {
117
119
  command: "npx",
118
- args: ["bun", clientPath],
120
+ args: ["-y", "-p", "@lightupai/polaris", "polaris-mcp"],
119
121
  env: {
120
122
  POLARIS_DAEMON_URL: "http://127.0.0.1:4322",
121
123
  },