@ekkos/cli 0.2.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 (135) hide show
  1. package/dist/cache/LocalSessionStore.d.ts +129 -0
  2. package/dist/cache/LocalSessionStore.js +688 -0
  3. package/dist/cache/capture.d.ts +26 -0
  4. package/dist/cache/capture.js +461 -0
  5. package/dist/cache/index.d.ts +7 -0
  6. package/dist/cache/index.js +23 -0
  7. package/dist/cache/types.d.ts +147 -0
  8. package/dist/cache/types.js +40 -0
  9. package/dist/commands/init.d.ts +9 -0
  10. package/dist/commands/init.js +478 -0
  11. package/dist/commands/run.d.ts +12 -0
  12. package/dist/commands/run.js +829 -0
  13. package/dist/commands/setup.d.ts +6 -0
  14. package/dist/commands/setup.js +658 -0
  15. package/dist/commands/status.d.ts +1 -0
  16. package/dist/commands/status.js +109 -0
  17. package/dist/commands/test.d.ts +1 -0
  18. package/dist/commands/test.js +157 -0
  19. package/dist/deploy/agents.d.ts +15 -0
  20. package/dist/deploy/agents.js +72 -0
  21. package/dist/deploy/hooks.d.ts +16 -0
  22. package/dist/deploy/hooks.js +121 -0
  23. package/dist/deploy/index.d.ts +7 -0
  24. package/dist/deploy/index.js +24 -0
  25. package/dist/deploy/instructions.d.ts +12 -0
  26. package/dist/deploy/instructions.js +36 -0
  27. package/dist/deploy/mcp.d.ts +19 -0
  28. package/dist/deploy/mcp.js +109 -0
  29. package/dist/deploy/plugins.d.ts +19 -0
  30. package/dist/deploy/plugins.js +62 -0
  31. package/dist/deploy/settings.d.ts +8 -0
  32. package/dist/deploy/settings.js +84 -0
  33. package/dist/deploy/skills.d.ts +19 -0
  34. package/dist/deploy/skills.js +60 -0
  35. package/dist/index.d.ts +2 -0
  36. package/dist/index.js +71 -0
  37. package/dist/restore/RestoreOrchestrator.d.ts +48 -0
  38. package/dist/restore/RestoreOrchestrator.js +481 -0
  39. package/dist/restore/index.d.ts +4 -0
  40. package/dist/restore/index.js +20 -0
  41. package/dist/utils/platform.d.ts +29 -0
  42. package/dist/utils/platform.js +65 -0
  43. package/dist/utils/session-words.json +119 -0
  44. package/dist/utils/state.d.ts +57 -0
  45. package/dist/utils/state.js +186 -0
  46. package/dist/utils/templates.d.ts +24 -0
  47. package/dist/utils/templates.js +118 -0
  48. package/package.json +48 -0
  49. package/templates/CLAUDE.md +287 -0
  50. package/templates/README.md +378 -0
  51. package/templates/agents/README.md +182 -0
  52. package/templates/agents/code-reviewer.md +166 -0
  53. package/templates/agents/debug-detective.md +169 -0
  54. package/templates/agents/ekkOS_Vercel.md +99 -0
  55. package/templates/agents/extension-manager.md +229 -0
  56. package/templates/agents/git-companion.md +185 -0
  57. package/templates/agents/github-test-agent.md +321 -0
  58. package/templates/agents/railway-manager.md +179 -0
  59. package/templates/claude-plugins/PHASE2_COMPLETION.md +346 -0
  60. package/templates/claude-plugins/PLUGIN_PROPOSALS.md +1776 -0
  61. package/templates/claude-plugins/README.md +587 -0
  62. package/templates/claude-plugins/agents/code-reviewer.json +14 -0
  63. package/templates/claude-plugins/agents/debug-detective.json +15 -0
  64. package/templates/claude-plugins/agents/git-companion.json +14 -0
  65. package/templates/claude-plugins/blog-manager/.claude-plugin/plugin.json +8 -0
  66. package/templates/claude-plugins/blog-manager/commands/blog.md +691 -0
  67. package/templates/claude-plugins/golden-loop-monitor/.claude-plugin/plugin.json +8 -0
  68. package/templates/claude-plugins/golden-loop-monitor/commands/loop-status.md +434 -0
  69. package/templates/claude-plugins/learning-tracker/.claude-plugin/plugin.json +8 -0
  70. package/templates/claude-plugins/learning-tracker/commands/my-patterns.md +282 -0
  71. package/templates/claude-plugins/memory-lens/.claude-plugin/plugin.json +8 -0
  72. package/templates/claude-plugins/memory-lens/commands/memory-search.md +181 -0
  73. package/templates/claude-plugins/pattern-coach/.claude-plugin/plugin.json +8 -0
  74. package/templates/claude-plugins/pattern-coach/commands/forge.md +365 -0
  75. package/templates/claude-plugins/project-schema-validator/.claude-plugin/plugin.json +8 -0
  76. package/templates/claude-plugins/project-schema-validator/commands/validate-schema.md +582 -0
  77. package/templates/claude-plugins-admin/AGENT_TEAM_PROPOSALS.md +819 -0
  78. package/templates/claude-plugins-admin/README.md +446 -0
  79. package/templates/claude-plugins-admin/autonomous-admin-agent/.claude-plugin/plugin.json +8 -0
  80. package/templates/claude-plugins-admin/autonomous-admin-agent/commands/agent.md +595 -0
  81. package/templates/claude-plugins-admin/backend-agent/.claude-plugin/plugin.json +8 -0
  82. package/templates/claude-plugins-admin/backend-agent/commands/backend.md +798 -0
  83. package/templates/claude-plugins-admin/deploy-guardian/.claude-plugin/plugin.json +8 -0
  84. package/templates/claude-plugins-admin/deploy-guardian/commands/deploy.md +554 -0
  85. package/templates/claude-plugins-admin/frontend-agent/.claude-plugin/plugin.json +8 -0
  86. package/templates/claude-plugins-admin/frontend-agent/commands/frontend.md +881 -0
  87. package/templates/claude-plugins-admin/mcp-server-manager/.claude-plugin/plugin.json +8 -0
  88. package/templates/claude-plugins-admin/mcp-server-manager/commands/mcp.md +85 -0
  89. package/templates/claude-plugins-admin/memory-system-monitor/.claude-plugin/plugin.json +8 -0
  90. package/templates/claude-plugins-admin/memory-system-monitor/commands/memory-health.md +569 -0
  91. package/templates/claude-plugins-admin/qa-agent/.claude-plugin/plugin.json +8 -0
  92. package/templates/claude-plugins-admin/qa-agent/commands/qa.md +863 -0
  93. package/templates/claude-plugins-admin/tech-lead-agent/.claude-plugin/plugin.json +8 -0
  94. package/templates/claude-plugins-admin/tech-lead-agent/commands/lead.md +732 -0
  95. package/templates/commands/continue.md +47 -0
  96. package/templates/cursor-hooks/after-agent-response.sh +117 -0
  97. package/templates/cursor-hooks/before-submit-prompt.sh +419 -0
  98. package/templates/cursor-hooks/hooks.json +20 -0
  99. package/templates/cursor-hooks/lib/contract.sh +320 -0
  100. package/templates/cursor-hooks/stop.sh +75 -0
  101. package/templates/cursor-rules/ekkos-memory.md +187 -0
  102. package/templates/hooks/assistant-response.sh +96 -0
  103. package/templates/hooks/hooks.json +28 -0
  104. package/templates/hooks/lib/contract.sh +320 -0
  105. package/templates/hooks/lib/state.sh +158 -0
  106. package/templates/hooks/session-start.ps1 +41 -0
  107. package/templates/hooks/session-start.sh +318 -0
  108. package/templates/hooks/stop.ps1 +16 -0
  109. package/templates/hooks/stop.sh +989 -0
  110. package/templates/hooks/user-prompt-submit.ps1 +174 -0
  111. package/templates/hooks/user-prompt-submit.sh +587 -0
  112. package/templates/hooks-node/lib/state.js +187 -0
  113. package/templates/hooks-node/stop.js +416 -0
  114. package/templates/hooks-node/user-prompt-submit.js +337 -0
  115. package/templates/plan-template.md +306 -0
  116. package/templates/rules/00-hooks-contract.mdc +89 -0
  117. package/templates/rules/30-ekkos-core.mdc +188 -0
  118. package/templates/rules/31-ekkos-messages.mdc +78 -0
  119. package/templates/skills/continue/SKILL.md +169 -0
  120. package/templates/skills/ekkOS_Deep_Recall/Skill.md +282 -0
  121. package/templates/skills/ekkOS_Learn/Skill.md +265 -0
  122. package/templates/skills/ekkOS_Memory_First/Skill.md +206 -0
  123. package/templates/skills/ekkOS_Plan_Assist/Skill.md +302 -0
  124. package/templates/skills/ekkOS_Preferences/Skill.md +247 -0
  125. package/templates/skills/ekkOS_Reflect/Skill.md +257 -0
  126. package/templates/skills/ekkOS_Safety/Skill.md +265 -0
  127. package/templates/skills/ekkOS_Schema/Skill.md +251 -0
  128. package/templates/skills/ekkOS_Summary/Skill.md +257 -0
  129. package/templates/skills/ekkOS_Vault/Skill.md +287 -0
  130. package/templates/skills/permissions/Skill.md +322 -0
  131. package/templates/spec-template.md +159 -0
  132. package/templates/windsurf-hooks/before-submit-prompt.sh +238 -0
  133. package/templates/windsurf-hooks/hooks.json +10 -0
  134. package/templates/windsurf-hooks/lib/contract.sh +320 -0
  135. package/templates/windsurf-rules/ekkos-memory.md +129 -0
@@ -0,0 +1,287 @@
1
+ # ekkOS_ Memory System
2
+
3
+ ## CORE PURPOSE
4
+
5
+ **The Golden Loop exists so YOU get SMARTER over time - learn from mistakes, don't repeat them.**
6
+
7
+ This is YOUR cognitive memory. It makes you:
8
+ - **Remember when you mess up** - Schema changes, wrong assumptions, bad approaches
9
+ - **Not repeat the same mistakes** - If you broke something before, KNOW not to do it again
10
+ - **Recall correct versions** - When schemas/configs get mangled, remember what's RIGHT
11
+ - **Build on what worked** - Use proven patterns instead of fumbling through problems
12
+
13
+ **FAILURES ARE JUST AS VALUABLE AS SUCCESSES.** Forge anti-patterns too.
14
+
15
+ ---
16
+
17
+ ## MANDATORY RULES (NOT OPTIONAL)
18
+
19
+ ### RULE 1: RETRIEVE BEFORE ANSWERING
20
+ Before answering ANY technical question, call `ekkOS_Search` first.
21
+ Do not skip this. Do not assume you know the answer.
22
+
23
+ ### RULE 2: ACKNOWLEDGE ALL RETRIEVED PATTERNS (PatternGuard)
24
+ When patterns are retrieved, you MUST acknowledge EVERY pattern - either use it or skip it.
25
+
26
+ **For patterns you USE:**
27
+ ```
28
+ [ekkOS_SELECT]
29
+ - id: <pattern_id>
30
+ reason: <why using>
31
+ confidence: <0.0-1.0>
32
+ [/ekkOS_SELECT]
33
+ ```
34
+
35
+ **For patterns NOT relevant:**
36
+ ```
37
+ [ekkOS_SKIP]
38
+ - id: <pattern_id>
39
+ reason: <why not relevant>
40
+ [/ekkOS_SKIP]
41
+ ```
42
+
43
+ ### RULE 3: FORGE WHAT YOU LEARN
44
+ When you fix a bug, get corrected, or learn something new, call `ekkOS_Forge` immediately.
45
+
46
+ ### RULE 4: FAILURES ARE VALUABLE
47
+ When something DOES NOT work, forge it as an anti-pattern.
48
+
49
+ ### RULE 5: POST-CLEAR CONFIRMATION (HARDCODED)
50
+ After `/clear`, when you see restored turns in `<system-reminder>` (pattern: `**Turn XX**: ...`), you MUST start your response with:
51
+ ```
52
+ โœ“ **Session continued (Turn N)** - X turns preserved, context restored
53
+ ```
54
+ This is the ONLY way users see that restoration worked. Hook output is invisible to them.
55
+
56
+ ---
57
+
58
+ ## SKILL TRIGGERS (MANDATORY)
59
+
60
+ Call skills using `Skill(skill: "name")` when you detect these triggers:
61
+
62
+ | Skill | MUST Fire When |
63
+ |-------|----------------|
64
+ | `ekkOS_Memory_First` | Before debugging, before "how do I...", before architecture decisions |
65
+ | `ekkOS_Learn` | After fixing ANY bug, after user correction, after solving non-trivial problem |
66
+ | `ekkOS_Deep_Recall` | User says "yesterday", "last week", "what did we discuss", "remember when", "we worked on X before" |
67
+ | `ekkOS_Preferences` | User says "always", "never", "I prefer", "don't", "avoid" |
68
+ | `ekkOS_Safety` | Before delete, before deploy, before DROP, before rm -rf, before push to main |
69
+ | `ekkOS_Schema` | Before writing SQL, before Supabase queries, before Prisma operations |
70
+
71
+ **These are NOT optional.** If the trigger is detected, fire the skill FIRST.
72
+
73
+ ---
74
+
75
+ ## AGENT ROUTING (MANDATORY)
76
+
77
+ **Route tasks to specialized agents using `Task(subagent_type="...")` instead of doing them yourself.**
78
+
79
+ | Trigger Keywords | Agent | When to Use |
80
+ |------------------|-------|-------------|
81
+ | extension, vsix, publish, marketplace, ekkos-connect | `extension-manager` | Version bumps, VSIX builds, publishing |
82
+ | vercel, deploy to vercel, platform.ekkos.dev, apps/web | `devops` | Vercel deployments (link + archive mode) |
83
+ | deploy, railway, workers, pm2, restart, logs, queue | `railway-manager` | Railway deployments, service management |
84
+ | commit, push, branch, merge, git, pull request, rebase | `git-companion` | All git operations |
85
+ | error, bug, broken, not working, failing, crash | `debug-detective` | Systematic debugging |
86
+ | review, PR, check this code, code quality | `code-reviewer` | Code reviews |
87
+ | blog, post, article, content | `ekkOS_Blogger` | Blog content creation |
88
+ | frontend, component, React, UI, page | `frontend` | React/Next.js development |
89
+ | backend, API, database, Supabase, RLS | `backend` | API and database work |
90
+ | test, QA, quality, coverage | `qa` | Testing and quality assurance |
91
+ | plan, architect, design, implement feature | `tech-lead` | Complex planning and coordination |
92
+
93
+ **How it works:**
94
+ 1. Detect trigger keywords in user request
95
+ 2. Spawn the specialist agent via `Task` tool
96
+ 3. Let the agent do the work with its focused toolset
97
+ 4. Summarize results back to user
98
+
99
+ **Example:**
100
+ ```
101
+ User: "bump the extension version"
102
+ You: Task(subagent_type="extension-manager", prompt="Bump version...")
103
+ ```
104
+
105
+ **DO NOT** do these tasks yourself when an agent exists. Agents have:
106
+ - Focused tool access (reduced hallucination)
107
+ - Domain expertise (patterns loaded)
108
+ - Consistent workflows (same process every time)
109
+
110
+ ---
111
+
112
+ ## MCP Tools (31 Total)
113
+
114
+ ### Core Memory Tools
115
+ | Tool | Description |
116
+ |------|-------------|
117
+ | `ekkOS_Search` | ๐Ÿ”ด REQUIRED: Search all 11 layers before answering |
118
+ | `ekkOS_Context` | Get relevant context for a task |
119
+ | `ekkOS_Capture` | Capture memory events |
120
+ | `ekkOS_Forge` | ๐Ÿ”ด REQUIRED: Create pattern from solution |
121
+ | `ekkOS_Directive` | ๐Ÿ”ด REQUIRED: Create MUST/NEVER/PREFER/AVOID rules |
122
+ | `ekkOS_Outcome` | Track if pattern worked or failed |
123
+ | `ekkOS_Detect` | ๐Ÿ”ด REQUIRED: Auto-detect which patterns were used |
124
+ | `ekkOS_Summary` | ๐Ÿ”ด REQUIRED: Get summary of MCP activity |
125
+ | `ekkOS_Conflict` | ๐Ÿ”ด REQUIRED: Check for conflicts before destructive actions |
126
+ | `ekkOS_Recall` | Recall past conversations by time |
127
+ | `ekkOS_Codebase` | Search project code embeddings |
128
+ | `ekkOS_Stats` | Get statistics for all layers |
129
+ | `ekkOS_Track` | Track when pattern is applied |
130
+ | `ekkOS_Reflect` | Analyze response for improvement opportunities |
131
+
132
+ ### Schema Awareness Tools
133
+ | Tool | Description |
134
+ |------|-------------|
135
+ | `ekkOS_IndexSchema` | Index database schemas (Supabase, Prisma, TypeScript) |
136
+ | `ekkOS_GetSchema` | Get schema for a specific table/type |
137
+
138
+ ### Portability Tools
139
+ | Tool | Description |
140
+ |------|-------------|
141
+ | `ekkOS_Export` | Export your patterns, directives, plans as portable JSON backup |
142
+ | `ekkOS_Import` | Import memory from backup (auto-deduplication) |
143
+
144
+ ### Plan Management
145
+ | Tool | Description |
146
+ |------|-------------|
147
+ | `ekkOS_Plan` | Create structured task plan |
148
+ | `ekkOS_Plans` | List user's plans |
149
+ | `ekkOS_PlanStatus` | Update plan status |
150
+ | `ekkOS_PlanStep` | Mark step complete/incomplete |
151
+ | `ekkOS_Generate` | AI-generate plan from context |
152
+ | `ekkOS_SaveTemplate` | Save plan as reusable template |
153
+ | `ekkOS_Templates` | List available templates |
154
+ | `ekkOS_FromTemplate` | Create plan from template |
155
+
156
+ ### Secrets Management (Layer 11)
157
+ | Tool | Description |
158
+ |------|-------------|
159
+ | `ekkOS_StoreSecret` | Encrypt and store sensitive data (AES-256-GCM) |
160
+ | `ekkOS_GetSecret` | Retrieve and decrypt a secret |
161
+ | `ekkOS_ListSecrets` | List secrets metadata (no values) |
162
+ | `ekkOS_DeleteSecret` | Permanently delete a secret |
163
+ | `ekkOS_RotateSecret` | Update secret with new value |
164
+
165
+ ---
166
+
167
+ ## Proactive Tool Triggers (MEMORIZE THESE)
168
+
169
+ ### Always Use `ekkOS_Search` When:
170
+ - User asks technical question
171
+ - User mentions past discussion
172
+ - Topic involves architecture, config, or debugging
173
+ - You're about to make a decision
174
+
175
+ ### Always Use `ekkOS_Forge` When:
176
+ - Fixed a bug (especially non-obvious)
177
+ - Discovered better approach
178
+ - Found pitfall or gotcha
179
+ - User corrected you
180
+ - Solved auth/config issue
181
+ - Made architectural decision
182
+ - Something DIDN'T work (anti-pattern)
183
+
184
+ ### Always Use `ekkOS_Directive` When:
185
+ - User says "always..." โ†’ type: MUST
186
+ - User says "never..." โ†’ type: NEVER
187
+ - User says "I prefer..." โ†’ type: PREFER
188
+ - User says "don't..." or "avoid..." โ†’ type: AVOID
189
+
190
+ ### Always Use `ekkOS_Conflict` When:
191
+ - About to delete files/data
192
+ - About to deploy to production
193
+ - About to modify config files
194
+ - About to run destructive commands
195
+
196
+ ### Always Use Plan Tools When:
197
+ - Task has 3+ steps
198
+ - User says "help me implement..."
199
+ - Complex feature request
200
+ - Multi-file changes needed
201
+
202
+ ### Always Use Secret Tools When:
203
+ - User shares API key, token, password
204
+ - Need to retrieve stored credentials
205
+ - User asks "do you have my X key?"
206
+
207
+ ---
208
+
209
+ ## 11-Layer Memory Architecture
210
+
211
+ | # | Layer | What It Stores | When to Forge |
212
+ |---|-------|---------------|---------------|
213
+ | 1 | Working | Current session state | Auto-managed |
214
+ | 2 | Episodic | Past conversations | Auto-captured |
215
+ | 3 | Semantic | Embeddings/knowledge | Auto-indexed |
216
+ | 4 | **Patterns** | Proven solutions | Bug fix, better approach, gotcha |
217
+ | 5 | **Procedural** | Step-by-step guides | Multi-step process that worked |
218
+ | 6 | **Collective** | Cross-project wisdom | Works everywhere, not just here |
219
+ | 7 | **Meta** | Pattern effectiveness | Auto-tracked |
220
+ | 8 | **Codebase** | Project-specific | This-repo-only patterns |
221
+ | 9 | **Directives** | User preferences | "Always do X", "Never do Y" |
222
+ | 10 | **Conflict** | Auto-resolves contradictions | Auto-managed |
223
+ | 11 | **Secrets** | Encrypted credentials | API keys, tokens, config |
224
+
225
+ ---
226
+
227
+ ## FORGE TRIGGERS
228
+
229
+ ### forge_pattern (Layer 4)
230
+ Call `ekkOS_Forge` when:
231
+ - Fixed bug (especially non-obvious)
232
+ - Discovered better approach
233
+ - Found pitfall or gotcha
234
+ - User corrected you
235
+ - Solved auth/config issue
236
+ - Made architectural decision
237
+ - Debugged non-trivially
238
+ - Found something that DOESN'T work
239
+ - Understood cross-service data flow
240
+ - Learned correct API usage
241
+
242
+ ### forge_directive (Layer 9)
243
+ Call `ekkOS_Directive` when user says:
244
+ - "always..." โ†’ type: MUST
245
+ - "never..." โ†’ type: NEVER
246
+ - "I prefer..." โ†’ type: PREFER
247
+ - "don't..." / "avoid..." โ†’ type: AVOID
248
+
249
+ ---
250
+
251
+ ## Response Format
252
+
253
+ **EVERY response MUST end with this footer:**
254
+ ```
255
+ ---
256
+ {IDE} ({Model}) ยท ๐Ÿง  **ekkOS_โ„ข** ยท Turn {N} ยท ๐Ÿ“… {Timestamp}
257
+ ```
258
+
259
+ **How to detect values:**
260
+ - **IDE**: Claude Code, Cursor, Windsurf, etc. (from environment)
261
+ - **Model**: Sonnet 4.5, Opus 4.5, etc. (from your model name)
262
+ - **Turn Number**: From hook header (e.g., "Turn 47") - starts at 0 for each new session
263
+ - **Timestamp**: From hook header (accurate local time in EST)
264
+
265
+ **Examples:**
266
+ - `Claude Code (Sonnet 4.5) ยท ๐Ÿง  **ekkOS_โ„ข** ยท Turn 12 ยท ๐Ÿ“… 2026-01-09 4:50 PM EST`
267
+ - `Cursor (Claude Sonnet 4) ยท ๐Ÿง  **ekkOS_โ„ข** ยท Turn 5 ยท ๐Ÿ“… 2026-01-09 10:15 AM EST`
268
+
269
+ **The hook header shows:** `๐Ÿง  ekkOS Memory | Turn {N} | Session: {ID} | {timestamp}`
270
+
271
+ ---
272
+
273
+ ## Quick Reference
274
+
275
+ - Technical question โ†’ `ekkOS_Search` first
276
+ - Patterns retrieved โ†’ SELECT or SKIP each one
277
+ - Problem solved โ†’ `ekkOS_Forge`
278
+ - User preference โ†’ `ekkOS_Directive`
279
+ - Need to recall โ†’ `ekkOS_Recall`
280
+ - Destructive action โ†’ `ekkOS_Conflict` first
281
+ - Store credentials โ†’ `ekkOS_StoreSecret`
282
+ - Backup your memory โ†’ `ekkOS_Export`
283
+ - Restore from backup โ†’ `ekkOS_Import`
284
+
285
+ ## Documentation
286
+
287
+ https://docs.ekkos.dev
@@ -0,0 +1,378 @@
1
+ # ekkOS Templates
2
+
3
+ Complete templates for the ekkOS memory system. Use `install-ekkos.sh` to install everything.
4
+
5
+ ## ๐Ÿ“ฆ What's Included
6
+
7
+ ### ๐Ÿช Hooks (4 files)
8
+
9
+ Shell scripts that run during the Claude Code session lifecycle to enable the **Golden Loop 5-Phase Flow**.
10
+
11
+ **Location**: `~/.claude/hooks/`
12
+
13
+ | Hook | Purpose | Golden Loop Phase |
14
+ |------|---------|-------------------|
15
+ | `session-start.sh` | Initialize tracking on session start | Setup |
16
+ | `user-prompt-submit.sh` | Capture user context at turn start | **1. CAPTURE** |
17
+ | `stop.sh` | Detect patterns, track outcomes at turn end | **3. RETRIEVE**, **4. INJECT**, **5. MEASURE** |
18
+ | `assistant-response.sh` | Process agent responses | **2. LEARN** (implicit) |
19
+
20
+ **Features**:
21
+ - Real-time Golden Loop tracking
22
+ - Automatic pattern detection and injection
23
+ - Turn-by-turn memory capture to Redis
24
+ - Session name generation and management
25
+ - Working memory preservation across `/clear`
26
+
27
+ ### ๐Ÿ“š Skills (12 skills)
28
+
29
+ User-invocable commands that leverage ekkOS memory.
30
+
31
+ **Location**: `~/.claude/skills/`
32
+
33
+ | Skill | Command | Purpose |
34
+ |-------|---------|---------|
35
+ | `continue` | `/continue` | Restore context after `/clear` from Redis (20 turns, <10ms) |
36
+ | `permissions` | `/permissions` | Manage proactive tool execution permissions |
37
+ | `ekkOS_Memory_First` | Auto | Search memory before debugging/solving problems |
38
+ | `ekkOS_Learn` | Auto | Capture solutions as patterns after fixing bugs |
39
+ | `ekkOS_Deep_Recall` | Auto | Time-based recall ("yesterday", "last week") |
40
+ | `ekkOS_Preferences` | Auto | Capture user directives ("always", "never") |
41
+ | `ekkOS_Safety` | Auto | Pre-flight safety checks before destructive ops |
42
+ | `ekkOS_Schema` | Auto | Database field awareness (Supabase/Prisma) |
43
+ | `ekkOS_Vault` | Auto | Encrypted secrets management (API keys, tokens) |
44
+ | `ekkOS_Summary` | Auto | Session activity summary |
45
+ | `ekkOS_Reflect` | Auto | Response quality analysis |
46
+ | `ekkOS_Plan_Assist` | Auto | Structured task planning |
47
+
48
+ **Skill Triggers**: Skills activate automatically based on user language patterns (e.g., "yesterday" โ†’ Deep Recall).
49
+
50
+ ### ๐Ÿค– Agents (4 agents)
51
+
52
+ Specialized agents with built-in 5-Phase Flow for specific tasks.
53
+
54
+ **Location**: `~/.claude/agents/` (Markdown files with YAML frontmatter)
55
+
56
+ | Agent | Triggers | Purpose |
57
+ |-------|----------|---------|
58
+ | `debug-detective` | error, bug, broken, failing | Systematic debugging with pattern memory |
59
+ | `code-reviewer` | review, PR, check code | PR reviews enforcing team patterns |
60
+ | `git-companion` | git, commit, branch, merge | Git workflow assistance |
61
+ | `railway-manager` | railway, deploy, workers, pm2, queue | Railway/PM2 infrastructure management |
62
+
63
+ **Agent Format** (Markdown with YAML frontmatter):
64
+ ```markdown
65
+ ---
66
+ name: agent-name
67
+ description: "When to use this agent. Include 'proactively' for auto-trigger."
68
+ tools: Read, Write, Bash, mcp__ekkos-memory__ekkOS_Search
69
+ model: sonnet
70
+ color: blue
71
+ ---
72
+
73
+ # Agent Title
74
+
75
+ System prompt content goes here...
76
+ ```
77
+
78
+ **Agent Features**:
79
+ - Full 5-Phase Flow enforcement
80
+ - PatternGuard (SELECT/SKIP acknowledgment)
81
+ - Automatic memory retrieval before action
82
+ - Outcome tracking and pattern forging
83
+
84
+ ### ๐Ÿ“– Documentation Templates
85
+
86
+ Additional templates for Cursor and other environments:
87
+
88
+ - `cursor-rules/` - Cursor-specific ekkOS rules
89
+ - `cursor-hooks/` - Cursor-compatible hooks
90
+ - `claude-plugins-admin/` - Admin agent proposals
91
+ - `claude-plugins/` - User-facing plugin proposals
92
+
93
+ ## ๐Ÿš€ Installation
94
+
95
+ ### Quick Install (Recommended)
96
+
97
+ ```bash
98
+ cd extensions/ekkos-connect
99
+ ./install-ekkos.sh
100
+ ```
101
+
102
+ This installs:
103
+ - โœ… All 4 hooks with Golden Loop tracking
104
+ - โœ… All 12 skills
105
+ - โœ… All 3 agents
106
+ - โœ… hooks.json configuration
107
+ - โœ… Verifies API connectivity
108
+
109
+ ### Manual Install
110
+
111
+ #### 1. Install Hooks
112
+
113
+ ```bash
114
+ cp templates/hooks/*.sh ~/.claude/hooks/
115
+ cp -r templates/hooks/lib ~/.claude/hooks/
116
+ chmod +x ~/.claude/hooks/*.sh
117
+ ```
118
+
119
+ #### 2. Install Skills
120
+
121
+ ```bash
122
+ mkdir -p ~/.claude/skills
123
+ cp -r templates/skills/* ~/.claude/skills/
124
+ ```
125
+
126
+ #### 3. Install Agents
127
+
128
+ ```bash
129
+ mkdir -p ~/.claude/claude-plugins/agents
130
+ cp templates/claude-plugins/agents/*.json ~/.claude/claude-plugins/agents/
131
+ ```
132
+
133
+ #### 4. Configure hooks.json
134
+
135
+ ```bash
136
+ cat > ~/.claude/hooks/hooks.json << 'EOF'
137
+ {
138
+ "hooks": {
139
+ "session-start": {
140
+ "command": "~/.claude/hooks/session-start.sh",
141
+ "enabled": true
142
+ },
143
+ "user-prompt-submit": {
144
+ "command": "~/.claude/hooks/user-prompt-submit.sh",
145
+ "enabled": true
146
+ },
147
+ "stop": {
148
+ "command": "~/.claude/hooks/stop.sh",
149
+ "enabled": true
150
+ }
151
+ }
152
+ }
153
+ EOF
154
+ ```
155
+
156
+ ## ๐Ÿ”„ The Golden Loop (5-Phase Flow)
157
+
158
+ The hooks and agents implement a continuous learning loop:
159
+
160
+ ```
161
+ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
162
+ โ”‚ THE GOLDEN LOOP โ”‚
163
+ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
164
+ โ”‚ โ”‚
165
+ โ”‚ 1. CAPTURE โ†’ Log context (user-prompt-submit.sh) โ”‚
166
+ โ”‚ โ†“ โ”‚
167
+ โ”‚ 2. LEARN โ†’ Agent processes with tools โ”‚
168
+ โ”‚ โ†“ โ”‚
169
+ โ”‚ 3. RETRIEVE โ†’ Search memory for patterns (stop.sh) โ”‚
170
+ โ”‚ โ†“ โ”‚
171
+ โ”‚ 4. INJECT โ†’ Apply patterns to solution โ”‚
172
+ โ”‚ โ†“ โ”‚
173
+ โ”‚ 5. MEASURE โ†’ Track outcomes, forge new patterns โ”‚
174
+ โ”‚ โ†“ โ”‚
175
+ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ (back to CAPTURE) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜โ”‚
176
+ โ”‚ โ”‚
177
+ โ”‚ Result: Agent gets SMARTER with every turn โ”‚
178
+ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
179
+ ```
180
+
181
+ ### How It Works
182
+
183
+ **Turn N starts**:
184
+ 1. `user-prompt-submit.sh` runs โ†’ **CAPTURE** user context
185
+ 2. Agent receives prompt โ†’ **LEARN** (processes with tools)
186
+ 3. Agent response completes โ†’ `stop.sh` runs
187
+ 4. `stop.sh` detects ekkOS_Search calls โ†’ **RETRIEVE** confirmed
188
+ 5. `stop.sh` detects [ekkOS_SELECT] markers โ†’ **INJECT** confirmed
189
+ 6. `stop.sh` detects ekkOS_Forge calls โ†’ **MEASURE** confirmed
190
+ 7. All phases logged to working memory (Redis)
191
+ 8. VS Code extension displays real-time phase status
192
+
193
+ **Turn N+1 starts** โ†’ Repeat with improved patterns!
194
+
195
+ ## ๐Ÿ“Š PatternGuard (SELECT/SKIP)
196
+
197
+ All agents and memory-aware responses must acknowledge retrieved patterns:
198
+
199
+ ```markdown
200
+ [ekkOS_SELECT]
201
+ - id: pattern-abc123
202
+ reason: Matches this error type exactly
203
+ confidence: 0.95
204
+ [/ekkOS_SELECT]
205
+
206
+ [ekkOS_SKIP]
207
+ - id: pattern-xyz789
208
+ reason: Different framework, not applicable
209
+ [/ekkOS_SKIP]
210
+ ```
211
+
212
+ **Why?** This provides:
213
+ - 100% pattern coverage (no ignored patterns)
214
+ - Feedback loop for pattern quality
215
+ - Audit trail of decision-making
216
+
217
+ ## ๐Ÿ” Permissions System
218
+
219
+ Skills can request permissions for proactive execution:
220
+
221
+ ```bash
222
+ # View current permissions
223
+ /permissions
224
+
225
+ # Grant auto-search before answering
226
+ /permissions grant search:auto_before_answer
227
+
228
+ # Revoke auto-forge on bug fix
229
+ /permissions revoke forge:auto_on_fix
230
+
231
+ # Reset to safe defaults
232
+ /permissions reset
233
+ ```
234
+
235
+ ## ๐Ÿงช Testing the Installation
236
+
237
+ After installing, start a new Claude Code session and try:
238
+
239
+ ```bash
240
+ # 1. Test /continue skill
241
+ /continue
242
+
243
+ # 2. Test permissions
244
+ /permissions list
245
+
246
+ # 3. Trigger Debug Detective agent
247
+ # (Just describe an error and it should activate)
248
+
249
+ # 4. Check Golden Loop tracking
250
+ # Open VS Code sidebar โ†’ ekkOS Connect
251
+ # Should show real-time phase tracking
252
+ ```
253
+
254
+ ## ๐Ÿ“ Directory Structure
255
+
256
+ ```
257
+ templates/
258
+ โ”œโ”€โ”€ hooks/ # Shell hooks for Claude Code
259
+ โ”‚ โ”œโ”€โ”€ user-prompt-submit.sh # CAPTURE phase
260
+ โ”‚ โ”œโ”€โ”€ stop.sh # RETRIEVE/INJECT/MEASURE
261
+ โ”‚ โ”œโ”€โ”€ session-start.sh # Initialize
262
+ โ”‚ โ”œโ”€โ”€ assistant-response.sh # LEARN phase
263
+ โ”‚ โ””โ”€โ”€ lib/ # Shared utilities
264
+ โ”‚ โ”œโ”€โ”€ contract.sh # Pattern contract parsing
265
+ โ”‚ โ””โ”€โ”€ state.sh # State management
266
+ โ”‚
267
+ โ”œโ”€โ”€ skills/ # User-invocable skills
268
+ โ”‚ โ”œโ”€โ”€ continue/ # Context restoration
269
+ โ”‚ โ”œโ”€โ”€ permissions/ # Permission management
270
+ โ”‚ โ”œโ”€โ”€ ekkOS_Memory_First/ # Search-first debugging
271
+ โ”‚ โ”œโ”€โ”€ ekkOS_Learn/ # Pattern forging
272
+ โ”‚ โ”œโ”€โ”€ ekkOS_Deep_Recall/ # Time-based recall
273
+ โ”‚ โ”œโ”€โ”€ ekkOS_Preferences/ # Directive capture
274
+ โ”‚ โ”œโ”€โ”€ ekkOS_Safety/ # Safety checks
275
+ โ”‚ โ”œโ”€โ”€ ekkOS_Schema/ # DB field awareness
276
+ โ”‚ โ”œโ”€โ”€ ekkOS_Vault/ # Secrets management
277
+ โ”‚ โ”œโ”€โ”€ ekkOS_Summary/ # Activity reports
278
+ โ”‚ โ”œโ”€โ”€ ekkOS_Reflect/ # Quality analysis
279
+ โ”‚ โ””โ”€โ”€ ekkOS_Plan_Assist/ # Task planning
280
+ โ”‚
281
+ โ”œโ”€โ”€ claude-plugins/agents/ # Specialized agents
282
+ โ”‚ โ”œโ”€โ”€ debug-detective.json # Systematic debugger
283
+ โ”‚ โ”œโ”€โ”€ code-reviewer.json # PR reviewer
284
+ โ”‚ โ”œโ”€โ”€ git-companion.json # Git workflow helper
285
+ โ”‚ โ””โ”€โ”€ railway-manager.json # Railway/PM2 infrastructure
286
+ โ”‚
287
+ โ”œโ”€โ”€ cursor-rules/ # Cursor-specific
288
+ โ”‚ โ””โ”€โ”€ ekkos-memory.md
289
+ โ”‚
290
+ โ””โ”€โ”€ cursor-hooks/ # Cursor-compatible hooks
291
+ โ”œโ”€โ”€ before-submit-prompt.sh
292
+ โ””โ”€โ”€ after-agent-response.sh
293
+ ```
294
+
295
+ ## ๐Ÿ”ง Updating Templates
296
+
297
+ To update your installed templates with the latest version:
298
+
299
+ ```bash
300
+ # 1. Pull latest changes
301
+ cd /path/to/EKKOS
302
+ git pull
303
+
304
+ # 2. Re-run install script
305
+ cd extensions/ekkos-connect
306
+ ./install-ekkos.sh
307
+ ```
308
+
309
+ The install script will overwrite existing files with the latest versions.
310
+
311
+ ## โšก Performance
312
+
313
+ - **Hooks**: <50ms overhead per turn
314
+ - **Redis working memory**: <10ms retrieval
315
+ - **Pattern injection**: Real-time (no user-visible delay)
316
+ - **Sidebar updates**: Event-driven (no polling)
317
+
318
+ ## ๐Ÿ› Troubleshooting
319
+
320
+ ### Hooks not running
321
+
322
+ ```bash
323
+ # Check hooks are executable
324
+ ls -la ~/.claude/hooks/*.sh
325
+
326
+ # Check hooks.json exists
327
+ cat ~/.claude/hooks/hooks.json
328
+
329
+ # Test hook manually
330
+ ~/.claude/hooks/session-start.sh
331
+ ```
332
+
333
+ ### Skills not appearing
334
+
335
+ ```bash
336
+ # Check skills directory
337
+ ls -la ~/.claude/skills/
338
+
339
+ # Each skill should have SKILL.md or Skill.md
340
+ ls ~/.claude/skills/*/SKILL.md
341
+ ```
342
+
343
+ ### Golden Loop not tracking
344
+
345
+ ```bash
346
+ # Check hook output
347
+ # Hooks should emit: [ekkOS_GL_PHASE:X] markers
348
+
349
+ # Verify Redis connectivity
350
+ curl -s "https://api.ekkos.dev/health"
351
+
352
+ # Check API key
353
+ jq '.apiKey' ~/.ekkos/config.json
354
+ ```
355
+
356
+ ## ๐Ÿ“š Documentation
357
+
358
+ - **Docs**: https://docs.ekkos.dev
359
+ - **Golden Loop**: See `docs/GOLDEN_LOOP_ORCHESTRATION.md`
360
+ - **Permissions**: See `docs/PERMISSIONS_SYSTEM.md`
361
+ - **Architecture**: See `docs/PERMISSION_5_PHASE_FLOW.md`
362
+
363
+ ## ๐Ÿค Contributing
364
+
365
+ Template improvements welcome! Submit PRs to:
366
+ - Fix bugs in hooks
367
+ - Add new skills
368
+ - Create new agents
369
+ - Improve documentation
370
+
371
+ ## ๐Ÿ“œ License
372
+
373
+ MIT - ekkOS Technologies Inc.
374
+
375
+ ---
376
+
377
+ **Version**: 2.11.0
378
+ **Last Updated**: 2026-01-13