Skip to content

me2resh/apexyard / .claude/skills/orbit

Run the opt-in ORBIT planning lifecycle for one managed project without replacing ApexYard governance.

FileKindSize
SKILL.mdskill md27.5 KB
lib/handoff-preflight.shexecutablescript9.2 KB
lib/record-check.shexecutablescript3.5 KB
lib/records-lint.shexecutablescript14.5 KB
lib/refresh-slice-record.shexecutablescript3.4 KB
lib/resolve-project-repo.shexecutablescript2.1 KB
lib/slice-pr-lint.shscript10.6 KB
lib/status-live.shexecutablescript3.4 KB
lib/warn-criterion-shape.shexecutablescript3.3 KB
lib/warn-uncovered-outcomes.shexecutablescript8.2 KB
tests/_lib-fixtures.shexecutablescript8.0 KB
tests/_lib-slice-fixtures.shscript1.8 KB
tests/smoke.shexecutablescript1.3 KB
tests/test_criterion_shape.shexecutablescript3.5 KB
tests/test_handoff_allows_duplicate_prefix_match.shexecutablescript1.9 KB
tests/test_handoff_preflight_happy_path.shexecutablescript1.9 KB
tests/test_handoff_refusal_cli_absent.shexecutablescript1.6 KB
tests/test_handoff_refusal_duplicate_search_fails.shexecutablescript1.5 KB
tests/test_handoff_refusal_duplicate_search_truncated.shexecutablescript2.1 KB
tests/test_handoff_refusal_duplicate_slice.shexecutablescript1.8 KB
tests/test_handoff_refusal_leak_scrub.shexecutablescript4.8 KB
tests/test_handoff_refusal_missing_option_value.shexecutablescript2.4 KB
tests/test_handoff_refusal_slice_id_double_quote.shexecutablescript2.9 KB
tests/test_handoff_refusal_slice_id_newline.shexecutablescript2.8 KB
tests/test_handoff_refusal_validate_fails.shexecutablescript1.4 KB
tests/test_record_check_blank_line.shexecutablescript4.1 KB
tests/test_record_check_change_only.shexecutablescript3.7 KB
tests/test_records_lint_changed_fields.shexecutablescript4.8 KB
tests/test_records_lint_faults.shexecutablescript6.1 KB
tests/test_records_lint_slice_evidence.shscript1.2 KB
tests/test_records_lint_slice_merge_base_drift.shexecutablescript7.2 KB
tests/test_records_lint_slice_provenance.shscript532 B
tests/test_records_lint_slice_scope.shscript1.8 KB
tests/test_records_lint_slice_warn.shscript324 B
tests/test_records_lint_upstream_skip.shscript3.0 KB
tests/test_refresh_slice_record.shscript3.4 KB
tests/test_resolve_project_repo_registry.shexecutablescript4.2 KB
tests/test_slice_pr_proposal.shscript2.9 KB
tests/test_slice_ticket_workflow.shscript1.4 KB
tests/test_status_live_squash_commit.shscript858 B
tests/test_status_live_writes_nothing.shexecutablescript1.9 KB
tests/test_uncovered_outcomes.shscript11.0 KB

lib/slice-pr-lint.sh

View on GitHub
#!/usr/bin/env bash
# Variables come from the caller or fixture functions.
# shellcheck disable=SC2154,SC2034

# Accept recorded merge-base R when it equals M, or when R is an ancestor of M
# and of HEAD and no status-dependent record changed between R and M (AgDR-0258).
# Globals: root, slice_id. Uses fail().
slice_pr_merge_base_ok() {
  local recorded="$1" current="$2" plan_id="$3" file="$4"
  local rc=0 rev path id body changed list changed_list
  local -a dep_paths=()
  if [ "$recorded" = "$current" ]; then
    return 0
  fi
  git -C "$root" rev-parse --verify --end-of-options "${recorded}^{commit}" >/dev/null 2>&1 ||
    fail 19 provenance "$file" "Cannot resolve the recorded merge-base."
  git -C "$root" rev-parse --verify --end-of-options "${current}^{commit}" >/dev/null 2>&1 ||
    fail 19 provenance "$file" "Cannot resolve the current merge-base."
  git -C "$root" merge-base --is-ancestor "$recorded" "$current"
  rc=$?
  if [ "$rc" -eq 1 ]; then
    fail 19 provenance "$file" "The merge-base SHA does not match."
  elif [ "$rc" -ne 0 ]; then
    fail 19 provenance "$file" "Cannot check merge-base ancestry."
  fi
  git -C "$root" merge-base --is-ancestor "$recorded" HEAD
  rc=$?
  if [ "$rc" -eq 1 ]; then
    fail 19 provenance "$file" "The merge-base SHA does not match."
  elif [ "$rc" -ne 0 ]; then
    fail 19 provenance "$file" "Cannot check merge-base ancestry."
  fi
  dep_paths+=("docs/orbit/plans/${plan_id}.notes.md")
  for rev in "$recorded" "$current"; do
    list=$(git -C "$root" ls-tree -r --name-only "$rev" -- \
      docs/orbit/plans/ docs/orbit/slices/ docs/orbit/reconciliations/) ||
      fail 19 provenance "$file" "Cannot list plan records for the merge-base check."
    while IFS= read -r path; do
      [ -n "$path" ] || continue
      case "$path" in
        docs/orbit/plans/*.json)
          body=$(git -C "$root" show "$rev:$path" 2>/dev/null) ||
            fail 19 provenance "$file" "Cannot read plan records for the merge-base check."
          id=$(printf '%s' "$body" | jq -r '.id // empty') ||
            fail 19 provenance "$file" "Cannot read plan records for the merge-base check."
          [ "$id" = "$plan_id" ] || continue
          dep_paths+=("$path")
          ;;
        docs/orbit/slices/*.json)
          body=$(git -C "$root" show "$rev:$path" 2>/dev/null) ||
            fail 19 provenance "$file" "Cannot read slice records for the merge-base check."
          id=$(printf '%s' "$body" | jq -r '.id // empty') ||
            fail 19 provenance "$file" "Cannot read slice records for the merge-base check."
          [ "$id" = "$slice_id" ] || continue
          dep_paths+=("$path")
          ;;
        docs/orbit/reconciliations/*.json)
          body=$(git -C "$root" show "$rev:$path" 2>/dev/null) ||
            fail 19 provenance "$file" "Cannot read Reconciliation records for the merge-base check."
          id=$(printf '%s' "$body" | jq -r '.planId // empty') ||
            fail 19 provenance "$file" "Cannot read Reconciliation records for the merge-base check."
          [ "$id" = "$plan_id" ] || continue
          dep_paths+=("$path")
          ;;
      esac
    done <<< "$list"
  done
  [ "${#dep_paths[@]}" -gt 0 ] ||
    fail 19 provenance "$file" "Cannot resolve status-dependent records for the merge-base check."
  changed=$(git -C "$root" diff --name-only --no-renames "$recorded" "$current" -- "${dep_paths[@]}") ||
    fail 19 provenance "$file" "Cannot diff status-dependent records between merge-bases."
  if [ -n "$changed" ]; then
    changed_list=$(printf '%s' "$changed" | tr '\n' ' ' | sed 's/[[:space:]]*$//')
    fail 19 provenance "$file" \
      "Plan records changed between the recorded merge-base and the current merge-base (${changed_list}). Run refresh-slice-record.sh."
  fi
  echo "records-lint: NOTE [provenance] Recorded merge-base ${recorded}; current merge-base ${current}." >&2
  return 0
}

# Check slice scope, evidence, and provenance. Write no record.
slice_pr_lint() {
  local slice="" f root mb paths records latest='{}' at best='' record plan allowed bad line number sha
  if [ -z "$slice_id" ] && [ -f "$pr_body" ]; then
    slice_id=$(sed -nE 's/^.*ORBIT slice:[*[:space:]]*`?(slice-[a-z0-9-]+).*$/\1/p' "$pr_body" | head -1)
  fi
  [ -n "$slice_id" ] || return 0
  root=$(git -C "$orbit_root" rev-parse --show-toplevel) || fail 19 provenance "" "Cannot resolve the repository."
  # Read the slice from the base branch, so a PR cannot widen its own scope.
  while IFS= read -r f; do
    case "$f" in docs/orbit/slices/*.json) ;; *) continue ;; esac
    record=$(git -C "$root" show "$base:$f" 2>/dev/null) || continue
    [ "$(printf '%s' "$record" | jq -r '.id')" != "$slice_id" ] || slice="$record"
  done < <(git -C "$root" ls-tree -r --name-only "$base" -- docs/orbit/slices/)
  [ -n "$slice" ] || fail 17 scope "" "No slice record named $slice_id on $base."
  plan=$(printf '%s' "$slice" | jq -r '.planId')
  allowed=$(printf '%s' "$slice" | jq -c '.contributesTo')
  mb=$(git -C "$root" merge-base "$base" HEAD) || fail 19 provenance "" "Cannot resolve the merge base."
  paths=$(git -C "$root" diff --name-only --no-renames "$mb") || fail 18 evidence "" "Cannot read changed paths."
  records=$( { printf '%s\n' "$paths"; git -C "$root" ls-files --others --exclude-standard; } | sort -u)
  while IFS= read -r f; do
    case "$f" in docs/orbit/reconciliations/*.json) ;; *) continue ;; esac
    record=$(git -C "$root" show "$base:$f") || fail 17 scope "$f" "Cannot read the base record."
    [ "$(printf '%s' "$record" | jq -r '.planId')" = "$plan" ] || continue
    at=$(printf '%s' "$record" | jq -r '.reconciledAt')
    if [ -z "$best" ] || [[ "$at" > "$best" ]]; then latest="$record"; best="$at"; fi
  done < <(git -C "$root" ls-tree -r --name-only "$base" -- docs/orbit/reconciliations/)
  local filtered_records=""
  while IFS= read -r f; do
    case "$f" in docs/orbit/*)
      if [ -n "${upstream:-}" ] && skip_upstream_record "$f"; then continue; fi ;;
    esac
    filtered_records+="$f"$'\n'
  done <<< "$records"
  records="$filtered_records"
  local count=0
  while IFS= read -r f; do
    case "$f" in docs/orbit/reconciliations/*.json) ;; *) continue ;; esac
    [ -f "$root/$f" ] || continue
    count=$((count + 1))
    [ "$(jq -r '.planId' "$root/$f")" = "$plan" ] || fail 17 scope "$f" "Record belongs to another plan."
    bad=$(jq -r --argjson old "$latest" --argjson allowed "$allowed" '
      (.criterionAssessments | map({key:.criterionId,value:.status}) | from_entries) as $new
      | (($old.criterionAssessments // []) | map({key:.criterionId,value:.status}) | from_entries) as $prev
      | ($new + $prev | keys[]) as $id
      | select(($allowed | index($id)) == null and $new[$id] != $prev[$id]) | $id' "$root/$f")
    [ -z "$bad" ] || fail 17 scope "$f" "Status changes outside contributesTo: $bad"
    bad=$(jq -r --argjson old "$latest" --arg paths "$paths" '
      def rank: if . == "achieved" then 2 elif . == "partially-verified" then 1 else 0 end;
      (($old.criterionAssessments // []) | map({key:.criterionId,value:.status}) | from_entries) as $prev
      | ($paths | split("\n") | map(select(length > 0 and (startswith("docs/orbit/") | not)))) as $paths
      | .criterionAssessments[] | . as $a
      | select((.status | rank) > ($prev[.criterionId] | rank))
      | select(any($a.evidence[]?; . as $e | any($paths[]; . as $p | $e | contains($p))) | not)
      | .criterionId' "$root/$f")
    [ -z "$bad" ] || fail 18 evidence "$f" "Raised status needs a changed path: $bad"
    line=$(jq -r '[.observations[]? | select(test("^Slice PR: #[0-9]+; dev merge-base [0-9a-fA-F]{40}\\.$"))] | if length == 1 then .[0] else empty end' "$root/$f")
    [ -n "$line" ] || fail 19 provenance "$f" "Add one Slice PR observation."
    number=${line#Slice PR: #}; number=${number%%;*}
    sha=${line##* }; sha=${sha%.}
    slice_pr_merge_base_ok "$sha" "$mb" "$plan" "$f"
    [ -z "$pr_number" ] || [ "$number" = "$pr_number" ] || fail 19 provenance "$f" "The PR number does not match."
  done <<< "$records"
  local proposals=() proposal own_rec="" base_slice id outcome notes withdrawn
  while IFS= read -r f; do
    case "$f" in
      docs/orbit/reconciliations/*.json) [ ! -f "$root/$f" ] || own_rec="$root/$f" ;;
      docs/orbit/slices/*.json)
        [ -f "$root/$f" ] || continue
        git -C "$root" cat-file -e "$mb:$f" 2>/dev/null || proposals+=("$f") ;;
    esac
  done <<< "$records"
  if [ -f "$pr_body" ]; then
    if grep -Fxq "No next slice: every outcome is achieved." "$pr_body"; then
      [ "${#proposals[@]}" -eq 0 ] || fail 17 next-slice "" "The PR states No next slice but adds a slice record."
    elif ! grep -Eq "^## Proposed next slice[[:space:]]*$" "$pr_body"; then
      echo "records-lint: WARN [next-slice] Add a Proposed next slice heading or the No next slice line." >&2
    fi
  fi
  [ "${#proposals[@]}" -le 1 ] || fail 17 scope "" "The PR adds more than one slice record."
  for proposal in ${proposals[@]+"${proposals[@]}"}; do
    [ "$count" -eq 1 ] || fail 17 scope "$proposal" "A proposal needs one PR Reconciliation."
    jq -e --slurpfile rec "$own_rec" '
      .planId == $rec[0].planId and .basedOn.planRevision == $rec[0].planRevision
      and .basedOn.reconciliationId == $rec[0].id' "$root/$proposal" >/dev/null ||
      fail 17 scope "$proposal" "Proposal provenance differs from the PR Reconciliation."
    if [ -z "${tickets:-}" ]; then
      echo 'records-lint: WARN [scope] No --tickets file. Skip the open slice check.' >&2
      continue
    fi
    outcome=$(jq -r '.outcomeId' "$root/$proposal")
    notes=$(cat "$root/docs/orbit/plans/$plan.notes.md" 2>/dev/null) || notes=""
    withdrawn=0
    local withdrawn_ids=()
    while IFS= read -r line; do
      case "$line" in
        '## Withdrawn slices') withdrawn=1 ;;
        '## '*) withdrawn=0 ;;
        '- Withdrawn: '*) [ "$withdrawn" -ne 1 ] || withdrawn_ids+=("${line#- Withdrawn: }") ;;
      esac
    done <<< "$notes"
    while IFS= read -r f; do
      base_slice=$(git -C "$root" show "$base:$f") || fail 17 scope "$f" "Cannot read the base slice."
      [ "$(printf '%s' "$base_slice" | jq -r '.planId')" = "$plan" ] || continue
      [ "$(printf '%s' "$base_slice" | jq -r '.outcomeId')" = "$outcome" ] || continue
      id=$(printf '%s' "$base_slice" | jq -r '.id')
      [ "$id" != "$slice_id" ] || continue
      grep -Fxq -- "$id" "$tickets" && continue
      withdrawn=0
      for line in ${withdrawn_ids[@]+"${withdrawn_ids[@]}"}; do [ "$line" != "$id" ] || withdrawn=1; done
      [ "$withdrawn" -eq 1 ] || fail 17 scope "$proposal" "Outcome $outcome has an unfiled slice: $id"
    done < <(git -C "$root" ls-tree -r --name-only "$base" -- docs/orbit/slices/)
  done
  [ "$count" -gt 0 ] || echo 'records-lint: WARN [progress] The slice PR has no Reconciliation.' >&2
  return 0
}
planning-and-task-breakdownaddyosmani/agent-skillsBreaks work into ordered tasks. Use when you have a spec or clear requirements and need to break work into implementable tasks. Use when a task feels too large to start, when you need to estimate scope, or when parallel work is possible.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
screenpipethedotmack/claude-memSearch screen and audio history recorded by Screenpipe and optionally save selected context into claude-mem. Use when the user asks to recall desktop activity, a meeting, or something seen in another app through Screenpipe.Stars: 118kUpdated Claude CodeCodexVerifiedInstall
contact-widgetnexu-io/open-designSelf-contained floating chat widget with welcome screen, social links, meeting button, and message input. Single HTML file, zero dependencies.Stars: 108kUpdated Claude CodeCodexVerifiedInstall
meeting-notesnexu-io/open-designMeeting notes page — title bar with attendees, agenda checklist, decisions block, action items table with owners + dates, and a "next meeting" footer. Use when the brief mentions "meeting notes", "minutes", "1:1 notes", "all-hands recap", or "会议纪要".Stars: 108kUpdated Claude CodeCodexVerifiedInstall