run-bridge
Run Bridge — Autonomous Excellence Loop
/plugin install loa-freesidedetails
Run Bridge — Autonomous Excellence Loop
Overview
The Run Bridge skill orchestrates an iterative improvement loop:
- Execute sprint plan via
/run sprint-plan - Invoke Bridgebuilder review on the resulting changes
- Parse findings into structured JSON
- Generate a new sprint plan from findings
- Repeat until findings "flatline" (kaironic termination)
Each iteration leaves a GitHub trail (PR comments, vision links) and captures speculative insights in the Vision Registry. On completion, Grounded Truth is regenerated and RTFM validation runs as a final gate.
Workflow
Phase 0: Input Guardrails
Check danger level (high) — requires explicit opt-in:
run_bridge.enabled: truein.loa.config.yaml- Not on a protected branch
Phase 1: Argument Parsing
| Argument | Flag | Default |
|---|---|---|
| depth | --depth N | 3 (max 5) |
| per_sprint | --per-sprint | false |
| resume | --resume | false |
| from | --from PHASE | — |
Phase 2: Orchestrator Invocation
Invoke bridge-orchestrator.sh with translated flags:
.claude/scripts/bridge-orchestrator.sh \
--depth "$depth" \
${per_sprint:+--per-sprint} \
${resume:+--resume} \
${from:+--from "$from"}
The orchestrator manages the state machine:
PREFLIGHT → JACK_IN → ITERATING ↔ ITERATING → FINALIZING → JACKED_OUT
↓ ↓
HALTED HALTED
Phase 3: Iteration Loop
For each iteration, the orchestrator emits SIGNAL lines that this skill interprets and acts on:
| Signal | Action |
|---|---|
GENERATE_SPRINT_FROM_FINDINGS | Create sprint plan from parsed findings |
RUN_SPRINT_PLAN | Execute /run sprint-plan |
RUN_PER_SPRINT | Execute per-sprint mode |
PIPELINE_SELF_REVIEW | Detect .claude/ changes → run Red Team against pipeline SDDs (gated by run_bridge.pipeline_self_review.enabled) |
RED_TEAM_CODE | Run red-team-code-vs-design.sh against SDD sections for implemented code (gated by red_team.code_vs_design.enabled) |
BRIDGEBUILDER_REVIEW | Invoke Bridgebuilder on changes |
VISION_CAPTURE | Check findings for VISION/SPECULATION severity → invoke bridge-vision-capture.sh (gated by vision_registry.bridge_auto_capture) |
GITHUB_TRAIL | Run bridge-github-trail.sh |
FLATLINE_CHECK | Evaluate flatline condition |
LORE_DISCOVERY | Run lore-discover.sh → call vision_check_lore_elevation() for visions with refs > 0 (v1.42.0) |
PIPELINE_SELF_REVIEW (cycle-046)
Before the Bridgebuilder review, the pipeline can review changes to itself:
- Gate check:
run_bridge.pipeline_self_review.enabled: truein config - Detection:
pipeline-self-review.sh --base-branch main --output-dir <output>- Runs
git diff --name-only main...HEAD -- .claude/scripts/ .claude/skills/ .claude/data/ .claude/protocols/ - If no pipeline files changed → skip silently
- Runs
- SDD Resolution: Maps changed files to governing SDDs via
.claude/data/pipeline-sdd-map.json - Self-Review: Invokes
red-team-code-vs-design.shagainst each resolved SDD - Output: Findings posted as PR comment with
[Pipeline Self-Review]prefix
This addresses the "pipeline bugs have multiplicative impact" insight — the review infrastructure should examine itself with the same rigor it examines application code.
Red Team Gate Placement (cycle-047)
The Red Team code-vs-design gate (red-team-code-vs-design.sh) runs before the
Bridgebuilder review, after code has been implemented. This placement is deliberate:
RUN_SPRINT_PLAN → PIPELINE_SELF_REVIEW → RED_TEAM_CODE → BRIDGEBUILDER_REVIEW → FLATLINE_CHECK
Why before Bridgebuilder, not after:
- Red Team checks code-vs-SDD compliance (did the code match the design?)
- Bridgebuilder reviews quality and architecture (is the design evolving well?)
- Compliance findings should be fixed before the Bridgebuilder sees the code, otherwise the Bridgebuilder wastes attention on compliance drift that will be fixed
Why after implementation, not before:
- Red Team needs actual code diff to compare against the SDD
- Pre-implementation Red Team is the
/red-teamskill (design-phase, attacks-only) - Post-implementation Red Team is
red-team-code-vs-design.sh(compliance check)
Relationship to reviewer/auditor in /run:
/runcycle: implement →/review-sprint→/audit-sprint(per-sprint quality gates)- Bridge cycle: sprint-plan → Red Team → Bridgebuilder (cross-iteration quality gates)
- These are complementary —
/rungates check sprint-level quality, bridge gates check iteration-level architectural drift
Configuration:
# .loa.config.yaml
red_team:
enabled: true
code_vs_design:
enabled: true # Enable Red Team code-vs-design in bridge iterations
VISION_CAPTURE → LORE_DISCOVERY Chain (v1.42.0)
After BRIDGEBUILDER_REVIEW completes and findings are parsed:
-
VISION_CAPTURE (conditional):
- Only fires when
vision_registry.bridge_auto_capture: truein.loa.config.yaml - Filters parsed findings for VISION or SPECULATION severity
- Invokes
bridge-vision-capture.shwith findings JSON path - Creates vision entries in
grimoires/loa/visions/entries/ - Updates
grimoires/loa/visions/index.md
- Only fires when
-
LORE_DISCOVERY (always after VISION_CAPTURE):
- Invokes
lore-discover.shto extract patterns from bridge reviews - Sources
vision-lib.shand callsvision_check_lore_elevation()for each vision withrefs > 0 - If elevation threshold met, calls
vision_generate_lore_entry()andvision_append_lore_entry() - Logs elevation events to trajectory JSONL
- Invokes
Data flow: bridge finding JSON → vision entry → index update → lore elevation check
Phase 3.1: Enriched Bridgebuilder Review
When the BRIDGEBUILDER_REVIEW signal fires, execute this 10-step workflow:
-
Persona Integrity Check: Read persona path from config (
yq '.run_bridge.bridgebuilder.persona_path' .loa.config.yaml, default:.claude/data/bridgebuilder-persona.md). Comparesha256sum <persona_path>against the base-branch version (git show origin/main:<persona_path> | sha256sum). If hashes differ, log WARNING and fall back to the base-branch version. If base-branch version doesn't exist (first deployment), proceed with local copy. -
Persona Content Validation: Verify all 5 required sections exist and are non-empty:
# Bridgebuilder## Identity## Voice## Review Output Format## Content PolicyIf any section is missing or empty, log WARNING and disable persona enrichment for this iteration (fall back to unadorned review).
-
Lore Load: Query lore index for relevant entries from both discovered patterns AND elevated visions (closing the autopoietic loop):
categories=$(yq '.run_bridge.lore.categories[]' .loa.config.yaml 2>/dev/null) # Load from both patterns.yaml (discovered patterns) and visions.yaml (elevated visions)Load
shortfields inline in the review prompt. Usecontextfor teaching moments. The visions.yaml source ensures that insights which accumulated enough references through the vision registry feed back into future bridge reviews. -
Embody Persona: Include the persona file content in the review prompt as the agent's identity and voice instructions. The persona defines HOW to review, not WHAT to review.
-
Dual-Stream Review: The review agent produces two streams:
- Findings stream: Structured JSON inside
<!-- bridge-findings-start/end -->markers. Includes enriched fields (faang_parallel,metaphor,teachable_moment,connection) and PRAISE findings when warranted. - Insights stream: Rich prose surrounding the findings block — opening context, architectural meditations, FAANG parallels, closing reflections.
- Findings stream: Structured JSON inside
-
Save Full Review: Write complete review (both streams) to
.run/bridge-reviews/{bridge_id}-iter{N}-full.mdwith 0600 permissions. -
Size Enforcement (SDD 3.5.1):
- Body ≤ 65KB: post as-is
- Body > 65KB: truncate prose, preserve findings JSON block
- Body > 256KB: extract findings-only fallback
-
Content Redaction (SDD 3.5.2, Flatline SKP-006): Apply
redact_security_content()with gitleaks-inspired patterns (AWS AKIA, GitHub ghp_/gho_/ghs_/ghr_, JWT eyJ, generic secrets). Allowlist protects sha256 hashes in markers and base64 diagram URLs. -
Post-Redaction Safety Check (Flatline SKP-006): Scan redacted output for known secret prefixes (
ghp_,gho_,AKIA,eyJ). If any remain, block posting and log error with line reference. The full review is still available in.run/. -
Parse + Post: Parse findings via
bridge-findings-parser.sh(JSON path with legacy fallback), then post viabridge-github-trail.sh comment.
Phase 4: Finalization
After loop termination (flatline or max depth):
- Ground Truth Update: Run
ground-truth-gen.sh --mode checksums - RTFM Gate: Test GT index.md, README.md, new protocol docs
- All PASS → continue
- FAILURE → generate 1 fix sprint, re-test (max 1 retry)
- Second FAILURE → log warning, continue
- Final PR Update: Update PR body with complete bridge summary
Phase 5: Progress Reporting
Report final metrics from .run/bridge-state.json:
- Total iterations completed
- Total sprints executed
- Total files changed
- Total findings addressed
- Total visions captured
- Flatline status
Configuration
run_bridge:
enabled: true
defaults:
depth: 3
per_sprint: false
flatline_threshold: 0.05
consecutive_flatline: 2
timeouts:
per_iteration_hours: 4
total_hours: 24
github_trail:
post_comments: true
update_pr_body: true
ground_truth:
enabled: true
vision_registry:
enabled: true
auto_capture: true
rtfm:
enabled: true
max_fix_iterations: 1
lore:
enabled: true
categories:
- mibera
- neuromancer
Error Handling
| Error | Cause | Resolution |
|---|---|---|
| "run_bridge.enabled is not true" | Config not set | Set run_bridge.enabled: true |
| "Cannot run bridge on protected branch" | On main/master | Switch to feature branch |
| "Sprint plan not found" | Missing sprint.md | Run /sprint-plan first |
| "Per-iteration timeout exceeded" | Single iteration too slow | Reduce sprint scope |
| "Total timeout exceeded" | Overall time limit hit | Resume with /run-bridge --resume |
Constraints
- C-BRIDGE-001: ALWAYS use
/run sprint-planwithin bridge iterations - C-BRIDGE-002: ALWAYS post Bridgebuilder review as PR comment
- C-BRIDGE-003: ALWAYS ensure GT claims cite file:line references
- C-BRIDGE-004: ALWAYS use YAML format for lore entries
- C-BRIDGE-005: ALWAYS include source bridge iteration and PR in vision entries
technical
- github
- 0xHoneyJar/loa-freeside
- stars
- 7
- license
- NOASSERTION
- contributors
- 6
- last commit
- 2026-04-30T00:44:24Z
- file
- .claude/skills/run-bridge/SKILL.md