"매 source code → 매 architectural model 의 inference". Documentation 의 lost / outdated 의 legacy system 의 understanding. 2026 현재 매 LLM (Claude Opus 4.7, GPT-5) 의 augmented static-analysis 가 매 dominant — 매 dependency graph + cluster + LLM-named module summary.
매 핵심
매 phases
Extraction: 매 source code, build files, config 의 parse → entities (file, class, module).
Abstraction: 매 dependency graph, call graph, data-flow.
Clustering: 매 community detection (Louvain, label propagation), 매 LLM semantic grouping.
fromanthropicimportAnthropicclient=Anthropic()defname_module(files:list[str],code_snippets:list[str])->str:msg=client.messages.create(model="claude-opus-4-7",max_tokens=200,messages=[{"role":"user","content":f"Files: {files}\n\nSnippets:\n{code_snippets}\n\n""Give a 3-word module name + 1-line responsibility."}],)returnmsg.content[0].text
Runtime trace → architecture (OpenTelemetry)
# Aggregate spans into service-level call graphfromcollectionsimportCounteredges=Counter()forspaninfetch_traces(service="checkout",since="24h"):ifspan.parentandspan.parent.service!=span.service:edges[(span.parent.service,span.service)]+=1# Top edges = primary architectural connections
C4 diagram emission (Structurizr DSL)
workspace {
model {
user = person "Customer"
sys = softwareSystem "Shop" {
web = container "Web"
api = container "API"
db = container "Postgres"
}
user -> web "uses"
web -> api "REST"
api -> db "JDBC"
}
}
매 결정 기준
상황
Approach
Small monolith (<100k LoC)
Static import graph + manual review
Microservices distributed
Distributed tracing (OTel) + service map
Legacy COBOL/Java enterprise
Lattix / Structure101 commercial tools
Quick high-level overview
LLM (Opus 4.7) on README + top-level dirs
Decomposition planning
Static + dynamic + LLM hybrid
기본값: 매 static import graph (madge / pyan / jdeps) → Louvain cluster → LLM name → C4 diagram.