life-pulse 1.0.0 → 2.0.0

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.
Files changed (65) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +152 -0
  3. package/dist/agent.d.ts +8 -5
  4. package/dist/agent.js +409 -362
  5. package/dist/analyze.d.ts +27 -1
  6. package/dist/archetype.d.ts +14 -0
  7. package/dist/archetype.js +84 -0
  8. package/dist/auq.d.ts +6 -4
  9. package/dist/auq.js +19 -55
  10. package/dist/cli.js +633 -172
  11. package/dist/collectors/calendar.js +5 -1
  12. package/dist/conversation.d.ts +24 -0
  13. package/dist/conversation.js +147 -0
  14. package/dist/crm.d.ts +44 -0
  15. package/dist/crm.js +433 -0
  16. package/dist/db.d.ts +4 -2
  17. package/dist/db.js +48 -12
  18. package/dist/health.d.ts +40 -0
  19. package/dist/health.js +170 -0
  20. package/dist/icloud-discovery.d.ts +31 -0
  21. package/dist/icloud-discovery.js +407 -0
  22. package/dist/incremental.d.ts +60 -0
  23. package/dist/incremental.js +215 -0
  24. package/dist/init-check.d.ts +31 -0
  25. package/dist/init-check.js +167 -0
  26. package/dist/installer.d.ts +17 -0
  27. package/dist/installer.js +389 -0
  28. package/dist/intelligence.d.ts +23 -0
  29. package/dist/intelligence.js +46 -0
  30. package/dist/knowledge.d.ts +32 -0
  31. package/dist/knowledge.js +177 -0
  32. package/dist/mcp-registry.d.ts +29 -0
  33. package/dist/mcp-registry.js +136 -0
  34. package/dist/message-loop.d.ts +53 -0
  35. package/dist/message-loop.js +284 -0
  36. package/dist/permissions.d.ts +24 -0
  37. package/dist/permissions.js +224 -0
  38. package/dist/platforms.d.ts +29 -0
  39. package/dist/platforms.js +272 -0
  40. package/dist/profile.d.ts +1 -0
  41. package/dist/profile.js +9 -2
  42. package/dist/progress.d.ts +3 -2
  43. package/dist/progress.js +82 -65
  44. package/dist/router.d.ts +35 -0
  45. package/dist/router.js +250 -0
  46. package/dist/session-progress.d.ts +99 -0
  47. package/dist/session-progress.js +283 -0
  48. package/dist/skill-loader.d.ts +54 -0
  49. package/dist/skill-loader.js +220 -0
  50. package/dist/sms-gateway.d.ts +36 -0
  51. package/dist/sms-gateway.js +148 -0
  52. package/dist/state.d.ts +18 -0
  53. package/dist/state.js +73 -22
  54. package/dist/test-enrich.d.ts +2 -0
  55. package/dist/test-enrich.js +78 -0
  56. package/dist/tools.js +418 -19
  57. package/dist/transport.d.ts +69 -0
  58. package/dist/transport.js +154 -0
  59. package/dist/tui.d.ts +75 -0
  60. package/dist/tui.js +449 -0
  61. package/dist/tunnel.d.ts +30 -0
  62. package/dist/tunnel.js +131 -0
  63. package/dist/watchdog.d.ts +33 -0
  64. package/dist/watchdog.js +147 -0
  65. package/package.json +24 -6
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024-2026 Molly Cantillon
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,152 @@
1
+ # life-pulse
2
+
3
+ macOS life diagnostic — reads local data sources, generates actionable insights.
4
+
5
+ Built with [Anthropic's long-running agent patterns](https://www.anthropic.com/engineering/effective-harnesses-for-long-running-agents) for persistent context across sessions.
6
+
7
+ ## Quick Start
8
+
9
+ ```bash
10
+ # Install globally
11
+ npm install -g life-pulse
12
+
13
+ # Or run directly
14
+ npx life-pulse
15
+
16
+ # First run: set up permissions
17
+ life-pulse --setup
18
+ ```
19
+
20
+ ## Features
21
+
22
+ ### 🧠 Session Continuity (Anthropic Pattern)
23
+ Each session picks up where the last left off:
24
+ - Tracks what was surfaced (avoids re-showing items)
25
+ - Remembers user decisions (learns from your choices)
26
+ - Maintains pending follow-ups across sessions
27
+ - Builds decision pattern profile over time
28
+
29
+ Progress is stored in `~/.life-pulse/session-progress.json`.
30
+
31
+ ### 📱 iCloud Discovery
32
+ Scans your iCloud Drive to discover apps and recommend integrations:
33
+ - Obsidian vaults
34
+ - Bear notes
35
+ - Things 3 tasks
36
+ - Day One journal
37
+ - And more...
38
+
39
+ "Here's what I found about you" — personalized setup.
40
+
41
+ ### ⚡ Incremental Processing
42
+ Delta-based scanning — only processes what's changed:
43
+ - Tracks file modification times
44
+ - Remembers last scanned message ID
45
+ - Skips sources that haven't changed
46
+ - Faster subsequent runs
47
+
48
+ ### 🔐 Permission Flow
49
+ Guided setup for macOS permissions:
50
+ - Full Disk Access (required)
51
+ - Contacts (for name resolution)
52
+ - Automation (for calendar/reminders)
53
+ - Accessibility (optional)
54
+
55
+ Direct links to System Settings privacy panels.
56
+
57
+ ### 👁 Health Monitoring
58
+ Long-running daemon mode with health checks:
59
+
60
+ ```bash
61
+ # Start as daemon
62
+ life-pulse --daemon
63
+
64
+ # Check status
65
+ life-pulse --health
66
+
67
+ # Or via HTTP
68
+ curl http://127.0.0.1:19876/health
69
+ ```
70
+
71
+ ## Commands
72
+
73
+ ```bash
74
+ life-pulse # Run interactive session
75
+ life-pulse --setup # Run first-time setup flow
76
+ life-pulse --status # Show session progress info
77
+ life-pulse --daemon # Run as background daemon
78
+ life-pulse --health # Check daemon health (JSON)
79
+ life-pulse --raw # Output raw collected data
80
+ life-pulse --json # Output analysis as JSON
81
+ life-pulse --legacy # Use single-shot LLM mode
82
+ life-pulse --install # Install launchd plist for morning briefs
83
+ ```
84
+
85
+ ## Environment Variables
86
+
87
+ ```bash
88
+ # Required: Anthropic API key
89
+ export ANTHROPIC_API_KEY="sk-ant-..."
90
+
91
+ # Optional: OpenRouter for legacy mode
92
+ export OPENROUTER_API_KEY="..."
93
+ ```
94
+
95
+ Store in `~/.config/life-pulse/.env` for persistence.
96
+
97
+ ## Data Sources
98
+
99
+ life-pulse reads from local macOS databases (requires Full Disk Access):
100
+
101
+ - **Messages** — iMessage/SMS conversations
102
+ - **Email** — Apple Mail summaries
103
+ - **Calendar** — Upcoming events
104
+ - **Contacts** — Name resolution for phone numbers
105
+ - **Safari/Chrome** — Browsing history
106
+ - **Screen Time** — App usage patterns
107
+ - **Notes** — Apple Notes
108
+ - **Reminders** — Apple Reminders
109
+ - **Notifications** — Recent alerts
110
+ - **Find My** — Device locations
111
+ - **Recent Files** — Recently opened documents
112
+ - **Shell History** — Terminal commands
113
+
114
+ All data stays local. Nothing leaves your machine except API calls to Claude.
115
+
116
+ ## Architecture
117
+
118
+ ```
119
+ ~/.life-pulse/
120
+ ├── session-progress.json # Cross-session state (Anthropic pattern)
121
+ ├── daemon.pid # PID file for daemon mode
122
+ └── heartbeat # Last activity timestamp
123
+
124
+ ~/Library/Application Support/life-pulse/
125
+ ├── state.json # Analysis history
126
+ ├── config.json # User preferences
127
+ ├── platforms.json # Discovered apps/services
128
+ └── todos.json # Task tracking
129
+ ```
130
+
131
+ ## Design Principles
132
+
133
+ 1. **Session Continuity** — Like claude-progress.txt, each run knows what happened before
134
+ 2. **Incremental Processing** — Don't rescan what hasn't changed
135
+ 3. **Graceful Degradation** — Works with partial permissions
136
+ 4. **Local First** — All data stays on your machine
137
+ 5. **User Control** — Every surfaced item gets a decision
138
+
139
+ ## Development
140
+
141
+ ```bash
142
+ git clone https://github.com/your-org/life-pulse
143
+ cd life-pulse
144
+ npm install
145
+ npm run dev # Run with tsx (hot reload)
146
+ npm run build # Compile TypeScript
147
+ npm run start # Run compiled version
148
+ ```
149
+
150
+ ## License
151
+
152
+ MIT
package/dist/agent.d.ts CHANGED
@@ -1,11 +1,14 @@
1
1
  /**
2
- * Agentic analysis with Claude Opus orchestrator + sub-agent workers.
2
+ * Executive Operating System Claude Agent SDK.
3
3
  *
4
4
  * Architecture:
5
- * Opus orchestrator scans data generates hypotheses spawns workers
6
- * Workers (Haiku) validate specific predictions using tools report back
7
- * Opus synthesizes validated findings into final analysis
5
+ * - Orchestrator (Opus) via SDK query() with built-in tool execution
6
+ * - Custom tools via in-process MCP server (life-pulse tools + ask_user)
7
+ * - Remote MCP servers auto-discovered from platforms (Slack, Stripe, etc.)
8
+ * - Workers dispatched as SDK subagents via Task tool
9
+ * - Workers get full Claude Code capabilities (Read, Bash, WebSearch, etc.)
8
10
  */
9
11
  import type { Analysis } from './analyze.js';
10
12
  import type { ProgressSink } from './progress.js';
11
- export declare function runAgent(apiKey: string, progress?: ProgressSink, onCard?: (card: any) => Promise<string>): Promise<Analysis>;
13
+ export declare function runAgent(_apiKey: string, // SDK reads ANTHROPIC_API_KEY from env
14
+ progress?: ProgressSink, onCard?: (card: any) => Promise<string>): Promise<Analysis>;