Private
Public Access
0
0

latest audit

This commit is contained in:
2026-06-24 17:02:55 -04:00
parent 7c352e1c30
commit 1caeca4ec4
13 changed files with 6410 additions and 0 deletions
@@ -0,0 +1,92 @@
# Aggregate Profile: ChatMessage
**Aggregate kind:** candidate_dataclass
**Memory dim:** discussion
**Is candidate:** True
## Pipeline summary
- Producers: 0
- Consumers: 0
- Distinct producer fqnames: 0
- Distinct consumer fqnames: 0
- Access pattern (aggregate): mixed
- Frequency (aggregate): unknown
- Decomposition direction: insufficient_data
- Struct field count (estimated): 0
## Producers (0)
_(none)_
## Consumers (0)
_(none)_
## Field access matrix
_(no field accesses detected)_
## Access pattern
**Dominant pattern:** mixed
**Evidence count:** 0
## SSDL Sketch for ChatMessage
_(placeholder; candidate aggregate)_
## Frequency
**Dominant frequency:** unknown
**Evidence count:** 0
## Result coverage
**Summary:**
| metric | value |
|---|---|
| total producers | 0 |
| result producers | 0 |
| total consumers | 0 |
| result consumers | 0 |
## Type alias coverage
**Summary:**
| metric | value |
|---|---|
| total field-access sites | 0 |
| typed sites (canonical field) | 0 |
| untyped sites (wildcard) | 0 |
## Cross-audit findings
_(no cross-audit findings mapped to this aggregate)_
## Decomposition cost
**Current cost estimate:** 0 us/turn
**Componentize savings:** 0 us/turn
**Unify savings:** 0 us/turn
**Recommended direction:** insufficient_data
**Rationale:** candidate aggregate; would be detected after any_type_componentization_20260621 merges
**Struct field count (estimated):** 0
**Struct frozen:** False
## Struct shape (inferred from producer returns)
_(no producers; cannot infer shape)_
## Optimization candidates
_(no optimization candidates generated)_
## Verdict
candidate aggregate; would be detected after any_type_componentization_20260621 merges
## Evidence appendix
@@ -0,0 +1,173 @@
# Aggregate Profile: CommsLog
**Aggregate kind:** typealias
**Memory dim:** discussion
**Is candidate:** False
## Pipeline summary
- Producers: 6
- Consumers: 5
- Distinct producer fqnames: 6
- Distinct consumer fqnames: 5
- Access pattern (aggregate): whole_struct
- Frequency (aggregate): per_turn
- Decomposition direction: hold
- Struct field count (estimated): 5
## Producers (6)
### `src\ai_client.py` (4 producers)
- `src.ai_client._list_minimax_models_result` (line 2436)
- `src.ai_client._list_gemini_models_result` (line 1626)
- `src.ai_client._set_minimax_provider_result` (line 398)
- `src.ai_client._list_anthropic_models_result` (line 1317)
### `src\gui_2.py` (2 producers)
- `src.gui_2._drain_normalize_errors` (line 7417)
- `src.gui_2._render_beads_tab_list_result` (line 8314)
## Consumers (5)
### `src\app_controller.py` (3 consumers)
- `src.app_controller._symbol_resolution_result` (line 3506)
- `src.app_controller._topological_sort_tickets_result` (line 4708)
- `src.app_controller._serialize_tool_calls_result` (line 2217)
### `src\gui_2.py` (1 consumer)
- `src.gui_2.__init__` (line 7550)
### `src\project_manager.py` (1 consumer)
- `src.project_manager.calculate_track_progress` (line 420)
## Field access matrix
| consumer | _attr_name | _cached | _module_name | _report_worker_error |
|---|---|---|---|---|
| `_symbol_resolution_result` | . | . | . | . |
| `_topological_sort_tickets_result` | . | . | . | 1 |
| `_serialize_tool_calls_result` | . | . | . | . |
| `calculate_track_progress` | . | . | . | . |
| `__init__` | 1 | 1 | 1 | . |
## Access pattern
**Dominant pattern:** whole_struct
**Evidence count:** 5
**Per-function pattern distribution:**
- `whole_struct`: 4 functions (80%)
- `field_by_field`: 1 functions (20%)
## SSDL Sketch for `CommsLog`
```
[Q:CommsLog entry-point] -> [Q:PCG lookup]
-> [1: _symbol_resolution_result] [B:check] (branches=4)
-> [2: _topological_sort_tickets_result] [B:check] (branches=2)
-> [3: _serialize_tool_calls_result] [B:check] (branches=2)
-> [4: calculate_track_progress] [B:check] (branches=1)
-> [5: __init__] [B:check] (branches=0)
-> [T:done]
```
**Effective codepaths:** 27 (sum of 2^branches across 5 consumers)
**Total branch points:** 9
**Nil-check functions:** 0
**Defusing opportunities:**
- **Immediate-Mode Cache `[Q:key] -> [I:FetchCached] -> [T]`**: Introduce a `commslog_cache` keyed lookup. Consumers request by key, get cached value, no field-existence checks. Reduces 4 field-check branches to 1 cache lookup.
- Effective codepaths: 27 -> 4
## Frequency
**Dominant frequency:** per_turn
**Evidence count:** 5
**Per-function frequency distribution:**
- `per_turn`: 5 functions
## Result coverage
**Summary:** 6 producers, 5 consumers
| metric | value |
|---|---|
| total producers | 6 |
| result producers | 6 |
| total consumers | 5 |
| result consumers | 0 |
## Type alias coverage
**Summary:** 4 sites; 0 typed (0%); 4 untyped (100%)
| metric | value |
|---|---|
| total field-access sites | 4 |
| typed sites (canonical field) | 0 |
| untyped sites (wildcard) | 4 |
## Cross-audit findings
| bucket | audit script | site count | example file | example line | note |
|---|---|---|---|---|---|
| optional_in_baseline | `audit_optional_in_3_files` | 76 | `src\ai_client.py` | 159 | 76 sites |
## Decomposition cost
**Current cost estimate:** 470 us/turn
**Componentize savings:** 0 us/turn
**Unify savings:** 70 us/turn
**Recommended direction:** hold
**Rationale:** CommsLog: access_pattern=whole_struct, frequency=per_turn, struct_field_count=5, struct_frozen=True. Recommended: hold because the current shape matches the access pattern.
**Struct field count (estimated):** 5
**Struct frozen:** True
## Struct shape (inferred from producer returns)
| field | access count | access pattern |
|---|---|---|
| `_report_worker_error` | 1 | used |
| `_module_name` | 1 | used |
| `_attr_name` | 1 | used |
| `_cached` | 1 | used |
## Optimization candidates
_(no optimization candidates generated)_
## Verdict
CommsLog: access_pattern=whole_struct, frequency=per_turn, struct_field_count=5, struct_frozen=True. Recommended: hold because the current shape matches the access pattern.
## Evidence appendix
### Access pattern evidence
| function | pattern | field_accesses | confidence |
|---|---|---|---|
| `src.app_controller._symbol_resolution_result` | `whole_struct` | | low |
| `src.app_controller._topological_sort_tickets_result` | `whole_struct` | `_report_worker_error`=1 | high |
| `src.app_controller._serialize_tool_calls_result` | `whole_struct` | | low |
| `src.project_manager.calculate_track_progress` | `whole_struct` | | low |
| `src.gui_2.__init__` | `field_by_field` | `_module_name`=1, `_attr_name`=1, `_cached`=1 | high |
### Frequency evidence
| function | frequency | source | note |
|---|---|---|---|
| `src.gui_2._drain_normalize_errors` | `per_turn` | `static_analysis` | producer from src\gui_2.py |
| `src.ai_client._list_minimax_models_result` | `per_turn` | `static_analysis` | producer from src\ai_client.py |
| `src.ai_client._list_gemini_models_result` | `per_turn` | `static_analysis` | producer from src\ai_client.py |
| `src.gui_2._render_beads_tab_list_result` | `per_turn` | `static_analysis` | producer from src\gui_2.py |
| `src.ai_client._set_minimax_provider_result` | `per_turn` | `static_analysis` | producer from src\ai_client.py |
@@ -0,0 +1,559 @@
# Aggregate Profile: CommsLogEntry
**Aggregate kind:** typealias
**Memory dim:** discussion
**Is candidate:** False
## Pipeline summary
- Producers: 117
- Consumers: 66
- Distinct producer fqnames: 96
- Distinct consumer fqnames: 46
- Access pattern (aggregate): whole_struct
- Frequency (aggregate): per_turn
- Decomposition direction: hold
- Struct field count (estimated): 10
## Producers (117)
### `src\aggregate.py` (1 producer)
- `src.aggregate.build_file_items` (line 158)
### `src\ai_client.py` (16 producers)
- `src.ai_client._load_credentials` (line 282)
- `src.ai_client._pre_dispatch` (line 2089)
- `src.ai_client.get_comms_log` (line 273)
- `src.ai_client.get_gemini_cache_stats` (line 1604)
- `src.ai_client._add_bleed_derived` (line 3332)
- `src.ai_client._get_anthropic_tools` (line 664)
- `src.ai_client._dashscope_call` (line 2716)
- `src.ai_client._extract_dashscope_tool_calls` (line 2754)
- `src.ai_client._send_cli_round_result` (line 1746)
- `src.ai_client._parse_tool_args_result` (line 741)
- `src.ai_client._content_block_to_dict` (line 1200)
- `src.ai_client.ollama_chat` (line 2938)
- `src.ai_client._get_deepseek_tools` (line 1194)
- `src.ai_client._strip_private_keys` (line 1464)
- `src.ai_client._build_chunked_context_blocks` (line 1281)
- `src.ai_client.get_token_stats` (line 3185)
### `src\api_hook_client.py` (39 producers)
- `src.api_hook_client.post_project` (line 470)
- `src.api_hook_client.drag` (line 230)
- `src.api_hook_client.set_value` (line 212)
- `src.api_hook_client.get_financial_metrics` (line 520)
- `src.api_hook_client.get_gui_health` (line 434)
- `src.api_hook_client.select_list_item` (line 256)
- `src.api_hook_client.get_mma_status` (line 539)
- `src.api_hook_client.get_project_switch_status` (line 374)
- `src.api_hook_client.get_performance` (line 318)
- `src.api_hook_client.get_patch_status` (line 295)
- `src.api_hook_client.get_startup_timeline` (line 353)
- `src.api_hook_client.get_events` (line 124)
- `src.api_hook_client.get_gui_state` (line 165)
- `src.api_hook_client.click` (line 223)
- `src.api_hook_client.get_node_status` (line 532)
- `src.api_hook_client.reject_patch` (line 288)
- `src.api_hook_client.get_project` (line 367)
- `src.api_hook_client.get_warmup_status` (line 325)
- `src.api_hook_client.right_click` (line 237)
- `src.api_hook_client.get_io_pool_status` (line 420)
- `src.api_hook_client.push_event` (line 156)
- `src.api_hook_client.get_warmup_wait` (line 332)
- `src.api_hook_client.get_status` (line 105)
- `src.api_hook_client._make_request` (line 65)
- `src.api_hook_client.wait_for_project_switch` (line 389)
- `src.api_hook_client.apply_patch` (line 281)
- `src.api_hook_client.get_context_state` (line 491)
- `src.api_hook_client.post_project` (line 473)
- `src.api_hook_client.get_warmup_canaries` (line 342)
- `src.api_hook_client.trigger_patch` (line 274)
- `src.api_hook_client.clear_events` (line 129)
- `src.api_hook_client.post_session` (line 117)
- `src.api_hook_client.get_session` (line 502)
- `src.api_hook_client.get_mma_workers` (line 546)
- `src.api_hook_client.get_gui_diagnostics` (line 311)
- `src.api_hook_client.post_gui` (line 149)
- `src.api_hook_client.get_system_telemetry` (line 524)
- `src.api_hook_client.select_tab` (line 263)
- `src.api_hook_client.wait_for_event` (line 136)
### `src\app_controller.py` (30 producers)
- `src.app_controller.wait` (line 5205)
- `src.app_controller.get_mma_status` (line 2835)
- `src.app_controller._api_get_performance` (line 195)
- `src.app_controller.get_performance` (line 2856)
- `src.app_controller.get_diagnostics` (line 2862)
- `src.app_controller.load_config` (line 5142)
- `src.app_controller._api_get_context` (line 398)
- `src.app_controller._api_status` (line 209)
- `src.app_controller.generate` (line 2868)
- `src.app_controller._api_generate` (line 221)
- `src.app_controller._api_token_stats` (line 417)
- `src.app_controller._api_get_gui_state` (line 123)
- `src.app_controller._api_get_diagnostics` (line 202)
- `src.app_controller.get_api_session` (line 2847)
- `src.app_controller.token_stats` (line 2898)
- `src.app_controller._api_get_api_session` (line 170)
- `src.app_controller._offload_entry_payload` (line 4240)
- `src.app_controller._pending_mma_spawn` (line 2772)
- `src.app_controller._api_pending_actions` (line 335)
- `src.app_controller.get_context` (line 2892)
- `src.app_controller.get_session` (line 2883)
- `src.app_controller.status` (line 2865)
- `src.app_controller.get_session_insights` (line 3049)
- `src.app_controller._api_get_api_project` (line 188)
- `src.app_controller._api_get_mma_status` (line 144)
- `src.app_controller._pending_mma_approval` (line 2776)
- `src.app_controller.get_api_project` (line 2853)
- `src.app_controller.pending_actions` (line 2874)
- `src.app_controller.get_gui_state` (line 2829)
- `src.app_controller._api_get_session` (line 374)
### `src\models.py` (23 producers)
- `src.models.to_dict` (line 646)
- `src.models.to_dict` (line 1000)
- `src.models.to_dict` (line 672)
- `src.models.to_dict` (line 938)
- `src.models.to_dict` (line 855)
- `src.models.to_dict` (line 441)
- `src.models.to_dict` (line 406)
- `src.models.to_dict` (line 355)
- `src.models.parse_history_entries` (line 214)
- `src.models.to_dict` (line 737)
- `src.models.to_dict` (line 486)
- `src.models.to_dict` (line 913)
- `src.models.to_dict` (line 596)
- `src.models.to_dict` (line 794)
- `src.models.to_dict` (line 558)
- `src.models.to_dict` (line 971)
- `src.models.to_dict` (line 1024)
- `src.models.to_dict` (line 288)
- `src.models.to_dict` (line 701)
- `src.models.to_dict` (line 886)
- `src.models.to_dict` (line 1059)
- `src.models._load_config_from_disk` (line 186)
- `src.models.to_dict` (line 618)
### `src\project_manager.py` (8 producers)
- `src.project_manager.load_history` (line 209)
- `src.project_manager.default_project` (line 123)
- `src.project_manager.migrate_from_legacy_config` (line 253)
- `src.project_manager.load_project` (line 186)
- `src.project_manager.get_all_tracks` (line 342)
- `src.project_manager.default_discussion` (line 117)
- `src.project_manager.flat_config` (line 267)
- `src.project_manager.str_to_entry` (line 75)
## Consumers (66)
### `src\aggregate.py` (5 consumers)
- `src.aggregate.build_tier3_context` (line 382)
- `src.aggregate.build_markdown_from_items` (line 348)
- `src.aggregate._build_files_section_from_items` (line 300)
- `src.aggregate.build_markdown_no_history` (line 366)
- `src.aggregate.run` (line 479)
### `src\ai_client.py` (29 consumers)
- `src.ai_client._strip_cache_controls` (line 1291)
- `src.ai_client._send_anthropic` (line 1405)
- `src.ai_client._estimate_prompt_tokens` (line 1243)
- `src.ai_client._strip_private_keys` (line 1464)
- `src.ai_client._trim_anthropic_history` (line 1353)
- `src.ai_client._add_history_cache_breakpoint` (line 1299)
- `src.ai_client._send_gemini_cli` (line 2019)
- `src.ai_client._repair_anthropic_history` (line 1381)
- `src.ai_client._create_gemini_cache_result` (line 1706)
- `src.ai_client._dashscope_call` (line 2716)
- `src.ai_client._send_grok` (line 2530)
- `src.ai_client._execute_single_tool_call_async` (line 945)
- `src.ai_client._repair_deepseek_history` (line 2138)
- `src.ai_client._add_bleed_derived` (line 3332)
- `src.ai_client._append_comms` (line 257)
- `src.ai_client._send_llama_native` (line 2958)
- `src.ai_client.send` (line 3208)
- `src.ai_client._estimate_message_tokens` (line 1218)
- `src.ai_client._pre_dispatch` (line 2089)
- `src.ai_client._send_gemini` (line 1802)
- `src.ai_client._send_minimax` (line 2616)
- `src.ai_client._send_deepseek` (line 2165)
- `src.ai_client._trim_minimax_history` (line 2482)
- `src.ai_client.ollama_chat` (line 2938)
- `src.ai_client._send_llama` (line 2858)
- `src.ai_client._invalidate_token_estimate` (line 1240)
- `src.ai_client._repair_minimax_history` (line 2462)
- `src.ai_client._send_qwen` (line 2773)
- `src.ai_client._strip_stale_file_refreshes` (line 1253)
### `src\app_controller.py` (5 consumers)
- `src.app_controller._start_track_logic_result` (line 4728)
- `src.app_controller._offload_entry_payload` (line 4240)
- `src.app_controller._start_track_logic` (line 4721)
- `src.app_controller._refresh_api_metrics` (line 3074)
- `src.app_controller._on_comms_entry` (line 4282)
### `src\models.py` (22 consumers)
- `src.models.from_dict` (line 603)
- `src.models.from_dict` (line 416)
- `src.models.from_dict` (line 506)
- `src.models.from_dict` (line 814)
- `src.models.from_dict` (line 893)
- `src.models._save_config_to_disk` (line 199)
- `src.models.from_dict` (line 378)
- `src.models.from_dict` (line 1007)
- `src.models.from_dict` (line 1038)
- `src.models.from_dict` (line 866)
- `src.models.from_dict` (line 712)
- `src.models.from_dict` (line 747)
- `src.models.from_dict` (line 683)
- `src.models.from_dict` (line 575)
- `src.models.from_dict` (line 630)
- `src.models.from_dict` (line 454)
- `src.models.from_dict` (line 949)
- `src.models.from_dict` (line 982)
- `src.models.from_dict` (line 656)
- `src.models.from_dict` (line 1072)
- `src.models.from_dict` (line 295)
- `src.models.from_dict` (line 920)
### `src\project_manager.py` (5 consumers)
- `src.project_manager.format_discussion` (line 69)
- `src.project_manager.flat_config` (line 267)
- `src.project_manager.entry_to_str` (line 49)
- `src.project_manager.save_project` (line 229)
- `src.project_manager.migrate_from_legacy_config` (line 253)
## Field access matrix
| consumer | _est_tokens | _gemini_cache_text | _pending_gui_tasks | _pending_gui_tasks_lock | _recalculate_session_usage | _start_track_logic_result | _token_stats | _topological_sort_tickets_result | _update_cached_stats | active_discussion | active_project_path | active_project_root | ai_status | append | config | content | context_files | encode | engines | error |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `build_tier3_context` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_strip_cache_controls` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `_send_anthropic` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_estimate_prompt_tokens` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_start_track_logic_result` | . | . | 2 | 2 | . | . | . | 1 | . | 1 | 1 | 1 | 4 | . | 1 | . | 1 | . | 1 | . |
| `_strip_private_keys` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_trim_anthropic_history` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_add_history_cache_breakpoint` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `build_markdown_from_items` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_send_gemini_cli` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_repair_anthropic_history` | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . | . | . |
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `format_discussion` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_create_gemini_cache_result` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_dashscope_call` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_send_grok` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_offload_entry_payload` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `_save_config_to_disk` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `_execute_single_tool_call_async` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `_repair_deepseek_history` | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . | . | . |
| `_add_bleed_derived` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `flat_config` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_build_files_section_from_items` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_append_comms` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_send_llama_native` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `send` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . | . |
| `_start_track_logic` | . | . | . | . | . | 1 | . | . | . | . | . | . | 1 | . | . | . | . | . | . | . |
| `build_markdown_no_history` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `_estimate_message_tokens` | 1 | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_pre_dispatch` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `_send_gemini` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . |
| `_send_minimax` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_refresh_api_metrics` | . | 1 | . | . | 1 | . | 1 | . | 1 | . | . | . | . | . | . | . | . | . | . | 2 |
| `_send_deepseek` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_trim_minimax_history` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `entry_to_str` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `ollama_chat` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `_send_llama` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
_... 24 more fields_
## Access pattern
**Dominant pattern:** whole_struct
**Evidence count:** 50
**Per-function pattern distribution:**
- `whole_struct`: 30 functions (60%)
- `mixed`: 17 functions (34%)
- `field_by_field`: 3 functions (6%)
## SSDL Sketch for `CommsLogEntry`
```
[Q:CommsLogEntry entry-point] -> [Q:PCG lookup]
-> [1: from_dict] [B:check] (branches=0)
-> [2: build_tier3_context] [B:check] (branches=50)
-> [3: _strip_cache_controls] [B:check] (branches=4)
-> [4: from_dict] [B:check] (branches=0)
-> [5: from_dict] [B:check] (branches=0)
-> [6: _send_anthropic] [B:is None?] (branches=40) [N:safe]
-> [7: _estimate_prompt_tokens] [B:check] (branches=2)
-> [8: _start_track_logic_result] [B:check] (branches=10)
-> [9: _strip_private_keys] [B:check] (branches=0)
-> [10: _trim_anthropic_history] [B:check] (branches=13)
-> [11: _add_history_cache_breakpoint] [B:check] (branches=5)
-> [12: build_markdown_from_items] [B:check] (branches=9)
-> [13: _send_gemini_cli] [B:is None?] (branches=23) [N:safe]
-> [14: _repair_anthropic_history] [B:check] (branches=6)
-> [15: from_dict] [B:check] (branches=0)
-> [16: format_discussion] [B:check] (branches=0)
-> [17: _create_gemini_cache_result] [B:check] (branches=3)
-> [18: _dashscope_call] [B:check] (branches=5)
-> [19: _send_grok] [B:check] (branches=14)
-> [20: _offload_entry_payload] [B:check] (branches=10)
-> [21: from_dict] [B:check] (branches=0)
-> [22: _save_config_to_disk] [B:check] (branches=1)
-> [23: from_dict] [B:check] (branches=0)
-> [24: _execute_single_tool_call_async] [B:is None?] (branches=15) [N:safe]
-> [25: from_dict] [B:check] (branches=0)
-> [26: _repair_deepseek_history] [B:check] (branches=6)
-> [27: _add_bleed_derived] [B:check] (branches=0)
-> [28: flat_config] [B:check] (branches=2)
-> [29: _build_files_section_from_items] [B:is None?] (branches=5) [N:safe]
-> [30: _append_comms] [B:is None?] (branches=1) [N:safe]
-> [31: _send_llama_native] [B:check] (branches=12)
-> [32: send] [B:check] (branches=19)
-> [33: _start_track_logic] [B:check] (branches=1)
-> [34: build_markdown_no_history] [B:check] (branches=0)
-> [35: from_dict] [B:check] (branches=0)
-> [36: _estimate_message_tokens] [B:is None?] (branches=9) [N:safe]
-> [37: _pre_dispatch] [B:check] (branches=8)
-> [38: from_dict] [B:check] (branches=0)
-> [39: from_dict] [B:check] (branches=0)
-> [40: _send_gemini] [B:is None?] (branches=75) [N:safe]
-> [41: _send_minimax] [B:check] (branches=11)
-> [42: _refresh_api_metrics] [B:is None?] (branches=11) [N:safe]
-> [43: _send_deepseek] [B:check] (branches=71)
-> [44: _trim_minimax_history] [B:check] (branches=8)
-> [45: entry_to_str] [B:check] (branches=3)
-> [46: from_dict] [B:check] (branches=0)
-> [47: from_dict] [B:check] (branches=0)
-> [48: ollama_chat] [B:check] (branches=3)
-> [49: from_dict] [B:check] (branches=0)
-> [50: _send_llama] [B:check] (branches=13)
-> [51: from_dict] [B:check] (branches=0)
-> [52: run] [B:check] (branches=1)
-> [53: _invalidate_token_estimate] [B:check] (branches=0)
-> [54: _on_comms_entry] [B:check] (branches=32)
-> [55: from_dict] [B:check] (branches=0)
-> [56: _repair_minimax_history] [B:check] (branches=10)
-> [57: from_dict] [B:check] (branches=0)
-> [58: from_dict] [B:check] (branches=0)
-> [59: from_dict] [B:check] (branches=0)
-> [60: _send_qwen] [B:check] (branches=9)
-> [61: save_project] [B:is None?] (branches=7) [N:safe]
-> [62: migrate_from_legacy_config] [B:check] (branches=2)
-> [63: from_dict] [B:check] (branches=0)
-> [64: _strip_stale_file_refreshes] [B:check] (branches=12)
-> [65: from_dict] [B:check] (branches=0)
-> [66: from_dict] [B:check] (branches=0)
-> [T:done]
```
**Effective codepaths:** 40140116231395706750390 (sum of 2^branches across 66 consumers)
**Total branch points:** 541
**Nil-check functions:** 9
**Defusing opportunities:**
- **Nil Sentinel `[N]`**: Introduce a module-level `NIL_<AGGREGATE>` sentinel whose field accesses return safe defaults. Replace None checks with the sentinel. Collapses 2^branch_count into ~1.
- Effective codepaths: 40140116231395706750390 -> 40140116231395706750372
- **Immediate-Mode Cache `[Q:key] -> [I:FetchCached] -> [T]`**: Introduce a `commslogentry_cache` keyed lookup. Consumers request by key, get cached value, no field-existence checks. Reduces 110 field-check branches to 1 cache lookup.
- Effective codepaths: 40140116231395706750390 -> 110
- **Generational Handles `[I:ResolveHandle] -> [B:Gen matches?] -> [N|safe]`**: Wrap the aggregate in a generational handle (index + generation). Validation is one comparison; mismatch returns the nil sentinel. Reduces N lifetime branches to 1 handle validation + sentinel return.
- Effective codepaths: 40140116231395706750390 -> 66
## Frequency
**Dominant frequency:** per_turn
**Evidence count:** 5
**Per-function frequency distribution:**
- `per_turn`: 5 functions
## Result coverage
**Summary:** 96 producers, 46 consumers
| metric | value |
|---|---|
| total producers | 96 |
| result producers | 96 |
| total consumers | 46 |
| result consumers | 0 |
## Type alias coverage
**Summary:** 110 sites; 0 typed (0%); 110 untyped (100%)
| metric | value |
|---|---|
| total field-access sites | 110 |
| typed sites (canonical field) | 0 |
| untyped sites (wildcard) | 110 |
## Cross-audit findings
_(no cross-audit findings mapped to this aggregate)_
## Decomposition cost
**Current cost estimate:** 720 us/turn
**Componentize savings:** 0 us/turn
**Unify savings:** 0 us/turn
**Recommended direction:** hold
**Rationale:** CommsLogEntry: access_pattern=whole_struct, frequency=per_turn, struct_field_count=10, struct_frozen=True. Recommended: hold because the current shape matches the access pattern.
**Struct field count (estimated):** 10
**Struct frozen:** True
## Struct shape (inferred from producer returns)
| field | access count | access pattern |
|---|---|---|
| `content` | 13 | hot |
| `marker` | 13 | hot |
| `get` | 7 | hot |
| `ai_status` | 2 | used |
| `config` | 2 | used |
| `pop` | 2 | used |
| `append` | 2 | used |
| `context_files` | 1 | used |
| `_pending_gui_tasks_lock` | 1 | used |
| `_topological_sort_tickets_result` | 1 | used |
| `active_project_root` | 1 | used |
| `event_queue` | 1 | used |
| `engines` | 1 | used |
| `project` | 1 | used |
| `active_discussion` | 1 | used |
| `submit_io` | 1 | used |
| `tracks` | 1 | used |
| `mma_tier_usage` | 1 | used |
| `_pending_gui_tasks` | 1 | used |
| `mma_step_mode` | 1 | used |
| `active_project_path` | 1 | used |
| `items` | 1 | used |
| `estimated_prompt_tokens` | 1 | used |
| `max_prompt_tokens` | 1 | used |
| `utilization_pct` | 1 | used |
| `headroom` | 1 | used |
| `would_trim` | 1 | used |
| `sys_tokens` | 1 | used |
| `tool_tokens` | 1 | used |
| `history_tokens` | 1 | used |
| `search` | 1 | used |
| `_start_track_logic_result` | 1 | used |
| `_est_tokens` | 1 | used |
| `encode` | 1 | used |
| `latency` | 1 | used |
| `_recalculate_session_usage` | 1 | used |
| `_token_stats` | 1 | used |
| `_gemini_cache_text` | 1 | used |
| `vendor_quota` | 1 | used |
| `last_error` | 1 | used |
| `error` | 1 | used |
| `_update_cached_stats` | 1 | used |
| `session_usage` | 1 | used |
| `usage` | 1 | used |
## Optimization candidates
_(no optimization candidates generated)_
## Verdict
CommsLogEntry: access_pattern=whole_struct, frequency=per_turn, struct_field_count=10, struct_frozen=True. Recommended: hold because the current shape matches the access pattern.
## Evidence appendix
### Access pattern evidence
| function | pattern | field_accesses | confidence |
|---|---|---|---|
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.aggregate.build_tier3_context` | `whole_struct` | | low |
| `src.ai_client._strip_cache_controls` | `whole_struct` | | low |
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.ai_client._send_anthropic` | `whole_struct` | | low |
| `src.ai_client._estimate_prompt_tokens` | `whole_struct` | | low |
| `src.app_controller._start_track_logic_result` | `field_by_field` | `ai_status`=4, `context_files`=1, `get`=3, `_pending_gui_tasks_lock`=2, `_topological_sort_tickets_result`=1, `active_project_root`=1, `event_queue`=1, `engines`=1, `project`=1, `active_discussion`=1 (+7 more) | high |
| `src.ai_client._strip_private_keys` | `whole_struct` | | low |
| `src.ai_client._trim_anthropic_history` | `whole_struct` | `pop`=5 | high |
| `src.ai_client._add_history_cache_breakpoint` | `whole_struct` | | low |
| `src.aggregate.build_markdown_from_items` | `whole_struct` | | low |
| `src.ai_client._send_gemini_cli` | `whole_struct` | | low |
| `src.ai_client._repair_anthropic_history` | `whole_struct` | `append`=1 | high |
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.project_manager.format_discussion` | `whole_struct` | | low |
| `src.ai_client._create_gemini_cache_result` | `whole_struct` | | low |
| `src.ai_client._dashscope_call` | `whole_struct` | | low |
| `src.ai_client._send_grok` | `whole_struct` | | low |
| `src.app_controller._offload_entry_payload` | `whole_struct` | | low |
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.models._save_config_to_disk` | `whole_struct` | | low |
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.ai_client._execute_single_tool_call_async` | `mixed` | `get`=2, `items`=1 | high |
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.ai_client._repair_deepseek_history` | `whole_struct` | `append`=1 | high |
| `src.ai_client._add_bleed_derived` | `field_by_field` | `estimated_prompt_tokens`=1, `max_prompt_tokens`=1, `utilization_pct`=1, `headroom`=1, `would_trim`=1, `sys_tokens`=1, `tool_tokens`=1, `history_tokens`=1, `get`=3 | high |
| `src.project_manager.flat_config` | `whole_struct` | `get`=7 | high |
| `src.aggregate._build_files_section_from_items` | `whole_struct` | | low |
| `src.ai_client._append_comms` | `whole_struct` | | low |
| `src.ai_client._send_llama_native` | `whole_struct` | | low |
| `src.ai_client.send` | `mixed` | `config`=1, `search`=1 | high |
| `src.app_controller._start_track_logic` | `mixed` | `_start_track_logic_result`=1, `ai_status`=1 | high |
| `src.aggregate.build_markdown_no_history` | `whole_struct` | | low |
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.ai_client._estimate_message_tokens` | `mixed` | `_est_tokens`=1, `get`=2 | high |
| `src.ai_client._pre_dispatch` | `whole_struct` | | low |
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.ai_client._send_gemini` | `whole_struct` | `encode`=1 | high |
| `src.ai_client._send_minimax` | `whole_struct` | | low |
| `src.app_controller._refresh_api_metrics` | `field_by_field` | `latency`=1, `_recalculate_session_usage`=1, `_token_stats`=1, `get`=2, `_gemini_cache_text`=1, `vendor_quota`=1, `last_error`=1, `error`=2, `_update_cached_stats`=1, `session_usage`=2 (+1 more) | high |
| `src.ai_client._send_deepseek` | `whole_struct` | | low |
| `src.ai_client._trim_minimax_history` | `whole_struct` | `pop`=4 | high |
| `src.project_manager.entry_to_str` | `whole_struct` | `get`=4 | high |
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.ai_client.ollama_chat` | `whole_struct` | | low |
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.ai_client._send_llama` | `whole_struct` | | low |
### Frequency evidence
| function | frequency | source | note |
|---|---|---|---|
| `src.app_controller.wait` | `per_turn` | `static_analysis` | producer from src\app_controller.py |
| `src.api_hook_client.post_project` | `per_turn` | `static_analysis` | producer from src\api_hook_client.py |
| `src.app_controller.get_mma_status` | `per_turn` | `static_analysis` | producer from src\app_controller.py |
| `src.ai_client._load_credentials` | `per_turn` | `static_analysis` | producer from src\ai_client.py |
| `src.ai_client._pre_dispatch` | `per_turn` | `static_analysis` | producer from src\ai_client.py |
@@ -0,0 +1,559 @@
# Aggregate Profile: FileItem
**Aggregate kind:** typealias
**Memory dim:** curation
**Is candidate:** False
## Pipeline summary
- Producers: 117
- Consumers: 66
- Distinct producer fqnames: 96
- Distinct consumer fqnames: 46
- Access pattern (aggregate): whole_struct
- Frequency (aggregate): per_turn
- Decomposition direction: hold
- Struct field count (estimated): 10
## Producers (117)
### `src\aggregate.py` (1 producer)
- `src.aggregate.build_file_items` (line 158)
### `src\ai_client.py` (16 producers)
- `src.ai_client._load_credentials` (line 282)
- `src.ai_client._pre_dispatch` (line 2089)
- `src.ai_client.get_comms_log` (line 273)
- `src.ai_client.get_gemini_cache_stats` (line 1604)
- `src.ai_client._add_bleed_derived` (line 3332)
- `src.ai_client._get_anthropic_tools` (line 664)
- `src.ai_client._dashscope_call` (line 2716)
- `src.ai_client._extract_dashscope_tool_calls` (line 2754)
- `src.ai_client._send_cli_round_result` (line 1746)
- `src.ai_client._parse_tool_args_result` (line 741)
- `src.ai_client._content_block_to_dict` (line 1200)
- `src.ai_client.ollama_chat` (line 2938)
- `src.ai_client._get_deepseek_tools` (line 1194)
- `src.ai_client._strip_private_keys` (line 1464)
- `src.ai_client._build_chunked_context_blocks` (line 1281)
- `src.ai_client.get_token_stats` (line 3185)
### `src\api_hook_client.py` (39 producers)
- `src.api_hook_client.post_project` (line 470)
- `src.api_hook_client.drag` (line 230)
- `src.api_hook_client.set_value` (line 212)
- `src.api_hook_client.get_financial_metrics` (line 520)
- `src.api_hook_client.get_gui_health` (line 434)
- `src.api_hook_client.select_list_item` (line 256)
- `src.api_hook_client.get_mma_status` (line 539)
- `src.api_hook_client.get_project_switch_status` (line 374)
- `src.api_hook_client.get_performance` (line 318)
- `src.api_hook_client.get_patch_status` (line 295)
- `src.api_hook_client.get_startup_timeline` (line 353)
- `src.api_hook_client.get_events` (line 124)
- `src.api_hook_client.get_gui_state` (line 165)
- `src.api_hook_client.click` (line 223)
- `src.api_hook_client.get_node_status` (line 532)
- `src.api_hook_client.reject_patch` (line 288)
- `src.api_hook_client.get_project` (line 367)
- `src.api_hook_client.get_warmup_status` (line 325)
- `src.api_hook_client.right_click` (line 237)
- `src.api_hook_client.get_io_pool_status` (line 420)
- `src.api_hook_client.push_event` (line 156)
- `src.api_hook_client.get_warmup_wait` (line 332)
- `src.api_hook_client.get_status` (line 105)
- `src.api_hook_client._make_request` (line 65)
- `src.api_hook_client.wait_for_project_switch` (line 389)
- `src.api_hook_client.apply_patch` (line 281)
- `src.api_hook_client.get_context_state` (line 491)
- `src.api_hook_client.post_project` (line 473)
- `src.api_hook_client.get_warmup_canaries` (line 342)
- `src.api_hook_client.trigger_patch` (line 274)
- `src.api_hook_client.clear_events` (line 129)
- `src.api_hook_client.post_session` (line 117)
- `src.api_hook_client.get_session` (line 502)
- `src.api_hook_client.get_mma_workers` (line 546)
- `src.api_hook_client.get_gui_diagnostics` (line 311)
- `src.api_hook_client.post_gui` (line 149)
- `src.api_hook_client.get_system_telemetry` (line 524)
- `src.api_hook_client.select_tab` (line 263)
- `src.api_hook_client.wait_for_event` (line 136)
### `src\app_controller.py` (30 producers)
- `src.app_controller.wait` (line 5205)
- `src.app_controller.get_mma_status` (line 2835)
- `src.app_controller._api_get_performance` (line 195)
- `src.app_controller.get_performance` (line 2856)
- `src.app_controller.get_diagnostics` (line 2862)
- `src.app_controller.load_config` (line 5142)
- `src.app_controller._api_get_context` (line 398)
- `src.app_controller._api_status` (line 209)
- `src.app_controller.generate` (line 2868)
- `src.app_controller._api_generate` (line 221)
- `src.app_controller._api_token_stats` (line 417)
- `src.app_controller._api_get_gui_state` (line 123)
- `src.app_controller._api_get_diagnostics` (line 202)
- `src.app_controller.get_api_session` (line 2847)
- `src.app_controller.token_stats` (line 2898)
- `src.app_controller._api_get_api_session` (line 170)
- `src.app_controller._offload_entry_payload` (line 4240)
- `src.app_controller._pending_mma_spawn` (line 2772)
- `src.app_controller._api_pending_actions` (line 335)
- `src.app_controller.get_context` (line 2892)
- `src.app_controller.get_session` (line 2883)
- `src.app_controller.status` (line 2865)
- `src.app_controller.get_session_insights` (line 3049)
- `src.app_controller._api_get_api_project` (line 188)
- `src.app_controller._api_get_mma_status` (line 144)
- `src.app_controller._pending_mma_approval` (line 2776)
- `src.app_controller.get_api_project` (line 2853)
- `src.app_controller.pending_actions` (line 2874)
- `src.app_controller.get_gui_state` (line 2829)
- `src.app_controller._api_get_session` (line 374)
### `src\models.py` (23 producers)
- `src.models.to_dict` (line 646)
- `src.models.to_dict` (line 1000)
- `src.models.to_dict` (line 672)
- `src.models.to_dict` (line 938)
- `src.models.to_dict` (line 855)
- `src.models.to_dict` (line 441)
- `src.models.to_dict` (line 406)
- `src.models.to_dict` (line 355)
- `src.models.parse_history_entries` (line 214)
- `src.models.to_dict` (line 737)
- `src.models.to_dict` (line 486)
- `src.models.to_dict` (line 913)
- `src.models.to_dict` (line 596)
- `src.models.to_dict` (line 794)
- `src.models.to_dict` (line 558)
- `src.models.to_dict` (line 971)
- `src.models.to_dict` (line 1024)
- `src.models.to_dict` (line 288)
- `src.models.to_dict` (line 701)
- `src.models.to_dict` (line 886)
- `src.models.to_dict` (line 1059)
- `src.models._load_config_from_disk` (line 186)
- `src.models.to_dict` (line 618)
### `src\project_manager.py` (8 producers)
- `src.project_manager.load_history` (line 209)
- `src.project_manager.default_project` (line 123)
- `src.project_manager.migrate_from_legacy_config` (line 253)
- `src.project_manager.load_project` (line 186)
- `src.project_manager.get_all_tracks` (line 342)
- `src.project_manager.default_discussion` (line 117)
- `src.project_manager.flat_config` (line 267)
- `src.project_manager.str_to_entry` (line 75)
## Consumers (66)
### `src\aggregate.py` (5 consumers)
- `src.aggregate.build_tier3_context` (line 382)
- `src.aggregate.build_markdown_from_items` (line 348)
- `src.aggregate._build_files_section_from_items` (line 300)
- `src.aggregate.build_markdown_no_history` (line 366)
- `src.aggregate.run` (line 479)
### `src\ai_client.py` (29 consumers)
- `src.ai_client._strip_cache_controls` (line 1291)
- `src.ai_client._send_anthropic` (line 1405)
- `src.ai_client._estimate_prompt_tokens` (line 1243)
- `src.ai_client._strip_private_keys` (line 1464)
- `src.ai_client._trim_anthropic_history` (line 1353)
- `src.ai_client._add_history_cache_breakpoint` (line 1299)
- `src.ai_client._send_gemini_cli` (line 2019)
- `src.ai_client._repair_anthropic_history` (line 1381)
- `src.ai_client._create_gemini_cache_result` (line 1706)
- `src.ai_client._dashscope_call` (line 2716)
- `src.ai_client._send_grok` (line 2530)
- `src.ai_client._execute_single_tool_call_async` (line 945)
- `src.ai_client._repair_deepseek_history` (line 2138)
- `src.ai_client._add_bleed_derived` (line 3332)
- `src.ai_client._append_comms` (line 257)
- `src.ai_client._send_llama_native` (line 2958)
- `src.ai_client.send` (line 3208)
- `src.ai_client._estimate_message_tokens` (line 1218)
- `src.ai_client._pre_dispatch` (line 2089)
- `src.ai_client._send_gemini` (line 1802)
- `src.ai_client._send_minimax` (line 2616)
- `src.ai_client._send_deepseek` (line 2165)
- `src.ai_client._trim_minimax_history` (line 2482)
- `src.ai_client.ollama_chat` (line 2938)
- `src.ai_client._send_llama` (line 2858)
- `src.ai_client._invalidate_token_estimate` (line 1240)
- `src.ai_client._repair_minimax_history` (line 2462)
- `src.ai_client._send_qwen` (line 2773)
- `src.ai_client._strip_stale_file_refreshes` (line 1253)
### `src\app_controller.py` (5 consumers)
- `src.app_controller._start_track_logic_result` (line 4728)
- `src.app_controller._offload_entry_payload` (line 4240)
- `src.app_controller._start_track_logic` (line 4721)
- `src.app_controller._refresh_api_metrics` (line 3074)
- `src.app_controller._on_comms_entry` (line 4282)
### `src\models.py` (22 consumers)
- `src.models.from_dict` (line 603)
- `src.models.from_dict` (line 416)
- `src.models.from_dict` (line 506)
- `src.models.from_dict` (line 814)
- `src.models.from_dict` (line 893)
- `src.models._save_config_to_disk` (line 199)
- `src.models.from_dict` (line 378)
- `src.models.from_dict` (line 1007)
- `src.models.from_dict` (line 1038)
- `src.models.from_dict` (line 866)
- `src.models.from_dict` (line 712)
- `src.models.from_dict` (line 747)
- `src.models.from_dict` (line 683)
- `src.models.from_dict` (line 575)
- `src.models.from_dict` (line 630)
- `src.models.from_dict` (line 454)
- `src.models.from_dict` (line 949)
- `src.models.from_dict` (line 982)
- `src.models.from_dict` (line 656)
- `src.models.from_dict` (line 1072)
- `src.models.from_dict` (line 295)
- `src.models.from_dict` (line 920)
### `src\project_manager.py` (5 consumers)
- `src.project_manager.format_discussion` (line 69)
- `src.project_manager.flat_config` (line 267)
- `src.project_manager.entry_to_str` (line 49)
- `src.project_manager.save_project` (line 229)
- `src.project_manager.migrate_from_legacy_config` (line 253)
## Field access matrix
| consumer | _est_tokens | _gemini_cache_text | _pending_gui_tasks | _pending_gui_tasks_lock | _recalculate_session_usage | _start_track_logic_result | _token_stats | _topological_sort_tickets_result | _update_cached_stats | active_discussion | active_project_path | active_project_root | ai_status | append | config | content | context_files | encode | engines | error |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `build_tier3_context` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_strip_cache_controls` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `_send_anthropic` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_estimate_prompt_tokens` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_start_track_logic_result` | . | . | 2 | 2 | . | . | . | 1 | . | 1 | 1 | 1 | 4 | . | 1 | . | 1 | . | 1 | . |
| `_strip_private_keys` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_trim_anthropic_history` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_add_history_cache_breakpoint` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `build_markdown_from_items` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_send_gemini_cli` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_repair_anthropic_history` | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . | . | . |
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `format_discussion` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_create_gemini_cache_result` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_dashscope_call` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_send_grok` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_offload_entry_payload` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `_save_config_to_disk` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `_execute_single_tool_call_async` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `_repair_deepseek_history` | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . | . | . |
| `_add_bleed_derived` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `flat_config` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_build_files_section_from_items` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_append_comms` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_send_llama_native` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `send` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . | . |
| `_start_track_logic` | . | . | . | . | . | 1 | . | . | . | . | . | . | 1 | . | . | . | . | . | . | . |
| `build_markdown_no_history` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `_estimate_message_tokens` | 1 | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_pre_dispatch` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `_send_gemini` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . |
| `_send_minimax` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_refresh_api_metrics` | . | 1 | . | . | 1 | . | 1 | . | 1 | . | . | . | . | . | . | . | . | . | . | 2 |
| `_send_deepseek` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_trim_minimax_history` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `entry_to_str` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `ollama_chat` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `_send_llama` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
_... 24 more fields_
## Access pattern
**Dominant pattern:** whole_struct
**Evidence count:** 50
**Per-function pattern distribution:**
- `whole_struct`: 30 functions (60%)
- `mixed`: 17 functions (34%)
- `field_by_field`: 3 functions (6%)
## SSDL Sketch for `FileItem`
```
[Q:FileItem entry-point] -> [Q:PCG lookup]
-> [1: from_dict] [B:check] (branches=0)
-> [2: build_tier3_context] [B:check] (branches=50)
-> [3: _strip_cache_controls] [B:check] (branches=4)
-> [4: from_dict] [B:check] (branches=0)
-> [5: from_dict] [B:check] (branches=0)
-> [6: _send_anthropic] [B:is None?] (branches=40) [N:safe]
-> [7: _estimate_prompt_tokens] [B:check] (branches=2)
-> [8: _start_track_logic_result] [B:check] (branches=10)
-> [9: _strip_private_keys] [B:check] (branches=0)
-> [10: _trim_anthropic_history] [B:check] (branches=13)
-> [11: _add_history_cache_breakpoint] [B:check] (branches=5)
-> [12: build_markdown_from_items] [B:check] (branches=9)
-> [13: _send_gemini_cli] [B:is None?] (branches=23) [N:safe]
-> [14: _repair_anthropic_history] [B:check] (branches=6)
-> [15: from_dict] [B:check] (branches=0)
-> [16: format_discussion] [B:check] (branches=0)
-> [17: _create_gemini_cache_result] [B:check] (branches=3)
-> [18: _dashscope_call] [B:check] (branches=5)
-> [19: _send_grok] [B:check] (branches=14)
-> [20: _offload_entry_payload] [B:check] (branches=10)
-> [21: from_dict] [B:check] (branches=0)
-> [22: _save_config_to_disk] [B:check] (branches=1)
-> [23: from_dict] [B:check] (branches=0)
-> [24: _execute_single_tool_call_async] [B:is None?] (branches=15) [N:safe]
-> [25: from_dict] [B:check] (branches=0)
-> [26: _repair_deepseek_history] [B:check] (branches=6)
-> [27: _add_bleed_derived] [B:check] (branches=0)
-> [28: flat_config] [B:check] (branches=2)
-> [29: _build_files_section_from_items] [B:is None?] (branches=5) [N:safe]
-> [30: _append_comms] [B:is None?] (branches=1) [N:safe]
-> [31: _send_llama_native] [B:check] (branches=12)
-> [32: send] [B:check] (branches=19)
-> [33: _start_track_logic] [B:check] (branches=1)
-> [34: build_markdown_no_history] [B:check] (branches=0)
-> [35: from_dict] [B:check] (branches=0)
-> [36: _estimate_message_tokens] [B:is None?] (branches=9) [N:safe]
-> [37: _pre_dispatch] [B:check] (branches=8)
-> [38: from_dict] [B:check] (branches=0)
-> [39: from_dict] [B:check] (branches=0)
-> [40: _send_gemini] [B:is None?] (branches=75) [N:safe]
-> [41: _send_minimax] [B:check] (branches=11)
-> [42: _refresh_api_metrics] [B:is None?] (branches=11) [N:safe]
-> [43: _send_deepseek] [B:check] (branches=71)
-> [44: _trim_minimax_history] [B:check] (branches=8)
-> [45: entry_to_str] [B:check] (branches=3)
-> [46: from_dict] [B:check] (branches=0)
-> [47: from_dict] [B:check] (branches=0)
-> [48: ollama_chat] [B:check] (branches=3)
-> [49: from_dict] [B:check] (branches=0)
-> [50: _send_llama] [B:check] (branches=13)
-> [51: from_dict] [B:check] (branches=0)
-> [52: run] [B:check] (branches=1)
-> [53: _invalidate_token_estimate] [B:check] (branches=0)
-> [54: _on_comms_entry] [B:check] (branches=32)
-> [55: from_dict] [B:check] (branches=0)
-> [56: _repair_minimax_history] [B:check] (branches=10)
-> [57: from_dict] [B:check] (branches=0)
-> [58: from_dict] [B:check] (branches=0)
-> [59: from_dict] [B:check] (branches=0)
-> [60: _send_qwen] [B:check] (branches=9)
-> [61: save_project] [B:is None?] (branches=7) [N:safe]
-> [62: migrate_from_legacy_config] [B:check] (branches=2)
-> [63: from_dict] [B:check] (branches=0)
-> [64: _strip_stale_file_refreshes] [B:check] (branches=12)
-> [65: from_dict] [B:check] (branches=0)
-> [66: from_dict] [B:check] (branches=0)
-> [T:done]
```
**Effective codepaths:** 40140116231395706750390 (sum of 2^branches across 66 consumers)
**Total branch points:** 541
**Nil-check functions:** 9
**Defusing opportunities:**
- **Nil Sentinel `[N]`**: Introduce a module-level `NIL_<AGGREGATE>` sentinel whose field accesses return safe defaults. Replace None checks with the sentinel. Collapses 2^branch_count into ~1.
- Effective codepaths: 40140116231395706750390 -> 40140116231395706750372
- **Immediate-Mode Cache `[Q:key] -> [I:FetchCached] -> [T]`**: Introduce a `fileitem_cache` keyed lookup. Consumers request by key, get cached value, no field-existence checks. Reduces 110 field-check branches to 1 cache lookup.
- Effective codepaths: 40140116231395706750390 -> 110
- **Generational Handles `[I:ResolveHandle] -> [B:Gen matches?] -> [N|safe]`**: Wrap the aggregate in a generational handle (index + generation). Validation is one comparison; mismatch returns the nil sentinel. Reduces N lifetime branches to 1 handle validation + sentinel return.
- Effective codepaths: 40140116231395706750390 -> 66
## Frequency
**Dominant frequency:** per_turn
**Evidence count:** 5
**Per-function frequency distribution:**
- `per_turn`: 5 functions
## Result coverage
**Summary:** 96 producers, 46 consumers
| metric | value |
|---|---|
| total producers | 96 |
| result producers | 96 |
| total consumers | 46 |
| result consumers | 0 |
## Type alias coverage
**Summary:** 110 sites; 0 typed (0%); 110 untyped (100%)
| metric | value |
|---|---|
| total field-access sites | 110 |
| typed sites (canonical field) | 0 |
| untyped sites (wildcard) | 110 |
## Cross-audit findings
_(no cross-audit findings mapped to this aggregate)_
## Decomposition cost
**Current cost estimate:** 720 us/turn
**Componentize savings:** 0 us/turn
**Unify savings:** 0 us/turn
**Recommended direction:** hold
**Rationale:** FileItem: access_pattern=whole_struct, frequency=per_turn, struct_field_count=10, struct_frozen=True. Recommended: hold because the current shape matches the access pattern.
**Struct field count (estimated):** 10
**Struct frozen:** True
## Struct shape (inferred from producer returns)
| field | access count | access pattern |
|---|---|---|
| `content` | 13 | hot |
| `marker` | 13 | hot |
| `get` | 7 | hot |
| `ai_status` | 2 | used |
| `config` | 2 | used |
| `pop` | 2 | used |
| `append` | 2 | used |
| `context_files` | 1 | used |
| `_pending_gui_tasks_lock` | 1 | used |
| `_topological_sort_tickets_result` | 1 | used |
| `active_project_root` | 1 | used |
| `event_queue` | 1 | used |
| `engines` | 1 | used |
| `project` | 1 | used |
| `active_discussion` | 1 | used |
| `submit_io` | 1 | used |
| `tracks` | 1 | used |
| `mma_tier_usage` | 1 | used |
| `_pending_gui_tasks` | 1 | used |
| `mma_step_mode` | 1 | used |
| `active_project_path` | 1 | used |
| `items` | 1 | used |
| `estimated_prompt_tokens` | 1 | used |
| `max_prompt_tokens` | 1 | used |
| `utilization_pct` | 1 | used |
| `headroom` | 1 | used |
| `would_trim` | 1 | used |
| `sys_tokens` | 1 | used |
| `tool_tokens` | 1 | used |
| `history_tokens` | 1 | used |
| `search` | 1 | used |
| `_start_track_logic_result` | 1 | used |
| `_est_tokens` | 1 | used |
| `encode` | 1 | used |
| `latency` | 1 | used |
| `_recalculate_session_usage` | 1 | used |
| `_token_stats` | 1 | used |
| `_gemini_cache_text` | 1 | used |
| `vendor_quota` | 1 | used |
| `last_error` | 1 | used |
| `error` | 1 | used |
| `_update_cached_stats` | 1 | used |
| `session_usage` | 1 | used |
| `usage` | 1 | used |
## Optimization candidates
_(no optimization candidates generated)_
## Verdict
FileItem: access_pattern=whole_struct, frequency=per_turn, struct_field_count=10, struct_frozen=True. Recommended: hold because the current shape matches the access pattern.
## Evidence appendix
### Access pattern evidence
| function | pattern | field_accesses | confidence |
|---|---|---|---|
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.aggregate.build_tier3_context` | `whole_struct` | | low |
| `src.ai_client._strip_cache_controls` | `whole_struct` | | low |
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.ai_client._send_anthropic` | `whole_struct` | | low |
| `src.ai_client._estimate_prompt_tokens` | `whole_struct` | | low |
| `src.app_controller._start_track_logic_result` | `field_by_field` | `ai_status`=4, `context_files`=1, `get`=3, `_pending_gui_tasks_lock`=2, `_topological_sort_tickets_result`=1, `active_project_root`=1, `event_queue`=1, `engines`=1, `project`=1, `active_discussion`=1 (+7 more) | high |
| `src.ai_client._strip_private_keys` | `whole_struct` | | low |
| `src.ai_client._trim_anthropic_history` | `whole_struct` | `pop`=5 | high |
| `src.ai_client._add_history_cache_breakpoint` | `whole_struct` | | low |
| `src.aggregate.build_markdown_from_items` | `whole_struct` | | low |
| `src.ai_client._send_gemini_cli` | `whole_struct` | | low |
| `src.ai_client._repair_anthropic_history` | `whole_struct` | `append`=1 | high |
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.project_manager.format_discussion` | `whole_struct` | | low |
| `src.ai_client._create_gemini_cache_result` | `whole_struct` | | low |
| `src.ai_client._dashscope_call` | `whole_struct` | | low |
| `src.ai_client._send_grok` | `whole_struct` | | low |
| `src.app_controller._offload_entry_payload` | `whole_struct` | | low |
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.models._save_config_to_disk` | `whole_struct` | | low |
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.ai_client._execute_single_tool_call_async` | `mixed` | `get`=2, `items`=1 | high |
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.ai_client._repair_deepseek_history` | `whole_struct` | `append`=1 | high |
| `src.ai_client._add_bleed_derived` | `field_by_field` | `estimated_prompt_tokens`=1, `max_prompt_tokens`=1, `utilization_pct`=1, `headroom`=1, `would_trim`=1, `sys_tokens`=1, `tool_tokens`=1, `history_tokens`=1, `get`=3 | high |
| `src.project_manager.flat_config` | `whole_struct` | `get`=7 | high |
| `src.aggregate._build_files_section_from_items` | `whole_struct` | | low |
| `src.ai_client._append_comms` | `whole_struct` | | low |
| `src.ai_client._send_llama_native` | `whole_struct` | | low |
| `src.ai_client.send` | `mixed` | `config`=1, `search`=1 | high |
| `src.app_controller._start_track_logic` | `mixed` | `_start_track_logic_result`=1, `ai_status`=1 | high |
| `src.aggregate.build_markdown_no_history` | `whole_struct` | | low |
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.ai_client._estimate_message_tokens` | `mixed` | `_est_tokens`=1, `get`=2 | high |
| `src.ai_client._pre_dispatch` | `whole_struct` | | low |
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.ai_client._send_gemini` | `whole_struct` | `encode`=1 | high |
| `src.ai_client._send_minimax` | `whole_struct` | | low |
| `src.app_controller._refresh_api_metrics` | `field_by_field` | `latency`=1, `_recalculate_session_usage`=1, `_token_stats`=1, `get`=2, `_gemini_cache_text`=1, `vendor_quota`=1, `last_error`=1, `error`=2, `_update_cached_stats`=1, `session_usage`=2 (+1 more) | high |
| `src.ai_client._send_deepseek` | `whole_struct` | | low |
| `src.ai_client._trim_minimax_history` | `whole_struct` | `pop`=4 | high |
| `src.project_manager.entry_to_str` | `whole_struct` | `get`=4 | high |
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.ai_client.ollama_chat` | `whole_struct` | | low |
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.ai_client._send_llama` | `whole_struct` | | low |
### Frequency evidence
| function | frequency | source | note |
|---|---|---|---|
| `src.app_controller.wait` | `per_turn` | `static_analysis` | producer from src\app_controller.py |
| `src.api_hook_client.post_project` | `per_turn` | `static_analysis` | producer from src\api_hook_client.py |
| `src.app_controller.get_mma_status` | `per_turn` | `static_analysis` | producer from src\app_controller.py |
| `src.ai_client._load_credentials` | `per_turn` | `static_analysis` | producer from src\ai_client.py |
| `src.ai_client._pre_dispatch` | `per_turn` | `static_analysis` | producer from src\ai_client.py |
@@ -0,0 +1,195 @@
# Aggregate Profile: FileItems
**Aggregate kind:** typealias
**Memory dim:** curation
**Is candidate:** False
## Pipeline summary
- Producers: 6
- Consumers: 9
- Distinct producer fqnames: 6
- Distinct consumer fqnames: 9
- Access pattern (aggregate): whole_struct
- Frequency (aggregate): per_turn
- Decomposition direction: hold
- Struct field count (estimated): 5
## Producers (6)
### `src\ai_client.py` (4 producers)
- `src.ai_client._list_minimax_models_result` (line 2436)
- `src.ai_client._list_gemini_models_result` (line 1626)
- `src.ai_client._set_minimax_provider_result` (line 398)
- `src.ai_client._list_anthropic_models_result` (line 1317)
### `src\gui_2.py` (2 producers)
- `src.gui_2._drain_normalize_errors` (line 7417)
- `src.gui_2._render_beads_tab_list_result` (line 8314)
## Consumers (9)
### `src\ai_client.py` (4 consumers)
- `src.ai_client._build_file_diff_text` (line 1105)
- `src.ai_client.run_with_tool_loop` (line 833)
- `src.ai_client._reread_file_items_result` (line 1056)
- `src.ai_client._build_file_context_text` (line 1092)
### `src\app_controller.py` (3 consumers)
- `src.app_controller._symbol_resolution_result` (line 3506)
- `src.app_controller._topological_sort_tickets_result` (line 4708)
- `src.app_controller._serialize_tool_calls_result` (line 2217)
### `src\gui_2.py` (1 consumer)
- `src.gui_2.__init__` (line 7550)
### `src\project_manager.py` (1 consumer)
- `src.project_manager.calculate_track_progress` (line 420)
## Field access matrix
| consumer | _attr_name | _cached | _module_name | _report_worker_error | append |
|---|---|---|---|---|---|
| `_build_file_diff_text` | . | . | . | . | . |
| `__init__` | 1 | 1 | 1 | . | . |
| `_symbol_resolution_result` | . | . | . | . | . |
| `_topological_sort_tickets_result` | . | . | . | 1 | . |
| `_serialize_tool_calls_result` | . | . | . | . | . |
| `run_with_tool_loop` | . | . | . | . | 2 |
| `calculate_track_progress` | . | . | . | . | . |
| `_reread_file_items_result` | . | . | . | . | . |
| `_build_file_context_text` | . | . | . | . | . |
## Access pattern
**Dominant pattern:** whole_struct
**Evidence count:** 9
**Per-function pattern distribution:**
- `whole_struct`: 8 functions (89%)
- `field_by_field`: 1 functions (11%)
## SSDL Sketch for `FileItems`
```
[Q:FileItems entry-point] -> [Q:PCG lookup]
-> [1: _build_file_diff_text] [B:check] (branches=6)
-> [2: __init__] [B:check] (branches=0)
-> [3: _symbol_resolution_result] [B:check] (branches=4)
-> [4: _topological_sort_tickets_result] [B:check] (branches=2)
-> [5: _serialize_tool_calls_result] [B:check] (branches=2)
-> [6: run_with_tool_loop] [B:is None?] (branches=23) [N:safe]
-> [7: calculate_track_progress] [B:check] (branches=1)
-> [8: _reread_file_items_result] [B:is None?] (branches=5) [N:safe]
-> [9: _build_file_context_text] [B:check] (branches=3)
-> [T:done]
```
**Effective codepaths:** 8388739 (sum of 2^branches across 9 consumers)
**Total branch points:** 46
**Nil-check functions:** 2
**Defusing opportunities:**
- **Nil Sentinel `[N]`**: Introduce a module-level `NIL_<AGGREGATE>` sentinel whose field accesses return safe defaults. Replace None checks with the sentinel. Collapses 2^branch_count into ~1.
- Effective codepaths: 8388739 -> 8388735
- **Immediate-Mode Cache `[Q:key] -> [I:FetchCached] -> [T]`**: Introduce a `fileitems_cache` keyed lookup. Consumers request by key, get cached value, no field-existence checks. Reduces 6 field-check branches to 1 cache lookup.
- Effective codepaths: 8388739 -> 6
- **Generational Handles `[I:ResolveHandle] -> [B:Gen matches?] -> [N|safe]`**: Wrap the aggregate in a generational handle (index + generation). Validation is one comparison; mismatch returns the nil sentinel. Reduces N lifetime branches to 1 handle validation + sentinel return.
- Effective codepaths: 8388739 -> 9
## Frequency
**Dominant frequency:** per_turn
**Evidence count:** 5
**Per-function frequency distribution:**
- `per_turn`: 5 functions
## Result coverage
**Summary:** 6 producers, 9 consumers
| metric | value |
|---|---|
| total producers | 6 |
| result producers | 6 |
| total consumers | 9 |
| result consumers | 0 |
## Type alias coverage
**Summary:** 6 sites; 0 typed (0%); 6 untyped (100%)
| metric | value |
|---|---|
| total field-access sites | 6 |
| typed sites (canonical field) | 0 |
| untyped sites (wildcard) | 6 |
## Cross-audit findings
_(no cross-audit findings mapped to this aggregate)_
## Decomposition cost
**Current cost estimate:** 470 us/turn
**Componentize savings:** 0 us/turn
**Unify savings:** 70 us/turn
**Recommended direction:** hold
**Rationale:** FileItems: access_pattern=whole_struct, frequency=per_turn, struct_field_count=5, struct_frozen=True. Recommended: hold because the current shape matches the access pattern.
**Struct field count (estimated):** 5
**Struct frozen:** True
## Struct shape (inferred from producer returns)
| field | access count | access pattern |
|---|---|---|
| `_module_name` | 1 | used |
| `_attr_name` | 1 | used |
| `_cached` | 1 | used |
| `_report_worker_error` | 1 | used |
| `append` | 1 | used |
## Optimization candidates
_(no optimization candidates generated)_
## Verdict
FileItems: access_pattern=whole_struct, frequency=per_turn, struct_field_count=5, struct_frozen=True. Recommended: hold because the current shape matches the access pattern.
## Evidence appendix
### Access pattern evidence
| function | pattern | field_accesses | confidence |
|---|---|---|---|
| `src.ai_client._build_file_diff_text` | `whole_struct` | | low |
| `src.gui_2.__init__` | `field_by_field` | `_module_name`=1, `_attr_name`=1, `_cached`=1 | high |
| `src.app_controller._symbol_resolution_result` | `whole_struct` | | low |
| `src.app_controller._topological_sort_tickets_result` | `whole_struct` | `_report_worker_error`=1 | high |
| `src.app_controller._serialize_tool_calls_result` | `whole_struct` | | low |
| `src.ai_client.run_with_tool_loop` | `whole_struct` | `append`=2 | high |
| `src.project_manager.calculate_track_progress` | `whole_struct` | | low |
| `src.ai_client._reread_file_items_result` | `whole_struct` | | low |
| `src.ai_client._build_file_context_text` | `whole_struct` | | low |
### Frequency evidence
| function | frequency | source | note |
|---|---|---|---|
| `src.gui_2._drain_normalize_errors` | `per_turn` | `static_analysis` | producer from src\gui_2.py |
| `src.ai_client._list_minimax_models_result` | `per_turn` | `static_analysis` | producer from src\ai_client.py |
| `src.ai_client._list_gemini_models_result` | `per_turn` | `static_analysis` | producer from src\ai_client.py |
| `src.gui_2._render_beads_tab_list_result` | `per_turn` | `static_analysis` | producer from src\gui_2.py |
| `src.ai_client._set_minimax_provider_result` | `per_turn` | `static_analysis` | producer from src\ai_client.py |
@@ -0,0 +1,189 @@
# Aggregate Profile: History
**Aggregate kind:** typealias
**Memory dim:** discussion
**Is candidate:** False
## Pipeline summary
- Producers: 7
- Consumers: 7
- Distinct producer fqnames: 7
- Distinct consumer fqnames: 7
- Access pattern (aggregate): whole_struct
- Frequency (aggregate): per_turn
- Decomposition direction: hold
- Struct field count (estimated): 5
## Producers (7)
### `src\ai_client.py` (4 producers)
- `src.ai_client._list_minimax_models_result` (line 2436)
- `src.ai_client._list_gemini_models_result` (line 1626)
- `src.ai_client._set_minimax_provider_result` (line 398)
- `src.ai_client._list_anthropic_models_result` (line 1317)
### `src\gui_2.py` (2 producers)
- `src.gui_2._drain_normalize_errors` (line 7417)
- `src.gui_2._render_beads_tab_list_result` (line 8314)
### `src\provider_state.py` (1 producer)
- `src.provider_state.get_all` (line 34)
## Consumers (7)
### `src\app_controller.py` (3 consumers)
- `src.app_controller._symbol_resolution_result` (line 3506)
- `src.app_controller._topological_sort_tickets_result` (line 4708)
- `src.app_controller._serialize_tool_calls_result` (line 2217)
### `src\gui_2.py` (1 consumer)
- `src.gui_2.__init__` (line 7550)
### `src\project_manager.py` (1 consumer)
- `src.project_manager.calculate_track_progress` (line 420)
### `src\provider_state.py` (2 consumers)
- `src.provider_state.append` (line 30)
- `src.provider_state.replace_all` (line 38)
## Field access matrix
| consumer | _attr_name | _cached | _module_name | _report_worker_error | lock | messages |
|---|---|---|---|---|---|---|
| `_symbol_resolution_result` | . | . | . | . | . | . |
| `_topological_sort_tickets_result` | . | . | . | 1 | . | . |
| `_serialize_tool_calls_result` | . | . | . | . | . | . |
| `append` | . | . | . | . | 1 | 1 |
| `replace_all` | . | . | . | . | 1 | 1 |
| `calculate_track_progress` | . | . | . | . | . | . |
| `__init__` | 1 | 1 | 1 | . | . | . |
## Access pattern
**Dominant pattern:** whole_struct
**Evidence count:** 7
**Per-function pattern distribution:**
- `whole_struct`: 4 functions (57%)
- `mixed`: 2 functions (29%)
- `field_by_field`: 1 functions (14%)
## SSDL Sketch for `History`
```
[Q:History entry-point] -> [Q:PCG lookup]
-> [1: _symbol_resolution_result] [B:check] (branches=4)
-> [2: _topological_sort_tickets_result] [B:check] (branches=2)
-> [3: _serialize_tool_calls_result] [B:check] (branches=2)
-> [4: append] [B:check] (branches=1)
-> [5: replace_all] [B:check] (branches=1)
-> [6: calculate_track_progress] [B:check] (branches=1)
-> [7: __init__] [B:check] (branches=0)
-> [T:done]
```
**Effective codepaths:** 31 (sum of 2^branches across 7 consumers)
**Total branch points:** 11
**Nil-check functions:** 0
**Defusing opportunities:**
- **Immediate-Mode Cache `[Q:key] -> [I:FetchCached] -> [T]`**: Introduce a `history_cache` keyed lookup. Consumers request by key, get cached value, no field-existence checks. Reduces 8 field-check branches to 1 cache lookup.
- Effective codepaths: 31 -> 8
## Frequency
**Dominant frequency:** per_turn
**Evidence count:** 5
**Per-function frequency distribution:**
- `per_turn`: 5 functions
## Result coverage
**Summary:** 7 producers, 7 consumers
| metric | value |
|---|---|
| total producers | 7 |
| result producers | 7 |
| total consumers | 7 |
| result consumers | 0 |
## Type alias coverage
**Summary:** 8 sites; 0 typed (0%); 8 untyped (100%)
| metric | value |
|---|---|
| total field-access sites | 8 |
| typed sites (canonical field) | 0 |
| untyped sites (wildcard) | 8 |
## Cross-audit findings
_(no cross-audit findings mapped to this aggregate)_
## Decomposition cost
**Current cost estimate:** 470 us/turn
**Componentize savings:** 0 us/turn
**Unify savings:** 70 us/turn
**Recommended direction:** hold
**Rationale:** History: access_pattern=whole_struct, frequency=per_turn, struct_field_count=5, struct_frozen=True. Recommended: hold because the current shape matches the access pattern.
**Struct field count (estimated):** 5
**Struct frozen:** True
## Struct shape (inferred from producer returns)
| field | access count | access pattern |
|---|---|---|
| `lock` | 2 | used |
| `messages` | 2 | used |
| `_report_worker_error` | 1 | used |
| `_module_name` | 1 | used |
| `_attr_name` | 1 | used |
| `_cached` | 1 | used |
## Optimization candidates
_(no optimization candidates generated)_
## Verdict
History: access_pattern=whole_struct, frequency=per_turn, struct_field_count=5, struct_frozen=True. Recommended: hold because the current shape matches the access pattern.
## Evidence appendix
### Access pattern evidence
| function | pattern | field_accesses | confidence |
|---|---|---|---|
| `src.app_controller._symbol_resolution_result` | `whole_struct` | | low |
| `src.app_controller._topological_sort_tickets_result` | `whole_struct` | `_report_worker_error`=1 | high |
| `src.app_controller._serialize_tool_calls_result` | `whole_struct` | | low |
| `src.provider_state.append` | `mixed` | `lock`=1, `messages`=1 | high |
| `src.provider_state.replace_all` | `mixed` | `lock`=1, `messages`=1 | high |
| `src.project_manager.calculate_track_progress` | `whole_struct` | | low |
| `src.gui_2.__init__` | `field_by_field` | `_module_name`=1, `_attr_name`=1, `_cached`=1 | high |
### Frequency evidence
| function | frequency | source | note |
|---|---|---|---|
| `src.gui_2._drain_normalize_errors` | `per_turn` | `static_analysis` | producer from src\gui_2.py |
| `src.ai_client._list_minimax_models_result` | `per_turn` | `static_analysis` | producer from src\ai_client.py |
| `src.ai_client._list_gemini_models_result` | `per_turn` | `static_analysis` | producer from src\ai_client.py |
| `src.gui_2._render_beads_tab_list_result` | `per_turn` | `static_analysis` | producer from src\gui_2.py |
| `src.provider_state.get_all` | `per_turn` | `static_analysis` | producer from src\provider_state.py |
@@ -0,0 +1,572 @@
# Aggregate Profile: HistoryMessage
**Aggregate kind:** typealias
**Memory dim:** discussion
**Is candidate:** False
## Pipeline summary
- Producers: 118
- Consumers: 68
- Distinct producer fqnames: 97
- Distinct consumer fqnames: 48
- Access pattern (aggregate): whole_struct
- Frequency (aggregate): per_turn
- Decomposition direction: hold
- Struct field count (estimated): 10
## Producers (118)
### `src\aggregate.py` (1 producer)
- `src.aggregate.build_file_items` (line 158)
### `src\ai_client.py` (16 producers)
- `src.ai_client._load_credentials` (line 282)
- `src.ai_client._pre_dispatch` (line 2089)
- `src.ai_client.get_comms_log` (line 273)
- `src.ai_client.get_gemini_cache_stats` (line 1604)
- `src.ai_client._add_bleed_derived` (line 3332)
- `src.ai_client._get_anthropic_tools` (line 664)
- `src.ai_client._dashscope_call` (line 2716)
- `src.ai_client._extract_dashscope_tool_calls` (line 2754)
- `src.ai_client._send_cli_round_result` (line 1746)
- `src.ai_client._parse_tool_args_result` (line 741)
- `src.ai_client._content_block_to_dict` (line 1200)
- `src.ai_client.ollama_chat` (line 2938)
- `src.ai_client._get_deepseek_tools` (line 1194)
- `src.ai_client._strip_private_keys` (line 1464)
- `src.ai_client._build_chunked_context_blocks` (line 1281)
- `src.ai_client.get_token_stats` (line 3185)
### `src\api_hook_client.py` (39 producers)
- `src.api_hook_client.post_project` (line 470)
- `src.api_hook_client.drag` (line 230)
- `src.api_hook_client.set_value` (line 212)
- `src.api_hook_client.get_financial_metrics` (line 520)
- `src.api_hook_client.get_gui_health` (line 434)
- `src.api_hook_client.select_list_item` (line 256)
- `src.api_hook_client.get_mma_status` (line 539)
- `src.api_hook_client.get_project_switch_status` (line 374)
- `src.api_hook_client.get_performance` (line 318)
- `src.api_hook_client.get_patch_status` (line 295)
- `src.api_hook_client.get_startup_timeline` (line 353)
- `src.api_hook_client.get_events` (line 124)
- `src.api_hook_client.get_gui_state` (line 165)
- `src.api_hook_client.click` (line 223)
- `src.api_hook_client.get_node_status` (line 532)
- `src.api_hook_client.reject_patch` (line 288)
- `src.api_hook_client.get_project` (line 367)
- `src.api_hook_client.get_warmup_status` (line 325)
- `src.api_hook_client.right_click` (line 237)
- `src.api_hook_client.get_io_pool_status` (line 420)
- `src.api_hook_client.push_event` (line 156)
- `src.api_hook_client.get_warmup_wait` (line 332)
- `src.api_hook_client.get_status` (line 105)
- `src.api_hook_client._make_request` (line 65)
- `src.api_hook_client.wait_for_project_switch` (line 389)
- `src.api_hook_client.apply_patch` (line 281)
- `src.api_hook_client.get_context_state` (line 491)
- `src.api_hook_client.post_project` (line 473)
- `src.api_hook_client.get_warmup_canaries` (line 342)
- `src.api_hook_client.trigger_patch` (line 274)
- `src.api_hook_client.clear_events` (line 129)
- `src.api_hook_client.post_session` (line 117)
- `src.api_hook_client.get_session` (line 502)
- `src.api_hook_client.get_mma_workers` (line 546)
- `src.api_hook_client.get_gui_diagnostics` (line 311)
- `src.api_hook_client.post_gui` (line 149)
- `src.api_hook_client.get_system_telemetry` (line 524)
- `src.api_hook_client.select_tab` (line 263)
- `src.api_hook_client.wait_for_event` (line 136)
### `src\app_controller.py` (30 producers)
- `src.app_controller.wait` (line 5205)
- `src.app_controller.get_mma_status` (line 2835)
- `src.app_controller._api_get_performance` (line 195)
- `src.app_controller.get_performance` (line 2856)
- `src.app_controller.get_diagnostics` (line 2862)
- `src.app_controller.load_config` (line 5142)
- `src.app_controller._api_get_context` (line 398)
- `src.app_controller._api_status` (line 209)
- `src.app_controller.generate` (line 2868)
- `src.app_controller._api_generate` (line 221)
- `src.app_controller._api_token_stats` (line 417)
- `src.app_controller._api_get_gui_state` (line 123)
- `src.app_controller._api_get_diagnostics` (line 202)
- `src.app_controller.get_api_session` (line 2847)
- `src.app_controller.token_stats` (line 2898)
- `src.app_controller._api_get_api_session` (line 170)
- `src.app_controller._offload_entry_payload` (line 4240)
- `src.app_controller._pending_mma_spawn` (line 2772)
- `src.app_controller._api_pending_actions` (line 335)
- `src.app_controller.get_context` (line 2892)
- `src.app_controller.get_session` (line 2883)
- `src.app_controller.status` (line 2865)
- `src.app_controller.get_session_insights` (line 3049)
- `src.app_controller._api_get_api_project` (line 188)
- `src.app_controller._api_get_mma_status` (line 144)
- `src.app_controller._pending_mma_approval` (line 2776)
- `src.app_controller.get_api_project` (line 2853)
- `src.app_controller.pending_actions` (line 2874)
- `src.app_controller.get_gui_state` (line 2829)
- `src.app_controller._api_get_session` (line 374)
### `src\models.py` (23 producers)
- `src.models.to_dict` (line 646)
- `src.models.to_dict` (line 1000)
- `src.models.to_dict` (line 672)
- `src.models.to_dict` (line 938)
- `src.models.to_dict` (line 855)
- `src.models.to_dict` (line 441)
- `src.models.to_dict` (line 406)
- `src.models.to_dict` (line 355)
- `src.models.parse_history_entries` (line 214)
- `src.models.to_dict` (line 737)
- `src.models.to_dict` (line 486)
- `src.models.to_dict` (line 913)
- `src.models.to_dict` (line 596)
- `src.models.to_dict` (line 794)
- `src.models.to_dict` (line 558)
- `src.models.to_dict` (line 971)
- `src.models.to_dict` (line 1024)
- `src.models.to_dict` (line 288)
- `src.models.to_dict` (line 701)
- `src.models.to_dict` (line 886)
- `src.models.to_dict` (line 1059)
- `src.models._load_config_from_disk` (line 186)
- `src.models.to_dict` (line 618)
### `src\project_manager.py` (8 producers)
- `src.project_manager.load_history` (line 209)
- `src.project_manager.default_project` (line 123)
- `src.project_manager.migrate_from_legacy_config` (line 253)
- `src.project_manager.load_project` (line 186)
- `src.project_manager.get_all_tracks` (line 342)
- `src.project_manager.default_discussion` (line 117)
- `src.project_manager.flat_config` (line 267)
- `src.project_manager.str_to_entry` (line 75)
### `src\provider_state.py` (1 producer)
- `src.provider_state.get_all` (line 34)
## Consumers (68)
### `src\aggregate.py` (5 consumers)
- `src.aggregate.build_tier3_context` (line 382)
- `src.aggregate.build_markdown_from_items` (line 348)
- `src.aggregate._build_files_section_from_items` (line 300)
- `src.aggregate.build_markdown_no_history` (line 366)
- `src.aggregate.run` (line 479)
### `src\ai_client.py` (29 consumers)
- `src.ai_client._strip_cache_controls` (line 1291)
- `src.ai_client._send_anthropic` (line 1405)
- `src.ai_client._estimate_prompt_tokens` (line 1243)
- `src.ai_client._strip_private_keys` (line 1464)
- `src.ai_client._trim_anthropic_history` (line 1353)
- `src.ai_client._add_history_cache_breakpoint` (line 1299)
- `src.ai_client._send_gemini_cli` (line 2019)
- `src.ai_client._repair_anthropic_history` (line 1381)
- `src.ai_client._create_gemini_cache_result` (line 1706)
- `src.ai_client._dashscope_call` (line 2716)
- `src.ai_client._send_grok` (line 2530)
- `src.ai_client._execute_single_tool_call_async` (line 945)
- `src.ai_client._repair_deepseek_history` (line 2138)
- `src.ai_client._add_bleed_derived` (line 3332)
- `src.ai_client._append_comms` (line 257)
- `src.ai_client._send_llama_native` (line 2958)
- `src.ai_client.send` (line 3208)
- `src.ai_client._estimate_message_tokens` (line 1218)
- `src.ai_client._pre_dispatch` (line 2089)
- `src.ai_client._send_gemini` (line 1802)
- `src.ai_client._send_minimax` (line 2616)
- `src.ai_client._send_deepseek` (line 2165)
- `src.ai_client._trim_minimax_history` (line 2482)
- `src.ai_client.ollama_chat` (line 2938)
- `src.ai_client._send_llama` (line 2858)
- `src.ai_client._invalidate_token_estimate` (line 1240)
- `src.ai_client._repair_minimax_history` (line 2462)
- `src.ai_client._send_qwen` (line 2773)
- `src.ai_client._strip_stale_file_refreshes` (line 1253)
### `src\app_controller.py` (5 consumers)
- `src.app_controller._start_track_logic_result` (line 4728)
- `src.app_controller._offload_entry_payload` (line 4240)
- `src.app_controller._start_track_logic` (line 4721)
- `src.app_controller._refresh_api_metrics` (line 3074)
- `src.app_controller._on_comms_entry` (line 4282)
### `src\models.py` (22 consumers)
- `src.models.from_dict` (line 603)
- `src.models.from_dict` (line 416)
- `src.models.from_dict` (line 506)
- `src.models.from_dict` (line 814)
- `src.models.from_dict` (line 893)
- `src.models._save_config_to_disk` (line 199)
- `src.models.from_dict` (line 378)
- `src.models.from_dict` (line 1007)
- `src.models.from_dict` (line 1038)
- `src.models.from_dict` (line 866)
- `src.models.from_dict` (line 712)
- `src.models.from_dict` (line 747)
- `src.models.from_dict` (line 683)
- `src.models.from_dict` (line 575)
- `src.models.from_dict` (line 630)
- `src.models.from_dict` (line 454)
- `src.models.from_dict` (line 949)
- `src.models.from_dict` (line 982)
- `src.models.from_dict` (line 656)
- `src.models.from_dict` (line 1072)
- `src.models.from_dict` (line 295)
- `src.models.from_dict` (line 920)
### `src\project_manager.py` (5 consumers)
- `src.project_manager.format_discussion` (line 69)
- `src.project_manager.flat_config` (line 267)
- `src.project_manager.entry_to_str` (line 49)
- `src.project_manager.save_project` (line 229)
- `src.project_manager.migrate_from_legacy_config` (line 253)
### `src\provider_state.py` (2 consumers)
- `src.provider_state.append` (line 30)
- `src.provider_state.replace_all` (line 38)
## Field access matrix
| consumer | _est_tokens | _gemini_cache_text | _pending_gui_tasks | _pending_gui_tasks_lock | _recalculate_session_usage | _start_track_logic_result | _token_stats | _topological_sort_tickets_result | _update_cached_stats | active_discussion | active_project_path | active_project_root | ai_status | append | config | content | context_files | encode | engines | error |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `build_tier3_context` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_strip_cache_controls` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `_send_anthropic` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_estimate_prompt_tokens` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_start_track_logic_result` | . | . | 2 | 2 | . | . | . | 1 | . | 1 | 1 | 1 | 4 | . | 1 | . | 1 | . | 1 | . |
| `_strip_private_keys` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_trim_anthropic_history` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_add_history_cache_breakpoint` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `build_markdown_from_items` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_send_gemini_cli` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_repair_anthropic_history` | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . | . | . |
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `format_discussion` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_create_gemini_cache_result` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_dashscope_call` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_send_grok` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_offload_entry_payload` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `_save_config_to_disk` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `_execute_single_tool_call_async` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `_repair_deepseek_history` | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . | . | . |
| `_add_bleed_derived` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `flat_config` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `append` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_build_files_section_from_items` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_append_comms` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_send_llama_native` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `send` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . | . |
| `_start_track_logic` | . | . | . | . | . | 1 | . | . | . | . | . | . | 1 | . | . | . | . | . | . | . |
| `build_markdown_no_history` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `_estimate_message_tokens` | 1 | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_pre_dispatch` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `_send_gemini` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . |
| `_send_minimax` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_refresh_api_metrics` | . | 1 | . | . | 1 | . | 1 | . | 1 | . | . | . | . | . | . | . | . | . | . | 2 |
| `_send_deepseek` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `replace_all` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_trim_minimax_history` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `entry_to_str` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `ollama_chat` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
_... 26 more fields_
## Access pattern
**Dominant pattern:** whole_struct
**Evidence count:** 50
**Per-function pattern distribution:**
- `whole_struct`: 29 functions (58%)
- `mixed`: 18 functions (36%)
- `field_by_field`: 3 functions (6%)
## SSDL Sketch for `HistoryMessage`
```
[Q:HistoryMessage entry-point] -> [Q:PCG lookup]
-> [1: from_dict] [B:check] (branches=0)
-> [2: build_tier3_context] [B:check] (branches=50)
-> [3: _strip_cache_controls] [B:check] (branches=4)
-> [4: from_dict] [B:check] (branches=0)
-> [5: from_dict] [B:check] (branches=0)
-> [6: _send_anthropic] [B:is None?] (branches=40) [N:safe]
-> [7: _estimate_prompt_tokens] [B:check] (branches=2)
-> [8: _start_track_logic_result] [B:check] (branches=10)
-> [9: _strip_private_keys] [B:check] (branches=0)
-> [10: _trim_anthropic_history] [B:check] (branches=13)
-> [11: _add_history_cache_breakpoint] [B:check] (branches=5)
-> [12: build_markdown_from_items] [B:check] (branches=9)
-> [13: _send_gemini_cli] [B:is None?] (branches=23) [N:safe]
-> [14: _repair_anthropic_history] [B:check] (branches=6)
-> [15: from_dict] [B:check] (branches=0)
-> [16: format_discussion] [B:check] (branches=0)
-> [17: _create_gemini_cache_result] [B:check] (branches=3)
-> [18: _dashscope_call] [B:check] (branches=5)
-> [19: _send_grok] [B:check] (branches=14)
-> [20: _offload_entry_payload] [B:check] (branches=10)
-> [21: from_dict] [B:check] (branches=0)
-> [22: _save_config_to_disk] [B:check] (branches=1)
-> [23: from_dict] [B:check] (branches=0)
-> [24: _execute_single_tool_call_async] [B:is None?] (branches=15) [N:safe]
-> [25: from_dict] [B:check] (branches=0)
-> [26: _repair_deepseek_history] [B:check] (branches=6)
-> [27: _add_bleed_derived] [B:check] (branches=0)
-> [28: flat_config] [B:check] (branches=2)
-> [29: append] [B:check] (branches=1)
-> [30: _build_files_section_from_items] [B:is None?] (branches=5) [N:safe]
-> [31: _append_comms] [B:is None?] (branches=1) [N:safe]
-> [32: _send_llama_native] [B:check] (branches=12)
-> [33: send] [B:check] (branches=19)
-> [34: _start_track_logic] [B:check] (branches=1)
-> [35: build_markdown_no_history] [B:check] (branches=0)
-> [36: from_dict] [B:check] (branches=0)
-> [37: _estimate_message_tokens] [B:is None?] (branches=9) [N:safe]
-> [38: _pre_dispatch] [B:check] (branches=8)
-> [39: from_dict] [B:check] (branches=0)
-> [40: from_dict] [B:check] (branches=0)
-> [41: _send_gemini] [B:is None?] (branches=75) [N:safe]
-> [42: _send_minimax] [B:check] (branches=11)
-> [43: _refresh_api_metrics] [B:is None?] (branches=11) [N:safe]
-> [44: _send_deepseek] [B:check] (branches=71)
-> [45: replace_all] [B:check] (branches=1)
-> [46: _trim_minimax_history] [B:check] (branches=8)
-> [47: entry_to_str] [B:check] (branches=3)
-> [48: from_dict] [B:check] (branches=0)
-> [49: from_dict] [B:check] (branches=0)
-> [50: ollama_chat] [B:check] (branches=3)
-> [51: from_dict] [B:check] (branches=0)
-> [52: _send_llama] [B:check] (branches=13)
-> [53: from_dict] [B:check] (branches=0)
-> [54: run] [B:check] (branches=1)
-> [55: _invalidate_token_estimate] [B:check] (branches=0)
-> [56: _on_comms_entry] [B:check] (branches=32)
-> [57: from_dict] [B:check] (branches=0)
-> [58: _repair_minimax_history] [B:check] (branches=10)
-> [59: from_dict] [B:check] (branches=0)
-> [60: from_dict] [B:check] (branches=0)
-> [61: from_dict] [B:check] (branches=0)
-> [62: _send_qwen] [B:check] (branches=9)
-> [63: save_project] [B:is None?] (branches=7) [N:safe]
-> [64: migrate_from_legacy_config] [B:check] (branches=2)
-> [65: from_dict] [B:check] (branches=0)
-> [66: _strip_stale_file_refreshes] [B:check] (branches=12)
-> [67: from_dict] [B:check] (branches=0)
-> [68: from_dict] [B:check] (branches=0)
-> [T:done]
```
**Effective codepaths:** 40140116231395706750394 (sum of 2^branches across 68 consumers)
**Total branch points:** 543
**Nil-check functions:** 9
**Defusing opportunities:**
- **Nil Sentinel `[N]`**: Introduce a module-level `NIL_<AGGREGATE>` sentinel whose field accesses return safe defaults. Replace None checks with the sentinel. Collapses 2^branch_count into ~1.
- Effective codepaths: 40140116231395706750394 -> 40140116231395706750376
- **Immediate-Mode Cache `[Q:key] -> [I:FetchCached] -> [T]`**: Introduce a `historymessage_cache` keyed lookup. Consumers request by key, get cached value, no field-existence checks. Reduces 112 field-check branches to 1 cache lookup.
- Effective codepaths: 40140116231395706750394 -> 112
- **Generational Handles `[I:ResolveHandle] -> [B:Gen matches?] -> [N|safe]`**: Wrap the aggregate in a generational handle (index + generation). Validation is one comparison; mismatch returns the nil sentinel. Reduces N lifetime branches to 1 handle validation + sentinel return.
- Effective codepaths: 40140116231395706750394 -> 68
## Frequency
**Dominant frequency:** per_turn
**Evidence count:** 5
**Per-function frequency distribution:**
- `per_turn`: 5 functions
## Result coverage
**Summary:** 97 producers, 48 consumers
| metric | value |
|---|---|
| total producers | 97 |
| result producers | 97 |
| total consumers | 48 |
| result consumers | 0 |
## Type alias coverage
**Summary:** 112 sites; 0 typed (0%); 112 untyped (100%)
| metric | value |
|---|---|
| total field-access sites | 112 |
| typed sites (canonical field) | 0 |
| untyped sites (wildcard) | 112 |
## Cross-audit findings
_(no cross-audit findings mapped to this aggregate)_
## Decomposition cost
**Current cost estimate:** 720 us/turn
**Componentize savings:** 0 us/turn
**Unify savings:** 0 us/turn
**Recommended direction:** hold
**Rationale:** HistoryMessage: access_pattern=whole_struct, frequency=per_turn, struct_field_count=10, struct_frozen=True. Recommended: hold because the current shape matches the access pattern.
**Struct field count (estimated):** 10
**Struct frozen:** True
## Struct shape (inferred from producer returns)
| field | access count | access pattern |
|---|---|---|
| `content` | 12 | hot |
| `marker` | 12 | hot |
| `get` | 7 | hot |
| `ai_status` | 2 | used |
| `config` | 2 | used |
| `pop` | 2 | used |
| `append` | 2 | used |
| `lock` | 2 | used |
| `messages` | 2 | used |
| `context_files` | 1 | used |
| `_pending_gui_tasks_lock` | 1 | used |
| `_topological_sort_tickets_result` | 1 | used |
| `active_project_root` | 1 | used |
| `event_queue` | 1 | used |
| `engines` | 1 | used |
| `project` | 1 | used |
| `active_discussion` | 1 | used |
| `submit_io` | 1 | used |
| `tracks` | 1 | used |
| `mma_tier_usage` | 1 | used |
| `_pending_gui_tasks` | 1 | used |
| `mma_step_mode` | 1 | used |
| `active_project_path` | 1 | used |
| `items` | 1 | used |
| `estimated_prompt_tokens` | 1 | used |
| `max_prompt_tokens` | 1 | used |
| `utilization_pct` | 1 | used |
| `headroom` | 1 | used |
| `would_trim` | 1 | used |
| `sys_tokens` | 1 | used |
| `tool_tokens` | 1 | used |
| `history_tokens` | 1 | used |
| `search` | 1 | used |
| `_start_track_logic_result` | 1 | used |
| `_est_tokens` | 1 | used |
| `encode` | 1 | used |
| `latency` | 1 | used |
| `_recalculate_session_usage` | 1 | used |
| `_token_stats` | 1 | used |
| `_gemini_cache_text` | 1 | used |
| `vendor_quota` | 1 | used |
| `last_error` | 1 | used |
| `error` | 1 | used |
| `_update_cached_stats` | 1 | used |
| `session_usage` | 1 | used |
| `usage` | 1 | used |
## Optimization candidates
_(no optimization candidates generated)_
## Verdict
HistoryMessage: access_pattern=whole_struct, frequency=per_turn, struct_field_count=10, struct_frozen=True. Recommended: hold because the current shape matches the access pattern.
## Evidence appendix
### Access pattern evidence
| function | pattern | field_accesses | confidence |
|---|---|---|---|
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.aggregate.build_tier3_context` | `whole_struct` | | low |
| `src.ai_client._strip_cache_controls` | `whole_struct` | | low |
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.ai_client._send_anthropic` | `whole_struct` | | low |
| `src.ai_client._estimate_prompt_tokens` | `whole_struct` | | low |
| `src.app_controller._start_track_logic_result` | `field_by_field` | `ai_status`=4, `context_files`=1, `get`=3, `_pending_gui_tasks_lock`=2, `_topological_sort_tickets_result`=1, `active_project_root`=1, `event_queue`=1, `engines`=1, `project`=1, `active_discussion`=1 (+7 more) | high |
| `src.ai_client._strip_private_keys` | `whole_struct` | | low |
| `src.ai_client._trim_anthropic_history` | `whole_struct` | `pop`=5 | high |
| `src.ai_client._add_history_cache_breakpoint` | `whole_struct` | | low |
| `src.aggregate.build_markdown_from_items` | `whole_struct` | | low |
| `src.ai_client._send_gemini_cli` | `whole_struct` | | low |
| `src.ai_client._repair_anthropic_history` | `whole_struct` | `append`=1 | high |
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.project_manager.format_discussion` | `whole_struct` | | low |
| `src.ai_client._create_gemini_cache_result` | `whole_struct` | | low |
| `src.ai_client._dashscope_call` | `whole_struct` | | low |
| `src.ai_client._send_grok` | `whole_struct` | | low |
| `src.app_controller._offload_entry_payload` | `whole_struct` | | low |
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.models._save_config_to_disk` | `whole_struct` | | low |
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.ai_client._execute_single_tool_call_async` | `mixed` | `get`=2, `items`=1 | high |
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.ai_client._repair_deepseek_history` | `whole_struct` | `append`=1 | high |
| `src.ai_client._add_bleed_derived` | `field_by_field` | `estimated_prompt_tokens`=1, `max_prompt_tokens`=1, `utilization_pct`=1, `headroom`=1, `would_trim`=1, `sys_tokens`=1, `tool_tokens`=1, `history_tokens`=1, `get`=3 | high |
| `src.project_manager.flat_config` | `whole_struct` | `get`=7 | high |
| `src.provider_state.append` | `mixed` | `lock`=1, `messages`=1 | high |
| `src.aggregate._build_files_section_from_items` | `whole_struct` | | low |
| `src.ai_client._append_comms` | `whole_struct` | | low |
| `src.ai_client._send_llama_native` | `whole_struct` | | low |
| `src.ai_client.send` | `mixed` | `config`=1, `search`=1 | high |
| `src.app_controller._start_track_logic` | `mixed` | `_start_track_logic_result`=1, `ai_status`=1 | high |
| `src.aggregate.build_markdown_no_history` | `whole_struct` | | low |
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.ai_client._estimate_message_tokens` | `mixed` | `_est_tokens`=1, `get`=2 | high |
| `src.ai_client._pre_dispatch` | `whole_struct` | | low |
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.ai_client._send_gemini` | `whole_struct` | `encode`=1 | high |
| `src.ai_client._send_minimax` | `whole_struct` | | low |
| `src.app_controller._refresh_api_metrics` | `field_by_field` | `latency`=1, `_recalculate_session_usage`=1, `_token_stats`=1, `get`=2, `_gemini_cache_text`=1, `vendor_quota`=1, `last_error`=1, `error`=2, `_update_cached_stats`=1, `session_usage`=2 (+1 more) | high |
| `src.ai_client._send_deepseek` | `whole_struct` | | low |
| `src.provider_state.replace_all` | `mixed` | `lock`=1, `messages`=1 | high |
| `src.ai_client._trim_minimax_history` | `whole_struct` | `pop`=4 | high |
| `src.project_manager.entry_to_str` | `whole_struct` | `get`=4 | high |
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.ai_client.ollama_chat` | `whole_struct` | | low |
### Frequency evidence
| function | frequency | source | note |
|---|---|---|---|
| `src.app_controller.wait` | `per_turn` | `static_analysis` | producer from src\app_controller.py |
| `src.api_hook_client.post_project` | `per_turn` | `static_analysis` | producer from src\api_hook_client.py |
| `src.app_controller.get_mma_status` | `per_turn` | `static_analysis` | producer from src\app_controller.py |
| `src.ai_client._load_credentials` | `per_turn` | `static_analysis` | producer from src\ai_client.py |
| `src.ai_client._pre_dispatch` | `per_turn` | `static_analysis` | producer from src\ai_client.py |
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,92 @@
# Aggregate Profile: ProviderHistory
**Aggregate kind:** candidate_dataclass
**Memory dim:** unknown
**Is candidate:** True
## Pipeline summary
- Producers: 0
- Consumers: 0
- Distinct producer fqnames: 0
- Distinct consumer fqnames: 0
- Access pattern (aggregate): mixed
- Frequency (aggregate): unknown
- Decomposition direction: insufficient_data
- Struct field count (estimated): 0
## Producers (0)
_(none)_
## Consumers (0)
_(none)_
## Field access matrix
_(no field accesses detected)_
## Access pattern
**Dominant pattern:** mixed
**Evidence count:** 0
## SSDL Sketch for ProviderHistory
_(placeholder; candidate aggregate)_
## Frequency
**Dominant frequency:** unknown
**Evidence count:** 0
## Result coverage
**Summary:**
| metric | value |
|---|---|
| total producers | 0 |
| result producers | 0 |
| total consumers | 0 |
| result consumers | 0 |
## Type alias coverage
**Summary:**
| metric | value |
|---|---|
| total field-access sites | 0 |
| typed sites (canonical field) | 0 |
| untyped sites (wildcard) | 0 |
## Cross-audit findings
_(no cross-audit findings mapped to this aggregate)_
## Decomposition cost
**Current cost estimate:** 0 us/turn
**Componentize savings:** 0 us/turn
**Unify savings:** 0 us/turn
**Recommended direction:** insufficient_data
**Rationale:** candidate aggregate; would be detected after any_type_componentization_20260621 merges
**Struct field count (estimated):** 0
**Struct frozen:** False
## Struct shape (inferred from producer returns)
_(no producers; cannot infer shape)_
## Optimization candidates
_(no optimization candidates generated)_
## Verdict
candidate aggregate; would be detected after any_type_componentization_20260621 merges
## Evidence appendix
@@ -0,0 +1,104 @@
# Aggregate Profile: Result
**Aggregate kind:** typealias
**Memory dim:** control
**Is candidate:** False
## Pipeline summary
- Producers: 0
- Consumers: 0
- Distinct producer fqnames: 0
- Distinct consumer fqnames: 0
- Access pattern (aggregate): mixed
- Frequency (aggregate): per_turn
- Decomposition direction: insufficient_data
- Struct field count (estimated): 5
## Producers (0)
_(none)_
## Consumers (0)
_(none)_
## Field access matrix
_(no field accesses detected)_
## Access pattern
**Dominant pattern:** mixed
**Evidence count:** 0
## SSDL Sketch for `Result`
```
[Q:Result entry-point] -> [Q:PCG lookup]
-> [T:done]
```
**Effective codepaths:** 0 (sum of 2^branches across 0 consumers)
**Total branch points:** 0
**Nil-check functions:** 0
**Defusing opportunities:**
- **Immediate-Mode Cache `[Q:key] -> [I:FetchCached] -> [T]`**: Introduce a `result_cache` keyed lookup. Consumers request by key, get cached value, no field-existence checks. Reduces 0 field-check branches to 1 cache lookup.
- Effective codepaths: 0 -> 1
## Frequency
**Dominant frequency:** per_turn
**Evidence count:** 0
## Result coverage
**Summary:** 0 producers, 0 consumers
| metric | value |
|---|---|
| total producers | 0 |
| result producers | 0 |
| total consumers | 0 |
| result consumers | 0 |
## Type alias coverage
**Summary:** 0 sites
| metric | value |
|---|---|
| total field-access sites | 0 |
| typed sites (canonical field) | 0 |
| untyped sites (wildcard) | 0 |
## Cross-audit findings
_(no cross-audit findings mapped to this aggregate)_
## Decomposition cost
**Current cost estimate:** 470 us/turn
**Componentize savings:** 0 us/turn
**Unify savings:** 0 us/turn
**Recommended direction:** insufficient_data
**Rationale:** Result: access_pattern=mixed, frequency=per_turn, struct_field_count=5, struct_frozen=True. Recommended: insufficient_data because runtime profiling is needed to determine the dominant pattern.
**Struct field count (estimated):** 5
**Struct frozen:** True
## Struct shape (inferred from producer returns)
_(no producers; cannot infer shape)_
## Optimization candidates
_(no optimization candidates generated)_
## Verdict
Result: access_pattern=mixed, frequency=per_turn, struct_field_count=5, struct_frozen=True. Recommended: insufficient_data because runtime profiling is needed to determine the dominant pattern.
## Evidence appendix
@@ -0,0 +1,574 @@
# Aggregate Profile: ToolCall
**Aggregate kind:** typealias
**Memory dim:** control
**Is candidate:** False
## Pipeline summary
- Producers: 118
- Consumers: 68
- Distinct producer fqnames: 97
- Distinct consumer fqnames: 48
- Access pattern (aggregate): whole_struct
- Frequency (aggregate): per_turn
- Decomposition direction: hold
- Struct field count (estimated): 10
## Producers (118)
### `src\aggregate.py` (1 producer)
- `src.aggregate.build_file_items` (line 158)
### `src\ai_client.py` (16 producers)
- `src.ai_client._load_credentials` (line 282)
- `src.ai_client._pre_dispatch` (line 2089)
- `src.ai_client.get_comms_log` (line 273)
- `src.ai_client.get_gemini_cache_stats` (line 1604)
- `src.ai_client._add_bleed_derived` (line 3332)
- `src.ai_client._get_anthropic_tools` (line 664)
- `src.ai_client._dashscope_call` (line 2716)
- `src.ai_client._extract_dashscope_tool_calls` (line 2754)
- `src.ai_client._send_cli_round_result` (line 1746)
- `src.ai_client._parse_tool_args_result` (line 741)
- `src.ai_client._content_block_to_dict` (line 1200)
- `src.ai_client.ollama_chat` (line 2938)
- `src.ai_client._get_deepseek_tools` (line 1194)
- `src.ai_client._strip_private_keys` (line 1464)
- `src.ai_client._build_chunked_context_blocks` (line 1281)
- `src.ai_client.get_token_stats` (line 3185)
### `src\api_hook_client.py` (39 producers)
- `src.api_hook_client.post_project` (line 470)
- `src.api_hook_client.drag` (line 230)
- `src.api_hook_client.set_value` (line 212)
- `src.api_hook_client.get_financial_metrics` (line 520)
- `src.api_hook_client.get_gui_health` (line 434)
- `src.api_hook_client.select_list_item` (line 256)
- `src.api_hook_client.get_mma_status` (line 539)
- `src.api_hook_client.get_project_switch_status` (line 374)
- `src.api_hook_client.get_performance` (line 318)
- `src.api_hook_client.get_patch_status` (line 295)
- `src.api_hook_client.get_startup_timeline` (line 353)
- `src.api_hook_client.get_events` (line 124)
- `src.api_hook_client.get_gui_state` (line 165)
- `src.api_hook_client.click` (line 223)
- `src.api_hook_client.get_node_status` (line 532)
- `src.api_hook_client.reject_patch` (line 288)
- `src.api_hook_client.get_project` (line 367)
- `src.api_hook_client.get_warmup_status` (line 325)
- `src.api_hook_client.right_click` (line 237)
- `src.api_hook_client.get_io_pool_status` (line 420)
- `src.api_hook_client.push_event` (line 156)
- `src.api_hook_client.get_warmup_wait` (line 332)
- `src.api_hook_client.get_status` (line 105)
- `src.api_hook_client._make_request` (line 65)
- `src.api_hook_client.wait_for_project_switch` (line 389)
- `src.api_hook_client.apply_patch` (line 281)
- `src.api_hook_client.get_context_state` (line 491)
- `src.api_hook_client.post_project` (line 473)
- `src.api_hook_client.get_warmup_canaries` (line 342)
- `src.api_hook_client.trigger_patch` (line 274)
- `src.api_hook_client.clear_events` (line 129)
- `src.api_hook_client.post_session` (line 117)
- `src.api_hook_client.get_session` (line 502)
- `src.api_hook_client.get_mma_workers` (line 546)
- `src.api_hook_client.get_gui_diagnostics` (line 311)
- `src.api_hook_client.post_gui` (line 149)
- `src.api_hook_client.get_system_telemetry` (line 524)
- `src.api_hook_client.select_tab` (line 263)
- `src.api_hook_client.wait_for_event` (line 136)
### `src\app_controller.py` (30 producers)
- `src.app_controller.wait` (line 5205)
- `src.app_controller.get_mma_status` (line 2835)
- `src.app_controller._api_get_performance` (line 195)
- `src.app_controller.get_performance` (line 2856)
- `src.app_controller.get_diagnostics` (line 2862)
- `src.app_controller.load_config` (line 5142)
- `src.app_controller._api_get_context` (line 398)
- `src.app_controller._api_status` (line 209)
- `src.app_controller.generate` (line 2868)
- `src.app_controller._api_generate` (line 221)
- `src.app_controller._api_token_stats` (line 417)
- `src.app_controller._api_get_gui_state` (line 123)
- `src.app_controller._api_get_diagnostics` (line 202)
- `src.app_controller.get_api_session` (line 2847)
- `src.app_controller.token_stats` (line 2898)
- `src.app_controller._api_get_api_session` (line 170)
- `src.app_controller._offload_entry_payload` (line 4240)
- `src.app_controller._pending_mma_spawn` (line 2772)
- `src.app_controller._api_pending_actions` (line 335)
- `src.app_controller.get_context` (line 2892)
- `src.app_controller.get_session` (line 2883)
- `src.app_controller.status` (line 2865)
- `src.app_controller.get_session_insights` (line 3049)
- `src.app_controller._api_get_api_project` (line 188)
- `src.app_controller._api_get_mma_status` (line 144)
- `src.app_controller._pending_mma_approval` (line 2776)
- `src.app_controller.get_api_project` (line 2853)
- `src.app_controller.pending_actions` (line 2874)
- `src.app_controller.get_gui_state` (line 2829)
- `src.app_controller._api_get_session` (line 374)
### `src\models.py` (23 producers)
- `src.models.to_dict` (line 646)
- `src.models.to_dict` (line 1000)
- `src.models.to_dict` (line 672)
- `src.models.to_dict` (line 938)
- `src.models.to_dict` (line 855)
- `src.models.to_dict` (line 441)
- `src.models.to_dict` (line 406)
- `src.models.to_dict` (line 355)
- `src.models.parse_history_entries` (line 214)
- `src.models.to_dict` (line 737)
- `src.models.to_dict` (line 486)
- `src.models.to_dict` (line 913)
- `src.models.to_dict` (line 596)
- `src.models.to_dict` (line 794)
- `src.models.to_dict` (line 558)
- `src.models.to_dict` (line 971)
- `src.models.to_dict` (line 1024)
- `src.models.to_dict` (line 288)
- `src.models.to_dict` (line 701)
- `src.models.to_dict` (line 886)
- `src.models.to_dict` (line 1059)
- `src.models._load_config_from_disk` (line 186)
- `src.models.to_dict` (line 618)
### `src\openai_compatible.py` (1 producer)
- `src.openai_compatible._to_typed_tool_call` (line 43)
### `src\project_manager.py` (8 producers)
- `src.project_manager.load_history` (line 209)
- `src.project_manager.default_project` (line 123)
- `src.project_manager.migrate_from_legacy_config` (line 253)
- `src.project_manager.load_project` (line 186)
- `src.project_manager.get_all_tracks` (line 342)
- `src.project_manager.default_discussion` (line 117)
- `src.project_manager.flat_config` (line 267)
- `src.project_manager.str_to_entry` (line 75)
## Consumers (68)
### `src\aggregate.py` (5 consumers)
- `src.aggregate.build_tier3_context` (line 382)
- `src.aggregate.build_markdown_from_items` (line 348)
- `src.aggregate._build_files_section_from_items` (line 300)
- `src.aggregate.build_markdown_no_history` (line 366)
- `src.aggregate.run` (line 479)
### `src\ai_client.py` (29 consumers)
- `src.ai_client._strip_cache_controls` (line 1291)
- `src.ai_client._send_anthropic` (line 1405)
- `src.ai_client._estimate_prompt_tokens` (line 1243)
- `src.ai_client._strip_private_keys` (line 1464)
- `src.ai_client._trim_anthropic_history` (line 1353)
- `src.ai_client._add_history_cache_breakpoint` (line 1299)
- `src.ai_client._send_gemini_cli` (line 2019)
- `src.ai_client._repair_anthropic_history` (line 1381)
- `src.ai_client._create_gemini_cache_result` (line 1706)
- `src.ai_client._dashscope_call` (line 2716)
- `src.ai_client._send_grok` (line 2530)
- `src.ai_client._execute_single_tool_call_async` (line 945)
- `src.ai_client._repair_deepseek_history` (line 2138)
- `src.ai_client._add_bleed_derived` (line 3332)
- `src.ai_client._append_comms` (line 257)
- `src.ai_client._send_llama_native` (line 2958)
- `src.ai_client.send` (line 3208)
- `src.ai_client._estimate_message_tokens` (line 1218)
- `src.ai_client._pre_dispatch` (line 2089)
- `src.ai_client._send_gemini` (line 1802)
- `src.ai_client._send_minimax` (line 2616)
- `src.ai_client._send_deepseek` (line 2165)
- `src.ai_client._trim_minimax_history` (line 2482)
- `src.ai_client.ollama_chat` (line 2938)
- `src.ai_client._send_llama` (line 2858)
- `src.ai_client._invalidate_token_estimate` (line 1240)
- `src.ai_client._repair_minimax_history` (line 2462)
- `src.ai_client._send_qwen` (line 2773)
- `src.ai_client._strip_stale_file_refreshes` (line 1253)
### `src\app_controller.py` (5 consumers)
- `src.app_controller._start_track_logic_result` (line 4728)
- `src.app_controller._offload_entry_payload` (line 4240)
- `src.app_controller._start_track_logic` (line 4721)
- `src.app_controller._refresh_api_metrics` (line 3074)
- `src.app_controller._on_comms_entry` (line 4282)
### `src\models.py` (22 consumers)
- `src.models.from_dict` (line 603)
- `src.models.from_dict` (line 416)
- `src.models.from_dict` (line 506)
- `src.models.from_dict` (line 814)
- `src.models.from_dict` (line 893)
- `src.models._save_config_to_disk` (line 199)
- `src.models.from_dict` (line 378)
- `src.models.from_dict` (line 1007)
- `src.models.from_dict` (line 1038)
- `src.models.from_dict` (line 866)
- `src.models.from_dict` (line 712)
- `src.models.from_dict` (line 747)
- `src.models.from_dict` (line 683)
- `src.models.from_dict` (line 575)
- `src.models.from_dict` (line 630)
- `src.models.from_dict` (line 454)
- `src.models.from_dict` (line 949)
- `src.models.from_dict` (line 982)
- `src.models.from_dict` (line 656)
- `src.models.from_dict` (line 1072)
- `src.models.from_dict` (line 295)
- `src.models.from_dict` (line 920)
### `src\openai_compatible.py` (1 consumer)
- `src.openai_compatible._to_dict_tool_call` (line 54)
### `src\openai_schemas.py` (1 consumer)
- `src.openai_schemas.__init__` (line 82)
### `src\project_manager.py` (5 consumers)
- `src.project_manager.format_discussion` (line 69)
- `src.project_manager.flat_config` (line 267)
- `src.project_manager.entry_to_str` (line 49)
- `src.project_manager.save_project` (line 229)
- `src.project_manager.migrate_from_legacy_config` (line 253)
## Field access matrix
| consumer | _est_tokens | _gemini_cache_text | _pending_gui_tasks | _pending_gui_tasks_lock | _recalculate_session_usage | _start_track_logic_result | _token_stats | _topological_sort_tickets_result | _update_cached_stats | active_discussion | active_project_path | active_project_root | ai_status | append | config | content | context_files | encode | engines | error |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `build_tier3_context` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_strip_cache_controls` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `_send_anthropic` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `__init__` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_estimate_prompt_tokens` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_start_track_logic_result` | . | . | 2 | 2 | . | . | . | 1 | . | 1 | 1 | 1 | 4 | . | 1 | . | 1 | . | 1 | . |
| `_strip_private_keys` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_trim_anthropic_history` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_to_dict_tool_call` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_add_history_cache_breakpoint` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `build_markdown_from_items` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_send_gemini_cli` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_repair_anthropic_history` | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . | . | . |
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `format_discussion` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_create_gemini_cache_result` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_dashscope_call` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_send_grok` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_offload_entry_payload` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `_save_config_to_disk` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `_execute_single_tool_call_async` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `_repair_deepseek_history` | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . | . | . |
| `_add_bleed_derived` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `flat_config` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_build_files_section_from_items` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_append_comms` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_send_llama_native` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `send` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . | . |
| `_start_track_logic` | . | . | . | . | . | 1 | . | . | . | . | . | . | 1 | . | . | . | . | . | . | . |
| `build_markdown_no_history` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `_estimate_message_tokens` | 1 | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_pre_dispatch` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `_send_gemini` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . |
| `_send_minimax` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_refresh_api_metrics` | . | 1 | . | . | 1 | . | 1 | . | 1 | . | . | . | . | . | . | . | . | . | . | 2 |
| `_send_deepseek` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_trim_minimax_history` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `entry_to_str` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `ollama_chat` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
_... 25 more fields_
## Access pattern
**Dominant pattern:** whole_struct
**Evidence count:** 50
**Per-function pattern distribution:**
- `whole_struct`: 31 functions (62%)
- `mixed`: 16 functions (32%)
- `field_by_field`: 3 functions (6%)
## SSDL Sketch for `ToolCall`
```
[Q:ToolCall entry-point] -> [Q:PCG lookup]
-> [1: from_dict] [B:check] (branches=0)
-> [2: build_tier3_context] [B:check] (branches=50)
-> [3: _strip_cache_controls] [B:check] (branches=4)
-> [4: from_dict] [B:check] (branches=0)
-> [5: from_dict] [B:check] (branches=0)
-> [6: _send_anthropic] [B:is None?] (branches=40) [N:safe]
-> [7: __init__] [B:is None?] (branches=1) [N:safe]
-> [8: _estimate_prompt_tokens] [B:check] (branches=2)
-> [9: _start_track_logic_result] [B:check] (branches=10)
-> [10: _strip_private_keys] [B:check] (branches=0)
-> [11: _trim_anthropic_history] [B:check] (branches=13)
-> [12: _to_dict_tool_call] [B:check] (branches=0)
-> [13: _add_history_cache_breakpoint] [B:check] (branches=5)
-> [14: build_markdown_from_items] [B:check] (branches=9)
-> [15: _send_gemini_cli] [B:is None?] (branches=23) [N:safe]
-> [16: _repair_anthropic_history] [B:check] (branches=6)
-> [17: from_dict] [B:check] (branches=0)
-> [18: format_discussion] [B:check] (branches=0)
-> [19: _create_gemini_cache_result] [B:check] (branches=3)
-> [20: _dashscope_call] [B:check] (branches=5)
-> [21: _send_grok] [B:check] (branches=14)
-> [22: _offload_entry_payload] [B:check] (branches=10)
-> [23: from_dict] [B:check] (branches=0)
-> [24: _save_config_to_disk] [B:check] (branches=1)
-> [25: from_dict] [B:check] (branches=0)
-> [26: _execute_single_tool_call_async] [B:is None?] (branches=15) [N:safe]
-> [27: from_dict] [B:check] (branches=0)
-> [28: _repair_deepseek_history] [B:check] (branches=6)
-> [29: _add_bleed_derived] [B:check] (branches=0)
-> [30: flat_config] [B:check] (branches=2)
-> [31: _build_files_section_from_items] [B:is None?] (branches=5) [N:safe]
-> [32: _append_comms] [B:is None?] (branches=1) [N:safe]
-> [33: _send_llama_native] [B:check] (branches=12)
-> [34: send] [B:check] (branches=19)
-> [35: _start_track_logic] [B:check] (branches=1)
-> [36: build_markdown_no_history] [B:check] (branches=0)
-> [37: from_dict] [B:check] (branches=0)
-> [38: _estimate_message_tokens] [B:is None?] (branches=9) [N:safe]
-> [39: _pre_dispatch] [B:check] (branches=8)
-> [40: from_dict] [B:check] (branches=0)
-> [41: from_dict] [B:check] (branches=0)
-> [42: _send_gemini] [B:is None?] (branches=75) [N:safe]
-> [43: _send_minimax] [B:check] (branches=11)
-> [44: _refresh_api_metrics] [B:is None?] (branches=11) [N:safe]
-> [45: _send_deepseek] [B:check] (branches=71)
-> [46: _trim_minimax_history] [B:check] (branches=8)
-> [47: entry_to_str] [B:check] (branches=3)
-> [48: from_dict] [B:check] (branches=0)
-> [49: from_dict] [B:check] (branches=0)
-> [50: ollama_chat] [B:check] (branches=3)
-> [51: from_dict] [B:check] (branches=0)
-> [52: _send_llama] [B:check] (branches=13)
-> [53: from_dict] [B:check] (branches=0)
-> [54: run] [B:check] (branches=1)
-> [55: _invalidate_token_estimate] [B:check] (branches=0)
-> [56: _on_comms_entry] [B:check] (branches=32)
-> [57: from_dict] [B:check] (branches=0)
-> [58: _repair_minimax_history] [B:check] (branches=10)
-> [59: from_dict] [B:check] (branches=0)
-> [60: from_dict] [B:check] (branches=0)
-> [61: from_dict] [B:check] (branches=0)
-> [62: _send_qwen] [B:check] (branches=9)
-> [63: save_project] [B:is None?] (branches=7) [N:safe]
-> [64: migrate_from_legacy_config] [B:check] (branches=2)
-> [65: from_dict] [B:check] (branches=0)
-> [66: _strip_stale_file_refreshes] [B:check] (branches=12)
-> [67: from_dict] [B:check] (branches=0)
-> [68: from_dict] [B:check] (branches=0)
-> [T:done]
```
**Effective codepaths:** 40140116231395706750393 (sum of 2^branches across 68 consumers)
**Total branch points:** 542
**Nil-check functions:** 10
**Defusing opportunities:**
- **Nil Sentinel `[N]`**: Introduce a module-level `NIL_<AGGREGATE>` sentinel whose field accesses return safe defaults. Replace None checks with the sentinel. Collapses 2^branch_count into ~1.
- Effective codepaths: 40140116231395706750393 -> 40140116231395706750373
- **Immediate-Mode Cache `[Q:key] -> [I:FetchCached] -> [T]`**: Introduce a `toolcall_cache` keyed lookup. Consumers request by key, get cached value, no field-existence checks. Reduces 109 field-check branches to 1 cache lookup.
- Effective codepaths: 40140116231395706750393 -> 109
- **Generational Handles `[I:ResolveHandle] -> [B:Gen matches?] -> [N|safe]`**: Wrap the aggregate in a generational handle (index + generation). Validation is one comparison; mismatch returns the nil sentinel. Reduces N lifetime branches to 1 handle validation + sentinel return.
- Effective codepaths: 40140116231395706750393 -> 68
## Frequency
**Dominant frequency:** per_turn
**Evidence count:** 5
**Per-function frequency distribution:**
- `per_turn`: 5 functions
## Result coverage
**Summary:** 97 producers, 48 consumers
| metric | value |
|---|---|
| total producers | 97 |
| result producers | 97 |
| total consumers | 48 |
| result consumers | 0 |
## Type alias coverage
**Summary:** 109 sites; 0 typed (0%); 109 untyped (100%)
| metric | value |
|---|---|
| total field-access sites | 109 |
| typed sites (canonical field) | 0 |
| untyped sites (wildcard) | 109 |
## Cross-audit findings
_(no cross-audit findings mapped to this aggregate)_
## Decomposition cost
**Current cost estimate:** 720 us/turn
**Componentize savings:** 0 us/turn
**Unify savings:** 0 us/turn
**Recommended direction:** hold
**Rationale:** ToolCall: access_pattern=whole_struct, frequency=per_turn, struct_field_count=10, struct_frozen=True. Recommended: hold because the current shape matches the access pattern.
**Struct field count (estimated):** 10
**Struct frozen:** True
## Struct shape (inferred from producer returns)
| field | access count | access pattern |
|---|---|---|
| `content` | 12 | hot |
| `marker` | 12 | hot |
| `get` | 7 | hot |
| `ai_status` | 2 | used |
| `config` | 2 | used |
| `pop` | 2 | used |
| `append` | 2 | used |
| `context_files` | 1 | used |
| `_pending_gui_tasks_lock` | 1 | used |
| `_topological_sort_tickets_result` | 1 | used |
| `active_project_root` | 1 | used |
| `event_queue` | 1 | used |
| `engines` | 1 | used |
| `project` | 1 | used |
| `active_discussion` | 1 | used |
| `submit_io` | 1 | used |
| `tracks` | 1 | used |
| `mma_tier_usage` | 1 | used |
| `_pending_gui_tasks` | 1 | used |
| `mma_step_mode` | 1 | used |
| `active_project_path` | 1 | used |
| `to_dict` | 1 | used |
| `items` | 1 | used |
| `estimated_prompt_tokens` | 1 | used |
| `max_prompt_tokens` | 1 | used |
| `utilization_pct` | 1 | used |
| `headroom` | 1 | used |
| `would_trim` | 1 | used |
| `sys_tokens` | 1 | used |
| `tool_tokens` | 1 | used |
| `history_tokens` | 1 | used |
| `search` | 1 | used |
| `_start_track_logic_result` | 1 | used |
| `_est_tokens` | 1 | used |
| `encode` | 1 | used |
| `latency` | 1 | used |
| `_recalculate_session_usage` | 1 | used |
| `_token_stats` | 1 | used |
| `_gemini_cache_text` | 1 | used |
| `vendor_quota` | 1 | used |
| `last_error` | 1 | used |
| `error` | 1 | used |
| `_update_cached_stats` | 1 | used |
| `session_usage` | 1 | used |
| `usage` | 1 | used |
## Optimization candidates
_(no optimization candidates generated)_
## Verdict
ToolCall: access_pattern=whole_struct, frequency=per_turn, struct_field_count=10, struct_frozen=True. Recommended: hold because the current shape matches the access pattern.
## Evidence appendix
### Access pattern evidence
| function | pattern | field_accesses | confidence |
|---|---|---|---|
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.aggregate.build_tier3_context` | `whole_struct` | | low |
| `src.ai_client._strip_cache_controls` | `whole_struct` | | low |
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.ai_client._send_anthropic` | `whole_struct` | | low |
| `src.openai_schemas.__init__` | `whole_struct` | | low |
| `src.ai_client._estimate_prompt_tokens` | `whole_struct` | | low |
| `src.app_controller._start_track_logic_result` | `field_by_field` | `ai_status`=4, `context_files`=1, `get`=3, `_pending_gui_tasks_lock`=2, `_topological_sort_tickets_result`=1, `active_project_root`=1, `event_queue`=1, `engines`=1, `project`=1, `active_discussion`=1 (+7 more) | high |
| `src.ai_client._strip_private_keys` | `whole_struct` | | low |
| `src.ai_client._trim_anthropic_history` | `whole_struct` | `pop`=5 | high |
| `src.openai_compatible._to_dict_tool_call` | `whole_struct` | `to_dict`=1 | high |
| `src.ai_client._add_history_cache_breakpoint` | `whole_struct` | | low |
| `src.aggregate.build_markdown_from_items` | `whole_struct` | | low |
| `src.ai_client._send_gemini_cli` | `whole_struct` | | low |
| `src.ai_client._repair_anthropic_history` | `whole_struct` | `append`=1 | high |
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.project_manager.format_discussion` | `whole_struct` | | low |
| `src.ai_client._create_gemini_cache_result` | `whole_struct` | | low |
| `src.ai_client._dashscope_call` | `whole_struct` | | low |
| `src.ai_client._send_grok` | `whole_struct` | | low |
| `src.app_controller._offload_entry_payload` | `whole_struct` | | low |
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.models._save_config_to_disk` | `whole_struct` | | low |
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.ai_client._execute_single_tool_call_async` | `mixed` | `get`=2, `items`=1 | high |
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.ai_client._repair_deepseek_history` | `whole_struct` | `append`=1 | high |
| `src.ai_client._add_bleed_derived` | `field_by_field` | `estimated_prompt_tokens`=1, `max_prompt_tokens`=1, `utilization_pct`=1, `headroom`=1, `would_trim`=1, `sys_tokens`=1, `tool_tokens`=1, `history_tokens`=1, `get`=3 | high |
| `src.project_manager.flat_config` | `whole_struct` | `get`=7 | high |
| `src.aggregate._build_files_section_from_items` | `whole_struct` | | low |
| `src.ai_client._append_comms` | `whole_struct` | | low |
| `src.ai_client._send_llama_native` | `whole_struct` | | low |
| `src.ai_client.send` | `mixed` | `config`=1, `search`=1 | high |
| `src.app_controller._start_track_logic` | `mixed` | `_start_track_logic_result`=1, `ai_status`=1 | high |
| `src.aggregate.build_markdown_no_history` | `whole_struct` | | low |
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.ai_client._estimate_message_tokens` | `mixed` | `_est_tokens`=1, `get`=2 | high |
| `src.ai_client._pre_dispatch` | `whole_struct` | | low |
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.ai_client._send_gemini` | `whole_struct` | `encode`=1 | high |
| `src.ai_client._send_minimax` | `whole_struct` | | low |
| `src.app_controller._refresh_api_metrics` | `field_by_field` | `latency`=1, `_recalculate_session_usage`=1, `_token_stats`=1, `get`=2, `_gemini_cache_text`=1, `vendor_quota`=1, `last_error`=1, `error`=2, `_update_cached_stats`=1, `session_usage`=2 (+1 more) | high |
| `src.ai_client._send_deepseek` | `whole_struct` | | low |
| `src.ai_client._trim_minimax_history` | `whole_struct` | `pop`=4 | high |
| `src.project_manager.entry_to_str` | `whole_struct` | `get`=4 | high |
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.ai_client.ollama_chat` | `whole_struct` | | low |
### Frequency evidence
| function | frequency | source | note |
|---|---|---|---|
| `src.app_controller.wait` | `per_turn` | `static_analysis` | producer from src\app_controller.py |
| `src.api_hook_client.post_project` | `per_turn` | `static_analysis` | producer from src\api_hook_client.py |
| `src.app_controller.get_mma_status` | `per_turn` | `static_analysis` | producer from src\app_controller.py |
| `src.ai_client._load_credentials` | `per_turn` | `static_analysis` | producer from src\ai_client.py |
| `src.ai_client._pre_dispatch` | `per_turn` | `static_analysis` | producer from src\ai_client.py |
@@ -0,0 +1,563 @@
# Aggregate Profile: ToolDefinition
**Aggregate kind:** typealias
**Memory dim:** control
**Is candidate:** False
## Pipeline summary
- Producers: 119
- Consumers: 66
- Distinct producer fqnames: 98
- Distinct consumer fqnames: 46
- Access pattern (aggregate): whole_struct
- Frequency (aggregate): per_turn
- Decomposition direction: hold
- Struct field count (estimated): 10
## Producers (119)
### `src\aggregate.py` (1 producer)
- `src.aggregate.build_file_items` (line 158)
### `src\ai_client.py` (18 producers)
- `src.ai_client._load_credentials` (line 282)
- `src.ai_client._pre_dispatch` (line 2089)
- `src.ai_client._build_deepseek_tools` (line 1148)
- `src.ai_client.get_comms_log` (line 273)
- `src.ai_client.get_gemini_cache_stats` (line 1604)
- `src.ai_client._add_bleed_derived` (line 3332)
- `src.ai_client._get_anthropic_tools` (line 664)
- `src.ai_client._dashscope_call` (line 2716)
- `src.ai_client._build_anthropic_tools` (line 623)
- `src.ai_client._extract_dashscope_tool_calls` (line 2754)
- `src.ai_client._send_cli_round_result` (line 1746)
- `src.ai_client._parse_tool_args_result` (line 741)
- `src.ai_client._content_block_to_dict` (line 1200)
- `src.ai_client.ollama_chat` (line 2938)
- `src.ai_client._get_deepseek_tools` (line 1194)
- `src.ai_client._strip_private_keys` (line 1464)
- `src.ai_client._build_chunked_context_blocks` (line 1281)
- `src.ai_client.get_token_stats` (line 3185)
### `src\api_hook_client.py` (39 producers)
- `src.api_hook_client.post_project` (line 470)
- `src.api_hook_client.drag` (line 230)
- `src.api_hook_client.set_value` (line 212)
- `src.api_hook_client.get_financial_metrics` (line 520)
- `src.api_hook_client.get_gui_health` (line 434)
- `src.api_hook_client.select_list_item` (line 256)
- `src.api_hook_client.get_mma_status` (line 539)
- `src.api_hook_client.get_project_switch_status` (line 374)
- `src.api_hook_client.get_performance` (line 318)
- `src.api_hook_client.get_patch_status` (line 295)
- `src.api_hook_client.get_startup_timeline` (line 353)
- `src.api_hook_client.get_events` (line 124)
- `src.api_hook_client.get_gui_state` (line 165)
- `src.api_hook_client.click` (line 223)
- `src.api_hook_client.get_node_status` (line 532)
- `src.api_hook_client.reject_patch` (line 288)
- `src.api_hook_client.get_project` (line 367)
- `src.api_hook_client.get_warmup_status` (line 325)
- `src.api_hook_client.right_click` (line 237)
- `src.api_hook_client.get_io_pool_status` (line 420)
- `src.api_hook_client.push_event` (line 156)
- `src.api_hook_client.get_warmup_wait` (line 332)
- `src.api_hook_client.get_status` (line 105)
- `src.api_hook_client._make_request` (line 65)
- `src.api_hook_client.wait_for_project_switch` (line 389)
- `src.api_hook_client.apply_patch` (line 281)
- `src.api_hook_client.get_context_state` (line 491)
- `src.api_hook_client.post_project` (line 473)
- `src.api_hook_client.get_warmup_canaries` (line 342)
- `src.api_hook_client.trigger_patch` (line 274)
- `src.api_hook_client.clear_events` (line 129)
- `src.api_hook_client.post_session` (line 117)
- `src.api_hook_client.get_session` (line 502)
- `src.api_hook_client.get_mma_workers` (line 546)
- `src.api_hook_client.get_gui_diagnostics` (line 311)
- `src.api_hook_client.post_gui` (line 149)
- `src.api_hook_client.get_system_telemetry` (line 524)
- `src.api_hook_client.select_tab` (line 263)
- `src.api_hook_client.wait_for_event` (line 136)
### `src\app_controller.py` (30 producers)
- `src.app_controller.wait` (line 5205)
- `src.app_controller.get_mma_status` (line 2835)
- `src.app_controller._api_get_performance` (line 195)
- `src.app_controller.get_performance` (line 2856)
- `src.app_controller.get_diagnostics` (line 2862)
- `src.app_controller.load_config` (line 5142)
- `src.app_controller._api_get_context` (line 398)
- `src.app_controller._api_status` (line 209)
- `src.app_controller.generate` (line 2868)
- `src.app_controller._api_generate` (line 221)
- `src.app_controller._api_token_stats` (line 417)
- `src.app_controller._api_get_gui_state` (line 123)
- `src.app_controller._api_get_diagnostics` (line 202)
- `src.app_controller.get_api_session` (line 2847)
- `src.app_controller.token_stats` (line 2898)
- `src.app_controller._api_get_api_session` (line 170)
- `src.app_controller._offload_entry_payload` (line 4240)
- `src.app_controller._pending_mma_spawn` (line 2772)
- `src.app_controller._api_pending_actions` (line 335)
- `src.app_controller.get_context` (line 2892)
- `src.app_controller.get_session` (line 2883)
- `src.app_controller.status` (line 2865)
- `src.app_controller.get_session_insights` (line 3049)
- `src.app_controller._api_get_api_project` (line 188)
- `src.app_controller._api_get_mma_status` (line 144)
- `src.app_controller._pending_mma_approval` (line 2776)
- `src.app_controller.get_api_project` (line 2853)
- `src.app_controller.pending_actions` (line 2874)
- `src.app_controller.get_gui_state` (line 2829)
- `src.app_controller._api_get_session` (line 374)
### `src\models.py` (23 producers)
- `src.models.to_dict` (line 646)
- `src.models.to_dict` (line 1000)
- `src.models.to_dict` (line 672)
- `src.models.to_dict` (line 938)
- `src.models.to_dict` (line 855)
- `src.models.to_dict` (line 441)
- `src.models.to_dict` (line 406)
- `src.models.to_dict` (line 355)
- `src.models.parse_history_entries` (line 214)
- `src.models.to_dict` (line 737)
- `src.models.to_dict` (line 486)
- `src.models.to_dict` (line 913)
- `src.models.to_dict` (line 596)
- `src.models.to_dict` (line 794)
- `src.models.to_dict` (line 558)
- `src.models.to_dict` (line 971)
- `src.models.to_dict` (line 1024)
- `src.models.to_dict` (line 288)
- `src.models.to_dict` (line 701)
- `src.models.to_dict` (line 886)
- `src.models.to_dict` (line 1059)
- `src.models._load_config_from_disk` (line 186)
- `src.models.to_dict` (line 618)
### `src\project_manager.py` (8 producers)
- `src.project_manager.load_history` (line 209)
- `src.project_manager.default_project` (line 123)
- `src.project_manager.migrate_from_legacy_config` (line 253)
- `src.project_manager.load_project` (line 186)
- `src.project_manager.get_all_tracks` (line 342)
- `src.project_manager.default_discussion` (line 117)
- `src.project_manager.flat_config` (line 267)
- `src.project_manager.str_to_entry` (line 75)
## Consumers (66)
### `src\aggregate.py` (5 consumers)
- `src.aggregate.build_tier3_context` (line 382)
- `src.aggregate.build_markdown_from_items` (line 348)
- `src.aggregate._build_files_section_from_items` (line 300)
- `src.aggregate.build_markdown_no_history` (line 366)
- `src.aggregate.run` (line 479)
### `src\ai_client.py` (29 consumers)
- `src.ai_client._strip_cache_controls` (line 1291)
- `src.ai_client._send_anthropic` (line 1405)
- `src.ai_client._estimate_prompt_tokens` (line 1243)
- `src.ai_client._strip_private_keys` (line 1464)
- `src.ai_client._trim_anthropic_history` (line 1353)
- `src.ai_client._add_history_cache_breakpoint` (line 1299)
- `src.ai_client._send_gemini_cli` (line 2019)
- `src.ai_client._repair_anthropic_history` (line 1381)
- `src.ai_client._create_gemini_cache_result` (line 1706)
- `src.ai_client._dashscope_call` (line 2716)
- `src.ai_client._send_grok` (line 2530)
- `src.ai_client._execute_single_tool_call_async` (line 945)
- `src.ai_client._repair_deepseek_history` (line 2138)
- `src.ai_client._add_bleed_derived` (line 3332)
- `src.ai_client._append_comms` (line 257)
- `src.ai_client._send_llama_native` (line 2958)
- `src.ai_client.send` (line 3208)
- `src.ai_client._estimate_message_tokens` (line 1218)
- `src.ai_client._pre_dispatch` (line 2089)
- `src.ai_client._send_gemini` (line 1802)
- `src.ai_client._send_minimax` (line 2616)
- `src.ai_client._send_deepseek` (line 2165)
- `src.ai_client._trim_minimax_history` (line 2482)
- `src.ai_client.ollama_chat` (line 2938)
- `src.ai_client._send_llama` (line 2858)
- `src.ai_client._invalidate_token_estimate` (line 1240)
- `src.ai_client._repair_minimax_history` (line 2462)
- `src.ai_client._send_qwen` (line 2773)
- `src.ai_client._strip_stale_file_refreshes` (line 1253)
### `src\app_controller.py` (5 consumers)
- `src.app_controller._start_track_logic_result` (line 4728)
- `src.app_controller._offload_entry_payload` (line 4240)
- `src.app_controller._start_track_logic` (line 4721)
- `src.app_controller._refresh_api_metrics` (line 3074)
- `src.app_controller._on_comms_entry` (line 4282)
### `src\models.py` (22 consumers)
- `src.models.from_dict` (line 603)
- `src.models.from_dict` (line 416)
- `src.models.from_dict` (line 506)
- `src.models.from_dict` (line 814)
- `src.models.from_dict` (line 893)
- `src.models._save_config_to_disk` (line 199)
- `src.models.from_dict` (line 378)
- `src.models.from_dict` (line 1007)
- `src.models.from_dict` (line 1038)
- `src.models.from_dict` (line 866)
- `src.models.from_dict` (line 712)
- `src.models.from_dict` (line 747)
- `src.models.from_dict` (line 683)
- `src.models.from_dict` (line 575)
- `src.models.from_dict` (line 630)
- `src.models.from_dict` (line 454)
- `src.models.from_dict` (line 949)
- `src.models.from_dict` (line 982)
- `src.models.from_dict` (line 656)
- `src.models.from_dict` (line 1072)
- `src.models.from_dict` (line 295)
- `src.models.from_dict` (line 920)
### `src\project_manager.py` (5 consumers)
- `src.project_manager.format_discussion` (line 69)
- `src.project_manager.flat_config` (line 267)
- `src.project_manager.entry_to_str` (line 49)
- `src.project_manager.save_project` (line 229)
- `src.project_manager.migrate_from_legacy_config` (line 253)
## Field access matrix
| consumer | _est_tokens | _gemini_cache_text | _pending_gui_tasks | _pending_gui_tasks_lock | _recalculate_session_usage | _start_track_logic_result | _token_stats | _topological_sort_tickets_result | _update_cached_stats | active_discussion | active_project_path | active_project_root | ai_status | append | config | content | context_files | encode | engines | error |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `build_tier3_context` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_strip_cache_controls` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `_send_anthropic` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_estimate_prompt_tokens` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_start_track_logic_result` | . | . | 2 | 2 | . | . | . | 1 | . | 1 | 1 | 1 | 4 | . | 1 | . | 1 | . | 1 | . |
| `_strip_private_keys` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_trim_anthropic_history` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_add_history_cache_breakpoint` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `build_markdown_from_items` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_send_gemini_cli` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_repair_anthropic_history` | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . | . | . |
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `format_discussion` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_create_gemini_cache_result` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_dashscope_call` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_send_grok` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_offload_entry_payload` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `_save_config_to_disk` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `_execute_single_tool_call_async` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `_repair_deepseek_history` | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . | . | . |
| `_add_bleed_derived` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `flat_config` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_build_files_section_from_items` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_append_comms` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_send_llama_native` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `send` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . | . |
| `_start_track_logic` | . | . | . | . | . | 1 | . | . | . | . | . | . | 1 | . | . | . | . | . | . | . |
| `build_markdown_no_history` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `_estimate_message_tokens` | 1 | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_pre_dispatch` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `_send_gemini` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . |
| `_send_minimax` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_refresh_api_metrics` | . | 1 | . | . | 1 | . | 1 | . | 1 | . | . | . | . | . | . | . | . | . | . | 2 |
| `_send_deepseek` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `_trim_minimax_history` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `entry_to_str` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `ollama_chat` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| `from_dict` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 1 | . | . | . | . |
| `_send_llama` | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
_... 24 more fields_
## Access pattern
**Dominant pattern:** whole_struct
**Evidence count:** 50
**Per-function pattern distribution:**
- `whole_struct`: 30 functions (60%)
- `mixed`: 17 functions (34%)
- `field_by_field`: 3 functions (6%)
## SSDL Sketch for `ToolDefinition`
```
[Q:ToolDefinition entry-point] -> [Q:PCG lookup]
-> [1: from_dict] [B:check] (branches=0)
-> [2: build_tier3_context] [B:check] (branches=50)
-> [3: _strip_cache_controls] [B:check] (branches=4)
-> [4: from_dict] [B:check] (branches=0)
-> [5: from_dict] [B:check] (branches=0)
-> [6: _send_anthropic] [B:is None?] (branches=40) [N:safe]
-> [7: _estimate_prompt_tokens] [B:check] (branches=2)
-> [8: _start_track_logic_result] [B:check] (branches=10)
-> [9: _strip_private_keys] [B:check] (branches=0)
-> [10: _trim_anthropic_history] [B:check] (branches=13)
-> [11: _add_history_cache_breakpoint] [B:check] (branches=5)
-> [12: build_markdown_from_items] [B:check] (branches=9)
-> [13: _send_gemini_cli] [B:is None?] (branches=23) [N:safe]
-> [14: _repair_anthropic_history] [B:check] (branches=6)
-> [15: from_dict] [B:check] (branches=0)
-> [16: format_discussion] [B:check] (branches=0)
-> [17: _create_gemini_cache_result] [B:check] (branches=3)
-> [18: _dashscope_call] [B:check] (branches=5)
-> [19: _send_grok] [B:check] (branches=14)
-> [20: _offload_entry_payload] [B:check] (branches=10)
-> [21: from_dict] [B:check] (branches=0)
-> [22: _save_config_to_disk] [B:check] (branches=1)
-> [23: from_dict] [B:check] (branches=0)
-> [24: _execute_single_tool_call_async] [B:is None?] (branches=15) [N:safe]
-> [25: from_dict] [B:check] (branches=0)
-> [26: _repair_deepseek_history] [B:check] (branches=6)
-> [27: _add_bleed_derived] [B:check] (branches=0)
-> [28: flat_config] [B:check] (branches=2)
-> [29: _build_files_section_from_items] [B:is None?] (branches=5) [N:safe]
-> [30: _append_comms] [B:is None?] (branches=1) [N:safe]
-> [31: _send_llama_native] [B:check] (branches=12)
-> [32: send] [B:check] (branches=19)
-> [33: _start_track_logic] [B:check] (branches=1)
-> [34: build_markdown_no_history] [B:check] (branches=0)
-> [35: from_dict] [B:check] (branches=0)
-> [36: _estimate_message_tokens] [B:is None?] (branches=9) [N:safe]
-> [37: _pre_dispatch] [B:check] (branches=8)
-> [38: from_dict] [B:check] (branches=0)
-> [39: from_dict] [B:check] (branches=0)
-> [40: _send_gemini] [B:is None?] (branches=75) [N:safe]
-> [41: _send_minimax] [B:check] (branches=11)
-> [42: _refresh_api_metrics] [B:is None?] (branches=11) [N:safe]
-> [43: _send_deepseek] [B:check] (branches=71)
-> [44: _trim_minimax_history] [B:check] (branches=8)
-> [45: entry_to_str] [B:check] (branches=3)
-> [46: from_dict] [B:check] (branches=0)
-> [47: from_dict] [B:check] (branches=0)
-> [48: ollama_chat] [B:check] (branches=3)
-> [49: from_dict] [B:check] (branches=0)
-> [50: _send_llama] [B:check] (branches=13)
-> [51: from_dict] [B:check] (branches=0)
-> [52: run] [B:check] (branches=1)
-> [53: _invalidate_token_estimate] [B:check] (branches=0)
-> [54: _on_comms_entry] [B:check] (branches=32)
-> [55: from_dict] [B:check] (branches=0)
-> [56: _repair_minimax_history] [B:check] (branches=10)
-> [57: from_dict] [B:check] (branches=0)
-> [58: from_dict] [B:check] (branches=0)
-> [59: from_dict] [B:check] (branches=0)
-> [60: _send_qwen] [B:check] (branches=9)
-> [61: save_project] [B:is None?] (branches=7) [N:safe]
-> [62: migrate_from_legacy_config] [B:check] (branches=2)
-> [63: from_dict] [B:check] (branches=0)
-> [64: _strip_stale_file_refreshes] [B:check] (branches=12)
-> [65: from_dict] [B:check] (branches=0)
-> [66: from_dict] [B:check] (branches=0)
-> [T:done]
```
**Effective codepaths:** 40140116231395706750390 (sum of 2^branches across 66 consumers)
**Total branch points:** 541
**Nil-check functions:** 9
**Defusing opportunities:**
- **Nil Sentinel `[N]`**: Introduce a module-level `NIL_<AGGREGATE>` sentinel whose field accesses return safe defaults. Replace None checks with the sentinel. Collapses 2^branch_count into ~1.
- Effective codepaths: 40140116231395706750390 -> 40140116231395706750372
- **Immediate-Mode Cache `[Q:key] -> [I:FetchCached] -> [T]`**: Introduce a `tooldefinition_cache` keyed lookup. Consumers request by key, get cached value, no field-existence checks. Reduces 110 field-check branches to 1 cache lookup.
- Effective codepaths: 40140116231395706750390 -> 110
- **Generational Handles `[I:ResolveHandle] -> [B:Gen matches?] -> [N|safe]`**: Wrap the aggregate in a generational handle (index + generation). Validation is one comparison; mismatch returns the nil sentinel. Reduces N lifetime branches to 1 handle validation + sentinel return.
- Effective codepaths: 40140116231395706750390 -> 66
## Frequency
**Dominant frequency:** per_turn
**Evidence count:** 5
**Per-function frequency distribution:**
- `per_turn`: 5 functions
## Result coverage
**Summary:** 98 producers, 46 consumers
| metric | value |
|---|---|
| total producers | 98 |
| result producers | 98 |
| total consumers | 46 |
| result consumers | 0 |
## Type alias coverage
**Summary:** 110 sites; 0 typed (0%); 110 untyped (100%)
| metric | value |
|---|---|
| total field-access sites | 110 |
| typed sites (canonical field) | 0 |
| untyped sites (wildcard) | 110 |
## Cross-audit findings
| bucket | audit script | site count | example file | example line | note |
|---|---|---|---|---|---|
| optional_in_baseline | `audit_optional_in_3_files` | 76 | `src\ai_client.py` | 159 | 76 sites |
## Decomposition cost
**Current cost estimate:** 720 us/turn
**Componentize savings:** 0 us/turn
**Unify savings:** 0 us/turn
**Recommended direction:** hold
**Rationale:** ToolDefinition: access_pattern=whole_struct, frequency=per_turn, struct_field_count=10, struct_frozen=True. Recommended: hold because the current shape matches the access pattern.
**Struct field count (estimated):** 10
**Struct frozen:** True
## Struct shape (inferred from producer returns)
| field | access count | access pattern |
|---|---|---|
| `content` | 13 | hot |
| `marker` | 13 | hot |
| `get` | 7 | hot |
| `ai_status` | 2 | used |
| `config` | 2 | used |
| `pop` | 2 | used |
| `append` | 2 | used |
| `context_files` | 1 | used |
| `_pending_gui_tasks_lock` | 1 | used |
| `_topological_sort_tickets_result` | 1 | used |
| `active_project_root` | 1 | used |
| `event_queue` | 1 | used |
| `engines` | 1 | used |
| `project` | 1 | used |
| `active_discussion` | 1 | used |
| `submit_io` | 1 | used |
| `tracks` | 1 | used |
| `mma_tier_usage` | 1 | used |
| `_pending_gui_tasks` | 1 | used |
| `mma_step_mode` | 1 | used |
| `active_project_path` | 1 | used |
| `items` | 1 | used |
| `estimated_prompt_tokens` | 1 | used |
| `max_prompt_tokens` | 1 | used |
| `utilization_pct` | 1 | used |
| `headroom` | 1 | used |
| `would_trim` | 1 | used |
| `sys_tokens` | 1 | used |
| `tool_tokens` | 1 | used |
| `history_tokens` | 1 | used |
| `search` | 1 | used |
| `_start_track_logic_result` | 1 | used |
| `_est_tokens` | 1 | used |
| `encode` | 1 | used |
| `latency` | 1 | used |
| `_recalculate_session_usage` | 1 | used |
| `_token_stats` | 1 | used |
| `_gemini_cache_text` | 1 | used |
| `vendor_quota` | 1 | used |
| `last_error` | 1 | used |
| `error` | 1 | used |
| `_update_cached_stats` | 1 | used |
| `session_usage` | 1 | used |
| `usage` | 1 | used |
## Optimization candidates
_(no optimization candidates generated)_
## Verdict
ToolDefinition: access_pattern=whole_struct, frequency=per_turn, struct_field_count=10, struct_frozen=True. Recommended: hold because the current shape matches the access pattern.
## Evidence appendix
### Access pattern evidence
| function | pattern | field_accesses | confidence |
|---|---|---|---|
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.aggregate.build_tier3_context` | `whole_struct` | | low |
| `src.ai_client._strip_cache_controls` | `whole_struct` | | low |
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.ai_client._send_anthropic` | `whole_struct` | | low |
| `src.ai_client._estimate_prompt_tokens` | `whole_struct` | | low |
| `src.app_controller._start_track_logic_result` | `field_by_field` | `ai_status`=4, `context_files`=1, `get`=3, `_pending_gui_tasks_lock`=2, `_topological_sort_tickets_result`=1, `active_project_root`=1, `event_queue`=1, `engines`=1, `project`=1, `active_discussion`=1 (+7 more) | high |
| `src.ai_client._strip_private_keys` | `whole_struct` | | low |
| `src.ai_client._trim_anthropic_history` | `whole_struct` | `pop`=5 | high |
| `src.ai_client._add_history_cache_breakpoint` | `whole_struct` | | low |
| `src.aggregate.build_markdown_from_items` | `whole_struct` | | low |
| `src.ai_client._send_gemini_cli` | `whole_struct` | | low |
| `src.ai_client._repair_anthropic_history` | `whole_struct` | `append`=1 | high |
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.project_manager.format_discussion` | `whole_struct` | | low |
| `src.ai_client._create_gemini_cache_result` | `whole_struct` | | low |
| `src.ai_client._dashscope_call` | `whole_struct` | | low |
| `src.ai_client._send_grok` | `whole_struct` | | low |
| `src.app_controller._offload_entry_payload` | `whole_struct` | | low |
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.models._save_config_to_disk` | `whole_struct` | | low |
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.ai_client._execute_single_tool_call_async` | `mixed` | `get`=2, `items`=1 | high |
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.ai_client._repair_deepseek_history` | `whole_struct` | `append`=1 | high |
| `src.ai_client._add_bleed_derived` | `field_by_field` | `estimated_prompt_tokens`=1, `max_prompt_tokens`=1, `utilization_pct`=1, `headroom`=1, `would_trim`=1, `sys_tokens`=1, `tool_tokens`=1, `history_tokens`=1, `get`=3 | high |
| `src.project_manager.flat_config` | `whole_struct` | `get`=7 | high |
| `src.aggregate._build_files_section_from_items` | `whole_struct` | | low |
| `src.ai_client._append_comms` | `whole_struct` | | low |
| `src.ai_client._send_llama_native` | `whole_struct` | | low |
| `src.ai_client.send` | `mixed` | `config`=1, `search`=1 | high |
| `src.app_controller._start_track_logic` | `mixed` | `_start_track_logic_result`=1, `ai_status`=1 | high |
| `src.aggregate.build_markdown_no_history` | `whole_struct` | | low |
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.ai_client._estimate_message_tokens` | `mixed` | `_est_tokens`=1, `get`=2 | high |
| `src.ai_client._pre_dispatch` | `whole_struct` | | low |
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.ai_client._send_gemini` | `whole_struct` | `encode`=1 | high |
| `src.ai_client._send_minimax` | `whole_struct` | | low |
| `src.app_controller._refresh_api_metrics` | `field_by_field` | `latency`=1, `_recalculate_session_usage`=1, `_token_stats`=1, `get`=2, `_gemini_cache_text`=1, `vendor_quota`=1, `last_error`=1, `error`=2, `_update_cached_stats`=1, `session_usage`=2 (+1 more) | high |
| `src.ai_client._send_deepseek` | `whole_struct` | | low |
| `src.ai_client._trim_minimax_history` | `whole_struct` | `pop`=4 | high |
| `src.project_manager.entry_to_str` | `whole_struct` | `get`=4 | high |
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.ai_client.ollama_chat` | `whole_struct` | | low |
| `src.models.from_dict` | `mixed` | `content`=1, `marker`=1 | high |
| `src.ai_client._send_llama` | `whole_struct` | | low |
### Frequency evidence
| function | frequency | source | note |
|---|---|---|---|
| `src.app_controller.wait` | `per_turn` | `static_analysis` | producer from src\app_controller.py |
| `src.api_hook_client.post_project` | `per_turn` | `static_analysis` | producer from src\api_hook_client.py |
| `src.app_controller.get_mma_status` | `per_turn` | `static_analysis` | producer from src\app_controller.py |
| `src.ai_client._load_credentials` | `per_turn` | `static_analysis` | producer from src\ai_client.py |
| `src.ai_client._pre_dispatch` | `per_turn` | `static_analysis` | producer from src\ai_client.py |
@@ -0,0 +1,92 @@
# Aggregate Profile: ToolSpec
**Aggregate kind:** candidate_dataclass
**Memory dim:** unknown
**Is candidate:** True
## Pipeline summary
- Producers: 0
- Consumers: 0
- Distinct producer fqnames: 0
- Distinct consumer fqnames: 0
- Access pattern (aggregate): mixed
- Frequency (aggregate): unknown
- Decomposition direction: insufficient_data
- Struct field count (estimated): 0
## Producers (0)
_(none)_
## Consumers (0)
_(none)_
## Field access matrix
_(no field accesses detected)_
## Access pattern
**Dominant pattern:** mixed
**Evidence count:** 0
## SSDL Sketch for ToolSpec
_(placeholder; candidate aggregate)_
## Frequency
**Dominant frequency:** unknown
**Evidence count:** 0
## Result coverage
**Summary:**
| metric | value |
|---|---|
| total producers | 0 |
| result producers | 0 |
| total consumers | 0 |
| result consumers | 0 |
## Type alias coverage
**Summary:**
| metric | value |
|---|---|
| total field-access sites | 0 |
| typed sites (canonical field) | 0 |
| untyped sites (wildcard) | 0 |
## Cross-audit findings
_(no cross-audit findings mapped to this aggregate)_
## Decomposition cost
**Current cost estimate:** 0 us/turn
**Componentize savings:** 0 us/turn
**Unify savings:** 0 us/turn
**Recommended direction:** insufficient_data
**Rationale:** candidate aggregate; would be detected after any_type_componentization_20260621 merges
**Struct field count (estimated):** 0
**Struct frozen:** False
## Struct shape (inferred from producer returns)
_(no producers; cannot infer shape)_
## Optimization candidates
_(no optimization candidates generated)_
## Verdict
candidate aggregate; would be detected after any_type_componentization_20260621 merges
## Evidence appendix