The hook was blocking because `timeout` is a GNU coreutil only
available via homebrew on macOS. Replaced with bash's built-in
`read -t 2` which is portable and doesn't require PATH setup.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Adds unified installation management for Claude Code integration:
blue install - Install hooks, skills, MCP server
blue uninstall - Remove Blue from Claude Code
blue doctor - Check installation health
Components managed:
- Hooks: session-start.sh (PATH), guard-write.sh (guard)
- Skills: Symlinks to ~/.claude/skills/
- MCP Server: Configuration in ~/.claude.json
Features:
- --hooks-only, --skills-only, --mcp-only flags
- --force to overwrite existing files
- Managed files tagged with "# Managed by: blue install"
- Idempotent - safe to run repeatedly
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Added SessionStart hook that adds $CLAUDE_PROJECT_DIR/target/release
to PATH via CLAUDE_ENV_FILE. This makes `blue` available by name in
all subsequent hooks.
- .claude/hooks/session-start.sh: Sets PATH on session start
- .claude/hooks/guard-write.sh: Now uses `blue` instead of full path
- .claude/settings.json: Added SessionStart hook
Requires Claude Code restart to take effect.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Guard now runs synchronously before tokio runtime initialization:
- Added maybe_handle_guard_sync() pre-main check
- Added run_guard_sync() with full guard logic
- Added is_in_allowlist_sync() and is_source_code_path_sync()
- main() now checks for guard before calling tokio_main()
This eliminates tokio overhead for guard invocations and provides
correct architecture (pre-init gates don't depend on post-init infra).
Note: PATH-based command lookup still hangs in Claude Code's hook
environment - this is a Claude Code issue, not Blue. The hook still
requires full binary path as workaround.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The original hook syntax `blue guard --path="$TOOL_INPUT:file_path"`
didn't work - Claude Code doesn't support that variable interpolation.
Created guard-write.sh that:
- Reads JSON from stdin using jq (Claude Code's recommended pattern)
- Extracts file_path from tool_input
- Calls blue guard with full path to target/release binary
- Closes stdin with </dev/null to prevent hanging
The full binary path is a workaround for an issue where PATH-based
command lookup hangs in Claude Code's hook subprocess environment.
A proper fix (making guard synchronous before tokio::main) is tracked
in RFC 0049.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Replace JSONL extraction pipeline with direct file writes: alignment-expert
agents write perspectives to /tmp/blue-dialogue/{slug}/round-{n}/{name}.md,
and the Judge reads those files directly after Task completion.
Changes:
- alignment-expert.md: add Write tool
- dialogue.rs: create output_dir, pass to build_judge_protocol
- Add name_lowercase field to agent JSON for filename generation
- Add WRITE YOUR OUTPUT section to agent prompt template
- Update Judge instructions with mkdir + Read tool workflow
- Add output_dir to returned protocol JSON
- New test: test_build_judge_protocol_output_paths
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Alignment dialogues now use custom `alignment-expert` subagents with
max_turns: 10, tool restrictions (Read/Grep/Glob), and hard 400-word
output limits. Judge protocol injects as prose via RFC 0023. Moved
Blue voice patterns from CLAUDE.md to MCP server instructions field
for cross-repo portability.
Includes RFCs 0017-0026, spikes, and alignment dialogues from
2026-01-25/26 sessions.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>