codegraph-engine 2.3.0__py3-none-any.whl → 3.0.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. codegraph/__init__.py +1 -1
  2. codegraph/__main__.py +7 -0
  3. codegraph/agent_brain.py +253 -2
  4. codegraph/agent_capabilities.py +1348 -67
  5. codegraph/agent_rules.py +2 -1
  6. codegraph/api_drift.py +455 -0
  7. codegraph/architecture_rules.py +123 -0
  8. codegraph/async_queue/__init__.py +50 -0
  9. codegraph/async_queue/detectors/__init__.py +48 -0
  10. codegraph/async_queue/detectors/celery.py +160 -0
  11. codegraph/async_queue/detectors/kafka.py +168 -0
  12. codegraph/async_queue/detectors/rabbitmq.py +116 -0
  13. codegraph/async_queue/detectors/redis.py +130 -0
  14. codegraph/async_queue/detectors/sqs.py +135 -0
  15. codegraph/async_queue/models.py +161 -0
  16. codegraph/async_queue/otel_models.py +74 -0
  17. codegraph/async_queue/otel_parser.py +337 -0
  18. codegraph/async_queue/reconciler.py +427 -0
  19. codegraph/async_queue/scanner.py +291 -0
  20. codegraph/async_queue/traversal.py +447 -0
  21. codegraph/change_impact.py +320 -110
  22. codegraph/changelog.py +170 -0
  23. codegraph/cli.py +1605 -62
  24. codegraph/cli_output.py +17 -2
  25. codegraph/context.py +135 -24
  26. codegraph/context_freshness.py +2 -0
  27. codegraph/database/__init__.py +14 -0
  28. codegraph/database/extractor.py +712 -17
  29. codegraph/database/interrogation.py +388 -2
  30. codegraph/database/schema_drift.py +862 -0
  31. codegraph/dataflow_propagation.py +118 -0
  32. codegraph/dead_code.py +387 -0
  33. codegraph/epistemic.py +15 -0
  34. codegraph/evidence_contract.py +34 -3
  35. codegraph/federation.py +245 -0
  36. codegraph/frameworks.py +234 -12
  37. codegraph/frameworks_nestjs.py +502 -0
  38. codegraph/frameworks_nextjs.py +337 -0
  39. codegraph/frameworks_react.py +457 -0
  40. codegraph/freshness.py +2 -0
  41. codegraph/frontend_html.py +109 -0
  42. codegraph/git.py +2 -0
  43. codegraph/git_state.py +2 -0
  44. codegraph/graph/traversal.py +150 -7
  45. codegraph/graph_csr.py +218 -0
  46. codegraph/incremental.py +150 -0
  47. codegraph/indexing/__init__.py +7 -1
  48. codegraph/indexing/classifier.py +5 -0
  49. codegraph/indexing/indexer.py +292 -38
  50. codegraph/indexing/languages/__init__.py +1 -0
  51. codegraph/indexing/languages/cpp.py +457 -0
  52. codegraph/indexing/languages/go.py +459 -0
  53. codegraph/indexing/languages/jvm.py +583 -0
  54. codegraph/indexing/languages/rust.py +507 -0
  55. codegraph/indexing/models.py +15 -1
  56. codegraph/indexing/parser.py +385 -9
  57. codegraph/indexing/pool.py +136 -0
  58. codegraph/indexing/protocols.py +220 -0
  59. codegraph/indexing/scanner.py +23 -0
  60. codegraph/indexing/templates.py +418 -0
  61. codegraph/interrogation.py +207 -39
  62. codegraph/lsp.py +318 -0
  63. codegraph/lsp_bridge/__init__.py +16 -0
  64. codegraph/lsp_bridge/bridge.py +102 -0
  65. codegraph/lsp_bridge/client.py +207 -0
  66. codegraph/lsp_bridge/models.py +71 -0
  67. codegraph/mcp/server.py +502 -29
  68. codegraph/memory/trajectory.py +282 -0
  69. codegraph/models.py +7 -0
  70. codegraph/monorepo.py +3 -0
  71. codegraph/multi_agent/__init__.py +13 -0
  72. codegraph/multi_agent/coordinator.py +229 -0
  73. codegraph/multi_agent/models.py +76 -0
  74. codegraph/optimizer.py +42 -5
  75. codegraph/polymorphism.py +95 -0
  76. codegraph/pr_review.py +296 -0
  77. codegraph/process_lifecycle.py +50 -12
  78. codegraph/reachability.py +198 -0
  79. codegraph/reachability_index.py +74 -0
  80. codegraph/refactor/__init__.py +48 -0
  81. codegraph/refactor/models.py +114 -0
  82. codegraph/refactor/patcher.py +348 -0
  83. codegraph/refactor/renamer.py +844 -0
  84. codegraph/refactor/transactions.py +414 -0
  85. codegraph/repair.py +233 -0
  86. codegraph/resolver.py +1357 -161
  87. codegraph/retrieval_policy.py +22 -1
  88. codegraph/roblox.py +2174 -0
  89. codegraph/route_composer.py +7 -0
  90. codegraph/route_topology.py +172 -0
  91. codegraph/runtime/__init__.py +25 -0
  92. codegraph/runtime/collector.py +155 -0
  93. codegraph/runtime/db_watcher.py +191 -0
  94. codegraph/runtime/ingestor.py +30 -10
  95. codegraph/runtime/otel_receiver.py +208 -0
  96. codegraph/runtime/port_inspector.py +304 -0
  97. codegraph/runtime/runner.py +155 -6
  98. codegraph/runtime/trace_linker.py +175 -0
  99. codegraph/sandbox.py +215 -0
  100. codegraph/search/hybrid.py +26 -0
  101. codegraph/security/supply_chain.py +188 -0
  102. codegraph/security/taint.py +421 -0
  103. codegraph/semantic_decorators.py +34 -3
  104. codegraph/structural_diff.py +2 -0
  105. codegraph/styles.py +144 -0
  106. codegraph/symbol_history.py +2 -0
  107. codegraph/test_gen.py +437 -0
  108. codegraph/tsconfig.py +236 -0
  109. codegraph/ui/__init__.py +6 -0
  110. codegraph/ui/server.py +876 -0
  111. codegraph/watcher.py +323 -0
  112. {codegraph_engine-2.3.0.dist-info → codegraph_engine-3.0.1.dist-info}/METADATA +365 -67
  113. codegraph_engine-3.0.1.dist-info/RECORD +164 -0
  114. {codegraph_engine-2.3.0.dist-info → codegraph_engine-3.0.1.dist-info}/WHEEL +1 -1
  115. codegraph_engine-2.3.0.dist-info/RECORD +0 -94
  116. {codegraph_engine-2.3.0.dist-info → codegraph_engine-3.0.1.dist-info}/entry_points.txt +0 -0
  117. {codegraph_engine-2.3.0.dist-info → codegraph_engine-3.0.1.dist-info}/licenses/LICENSE +0 -0
  118. {codegraph_engine-2.3.0.dist-info → codegraph_engine-3.0.1.dist-info}/top_level.txt +0 -0
@@ -158,6 +158,14 @@ ROUTING_MANIFEST: dict[str, str] = {
158
158
  "context_freshness": "check_context_freshness",
159
159
  "symbol_history": "trace_symbol_history",
160
160
  "semantic_conflicts": "detect_semantic_conflicts",
161
+ "safe_rename": "safe_rename",
162
+ "rollback_refactor": "rollback_refactor",
163
+ "batch_symbols": "batch_get_symbols",
164
+ "batch_callers": "batch_find_callers",
165
+ "batch_context": "batch_get_context",
166
+ "semantic_patch_preview": "preview_semantic_patch",
167
+ "semantic_patch_apply": "apply_semantic_patch",
168
+ "dead_code": "find_dead_code",
161
169
  }
162
170
 
163
171
  DEFAULT_AGENT_PROFILE_TOOLS: tuple[str, ...] = (
@@ -736,7 +744,7 @@ TOOL_CAPABILITY_REGISTRY: tuple[ToolCapabilitySpec, ...] = (
736
744
  description=(
737
745
  "Compile a token-bounded, coverage-optimized ContextPacket containing verified symbols, compressed relationships, routes, DI providers, packages, and related tests. "
738
746
  "Primary input: `query` (natural-language question, symbol, or task description; `task` is also supported as a compatibility alias for string or structured TaskSpec dict). "
739
- "Budget controls: `max_tokens` (default 4000, hard cap 20000), `max_files` (default 15, hard cap 30), `max_lines` (default 500, hard cap 1500). "
747
+ "Budget controls: `max_tokens` (default 4000, hard cap 20000), `max_files` (default 25, hard cap 40), `max_lines` (default 500, hard cap 1500). "
740
748
  "Preserves UNKNOWN, POSSIBLE, and AMBIGUOUS states explicitly. "
741
749
  "Does not return full raw files; use targeted get_file or read_file only if exact omitted lines are needed afterward."
742
750
  ),
@@ -790,7 +798,7 @@ TOOL_CAPABILITY_REGISTRY: tuple[ToolCapabilitySpec, ...] = (
790
798
  ),
791
799
  profiles=("agent", "graph", "minimal", "developer", "full"),
792
800
  minimal_invocation='get_context(query="Debug authentication failure in login_endpoint")',
793
- advanced_invocation='get_context(query="Trace DI chain for get_current_user", intent="DEBUG", max_tokens=4000, max_files=15, max_lines=500, explain=True)',
801
+ advanced_invocation='get_context(query="Trace DI chain for get_current_user", intent="DEBUG", max_tokens=4000, max_files=25, max_lines=500, explain=True)',
794
802
  result_fields=("symbols", "relationships", "routes", "tests", "packages", "unknowns", "conflicts", "uncertainties", "freshness", "selected_tokens", "candidate_tokens", "selected_files", "selected_lines", "coverage_score", "truncated", "candidate_token_estimate", "selected_token_estimate", "context_reduction_pct", "coverage"),
795
803
  typical_followup="get_file on specific line ranges if implementation details outside snippets are required",
796
804
  common_mistakes=(
@@ -2625,6 +2633,1342 @@ TOOL_CAPABILITY_REGISTRY: tuple[ToolCapabilitySpec, ...] = (
2625
2633
  example_call='detect_semantic_conflicts(base_branch="main", head_branch="HEAD")',
2626
2634
  example_interpretation="Inspect has_conflicts and conflicts list for DELETED_SYMBOL_REFERENCED or CALL_SIGNATURE_MISMATCH.",
2627
2635
  ),
2636
+ # 49. safe_rename
2637
+ ToolCapabilitySpec(
2638
+ tool_name="safe_rename",
2639
+ capability="ast_symbol_refactor",
2640
+ description=(
2641
+ "Perform a deterministic, syntax-validated, transaction-safe AST rename of a symbol across the repository. "
2642
+ "Use when renaming a function, method, or class across multiple files safely with in-memory preview diffs. "
2643
+ "Does not prove runtime equivalence beyond AST syntax validation and statically verified references."
2644
+ ),
2645
+ task_types=(
2646
+ AgentTaskCategory.CHANGE_IMPACT.value,
2647
+ ),
2648
+ required_inputs=("target", "new_name"),
2649
+ optional_inputs=("dry_run", "force_uncertain"),
2650
+ expected_output_type="RefactorResult",
2651
+ relationship_types_returned=("DEFINES", "CALLS", "IMPORTS"),
2652
+ evidence_guarantees="Token-exact replacement with in-memory ast.parse syntax validation and atomic rollback manifest.",
2653
+ does_not_prove="Does not prove semantic preservation beyond AST syntax validation and statically verified references.",
2654
+ useful_situations=(
2655
+ "Renaming a function, method, or class safely across multiple files without breaking references",
2656
+ "Previewing exact diffs before executing an atomic codebase refactoring",
2657
+ ),
2658
+ avoid_when=(
2659
+ "Trivial single-file edit of a local variable inside an already-open function",
2660
+ ),
2661
+ profiles=("full",),
2662
+ minimal_invocation='safe_rename(target="AuthService", new_name="AuthenticationService", dry_run=True)',
2663
+ advanced_invocation='safe_rename(target="AuthService.verify", new_name="verify_token", dry_run=False, force_uncertain=False)',
2664
+ result_fields=("status", "target_symbol", "new_name", "risk", "files_changed", "spans_count", "diffs", "rollback_id", "errors"),
2665
+ typical_followup="rollback_refactor if undo needed, or find_tests to run affected test suite",
2666
+ common_mistakes=(
2667
+ "Applying without inspecting preview diffs when dry_run=True",
2668
+ "Using invalid Python identifiers with spaces or keywords",
2669
+ ),
2670
+ example_request="Rename AuthService to AuthenticationService and preview all diffs.",
2671
+ example_call='safe_rename(target="AuthService", new_name="AuthenticationService", dry_run=True)',
2672
+ example_interpretation="Inspect status=='READY', diffs, risk=='LOW', and affected_tests before applying.",
2673
+ ),
2674
+ # 50. rollback_refactor
2675
+ ToolCapabilitySpec(
2676
+ tool_name="rollback_refactor",
2677
+ capability="refactor_transaction_rollback",
2678
+ description=(
2679
+ "Atomically rollback an applied refactoring transaction using its rollback manifest ID. "
2680
+ "Use when reverting an applied refactoring transaction to restore original source files cleanly. "
2681
+ "Does not restore files if they were modified externally after refactoring was applied."
2682
+ ),
2683
+ task_types=(
2684
+ AgentTaskCategory.CHANGE_IMPACT.value,
2685
+ ),
2686
+ required_inputs=("transaction_id",),
2687
+ optional_inputs=(),
2688
+ expected_output_type="RefactorResult",
2689
+ relationship_types_returned=(),
2690
+ evidence_guarantees="Precondition SHA-256 validation and atomic file replacement with os.replace.",
2691
+ does_not_prove="Cannot rollback if files were modified externally after refactoring was applied.",
2692
+ useful_situations=(
2693
+ "Undoing an applied refactoring transaction cleanly to restore original code bytes",
2694
+ ),
2695
+ avoid_when=(
2696
+ "Transaction was not applied or files have subsequent manual edits",
2697
+ ),
2698
+ profiles=("full",),
2699
+ minimal_invocation='rollback_refactor(transaction_id="rf_abc123")',
2700
+ advanced_invocation='rollback_refactor(transaction_id="rf_abc123")',
2701
+ result_fields=("status", "target_symbol", "new_name", "files_changed", "rollback_id", "errors"),
2702
+ typical_followup="get_repository_status to verify repository state",
2703
+ common_mistakes=(
2704
+ "Calling rollback after modifying the files externally (which blocks rollback for safety)",
2705
+ ),
2706
+ example_request="Undo the refactor with transaction ID rf_12345.",
2707
+ example_call='rollback_refactor(transaction_id="rf_12345")',
2708
+ example_interpretation="Inspect status=='ROLLED_BACK' and files_changed.",
2709
+ ),
2710
+ # 65. get_live_services
2711
+ ToolCapabilitySpec(
2712
+ tool_name="get_live_services",
2713
+ capability="live_service_discovery",
2714
+ description=(
2715
+ "Detect and attribute active localhost services, ports, PIDs, frameworks, and workspace sub-packages with zero idle CPU. "
2716
+ "Use when diagnosing running dev servers or multi-service architectures. "
2717
+ "Does not prove live HTTP response payloads or application layer health."
2718
+ ),
2719
+ task_types=(
2720
+ AgentTaskCategory.DIAGNOSTIC.value,
2721
+ AgentTaskCategory.DEBUG.value,
2722
+ AgentTaskCategory.ARCHITECTURE.value,
2723
+ ),
2724
+ required_inputs=(),
2725
+ optional_inputs=(),
2726
+ expected_output_type="dict[str, Any]",
2727
+ relationship_types_returned=(),
2728
+ evidence_guarantees="Kernel socket table inspection and static configuration discovery with 5-second TTL cache.",
2729
+ does_not_prove="Does not prove live HTTP response payloads or application layer health.",
2730
+ useful_situations=(
2731
+ "Identifying running backend and frontend dev servers",
2732
+ "Attributing localhost ports to workspace sub-directories",
2733
+ ),
2734
+ avoid_when=(
2735
+ "Dev servers are not running or only static AST analysis is required",
2736
+ ),
2737
+ profiles=("full",),
2738
+ minimal_invocation="get_live_services()",
2739
+ advanced_invocation="get_live_services()",
2740
+ result_fields=("live_services", "configured_services", "count"),
2741
+ typical_followup="get_distributed_trace or list_routes",
2742
+ common_mistakes=(
2743
+ "Polling get_live_services in a rapid spin loop instead of relying on the 5-second TTL cache",
2744
+ ),
2745
+ example_request="What dev servers are running on localhost?",
2746
+ example_call="get_live_services()",
2747
+ example_interpretation="Inspect live_services for active listening ports and PIDs.",
2748
+ ),
2749
+ # 66. check_db_drift
2750
+ ToolCapabilitySpec(
2751
+ tool_name="check_db_drift",
2752
+ capability="database_schema_drift",
2753
+ description=(
2754
+ "Detect database schema drift between migration files, live database state, and code ORM models with zero idle CPU. "
2755
+ "Flags unmapped tables, missing columns, and migration version state. "
2756
+ "Use when verifying whether database migrations are up to date with code models. "
2757
+ "Does not execute SQL data assertions or validate column constraints against live row data."
2758
+ ),
2759
+ task_types=(
2760
+ AgentTaskCategory.DEBUG.value,
2761
+ AgentTaskCategory.CHANGE_IMPACT.value,
2762
+ ),
2763
+ required_inputs=(),
2764
+ optional_inputs=(),
2765
+ expected_output_type="dict[str, Any]",
2766
+ relationship_types_returned=(),
2767
+ evidence_guarantees="Comparison of SQLite/PostgreSQL schemas and migration folder state with 5-second TTL cache.",
2768
+ does_not_prove="Does not execute SQL data assertions or validate column constraints against live row data.",
2769
+ useful_situations=(
2770
+ "Verifying whether database migrations are up to date with code models",
2771
+ "Diagnosing missing table or column runtime errors",
2772
+ ),
2773
+ avoid_when=(
2774
+ "Project does not utilize SQL databases or database models",
2775
+ ),
2776
+ profiles=("full",),
2777
+ minimal_invocation="check_db_drift()",
2778
+ advanced_invocation="check_db_drift()",
2779
+ result_fields=("status", "unmapped_tables", "missing_columns", "migration_version", "is_drifted"),
2780
+ typical_followup="get_db_schema or find_db_tables",
2781
+ common_mistakes=(
2782
+ "Assuming check_db_drift executes database migrations rather than inspecting drift",
2783
+ ),
2784
+ example_request="Check if our database schema has drifted from migrations.",
2785
+ example_call="check_db_drift()",
2786
+ example_interpretation="Check if is_drifted is true and review missing_columns.",
2787
+ ),
2788
+ # 67. check_route_schema_drift
2789
+ ToolCapabilitySpec(
2790
+ tool_name="check_route_schema_drift",
2791
+ capability="route_schema_validation_drift",
2792
+ description=(
2793
+ "Use when detecting schema validation drift between a route/handler input schema (Pydantic BaseModel, Django Form, DRF Serializer) "
2794
+ "and destination database table columns. "
2795
+ "Flags MISSING_REQUIRED_COLUMN, NULLABILITY_MISMATCH, TYPE_INCOMPATIBILITY, LENGTH_CONSTRAINT_DRIFT, and UNUSED_SCHEMA_FIELD. "
2796
+ "Does not execute live requests."
2797
+ ),
2798
+ task_types=(
2799
+ AgentTaskCategory.DEBUG.value,
2800
+ AgentTaskCategory.CHANGE_IMPACT.value,
2801
+ ),
2802
+ required_inputs=(),
2803
+ optional_inputs=("route", "handler", "table", "schema"),
2804
+ expected_output_type="dict[str, Any]",
2805
+ relationship_types_returned=(),
2806
+ evidence_guarantees="Deterministic AST and database schema entity comparison.",
2807
+ does_not_prove="Does not execute live HTTP requests or live SQL transactions.",
2808
+ useful_situations=(
2809
+ "Validating route request payload models against destination database columns",
2810
+ "Preventing runtime NOT NULL constraint failures and type mismatches before deployment",
2811
+ ),
2812
+ avoid_when=(
2813
+ "Inspecting static code symbols unrelated to HTTP routes or database persistence",
2814
+ ),
2815
+ profiles=("full",),
2816
+ minimal_invocation='check_route_schema_drift(route="/api/v1/orders/checkout")',
2817
+ advanced_invocation='check_route_schema_drift(route="/api/v1/orders/checkout", table="orders", schema="CheckoutRequest")',
2818
+ result_fields=("status", "route_or_handler", "target_table", "schema_name", "drift_count", "critical_count", "warning_count", "info_count", "issues"),
2819
+ typical_followup="get_route_db_lineage or get_db_table",
2820
+ common_mistakes=(
2821
+ "Assuming check_route_schema_drift executes HTTP requests rather than inspecting static schemas",
2822
+ ),
2823
+ example_request="Check for schema drift on our checkout route.",
2824
+ example_call='check_route_schema_drift(route="/api/v1/orders/checkout")',
2825
+ example_interpretation="Review issues for MISSING_REQUIRED_COLUMN or NULLABILITY_MISMATCH.",
2826
+ ),
2827
+ # 68. get_distributed_trace
2828
+ ToolCapabilitySpec(
2829
+ tool_name="get_distributed_trace",
2830
+ capability="distributed_trace_reconstruction",
2831
+ description=(
2832
+ "Stitch and reconstruct multi-service distributed execution trees across frontend, backend, and database boundaries for a specific W3C trace ID. "
2833
+ "Use when tracing cross-service requests or debugging multi-service latency bottlenecks. "
2834
+ "Does not capture unobserved code paths or untraced sidecar requests."
2835
+ ),
2836
+ task_types=(
2837
+ AgentTaskCategory.TRACE.value,
2838
+ AgentTaskCategory.DEBUG.value,
2839
+ ),
2840
+ required_inputs=("trace_id",),
2841
+ optional_inputs=(),
2842
+ expected_output_type="dict[str, Any]",
2843
+ relationship_types_returned=(),
2844
+ evidence_guarantees="W3C traceparent stitching across multi-service runtime observations.",
2845
+ does_not_prove="Does not capture unobserved code paths or untraced sidecar requests.",
2846
+ useful_situations=(
2847
+ "Tracing an end-to-end user request from UI click to backend SQL execution",
2848
+ "Pinpointing which service failed in a distributed microservice workflow",
2849
+ ),
2850
+ avoid_when=(
2851
+ "Static code traversal is sufficient or dev servers have not captured runtime traces",
2852
+ ),
2853
+ profiles=("full",),
2854
+ minimal_invocation='get_distributed_trace(trace_id="4bf92f3577b34da6a3ce929d0e0e4736")',
2855
+ advanced_invocation='get_distributed_trace(trace_id="4bf92f3577b34da6a3ce929d0e0e4736")',
2856
+ result_fields=("trace_id", "status", "root_span", "total_spans", "services_involved", "timeline"),
2857
+ typical_followup="get_runtime_trace or reconcile_static_runtime",
2858
+ common_mistakes=(
2859
+ "Passing span_id instead of trace_id to get_distributed_trace",
2860
+ ),
2861
+ example_request="Trace the distributed execution for trace ID 4bf92f3577b34da6a3ce929d0e0e4736.",
2862
+ example_call='get_distributed_trace(trace_id="4bf92f3577b34da6a3ce929d0e0e4736")',
2863
+ example_interpretation="Review timeline and services_involved to locate execution bottlenecks or failures.",
2864
+ ),
2865
+ # 68. check_api_drift
2866
+ ToolCapabilitySpec(
2867
+ tool_name="check_api_drift",
2868
+ capability="client_server_api_drift",
2869
+ description=(
2870
+ "Detect client-server API contract drift between frontend fetch or axios calls and backend route registrations. "
2871
+ "Flags orphaned client endpoints (404s) and HTTP method mismatches (405s). "
2872
+ "Use when validating frontend API calls against backend endpoints before deployment. "
2873
+ "Does not execute live HTTP requests or validate dynamic URL strings constructed via runtime interpolation."
2874
+ ),
2875
+ task_types=(
2876
+ AgentTaskCategory.ROUTE_DISCOVERY.value,
2877
+ AgentTaskCategory.CHANGE_IMPACT.value,
2878
+ AgentTaskCategory.DEBUG.value,
2879
+ ),
2880
+ required_inputs=(),
2881
+ optional_inputs=(),
2882
+ expected_output_type="dict[str, Any]",
2883
+ relationship_types_returned=(),
2884
+ evidence_guarantees="Cross-layer AST static verification comparing frontend fetch calls with backend route trees.",
2885
+ does_not_prove="Does not execute live HTTP requests or validate dynamic URL concatenation at runtime.",
2886
+ useful_situations=(
2887
+ "Finding broken API endpoint paths in frontend client code",
2888
+ "Detecting HTTP method mismatches before deployment",
2889
+ ),
2890
+ avoid_when=(
2891
+ "Frontend code does not use REST fetch/axios calls to backend routes",
2892
+ ),
2893
+ profiles=("full",),
2894
+ minimal_invocation="check_api_drift()",
2895
+ advanced_invocation="check_api_drift()",
2896
+ result_fields=("status", "orphaned_client_routes", "method_mismatches", "verified_contracts_count"),
2897
+ typical_followup="find_routes or list_routes",
2898
+ common_mistakes=(
2899
+ "Assuming check_api_drift catches dynamic URL template literals constructed via arbitrary runtime string interpolation",
2900
+ ),
2901
+ example_request="Check if any frontend API calls mismatch backend routes.",
2902
+ example_call="check_api_drift()",
2903
+ example_interpretation="Inspect orphaned_client_routes for potential 404s.",
2904
+ ),
2905
+ # 69. get_monorepo_packages
2906
+ ToolCapabilitySpec(
2907
+ tool_name="get_monorepo_packages",
2908
+ capability="monorepo_package_discovery",
2909
+ description=(
2910
+ "Catalog monorepo workspace packages, tools (pnpm, Turborepo, npm/yarn workspaces), entry points, and inter-package dependencies. "
2911
+ "Use when mapping multi-package repository structure and package boundaries. "
2912
+ "Does not prove build system execution order or runtime dependency loading."
2913
+ ),
2914
+ task_types=(
2915
+ AgentTaskCategory.PACKAGE.value,
2916
+ AgentTaskCategory.ARCHITECTURE.value,
2917
+ ),
2918
+ required_inputs=(),
2919
+ optional_inputs=(),
2920
+ expected_output_type="dict[str, Any]",
2921
+ relationship_types_returned=(),
2922
+ evidence_guarantees="Deterministic workspace manifest analysis across pnpm, yarn, npm, Turborepo, Cargo, and Poetry.",
2923
+ does_not_prove="Does not prove build system execution order or runtime dependency loading.",
2924
+ useful_situations=(
2925
+ "Mapping multi-package repository structure and package boundaries",
2926
+ "Tracing internal dependency graph between workspace packages",
2927
+ ),
2928
+ avoid_when=(
2929
+ "Repository is a single standalone package without workspaces",
2930
+ ),
2931
+ profiles=("full",),
2932
+ minimal_invocation="get_monorepo_packages()",
2933
+ advanced_invocation="get_monorepo_packages()",
2934
+ result_fields=("tool", "packages", "dependency_graph", "root_path"),
2935
+ typical_followup="get_architecture or get_dependencies",
2936
+ common_mistakes=(
2937
+ "Expecting get_monorepo_packages to build or run package package.json scripts",
2938
+ ),
2939
+ example_request="List all packages in this monorepo and their dependencies.",
2940
+ example_call="get_monorepo_packages()",
2941
+ example_interpretation="Inspect packages mapping to understand package names, root paths, and dependencies.",
2942
+ ),
2943
+ # 71. batch_get_symbols
2944
+ ToolCapabilitySpec(
2945
+ tool_name="batch_get_symbols",
2946
+ capability="batch_symbol_lookup",
2947
+ description=(
2948
+ "Retrieve authoritative signature, kind, parent scope, decorators, and bounded source snippet for multiple symbols in a single round-trip. "
2949
+ "Use when inspecting multiple related symbols to minimize turn count and token overhead. "
2950
+ "Does not traverse multi-hop call graphs."
2951
+ ),
2952
+ task_types=(
2953
+ AgentTaskCategory.SYMBOL_LOOKUP.value,
2954
+ AgentTaskCategory.MULTI_FILE_INVESTIGATION.value,
2955
+ ),
2956
+ required_inputs=("symbols",),
2957
+ optional_inputs=(),
2958
+ expected_output_type="dict[str, Any]",
2959
+ relationship_types_returned=(),
2960
+ evidence_guarantees="Deterministic symbol metadata resolution across Python, TypeScript, JavaScript, and Luau AST definitions.",
2961
+ does_not_prove="Does not traverse multi-hop call graphs; use batch_find_callers for call hierarchies.",
2962
+ useful_situations=(
2963
+ "Inspecting multiple symbol declarations concurrently",
2964
+ "Reducing LLM turn count when exploring related classes and functions",
2965
+ ),
2966
+ avoid_when=(
2967
+ "Only inspecting a single symbol (use get_symbol instead)",
2968
+ ),
2969
+ profiles=("full",),
2970
+ minimal_invocation='batch_get_symbols(symbols=["UserService", "OrderService"])',
2971
+ advanced_invocation='batch_get_symbols(symbols=["UserService.get_user", "OrderService.create_order"])',
2972
+ result_fields=("results", "count", "found_count"),
2973
+ typical_followup="batch_find_callers to discover callers of multiple symbols",
2974
+ common_mistakes=(
2975
+ "Passing an empty list or exceeding 50 symbols",
2976
+ ),
2977
+ example_request="Inspect the definitions of UserService and OrderService simultaneously.",
2978
+ example_call='batch_get_symbols(symbols=["UserService", "OrderService"])',
2979
+ example_interpretation="Inspect results mapping for symbol metadata and bounded snippets.",
2980
+ ),
2981
+ # 72. batch_find_callers
2982
+ ToolCapabilitySpec(
2983
+ tool_name="batch_find_callers",
2984
+ capability="batch_caller_discovery",
2985
+ description=(
2986
+ "Find functions and methods calling each of the specified symbols in a single round-trip. "
2987
+ "Use when querying callers of multiple symbols to reduce round trips and multi-turn latency. "
2988
+ "Does not prove runtime execution of conditional branches."
2989
+ ),
2990
+ task_types=(
2991
+ AgentTaskCategory.RELATIONSHIP.value,
2992
+ AgentTaskCategory.TRACE.value,
2993
+ ),
2994
+ required_inputs=("symbols",),
2995
+ optional_inputs=("max_results_per_symbol",),
2996
+ expected_output_type="dict[str, Any]",
2997
+ relationship_types_returned=("CALLS",),
2998
+ evidence_guarantees="Verified CALLS relationships with confidence and AST_VERIFIED evidence.",
2999
+ does_not_prove="Does not prove runtime execution of conditional branches.",
3000
+ useful_situations=(
3001
+ "Tracing caller hierarchies across multiple related functions or methods in one call",
3002
+ "Assessing blast radius of multiple symbols simultaneously",
3003
+ ),
3004
+ avoid_when=(
3005
+ "Only querying callers for a single symbol (use find_callers or get_callers)",
3006
+ ),
3007
+ profiles=("full",),
3008
+ minimal_invocation='batch_find_callers(symbols=["AuthService.login", "TokenValidator.verify"])',
3009
+ advanced_invocation='batch_find_callers(symbols=["AuthService.login", "TokenValidator.verify"], max_results_per_symbol=15)',
3010
+ result_fields=("results", "count", "total_callers"),
3011
+ typical_followup="get_file on specific caller locations",
3012
+ common_mistakes=(
3013
+ "Expecting callee discovery instead of caller discovery (use find_callees)",
3014
+ ),
3015
+ example_request="Who calls AuthService.login and TokenValidator.verify?",
3016
+ example_call='batch_find_callers(symbols=["AuthService.login", "TokenValidator.verify"])',
3017
+ example_interpretation="Inspect results mapping to see callers for each requested symbol.",
3018
+ ),
3019
+ # 73. batch_get_context
3020
+ ToolCapabilitySpec(
3021
+ tool_name="batch_get_context",
3022
+ capability="batch_context_optimization",
3023
+ description=(
3024
+ "Compile token-bounded, coverage-optimized ContextPackets for multiple task prompts or symbol targets in a single call. "
3025
+ "Use when retrieving separate focused contexts for different sub-tasks concurrently. "
3026
+ "Does not execute repository code or tests."
3027
+ ),
3028
+ task_types=(
3029
+ AgentTaskCategory.MULTI_FILE_INVESTIGATION.value,
3030
+ AgentTaskCategory.DEBUG.value,
3031
+ ),
3032
+ required_inputs=("tasks",),
3033
+ optional_inputs=("max_tokens_per_task",),
3034
+ expected_output_type="dict[str, Any]",
3035
+ relationship_types_returned=(),
3036
+ evidence_guarantees="Strict token-budgeted context slices with coverage scoring and candidate optimization.",
3037
+ does_not_prove="Does not execute repository code or tests.",
3038
+ useful_situations=(
3039
+ "Gathering context for multiple sub-goals in parallel",
3040
+ "Synthesizing separate context packets for independent components",
3041
+ ),
3042
+ avoid_when=(
3043
+ "Only querying for a single task context (use get_context)",
3044
+ ),
3045
+ profiles=("full",),
3046
+ minimal_invocation='batch_get_context(tasks=[{"query": "AuthService"}, {"query": "OrderService"}])',
3047
+ advanced_invocation='batch_get_context(tasks=[{"query": "AuthService", "intent": "DEBUG"}, {"query": "OrderService", "intent": "TRACE"}], max_tokens_per_task=2000)',
3048
+ result_fields=("results", "count"),
3049
+ typical_followup="apply_semantic_patch or safe_rename based on retrieved context",
3050
+ common_mistakes=(
3051
+ "Exceeding 5 tasks in a single batch call",
3052
+ ),
3053
+ example_request="Get context packets for both the auth service and the payment processor.",
3054
+ example_call='batch_get_context(tasks=[{"query": "auth service", "intent": "DEBUG"}, {"query": "payment processor", "intent": "TRACE"}])',
3055
+ example_interpretation="Inspect results list containing individual ContextPacket dictionaries.",
3056
+ ),
3057
+ # 74. preview_semantic_patch
3058
+ ToolCapabilitySpec(
3059
+ tool_name="preview_semantic_patch",
3060
+ capability="semantic_patch_preview",
3061
+ description=(
3062
+ "Dry-run preview a multi-file semantic patch across repository files with pre-flight syntax validation and unified diffs. "
3063
+ "Use when verifying multi-file changes, syntax correctness, and diff previews before applying modifications to disk. "
3064
+ "Guarantees zero disk mutation during preview. Does not commit modifications to disk."
3065
+ ),
3066
+ task_types=(
3067
+ AgentTaskCategory.LOCAL_EDIT.value,
3068
+ AgentTaskCategory.CHANGE_IMPACT.value,
3069
+ ),
3070
+ required_inputs=("patches",),
3071
+ optional_inputs=(),
3072
+ expected_output_type="RefactorResult",
3073
+ relationship_types_returned=(),
3074
+ evidence_guarantees="Zero disk mutation guarantee; pre-flight AST syntax validation for Python, Luau, JSON, and JS/TS.",
3075
+ does_not_prove="Does not commit modifications to disk; use apply_semantic_patch to commit.",
3076
+ useful_situations=(
3077
+ "Previewing exact unified diffs before modifying files",
3078
+ "Validating that proposed code changes are syntactically valid across multiple languages",
3079
+ ),
3080
+ avoid_when=(
3081
+ "Applying the changes to disk immediately (use apply_semantic_patch)",
3082
+ ),
3083
+ profiles=("full",),
3084
+ minimal_invocation='preview_semantic_patch(patches=[{"path": "src/main.py", "hunks": [{"target": "foo", "replacement": "bar"}]}])',
3085
+ advanced_invocation='preview_semantic_patch(patches=[{"path": "src/main.py", "expected_hash": "...", "hunks": [{"target": "...", "replacement": "..."}]}])',
3086
+ result_fields=("status", "files_changed", "diffs", "errors"),
3087
+ typical_followup="apply_semantic_patch if preview diffs and syntax validation are satisfactory",
3088
+ common_mistakes=(
3089
+ "Expecting preview_semantic_patch to modify disk files (it is strictly dry-run)",
3090
+ ),
3091
+ example_request="Preview what changes would happen if we replace this method in two files.",
3092
+ example_call='preview_semantic_patch(patches=[{"path": "app.py", "hunks": [{"target": "old()", "replacement": "new()"}]}])',
3093
+ example_interpretation="Verify status=='READY' and inspect diffs to ensure edits are exact.",
3094
+ ),
3095
+ # 75. apply_semantic_patch
3096
+ ToolCapabilitySpec(
3097
+ tool_name="apply_semantic_patch",
3098
+ capability="semantic_patch_apply",
3099
+ description=(
3100
+ "Atomically apply a multi-file semantic patch across repository files with pre-flight syntax validation and rollback support. "
3101
+ "Use when executing validated multi-file code modifications with transactional safety and rollback guarantees. "
3102
+ "Does not prove semantic preservation beyond syntax validation and hash preconditions."
3103
+ ),
3104
+ task_types=(
3105
+ AgentTaskCategory.LOCAL_EDIT.value,
3106
+ AgentTaskCategory.CHANGE_IMPACT.value,
3107
+ ),
3108
+ required_inputs=("patches",),
3109
+ optional_inputs=("dry_run",),
3110
+ expected_output_type="RefactorResult",
3111
+ relationship_types_returned=(),
3112
+ evidence_guarantees="Precondition hash verification, AST syntax validation, atomic file replacement via os.replace under RefactorLock, and persistent rollback manifest.",
3113
+ does_not_prove="Does not prove business logic correctness beyond syntax tree validity.",
3114
+ useful_situations=(
3115
+ "Executing multi-file code modifications atomically with rollback safety",
3116
+ "Ensuring syntax errors never corrupt source files on disk",
3117
+ ),
3118
+ avoid_when=(
3119
+ "Only previewing changes without touching disk (use preview_semantic_patch or dry_run=True)",
3120
+ ),
3121
+ profiles=("full",),
3122
+ minimal_invocation='apply_semantic_patch(patches=[{"path": "src/main.py", "hunks": [{"target": "foo", "replacement": "bar"}]}])',
3123
+ advanced_invocation='apply_semantic_patch(patches=[{"path": "src/main.py", "hunks": [{"target": "foo", "replacement": "bar"}]}], dry_run=False)',
3124
+ result_fields=("status", "files_changed", "rollback_id", "diffs", "errors"),
3125
+ typical_followup="rollback_refactor if rollback needed, or find_tests to verify test suite",
3126
+ common_mistakes=(
3127
+ "Passing invalid syntax or target hunks that do not match current disk files",
3128
+ ),
3129
+ example_request="Apply this multi-file patch to app.py and config.json atomically.",
3130
+ example_call='apply_semantic_patch(patches=[{"path": "app.py", "hunks": [{"target": "a", "replacement": "b"}]}])',
3131
+ example_interpretation="Verify status=='APPLIED' and save rollback_id for potential rollback.",
3132
+ ),
3133
+ # 76. find_dead_code
3134
+ ToolCapabilitySpec(
3135
+ tool_name="find_dead_code",
3136
+ capability="dead_code_detection",
3137
+ description=(
3138
+ "Detect zero-caller functions, classes, uncalled zombie HTTP routes, and orphaned database tables by cross-referencing AST graphs with runtime traces. "
3139
+ "Use when identifying unused code, zombie endpoints, or unread/unwritten database tables. "
3140
+ "Does not prove unobserved paths are impossible when runtime traces are absent."
3141
+ ),
3142
+ task_types=(
3143
+ AgentTaskCategory.DIAGNOSTIC.value,
3144
+ AgentTaskCategory.ARCHITECTURE.value,
3145
+ ),
3146
+ required_inputs=(),
3147
+ optional_inputs=("max_symbols",),
3148
+ expected_output_type="dict[str, Any]",
3149
+ relationship_types_returned=(),
3150
+ evidence_guarantees="Deterministic cross-referencing of static AST callers, route tables, DB entity readers/writers, and runtime observations.",
3151
+ does_not_prove="Does not prove unobserved paths are impossible when runtime traces are absent.",
3152
+ useful_situations=(
3153
+ "Identifying dead functions and classes before refactoring or cleanup",
3154
+ "Detecting zombie HTTP endpoints that have never been invoked in production traces",
3155
+ "Auditing database schemas for orphaned tables with zero readers or writers",
3156
+ ),
3157
+ avoid_when=(
3158
+ "Checking local variables within a single function",
3159
+ ),
3160
+ profiles=("full",),
3161
+ minimal_invocation="find_dead_code()",
3162
+ advanced_invocation="find_dead_code(max_symbols=100)",
3163
+ result_fields=("repository", "dead_symbols", "zombie_routes", "orphaned_tables", "runtime_traces_present", "total_dead_count"),
3164
+ typical_followup="safe_rename or get_file to inspect flagged dead symbols",
3165
+ common_mistakes=(
3166
+ "Assuming UNOBSERVED_AT_RUNTIME routes are broken when no telemetry has been ingested",
3167
+ ),
3168
+ example_request="Find all unused functions and zombie endpoints in this codebase.",
3169
+ example_call="find_dead_code()",
3170
+ example_interpretation="Inspect dead_symbols, zombie_routes, and orphaned_tables lists in the report.",
3171
+ ),
3172
+ # 77. generate_pr_review
3173
+ ToolCapabilitySpec(
3174
+ tool_name="generate_pr_review",
3175
+ capability="pr_review",
3176
+ description=(
3177
+ "Generate comprehensive semantic PR review evaluating structural diffs, caller contract breaks, affected routes, and test gaps. "
3178
+ "Use when reviewing pull requests or evaluating branch changes before merging. "
3179
+ "Does not execute repository code or guarantee merge builds pass without running tests."
3180
+ ),
3181
+ task_types=(
3182
+ AgentTaskCategory.CHANGE_IMPACT.value,
3183
+ AgentTaskCategory.DIAGNOSTIC.value,
3184
+ ),
3185
+ required_inputs=(),
3186
+ optional_inputs=("base_ref", "head_ref"),
3187
+ expected_output_type="dict[str, Any]",
3188
+ relationship_types_returned=("CALLS", "REFERENCES"),
3189
+ evidence_guarantees="Deterministic 3-way AST merge-base comparison, semantic contract verification, and test coverage gap detection.",
3190
+ does_not_prove="Does not execute repository code or guarantee merge builds pass without running tests.",
3191
+ useful_situations=(
3192
+ "Auditing PR branches for breaking API changes and deleted symbols before merge",
3193
+ "Generating automated Markdown review comments for GitHub Actions PRs",
3194
+ "Checking whether modified HTTP endpoints have covering test cases",
3195
+ ),
3196
+ avoid_when=(
3197
+ "Checking uncommitted local working-tree edits without git commit refs",
3198
+ ),
3199
+ profiles=("full",),
3200
+ minimal_invocation="generate_pr_review()",
3201
+ advanced_invocation='generate_pr_review(base_ref="origin/main", head_ref="HEAD")',
3202
+ result_fields=("base_ref", "head_ref", "verdict", "summary", "findings", "files_changed", "affected_routes", "affected_tests", "suggested_test_command", "markdown_report"),
3203
+ typical_followup="inspect findings list or run suggested_test_command",
3204
+ common_mistakes=(
3205
+ "Passing invalid git revision names",
3206
+ ),
3207
+ example_request="Review this pull request against main and flag any breaking contract changes.",
3208
+ example_call='generate_pr_review(base_ref="main", head_ref="HEAD")',
3209
+ example_interpretation="Inspect verdict ('APPROVE', 'COMMENT', 'REQUEST_CHANGES') and markdown_report.",
3210
+ ),
3211
+ # 78. generate_test_scaffolding
3212
+ ToolCapabilitySpec(
3213
+ tool_name="generate_test_scaffolding",
3214
+ capability="test_generation",
3215
+ description=(
3216
+ "Generate production-ready test scaffolding with fixtures, dependency mocks (DB sessions, HTTP clients), and boundary test cases for a symbol or route. "
3217
+ "Use when writing tests for untested functions or HTTP endpoints. "
3218
+ "Does not execute generated tests or prove test assertions pass without execution."
3219
+ ),
3220
+ task_types=(
3221
+ AgentTaskCategory.TEST_DISCOVERY.value,
3222
+ AgentTaskCategory.DEBUG.value,
3223
+ ),
3224
+ required_inputs=("target",),
3225
+ optional_inputs=("framework",),
3226
+ expected_output_type="dict[str, Any]",
3227
+ relationship_types_returned=("TESTS", "TESTS_SYMBOL"),
3228
+ evidence_guarantees="Deterministic callee inspection, database dependency tracking, and framework signature analysis.",
3229
+ does_not_prove="Does not execute generated tests or prove test assertions pass without execution.",
3230
+ useful_situations=(
3231
+ "Generating test scaffolding for newly added functions or methods",
3232
+ "Creating integration test templates for FastAPI, Express, or Actix HTTP routes",
3233
+ "Detecting mock requirements (database sessions, external APIs) from call graphs",
3234
+ ),
3235
+ avoid_when=(
3236
+ "Searching for existing test files (use find_tests instead)",
3237
+ ),
3238
+ profiles=("full",),
3239
+ minimal_invocation='generate_test_scaffolding(target="process_payment")',
3240
+ advanced_invocation='generate_test_scaffolding(target="process_payment", framework="pytest")',
3241
+ result_fields=("target_symbol", "target_file", "framework", "suggested_test_file", "test_code", "mock_requirements", "test_cases"),
3242
+ typical_followup="write_file to save the generated test_code into suggested_test_file",
3243
+ common_mistakes=(
3244
+ "Expecting generated mock assertions to contain proprietary business logic without user customization",
3245
+ ),
3246
+ example_request="Generate a pytest test suite for process_payment with database mocks.",
3247
+ example_call='generate_test_scaffolding(target="process_payment")',
3248
+ example_interpretation="Inspect test_code and mock_requirements, then write to suggested_test_file.",
3249
+ ),
3250
+ # 79. federate_repositories
3251
+ ToolCapabilitySpec(
3252
+ tool_name="federate_repositories",
3253
+ capability="monorepo_analysis",
3254
+ description=(
3255
+ "Discover and catalog federated repositories in a multi-repo workspace. "
3256
+ "Use when mapping microservice boundaries and cross-service index sizes. "
3257
+ "Does not modify child repository indices or re-index dirty working trees automatically."
3258
+ ),
3259
+ task_types=(
3260
+ AgentTaskCategory.ARCHITECTURE.value,
3261
+ AgentTaskCategory.PACKAGE.value,
3262
+ ),
3263
+ required_inputs=(),
3264
+ optional_inputs=("workspace_root",),
3265
+ expected_output_type="dict[str, Any]",
3266
+ relationship_types_returned=("CONTAINS_PACKAGE",),
3267
+ evidence_guarantees="Deterministic inspection of workspace manifests (codegraph.workspace.json) and child repository SQLite indices.",
3268
+ does_not_prove="Does not modify child repository indices or re-index dirty working trees automatically.",
3269
+ useful_situations=(
3270
+ "Mapping all microservices within a multi-repo developer workspace",
3271
+ "Inspecting symbol and route counts across federated service repositories",
3272
+ ),
3273
+ avoid_when=(
3274
+ "Analyzing a single isolated repository without sibling microservices",
3275
+ ),
3276
+ profiles=("full",),
3277
+ minimal_invocation="federate_repositories()",
3278
+ advanced_invocation='federate_repositories(workspace_root="/path/to/workspace")',
3279
+ result_fields=("workspace_root", "repos", "total_repos", "total_links"),
3280
+ typical_followup="find_cross_repo_routes to map inter-service HTTP links",
3281
+ common_mistakes=(
3282
+ "Passing a workspace root that does not contain indexed CodeGraph repositories",
3283
+ ),
3284
+ example_request="List all microservices and repository indices in this workspace.",
3285
+ example_call="federate_repositories()",
3286
+ example_interpretation="Inspect repos list containing name, path, symbol_count, and route_count.",
3287
+ ),
3288
+ # 80. find_cross_repo_routes
3289
+ ToolCapabilitySpec(
3290
+ tool_name="find_cross_repo_routes",
3291
+ capability="route_tracing",
3292
+ description=(
3293
+ "Resolve cross-repository HTTP and RPC service-to-service links across microservices. "
3294
+ "Use when tracing requests across separate repositories. "
3295
+ "Does not prove unobserved dynamic endpoints without static route or URL evidence."
3296
+ ),
3297
+ task_types=(
3298
+ AgentTaskCategory.ROUTE_DISCOVERY.value,
3299
+ AgentTaskCategory.ARCHITECTURE.value,
3300
+ ),
3301
+ required_inputs=(),
3302
+ optional_inputs=("workspace_root", "query"),
3303
+ expected_output_type="dict[str, Any]",
3304
+ relationship_types_returned=("FETCHES_ROUTE", "ROUTES_TO"),
3305
+ evidence_guarantees="Deterministic cross-repository URL pattern matching against indexed framework_routes tables.",
3306
+ does_not_prove="Does not prove unobserved dynamic endpoints without static route or URL evidence.",
3307
+ useful_situations=(
3308
+ "Tracing an API call in a frontend service to the corresponding backend microservice handler",
3309
+ "Auditing service-to-service communication topologies across a federated workspace",
3310
+ ),
3311
+ avoid_when=(
3312
+ "Searching for routes within a single standalone repository (use find_routes instead)",
3313
+ ),
3314
+ profiles=("full",),
3315
+ minimal_invocation="find_cross_repo_routes()",
3316
+ advanced_invocation='find_cross_repo_routes(query="/api/v1/users")',
3317
+ result_fields=("workspace_root", "total_links", "cross_repo_links"),
3318
+ typical_followup="trace_path or get_file on target_repo and target_file",
3319
+ common_mistakes=(
3320
+ "Querying unindexed sibling repositories",
3321
+ ),
3322
+ example_request="Find which microservice handles the /api/v1/users endpoint called by frontend.",
3323
+ example_call='find_cross_repo_routes(query="/api/v1/users")',
3324
+ example_interpretation="Inspect cross_repo_links for source_repo, target_repo, and target_handler.",
3325
+ ),
3326
+ # 81. store_agent_memory
3327
+ ToolCapabilitySpec(
3328
+ tool_name="store_agent_memory",
3329
+ capability="agent_memory",
3330
+ description=(
3331
+ "Store an agent debugging trajectory, test repair pattern, or architectural decision into persistent memory. "
3332
+ "Use when recording successful bug resolutions or architecture decisions for future recall. "
3333
+ "Does not share stored memory outside the local repository index."
3334
+ ),
3335
+ task_types=(
3336
+ AgentTaskCategory.DEBUG.value,
3337
+ AgentTaskCategory.EXPLANATION.value,
3338
+ ),
3339
+ required_inputs=("title", "resolution"),
3340
+ optional_inputs=("category", "symptoms", "root_cause"),
3341
+ expected_output_type="dict[str, Any]",
3342
+ relationship_types_returned=(),
3343
+ evidence_guarantees="Atomic persistence into SQLite and FTS5 full-text index with WAL mode concurrency.",
3344
+ does_not_prove="Does not share stored memory outside the local repository index.",
3345
+ useful_situations=(
3346
+ "Saving the root cause and fix for a tricky edge-case bug for future agents",
3347
+ "Recording architectural decisions and component conventions",
3348
+ "Documenting flaky test workarounds and setup prerequisites",
3349
+ ),
3350
+ avoid_when=(
3351
+ "Temporary scratchpad notes that should not persist across sessions",
3352
+ ),
3353
+ profiles=("full",),
3354
+ minimal_invocation='store_agent_memory(title="Fixed Auth Skew", resolution="Added clock leeway")',
3355
+ advanced_invocation='store_agent_memory(title="Fixed Auth Skew", resolution="Added clock leeway", category="BUG_FIX", symptoms="401 error", root_cause="clock drift")',
3356
+ result_fields=("id", "created_at", "session_id", "category", "title", "symptoms", "root_cause", "resolution", "files", "tags", "outcome", "score"),
3357
+ typical_followup="query_agent_memory to recall stored memory",
3358
+ common_mistakes=(
3359
+ "Storing sensitive tokens, secrets, or passwords in memory title or resolution",
3360
+ ),
3361
+ example_request="Save this debugging resolution to agent memory.",
3362
+ example_call='store_agent_memory(title="Fixed token leak", resolution="Closed session in finally block")',
3363
+ example_interpretation="Verify id is returned starting with 'mem_'.",
3364
+ ),
3365
+ # 82. query_agent_memory
3366
+ ToolCapabilitySpec(
3367
+ tool_name="query_agent_memory",
3368
+ capability="agent_memory",
3369
+ description=(
3370
+ "Search past agent debugging memories and architectural decisions using FTS5 BM25 ranking. "
3371
+ "Use when investigating recurring bugs or checking past resolutions. "
3372
+ "Does not guarantee past solutions apply to unrelated bugs without semantic match."
3373
+ ),
3374
+ task_types=(
3375
+ AgentTaskCategory.DEBUG.value,
3376
+ AgentTaskCategory.EXPLANATION.value,
3377
+ ),
3378
+ required_inputs=("query",),
3379
+ optional_inputs=("category", "limit", "max_tokens"),
3380
+ expected_output_type="dict[str, Any]",
3381
+ relationship_types_returned=(),
3382
+ evidence_guarantees="Deterministic FTS5 BM25 relevance ranking and recency scoring.",
3383
+ does_not_prove="Does not guarantee past solutions apply to unrelated bugs without semantic match.",
3384
+ useful_situations=(
3385
+ "Checking if similar error traces or symptoms have been solved in past sessions",
3386
+ "Recalling previous architectural guidelines or database migration patterns",
3387
+ ),
3388
+ avoid_when=(
3389
+ "Searching codebase symbols (use find_symbol instead) or literal code (use search_code instead)",
3390
+ ),
3391
+ profiles=("full",),
3392
+ minimal_invocation='query_agent_memory(query="auth token expired")',
3393
+ advanced_invocation='query_agent_memory(query="sqlite locked", category="ARCHITECTURE_DECISION", limit=5)',
3394
+ result_fields=("query", "count", "memories"),
3395
+ typical_followup="inspect memories list for symptoms and resolution",
3396
+ common_mistakes=(
3397
+ "Querying empty string without query terms",
3398
+ ),
3399
+ example_request="Have we ever solved a 401 token expiry error in this project?",
3400
+ example_call='query_agent_memory(query="401 token expiry")',
3401
+ example_interpretation="Inspect memories for past resolutions and root causes.",
3402
+ ),
3403
+ # 83. analyze_dataflow_taint
3404
+ ToolCapabilitySpec(
3405
+ tool_name="analyze_dataflow_taint",
3406
+ capability="security_taint_audit",
3407
+ description=(
3408
+ "Analyze source-to-sink dataflow taint paths for injection and security vulnerabilities (SQL injection CWE-89, command execution CWE-78, path traversal CWE-22, SSRF CWE-918, insecure deserialization CWE-502) using AST dataflow tracking. "
3409
+ "Use when auditing endpoint security, sanitization gaps, or vulnerable data sinks. "
3410
+ "Does not execute repository code; reports AST-verified taint propagation chains."
3411
+ ),
3412
+ task_types=(
3413
+ AgentTaskCategory.DEBUG.value,
3414
+ AgentTaskCategory.EXPLANATION.value,
3415
+ ),
3416
+ required_inputs=(),
3417
+ optional_inputs=("entrypoint_symbol", "filter_cwe", "max_depth"),
3418
+ expected_output_type="dict[str, Any]",
3419
+ relationship_types_returned=(),
3420
+ evidence_guarantees="Deterministic AST source-to-sink variable propagation and sink validation.",
3421
+ does_not_prove="Does not prove runtime exploitability when external WAF or runtime middleware blocks traffic.",
3422
+ useful_situations=(
3423
+ "Auditing user-input flows into raw SQL queries, shell commands, file opens, or HTTP requests",
3424
+ "Checking whether sanitization functions neutralize tainted data before sink execution",
3425
+ ),
3426
+ avoid_when=(
3427
+ "Fixing pure syntax errors or non-security refactoring tasks",
3428
+ ),
3429
+ profiles=("full",),
3430
+ minimal_invocation="analyze_dataflow_taint()",
3431
+ advanced_invocation='analyze_dataflow_taint(filter_cwe="CWE-89", max_depth=10)',
3432
+ result_fields=("repository", "total_vulnerabilities", "critical_count", "high_count", "vulnerabilities"),
3433
+ typical_followup="inspect vulnerabilities list and remediate unsanitized sinks",
3434
+ common_mistakes=(
3435
+ "Assuming absence of taint findings proves total exploit immunity without defense-in-depth review",
3436
+ ),
3437
+ example_request="Are there any SQL injection or command injection vulnerabilities in our route handlers?",
3438
+ example_call='analyze_dataflow_taint(filter_cwe="CWE-89")',
3439
+ example_interpretation="Inspect vulnerabilities for source expression, sink function, and remediation advice.",
3440
+ ),
3441
+ # 84. repair_repository_index
3442
+ ToolCapabilitySpec(
3443
+ tool_name="repair_repository_index",
3444
+ capability="index_self_healing",
3445
+ description=(
3446
+ "Perform automated self-healing, SQLite integrity verification, rebuilding corrupted FTS5 indices, pruning dangling FK references, clearing stale locks, and truncating WAL logs. "
3447
+ "Use when the repository index encounters lock contention, corrupted FTS entries, or orphaned edges. "
3448
+ "Does not delete source repository code."
3449
+ ),
3450
+ task_types=(
3451
+ AgentTaskCategory.DEBUG.value,
3452
+ ),
3453
+ required_inputs=(),
3454
+ optional_inputs=("deep", "vacuum"),
3455
+ expected_output_type="dict[str, Any]",
3456
+ relationship_types_returned=(),
3457
+ evidence_guarantees="PRAGMA integrity_check validation and atomic SQLite WAL log truncation.",
3458
+ does_not_prove="Does not restore deleted source files from outside the repository index.",
3459
+ useful_situations=(
3460
+ "Recovering from unexpected process termination, stale lock files, or SQLite disk I/O errors",
3461
+ "Rebuilding full-text search tables when search queries return inconsistent results",
3462
+ ),
3463
+ avoid_when=(
3464
+ "Standard code navigation or routine symbol queries",
3465
+ ),
3466
+ profiles=("full",),
3467
+ minimal_invocation="repair_repository_index()",
3468
+ advanced_invocation="repair_repository_index(deep=True, vacuum=True)",
3469
+ result_fields=("status", "integrity_check_passed", "fts_rebuilt", "wal_checkpointed", "stale_locks_cleared"),
3470
+ typical_followup="re-run failed query or verify healthy index status",
3471
+ common_mistakes=(
3472
+ "Calling vacuum=True on massive repositories inside high-concurrency read loops",
3473
+ ),
3474
+ example_request="The index feels out of sync and search is slow. Can we repair and optimize it?",
3475
+ example_call="repair_repository_index(deep=True, vacuum=True)",
3476
+ example_interpretation="Check status == 'HEALTHY' or 'REPAIRED' and review actions_taken.",
3477
+ ),
3478
+ # 85. get_lsp_diagnostics
3479
+ ToolCapabilitySpec(
3480
+ tool_name="get_lsp_diagnostics",
3481
+ capability="compiler_diagnostics",
3482
+ description=(
3483
+ "Collect live compiler diagnostics, type errors, and lint warnings via Language Server Protocol (LSP) daemons (pyright, gopls, rust-analyzer, clangd). "
3484
+ "Use when diagnosing compile errors, missing types, or verifying code correctness across languages. "
3485
+ "Does not modify source files; reports language-server diagnostics."
3486
+ ),
3487
+ task_types=(
3488
+ AgentTaskCategory.DEBUG.value,
3489
+ AgentTaskCategory.DIAGNOSTIC.value,
3490
+ ),
3491
+ required_inputs=(),
3492
+ optional_inputs=("file_path",),
3493
+ expected_output_type="dict[str, Any]",
3494
+ relationship_types_returned=(),
3495
+ evidence_guarantees="Compiler-accurate type checker error ranges and diagnostic severities.",
3496
+ does_not_prove="Does not prove runtime correctness in untyped or dynamic script sections.",
3497
+ useful_situations=(
3498
+ "Checking whether recent code edits introduced syntax or type check errors",
3499
+ "Verifying import validity before creating a pull request",
3500
+ ),
3501
+ avoid_when=(
3502
+ "Searching codebase symbols or tracing caller hierarchies",
3503
+ ),
3504
+ profiles=("full",),
3505
+ minimal_invocation="get_lsp_diagnostics()",
3506
+ advanced_invocation='get_lsp_diagnostics(file_path="src/main.py")',
3507
+ result_fields=("workspace", "status", "total_diagnostics", "error_count", "warning_count", "diagnostics"),
3508
+ typical_followup="inspect diagnostics list and fix compiler errors",
3509
+ common_mistakes=(
3510
+ "Assuming failure if host does not have LSP binary installed (falls back gracefully to static analysis)",
3511
+ ),
3512
+ example_request="Are there any compiler or type errors in our modified files?",
3513
+ example_call='get_lsp_diagnostics(file_path="src/service.py")',
3514
+ example_interpretation="Inspect error_count and diagnostics items for line numbers and error codes.",
3515
+ ),
3516
+ # 86. register_agent_session
3517
+ ToolCapabilitySpec(
3518
+ tool_name="register_agent_session",
3519
+ capability="multi_agent_session",
3520
+ description=(
3521
+ "Register an active AI coding agent session in the multi-agent shared workspace. "
3522
+ "Use when joining a swarm or announcing an active coding task to coordinate with other agents. "
3523
+ "Does not acquire file locks."
3524
+ ),
3525
+ task_types=(
3526
+ AgentTaskCategory.ARCHITECTURE.value,
3527
+ AgentTaskCategory.DEBUG.value,
3528
+ ),
3529
+ required_inputs=("agent_id", "name", "task"),
3530
+ optional_inputs=(),
3531
+ expected_output_type="dict[str, Any]",
3532
+ relationship_types_returned=(),
3533
+ evidence_guarantees="Atomic registration in SQLite WAL workspace registry.",
3534
+ does_not_prove="Does not lock files or prevent uncoordinated file system modifications outside CodeGraph.",
3535
+ useful_situations=(
3536
+ "Announcing an agent's active task to peer agents in a shared repository",
3537
+ "Establishing agent presence before requesting file leases",
3538
+ ),
3539
+ avoid_when=(
3540
+ "Single-agent isolated development without peer agents",
3541
+ ),
3542
+ profiles=("full",),
3543
+ minimal_invocation='register_agent_session(agent_id="agent-1", name="BugFixer", task="Fix 401")',
3544
+ advanced_invocation='register_agent_session(agent_id="agent-1", name="BugFixer", task="Fix 401 error")',
3545
+ result_fields=("agent_id", "name", "task_description", "registered_at", "status"),
3546
+ typical_followup="claim_file_lease on target files before editing",
3547
+ common_mistakes=(
3548
+ "Using empty agent_id or failing to send heartbeats",
3549
+ ),
3550
+ example_request="Register our agent session to coordinate with other agents on this repo.",
3551
+ example_call='register_agent_session(agent_id="claude-1", name="RefactorBot", task="Refactor auth")',
3552
+ example_interpretation="Verify status == 'ACTIVE' and proceed to lease claiming.",
3553
+ ),
3554
+ # 87. claim_file_lease
3555
+ ToolCapabilitySpec(
3556
+ tool_name="claim_file_lease",
3557
+ capability="multi_agent_lease",
3558
+ description=(
3559
+ "Claim a lease lock on a file path to prevent concurrent edit clobbering by other AI agents. "
3560
+ "Use before modifying a file in a multi-agent environment. "
3561
+ "Does not modify file content."
3562
+ ),
3563
+ task_types=(
3564
+ AgentTaskCategory.LOCAL_EDIT.value,
3565
+ AgentTaskCategory.DEBUG.value,
3566
+ ),
3567
+ required_inputs=("agent_id", "file_path"),
3568
+ optional_inputs=("lease_type", "ttl_seconds"),
3569
+ expected_output_type="dict[str, Any]",
3570
+ relationship_types_returned=(),
3571
+ evidence_guarantees="Atomic mutex lock preventing overlapping write leases.",
3572
+ does_not_prove="Does not prevent manual human edits via external text editors.",
3573
+ useful_situations=(
3574
+ "Locking a core module before applying automated refactoring patches",
3575
+ "Ensuring no teammate agent overwrites a file during multi-file editing",
3576
+ ),
3577
+ avoid_when=(
3578
+ "Read-only queries or symbol discovery",
3579
+ ),
3580
+ profiles=("full",),
3581
+ minimal_invocation='claim_file_lease(agent_id="agent-1", file_path="src/main.py")',
3582
+ advanced_invocation='claim_file_lease(agent_id="agent-1", file_path="src/main.py", lease_type="EXCLUSIVE_WRITE", ttl_seconds=120)',
3583
+ result_fields=("success", "message", "file_path", "agent_id", "lease_type"),
3584
+ typical_followup="apply edits, then release_file_lease",
3585
+ common_mistakes=(
3586
+ "Holding leases indefinitely without renewing TTL or releasing upon task completion",
3587
+ ),
3588
+ example_request="Claim exclusive write lease on src/auth.py before refactoring.",
3589
+ example_call='claim_file_lease(agent_id="agent-1", file_path="src/auth.py")',
3590
+ example_interpretation="Check success is True before editing file.",
3591
+ ),
3592
+ # 88. release_file_lease
3593
+ ToolCapabilitySpec(
3594
+ tool_name="release_file_lease",
3595
+ capability="multi_agent_lease_release",
3596
+ description=(
3597
+ "Release one or all file leases held by an AI agent upon completing task edits. "
3598
+ "Use after committing or discarding file edits. "
3599
+ "Does not delete source files."
3600
+ ),
3601
+ task_types=(
3602
+ AgentTaskCategory.LOCAL_EDIT.value,
3603
+ AgentTaskCategory.DEBUG.value,
3604
+ ),
3605
+ required_inputs=("agent_id",),
3606
+ optional_inputs=("file_path",),
3607
+ expected_output_type="dict[str, Any]",
3608
+ relationship_types_returned=(),
3609
+ evidence_guarantees="Atomic lease release and lock clearance in SQLite registry.",
3610
+ does_not_prove="Does not commit file changes to git.",
3611
+ useful_situations=(
3612
+ "Releasing file locks so waiting agents can proceed with edits",
3613
+ "Cleaning up leases when an agent finishes its assigned task",
3614
+ ),
3615
+ avoid_when=(
3616
+ "When the agent is still modifying the target file",
3617
+ ),
3618
+ profiles=("full",),
3619
+ minimal_invocation='release_file_lease(agent_id="agent-1")',
3620
+ advanced_invocation='release_file_lease(agent_id="agent-1", file_path="src/main.py")',
3621
+ result_fields=("released_count", "agent_id", "file_path"),
3622
+ typical_followup="get_multi_agent_status to confirm clean workspace",
3623
+ common_mistakes=(
3624
+ "Releasing leases before saving file contents to disk",
3625
+ ),
3626
+ example_request="Release all leases held by agent-1.",
3627
+ example_call='release_file_lease(agent_id="agent-1")',
3628
+ example_interpretation="Verify released_count >= 1.",
3629
+ ),
3630
+ # 89. get_multi_agent_status
3631
+ ToolCapabilitySpec(
3632
+ tool_name="get_multi_agent_status",
3633
+ capability="multi_agent_status",
3634
+ description=(
3635
+ "Return consolidated multi-agent status report including active agent sessions, held file leases, and predicted AST conflicts. "
3636
+ "Use to check if other agents are working on related files. "
3637
+ "Does not acquire locks."
3638
+ ),
3639
+ task_types=(
3640
+ AgentTaskCategory.ARCHITECTURE.value,
3641
+ AgentTaskCategory.DEBUG.value,
3642
+ ),
3643
+ required_inputs=(),
3644
+ optional_inputs=(),
3645
+ expected_output_type="dict[str, Any]",
3646
+ relationship_types_returned=(),
3647
+ evidence_guarantees="Real-time SQLite inspection of active leases and AST conflict analysis.",
3648
+ does_not_prove="Does not predict future unannounced edits from unregistered agents.",
3649
+ useful_situations=(
3650
+ "Checking who is currently working on what in a multi-agent coding workspace",
3651
+ "Proactively detecting if two agents are modifying caller/callee coupled files",
3652
+ ),
3653
+ avoid_when=(
3654
+ "Routine single-agent local edits",
3655
+ ),
3656
+ profiles=("full",),
3657
+ minimal_invocation="get_multi_agent_status()",
3658
+ advanced_invocation="get_multi_agent_status()",
3659
+ result_fields=("workspace", "total_agents", "active_leases_count", "conflicts_count", "agents", "leases", "conflicts"),
3660
+ typical_followup="review conflicts list and negotiate lease order",
3661
+ common_mistakes=(
3662
+ "Ignoring reported semantic conflicts when planning cross-module refactors",
3663
+ ),
3664
+ example_request="What agents are currently active and are there any file lock conflicts?",
3665
+ example_call="get_multi_agent_status()",
3666
+ example_interpretation="Inspect conflicts list to ensure zero conflicting write leases.",
3667
+ ),
3668
+ # 90. evaluate_speculative_patch
3669
+ ToolCapabilitySpec(
3670
+ tool_name="evaluate_speculative_patch",
3671
+ capability="speculative_sandbox",
3672
+ description=(
3673
+ "Project an in-memory virtual AST branch in RAM to evaluate caller breakages, parameter mismatches, and route mutations without modifying disk files. "
3674
+ "Use before writing refactoring patches. "
3675
+ "Does not modify disk files."
3676
+ ),
3677
+ task_types=(
3678
+ AgentTaskCategory.LOCAL_EDIT.value,
3679
+ AgentTaskCategory.CHANGE_IMPACT.value,
3680
+ ),
3681
+ required_inputs=("patches",),
3682
+ optional_inputs=(),
3683
+ expected_output_type="dict[str, Any]",
3684
+ relationship_types_returned=(),
3685
+ evidence_guarantees="In-memory AST parsing and virtual diff contract break detection.",
3686
+ does_not_prove="Does not execute code or run test assertions.",
3687
+ useful_situations=(
3688
+ "Testing candidate function signature edits before committing to disk",
3689
+ "Evaluating whether a proposed refactor removes required parameters",
3690
+ ),
3691
+ avoid_when=(
3692
+ "Simple single-file docstring edits",
3693
+ ),
3694
+ profiles=("full",),
3695
+ minimal_invocation='evaluate_speculative_patch(patches={"src/main.py": "def foo(): pass"})',
3696
+ advanced_invocation='evaluate_speculative_patch(patches={"src/api.py": "def handle(req): pass"})',
3697
+ result_fields=("is_safe", "modified_files", "contract_breaks", "route_mutations", "diff_summary"),
3698
+ typical_followup="apply patch if is_safe is True or fix contract_breaks",
3699
+ common_mistakes=(
3700
+ "Applying invalid syntax in patch content",
3701
+ ),
3702
+ example_request="Will modifying this function signature break any callers?",
3703
+ example_call='evaluate_speculative_patch(patches={"src/auth.py": "def login(user): return True"})',
3704
+ example_interpretation="Inspect is_safe and contract_breaks list.",
3705
+ ),
3706
+ # 91. verify_architectural_rules
3707
+ ToolCapabilitySpec(
3708
+ tool_name="verify_architectural_rules",
3709
+ capability="architecture_governance",
3710
+ description=(
3711
+ "Evaluate declarative architectural boundaries, forbidden cross-module dependencies, and layer rules against the repository index. "
3712
+ "Use when checking pull request compliance with enterprise architecture. "
3713
+ "Does not modify code."
3714
+ ),
3715
+ task_types=(
3716
+ AgentTaskCategory.ARCHITECTURE.value,
3717
+ AgentTaskCategory.DIAGNOSTIC.value,
3718
+ ),
3719
+ required_inputs=(),
3720
+ optional_inputs=("rules",),
3721
+ expected_output_type="dict[str, Any]",
3722
+ relationship_types_returned=(),
3723
+ evidence_guarantees="Deterministic import edge matching against declarative glob patterns.",
3724
+ does_not_prove="Does not infer architectural intent outside configured rule patterns.",
3725
+ useful_situations=(
3726
+ "Enforcing clean architecture separation between controllers and database models",
3727
+ "Preventing circular or forbidden module dependency leaks",
3728
+ ),
3729
+ avoid_when=(
3730
+ "Localized bug fixes in existing isolated functions",
3731
+ ),
3732
+ profiles=("full",),
3733
+ minimal_invocation="verify_architectural_rules()",
3734
+ advanced_invocation="verify_architectural_rules(rules=[{'name': 'no-db-in-api', 'source_pattern': '*api*', 'cannot_import': ['*db*']}])",
3735
+ result_fields=("status", "total_rules_checked", "violations_count", "violations"),
3736
+ typical_followup="remediate reported rule violations",
3737
+ common_mistakes=(
3738
+ "Assuming compliance if rule patterns do not match source directory layout",
3739
+ ),
3740
+ example_request="Does our code violate any architectural layer boundaries?",
3741
+ example_call="verify_architectural_rules()",
3742
+ example_interpretation="Check status == 'COMPLIANT' and inspect violations list.",
3743
+ ),
3744
+ # 92. find_unreachable_code
3745
+ ToolCapabilitySpec(
3746
+ tool_name="find_unreachable_code",
3747
+ capability="reachability_analysis",
3748
+ description=(
3749
+ "Perform DI-aware root-to-leaf reachability analysis from HTTP routes, CLIs, and crons to detect true dead code with STATIC_VERIFIED confidence. "
3750
+ "Use when pruning dead code or unused legacy modules. "
3751
+ "Does not delete code."
3752
+ ),
3753
+ task_types=(
3754
+ AgentTaskCategory.DIAGNOSTIC.value,
3755
+ AgentTaskCategory.ARCHITECTURE.value,
3756
+ ),
3757
+ required_inputs=(),
3758
+ optional_inputs=(),
3759
+ expected_output_type="dict[str, Any]",
3760
+ relationship_types_returned=(),
3761
+ evidence_guarantees="BFS reachability traversal over calls, inheritance, and DI bindings.",
3762
+ does_not_prove="Does not prove unreachability for code invoked via external dynamic reflection or eval.",
3763
+ useful_situations=(
3764
+ "Identifying unused functions, orphaned classes, and abandoned legacy endpoints",
3765
+ "Validating codebase tree-shaking opportunities before major refactors",
3766
+ ),
3767
+ avoid_when=(
3768
+ "Working on library packages intended for external consumer import",
3769
+ ),
3770
+ profiles=("full",),
3771
+ minimal_invocation="find_unreachable_code()",
3772
+ advanced_invocation="find_unreachable_code()",
3773
+ result_fields=("workspace", "total_symbols", "reachable_count", "unreachable_count", "dead_code_percentage"),
3774
+ typical_followup="inspect unreachable_symbols list for candidates to delete",
3775
+ common_mistakes=(
3776
+ "Deleting public library exports that are called only by external downstream consumers",
3777
+ ),
3778
+ example_request="Are there any completely dead or unreachable functions in our project?",
3779
+ example_call="find_unreachable_code()",
3780
+ example_interpretation="Inspect unreachable_symbols list with STATIC_VERIFIED confidence.",
3781
+ ),
3782
+ # 93. generate_semantic_changelog
3783
+ ToolCapabilitySpec(
3784
+ tool_name="generate_semantic_changelog",
3785
+ capability="semantic_changelog",
3786
+ description=(
3787
+ "Synthesize human-readable release changelog categorizing breaking changes, new endpoints, and database mutations from AST diffs. "
3788
+ "Use when writing release notes or preparing deployment summaries. "
3789
+ "Does not modify git repository."
3790
+ ),
3791
+ task_types=(
3792
+ AgentTaskCategory.CHANGE_IMPACT.value,
3793
+ AgentTaskCategory.ARCHITECTURE.value,
3794
+ ),
3795
+ required_inputs=(),
3796
+ optional_inputs=("base_ref", "head_ref"),
3797
+ expected_output_type="dict[str, Any]",
3798
+ relationship_types_returned=(),
3799
+ evidence_guarantees="AST-diff categorization of added/removed routes, schema mutations, and API drops.",
3800
+ does_not_prove="Does not document non-code changes such as asset or documentation edits.",
3801
+ useful_situations=(
3802
+ "Summarizing release highlights between two Git release tags",
3803
+ "Listing breaking changes before deploying an API version",
3804
+ ),
3805
+ avoid_when=(
3806
+ "Querying single file syntax",
3807
+ ),
3808
+ profiles=("full",),
3809
+ minimal_invocation="generate_semantic_changelog()",
3810
+ advanced_invocation='generate_semantic_changelog(base_ref="v1.0.0", head_ref="v2.0.0")',
3811
+ result_fields=("base_ref", "head_ref", "total_changes", "breaking_changes_count", "markdown_changelog"),
3812
+ typical_followup="review markdown_changelog output",
3813
+ common_mistakes=(
3814
+ "Using invalid or non-existent Git commit hashes",
3815
+ ),
3816
+ example_request="Generate a release changelog comparing HEAD~5 to HEAD.",
3817
+ example_call='generate_semantic_changelog(base_ref="HEAD~5", head_ref="HEAD")',
3818
+ example_interpretation="Inspect markdown_changelog for breaking changes and new endpoints.",
3819
+ ),
3820
+ # 94. fast_graph_path
3821
+ ToolCapabilitySpec(
3822
+ tool_name="fast_graph_path",
3823
+ capability="compressed_graph_path",
3824
+ description=(
3825
+ "Compute microsecond BFS shortest path between two symbols using the Compressed Sparse Row (CSR) binary graph. "
3826
+ "Use for instant path tracing between caller and callee. "
3827
+ "Does not modify graph."
3828
+ ),
3829
+ task_types=(
3830
+ AgentTaskCategory.TRACE.value,
3831
+ AgentTaskCategory.RELATIONSHIP.value,
3832
+ ),
3833
+ required_inputs=("start_node", "end_node"),
3834
+ optional_inputs=(),
3835
+ expected_output_type="dict[str, Any]",
3836
+ relationship_types_returned=(),
3837
+ evidence_guarantees="Microsecond breadth-first search path traversal in C-contiguous memory.",
3838
+ does_not_prove="Does not guarantee runtime dataflow execution along static edges.",
3839
+ useful_situations=(
3840
+ "Finding shortest invocation path between an entrypoint route and a database writer",
3841
+ "Tracing dependency chains across microservices or packages",
3842
+ ),
3843
+ avoid_when=(
3844
+ "When node names are unknown (use find_symbol first)",
3845
+ ),
3846
+ profiles=("full",),
3847
+ minimal_invocation='fast_graph_path(start_node="api_login", end_node="UserTable")',
3848
+ advanced_invocation='fast_graph_path(start_node="api_login", end_node="UserTable")',
3849
+ result_fields=("start_node", "end_node", "path", "length"),
3850
+ typical_followup="inspect path array of intermediate symbols",
3851
+ common_mistakes=(
3852
+ "Passing non-existent node names",
3853
+ ),
3854
+ example_request="What is the shortest path between handle_checkout and process_payment?",
3855
+ example_call='fast_graph_path(start_node="handle_checkout", end_node="process_payment")',
3856
+ example_interpretation="Inspect path array for step-by-step caller-callee sequence.",
3857
+ ),
3858
+ # 95. resolve_polymorphic_callees
3859
+ ToolCapabilitySpec(
3860
+ tool_name="resolve_polymorphic_callees",
3861
+ capability="polymorphic_dispatch",
3862
+ description=(
3863
+ "Resolve an abstract interface method or trait invocation to all concrete implementing classes in the workspace. "
3864
+ "Use when tracing dynamic dispatch or trait method implementations. "
3865
+ "Does not execute code."
3866
+ ),
3867
+ task_types=(
3868
+ AgentTaskCategory.RELATIONSHIP.value,
3869
+ AgentTaskCategory.TRACE.value,
3870
+ ),
3871
+ required_inputs=("interface_symbol", "method_name"),
3872
+ optional_inputs=(),
3873
+ expected_output_type="dict[str, Any]",
3874
+ relationship_types_returned=(),
3875
+ evidence_guarantees="AST-verified inheritance and interface implementation matching.",
3876
+ does_not_prove="Does not determine runtime active branch when multiple implementers exist.",
3877
+ useful_situations=(
3878
+ "Finding which concrete classes implement an interface like PaymentProcessor.charge()",
3879
+ "Tracing Rust trait methods or Go interface dispatch to concrete structs",
3880
+ ),
3881
+ avoid_when=(
3882
+ "Calling standard non-virtual concrete methods",
3883
+ ),
3884
+ profiles=("full",),
3885
+ minimal_invocation='resolve_polymorphic_callees(interface_symbol="PaymentGateway", method_name="pay")',
3886
+ advanced_invocation='resolve_polymorphic_callees(interface_symbol="PaymentGateway", method_name="pay")',
3887
+ result_fields=("interface_symbol", "method_name", "total_implementations", "implementations"),
3888
+ typical_followup="inspect implementations list for implementing classes",
3889
+ common_mistakes=(
3890
+ "Searching for concrete class instead of interface symbol",
3891
+ ),
3892
+ example_request="Which classes implement IOrderRepository.findById?",
3893
+ example_call='resolve_polymorphic_callees(interface_symbol="IOrderRepository", method_name="findById")',
3894
+ example_interpretation="Review implementations list for concrete class names and file locations.",
3895
+ ),
3896
+ # 96. propagate_interprocedural_dataflow
3897
+ ToolCapabilitySpec(
3898
+ tool_name="propagate_interprocedural_dataflow",
3899
+ capability="interprocedural_dataflow",
3900
+ description=(
3901
+ "Trace inter-procedural dataflow, return type inference, and unguarded None/null dereferences across caller-callee boundaries. "
3902
+ "Use when investigating NullPointerExceptions or type contract violations. "
3903
+ "Does not execute code."
3904
+ ),
3905
+ task_types=(
3906
+ AgentTaskCategory.DEBUG.value,
3907
+ AgentTaskCategory.DIAGNOSTIC.value,
3908
+ ),
3909
+ required_inputs=("target_symbol",),
3910
+ optional_inputs=(),
3911
+ expected_output_type="dict[str, Any]",
3912
+ relationship_types_returned=(),
3913
+ evidence_guarantees="Inter-procedural signature analysis and caller dereference checking.",
3914
+ does_not_prove="Does not prove runtime null dereference if runtime input guarantees non-null.",
3915
+ useful_situations=(
3916
+ "Checking if a function returning Optional[T] causes AttributeError in downstream callers",
3917
+ "Verifying type propagation across caller boundaries",
3918
+ ),
3919
+ avoid_when=(
3920
+ "Simple single-expression local variable edits",
3921
+ ),
3922
+ profiles=("full",),
3923
+ minimal_invocation='propagate_interprocedural_dataflow(target_symbol="find_user")',
3924
+ advanced_invocation='propagate_interprocedural_dataflow(target_symbol="find_user")',
3925
+ result_fields=("target_symbol", "inferred_return_type", "is_nullable", "nullability_warnings"),
3926
+ typical_followup="add null guards in reported caller locations",
3927
+ common_mistakes=(
3928
+ "Ignoring reported is_nullable warnings in high-traffic endpoints",
3929
+ ),
3930
+ example_request="Does find_user return None and could it crash its callers?",
3931
+ example_call='propagate_interprocedural_dataflow(target_symbol="find_user")',
3932
+ example_interpretation="Inspect is_nullable and nullability_warnings list.",
3933
+ ),
3934
+ # 97. analyze_supply_chain_cve_impact
3935
+ ToolCapabilitySpec(
3936
+ tool_name="analyze_supply_chain_cve_impact",
3937
+ capability="supply_chain_analysis",
3938
+ description=(
3939
+ "Inspect third-party dependency manifests (package.json, go.mod, Cargo.toml, requirements.txt) and trace actual internal call site reachability. "
3940
+ "Use when assessing CVE vulnerability blast radius. "
3941
+ "Does not execute external dependencies."
3942
+ ),
3943
+ task_types=(
3944
+ AgentTaskCategory.PACKAGE.value,
3945
+ AgentTaskCategory.CHANGE_IMPACT.value,
3946
+ ),
3947
+ required_inputs=(),
3948
+ optional_inputs=("target_package",),
3949
+ expected_output_type="dict[str, Any]",
3950
+ relationship_types_returned=(),
3951
+ evidence_guarantees="Manifest parsing and import call-site reachability matching.",
3952
+ does_not_prove="Does not fetch live CVE databases without external network connectivity.",
3953
+ useful_situations=(
3954
+ "Determining if a flagged vulnerable third-party package is actually imported by your code",
3955
+ "Auditing all internal call sites invoking a specific external library",
3956
+ ),
3957
+ avoid_when=(
3958
+ "Searching internal workspace symbols",
3959
+ ),
3960
+ profiles=("full",),
3961
+ minimal_invocation="analyze_supply_chain_cve_impact()",
3962
+ advanced_invocation='analyze_supply_chain_cve_impact(target_package="axios")',
3963
+ result_fields=("workspace", "total_dependencies", "actively_imported_count", "packages", "active_call_sites"),
3964
+ typical_followup="inspect active_call_sites for impacted files",
3965
+ common_mistakes=(
3966
+ "Assuming package is safe just because it is in devDependencies",
3967
+ ),
3968
+ example_request="Is package lodash actively imported and called in our codebase?",
3969
+ example_call='analyze_supply_chain_cve_impact(target_package="lodash")',
3970
+ example_interpretation="Check is_actively_imported and call_sites_count.",
3971
+ ),
2628
3972
  )
2629
3973
 
2630
3974
  _TOOL_BY_NAME: dict[str, ToolCapabilitySpec] = {t.tool_name: t for t in TOOL_CAPABILITY_REGISTRY}
@@ -2931,72 +4275,9 @@ MCP_PROFILE_RECOMMENDATIONS: dict[str, dict[str, object]] = {
2931
4275
  },
2932
4276
  "full": {
2933
4277
  "profile": "full",
2934
- "tool_count": 62,
4278
+ "tool_count": len(TOOL_CAPABILITY_REGISTRY),
2935
4279
  "recommended_for": "Complete diagnostic, database intelligence, runtime reconciliation, benchmark, and repository administration sessions",
2936
- "included_tools": [
2937
- "analyze_change_impact",
2938
- "analyze_impact",
2939
- "check_context_freshness",
2940
- "compare_git",
2941
- "compile_task",
2942
- "detect_semantic_conflicts",
2943
- "find_callees",
2944
- "find_callers",
2945
- "find_db_callers",
2946
- "find_db_columns",
2947
- "find_db_models",
2948
- "find_db_queries",
2949
- "find_db_readers",
2950
- "find_db_relationships",
2951
- "find_db_tables",
2952
- "find_db_writers",
2953
- "find_references",
2954
- "find_related_tests",
2955
- "find_routes",
2956
- "find_symbol",
2957
- "find_tests",
2958
- "get_architecture",
2959
- "get_call_graph",
2960
- "get_callees",
2961
- "get_callers",
2962
- "get_change_impact",
2963
- "get_context",
2964
- "get_db_impact",
2965
- "get_db_schema",
2966
- "get_db_table",
2967
- "get_dependencies",
2968
- "get_dependency_graph",
2969
- "get_dependents",
2970
- "get_evidence",
2971
- "get_file",
2972
- "get_file_history",
2973
- "get_file_symbols",
2974
- "get_git_impact",
2975
- "get_git_state",
2976
- "get_graph",
2977
- "get_imports",
2978
- "get_project_structure",
2979
- "get_recent_changes",
2980
- "get_references",
2981
- "get_repository_status",
2982
- "get_resource_status",
2983
- "get_runtime_trace",
2984
- "get_symbol",
2985
- "ingest_runtime_traces",
2986
- "list_routes",
2987
- "plan_retrieval",
2988
- "read_file",
2989
- "reconcile_static_runtime",
2990
- "resolve_symbol",
2991
- "search_code",
2992
- "search_memory",
2993
- "search_symbols",
2994
- "trace_call",
2995
- "trace_flow",
2996
- "trace_path",
2997
- "trace_symbol_history",
2998
- "verify_evidence",
2999
- ],
4280
+ "included_tools": sorted(spec.tool_name for spec in TOOL_CAPABILITY_REGISTRY),
3000
4281
  },
3001
4282
  }
3002
4283