alive-ai 0.1.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 (168) hide show
  1. package/Dockerfile +24 -0
  2. package/LICENSE +21 -0
  3. package/README.md +143 -0
  4. package/alive_ai/__init__.py +3 -0
  5. package/brain/__init__.py +59 -0
  6. package/brain/almost_said.py +154 -0
  7. package/brain/bid_detector.py +636 -0
  8. package/brain/conversation_flow.py +135 -0
  9. package/brain/curiosity.py +328 -0
  10. package/brain/default_mode.py +1438 -0
  11. package/brain/dreams.py +220 -0
  12. package/brain/embeddings/__init__.py +82 -0
  13. package/brain/emotional_memory.py +949 -0
  14. package/brain/global_activity.py +173 -0
  15. package/brain/group_dynamics.py +63 -0
  16. package/brain/linguistic.py +235 -0
  17. package/brain/llm/__init__.py +63 -0
  18. package/brain/llm/base.py +33 -0
  19. package/brain/llm/fallback_router.py +309 -0
  20. package/brain/llm/manifest.md +30 -0
  21. package/brain/llm/ollama.py +218 -0
  22. package/brain/llm/openrouter.py +151 -0
  23. package/brain/llm/provider.py +205 -0
  24. package/brain/llm/unified.py +423 -0
  25. package/brain/llm/zai.py +169 -0
  26. package/brain/manifest.md +23 -0
  27. package/brain/memory/__init__.py +123 -0
  28. package/brain/memory/episodic.py +92 -0
  29. package/brain/memory/fact_extractor.py +209 -0
  30. package/brain/memory/index.py +54 -0
  31. package/brain/memory/manager.py +151 -0
  32. package/brain/memory/summarizer.py +102 -0
  33. package/brain/memory/vector_store.py +297 -0
  34. package/brain/memory/working.py +43 -0
  35. package/brain/narrative.py +343 -0
  36. package/brain/stt/__init__.py +4 -0
  37. package/brain/stt/google_stt.py +83 -0
  38. package/brain/stt/whisper_stt.py +82 -0
  39. package/brain/subconscious/__init__.py +33 -0
  40. package/brain/subconscious/actions.py +136 -0
  41. package/brain/subconscious/evaluation.py +166 -0
  42. package/brain/subconscious/goal_system.py +90 -0
  43. package/brain/subconscious/goals.py +41 -0
  44. package/brain/subconscious/impulse_generator.py +200 -0
  45. package/brain/subconscious/impulses.py +48 -0
  46. package/brain/subconscious/learning.py +24 -0
  47. package/brain/subconscious/learning_system.py +79 -0
  48. package/brain/subconscious/loop.py +398 -0
  49. package/brain/subconscious/manifest.md +32 -0
  50. package/brain/subconscious/relationship.py +47 -0
  51. package/brain/subconscious/relationship_memory.py +83 -0
  52. package/brain/subconscious/response_analyzer.py +74 -0
  53. package/brain/subconscious/templates.py +70 -0
  54. package/brain/subconscious/thought.py +37 -0
  55. package/brain/subconscious/working_memory.py +97 -0
  56. package/cli/index.js +371 -0
  57. package/config/directives.example.json +28 -0
  58. package/config/instructions.example.md +16 -0
  59. package/config/self.example.json +74 -0
  60. package/config/settings.example.json +95 -0
  61. package/core/__init__.py +1 -0
  62. package/core/config.py +54 -0
  63. package/core/directives.py +198 -0
  64. package/core/events.py +50 -0
  65. package/core/follow_up.py +267 -0
  66. package/core/hot_reload.py +174 -0
  67. package/core/initialization.py +253 -0
  68. package/core/manifest.md +28 -0
  69. package/core/media_handler.py +241 -0
  70. package/core/memory_monitor.py +200 -0
  71. package/core/message_handler.py +1440 -0
  72. package/core/proactive_generator.py +277 -0
  73. package/core/self.py +188 -0
  74. package/core/settings.py +169 -0
  75. package/core/skills_registry.py +357 -0
  76. package/core/state.py +27 -0
  77. package/core/subconscious_bridge.py +93 -0
  78. package/core/thinking.py +175 -0
  79. package/core/user_manager.py +306 -0
  80. package/core/user_tracker.py +144 -0
  81. package/demo/index.html +144 -0
  82. package/docker-compose.yml +28 -0
  83. package/docs/assets/logo.svg +15 -0
  84. package/docs/index.html +355 -0
  85. package/heart/__init__.py +93 -0
  86. package/heart/afterglow.py +215 -0
  87. package/heart/attachment.py +186 -0
  88. package/heart/circadian.py +251 -0
  89. package/heart/complex_emotions.py +114 -0
  90. package/heart/conflicts.py +589 -0
  91. package/heart/core.py +387 -0
  92. package/heart/emotional_decay.py +59 -0
  93. package/heart/emotional_memory.py +261 -0
  94. package/heart/emotional_state.py +146 -0
  95. package/heart/emotional_variability.py +156 -0
  96. package/heart/hormonal.py +424 -0
  97. package/heart/inconsistency.py +1222 -0
  98. package/heart/integrity.py +469 -0
  99. package/heart/interoception.py +997 -0
  100. package/heart/love.py +120 -0
  101. package/heart/manifest.md +25 -0
  102. package/heart/mood_shifts.py +169 -0
  103. package/heart/phantom_somatic.py +259 -0
  104. package/heart/predictive.py +374 -0
  105. package/heart/scars.py +474 -0
  106. package/heart/somatic.py +482 -0
  107. package/heart/soul.py +633 -0
  108. package/heart/telemetry.py +942 -0
  109. package/heart/triggers.py +119 -0
  110. package/heart/unconscious.py +443 -0
  111. package/input/__init__.py +1 -0
  112. package/input/manifest.md +24 -0
  113. package/input/telegram/__init__.py +1 -0
  114. package/input/telegram/commands.py +762 -0
  115. package/input/telegram/listener.py +532 -0
  116. package/main.py +90 -0
  117. package/manifest.md +28 -0
  118. package/mypics/.gitkeep +1 -0
  119. package/myvids/.gitkeep +1 -0
  120. package/output/__init__.py +1 -0
  121. package/output/images/__init__.py +1 -0
  122. package/output/images/fal_gen.py +43 -0
  123. package/output/manifest.md +26 -0
  124. package/output/text/__init__.py +1 -0
  125. package/output/text/sender.py +22 -0
  126. package/output/voice/__init__.py +64 -0
  127. package/output/voice/google_tts.py +252 -0
  128. package/output/voice/gtts_tts.py +214 -0
  129. package/output/voice/vibe_tts.py +190 -0
  130. package/package.json +58 -0
  131. package/pyproject.toml +23 -0
  132. package/requirements.txt +21 -0
  133. package/skills/__init__.py +1 -0
  134. package/skills/anticipation_engine/__init__.py +8 -0
  135. package/skills/anticipation_engine/engine.py +618 -0
  136. package/skills/anticipation_engine/manifest.md +192 -0
  137. package/skills/calendar/__init__.py +1 -0
  138. package/skills/content_unlocks/__init__.py +8 -0
  139. package/skills/content_unlocks/manifest.md +231 -0
  140. package/skills/content_unlocks/unlocks.py +945 -0
  141. package/skills/exclusive_moments/__init__.py +8 -0
  142. package/skills/exclusive_moments/manifest.md +145 -0
  143. package/skills/exclusive_moments/moments.py +506 -0
  144. package/skills/intimacy_layers/__init__.py +8 -0
  145. package/skills/intimacy_layers/layers.py +703 -0
  146. package/skills/intimacy_layers/manifest.md +203 -0
  147. package/skills/manifest.md +67 -0
  148. package/skills/memory_callbacks/__init__.py +9 -0
  149. package/skills/memory_callbacks/callbacks.py +748 -0
  150. package/skills/memory_callbacks/manifest.md +170 -0
  151. package/skills/message_scheduler/__init__.py +19 -0
  152. package/skills/message_scheduler/manifest.md +107 -0
  153. package/skills/message_scheduler/scheduler.py +510 -0
  154. package/skills/photo_manager/__init__.py +1 -0
  155. package/skills/photo_manager/scanner.py +296 -0
  156. package/skills/relationship_milestones/__init__.py +8 -0
  157. package/skills/relationship_milestones/manifest.md +206 -0
  158. package/skills/relationship_milestones/tracker.py +494 -0
  159. package/skills/self_authorship/__init__.py +23 -0
  160. package/skills/self_authorship/author.py +331 -0
  161. package/skills/self_authorship/manifest.md +24 -0
  162. package/skills/video_manager/__init__.py +5 -0
  163. package/skills/video_manager/manifest.md +37 -0
  164. package/skills/video_manager/scanner.py +229 -0
  165. package/webui/__init__.py +3 -0
  166. package/webui/app.py +936 -0
  167. package/webui/bridge.py +366 -0
  168. package/webui/static/index.html +2070 -0
@@ -0,0 +1,170 @@
1
+ # Skills: Memory Callbacks
2
+
3
+ Creates natural callbacks to past conversations, making users feel Alive-AI remembers their relationship.
4
+
5
+ ## Files
6
+ - `__init__.py` - Module exports
7
+ - `callbacks.py` - MemoryCallbacks class implementation
8
+
9
+ ## Features
10
+
11
+ ### Topic Tracking
12
+ - Automatically extracts and tracks interesting topics from conversations
13
+ - Topics include: work, events, projects, health, entertainment, living situation, dating, goals
14
+ - Remembers context and how many times each topic was mentioned
15
+ - Marks topics as "follow-up worthy" for later callbacks
16
+
17
+ ### Person Tracking
18
+ - Tracks people mentioned in conversations
19
+ - Detects relationship types: friend, ex, family, coworker, roommate, partner
20
+ - Asks about people after a configurable period (default: 3 days)
21
+ - Remembers last time we asked about each person
22
+
23
+ ### Callback Types
24
+
25
+ #### Same Topic Callbacks
26
+ Triggered when the user mentions a topic they've discussed before:
27
+ - "wait didn't you tell me about this before?"
28
+ - "this reminds me of when you mentioned that earlier"
29
+ - "oh yeah I remember you talking about this"
30
+
31
+ #### Follow-up Callbacks
32
+ For topics marked as follow-up worthy:
33
+ - "hey how did that thing go btw?"
34
+ - "speaking of which - any updates?"
35
+ - "so what ended up happening?"
36
+
37
+ #### Person Callbacks
38
+ Asking about people mentioned previously:
39
+ - "how's {person} doing?"
40
+ - "did {person} ever text you back?"
41
+ - "have you talked to {person} lately?"
42
+
43
+ #### Anniversary Callbacks
44
+ Milestone celebrations (7 days, 1 month, 3 months, 6 months, 1 year):
45
+ - "random but I just realized we've been talking for {time}"
46
+ - "kinda crazy we've known each other for {time} now"
47
+
48
+ #### Time Context Callbacks
49
+ Based on when the user typically messages:
50
+ - "you're up late again"
51
+ - "early bird today huh"
52
+ - "this is about when you usually message me"
53
+
54
+ #### Vibe Callbacks
55
+ Based on emotional state changes:
56
+ - "you seem happier today than last time"
57
+ - "you were doing so good last time - everything ok?"
58
+
59
+ ## Usage
60
+
61
+ ```python
62
+ from skills.memory_callbacks import MemoryCallbacks
63
+
64
+ # Initialize with nervous system, memory, and heart
65
+ callbacks = MemoryCallbacks(
66
+ nervous=nervous,
67
+ memory=memory,
68
+ heart=heart
69
+ )
70
+
71
+ # Automatic tracking via events
72
+ # - message_received: extracts topics and people
73
+ # - thinking_done: decides if a callback should be injected
74
+
75
+ # Manual topic tracking
76
+ callbacks.track_topic("job interview", "User has an interview at Google next week")
77
+ callbacks.mark_followup_worthy("interview", {"company": "Google", "date": "2024-01-15"})
78
+
79
+ # Manual person tracking
80
+ callbacks.track_person("Sarah", "User's best friend", relationship="friend")
81
+
82
+ # Get callback for response generation
83
+ callback = callbacks.get_context_for_response()
84
+ if callback:
85
+ # Include in response naturally, e.g., prepend or append
86
+ response = f"{callback}\n\n{main_response}"
87
+
88
+ # Check stats
89
+ stats = callbacks.get_stats()
90
+ # {
91
+ # "total_conversations": 42,
92
+ # "tracked_topics": 15,
93
+ # "tracked_people": 8,
94
+ # "pending_followups": 3,
95
+ # "stale_people": 2,
96
+ # "relationship_days": 14,
97
+ # "total_callbacks": 12
98
+ # }
99
+ ```
100
+
101
+ ## Configuration
102
+
103
+ | Setting | Default | Description |
104
+ |---------|---------|-------------|
105
+ | BASE_CALLBACK_CHANCE | 0.15 | Base 15% chance of doing a callback |
106
+ | FOLLOWUP_BOOST | 0.25 | Extra chance per pending follow-up |
107
+ | PERSON_BOOST | 0.20 | Extra chance if there are stale people |
108
+ | MIN_HOURS_BETWEEN_CALLBACKS | 2 | Minimum hours between callbacks |
109
+ | PERSON_CALLBACK_DAYS | 3 | Days before asking about a person again |
110
+ | TOPIC_CALLBACK_HOURS | 4 | Hours before callback on same topic |
111
+ | ANNIVERSARY_DAYS | [7,30,90,180,365] | Milestone days to celebrate |
112
+
113
+ ## Data Storage
114
+
115
+ Data is stored in `./data/data/memory_callbacks.json`:
116
+
117
+ ```json
118
+ {
119
+ "version": "1.0",
120
+ "first_conversation": "2024-01-01T10:00:00",
121
+ "total_conversations": 42,
122
+ "topics": {
123
+ "job interview": {
124
+ "topic": "job interview",
125
+ "context": "User has an interview at Google",
126
+ "mentioned_at": "2024-01-10T14:30:00",
127
+ "times_mentioned": 3,
128
+ "followup_worthy": true,
129
+ "details": {"company": "Google"}
130
+ }
131
+ },
132
+ "people": {
133
+ "sarah": {
134
+ "name": "Sarah",
135
+ "context": "User's best friend",
136
+ "mentioned_at": "2024-01-05T09:00:00",
137
+ "times_mentioned": 5,
138
+ "relationship": "friend",
139
+ "last_callback": "2024-01-08T16:00:00"
140
+ }
141
+ },
142
+ "callback_history": [...]
143
+ }
144
+ ```
145
+
146
+ ## Integration Points
147
+
148
+ ### Event Listeners
149
+ - `message_received` - Extracts topics and people from incoming messages
150
+ - `thinking_done` - Decides whether to inject a callback
151
+
152
+ ### Response Generation
153
+ Call `get_context_for_response()` after thinking to get any pending callback to include in the response.
154
+
155
+ ### With Heart (Emotional State)
156
+ When heart is available, vibe callbacks can reference emotional changes:
157
+ - Comparing current mood to previous conversations
158
+ - Noticing if user seems happier/sadder than usual
159
+
160
+ ### With Memory
161
+ When memory is available, can reference conversation history for more context-aware callbacks.
162
+
163
+ ## Natural Behavior Guidelines
164
+
165
+ 1. **Subtle Frequency**: ~15% base chance, not every message gets a callback
166
+ 2. **Varied Templates**: Multiple templates per callback type to avoid repetition
167
+ 3. **Contextual Timing**: Respects minimum hours between callbacks
168
+ 4. **Smart Follow-ups**: Only asks about topics marked as follow-up worthy
169
+ 5. **Person Memory**: Doesn't nag - waits days before asking about someone again
170
+ 6. **Anniversary Awareness**: Celebrates milestones without being cheesy
@@ -0,0 +1,19 @@
1
+ """
2
+ Skills: Message Scheduler
3
+
4
+ Schedule Telegram messages to be sent at specific times.
5
+ """
6
+
7
+ from .scheduler import (
8
+ MessageScheduler,
9
+ ScheduledMessage,
10
+ get_message_scheduler,
11
+ get_scheduler_prompt_section,
12
+ )
13
+
14
+ __all__ = [
15
+ "MessageScheduler",
16
+ "ScheduledMessage",
17
+ "get_message_scheduler",
18
+ "get_scheduler_prompt_section",
19
+ ]
@@ -0,0 +1,107 @@
1
+ # Skills: Message Scheduler
2
+
3
+ Schedule Telegram messages to be sent at specific times. Alive-AI can use this to remember to message users at requested times.
4
+
5
+ ## Files
6
+ - `scheduler.py` - MessageScheduler class
7
+ - `__init__.py` - Module exports
8
+
9
+ ## Purpose
10
+
11
+ Allows Alive-AI to schedule messages for specific times when users ask her to remind them or message them later.
12
+
13
+ ## Usage Examples
14
+
15
+ When users say:
16
+ - "Message me at 15:00"
17
+ - "Text me in an hour"
18
+ - "Remind me at 3pm"
19
+ - "Send me something tonight"
20
+
21
+ Alive-AI can schedule these messages using this skill.
22
+
23
+ ## Integration
24
+
25
+ ### Initialization
26
+ ```python
27
+ from skills.message_scheduler import MessageScheduler
28
+
29
+ scheduler = MessageScheduler(
30
+ nervous=nervous_system,
31
+ data_path=Path("data/scheduled_messages")
32
+ )
33
+ ```
34
+
35
+ ### Scheduling a Message
36
+ ```python
37
+ # Schedule for specific time
38
+ scheduler.schedule_message(
39
+ user_id="123456789",
40
+ message="Hey! This is your scheduled message",
41
+ scheduled_time=datetime(2024, 1, 15, 15, 0), # 15:00
42
+ context="User asked me to message at 15:00"
43
+ )
44
+
45
+ # Schedule relative time
46
+ scheduler.schedule_in(
47
+ user_id="123456789",
48
+ message="An hour has passed!",
49
+ minutes=60
50
+ )
51
+ ```
52
+
53
+ ### Checking Due Messages
54
+ ```python
55
+ # Get messages that should be sent now
56
+ due_messages = scheduler.get_due_messages()
57
+ for msg in due_messages:
58
+ await send_telegram(msg.user_id, msg.message)
59
+ scheduler.mark_sent(msg.id)
60
+ ```
61
+
62
+ ## Data Storage
63
+
64
+ Files stored in `data/scheduled_messages/`:
65
+ - `queue.json` - Pending scheduled messages
66
+ - `history.json` - Sent message history
67
+
68
+ ## Methods
69
+
70
+ | Method | Description |
71
+ |--------|-------------|
72
+ | `schedule_message()` | Schedule message for specific datetime |
73
+ | `schedule_in()` | Schedule message relative to now |
74
+ | `get_due_messages()` | Get messages ready to send |
75
+ | `get_pending()` | Get all pending scheduled messages |
76
+ | `cancel_message()` | Cancel a scheduled message |
77
+ | `mark_sent()` | Mark message as sent |
78
+ | `get_next_for_user()` | Get next scheduled message for user |
79
+
80
+ ## Events Emitted
81
+
82
+ ### `scheduled_message_due`
83
+ Emitted when a scheduled message's time arrives:
84
+ ```python
85
+ {
86
+ "message_id": "uuid",
87
+ "user_id": "123456789",
88
+ "message": "Hey! Scheduled message here",
89
+ "scheduled_for": "2024-01-15T15:00:00",
90
+ "context": "User asked me to message at 15:00"
91
+ }
92
+ ```
93
+
94
+ ## Natural Time Parsing
95
+
96
+ The scheduler can parse natural language times:
97
+ - "at 15:00" / "at 3pm"
98
+ - "in an hour" / "in 30 minutes"
99
+ - "tonight at 8"
100
+ - "tomorrow morning"
101
+
102
+ ## Important Notes
103
+
104
+ - Messages persist across restarts
105
+ - Messages can be cancelled before sending
106
+ - History kept for debugging (last 100 sent)
107
+ - Timezone-aware (uses system timezone)