Commit graph

66 commits

Author SHA1 Message Date
Eric Garcia
015c21d381 fix: correct dialogue round numbering and kebab-case spike filenames
- Fix "Round 0" → "Round 1" for opening arguments in alignment dialogues
- Convert spike titles to kebab-case for consistent filenames

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 07:40:24 -05:00
Eric Garcia
16d45d9a11 feat: alignment dialogue subagents, MCP instructions, and document batch
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>
2026-01-26 07:09:39 -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
ff83a2e26b feat: implement filesystem authority - slug matching, FS-aware numbering (RFC 0022)
Add slug-based document lookup so kebab-case queries ("filesystem-authority")
match titles ("Filesystem Authority") via deslugification. Implement
next_number_with_fs() that scans both DB and filesystem directory, taking
max(db, fs) + 1 to prevent numbering collisions when files exist outside
the index. Update all 7 callers across MCP handlers. Add blue.db to
.gitignore since it is a derived index. Includes 9 new tests covering
slug matching, filesystem-aware numbering, and collision regression.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 21:46:08 -05:00
Eric Garcia
1ed6f15fa9 feat: implement document sync and Claude Code task integration (RFC 0018, 0019)
RFC 0018 - Document Import/Sync:
- Add content_hash and indexed_at fields to Document
- Implement find_document_with_fallback for filesystem recovery
- Add reconcile() for database/filesystem sync
- Create blue_sync MCP tool
- Update blue_status to show index drift

RFC 0019 - Claude Code Task Integration:
- Expose .plan.md as MCP resource (blue://docs/rfcs/{n}/plan)
- Enhance blue_rfc_get with claude_code_tasks array
- Add 💙 prefix for Blue-synced tasks
- Add knowledge/task-sync.md for session injection
- Automatic sync via injected instructions

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 20:58:46 -05:00
Eric Garcia
9759f0e3db feat: implement plan file authority (RFC 0017)
Plan files (.plan.md) are now the authoritative source for RFC task
tracking, with SQLite as a derived cache rebuilt on read.

Changes:
- Add plan.rs with PlanFile parsing/generation
- Add schema v7 migration for plan_cache table
- Modify handle_rfc_plan to write .plan.md files
- Modify handle_rfc_task_complete to update .plan.md
- Implement rebuild-on-read for stale cache detection
- Add RFC header validation (table vs inline format)
- Extend blue_lint with headers check and --fix support

Also includes spike investigating Claude Code task integration.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 20:10:05 -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
1847700c09 docs: add infrastructure RFCs (0014, 0015-cert-manager)
- RFC 0014: Workflow Enforcement Parity - conversational hints over JSON
- RFC 0015: Cert-Manager with Let's Encrypt for TLS on K3s cluster

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 18:12:36 -05:00
Eric Garcia
29f139e1cd fix: remove wrong alignment orchestration architecture (RFC 0015)
RFC 0012 was implemented with Option B (MCP orchestrates via Ollama)
instead of Option A (Claude orchestrates via Task tool). This caused:
- No parallel agents spawned
- Fake Ollama responses instead of real deliberation
- Inline JSON instead of .dialogue.md files

Fix by removing blue_alignment_play tool entirely. Claude now
orchestrates alignment dialogues directly using Task tool per ADR 0014.

Also:
- Add pub mod resources for RFC 0016/0017 (was missing)
- Update lib.rs threading for spawn_blocking
- Add .blue/worktrees/ to gitignore
- Update database schema

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 17:36:16 -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
a5b142299d feat: context injection architecture via 12-expert alignment dialogue
RFC 0016 drafted from alignment dialogue achieving 95% convergence:
- Three-tier model: Identity (fixed) / Workflow (session) / Reference (on-demand)
- Manifest-driven injection via .blue/context.manifest.yaml
- URI addressing: blue://docs/, blue://context/, blue://state/
- Hooks push URIs, MCP resolves content
- Progressive visibility: blue context show

New ADRs ported from coherence-mcp:
- 0014: Alignment Dialogue Agents (renamed from 0006)
- 0015: Plausibility
- 0016: You Know Who You Are

Knowledge injection system:
- hooks/session-start for SessionStart injection
- knowledge/*.md files for global context
- Expert pools with domain-specific relevance tiers
- Updated /alignment-play skill with full scoring

Spikes completed:
- Context injection mechanisms (7 mechanisms designed)
- ADR porting inventory (17 Blue ADRs mapped)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 16:16:11 -05:00
Eric Garcia
a07737f3dc RFC 0014: Workflow Enforcement Parity (#1)
Co-authored-by: Eric Garcia <eric.garcia@gmail.com>
Co-committed-by: Eric Garcia <eric.garcia@gmail.com>
2026-01-25 19:21:42 +00:00
Eric Garcia
1afdd05ea6 feat: add install command detection to worktree creation
After creating a worktree, detect the project type and suggest
the appropriate install command:
- Node.js: bun/pnpm/yarn/npm based on lock file
- Python: uv/poetry/pip based on lock file
- Rust: cargo build
- Go: go mod download
- Generic: Makefile

Custom scripts/setup-worktree.sh takes precedence over auto-detection.

Ported from coherence-mcp.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 20:58:06 -05:00
Eric Garcia
19602c632b chore: sync state.rs and add RFC/spike documents
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 20:32:32 -05:00
Eric Garcia
d3b0ee59c2 Merge branch 'mcp-workflow-guidance' into develop
Combines RFC 0011 (MCP Workflow Guidance) with RFC 0013 (Git Forge Integration).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 20:32:06 -05:00
Eric Garcia
04f34cc27c Merge branch 'git-forge-integration' into develop 2026-01-24 20:31:25 -05:00
Eric Garcia
fae8e96108 feat: implement RFC 0012 alignment dialogue orchestration
Add blue_alignment_play MCP tool for multi-expert deliberation:
- Core alignment module with Expert, Round, ExpertResponse types
- Panel templates: Infrastructure, Product, ML, Governance, General
- Ollama integration for running expert rounds until convergence
- Dialogue markdown generation with SQLite tracking
- RFC linking support

Also removes dead code (ADR 0010: No Dead Code).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 20:14:13 -05:00
Eric Garcia
d91589346b feat: add forge config caching and handle_pr_merge forge support
Completes RFC 0013 git forge integration:
- Add BlueConfig struct for .blue/config.yaml persistence
- Add detect_forge_type_cached() and create_forge_cached() functions
  that cache detected forge type to avoid repeated API probing
- Update handle_pr_merge to use native forge API instead of gh CLI
- Add force parameter for skipping precondition checks when gh unavailable

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 20:12:37 -05:00
Eric Garcia
ae98b6f230 feat: add git forge integration for GitHub and Forgejo (RFC 0013)
- Add forge module with Forge trait for unified PR operations
- Implement GitHubForge with REST API client
- Implement ForgejoForge with REST API client (works with Gitea too)
- Add git URL parsing to extract host, owner, repo from remotes
- Add auto-detection of forge type from remote URLs
- Update blue_pr_create to use native forge API instead of gh CLI
- Support GITHUB_TOKEN and FORGEJO_TOKEN environment variables

The forge abstraction allows Blue to create PRs on both GitHub and
Forgejo/Gitea instances without requiring external CLI tools.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 20:07:44 -05:00
Eric Garcia
ea1d57e62f feat: add MCP workflow guidance for worktree creation (RFC 0011)
- Update blue_worktree_create description with workflow context
- Fix blue_next to use MCP tool syntax instead of CLI syntax
- Update generate_hint() to name tools explicitly
- Add next_action field when RFC status becomes accepted
- Add warning when RFC goes in-progress without worktree
- Update pr_create and rfc_complete descriptions with workflow context

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 19:37:33 -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
8f31288b55 docs: add RFC 0010 for realm semantic index
Spike investigation into AI-maintained semantic indexing for realms.
12-expert dialogue refined through 6 rounds to 96% alignment.

Key decisions:
- Storage: SQLite + FTS5, relationships stored at index time
- Triggers: Git pre-commit hook on diff, --all for bootstrap
- Model: Qwen2.5:3b via Ollama (speed/quality sweet spot)
- Granularity: Symbol-level with line numbers

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 18:33:02 -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
36aeb2f889 docs: add install scripts and MCP integration docs
- INSTALL.md: Installation instructions for Blue CLI
- install.sh: Automated install script
- docs/mcp/: MCP server integration documentation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 16:44:55 -05:00
Eric Garcia
8f0063683f chore: track .blue/blue.db database
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 16:44:22 -05:00
Eric Garcia
489942cd35 feat: implement RFC 0006 (soft-delete) and RFC 0007 (branch naming)
RFC 0006 - Document Deletion Tools:
- Add soft-delete with 7-day retention before permanent deletion
- Add blue_delete, blue_restore, blue_deleted_list, blue_purge_deleted tools
- Add deleted_at column to documents table (schema v3)
- Block deletion of documents with ADR dependents
- Support dry_run, force, and permanent options

RFC 0007 - Consistent Branch Naming:
- Strip RFC number prefix from branch/worktree names
- Branch format: feature-description (not rfc/NNNN-feature-description)
- PR title format: RFC NNNN: Feature Description
- Add strip_rfc_number_prefix helper with tests

Also:
- Remove orphan .blue/repos/ and .blue/data/ directories
- Fix docs path resolution bug (spike documented)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 16:42:31 -05:00
Eric Garcia
28898556cd docs: update CLAUDE.md for new .blue structure and MCP tools
- Fix ADR path to .blue/docs/adrs/
- Update project structure to show .blue/ directory
- Add MCP tools section

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 16:21:54 -05:00
Eric Garcia
0150a5d1ed chore: move adrs, rfcs, spikes to .blue/docs
Per RFC 0003, Blue-tracked documents live in per-repo .blue/ directories.
ADRs needed for semantic adherence checking.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 16:16:34 -05:00
Eric Garcia
eedae91178 chore: move dialogues to .blue/docs/dialogues
Per RFC 0003, docs should live in per-repo .blue/ directories.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 16:12:06 -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
5d3a7c0d1b feat(ollama): Add binary bundling and SHA256 verification
- Add build.rs to download Ollama at build time for target platform
- Add SHA256 verification infrastructure (currently skipped for external installs)
- Improve bundled_binary_path() to check additional standard locations
- Support BLUE_OLLAMA_PATH and BLUE_SKIP_OLLAMA_DOWNLOAD env vars

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 15:39:41 -05:00
Eric Garcia
f1612b9b0c feat(llm): Add graceful degradation fallback chain
Implements fallback: Ollama → API → Keywords

- Add KeywordLlm provider (always available, keyword-based matching)
- Add LlmManager for managing provider fallback chain
- Add blue_llm_providers tool to show chain status
- Keywords provider uses Jaccard similarity for text matching

The system now gracefully degrades when LLM providers are unavailable:
1. Try local Ollama first (best quality)
2. Fall back to API if configured (ANTHROPIC_API_KEY/OPENAI_API_KEY)
3. Fall back to keyword matching (always works, basic functionality)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 15:29:05 -05:00
Eric Garcia
59476fc72b test(ollama): Add integration tests for running Ollama
Tests require running Ollama server (run with --ignored):
- integration_health_check: Verify server is healthy
- integration_list_models: List installed models
- integration_generate: Test text generation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 15:22:43 -05:00
Eric Garcia
7dd263f1f9 feat: Implement RFCs 0002, 0004, and 0005
RFC 0002 (runbook-action-lookup):
- Add action metadata storage to runbooks
- Implement blue_runbook_lookup with word-based matching
- Add blue_runbook_actions to list all actions

RFC 0004 (adr-adherence):
- Add blue_adr_list, blue_adr_get, blue_adr_relevant, blue_adr_audit
- Implement keyword-based relevance matching with stem-like prefixes
- Add adr:N query support in blue_search

RFC 0005 (local-llm-integration):
- Create blue-ollama crate for embedded Ollama server management
- Add LlmProvider trait and MockLlm in blue-core
- Implement OllamaLlm with HTTP client for model operations
- Add MCP tools: blue_llm_start/stop/status, blue_model_pull/list/remove/warmup
- Support BLUE_OLLAMA_PATH env var for air-gapped builds

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 15:15:33 -05:00
Eric Garcia
2fdf29d56e feat(core): Implement RFC 0003 per-repo .blue/ folders
Simplify Blue's directory structure to use per-repo .blue/ folders
instead of centralized ~/.blue/repos/<project>/ structure.

Changes:
- Refactor BlueHome struct with simplified per-repo paths
- Update detect_blue() to find git root and create .blue/ there
- Add migration logic from old .blue/repos/<project>/docs/ structure
- Auto-create .blue/ on first command (no 'blue init' required)
- Update all handlers to use new flat path structure
- Handle edge case: no git repo uses current directory

Structure: repo/.blue/{docs/, worktrees/, blue.db, config.yaml}

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 11:41:17 -05:00
Eric Garcia
a021d8b699 docs: Add RFC 0004 (ADR Adherence) and RFC 0005 (Local LLM Integration)
RFC 0004: ADR Adherence
- 4 layers: Awareness, Relevance, Verification, Documentation
- AI-powered relevance matching for philosophical ADRs
- Graceful degradation: AI → keywords

RFC 0005: Local LLM Integration
- Embed Ollama for semantic tasks and agentic coding
- CUDA > MPS > CPU backend priority (runtime detection)
- Goose integration via shared Ollama instance
- Daemon model with health checks and crash recovery
- Port conflict handling, binary verification, ARM64 support

Both RFCs reached 95% confidence via 12-expert alignment process.

Includes supporting spikes:
- adr-adherence
- local-llm-integration
- agentic-cli-integration

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 11:33:10 -05:00
Eric Garcia
f33a8d8879 docs: Add 3 RFCs and 2 spikes from expert review
RFCs (95% expert-validated):
- 0001: Dialogue SQLite Metadata - index dialogues, keep content in markdown
- 0002: Runbook Action Lookup - action tags + lookup tool for runbooks
- 0003: Per-Repo Blue Folders - each repo gets its own .blue/

Spikes (completed):
- sqlite-storage-expansion - found spikes/plans already in SQLite
- per-repo-blue-folder - recommends per-repo .blue/ structure

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 11:05:49 -05:00
Eric Garcia
e3ea201d45 chore: Track .blue folder in git
- Track config, SQLite database, and docs
- Ignore transient WAL files (-shm, -wal)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 10:53:07 -05:00
Eric Garcia
41a78b4f2a feat(rfc): Write RFC files to disk on creation
- RFC handler now writes markdown to .blue/repos/<project>/docs/rfcs/
- Sets file_path in document store for tracking
- Returns file path in response
- Remove unused get_current_session function
- Rename realm tools to use blue_ prefix for consistency

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 10:51:08 -05:00
Eric Garcia
3e1fc44370 docs: Add ADR 0000 Never Give Up to beliefs list
The zeroth principle - the ground everything stands on.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 09:12:18 -05:00
Eric Garcia
8d91242147 docs(rfc): Mark RFC 0002 as implemented
All 8 MCP tools complete: realm_status, realm_check, contract_get,
session_start, session_stop, realm_worktree_create, realm_pr_status,
notifications_list.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 07:54:12 -05:00
Eric Garcia
74e3a03ba8 feat(realm): Implement RFC 0002 Phase 4 notifications
Complete RFC 0002: Realm MCP Integration with notifications support.

New MCP tool:
- notifications_list: List notifications with state filters
  (pending, seen, expired, all)

DaemonDb extensions:
- cleanup_expired_notifications: Auto-delete 7+ day old notifications
- list_notifications_with_state: Returns notifications with computed state

Schema integrity checking:
- Canonical JSON hashing (SHA-256) for schema fingerprinting
- check_schema_integrity returns hashes for all accessible contracts
- Integrated into realm_check response

Notification piggybacking:
- fetch_pending_notifications for realm_status and realm_check
- Filtered to domains the current repo participates in

RFC 0002 is now complete with all 8 tools:
- Phase 1: realm_status, realm_check, contract_get
- Phase 2: session_start, session_stop
- Phase 3: realm_worktree_create, realm_pr_status
- Phase 4: notifications_list

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 07:42:26 -05:00
Eric Garcia
ad1adcb874 feat(realm): Implement RFC 0002 Phase 3 workflow tools
Add MCP tools for coordinated multi-repo development:
- realm_worktree_create: Create worktrees for domain peers
- realm_pr_status: Show PR readiness across realm repos

realm_worktree_create features:
- Auto-selects domain peers (repos sharing domains with current repo)
- Creates worktrees under ~/.blue/worktrees/<realm>/<rfc>/<repo>/
- Supports explicit repo list override
- Creates rfc/<name> branches in each repo

realm_pr_status features:
- Shows uncommitted changes and commits ahead for each repo
- Fetches PR info via gh CLI when available
- Summarizes overall readiness for coordinated release

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 07:35:43 -05:00
Eric Garcia
aba92d6f06 feat(realm): Implement RFC 0002 Phase 2 session tools
Add MCP tools for session lifecycle management:
- session_start: Begin work session with realm context detection
- session_stop: End session with duration and activity summary

Session state stored in .blue/session file tracks:
- Session ID, realm, repo
- Active RFC being worked on
- Active domains (auto-detected from bindings)
- Contracts being modified (exports) and watched (imports)

Implementation details:
- SessionState struct with save/load/delete methods
- Automatic domain and contract detection from realm bindings
- Duration calculation on session stop
- 6 new tests for session functionality

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 07:27:15 -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
eef4a8460e docs(adr): Add ADR 0000 Never Give Up and align all ADRs
Add the zeroth principle: "The only rule we need is never giving up."
Run 12-expert alignment dialogue to 95% consensus.

Changes:
- ADR 0000: New foundational ADR with sustainable persistence framing
- ADR 0004: Cross-reference to Faith when evidence unavailable
- ADR 0012: Cross-reference to persistence as faith in time
- ADR 0013: Acknowledge scarcity pushes, link overflow to persistence
- CLAUDE.md: Update to 14 ADRs, add the arc

The Arc: Ground (0) → Welcome (1-3) → Integrity (4-7) → Commitment (8-10) → Flourishing (11-13)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 05:53:13 -05:00
Eric Garcia
b8a15c2d87 docs(rfc): Update RFC 0001 with refinement dialogue consensus
Major updates from 12-round alignment dialogue (unanimous consensus):

Architecture:
- Hybrid coordination: SQLite IPC for real-time hints + Git PRs for durable changes
- SQLite sessions.db replaces JSON file for session coordination
- SQLite cache.db for export/contract/validation caching

Commands:
- Reduced to 5 MVP commands: status, sync, worktree, pr, check
- Admin commands under `blue realm admin` subcommand
- Added `blue realm check` with modes: exporter, importer, contract, compatibility

Contracts:
- Added `owner` field (one exporter per contract)
- Added `compatibility: {backwards, forwards}` rules
- Added `validation:` hooks with ci_only option
- Semver ranges in import bindings

Trust & Governance:
- Explicit trust.permissions model
- Contract ownership enforcement
- Cycle detection and prevention

Credentials:
- Layered: env → git credential → keychain → config
- GitHub App auth support for CI

Conflict Resolution:
- Ownership + semver + git rebase strategy
- Stale bindings as soft warnings

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 05:33:55 -05:00
Eric Garcia
af9794f044 docs(dialogue): Complete 12-round refinement of RFC 0001
Full alignment dialogue with 12 experts achieving unanimous consensus.

Key refinements:
- Hybrid coordination: SQLite IPC + Git PRs (not sockets)
- Commands: 5 MVP (status, sync, worktree, pr, check) + admin
- Contracts: owner field, compatibility rules, validation hooks
- Caching: SQLite-based with proper invalidation
- CI/CD: check modes (exporter/importer/contract/compatibility)
- Credentials: layered (env → git → keychain → config)
- Trust: explicit permissions model per artifact type
- Conflicts: ownership + semver + git resolution
- Cycles: detection and prevention at domain creation
- Governance: domain-level overrides supported

All 12 experts moved to Support position.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 05:28:48 -05:00