Skip to content

Commit e3e91e0

Browse files
0xrinegadeclaude
andcommitted
feat(tui): Add hypothesis-driven investigation mode
- Add hypothesis extraction from user queries - Update AI analysis prompt to evaluate hypotheses - Generate verdict (SUPPORTED/REFUTED/INCONCLUSIVE) with evidence - Hypothesis triggers: "I think", "I suspect", "check if", etc. 🤖 Generated with [Claude Code](https://claude.ai/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent b272c65 commit e3e91e0

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

src/commands/research.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,9 @@ async fn handle_tui_research(matches: &ArgMatches, wallet: &str) -> Result<()> {
579579
// Get Tokio runtime handle for spawning async tasks
580580
let runtime_handle = tokio::runtime::Handle::current();
581581

582+
// Initialize chat AI integration with the runtime handle
583+
app.set_runtime_handle(runtime_handle.clone());
584+
582585
// Spawn real research agent in background thread
583586
let agent_handle = std::thread::spawn(move || {
584587
// Block on async agent execution

src/utils/tui/app.rs

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,10 +1188,26 @@ async fn run_autonomous_investigation(
11881188
// Create AI service for synthesis
11891189
let ai_service = crate::services::ai_service::AiService::new();
11901190

1191+
// Build hypothesis section if provided
1192+
let hypothesis_section = if let Some(ref h) = hypothesis {
1193+
format!(r#"
1194+
1195+
HYPOTHESIS TO TEST: "{}"
1196+
1197+
You MUST include a dedicated "Hypothesis Verdict" section with:
1198+
- **SUPPORTED** / **REFUTED** / **INCONCLUSIVE** verdict
1199+
- Evidence supporting the hypothesis
1200+
- Evidence against the hypothesis
1201+
- Confidence level (High/Medium/Low)
1202+
"#, h)
1203+
} else {
1204+
String::new()
1205+
};
1206+
11911207
let analysis_prompt = format!(
11921208
r#"You are a blockchain forensics expert. Analyze this investigation data and provide a comprehensive report.
11931209
1194-
TARGET WALLET: {}
1210+
TARGET WALLET: {}{}
11951211
11961212
EXPLORATION SUMMARY:
11971213
- Wallets explored: {}
@@ -1205,19 +1221,21 @@ WALLET EXPLORATION LOG:
12051221
{}
12061222
12071223
Generate a forensic report with:
1208-
1. **Executive Summary** (2-3 sentences)
1224+
1. **Executive Summary** (2-3 sentences){}
12091225
2. **Key Findings** (bullet points)
12101226
3. **Risk Assessment** (Low/Medium/High/Critical with explanation)
12111227
4. **Wallet Relationships** (key connections identified)
12121228
5. **Recommendations** (what to investigate further)
12131229
12141230
Be specific. Use actual wallet addresses (never truncate). Include amounts where relevant."#,
12151231
target_wallet,
1232+
hypothesis_section,
12161233
visited.len(),
12171234
all_transfers.len(),
12181235
MAX_INVESTIGATION_DEPTH,
12191236
findings.iter().map(|f| format!("• [{}] {}: {}", severity_str(&f.severity), f.title, f.description)).collect::<Vec<_>>().join("\n"),
1220-
wallet_summaries.join("\n")
1237+
wallet_summaries.join("\n"),
1238+
if hypothesis.is_some() { "\n6. **Hypothesis Verdict** (SUPPORTED/REFUTED/INCONCLUSIVE with evidence)" } else { "" }
12211239
);
12221240

12231241
let report = match ai_service.query_osvm_ai_with_options(&analysis_prompt, None, Some(true), false).await {

0 commit comments

Comments
 (0)