@ekkos/cli 1.3.1 → 1.3.5

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 (131) hide show
  1. package/dist/capture/jsonl-rewriter.d.ts +1 -1
  2. package/dist/capture/jsonl-rewriter.js +3 -3
  3. package/dist/capture/transcript-repair.d.ts +2 -2
  4. package/dist/capture/transcript-repair.js +2 -2
  5. package/dist/commands/claw.d.ts +13 -0
  6. package/dist/commands/claw.js +253 -0
  7. package/dist/commands/dashboard.js +742 -118
  8. package/dist/commands/doctor.d.ts +3 -3
  9. package/dist/commands/doctor.js +6 -79
  10. package/dist/commands/gemini.d.ts +19 -0
  11. package/dist/commands/gemini.js +193 -0
  12. package/dist/commands/init.d.ts +1 -0
  13. package/dist/commands/init.js +56 -41
  14. package/dist/commands/run.d.ts +0 -1
  15. package/dist/commands/run.js +288 -263
  16. package/dist/commands/scan.d.ts +21 -0
  17. package/dist/commands/scan.js +386 -0
  18. package/dist/commands/status.d.ts +4 -1
  19. package/dist/commands/status.js +165 -27
  20. package/dist/commands/swarm-dashboard.js +156 -28
  21. package/dist/commands/swarm.d.ts +1 -1
  22. package/dist/commands/swarm.js +1 -1
  23. package/dist/commands/test-claude.d.ts +2 -2
  24. package/dist/commands/test-claude.js +3 -3
  25. package/dist/deploy/index.d.ts +0 -2
  26. package/dist/deploy/index.js +0 -2
  27. package/dist/deploy/settings.d.ts +6 -5
  28. package/dist/deploy/settings.js +64 -16
  29. package/dist/deploy/skills.js +1 -2
  30. package/dist/index.js +86 -96
  31. package/dist/lib/usage-parser.d.ts +1 -1
  32. package/dist/lib/usage-parser.js +9 -6
  33. package/dist/local/index.d.ts +14 -0
  34. package/dist/local/index.js +28 -0
  35. package/dist/local/local-embeddings.d.ts +49 -0
  36. package/dist/local/local-embeddings.js +232 -0
  37. package/dist/local/offline-fallback.d.ts +44 -0
  38. package/dist/local/offline-fallback.js +159 -0
  39. package/dist/local/sqlite-store.d.ts +126 -0
  40. package/dist/local/sqlite-store.js +393 -0
  41. package/dist/local/sync-engine.d.ts +42 -0
  42. package/dist/local/sync-engine.js +223 -0
  43. package/dist/utils/platform.d.ts +5 -1
  44. package/dist/utils/platform.js +24 -4
  45. package/dist/utils/proxy-url.d.ts +21 -0
  46. package/dist/utils/proxy-url.js +34 -0
  47. package/dist/utils/state.d.ts +1 -1
  48. package/dist/utils/state.js +11 -3
  49. package/dist/utils/templates.js +1 -1
  50. package/package.json +11 -4
  51. package/templates/CLAUDE.md +49 -107
  52. package/dist/agent/daemon.d.ts +0 -130
  53. package/dist/agent/daemon.js +0 -606
  54. package/dist/agent/health-check.d.ts +0 -35
  55. package/dist/agent/health-check.js +0 -243
  56. package/dist/agent/pty-runner.d.ts +0 -53
  57. package/dist/agent/pty-runner.js +0 -190
  58. package/dist/commands/agent.d.ts +0 -50
  59. package/dist/commands/agent.js +0 -544
  60. package/dist/commands/setup-remote.d.ts +0 -20
  61. package/dist/commands/setup-remote.js +0 -582
  62. package/dist/utils/verify-remote-terminal.d.ts +0 -10
  63. package/dist/utils/verify-remote-terminal.js +0 -415
  64. package/templates/README.md +0 -378
  65. package/templates/claude-plugins/PHASE2_COMPLETION.md +0 -346
  66. package/templates/claude-plugins/PLUGIN_PROPOSALS.md +0 -1776
  67. package/templates/claude-plugins/README.md +0 -587
  68. package/templates/claude-plugins/agents/code-reviewer.json +0 -14
  69. package/templates/claude-plugins/agents/debug-detective.json +0 -15
  70. package/templates/claude-plugins/agents/git-companion.json +0 -14
  71. package/templates/claude-plugins/blog-manager/.claude-plugin/plugin.json +0 -8
  72. package/templates/claude-plugins/blog-manager/commands/blog.md +0 -691
  73. package/templates/claude-plugins/golden-loop-monitor/.claude-plugin/plugin.json +0 -8
  74. package/templates/claude-plugins/golden-loop-monitor/commands/loop-status.md +0 -434
  75. package/templates/claude-plugins/learning-tracker/.claude-plugin/plugin.json +0 -8
  76. package/templates/claude-plugins/learning-tracker/commands/my-patterns.md +0 -282
  77. package/templates/claude-plugins/memory-lens/.claude-plugin/plugin.json +0 -8
  78. package/templates/claude-plugins/memory-lens/commands/memory-search.md +0 -181
  79. package/templates/claude-plugins/pattern-coach/.claude-plugin/plugin.json +0 -8
  80. package/templates/claude-plugins/pattern-coach/commands/forge.md +0 -365
  81. package/templates/claude-plugins/project-schema-validator/.claude-plugin/plugin.json +0 -8
  82. package/templates/claude-plugins/project-schema-validator/commands/validate-schema.md +0 -582
  83. package/templates/claude-plugins-admin/AGENT_TEAM_PROPOSALS.md +0 -819
  84. package/templates/claude-plugins-admin/README.md +0 -446
  85. package/templates/claude-plugins-admin/autonomous-admin-agent/.claude-plugin/plugin.json +0 -8
  86. package/templates/claude-plugins-admin/autonomous-admin-agent/commands/agent.md +0 -595
  87. package/templates/claude-plugins-admin/backend-agent/.claude-plugin/plugin.json +0 -8
  88. package/templates/claude-plugins-admin/backend-agent/commands/backend.md +0 -798
  89. package/templates/claude-plugins-admin/deploy-guardian/.claude-plugin/plugin.json +0 -8
  90. package/templates/claude-plugins-admin/deploy-guardian/commands/deploy.md +0 -554
  91. package/templates/claude-plugins-admin/frontend-agent/.claude-plugin/plugin.json +0 -8
  92. package/templates/claude-plugins-admin/frontend-agent/commands/frontend.md +0 -881
  93. package/templates/claude-plugins-admin/mcp-server-manager/.claude-plugin/plugin.json +0 -8
  94. package/templates/claude-plugins-admin/mcp-server-manager/commands/mcp.md +0 -85
  95. package/templates/claude-plugins-admin/memory-system-monitor/.claude-plugin/plugin.json +0 -8
  96. package/templates/claude-plugins-admin/memory-system-monitor/commands/memory-health.md +0 -569
  97. package/templates/claude-plugins-admin/qa-agent/.claude-plugin/plugin.json +0 -8
  98. package/templates/claude-plugins-admin/qa-agent/commands/qa.md +0 -863
  99. package/templates/claude-plugins-admin/tech-lead-agent/.claude-plugin/plugin.json +0 -8
  100. package/templates/claude-plugins-admin/tech-lead-agent/commands/lead.md +0 -732
  101. package/templates/commands/continue.md +0 -47
  102. package/templates/cursor-rules/ekkos-memory.md +0 -127
  103. package/templates/ekkos-manifest.json +0 -223
  104. package/templates/helpers/json-parse.cjs +0 -101
  105. package/templates/hooks-node/lib/state.js +0 -187
  106. package/templates/hooks-node/stop.js +0 -416
  107. package/templates/hooks-node/user-prompt-submit.js +0 -337
  108. package/templates/plan-template.md +0 -306
  109. package/templates/rules/00-hooks-contract.mdc +0 -89
  110. package/templates/rules/30-ekkos-core.mdc +0 -188
  111. package/templates/rules/31-ekkos-messages.mdc +0 -78
  112. package/templates/shared/hooks-enabled.json +0 -22
  113. package/templates/shared/session-words.json +0 -45
  114. package/templates/skills/ekkOS_Deep_Recall/Skill.md +0 -282
  115. package/templates/skills/ekkOS_Learn/Skill.md +0 -265
  116. package/templates/skills/ekkOS_Memory_First/Skill.md +0 -206
  117. package/templates/skills/ekkOS_Plan_Assist/Skill.md +0 -302
  118. package/templates/skills/ekkOS_Preferences/Skill.md +0 -247
  119. package/templates/skills/ekkOS_Reflect/Skill.md +0 -257
  120. package/templates/skills/ekkOS_Safety/Skill.md +0 -265
  121. package/templates/skills/ekkOS_Schema/Skill.md +0 -251
  122. package/templates/skills/ekkOS_Summary/Skill.md +0 -257
  123. package/templates/spec-template.md +0 -159
  124. package/templates/windsurf-rules/ekkos-memory.md +0 -127
  125. package/templates/windsurf-skills/README.md +0 -58
  126. package/templates/windsurf-skills/ekkos-continue/SKILL.md +0 -81
  127. package/templates/windsurf-skills/ekkos-golden-loop/SKILL.md +0 -225
  128. package/templates/windsurf-skills/ekkos-insights/SKILL.md +0 -138
  129. package/templates/windsurf-skills/ekkos-recall/SKILL.md +0 -96
  130. package/templates/windsurf-skills/ekkos-safety/SKILL.md +0 -89
  131. package/templates/windsurf-skills/ekkos-vault/SKILL.md +0 -86
@@ -48,18 +48,38 @@ function detectInstalledIDEs() {
48
48
  return ides;
49
49
  }
50
50
  /**
51
- * Get the current running IDE from environment
51
+ * Get the current running IDE from environment variables and cwd directory markers.
52
+ * Checks (in priority order):
53
+ * 1. Dedicated IDE env vars (CURSOR_USER_ID, VSCODE_INJECTION, CODEIUM_USER_ID, CLAUDE_CODE)
54
+ * 2. TERM_PROGRAM / TERMINAL_EMULATOR
55
+ * 3. Project-local directory markers (.cursor/, .windsurf/, .vscode/ in cwd)
52
56
  */
53
57
  function detectCurrentIDE() {
58
+ // 1. Dedicated env vars — most reliable signal
59
+ if (process.env.CURSOR_USER_ID)
60
+ return 'cursor';
61
+ if (process.env.CODEIUM_USER_ID)
62
+ return 'windsurf';
63
+ if (process.env.VSCODE_INJECTION || process.env.VSCODE_IPC_HOOK_CLI)
64
+ return 'claude'; // Claude Code runs inside VS Code
65
+ if (process.env.CLAUDE_CODE)
66
+ return 'claude';
67
+ // 2. TERM_PROGRAM / TERMINAL_EMULATOR
54
68
  const termProgram = process.env.TERM_PROGRAM?.toLowerCase() || '';
55
69
  const termEmulator = process.env.TERMINAL_EMULATOR?.toLowerCase() || '';
56
70
  if (termProgram.includes('cursor'))
57
71
  return 'cursor';
58
- if (termProgram.includes('vscode') || termEmulator.includes('vscode'))
59
- return 'vscode';
60
72
  if (termProgram.includes('windsurf') || termProgram.includes('codeium'))
61
73
  return 'windsurf';
62
- if (process.env.CLAUDE_CODE)
74
+ if (termProgram.includes('vscode') || termEmulator.includes('vscode'))
63
75
  return 'claude';
76
+ // 3. Project-local directory markers (cwd)
77
+ const cwd = process.cwd();
78
+ if ((0, fs_1.existsSync)((0, path_1.join)(cwd, '.cursor')))
79
+ return 'cursor';
80
+ if ((0, fs_1.existsSync)((0, path_1.join)(cwd, '.windsurf')))
81
+ return 'windsurf';
82
+ if ((0, fs_1.existsSync)((0, path_1.join)(cwd, '.vscode')))
83
+ return 'claude'; // VS Code / Claude Code
64
84
  return null;
65
85
  }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Shared proxy URL builder for ekkOS proxy integration
3
+ * Used by: commands/run.ts, commands/test-claude.ts, commands/gemini.ts
4
+ */
5
+ export declare const EKKOS_PROXY_URL: string;
6
+ /**
7
+ * Build a fully-qualified proxy URL with user/session binding params.
8
+ * Format: https://proxy.ekkos.dev/proxy/{userId}/{sessionName}?project={base64(cwd)}&sid={sessionId}&tz={tz}
9
+ *
10
+ * Used by Claude (Anthropic SDK handles query params correctly).
11
+ */
12
+ export declare function buildProxyUrl(userId: string, sessionName: string, projectPath: string, sessionId: string): string;
13
+ /**
14
+ * Build a proxy URL without query params — metadata encoded in path segments.
15
+ * Format: https://proxy.ekkos.dev/gproxy/{userId}/{sessionName}/{sid}/{project64}
16
+ *
17
+ * Required for Gemini: @google/genai SDK concatenates baseUrl + path with string
18
+ * joining, so query params in the base URL get corrupted. This variant keeps the
19
+ * base URL clean so the SDK can append /v1beta1/... correctly.
20
+ */
21
+ export declare function buildGeminiProxyUrl(userId: string, sessionName: string, projectPath: string, sessionId: string): string;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ /**
3
+ * Shared proxy URL builder for ekkOS proxy integration
4
+ * Used by: commands/run.ts, commands/test-claude.ts, commands/gemini.ts
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.EKKOS_PROXY_URL = void 0;
8
+ exports.buildProxyUrl = buildProxyUrl;
9
+ exports.buildGeminiProxyUrl = buildGeminiProxyUrl;
10
+ // eslint-disable-next-line no-restricted-syntax -- Config URL, not API key
11
+ exports.EKKOS_PROXY_URL = process.env.EKKOS_PROXY_URL || 'https://proxy.ekkos.dev';
12
+ /**
13
+ * Build a fully-qualified proxy URL with user/session binding params.
14
+ * Format: https://proxy.ekkos.dev/proxy/{userId}/{sessionName}?project={base64(cwd)}&sid={sessionId}&tz={tz}
15
+ *
16
+ * Used by Claude (Anthropic SDK handles query params correctly).
17
+ */
18
+ function buildProxyUrl(userId, sessionName, projectPath, sessionId) {
19
+ const projectPathEncoded = Buffer.from(projectPath).toString('base64url');
20
+ const userTz = Intl.DateTimeFormat().resolvedOptions().timeZone;
21
+ return `${exports.EKKOS_PROXY_URL}/proxy/${encodeURIComponent(userId)}/${encodeURIComponent(sessionName)}?project=${projectPathEncoded}&sid=${encodeURIComponent(sessionId)}&tz=${encodeURIComponent(userTz)}`;
22
+ }
23
+ /**
24
+ * Build a proxy URL without query params — metadata encoded in path segments.
25
+ * Format: https://proxy.ekkos.dev/gproxy/{userId}/{sessionName}/{sid}/{project64}
26
+ *
27
+ * Required for Gemini: @google/genai SDK concatenates baseUrl + path with string
28
+ * joining, so query params in the base URL get corrupted. This variant keeps the
29
+ * base URL clean so the SDK can append /v1beta1/... correctly.
30
+ */
31
+ function buildGeminiProxyUrl(userId, sessionName, projectPath, sessionId) {
32
+ const projectPathEncoded = Buffer.from(projectPath).toString('base64url');
33
+ return `${exports.EKKOS_PROXY_URL}/gproxy/${encodeURIComponent(userId)}/${encodeURIComponent(sessionName)}/${encodeURIComponent(sessionId)}/${projectPathEncoded}`;
34
+ }
@@ -76,7 +76,7 @@ export declare function getMostRecentSession(): {
76
76
  lastActive: string;
77
77
  } | null;
78
78
  /**
79
- * Get all active sessions (filters out stale ones with dead PIDs)
79
+ * Get all active sessions (filters out stale ones with dead PIDs or old heartbeats)
80
80
  */
81
81
  export declare function getActiveSessions(): ActiveSession[];
82
82
  /**
@@ -253,7 +253,7 @@ function getMostRecentSession() {
253
253
  // Track multiple concurrent Claude Code sessions without state collision
254
254
  // ═══════════════════════════════════════════════════════════════════════════
255
255
  /**
256
- * Get all active sessions (filters out stale ones with dead PIDs)
256
+ * Get all active sessions (filters out stale ones with dead PIDs or old heartbeats)
257
257
  */
258
258
  function getActiveSessions() {
259
259
  ensureEkkosDir();
@@ -263,8 +263,16 @@ function getActiveSessions() {
263
263
  }
264
264
  const content = fs.readFileSync(exports.ACTIVE_SESSIONS_FILE, 'utf-8');
265
265
  const sessions = JSON.parse(content);
266
- // Filter out sessions with dead PIDs
267
- const alive = sessions.filter(s => isProcessAlive(s.pid));
266
+ const now = Date.now();
267
+ const STALE_MS = 12 * 60 * 60 * 1000; // 12 hours — no heartbeat = stale
268
+ // Filter out sessions with dead PIDs or stale heartbeats
269
+ const alive = sessions.filter(s => {
270
+ // Check heartbeat staleness first (cheap, no syscall)
271
+ const lastBeat = new Date(s.lastHeartbeat).getTime();
272
+ if (now - lastBeat > STALE_MS)
273
+ return false;
274
+ return isProcessAlive(s.pid);
275
+ });
268
276
  // If we filtered any out, update the file
269
277
  if (alive.length !== sessions.length) {
270
278
  fs.writeFileSync(exports.ACTIVE_SESSIONS_FILE, JSON.stringify(alive, null, 2));
@@ -21,7 +21,7 @@ function getTemplatePath(...paths) {
21
21
  * Check if templates exist
22
22
  */
23
23
  function templatesExist() {
24
- return (0, fs_1.existsSync)(TEMPLATES_DIR) && (0, fs_1.existsSync)(getTemplatePath('hooks'));
24
+ return (0, fs_1.existsSync)(TEMPLATES_DIR) && (0, fs_1.existsSync)(getTemplatePath('CLAUDE.md'));
25
25
  }
26
26
  /**
27
27
  * Read a template file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ekkos/cli",
3
- "version": "1.3.1",
3
+ "version": "1.3.5",
4
4
  "description": "Setup ekkOS memory for AI coding assistants (Claude Code, Cursor, Windsurf)",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -10,7 +10,7 @@
10
10
  },
11
11
  "scripts": {
12
12
  "build": "tsc",
13
- "dev": "ts-node src/index.ts",
13
+ "dev": "tsx src/index.ts",
14
14
  "prepack": "node scripts/build-templates.js prepack",
15
15
  "postpack": "node scripts/build-templates.js postpack",
16
16
  "prepublishOnly": "npm run build"
@@ -28,7 +28,9 @@
28
28
  "author": "ekkOS",
29
29
  "license": "MIT",
30
30
  "dependencies": {
31
+ "@ekkos/prometheus": "workspace:*",
31
32
  "@supabase/supabase-js": "^2.39.8",
33
+ "axios": "^1.7.0",
32
34
  "blessed": "^0.1.81",
33
35
  "blessed-contrib": "^4.11.0",
34
36
  "ccusage": "^18.0.5",
@@ -38,7 +40,11 @@
38
40
  "node-pty": "1.2.0-beta.7",
39
41
  "open": "^10.0.0",
40
42
  "ora": "^8.0.1",
41
- "ws": "^8.19.0"
43
+ "qrcode-terminal": "^0.12.0",
44
+ "socket.io-client": "^4.8.0",
45
+ "tweetnacl": "^1.0.3",
46
+ "ws": "^8.19.0",
47
+ "zod": "^3.23.0"
42
48
  },
43
49
  "devDependencies": {
44
50
  "@types/blessed": "^0.1.27",
@@ -50,6 +56,7 @@
50
56
  },
51
57
  "files": [
52
58
  "dist",
53
- "templates"
59
+ "templates/CLAUDE.md",
60
+ "templates/skills"
54
61
  ]
55
62
  }
@@ -1,18 +1,28 @@
1
1
  # ekkOS_ Memory System
2
2
 
3
- ## The Golden Loop
3
+ ## What is ekkOS?
4
4
 
5
- ekkOS is your AI's cognitive memory. It learns from every session so you get smarter over time.
6
-
7
- - **Remember mistakes** — Schema changes, wrong assumptions, bad approaches
8
- - **Don't repeat them** — If something broke before, know not to do it again
9
- - **Recall what's right** — When schemas/configs get mangled, remember the correct version
10
- - **Build on what worked** — Use proven patterns instead of starting from scratch
5
+ ekkOS is persistent memory for your AI coding assistant. It learns from every session — remembering mistakes, proven solutions, your preferences, and project context — so your AI gets smarter over time.
11
6
 
12
7
  **Failures are just as valuable as successes.** Forge anti-patterns too.
13
8
 
14
9
  ---
15
10
 
11
+ ## How It Works
12
+
13
+ ekkOS uses **proxy injection** to transparently enrich your conversations with relevant context. You don't need to do anything special — the proxy automatically:
14
+
15
+ - Injects **relevant patterns** from past sessions when you ask technical questions
16
+ - Injects **your directives** (MUST/NEVER/PREFER/AVOID rules) so your AI follows your preferences
17
+ - Injects **episodic recall** when you reference past conversations ("yesterday", "last week")
18
+ - Injects **schema context** when working with databases
19
+ - **Auto-forges patterns** when it detects bug fixes or learned solutions
20
+ - Injects **active goals** and plan progress
21
+
22
+ You also have **MCP tools** for explicit memory operations when needed.
23
+
24
+ ---
25
+
16
26
  ## Core Rules
17
27
 
18
28
  ### RULE 1: SEARCH BEFORE ANSWERING
@@ -20,9 +30,9 @@ Before answering ANY technical question, call `ekkOS_Search` first.
20
30
  Do not skip this. Do not assume you know the answer.
21
31
 
22
32
  ### RULE 2: ACKNOWLEDGE PATTERNS (PatternGuard)
23
- When patterns are retrieved, you MUST acknowledge every pattern — either use it or skip it.
33
+ When patterns are retrieved (via proxy injection or search), acknowledge every pattern — either use it or skip it.
24
34
 
25
- **Exception:** Suppress SELECT/SKIP blocks for non-technical turns (acknowledgments, affirmations, short replies).
35
+ **Exception:** Suppress SELECT/SKIP blocks for non-technical turns.
26
36
 
27
37
  **For patterns you USE:**
28
38
  ```
@@ -43,115 +53,54 @@ When patterns are retrieved, you MUST acknowledge every pattern — either use i
43
53
 
44
54
  ### RULE 3: FORGE WHAT YOU LEARN
45
55
  When you fix a bug, get corrected, or learn something new, call `ekkOS_Forge` immediately.
46
-
47
- When something DOES NOT work, forge it as an anti-pattern — failures are valuable.
56
+ Failures are valuable — forge anti-patterns too.
48
57
 
49
58
  ### RULE 4: CONTEXT CONTINUITY
50
59
 
51
- **Post-clear restoration:** After `/clear`, when you see restored turns in `<system-reminder>`, confirm with:
60
+ **Post-clear restoration:** After `/clear`, when you see restored turns in `<system-reminder>`, confirm:
52
61
  ```
53
62
  ✓ **Session continued (Turn N)** — X turns preserved, context restored
54
63
  ```
55
64
 
56
- **Auto-restore after compaction:** When you see `<ekkos-context-preserved>` in the conversation:
65
+ **Auto-restore after compaction:** When you see `<ekkos-context-preserved>`:
57
66
  1. Call `ekkOS_RestoreContext` with the `restoration_token` from the tag
58
- 2. Confirm with:
59
- ```
60
- ✓ **Context restored** — ekkOS preserved X turns before compaction
61
- ```
62
-
63
- ekkOS preserves your working memory automatically. When context is compacted, call `ekkOS_RestoreContext` to get it back seamlessly.
67
+ 2. Confirm: `✓ **Context restored** — ekkOS preserved X turns before compaction`
64
68
 
65
69
  ---
66
70
 
67
- ## 11-Layer Memory Architecture
68
-
69
- | # | Layer | What It Stores |
70
- |---|-------|---------------|
71
- | 1 | Working | Current session state |
72
- | 2 | Episodic | Past conversations |
73
- | 3 | Semantic | Embeddings & knowledge |
74
- | 4 | Patterns | Proven solutions |
75
- | 5 | Procedural | Step-by-step guides |
76
- | 6 | Collective | Cross-project wisdom |
77
- | 7 | Meta | Pattern effectiveness |
78
- | 8 | Codebase | Project-specific code |
79
- | 9 | Directives | User rules (MUST/NEVER/PREFER/AVOID) |
80
- | 10 | Conflict | Auto-resolves contradictions |
81
- | 11 | Secrets | Encrypted credentials (AES-256-GCM) |
71
+ ## MCP Tools
82
72
 
83
- ---
84
-
85
- ## MCP Tools — 29 Visible
86
-
87
- ### Core Memory (6)
88
- | Tool | Description |
89
- |------|-------------|
90
- | `ekkOS_Search` | Search across all 11 memory layers |
91
- | `ekkOS_Forge` | Create pattern from learned solution |
92
- | `ekkOS_Track` | Track when a pattern is applied |
93
- | `ekkOS_Outcome` | Record if pattern worked or failed |
94
- | `ekkOS_Stats` | Get statistics for all layers |
95
- | `ekkOS_Context` | Get relevant context for a task |
96
-
97
- ### Retrieval (4)
98
- | Tool | Description |
73
+ ### Core Memory
74
+ | Tool | When to Use |
99
75
  |------|-------------|
100
- | `ekkOS_Codebase` | Search project code embeddings |
101
- | `ekkOS_Recall` | Recall past conversations by time |
102
- | `ekkOS_PreserveContext` | Preserve working memory before compaction |
103
- | `ekkOS_RestoreContext` | Restore context after compaction |
76
+ | `ekkOS_Search` | Before answering technical questions |
77
+ | `ekkOS_Forge` | After fixing bugs, learning something new |
78
+ | `ekkOS_Track` | When applying a retrieved pattern |
79
+ | `ekkOS_Outcome` | When a pattern worked or failed |
104
80
 
105
- ### Directives (4)
106
- | Tool | Description |
81
+ ### Directives
82
+ | Tool | When to Use |
107
83
  |------|-------------|
108
- | `ekkOS_Directive` | Create MUST/NEVER/PREFER/AVOID rules |
109
- | `ekkOS_UpdateDirective` | Update an existing directive |
110
- | `ekkOS_DeleteDirective` | Remove a directive |
111
- | `ekkOS_UniversalDirectives` | Get directives that apply across all projects |
84
+ | `ekkOS_Directive` | User says "always" → MUST, "never" → NEVER, "prefer" → PREFER, "avoid" → AVOID |
85
+ | `ekkOS_Conflict` | Before deleting files, deploying, destructive commands |
112
86
 
113
- ### Utility (5)
114
- | Tool | Description |
87
+ ### Plans
88
+ | Tool | When to Use |
115
89
  |------|-------------|
116
- | `ekkOS_Summary` | Get summary of recent memory activity |
117
- | `ekkOS_Conflict` | Check for conflicts before destructive actions |
118
- | `ekkOS_Export` | Export patterns, directives, plans as JSON backup |
119
- | `ekkOS_Import` | Import memory from backup (auto-deduplication) |
120
- | `ekkOS_Health` | System health check |
121
-
122
- ### Plans (5)
123
- | Tool | Description |
124
- |------|-------------|
125
- | `ekkOS_Plan` | Create structured task plan |
126
- | `ekkOS_Plans` | List your plans |
127
- | `ekkOS_PlanStatus` | Update plan status |
128
- | `ekkOS_PlanStep` | Mark step complete/incomplete |
129
- | `ekkOS_Generate` | AI-generate plan from context |
130
-
131
- ### Secrets (5)
132
- | Tool | Description |
133
- |------|-------------|
134
- | `ekkOS_StoreSecret` | Encrypt and store sensitive data |
135
- | `ekkOS_GetSecret` | Retrieve and decrypt a secret |
136
- | `ekkOS_ListSecrets` | List secrets metadata (no values exposed) |
137
- | `ekkOS_DeleteSecret` | Permanently delete a secret |
138
- | `ekkOS_RotateSecret` | Update a secret with a new value |
90
+ | `ekkOS_Plan` | Task has 3+ steps |
91
+ | `ekkOS_PlanStep` | Mark step complete |
139
92
 
140
- ---
141
-
142
- ## When To Use What
143
-
144
- | Tool | Trigger |
145
- |------|---------|
146
- | `ekkOS_Search` | Technical question, past discussion, architecture decision, debugging |
147
- | `ekkOS_Forge` | Bug fixed, better approach found, gotcha discovered, user corrected you, anti-pattern |
148
- | `ekkOS_Directive` | User says "always" → MUST, "never" → NEVER, "I prefer" → PREFER, "avoid" → AVOID |
149
- | `ekkOS_Conflict` | Before deleting files, deploying to production, modifying config, destructive commands |
150
- | Plan tools | Task has 3+ steps, "help me implement...", complex feature request |
151
- | Secret tools | User shares API key/token/password, need stored credentials |
152
- | `ekkOS_Recall` | User says "yesterday", "last week", "remember when", "what did we discuss" |
93
+ ### Secrets
94
+ | Tool | When to Use |
95
+ |------|-------------|
96
+ | `ekkOS_StoreSecret` | User shares API key, token, password |
97
+ | `ekkOS_GetSecret` | Need a stored credential |
153
98
 
154
- Directives are created when you explicitly request them (e.g., "always use TypeScript").
99
+ ### Context
100
+ | Tool | When to Use |
101
+ |------|-------------|
102
+ | `ekkOS_RestoreContext` | See `<ekkos-context-preserved>` tag |
103
+ | `ekkOS_Recall` | "Yesterday", "last week", "remember when..." |
155
104
 
156
105
  ---
157
106
 
@@ -164,12 +113,7 @@ Every response ends with:
164
113
  ```
165
114
 
166
115
  - **Session name** comes from the `<ekkos-session>` tag
167
- - **Timestamp** comes from the `<current-time>` tag, or use the current date/time
168
- - **IDE/Model** detected from your environment
169
-
170
- Examples:
171
- - `Claude Code (Opus 4.6) · 🧠 **ekkOS_™** · cosmic-penguin-runs · 📅 2026-01-09 4:50 PM EST`
172
- - `Cursor (Sonnet 4.5) · 🧠 **ekkOS_™** · bright-falcon-soars · 📅 2026-01-09 10:15 AM EST`
116
+ - **Timestamp** from `<current-time>` tag or current date/time
173
117
 
174
118
  ---
175
119
 
@@ -179,10 +123,8 @@ Examples:
179
123
  - Patterns retrieved → SELECT or SKIP each one
180
124
  - Problem solved → `ekkOS_Forge`
181
125
  - User preference → `ekkOS_Directive`
182
- - Need to recall → `ekkOS_Recall`
183
126
  - Destructive action → `ekkOS_Conflict` first
184
127
  - Store credentials → `ekkOS_StoreSecret`
185
- - Backup memory → `ekkOS_Export`
186
128
 
187
129
  ## Documentation
188
130
 
@@ -1,130 +0,0 @@
1
- /**
2
- * ekkOS Agent Daemon
3
- *
4
- * Background daemon that:
5
- * 1. Maintains WebSocket connection to cloud relay
6
- * 2. Receives session start requests
7
- * 3. Spawns `ekkos run -d` in PTY
8
- * 4. Relays PTY I/O to cloud
9
- */
10
- interface DaemonConfig {
11
- deviceToken: string;
12
- deviceId: string;
13
- deviceName: string;
14
- verbose?: boolean;
15
- }
16
- export declare class AgentDaemon {
17
- private config;
18
- private ws;
19
- private reconnectAttempt;
20
- private heartbeatTimer;
21
- private pongTimer;
22
- private pongReceived;
23
- private ptyRunner;
24
- private currentSessionId;
25
- private currentSessionCwd;
26
- private sessionStartedAt;
27
- private ptyRestartAttempts;
28
- private readonly QUICK_EXIT_MS;
29
- private running;
30
- private logPath;
31
- private outputBuffer;
32
- private currentSessionName;
33
- private isAutoClearInProgress;
34
- private lastContextWallTime;
35
- private readonly CONTEXT_WALL_COOLDOWN;
36
- constructor(config: DaemonConfig);
37
- /**
38
- * Start the daemon
39
- */
40
- start(): Promise<void>;
41
- /**
42
- * Stop the daemon
43
- */
44
- stop(): Promise<void>;
45
- /**
46
- * Connect to relay server
47
- */
48
- private connect;
49
- /**
50
- * Handle WebSocket open
51
- */
52
- private handleOpen;
53
- /**
54
- * Handle incoming message
55
- */
56
- private handleMessage;
57
- /**
58
- * Handle session start request
59
- */
60
- private handleSessionStart;
61
- /**
62
- * Handle session end request
63
- */
64
- private handleSessionEnd;
65
- /**
66
- * Handle input from browser
67
- */
68
- private handleInput;
69
- /**
70
- * Handle resize from browser
71
- */
72
- private handleResize;
73
- /**
74
- * Handle directory listing request from relay for project browsing UI.
75
- */
76
- private handleListDirectories;
77
- private resolveBrowsePath;
78
- private getParentPath;
79
- private getWindowsRootEntries;
80
- private resolveSessionCwd;
81
- /**
82
- * Handle PTY exit
83
- */
84
- private handlePTYExit;
85
- /**
86
- * Send PTY output to server (with auto-continue detection)
87
- */
88
- private sendOutput;
89
- /**
90
- * Trigger auto /clear + /continue when context wall is hit
91
- */
92
- private triggerAutoContinue;
93
- /**
94
- * Wait for Claude's idle prompt ("> ")
95
- */
96
- private waitForIdlePrompt;
97
- /**
98
- * Sleep helper
99
- */
100
- private sleep;
101
- /**
102
- * Start or restart PTY for the current session.
103
- */
104
- private startSessionPty;
105
- /**
106
- * Handle WebSocket close
107
- *
108
- * CRITICAL: Do NOT kill the PTY here. The PTY must survive WebSocket
109
- * disconnects so users can reconnect to their existing session.
110
- * The PTY is only killed on explicit session_end or daemon stop.
111
- */
112
- private handleClose;
113
- /**
114
- * Schedule reconnection with exponential backoff
115
- */
116
- private scheduleReconnect;
117
- /**
118
- * Handle WebSocket error
119
- */
120
- private handleError;
121
- /**
122
- * Send message to server
123
- */
124
- private sendMessage;
125
- /**
126
- * Log message
127
- */
128
- private log;
129
- }
130
- export {};