model-pin-gate
PreToolUse guard: unpinned Fable-seat spawns and sub-apex Fable targets block. Triggers: model pin, Fable seat, spawn.
- License 许可
- Apache-2.0
- 所属仓库
- EtanHey/golems
- 最近更新
- 2026-11-15
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- model-pin-gate
- description
- PreToolUse guard: unpinned Fable-seat spawns and sub-apex Fable targets block. Triggers: model pin, Fable seat, spawn.
- disable-model-invocation
- true
02 资源文件 33
- 参考文档evals/fixtures/green/01-agent-sonnet-pinned-fable-seat.json393 B
- 参考文档evals/fixtures/green/02-agent-opus-pinned-fable-seat.json374 B
- 参考文档evals/fixtures/green/03-apex-fable-cmux-seat-spawn.json483 B
- 参考文档evals/fixtures/green/04-non-spawn-tool.json330 B
- 参考文档evals/fixtures/green/05-malformed-payload.json186 B
- 参考文档evals/fixtures/green/06-undetectable-seat-fails-open.json214 B
- 参考文档evals/fixtures/green/07-latency-realistic-spawn.json714 B
- 参考文档evals/fixtures/green/08-workflow-per-call-model-pins.json625 B
- 参考文档evals/fixtures/green/09-workflow-computed-model-key.json458 B
- 参考文档evals/fixtures/green/10-workflow-escaped-quoted-model-key.json468 B
- 参考文档evals/fixtures/green/11-workflow-comment-not-parsed-as-regex.json466 B
- 参考文档evals/fixtures/green/12-workflow-line-continuation-in-quoted-key.json477 B
- 参考文档evals/fixtures/green/13-apex-orcclaude-cmux-seat-spawn.json529 B
- 参考文档evals/fixtures/green/13-workflow-computed-key-with-trivia.json628 B
- 参考文档evals/fixtures/red/01-unpinned-agent-fable-seat.json392 B
- 参考文档evals/fixtures/red/02-explicit-fable-non-apex.json439 B
- 参考文档evals/fixtures/red/03-cmux-spawn-fable-non-apex.json571 B
- 参考文档evals/fixtures/red/04-cmux-new-split-fable-non-apex.json538 B
- 参考文档evals/fixtures/red/05-apex-fable-subagent-after-reset.json516 B
- 参考文档evals/fixtures/red/06-apex-fable-subagent-amnesty.json519 B
- 参考文档evals/fixtures/red/07-fable-in-workflow-amnesty.json554 B
- 参考文档evals/fixtures/red/08-fable-in-workflow-after-reset.json554 B
- 参考文档evals/fixtures/red/09-workflow-unpinned-after-reset.json502 B
- 参考文档evals/fixtures/red/10-workflow-unrelated-model-property.json516 B
- 参考文档evals/fixtures/red/11-workflow-comment-before-agent-paren.json499 B
- 参考文档evals/fixtures/red/12-workflow-model-pin-in-nested-call.json513 B
- 参考文档evals/fixtures/red/13-workflow-regex-literal-swallows-call.json510 B
- 脚本evals/model-pin-gate.test.mjs19.0 KB
- 脚本evals/run_suite.py7.7 KB
- 参考文档install-snippet.json477 B
- 脚本lib/transcript.mjs2.4 KB
- 脚本scripts/model-pin-gate-hook.mjs4.4 KB
- 脚本src/model-pin-gate.mjs23.0 KB
03 SKILL.md 正文
Skill: Model-Pin Gate
Every non-Cursor spawn pins its model explicitly (canon #5); a non-default model such as Fable is used only by explicit per-invocation selection, never inherited. Routing: see
/agent-routing§ Routing rules (SSOT).
What It Is
model-pin-gate is a Claude Code PreToolUse hook for Task|Agent|Workflow
and, with the prepared settings matcher, cmux spawn_agent, dispatch_to_agent,
and repoGolem-style new_split launches.
It reads the current session's recent assistant model from transcript_path with
a bounded tail read. It also honors explicit apex-seat identifiers
(orchestrator, orc, skillcreatorLead) when a caller deliberately targets
Fable.
The hook enforces Etan's fleet model policy:
| Spawn surface | Verdict |
|---|---|
Agent or Task without tool_input.model |
BLOCK: MODELPIN_AGENT_UNPINNED |
Agent, Task, or Workflow explicitly targeting Fable from a non-apex seat |
BLOCK: MODELPIN_FABLE_BELOW_APEX |
cmux spawn_agent, dispatch_to_agent, or new_split targeting Fable from a non-apex seat |
BLOCK: MODELPIN_CMUX_FABLE_TARGET |
explicit Fable target from orchestrator, orc, or skillcreatorLead |
PASS |
explicit non-Fable model (opus, sonnet, haiku, or another explicit non-Fable model) |
PASS |
Workflow script with agent( calls and fewer model: pins than agent( calls |
ADVISORY: MODELPIN_WORKFLOW_AGENT_MODEL_ADVISORY |
Workflow script with unpinned agent( calls, after WEEKLY_RESET_AT (2026-09-06T02:05Z = ~05:05 IDT, Etan 8A) |
FLAG: MODELPIN_WORKFLOW_AGENT_UNPINNED |
Workflow script pins Fable, apex seat, before WEEKLY_RESET_AT |
ADVISORY: MODELPIN_FABLE_IN_WORKFLOW (Etan 2026-09-05 amnesty) |
Workflow script pins Fable, any seat, after WEEKLY_RESET_AT |
FLAG: MODELPIN_FABLE_IN_WORKFLOW (07-18 law) |
Agent/Task pins Fable from an apex seat, before / after WEEKLY_RESET_AT |
ADVISORY / FLAG: MODELPIN_FABLE_SUBAGENT |
Agent/Task/Workflow targets Fable from a non-apex seat (any date) |
FLAG: MODELPIN_FABLE_BELOW_APEX |
Workflow script with enough model: pins |
PASS |
| unrelated tools, malformed payloads, missing/undetectable seat model | PASS fail-open |
The Workflow path is intentionally heuristic and advisory-only. It counts
agent( occurrences versus model: occurrences and does not attempt full
JavaScript parsing inside a 500ms hook.
Hook Contract
Input is the Claude Code PreToolUse stdin payload:
{
"hook_event_name": "PreToolUse",
"transcript_path": "/path/to/transcript.jsonl",
"tool_name": "Agent",
"seat_id": "skillcreatorWorker",
"tool_input": { "model": "opus", "prompt": "..." }
}
Output schema:
- allow:
{} - block:
{"decision":"block","reason":"..."} - advisory:
{"systemMessage":"..."}
The hook is local-only: no network, no BrainLayer, no subprocesses, bounded stdin/transcript reads, and fail-open on malformed input or internal errors. Caught failures emit a visible advisory that the check could not run; the action is still allowed and exception details are omitted.
install-snippet.json pins the absolute Node path:
$HOME/.nvm/versions/node/v22.22.0/bin/node.
Run It
bun test skills/golem-powers/model-pin-gate/evals/model-pin-gate.test.mjs
python3 skills/golem-powers/model-pin-gate/evals/run_suite.py
Programmatic: import { detectModelPin } from "./src/model-pin-gate.mjs" →
detectModelPin(payload) returns { verdict, seatModel, tool, violations, advisories }.
Stated Limits
- Unpinned inheritance detection depends on a recent assistant
modelfield in the transcript. If the model is absent or unreadable and no explicit Fable target is present, the gate allows the call. - Explicit Fable targets are allowed only when the payload carries an apex seat identifier. Unknown seat identifiers are treated as non-apex for explicit Fable targets.
- Workflow checks are advisory-only by design. They are a cheap reminder to pin
each
agent()call and avoid brittle parsing in a hot hook path.
04 同仓库更多 Skills
yash
Push dependency bugs upstream. Triggers: dependency bug, workaround, monkey-patch, fork/fix. NOT app bugs.
whats-new
Diff Claude/Codex/Cursor/Wispr/agy changelogs vs local setup. Triggers: whats new, changelog, version bump.
weave
Orchestrator convergence: mine JSONLs, cite findings, route actions. Triggers: weave, run weave.
unslop
Cut AI tells while keeping every receipt, number, path, and hedge intact. Triggers: unslop, cut the slop, wall of text, too verbose, rambly, make this readable. NOT for delivery cadence (see i-have-adhd), channel choice, or artifact length governance.
tmp-block
Guard denying durable writes to /tmp, /private/tmp, /var/folders, $TMPDIR; enforces <repo>/.worktrees/<name>. Triggers: tmp guard, TMP-BLOCK deny, WORKTREE-CONVENTION deny, bypass ledger. NOT for storage policy.
t3-visuals
Show/visualize/chart/diagram/compare/status board in T3 with compact interactive HTML. Not standalone dashboards.