kodelyth-ecc 1.2.2 → 1.3.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.
@@ -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,184 @@
1
+ ---
2
+ name: agent-handoff
3
+ description: >
4
+ How to chain ECC specialist agents for multi-step problems —
5
+ pair-programmer → tdd-guide → code-reviewer → security-reviewer.
6
+ Use when one agent finishes its job and the next logical step needs
7
+ a different specialist. Documents the standard handoff protocol so
8
+ agents pass context cleanly.
9
+ ---
10
+
11
+ # Agent Handoff Protocol
12
+
13
+ Single agents handle single concerns. Real engineering tasks span multiple concerns. **Handoffs** are how ECC chains agents without losing context.
14
+
15
+ ## The 3-Line Handoff Protocol
16
+
17
+ When an agent finishes its scope and the next step needs a different specialist, it ends with exactly this shape:
18
+
19
+ ```
20
+ ─────────────────────────────────────
21
+ HANDOFF
22
+ From: <current-agent>
23
+ To: <next-agent>
24
+ Why: <one-line reason>
25
+ Carry: <what the next agent needs to know>
26
+ ─────────────────────────────────────
27
+ ```
28
+
29
+ Then **stop**. The next agent picks up from `Carry:`.
30
+
31
+ ## Standard Chains
32
+
33
+ These are the most common multi-agent flows. Memorize them.
34
+
35
+ ### Build something new (clean path)
36
+
37
+ ```
38
+ pair-programmer → tdd-guide → code-reviewer → api-guardian (if API)
39
+ → security-reviewer (if sensitive)
40
+ → ux-reviewer (if UI)
41
+ ```
42
+
43
+ `pair-programmer` agrees on approach. `tdd-guide` writes failing tests first. The implementer writes code. `code-reviewer` checks it. Specialist reviewers check their domain.
44
+
45
+ ### Bug in production
46
+
47
+ ```
48
+ debug-detective → tdd-guide → refactor-cleaner (optional)
49
+ (root cause) (regression test)
50
+ ```
51
+
52
+ Always add a regression test after a real-bug fix. Always.
53
+
54
+ ### Refactor a module
55
+
56
+ ```
57
+ code-explorer → refactor-cleaner → tdd-guide → code-reviewer
58
+ (map dependencies) (cleanup) (verify behavior)
59
+ ```
60
+
61
+ ### Performance investigation
62
+
63
+ ```
64
+ performance-optimizer → tdd-guide → code-reviewer
65
+ (perf regression test)
66
+ ```
67
+
68
+ ### API change
69
+
70
+ ```
71
+ api-guardian → pair-programmer → tdd-guide → doc-updater
72
+ (blast radius) (impl approach) (changelog)
73
+ ```
74
+
75
+ ### Security audit
76
+
77
+ ```
78
+ security-reviewer → tdd-guide → release-captain
79
+ (security regression test) (patch release)
80
+ ```
81
+
82
+ ### Open-source a private project
83
+
84
+ ```
85
+ opensource-forker → opensource-sanitizer → opensource-packager → release-captain
86
+ (make a clean fork) (strip secrets/PII) (README, license, examples) (cut v0.1.0)
87
+ ```
88
+
89
+ ### Framework migration
90
+
91
+ ```
92
+ migration-guide → pair-programmer → tdd-guide → pr-test-analyzer
93
+ (phase plan) (per-phase impl) (verify coverage on PR)
94
+ ```
95
+
96
+ ### Build is broken
97
+
98
+ ```
99
+ build-error-resolver → dependency-doctor (if dep issue)
100
+ → env-debugger (if env issue)
101
+ → debug-detective (if it's actually a runtime bug surfacing at build)
102
+ ```
103
+
104
+ ### CI is flaky
105
+
106
+ ```
107
+ flake-hunter → tdd-guide → release-captain (if it gates a release)
108
+ (deterministic test)
109
+ ```
110
+
111
+ ### Git is on fire
112
+
113
+ ```
114
+ git-rescue → release-captain (if a release was midway)
115
+ ```
116
+
117
+ ## Carry Field — What to Pass Forward
118
+
119
+ The `Carry:` line is the most important. Bad carry breaks the chain.
120
+
121
+ **Good carry:**
122
+ > "Bug is in `processPayment()` line 142 — race between `lockBalance()` and `commitTx()`. The lock returns before the DB transaction is durable. Add a regression test that simulates a 50ms commit delay and asserts no double-spend."
123
+
124
+ **Bad carry:**
125
+ > "There was a bug, please test it"
126
+
127
+ The next agent should be able to start work from `Carry:` alone, without re-reading the whole conversation.
128
+
129
+ ## When NOT to Hand Off
130
+
131
+ - The current agent's job isn't actually done. Finish it.
132
+ - The user explicitly said "just do this one thing." Respect it.
133
+ - The next step is **trivial** and a handoff would slow it down (e.g., a one-line change). Just do it.
134
+ - The user is **already in flow** and a handoff context-switch would interrupt them. Wait for a natural pause.
135
+
136
+ ## Parallel Handoffs
137
+
138
+ Some problems need multiple agents at once, not in sequence:
139
+
140
+ ```
141
+ "Building a new payment endpoint" →
142
+
143
+ [PARALLEL]
144
+ ├─ api-guardian (contract review)
145
+ ├─ security-reviewer (auth, input validation, idempotency)
146
+ └─ pair-programmer (overall approach)
147
+
148
+ [SEQUENTIAL after agreement]
149
+ tdd-guide → implementer → code-reviewer
150
+ ```
151
+
152
+ Announce the parallel set up front so the user knows what's happening:
153
+
154
+ ```
155
+ This touches three concerns at once. I'm consulting:
156
+ • api-guardian — for contract design
157
+ • security-reviewer — for auth & validation
158
+ • pair-programmer — for overall structure
159
+
160
+ Then we'll move to tests + implementation.
161
+ ```
162
+
163
+ ## Handoff Hygiene
164
+
165
+ - **Always** name both agents (from/to)
166
+ - **Always** justify the handoff in one line (why this specialist now?)
167
+ - **Always** package the carry — the next agent should not need to re-investigate
168
+ - **Never** chain more than 4 agents in a single response — that's a sign the task is too big and needs decomposition (use `planner`)
169
+
170
+ ## Self-Handoff Rule
171
+
172
+ An agent may **stay in role** for the next step if it's still within its specialty. Don't fake a handoff just because the conversation continues:
173
+
174
+ - `debug-detective` may continue after finding the cause to **explain** the cause — that's still debugging.
175
+ - `code-reviewer` may continue to suggest specific fixes — still review scope.
176
+ - But `code-reviewer` writing the actual fix at scale → hand off to the implementer (or appropriate language reviewer with `code-architect` for blueprint).
177
+
178
+ ## The Master Conductor: kodelyth-advisor
179
+
180
+ When in doubt about whom to hand off to, the user can always invoke `kodelyth-advisor`. The advisor doesn't do the work — it picks the right specialist and routes.
181
+
182
+ ```
183
+ Any agent → kodelyth-advisor (if next step is unclear) → Right specialist
184
+ ```
@@ -0,0 +1,134 @@
1
+ ---
2
+ name: intent-routing
3
+ description: >
4
+ How Kodelyth ECC auto-detects user intent and routes to the right
5
+ specialist agent without requiring explicit invocation. Read this when
6
+ you (the AI) want to understand the routing rule, when the user asks
7
+ "how does the toolkit decide which agent to use", or when designing a
8
+ new agent and need to know what trigger patterns it should claim.
9
+ ---
10
+
11
+ # Intent Routing — How ECC Picks the Right Agent
12
+
13
+ ECC has **two activation paths** for its 53 specialist agents:
14
+
15
+ 1. **Explicit** — user types `use <agent>`, `@agent`, or `invoke <agent>`
16
+ 2. **Implicit (intent routing)** — the AI reads the user's message, infers the right specialist, announces the routing, and behaves as that agent
17
+
18
+ Most users never type `use ...`. Intent routing is what makes the toolkit feel **alive** instead of like a directory of files.
19
+
20
+ ## The Routing Contract
21
+
22
+ When intent routing fires, the AI MUST do four things in order:
23
+
24
+ 1. **Acknowledge the routing** in one short line above the response:
25
+ ```
26
+ → Routing to debug-detective (your error message + frustration matches the bug-tracking signal)
27
+ ```
28
+ 2. **Behave as that agent** — adopt its persona, methodology, and constraints for the rest of the response
29
+ 3. **Suggest the explicit invocation** in one closing line:
30
+ ```
31
+ Tip: next time you can type "use debug-detective" to invoke me directly.
32
+ ```
33
+ 4. **Stay transparent** — never silently route. The user must always know which agent is "speaking".
34
+
35
+ ## The Source of Truth
36
+
37
+ The full routing table lives in `rules/common/agent-intent-routing.md`. This skill is a **summary + design guide**.
38
+
39
+ If you (an agent author) want to claim trigger patterns for a new agent, you must:
40
+
41
+ 1. Add your patterns to `agent-intent-routing.md`
42
+ 2. Pick a priority tier (1 = crisis, 10 = chaining)
43
+ 3. Verify your patterns don't collide with an existing higher-priority agent
44
+ 4. Add a counter-pattern (when NOT to route here)
45
+
46
+ ## Priority Tiers (Why They Matter)
47
+
48
+ When two agents could match, the **higher tier wins**.
49
+
50
+ | Tier | Theme | Example agents |
51
+ |---|---|---|
52
+ | 1 | Crisis & emotional state | kodelyth-advisor, pair-programmer |
53
+ | 2 | Active pain (something broken) | debug-detective, build-error-resolver, env-debugger |
54
+ | 3 | Quality & review | code-reviewer, security-reviewer, ux-reviewer, api-guardian |
55
+ | 4 | Performance & scale | performance-optimizer |
56
+ | 5 | Planning & architecture | planner, architect, code-architect, migration-guide |
57
+ | 6 | Testing | tdd-guide, e2e-runner, pr-test-analyzer, flake-hunter |
58
+ | 7 | Code hygiene | refactor-cleaner, code-simplifier, type-design-analyzer |
59
+ | 8 | Documentation | doc-updater, docs-lookup, comment-analyzer |
60
+ | 9 | Specialized | seo-specialist, opensource-*, dependency-doctor, git-rescue, release-captain |
61
+ | 10 | Multi-agent chains | (handoffs between any two agents) |
62
+
63
+ **Why crisis is tier 1:** if a user says "I'm stuck on this bug", we route to `kodelyth-advisor` first (emotional state) rather than `debug-detective` (the technical one). The advisor will then often hand off to `debug-detective` once the user describes the actual bug.
64
+
65
+ ## What Counts as a Trigger
66
+
67
+ A trigger is a **regex or keyword pattern in the user's message**. Good triggers:
68
+
69
+ - **Direct verbs**: "review", "debug", "optimize", "migrate"
70
+ - **State words**: "broken", "slow", "stuck", "failing", "vulnerable"
71
+ - **Domain terms**: "JWT", "SQL injection", "WCAG", "TypeScript", "Postgres"
72
+ - **Emotional cues**: "I'm lost", "I've been trying for hours", "this won't work"
73
+
74
+ Bad triggers (avoid):
75
+
76
+ - Single common words like "and", "the", "code" (will match everything)
77
+ - Words that are equally valid for two different agents without any disambiguator
78
+ - Metaphors that are easy to miss ("my code is on fire" — too loose)
79
+
80
+ ## Counter-Patterns (When NOT to Route)
81
+
82
+ Always include these in any new agent:
83
+
84
+ - The user **already explicitly invoked** another agent — that wins
85
+ - The message is a **one-line factual question** — answer directly, don't route
86
+ - The message is **purely conversational** ("hi", "thanks") — don't route
87
+ - The user explicitly says **"don't route" or "just answer me"** — respect it
88
+ - The user is in a **defined multi-step workflow** with another agent — don't interrupt
89
+
90
+ ## Example: Designing a New Agent's Trigger Section
91
+
92
+ ```markdown
93
+ ### `dependency-doctor` — npm/pip/cargo/maven dep hell
94
+
95
+ | Signal | Examples |
96
+ |---|---|
97
+ | Install failure | "npm install fails", "cannot resolve", "yarn install error" |
98
+ | Lockfile drift | "package-lock conflict", "yarn.lock conflict", "lockfile diff" |
99
+ | CVE | "audit shows", "CVE-", "vulnerable dependency" |
100
+ | Version conflict | "ERESOLVE", "peer dep conflict", "conflicting versions" |
101
+ | Bloat | "bundle too big", "node_modules huge", "dep audit" |
102
+
103
+ Counter-signals (do NOT route here):
104
+ - Generic "build failed" without dep mention → `build-error-resolver`
105
+ - Runtime null pointer → `debug-detective`
106
+ ```
107
+
108
+ ## Example: Routing Decisions in the Wild
109
+
110
+ | User says | Route to | Why |
111
+ |---|---|---|
112
+ | "I'm getting a TypeError on line 42" | `debug-detective` | T2 — specific error |
113
+ | "Should I use React Context or Zustand?" | `pair-programmer` | T1 — pre-implementation question |
114
+ | "Review my login component" | `typescript-reviewer` (if .ts file) or `code-reviewer` | T3 — review request |
115
+ | "I have no idea where to start with this auth migration" | `kodelyth-advisor` | T1 — lost / overwhelmed |
116
+ | "How do I make this faster?" | `performance-optimizer` | T4 — perf |
117
+ | "Is my JWT signing secure?" | `security-reviewer` | T3 — security keyword |
118
+ | "build failed on Vercel" | `build-error-resolver` | T2 — build failure |
119
+ | "Tests pass locally but fail on CI" | `flake-hunter` then `env-debugger` | T2 — flake or env diff |
120
+ | "Migrate Pages Router to App Router" | `migration-guide` | T5 — framework migration |
121
+ | "Add accessibility to this form" | `ux-reviewer` | T3 — a11y |
122
+ | "open source this project" | `opensource-forker` (chain start) | T9 — OSS chain |
123
+ | "I lost my commits after `reset --hard`" | `git-rescue` | T9 — git crisis |
124
+
125
+ ## Anti-Patterns to Avoid
126
+
127
+ - **Silent routing**: jumping into `debug-detective` without a "→ Routing to" line. The user thinks the AI just changed personality randomly.
128
+ - **Over-routing**: claiming `code-reviewer` for every code-related message. Reserve it for explicit review intent.
129
+ - **Under-routing**: ignoring obvious signals because the user didn't type the magic word.
130
+ - **Stacking**: routing to 4 agents at once. Pick **one or at most two parallel agents**.
131
+
132
+ ## Skill Authors: Add Your Triggers Here
133
+
134
+ When you build a new agent, update `rules/common/agent-intent-routing.md`. The intent rule is **the toolkit's nervous system**. Better intent rules = better routing = better user experience.