kenaz 0.3.16 → 0.3.17

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.
@@ -14,6 +14,7 @@ ARGUMENTS 含 `[專案: X]` 或 `--project-path X` → PROJECT_PATH = X,下方
14
14
  ## 工作方式
15
15
  - **自己做**:約 30 行內的小修正 → 直接改,跑最近的測試,提交。
16
16
  - **開卡派工**(中型、可平行、高風險):`kenaz_task_create` 開卡(requirements、acceptance criteria、scope paths)→ `node .formation/tools/dispatch.js --skill=do --task=TASK_XXX --dispatch-mode=subagent` → `promptText` 給 subagent、`agentParams` 照用(不換模型);輸出是 `executor` 區塊時照 RULES.md 的 Dispatch 執行。subagent 在 worktree commit,你驗證後合併。
17
+ - 用戶指定 model 就照做:單張卡加 `--dispatch-model <id>`(不改設定);「之後都用」才 `kenaz subagent set <id> [--rigor r]`。沒指定就照設定,不自己換。
17
18
  - 開卡前確認 scope 與驗收條件對準真正的問題。
18
19
 
19
20
  ## 驗證(合併前,強度跟風險相稱)
@@ -0,0 +1,44 @@
1
+ // vendor-agent-guard.js: in another-vendor session, an Agent call that asks for a Claude model is denied.
2
+ const test = require('node:test');
3
+ const assert = require('node:assert');
4
+ const path = require('path');
5
+ const { spawnSync } = require('child_process');
6
+ const { decide } = require('../vendor-agent-guard');
7
+
8
+ const DS = { ANTHROPIC_BASE_URL: 'https://api.deepseek.com/anthropic', KENAZ_PROVIDER: 'deepseek' };
9
+ const call = (model, tool = 'Agent') => ({ tool_name: tool, tool_input: { description: 'x', prompt: 'y', ...(model ? { model } : {}) } });
10
+
11
+ test('deepseek session: Agent/Task asking for a Claude model is denied with the dispatch.js route', () => {
12
+ for (const [m, t] of [['opus', 'Agent'], ['sonnet', 'Task'], ['claude-opus-5-5', 'Agent']]) {
13
+ const d = decide(call(m, t), DS);
14
+ assert.strictEqual(d.hookSpecificOutput.permissionDecision, 'deny', m);
15
+ assert.match(d.hookSpecificOutput.permissionDecisionReason, /dispatch\.js .*executor/);
16
+ }
17
+ // base URL alone (a session launched before KENAZ_PROVIDER existed) is enough
18
+ assert.ok(decide(call('opus'), { ANTHROPIC_BASE_URL: 'https://api.deepseek.com/anthropic' }));
19
+ });
20
+
21
+ test('controls: no model, a non-Claude model, a Claude session, or another tool are allowed', () => {
22
+ assert.strictEqual(decide(call(null), DS), null, 'no model = runs on the session vendor, as intended');
23
+ assert.strictEqual(decide(call('deepseek-v4-pro'), DS), null);
24
+ assert.strictEqual(decide(call('opus'), {}), null, 'normal Claude session');
25
+ assert.strictEqual(decide(call('opus'), { ANTHROPIC_BASE_URL: 'https://api.anthropic.com' }), null);
26
+ assert.strictEqual(decide({ tool_name: 'Bash', tool_input: { command: 'ls' } }, DS), null);
27
+ });
28
+
29
+ test('real hook path: the plugin dispatcher runs it in a user project and prints the deny JSON', () => {
30
+ const root = path.resolve(__dirname, '..', '..', '..');
31
+ // a user project (inside the core repo the plugin yields to the repo's own .claude/settings.json hooks)
32
+ const proj = require('fs').mkdtempSync(path.join(require('os').tmpdir(), 'vag-'));
33
+ require('fs').mkdirSync(path.join(proj, '.kenaz')); require('fs').writeFileSync(path.join(proj, '.kenaz', 'project.yaml'), 'name: p\n');
34
+ const r = spawnSync(process.execPath, [path.join(root, 'plugins', 'kenaz', 'hooks', 'kenaz-hook.js'), 'vendor-agent-guard'], {
35
+ input: JSON.stringify(call('opus')), encoding: 'utf8',
36
+ env: { ...process.env, ...DS, CLAUDE_PROJECT_DIR: proj, KENAZ_MODE: 'full' }, cwd: proj,
37
+ });
38
+ assert.match(r.stdout, /"permissionDecision":"deny"/, r.stdout + r.stderr);
39
+ const ok = spawnSync(process.execPath, [path.join(root, 'plugins', 'kenaz', 'hooks', 'kenaz-hook.js'), 'vendor-agent-guard'], {
40
+ input: JSON.stringify(call('opus')), encoding: 'utf8',
41
+ env: { ...process.env, ANTHROPIC_BASE_URL: '', KENAZ_PROVIDER: '', CLAUDE_PROJECT_DIR: proj, KENAZ_MODE: 'full' }, cwd: proj,
42
+ });
43
+ assert.strictEqual(ok.stdout.trim(), '', 'control: Claude session prints nothing');
44
+ });
@@ -0,0 +1,40 @@
1
+ 'use strict';
2
+ // PreToolUse(Agent|Task): in a session whose model requests go to another vendor (kenaz launch --provider
3
+ // deepseek, or the env set by hand), an Agent-tool subagent runs on that vendor too, whatever `model` says.
4
+ // Asking it for a Claude model is therefore always a silent substitution: deny it and point at the path that
5
+ // does reach Claude (dispatch.js -> executor block -> claude -p on the user's own login). Agent calls without
6
+ // a Claude model are allowed (they run on the session's vendor, as expected). Fails open on any error.
7
+ // Field report 2026-10-12: a DeepSeek Ansuz asked the Agent tool for opus and the subagent ran deepseek-v4-pro.
8
+ const path = require('path');
9
+
10
+ const CLAUDE_MODEL = /^(opus|sonnet|haiku|fable)$|^claude-/i;
11
+
12
+ function decide(input, env = process.env) {
13
+ if (!input || !['Agent', 'Task'].includes(input.tool_name)) return null;
14
+ const model = String((input.tool_input && input.tool_input.model) || '').trim();
15
+ if (!CLAUDE_MODEL.test(model)) return null;
16
+ let other = false;
17
+ try { other = require(path.join(__dirname, '..', '..', '.formation', 'bifrost', 'exec.js')).otherVendorSession(env); } catch (_) { return null; }
18
+ if (!other) return null;
19
+ return {
20
+ hookSpecificOutput: {
21
+ hookEventName: 'PreToolUse',
22
+ permissionDecision: 'deny',
23
+ permissionDecisionReason: `This session's model requests go to ${env.KENAZ_PROVIDER || 'another vendor'} (${env.ANTHROPIC_BASE_URL || 'KENAZ_PROVIDER'}), so an Agent-tool subagent would run there, not on Claude '${model}'. ` +
24
+ 'For a Claude subagent run dispatch.js (card first): node .formation/tools/dispatch.js --skill=do --task=TASK_XXX --dispatch-mode=subagent [--dispatch-model ' + model + '] ' +
25
+ '-> it prints an `executor` block; run executor.command with Bash run_in_background (claude -p on the user\'s Claude login). ' +
26
+ 'To use this session\'s model instead, call the Agent tool again without `model`.',
27
+ },
28
+ };
29
+ }
30
+
31
+ function main() {
32
+ try {
33
+ const raw = require('fs').readFileSync(0, 'utf8');
34
+ const out = decide(JSON.parse(raw || '{}'));
35
+ if (out) process.stdout.write(JSON.stringify(out));
36
+ } catch (_) { /* fail open */ }
37
+ }
38
+
39
+ if (require.main === module) main(); // hook wrappers require() it and call main() (same as memory-guard.js)
40
+ module.exports = { decide, main };
@@ -71,6 +71,15 @@
71
71
  }
72
72
  ],
73
73
  "matcher": "mcp__kenaz-dashboard__.*|Read|Edit|Write"
74
+ },
75
+ {
76
+ "matcher": "Agent|Task",
77
+ "hooks": [
78
+ {
79
+ "type": "command",
80
+ "command": "node -e \"const d=process.env.CLAUDE_PROJECT_DIR;process.chdir(d);require(d+'/.claude/hooks/vendor-agent-guard.js').main()\""
81
+ }
82
+ ]
74
83
  }
75
84
  ],
76
85
  "PostToolUse": [
@@ -92,6 +92,13 @@ async function deepseekModels(key, fetchFn = globalThis.fetch, timeoutMs = 3000)
92
92
  return Object.keys(out).length ? out : null;
93
93
  } catch { return null; }
94
94
  }
95
+ /** True in a Claude Code session whose model requests go to another vendor (kenaz launch, or the env set by
96
+ * hand): KENAZ_PROVIDER, or ANTHROPIC_BASE_URL not on anthropic.com. The Agent tool there reaches only that vendor. */
97
+ function otherVendorSession(env = process.env) {
98
+ if (env.KENAZ_PROVIDER && env.KENAZ_PROVIDER !== 'anthropic') return true;
99
+ const u = String(env.ANTHROPIC_BASE_URL || '').replace(/^https?:\/\//i, '');
100
+ return !!u && !/(^|\.)anthropic\.com(\/|:|$)/i.test(u);
101
+ }
95
102
  const DEEPSEEK_UNSET = ['ANTHROPIC_API_KEY']; // never send a real Anthropic key to another vendor
96
103
  // The claude adapter must reach Claude, not the vendor `kenaz launch` pointed this session at: drop every override
97
104
  // launch sets (the vendor key lives in ANTHROPIC_AUTH_TOKEN; DEEPSEEK_API_KEY is dropped too, the child does not need it).
@@ -168,4 +175,4 @@ async function main(argv) {
168
175
  }
169
176
 
170
177
  if (require.main === module) main(process.argv.slice(2)).then((c) => { process.exitCode = c; });
171
- module.exports = { parseExecutorModel, deepseekKey, deepseekEnv, deepseekModels, DEEPSEEK_UNSET, winQuote, buildChild, run, main, DEEPSEEK_MODELS };
178
+ module.exports = { otherVendorSession, parseExecutorModel, deepseekKey, deepseekEnv, deepseekModels, DEEPSEEK_UNSET, winQuote, buildChild, run, main, DEEPSEEK_MODELS };
@@ -178,14 +178,14 @@ test('dispatch under KENAZ_PROVIDER: Claude id -> executor adapter claude, no ag
178
178
  fs.mkdirSync(path.join(sb, '.kenaz', 'locks'), { recursive: true });
179
179
  fs.writeFileSync(path.join(sb, 'README.md'), 'x'); fs.writeFileSync(path.join(sb, '.gitignore'), '.formation/worktrees/\n.kenaz/\n');
180
180
  git(sb, ['init', '-q']); git(sb, ['add', '-A']); git(sb, ['commit', '-q', '--no-verify', '-m', 'init']);
181
- const base = { ...process.env }; delete base.CLAUDE_PROJECT_DIR; delete base.CODEX_SESSION_ID; delete base.CODEX_THREAD_ID; delete base.KENAZ_PROVIDER;
181
+ const base = { ...process.env }; delete base.CLAUDE_PROJECT_DIR; delete base.CODEX_SESSION_ID; delete base.CODEX_THREAD_ID; delete base.KENAZ_PROVIDER; delete base.ANTHROPIC_BASE_URL;
182
182
  const sh = (script, args, env) => spawnSync(process.execPath, [script, ...args], { env, encoding: 'utf8', windowsHide: true, cwd: ROOT });
183
183
  const mk = sh(TASKAPI, ['--project-path', sb, 'create', '--title', 't2430', '--description', 'd', '--scope-paths', 'zzz/a.js', '--requirements', 'r1',
184
184
  '--acceptance-criteria', 'a1', '--acceptance-criteria', 'a2', '--acceptance-criteria', 'a3', '--technical-notes', 't1', '--technical-notes', 't2', '--force'], base);
185
185
  const id = ((mk.stdout || '').match(/TASK_\d+/) || [])[0]; assert.ok(id, mk.stdout + mk.stderr);
186
- const disp = (model, provider) => {
186
+ const disp = (model, provider, extra = {}) => {
187
187
  fs.writeFileSync(path.join(sb, '.kenaz', 'dashboard-models.json'), JSON.stringify({ dispatchModel: model }));
188
- const env = { ...base, ...(provider ? { KENAZ_PROVIDER: provider } : {}), DEEPSEEK_API_KEY: KEY };
188
+ const env = { ...base, ...(provider ? { KENAZ_PROVIDER: provider } : {}), DEEPSEEK_API_KEY: KEY, ...extra };
189
189
  const r = sh(DISPATCH, ['--skill=do', `--task=${id}`, '--dispatch-mode=subagent', '--project-path', sb, '--force'], env);
190
190
  return { r, j: (() => { try { return JSON.parse(r.stdout); } catch { return null; } })() };
191
191
  };
@@ -202,6 +202,11 @@ test('dispatch under KENAZ_PROVIDER: Claude id -> executor adapter claude, no ag
202
202
  const none = disp('claude-sonnet-5-5', null); // control: no KENAZ_PROVIDER = byte-for-byte as before
203
203
  assert.equal(none.j.executor, undefined);
204
204
  assert.deepEqual(Object.keys(none.j.agentParams), ['description', 'model']); assert.equal(none.j.agentParams.model, 'sonnet');
205
+ // a session launched before KENAZ_PROVIDER existed, or with the env set by hand, is recognised by its base URL
206
+ const byUrl = disp('claude-opus-5', null, { ANTHROPIC_BASE_URL: 'https://api.deepseek.com/anthropic' });
207
+ assert.equal(byUrl.j.executor.adapter, 'claude'); assert.equal(byUrl.j.agentParams, undefined);
208
+ const official = disp('claude-opus-5', null, { ANTHROPIC_BASE_URL: 'https://api.anthropic.com' }); // control
209
+ assert.equal(official.j.executor, undefined); assert.equal(official.j.agentParams.model, 'opus');
205
210
  });
206
211
 
207
212
  test('dispatch: executor block for codex:/deepseek:, byte-for-byte agentParams for a Claude id', (t) => {
@@ -210,7 +215,7 @@ test('dispatch: executor block for codex:/deepseek:, byte-for-byte agentParams f
210
215
  fs.mkdirSync(path.join(sb, '.kenaz', 'locks'), { recursive: true });
211
216
  fs.writeFileSync(path.join(sb, 'README.md'), 'x'); fs.writeFileSync(path.join(sb, '.gitignore'), '.formation/worktrees/\n.kenaz/\n');
212
217
  git(sb, ['init', '-q']); git(sb, ['add', '-A']); git(sb, ['commit', '-q', '--no-verify', '-m', 'init']);
213
- const env = { ...process.env, DEEPSEEK_API_KEY: KEY }; delete env.CLAUDE_PROJECT_DIR; delete env.CODEX_SESSION_ID; delete env.CODEX_THREAD_ID;
218
+ const env = { ...process.env, DEEPSEEK_API_KEY: KEY }; delete env.ANTHROPIC_BASE_URL; delete env.KENAZ_PROVIDER; delete env.CLAUDE_PROJECT_DIR; delete env.CODEX_SESSION_ID; delete env.CODEX_THREAD_ID;
214
219
  const sh = (script, args) => spawnSync(process.execPath, [script, ...args], { env, encoding: 'utf8', windowsHide: true, cwd: ROOT });
215
220
  const mk = sh(TASKAPI, ['--project-path', sb, 'create', '--title', 't2422', '--description', 'd', '--scope-paths', 'zzz/a.js', '--requirements', 'r1',
216
221
  '--acceptance-criteria', 'a1', '--acceptance-criteria', 'a2', '--acceptance-criteria', 'a3', '--technical-notes', 't1', '--technical-notes', 't2', '--force']);
@@ -1065,7 +1065,9 @@ async function getSubagentDispatchParams(options) {
1065
1065
  }
1066
1066
  // TASK_2430: in a `kenaz launch` session the Agent tool only reaches the other vendor, so a Claude model
1067
1067
  // id runs as a `claude -p` executor on the user's own Claude login instead.
1068
- if (!isCodex && !exec && process.env.KENAZ_PROVIDER && process.env.KENAZ_PROVIDER !== 'anthropic') {
1068
+ // A session started before KENAZ_PROVIDER existed, or with the env set by hand, is recognised by its base URL.
1069
+ const otherVendor = require('../bifrost/exec').otherVendorSession(process.env);
1070
+ if (!isCodex && !exec && otherVendor) {
1069
1071
  const fam = translateModelForAgentTool(rawModel).model;
1070
1072
  if (fam) exec = { adapter: 'claude', id: fam };
1071
1073
  }
@@ -70,6 +70,11 @@ the real defect BEFORE carding or dispatching.
70
70
  opus). dispatch.js moves the card to active.
71
71
  - The dispatch model is the project's setting: `kenaz subagent` (or /kenaz subagent) shows it per rigor, `kenaz subagent set <id> [--rigor r]`
72
72
  changes it (writes .kenaz/dashboard-models.json). Your own model is the user's session model (/model).
73
+ - When the user names a model in conversation, act on it yourself (user decision 2026-10-12), never on your own
74
+ judgment (2026-09-22): for one card ("use opus for this", "let deepseek do the frontend") pass
75
+ `--dispatch-model <id>` to dispatch.js (claude-opus-5-5, opus, codex:<id>, deepseek:<model>) and leave the setting
76
+ alone; for "from now on / always" run `kenaz subagent set <id> [--rigor r]` (core repo:
77
+ `node .formation/tools/dispatch-model.js set <id> [--rigor r]`) and say what changed. No model named = the setting.
73
78
  - Executor model (`kenaz subagent set codex:<id>` or `deepseek:<model>`): dispatch.js prints an `executor` block instead of
74
79
  agentParams. Run `executor.command` with Bash run_in_background, wait for the completion notice, read `executor.resultFile`
75
80
  (ok, exitCode, lastMessage, commits; `no commits` = failure), then verify and merge `executor.branchName` as usual.
@@ -1 +1 @@
1
- 0.3.16
1
+ 0.3.17
@@ -14,6 +14,7 @@ ARGUMENTS 含 `[專案: X]` 或 `--project-path X` → PROJECT_PATH = X,下方
14
14
  ## 工作方式
15
15
  - **自己做**:約 30 行內的小修正 → 直接改,跑最近的測試,提交。
16
16
  - **開卡派工**(中型、可平行、高風險):`kenaz_task_create` 開卡(requirements、acceptance criteria、scope paths)→ `node "${CLAUDE_PLUGIN_ROOT}/hooks/core-resolve.js" .formation/tools/dispatch.js --skill=do --task=TASK_XXX --dispatch-mode=subagent` → `promptText` 給 subagent、`agentParams` 照用(不換模型);輸出是 `executor` 區塊時照 RULES.md 的 Dispatch 執行。subagent 在 worktree commit,你驗證後合併。
17
+ - 用戶指定 model 就照做:單張卡加 `--dispatch-model <id>`(不改設定);「之後都用」才 `kenaz subagent set <id> [--rigor r]`。沒指定就照設定,不自己換。
17
18
  - 開卡前確認 scope 與驗收條件對準真正的問題。
18
19
 
19
20
  ## 驗證(合併前,強度跟風險相稱)
@@ -1,28 +1,152 @@
1
1
  {
2
2
  "hooks": {
3
- "SessionStart": [{ "hooks": [
4
- { "type": "command", "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/kenaz-hook.js\" session-start" },
5
- { "type": "command", "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/kenaz-hook.js\" guidance" }
6
- ] }],
7
- "UserPromptSubmit": [{ "hooks": [{ "type": "command", "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/kenaz-hook.js\" prompt-runner" }] }],
3
+ "SessionStart": [
4
+ {
5
+ "hooks": [
6
+ {
7
+ "type": "command",
8
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/kenaz-hook.js\" session-start"
9
+ },
10
+ {
11
+ "type": "command",
12
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/kenaz-hook.js\" guidance"
13
+ }
14
+ ]
15
+ }
16
+ ],
17
+ "UserPromptSubmit": [
18
+ {
19
+ "hooks": [
20
+ {
21
+ "type": "command",
22
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/kenaz-hook.js\" prompt-runner"
23
+ }
24
+ ]
25
+ }
26
+ ],
8
27
  "PreToolUse": [
9
- { "hooks": [{ "type": "command", "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/kenaz-hook.js\" flow-post" }] },
10
- { "matcher": "Bash", "hooks": [{ "type": "command", "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/kenaz-hook.js\" synapse-first" }] },
11
- { "matcher": "mcp__kenaz-dashboard__.*|Read|Edit|Write", "hooks": [{ "type": "command", "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/kenaz-hook.js\" memory-guard" }] }
28
+ {
29
+ "hooks": [
30
+ {
31
+ "type": "command",
32
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/kenaz-hook.js\" flow-post"
33
+ }
34
+ ]
35
+ },
36
+ {
37
+ "matcher": "Bash",
38
+ "hooks": [
39
+ {
40
+ "type": "command",
41
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/kenaz-hook.js\" synapse-first"
42
+ }
43
+ ]
44
+ },
45
+ {
46
+ "matcher": "mcp__kenaz-dashboard__.*|Read|Edit|Write",
47
+ "hooks": [
48
+ {
49
+ "type": "command",
50
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/kenaz-hook.js\" memory-guard"
51
+ }
52
+ ]
53
+ },
54
+ {
55
+ "matcher": "Agent|Task",
56
+ "hooks": [
57
+ {
58
+ "type": "command",
59
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/kenaz-hook.js\" vendor-agent-guard"
60
+ }
61
+ ]
62
+ }
12
63
  ],
13
64
  "PostToolUse": [
14
- { "hooks": [{ "type": "command", "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/kenaz-hook.js\" flow-post" }] },
15
- { "matcher": "TaskCreate|TaskUpdate", "hooks": [{ "type": "command", "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/kenaz-hook.js\" task-bridge" }] }
16
- ],
17
- "PostToolUseFailure": [{ "hooks": [{ "type": "command", "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/kenaz-hook.js\" flow-post" }] }],
18
- "Notification": [{ "hooks": [{ "type": "command", "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/kenaz-hook.js\" flow-post" }] }],
19
- "SubagentStart": [{ "hooks": [{ "type": "command", "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/kenaz-hook.js\" flow-post" }] }],
20
- "SubagentStop": [{ "hooks": [{ "type": "command", "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/kenaz-hook.js\" flow-post" }] }],
21
- "SessionEnd": [{ "hooks": [{ "type": "command", "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/kenaz-hook.js\" flow-post" }] }],
22
- "Stop": [{ "hooks": [
23
- { "type": "command", "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/kenaz-hook.js\" flow-post" },
24
- { "type": "command", "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/kenaz-hook.js\" session-stop" },
25
- { "type": "command", "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/kenaz-hook.js\" autonomy-stop" }
26
- ] }]
65
+ {
66
+ "hooks": [
67
+ {
68
+ "type": "command",
69
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/kenaz-hook.js\" flow-post"
70
+ }
71
+ ]
72
+ },
73
+ {
74
+ "matcher": "TaskCreate|TaskUpdate",
75
+ "hooks": [
76
+ {
77
+ "type": "command",
78
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/kenaz-hook.js\" task-bridge"
79
+ }
80
+ ]
81
+ }
82
+ ],
83
+ "PostToolUseFailure": [
84
+ {
85
+ "hooks": [
86
+ {
87
+ "type": "command",
88
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/kenaz-hook.js\" flow-post"
89
+ }
90
+ ]
91
+ }
92
+ ],
93
+ "Notification": [
94
+ {
95
+ "hooks": [
96
+ {
97
+ "type": "command",
98
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/kenaz-hook.js\" flow-post"
99
+ }
100
+ ]
101
+ }
102
+ ],
103
+ "SubagentStart": [
104
+ {
105
+ "hooks": [
106
+ {
107
+ "type": "command",
108
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/kenaz-hook.js\" flow-post"
109
+ }
110
+ ]
111
+ }
112
+ ],
113
+ "SubagentStop": [
114
+ {
115
+ "hooks": [
116
+ {
117
+ "type": "command",
118
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/kenaz-hook.js\" flow-post"
119
+ }
120
+ ]
121
+ }
122
+ ],
123
+ "SessionEnd": [
124
+ {
125
+ "hooks": [
126
+ {
127
+ "type": "command",
128
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/kenaz-hook.js\" flow-post"
129
+ }
130
+ ]
131
+ }
132
+ ],
133
+ "Stop": [
134
+ {
135
+ "hooks": [
136
+ {
137
+ "type": "command",
138
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/kenaz-hook.js\" flow-post"
139
+ },
140
+ {
141
+ "type": "command",
142
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/kenaz-hook.js\" session-stop"
143
+ },
144
+ {
145
+ "type": "command",
146
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/kenaz-hook.js\" autonomy-stop"
147
+ }
148
+ ]
149
+ }
150
+ ]
27
151
  }
28
152
  }
@@ -31,6 +31,7 @@ const HOOKS = {
31
31
  'autonomy-stop': { kind: 'script', file: 'autonomy-stop.js', call: 'main', minMode: 'full' },
32
32
  'synapse-first': { kind: 'script', file: 'synapse-first-investigation.js', minMode: 'full' },
33
33
  'memory-guard': { kind: 'script', file: 'memory-guard.js', call: 'main', minMode: 'full' },
34
+ 'vendor-agent-guard': { kind: 'script', file: 'vendor-agent-guard.js', call: 'main', minMode: 'assist' },
34
35
  'task-bridge': { kind: 'script', file: 'task-bridge.js', minMode: 'assist' },
35
36
  };
36
37
 
package/lib/cli.js CHANGED
@@ -35,8 +35,9 @@ function installer() {
35
35
 
36
36
  /** A core module from the installed core, else this checkout; null when neither is there. */
37
37
  function coreModule(p, ...rel) {
38
- // installed core, then the core bundled in this npm package (npx before `kenaz install`), then the repo checkout
39
- for (const f of [path.join(p.core, ...rel), path.join(PKG_ROOT, 'core', ...rel), path.join(__dirname, '..', '..', '..', ...rel)]) {
38
+ // installed core, then the repo checkout (dev: live source), then the core bundled in this npm package (npx
39
+ // before `kenaz install`). Bundled before repo ran a stale prepack copy from a dev checkout (2026-10-12).
40
+ for (const f of [path.join(p.core, ...rel), path.join(__dirname, '..', '..', '..', ...rel), path.join(PKG_ROOT, 'core', ...rel)]) {
40
41
  if (fs.existsSync(f)) return require(f);
41
42
  }
42
43
  return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kenaz",
3
- "version": "0.3.16",
3
+ "version": "0.3.17",
4
4
  "description": "Install Kenaz (plugin, hooks, kenaz-server) for Claude Code and Codex: npx kenaz install",
5
5
  "bin": {
6
6
  "kenaz": "bin/kenaz.js"
@@ -20,11 +20,11 @@
20
20
  "test": "node --test lib/cli.test.js"
21
21
  },
22
22
  "optionalDependencies": {
23
- "@kenazai/server-darwin-arm64": "0.3.16",
24
- "@kenazai/server-darwin-x64": "0.3.16",
25
- "@kenazai/server-linux-arm64": "0.3.16",
26
- "@kenazai/server-linux-x64": "0.3.16",
27
- "@kenazai/server-win32-x64": "0.3.16"
23
+ "@kenazai/server-darwin-arm64": "0.3.17",
24
+ "@kenazai/server-darwin-x64": "0.3.17",
25
+ "@kenazai/server-linux-arm64": "0.3.17",
26
+ "@kenazai/server-linux-x64": "0.3.17",
27
+ "@kenazai/server-win32-x64": "0.3.17"
28
28
  },
29
29
  "license": "UNLICENSED",
30
30
  "repository": {