# `orchestrator.knowledge.current_state`
<!-- generated by `orchestrator understand`; the PKG is source of truth, edits here are advisory -->

[← Episteme](../README.md) · [Architecture](../architecture.md)

**Source:** [`src/orchestrator/knowledge/current_state.py`](../../src/orchestrator/knowledge/current_state.py)

1 types · 26 functions · python

## Changing this safely

**Tested by** (5): `tests.knowledge.test_current_state`, `tests.knowledge.test_report_html`, `tests.knowledge.test_report_svg`, `tests.knowledge.test_report_svg_clusters`, `tests.knowledge.test_shared_analysis`

**Most depended-upon here** — a change to these reaches the most code (call graph, ≤4 hops):

- [`is_test_area`](../../src/orchestrator/knowledge/current_state.py#L71) — reaches **19** symbols
- [`architecture_graph`](../../src/orchestrator/knowledge/current_state.py#L461) — reaches **13** symbols
- [`architecture_clusters`](../../src/orchestrator/knowledge/current_state.py#L496) — reaches **12** symbols
- [`architecture_mermaid`](../../src/orchestrator/knowledge/current_state.py#L526) — reaches **12** symbols
- [`compute_current_state`](../../src/orchestrator/knowledge/current_state.py#L195) — reaches **12** symbols
- [`_is_interface`](../../src/orchestrator/knowledge/current_state.py#L95) — reaches **11** symbols
- [`CurrentState`](../../src/orchestrator/knowledge/current_state.py#L118) — reaches **10** symbols
- [`_app_type`](../../src/orchestrator/knowledge/current_state.py#L606) — reaches **10** symbols

## Types

### `CurrentState`

[`src/orchestrator/knowledge/current_state.py:118`](../../src/orchestrator/knowledge/current_state.py#L118)

- **Called by** (1 production · 1 test): [`compute_current_state`](../../src/orchestrator/knowledge/current_state.py#L195), [`_state`](../../tests/knowledge/test_report_svg_clusters.py#L42)
- **Fields**: `area_funcs`, `area_types`, `areas`, `auth_surface`, `busiest_controllers`, `call_hotspots`, `controllers`, `counts`, `coupling`, `coverable_symbols`, `data_access`, `doc_drift_top`, `doc_drift_total`, `docs`, `documented_symbols`, `dup_names`, `endpoints`, `entry_points`, `external_deps`, `framework`, `generated`, `has_calls`, `hotspots`, `infrastructure`, `interfaces`, `languages`, `layers`, `modules`, `namespaces`, `production_areas`, `recent_areas`, `recommendations`, `size_dist`, `test_runner`, `tested_areas`, `untested_top`
- **Documented in**: `docs/specs/pkg-navigable-reports.md#risks-the-things-that-will-bite`, `docs/specs/shareable-report-spec.md#components-where-the-code-goes`, `docs/specs/shareable-report-spec.md#phases`, `docs/specs/shareable-report-spec.md#report-content`, `docs/specs/shareable-report-spec.md#what-already-exists-reuse-dont-rebuild`

## Functions

### `_app_type`

[`src/orchestrator/knowledge/current_state.py:606`](../../src/orchestrator/knowledge/current_state.py#L606)

- **Called by** (2): [`_header`](../../src/orchestrator/knowledge/report_html.py#L62), [`_overview`](../../src/orchestrator/knowledge/current_state.py#L616)

### `_code_structure`

[`src/orchestrator/knowledge/current_state.py:633`](../../src/orchestrator/knowledge/current_state.py#L633)

- **Called by** (1): [`_render_developer`](../../src/orchestrator/knowledge/current_state.py#L714)

### `_documentation_section`

[`src/orchestrator/knowledge/current_state.py:686`](../../src/orchestrator/knowledge/current_state.py#L686)

- **Called by** (1): [`_render_developer`](../../src/orchestrator/knowledge/current_state.py#L714)

### `_entry_points`

[`src/orchestrator/knowledge/current_state.py:384`](../../src/orchestrator/knowledge/current_state.py#L384)

- **Called by** (1): [`compute_current_state`](../../src/orchestrator/knowledge/current_state.py#L195)
- **Calls** (2): [`_is_test_path`](../../src/orchestrator/knowledge/current_state.py#L410), `loads`

### `_infrastructure_section`

[`src/orchestrator/knowledge/current_state.py:668`](../../src/orchestrator/knowledge/current_state.py#L668)

- **Called by** (1): [`_render_developer`](../../src/orchestrator/knowledge/current_state.py#L714)

### `_is_framework`

[`src/orchestrator/knowledge/current_state.py:91`](../../src/orchestrator/knowledge/current_state.py#L91)

- **Called by** (1): [`compute_current_state`](../../src/orchestrator/knowledge/current_state.py#L195)

### `_is_generated`

[`src/orchestrator/knowledge/current_state.py:87`](../../src/orchestrator/knowledge/current_state.py#L87)

- **Called by** (1 production · 1 test): [`compute_current_state`](../../src/orchestrator/knowledge/current_state.py#L195), [`test_vendored_and_generated_paths_excluded`](../../tests/knowledge/test_current_state.py#L202)
- **Calls** (1): [`_is_generated_path`](../../src/orchestrator/knowledge/current_state.py#L80)

### `_is_generated_path`

[`src/orchestrator/knowledge/current_state.py:80`](../../src/orchestrator/knowledge/current_state.py#L80)

- **Called by** (2): [`_is_generated`](../../src/orchestrator/knowledge/current_state.py#L87), [`_recent_areas`](../../src/orchestrator/knowledge/current_state.py#L169)

### `_is_interface`

[`src/orchestrator/knowledge/current_state.py:95`](../../src/orchestrator/knowledge/current_state.py#L95)

- **Called by** (2): [`_layer`](../../src/orchestrator/knowledge/current_state.py#L100), [`compute_current_state`](../../src/orchestrator/knowledge/current_state.py#L195)

### `_is_test_path`

[`src/orchestrator/knowledge/current_state.py:410`](../../src/orchestrator/knowledge/current_state.py#L410)

- **Called by** (1): [`_entry_points`](../../src/orchestrator/knowledge/current_state.py#L384)

### `_layer`

[`src/orchestrator/knowledge/current_state.py:100`](../../src/orchestrator/knowledge/current_state.py#L100)

- **Called by** (1): [`compute_current_state`](../../src/orchestrator/knowledge/current_state.py#L195)
- **Calls** (1): [`_is_interface`](../../src/orchestrator/knowledge/current_state.py#L95)

### `_mid`

[`src/orchestrator/knowledge/current_state.py:444`](../../src/orchestrator/knowledge/current_state.py#L444)

- **Called by** (1): [`architecture_mermaid`](../../src/orchestrator/knowledge/current_state.py#L526)
- **Calls** (1): `sub`

### `_overview`

[`src/orchestrator/knowledge/current_state.py:616`](../../src/orchestrator/knowledge/current_state.py#L616)

- **Called by** (2): [`_overview_section`](../../src/orchestrator/knowledge/report_html.py#L96), [`_render_developer`](../../src/orchestrator/knowledge/current_state.py#L714)
- **Calls** (1): [`_app_type`](../../src/orchestrator/knowledge/current_state.py#L606)

### `_recent_areas`

[`src/orchestrator/knowledge/current_state.py:169`](../../src/orchestrator/knowledge/current_state.py#L169)

- **Called by** (1): [`compute_current_state`](../../src/orchestrator/knowledge/current_state.py#L195)
- **Calls** (3): [`_is_generated_path`](../../src/orchestrator/knowledge/current_state.py#L80), `collections.Counter`, `run`

### `_recommend`

[`src/orchestrator/knowledge/current_state.py:416`](../../src/orchestrator/knowledge/current_state.py#L416)

- **Called by** (1): [`compute_current_state`](../../src/orchestrator/knowledge/current_state.py#L195)
- **Documented in**: `docs/specs/shareable-report-spec.md#report-content`

### `_render_developer`

[`src/orchestrator/knowledge/current_state.py:714`](../../src/orchestrator/knowledge/current_state.py#L714)

- **Called by** (1): [`render_current_state`](../../src/orchestrator/knowledge/current_state.py#L569)
- **Calls** (5): [`_code_structure`](../../src/orchestrator/knowledge/current_state.py#L633), [`_documentation_section`](../../src/orchestrator/knowledge/current_state.py#L686), [`_infrastructure_section`](../../src/orchestrator/knowledge/current_state.py#L668), [`_overview`](../../src/orchestrator/knowledge/current_state.py#L616), [`architecture_mermaid`](../../src/orchestrator/knowledge/current_state.py#L526)

### `_render_stakeholder`

[`src/orchestrator/knowledge/current_state.py:576`](../../src/orchestrator/knowledge/current_state.py#L576)

- **Called by** (1): [`render_current_state`](../../src/orchestrator/knowledge/current_state.py#L569)

### `_zone_label`

[`src/orchestrator/knowledge/current_state.py:457`](../../src/orchestrator/knowledge/current_state.py#L457)

_No relationships extracted — nothing in the graph calls it or extends it._

### `architecture_clusters`

[`src/orchestrator/knowledge/current_state.py:496`](../../src/orchestrator/knowledge/current_state.py#L496)

- **Called by** (2): [`architecture_mermaid`](../../src/orchestrator/knowledge/current_state.py#L526), [`architecture_svg`](../../src/orchestrator/knowledge/report_svg.py#L73)
- **Calls** (5): [`communities_by_id`](../../src/orchestrator/knowledge/clustering.py#L135), [`detect_communities`](../../src/orchestrator/knowledge/clustering.py#L82), [`is_test_area`](../../src/orchestrator/knowledge/current_state.py#L71), [`modularity`](../../src/orchestrator/knowledge/clustering.py#L143), [`significant_edges`](../../src/orchestrator/knowledge/clustering.py#L55)
- **Documented in**: `docs/specs/gap5-visualization-roadmap.md#phase-2-shipped-exit-criterion-met-scope-deliberately-trimmed`

### `architecture_graph`

[`src/orchestrator/knowledge/current_state.py:461`](../../src/orchestrator/knowledge/current_state.py#L461)

- **Called by** (3): [`_architecture_section`](../../src/orchestrator/knowledge/report_html.py#L100), [`architecture_mermaid`](../../src/orchestrator/knowledge/current_state.py#L526), [`architecture_svg`](../../src/orchestrator/knowledge/report_svg.py#L73)
- **Documented in**: `CHANGELOG.md`, `docs/specs/gap5-visualization-roadmap.md#phase-2-shipped-exit-criterion-met-scope-deliberately-trimmed`

### `architecture_mermaid`

[`src/orchestrator/knowledge/current_state.py:526`](../../src/orchestrator/knowledge/current_state.py#L526)

- **Called by** (2): [`_render_developer`](../../src/orchestrator/knowledge/current_state.py#L714), [`_system_architecture_block`](../../src/orchestrator/knowledge/renderers.py#L1014)
- **Calls** (4): [`_mid`](../../src/orchestrator/knowledge/current_state.py#L444), [`architecture_clusters`](../../src/orchestrator/knowledge/current_state.py#L496), [`architecture_graph`](../../src/orchestrator/knowledge/current_state.py#L461), `collections.defaultdict`

### `build_current_state`

[`src/orchestrator/knowledge/current_state.py:859`](../../src/orchestrator/knowledge/current_state.py#L859)

- **Called by** (3 production · 2 test): [`_compute`](../../src/orchestrator/sdlc/comprehension.py#L31), [`adapter`](../../src/orchestrator/registry/api/capabilities.py#L261), [`state`](../../src/orchestrator/cli.py#L2212), [`test_build_current_state_end_to_end_python`](../../tests/knowledge/test_current_state.py#L193), [`test_infrastructure_section_from_real_repo`](../../tests/knowledge/test_current_state.py#L108)
- **Calls** (2): [`load_current_state`](../../src/orchestrator/knowledge/current_state.py#L841), [`render_current_state`](../../src/orchestrator/knowledge/current_state.py#L569)
- **Documented in**: `docs/specs/comprehension-skill-spec.md#the-tool-surface-new-read-only-mcp-tools`, `docs/specs/comprehension-skill-spec.md#what-already-exists-reuse-dont-rebuild`

### `compute_current_state`

[`src/orchestrator/knowledge/current_state.py:195`](../../src/orchestrator/knowledge/current_state.py#L195)

- **Called by** (1 production · 13 test): [`analyse`](../../src/orchestrator/knowledge/analysis.py#L50), [`_many_area_state`](../../tests/knowledge/test_report_svg.py#L24), [`_state`](../../tests/knowledge/test_report_html.py#L50), [`test_auth_surface_and_recency_degrade`](../../tests/knowledge/test_current_state.py#L183), [`test_blast_radius_coverage_gaps`](../../tests/knowledge/test_report_html.py#L154), [`test_call_graph_hotspots_rendered`](../../tests/knowledge/test_current_state.py#L158), [`test_compute_metrics`](../../tests/knowledge/test_current_state.py#L53), [`test_developer_lens_renders_sections`](../../tests/knowledge/test_current_state.py#L91), [`test_documentation_metrics_and_section`](../../tests/knowledge/test_current_state.py#L64), [`test_function_areas_group_by_owning_module_not_symbol_id`](../../tests/knowledge/test_current_state.py#L134), [`test_no_documentation_section_without_docs`](../../tests/knowledge/test_current_state.py#L77), [`test_recommendations_flag_tests_and_fat_controller`](../../tests/knowledge/test_current_state.py#L83), [`test_spotlight_uses_graph_when_store_given`](../../tests/knowledge/test_report_html.py#L144), [`test_stakeholder_lens_is_plain_language`](../../tests/knowledge/test_current_state.py#L175)
- **Calls** (12): [`CurrentState`](../../src/orchestrator/knowledge/current_state.py#L118), [`_entry_points`](../../src/orchestrator/knowledge/current_state.py#L384), [`_is_framework`](../../src/orchestrator/knowledge/current_state.py#L91), [`_is_generated`](../../src/orchestrator/knowledge/current_state.py#L87), [`_is_interface`](../../src/orchestrator/knowledge/current_state.py#L95), [`_layer`](../../src/orchestrator/knowledge/current_state.py#L100), [`_recent_areas`](../../src/orchestrator/knowledge/current_state.py#L169), [`_recommend`](../../src/orchestrator/knowledge/current_state.py#L416), `collections.Counter`, [`detect_infrastructure`](../../src/orchestrator/knowledge/infrastructure.py#L170), [`doc_drift`](../../src/orchestrator/pkg/doc_link.py#L69), [`is_test_area`](../../src/orchestrator/knowledge/current_state.py#L71)

### `is_test_area`

[`src/orchestrator/knowledge/current_state.py:71`](../../src/orchestrator/knowledge/current_state.py#L71)

- **Called by** (2 production · 1 test): [`architecture_clusters`](../../src/orchestrator/knowledge/current_state.py#L496), [`compute_current_state`](../../src/orchestrator/knowledge/current_state.py#L195), [`test_coverage_counts_components_a_test_imports`](../../tests/knowledge/test_shared_analysis.py#L108)
- **Calls** (1): [`zone_of`](../../src/orchestrator/knowledge/areas.py#L36)

### `load_current_state`

[`src/orchestrator/knowledge/current_state.py:841`](../../src/orchestrator/knowledge/current_state.py#L841)

- **Called by** (4): [`_render_state_html`](../../src/orchestrator/cli.py#L2272), [`build_current_state`](../../src/orchestrator/knowledge/current_state.py#L859), [`run`](../../src/orchestrator/plugin/server.py#L781), [`run`](../../src/orchestrator/plugin/server.py#L350)
- **Calls** (1): [`analyse`](../../src/orchestrator/knowledge/analysis.py#L50)
- **Documented in**: `docs/specs/comprehension-skill-spec.md#the-tool-surface-new-read-only-mcp-tools`, `docs/specs/comprehension-skill-spec.md#what-already-exists-reuse-dont-rebuild`

### `render_current_state`

[`src/orchestrator/knowledge/current_state.py:569`](../../src/orchestrator/knowledge/current_state.py#L569)

- **Called by** (2 production · 8 test): [`build_current_state`](../../src/orchestrator/knowledge/current_state.py#L859), [`run`](../../src/orchestrator/plugin/server.py#L350), [`test_auth_surface_and_recency_degrade`](../../tests/knowledge/test_current_state.py#L183), [`test_both_surfaces_read_the_same_analysis`](../../tests/knowledge/test_shared_analysis.py#L65), [`test_call_graph_hotspots_rendered`](../../tests/knowledge/test_current_state.py#L158), [`test_developer_lens_renders_sections`](../../tests/knowledge/test_current_state.py#L91), [`test_documentation_metrics_and_section`](../../tests/knowledge/test_current_state.py#L64), [`test_git_churn_stays_out_of_the_committed_bank`](../../tests/knowledge/test_shared_analysis.py#L128), [`test_no_documentation_section_without_docs`](../../tests/knowledge/test_current_state.py#L77), [`test_stakeholder_lens_is_plain_language`](../../tests/knowledge/test_current_state.py#L175)
- **Calls** (2): [`_render_developer`](../../src/orchestrator/knowledge/current_state.py#L714), [`_render_stakeholder`](../../src/orchestrator/knowledge/current_state.py#L576)

## Imports

`__future__.annotations`, `collections.Counter`, `collections.defaultdict`, `dataclasses.dataclass`, `dataclasses.field`, [`orchestrator.catalog.profile`](../../src/orchestrator/catalog/profile.py#L1), [`orchestrator.knowledge.analysis`](../../src/orchestrator/knowledge/analysis.py#L1), [`orchestrator.knowledge.areas`](../../src/orchestrator/knowledge/areas.py#L1), [`orchestrator.knowledge.clustering`](../../src/orchestrator/knowledge/clustering.py#L1), [`orchestrator.knowledge.infrastructure`](../../src/orchestrator/knowledge/infrastructure.py#L1), [`orchestrator.pkg.doc_link`](../../src/orchestrator/pkg/doc_link.py#L1), [`orchestrator.pkg.facts`](../../src/orchestrator/pkg/facts.py#L1), `pathlib.Path`, `re`, `subprocess`, `tomllib`, `typing.TYPE_CHECKING`

## Imported by

[`orchestrator.cli`](orchestrator.cli.md), [`orchestrator.knowledge.analysis`](../../src/orchestrator/knowledge/analysis.py#L1), [`orchestrator.knowledge.renderers`](orchestrator.knowledge.renderers.md), [`orchestrator.knowledge.report_html`](orchestrator.knowledge.report_html.md), [`orchestrator.knowledge.report_svg`](../../src/orchestrator/knowledge/report_svg.py#L1), [`orchestrator.plugin.server`](orchestrator.plugin.server.md), [`orchestrator.registry.api.capabilities`](orchestrator.registry.api.capabilities.md), [`orchestrator.sdlc.comprehension`](../../src/orchestrator/sdlc/comprehension.py#L1), [`tests.knowledge.test_current_state`](../../tests/knowledge/test_current_state.py#L1), [`tests.knowledge.test_report_html`](../../tests/knowledge/test_report_html.py#L1), [`tests.knowledge.test_report_svg`](../../tests/knowledge/test_report_svg.py#L1), [`tests.knowledge.test_report_svg_clusters`](../../tests/knowledge/test_report_svg_clusters.py#L1), [`tests.knowledge.test_shared_analysis`](../../tests/knowledge/test_shared_analysis.py#L1)
