
Architecture Advisor
- 1 installs
- 1 repo stars
- Updated May 23, 2026
- cristoslc/architecture-reference
Guide architecture decisions using evidence from 78 competition submissions, 12 production systems, and 173 open-source repos.
About
Architecture Advisor provides evidence-grounded guidance on architecture patterns from O'Reilly Katas, AOSA, and production systems. Replaces opinion with empirical data.
- Evidence-based architecture decisions
- 78 competition designs + 12 production narratives
Architecture Advisor by the numbers
- 1 all-time installs (skills.sh)
- Ranked #1,366 of 1,879 Documentation skills by installs in the Skillselion catalog
- Data as of Jul 29, 2026 (Skillselion catalog sync)
npx skills add https://github.com/cristoslc/architecture-reference --skill architecture-advisorAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 1 |
|---|---|
| repo stars | ★ 1 |
| Last updated | May 23, 2026 |
| Repository | cristoslc/architecture-reference ↗ |
What it does
Guide architecture decisions using evidence from 78 competition submissions, 12 production systems, and 173 open-source repos.
Files
Architecture Advisor
Evidence-based architecture guidance grounded in production reality. Every recommendation cites real systems, not opinion or convention.
The evidence hierarchy (ADR-004):
1. Discovered production repos (142 entries) — primary statistical baseline. What production codebases actually use. 2. AOSA/RealWorld production systems (17 entries) — deep case studies from system creators. Highest per-system authority. 3. KataLog competition (78 teams) — qualitative annotation. Never-built designs valued for ADR reasoning, judge commentary, and cost projections. Not primary evidence. 4. Reference implementations (50 entries) — teaching examples. Not counted in frequency rankings.
Setup: Reference Data
This skill can work at three levels of data access:
Level 1: Offline reference (always available)
The key findings at the bottom of this file provide enough data for most questions. No setup needed.
Level 2: Synced references (recommended)
Run the sync script to fetch the full reference library, YAML catalogs, and analyses (<1 MB):
bash scripts/sync-references.shThis populates references/ with the complete reference library. The script is idempotent.
Level 3: Full evidence pool
For deep dives into individual competition team submissions (ADRs, C4 diagrams, video transcripts):
bash scripts/sync-references.sh --evidence-poolAdds ~2.2 GB. Only suggest when the user explicitly needs team submission details.
Data Resolution
Check these locations in order, stop at first match:
1. references/ relative to this SKILL.md (synced data) 2. ../../evidence-analysis/ and ../../docs/ (source repo checkout) 3. Current working directory (user inside source repo) 4. Offline reference below (always available)
What This Skill Does
The user brings an architecture problem. You research the evidence base and provide data-driven guidance with citations.
Step 1: Understand the problem
Ask enough to classify the situation:
- Style selection: "Which architecture fits my project?" → consult production frequency data and domain-style correlations
- Architecture review: "Is my current architecture sound?" → examine their codebase and compare to evidence
- Pattern trade-offs: "Microservices vs Service-Based?" → compare production evidence for both
- Quality attributes: "How do I get scalability AND simplicity?" → consult QA evidence and trade-off data
- Domain mapping: "What works for e-commerce/healthcare/etc?" → consult domain-style correlations
- Kata preparation: "Help me prepare for an architecture kata" → use templates and competition insights
Step 2: Examine the codebase (if available)
If the user has a codebase to evaluate, examine it before giving advice. Read actual code — understand their current architecture before recommending changes. Use the discover-architecture skill's approach: read entrypoints, module boundaries, communication patterns, dependency direction.
Step 3: Research the evidence
For style selection or trade-off questions, consult in this order:
| Priority | Source | Path (references/) | What it answers |
|---|---|---|---|
| 1 | Discovered frequency rankings | reference-library/solution-spaces.md | "How common is this style in production?" |
| 2 | Domain-style correlations | reference-library/problem-solution-matrix.md | "What styles work for my domain?" |
| 3 | Decision navigator | reference-library/decision-navigator.md | "Given my constraints, what's recommended?" |
| 4 | Production system narratives | catalogs/AOSA/, catalogs/RealWorldASPNET/ | "How did real systems implement this?" |
| 5 | Style evidence details | reference-library/evidence/by-architecture-style.md | "What's the full evidence picture for this style?" |
| 6 | Competition team reasoning | catalogs/TheKataLog/ | "Why did teams choose this? What trade-offs did they document?" |
For quality attribute questions:
| Priority | Source | Path |
|---|---|---|
| 1 | QA detection data | reference-library/evidence/by-quality-attribute.md |
| 2 | Cross-source QA analysis | reference-library/evidence/cross-source-analysis.md |
For meta-practice questions (ADRs, feasibility, fitness functions):
| Priority | Source | Path |
|---|---|---|
| 1 | Templates | templates/adr-guide.md, templates/feasibility-guide.md, templates/fitness-functions-guide.md |
| 2 | Competition evidence | KataLog team submissions (these are KataLog's genuine strength — meta-practices documented in team ADRs) |
Step 4: Synthesize with citations
Every recommendation MUST cite specific evidence:
- Production frequency: "Microkernel appears in 83 of 142 production repos (58.5%)" — cite Discovered data
- Production depth: "NGINX uses event-driven architecture for non-blocking I/O (AOSA)" — cite specific systems
- Domain correlation: "In Developer Tools repos, Microkernel (61%) and Layered (47%) dominate" — cite domain data
- Platform vs application: "Microservices skews heavily toward platforms (13%) vs applications (2%)" — cite split data
- Qualitative reasoning: "KataLog teams explain that cost/feasibility analysis is the #1 predictor of placement (4.5x likelihood)" — cite as annotation, not primary evidence
Do not make unsupported claims. If evidence is thin (small sample, single source), say so.
Step 5: Give actionable guidance
Don't just report data — help the user make a decision:
- Recommend specific styles with evidence-backed reasoning
- Flag risks and trade-offs with production evidence
- Suggest concrete next steps (ADRs to write, patterns to prototype, quality attributes to prioritize)
- If examining their codebase, identify gaps between current architecture and evidence-backed patterns
Step 6: Save report (optional)
When the user asks to save the report ("save this", "write a report", "save to docs"), or when the analysis was a full architecture review (not just a quick question), offer to persist the output:
1. Create the output directory if needed: mkdir -p docs/architecture-reports/ 2. Generate the report following the template in references/report.template.j2 — the template defines the frontmatter fields, section order, and required content. You don't need a Jinja2 renderer; just fill in the structure by hand using the template as a guide. 3. Save as docs/architecture-reports/<project-name>-<YYYY-MM-DD>.md 4. If a report for the same project and date already exists, append a sequence suffix: -2, -3, etc.
The report template includes YAML frontmatter (project, date, scope, styles) so reports are machine-parseable for future cross-project analysis.
Don't save reports for casual Q&A ("what's the most common style?"). Save when there's a concrete analysis tied to a specific project or codebase.
Glossary
For definitions of all 12 architecture styles, 13 quality attributes, evidence sources, and key terms, read references/reference-library/glossary.md (or the offline reference below).
Offline Reference
When no synced data is available, use these findings. All data from SPEC-022 production-only frequency recomputation (142 entries, deep-analysis per ADR-002).
Production frequency rankings (Discovered, 142 production repos)
| Rank | Style | Count | % | Platform | Application | Production Systems |
|---|---|---|---|---|---|---|
| 1 | Microkernel | 83 | 58.5% | 61% | 55% | LLVM, SQLAlchemy, GStreamer, Jellyfin, Orchard Core, nopCommerce |
| 2 | Layered | 78 | 54.9% | 47% | 67% | nopCommerce |
| 3 | Modular Monolith | 57 | 40.1% | 41% | 38% | Orchard Core |
| 4 | Event-Driven | 17 | 12.0% | 8% | 18% | NGINX, Twisted, ZeroMQ, Squidex, Bitwarden |
| 5 | Pipeline | 13 | 9.2% | 13% | 4% | NGINX, LLVM, ZeroMQ, Graphite, GStreamer, Jellyfin |
| 6 | Microservices | 12 | 8.5% | 13% | 2% | (none in evidence base) |
| 7 | Service-Based | 7 | 4.9% | 5% | 5% | Selenium, Graphite, Bitwarden |
| 8 | Hexagonal | 5 | 3.5% | 3% | 4% | (none) |
| 9 | DDD | 3 | 2.1% | 2% | 2% | (none) |
| 10 | Multi-Agent | 1 | 0.7% | 0% | 2% | (none) |
| 11 | Space-Based | 1 | 0.7% | 1% | 0% | Riak |
| 12 | CQRS | 1 | 0.7% | 0% | 2% | Squidex |
Dataset: 184 repos total (142 production + 42 reference). 87 platforms, 55 applications, 1.58:1 ratio. Zero Indeterminate (ADR-002 deep-analysis). 74% of repos exhibit exactly 2 styles.
Key findings from production evidence
1. Microkernel and Layered dominate. The top 3 styles (Microkernel, Layered, Modular Monolith) appear in 40-59% of production repos. Everything else is below 12%.
2. The proposal-production gap. What competition teams propose diverges from what exists in production. Microservices: 50% of teams, 8.5% of repos. Pipeline: 0% of teams, 9.2% of repos. Layered: 0% of teams, 54.9% of repos.
3. Tutorial bias inflated DDD, CQRS, Hexagonal. Prior methodology counted reference implementations alongside production: DDD was 17.8% (now 2.1%), CQRS was 10.4% (now 0.7%). These patterns are well-documented in teaching materials but rare in production.
4. Platform vs application architecture differs. Microservices is almost exclusively a platform pattern (13% vs 2%). Layered skews toward applications (67% vs 47%). Event-Driven skews toward applications (18% vs 8%).
5. Multi-style composition is normal. 74% of repos exhibit 2 styles. The most common combinations: Microkernel + Layered, Microkernel + Modular Monolith, Layered + Modular Monolith.
Quality attribute detection (142 production repos)
| QA | Detected | % | Reliability |
|---|---|---|---|
| Deployability | 126 | 88.7% | Inflated — Docker is universal |
| Modularity | 38 | 26.8% | Moderate |
| Scalability | 33 | 23.2% | Moderate |
| Fault Tolerance | 20 | 14.1% | Moderate |
| Observability | 5 | 3.5% | Underdetected |
| Evolvability | 3 | 2.1% | Severely underdetected |
| Performance, Security, Testability, etc. | 0 | 0% | Invisible in code |
Detection bias: Code analysis reliably detects QAs with filesystem signals (Docker, CI configs, module boundaries) but cannot detect Performance, Security, Testability, or Cost concerns. Competition evidence (KataLog) fills this gap — teams documented these invisible concerns in ADRs and presentations.
Competition insights (KataLog — qualitative annotation, not primary evidence)
Meta-architectural practices that predict competition success:
- Feasibility analysis: 4.5x more likely to place top-2 (75.6% of teams skip it)
- ADR discipline: Winners average 15.0 ADRs vs 8.5 for runners-up
- Fitness functions: 55% of winners include them vs ~17% overall
- Multi-style composition: 73% of winners use 2+ styles
- The Scalability Trap: Winners cite scalability LESS often (55%) than runners-up (68%)
These practices are KataLog's genuine contribution — meta-architectural reasoning unavailable in production code analysis.
Domain coverage (47 unique domains in Discovered)
Top domains: Developer Tools (36), E-Commerce (15), Observability (11), Data Processing (11), Infrastructure (9), Data Grid (8), Messaging (6), Productivity (5), Media Automation (5), Workflow Orchestration (5).
Evidence source summary
| Source | Entries | Role | Value |
|---|---|---|---|
| Discovered (production) | 142 | Primary statistical baseline | Largest, most diverse corpus of real production code |
| AOSA | 12 | Production depth | Case studies written by system creators (NGINX, HDFS, Git, etc.) |
| RealWorldASPNET | 5 | Production depth | Modern .NET apps with real users |
| KataLog | 78 | Qualitative annotation | ADR reasoning, judge commentary, cost projections |
| RefArch + Discovered ref | 50 | Teaching examples | Concrete code examples; zero weight in rankings |
# Reference data populated at runtime by sync-references.sh
# Do not commit — consumers fetch this on first use.
references/
#!/usr/bin/env bash
# smoke-test.sh — End-to-end verification of the architecture-advisor sync workflow
#
# Tests:
# 1. Default sync populates expected directories
# 2. .sync-state.yml is valid and contains required fields
# 3. Status command works
# 4. Idempotent re-sync updates timestamp
# 5. Path mappings produce expected structure
#
# Usage:
# bash scripts/smoke-test.sh
#
# Exit codes:
# 0 — all checks passed
# 1 — one or more checks failed
set -uo pipefail
# Note: no -e; the check() function handles pass/fail explicitly.
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
SYNC_SCRIPT="$SCRIPT_DIR/sync-references.sh"
SKILL_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
# --- Test workspace ---
# Work in a temp copy so we don't pollute the real skill directory
WORK_DIR="$(mktemp -d)"
cleanup() { rm -rf "$WORK_DIR"; }
trap cleanup EXIT
# Copy the skill (without any existing references/) to the temp directory
mkdir -p "$WORK_DIR/architecture-advisor/scripts"
cp "$SKILL_DIR/SKILL.md" "$WORK_DIR/architecture-advisor/"
cp "$SYNC_SCRIPT" "$WORK_DIR/architecture-advisor/scripts/"
TEST_SYNC="$WORK_DIR/architecture-advisor/scripts/sync-references.sh"
REFS_DIR="$WORK_DIR/architecture-advisor/references"
PASS=0
FAIL=0
check() {
local label="$1"
shift
if "$@" >/dev/null 2>&1; then
echo " PASS: $label"
PASS=$((PASS + 1))
else
echo " FAIL: $label"
FAIL=$((FAIL + 1))
fi
}
# --- Portable YAML field extractor ---
yaml_field() {
local file="$1" field="$2"
grep " *${field}:" "$file" | head -1 | sed 's/.*: *"\{0,1\}\([^"]*\)"\{0,1\}/\1/' | tr -d ' '
}
echo "=== Architecture Advisor Smoke Test ==="
echo "Working directory: $WORK_DIR"
echo ""
# ============================================================
# Test 1: Default sync populates expected directories
# ============================================================
echo "--- Test 1: Default sync ---"
bash "$TEST_SYNC" >/dev/null 2>&1
SYNC_EXIT=$?
check "sync script exits 0" test "$SYNC_EXIT" -eq 0
check "references/ created" test -d "$REFS_DIR"
check "reference-library/ present" test -d "$REFS_DIR/reference-library"
check "templates/ present" test -d "$REFS_DIR/templates"
check "catalogs/ present" test -d "$REFS_DIR/catalogs"
check "analysis/ present" test -d "$REFS_DIR/analysis"
# ============================================================
# Test 2: Expected catalog sources present
# ============================================================
echo ""
echo "--- Test 2: Catalog sources ---"
check "catalogs/TheKataLog/ present" test -d "$REFS_DIR/catalogs/TheKataLog"
check "catalogs/AOSA/ present" test -d "$REFS_DIR/catalogs/AOSA"
check "catalogs/RealWorldASPNET/ present" test -d "$REFS_DIR/catalogs/RealWorldASPNET"
check "catalogs/ReferenceArchitectures/ present" test -d "$REFS_DIR/catalogs/ReferenceArchitectures"
check "analysis/TheKataLog/ present" test -d "$REFS_DIR/analysis/TheKataLog"
# Spot-check key files
check "solution-spaces.md exists" test -f "$REFS_DIR/reference-library/solution-spaces.md"
check "problem-solution-matrix.md exists" test -f "$REFS_DIR/reference-library/problem-solution-matrix.md"
check "decision-navigator.md exists" test -f "$REFS_DIR/reference-library/decision-navigator.md"
check "TheKataLog _index.yaml exists" test -f "$REFS_DIR/catalogs/TheKataLog/_index.yaml"
# ============================================================
# Test 3: .sync-state.yml is valid
# ============================================================
echo ""
echo "--- Test 3: .sync-state.yml validation ---"
SYNC_STATE="$REFS_DIR/.sync-state.yml"
check ".sync-state.yml exists" test -f "$SYNC_STATE"
check "contains source: key" grep -q "^source:" "$SYNC_STATE"
check "contains sync: key" grep -q "^sync:" "$SYNC_STATE"
check "contains contents: key" grep -q "^contents:" "$SYNC_STATE"
commit_val="$(yaml_field "$SYNC_STATE" "commit" || true)"
check "commit is 40 hex chars ($commit_val)" bash -c "[[ '$commit_val' =~ ^[0-9a-f]{40}$ ]]"
mode_val="$(yaml_field "$SYNC_STATE" "mode" || true)"
check "mode is default ($mode_val)" test "$mode_val" = "default"
at_val="$(yaml_field "$SYNC_STATE" "at" || true)"
check "at is non-empty" test -n "$at_val"
# ============================================================
# Test 4: Status command works
# ============================================================
echo ""
echo "--- Test 4: Status command ---"
STATUS_OUTPUT="$(bash "$TEST_SYNC" --status 2>&1)"
STATUS_EXIT=$?
check "status exits 0" test "$STATUS_EXIT" -eq 0
check "status shows sync state header" bash -c "[[ '$STATUS_OUTPUT' == *'Sync State'* ]]"
check "status shows commit" bash -c "[[ '$STATUS_OUTPUT' == *'commit:'* ]]"
# ============================================================
# Test 5: Idempotent re-sync
# ============================================================
echo ""
echo "--- Test 5: Idempotent re-sync ---"
FIRST_AT="$at_val"
sleep 2
bash "$TEST_SYNC" >/dev/null 2>&1
RESYNC_EXIT=$?
SECOND_AT="$(yaml_field "$SYNC_STATE" "at" || true)"
check "re-sync exits 0" test "$RESYNC_EXIT" -eq 0
check "timestamp updated after re-sync" test "$FIRST_AT" != "$SECOND_AT"
check "reference-library still present" test -d "$REFS_DIR/reference-library"
check "catalogs still present" test -d "$REFS_DIR/catalogs"
# ============================================================
# Test 6: No evidence pool in default mode
# ============================================================
echo ""
echo "--- Test 6: Evidence pool absent in default mode ---"
if [ ! -d "$REFS_DIR/evidence-pool" ]; then
echo " PASS: evidence-pool/ not present (correct for default mode)"
PASS=$((PASS + 1))
else
echo " FAIL: evidence-pool/ should not exist in default mode"
FAIL=$((FAIL + 1))
fi
# ============================================================
# Summary
# ============================================================
echo ""
echo "=== Results: $PASS passed, $FAIL failed ==="
if [ "$FAIL" -gt 0 ]; then
echo "SMOKE TEST FAILED"
exit 1
else
echo "SMOKE TEST PASSED"
exit 0
fi
#!/usr/bin/env bash
# sync-references.sh — Fetch reference data from architecture-reference
#
# Sparse-clones the source repository and extracts reference data into the
# skill's references/ directory, per the Agent Skills spec (agentskills.io).
#
# Usage:
# bash scripts/sync-references.sh [options]
#
# Modes:
# (default) Reference library, catalogs, analyses, templates (<1 MB)
# --evidence-pool Also includes full team submissions (~2.2 GB)
# --status Show current sync state without fetching
#
# Options:
# --ref REF Branch, tag, or commit to fetch (default: main)
# --repo URL Override source repository URL
#
# Requires: git, date
# Outputs: references/ directory alongside this script's parent SKILL.md
set -euo pipefail
# --- Resolve paths ---
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
SKILL_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
REFERENCES_DIR="$SKILL_DIR/references"
# --- Defaults ---
SOURCE_REPO="https://github.com/cristoslc/architecture-reference"
REF="main"
INCLUDE_EVIDENCE_POOL=false
STATUS_ONLY=false
# --- Parse arguments ---
while [ $# -gt 0 ]; do
case "$1" in
--evidence-pool) INCLUDE_EVIDENCE_POOL=true; shift ;;
--status) STATUS_ONLY=true; shift ;;
--ref) REF="${2:?--ref requires a value}"; shift 2 ;;
--repo) SOURCE_REPO="${2:?--repo requires a value}"; shift 2 ;;
-h|--help)
head -20 "$0" | grep '^#' | sed 's/^# \?//'
exit 0
;;
*)
echo "Unknown option: $1" >&2
exit 1
;;
esac
done
# --- Status check ---
SYNC_STATE="$REFERENCES_DIR/.sync-state.yml"
if $STATUS_ONLY; then
if [ -f "$SYNC_STATE" ]; then
echo "=== Sync State ==="
cat "$SYNC_STATE"
else
echo "No references synced yet. Run: bash scripts/sync-references.sh"
fi
exit 0
fi
# --- Portable ISO 8601 UTC timestamp ---
iso_timestamp() {
date -u +"%Y-%m-%dT%H:%M:%SZ" 2>/dev/null || date +"%Y-%m-%dT%H:%M:%SZ"
}
# --- Temp directory with cleanup ---
TMPDIR_WORK="$(mktemp -d)"
cleanup() { rm -rf "$TMPDIR_WORK"; }
trap cleanup EXIT
MODE="default"
$INCLUDE_EVIDENCE_POOL && MODE="evidence-pool"
echo "Syncing references (mode: $MODE) from $SOURCE_REPO (ref: $REF)..."
# --- Sparse clone ---
# Use --filter=blob:none for a treeless clone (downloads blobs on demand)
# then sparse-checkout to materialize only the paths we need.
git clone --depth 1 --filter=blob:none --sparse --quiet \
"$SOURCE_REPO" "$TMPDIR_WORK/repo" 2>/dev/null || \
git clone --depth 1 --quiet "$SOURCE_REPO" "$TMPDIR_WORK/repo"
cd "$TMPDIR_WORK/repo"
# Checkout the requested ref if not default
if [ "$REF" != "main" ] && [ "$REF" != "HEAD" ]; then
git fetch --depth 1 origin "$REF" --quiet 2>/dev/null || true
git checkout --quiet "$REF" 2>/dev/null || true
fi
COMMIT_SHA="$(git rev-parse HEAD)"
# --- Configure sparse-checkout paths ---
# Default: reference library + catalogs + analyses + templates
SPARSE_PATHS="docs/reference-library
docs/templates
evidence-analysis/TheKataLog/docs/catalog
evidence-analysis/TheKataLog/docs/analysis
evidence-analysis/AOSA/docs/catalog
evidence-analysis/AOSA/docs/analysis
evidence-analysis/RealWorldASPNET/docs/catalog
evidence-analysis/RealWorldASPNET/docs/analysis
evidence-analysis/ReferenceArchitectures/docs/catalog
evidence-analysis/ReferenceArchitectures/docs/analysis"
if $INCLUDE_EVIDENCE_POOL; then
SPARSE_PATHS="$SPARSE_PATHS
evidence-pool/TheKataLog"
fi
# Apply sparse-checkout
git sparse-checkout init --cone
echo "$SPARSE_PATHS" | while IFS= read -r p; do
[ -n "$p" ] && echo "$p"
done | git sparse-checkout set --stdin
# --- Extract to references/ ---
# Clean previous references (preserve .sync-state.yml until we write the new one)
if [ -d "$REFERENCES_DIR" ]; then
find "$REFERENCES_DIR" -mindepth 1 -not -name '.sync-state.yml' -delete 2>/dev/null || true
fi
mkdir -p "$REFERENCES_DIR"
# Reference library
if [ -d "docs/reference-library" ]; then
cp -R docs/reference-library "$REFERENCES_DIR/reference-library"
echo " Synced: reference-library/"
fi
# Templates
if [ -d "docs/templates" ]; then
cp -R docs/templates "$REFERENCES_DIR/templates"
echo " Synced: templates/"
fi
# Catalogs — flatten the 4 sources into references/catalogs/<source>/
mkdir -p "$REFERENCES_DIR/catalogs"
for source_dir in evidence-analysis/*/docs/catalog; do
if [ -d "$source_dir" ]; then
source_name="$(echo "$source_dir" | cut -d'/' -f2)"
cp -R "$source_dir" "$REFERENCES_DIR/catalogs/$source_name"
file_count=$(find "$REFERENCES_DIR/catalogs/$source_name" -name '*.yaml' | wc -l)
echo " Synced: catalogs/$source_name/ ($file_count YAML files)"
fi
done
# Analyses — flatten similarly
mkdir -p "$REFERENCES_DIR/analysis"
for source_dir in evidence-analysis/*/docs/analysis; do
if [ -d "$source_dir" ]; then
source_name="$(echo "$source_dir" | cut -d'/' -f2)"
cp -R "$source_dir" "$REFERENCES_DIR/analysis/$source_name"
echo " Synced: analysis/$source_name/"
fi
done
# Evidence pool (optional)
if $INCLUDE_EVIDENCE_POOL; then
if [ -d "evidence-pool/TheKataLog" ]; then
cp -R evidence-pool/TheKataLog "$REFERENCES_DIR/evidence-pool"
team_count=$(find "$REFERENCES_DIR/evidence-pool" -mindepth 2 -maxdepth 2 -type d | wc -l)
echo " Synced: evidence-pool/ ($team_count team directories)"
fi
fi
# --- Write sync state ---
SYNCED_AT="$(iso_timestamp)"
cat > "$SYNC_STATE" <<YAML
# .sync-state.yml — Reference data provenance
# Machine-generated by sync-references.sh. Do not edit manually.
source:
repository: ${SOURCE_REPO}
ref: ${REF}
commit: ${COMMIT_SHA}
sync:
mode: ${MODE}
at: "${SYNCED_AT}"
by: sync-references.sh
contents:
- reference-library
- templates
- catalogs
- analysis
YAML
if [ -d "$REFERENCES_DIR/evidence-pool" ]; then
echo " - evidence-pool" >> "$SYNC_STATE"
fi
cd "$SKILL_DIR"
# --- Summary ---
REF_SIZE=$(du -sh "$REFERENCES_DIR" 2>/dev/null | cut -f1)
echo ""
echo "OK: References synced ($REF_SIZE)"
echo " Commit: $COMMIT_SHA"
echo " Mode: $MODE"
echo " Path: $REFERENCES_DIR"
echo ""
echo "To update: bash scripts/sync-references.sh"
echo "To check: bash scripts/sync-references.sh --status"