Skip to content
Development
Command

/phase-1-context

<!-- SPDX-FileCopyrightText: Copyright (c) RapierCraft Studios --> <!-- SPDX-License-Identifier: AGPL-3.0-or-later -->

BOOST
From plugin
forgedock
11980 skills80 commands
Install
> /plugin marketplace add RapierCraftStudios/ForgeDock
> /plugin install forgedock@forgedock

How it fires

How this command gets triggered: by you, by Claude, or both.

  • Fires itselfClaude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/phase-1-context

Context preview

What this command does when you run it.

<!-- SPDX-FileCopyrightText: Copyright (c) RapierCraft Studios --> <!-- SPDX-License-Identifier: AGPL-3.0-or-later -->

Command definition

phase-1-context.md
user-invocable: false
install: extras

<!-- SPDX-FileCopyrightText: Copyright (c) RapierCraft Studios --> <!-- SPDX-License-Identifier: AGPL-3.0-or-later -->

/pipeline-health — Phase 1: Identify Context

Phase 1: Identify Context

1A: Resolve the target project

# Default to current repo if no argument
if [ -z "$ARGUMENTS" ] || [ "$ARGUMENTS" = "all" ]; then
    REPO=$(gh repo view --json nameWithOwner --jq '.nameWithOwner' 2>/dev/null)
else
    REPO="$ARGUMENTS"
fi
echo "Target project: $REPO"

1B: Get the analysis window

# Last pipeline-health run (if any) — from Forge git log
LAST_RUN=$(cd "$FORGE_HOME" && git log --all --oneline --grep="pipeline-health: $REPO" --format="%aI" -1 2>/dev/null || echo "")
if [ -z "$LAST_RUN" ]; then
    # First run — analyze last 30 days
    SINCE=$(date -d "30 days ago" +%Y-%m-%dT%H:%M:%SZ 2>/dev/null || date -v-30d +%Y-%m-%dT%H:%M:%SZ)
    echo "First health check — analyzing last 30 days"
else
    SINCE="$LAST_RUN"
    echo "Last health check: $LAST_RUN — analyzing since then"
fi

**Decomposition trackers** <!-- Added: forge#3736 -->: issues labelled `workflow:decomposed` are trackers (open, or closed at decomposition when `decomposition.close_parent` is true), not work. Phase 2 excludes `workflow:decomposed` from every open-work and issue-flow count and reports them separately as `trackers (N)`.

1C: Load Prior Health Report

Fetch the most recent `health-report` issue for the same repo and parse its metrics for trend computation. This must run before Phase 2 so that PRIOR_* variables are available when Phase 3A builds the trend column.

# Find the most recent health-report issue for this repo
PRIOR_REPORT=$(gh issue list -R $FORGE_REPO \
  --state all --label "health-report" --limit 10 \
  --json number,title,body \
  --jq "[.[] | select(.title | contains(\"$REPO\"))] | sort_by(.number) | last")

if [ -z "$PRIOR_REPORT" ] || [ "$PRIOR_REPORT" = "null" ]; then
    echo "No prior health report found for $REPO — this is a baseline run. All trends will show '—'."
    PRIOR_HEALTH_SCORE=""
    PRIOR_BUILD_PASS_RATE=""
    PRIOR_FINDINGS_PER_PR=""
    PRIOR_FALSE_POSITIVE_RATE=""
    PRIOR_FIXUP_RATE=""
    PRIOR_SELF_CORRECTION_RATE=""
    PRIOR_ORIGINAL_WORK_RATIO=""
    PRIOR_MILESTONE_MERGE_RATE=""
    PRIOR_POST_DEPLOY_FAILURE_RATE=""
    PRIOR_REVIEW_ESCAPE_RATE=""
    PRIOR_SEC=0; PRIOR_AUTH=0; PRIOR_BILL=0; PRIOR_DB=0; PRIOR_FE=0
    PRIOR_INFRA=0; PRIOR_API=0; PRIOR_CONC=0; PRIOR_SCRP=0; PRIOR_ISSUE_SPEC=0
    PRIOR_TRANSCRIPT_SCORE=""
    PRIOR_SESSION_COUNT=""
    PRIOR_COMPACTION_MEDIAN=""
else
    PRIOR_BODY=$(echo "$PRIOR_REPORT" | jq -r '.body')
    PRIOR_NUMBER=$(echo "$PRIOR_REPORT" | jq -r '.number')
    echo "Prior health report: #$PRIOR_NUMBER — parsing metrics for trend computation"

    # Parse health score: matches "**Health Score**: 78/100" or "Score: 78/100"
    PRIOR_HEALTH_SCORE=$(echo "$PRIOR_BODY" | grep -oP '(?<=\*\*Health Score\*\*: )\d+(?=/100)' | head -1)
    [ -z "$PRIOR_HEALTH_SCORE" ] && PRIOR_HEALTH_SCORE=$(echo "$PRIOR_BODY" | grep -oP '(?<=Score: )\d+(?=/100)' | head -1)

    # Parse metric table rows — format: "| Metric name | VALUE | target | status |"
    # Build pass rate
    PRIOR_BUILD_PASS_RATE=$(echo "$PRIOR_BODY" | grep -i "Build pass rate" | grep -oP '\d+(?=%)' | head -1)
    # Review findings per PR
    PRIOR_FINDINGS_PER_PR=$(echo "$PRIOR_BODY" | grep -i "Review findings per PR" | grep -oP '[0-9]+\.?[0-9]*' | sed -n '2p')
    # False positive rate
    PRIOR_FALSE_POSITIVE_RATE=$(echo "$PRIOR_BODY" | grep -i "False positive rate" | grep -oP '\d+(?=%)' | head -1)
    # Manual fix-up rate
    PRIOR_FIXUP_RATE=$(echo "$PRIOR_BODY" | grep -i "Manual fix-up rate" | grep -oP '\d+(?=%)' | head -1)
    # Pipeline self-correction rate
    PRIOR_SELF_CORRECTION_RATE=$(echo "$PRIOR_BODY" | grep -i "self-correction rate" | grep -oP '\d+(?=%)' | head -1)
    # Original work ratio
    PRIOR_ORIGINAL_WORK_RATIO=$(echo "$PRIOR_BODY" | grep -i "Original work ratio" | grep -oP '\d+(?=%)' | head -1)
    # Milestone merge success
    PRIOR_MILESTONE_MERGE_RATE=$(echo "$PRIOR_BODY" | grep -i "Milestone merge success" | grep -oP '\d+(?=%)' | head -1)
    # Post-deploy failure rate
    PRIOR_POST_DEPLOY_FAILURE_RATE=$(echo "$PRIOR_BODY" | grep -i "Post-deploy failure rate" | grep -oP '\d+(?=%)' | head -1)
    # Review escape rate
    PRIOR_REVIEW_ESCAPE_RATE=$(echo "$PRIOR_BODY" | grep -i "Review escape rate" | grep -oP '\d+(?=%)' | head -1)
    # Transcript health score (from Phase 3C — supplementary signal)
    PRIOR_TRANSCRIPT_SCORE=$(echo "$PRIOR_BODY" | grep -i "Transcript health score" | grep -oP '\d+(?=/100)' | head -1)
    # Pipeline sessions in window (from Transcript Flow Metrics section)
    PRIOR_SESSION_COUNT=$(echo "$PRIOR_BODY" | grep -i "Pipeline sessions parsed" | grep -oP '^\d+' | head -1)
    # Compaction events median (from Aggregated Session Metrics table)
    PRIOR_COMPACTION_MEDIAN=$(echo "$PRIOR_BODY" | grep -i "Context compaction events" | grep -oP '[0-9]+\.?[0-9]*' | head -1)

    # Parse defect category counts from the "Defect Category Breakdown" section
    # Matches table rows like "| SEC | 4 | 22% | ↑ +1 |" or "| SEC | 4 | 22% | — |"
    _parse_cat() {
        echo "$PRIOR_BODY" | grep -P "^\| $1 \|" | grep -oP '(?<=\| )\d+(?= \|)' | head -1
    }
    PRIOR_SEC=$(   _parse_cat "SEC");     [ -z "$PRIOR_SEC" ]        && PRIOR_SEC=0
    PRIOR_AUTH=$(  _parse_cat "AUTH");    [ -z "$PRIOR_AUTH" ]       && PRIOR_AUTH=0
    PRIOR_BILL=$(  _parse_cat "BILL");    [ -z "$PRIOR_BILL" ]       && PRIOR_BILL=0
    PRIOR_DB=$(    _parse_cat "DB");      [ -z "$PRIOR_DB" ]         && PRIOR_DB=0
    PRIOR_FE=$(    _parse_cat "FE");      [ -z "$PRIOR_FE" ]         && PRIOR_FE=0
    PRIOR_INFRA=$( _parse_cat "INFRA");   [ -z "$PRIOR_INFRA" ]      && PRIOR_INFRA=0
    PRIOR_API=$(   _parse_cat "API");     [ -z "$PRIOR_API" ]        && PRIOR_API=0
    PRIOR_CONC=$
Read more
Ships withforgedock

ForgeDock — autonomous AI dev pipeline for Claude Code. GitHub as agent memory: issue in, PR out.

Get the whole plugin

Other commands on forgedock.