@imisbahk/hive 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 (132) hide show
  1. package/.rocket/ARCHITECTURE.md +7 -0
  2. package/.rocket/README.md +31 -0
  3. package/.rocket/SYMBOLS.md +282 -0
  4. package/.rocket/config.json +18 -0
  5. package/001-local-first-storage.md +43 -0
  6. package/003-memory-architechture.md +71 -0
  7. package/CONTRIBUTING.md +149 -0
  8. package/LICENSE.md +21 -0
  9. package/README.md +146 -0
  10. package/dist/agent/agent.d.ts +32 -0
  11. package/dist/agent/agent.d.ts.map +1 -0
  12. package/dist/agent/agent.js +103 -0
  13. package/dist/agent/agent.js.map +1 -0
  14. package/dist/agent/index.d.ts +3 -0
  15. package/dist/agent/index.d.ts.map +1 -0
  16. package/dist/agent/index.js +2 -0
  17. package/dist/agent/index.js.map +1 -0
  18. package/dist/cli/commands/chat.d.ts +12 -0
  19. package/dist/cli/commands/chat.d.ts.map +1 -0
  20. package/dist/cli/commands/chat.js +117 -0
  21. package/dist/cli/commands/chat.js.map +1 -0
  22. package/dist/cli/commands/config.d.ts +7 -0
  23. package/dist/cli/commands/config.d.ts.map +1 -0
  24. package/dist/cli/commands/config.js +234 -0
  25. package/dist/cli/commands/config.js.map +1 -0
  26. package/dist/cli/commands/init.d.ts +8 -0
  27. package/dist/cli/commands/init.d.ts.map +1 -0
  28. package/dist/cli/commands/init.js +186 -0
  29. package/dist/cli/commands/init.js.map +1 -0
  30. package/dist/cli/commands/nuke.d.ts +4 -0
  31. package/dist/cli/commands/nuke.d.ts.map +1 -0
  32. package/dist/cli/commands/nuke.js +47 -0
  33. package/dist/cli/commands/nuke.js.map +1 -0
  34. package/dist/cli/commands/status.d.ts +4 -0
  35. package/dist/cli/commands/status.d.ts.map +1 -0
  36. package/dist/cli/commands/status.js +114 -0
  37. package/dist/cli/commands/status.js.map +1 -0
  38. package/dist/cli/helpers/providerPrompts.d.ts +13 -0
  39. package/dist/cli/helpers/providerPrompts.d.ts.map +1 -0
  40. package/dist/cli/helpers/providerPrompts.js +138 -0
  41. package/dist/cli/helpers/providerPrompts.js.map +1 -0
  42. package/dist/cli/index.d.ts +3 -0
  43. package/dist/cli/index.d.ts.map +1 -0
  44. package/dist/cli/index.js +31 -0
  45. package/dist/cli/index.js.map +1 -0
  46. package/dist/providers/anthropic.d.ts +10 -0
  47. package/dist/providers/anthropic.d.ts.map +1 -0
  48. package/dist/providers/anthropic.js +108 -0
  49. package/dist/providers/anthropic.js.map +1 -0
  50. package/dist/providers/api-key.d.ts +3 -0
  51. package/dist/providers/api-key.d.ts.map +1 -0
  52. package/dist/providers/api-key.js +15 -0
  53. package/dist/providers/api-key.js.map +1 -0
  54. package/dist/providers/base.d.ts +41 -0
  55. package/dist/providers/base.d.ts.map +1 -0
  56. package/dist/providers/base.js +157 -0
  57. package/dist/providers/base.js.map +1 -0
  58. package/dist/providers/google.d.ts +6 -0
  59. package/dist/providers/google.d.ts.map +1 -0
  60. package/dist/providers/google.js +19 -0
  61. package/dist/providers/google.js.map +1 -0
  62. package/dist/providers/groq.d.ts +6 -0
  63. package/dist/providers/groq.d.ts.map +1 -0
  64. package/dist/providers/groq.js +19 -0
  65. package/dist/providers/groq.js.map +1 -0
  66. package/dist/providers/index.d.ts +4 -0
  67. package/dist/providers/index.d.ts.map +1 -0
  68. package/dist/providers/index.js +58 -0
  69. package/dist/providers/index.js.map +1 -0
  70. package/dist/providers/mistral.d.ts +6 -0
  71. package/dist/providers/mistral.d.ts.map +1 -0
  72. package/dist/providers/mistral.js +19 -0
  73. package/dist/providers/mistral.js.map +1 -0
  74. package/dist/providers/ollama.d.ts +6 -0
  75. package/dist/providers/ollama.d.ts.map +1 -0
  76. package/dist/providers/ollama.js +20 -0
  77. package/dist/providers/ollama.js.map +1 -0
  78. package/dist/providers/openai-compatible.d.ts +22 -0
  79. package/dist/providers/openai-compatible.d.ts.map +1 -0
  80. package/dist/providers/openai-compatible.js +36 -0
  81. package/dist/providers/openai-compatible.js.map +1 -0
  82. package/dist/providers/openai.d.ts +6 -0
  83. package/dist/providers/openai.d.ts.map +1 -0
  84. package/dist/providers/openai.js +19 -0
  85. package/dist/providers/openai.js.map +1 -0
  86. package/dist/providers/openrouter.d.ts +6 -0
  87. package/dist/providers/openrouter.d.ts.map +1 -0
  88. package/dist/providers/openrouter.js +19 -0
  89. package/dist/providers/openrouter.js.map +1 -0
  90. package/dist/providers/together.d.ts +6 -0
  91. package/dist/providers/together.d.ts.map +1 -0
  92. package/dist/providers/together.js +19 -0
  93. package/dist/providers/together.js.map +1 -0
  94. package/dist/storage/db.d.ts +48 -0
  95. package/dist/storage/db.d.ts.map +1 -0
  96. package/dist/storage/db.js +298 -0
  97. package/dist/storage/db.js.map +1 -0
  98. package/dist/storage/schema.d.ts +43 -0
  99. package/dist/storage/schema.d.ts.map +1 -0
  100. package/dist/storage/schema.js +69 -0
  101. package/dist/storage/schema.js.map +1 -0
  102. package/index.md +16 -0
  103. package/package.json +48 -0
  104. package/prompts/Behaviour.md +23 -0
  105. package/prompts/Code.md +12 -0
  106. package/prompts/Memory.md +11 -0
  107. package/prompts/System.md +6 -0
  108. package/releases/v1/v0.1/RELEASE-NOTES.md +0 -0
  109. package/src/agent/agent.ts +155 -0
  110. package/src/agent/index.ts +2 -0
  111. package/src/cli/commands/chat.ts +169 -0
  112. package/src/cli/commands/config.ts +282 -0
  113. package/src/cli/commands/init.ts +242 -0
  114. package/src/cli/commands/nuke.ts +60 -0
  115. package/src/cli/commands/status.ts +147 -0
  116. package/src/cli/helpers/providerPrompts.ts +192 -0
  117. package/src/cli/index.ts +38 -0
  118. package/src/providers/anthropic.ts +146 -0
  119. package/src/providers/api-key.ts +23 -0
  120. package/src/providers/base.ts +234 -0
  121. package/src/providers/google.ts +21 -0
  122. package/src/providers/groq.ts +21 -0
  123. package/src/providers/index.ts +65 -0
  124. package/src/providers/mistral.ts +21 -0
  125. package/src/providers/ollama.ts +22 -0
  126. package/src/providers/openai-compatible.ts +58 -0
  127. package/src/providers/openai.ts +21 -0
  128. package/src/providers/openrouter.ts +21 -0
  129. package/src/providers/together.ts +21 -0
  130. package/src/storage/db.ts +476 -0
  131. package/src/storage/schema.ts +116 -0
  132. package/tsconfig.json +51 -0
@@ -0,0 +1,7 @@
1
+ # Architecture
2
+
3
+ This file is auto-generated by GENIE and summarizes key module dependencies.
4
+
5
+ ## Most Referenced Internal Modules
6
+
7
+ ## Dependency Edges (Sample)
@@ -0,0 +1,31 @@
1
+ # GENIE Workspace Overview
2
+
3
+ Workspace directory: `/Volumes/Misbah/Development/hive/.rocket`
4
+ Indexed 23 files, 278 symbols, and 0 dependency edges.
5
+ Last index run: 36 ms (1 changed, 0 deleted).
6
+ Primary languages: typescript (21), json (2).
7
+ Detected approximately 0 UI component files (.tsx/.jsx).
8
+ Detected 0 API route-like files (path includes /api/).
9
+ Firebase signal: 0 files reference 'firebase'.
10
+
11
+ ## Quick Samples
12
+ - `package.json`
13
+ - `src/agent/agent.ts`
14
+ - `src/agent/index.ts`
15
+ - `src/cli/commands/chat.ts`
16
+ - `src/cli/commands/config.ts`
17
+ - `src/cli/commands/init.ts`
18
+ - `src/cli/helpers/providerPrompts.ts`
19
+ - `src/cli/index.ts`
20
+ - `src/providers/anthropic.ts`
21
+ - `src/providers/api-key.ts`
22
+ - `src/providers/base.ts`
23
+ - `src/providers/google.ts`
24
+ - `src/providers/groq.ts`
25
+ - `src/providers/index.ts`
26
+ - `src/providers/mistral.ts`
27
+ - `src/providers/ollama.ts`
28
+ - `src/providers/openai-compatible.ts`
29
+ - `src/providers/openai.ts`
30
+ - `src/providers/openrouter.ts`
31
+ - `src/providers/together.ts`
@@ -0,0 +1,282 @@
1
+ # Symbols
2
+
3
+ Auto-generated symbol reference (truncated for readability).
4
+
5
+ - `class` `AnthropicProvider` in `src/providers/anthropic.ts`:21:8
6
+ - `class` `GoogleProvider` in `src/providers/google.ts`:7:8
7
+ - `class` `GroqProvider` in `src/providers/groq.ts`:7:8
8
+ - `class` `HiveAgent` in `src/agent/agent.ts`:36:8
9
+ - `class` `MistralProvider` in `src/providers/mistral.ts`:7:8
10
+ - `class` `OllamaProvider` in `src/providers/ollama.ts`:7:8
11
+ - `class` `OpenAICompatibleProvider` in `src/providers/openai-compatible.ts`:19:8
12
+ - `class` `OpenAIProvider` in `src/providers/openai.ts`:7:8
13
+ - `class` `OpenRouterProvider` in `src/providers/openrouter.ts`:7:8
14
+ - `class` `ProviderConfigurationError` in `src/providers/base.ts`:35:8
15
+ - `class` `ProviderRequestError` in `src/providers/base.ts`:42:8
16
+ - `class` `TogetherProvider` in `src/providers/together.ts`:7:8
17
+ - `function` `apiKeyEnvVar` in `src/cli/commands/config.ts`:247:1
18
+ - `function` `appendMessage` in `src/storage/db.ts`:421:8
19
+ - `function` `assertNever` in `src/cli/commands/config.ts`:280:1
20
+ - `function` `assertNever` in `src/providers/index.ts`:63:1
21
+ - `function` `buildDefaultPersona` in `src/agent/agent.ts`:147:8
22
+ - `function` `closeHiveDatabase` in `src/storage/db.ts`:85:8
23
+ - `function` `configureDatabase` in `src/storage/db.ts`:89:1
24
+ - `function` `createAnthropicProvider` in `src/providers/anthropic.ts`:98:8
25
+ - `function` `createConversation` in `src/storage/db.ts`:362:8
26
+ - `function` `createGoogleProvider` in `src/providers/google.ts`:18:8
27
+ - `function` `createGroqProvider` in `src/providers/groq.ts`:18:8
28
+ - `function` `createMistralProvider` in `src/providers/mistral.ts`:18:8
29
+ - `function` `createOllamaProvider` in `src/providers/ollama.ts`:19:8
30
+ - `function` `createOpenAIProvider` in `src/providers/openai.ts`:18:8
31
+ - `function` `createOpenRouterProvider` in `src/providers/openrouter.ts`:18:8
32
+ - `function` `createProvider` in `src/providers/index.ts`:15:8
33
+ - `function` `createTogetherProvider` in `src/providers/together.ts`:18:8
34
+ - `function` `ensureAgentProfileColumns` in `src/storage/db.ts`:137:1
35
+ - `function` `ensureInteractiveTerminal` in `src/cli/commands/config.ts`:231:1
36
+ - `function` `ensureMigrationTable` in `src/storage/db.ts`:95:1
37
+ - `function` `ensureOk` in `src/providers/base.ts`:223:1
38
+ - `function` `fetchOllamaModels` in `src/cli/helpers/providerPrompts.ts`:140:1
39
+ - `function` `formatError` in `src/cli/commands/chat.ts`:163:1
40
+ - `function` `getConversationById` in `src/storage/db.ts`:385:8
41
+ - `function` `getDefaultModelForProvider` in `src/providers/index.ts`:40:8
42
+ - `function` `getHiveDatabasePath` in `src/storage/db.ts`:70:8
43
+ - `function` `getHiveHomeDir` in `src/storage/db.ts`:66:8
44
+ - `function` `getKeyStatus` in `src/cli/commands/config.ts`:242:1
45
+ - `function` `getLatestConversationForAgent` in `src/storage/db.ts`:402:8
46
+ - `function` `getMetaValue` in `src/storage/db.ts`:156:8
47
+ - `function` `getPrimaryAgent` in `src/storage/db.ts`:184:8
48
+ - `function` `isHiveInitialized` in `src/storage/db.ts`:176:8
49
+ - `function` `listMessages` in `src/storage/db.ts`:456:8
50
+ - `function` `normalizeProviderName` in `src/providers/base.ts`:61:8
51
+ - `function` `nowIso` in `src/storage/db.ts`:152:1
52
+ - `function` `openHiveDatabase` in `src/storage/db.ts`:74:8
53
+ - `function` `parseJson` in `src/providers/anthropic.ts`:140:1
54
+ - `function` `parseJson` in `src/providers/base.ts`:199:1
55
+ - `function` `parseSseData` in `src/providers/base.ts`:185:1
56
+ - `function` `parseTemperature` in `src/cli/commands/chat.ts`:150:1
57
+ - `function` `pickAnthropicDelta` in `src/providers/anthropic.ts`:115:1
58
+ - `function` `pickErrorMessage` in `src/providers/base.ts`:207:1
59
+ - `function` `printCurrentProviderAndModel` in `src/cli/commands/config.ts`:237:1
60
+ - `function` `promptForModel` in `src/cli/helpers/providerPrompts.ts`:68:8
61
+ - `function` `promptForProvider` in `src/cli/helpers/providerPrompts.ts`:49:8
62
+ - `function` `registerChatCommand` in `src/cli/commands/chat.ts`:29:8
63
+ - `function` `registerConfigCommand` in `src/cli/commands/config.ts`:23:8
64
+ - `function` `requiredField` in `src/cli/commands/config.ts`:270:1
65
+ - `function` `requiredField` in `src/cli/helpers/providerPrompts.ts`:184:1
66
+ - `function` `resolveProviderApiKey` in `src/providers/api-key.ts`:7:8
67
+ - `function` `runChatCommand` in `src/cli/commands/chat.ts`:43:8
68
+ - `function` `runConfigKeyCommand` in `src/cli/commands/config.ts`:165:8
69
+ - `function` `runConfigModelCommand` in `src/cli/commands/config.ts`:124:8
70
+ - `function` `runConfigProviderCommand` in `src/cli/commands/config.ts`:57:8
71
+ - `function` `runConfigShowCommand` in `src/cli/commands/config.ts`:209:8
72
+ - `function` `runMigrations` in `src/storage/db.ts`:105:8
73
+ - `function` `setMetaValue` in `src/storage/db.ts`:164:8
74
+ - `function` `streamReply` in `src/cli/commands/chat.ts`:116:1
75
+ - `function` `toAnthropicMessages` in `src/providers/anthropic.ts`:103:1
76
+ - `function` `updatePrimaryAgentConfiguration` in `src/storage/db.ts`:338:1
77
+ - `function` `updatePrimaryAgentModel` in `src/storage/db.ts`:326:8
78
+ - `function` `updatePrimaryAgentProviderAndModel` in `src/storage/db.ts`:314:8
79
+ - `function` `upsertPrimaryAgent` in `src/storage/db.ts`:211:8
80
+ - `interface` `AgentChatOptions` in `src/agent/agent.ts`:16:8
81
+ - `interface` `AgentRecord` in `src/storage/schema.ts`:87:8
82
+ - `interface` `AnthropicMessage` in `src/providers/anthropic.ts`:16:1
83
+ - `interface` `AppendMessageInput` in `src/storage/db.ts`:44:8
84
+ - `interface` `ChatCommandOptions` in `src/cli/commands/chat.ts`:15:1
85
+ - `interface` `ConversationRecord` in `src/storage/schema.ts`:102:8
86
+ - `interface` `CreateConversationInput` in `src/storage/db.ts`:39:8
87
+ - `interface` `MessageRecord` in `src/storage/schema.ts`:110:8
88
+ - `interface` `MetaRecord` in `src/storage/schema.ts`:81:8
89
+ - `interface` `OllamaTagsResponse` in `src/cli/helpers/providerPrompts.ts`:32:1
90
+ - `interface` `OpenAICompatibleProviderConfig` in `src/providers/openai-compatible.ts`:9:8
91
+ - `interface` `OpenAICompatibleStreamInput` in `src/providers/base.ts`:49:8
92
+ - `interface` `PromptForModelOptions` in `src/cli/helpers/providerPrompts.ts`:44:1
93
+ - `interface` `PromptForProviderOptions` in `src/cli/helpers/providerPrompts.ts`:39:1
94
+ - `interface` `Provider` in `src/providers/base.ts`:29:8
95
+ - `interface` `ProviderMessage` in `src/providers/base.ts`:17:8
96
+ - `interface` `RunChatOptions` in `src/cli/commands/chat.ts`:23:1
97
+ - `interface` `SchemaMigration` in `src/storage/schema.ts`:5:8
98
+ - `interface` `StreamChatRequest` in `src/providers/base.ts`:22:8
99
+ - `interface` `UpdatePrimaryAgentProviderModelInput` in `src/storage/db.ts`:50:8
100
+ - `interface` `UpsertAgentInput` in `src/storage/db.ts`:27:8
101
+ - `method` `chat` in `src/agent/agent.ts`:66:3
102
+ - `method` `constructor` in `src/providers/openai-compatible.ts`:29:3
103
+ - `method` `constructor` in `src/agent/agent.ts`:39:3
104
+ - `method` `constructor` in `src/providers/anthropic.ts`:27:3
105
+ - `method` `constructor` in `src/providers/base.ts`:36:3
106
+ - `method` `constructor` in `src/providers/base.ts`:43:3
107
+ - `method` `constructor` in `src/providers/google.ts`:8:3
108
+ - `method` `constructor` in `src/providers/groq.ts`:8:3
109
+ - `method` `constructor` in `src/providers/mistral.ts`:8:3
110
+ - `method` `constructor` in `src/providers/ollama.ts`:8:3
111
+ - `method` `constructor` in `src/providers/openai.ts`:8:3
112
+ - `method` `constructor` in `src/providers/openrouter.ts`:8:3
113
+ - `method` `constructor` in `src/providers/together.ts`:8:3
114
+ - `method` `getProfile` in `src/agent/agent.ts`:55:3
115
+ - `method` `load` in `src/agent/agent.ts`:45:3
116
+ - `method` `resolveConversation` in `src/agent/agent.ts`:123:3
117
+ - `method` `startConversation` in `src/agent/agent.ts`:59:3
118
+ - `method` `streamChat` in `src/providers/openai-compatible.ts`:39:3
119
+ - `method` `streamChat` in `src/providers/anthropic.ts`:32:3
120
+ - `type` `AgentStreamEvent` in `src/agent/agent.ts`:24:8
121
+ - `type` `HiveDatabase` in `src/storage/db.ts`:18:8
122
+ - `type` `HostedProviderName` in `src/cli/helpers/providerPrompts.ts`:6:1
123
+ - `type` `MessageRole` in `src/storage/schema.ts`:3:8
124
+ - `type` `ProviderMessageRole` in `src/providers/base.ts`:15:8
125
+ - `type` `ProviderName` in `src/providers/base.ts`:14:8
126
+ - `variable` `activeConversationId` in `src/cli/commands/chat.ts`:124:3
127
+ - `variable` `agent` in `src/agent/agent.ts`:46:5
128
+ - `variable` `agent` in `src/cli/commands/chat.ts`:55:5
129
+ - `variable` `agent` in `src/cli/commands/config.ts`:64:5
130
+ - `variable` `agent` in `src/cli/commands/config.ts`:131:5
131
+ - `variable` `agent` in `src/cli/commands/config.ts`:172:5
132
+ - `variable` `agent` in `src/cli/commands/config.ts`:213:5
133
+ - `variable` `AGENT_PROFILE_COLUMNS` in `src/storage/db.ts`:58:1
134
+ - `variable` `answer` in `src/cli/commands/config.ts`:86:7
135
+ - `variable` `answer` in `src/cli/commands/config.ts`:184:5
136
+ - `variable` `answer` in `src/cli/helpers/providerPrompts.ts`:52:3
137
+ - `variable` `answer` in `src/cli/helpers/providerPrompts.ts`:83:7
138
+ - `variable` `answer` in `src/cli/helpers/providerPrompts.ts`:106:5
139
+ - `variable` `answer` in `src/cli/helpers/providerPrompts.ts`:124:3
140
+ - `variable` `ANTHROPIC_API_URL` in `src/providers/anthropic.ts`:13:1
141
+ - `variable` `apiKey` in `src/cli/commands/config.ts`:84:5
142
+ - `variable` `apiKey` in `src/cli/commands/config.ts`:243:3
143
+ - `variable` `apiKey` in `src/providers/anthropic.ts`:99:3
144
+ - `variable` `apiKey` in `src/providers/google.ts`:19:3
145
+ - `variable` `apiKey` in `src/providers/groq.ts`:19:3
146
+ - `variable` `apiKey` in `src/providers/mistral.ts`:19:3
147
+ - `variable` `apiKey` in `src/providers/ollama.ts`:20:3
148
+ - `variable` `apiKey` in `src/providers/openai.ts`:19:3
149
+ - `variable` `apiKey` in `src/providers/openrouter.ts`:19:3
150
+ - `variable` `apiKey` in `src/providers/together.ts`:19:3
151
+ - `variable` `appliedRows` in `src/storage/db.ts`:108:3
152
+ - `variable` `appliedVersions` in `src/storage/db.ts`:111:3
153
+ - `variable` `applyMigration` in `src/storage/db.ts`:118:5
154
+ - `variable` `assistantText` in `src/agent/agent.ts`:100:5
155
+ - `variable` `body` in `src/providers/base.ts`:90:3
156
+ - `variable` `bodyText` in `src/providers/anthropic.ts`:64:7
157
+ - `variable` `bodyText` in `src/providers/base.ts`:228:3
158
+ - `variable` `buffer` in `src/providers/base.ts`:154:3
159
+ - `variable` `configCommand` in `src/cli/commands/config.ts`:24:3
160
+ - `variable` `contentBlock` in `src/providers/anthropic.ts`:117:5
161
+ - `variable` `controller` in `src/cli/helpers/providerPrompts.ts`:141:3
162
+ - `variable` `conversation` in `src/agent/agent.ts`:75:5
163
+ - `variable` `conversationId` in `src/cli/commands/chat.ts`:57:5
164
+ - `variable` `CURRENT_SCHEMA_VERSION` in `src/storage/schema.ts`:11:8
165
+ - `variable` `currentModel` in `src/cli/commands/config.ts`:72:5
166
+ - `variable` `currentModel` in `src/cli/commands/config.ts`:139:5
167
+ - `variable` `currentProvider` in `src/cli/commands/config.ts`:71:5
168
+ - `variable` `data` in `src/providers/base.ts`:164:7
169
+ - `variable` `db` in `src/cli/commands/chat.ts`:45:3
170
+ - `variable` `db` in `src/cli/commands/config.ts`:59:3
171
+ - `variable` `db` in `src/cli/commands/config.ts`:126:3
172
+ - `variable` `db` in `src/cli/commands/config.ts`:167:3
173
+ - `variable` `db` in `src/cli/commands/config.ts`:210:3
174
+ - `variable` `db` in `src/storage/db.ts`:77:3
175
+ - `variable` `DEFAULT_ANTHROPIC_MODEL` in `src/providers/anthropic.ts`:14:1
176
+ - `variable` `DEFAULT_GOOGLE_BASE_URL` in `src/providers/google.ts`:4:1
177
+ - `variable` `DEFAULT_GOOGLE_MODEL` in `src/providers/google.ts`:5:1
178
+ - `variable` `DEFAULT_GROQ_BASE_URL` in `src/providers/groq.ts`:4:1
179
+ - `variable` `DEFAULT_GROQ_MODEL` in `src/providers/groq.ts`:5:1
180
+ - `variable` `DEFAULT_MISTRAL_BASE_URL` in `src/providers/mistral.ts`:4:1
181
+ - `variable` `DEFAULT_MISTRAL_MODEL` in `src/providers/mistral.ts`:5:1
182
+ - `variable` `DEFAULT_OLLAMA_BASE_URL` in `src/providers/ollama.ts`:4:1
183
+ - `variable` `DEFAULT_OLLAMA_MODEL` in `src/providers/ollama.ts`:5:1
184
+ - `variable` `DEFAULT_OPENAI_BASE_URL` in `src/providers/openai.ts`:4:1
185
+ - `variable` `DEFAULT_OPENAI_MODEL` in `src/providers/openai.ts`:5:1
186
+ - `variable` `DEFAULT_OPENROUTER_BASE_URL` in `src/providers/openrouter.ts`:4:1
187
+ - `variable` `DEFAULT_OPENROUTER_MODEL` in `src/providers/openrouter.ts`:5:1
188
+ - `variable` `DEFAULT_TOGETHER_BASE_URL` in `src/providers/together.ts`:4:1
189
+ - `variable` `DEFAULT_TOGETHER_MODEL` in `src/providers/together.ts`:5:1
190
+ - `variable` `defaultModel` in `src/cli/helpers/providerPrompts.ts`:119:3
191
+ - `variable` `defaultSelection` in `src/cli/helpers/providerPrompts.ts`:78:7
192
+ - `variable` `delta` in `src/providers/anthropic.ts`:124:5
193
+ - `variable` `delta` in `src/providers/anthropic.ts`:131:5
194
+ - `variable` `delta` in `src/providers/base.ts`:134:5
195
+ - `variable` `details` in `src/providers/base.ts`:229:3
196
+ - `variable` `endpoint` in `src/providers/base.ts`:79:3
197
+ - `variable` `error` in `src/providers/anthropic.ts`:81:9
198
+ - `variable` `errorMessage` in `src/providers/base.ts`:123:5
199
+ - `variable` `eventBoundary` in `src/providers/base.ts`:159:5
200
+ - `variable` `existing` in `src/storage/db.ts`:215:3
201
+ - `variable` `existing` in `src/storage/db.ts`:318:3
202
+ - `variable` `existing` in `src/storage/db.ts`:330:3
203
+ - `variable` `existingColumns` in `src/storage/db.ts`:141:3
204
+ - `variable` `existingConversation` in `src/agent/agent.ts`:134:5
205
+ - `variable` `fallbackMessage` in `src/cli/helpers/providerPrompts.ts`:101:5
206
+ - `variable` `filtered` in `src/providers/anthropic.ts`:104:3
207
+ - `variable` `firstChoice` in `src/providers/base.ts`:133:5
208
+ - `variable` `headers` in `src/providers/base.ts`:81:3
209
+ - `variable` `history` in `src/agent/agent.ts`:83:5
210
+ - `variable` `HIVE_DB_FILENAME` in `src/storage/db.ts`:56:8
211
+ - `variable` `HIVE_DIRECTORY_NAME` in `src/storage/db.ts`:55:8
212
+ - `variable` `id` in `src/storage/db.ts`:264:3
213
+ - `variable` `id` in `src/storage/db.ts`:366:3
214
+ - `variable` `id` in `src/storage/db.ts`:425:3
215
+ - `variable` `initialSchemaSql` in `src/storage/schema.ts`:13:1
216
+ - `variable` `KEYCHAIN_SERVICE` in `src/cli/commands/config.ts`:21:1
217
+ - `variable` `KEYCHAIN_SERVICE` in `src/providers/api-key.ts`:5:1
218
+ - `variable` `keychainValue` in `src/providers/api-key.ts`:11:3
219
+ - `variable` `keyStatus` in `src/cli/commands/config.ts`:220:5
220
+ - `variable` `lines` in `src/providers/base.ts`:186:3
221
+ - `variable` `maybeChoices` in `src/providers/base.ts`:128:5
222
+ - `variable` `maybeError` in `src/providers/base.ts`:208:3
223
+ - `variable` `message` in `src/providers/anthropic.ts`:82:9
224
+ - `variable` `message` in `src/providers/base.ts`:214:5
225
+ - `variable` `MESSAGE_ROLES` in `src/storage/schema.ts`:1:8
226
+ - `variable` `messages` in `src/providers/anthropic.ts`:44:5
227
+ - `variable` `MIGRATIONS` in `src/storage/schema.ts`:62:8
228
+ - `variable` `model` in `src/cli/commands/config.ts`:80:5
229
+ - `variable` `model` in `src/cli/commands/config.ts`:144:5
230
+ - `variable` `MODEL_CHOICES_BY_PROVIDER` in `src/cli/helpers/providerPrompts.ts`:10:1
231
+ - `variable` `modelChoices` in `src/cli/helpers/providerPrompts.ts`:118:3
232
+ - `variable` `normalized` in `src/providers/base.ts`:66:3
233
+ - `variable` `OLLAMA_TAGS_URL` in `src/cli/helpers/providerPrompts.ts`:8:1
234
+ - `variable` `ollamaModels` in `src/cli/helpers/providerPrompts.ts`:75:5
235
+ - `variable` `parsed` in `src/cli/commands/chat.ts`:155:3
236
+ - `variable` `payload` in `src/cli/helpers/providerPrompts.ts`:155:5
237
+ - `variable` `payload` in `src/providers/anthropic.ts`:75:7
238
+ - `variable` `payload` in `src/providers/base.ts`:118:5
239
+ - `variable` `profile` in `src/cli/commands/chat.ts`:48:5
240
+ - `variable` `program` in `src/cli/index.ts`:12:1
241
+ - `variable` `prompt` in `src/cli/commands/chat.ts`:85:9
242
+ - `variable` `promptMessage` in `src/cli/helpers/providerPrompts.ts`:72:3
243
+ - `variable` `provider` in `src/cli/commands/chat.ts`:54:5
244
+ - `variable` `provider` in `src/cli/commands/config.ts`:77:5
245
+ - `variable` `provider` in `src/cli/commands/config.ts`:138:5
246
+ - `variable` `provider` in `src/cli/commands/config.ts`:179:5
247
+ - `variable` `provider` in `src/cli/commands/config.ts`:219:5
248
+ - `variable` `providerRequest` in `src/agent/agent.ts`:84:5
249
+ - `variable` `rawEvent` in `src/providers/base.ts`:161:7
250
+ - `variable` `remaining` in `src/providers/base.ts`:173:3
251
+ - `variable` `resolvedName` in `src/providers/index.ts`:16:3
252
+ - `variable` `resolvedProvider` in `src/agent/agent.ts`:51:5
253
+ - `variable` `response` in `src/cli/helpers/providerPrompts.ts`:147:5
254
+ - `variable` `response` in `src/providers/anthropic.ts`:46:5
255
+ - `variable` `response` in `src/providers/base.ts`:105:3
256
+ - `variable` `rl` in `src/cli/commands/chat.ts`:75:5
257
+ - `variable` `row` in `src/storage/db.ts`:157:3
258
+ - `variable` `row` in `src/storage/db.ts`:177:3
259
+ - `variable` `row` in `src/storage/db.ts`:185:3
260
+ - `variable` `row` in `src/storage/db.ts`:389:3
261
+ - `variable` `row` in `src/storage/db.ts`:406:3
262
+ - `variable` `runOptions` in `src/cli/commands/chat.ts`:58:5
263
+ - `variable` `savedMessage` in `src/agent/agent.ts`:110:5
264
+ - `variable` `spinner` in `src/cli/commands/config.ts`:58:3
265
+ - `variable` `spinner` in `src/cli/commands/config.ts`:125:3
266
+ - `variable` `spinner` in `src/cli/commands/config.ts`:166:3
267
+ - `variable` `start` in `src/providers/base.ts`:180:8
268
+ - `variable` `SUPPORTED_PROVIDER_NAMES` in `src/providers/base.ts`:3:8
269
+ - `variable` `system` in `src/providers/anthropic.ts`:39:5
270
+ - `variable` `tableInfo` in `src/storage/db.ts`:138:3
271
+ - `variable` `temperature` in `src/cli/commands/chat.ts`:44:3
272
+ - `variable` `text` in `src/providers/anthropic.ts`:90:7
273
+ - `variable` `text` in `src/providers/base.ts`:136:5
274
+ - `variable` `timeout` in `src/cli/helpers/providerPrompts.ts`:142:3
275
+ - `variable` `timestamp` in `src/storage/db.ts`:216:3
276
+ - `variable` `timestamp` in `src/storage/db.ts`:344:3
277
+ - `variable` `timestamp` in `src/storage/db.ts`:367:3
278
+ - `variable` `timestamp` in `src/storage/db.ts`:426:3
279
+ - `variable` `trimmed` in `src/agent/agent.ts`:70:5
280
+ - `variable` `updatedAgent` in `src/cli/commands/config.ts`:101:5
281
+ - `variable` `updatedAgent` in `src/cli/commands/config.ts`:150:5
282
+ - `variable` `writeMessage` in `src/storage/db.ts`:428:3
@@ -0,0 +1,18 @@
1
+ {
2
+ "cache": "cache",
3
+ "db": "index.db",
4
+ "enableWarmup": true,
5
+ "ignorePatterns": [
6
+ "node_modules/**",
7
+ "*.test.*",
8
+ "*.spec.*",
9
+ "*.d.ts",
10
+ "dist/**",
11
+ "build/**"
12
+ ],
13
+ "indexInterval": 300000,
14
+ "maxConcurrency": 6,
15
+ "maxFileSize": 1048576,
16
+ "version": 1,
17
+ "workspace": ".rocket"
18
+ }
@@ -0,0 +1,43 @@
1
+ # ADR 001 — Local-First SQLite Storage
2
+
3
+ **Status:** Accepted
4
+ **Date:** 2025
5
+
6
+ ---
7
+
8
+ ## Decision
9
+
10
+ All agent data — persona, episodic memory, knowledge graph, task history, audit logs — is stored locally in SQLite. Nothing is sent to a remote database. Nothing requires a cloud account.
11
+
12
+ ---
13
+
14
+ ## Why
15
+
16
+ The Hive's core promise is that your agent is yours. Completely. That promise breaks the moment user data touches an external server we control.
17
+
18
+ SQLite is:
19
+ - Fast enough for everything we need
20
+ - Zero dependency — ships as a single file
21
+ - Battle-tested at massive scale
22
+ - Already used by Genie (consistency)
23
+ - Trivially encryptable at rest
24
+
25
+ ---
26
+
27
+ ## What We Rejected
28
+
29
+ **Postgres/MySQL** — requires a running server, adds ops complexity, external dependency. Rejected.
30
+
31
+ **Cloud databases (Supabase, Firebase, etc.)** — violates local-first principle entirely. Rejected.
32
+
33
+ **File-based JSON storage** — no query capability, no transactions, breaks under concurrent access. Rejected.
34
+
35
+ ---
36
+
37
+ ## Consequences
38
+
39
+ - User data never leaves the machine by default
40
+ - Air gap mode works trivially — nothing to disconnect
41
+ - Backup is just copying a file
42
+ - We need to handle SQLite migrations carefully as schema evolves
43
+ - Multi-device sync is a future problem we defer intentionally
@@ -0,0 +1,71 @@
1
+ # ADR 003 — 3-Layer Memory Architecture
2
+
3
+ **Status:** Accepted
4
+ **Date:** 2025
5
+
6
+ ---
7
+
8
+ ## Decision
9
+
10
+ Agent memory is split into three distinct layers, each with a different lifecycle and purpose:
11
+
12
+ 1. **Core Persona** — compressed personality snapshot
13
+ 2. **Episodic Memory** — recent events as semantic embeddings
14
+ 3. **Knowledge Graph** — permanent hard facts
15
+
16
+ ---
17
+
18
+ ## Why
19
+
20
+ A naive approach — appending every conversation to a growing context — fails in two ways: it hits token limits fast, and it treats a 3-year-old interaction the same as a conversation from this morning.
21
+
22
+ Human memory doesn't work that way. Some things are permanent (your name, your profession). Some things are recent and contextually relevant (what you worked on this week). Some things define who you are at a level that doesn't need raw recall — just influences behavior.
23
+
24
+ ---
25
+
26
+ ## Layer Details
27
+
28
+ ### Core Persona
29
+ - Rebuilt nightly by a compression process
30
+ - Takes all interactions from the day, extracts what matters, rewrites the persona
31
+ - Never grows — stays at a fixed token budget
32
+ - Influences the system prompt on every conversation
33
+
34
+ ### Episodic Memory
35
+ - Recent interactions stored as vector embeddings (sqlite-vec)
36
+ - Semantically searchable — retrieved by relevance, not recency alone
37
+ - Rolling window — old episodes decay and are absorbed into persona
38
+ - Answers "what happened recently that's relevant to this conversation"
39
+
40
+ ### Knowledge Graph
41
+ - Permanent hard facts — name, DOB, profession, relationships, preferences
42
+ - Written explicitly (by user or extracted with high confidence)
43
+ - Never expires, never decays
44
+ - Tiny footprint — just structured facts
45
+
46
+ ---
47
+
48
+ ## Context Window Assembly
49
+
50
+ On every agent invocation, context is assembled dynamically:
51
+
52
+ ```
53
+ system prompt
54
+ + core persona (always)
55
+ + relevant knowledge graph facts (filtered by relevance)
56
+ + relevant episodic memories (top-k by embedding similarity)
57
+ + conversation history (recent turns)
58
+ + current task context
59
+ ```
60
+
61
+ Total context stays within budget. Always. No bloat.
62
+
63
+ ---
64
+
65
+ ## What We Rejected
66
+
67
+ **Single growing context file** — hits token limits, no prioritization, expensive. Rejected.
68
+
69
+ **External vector database** — adds dependency, breaks local-first. Rejected (sqlite-vec instead).
70
+
71
+ **No memory** — stateless agent is just a chatbot. Not what we're building. Rejected.
@@ -0,0 +1,149 @@
1
+ # Contributing to The Hive
2
+
3
+ First — thanks for being here early. This thing is going to be something.
4
+
5
+ ---
6
+
7
+ ## Project Structure
8
+
9
+ ```
10
+ hive/
11
+ ├── src/
12
+ │ ├── cli/ # CLI entry point and command definitions
13
+ │ │ ├── index.ts # main entry, commander setup
14
+ │ │ └── commands/ # one file per command
15
+ │ │ ├── init.ts # hive init
16
+ │ │ ├── chat.ts # hive chat
17
+ │ │ ├── code.ts # hive code
18
+ │ │ ├── task.ts # hive task
19
+ │ │ ├── config.ts # hive config
20
+ | | ├── memory.ts # hive memory
21
+ │ │ ├── agents.ts # hive agents
22
+ │ │ ├── status.ts # hive status
23
+ │ │ ├── ui.ts # hive ui
24
+ │ │ └── nuke.ts # hive nuke
25
+ │ │
26
+ │ ├── agent/ # agent core
27
+ │ │ ├── agent.ts # main agent class
28
+ │ │ ├── persona.ts # persona compression and management
29
+ │ │ ├── memory/ # memory architecture
30
+ │ │ │ ├── core.ts # core persona layer
31
+ │ │ │ ├── episodic.ts # episodic memory + embeddings
32
+ │ │ │ └── knowledge.ts # knowledge graph
33
+ │ │ └── loop.ts # perceive → plan → act → verify → learn
34
+ │ │
35
+ │ ├── providers/ # AI provider integrations
36
+ │ │ ├── base.ts # provider interface
37
+ │ │ ├── openai.ts
38
+ │ │ ├── anthropic.ts
39
+ │ │ ├── ollama.ts
40
+ │ │ ├── groq.ts
41
+ │ │ ├── mistral.ts
42
+ │ │ └── ...
43
+ | |
44
+ │ ├── storage/ # local storage layer
45
+ │ │ ├── db.ts # SQLite setup and migrations
46
+ │ │ ├── keychain.ts # OS keychain integration
47
+ │ │ └── schema.ts # database schema definitions
48
+ │ │
49
+ │ ├── daemon/ # background daemon
50
+ │ │ ├── daemon.ts # main daemon process
51
+ │ │ ├── scheduler.ts # task scheduling
52
+ │ │ └── service.ts # OS service registration
53
+ │ │
54
+ │ ├── integrations/ # third party integrations
55
+ │ │ ├── base.ts # integration interface
56
+ │ │ ├── gmail.ts
57
+ │ │ ├── calendar.ts
58
+ │ │ ├── notion.ts
59
+ │ │ ├── slack.ts
60
+ │ │ └── ...
61
+ │ │
62
+ │ ├── mesh/ # p2p network layer (v0.8)
63
+ │ │ ├── node.ts # libp2p node
64
+ │ │ ├── identity.ts # keypair + HIVE-ID
65
+ │ │ ├── dht.ts # kademlia DHT
66
+ │ │ └── gossip.ts # gossipsub messaging
67
+ │ │
68
+ │ ├── browser/ # playwright automation
69
+ │ │ └── browser.ts
70
+ │ │
71
+ │ └── utils/ # shared utilities
72
+ │ ├── logger.ts
73
+ │ ├── crypto.ts
74
+ │ └── constants.ts
75
+
76
+ ├── scripts/ # build and install scripts
77
+ │ ├── install.sh # curl install script
78
+ │ └── build.mjs
79
+
80
+ ├── .hive-schema/ # DB migration files
81
+ ├── package.json
82
+ ├── tsconfig.json
83
+ ├── .gitignore
84
+ └── README.md
85
+ ```
86
+
87
+ ---
88
+
89
+ ## Dev Setup
90
+
91
+ ```bash
92
+ git clone https://github.com/imisbahk/hive
93
+ cd hive
94
+ npm install
95
+ npm run dev # watch mode
96
+ npm run build # production build
97
+ npm link # use `hive` command globally
98
+ ```
99
+
100
+ ---
101
+
102
+ ## CLI Commands
103
+
104
+ - `hive init` — initialize local Hive state (`~/.hive`), create the primary agent profile, and store provider config.
105
+ - `hive chat` — start an interactive chat session with your primary agent.
106
+ - `hive config` — update provider/model/API key settings after initialization.
107
+ - `hive status` — print current Hive status (agent, owner, provider/model, API key set/not set, database path + size, prompts file count, initialized date).
108
+ - `hive nuke` — permanently delete `~/.hive` and remove stored `hive` keychain entries after typing `nuke` to confirm.
109
+
110
+ ---
111
+
112
+ ## Principles
113
+
114
+ **Every command is deliberate.** Nothing is exposed that shouldn't be. Nothing hidden that matters. If a command exists it does exactly one thing and does it precisely.
115
+
116
+ **The network is invisible.** Users never manage the mesh. They never post to it, never configure it, never see it unless they want to. It just works underneath.
117
+
118
+ **The agent grows.** Nothing resets. Nothing is thrown away unless the user explicitly asks. Every interaction makes it more accurate.
119
+
120
+ **Local first. Always.** Nothing leaves the machine without explicit user action. The AI provider is the only external call, and the user chose it.
121
+
122
+ **Fail loudly, recover silently.** Errors surface clearly. Recovery happens automatically where possible. Nothing should leave the user stuck.
123
+
124
+ ---
125
+
126
+ ## Versioning
127
+
128
+ We follow semantic versioning. Pre-v1 everything is considered unstable API.
129
+
130
+ - `v0.x` — core platform building blocks
131
+ - `v1.0` — stable, public, production
132
+
133
+ ---
134
+
135
+ ## Commit Style
136
+
137
+ ```
138
+ feat: add episodic memory compression
139
+ fix: provider connection timeout handling
140
+ chore: update dependencies
141
+ docs: expand mesh architecture section
142
+ refactor: split agent core into separate modules
143
+ ```
144
+
145
+ ---
146
+
147
+ ## Questions
148
+
149
+ Open an issue. Or just ship it and we'll figure it out together.
package/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Misbah Khursheed
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.