# get_architecture

get_architecture returns workspace architecture metrics (propagation cost, the cyclic core, per-role counts) and a deterministic 1-10 architecture score.

`get_architecture` reports how coupled a multi-repository system is and
which services form its core. It reads the architecture metrics built
over the workspace system graph, using structural edges only (co-change
is excluded). The metrics are described in
[Architecture metrics](https://docs.repowise.dev/multi-repo/architecture-metrics).

This tool is workspace-only and off by default. Enable it with
`repowise mcp --tools +get_architecture` or persist it with
`repowise config set mcp.tools standard,+get_architecture`.
See [Tool profiles](https://docs.repowise.dev/agents/tool-profiles).

## When to call

- **Before a cross-service refactor**, to see how far a change can
  propagate and which services sit in the cyclic core.
- **To compare against an earlier snapshot** after services were split
  or merged.

## Parameters

None. `get_architecture()` takes no arguments.

## Returns

| Field | Meaning |
|---|---|
| `score` | Deterministic 1 to 10 architecture score, higher means lower coupling and a smaller core. `null` when the graph's evidence cannot support a verdict |
| `architecture_type` | `core-periphery`, `hierarchical` or `undetermined` |
| `propagation_cost_pct` | The share of other services the average service reaches transitively, as a percentage |
| `node_count` | Services in the system graph |
| `core_size` | Services in the largest cyclic group |
| `core_ratio` | `core_size` over `node_count`, 0 to 1 |
| `core_members` | Up to 25 core service ids |
| `core_members_truncated` | How many core members are beyond the 25 listed |
| `cycle_count` | Dependency cycles found |
| `cycle_count_capped` | `true` when the enumeration budget stopped the count, so `cycle_count` is a floor |
| `conformance_violations` | Declared-rule violations, as counted by [get_conformance](https://docs.repowise.dev/mcp/get-conformance) |
| `role_breakdown` | Services per role: `core`, `shared`, `control`, `peripheral` |
| `evidence` | The graph's evidence state (`measured`, `partial` or `insufficient`), a summary and the reasons |
| `http_calls` | Only when present: HTTP calls read in code but linked to no other service |
| `summary` | One sentence with the score, type, propagation cost, core and cycle count |

The score starts at 10 and subtracts: 5 times the propagation cost
fraction, 3 times the core ratio, 0.5 per cycle (capped at 2) and 0.5 per
conformance violation (capped at 2), clamped to 1 through 10. A system
whose largest cyclic group holds at least 6% of its services is
`core-periphery`; below that it is `hierarchical`.

## Example

```python
get_architecture()
```

```json
{
  "score": 7.4,
  "architecture_type": "hierarchical",
  "propagation_cost_pct": 22.5,
  "node_count": 12,
  "core_size": 0,
  "core_ratio": 0.0,
  "core_members": [],
  "core_members_truncated": 0,
  "cycle_count": 0,
  "cycle_count_capped": false,
  "conformance_violations": 1,
  "role_breakdown": {"core": 0, "shared": 3, "control": 4, "peripheral": 5},
  "evidence": {"state": "measured", "determined": true, "summary": ""},
  "summary": "Architecture score 7.4/10 (hierarchical): propagation cost 22.5%, no cyclic core (acyclic structure), 0 dependency cycle(s)."
}
```

## Things worth knowing

- **Workspace mode only.** Outside a workspace the call returns an
  `invalid_args` error: `get_architecture is only available in workspace mode.`
- **Needs the system graph.** Before `repowise update --workspace` has
  run, the call returns a `no_index` error that names that command.
- **No score over an unseen graph.** When no dependency between services
  was detected, `score` is `null` and the summary says the architecture
  was not determined, with the reason. Zero edges means not seen, not
  decoupled.
- **Partial evidence** keeps the score and appends the reason to the
  summary.
- **`_meta`** carries the analysis time and the commit each repo was
  analyzed at.

## Next
- [Architecture metrics](https://docs.repowise.dev/multi-repo/architecture-metrics) explains propagation cost, the core and the roles.
- [get_conformance](https://docs.repowise.dev/mcp/get-conformance) lists the rule violations and cycles behind the score.
- [Workspace MCP mode](https://docs.repowise.dev/multi-repo/workspace-mcp) covers the other workspace tools.
