sac-reverse-engineer
End-to-end reverse-engineer one or more git repositories into a SAC architecture knowledge graph (packages, services, IaC, CI/CD, IAM, identity, topology). Plan breadth-first, then fan out area walkers. Primary entry skill for SAC.
- License 许可
- MIT
- 最近更新
- 2026-09-20
- Stars
- ★ 1
- Forks
- 2
01 前言 Front Matter
- name
- sac-reverse-engineer
- description
- End-to-end reverse-engineer one or more git repositories into a SAC architecture knowledge graph (packages, services, IaC, CI/CD, IAM, identity, topology). Plan breadth-first, then fan out area walkers. Primary entry skill for SAC.
03 SKILL.md 正文
SAC Reverse Engineer
Populate the second brain for system architecture information on the given monorepo or multi-repo set: map the estate first, prioritize focus areas, walk code/IaC with matching sub-agents, materialize concepts using the standard OKF schema pack (schemas/types.json), wire relationships, validate with --schema, and leave a queryable knowledge bundle.
This is capture-time. Do not conflate it with query-time architecture-retriever / sac-retrieve. Walkers populate the graph. Retrievers stay separate.
Connectivity
Provider login/API details come from host skills and MCPs — not from SAC. Fetch wiki/tickets/live cloud inventory via those tools first; SAC normalizes paths you pass in. In-repo scanners need only filesystem access to git roots.
Process
- Confirm repo roots (local paths or clones of URLs) and system name.
- Optional: wiki export dir, tickets JSON.
- Init the knowledge bundle if needed.
- Plan (breadth-first) — map layout, ecosystems, and which domains are present. Do not start with a full scan.
python3 "${CLAUDE_PLUGIN_ROOT}/scripts/sac_orchestrate.py" \
--repo . \
--system "$SYSTEM_NAME" \
--scan-root "$REPO_ROOT" \
--plan-only \
--json
Or:
python3 "${CLAUDE_PLUGIN_ROOT}/scripts/sac_plan.py" \
--repo . --system "$SYSTEM_NAME" --scan-root "$REPO_ROOT" --write --json
Artifacts (operational, not OKF concepts):
knowledge/.sac/re-plan.md— repo map, ranked task list, unchecked deep-dive checklistsknowledge/.sac/re-plan.json— same, machine-readableknowledge/.sac/re-plan-progress.json— checklist status
- Review the plan, then spawn from the assignment tables: one child per domain area and one child per listed language/IaC specialist. Signal-gated — do not spawn Java (Gradle / Maven) unless Gradle or Maven markers exist (both first-class; mixed repos cover both), or Terraform without
.tf. Independent domains in parallel; specialists enrich after the deterministic scan for that ecosystem. Pass that area’s checklist andscan_domains. - Each child runs a domain-scoped scanner + capture (scripts own writes) and marks checklist items:
python3 "${CLAUDE_PLUGIN_ROOT}/scripts/sac_orchestrate.py" \
--repo . --system "$SYSTEM_NAME" --scan-root "$REPO_ROOT" \
--from-plan knowledge/.sac/re-plan.json --area packages --json
# equivalent scoped pair
python3 "${CLAUDE_PLUGIN_ROOT}/scripts/sac_scan.py" --root "$REPO_ROOT" --domains packages --json
python3 "${CLAUDE_PLUGIN_ROOT}/scripts/sac_capture.py" \
--repo . --root "$REPO_ROOT" --system "$SYSTEM_NAME" --domains packages
python3 "${CLAUDE_PLUGIN_ROOT}/scripts/sac_plan.py" mark \
--plan knowledge/.sac/re-plan.json --area packages --item capture --status done
Do not re-run full_scan in every child if the plan already scoped domains. Language/IaC specialists (--area lang-java, iac-terraform, …) are enrichment-only — they do not re-scan.
- After children return, graph-builder (or orchestrate without
--plan-only) joins Package/Service ↔ Deployment ↔ LB ↔ Pipeline where evidence exists. - Optional wiki/ticket ingest. Blast radius on critical services.
- Validate + doctor + report checklist completion:
python3 "${CLAUDE_PLUGIN_ROOT}/scripts/sac_validate.py" --repo . --schema
python3 "${CLAUDE_PLUGIN_ROOT}/scripts/sac_doctor.py" --repo .
python3 "${CLAUDE_PLUGIN_ROOT}/scripts/sac_plan.py" show --plan knowledge/.sac/re-plan.json
Unattended (plan + scoped capture of every detected domain + graph):
python3 "${CLAUDE_PLUGIN_ROOT}/scripts/sac_orchestrate.py" \
--repo . \
--system "$SYSTEM_NAME" \
--scan-root "$REPO_ROOT" \
--json
Default scan domains include diagrams (Mermaid/PlantUML) and code (Module/Class/Method/Function) when the plan detects them.
04 同仓库更多 Skills
sac-session
Open or close an isolated second-brain write session (worktree + PR). Use before scanning or materializing architecture when multiple agents share one knowledge remote.
sac-search
Full-text search over SAC architecture knowledge concepts.
sac-scan
Run deterministic architecture scanners (packages, containers, IaC, K8s, CI/CD, identity) against a code root without writing knowledge.
sac-retrieve
Query-time retrieval of SAC architecture context without contaminating the parent. Spawn architecture-retriever for topology (Service, ApiContract, Package, Runtime, Pipeline, IdentityProvider, blast radius). Do not run sac_search or sac_pack in the parent. Consume only the retrieval card.
sac-plan
Breadth-first reverse-engineering plan — map monorepo/multi-repo roots, rank focus areas, emit deep-dive checklists. Pause here before spawning area walkers. Not query-time retrieve.
sac-pack
Build progressive disclosure context packs (default 2-hop) for precise LLM queries over architecture knowledge.