@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,238 @@
1
+ #!/bin/bash
2
+ # โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
3
+ # ekkOS_ Hook: BeforeSubmitPrompt (Windsurf Cascade) - RETRIEVE + INJECT + CONTRACT
4
+ #
5
+ # ARCHITECTURE: Dumb Hook, Smart Backend
6
+ # โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
7
+ # This hook runs BEFORE the prompt is sent to the AI.
8
+ # It is THE CANONICAL retrieval path for Windsurf.
9
+ #
10
+ # GOLDEN LOOP ENFORCEMENT:
11
+ # - Writes turn contract as evidence of retrieval
12
+ # - In STRICT mode, returns continue=false to block turn
13
+ # - Lists pattern IDs explicitly for PatternGuard validation
14
+ # โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
15
+
16
+ set +e # Don't exit on errors - be bulletproof
17
+
18
+ # Get project root
19
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
20
+ PROJECT_ROOT="$(dirname "$(dirname "$SCRIPT_DIR")")"
21
+ STATE_DIR="$PROJECT_ROOT/.windsurf/state"
22
+ mkdir -p "$STATE_DIR" 2>/dev/null || true
23
+
24
+ # Load turn contract library
25
+ if [ -f "$SCRIPT_DIR/lib/contract.sh" ]; then
26
+ source "$SCRIPT_DIR/lib/contract.sh" 2>/dev/null || true
27
+ fi
28
+
29
+ # Fallback functions if library didn't load
30
+ if ! command -v write_turn_contract >/dev/null 2>&1; then
31
+ write_turn_contract() { return 0; }
32
+ fi
33
+ if ! command -v generate_query_hash >/dev/null 2>&1; then
34
+ generate_query_hash() { echo "$(date +%s)"; }
35
+ fi
36
+ if ! command -v is_strict_mode >/dev/null 2>&1; then
37
+ is_strict_mode() { [ "${EKKOS_STRICT:-0}" = "1" ]; }
38
+ fi
39
+ if ! command -v get_strict_blocker_message >/dev/null 2>&1; then
40
+ get_strict_blocker_message() { echo "โ›” EKKOS_STRICT: Retrieval failed - DO NOT ANSWER"; }
41
+ fi
42
+
43
+ # Read JSON input from stdin
44
+ INPUT=$(cat)
45
+
46
+ # Extract prompt text and session info
47
+ PROMPT_TEXT=$(echo "$INPUT" | jq -r '.prompt // .text // ""' 2>/dev/null || echo "")
48
+ SESSION_ID=$(echo "$INPUT" | jq -r '.session_id // .conversation_id // ""' 2>/dev/null || echo "")
49
+ MODEL_INFO=$(echo "$INPUT" | jq -r '.model // ""' 2>/dev/null || echo "")
50
+
51
+ # Generate session ID if not provided
52
+ if [ -z "$SESSION_ID" ] || [ "$SESSION_ID" = "null" ]; then
53
+ SESSION_ID="windsurf-$(date +%s)-$$"
54
+ fi
55
+
56
+ # Skip if empty
57
+ if [ -z "$PROMPT_TEXT" ] || [ "$PROMPT_TEXT" = "null" ]; then
58
+ echo '{"continue": true}'
59
+ exit 0
60
+ fi
61
+
62
+ # Generate query hash for contract
63
+ QUERY_HASH=$(generate_query_hash "$PROMPT_TEXT")
64
+
65
+ # โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
66
+ # Load auth token - PORTABLE: Check 3 sources in priority order
67
+ # โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
68
+ EKKOS_CONFIG="$HOME/.ekkos/config.json"
69
+ AUTH_TOKEN=""
70
+ USER_ID=""
71
+
72
+ # 1. First try ~/.ekkos/config.json (set by VS Code extension - most portable)
73
+ # Prefer hookApiKey (scoped key for hooks) over apiKey (legacy)
74
+ if [ -f "$EKKOS_CONFIG" ]; then
75
+ AUTH_TOKEN=$(jq -r '.hookApiKey // .apiKey // ""' "$EKKOS_CONFIG" 2>/dev/null || echo "")
76
+ USER_ID=$(jq -r '.userId // ""' "$EKKOS_CONFIG" 2>/dev/null || echo "")
77
+ fi
78
+
79
+ # 2. Then try project .env.local (for developers)
80
+ if [ -z "$AUTH_TOKEN" ] && [ -f "$PROJECT_ROOT/.env.local" ]; then
81
+ AUTH_TOKEN=$(grep -E "^SUPABASE_SECRET_KEY=" "$PROJECT_ROOT/.env.local" | cut -d'=' -f2- | tr -d '"' | tr -d "'" | tr -d '\r')
82
+ fi
83
+
84
+ # 3. Finally try environment variable
85
+ if [ -z "$AUTH_TOKEN" ]; then
86
+ AUTH_TOKEN="${SUPABASE_SECRET_KEY:-}"
87
+ fi
88
+
89
+ # Track retrieval status
90
+ RETRIEVAL_OK="false"
91
+ RETRIEVED_PATTERN_IDS=""
92
+ RETRIEVED_DIRECTIVE_IDS=""
93
+
94
+ # Skip if no auth
95
+ if [ -z "$AUTH_TOKEN" ]; then
96
+ # STRICT MODE: Block turn if no auth
97
+ if is_strict_mode; then
98
+ BLOCKER_MSG=$(get_strict_blocker_message)
99
+ write_turn_contract "$SESSION_ID" "false" "windsurf" "" "" "$QUERY_HASH" "$PROJECT_ROOT"
100
+ echo "{\"continue\": false, \"user_message\": $(echo "$BLOCKER_MSG" | jq -R -s .)}"
101
+ exit 0
102
+ fi
103
+
104
+ write_turn_contract "$SESSION_ID" "false" "windsurf" "" "" "$QUERY_HASH" "$PROJECT_ROOT"
105
+ echo '{"continue": true, "user_message": "[ekkOS] No auth token. Run ekkOS: Connect in VS Code."}'
106
+ exit 0
107
+ fi
108
+
109
+ # Cloud API
110
+ MEMORY_API_URL="https://mcp.ekkos.dev"
111
+
112
+ # โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
113
+ # [ekkOS_RETRIEVE] Search memory for patterns (all 8 queryable layers)
114
+ # โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
115
+ JSON_PAYLOAD=$(jq -n \
116
+ --arg query "$PROMPT_TEXT" \
117
+ --arg user_id "${USER_ID:-system}" \
118
+ --arg session "windsurf-$SESSION_ID" \
119
+ '{
120
+ query: $query,
121
+ user_id: $user_id,
122
+ session_id: $session,
123
+ max_per_layer: 5,
124
+ include_layers: ["working", "episodic", "semantic", "patterns", "procedural", "collective", "codebase", "directives"],
125
+ metadata: { source: "windsurf-cascade-hook" }
126
+ }' 2>/dev/null || echo '{}')
127
+
128
+ API_RESPONSE=$(curl -s -X POST "$MEMORY_API_URL/api/v1/context/retrieve" \
129
+ -H "Authorization: Bearer $AUTH_TOKEN" \
130
+ -H "Content-Type: application/json" \
131
+ -d "$JSON_PAYLOAD" \
132
+ --connect-timeout 3 \
133
+ --max-time 5 2>/dev/null || echo '{"error":"timeout"}')
134
+
135
+ # Check if retrieval succeeded
136
+ if echo "$API_RESPONSE" | jq -e '.layers' >/dev/null 2>&1; then
137
+ RETRIEVAL_OK="true"
138
+ else
139
+ # STRICT MODE: Block turn if retrieval failed
140
+ if is_strict_mode; then
141
+ BLOCKER_MSG=$(get_strict_blocker_message)
142
+ write_turn_contract "$SESSION_ID" "false" "windsurf" "" "" "$QUERY_HASH" "$PROJECT_ROOT"
143
+ echo "{\"continue\": false, \"user_message\": $(echo "$BLOCKER_MSG" | jq -R -s .)}"
144
+ exit 0
145
+ fi
146
+
147
+ API_RESPONSE='{"error":"timeout","formatted_context":"","layers":{"patterns":[],"directives":[]}}'
148
+ fi
149
+
150
+ # Extract counts
151
+ PATTERN_COUNT=$(echo "$API_RESPONSE" | jq '.layers.patterns // [] | length' 2>/dev/null || echo "0")
152
+ DIRECTIVE_COUNT=$(echo "$API_RESPONSE" | jq '.layers.directives // [] | length' 2>/dev/null || echo "0")
153
+ TOTAL_COUNT=$((PATTERN_COUNT + DIRECTIVE_COUNT))
154
+
155
+ # Extract pattern and directive IDs for turn contract
156
+ RETRIEVED_PATTERN_IDS=$(echo "$API_RESPONSE" | jq -r '.layers.patterns // [] | map(.pattern_id // .id) | join(",")' 2>/dev/null || echo "")
157
+ RETRIEVED_DIRECTIVE_IDS=$(echo "$API_RESPONSE" | jq -r '.layers.directives // [] | map(.directive_id // .id) | join(",")' 2>/dev/null || echo "")
158
+
159
+ # โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
160
+ # [ekkOS_CONTRACT] Write turn contract as evidence of retrieval
161
+ # โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
162
+ write_turn_contract "$SESSION_ID" "$RETRIEVAL_OK" "windsurf" "$RETRIEVED_PATTERN_IDS" "$RETRIEVED_DIRECTIVE_IDS" "$QUERY_HASH" "$PROJECT_ROOT"
163
+
164
+ # Save session ID to state file
165
+ echo "$SESSION_ID" > "$STATE_DIR/current_session_id.txt" 2>/dev/null || true
166
+
167
+ # โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
168
+ # [ekkOS_INJECT] Build user message with patterns
169
+ # โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
170
+ if [ "$PATTERN_COUNT" -gt 0 ]; then
171
+ # Get formatted context
172
+ FORMATTED=$(echo "$API_RESPONSE" | jq -r '.formatted_context // ""' 2>/dev/null)
173
+
174
+ # Get pattern IDs for PatternGuard
175
+ PATTERN_ID_LIST=$(echo "$API_RESPONSE" | jq -r '.layers.patterns[:5][] | .pattern_id // .id' 2>/dev/null || echo "")
176
+
177
+ if [ -n "$FORMATTED" ] && [ "$FORMATTED" != "null" ]; then
178
+ MESSAGE="โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
179
+ ๐Ÿง  ekkOSโ„ข Memory Substrate
180
+ โœ“ $PATTERN_COUNT patterns loaded from memory
181
+ โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
182
+
183
+ $FORMATTED
184
+
185
+ โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
186
+ โš ๏ธ PATTERNGUARD REQUIRED
187
+
188
+ You MUST acknowledge ALL $PATTERN_COUNT pattern(s) above.
189
+
190
+ Pattern IDs to acknowledge:
191
+ $PATTERN_ID_LIST
192
+
193
+ For patterns you USE:
194
+ [ekkOS_SELECT]
195
+ - id: <pattern-uuid>
196
+ reason: <why using>
197
+ confidence: <0.0-1.0>
198
+ [/ekkOS_SELECT]
199
+
200
+ For patterns you DO NOT use:
201
+ [ekkOS_SKIP]
202
+ - id: <pattern-uuid>
203
+ reason: <why not relevant>
204
+ [/ekkOS_SKIP]
205
+
206
+ Coverage MUST be 100% (all IDs acknowledged).
207
+
208
+ RESPONSE FORMAT: End with:
209
+ ๐Ÿง  **ekkOS_โ„ข** ยท ๐Ÿ“… YYYY-MM-DD H:MM AM/PM TZ
210
+ โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”"
211
+ else
212
+ # Fallback: minimal injection
213
+ MESSAGE="โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
214
+ ๐Ÿง  ekkOSโ„ข: $PATTERN_COUNT patterns found
215
+
216
+ Pattern IDs to acknowledge with [ekkOS_SELECT] or [ekkOS_SKIP]:
217
+ $PATTERN_ID_LIST
218
+
219
+ End response with: ๐Ÿง  **ekkOS_โ„ข** ยท ๐Ÿ“… YYYY-MM-DD
220
+ โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”"
221
+ fi
222
+
223
+ # Save patterns for capture
224
+ echo "$API_RESPONSE" | jq '.layers.patterns // []' > "$STATE_DIR/patterns-${SESSION_ID}.json" 2>/dev/null || true
225
+
226
+ echo "{\"continue\": true, \"user_message\": $(echo "$MESSAGE" | jq -R -s .)}" | jq -c .
227
+ else
228
+ # No patterns - still write contract and remind about footer
229
+ MESSAGE="โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
230
+ ๐Ÿง  ekkOSโ„ข: No patterns found (new territory)
231
+
232
+ End response with: ๐Ÿง  **ekkOS_โ„ข** ยท ๐Ÿ“… YYYY-MM-DD
233
+ โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”"
234
+
235
+ echo "{\"continue\": true, \"user_message\": $(echo "$MESSAGE" | jq -R -s .)}" | jq -c .
236
+ fi
237
+
238
+ exit 0
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 1,
3
+ "hooks": {
4
+ "beforeSubmitPrompt": [
5
+ {
6
+ "command": "./.windsurf/hooks/before-submit-prompt.sh"
7
+ }
8
+ ]
9
+ }
10
+ }
@@ -0,0 +1,320 @@
1
+ #!/bin/bash
2
+ # โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
3
+ # ekkOS_ Turn Contract Library
4
+ #
5
+ # Shared functions for Golden Loop compliance enforcement.
6
+ # Used by BOTH Claude Code (.claude/) and Cursor (.cursor/) hooks.
7
+ #
8
+ # TURN CONTRACT: Evidence that retrieval occurred before answering.
9
+ # This is the SINGLE SOURCE OF TRUTH for compliance auditing.
10
+ # โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
11
+
12
+ # Get contract directory based on environment
13
+ get_contract_dir() {
14
+ local source="${1:-claude-code}"
15
+ local project_root="${2:-$PROJECT_ROOT}"
16
+
17
+ if [ "$source" = "cursor" ]; then
18
+ echo "$project_root/.cursor/state/ekkos"
19
+ else
20
+ echo "$project_root/.claude/state/ekkos"
21
+ fi
22
+ }
23
+
24
+ # Generate stable hash of user prompt (for deduplication)
25
+ generate_query_hash() {
26
+ local query="$1"
27
+ # Use md5 on macOS, md5sum on Linux
28
+ if command -v md5 >/dev/null 2>&1; then
29
+ echo -n "$query" | md5 | cut -c1-16
30
+ elif command -v md5sum >/dev/null 2>&1; then
31
+ echo -n "$query" | md5sum | cut -c1-16
32
+ else
33
+ # Fallback: simple hash using cksum
34
+ echo -n "$query" | cksum | cut -d' ' -f1
35
+ fi
36
+ }
37
+
38
+ # Write turn contract at RETRIEVAL time
39
+ # This is the EVIDENCE that retrieval happened before answering
40
+ write_turn_contract() {
41
+ local session_id="$1"
42
+ local retrieval_ok="$2"
43
+ local retrieval_source="$3"
44
+ local pattern_ids="$4" # Comma-separated list
45
+ local directive_ids="$5" # Comma-separated list
46
+ local query_hash="$6"
47
+ local project_root="${7:-$PROJECT_ROOT}"
48
+
49
+ local contract_dir
50
+ contract_dir=$(get_contract_dir "$retrieval_source" "$project_root")
51
+ mkdir -p "$contract_dir" 2>/dev/null || return 1
52
+
53
+ local contract_file="$contract_dir/turn-contract-${session_id}.json"
54
+ local timestamp
55
+ timestamp=$(date -u +%Y-%m-%dT%H:%M:%SZ)
56
+
57
+ # Convert comma-separated IDs to JSON array
58
+ local pattern_array
59
+ local directive_array
60
+ if [ -n "$pattern_ids" ]; then
61
+ pattern_array=$(echo "$pattern_ids" | tr ',' '\n' | grep -v '^$' | jq -R . | jq -s .)
62
+ else
63
+ pattern_array="[]"
64
+ fi
65
+ if [ -n "$directive_ids" ]; then
66
+ directive_array=$(echo "$directive_ids" | tr ',' '\n' | grep -v '^$' | jq -R . | jq -s .)
67
+ else
68
+ directive_array="[]"
69
+ fi
70
+
71
+ # Write contract
72
+ cat > "$contract_file" << EOF
73
+ {
74
+ "session_id": "$session_id",
75
+ "retrieval_ok": $retrieval_ok,
76
+ "retrieval_source": "$retrieval_source",
77
+ "retrieved_pattern_ids": $pattern_array,
78
+ "retrieved_directive_ids": $directive_array,
79
+ "timestamp": "$timestamp",
80
+ "query_hash": "$query_hash",
81
+ "ekkos_strict": ${EKKOS_STRICT:-0}
82
+ }
83
+ EOF
84
+
85
+ return 0
86
+ }
87
+
88
+ # Read turn contract
89
+ read_turn_contract() {
90
+ local session_id="$1"
91
+ local retrieval_source="$2"
92
+ local project_root="${3:-$PROJECT_ROOT}"
93
+
94
+ local contract_dir
95
+ contract_dir=$(get_contract_dir "$retrieval_source" "$project_root")
96
+ local contract_file="$contract_dir/turn-contract-${session_id}.json"
97
+
98
+ if [ -f "$contract_file" ]; then
99
+ cat "$contract_file"
100
+ return 0
101
+ else
102
+ return 1
103
+ fi
104
+ }
105
+
106
+ # Extract field from contract JSON
107
+ get_contract_field() {
108
+ local contract_json="$1"
109
+ local field="$2"
110
+
111
+ echo "$contract_json" | jq -r ".$field // \"\"" 2>/dev/null
112
+ }
113
+
114
+ # Get array field as comma-separated string
115
+ get_contract_array() {
116
+ local contract_json="$1"
117
+ local field="$2"
118
+
119
+ echo "$contract_json" | jq -r ".$field // [] | join(\",\")" 2>/dev/null
120
+ }
121
+
122
+ # Cleanup turn contract (only after successful capture)
123
+ cleanup_turn_contract() {
124
+ local session_id="$1"
125
+ local retrieval_source="$2"
126
+ local project_root="${3:-$PROJECT_ROOT}"
127
+
128
+ local contract_dir
129
+ contract_dir=$(get_contract_dir "$retrieval_source" "$project_root")
130
+ local contract_file="$contract_dir/turn-contract-${session_id}.json"
131
+
132
+ rm -f "$contract_file" 2>/dev/null
133
+ }
134
+
135
+ # Check if strict mode is enabled
136
+ is_strict_mode() {
137
+ [ "${EKKOS_STRICT:-0}" = "1" ]
138
+ }
139
+
140
+ # Generate strict mode blocker message for Claude Code
141
+ get_strict_blocker_message() {
142
+ cat << 'EOF'
143
+ โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
144
+ โ›” EKKOS_STRICT MODE: RETRIEVAL FAILED โ€” DO NOT ANSWER
145
+
146
+ ekkOS memory retrieval failed or was not authenticated.
147
+ In STRICT mode, you MUST NOT answer technical questions without memory context.
148
+
149
+ ACTION REQUIRED:
150
+ 1. Check if ekkOS is connected: Run `ekkOS: Connect` in VS Code
151
+ 2. Verify auth token exists: ~/.ekkos/config.json
152
+ 3. Retry the request after connecting
153
+
154
+ DO NOT proceed with answering. The Golden Loop requires retrieval FIRST.
155
+ โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
156
+ EOF
157
+ }
158
+
159
+ # Validate PatternGuard coverage (returns 0-100)
160
+ calculate_pattern_guard_coverage() {
161
+ local assistant_response="$1"
162
+ local pattern_ids="$2" # Comma-separated
163
+
164
+ # Count total patterns
165
+ local total_count
166
+ total_count=$(echo "$pattern_ids" | tr ',' '\n' | grep -c '.' || echo 0)
167
+
168
+ if [ "$total_count" -eq 0 ]; then
169
+ echo "100" # No patterns = 100% coverage by definition
170
+ return 0
171
+ fi
172
+
173
+ # Extract acknowledged IDs from [ekkOS_SELECT] and [ekkOS_SKIP] blocks
174
+ local acknowledged_count=0
175
+
176
+ # Check SELECT block
177
+ local select_block
178
+ select_block=$(echo "$assistant_response" | grep -ozP '\[ekkOS_SELECT\][\s\S]*?\[/ekkOS_SELECT\]' 2>/dev/null | tr '\0' '\n' || true)
179
+ if [ -n "$select_block" ]; then
180
+ local select_count
181
+ select_count=$(echo "$select_block" | grep -oE 'id:\s*[a-f0-9-]+' | wc -l | tr -d ' ')
182
+ acknowledged_count=$((acknowledged_count + select_count))
183
+ fi
184
+
185
+ # Check SKIP block
186
+ local skip_block
187
+ skip_block=$(echo "$assistant_response" | grep -ozP '\[ekkOS_SKIP\][\s\S]*?\[/ekkOS_SKIP\]' 2>/dev/null | tr '\0' '\n' || true)
188
+ if [ -n "$skip_block" ]; then
189
+ local skip_count
190
+ skip_count=$(echo "$skip_block" | grep -oE 'id:\s*[a-f0-9-]+' | wc -l | tr -d ' ')
191
+ acknowledged_count=$((acknowledged_count + skip_count))
192
+ fi
193
+
194
+ # Legacy: Check for [ekkOS_APPLY] markers (fallback)
195
+ if [ "$acknowledged_count" -eq 0 ]; then
196
+ local apply_count
197
+ apply_count=$(echo "$assistant_response" | grep -c '\[ekkOS_APPLY\]' || echo 0)
198
+ acknowledged_count=$apply_count
199
+ fi
200
+
201
+ # Calculate coverage percentage
202
+ local coverage
203
+ coverage=$((acknowledged_count * 100 / total_count))
204
+
205
+ # Cap at 100%
206
+ if [ "$coverage" -gt 100 ]; then
207
+ coverage=100
208
+ fi
209
+
210
+ echo "$coverage"
211
+ }
212
+
213
+ # Check for ekkOS footer presence
214
+ check_footer_present() {
215
+ local assistant_response="$1"
216
+
217
+ # Look for the mandatory footer format:
218
+ # ๐Ÿง  **ekkOS_โ„ข** ยท ๐Ÿ“… YYYY-MM-DD
219
+ # OR
220
+ # {IDE} ({Model}) ยท ๐Ÿง  **ekkOS_โ„ข** ยท ๐Ÿ“… {Timestamp}
221
+
222
+ if echo "$assistant_response" | grep -qE '๐Ÿง .*ekkOS.*๐Ÿ“….*[0-9]{4}-[0-9]{2}-[0-9]{2}'; then
223
+ echo "true"
224
+ return 0
225
+ else
226
+ echo "false"
227
+ return 1
228
+ fi
229
+ }
230
+
231
+ # Build compliance metadata for capture
232
+ build_compliance_metadata() {
233
+ local retrieval_ok="$1"
234
+ local pattern_guard_coverage="$2"
235
+ local footer_present="$3"
236
+ local ekkos_strict="$4"
237
+ local retrieved_count="$5"
238
+
239
+ local pattern_guard_required="false"
240
+ if [ "$retrieved_count" -gt 0 ]; then
241
+ pattern_guard_required="true"
242
+ fi
243
+
244
+ cat << EOF
245
+ {
246
+ "retrieval_ok": $retrieval_ok,
247
+ "pattern_guard_required": $pattern_guard_required,
248
+ "pattern_guard_coverage_pct": $pattern_guard_coverage,
249
+ "footer_present": $footer_present,
250
+ "ekkos_strict": $ekkos_strict,
251
+ "retrieved_count": $retrieved_count,
252
+ "compliance_version": "1.0"
253
+ }
254
+ EOF
255
+ }
256
+
257
+ # Determine if turn is compliant
258
+ is_turn_compliant() {
259
+ local retrieval_ok="$1"
260
+ local pattern_guard_coverage="$2"
261
+ local footer_present="$3"
262
+ local pattern_count="$4"
263
+
264
+ # Retrieval must have succeeded
265
+ if [ "$retrieval_ok" != "true" ]; then
266
+ echo "false"
267
+ return 1
268
+ fi
269
+
270
+ # If patterns were retrieved, PatternGuard must be 100%
271
+ if [ "$pattern_count" -gt 0 ] && [ "$pattern_guard_coverage" -lt 100 ]; then
272
+ echo "false"
273
+ return 1
274
+ fi
275
+
276
+ # Footer must be present
277
+ if [ "$footer_present" != "true" ]; then
278
+ echo "false"
279
+ return 1
280
+ fi
281
+
282
+ echo "true"
283
+ return 0
284
+ }
285
+
286
+ # Generate violation reason
287
+ get_violation_reason() {
288
+ local retrieval_ok="$1"
289
+ local pattern_guard_coverage="$2"
290
+ local footer_present="$3"
291
+ local pattern_count="$4"
292
+
293
+ local reasons=""
294
+
295
+ if [ "$retrieval_ok" != "true" ]; then
296
+ reasons="retrieval_failed"
297
+ fi
298
+
299
+ if [ "$pattern_count" -gt 0 ] && [ "$pattern_guard_coverage" -lt 100 ]; then
300
+ if [ -n "$reasons" ]; then
301
+ reasons="$reasons,pattern_guard_incomplete"
302
+ else
303
+ reasons="pattern_guard_incomplete"
304
+ fi
305
+ fi
306
+
307
+ if [ "$footer_present" != "true" ]; then
308
+ if [ -n "$reasons" ]; then
309
+ reasons="$reasons,footer_missing"
310
+ else
311
+ reasons="footer_missing"
312
+ fi
313
+ fi
314
+
315
+ if [ -z "$reasons" ]; then
316
+ reasons="none"
317
+ fi
318
+
319
+ echo "$reasons"
320
+ }
@@ -0,0 +1,129 @@
1
+ ---
2
+ trigger: always_on
3
+ description: ekkOS Memory - 11-layer cognitive memory with 31 MCP tools
4
+ ---
5
+
6
+ # ekkOS Memory System
7
+
8
+ You have access to **ekkOS memory** via 31 MCP tools. This is an 11-layer cognitive memory system that makes AI smarter over time by learning from past sessions.
9
+
10
+ ## MANDATORY RULES
11
+
12
+ ### RULE 1: SEARCH BEFORE ANSWERING
13
+ Before answering ANY technical question, call `ekkOS_Search` first.
14
+
15
+ ### RULE 2: ACKNOWLEDGE RETRIEVED PATTERNS
16
+ When patterns are retrieved:
17
+ ```
18
+ [ekkOS_SELECT]
19
+ - id: <pattern_id>
20
+ reason: <why using>
21
+ confidence: <0.0-1.0>
22
+ [/ekkOS_SELECT]
23
+
24
+ [ekkOS_SKIP]
25
+ - id: <pattern_id>
26
+ reason: <why not relevant>
27
+ [/ekkOS_SKIP]
28
+ ```
29
+
30
+ ### RULE 3: FORGE WHAT YOU LEARN
31
+ When you fix a bug or learn something new, call `ekkOS_Forge` immediately.
32
+
33
+ ### RULE 4: FAILURES ARE VALUABLE
34
+ When something DOESN'T work, forge it as an anti-pattern.
35
+
36
+ ## MCP Tools (31 Total)
37
+
38
+ ### Core Memory Tools
39
+ | Tool | Description |
40
+ |------|-------------|
41
+ | `ekkOS_Search` | Search all 11 memory layers |
42
+ | `ekkOS_Context` | Get relevant task context |
43
+ | `ekkOS_Capture` | Capture memory events |
44
+ | `ekkOS_Forge` | Create pattern from solution |
45
+ | `ekkOS_Directive` | Create MUST/NEVER/PREFER/AVOID rules |
46
+ | `ekkOS_Outcome` | Track success/failure |
47
+ | `ekkOS_Detect` | Auto-detect pattern usage |
48
+ | `ekkOS_Summary` | Get activity summary |
49
+ | `ekkOS_Conflict` | Check for conflicts |
50
+ | `ekkOS_Recall` | Recall past conversations |
51
+ | `ekkOS_Codebase` | Search code embeddings |
52
+ | `ekkOS_Stats` | Get layer statistics |
53
+ | `ekkOS_Track` | Track pattern application |
54
+ | `ekkOS_Reflect` | Analyze response for improvements |
55
+
56
+ ### Schema Awareness Tools
57
+ | Tool | Description |
58
+ |------|-------------|
59
+ | `ekkOS_IndexSchema` | Index database schemas (Supabase/Prisma/TS) |
60
+ | `ekkOS_GetSchema` | Get schema for a specific table/type |
61
+
62
+ ### Portability
63
+ | Tool | Description |
64
+ |------|-------------|
65
+ | `ekkOS_Export` | Export data as portable backup |
66
+ | `ekkOS_Import` | Import from backup |
67
+
68
+ ### Plan Management
69
+ | Tool | Description |
70
+ |------|-------------|
71
+ | `ekkOS_Plan` | Create task plan |
72
+ | `ekkOS_Plans` | List user plans |
73
+ | `ekkOS_PlanStatus` | Update plan status |
74
+ | `ekkOS_PlanStep` | Mark step done |
75
+ | `ekkOS_Generate` | AI-generate plan |
76
+ | `ekkOS_SaveTemplate` | Save as template |
77
+ | `ekkOS_Templates` | List templates |
78
+ | `ekkOS_FromTemplate` | Create from template |
79
+
80
+ ### Secrets (Layer 11)
81
+ | Tool | Description |
82
+ |------|-------------|
83
+ | `ekkOS_StoreSecret` | Encrypt and store |
84
+ | `ekkOS_GetSecret` | Retrieve and decrypt |
85
+ | `ekkOS_ListSecrets` | List metadata |
86
+ | `ekkOS_DeleteSecret` | Delete secret |
87
+ | `ekkOS_RotateSecret` | Rotate value |
88
+
89
+ ## 11-Layer Architecture
90
+
91
+ | # | Layer | Purpose |
92
+ |---|-------|---------|
93
+ | 1 | Working | Current session |
94
+ | 2 | Episodic | Past conversations |
95
+ | 3 | Semantic | Embeddings |
96
+ | 4 | Patterns | Proven solutions |
97
+ | 5 | Procedural | Step-by-step guides |
98
+ | 6 | Collective | Cross-project wisdom |
99
+ | 7 | Meta | Pattern effectiveness |
100
+ | 8 | Codebase | Project code |
101
+ | 9 | Directives | User rules |
102
+ | 10 | Conflict | Auto-resolution |
103
+ | 11 | Secrets | Encrypted credentials (AES-256-GCM) |
104
+
105
+ ## FORGE TRIGGERS
106
+
107
+ **forge_pattern** when you:
108
+ - Fix a bug
109
+ - Find better approach
110
+ - Discover gotcha
111
+ - Get corrected
112
+ - Solve auth/config
113
+ - Make architecture decision
114
+ - Debug non-trivially
115
+ - Find anti-pattern
116
+
117
+ **forge_directive** when user says:
118
+ - "always..." โ†’ MUST
119
+ - "never..." โ†’ NEVER
120
+ - "I prefer..." โ†’ PREFER
121
+ - "don't..." โ†’ AVOID
122
+
123
+ ## Response Format
124
+
125
+ End every response with:
126
+ ```
127
+ ---
128
+ ๐Ÿง  **ekkOS_โ„ข** ยท ๐Ÿ“… YYYY-MM-DD H:MM AM/PM TZ
129
+ ```