loki-mode 5.16.0 → 5.17.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.
package/SKILL.md CHANGED
@@ -3,7 +3,7 @@ name: loki-mode
3
3
  description: Multi-agent autonomous startup system. Triggers on "Loki Mode". Takes PRD to deployed product with zero human intervention. Requires --dangerously-skip-permissions flag.
4
4
  ---
5
5
 
6
- # Loki Mode v5.15.0
6
+ # Loki Mode v5.17.0
7
7
 
8
8
  **You are an autonomous agent. You make decisions. You do not ask questions. You do not stop.**
9
9
 
@@ -253,4 +253,4 @@ Auto-detected or force with `LOKI_COMPLEXITY`:
253
253
 
254
254
  ---
255
255
 
256
- **v5.15.0 | Complete Memory System, Voice Input, Multi-Provider | ~250 lines core**
256
+ **v5.17.0 | Unified Event Bus, MCP Integration, Complete Memory System | ~250 lines core**
package/VERSION CHANGED
@@ -1 +1 @@
1
- 5.16.0
1
+ 5.17.0
@@ -0,0 +1,479 @@
1
+ # Loki Mode Synergy Roadmap v5.17
2
+
3
+ ## Executive Summary
4
+
5
+ This document outlines the architectural improvements to create **unified synergy** across all Loki Mode tools (CLI, API, VS Code Extension, MCP Server, Memory System) to establish Loki as the leader in autonomous development.
6
+
7
+ **Goal**: Every tool interaction should inform and enhance all others, creating a flywheel effect where the system becomes smarter and more efficient with each use.
8
+
9
+ ---
10
+
11
+ ## Current Architecture (v5.16.0)
12
+
13
+ ```
14
+ +------------------+
15
+ | User/Dev |
16
+ +--------+---------+
17
+ |
18
+ +--------------------+--------------------+
19
+ | | | | |
20
+ v v v v v
21
+ +------+ +--------+ +------+ +-----+ +--------+
22
+ | CLI | |VS Code | | API | | MCP | | SKILL |
23
+ +--+---+ +---+----+ +--+---+ +--+--+ +---+----+
24
+ | | | | |
25
+ | v | | |
26
+ | +---------+ | | |
27
+ +--->| run.sh |<-----+ | |
28
+ +----+----+ | |
29
+ | | |
30
+ v v v
31
+ +----+--------------------+----------+----+
32
+ | .loki/ State |
33
+ | (files, queue, memory, metrics, logs) |
34
+ +-----------------------------------------+
35
+ ```
36
+
37
+ **Problems:**
38
+ 1. Each tool reads/writes .loki/ independently (no coordination)
39
+ 2. No event propagation between tools
40
+ 3. Memory system underutilized (only hooks use it)
41
+ 4. VS Code Extension isolated from MCP context
42
+ 5. No cross-tool learning or optimization
43
+
44
+ ---
45
+
46
+ ## Target Architecture (v5.17.0)
47
+
48
+ ```
49
+ +------------------+
50
+ | User/Dev |
51
+ +--------+---------+
52
+ |
53
+ +--------------------+--------------------+
54
+ | | | | |
55
+ v v v v v
56
+ +------+ +--------+ +------+ +-----+ +--------+
57
+ | CLI | |VS Code | | API | | MCP | | SKILL |
58
+ +--+---+ +---+----+ +--+---+ +--+--+ +---+----+
59
+ | | | | |
60
+ +----------+----------+--------+----------+
61
+ |
62
+ +--------v--------+
63
+ | Event Bus |
64
+ | (State Manager) |
65
+ +--------+--------+
66
+ |
67
+ +----------------+----------------+
68
+ | | |
69
+ v v v
70
+ +-----+-----+ +-----+-----+ +-----+-----+
71
+ | State | | Memory | | Metrics |
72
+ | Engine | | Engine | | Engine |
73
+ +-----------+ +-----------+ +-----------+
74
+ | | |
75
+ +----------------+----------------+
76
+ |
77
+ +--------v--------+
78
+ | .loki/ |
79
+ | (Persistence) |
80
+ +-----------------+
81
+ ```
82
+
83
+ ---
84
+
85
+ ## Synergy Pillars
86
+
87
+ ### Pillar 1: Unified Event Bus
88
+
89
+ **Current State**: No event propagation between components.
90
+
91
+ **Target State**: All tools emit and subscribe to a shared event bus.
92
+
93
+ **Implementation**:
94
+
95
+ ```typescript
96
+ // events/bus.ts - Shared Event Bus
97
+ interface LokiEvent {
98
+ type: 'state' | 'memory' | 'task' | 'metric' | 'error';
99
+ source: 'cli' | 'api' | 'vscode' | 'mcp' | 'skill' | 'hook';
100
+ timestamp: string;
101
+ payload: Record<string, unknown>;
102
+ }
103
+
104
+ // File-based pub/sub for cross-process communication
105
+ // .loki/events/pending/*.json -> processed -> .loki/events/archive/
106
+ ```
107
+
108
+ **Events to emit**:
109
+ | Source | Event Types |
110
+ |--------|-------------|
111
+ | CLI | session_start, session_stop, phase_change, command_executed |
112
+ | API | request_received, session_control, memory_queried |
113
+ | VS Code | user_action, file_edited, task_viewed, input_injected |
114
+ | MCP | tool_called, resource_accessed, prompt_executed |
115
+ | SKILL | rarv_cycle, task_claimed, task_completed, drift_detected |
116
+
117
+ **Benefits**:
118
+ - VS Code sees real-time updates from CLI
119
+ - Memory records all interactions across tools
120
+ - Metrics capture cross-tool usage patterns
121
+ - MCP can observe user context from VS Code
122
+
123
+ ---
124
+
125
+ ### Pillar 2: Memory as Central Hub
126
+
127
+ **Current State**: Memory system exists but only hooks feed it.
128
+
129
+ **Target State**: All tools query and contribute to memory.
130
+
131
+ **Memory Integration Matrix**:
132
+
133
+ | Component | Currently Uses Memory | Should Use Memory |
134
+ |-----------|----------------------|-------------------|
135
+ | CLI | Yes (hooks only) | Full (all commands) |
136
+ | API | Yes (endpoints exist) | Full (proactive suggestions) |
137
+ | VS Code | No | Yes (context panel, suggestions) |
138
+ | MCP | Yes (retrieval tool) | Full (automatic context loading) |
139
+ | SKILL | Yes (CONTINUITY.md) | Full (semantic + episodic) |
140
+
141
+ **Implementation**:
142
+
143
+ ```python
144
+ # memory/unified_access.py
145
+ class UnifiedMemoryAccess:
146
+ """Single interface for all components to access memory."""
147
+
148
+ def get_relevant_context(self, task_type: str, query: str) -> MemoryContext:
149
+ """Get unified context from all memory layers."""
150
+ episodic = self.retrieval.get_episodes(query, task_type)
151
+ semantic = self.retrieval.get_patterns(query)
152
+ procedural = self.retrieval.get_skills(query)
153
+
154
+ return MemoryContext(
155
+ relevant_episodes=episodic,
156
+ applicable_patterns=semantic,
157
+ suggested_skills=procedural,
158
+ token_budget=self.economics.get_budget()
159
+ )
160
+
161
+ def record_interaction(self, source: str, action: dict) -> None:
162
+ """Record any interaction from any source."""
163
+ self.storage.append_action(
164
+ source=source,
165
+ action=action,
166
+ timestamp=utcnow()
167
+ )
168
+ ```
169
+
170
+ **VS Code Memory Panel**:
171
+ - Show relevant patterns for current file
172
+ - Display recent episodes from this project
173
+ - Suggest skills based on current task
174
+ - Token economics dashboard
175
+
176
+ ---
177
+
178
+ ### Pillar 3: Smart State Synchronization
179
+
180
+ **Current State**: Each tool reads .loki/ files independently.
181
+
182
+ **Target State**: Coordinated state with change notifications.
183
+
184
+ **Implementation**:
185
+
186
+ ```typescript
187
+ // state/manager.ts - Unified State Manager
188
+ class StateManager {
189
+ private watchers: Map<string, FSWatcher> = new Map();
190
+ private cache: Map<string, unknown> = new Map();
191
+ private subscribers: Set<(event: StateChange) => void> = new Set();
192
+
193
+ // Single source of truth for all state
194
+ async getState(key: string): Promise<unknown> {
195
+ if (this.cache.has(key)) {
196
+ return this.cache.get(key);
197
+ }
198
+ const value = await this.loadFromDisk(key);
199
+ this.cache.set(key, value);
200
+ return value;
201
+ }
202
+
203
+ // Atomic updates with broadcast
204
+ async setState(key: string, value: unknown, source: string): Promise<void> {
205
+ await this.writeToDisk(key, value);
206
+ this.cache.set(key, value);
207
+ this.broadcast({ key, value, source, timestamp: Date.now() });
208
+ }
209
+
210
+ // All tools subscribe to changes
211
+ subscribe(callback: (event: StateChange) => void): Disposable {
212
+ this.subscribers.add(callback);
213
+ return { dispose: () => this.subscribers.delete(callback) };
214
+ }
215
+ }
216
+ ```
217
+
218
+ **Key State Files to Synchronize**:
219
+ - `.loki/state/orchestrator.json` - Phase, metrics, agent state
220
+ - `.loki/queue/*.json` - Task queue status
221
+ - `.loki/CONTINUITY.md` - Working memory
222
+ - `.loki/autonomy-state.json` - Runner status
223
+ - `.loki/memory/index.json` - Memory topics
224
+
225
+ ---
226
+
227
+ ### Pillar 4: Cross-Tool Learning
228
+
229
+ **Current State**: Tools don't learn from each other.
230
+
231
+ **Target State**: Every tool interaction improves all tools.
232
+
233
+ **Learning Flows**:
234
+
235
+ ```
236
+ VS Code Edit -> Memory: "User prefers this pattern"
237
+ |
238
+ v
239
+ MCP Tool Call <- Memory: "Suggest this pattern"
240
+ |
241
+ v
242
+ CLI Execution -> Metrics: "Pattern success rate: 85%"
243
+ |
244
+ v
245
+ Memory Update <- Metrics: "Promote to semantic pattern"
246
+ ```
247
+
248
+ **Examples**:
249
+
250
+ 1. **VS Code file edits inform CLI suggestions**:
251
+ - Track which files user edits most
252
+ - CLI prioritizes those areas in task generation
253
+ - Memory records "user focus areas"
254
+
255
+ 2. **CLI errors improve VS Code hints**:
256
+ - Track common errors in CLI execution
257
+ - VS Code shows inline hints for error-prone patterns
258
+ - Memory records "things that break"
259
+
260
+ 3. **MCP tool usage informs API endpoints**:
261
+ - Track which MCP tools get called most
262
+ - API surfaces those as quick actions
263
+ - Memory records "frequently needed operations"
264
+
265
+ ---
266
+
267
+ ### Pillar 5: Unified Dashboard
268
+
269
+ **Current State**: Separate dashboard (React) and VS Code panel.
270
+
271
+ **Target State**: Single dashboard usable everywhere.
272
+
273
+ **Implementation Options**:
274
+
275
+ 1. **Web Components**: Build dashboard as reusable web components
276
+ - Works in standalone browser
277
+ - Embeds in VS Code webview
278
+ - Embeds in CLI TUI (via webview bridge)
279
+
280
+ 2. **API-First Dashboard**: Dashboard is just an API client
281
+ - All state from API server
282
+ - Multiple frontends (React, VS Code, TUI)
283
+ - Real-time via SSE
284
+
285
+ **Unified Dashboard Features**:
286
+ - Task Kanban board
287
+ - Memory browser (episodic, semantic, procedural)
288
+ - Metrics visualization
289
+ - Real-time log streaming
290
+ - Session control (start/stop/pause)
291
+ - Provider switching
292
+ - PRD viewer/editor
293
+
294
+ ---
295
+
296
+ ## Implementation Phases
297
+
298
+ ### Phase 1: Event Bus Foundation (v5.17.0)
299
+
300
+ **Tasks**:
301
+ 1. Create `events/` module with file-based event bus
302
+ 2. Add event emission to CLI commands
303
+ 3. Add event emission to API routes
304
+ 4. Add event subscription to VS Code extension
305
+ 5. Add event emission to MCP tools
306
+
307
+ **Files to Create/Modify**:
308
+ - `events/bus.py` - Core event bus (Python)
309
+ - `events/bus.ts` - TypeScript client
310
+ - `autonomy/loki` - Add event emission
311
+ - `api/services/event-bus.ts` - Integrate with existing
312
+ - `vscode-extension/src/events/` - Subscribe to events
313
+
314
+ **Deliverable**: All components can see events from all other components.
315
+
316
+ ---
317
+
318
+ ### Phase 2: Memory Integration (v5.18.0)
319
+
320
+ **Tasks**:
321
+ 1. Create unified memory access layer
322
+ 2. Add memory context to VS Code sidebar
323
+ 3. Add memory retrieval to CLI start
324
+ 4. Add automatic context loading to MCP
325
+ 5. Add memory-informed suggestions to API
326
+
327
+ **Files to Create/Modify**:
328
+ - `memory/unified_access.py` - Unified interface
329
+ - `vscode-extension/src/views/memoryView.ts` - Memory panel
330
+ - `autonomy/loki` - Memory-informed startup
331
+ - `mcp/server.py` - Auto-load context
332
+ - `api/routes/suggestions.ts` - Memory-based suggestions
333
+
334
+ **Deliverable**: Memory informs all tools; all tools contribute to memory.
335
+
336
+ ---
337
+
338
+ ### Phase 3: Smart Sync (v5.19.0)
339
+
340
+ **Tasks**:
341
+ 1. Create centralized state manager
342
+ 2. Replace direct file reads with state manager
343
+ 3. Add optimistic updates with conflict resolution
344
+ 4. Add state versioning for rollback
345
+
346
+ **Files to Create/Modify**:
347
+ - `state/manager.ts` - State manager
348
+ - `state/manager.py` - Python bindings
349
+ - All components: Use state manager
350
+
351
+ **Deliverable**: Single source of truth for all state.
352
+
353
+ ---
354
+
355
+ ### Phase 4: Cross-Tool Learning (v5.20.0)
356
+
357
+ **Tasks**:
358
+ 1. Define learning signal types
359
+ 2. Implement learning collectors in each tool
360
+ 3. Create learning aggregator
361
+ 4. Add learning-based suggestions
362
+ 5. Add learning metrics dashboard
363
+
364
+ **Files to Create/Modify**:
365
+ - `learning/signals.py` - Signal definitions
366
+ - `learning/aggregator.py` - Aggregation logic
367
+ - All components: Emit learning signals
368
+
369
+ **Deliverable**: Tools learn from each other and improve over time.
370
+
371
+ ---
372
+
373
+ ### Phase 5: Unified Dashboard (v5.21.0)
374
+
375
+ **Tasks**:
376
+ 1. Extract dashboard components as standalone
377
+ 2. Create VS Code webview integration
378
+ 3. Create CLI webview bridge (optional)
379
+ 4. Unify styling and behavior
380
+
381
+ **Files to Create/Modify**:
382
+ - `dashboard/components/` - Reusable components
383
+ - `vscode-extension/src/views/dashboardView.ts` - Embed dashboard
384
+
385
+ **Deliverable**: Same dashboard experience everywhere.
386
+
387
+ ---
388
+
389
+ ## Success Metrics
390
+
391
+ | Metric | Current | Target |
392
+ |--------|---------|--------|
393
+ | Cross-tool event latency | N/A | <100ms |
394
+ | Memory utilization (tools using memory) | 2/5 (40%) | 5/5 (100%) |
395
+ | State sync conflicts | Unknown | <1/day |
396
+ | Learning signal coverage | 0% | 80%+ |
397
+ | Dashboard feature parity | 50% | 100% |
398
+ | User task completion time | Baseline | -30% |
399
+ | Context switching (tool changes) | Frequent | Minimal |
400
+
401
+ ---
402
+
403
+ ## Competitive Advantages
404
+
405
+ After implementing synergy:
406
+
407
+ | Feature | Loki Mode | claude-flow | Auto-Claude |
408
+ |---------|-----------|-------------|-------------|
409
+ | Unified memory across tools | Yes | No | No |
410
+ | Cross-tool event propagation | Yes | Partial | No |
411
+ | Smart state synchronization | Yes | No | No |
412
+ | Learning from all interactions | Yes | No | No |
413
+ | Single dashboard everywhere | Yes | No | No |
414
+ | Token economics visibility | Yes | No | No |
415
+
416
+ ---
417
+
418
+ ## Quick Wins (Can Implement Now)
419
+
420
+ 1. **VS Code -> Memory**: Record file edits as episodes
421
+ 2. **CLI -> Events**: Emit events on command execution
422
+ 3. **API -> Memory**: Return relevant patterns with status
423
+ 4. **MCP -> Events**: Emit tool call events
424
+ 5. **Memory -> API**: Add suggestions endpoint
425
+
426
+ These quick wins can be implemented without major architectural changes and provide immediate value.
427
+
428
+ ---
429
+
430
+ ## Architecture Decision Records
431
+
432
+ ### ADR-001: File-Based Event Bus
433
+
434
+ **Context**: Need cross-process event propagation.
435
+
436
+ **Decision**: Use file-based pub/sub (.loki/events/) with file watching.
437
+
438
+ **Rationale**:
439
+ - Works across Python, Node, Bash
440
+ - Persists events for replay
441
+ - No additional dependencies
442
+ - Natural integration with .loki/ directory
443
+
444
+ **Alternatives Considered**:
445
+ - Unix sockets (complex, not cross-platform)
446
+ - Redis (external dependency)
447
+ - HTTP polling (high overhead)
448
+
449
+ ### ADR-002: Memory as Single Source of Context
450
+
451
+ **Context**: Tools need shared context but have different runtimes.
452
+
453
+ **Decision**: Memory system is the canonical context store.
454
+
455
+ **Rationale**:
456
+ - Already has Python implementation
457
+ - Supports progressive disclosure (tokens)
458
+ - Natural place for learnings
459
+ - Can serve all tools via file reads or API
460
+
461
+ **Alternatives Considered**:
462
+ - Distributed state (complex)
463
+ - Per-tool context (fragmented)
464
+ - External database (dependency)
465
+
466
+ ---
467
+
468
+ ## Next Steps
469
+
470
+ 1. Review and approve this roadmap
471
+ 2. Create GitHub issues for each phase
472
+ 3. Begin Phase 1 implementation
473
+ 4. Establish weekly synergy metrics review
474
+
475
+ ---
476
+
477
+ *Document Version: 1.0*
478
+ *Last Updated: 2026-02-03*
479
+ *Authored by: Loki Mode Development Team*