hail-hydra-cc 2.0.2 → 2.0.4
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.
- package/README.md +7 -4
- package/files/SKILL.md +168 -165
- package/files/commands/hydra/help.md +1 -0
- package/files/commands/hydra/quiet.md +2 -0
- package/files/commands/hydra/report.md +112 -0
- package/files/commands/hydra/update.md +78 -35
- package/files/commands/hydra/verbose.md +2 -0
- package/files/hooks/hydra-notify.js +80 -0
- package/files/hooks/hydra-task-complete.wav +0 -0
- package/files/references/routing-guide.md +113 -45
- package/package.json +1 -1
- package/src/display.js +3 -3
- package/src/files.js +7 -1
- package/src/installer.js +31 -1
package/README.md
CHANGED
|
@@ -56,18 +56,21 @@ npx hail-hydra-cc --help # Show help
|
|
|
56
56
|
│ ├── hydra-coder.md
|
|
57
57
|
│ ├── hydra-analyst.md
|
|
58
58
|
│ └── hydra-sentinel.md
|
|
59
|
-
├── commands/hydra/ #
|
|
59
|
+
├── commands/hydra/ # 8 slash commands
|
|
60
60
|
│ ├── help.md # /hydra:help
|
|
61
61
|
│ ├── status.md # /hydra:status
|
|
62
62
|
│ ├── update.md # /hydra:update
|
|
63
63
|
│ ├── config.md # /hydra:config
|
|
64
64
|
│ ├── guard.md # /hydra:guard
|
|
65
65
|
│ ├── quiet.md # /hydra:quiet
|
|
66
|
-
│
|
|
67
|
-
|
|
66
|
+
│ ├── verbose.md # /hydra:verbose
|
|
67
|
+
│ └── report.md # /hydra:report
|
|
68
|
+
├── hooks/ # 4 lifecycle hooks
|
|
68
69
|
│ ├── hydra-check-update.js # SessionStart — version check
|
|
69
70
|
│ ├── hydra-statusline.js # StatusLine — status bar
|
|
70
|
-
│
|
|
71
|
+
│ ├── hydra-auto-guard.js # PostToolUse — file tracker
|
|
72
|
+
│ ├── hydra-notify.js # Notification — task completion sound
|
|
73
|
+
│ └── hydra-task-complete.wav # Notification sound file
|
|
71
74
|
└── skills/hydra/ # Skill (Claude Code discoverable via /skills)
|
|
72
75
|
├── SKILL.md # Orchestrator instructions
|
|
73
76
|
├── VERSION # Installed version
|
package/files/SKILL.md
CHANGED
|
@@ -14,6 +14,49 @@ description: >
|
|
|
14
14
|
> *"Cut off one head, two more shall take its place."*
|
|
15
15
|
> Except here — every head is doing your work faster and cheaper.
|
|
16
16
|
|
|
17
|
+
## ⛔ MANDATORY PROTOCOLS — NEVER SKIP
|
|
18
|
+
|
|
19
|
+
These protocols are NON-NEGOTIABLE. Skipping them is a framework violation.
|
|
20
|
+
|
|
21
|
+
### Protocol 1: Sentinel Scan After Code Changes
|
|
22
|
+
|
|
23
|
+
When ANY agent returns output containing `⚠️ HYDRA_SENTINEL_REQUIRED`, you
|
|
24
|
+
MUST — before doing ANYTHING else, before presenting results to the user,
|
|
25
|
+
before running any other agents — dispatch hydra-sentinel-scan with the
|
|
26
|
+
files and changes listed in the trigger block.
|
|
27
|
+
|
|
28
|
+
**This is blocking.** The user does NOT see the code changes until sentinel
|
|
29
|
+
completes. If you present code changes to the user without running sentinel
|
|
30
|
+
first, you have violated the framework's core safety guarantee.
|
|
31
|
+
|
|
32
|
+
Sequence:
|
|
33
|
+
1. Receive agent output containing ⚠️ HYDRA_SENTINEL_REQUIRED
|
|
34
|
+
2. IMMEDIATELY dispatch hydra-sentinel-scan AND hydra-guard in parallel
|
|
35
|
+
3. WAIT for both to complete
|
|
36
|
+
4. If sentinel-scan finds issues → dispatch hydra-sentinel (deep analysis)
|
|
37
|
+
5. WAIT for deep analysis
|
|
38
|
+
6. THEN — and ONLY then — present results to the user
|
|
39
|
+
|
|
40
|
+
If the agent output contains `✅ HYDRA_NO_CODE_CHANGES`, skip sentinel. Present
|
|
41
|
+
results immediately.
|
|
42
|
+
|
|
43
|
+
### Protocol 2: Sentinel Fix Decision Tree
|
|
44
|
+
|
|
45
|
+
When hydra-sentinel confirms real issues:
|
|
46
|
+
|
|
47
|
+
**TRIVIAL** (auto-fix without asking):
|
|
48
|
+
Import renames, file path updates, barrel file re-exports.
|
|
49
|
+
→ Dispatch hydra-coder to fix. Re-run sentinel-scan to verify.
|
|
50
|
+
→ Tell user: "Sentinel caught [issue]. Auto-fixed."
|
|
51
|
+
|
|
52
|
+
**MEDIUM** (present to user, offer to fix):
|
|
53
|
+
API contract mismatches, missing env vars, signature mismatches.
|
|
54
|
+
→ Show the sentinel report. Ask: "Want me to fix these?"
|
|
55
|
+
|
|
56
|
+
**COMPLEX** (report only):
|
|
57
|
+
Architectural changes, migration needed, business logic decisions.
|
|
58
|
+
→ Show the report. Let user decide.
|
|
59
|
+
|
|
17
60
|
## Why Hydra Exists
|
|
18
61
|
|
|
19
62
|
Autoregressive LLM inference is memory-bandwidth bound — the time per token scales with model
|
|
@@ -317,192 +360,128 @@ Deviate from this model only when:
|
|
|
317
360
|
| Catastrophic test failure | Make final runner BLOCKING (something is fundamentally broken) |
|
|
318
361
|
| Stale Session Index detected | Rebuild index; treat as Turn 1 |
|
|
319
362
|
|
|
320
|
-
##
|
|
363
|
+
## Mandatory Delegation Rules
|
|
321
364
|
|
|
322
|
-
|
|
323
|
-
first step of every task. The whole point of Hydra is parallel execution, and you cannot
|
|
324
|
-
parallelize what you haven't decomposed.
|
|
365
|
+
These rules are BINDING. They are not heuristics, suggestions, or guidelines to consider. They are hard rules that determine whether YOU handle a task or DELEGATE it to a Hydra head. Violating these rules defeats the purpose of Hydra.
|
|
325
366
|
|
|
326
|
-
###
|
|
367
|
+
### ALWAYS Delegate — No Exceptions
|
|
327
368
|
|
|
328
|
-
|
|
329
|
-
"Fix the auth bug" is atomic. "Fix the auth bug and add tests" is two subtasks.
|
|
369
|
+
These task types MUST be delegated. You are NOT allowed to handle them yourself, regardless of how simple they seem.
|
|
330
370
|
|
|
331
|
-
|
|
371
|
+
| Task Type | Delegate To | Why You Don't Do It |
|
|
372
|
+
|-----------|-------------|---------------------|
|
|
373
|
+
| File search / grep / find patterns | hydra-scout | Haiku is equally good at Glob/Grep and costs 95% less |
|
|
374
|
+
| Read and summarize code or docs | hydra-scout | Reading files is mechanical — no Opus reasoning needed |
|
|
375
|
+
| Run tests, builds, lints, type checks | hydra-runner | Executing commands and reporting output is mechanical |
|
|
376
|
+
| Git operations (commit, branch, diff, log, stash) | hydra-git | Git commands are well-defined and deterministic |
|
|
377
|
+
| Security/quality gate scans | hydra-guard | Pattern matching for secrets/issues is Haiku's strength |
|
|
378
|
+
| Write/update docstrings, comments, changelogs | hydra-scribe | Descriptive writing from existing code is mechanical |
|
|
379
|
+
| Implement features from clear specs | hydra-coder | Sonnet handles standard implementation patterns equally well |
|
|
380
|
+
| Fix bugs with clear error messages/stack traces | hydra-coder | Error-driven debugging with clear clues is Sonnet-level |
|
|
381
|
+
| Code review and PR analysis | hydra-analyst | Structured code analysis is Sonnet's sweet spot |
|
|
332
382
|
|
|
333
|
-
|
|
383
|
+
**Self-check**: Before you start ANY task, ask: "Is this in the ALWAYS Delegate table?" If yes — delegate. No exceptions. No "but it's faster if I just..." No "it's only a small..." DELEGATE.
|
|
334
384
|
|
|
335
|
-
|
|
336
|
-
- If it depends on Task A → it runs in the wave after Task A completes
|
|
385
|
+
### ALWAYS Handle Yourself — Never Delegate
|
|
337
386
|
|
|
338
|
-
|
|
387
|
+
These task types stay with Opus. Delegating them wastes time or risks quality.
|
|
339
388
|
|
|
340
|
-
|
|
341
|
-
|
|
389
|
+
| Task Type | Why You Keep It |
|
|
390
|
+
|-----------|----------------|
|
|
391
|
+
| Task classification and routing decisions | Only you see the full conversation context |
|
|
392
|
+
| Verifying and synthesizing agent outputs | Judgment on whether a draft is acceptable requires orchestrator perspective |
|
|
393
|
+
| System architecture and major design decisions | Novel architectural tradeoffs need Opus-level reasoning |
|
|
394
|
+
| Ambiguous debugging with no clear clues | "It works in staging but not prod" needs deep investigation |
|
|
395
|
+
| Context-dependent tasks requiring conversation history | Agents don't see prior turns — you do |
|
|
396
|
+
| Trivial edits under 5 seconds (max 2-3 per session) | Delegation overhead exceeds task cost |
|
|
397
|
+
| Planning and decomposition | Breaking tasks into waves IS the orchestrator's job |
|
|
398
|
+
| Conversation management (clarification, alignment) | Only you talk to the user |
|
|
342
399
|
|
|
343
|
-
###
|
|
400
|
+
### JUDGMENT CALLS — Use This Decision Framework
|
|
344
401
|
|
|
345
|
-
|
|
346
|
-
relevant outputs forward and launch Wave 2. Continue until all subtasks are done.
|
|
402
|
+
For tasks NOT in either table above, apply this 3-step check:
|
|
347
403
|
|
|
348
|
-
|
|
404
|
+
1. **Does it require conversation context?** (prior turns, user preferences, accumulated state)
|
|
405
|
+
- YES → Handle yourself. Agents don't have this context.
|
|
406
|
+
2. **Can Haiku or Sonnet do this equally well?** (not "almost as well" — EQUALLY well)
|
|
407
|
+
- YES → Delegate. You're wasting money and time doing it yourself.
|
|
408
|
+
- NO → Handle yourself.
|
|
409
|
+
3. **Would delegation take LONGER than doing it yourself?** (including prompt construction + wait time)
|
|
410
|
+
- YES, and the task is truly trivial → Handle yourself (counts toward overhead budget).
|
|
411
|
+
- NO or UNSURE → **Delegate.** This is the default. When in doubt, DELEGATE.
|
|
349
412
|
|
|
350
|
-
|
|
351
|
-
> Launching 3 Haiku agents simultaneously is always faster than launching them one at a time,
|
|
352
|
-
> even if you have to wait for all three before continuing. A wave of 3 Haiku agents completes
|
|
353
|
-
> in the time it takes 1 Haiku agent to finish, not 3× longer.
|
|
413
|
+
### Parallel Dispatch — MANDATORY for Independent Subtasks
|
|
354
414
|
|
|
355
|
-
|
|
415
|
+
If a task decomposes into subtasks with no dependencies between them, you MUST dispatch them simultaneously in a single message. Sequential dispatch of independent tasks is a rule violation.
|
|
356
416
|
|
|
417
|
+
**WRONG** (sequential — wastes time):
|
|
357
418
|
```
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
Task C: Fix the bug → hydra-coder [depends on A]
|
|
364
|
-
Task D: Write new tests → hydra-coder [depends on C]
|
|
365
|
-
Task E: Run all tests → hydra-runner [depends on C, D]
|
|
366
|
-
Task F: Update docs → hydra-scribe [depends on C]
|
|
367
|
-
|
|
368
|
-
Wave 1 → launch A + B simultaneously
|
|
369
|
-
Wave 2 → launch C (using A's findings)
|
|
370
|
-
Wave 3 → launch D + F simultaneously (both only need C)
|
|
371
|
-
Wave 4 → launch E (needs D complete)
|
|
419
|
+
Message 1: Launch hydra-scout to explore auth module
|
|
420
|
+
[wait for result]
|
|
421
|
+
Message 2: Launch hydra-runner to run existing tests
|
|
422
|
+
[wait for result]
|
|
423
|
+
Message 3: Launch hydra-scout to check test patterns
|
|
372
424
|
```
|
|
373
425
|
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
Route to Haiku when the task is **mechanical, read-heavy, or well-defined**:
|
|
382
|
-
|
|
383
|
-
- Searching/grepping across files
|
|
384
|
-
- Reading and summarizing code or documentation
|
|
385
|
-
- Running tests, lints, builds, format checks
|
|
386
|
-
- Listing directory structures, finding files by pattern
|
|
387
|
-
- Simple git operations (status, log, diff)
|
|
388
|
-
- Generating boilerplate or repetitive code from clear templates
|
|
389
|
-
- Writing/updating comments, docstrings, simple README sections
|
|
390
|
-
- Quick factual lookups in the codebase
|
|
391
|
-
- Security/quality gate scans on changed code (hydra-guard)
|
|
392
|
-
- Git operations: staging, committing, branching, log inspection (hydra-git)
|
|
393
|
-
|
|
394
|
-
**Heuristic**: If you could describe the task as a single imperative sentence with no ambiguity
|
|
395
|
-
(e.g., "find all files importing X", "run the test suite"), it's Tier 1.
|
|
396
|
-
|
|
397
|
-
### Tier 2 → Sonnet 4.6 Heads (hydra-coder, hydra-analyst)
|
|
398
|
-
|
|
399
|
-
Route to Sonnet when the task requires **reasoning about code, but within well-understood patterns**:
|
|
400
|
-
|
|
401
|
-
- Implementing a feature from a clear spec or description
|
|
402
|
-
- Writing or modifying functions, classes, modules
|
|
403
|
-
- Refactoring code (rename, extract, restructure)
|
|
404
|
-
- Creating test cases that require understanding business logic
|
|
405
|
-
- Debugging with stack traces or error messages as clues
|
|
406
|
-
- Code review and suggesting improvements
|
|
407
|
-
- Writing technical documentation that requires comprehension
|
|
408
|
-
- Resolving straightforward merge conflicts
|
|
409
|
-
- Making API integrations following documented patterns
|
|
410
|
-
|
|
411
|
-
**Heuristic**: If you need to read, understand, and then produce code — but the approach is
|
|
412
|
-
reasonably standard — it's Tier 2.
|
|
413
|
-
|
|
414
|
-
### Tier 3 → Opus (handle directly, don't delegate)
|
|
415
|
-
|
|
416
|
-
Keep it yourself when the task demands **deep reasoning, novel architecture, or high-stakes decisions**:
|
|
417
|
-
|
|
418
|
-
- System architecture design and major refactoring decisions
|
|
419
|
-
- Debugging subtle, non-obvious issues with no clear stack trace
|
|
420
|
-
- Performance optimization requiring algorithmic insight
|
|
421
|
-
- Security analysis and vulnerability assessment
|
|
422
|
-
- Multi-file coordinated changes with complex interdependencies
|
|
423
|
-
- Resolving ambiguous requirements that need clarification
|
|
424
|
-
- Novel algorithm implementation
|
|
425
|
-
- Tasks where getting it wrong would be very costly
|
|
426
|
-
|
|
427
|
-
**Heuristic**: If you'd need to think hard even as Opus, don't delegate.
|
|
428
|
-
|
|
429
|
-
### Edge Cases and Judgment Calls
|
|
426
|
+
**RIGHT** (parallel — all independent):
|
|
427
|
+
```
|
|
428
|
+
Message 1: Launch hydra-scout (auth module) + hydra-runner (tests) + hydra-scout (test patterns)
|
|
429
|
+
[all three return]
|
|
430
|
+
Message 2: Launch dependent tasks using results from Message 1
|
|
431
|
+
```
|
|
430
432
|
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
-
|
|
434
|
-
|
|
435
|
-
-
|
|
436
|
-
do it yourself.
|
|
433
|
+
**Trigger phrases that REQUIRE parallel dispatch:**
|
|
434
|
+
- "...and..." (e.g., "fix the bug AND add tests" → scout + runner in parallel)
|
|
435
|
+
- "...then..." where the "then" tasks are independent of each other
|
|
436
|
+
- Any request with 2+ independent components
|
|
437
|
+
- Any request where exploration and execution can overlap
|
|
437
438
|
|
|
438
|
-
|
|
439
|
+
### Delegation Overhead Budget
|
|
439
440
|
|
|
440
|
-
|
|
441
|
-
to waves before any agent is dispatched.
|
|
441
|
+
You are allowed a MAXIMUM of 2-3 "do it myself" exceptions per session for tasks that technically fall in the ALWAYS Delegate table but are genuinely trivial (e.g., adding a single `console.log` to a known file). Track this internally.
|
|
442
442
|
|
|
443
|
-
|
|
443
|
+
**Rules:**
|
|
444
|
+
- If you've done 5+ tasks directly in a row without delegating, STOP. Re-read the ALWAYS Delegate table. You are almost certainly violating these rules.
|
|
445
|
+
- "It's faster if I just do it" is not a valid exception after the 2-3 budget is spent.
|
|
446
|
+
- The budget resets each session.
|
|
444
447
|
|
|
445
|
-
|
|
446
|
-
in one response. Never send Wave 2 before Wave 1's results arrive.
|
|
447
|
-
2. **Dependencies determine wave membership** — if Task B needs Task A's output, they
|
|
448
|
-
are in different waves. If they're independent, they're in the same wave.
|
|
449
|
-
3. **Within a wave, order doesn't matter** — all tasks start simultaneously.
|
|
450
|
-
4. **Between waves, results flow forward** — pass relevant context from each wave into
|
|
451
|
-
the prompts of the next wave's agents (see Handoff Protocol).
|
|
448
|
+
### Plan Mode Behavior
|
|
452
449
|
|
|
453
|
-
|
|
450
|
+
During planning phase (before execution begins):
|
|
451
|
+
- Using Claude Code's built-in Explore agent is acceptable for quick codebase understanding.
|
|
452
|
+
- No delegation rules apply yet — you're gathering context, not executing.
|
|
454
453
|
|
|
455
|
-
|
|
454
|
+
Once execution begins (after plan is approved):
|
|
455
|
+
- ALL mandatory delegation rules apply immediately.
|
|
456
|
+
- **NEVER use the built-in Explore agent during execution when hydra-scout is available.** hydra-scout is faster and cheaper.
|
|
457
|
+
- Plans MUST reference specific Hydra agents. Example format:
|
|
456
458
|
|
|
457
459
|
```
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
Wave 2 → C (with A's findings as context)
|
|
465
|
-
Wave 3 → D
|
|
460
|
+
Step 1: hydra-scout → read auth module structure [parallel with Step 2]
|
|
461
|
+
Step 2: hydra-runner → run existing test suite [parallel with Step 1]
|
|
462
|
+
Step 3: hydra-coder → implement fix using findings from Steps 1-2
|
|
463
|
+
Step 4: hydra-sentinel-scan + hydra-guard → verify changes [parallel]
|
|
464
|
+
Step 5: hydra-runner → run tests to confirm fix
|
|
465
|
+
Step 6: hydra-git → commit with descriptive message
|
|
466
466
|
```
|
|
467
467
|
|
|
468
|
-
|
|
468
|
+
### Dispatch Logging
|
|
469
469
|
|
|
470
|
-
|
|
471
|
-
Task A: Map existing endpoints → hydra-scout [no deps]
|
|
472
|
-
Task B: Map existing test style → hydra-scout [no deps]
|
|
473
|
-
Task C: Map existing doc style → hydra-scout [no deps]
|
|
474
|
-
Task D: Implement endpoint → hydra-coder [depends on A]
|
|
475
|
-
Task E: Write tests → hydra-coder [depends on A, B]
|
|
476
|
-
Task F: Write API docs → hydra-scribe [depends on A, C]
|
|
477
|
-
Task G: Run tests → hydra-runner [depends on E]
|
|
478
|
-
|
|
479
|
-
Wave 1 → A + B + C (parallel — all pure exploration)
|
|
480
|
-
Wave 2 → D + E + F (parallel — all depend only on Wave 1)
|
|
481
|
-
Wave 3 → G
|
|
482
|
-
```
|
|
483
|
-
|
|
484
|
-
#### Example 3: "Debug why the payment service is slow, fix it, and verify"
|
|
470
|
+
After every task completion (unless `/hydra:quiet` is active), show a dispatch summary:
|
|
485
471
|
|
|
486
472
|
```
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
Wave 3 → E + F (parallel)
|
|
473
|
+
| Step | Agent | Task | Time |
|
|
474
|
+
|------|-------|------|------|
|
|
475
|
+
| 1 | hydra-scout | Explore auth module | 3.2s |
|
|
476
|
+
| 2 | hydra-runner | Run test suite | 5.1s |
|
|
477
|
+
| 3 | hydra-coder | Fix auth bug | 8.4s |
|
|
478
|
+
| 4 | hydra-guard | Security scan | 2.1s |
|
|
479
|
+
| 5 | hydra-runner | Verify fix | 4.8s |
|
|
480
|
+
|
|
481
|
+
Delegation: 5/5 (100%) — Opus direct: 0
|
|
497
482
|
```
|
|
498
483
|
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
- **3 Haiku agents in parallel** finish in ~1× the time of 1 agent
|
|
502
|
-
- **3 Haiku agents sequentially** take ~3× the time
|
|
503
|
-
- For a 4-wave workflow, parallelism within waves can cut total wall-clock time by 40-60%
|
|
504
|
-
- The orchestrator (Opus) is not executing during waves — it's free to think about the
|
|
505
|
-
next wave while heads work
|
|
484
|
+
If "Opus direct" exceeds "Delegation" count, the mandatory rules are not being followed. Re-read the ALWAYS Delegate table before continuing.
|
|
506
485
|
|
|
507
486
|
## Verification Protocol
|
|
508
487
|
|
|
@@ -569,6 +548,10 @@ When manual verification is required, match depth to risk:
|
|
|
569
548
|
|
|
570
549
|
## Sentinel Protocol — Integration Integrity
|
|
571
550
|
|
|
551
|
+
> **REMINDER:** If you see `⚠️ HYDRA_SENTINEL_REQUIRED` in any agent's output
|
|
552
|
+
> and you skip sentinel, you are violating the framework's core protocol.
|
|
553
|
+
> See "⛔ MANDATORY PROTOCOLS" at the top of this document.
|
|
554
|
+
|
|
572
555
|
After EVERY code change made by hydra-coder or hydra-analyst (or yourself),
|
|
573
556
|
you MUST run the sentinel pipeline BEFORE presenting results to the user.
|
|
574
557
|
|
|
@@ -767,6 +750,19 @@ Note: Savings calculated against Opus 4.6 pricing ($5/$25 per MTok) as of Februa
|
|
|
767
750
|
"Re-executing [task] directly — [agent]'s output was insufficient because [reason]"
|
|
768
751
|
- **If accepted as-is**, no inline comment needed — the dispatch log covers it
|
|
769
752
|
|
|
753
|
+
### Sentinel Status in Dispatch Log
|
|
754
|
+
|
|
755
|
+
The dispatch log MUST show sentinel status for every task involving code changes:
|
|
756
|
+
|
|
757
|
+
| Step | Agent | Task | Verdict |
|
|
758
|
+
|------|-------|------|---------|
|
|
759
|
+
| 1 | hydra-coder (Sonnet 4.6) | Fixed auth bug | ✅ Accepted |
|
|
760
|
+
| 2 | hydra-sentinel-scan (Haiku) | Integration sweep | ✅ Clean |
|
|
761
|
+
| 3 | hydra-guard (Haiku 4.5) | Security scan | ✅ Clean |
|
|
762
|
+
|
|
763
|
+
If sentinel-scan is missing from the dispatch log after a code change,
|
|
764
|
+
something went wrong. This is your self-check.
|
|
765
|
+
|
|
770
766
|
### Controlling the Dispatch Log
|
|
771
767
|
|
|
772
768
|
- **Default**: ON — always shown when 2+ agents were used
|
|
@@ -866,16 +862,8 @@ The user should never notice Hydra operating. Don't announce "I'm delegating to
|
|
|
866
862
|
Don't explain the routing. Don't ask permission. Just do it. The user asked for a result, not
|
|
867
863
|
a process narration. If a head does the work, present the output as if you did it.
|
|
868
864
|
|
|
869
|
-
### Speed
|
|
870
|
-
|
|
871
|
-
and go. If you spend 10 seconds classifying a 5-second task, you've defeated the purpose.
|
|
872
|
-
|
|
873
|
-
### Parallel Heads
|
|
874
|
-
Parallel dispatch is the default, not a bonus feature. Every multi-step request MUST be
|
|
875
|
-
decomposed into waves before any agent is dispatched (see Decomposition First Protocol).
|
|
876
|
-
Independent subtasks always launch simultaneously in a single message. Never dispatch
|
|
877
|
-
sequentially when parallel is possible. The Wave Execution Model section has 3 concrete
|
|
878
|
-
examples showing how to do this correctly.
|
|
865
|
+
### Speed and Parallelism
|
|
866
|
+
See "Mandatory Delegation Rules" for binding delegation and parallel dispatch rules.
|
|
879
867
|
|
|
880
868
|
### Escalate, Never Downgrade on Retry
|
|
881
869
|
If Haiku's output wasn't good enough, don't try Haiku again or even Sonnet. Just do it yourself.
|
|
@@ -952,14 +940,29 @@ If the user types any of these exact phrases, respond with the corresponding act
|
|
|
952
940
|
|
|
953
941
|
Track these mentally to calibrate:
|
|
954
942
|
|
|
955
|
-
- **Delegation rate**: What % of tasks go to heads? Target: 60–
|
|
943
|
+
- **Delegation rate**: What % of tasks go to heads? Target: 60–70%.
|
|
956
944
|
- **Rejection rate**: How often does a draft need Opus intervention? Target: <15%.
|
|
957
945
|
- **User complaints**: Zero. If the user notices quality issues, tune the classification.
|
|
958
946
|
|
|
959
947
|
If rejection rate > 20%, you're too aggressive — shift borderline tasks up one tier.
|
|
960
948
|
If rejection rate < 5%, you're too conservative — delegate more.
|
|
961
949
|
|
|
950
|
+
## Task Completion Notification
|
|
951
|
+
|
|
952
|
+
After completing a user's task (the final response you present to the user),
|
|
953
|
+
run this command as the LAST action:
|
|
954
|
+
```bash
|
|
955
|
+
node ~/.claude/hooks/hydra-notify.js < /dev/null
|
|
956
|
+
```
|
|
957
|
+
|
|
958
|
+
This plays a short notification sound so the user knows you're done —
|
|
959
|
+
especially useful when they've tabbed away while waiting.
|
|
960
|
+
|
|
961
|
+
Do this for SUBSTANTIAL tasks only (tasks that took more than ~10 seconds).
|
|
962
|
+
Do NOT play it for quick conversational responses, acknowledgments, or
|
|
963
|
+
follow-up questions.
|
|
964
|
+
|
|
962
965
|
## Reference Material
|
|
963
966
|
|
|
964
|
-
- `references/routing-guide.md` —
|
|
967
|
+
- `references/routing-guide.md` — Mandatory delegation examples, decision flowchart
|
|
965
968
|
- `references/model-capabilities.md` — What each model can and can't do
|
|
@@ -17,6 +17,7 @@ COMMANDS
|
|
|
17
17
|
/hydra:guard Run security scan on files (usage: /hydra:guard src/auth.py)
|
|
18
18
|
/hydra:quiet Suppress dispatch logs for this session
|
|
19
19
|
/hydra:verbose Enable verbose dispatch logs with timing
|
|
20
|
+
/hydra:report Report a bug, request a feature, or share feedback
|
|
20
21
|
|
|
21
22
|
AGENTS
|
|
22
23
|
🟢 hydra-scout (Haiku 4.5) — Explore codebase, find files, map structure
|
|
@@ -12,3 +12,5 @@ Respond with:
|
|
|
12
12
|
"🐉 Quiet mode enabled. Dispatch logs suppressed for this session. Use /hydra:verbose to re-enable."
|
|
13
13
|
|
|
14
14
|
Continue operating Hydra normally (delegation, verification, auto-guard) — just don't show the dispatch log table.
|
|
15
|
+
|
|
16
|
+
Also suppress the task completion notification sound for this session.
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Report a bug, request a feature, or share feedback about Hydra
|
|
3
|
+
allowed-tools: Bash
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Hydra Report
|
|
7
|
+
|
|
8
|
+
Walk the user through submitting a bug report, feature request, or general feedback for the Hydra framework. Follow these steps interactively:
|
|
9
|
+
|
|
10
|
+
## Step 1 — Ask report type
|
|
11
|
+
|
|
12
|
+
Ask the user:
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
🐉 What would you like to report?
|
|
16
|
+
|
|
17
|
+
1. 🐛 Bug Report — something is broken or not working as expected
|
|
18
|
+
2. ✨ Feature Request — an idea for a new feature or improvement
|
|
19
|
+
3. 💬 General Feedback — anything else you'd like to share
|
|
20
|
+
|
|
21
|
+
Enter 1, 2, or 3:
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Wait for their response. Map:
|
|
25
|
+
- 1 → label: `bug`, template: Bug Report
|
|
26
|
+
- 2 → label: `enhancement`, template: Feature Request
|
|
27
|
+
- 3 → label: `feedback`, template: General Feedback
|
|
28
|
+
|
|
29
|
+
## Step 2 — Collect description
|
|
30
|
+
|
|
31
|
+
Ask the user to describe the issue or idea:
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
Describe the [bug/feature/feedback] in a few sentences:
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
For bugs, also ask:
|
|
38
|
+
```
|
|
39
|
+
Steps to reproduce (if applicable):
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Step 3 — Collect system info (optional)
|
|
43
|
+
|
|
44
|
+
Ask: "Include system info in the report? (recommended for bugs) [Y/n]"
|
|
45
|
+
|
|
46
|
+
If yes, gather:
|
|
47
|
+
```bash
|
|
48
|
+
# Hydra version
|
|
49
|
+
cat ~/.claude/skills/hydra/VERSION 2>/dev/null || echo "not found"
|
|
50
|
+
```
|
|
51
|
+
```bash
|
|
52
|
+
# OS info
|
|
53
|
+
node -e "console.log(process.platform + ' ' + process.arch + ' ' + require('os').release())"
|
|
54
|
+
```
|
|
55
|
+
```bash
|
|
56
|
+
# Agent count
|
|
57
|
+
ls ~/.claude/agents/hydra-*.md 2>/dev/null | wc -l
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Format as a "System Info" section in the report.
|
|
61
|
+
|
|
62
|
+
## Step 4 — Submit via GitHub CLI or fallback
|
|
63
|
+
|
|
64
|
+
Check if `gh` CLI is available:
|
|
65
|
+
```bash
|
|
66
|
+
gh --version 2>/dev/null
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### If `gh` is installed, check auth:
|
|
70
|
+
```bash
|
|
71
|
+
gh auth status 2>/dev/null
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### If authenticated → create issue directly:
|
|
75
|
+
```bash
|
|
76
|
+
gh issue create \
|
|
77
|
+
--repo AR6420/Hail_Hydra \
|
|
78
|
+
--title "<concise title based on description>" \
|
|
79
|
+
--label "<bug|enhancement|feedback>" \
|
|
80
|
+
--body "<formatted report body>"
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Show the resulting issue URL to the user.
|
|
84
|
+
|
|
85
|
+
### If `gh` is installed but NOT authenticated:
|
|
86
|
+
|
|
87
|
+
Tell the user:
|
|
88
|
+
```
|
|
89
|
+
GitHub CLI is installed but not authenticated.
|
|
90
|
+
Run this in your terminal to authenticate:
|
|
91
|
+
|
|
92
|
+
gh auth login
|
|
93
|
+
|
|
94
|
+
Then try /hydra:report again.
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### If `gh` is NOT installed → browser fallback:
|
|
98
|
+
|
|
99
|
+
Construct a pre-filled GitHub issue URL and show it to the user:
|
|
100
|
+
|
|
101
|
+
```
|
|
102
|
+
GitHub CLI not found. You can submit your report via browser:
|
|
103
|
+
|
|
104
|
+
https://github.com/AR6420/Hail_Hydra/issues/new?template=<template>&title=<encoded-title>&labels=<label>&body=<encoded-body>
|
|
105
|
+
|
|
106
|
+
Or install GitHub CLI: https://cli.github.com
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Map template filenames:
|
|
110
|
+
- bug → `bug_report.md`
|
|
111
|
+
- enhancement → `feature_request.md`
|
|
112
|
+
- feedback → `feedback.md`
|
|
@@ -1,35 +1,78 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Update the Hydra framework to the latest version from npm
|
|
3
|
-
allowed-tools: Bash
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Hydra Update
|
|
7
|
-
|
|
8
|
-
Run the following steps to update Hydra to the latest version:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
```bash
|
|
27
|
-
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
1
|
+
---
|
|
2
|
+
description: Update the Hydra framework to the latest version from npm
|
|
3
|
+
allowed-tools: Bash, Read
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Hydra Update
|
|
7
|
+
|
|
8
|
+
Run the following steps to update Hydra to the latest version:
|
|
9
|
+
|
|
10
|
+
## Step 1 — Check versions
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
cat ~/.claude/skills/hydra/VERSION 2>/dev/null || echo "VERSION file not found"
|
|
14
|
+
```
|
|
15
|
+
```bash
|
|
16
|
+
npm view hail-hydra-cc version 2>/dev/null || echo "Package not found on npm"
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
If the installed version matches the latest npm version, tell the user:
|
|
20
|
+
"🐉 Hydra is already at the latest version ([version])."
|
|
21
|
+
and stop here.
|
|
22
|
+
|
|
23
|
+
## Step 2 — Show changelog preview
|
|
24
|
+
|
|
25
|
+
Fetch the CHANGELOG from GitHub:
|
|
26
|
+
```bash
|
|
27
|
+
curl -sL "https://raw.githubusercontent.com/AR6420/Hail_Hydra/main/CHANGELOG.md"
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Parse the changelog to extract entries between the installed version and the latest version. Display a formatted "What's New" section:
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
🐉 Hydra Update Available: [installed] → [latest]
|
|
34
|
+
═══════════════════════════════════════════════════
|
|
35
|
+
|
|
36
|
+
📋 What's New:
|
|
37
|
+
[changelog entries for versions between installed and latest]
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
If the changelog fetch fails, skip the preview and continue with the update.
|
|
41
|
+
|
|
42
|
+
## Step 3 — Show safety note
|
|
43
|
+
|
|
44
|
+
Display:
|
|
45
|
+
```
|
|
46
|
+
⚠️ What gets replaced:
|
|
47
|
+
• Agent definitions (agents/*.md)
|
|
48
|
+
• SKILL.md, references, commands, hooks
|
|
49
|
+
• VERSION file
|
|
50
|
+
|
|
51
|
+
✅ What's preserved:
|
|
52
|
+
• Your hydra.config.md settings
|
|
53
|
+
• Agent memory directories (memory/)
|
|
54
|
+
• CLAUDE.md orchestrator notes
|
|
55
|
+
• settings.json hook registrations (re-registered automatically)
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Step 4 — Ask for confirmation
|
|
59
|
+
|
|
60
|
+
Ask the user: "Proceed with update? [Y/n]"
|
|
61
|
+
|
|
62
|
+
If they decline, respond: "🐉 Update cancelled." and stop.
|
|
63
|
+
|
|
64
|
+
## Step 5 — Run the update
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
npx hail-hydra-cc@latest --global
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Step 6 — Verify
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
cat ~/.claude/skills/hydra/VERSION
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Report to the user:
|
|
77
|
+
- If updated: "🐉 Hydra updated from [old] → [new]. All heads refreshed. Restart Claude Code to load the new files."
|
|
78
|
+
- If error: Show the error and suggest running `npx hail-hydra-cc@latest --global` manually in their terminal.
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Hydra Task Completion Notification
|
|
6
|
+
*
|
|
7
|
+
* Plays a short notification sound when Claude Code finishes a task.
|
|
8
|
+
* Cross-platform: macOS (afplay), Windows (PowerShell), Linux (paplay/aplay).
|
|
9
|
+
*
|
|
10
|
+
* Called by Claude Code's Notification hook — stdin receives JSON from
|
|
11
|
+
* the hook system, which we drain and discard to prevent EPIPE errors.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
const { spawn } = require('child_process');
|
|
15
|
+
const path = require('path');
|
|
16
|
+
const fs = require('fs');
|
|
17
|
+
const os = require('os');
|
|
18
|
+
|
|
19
|
+
// Drain stdin to prevent EPIPE when Claude Code pipes hook data
|
|
20
|
+
process.stdin.resume();
|
|
21
|
+
process.stdin.on('data', () => {});
|
|
22
|
+
process.stdin.on('end', () => {});
|
|
23
|
+
|
|
24
|
+
const wavFile = path.join(os.homedir(), '.claude', 'hooks', 'hydra-task-complete.wav');
|
|
25
|
+
|
|
26
|
+
// Bail silently if the sound file is missing
|
|
27
|
+
if (!fs.existsSync(wavFile)) {
|
|
28
|
+
process.exit(0);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const platform = process.platform;
|
|
32
|
+
|
|
33
|
+
try {
|
|
34
|
+
let child;
|
|
35
|
+
|
|
36
|
+
if (platform === 'darwin') {
|
|
37
|
+
// macOS
|
|
38
|
+
child = spawn('afplay', [wavFile], {
|
|
39
|
+
detached: true,
|
|
40
|
+
stdio: 'ignore',
|
|
41
|
+
});
|
|
42
|
+
} else if (platform === 'win32') {
|
|
43
|
+
// Windows — use PowerShell to play the .wav
|
|
44
|
+
child = spawn('powershell', [
|
|
45
|
+
'-NoProfile', '-NonInteractive', '-Command',
|
|
46
|
+
`(New-Object Media.SoundPlayer '${wavFile.replace(/'/g, "''")}').PlaySync()`,
|
|
47
|
+
], {
|
|
48
|
+
detached: true,
|
|
49
|
+
stdio: 'ignore',
|
|
50
|
+
windowsHide: true,
|
|
51
|
+
});
|
|
52
|
+
} else {
|
|
53
|
+
// Linux — try paplay (PulseAudio) first, fall back to aplay (ALSA)
|
|
54
|
+
const paplay = spawn('paplay', [wavFile], {
|
|
55
|
+
detached: true,
|
|
56
|
+
stdio: 'ignore',
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
paplay.on('error', () => {
|
|
60
|
+
// paplay not available, try aplay
|
|
61
|
+
const aplay = spawn('aplay', [wavFile], {
|
|
62
|
+
detached: true,
|
|
63
|
+
stdio: 'ignore',
|
|
64
|
+
});
|
|
65
|
+
aplay.unref();
|
|
66
|
+
aplay.on('error', () => {}); // silently ignore if neither works
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
paplay.unref();
|
|
70
|
+
process.exit(0);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (child) {
|
|
74
|
+
child.unref();
|
|
75
|
+
}
|
|
76
|
+
} catch {
|
|
77
|
+
// Silently ignore errors — notification sound is non-critical
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
process.exit(0);
|
|
Binary file
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
# Routing Guide —
|
|
1
|
+
# Routing Guide — Mandatory Delegation Examples
|
|
2
2
|
|
|
3
|
-
This reference provides concrete examples to
|
|
4
|
-
Read this when you need to
|
|
3
|
+
This reference provides concrete examples to see mandatory delegation in action.
|
|
4
|
+
Read this when you need to see how delegation rules apply to real tasks.
|
|
5
5
|
|
|
6
6
|
## Table of Contents
|
|
7
|
-
1. [
|
|
8
|
-
2. [
|
|
9
|
-
3. [
|
|
7
|
+
1. [ALWAYS Delegate — Haiku 4.5 Agents](#always-delegate-haiku)
|
|
8
|
+
2. [ALWAYS Delegate — Sonnet 4.6 Agents](#always-delegate-sonnet)
|
|
9
|
+
3. [ALWAYS Handle Yourself — Opus 4.6](#always-handle-yourself-opus)
|
|
10
10
|
4. [Compound Task Decomposition](#compound-tasks)
|
|
11
11
|
5. [Common Misclassifications](#common-misclassifications)
|
|
12
12
|
|
|
13
13
|
---
|
|
14
14
|
|
|
15
|
-
##
|
|
15
|
+
## ALWAYS Delegate — Haiku 4.5 Agents
|
|
16
16
|
|
|
17
17
|
### hydra-scout (Haiku 4.5) examples
|
|
18
18
|
| User says | Route to | Why |
|
|
@@ -64,7 +64,7 @@ Read this when you need to resolve ambiguous cases.
|
|
|
64
64
|
|
|
65
65
|
---
|
|
66
66
|
|
|
67
|
-
##
|
|
67
|
+
## ALWAYS Delegate — Sonnet 4.6 Agents
|
|
68
68
|
|
|
69
69
|
### hydra-coder (Sonnet 4.6) examples
|
|
70
70
|
| User says | Route to | Why |
|
|
@@ -88,7 +88,7 @@ Read this when you need to resolve ambiguous cases.
|
|
|
88
88
|
|
|
89
89
|
---
|
|
90
90
|
|
|
91
|
-
##
|
|
91
|
+
## ALWAYS Handle Yourself — Opus 4.6
|
|
92
92
|
|
|
93
93
|
| User says | Why Opus? |
|
|
94
94
|
|-----------|-----------|
|
|
@@ -147,48 +147,116 @@ These are tasks that look like one tier but are actually another:
|
|
|
147
147
|
|
|
148
148
|
| Task | Looks like | Actually | Why |
|
|
149
149
|
|------|-----------|----------|-----|
|
|
150
|
-
| "Add a simple button" |
|
|
151
|
-
| "Read the logs and find the error" |
|
|
152
|
-
| "Fix the typo in line 42" |
|
|
153
|
-
| "Add caching" |
|
|
154
|
-
| "Write a migration to add a column" |
|
|
155
|
-
| "Upgrade React from 17 to 18" |
|
|
150
|
+
| "Add a simple button" | Haiku (simple) | hydra-coder (Sonnet) | Needs to match existing component patterns |
|
|
151
|
+
| "Read the logs and find the error" | Haiku (read) | hydra-analyst (Sonnet) | Log analysis requires reasoning |
|
|
152
|
+
| "Fix the typo in line 42" | hydra-coder (Sonnet) | hydra-scribe (Haiku) | Trivial mechanical change |
|
|
153
|
+
| "Add caching" | hydra-coder (Sonnet) | Opus (handle yourself) | Cache invalidation strategy is hard |
|
|
154
|
+
| "Write a migration to add a column" | hydra-coder (Sonnet) | hydra-scribe (Haiku) | Template-level SQL |
|
|
155
|
+
| "Upgrade React from 17 to 18" | Haiku (simple) | Opus (handle yourself) | Breaking changes need careful analysis |
|
|
156
156
|
|
|
157
157
|
---
|
|
158
158
|
|
|
159
159
|
## Quick Decision Flowchart
|
|
160
160
|
|
|
161
161
|
```
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
162
|
+
Task arrives
|
|
163
|
+
│
|
|
164
|
+
├── In ALWAYS Delegate table? ── YES ──→ Route to specified agent
|
|
165
|
+
│
|
|
166
|
+
├── In ALWAYS Handle Yourself table? ── YES ──→ Opus handles directly
|
|
167
|
+
│
|
|
168
|
+
└── Neither? → JUDGMENT CALLS:
|
|
169
|
+
├── Requires conversation context? ── YES ──→ Opus
|
|
170
|
+
├── Haiku/Sonnet can do equally well? ── NO ──→ Opus
|
|
171
|
+
└── Delegation takes LONGER? ── YES (and truly trivial) ──→ Opus
|
|
172
|
+
└── Otherwise ──→ Delegate to best-fit agent
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## Routing Examples — Mandatory Delegation
|
|
176
|
+
|
|
177
|
+
These examples show the RIGHT and WRONG way to handle common requests under the mandatory delegation rules.
|
|
178
|
+
|
|
179
|
+
### 1. "Fix the bug in auth.ts"
|
|
180
|
+
|
|
181
|
+
**WRONG** (Opus does it all):
|
|
182
|
+
```
|
|
183
|
+
Read auth.ts yourself → find the bug → fix it → run tests
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
**RIGHT** (mandatory delegation):
|
|
187
|
+
```
|
|
188
|
+
1. hydra-scout → explore auth module, find the bug location
|
|
189
|
+
2. hydra-analyst → analyze the bug, identify root cause
|
|
190
|
+
3. hydra-coder → implement the fix
|
|
191
|
+
4. hydra-sentinel-scan + hydra-guard → verify changes [parallel]
|
|
192
|
+
5. hydra-runner → run tests to confirm fix
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### 2. "What's the project structure?"
|
|
196
|
+
|
|
197
|
+
**WRONG** (Opus runs find/ls itself):
|
|
198
|
+
```
|
|
199
|
+
Run `find . -type f` or `ls -R` yourself
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
**RIGHT** (mandatory delegation):
|
|
203
|
+
```
|
|
204
|
+
1. hydra-scout → map project structure, report back
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### 3. "Run the tests"
|
|
208
|
+
|
|
209
|
+
**WRONG** (Opus runs npm test itself):
|
|
210
|
+
```
|
|
211
|
+
Run `npm test` yourself
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
**RIGHT** (mandatory delegation):
|
|
215
|
+
```
|
|
216
|
+
1. hydra-runner → execute test suite, report results
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### 4. "Commit these changes"
|
|
220
|
+
|
|
221
|
+
**WRONG** (Opus runs git add/commit itself):
|
|
222
|
+
```
|
|
223
|
+
Run `git add . && git commit -m "..."` yourself
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
**RIGHT** (mandatory delegation):
|
|
227
|
+
```
|
|
228
|
+
1. hydra-git → stage and commit with well-crafted message
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### 5. "This function is slow, figure out why"
|
|
232
|
+
|
|
233
|
+
**RIGHT** (Opus orchestrates, delegates execution):
|
|
234
|
+
```
|
|
235
|
+
1. hydra-analyst → profile and diagnose the performance issue
|
|
236
|
+
2. YOU → decide the optimization approach (architectural judgment)
|
|
237
|
+
3. hydra-coder → implement the optimization
|
|
238
|
+
4. hydra-runner → benchmark before and after
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
### 6. "Redesign the auth module to use OAuth2"
|
|
242
|
+
|
|
243
|
+
**RIGHT** (Opus architects, delegates implementation):
|
|
244
|
+
```
|
|
245
|
+
1. hydra-scout → map current auth module structure [parallel with Step 2]
|
|
246
|
+
2. hydra-scout → research OAuth2 patterns in codebase [parallel with Step 1]
|
|
247
|
+
3. YOU → design the new architecture (this is YOUR job)
|
|
248
|
+
4. hydra-coder #1 → implement OAuth2 provider [parallel with Steps 5-6]
|
|
249
|
+
5. hydra-coder #2 → implement token management [parallel with Steps 4, 6]
|
|
250
|
+
6. hydra-coder #3 → update route handlers [parallel with Steps 4-5]
|
|
251
|
+
7. hydra-sentinel-scan → integration sweep on all changes
|
|
252
|
+
8. hydra-runner → run full test suite
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
### 7. "Quick — add a console.log to line 5"
|
|
256
|
+
|
|
257
|
+
**ACCEPTABLE** (trivial <5s edit — uses overhead budget):
|
|
258
|
+
```
|
|
259
|
+
YOU → add the console.log directly (counts as 1 of max 2-3 exceptions per session)
|
|
192
260
|
```
|
|
193
261
|
|
|
194
262
|
## Sentinel Routing
|
package/package.json
CHANGED
package/src/display.js
CHANGED
|
@@ -42,8 +42,8 @@ function showInstallComplete(statusLineConfigured = true) {
|
|
|
42
42
|
console.log(chalk.cyan.bold(' \uD83D\uDC09 Hail Hydra! Framework deployed and ready.'));
|
|
43
43
|
console.log(chalk.gray(' ' + '\u2500'.repeat(45)));
|
|
44
44
|
console.log(chalk.green(` \u2714 9 agents installed`));
|
|
45
|
-
console.log(chalk.green(` \u2714
|
|
46
|
-
console.log(chalk.green(` \u2714
|
|
45
|
+
console.log(chalk.green(` \u2714 8 slash commands installed`));
|
|
46
|
+
console.log(chalk.green(` \u2714 4 hooks registered`));
|
|
47
47
|
if (statusLineConfigured) {
|
|
48
48
|
console.log(chalk.green(` \u2714 StatusLine configured`));
|
|
49
49
|
} else {
|
|
@@ -141,7 +141,7 @@ function showStatusTable(globalStatus, localStatus) {
|
|
|
141
141
|
// Global hooks (always ~/.claude/hooks/)
|
|
142
142
|
console.log();
|
|
143
143
|
console.log(chalk.bold(' Global Hooks (~/.claude/hooks/)'));
|
|
144
|
-
const hookKeys = ['hydra-check-update', 'hydra-statusline', 'hydra-auto-guard'];
|
|
144
|
+
const hookKeys = ['hydra-check-update', 'hydra-statusline', 'hydra-auto-guard', 'hydra-notify'];
|
|
145
145
|
for (const key of hookKeys) {
|
|
146
146
|
const dest = path.join(os.homedir(), '.claude', 'hooks', `${key}.js`);
|
|
147
147
|
if (fileExists(dest)) {
|
package/src/files.js
CHANGED
|
@@ -80,12 +80,18 @@ const commands = {
|
|
|
80
80
|
'guard': readBundled('commands/hydra/guard.md'),
|
|
81
81
|
'quiet': readBundled('commands/hydra/quiet.md'),
|
|
82
82
|
'verbose': readBundled('commands/hydra/verbose.md'),
|
|
83
|
+
'report': readBundled('commands/hydra/report.md'),
|
|
83
84
|
};
|
|
84
85
|
|
|
85
86
|
const hooks = {
|
|
86
87
|
'hydra-check-update': readBundled('hooks/hydra-check-update.js'),
|
|
87
88
|
'hydra-statusline': readBundled('hooks/hydra-statusline.js'),
|
|
88
89
|
'hydra-auto-guard': readBundled('hooks/hydra-auto-guard.js'),
|
|
90
|
+
'hydra-notify': readBundled('hooks/hydra-notify.js'),
|
|
89
91
|
};
|
|
90
92
|
|
|
91
|
-
|
|
93
|
+
const binaryHooks = {
|
|
94
|
+
'hydra-task-complete.wav': path.join(FILES_DIR, 'hooks', 'hydra-task-complete.wav'),
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
module.exports = { agents, skill, references, commands, hooks, binaryHooks };
|
package/src/installer.js
CHANGED
|
@@ -5,7 +5,7 @@ const path = require('path');
|
|
|
5
5
|
const os = require('os');
|
|
6
6
|
const chalk = require('chalk');
|
|
7
7
|
|
|
8
|
-
const { agents, skill, references, commands, hooks } = require('./files');
|
|
8
|
+
const { agents, skill, references, commands, hooks, binaryHooks } = require('./files');
|
|
9
9
|
const { showInstallHeader, showFileInstalled, showInstallComplete, showStatusTable, VERSION } = require('./display');
|
|
10
10
|
|
|
11
11
|
// ── Install locations ────────────────────────────────────────────────────────
|
|
@@ -100,6 +100,17 @@ function installHooks() {
|
|
|
100
100
|
showFileInstalled(`hooks/${key}.js`, false, err.message);
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
|
+
|
|
104
|
+
// Copy binary hook files (e.g., .wav) that can't be read as UTF-8 text
|
|
105
|
+
for (const [filename, srcPath] of Object.entries(binaryHooks)) {
|
|
106
|
+
const dest = path.join(hooksDir, filename);
|
|
107
|
+
try {
|
|
108
|
+
fs.copyFileSync(srcPath, dest);
|
|
109
|
+
showFileInstalled(`hooks/${filename}`, true);
|
|
110
|
+
} catch (err) {
|
|
111
|
+
showFileInstalled(`hooks/${filename}`, false, err.message);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
103
114
|
}
|
|
104
115
|
|
|
105
116
|
function registerHooksInSettings() {
|
|
@@ -130,6 +141,12 @@ function registerHooksInSettings() {
|
|
|
130
141
|
hooks: [{ type: 'command', command: 'node ~/.claude/hooks/hydra-auto-guard.js' }]
|
|
131
142
|
});
|
|
132
143
|
|
|
144
|
+
if (!settings.hooks.Notification) settings.hooks.Notification = [];
|
|
145
|
+
settings.hooks.Notification = settings.hooks.Notification.filter(x => !isHydraHook(x));
|
|
146
|
+
settings.hooks.Notification.push({
|
|
147
|
+
hooks: [{ type: 'command', command: 'node ~/.claude/hooks/hydra-notify.js' }]
|
|
148
|
+
});
|
|
149
|
+
|
|
133
150
|
let statusLineConfigured = false;
|
|
134
151
|
if (!settings.statusLine || (settings.statusLine.command && settings.statusLine.command.includes('hydra-'))) {
|
|
135
152
|
settings.statusLine = {
|
|
@@ -161,6 +178,10 @@ function deregisterHooks() {
|
|
|
161
178
|
settings.hooks.PostToolUse = settings.hooks.PostToolUse.filter(x => !isHydraHook(x));
|
|
162
179
|
if (!settings.hooks.PostToolUse.length) delete settings.hooks.PostToolUse;
|
|
163
180
|
}
|
|
181
|
+
if (settings.hooks?.Notification) {
|
|
182
|
+
settings.hooks.Notification = settings.hooks.Notification.filter(x => !isHydraHook(x));
|
|
183
|
+
if (!settings.hooks.Notification.length) delete settings.hooks.Notification;
|
|
184
|
+
}
|
|
164
185
|
if (settings.hooks && !Object.keys(settings.hooks).length) delete settings.hooks;
|
|
165
186
|
|
|
166
187
|
if (settings.statusLine?.command?.includes('hydra-')) delete settings.statusLine;
|
|
@@ -305,6 +326,15 @@ async function runUninstall({ interactive = true } = {}) {
|
|
|
305
326
|
}
|
|
306
327
|
}
|
|
307
328
|
|
|
329
|
+
// Remove binary hook files (e.g., .wav)
|
|
330
|
+
for (const filename of Object.keys(binaryHooks)) {
|
|
331
|
+
const dest = path.join(GLOBAL_BASE, 'hooks', filename);
|
|
332
|
+
if (fileExists(dest)) {
|
|
333
|
+
try { fs.unlinkSync(dest); console.log(chalk.green(` \u2714 Removed hooks/${filename}`)); }
|
|
334
|
+
catch (err) { console.log(chalk.red(` \u2716 Failed: hooks/${filename} \u2014 ${err.message}`)); }
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
308
338
|
// Remove cache file
|
|
309
339
|
const cacheFile = path.join(GLOBAL_BASE, 'cache', 'hydra-update-check.json');
|
|
310
340
|
if (fileExists(cacheFile)) {
|