Commit graph

15 commits

Author SHA1 Message Date
Eric Garcia
f5d3621495 feat: RFC 0052 blue install command - implemented
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>
2026-02-01 19:02:37 -05:00
Eric Garcia
174eb40da9 feat: RFC 0049 synchronous guard command - implemented
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>
2026-02-01 18:27:45 -05:00
Eric Garcia
607b5ce07c fix: add session-heartbeat and session-end CLI commands for hooks
- Add top-level `session-heartbeat` command (silent, touches session file)
- Add top-level `session-end` command (silent, removes session file)
- Add `Heartbeat` variant to SessionCommands enum
- Required by global Claude Code hooks in ~/.claude/settings.json

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 10:03:31 -05:00
Eric Garcia
6ff8ba706c feat: RFC 0038 SDLC workflow discipline implementation
- Add `blue guard` CLI command for PreToolUse hook integration
  - Allowlist patterns for .blue/docs/, .claude/, /tmp/, root *.md
  - Worktree detection and RFC branch validation
  - Audit logging for bypass tracking
- Add PreToolUse hook in .claude/settings.json
- Add produces_rfcs field to Spike struct for multi-RFC tracking
- Implement spike auto-close when RFC transitions to implemented
- Add ADR suggestions when RFC transitions to in-progress
- Add LocalRealmDependencies for .blue/realm.toml parsing
- Add blue_rfc_validate_realm tool for cross-repo RFC validation
- Add toml dependency for realm.toml parsing

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 08:59:20 -05:00
Eric Garcia
0fea499957 feat: lifecycle suffixes for all document states + resolve all clippy warnings
Every document filename now mirrors its lifecycle state with a status
suffix (e.g., .draft.md, .wip.md, .accepted.md). No more bare .md for
tracked document types. Also renamed all from_str methods to parse to
avoid FromStr trait confusion, introduced StagingDeploymentParams struct,
and fixed all 19 clippy warnings across the codebase.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 12:19:46 -05:00
Eric Garcia
c9acd1a4ad feat: implement RFC 0020 MCP project detection (all phases)
Separate mcp_root from cwd so tool-arg overrides don't clobber the
session-level root from initialize. Fallback chain matches RFC spec:
cwd → mcp_root → walk tree → fail with guidance. Error messages now
include attempted paths and actionable fix suggestions. Added --debug
flag to MCP server for file-based DEBUG logging.

Phase 2 finding: Claude Code v2.1.19 declares roots capability but
sends no roots array. Walk-up is the primary detection path.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 21:47:24 -05:00
Eric Garcia
87e0066c36 chore: apply clippy fixes and fix invalid YAML test
- Replace redundant closures with function references
- Use next_back() instead of last() for DoubleEndedIterator
- Fix test_parse_index_response_invalid to use actually invalid YAML
  (previous test string was valid YAML - a plain string with braces)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 18:35:54 -05:00
Eric Garcia
83fb0202a6 feat: implement dynamic context activation (RFC 0016 + 0017)
RFC 0016: Context Injection Architecture
- Add blue:// URI scheme for document addressing
- Add manifest.rs for three-tier context configuration
- Implement MCP resources/list and resources/read handlers
- Add `blue context` CLI command for visibility
- Add context_injections audit table (schema v5)

RFC 0017: Dynamic Context Activation (Phase 1)
- Add relevance_edges table for explicit links (schema v6)
- Implement composite session ID: {repo}-{realm}-{random12}
- Add content-hash based staleness detection
- Add tiered refresh policies (SessionStart/OnChange/OnRequest/Never)
- Add rate limiting with 30s cooldown
- Add blue_context_status MCP tool

Drafted from 12-expert alignment dialogue achieving 95% convergence.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 17:21:05 -05:00
Eric Garcia
bfd2a01ede fix: remove stop sequence that truncated indexer LLM output
The stop_sequences contained "```" which caused the model to stop
immediately after outputting "```yaml", truncating the entire response.
Also wrap blocking indexer operations in spawn_blocking to avoid
runtime conflicts with reqwest::blocking::Client.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 19:25:51 -05:00
Eric Garcia
d77ea4ba3f feat: add Ollama integration for semantic file indexing
Implements the AI-powered indexing component of RFC 0010:
- Add indexer module with LlmProvider abstraction
- Integrate qwen2.5:3b via Ollama for local file analysis
- Extract summaries, relationships, and symbols from source files
- Support partial indexing for files >1000 lines
- Wire indexer to all CLI index commands (--all, --diff, --file, --refresh)

The indexer generates structured YAML output with:
- One-sentence file summaries
- Relationship descriptions for semantic search
- Symbol-level indexing with line numbers

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 18:51:48 -05:00
Eric Garcia
cf0baa0ea0 feat: implement RFC 0010 semantic index core infrastructure
Adds the foundation for AI-maintained semantic file indexing:

Schema (v4 migration):
- file_index table with summary, relationships, prompt_version
- symbol_index table with name, kind, line numbers, description
- FTS5 virtual tables for full-text search

CLI commands (blue index):
- --all: Bootstrap full index
- --diff: Index staged files (for pre-commit hook)
- --file: Single file indexing
- --refresh: Re-index stale entries
- --install-hook: Install git pre-commit hook
- status: Show index freshness

MCP tools:
- blue_index_status: Get index stats
- blue_index_search: FTS5 search across files/symbols
- blue_index_impact: Analyze change blast radius
- blue_index_file: Store AI-generated index data
- blue_index_realm: List all indexed files

Remaining work: Ollama integration for actual AI indexing.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 18:44:44 -05:00
Eric Garcia
1be95dd4a1 feat: implement RFC 0008 (status file sync) and RFC 0009 (audit documents)
RFC 0008: Status updates now sync to markdown files, not just DB
RFC 0009: Add Audit as first-class document type, rename blue_audit to
blue_health_check to avoid naming collision

Also includes:
- Update RFC 0005 with Ollama auto-detection and bundled Goose support
- Mark RFCs 0001-0006 as Implemented
- Add spikes documenting investigations

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 17:56:20 -05:00
Eric Garcia
1f9eb88137 feat(cli): Add blue agent command for Goose integration
- Add `blue agent` command that launches Goose with Blue MCP extension
- Detects Goose installation and provides install instructions if missing
- Supports --model flag and additional Goose arguments
- Uses exec() on Unix to replace process for clean signal handling

Completes RFC 0005: Local LLM Integration (15/15 tasks)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 15:47:25 -05:00
Eric Garcia
daaaea5c82 feat(realm): Implement RFC 0001 cross-repo coordination and RFC 0002 Phase 1 MCP tools
RFC 0001 - Cross-Repo Coordination with Realms:
- Daemon architecture with HTTP server on localhost:7865
- SQLite persistence for sessions, realms, notifications
- Realm service with git-based storage and caching
- CLI commands: realm status/sync/check/worktree/pr/admin
- Session coordination for multi-repo work

RFC 0002 Phase 1 - Realm MCP Integration:
- realm_status: Get realm overview (repos, domains, contracts)
- realm_check: Validate contracts/bindings with errors/warnings
- contract_get: Get contract details with bindings
- Context detection from .blue/config.yaml
- 98% expert panel alignment via 12-expert dialogue

Also includes:
- CLI documentation in docs/cli/
- Spike for Forgejo tunnelless access
- 86 tests passing

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 07:14:35 -05:00
Eric Garcia
940701d191 feat: Add Rust workspace and MCP server skeleton
- Rename from 💙 to blue for filesystem compatibility
- Add blue-core crate with documents and voice modules
- Add blue-mcp crate with JSON-RPC server skeleton
- Add blue-cli with subcommands (init, status, rfc, etc.)
- Add CLAUDE.md and .gitignore
- Add RFC 0001: Efficient Document Format

Phase 1 foundation complete. Ready for porting coherence-mcp functionality.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 16:51:04 -05:00