kodelyth-ecc 1.2.2 → 1.4.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 (46) hide show
  1. package/AGENTS.md +101 -181
  2. package/CHANGELOG.md +67 -0
  3. package/CLAUDE.md +72 -63
  4. package/KODELYTH.md +79 -44
  5. package/README.md +244 -192
  6. package/VERSION +1 -1
  7. package/agents/dependency-doctor.md +120 -0
  8. package/agents/env-debugger.md +154 -0
  9. package/agents/flake-hunter.md +142 -0
  10. package/agents/git-rescue.md +133 -0
  11. package/agents/kodelyth-memory.md +87 -0
  12. package/agents/release-captain.md +190 -0
  13. package/bin/kodelyth-ecc.js +18 -12
  14. package/commands/memory.md +62 -0
  15. package/hooks/hooks.json +26 -0
  16. package/hooks/memory/capture-stop.js +88 -0
  17. package/hooks/memory/inject-start.js +60 -0
  18. package/install.ps1 +28 -9
  19. package/install.sh +11 -97
  20. package/package.json +4 -2
  21. package/rules/common/agent-intent-routing.md +337 -0
  22. package/rules/common/memory-protocol.md +56 -0
  23. package/scripts/memory/cli.js +200 -0
  24. package/scripts/memory/extract.js +176 -0
  25. package/scripts/memory/inject.js +145 -0
  26. package/scripts/memory/store.js +300 -0
  27. package/skills/agent-handoff/SKILL.md +184 -0
  28. package/skills/intent-routing/SKILL.md +134 -0
  29. package/skills/kodelyth-memory/SKILL.md +136 -0
  30. package/tests/memory/store.test.js +121 -0
  31. package/dashboard/lib/agent-tracker.js +0 -366
  32. package/dashboard/lib/aggregator.js +0 -119
  33. package/dashboard/lib/cost-calculator.js +0 -50
  34. package/dashboard/lib/platform-detector.js +0 -89
  35. package/dashboard/lib/readers/antigravity-reader.js +0 -113
  36. package/dashboard/lib/readers/claude-reader.js +0 -135
  37. package/dashboard/lib/readers/codex-reader.js +0 -192
  38. package/dashboard/lib/readers/cursor-reader.js +0 -135
  39. package/dashboard/lib/readers/opencode-reader.js +0 -201
  40. package/dashboard/lib/readers/windsurf-reader.js +0 -146
  41. package/dashboard/package.json +0 -24
  42. package/dashboard/public/index.html +0 -1221
  43. package/dashboard/server.js +0 -119
  44. package/scripts/agent-tracker-hook.js +0 -81
  45. package/social/readme-lens.svg +0 -140
  46. package/social/readme-savings.svg +0 -56
package/install.sh CHANGED
@@ -47,7 +47,7 @@ echo -e "${RED}${BOLD} ║ DANGER LEVEL: GOD TIER · NOT FOR JUNIOR DEV
47
47
  echo -e "${RED}${BOLD} ╚══════════════════════════════════════════════════════════════╝${RESET}"
48
48
  echo ""
49
49
  echo -e "${BOLD} Kodelyth ECC — The most dangerous AI coding toolkit on the planet${RESET}"
50
- echo -e "${CYAN} 53 specialist agents · 185 skills · 79 commands · 18+ hooks${RESET}"
50
+ echo -e "${CYAN} 59 specialist agents · 188 skills · 80 commands · 18+ hooks · intent routing · local memory${RESET}"
51
51
  echo -e "${CYAN} Any language · Any framework · Any scale · 300B-level quality${RESET}"
52
52
  echo ""
53
53
  echo -e " github.com/sifxprime/kodelyth-ecc"
@@ -344,8 +344,8 @@ echo ""
344
344
 
345
345
  case "$TARGET" in
346
346
  claude-home)
347
- install_dir "$SCRIPT_DIR/agents" "$AGENTS_DEST" "Agents (53)"
348
- install_dir "$SCRIPT_DIR/skills" "$SKILLS_DEST" "Skills (185)"
347
+ install_dir "$SCRIPT_DIR/agents" "$AGENTS_DEST" "Agents (58)"
348
+ install_dir "$SCRIPT_DIR/skills" "$SKILLS_DEST" "Skills (187)"
349
349
  install_dir "$SCRIPT_DIR/commands" "$COMMANDS_DEST" "Commands (79)"
350
350
  install_hooks "$HOOKS_DEST"
351
351
  # Rules: install common + selected languages
@@ -387,19 +387,19 @@ case "$TARGET" in
387
387
 
388
388
  cursor-project)
389
389
  install_flat "$SCRIPT_DIR/rules" "$RULES_DEST" "Rules (flattened)"
390
- install_dir "$SCRIPT_DIR/skills" "$SKILLS_DEST" "Skills (183)"
390
+ install_dir "$SCRIPT_DIR/skills" "$SKILLS_DEST" "Skills (187)"
391
391
  ;;
392
392
 
393
393
  codex-home)
394
- install_dir "$SCRIPT_DIR/agents" "$AGENTS_DEST" "Agents (53)"
395
- install_dir "$SCRIPT_DIR/skills" "$SKILLS_DEST" "Skills (185)"
394
+ install_dir "$SCRIPT_DIR/agents" "$AGENTS_DEST" "Agents (58)"
395
+ install_dir "$SCRIPT_DIR/skills" "$SKILLS_DEST" "Skills (187)"
396
396
  install_dir "$SCRIPT_DIR/commands" "$COMMANDS_DEST" "Commands (79)"
397
397
  install_flat "$SCRIPT_DIR/rules" "$RULES_DEST" "Rules (flattened)"
398
398
  ;;
399
399
 
400
400
  windsurf-project|windsurf-home)
401
- install_dir "$SCRIPT_DIR/agents" "$AGENTS_DEST" "Agents (53)"
402
- install_dir "$SCRIPT_DIR/skills" "$SKILLS_DEST" "Skills (185)"
401
+ install_dir "$SCRIPT_DIR/agents" "$AGENTS_DEST" "Agents (58)"
402
+ install_dir "$SCRIPT_DIR/skills" "$SKILLS_DEST" "Skills (187)"
403
403
  install_flat "$SCRIPT_DIR/rules" "$RULES_DEST" "Rules (flattened)"
404
404
  generate_windsurfrules "$SCRIPT_DIR/rules" "$WINDSURFRULES_DEST"
405
405
  ;;
@@ -409,31 +409,6 @@ case "$TARGET" in
409
409
  ;;
410
410
  esac
411
411
 
412
- # ── Install Kodelyth Lens dashboard ──────────────────────────────────────────
413
- LENS_DEST="$HOME_DIR/.kodelyth/lens"
414
- LENS_INSTALLED=false
415
- if [[ -d "$SCRIPT_DIR/dashboard" ]]; then
416
- mkdir -p "$LENS_DEST"
417
- cp -r "$SCRIPT_DIR/dashboard"/. "$LENS_DEST/"
418
- echo -e " ${GREEN}✓${RESET} Kodelyth Lens dashboard ${BLUE}(→ $LENS_DEST)${RESET}"
419
- # Create launcher script
420
- cat > "$HOME_DIR/.kodelyth/lens.sh" <<'LENS'
421
- #!/usr/bin/env bash
422
- cd "$HOME/.kodelyth/lens" && node server.js
423
- LENS
424
- chmod +x "$HOME_DIR/.kodelyth/lens.sh"
425
- echo -e " ${GREEN}✓${RESET} Lens launcher ${BLUE}(→ ~/.kodelyth/lens.sh)${RESET}"
426
- LENS_INSTALLED=true
427
- fi
428
-
429
- # ── Install agent-tracker hook script ─────────────────────────────────────────
430
- if [[ -f "$SCRIPT_DIR/scripts/agent-tracker-hook.js" ]] && [[ "$TARGET" == "claude-home" ]]; then
431
- HOOKS_SCRIPTS="$HOME_DIR/.claude/hooks/scripts"
432
- mkdir -p "$HOOKS_SCRIPTS"
433
- cp "$SCRIPT_DIR/scripts/agent-tracker-hook.js" "$HOOKS_SCRIPTS/agent-tracker-hook.js"
434
- echo -e " ${GREEN}✓${RESET} Agent tracker hook ${BLUE}(→ $HOOKS_SCRIPTS)${RESET}"
435
- fi
436
-
437
412
  # ── Write install state ───────────────────────────────────────────────────────
438
413
  VERSION="$(cat "$SCRIPT_DIR/VERSION" 2>/dev/null || echo "1.0.0")"
439
414
  STATE_FILE="$DEST/kodelyth-ecc-install-state.json"
@@ -455,58 +430,6 @@ echo ""
455
430
  echo -e "${GREEN}${BOLD} ARMED AND OPERATIONAL.${RESET}"
456
431
  echo ""
457
432
 
458
- # ── Auto-start Kodelyth Lens (claude-home only) ───────────────────────────────
459
- if [[ "$TARGET" == "claude-home" ]] && [[ "$LENS_INSTALLED" == "true" ]]; then
460
- if command -v node &>/dev/null; then
461
- LENS_PORT="${LENS_PORT:-3456}"
462
- LENS_LOG="$HOME_DIR/.kodelyth/lens.log"
463
-
464
- # Kill any existing Lens process on this port
465
- if command -v lsof &>/dev/null; then
466
- OLD_PID="$(lsof -ti ":$LENS_PORT" 2>/dev/null || true)"
467
- if [[ -n "$OLD_PID" ]]; then
468
- kill "$OLD_PID" 2>/dev/null || true
469
- fi
470
- fi
471
-
472
- # Start Lens server in background
473
- nohup node "$LENS_DEST/server.js" > "$LENS_LOG" 2>&1 &
474
- LENS_PID=$!
475
-
476
- # Wait up to 5 seconds for the server to be ready
477
- LENS_READY=false
478
- for i in 1 2 3 4 5; do
479
- sleep 1
480
- if command -v curl &>/dev/null && curl -sf "http://localhost:$LENS_PORT/api/stats" >/dev/null 2>&1; then
481
- LENS_READY=true
482
- break
483
- elif command -v wget &>/dev/null && wget -qO- "http://localhost:$LENS_PORT/api/stats" >/dev/null 2>&1; then
484
- LENS_READY=true
485
- break
486
- fi
487
- done
488
-
489
- if [[ "$LENS_READY" == "true" ]]; then
490
- echo -e " ${GREEN}✓${RESET} Kodelyth Lens started ${BLUE}(PID $LENS_PID · port $LENS_PORT)${RESET}"
491
- # Open browser — macOS: open, Linux: xdg-open, WSL: explorer.exe
492
- if [[ "$OSTYPE" == "darwin"* ]]; then
493
- open "http://localhost:$LENS_PORT" 2>/dev/null || true
494
- echo -e " ${GREEN}✓${RESET} Dashboard opened in browser"
495
- elif command -v xdg-open &>/dev/null; then
496
- xdg-open "http://localhost:$LENS_PORT" 2>/dev/null &
497
- echo -e " ${GREEN}✓${RESET} Dashboard opened in browser"
498
- elif command -v explorer.exe &>/dev/null; then
499
- explorer.exe "http://localhost:$LENS_PORT" 2>/dev/null || true
500
- echo -e " ${GREEN}✓${RESET} Dashboard opened in browser"
501
- fi
502
- else
503
- echo -e " ${YELLOW}⚠${RESET} Lens server started (PID $LENS_PID) — open http://localhost:$LENS_PORT manually"
504
- fi
505
-
506
- echo ""
507
- fi
508
- fi
509
-
510
433
  case "$TARGET" in
511
434
  claude-home)
512
435
  echo -e "${BOLD} Claude Code — what to do now:${RESET}"
@@ -519,13 +442,8 @@ case "$TARGET" in
519
442
  echo " use ux-reviewer ← after touching any UI"
520
443
  echo " /kodelyth-quickstart ← full onboarding guide"
521
444
  echo ""
522
- echo -e "${BOLD} Kodelyth LensUsage Dashboard:${RESET}"
523
- echo ""
524
- echo " node ~/.kodelyth/lens/server.js"
525
- echo " Open: http://localhost:3456"
526
- echo ""
527
- echo " Tracks agents, costs, cache savings across"
528
- echo " Claude Code · Cursor · Windsurf · Codex · OpenCode · Antigravity"
445
+ echo " Intent routing is god-tier describe your problem in plain words"
446
+ echo " and the right specialist agent is auto-suggested."
529
447
  ;;
530
448
  antigravity)
531
449
  echo -e "${BOLD} Google Antigravity — what to do now:${RESET}"
@@ -557,17 +475,13 @@ case "$TARGET" in
557
475
  echo -e "${BOLD} Windsurf — what to do now:${RESET}"
558
476
  echo ""
559
477
  echo " Open your project in Windsurf (Cascade)."
560
- echo " .windsurfrules is active — 12 coding rules loaded automatically."
478
+ echo " .windsurfrules is active — 15 coding rules + intent routing loaded automatically."
561
479
  echo " Agents available in .windsurf/agents/"
562
480
  echo ""
563
481
  echo " use kodelyth-advisor ← not sure where to start"
564
482
  echo " use debug-detective ← trace any bug to root cause"
565
483
  echo " use ux-reviewer ← after touching any UI"
566
484
  echo " use api-guardian ← API contract protection"
567
- echo ""
568
- echo " Kodelyth Lens — Usage Dashboard:"
569
- echo " node ~/.kodelyth/lens/server.js"
570
- echo " Open: http://localhost:3456"
571
485
  ;;
572
486
  *)
573
487
  echo -e "${BOLD} What to do now:${RESET}"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "kodelyth-ecc",
3
- "version": "1.2.2",
4
- "description": "Production-grade AI coding toolkit — 53 agents, 185 skills, 79 commands. Works with Claude Code, Windsurf, Cursor, Codex, Antigravity, and OpenCode.",
3
+ "version": "1.4.0",
4
+ "description": "Production-grade AI coding toolkit — 59 agents, 188 skills, 79 commands, god-tier intent routing, local self-learning memory. Works with Claude Code, Windsurf, Cursor, Codex, Antigravity, and OpenCode.",
5
5
  "author": "Kodelyth <github.com/sifxprime>",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -19,6 +19,8 @@
19
19
  "ai-agents",
20
20
  "coding-toolkit",
21
21
  "llm",
22
+ "memory",
23
+ "self-learning",
22
24
  "kodelyth"
23
25
  ],
24
26
  "bin": {
@@ -0,0 +1,337 @@
1
+ # Agent Intent Routing — Auto-Detect User Intent → Right Specialist Agent
2
+
3
+ This rule teaches the AI to **automatically route the user to the correct specialist agent** based on what they say, write, or feel — without requiring `use <agent-name>` syntax.
4
+
5
+ When any of the patterns below match the user's message, the AI MUST:
6
+
7
+ 1. **Acknowledge** the routing in one short line: `→ Routing to <agent-name>`
8
+ 2. **Behave as that agent** for the rest of that response (apply its persona, methodology, and constraints)
9
+ 3. **Suggest the explicit invocation** at the end so the user learns the toolkit: `Tip: next time you can type "use <agent-name>"`
10
+
11
+ If multiple agents match, pick the **highest priority** below (priority decreases top-to-bottom). If two are equally relevant, name both and ask the user which to use.
12
+
13
+ **Never silently route.** Always be transparent about which agent is taking over.
14
+
15
+ ---
16
+
17
+ ## Priority 1 — Crisis & Emotional Signals
18
+
19
+ ### `kodelyth-advisor` — User is lost, stuck, overwhelmed
20
+
21
+ Trigger if the user expresses **uncertainty about direction**, not a specific technical question.
22
+
23
+ | Signal | Examples |
24
+ |---|---|
25
+ | Stuck / lost | "I'm stuck", "I'm lost", "I have no idea", "I don't know where to start" |
26
+ | Overwhelmed | "this is too much", "I'm overwhelmed", "where do I even begin" |
27
+ | Asking for direction | "what should I do", "help me figure out", "should I X or Y", "I'm not sure" |
28
+ | Confused about the codebase | "I don't understand this code", "how does this even work" |
29
+ | First-time on a problem | "first time doing X", "never done this before", "is there a right way" |
30
+
31
+ **Counter-signals (do NOT route here):** specific technical question, error message, or named file/function.
32
+
33
+ ### `pair-programmer` — User is about to write code
34
+
35
+ Trigger if the user describes **what they're about to build** before they start.
36
+
37
+ | Signal | Examples |
38
+ |---|---|
39
+ | Pre-implementation | "I want to build", "I'm going to add", "let's create", "I need to make a" |
40
+ | Approach question | "how should I implement", "what's the best way to", "should I use X pattern" |
41
+ | Architecture sketch | "I'm thinking of doing X then Y", "my plan is to" |
42
+ | Pre-flight check | "before I start", "thinking about", "planning to" |
43
+
44
+ ---
45
+
46
+ ## Priority 2 — Active Pain (something is broken)
47
+
48
+ ### `debug-detective` — Bug, error, unexpected behavior
49
+
50
+ | Signal | Examples |
51
+ |---|---|
52
+ | Direct bug report | "bug", "broken", "crashed", "exception", "stack trace", "traceback" |
53
+ | Frustration | "I've been trying for hours", "can't figure out why", "this won't work" |
54
+ | Unexpected behavior | "why is this X", "shouldn't this Y", "not what I expected" |
55
+ | Specific error keywords | `TypeError`, `NullPointerException`, `panic`, `segfault`, `undefined`, `cannot read property` |
56
+ | Test failures | "test fails", "expected X got Y", "assertion failed" |
57
+
58
+ **Always:** ask for the exact error, the minimal repro, and what was changed last.
59
+
60
+ ### `silent-failure-hunter` — Something is wrong but no error
61
+
62
+ | Signal | Examples |
63
+ |---|---|
64
+ | Mismatch w/o error | "no error but wrong result", "data is wrong", "looks fine but isn't working" |
65
+ | Silent state corruption | "X happened but Y didn't fire", "the value is off", "race condition" |
66
+ | Swallowed exceptions | "try/catch", "fallback", "default value", "it just returns null" |
67
+
68
+ ### `build-error-resolver` — Build / compile / type errors
69
+
70
+ | Signal | Examples |
71
+ |---|---|
72
+ | Build failed | "build failed", "compile error", "won't compile", "cargo build", "npm run build" |
73
+ | Type errors | "type error", "TS2322", "type mismatch", "cannot assign", "incompatible types" |
74
+ | Module/import | "module not found", "cannot resolve", "import error" |
75
+
76
+ **Language-specific routing:** Go → `go-build-resolver`, Rust → `rust-build-resolver`, Java → `java-build-resolver`, Kotlin → `kotlin-build-resolver`, C++ → `cpp-build-resolver`, Dart/Flutter → `dart-build-resolver`, PyTorch → `pytorch-build-resolver`.
77
+
78
+ ---
79
+
80
+ ## Priority 3 — Quality & Review
81
+
82
+ ### `code-reviewer` — User wants feedback on existing code
83
+
84
+ | Signal | Examples |
85
+ |---|---|
86
+ | Direct review request | "review this", "code review", "LGTM?", "thoughts?", "feedback" |
87
+ | Quality check | "is this good", "is this clean", "anything wrong" |
88
+ | Refactor opportunity | "is there a better way", "smell test", "looks ugly" |
89
+
90
+ **Language-specific routing (if file extension or language is mentioned):**
91
+
92
+ | Language | Agent |
93
+ |---|---|
94
+ | TypeScript / JavaScript | `typescript-reviewer` |
95
+ | Python | `python-reviewer` |
96
+ | Go | `go-reviewer` |
97
+ | Rust | `rust-reviewer` |
98
+ | Java / Spring | `java-reviewer` |
99
+ | Kotlin / Android | `kotlin-reviewer` |
100
+ | C++ | `cpp-reviewer` |
101
+ | C# / .NET | `csharp-reviewer` |
102
+ | Flutter / Dart | `flutter-reviewer` |
103
+ | SQL / Postgres / Supabase | `database-reviewer` |
104
+ | Healthcare / EMR / PHI | `healthcare-reviewer` |
105
+
106
+ ### `security-reviewer` — Security concern
107
+
108
+ | Signal | Examples |
109
+ |---|---|
110
+ | Direct security question | "is this secure", "vulnerability", "CVE", "audit" |
111
+ | Common attacks | "SQL injection", "XSS", "CSRF", "SSRF", "auth bypass", "RCE", "path traversal" |
112
+ | Auth & secrets | "auth flow", "JWT", "session", "API key in code", "leaked secret", "exposed credential" |
113
+ | Crypto | "encryption", "hashing passwords", "salt", "AES", "RSA" |
114
+ | Input handling | "user input", "sanitize", "escape", "validation" |
115
+
116
+ ### `api-guardian` — API contract changes
117
+
118
+ | Signal | Examples |
119
+ |---|---|
120
+ | API change | "breaking change", "deprecate", "API version", "backwards compat" |
121
+ | Contract concern | "consumer impact", "client breakage", "field removal", "rename endpoint" |
122
+ | Spec work | "OpenAPI", "GraphQL schema", "REST design", "idempotent" |
123
+
124
+ ### `ux-reviewer` — Frontend / UX / Accessibility
125
+
126
+ | Signal | Examples |
127
+ |---|---|
128
+ | UI feedback | "feels off", "looks weird", "UX", "user experience", "interaction" |
129
+ | Accessibility | "a11y", "WCAG", "screen reader", "ARIA", "keyboard nav", "color contrast" |
130
+ | Form / interaction | "form validation", "loading state", "error state", "empty state" |
131
+ | Mobile / responsive | "mobile", "responsive", "viewport", "touch target" |
132
+
133
+ ---
134
+
135
+ ## Priority 4 — Performance & Scale
136
+
137
+ ### `performance-optimizer` — Slowness / bottleneck
138
+
139
+ | Signal | Examples |
140
+ |---|---|
141
+ | Slow | "slow", "sluggish", "laggy", "takes forever", "timing out" |
142
+ | Resource | "high CPU", "memory leak", "OOM", "out of memory", "cpu pinned" |
143
+ | Frontend perf | "FCP", "LCP", "INP", "bundle size", "render time", "jank" |
144
+ | Backend perf | "N+1", "slow query", "throughput", "latency", "p99" |
145
+
146
+ ---
147
+
148
+ ## Priority 5 — Planning & Architecture
149
+
150
+ ### `planner` — Feature planning
151
+
152
+ | Signal | Examples |
153
+ |---|---|
154
+ | Plan a feature | "plan this", "roadmap", "break down", "sprint plan", "milestones" |
155
+ | Decompose | "where do I start with X feature", "tasks for", "work items" |
156
+
157
+ ### `architect` — System design
158
+
159
+ | Signal | Examples |
160
+ |---|---|
161
+ | System-level | "architecture", "system design", "how should the services interact" |
162
+ | Choosing tech | "should I use Postgres or Mongo", "monorepo vs polyrepo", "REST vs GraphQL" |
163
+ | Scaling | "horizontal scaling", "sharding", "queue", "event-driven" |
164
+
165
+ ### `code-architect` — Single-feature blueprint
166
+
167
+ Trigger when the user wants a **detailed implementation blueprint for one specific feature**, not the whole system.
168
+
169
+ ### `migration-guide` — Framework / language version upgrade
170
+
171
+ | Signal | Examples |
172
+ |---|---|
173
+ | Upgrade | "upgrade from X to Y", "migrate to", "Next.js 12 → 15", "Python 2 → 3", "React 18 → 19" |
174
+ | Major version | "major version bump", "breaking deps", "node 18 → 22", "TS 4 → 5" |
175
+
176
+ ---
177
+
178
+ ## Priority 6 — Testing
179
+
180
+ ### `tdd-guide` — Tests, coverage, TDD
181
+
182
+ | Signal | Examples |
183
+ |---|---|
184
+ | Write tests | "write a test", "unit test", "integration test", "test for this" |
185
+ | TDD | "TDD", "test driven", "red green refactor" |
186
+ | Coverage | "coverage", "what's not tested", "coverage gap" |
187
+
188
+ ### `e2e-runner` — End-to-end Playwright tests
189
+
190
+ | Signal | Examples |
191
+ |---|---|
192
+ | E2E | "Playwright", "end-to-end", "E2E", "browser test", "user flow test" |
193
+ | Critical path | "checkout flow", "signup flow", "happy path test" |
194
+
195
+ ### `pr-test-analyzer` — Test coverage on PRs
196
+
197
+ | Signal | Examples |
198
+ |---|---|
199
+ | PR | "review my PR tests", "did I cover everything", "PR test gaps" |
200
+
201
+ ---
202
+
203
+ ## Priority 7 — Code Hygiene
204
+
205
+ ### `refactor-cleaner` — Dead code, cleanup
206
+
207
+ | Signal | Examples |
208
+ |---|---|
209
+ | Cleanup | "clean up", "dead code", "unused", "remove old", "tech debt" |
210
+ | Duplicate | "duplicate", "DRY", "extract function" |
211
+
212
+ ### `code-simplifier` — Reduce complexity
213
+
214
+ | Signal | Examples |
215
+ |---|---|
216
+ | Simplify | "simpler", "too complex", "hard to read", "convoluted" |
217
+ | Readability | "easier to follow", "more readable" |
218
+
219
+ ### `type-design-analyzer` — Type system improvements
220
+
221
+ | Signal | Examples |
222
+ |---|---|
223
+ | Type design | "better types", "stricter types", "type safety", "discriminated union", "generics" |
224
+ | `any` cleanup | "remove any", "stricter typing", "narrow type" |
225
+
226
+ ---
227
+
228
+ ## Priority 8 — Documentation
229
+
230
+ ### `doc-updater` — Update docs/README
231
+
232
+ | Signal | Examples |
233
+ |---|---|
234
+ | Docs | "update README", "document this", "add docs", "JSDoc", "docstring" |
235
+ | Onboarding | "explain how this works", "doc for new devs" |
236
+
237
+ ### `docs-lookup` — Library / framework API question
238
+
239
+ | Signal | Examples |
240
+ |---|---|
241
+ | Library API | "how do I use X library", "what's the signature", "API for X" |
242
+ | Framework feature | "Next.js App Router", "React Suspense", "Django ORM", "Rails 7" |
243
+
244
+ ### `comment-analyzer` — Comment quality
245
+
246
+ | Signal | Examples |
247
+ |---|---|
248
+ | Comments | "are my comments good", "comment hygiene", "explain why not what" |
249
+
250
+ ---
251
+
252
+ ## Priority 9 — Specialized Workflows
253
+
254
+ ### `chief-of-staff` — Communication, email, multi-channel ops
255
+
256
+ Trigger for non-code workflow tasks: drafting emails, scheduling, status updates, multi-channel coordination.
257
+
258
+ ### `seo-specialist` — SEO / metadata / search
259
+
260
+ | Signal | Examples |
261
+ |---|---|
262
+ | SEO | "SEO", "meta tags", "schema.org", "structured data", "Core Web Vitals", "sitemap" |
263
+
264
+ ### `opensource-forker` + `opensource-sanitizer` + `opensource-packager` — Open-sourcing a project
265
+
266
+ | Signal | Examples |
267
+ |---|---|
268
+ | OSS prep | "open source this", "make this public", "publish to GitHub", "strip secrets", "remove credentials" |
269
+
270
+ Use the chain: `forker` → `sanitizer` → `packager`.
271
+
272
+ ---
273
+
274
+ ## Priority 10 — Multi-Agent Patterns
275
+
276
+ ### Sequential chains (suggest the next agent)
277
+
278
+ | Just used | Suggest next |
279
+ |---|---|
280
+ | `pair-programmer` (approach agreed) | `code-reviewer` after implementation |
281
+ | `debug-detective` (root cause found) | `tdd-guide` to add a regression test |
282
+ | `code-reviewer` (issues found) | `refactor-cleaner` to fix |
283
+ | `security-reviewer` (vuln found) | `tdd-guide` to add a security test |
284
+ | `migration-guide` (plan made) | `pr-test-analyzer` after PR is up |
285
+ | `architect` (design done) | `code-architect` for the first feature |
286
+ | `performance-optimizer` (bottleneck found) | `tdd-guide` for a perf regression test |
287
+
288
+ ### Parallel suggestions
289
+
290
+ If the user has a multi-faceted concern, name the parallel agents:
291
+ - "I'm building a payment endpoint" → `pair-programmer` + `security-reviewer` + `api-guardian`
292
+ - "Refactoring the auth module" → `refactor-cleaner` + `security-reviewer` + `tdd-guide`
293
+
294
+ ---
295
+
296
+ ## Counter-Patterns — Do NOT Route
297
+
298
+ **Skip routing if:**
299
+
300
+ - The user **already explicitly invoked** an agent (`use <agent>`, `@agent`, `invoke <agent>`) — that takes precedence
301
+ - The message is **a one-liner factual question** ("what does `git stash pop` do?") — answer directly
302
+ - The message is **purely conversational** ("hi", "thanks", "ok") — respond normally
303
+ - The user says **"just answer me directly"** or **"don't route"** — respect it
304
+ - The user is in the middle of a **defined multi-step workflow** initiated by another agent
305
+
306
+ ---
307
+
308
+ ## Example Routing Decisions
309
+
310
+ | User says | Route to | Why |
311
+ |---|---|---|
312
+ | "I'm getting a TypeError on line 42" | `debug-detective` | Specific error, frustration implied |
313
+ | "Should I use React Context or Zustand here?" | `pair-programmer` | Pre-implementation approach question |
314
+ | "Review my login component" | `typescript-reviewer` (or `code-reviewer`) | Explicit review + likely TS |
315
+ | "I have no idea where to start with this auth migration" | `kodelyth-advisor` | Lost / overwhelmed |
316
+ | "How do I make this faster?" | `performance-optimizer` | Direct perf question |
317
+ | "Is my JWT signing secure?" | `security-reviewer` | Auth + security keyword |
318
+ | "build failed on Vercel" | `build-error-resolver` | Build failure |
319
+ | "Tests are slow / red" | `tdd-guide` first, then `debug-detective` if reds | Test-first reasoning |
320
+ | "Migrate from Pages Router to App Router" | `migration-guide` | Framework migration |
321
+ | "Add accessibility to this form" | `ux-reviewer` | a11y |
322
+ | "Plan the v2 redesign" | `planner` → `architect` | Plan + design |
323
+ | "open source this project" | `opensource-forker` | OSS chain start |
324
+
325
+ ---
326
+
327
+ ## Output Format When Routing
328
+
329
+ ```
330
+ → Routing to debug-detective (your error message + frustration matches the bug-tracking signal)
331
+
332
+ [response in debug-detective's style — methodical, hypothesis-driven, asks for repro]
333
+
334
+ Tip: next time you can type "use debug-detective" to invoke me directly.
335
+ ```
336
+
337
+ This keeps the user **informed**, **never surprised**, and **learning the toolkit** with every interaction.
@@ -0,0 +1,56 @@
1
+ # Kodelyth Memory Protocol
2
+
3
+ > Auto-loaded every session. Tells the AI when to consult and contribute to local memory.
4
+
5
+ ## What is Kodelyth Memory
6
+
7
+ A local file at `~/.kodelyth/memory/memories.jsonl` storing solutions, patterns, and gotchas extracted from past sessions. Retrieval is BM25 (keyword + tag matching). It is **not** a learned model — it is a retrieval store that gives you better context.
8
+
9
+ If the SessionStart hook ran, you have already received a memory block in your initial context with:
10
+ - The user's recurring patterns (tags seen across multiple sessions)
11
+ - Recent solutions in this project
12
+ - Their detected stack
13
+
14
+ ## When to recall memory mid-session
15
+
16
+ Trigger a memory recall (run the `kodelyth-memory` agent or `node scripts/memory/cli.js search "<query>"`) when **any** of these is true:
17
+
18
+ 1. The user describes a task in a domain that matches a tag in their memory (`payments`, `auth`, `database`, `deployment`, etc.)
19
+ 2. The user asks "have I done this before?" or "how did I solve X last time?"
20
+ 3. The user mentions a library, framework, or service by name that appears in past memories
21
+ 4. You're about to commit to an architectural decision and want to check past precedent
22
+
23
+ ## How to surface a recalled memory
24
+
25
+ Naturally, never robotically. Pattern:
26
+
27
+ > I checked your memory — you solved a similar problem in `<project>` on `<date>`. The approach that worked was `<approach>`. Want me to apply the same here, or is this case different?
28
+
29
+ Always end by giving the user the option to override. Memory is a hint, not a command.
30
+
31
+ ## When to capture a new memory
32
+
33
+ Capture when **all** are true:
34
+ - The user signals success (`"that worked"`, `"perfect"`, `"fixed it"`, `"thanks"`, `"done"`)
35
+ - The work involved real iteration (not a one-shot trivial fix)
36
+ - The lesson is reusable (would help in another similar problem, not just this exact file)
37
+
38
+ Show the user the draft memory before storing. Never silently capture.
39
+
40
+ ## What you must not do
41
+
42
+ - **Never** auto-recall the same memory twice in one session (the user has seen it)
43
+ - **Never** capture without explicit confirmation (`yes`, `store it`, `remember`)
44
+ - **Never** treat a recalled memory as ground truth — it could be stale
45
+ - **Never** transmit memory data anywhere — it is local-only by design
46
+ - **Never** fabricate a memory ("you usually...") if no relevant memory exists — say nothing
47
+
48
+ ## Cache-aware behaviour
49
+
50
+ The injected memory block is structured so its prefix is identical across calls in the same project. Do not rewrite or reorder this block during a session — that defeats the prompt cache and burns tokens. If you need to add session-specific notes, append them after the block.
51
+
52
+ ## Honest disclosure
53
+
54
+ If the user asks "how do you know that about me?", answer plainly:
55
+
56
+ > "It's in your local Kodelyth Memory at `~/.kodelyth/memory/`. You can inspect it, edit it, or delete it any time. Nothing was sent anywhere."