oh-my-claudecode 0.2.8 → 0.2.9
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 +170 -68
- package/commands/cthulhu.md +9 -1
- package/commands/invoke-shub.md +8 -2
- package/commands/shoggoth.md +15 -25
- package/commands/yog-sothoth.md +18 -25
- package/dist/agents/render.d.ts +11 -0
- package/dist/agents/render.d.ts.map +1 -0
- package/dist/agents/render.js +69 -0
- package/dist/agents/render.js.map +1 -0
- package/dist/cli/dashboard.d.ts +12 -0
- package/dist/cli/dashboard.d.ts.map +1 -0
- package/dist/cli/dashboard.js +58 -0
- package/dist/cli/dashboard.js.map +1 -0
- package/dist/cli/doctor.d.ts +11 -0
- package/dist/cli/doctor.d.ts.map +1 -1
- package/dist/cli/doctor.js +163 -9
- package/dist/cli/doctor.js.map +1 -1
- package/dist/cli/index.js +72 -3
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/install.d.ts +6 -0
- package/dist/cli/install.d.ts.map +1 -1
- package/dist/cli/install.js +211 -44
- package/dist/cli/install.js.map +1 -1
- package/dist/cli/lint.d.ts +26 -0
- package/dist/cli/lint.d.ts.map +1 -0
- package/dist/cli/lint.js +86 -0
- package/dist/cli/lint.js.map +1 -0
- package/dist/cli/stats.d.ts +56 -0
- package/dist/cli/stats.d.ts.map +1 -0
- package/dist/cli/stats.js +197 -0
- package/dist/cli/stats.js.map +1 -0
- package/dist/cli/sync.d.ts +44 -0
- package/dist/cli/sync.d.ts.map +1 -0
- package/dist/cli/sync.js +154 -0
- package/dist/cli/sync.js.map +1 -0
- package/dist/config/schema.d.ts +337 -331
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js +14 -10
- package/dist/config/schema.js.map +1 -1
- package/dist/features/block-summarizer/index.js +1 -0
- package/dist/features/block-summarizer/index.js.map +1 -1
- package/dist/features/yith-archive/config.d.ts.map +1 -1
- package/dist/features/yith-archive/config.js +11 -15
- package/dist/features/yith-archive/config.js.map +1 -1
- package/dist/features/yith-archive/eval/schemas.d.ts +2 -2
- package/dist/features/yith-archive/functions/migrate.d.ts.map +1 -1
- package/dist/features/yith-archive/functions/migrate.js +7 -3
- package/dist/features/yith-archive/functions/migrate.js.map +1 -1
- package/dist/features/yith-archive/functions/opencode-import.d.ts.map +1 -1
- package/dist/features/yith-archive/functions/opencode-import.js +54 -27
- package/dist/features/yith-archive/functions/opencode-import.js.map +1 -1
- package/dist/features/yith-archive/functions/smart-search.js.map +1 -1
- package/dist/features/yith-archive/functions/temporal-graph.d.ts.map +1 -1
- package/dist/features/yith-archive/functions/temporal-graph.js +1 -0
- package/dist/features/yith-archive/functions/temporal-graph.js.map +1 -1
- package/dist/features/yith-archive/providers/embedding/local.d.ts +16 -5
- package/dist/features/yith-archive/providers/embedding/local.d.ts.map +1 -1
- package/dist/features/yith-archive/providers/embedding/local.js +29 -11
- package/dist/features/yith-archive/providers/embedding/local.js.map +1 -1
- package/dist/features/yith-archive/state/fake-sdk.d.ts.map +1 -1
- package/dist/features/yith-archive/state/fake-sdk.js.map +1 -1
- package/dist/features/yith-archive/state/reranker.d.ts.map +1 -1
- package/dist/features/yith-archive/state/reranker.js +9 -2
- package/dist/features/yith-archive/state/reranker.js.map +1 -1
- package/dist/features/yith-archive/state/vector-index.d.ts.map +1 -1
- package/dist/features/yith-archive/state/vector-index.js +1 -0
- package/dist/features/yith-archive/state/vector-index.js.map +1 -1
- package/dist/hooks/agent-sync.d.ts +16 -0
- package/dist/hooks/agent-sync.d.ts.map +1 -0
- package/dist/hooks/agent-sync.js +42 -0
- package/dist/hooks/agent-sync.js.map +1 -0
- package/dist/hooks/comment-checker.d.ts +1 -1
- package/dist/hooks/comment-checker.d.ts.map +1 -1
- package/dist/hooks/comment-checker.js +10 -0
- package/dist/hooks/comment-checker.js.map +1 -1
- package/dist/hooks/cthulhu-auto.d.ts +1 -1
- package/dist/hooks/cthulhu-auto.d.ts.map +1 -1
- package/dist/hooks/cthulhu-auto.js +77 -8
- package/dist/hooks/cthulhu-auto.js.map +1 -1
- package/dist/hooks/cthulhu-preflight.d.ts.map +1 -1
- package/dist/hooks/cthulhu-preflight.js +6 -5
- package/dist/hooks/cthulhu-preflight.js.map +1 -1
- package/dist/hooks/design-detector-hook.d.ts +6 -5
- package/dist/hooks/design-detector-hook.d.ts.map +1 -1
- package/dist/hooks/design-detector-hook.js +27 -8
- package/dist/hooks/design-detector-hook.js.map +1 -1
- package/dist/hooks/index.d.ts +2 -1
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +43 -0
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/web-research-hook.d.ts +6 -5
- package/dist/hooks/web-research-hook.d.ts.map +1 -1
- package/dist/hooks/web-research-hook.js +30 -9
- package/dist/hooks/web-research-hook.js.map +1 -1
- package/dist/hooks/write-guard.d.ts +1 -1
- package/dist/hooks/write-guard.d.ts.map +1 -1
- package/dist/hooks/write-guard.js +10 -0
- package/dist/hooks/write-guard.js.map +1 -1
- package/dist/hooks/yith-capture.d.ts +9 -3
- package/dist/hooks/yith-capture.d.ts.map +1 -1
- package/dist/hooks/yith-capture.js +43 -14
- package/dist/hooks/yith-capture.js.map +1 -1
- package/dist/index.d.ts +12 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -5
- package/dist/index.js.map +1 -1
- package/dist/linters/type-safety-ast.d.ts.map +1 -1
- package/dist/linters/type-safety-ast.js +42 -24
- package/dist/linters/type-safety-ast.js.map +1 -1
- package/dist/shared/ascii-logo.d.ts +24 -0
- package/dist/shared/ascii-logo.d.ts.map +1 -0
- package/dist/shared/ascii-logo.js +77 -0
- package/dist/shared/ascii-logo.js.map +1 -0
- package/dist/shared/model-resolution.d.ts +19 -6
- package/dist/shared/model-resolution.d.ts.map +1 -1
- package/dist/shared/model-resolution.js +25 -12
- package/dist/shared/model-resolution.js.map +1 -1
- package/package.json +9 -6
- package/tui/dashboard.tsx +504 -0
- package/tui/data.ts +178 -0
- package/tui/theme.ts +51 -0
- package/tui/tsconfig.json +15 -0
- package/tui/wizard.tsx +219 -0
- package/dist/plugin-handlers/config-handler.d.ts +0 -21
- package/dist/plugin-handlers/config-handler.d.ts.map +0 -1
- package/dist/plugin-handlers/config-handler.js +0 -33
- package/dist/plugin-handlers/config-handler.js.map +0 -1
- package/dist/plugin-handlers/index.d.ts +0 -2
- package/dist/plugin-handlers/index.d.ts.map +0 -1
- package/dist/plugin-handlers/index.js +0 -2
- package/dist/plugin-handlers/index.js.map +0 -1
|
@@ -62,6 +62,30 @@ if [ -f "\$NECRONOMICON" ] && command -v jq >/dev/null 2>&1; then
|
|
|
62
62
|
' "\$NECRONOMICON" 2>/dev/null || echo "0")
|
|
63
63
|
fi
|
|
64
64
|
|
|
65
|
+
# --- Capture health ---
|
|
66
|
+
# The bind CLI writes an epoch timestamp to .last-bind-success after every
|
|
67
|
+
# successful transcript ingestion. If that beacon is stale (or the CLI is
|
|
68
|
+
# missing entirely), continuous capture has silently stopped — surface it
|
|
69
|
+
# instead of letting session data age out unobserved.
|
|
70
|
+
CAPTURE_STATUS="ok"
|
|
71
|
+
CAPTURE_AGE_DAYS="?"
|
|
72
|
+
if ! command -v oh-my-claudecode >/dev/null 2>&1; then
|
|
73
|
+
CAPTURE_STATUS="no-cli"
|
|
74
|
+
else
|
|
75
|
+
BEACON="\${HOME}/.oh-my-claudecode/yith/.last-bind-success"
|
|
76
|
+
if [ ! -f "\$BEACON" ]; then
|
|
77
|
+
CAPTURE_STATUS="never"
|
|
78
|
+
else
|
|
79
|
+
last_success=\$(cat "\$BEACON" 2>/dev/null || echo 0)
|
|
80
|
+
now_s=\$(date +%s)
|
|
81
|
+
age=\$((now_s - last_success))
|
|
82
|
+
CAPTURE_AGE_DAYS=\$((age / 86400))
|
|
83
|
+
if [ "\$age" -ge 604800 ]; then
|
|
84
|
+
CAPTURE_STATUS="stale"
|
|
85
|
+
fi
|
|
86
|
+
fi
|
|
87
|
+
fi
|
|
88
|
+
|
|
65
89
|
cat <<'PROMPT'
|
|
66
90
|
[oh-my-claudecode: Cthulhu orchestrator auto-activated — .elder-gods/ detected]
|
|
67
91
|
|
|
@@ -75,7 +99,18 @@ Operating principles:
|
|
|
75
99
|
3. Parallelize everything — independent searches and reads happen simultaneously
|
|
76
100
|
4. Plan before implement — todos BEFORE touching files
|
|
77
101
|
5. Verify before completing — diagnostics, tests, evidence required
|
|
78
|
-
6.
|
|
102
|
+
6. Summarize after delegation — after every Agent(subagent_type=...) call, write
|
|
103
|
+
the full output to .elder-gods/blocks/<timestamp>-<slug>.md and continue
|
|
104
|
+
reasoning from a 3-5 bullet summary. The block stays on disk; re-read it with
|
|
105
|
+
the Read tool if the summary proves insufficient. This keeps the main thread
|
|
106
|
+
from accumulating raw subagent output.
|
|
107
|
+
7. Persist insights to Yith Archive — salient facts from delegations (user
|
|
108
|
+
preferences, project conventions, non-obvious constraints, decisions) become
|
|
109
|
+
durable cross-session memories via yith_remember. Note: context compaction
|
|
110
|
+
and /clear are non-destructive — the full transcript is ingested into the
|
|
111
|
+
archive at those boundaries automatically, so recall what compaction
|
|
112
|
+
summarized away with yith_search instead of asking the user to repeat it.
|
|
113
|
+
8. Agent-speed time framing — you are not a human team. NEVER estimate work in
|
|
79
114
|
human units (days, weeks, sprints, story points, "a few hours of dev time").
|
|
80
115
|
Agents operate in tool-call budgets, not calendars. If asked "how long", answer
|
|
81
116
|
in concrete units you actually control: number of steps, files touched, tool
|
|
@@ -93,11 +128,18 @@ Available Elder God specialists (use via Agent tool subagent_type):
|
|
|
93
128
|
- "nyarlathotep" — end-to-end autonomous execution of whole goals
|
|
94
129
|
- "shub-niggurath" — strategic planning flow (interview → plan → review)
|
|
95
130
|
- "the-deep-one" — image/screenshot/diagram analysis
|
|
131
|
+
- "nodens" — frontend/UI design and component work
|
|
96
132
|
|
|
97
133
|
Classification flow for each user message:
|
|
98
134
|
- Trivial → direct tools, no delegation
|
|
99
|
-
- Exploratory → parallel
|
|
100
|
-
- Implementation
|
|
135
|
+
- Exploratory → parallel "shoggoth" agents
|
|
136
|
+
- Implementation, small (single file, obvious change) → todos, then execute directly
|
|
137
|
+
- Implementation, substantial (2+ files, new feature, refactor, or unclear scope) →
|
|
138
|
+
the pipeline is MANDATORY, not optional:
|
|
139
|
+
1. Spawn "shub-niggurath" to produce a work plan in .elder-gods/plans/
|
|
140
|
+
2. Spawn "tsathoggua" to review the plan — fix blockers it raises
|
|
141
|
+
3. Execute the approved plan, delegating to specialists per its steps
|
|
142
|
+
- Design/UI work → delegate to "nodens"
|
|
101
143
|
- Ambiguous → exactly one clarifying question
|
|
102
144
|
|
|
103
145
|
[END cthulhu orchestrator injection]
|
|
@@ -133,15 +175,42 @@ elif [ "\$PENDING_COUNT" != "0" ]; then
|
|
|
133
175
|
echo "✓ Necronomicon bound. \$PENDING_COUNT raw observations are queued for"
|
|
134
176
|
echo "compression into searchable memories."
|
|
135
177
|
echo
|
|
136
|
-
echo "**
|
|
137
|
-
echo "
|
|
138
|
-
echo "
|
|
139
|
-
echo "mem::compress-batch-step and
|
|
140
|
-
echo "
|
|
178
|
+
echo "**Act, don't ask**: after you finish handling the user's first message,"
|
|
179
|
+
echo "drain the queue yourself. Tell the user in one line that you're"
|
|
180
|
+
echo "compressing \$PENDING_COUNT pending observations in the background of the"
|
|
181
|
+
echo "conversation, then call yith_trigger with mem::compress-batch-step and"
|
|
182
|
+
echo "drive the needs_llm_work -> yith_commit_work loop until terminal."
|
|
183
|
+
echo "Render an ASCII progress bar per round. Only skip this if the user"
|
|
184
|
+
echo "explicitly objects or the session is clearly meant to be ultra-short."
|
|
141
185
|
else
|
|
142
186
|
echo
|
|
143
187
|
echo "✓ Necronomicon is bound and every phase is complete. Nothing pending."
|
|
144
188
|
fi
|
|
189
|
+
|
|
190
|
+
# --- Capture health ---
|
|
191
|
+
if [ "\$CAPTURE_STATUS" != "ok" ]; then
|
|
192
|
+
echo
|
|
193
|
+
echo "[Yith capture health]"
|
|
194
|
+
case "\$CAPTURE_STATUS" in
|
|
195
|
+
no-cli)
|
|
196
|
+
echo "⚠ The oh-my-claudecode CLI is not on PATH — continuous transcript"
|
|
197
|
+
echo "capture is INOPERATIVE. Session data will be lost when Claude Code"
|
|
198
|
+
echo "rotates old transcripts. Tell the user to reinstall:"
|
|
199
|
+
echo " npm install -g oh-my-claudecode && oh-my-claudecode install"
|
|
200
|
+
;;
|
|
201
|
+
never)
|
|
202
|
+
echo "⚠ Transcript ingestion has never completed successfully on this"
|
|
203
|
+
echo "machine. Tell the user to run \\\`oh-my-claudecode bind\\\` in a"
|
|
204
|
+
echo "terminal (or /necronomicon-bind here) so history starts flowing"
|
|
205
|
+
echo "into the archive."
|
|
206
|
+
;;
|
|
207
|
+
stale)
|
|
208
|
+
echo "⚠ Last successful transcript ingestion was \$CAPTURE_AGE_DAYS days ago."
|
|
209
|
+
echo "Continuous capture may be broken (cron removed? CLI updated?)."
|
|
210
|
+
echo "Tell the user to run \\\`oh-my-claudecode doctor\\\` to diagnose."
|
|
211
|
+
;;
|
|
212
|
+
esac
|
|
213
|
+
fi
|
|
145
214
|
`;
|
|
146
215
|
export function getCthulhuAutoHookConfig() {
|
|
147
216
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cthulhu-auto.js","sourceRoot":"","sources":["../../src/hooks/cthulhu-auto.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,CAAC,MAAM,wBAAwB,GAAG
|
|
1
|
+
{"version":3,"file":"cthulhu-auto.js","sourceRoot":"","sources":["../../src/hooks/cthulhu-auto.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,CAAC,MAAM,wBAAwB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0MvC,CAAA;AAED,MAAM,UAAU,wBAAwB;IACtC,OAAO;QACL,OAAO,EAAE,EAAE;QACX,KAAK,EAAE;YACL;gBACE,IAAI,EAAE,SAAS;gBACf,OAAO,EAAE,iCAAiC;aAC3C;SACF;KACF,CAAA;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cthulhu-preflight.d.ts","sourceRoot":"","sources":["../../src/hooks/cthulhu-preflight.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,MAAM,MAAM,aAAa,GACrB,oBAAoB,GACpB,oBAAoB,GACpB,iBAAiB,GACjB,kBAAkB,GAClB,kBAAkB,GAClB,6BAA6B,CAAA;AAEjC,MAAM,WAAW,cAAc;IAC7B,yDAAyD;IACzD,eAAe,EAAE,OAAO,CAAA;IACxB,kDAAkD;IAClD,iBAAiB,EAAE,OAAO,CAAA;IAC1B,yDAAyD;IACzD,uBAAuB,EAAE,MAAM,CAAA;IAC/B,yDAAyD;IACzD,YAAY,EAAE,aAAa,EAAE,CAAA;IAC7B;kEAC8D;IAC9D,aAAa,CAAC,EAAE,aAAa,EAAE,CAAA;CAChC;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"cthulhu-preflight.d.ts","sourceRoot":"","sources":["../../src/hooks/cthulhu-preflight.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,MAAM,MAAM,aAAa,GACrB,oBAAoB,GACpB,oBAAoB,GACpB,iBAAiB,GACjB,kBAAkB,GAClB,kBAAkB,GAClB,6BAA6B,CAAA;AAEjC,MAAM,WAAW,cAAc;IAC7B,yDAAyD;IACzD,eAAe,EAAE,OAAO,CAAA;IACxB,kDAAkD;IAClD,iBAAiB,EAAE,OAAO,CAAA;IAC1B,yDAAyD;IACzD,uBAAuB,EAAE,MAAM,CAAA;IAC/B,yDAAyD;IACzD,YAAY,EAAE,aAAa,EAAE,CAAA;IAC7B;kEAC8D;IAC9D,aAAa,CAAC,EAAE,aAAa,EAAE,CAAA;CAChC;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM,CAoFnE"}
|
|
@@ -68,18 +68,19 @@ export function buildPreflightSection(input) {
|
|
|
68
68
|
}
|
|
69
69
|
return lines.join("\n");
|
|
70
70
|
}
|
|
71
|
-
// Priority 4:
|
|
71
|
+
// Priority 4: drain pending compression (bind complete, queue non-empty).
|
|
72
72
|
if (input.pendingCompressionCount > 0) {
|
|
73
73
|
lines.push("");
|
|
74
74
|
lines.push(`✓ Necronomicon bound. ${input.pendingCompressionCount} raw ` +
|
|
75
75
|
"observations are queued for compression into searchable memories.");
|
|
76
76
|
lines.push("");
|
|
77
|
-
lines.push("**
|
|
78
|
-
"
|
|
79
|
-
"
|
|
77
|
+
lines.push("**Act, don't ask**: after handling the user's first message, drain " +
|
|
78
|
+
"the queue yourself. Tell the user in one line that you're compressing " +
|
|
79
|
+
"the pending observations, then call " +
|
|
80
80
|
"`yith_trigger({ name: 'mem::compress-batch-step', args: { limit: 100 } })` " +
|
|
81
81
|
"and drive the `needs_llm_work` → `yith_commit_work` loop until terminal. " +
|
|
82
|
-
"Render an ASCII progress bar per round so the user sees forward motion."
|
|
82
|
+
"Render an ASCII progress bar per round so the user sees forward motion. " +
|
|
83
|
+
"Only skip if the user explicitly objects.");
|
|
83
84
|
return lines.join("\n");
|
|
84
85
|
}
|
|
85
86
|
// All clear.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cthulhu-preflight.js","sourceRoot":"","sources":["../../src/hooks/cthulhu-preflight.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAwBH;;;;;GAKG;AACH,MAAM,UAAU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;YAC3E,0EAA0E;YAC1E,2CAA2C,CAC9C,CAAA;QACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACzB,CAAC;IAED,aAAa;IACb,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACd,KAAK,CAAC,IAAI,CAAC,iEAAiE;QAC1E,wCAAwC,CAAC,CAAA;IAC3C,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACzB,CAAC"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Design Detector Hook
|
|
3
3
|
*
|
|
4
|
-
* PreToolUse hook that detects when
|
|
5
|
-
*
|
|
4
|
+
* PreToolUse hook that detects when the conversation involves a
|
|
5
|
+
* frontend/design task and injects a routing directive: delegate to the
|
|
6
|
+
* Nodens subagent (design methodology, accessibility, responsive work)
|
|
7
|
+
* instead of handling the design inline.
|
|
6
8
|
*
|
|
7
|
-
*
|
|
8
|
-
* in design methodology and frontend implementation.
|
|
9
|
+
* Respects `frontend_design.enabled: false` in ~/.claude/oh-my-claudecode.jsonc.
|
|
9
10
|
*/
|
|
10
|
-
export declare const DESIGN_DETECTOR_HOOK_SCRIPT = "#!/usr/bin/env bash\n# oh-my-claudecode: Design Detector PreToolUse Hook\n# Fires on tool use to detect design tasks and suggest Nodens routing.\n\nset -euo pipefail\n\nCLAUDE_API_PROMPT=\"${CLAUDE_API_PROMPT:-}\"\n\n# Check for design-related keywords\n# HIGH confidence: component, ui, interface, design, button, form, modal, etc.\n# MEDIUM confidence: react, css, tailwind, responsive, animation, etc.\n\nif echo \"$CLAUDE_API_PROMPT\" | grep -qiE '\\b(component|ui|interface|design|button|form|modal|card|layout|responsive|css|tailwind|animation|accessibility|wcag|aria)\\b'; then\n echo \"[DESIGN TASK DETECTED]\"\n echo \"This
|
|
11
|
+
export declare const DESIGN_DETECTOR_HOOK_SCRIPT = "#!/usr/bin/env bash\n# oh-my-claudecode: Design Detector PreToolUse Hook\n# Fires on tool use to detect design tasks and suggest Nodens routing.\n\nset -euo pipefail\n\n# Scope to OMC-activated projects: bail unless .elder-gods/ exists in the\n# project directory or any parent. Unrelated repos keep stock behavior.\ndir=\"${CLAUDE_PROJECT_DIR:-$PWD}\"\nfound=\"\"\nwhile [ \"$dir\" != \"/\" ] && [ -n \"$dir\" ]; do\n if [ -d \"$dir/.elder-gods\" ]; then found=\"1\"; break; fi\n dir=\"$(dirname \"$dir\")\"\ndone\n[ -z \"$found\" ] && exit 0\n\n# Config kill-switch: frontend_design.enabled: false disables this hook.\nCONFIG=\"${HOME}/.claude/oh-my-claudecode.jsonc\"\nif [ -f \"$CONFIG\" ] && grep -A3 '\"frontend_design\"' \"$CONFIG\" 2>/dev/null | grep -q '\"enabled\"[[:space:]]*:[[:space:]]*false'; then\n exit 0\nfi\n\nCLAUDE_API_PROMPT=\"${CLAUDE_API_PROMPT:-}\"\n\n# Check for design-related keywords\n# HIGH confidence: component, ui, interface, design, button, form, modal, etc.\n# MEDIUM confidence: react, css, tailwind, responsive, animation, etc.\n\nif echo \"$CLAUDE_API_PROMPT\" | grep -qiE '\\b(component|ui|interface|design|button|form|modal|card|layout|responsive|css|tailwind|animation|accessibility|wcag|aria)\\b'; then\n echo \"[DESIGN TASK DETECTED]\"\n echo \"This is a design/frontend task. Route it to the specialist instead of\"\n echo \"handling the design inline: Agent tool, subagent_type: \\\"nodens\\\".\"\n echo \" \u2022 Nodens (God of Craftsmanship) runs intent \u2192 spec \u2192 impl \u2192 polish\"\n echo \" \u2022 Covers accessibility (WCAG), responsive design, and design systems\"\n echo \"Handle it yourself only when the change is a trivial copy/style tweak\"\n echo \"or the nodens agent is unavailable.\"\n echo \"\"\nfi\n";
|
|
11
12
|
export declare function getDesignDetectorHookConfig(): object;
|
|
12
13
|
//# sourceMappingURL=design-detector-hook.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"design-detector-hook.d.ts","sourceRoot":"","sources":["../../src/hooks/design-detector-hook.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"design-detector-hook.d.ts","sourceRoot":"","sources":["../../src/hooks/design-detector-hook.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,eAAO,MAAM,2BAA2B,6vDAsCvC,CAAA;AAED,wBAAgB,2BAA2B,IAAI,MAAM,CAUpD"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Design Detector Hook
|
|
3
3
|
*
|
|
4
|
-
* PreToolUse hook that detects when
|
|
5
|
-
*
|
|
4
|
+
* PreToolUse hook that detects when the conversation involves a
|
|
5
|
+
* frontend/design task and injects a routing directive: delegate to the
|
|
6
|
+
* Nodens subagent (design methodology, accessibility, responsive work)
|
|
7
|
+
* instead of handling the design inline.
|
|
6
8
|
*
|
|
7
|
-
*
|
|
8
|
-
* in design methodology and frontend implementation.
|
|
9
|
+
* Respects `frontend_design.enabled: false` in ~/.claude/oh-my-claudecode.jsonc.
|
|
9
10
|
*/
|
|
10
11
|
export const DESIGN_DETECTOR_HOOK_SCRIPT = `#!/usr/bin/env bash
|
|
11
12
|
# oh-my-claudecode: Design Detector PreToolUse Hook
|
|
@@ -13,6 +14,22 @@ export const DESIGN_DETECTOR_HOOK_SCRIPT = `#!/usr/bin/env bash
|
|
|
13
14
|
|
|
14
15
|
set -euo pipefail
|
|
15
16
|
|
|
17
|
+
# Scope to OMC-activated projects: bail unless .elder-gods/ exists in the
|
|
18
|
+
# project directory or any parent. Unrelated repos keep stock behavior.
|
|
19
|
+
dir="\${CLAUDE_PROJECT_DIR:-$PWD}"
|
|
20
|
+
found=""
|
|
21
|
+
while [ "$dir" != "/" ] && [ -n "$dir" ]; do
|
|
22
|
+
if [ -d "$dir/.elder-gods" ]; then found="1"; break; fi
|
|
23
|
+
dir="$(dirname "$dir")"
|
|
24
|
+
done
|
|
25
|
+
[ -z "$found" ] && exit 0
|
|
26
|
+
|
|
27
|
+
# Config kill-switch: frontend_design.enabled: false disables this hook.
|
|
28
|
+
CONFIG="\${HOME}/.claude/oh-my-claudecode.jsonc"
|
|
29
|
+
if [ -f "$CONFIG" ] && grep -A3 '"frontend_design"' "$CONFIG" 2>/dev/null | grep -q '"enabled"[[:space:]]*:[[:space:]]*false'; then
|
|
30
|
+
exit 0
|
|
31
|
+
fi
|
|
32
|
+
|
|
16
33
|
CLAUDE_API_PROMPT="\${CLAUDE_API_PROMPT:-}"
|
|
17
34
|
|
|
18
35
|
# Check for design-related keywords
|
|
@@ -21,10 +38,12 @@ CLAUDE_API_PROMPT="\${CLAUDE_API_PROMPT:-}"
|
|
|
21
38
|
|
|
22
39
|
if echo "$CLAUDE_API_PROMPT" | grep -qiE '\\b(component|ui|interface|design|button|form|modal|card|layout|responsive|css|tailwind|animation|accessibility|wcag|aria)\\b'; then
|
|
23
40
|
echo "[DESIGN TASK DETECTED]"
|
|
24
|
-
echo "This
|
|
25
|
-
echo "
|
|
26
|
-
echo " •
|
|
27
|
-
echo " •
|
|
41
|
+
echo "This is a design/frontend task. Route it to the specialist instead of"
|
|
42
|
+
echo "handling the design inline: Agent tool, subagent_type: \\"nodens\\"."
|
|
43
|
+
echo " • Nodens (God of Craftsmanship) runs intent → spec → impl → polish"
|
|
44
|
+
echo " • Covers accessibility (WCAG), responsive design, and design systems"
|
|
45
|
+
echo "Handle it yourself only when the change is a trivial copy/style tweak"
|
|
46
|
+
echo "or the nodens agent is unavailable."
|
|
28
47
|
echo ""
|
|
29
48
|
fi
|
|
30
49
|
`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"design-detector-hook.js","sourceRoot":"","sources":["../../src/hooks/design-detector-hook.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"design-detector-hook.js","sourceRoot":"","sources":["../../src/hooks/design-detector-hook.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,MAAM,CAAC,MAAM,2BAA2B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsC1C,CAAA;AAED,MAAM,UAAU,2BAA2B;IACzC,OAAO;QACL,OAAO,EAAE,EAAE;QACX,KAAK,EAAE;YACL;gBACE,IAAI,EAAE,SAAS;gBACf,OAAO,EAAE,oCAAoC;aAC9C;SACF;KACF,CAAA;AACH,CAAC"}
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -9,9 +9,10 @@ export { MEMORY_OVERRIDE_HOOK_SCRIPT, getMemoryOverrideHookConfig } from "./memo
|
|
|
9
9
|
export { YITH_CAPTURE_HOOK_SCRIPT, getYithCaptureHookConfig } from "./yith-capture.js";
|
|
10
10
|
export { WEB_RESEARCH_DETECTOR_HOOK_SCRIPT, getWebResearchDetectorHookConfig } from "./web-research-hook.js";
|
|
11
11
|
export { DESIGN_DETECTOR_HOOK_SCRIPT, getDesignDetectorHookConfig } from "./design-detector-hook.js";
|
|
12
|
+
export { AGENT_SYNC_HOOK_SCRIPT, getAgentSyncHookConfig } from "./agent-sync.js";
|
|
12
13
|
export interface HookDefinition {
|
|
13
14
|
name: HookName;
|
|
14
|
-
event: "PreToolUse" | "PostToolUse" | "Stop" | "Notification" | "SessionStart";
|
|
15
|
+
event: "PreToolUse" | "PostToolUse" | "Stop" | "Notification" | "SessionStart" | "PreCompact" | "SessionEnd";
|
|
15
16
|
scriptPath: string;
|
|
16
17
|
scriptContent: string;
|
|
17
18
|
config: object;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAEzE,OAAO,EAAE,6BAA6B,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAA;AACrG,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAA;AAChF,OAAO,EAAE,2BAA2B,EAAE,2BAA2B,EAAE,MAA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AE,MAAM,wBAAwB,CAAA;AAC5G,OAAO,EAAE,2BAA2B,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAA;AACpG,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAA;AAEhF,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,QAAQ,CAAA;IACd,KAAK,EACD,YAAY,GACZ,aAAa,GACb,MAAM,GACN,cAAc,GACd,cAAc,GACd,YAAY,GACZ,YAAY,CAAA;IAChB,UAAU,EAAE,MAAM,CAAA;IAClB,aAAa,EAAE,MAAM,CAAA;IACrB,MAAM,EAAE,MAAM,CAAA;CACf;AA+CD,0CAA0C;AAC1C,eAAO,MAAM,oBAAoB,EAAE,cAAc,EA8GhD,CAAA;AAED,2EAA2E;AAC3E,wBAAgB,eAAe,CAAC,MAAM,EAAE,oBAAoB,GAAG,cAAc,EAAE,CAG9E;AAED,kFAAkF;AAClF,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,cAAc,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAuBzF"}
|
package/dist/hooks/index.js
CHANGED
|
@@ -8,6 +8,7 @@ export { MEMORY_OVERRIDE_HOOK_SCRIPT, getMemoryOverrideHookConfig } from "./memo
|
|
|
8
8
|
export { YITH_CAPTURE_HOOK_SCRIPT, getYithCaptureHookConfig } from "./yith-capture.js";
|
|
9
9
|
export { WEB_RESEARCH_DETECTOR_HOOK_SCRIPT, getWebResearchDetectorHookConfig } from "./web-research-hook.js";
|
|
10
10
|
export { DESIGN_DETECTOR_HOOK_SCRIPT, getDesignDetectorHookConfig } from "./design-detector-hook.js";
|
|
11
|
+
export { AGENT_SYNC_HOOK_SCRIPT, getAgentSyncHookConfig } from "./agent-sync.js";
|
|
11
12
|
import { TODO_CONTINUATION_HOOK_SCRIPT, getTodoContinuationHookConfig, } from "./todo-continuation.js";
|
|
12
13
|
import { ELDER_LOOP_HOOK_SCRIPT, getElderLoopHookConfig, } from "./elder-loop.js";
|
|
13
14
|
import { COMMENT_CHECKER_HOOK_SCRIPT, getCommentCheckerHookConfig, } from "./comment-checker.js";
|
|
@@ -18,6 +19,7 @@ import { MEMORY_OVERRIDE_HOOK_SCRIPT, getMemoryOverrideHookConfig, } from "./mem
|
|
|
18
19
|
import { YITH_CAPTURE_HOOK_SCRIPT, getYithCaptureHookConfig, } from "./yith-capture.js";
|
|
19
20
|
import { WEB_RESEARCH_DETECTOR_HOOK_SCRIPT, getWebResearchDetectorHookConfig, } from "./web-research-hook.js";
|
|
20
21
|
import { DESIGN_DETECTOR_HOOK_SCRIPT, getDesignDetectorHookConfig, } from "./design-detector-hook.js";
|
|
22
|
+
import { AGENT_SYNC_HOOK_SCRIPT, getAgentSyncHookConfig, } from "./agent-sync.js";
|
|
21
23
|
/** All hook definitions for the plugin */
|
|
22
24
|
export const ALL_HOOK_DEFINITIONS = [
|
|
23
25
|
{
|
|
@@ -76,6 +78,45 @@ export const ALL_HOOK_DEFINITIONS = [
|
|
|
76
78
|
scriptContent: YITH_CAPTURE_HOOK_SCRIPT,
|
|
77
79
|
config: getYithCaptureHookConfig(),
|
|
78
80
|
},
|
|
81
|
+
{
|
|
82
|
+
// Same script, second event: ingest at session start too, so a
|
|
83
|
+
// machine that was closed for weeks backfills the moment Claude
|
|
84
|
+
// Code opens — before any Stop event has a chance to fire.
|
|
85
|
+
name: "yith-capture",
|
|
86
|
+
event: "SessionStart",
|
|
87
|
+
scriptPath: "~/.claude/hooks/yith-capture.sh",
|
|
88
|
+
scriptContent: YITH_CAPTURE_HOOK_SCRIPT,
|
|
89
|
+
config: getYithCaptureHookConfig(),
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
// Third event: capture immediately before context compaction (manual
|
|
93
|
+
// or auto). The transcript survives compaction, but ingesting at this
|
|
94
|
+
// boundary means the archive is already current the moment the
|
|
95
|
+
// in-context history gets summarized away.
|
|
96
|
+
name: "yith-capture",
|
|
97
|
+
event: "PreCompact",
|
|
98
|
+
scriptPath: "~/.claude/hooks/yith-capture.sh",
|
|
99
|
+
scriptContent: YITH_CAPTURE_HOOK_SCRIPT,
|
|
100
|
+
config: getYithCaptureHookConfig(),
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
// Fourth event: capture when the session ends — /clear, logout, or
|
|
104
|
+
// exit. The spawn is detached, so ingestion completes even though the
|
|
105
|
+
// session process is going away. Nothing said in a cleared session is
|
|
106
|
+
// ever lost.
|
|
107
|
+
name: "yith-capture",
|
|
108
|
+
event: "SessionEnd",
|
|
109
|
+
scriptPath: "~/.claude/hooks/yith-capture.sh",
|
|
110
|
+
scriptContent: YITH_CAPTURE_HOOK_SCRIPT,
|
|
111
|
+
config: getYithCaptureHookConfig(),
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
name: "agent-sync",
|
|
115
|
+
event: "SessionStart",
|
|
116
|
+
scriptPath: "~/.claude/hooks/agent-sync.sh",
|
|
117
|
+
scriptContent: AGENT_SYNC_HOOK_SCRIPT,
|
|
118
|
+
config: getAgentSyncHookConfig(),
|
|
119
|
+
},
|
|
79
120
|
{
|
|
80
121
|
name: "web-research-detector",
|
|
81
122
|
event: "PreToolUse",
|
|
@@ -104,6 +145,8 @@ export function buildHooksConfig(enabledHooks) {
|
|
|
104
145
|
Stop: [],
|
|
105
146
|
Notification: [],
|
|
106
147
|
SessionStart: [],
|
|
148
|
+
PreCompact: [],
|
|
149
|
+
SessionEnd: [],
|
|
107
150
|
};
|
|
108
151
|
for (const hook of enabledHooks) {
|
|
109
152
|
hooksByEvent[hook.event].push(hook.config);
|
package/dist/hooks/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,6BAA6B,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAA;AACrG,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,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AED,KAAK,MAAM,IAAI,IAAI,YAAY,EAAE,CAAC;QAChC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAC5C,CAAC;IAED,sBAAsB;IACtB,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC;QAC9C,IAAI,YAAY,CAAC,KAAK,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACrC,OAAO,YAAY,CAAC,KAAK,CAAC,CAAA;QAC5B,CAAC;IACH,CAAC;IAED,OAAO,YAAY,CAAA;AACrB,CAAC"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Web Research Detector Hook
|
|
3
3
|
*
|
|
4
|
-
* PreToolUse hook that detects when
|
|
5
|
-
*
|
|
4
|
+
* PreToolUse hook that detects when the conversation involves version
|
|
5
|
+
* checks, breaking changes, or other date-sensitive knowledge, and injects
|
|
6
|
+
* a directive to spawn a background Dagon research agent so current
|
|
7
|
+
* information lands in the context window before the answer is given.
|
|
6
8
|
*
|
|
7
|
-
*
|
|
8
|
-
* searching for current information before providing answers.
|
|
9
|
+
* Respects `web_research.enabled: false` in ~/.claude/oh-my-claudecode.jsonc.
|
|
9
10
|
*/
|
|
10
|
-
export declare const WEB_RESEARCH_DETECTOR_HOOK_SCRIPT = "#!/usr/bin/env bash\n# oh-my-claudecode: Web Research Detector PreToolUse Hook\n# Fires on tool use to detect web research needs and inject enforcement context.\n\nset -euo pipefail\n\nCLAUDE_API_PROMPT=\"${CLAUDE_API_PROMPT:-}\"\n\n# Extract a simple heuristic from the prompt: look for version patterns or date-sensitive keywords\n# This is a bash-level heuristic that doesn't need the full TypeScript detector\n\n# Check for version patterns: v1.0, 2024, latest, etc.\nif echo \"$CLAUDE_API_PROMPT\" | grep -qiE '\\b(v[0-9]+\\.[0-9]+|20[0-9]{2}|latest\\s+(version|release|update)|breaking\\s+changes|what.?s\\s+new)\\b'; then\n echo \"[WEB RESEARCH ENFORCEMENT]\"\n echo \"
|
|
11
|
+
export declare const WEB_RESEARCH_DETECTOR_HOOK_SCRIPT = "#!/usr/bin/env bash\n# oh-my-claudecode: Web Research Detector PreToolUse Hook\n# Fires on tool use to detect web research needs and inject enforcement context.\n\nset -euo pipefail\n\n# Scope to OMC-activated projects: bail unless .elder-gods/ exists in the\n# project directory or any parent. Unrelated repos keep stock behavior.\ndir=\"${CLAUDE_PROJECT_DIR:-$PWD}\"\nfound=\"\"\nwhile [ \"$dir\" != \"/\" ] && [ -n \"$dir\" ]; do\n if [ -d \"$dir/.elder-gods\" ]; then found=\"1\"; break; fi\n dir=\"$(dirname \"$dir\")\"\ndone\n[ -z \"$found\" ] && exit 0\n\n# Config kill-switch: web_research.enabled: false disables this hook.\nCONFIG=\"${HOME}/.claude/oh-my-claudecode.jsonc\"\nif [ -f \"$CONFIG\" ] && grep -A3 '\"web_research\"' \"$CONFIG\" 2>/dev/null | grep -q '\"enabled\"[[:space:]]*:[[:space:]]*false'; then\n exit 0\nfi\n\nCLAUDE_API_PROMPT=\"${CLAUDE_API_PROMPT:-}\"\n\n# Extract a simple heuristic from the prompt: look for version patterns or date-sensitive keywords\n# This is a bash-level heuristic that doesn't need the full TypeScript detector\n\n# Check for version patterns: v1.0, 2024, latest, etc.\nif echo \"$CLAUDE_API_PROMPT\" | grep -qiE '\\b(v[0-9]+\\.[0-9]+|20[0-9]{2}|latest\\s+(version|release|update)|breaking\\s+changes|what.?s\\s+new)\\b'; then\n echo \"[WEB RESEARCH ENFORCEMENT]\"\n echo \"This request depends on current knowledge (version check or other\"\n echo \"date-sensitive information). Your training data may be stale here.\"\n echo \"\"\n echo \"Spawn a background Dagon research agent NOW, before answering:\"\n echo \" Agent tool, subagent_type: \\\"dagon\\\", run_in_background: true,\"\n echo \" prompt: the specific versions/APIs/dates to verify.\"\n echo \"Fold its findings into your answer when it returns. If the Agent tool\"\n echo \"or the dagon agent is unavailable, use WebSearch directly instead.\"\n echo \"Never answer a version-sensitive question purely from memory.\"\n echo \"\"\nfi\n";
|
|
11
12
|
export declare function getWebResearchDetectorHookConfig(): object;
|
|
12
13
|
//# sourceMappingURL=web-research-hook.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web-research-hook.d.ts","sourceRoot":"","sources":["../../src/hooks/web-research-hook.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"web-research-hook.d.ts","sourceRoot":"","sources":["../../src/hooks/web-research-hook.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,eAAO,MAAM,iCAAiC,s7DAyC7C,CAAA;AAED,wBAAgB,gCAAgC,IAAI,MAAM,CAUzD"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Web Research Detector Hook
|
|
3
3
|
*
|
|
4
|
-
* PreToolUse hook that detects when
|
|
5
|
-
*
|
|
4
|
+
* PreToolUse hook that detects when the conversation involves version
|
|
5
|
+
* checks, breaking changes, or other date-sensitive knowledge, and injects
|
|
6
|
+
* a directive to spawn a background Dagon research agent so current
|
|
7
|
+
* information lands in the context window before the answer is given.
|
|
6
8
|
*
|
|
7
|
-
*
|
|
8
|
-
* searching for current information before providing answers.
|
|
9
|
+
* Respects `web_research.enabled: false` in ~/.claude/oh-my-claudecode.jsonc.
|
|
9
10
|
*/
|
|
10
11
|
export const WEB_RESEARCH_DETECTOR_HOOK_SCRIPT = `#!/usr/bin/env bash
|
|
11
12
|
# oh-my-claudecode: Web Research Detector PreToolUse Hook
|
|
@@ -13,6 +14,22 @@ export const WEB_RESEARCH_DETECTOR_HOOK_SCRIPT = `#!/usr/bin/env bash
|
|
|
13
14
|
|
|
14
15
|
set -euo pipefail
|
|
15
16
|
|
|
17
|
+
# Scope to OMC-activated projects: bail unless .elder-gods/ exists in the
|
|
18
|
+
# project directory or any parent. Unrelated repos keep stock behavior.
|
|
19
|
+
dir="\${CLAUDE_PROJECT_DIR:-$PWD}"
|
|
20
|
+
found=""
|
|
21
|
+
while [ "$dir" != "/" ] && [ -n "$dir" ]; do
|
|
22
|
+
if [ -d "$dir/.elder-gods" ]; then found="1"; break; fi
|
|
23
|
+
dir="$(dirname "$dir")"
|
|
24
|
+
done
|
|
25
|
+
[ -z "$found" ] && exit 0
|
|
26
|
+
|
|
27
|
+
# Config kill-switch: web_research.enabled: false disables this hook.
|
|
28
|
+
CONFIG="\${HOME}/.claude/oh-my-claudecode.jsonc"
|
|
29
|
+
if [ -f "$CONFIG" ] && grep -A3 '"web_research"' "$CONFIG" 2>/dev/null | grep -q '"enabled"[[:space:]]*:[[:space:]]*false'; then
|
|
30
|
+
exit 0
|
|
31
|
+
fi
|
|
32
|
+
|
|
16
33
|
CLAUDE_API_PROMPT="\${CLAUDE_API_PROMPT:-}"
|
|
17
34
|
|
|
18
35
|
# Extract a simple heuristic from the prompt: look for version patterns or date-sensitive keywords
|
|
@@ -21,11 +38,15 @@ CLAUDE_API_PROMPT="\${CLAUDE_API_PROMPT:-}"
|
|
|
21
38
|
# Check for version patterns: v1.0, 2024, latest, etc.
|
|
22
39
|
if echo "$CLAUDE_API_PROMPT" | grep -qiE '\\b(v[0-9]+\\.[0-9]+|20[0-9]{2}|latest\\s+(version|release|update)|breaking\\s+changes|what.?s\\s+new)\\b'; then
|
|
23
40
|
echo "[WEB RESEARCH ENFORCEMENT]"
|
|
24
|
-
echo "
|
|
25
|
-
echo "
|
|
26
|
-
echo "
|
|
27
|
-
echo "
|
|
28
|
-
echo "
|
|
41
|
+
echo "This request depends on current knowledge (version check or other"
|
|
42
|
+
echo "date-sensitive information). Your training data may be stale here."
|
|
43
|
+
echo ""
|
|
44
|
+
echo "Spawn a background Dagon research agent NOW, before answering:"
|
|
45
|
+
echo " Agent tool, subagent_type: \\"dagon\\", run_in_background: true,"
|
|
46
|
+
echo " prompt: the specific versions/APIs/dates to verify."
|
|
47
|
+
echo "Fold its findings into your answer when it returns. If the Agent tool"
|
|
48
|
+
echo "or the dagon agent is unavailable, use WebSearch directly instead."
|
|
49
|
+
echo "Never answer a version-sensitive question purely from memory."
|
|
29
50
|
echo ""
|
|
30
51
|
fi
|
|
31
52
|
`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web-research-hook.js","sourceRoot":"","sources":["../../src/hooks/web-research-hook.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"web-research-hook.js","sourceRoot":"","sources":["../../src/hooks/web-research-hook.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,MAAM,CAAC,MAAM,iCAAiC,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyChD,CAAA;AAED,MAAM,UAAU,gCAAgC;IAC9C,OAAO;QACL,OAAO,EAAE,EAAE;QACX,KAAK,EAAE;YACL;gBACE,IAAI,EAAE,SAAS;gBACf,OAAO,EAAE,0CAA0C;aACpD;SACF;KACF,CAAA;AACH,CAAC"}
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
* Warns when Write is used on an existing file (should use Edit instead).
|
|
6
6
|
* Prevents accidental full-file overwrites when only a portion should change.
|
|
7
7
|
*/
|
|
8
|
-
export declare const WRITE_GUARD_HOOK_SCRIPT = "#!/usr/bin/env bash\n# oh-my-claudecode: Write Guard PreToolUse Hook\n# Fires before Write \u2014 warns if writing to an existing file.\n\nset -euo pipefail\n\nTOOL_NAME=\"${CLAUDE_TOOL_NAME:-}\"\nFILE_PATH=\"${CLAUDE_TOOL_INPUT_FILE_PATH:-}\"\n\nif [ \"$TOOL_NAME\" != \"Write\" ] || [ -z \"$FILE_PATH\" ]; then\n exit 0\nfi\n\nif [ -f \"$FILE_PATH\" ]; then\n echo \"[WRITE GUARD] Warning: Write tool used on existing file: $FILE_PATH\"\n echo \"Consider using Edit instead to preserve unintended changes.\"\n echo \"If you intend to fully replace this file, proceed.\"\nfi\n";
|
|
8
|
+
export declare const WRITE_GUARD_HOOK_SCRIPT = "#!/usr/bin/env bash\n# oh-my-claudecode: Write Guard PreToolUse Hook\n# Fires before Write \u2014 warns if writing to an existing file.\n\nset -euo pipefail\n\n# Scope to OMC-activated projects: bail unless .elder-gods/ exists in the\n# project directory or any parent. Unrelated repos keep stock behavior.\ndir=\"${CLAUDE_PROJECT_DIR:-$PWD}\"\nfound=\"\"\nwhile [ \"$dir\" != \"/\" ] && [ -n \"$dir\" ]; do\n if [ -d \"$dir/.elder-gods\" ]; then found=\"1\"; break; fi\n dir=\"$(dirname \"$dir\")\"\ndone\n[ -z \"$found\" ] && exit 0\n\nTOOL_NAME=\"${CLAUDE_TOOL_NAME:-}\"\nFILE_PATH=\"${CLAUDE_TOOL_INPUT_FILE_PATH:-}\"\n\nif [ \"$TOOL_NAME\" != \"Write\" ] || [ -z \"$FILE_PATH\" ]; then\n exit 0\nfi\n\nif [ -f \"$FILE_PATH\" ]; then\n echo \"[WRITE GUARD] Warning: Write tool used on existing file: $FILE_PATH\"\n echo \"Consider using Edit instead to preserve unintended changes.\"\n echo \"If you intend to fully replace this file, proceed.\"\nfi\n";
|
|
9
9
|
export declare function getWriteGuardHookConfig(): object;
|
|
10
10
|
//# sourceMappingURL=write-guard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write-guard.d.ts","sourceRoot":"","sources":["../../src/hooks/write-guard.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,eAAO,MAAM,uBAAuB,
|
|
1
|
+
{"version":3,"file":"write-guard.d.ts","sourceRoot":"","sources":["../../src/hooks/write-guard.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,eAAO,MAAM,uBAAuB,s8BA4BnC,CAAA;AAED,wBAAgB,uBAAuB,IAAI,MAAM,CAUhD"}
|
|
@@ -11,6 +11,16 @@ export const WRITE_GUARD_HOOK_SCRIPT = `#!/usr/bin/env bash
|
|
|
11
11
|
|
|
12
12
|
set -euo pipefail
|
|
13
13
|
|
|
14
|
+
# Scope to OMC-activated projects: bail unless .elder-gods/ exists in the
|
|
15
|
+
# project directory or any parent. Unrelated repos keep stock behavior.
|
|
16
|
+
dir="\${CLAUDE_PROJECT_DIR:-$PWD}"
|
|
17
|
+
found=""
|
|
18
|
+
while [ "$dir" != "/" ] && [ -n "$dir" ]; do
|
|
19
|
+
if [ -d "$dir/.elder-gods" ]; then found="1"; break; fi
|
|
20
|
+
dir="$(dirname "$dir")"
|
|
21
|
+
done
|
|
22
|
+
[ -z "$found" ] && exit 0
|
|
23
|
+
|
|
14
24
|
TOOL_NAME="\${CLAUDE_TOOL_NAME:-}"
|
|
15
25
|
FILE_PATH="\${CLAUDE_TOOL_INPUT_FILE_PATH:-}"
|
|
16
26
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write-guard.js","sourceRoot":"","sources":["../../src/hooks/write-guard.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,CAAC,MAAM,uBAAuB,GAAG
|
|
1
|
+
{"version":3,"file":"write-guard.js","sourceRoot":"","sources":["../../src/hooks/write-guard.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,CAAC,MAAM,uBAAuB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BtC,CAAA;AAED,MAAM,UAAU,uBAAuB;IACrC,OAAO;QACL,OAAO,EAAE,OAAO;QAChB,KAAK,EAAE;YACL;gBACE,IAAI,EAAE,SAAS;gBACf,OAAO,EAAE,gCAAgC;aAC1C;SACF;KACF,CAAA;AACH,CAAC"}
|
|
@@ -20,16 +20,22 @@
|
|
|
20
20
|
* every 5 seconds would burn credits; firing it every 5 minutes
|
|
21
21
|
* catches the queue opportunistically without being invasive.
|
|
22
22
|
*
|
|
23
|
-
* - Compression threshold (
|
|
23
|
+
* - Compression threshold (20 pending observations): below this, we
|
|
24
24
|
* let the user's manual `/necronomicon-bind` ritual handle
|
|
25
25
|
* compression. Above it, we assume the queue is growing faster
|
|
26
26
|
* than the user is running the ritual and nudge the cron-style
|
|
27
|
-
* spawn path into action automatically.
|
|
27
|
+
* spawn path into action automatically. A 24-hour age trigger
|
|
28
|
+
* drains even a small queue, so observations never sit raw
|
|
29
|
+
* (and poorly searchable) indefinitely.
|
|
30
|
+
*
|
|
31
|
+
* - Fires on Stop AND SessionStart (registered for both events in
|
|
32
|
+
* hooks/index.ts) so a machine that was closed for weeks ingests
|
|
33
|
+
* the backlog the moment Claude Code opens.
|
|
28
34
|
*
|
|
29
35
|
* - Fail-safe: the hook exits 0 on every branch. A broken Yith
|
|
30
36
|
* install can never block the user's Claude Code session — the
|
|
31
37
|
* hook is purely additive.
|
|
32
38
|
*/
|
|
33
|
-
export declare const YITH_CAPTURE_HOOK_SCRIPT = "#!/usr/bin/env bash\n# oh-my-claudecode: Yith continuous-ingestion Stop hook\n# Runs after every assistant turn. Spawns background bind ticks to\n# keep raw observations flowing and (occasionally) to drain pending\n# compression via \\`claude -p\\`. Never blocks the session.\n\nset -euo pipefail\n\nYITH_DIR=\"${HOME}/.oh-my-claudecode/yith\"\nCAPTURE_SENTINEL=\"${YITH_DIR}/.last-captured\"\nCOMPRESS_SENTINEL=\"${YITH_DIR}/.last-compressed\"\nDEBOUNCE_CAPTURE_SEC=5\nDEBOUNCE_COMPRESS_SEC=300\nCOMPRESS_THRESHOLD=
|
|
39
|
+
export declare const YITH_CAPTURE_HOOK_SCRIPT = "#!/usr/bin/env bash\n# oh-my-claudecode: Yith continuous-ingestion Stop hook\n# Runs after every assistant turn. Spawns background bind ticks to\n# keep raw observations flowing and (occasionally) to drain pending\n# compression via \\`claude -p\\`. Never blocks the session.\n\nset -euo pipefail\n\nYITH_DIR=\"${HOME}/.oh-my-claudecode/yith\"\nCAPTURE_SENTINEL=\"${YITH_DIR}/.last-captured\"\nCOMPRESS_SENTINEL=\"${YITH_DIR}/.last-compressed\"\nDEBOUNCE_CAPTURE_SEC=5\nDEBOUNCE_COMPRESS_SEC=300\nCOMPRESS_THRESHOLD=20\nCOMPRESS_MAX_AGE_SEC=86400\n\n# Bail early if Yith isn't installed yet (fresh machine, user hasn't\n# run \\`oh-my-claudecode bind\\` yet). The hook is strictly additive;\n# missing prerequisites are a silent no-op, not an error.\nif [ ! -d \"$YITH_DIR\" ]; then\n exit 0\nfi\n\n# Need the CLI on PATH to do anything useful.\nif ! command -v oh-my-claudecode >/dev/null 2>&1; then\n exit 0\nfi\n\n# Which lifecycle event invoked us? Claude Code passes JSON on stdin.\n# PreCompact and SessionEnd are capture-critical boundaries (context is\n# about to be summarized away / the session is going away) \u2014 they bypass\n# the debounce so the very last turns always reach the archive.\nHOOK_EVENT=\"\"\nif [ ! -t 0 ]; then\n HOOK_INPUT=$(cat 2>/dev/null || true)\n HOOK_EVENT=$(printf '%s' \"$HOOK_INPUT\" \\\n | grep -o '\"hook_event_name\"[[:space:]]*:[[:space:]]*\"[^\"]*\"' \\\n | head -1 | sed 's/.*\"\\([^\"]*\\)\"$/\\1/')\nfi\nFORCE_CAPTURE=0\ncase \"$HOOK_EVENT\" in\n PreCompact|SessionEnd) FORCE_CAPTURE=1 ;;\nesac\n\nnow=$(date +%s)\n\n# \u2500\u2500 Capture tick (always tries to run) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nlast_capture=0\nif [ -f \"$CAPTURE_SENTINEL\" ]; then\n last_capture=$(cat \"$CAPTURE_SENTINEL\" 2>/dev/null || echo 0)\nfi\n\nif [ \"$FORCE_CAPTURE\" = \"1\" ] || [ $((now - last_capture)) -ge $DEBOUNCE_CAPTURE_SEC ]; then\n echo \"$now\" > \"$CAPTURE_SENTINEL\"\n # Scope the scan to the current project when CLAUDE_PROJECT_DIR is\n # set by Claude Code \u2014 otherwise let bind scan everything.\n PROJECT_FLAG=\"\"\n if [ -n \"${CLAUDE_PROJECT_DIR:-}\" ]; then\n PROJECT_FLAG=\"--project ${CLAUDE_PROJECT_DIR}\"\n fi\n # Fork-detach: the CLI's \\`--background\\` flag spawns a grandchild\n # with detached stdio and exits the parent immediately, so the Stop\n # hook returns in ~10 ms regardless of how long the backfill takes.\n oh-my-claudecode bind --resume --claude-only --background $PROJECT_FLAG \\\n >/dev/null 2>&1 || true\nfi\n\n# \u2500\u2500 Compression tick (threshold- or age-gated, less frequent) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nNECRONOMICON=\"${YITH_DIR}/necronomicon.json\"\nif [ -f \"$NECRONOMICON\" ] && command -v jq >/dev/null 2>&1; then\n PENDING=$(jq -r '.\"mem:pending-compression\".state.count // 0' \"$NECRONOMICON\" 2>/dev/null || echo 0)\n last_compress=0\n if [ -f \"$COMPRESS_SENTINEL\" ]; then\n last_compress=$(cat \"$COMPRESS_SENTINEL\" 2>/dev/null || echo 0)\n fi\n # Fire when the queue is big, OR when ANY observations have sat raw\n # for more than COMPRESS_MAX_AGE_SEC since the last compression tick.\n should_compress=0\n if [ \"$PENDING\" -ge \"$COMPRESS_THRESHOLD\" ]; then\n should_compress=1\n elif [ \"$PENDING\" -gt 0 ] && [ $((now - last_compress)) -ge $COMPRESS_MAX_AGE_SEC ]; then\n should_compress=1\n fi\n if [ \"$should_compress\" = \"1\" ] && [ $((now - last_compress)) -ge $DEBOUNCE_COMPRESS_SEC ]; then\n echo \"$now\" > \"$COMPRESS_SENTINEL\"\n oh-my-claudecode bind --resume --compress-only --background \\\n >/dev/null 2>&1 || true\n fi\nfi\n\nexit 0\n";
|
|
34
40
|
export declare function getYithCaptureHookConfig(): object;
|
|
35
41
|
//# sourceMappingURL=yith-capture.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"yith-capture.d.ts","sourceRoot":"","sources":["../../src/hooks/yith-capture.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"yith-capture.d.ts","sourceRoot":"","sources":["../../src/hooks/yith-capture.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,eAAO,MAAM,wBAAwB,ouHA2FpC,CAAA;AAED,wBAAgB,wBAAwB,IAAI,MAAM,CAUjD"}
|