@@ -346,6 +346,11 @@ async fn review_command(
346346 }
347347 }
348348
349+ if let Some ( guidance) = build_review_guidance ( & config, path_config) {
350+ local_prompt_config. system_prompt . push_str ( "\n \n " ) ;
351+ local_prompt_config. system_prompt . push_str ( & guidance) ;
352+ }
353+
349354 let local_prompt_builder = core:: PromptBuilder :: new ( local_prompt_config) ;
350355 let ( system_prompt, user_prompt) =
351356 local_prompt_builder. build_prompt ( & diff, & context_chunks) ?;
@@ -389,6 +394,7 @@ async fn review_command(
389394 let processed_comments = plugin_manager
390395 . run_post_processors ( all_comments, & repo_path_str)
391396 . await ?;
397+ let processed_comments = apply_confidence_threshold ( processed_comments, config. min_confidence ) ;
392398
393399 let effective_format = if patch { OutputFormat :: Patch } else { format } ;
394400 output_comments ( & processed_comments, output_path, effective_format) . await ?;
@@ -866,6 +872,10 @@ async fn review_diff_content_raw(
866872 local_prompt_config. system_prompt = prompt. clone ( ) ;
867873 }
868874 }
875+ if let Some ( guidance) = build_review_guidance ( & config, path_config) {
876+ local_prompt_config. system_prompt . push_str ( "\n \n " ) ;
877+ local_prompt_config. system_prompt . push_str ( & guidance) ;
878+ }
869879 let local_prompt_builder = core:: PromptBuilder :: new ( local_prompt_config) ;
870880 let ( system_prompt, user_prompt) =
871881 local_prompt_builder. build_prompt ( & diff, & context_chunks) ?;
@@ -910,6 +920,7 @@ async fn review_diff_content_raw(
910920 let processed_comments = plugin_manager
911921 . run_post_processors ( all_comments, & repo_path_str)
912922 . await ?;
923+ let processed_comments = apply_confidence_threshold ( processed_comments, config. min_confidence ) ;
913924
914925 Ok ( processed_comments)
915926}
@@ -1292,12 +1303,14 @@ async fn smart_review_command(
12921303 context_chunks. extend ( definition_chunks) ;
12931304 }
12941305
1306+ let guidance = build_review_guidance ( & config, path_config) ;
12951307 let ( system_prompt, user_prompt) =
12961308 core:: SmartReviewPromptBuilder :: build_enhanced_review_prompt (
12971309 & diff,
12981310 & context_chunks,
12991311 config. max_context_chars ,
13001312 config. max_diff_chars ,
1313+ guidance. as_deref ( ) ,
13011314 ) ?;
13021315
13031316 let request = adapters:: llm:: LLMRequest {
@@ -1340,6 +1353,7 @@ async fn smart_review_command(
13401353 let processed_comments = plugin_manager
13411354 . run_post_processors ( all_comments, & repo_path_str)
13421355 . await ?;
1356+ let processed_comments = apply_confidence_threshold ( processed_comments, config. min_confidence ) ;
13431357
13441358 // Generate summary and output results
13451359 let summary = core:: CommentSynthesizer :: generate_summary ( & processed_comments) ;
@@ -1825,6 +1839,81 @@ fn filter_comments_for_diff(
18251839 filtered
18261840}
18271841
1842+ fn build_review_guidance (
1843+ config : & config:: Config ,
1844+ path_config : Option < & config:: PathConfig > ,
1845+ ) -> Option < String > {
1846+ let mut sections = Vec :: new ( ) ;
1847+
1848+ if let Some ( profile) = config. review_profile . as_deref ( ) {
1849+ let guidance = match profile {
1850+ "chill" => Some (
1851+ "Be conservative and only surface high-confidence, high-impact issues. Avoid nitpicks and redundant comments." ,
1852+ ) ,
1853+ "assertive" => Some (
1854+ "Be thorough and proactive. Surface edge cases, latent risks, and maintainability concerns even if they are subtle." ,
1855+ ) ,
1856+ _ => None ,
1857+ } ;
1858+ if let Some ( text) = guidance {
1859+ sections. push ( format ! ( "Review profile ({}): {}" , profile, text) ) ;
1860+ }
1861+ }
1862+
1863+ if let Some ( instructions) = config. review_instructions . as_deref ( ) {
1864+ let trimmed = instructions. trim ( ) ;
1865+ if !trimmed. is_empty ( ) {
1866+ sections. push ( format ! ( "Global review instructions:\n {}" , trimmed) ) ;
1867+ }
1868+ }
1869+
1870+ if let Some ( pc) = path_config {
1871+ if let Some ( instructions) = pc. review_instructions . as_deref ( ) {
1872+ let trimmed = instructions. trim ( ) ;
1873+ if !trimmed. is_empty ( ) {
1874+ sections. push ( format ! ( "Path-specific instructions:\n {}" , trimmed) ) ;
1875+ }
1876+ }
1877+ }
1878+
1879+ if sections. is_empty ( ) {
1880+ None
1881+ } else {
1882+ Some ( format ! (
1883+ "Additional review guidance:\n {}" ,
1884+ sections. join( "\n \n " )
1885+ ) )
1886+ }
1887+ }
1888+
1889+ fn apply_confidence_threshold (
1890+ comments : Vec < core:: Comment > ,
1891+ min_confidence : f32 ,
1892+ ) -> Vec < core:: Comment > {
1893+ if min_confidence <= 0.0 {
1894+ return comments;
1895+ }
1896+
1897+ let total = comments. len ( ) ;
1898+ let mut kept = Vec :: with_capacity ( total) ;
1899+
1900+ for comment in comments {
1901+ if comment. confidence >= min_confidence {
1902+ kept. push ( comment) ;
1903+ }
1904+ }
1905+
1906+ if kept. len ( ) != total {
1907+ let dropped = total. saturating_sub ( kept. len ( ) ) ;
1908+ info ! (
1909+ "Dropped {} comment(s) below confidence threshold {}" ,
1910+ dropped, min_confidence
1911+ ) ;
1912+ }
1913+
1914+ kept
1915+ }
1916+
18281917fn is_line_in_diff ( diff : & core:: UnifiedDiff , line_number : usize ) -> bool {
18291918 if line_number == 0 {
18301919 return false ;
0 commit comments