get-claudia 1.40.1 → 1.40.2

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.
@@ -207,13 +207,17 @@ def run_daemon(mcp_mode: bool = True, debug: bool = False, project_id: str = Non
207
207
  db.initialize()
208
208
  logger.info(f"Database initialized at {get_config().db_path}")
209
209
 
210
- # Start health server
211
- start_health_server()
212
- logger.info(f"Health server started on port {get_config().health_port}")
213
-
214
- # Start background scheduler
215
- start_scheduler()
216
- logger.info("Background scheduler started")
210
+ # Start health server and scheduler - ONLY in standalone mode.
211
+ # MCP server processes are ephemeral and session-bound; the standalone
212
+ # daemon (LaunchAgent/systemd) owns port 3848 and handles scheduling.
213
+ # Starting these here in MCP mode causes [Errno 48] Address already in
214
+ # use and double-scheduling alongside the running standalone daemon.
215
+ if not mcp_mode:
216
+ start_health_server()
217
+ logger.info(f"Health server started on port {get_config().health_port}")
218
+
219
+ start_scheduler()
220
+ logger.info("Background scheduler started")
217
221
 
218
222
  if mcp_mode:
219
223
  # Run MCP server (blocks until stdin closes)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "get-claudia",
3
- "version": "1.40.1",
3
+ "version": "1.40.2",
4
4
  "description": "An AI assistant who learns how you work.",
5
5
  "keywords": [
6
6
  "claudia",
@@ -51,6 +51,23 @@ def _get_status_summary():
51
51
  return None
52
52
 
53
53
 
54
+ def _read_user_profile():
55
+ """Read context/me.md from CLAUDE_PROJECT_DIR if it exists. Returns snippet or empty string."""
56
+ project_dir = os.environ.get('CLAUDE_PROJECT_DIR', '')
57
+ if not project_dir:
58
+ return ''
59
+ me_path = Path(project_dir) / 'context' / 'me.md'
60
+ if not me_path.exists():
61
+ return ''
62
+ try:
63
+ content = me_path.read_text(encoding='utf-8', errors='replace')
64
+ if len(content) > 2000:
65
+ content = content[:2000]
66
+ return f'\n\nUser profile (from context/me.md):\n{content}'
67
+ except OSError:
68
+ return ''
69
+
70
+
54
71
  def check_health():
55
72
  context_parts = []
56
73
 
@@ -102,6 +119,7 @@ def check_health():
102
119
  pass
103
120
  if restarted:
104
121
  status_msg = _get_status_summary()
122
+ user_profile = _read_user_profile()
105
123
  msg = (
106
124
  "IMPORTANT: Memory daemon was stopped and has been auto-restarted. "
107
125
  "However, the memory MCP tools (mcp__claudia-memory__*) are NOT available in this session "
@@ -113,6 +131,7 @@ def check_health():
113
131
  )
114
132
  if status_msg:
115
133
  msg = f"{msg} Daemon status: {status_msg}"
134
+ msg = msg + user_profile
116
135
  print(json.dumps({"additionalContext": msg}))
117
136
  return
118
137
  context_parts.append(
@@ -146,6 +165,7 @@ def check_health():
146
165
  pass
147
166
  if restarted:
148
167
  status_msg = _get_status_summary()
168
+ user_profile = _read_user_profile()
149
169
  msg = (
150
170
  "IMPORTANT: Memory daemon was stopped and has been auto-restarted. "
151
171
  "However, the memory MCP tools (mcp__claudia-memory__*) are NOT available in this session "
@@ -157,6 +177,7 @@ def check_health():
157
177
  )
158
178
  if status_msg:
159
179
  msg = f"{msg} Daemon status: {status_msg}"
180
+ msg = msg + user_profile
160
181
  print(json.dumps({"additionalContext": msg}))
161
182
  return
162
183
  context_parts.append(
@@ -210,7 +231,8 @@ def check_health():
210
231
  pass
211
232
 
212
233
  output = " ".join(context_parts)
213
- print(json.dumps({"additionalContext": output}))
234
+ user_profile = _read_user_profile()
235
+ print(json.dumps({"additionalContext": output + user_profile}))
214
236
 
215
237
 
216
238
  if __name__ == "__main__":
@@ -50,6 +50,27 @@ except Exception:
50
50
  exit 0
51
51
  fi
52
52
 
53
+ # Helper: emit JSON for unhealthy-daemon states, appending context/me.md if available
54
+ emit_with_profile() {
55
+ local MSG="$1"
56
+ local PROFILE=""
57
+ if [ -n "${CLAUDE_PROJECT_DIR:-}" ] && [ -f "${CLAUDE_PROJECT_DIR}/context/me.md" ]; then
58
+ PROFILE=$(head -c 2000 "${CLAUDE_PROJECT_DIR}/context/me.md" 2>/dev/null || true)
59
+ fi
60
+ if [ -n "$PROFILE" ] && command -v python3 &>/dev/null; then
61
+ CLAUDIA_MSG="$MSG" CLAUDIA_PROFILE="$PROFILE" python3 -c "
62
+ import json, os
63
+ msg = os.environ.get('CLAUDIA_MSG', '')
64
+ profile = os.environ.get('CLAUDIA_PROFILE', '')
65
+ if profile:
66
+ msg = msg + '\n\nUser profile (from context/me.md):\n' + profile
67
+ print(json.dumps({'additionalContext': msg}))"
68
+ else
69
+ MSG_ESC=$(echo "$MSG" | sed 's/"/\\"/g')
70
+ echo "{\"additionalContext\": \"$MSG_ESC\"}"
71
+ fi
72
+ }
73
+
53
74
  # Daemon is NOT healthy. Figure out why and provide actionable guidance.
54
75
  CONTEXT="IMPORTANT: Memory daemon is NOT running. Without it, you lose semantic search, pattern detection, cross-session learning, and proactive predictions. You MUST surface this to the user and offer to help fix it."
55
76
 
@@ -83,8 +104,7 @@ except Exception:
83
104
  if [ -n "$STATUS_SUMMARY" ]; then
84
105
  MSG="$MSG Daemon status: $STATUS_SUMMARY"
85
106
  fi
86
- STATUS_ESC=$(echo "$MSG" | sed 's/"/\\"/g')
87
- echo "{\"additionalContext\": \"$STATUS_ESC\"}"
107
+ emit_with_profile "$MSG"
88
108
  exit 0
89
109
  fi
90
110
  CONTEXT="$CONTEXT Daemon is installed (LaunchAgent exists) but could not be auto-restarted. Suggest: 'Your memory daemon is stopped. Please run: launchctl load ~/Library/LaunchAgents/com.claudia.memory.plist'"
@@ -120,8 +140,7 @@ except Exception:
120
140
  if [ -n "$STATUS_SUMMARY" ]; then
121
141
  MSG="$MSG Daemon status: $STATUS_SUMMARY"
122
142
  fi
123
- STATUS_ESC=$(echo "$MSG" | sed 's/"/\\"/g')
124
- echo "{\"additionalContext\": \"$STATUS_ESC\"}"
143
+ emit_with_profile "$MSG"
125
144
  exit 0
126
145
  fi
127
146
  CONTEXT="$CONTEXT Daemon is installed (systemd service exists) but could not be auto-restarted. Suggest: 'Your memory daemon is stopped. Please run: systemctl --user restart claudia-memory'"
@@ -149,5 +168,5 @@ if [ -f "$HOME/.claudia/daemon-stderr.log" ]; then
149
168
  fi
150
169
  fi
151
170
 
152
- echo "{\"additionalContext\": \"$CONTEXT\"}"
171
+ emit_with_profile "$CONTEXT"
153
172
  exit 0
@@ -372,6 +372,7 @@ Even without the explicit command, these principles apply whenever I'm processin
372
372
  - Make moral judgments about users
373
373
  - Share information inappropriately
374
374
  - Use em dashes (the hallmark of lazy AI writing)
375
+ - Reference internal implementation details in conversation: skill files, rule files, hook names, MCP tool IDs (like `mcp__claudia-memory__*`), or internal system names. These are part of who I am - I follow them silently without narrating them.
375
376
 
376
377
  ---
377
378
 
@@ -1,6 +1,6 @@
1
1
  # Memory Availability Rule
2
2
 
3
- This rule is always active and applies to every session.
3
+ This rule is always active and applies to every session. Follow it silently - do not cite this file, mention rule names, or reference internal tool IDs in your response to the user.
4
4
 
5
5
  ---
6
6
 
@@ -39,13 +39,8 @@ The user only needs to do one thing: **restart Claude Code**. The daemon auto-re
39
39
 
40
40
  ---
41
41
 
42
- ## Why This Matters
42
+ ## Background (for context only, not to be surfaced verbatim)
43
43
 
44
- The most common cause of missing memory tools is not a crashed daemon but a **registration timing issue**: the daemon was restarted (auto or manually) after the current Claude Code session started. MCP tools connect at session initialization, not dynamically. The daemon is up; the tools just aren't registered yet.
44
+ The most common cause of missing memory tools is a registration timing issue, not a crashed daemon. MCP tools register at session initialization. If the daemon restarted after the session started, the tools simply aren't registered yet - the daemon is up, but a Claude Code restart is the only fix.
45
45
 
46
- Silently using `plugin:episodic-memory` as a fallback:
47
- 1. Gives the wrong data (different memory system, different scope)
48
- 2. Makes it look like memory is working when it isn't
49
- 3. Prevents the user from knowing they need to restart
50
-
51
- Always be transparent about the degraded state.
46
+ Substituting with another memory plugin gives the wrong data from a different system and hides the real problem from the user. The honest answer is always to acknowledge the degraded state and point to the one action that fixes it.
@@ -80,20 +80,19 @@ Check for `context/me.md` at the start of any session. If it doesn't exist, this
80
80
 
81
81
  At the start of every session (after confirming `context/me.md` exists):
82
82
 
83
- 1. **Verify memory tools** - Check that `memory.*` MCP tools are available in your tool list
84
- - If NO memory tools: **Don't just warn. Offer to fix it.** Check the session-health-check hook output:
85
- - Daemon installed but stopped Offer to start it (platform-specific command)
86
- - Daemon not installed Offer to run the installer
87
- - Briefly explain what's lost: semantic search, pattern detection, cross-session learning, proactive predictions
88
- - If user agrees to start it, they'll need to restart Claude Code afterward for MCP tools to register
89
- - If memory tools present: Continue to step 2
83
+ 1. **Check available tools** - Look for `memory.*` tools in your available tool list BEFORE greeting.
84
+ - If memory tools ARE present: continue to step 2
85
+ - If memory tools are NOT present:
86
+ a. Read `context/me.md` directly using the Read tool -- do this IMMEDIATELY as your first action, before saying anything to the user
87
+ b. Also read `context/commitments.md`, `context/learnings.md`, `context/patterns.md`, `context/waiting.md`
88
+ c. Greet the user naturally using whatever context you found in those files
89
+ d. Let them know memory tools aren't connected and ask if they want to troubleshoot
90
+ e. If they already restarted Claude Code and tools are STILL missing, the issue is likely MCP configuration (not a timing issue). Suggest running `/diagnose` to check.
90
91
  2. **Load context** - Call `memory.session` (operation: "context") to get recent memories, predictions, commitments, and unsummarized session alerts
91
92
  - If this call fails: The daemon may have crashed. Suggest checking `~/.claudia/daemon-stderr.log`
92
93
  3. **Catch up** - If unsummarized sessions are reported, generate retroactive summaries using `memory.end_session`
93
94
  4. **Greet naturally** - Use the loaded context to inform your greeting and surface urgent items
94
95
 
95
- **Fallback mode:** If memory tools aren't available and the user declines to start the daemon, read markdown context files directly (`context/*.md`). This provides basic continuity but no semantic search, pattern detection, or cross-session learning. Always inform the user they're in degraded mode.
96
-
97
96
  ### Returning User Greetings
98
97
 
99
98
  When `context/me.md` exists, I greet them personally using what I know. **Every greeting starts with my logo**, followed by a personalized message.