@hienlh/ppm 0.9.46 → 0.9.47

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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.9.47] - 2026-04-06
4
+
5
+ ### Fixed
6
+ - **AI writes to Claude memory files**: Added core directive preventing AI from managing its own memory/identity files. Memory is handled by PPMBot externally.
7
+ - **Garbage identity saved**: Removed `hasCheckedIdentity` fallback that saved random messages as identity. Identity only collected through `/start` onboarding flow.
8
+ - **Identity onboarding context**: AI now gets a hint that the message is an identity intro, so it acknowledges warmly instead of treating it as a task.
9
+
3
10
  ## [0.9.46] - 2026-04-06
4
11
 
5
12
  ### Added
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hienlh/ppm",
3
- "version": "0.9.46",
3
+ "version": "0.9.47",
4
4
  "description": "Personal Project Manager — mobile-first web IDE with AI assistance",
5
5
  "author": "hienlh",
6
6
  "license": "MIT",
@@ -41,9 +41,6 @@ class PPMBotService {
41
41
  /** Chat IDs that just received identity onboarding prompt */
42
42
  private identityPending = new Set<string>();
43
43
 
44
- /** Chat IDs where we've already checked for identity (once per session) */
45
- private hasCheckedIdentity = new Set<string>();
46
-
47
44
  /** Message count per session for periodic memory save */
48
45
  private messageCount = new Map<string, number>();
49
46
 
@@ -95,7 +92,6 @@ class PPMBotService {
95
92
  this.processing.clear();
96
93
  this.messageQueue.clear();
97
94
  this.identityPending.clear();
98
- this.hasCheckedIdentity.clear();
99
95
  this.messageCount.clear();
100
96
 
101
97
  console.log("[ppmbot] Stopped");
@@ -504,8 +500,9 @@ class PPMBotService {
504
500
  text,
505
501
  );
506
502
 
507
- // Build system prompt with memory
508
- let systemPrompt = config?.system_prompt ?? "";
503
+ // Build system prompt with memory + core directives
504
+ const coreDirective = "IMPORTANT: Do NOT write files, save to MEMORY.md, or manage your own memory/identity files. Your memory is managed externally by PPMBot. Just respond naturally.";
505
+ let systemPrompt = coreDirective + "\n\n" + (config?.system_prompt ?? "");
509
506
  const memorySection = this.memory.buildRecallPrompt(memories);
510
507
  if (memorySection) {
511
508
  systemPrompt += memorySection;
@@ -516,23 +513,19 @@ class PPMBotService {
516
513
  permissionMode: (config?.permission_mode ?? "bypassPermissions") as PermissionMode,
517
514
  };
518
515
 
519
- let fullMessage = text;
520
- if (systemPrompt) {
521
- fullMessage = `<system-context>\n${systemPrompt}\n</system-context>\n\n${text}`;
522
- }
523
-
524
516
  // Save identity BEFORE streaming — must persist even if streaming times out
517
+ let messageForAI = text;
525
518
  if (this.identityPending.has(chatId)) {
526
519
  this.identityPending.delete(chatId);
527
520
  this.memory.saveOne("_global", `User identity: ${text}`, "preference", session.sessionId);
528
521
  console.log("[ppmbot] Saved identity memory from onboarding");
529
- } else if (!this.hasCheckedIdentity.has(chatId)) {
530
- this.hasCheckedIdentity.add(chatId);
531
- const globalMems = this.memory.getSummary("_global", 50);
532
- if (!globalMems.some((m) => m.category === "preference" && /identity/i.test(m.content))) {
533
- this.memory.saveOne("_global", `User identity: ${text}`, "preference", session.sessionId);
534
- console.log("[ppmbot] Saved identity memory (first message, no identity found)");
535
- }
522
+ // Tell AI this is an identity intro so it acknowledges warmly
523
+ messageForAI = `[User just introduced themselves in response to onboarding prompt. Acknowledge warmly and briefly.]\n\n${text}`;
524
+ }
525
+
526
+ let fullMessage = messageForAI;
527
+ if (systemPrompt) {
528
+ fullMessage = `<system-context>\n${systemPrompt}\n</system-context>\n\n${messageForAI}`;
536
529
  }
537
530
 
538
531
  const events = chatService.sendMessage(