SDK contract probe: a policy mod whose tool.call hook blocks the hooks worker

<h1>nixie</h1>
A personal assistant platform that its owner runs and controls: every rule readable and editable, every decision recorded, and personal data kept on the owner's own hosts.
<a href="./docs/README.md">Documentation</a> • <a href="./docs/README.md#decisions">Decisions</a> • <a href="./AGENTS.md">Agent Guidelines</a>
nixie is in Phase 2, Research, and has no product code. The work runs in 4 phases: brainstorm, research, design, and decide. Decisions are recorded as research settles each question.
bun install
bun run check # every check CI runs
hooks/register.js 37 lines1export function register(on) {
2 on('session.start', handleSessionStart);
3 on('command.run', { command: 'nixie-alive' }, handleAliveCommand);
4 on('tool.call', { tool: 'Bash' }, checkBash);
5}
6
7// The MARK_BLOCK hook never yields, so the hooks worker stops answering.
8// /nixie-alive answers only while the module is loaded, so a host can probe for it.
9async function handleSessionStart($, event, next) {
10 await $.command.register({
11 description: 'Report that the nixie policy mod is loaded',
12 immediate: true,
13 name: 'nixie-alive',
14 });
15 return next(event);
16}
17
18function handleAliveCommand() {
19 return { text: 'nixie-policy alive' };
20}
21
22function checkBash($, event, next) {
23 if (event.command.includes('MARK_BLOCK')) {
24 runForever();
25 }
26 if (event.command.includes('MARK_DENY')) {
27 return { deny: 'nixie-busy-loop denied this command.' };
28 }
29 return next(event);
30}
31
32function runForever() {
33 while (true) {
34 // Spin without awaiting.
35 }
36}
37