ADRs: - Update 0008-honor, 0009-courage, 0013-overflow, 0015-plausibility - Add 0017-hosted-coding-assistant-architecture RFCs: - 0032: per-repo AWS profile configuration (draft) - 0033: round-scoped dialogue files (impl + plan) - 0034: comprehensive config architecture (accepted) - 0036: expert output discipline (impl) - 0037: single source protocol authority (draft) - 0038: SDLC workflow discipline (draft) - 0039: ADR architecture greenfield clarifications (impl) - 0040: divorce financial analysis (draft) - 0042: alignment dialogue defensive publication (draft) Spikes: - Read tool token limit on assembled dialogues - RFC ID collision root cause - Expert agent output too long - Judge writes expert outputs - Blue MCP server on superviber infrastructure - Playwright MCP multiple window isolation Dialogues: 16 alignment dialogue records Code: - blue-core: forge module enhancements - blue-mcp: env handlers and server updates - alignment-expert agent improvements - alignment-play skill refinements - install.sh script Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
14 KiB
RFC 0038: SDLC Workflow Discipline
| Status | Draft |
| Date | 2026-01-27 |
| Source Spike | 2026-01-26T1500Z-formalize-sdlc-workflow-and-release-process |
| Source Dialogue | 2026-01-27T0058Z-sdlc-workflow-discipline-rfc |
| ADRs | 0009 (Courage), 0011 (Freedom Through Constraint) |
Summary
Enforce SDLC workflow discipline through mechanical gates rather than documented aspirations. PreToolUse hooks block code edits outside worktrees, spike auto-close fires when source RFCs ship, and ADR suggestions surface at implementation boundaries. Deploy all gates simultaneously — they target different workflow moments and don't compound friction.
Problem
Four workflow gaps persist despite existing tooling:
- Work outside worktrees:
blue_worktree_createexists but enforcement is soft (warning only). Code gets committed directly todevelop. - Missing PRs:
blue_pr_createexists but nothing requires its use. Work merges without review. - Stale spikes: Spikes that produce RFCs stay
.wip.mdforever. No backlink from "RFC implemented" to "close source spike." - Absent ADRs:
blue_adr_relevantprovides AI-powered semantic matching but is never invoked during any workflow step. Architectural decisions go undocumented.
Root Cause (Dialogue Consensus — 6/6)
Worktree isolation is the root problem. Missing PRs, stale spikes, and absent ADRs are symptoms. Documented process lives in markdown while actual process lives in tool defaults. Soft warnings get ignored. Mechanical enforcement is required.
Goals
- Code changes require active worktrees — mechanically enforced, not aspirational
- Spikes auto-close when their source RFCs reach
implemented - ADR suggestions surface at the right moment without blocking workflow
- PRs become natural consequences of worktree discipline, not separate gates
- Connected RFCs across multiple repos can be tracked and coordinated
Non-Goals
- Release process formalization (separate RFC per existing spike Phase 2)
- Doc-writer agent formalization (separate RFC per spike Phase 3)
- CI/CD pipeline integration
- Branch protection rules at forge level
- Auto-transition of RFC status across repo boundaries (notification only)
Proposal
1. PreToolUse Hooks for Worktree Enforcement
A PreToolUse hook intercepts Write, Edit, and Bash (file-writing commands) before execution. The hook calls the compiled blue guard command to verify:
- Is the target file inside a Blue worktree?
- Does the worktree correspond to an RFC in
acceptedorin-progressstatus? - Is the file within the worktree's directory tree?
If any check fails and the file is NOT on the allowlist, the hook blocks the tool call.
{
"hooks": {
"PreToolUse": [
{
"matcher": "Write|Edit",
"hooks": [
{
"type": "command",
"command": "blue guard --tool=$TOOL_NAME --path=$INPUT_FILE_PATH"
}
]
}
]
}
}
Allowlist (No Worktree Required)
| Path Pattern | Rationale |
|---|---|
.blue/docs/** |
Spikes, RFCs, ADRs, dialogues are pre-implementation |
.claude/** |
Agent definitions are configuration |
*.md (repo root) |
README, CHANGELOG, CONTRIBUTING |
/tmp/blue-dialogue/** |
Dialogue agent output files |
.gitignore |
Repository configuration |
Everything else — crates/**, src/**, tests/**, Cargo.toml, Cargo.lock — requires an active worktree.
Emergency Bypass
Set BLUE_BYPASS_WORKTREE=1 for legitimate exceptions (hotfixes, cross-branch investigations). All bypasses are logged to an audit trail file at .blue/audit/guard-bypass.log with timestamp, file path, and reason.
2. Spike Auto-Close on RFC Implementation
Schema Changes
RFC frontmatter gains optional field:
| **Source Spike** | 2026-01-26T1500Z-formalize-sdlc-workflow |
Spike frontmatter gains optional field:
| **Produces RFCs** | 0038 |
For multi-RFC spikes:
| **Produces RFCs** | 0038, 0039, 0040 |
Mechanism
When blue_rfc_update_status transitions an RFC to implemented:
- Parse
Source Spikefrom RFC frontmatter - If present, locate the spike file
- If spike has
Produces RFCslisting multiple RFCs, check if ALL have reachedimplementedorrejected - If all resolved: rename spike from
.wip.mdto.done.md, append resolution note with RFC IDs and date - If not all resolved: emit conversational hint noting partial completion
Manual .done.md transition remains available for scope-changed investigations.
3. ADR Suggestion at Implementation Boundary
When blue_rfc_update_status transitions an RFC to in-progress (the implementation boundary):
- Call
blue_adr_relevantwith the RFC title and problem statement as context - If relevant ADRs found with confidence > 0.7, emit conversational hint:
"This RFC may relate to ADRs: 0009 (Courage), 0011 (Freedom Through Constraint). Consider citing them or documenting new architectural decisions." - If RFC title contains keywords
breaking,redesign,architectural,migration: additionally hint "This appears to be an architectural decision — consider creating an ADR."
This is a suggestion only. It does not block any workflow step. Per RFC 0004: "Guide, don't block."
4. PRs as Isolation Boundaries
Worktree enforcement makes branch-based development mandatory. PRs become the natural merge path:
blue_worktree_createcreates a feature branch fromdevelop- Code changes happen in the worktree (enforced by PreToolUse hooks)
- When work is complete,
blue_pr_createcreates a PR from the feature branch todevelop - PR serves as isolation verification — confirming work was done in the correct context
- Zero-reviewer merges are acceptable for AI-only development (PRs verify isolation, not code review)
- All PRs squash-merge to
develop(no override)
5. Agent Incentive Alignment
PreToolUse hooks make blue_worktree_create the ONLY path to code modification. AI agents optimize for task completion; when task completion becomes impossible without a worktree, the agent optimizes FOR worktree creation. This mechanically aligns agent behavior with process compliance without requiring the agent to "understand" or "remember" the rules.
This embodies ADR 0011 (Freedom Through Constraint): the constraint of worktree-only editing enables the freedom of reliable, isolated, reviewable changes.
6. Deployment Strategy: All-at-Once
Deploy all four mechanisms simultaneously. Rationale (4-2 dialogue supermajority):
- PreToolUse hooks operate at write-time
- Spike auto-close operates at status-change time
- ADR suggestions operate at implementation-boundary time
- PRs operate at merge-time
These are orthogonal workflow moments. Simultaneous deployment distributes friction across independent decision points rather than compounding it. A single behavioral boundary event creates stronger habit formation than gradual tightening.
The comprehensive allowlist ensures documentation workflows remain frictionless while code workflows gain mechanical discipline.
7. Realm Coordination for Cross-Repo RFCs
When architectural changes span multiple repositories (a "realm"), connected RFCs need tracking and coordination. The design follows a federated storage + runtime discovery model (5-1 dialogue supermajority).
Metadata Format
Each repo has .blue/realm.toml declaring its outbound dependencies:
# Realm membership (optional, for discovery)
[realm]
name = "blue-ecosystem"
# This repo's outbound RFC dependencies
[rfc.0038]
depends_on = ["blue-web:0015", "blue-cli:0008"]
[rfc.0040]
depends_on = ["blue-web:0018"]
RFC frontmatter gains optional field:
| **Realm Dependencies** | blue-web:0015, blue-cli:0008 |
Qualified RFC Identifiers
Cross-repo references use the format repo:rfc-number:
blue:0038— RFC 0038 in thebluerepositoryblue-web:0015— RFC 0015 in theblue-webrepository
This extends the spike Produces RFCs field:
| **Produces RFCs** | blue:0038, blue-web:0015, blue-cli:0008 |
Validation Tool
blue_rfc_validate_realm [--strict]:
- Reads local
.blue/realm.toml - For each dependency, fetches status from target repo:
- Git clone to
/tmp/blue-realm-cache/<repo>/(cached, refreshed on query) - Or GitHub API for lighter queries
- Git clone to
- Reports status matrix of all connected RFCs
- Default: warn on unresolved dependencies (consuming repo accepts risk)
--strictor configstrict_realm_validation = true: fail on unresolved
Cross-Repo Spike Auto-Close
When spike Produces RFCs contains qualified identifiers spanning repos:
- Parse all qualified RFC IDs from spike frontmatter
- For each remote repo, query RFC status via cached clone or API
- Auto-close (
.wip.md→.done.md) only when ALL listed RFCs reachimplementedorrejected - If partial: emit hint noting which remote RFCs are pending
Governance Model
Initiating repo authority (5-1 dialogue supermajority):
- The repo that initiates a cross-repo dependency owns that declaration
- Each repo declares its own
depends_onentries — no centralized registry - No repo can block another repo's workflow
- Notification only, not auto-transition: when an RFC transitions, connected repos are notified but not forced to change
This follows the Kubernetes/Terraform pattern: components declare dependencies, tooling validates at runtime, deployments don't block each other.
Implementation Plan
Phase 1: Single-Repo Workflow Discipline
- Add
blue guardcommand to compiled binary with worktree detection, RFC status validation, path-in-worktree verification, and allowlist - Install PreToolUse hook in
.claude/settings.json(project level) and~/.claude/settings.json(user level for cross-repo) - Add
Source Spikefield to RFC template andProduces RFCsfield to spike template - Extend
blue_rfc_update_statushandler: onimplementedtransition, check for linked spike and auto-close - Extend
blue_rfc_update_statushandler: onin-progresstransition, callblue_adr_relevantand emit hint - Remove
squashparameter fromblue_pr_merge— always squash for feature PRs - Add audit trail logging for
BLUE_BYPASS_WORKTREEusage - Update MCP server instructions to describe new enforcement behavior
Phase 2: Realm Coordination
- Define
.blue/realm.tomlschema and parser - Add
Realm Dependenciesfield to RFC frontmatter schema - Extend spike
Produces RFCsto support qualified identifiers (repo:rfc-number) - Implement
blue_rfc_validate_realmtool with repo caching and GitHub API fallback - Extend spike auto-close to poll cross-repo RFC statuses
- Add
strict_realm_validationconfig option for fail-on-unresolved mode - Emit cross-repo status hints during RFC transitions
Alternatives Considered
A. Phased Rollout (Worktree-First)
Implement only worktree enforcement in Phase 1, measure friction for 2 weeks, then add spike/ADR automation. Rejected (4-2 supermajority): gates target different workflow moments, so simultaneous deployment is safe. Partial enforcement trains agents to game gaps.
B. Documentation-Only Approach
Add stronger language to MCP instructions about workflow discipline. Rejected (6/6 unanimous): "documented process lives in markdown while actual process lives in tool defaults" (Brioche). Soft guidance has proven insufficient.
C. Spike-First Investigation
Conduct a spike measuring which interventions change agent behavior before committing to an RFC. Rejected (5/6): the root cause (lack of mechanical enforcement) and the mechanism (PreToolUse hooks) are both well-understood from the existing formalize-sdlc spike.
Test Plan
Single-Repo Tests
blue guardblocks Write tocrates/without active worktreeblue guardallows Write to.blue/docs/spikes/without worktreeblue guardallows Write withBLUE_BYPASS_WORKTREE=1and logs bypassblue guardallows Write inside active worktree directory- Allowlist covers all documented paths (
.blue/docs/**,*.mdroot,/tmp/blue-dialogue/**,.claude/**) - RFC with
Source Spikemetadata auto-closes spike onimplementedtransition - Multi-RFC spike stays
.wip.mduntil all listed RFCs reachimplemented - Manual spike
.done.mdtransition still works - ADR hint emits on RFC transition to
in-progress - ADR hint includes keyword detection for "breaking", "redesign", "architectural"
- ADR hint does NOT block workflow
blue_pr_mergealways squashes (no override parameter)- Audit trail file records bypass events with timestamp and path
Realm Coordination Tests
.blue/realm.tomlparsesdepends_onarrays with qualified identifiersblue_rfc_validate_realmresolves local RFC statuses correctlyblue_rfc_validate_realmfetches remote repo status via cached cloneblue_rfc_validate_realmwarns on unresolved dependencies (default mode)blue_rfc_validate_realm --strictfails on unresolved dependencies- Spike with cross-repo
Produces RFCsstays.wip.mduntil all reachimplemented - Spike with cross-repo
Produces RFCsauto-closes when all reachimplemented - Cross-repo status hint emits during RFC transitions with realm dependencies
strict_realm_validation = truein config enables fail mode without CLI flag- Repo cache at
/tmp/blue-realm-cache/<repo>/refreshes on query
"The constraint of worktree-only editing enables the freedom of reliable, isolated, reviewable changes."
— Converged from 6-expert alignment dialogue (395 ALIGNMENT, 14/14 tensions resolved, 4 rounds)