Skip to content

faugustdev/git-context-controller

Git Context Controller (GCC) v2 — Lean agent memory backed by real git. Stores hash + intent + optional decision notes instead of verbose markdown. Auto-bridges to aiyoucli vector memory when available. Dual mode: git-backed (lean index.yaml) or standalone (markdown fallback). Triggers on /gcc commands or natural language like 'commit this progress', 'branch to try an alternative', 'merge results', 'recover context'.

FileKindSize
SKILL.mdskill md7.8 KB
examples/sample_session.mdmarkdown4.3 KB
references/file_formats.mdmarkdown3.6 KB
scripts/gcc_bridge.shexecutablescript3.9 KB
scripts/gcc_cleanup.shexecutablescript4.8 KB
scripts/gcc_commit.shexecutablescript3.5 KB
scripts/gcc_context.shexecutablescript4.2 KB
scripts/gcc_init.shexecutablescript2.5 KB

scripts/gcc_bridge.sh

View on GitHub
#!/bin/bash
# GCC v2 Bridge — feeds commit data to aiyoucli vector memory if available
#
# Usage (called automatically by gcc_commit.sh):
#   gcc_bridge.sh <hash> <intent> [note]
#
# Manual usage:
#   gcc_bridge.sh --sync          # sync all unsynced timeline entries
#   gcc_bridge.sh --status        # check bridge status
#
# Requires: aiyoucli or aiyoucli-mcp in PATH
# If not available, exits silently (no error)

set -e

GCC_DIR=".GCC"
INDEX="$GCC_DIR/index.yaml"
BRIDGE_LOG="$GCC_DIR/.bridge-log"

# Check if aiyoucli is available
has_aiyoucli() {
  command -v aiyoucli >/dev/null 2>&1 || command -v aiyoucli-mcp >/dev/null 2>&1
}

# Escape string for JSON value
json_escape() {
  printf '%s' "$1" | sed 's/\\/\\\\/g; s/"/\\"/g; s/	/\\t/g' | tr -d '\n'
}

# Store a memory entry via aiyoucli CLI
store_memory() {
  local hash="$1"
  local intent_raw="$2"
  local note_raw="${3:-}"
  local branch="${4:-main}"
  local date="${5:-$(date -u +"%Y-%m-%dT%H:%M:%SZ")}"

  # Escape for JSON
  local intent
  intent=$(json_escape "$intent_raw")
  local note
  note=$(json_escape "$note_raw")

  # Build metadata JSON
  local metadata
  metadata="{\"type\":\"gcc-commit\",\"hash\":\"$hash\",\"intent\":\"$intent\",\"branch\":\"$branch\",\"date\":\"$date\""
  [ -n "$note" ] && metadata="$metadata,\"note\":\"$note\""
  metadata="$metadata}"

  # Build value
  local value="$intent_raw"
  [ -n "$note_raw" ] && value="$value | $note_raw"

  # Try aiyoucli memory store
  if command -v aiyoucli >/dev/null 2>&1; then
    aiyoucli memory store \
      --key "gcc:$hash" \
      --value "$value" \
      --namespace "gcc" \
      --tags "commit,$branch" \
      --metadata "$metadata" 2>/dev/null && {
        echo "$hash" >> "$BRIDGE_LOG"
        return 0
      }
  fi

  return 1
}

# Check if a hash was already synced
is_synced() {
  local hash="$1"
  [ -f "$BRIDGE_LOG" ] && grep -q "^$hash$" "$BRIDGE_LOG" 2>/dev/null
}

case "${1:---help}" in
  --status)
    echo "# GCC Bridge Status"
    if has_aiyoucli; then
      echo "aiyoucli: available"
    else
      echo "aiyoucli: not found (bridge inactive)"
    fi

    TOTAL=$(grep -c '^\s*- id:' "$INDEX" 2>/dev/null || echo "0")
    SYNCED=$(wc -l < "$BRIDGE_LOG" 2>/dev/null || echo "0")
    echo "Timeline entries: $TOTAL"
    echo "Synced to memory: $SYNCED"
    echo "Pending: $((TOTAL - SYNCED))"
    ;;

  --sync)
    if ! has_aiyoucli; then
      echo "aiyoucli not found — nothing to sync"
      exit 0
    fi

    echo "Syncing unsynced entries..."
    SYNCED=0

    # Parse index.yaml and sync entries with hashes
    awk '
      /^  - id:/ { id=$3 }
      /hash:/ { hash=$2 }
      /intent:/ { gsub(/^[^"]*"|"$/, "", $0); intent=$0 }
      /note:/ { gsub(/^[^"]*"|"$/, "", $0); note=$0 }
      /branch:/ && !/current_branch/ { branch=$2 }
      /date:/ && !/created:/ {
        date=$2; gsub(/"/, "", date)
        if (hash != "null" && hash != "") {
          printf "%s|%s|%s|%s|%s\n", hash, intent, note, branch, date
        }
        note=""
      }
    ' "$INDEX" | while IFS='|' read -r hash intent note branch date; do
      if ! is_synced "$hash"; then
        if store_memory "$hash" "$intent" "$note" "$branch" "$date"; then
          SYNCED=$((SYNCED + 1))
          echo "  Synced: $hash — $intent"
        fi
      fi
    done

    echo "Done."
    ;;

  --help)
    echo "Usage: gcc_bridge.sh <hash> <intent> [note]"
    echo "       gcc_bridge.sh --sync"
    echo "       gcc_bridge.sh --status"
    exit 0
    ;;

  *)
    # Direct call: store single entry
    HASH="$1"
    INTENT="$2"
    NOTE="${3:-}"

    if [ -z "$HASH" ] || [ -z "$INTENT" ]; then
      exit 0
    fi

    if ! has_aiyoucli; then
      exit 0  # Silent skip
    fi

    if is_synced "$HASH"; then
      exit 0
    fi

    BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "main")
    store_memory "$HASH" "$INTENT" "$NOTE" "$BRANCH" && \
      echo "Bridged to aiyoucli: $HASH" || true
    ;;
esac
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 464kUpdated Claude CodeCodexVerifiedInstall
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 464kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 318kUpdated Claude CodeCodexUnverifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 318kUpdated Claude CodeCodexUnverifiedInstall