|
| 1 | +# Plan to Fix OSVM Research Agent Output |
| 2 | + |
| 3 | +## User's Requirements (Re-read Analysis): |
| 4 | + |
| 5 | +1. **"where is beatiful chart like this?"** |
| 6 | + - User wants the HORIZONTAL PIPELINE renderer (from `/tmp/pipeline_with_metadata.rs`) |
| 7 | + - NOT the simple depth-based sections |
| 8 | + - Want the ASCII art with arrows flowing LEFT→RIGHT like the prototype showed |
| 9 | + |
| 10 | +2. **"why you expand only surface level?"** |
| 11 | + - Currently showing depth-based sections separately |
| 12 | + - User wants TRUE horizontal expansion with wallets side-by-side |
| 13 | + - Like columns in a table, not separate sections |
| 14 | + |
| 15 | +3. **"stop printing out ovsm out"** |
| 16 | + - Don't show raw OVSM LISP code execution in output |
| 17 | + - Save it to file instead |
| 18 | + |
| 19 | +4. **"save it to file, not to the output"** |
| 20 | + - All OVSM execution details → file |
| 21 | + - Only show final results to user |
| 22 | + |
| 23 | +5. **"in ai call specify maxTokens: 128"** |
| 24 | + - Make AI responses more concise |
| 25 | + - Add maxTokens parameter to AI service calls |
| 26 | + |
| 27 | +6. **"it gives us markdown - you must render markdown"** |
| 28 | + - AI responses come as markdown |
| 29 | + - Need to render markdown to terminal (colors, formatting) |
| 30 | + |
| 31 | +7. **"all osvm output must be written to the log file"** |
| 32 | + - Path: `~/.osvm/logs/log-{unixtimestamp}.log` |
| 33 | + - ALL events, output, execution details |
| 34 | + - Keep logging until program exits |
| 35 | + |
| 36 | +## Tasks to Implement: |
| 37 | + |
| 38 | +### Task 1: Fix Horizontal Pipeline Renderer ✅ HIGH PRIORITY |
| 39 | +**Problem**: Current implementation shows depth sections VERTICALLY, not true horizontal pipeline |
| 40 | +**Solution**: |
| 41 | +- Modify `render_horizontal_pipeline()` to render wallets SIDE-BY-SIDE at same depth |
| 42 | +- Create true LEFT→RIGHT flow like the prototype |
| 43 | +- Use columnar layout with proper ASCII art arrows |
| 44 | + |
| 45 | +**Files to modify**: |
| 46 | +- `src/services/research_agent.rs` - Fix renderer to be truly horizontal |
| 47 | + |
| 48 | +### Task 2: Add Logging System ✅ HIGH PRIORITY |
| 49 | +**Problem**: No centralized logging to file |
| 50 | +**Solution**: |
| 51 | +- Create `~/.osvm/logs/` directory |
| 52 | +- Generate log filename with Unix timestamp |
| 53 | +- Redirect all output to log file |
| 54 | +- Use `tracing` or `log` crate with file appender |
| 55 | + |
| 56 | +**Files to modify**: |
| 57 | +- `src/main.rs` - Initialize logging on startup |
| 58 | +- `src/services/research_agent.rs` - Log all OVSM executions |
| 59 | + |
| 60 | +### Task 3: Hide OVSM Execution Output ✅ MEDIUM PRIORITY |
| 61 | +**Problem**: OVSM LISP code shown in terminal |
| 62 | +**Solution**: |
| 63 | +- Don't print OVSM execution to stdout |
| 64 | +- Only log to file |
| 65 | +- Show only final results to user |
| 66 | + |
| 67 | +**Files to modify**: |
| 68 | +- `src/services/ovsm_service.rs` or wherever OVSM is executed |
| 69 | +- Capture stdout/stderr and redirect to log |
| 70 | + |
| 71 | +### Task 4: Add maxTokens to AI Calls ✅ MEDIUM PRIORITY |
| 72 | +**Problem**: AI responses too verbose |
| 73 | +**Solution**: |
| 74 | +- Add `max_tokens: 128` parameter to AI API calls |
| 75 | +- Make responses more concise |
| 76 | + |
| 77 | +**Files to modify**: |
| 78 | +- `src/services/ai_service.rs` - Add maxTokens parameter |
| 79 | +- `src/utils/ai_client.rs` - Pass parameter to API |
| 80 | + |
| 81 | +### Task 5: Render Markdown in Terminal ✅ MEDIUM PRIORITY |
| 82 | +**Problem**: AI returns markdown, we show raw text |
| 83 | +**Solution**: |
| 84 | +- Use `termimad` or `bat` crate to render markdown |
| 85 | +- Convert markdown to ANSI-colored terminal output |
| 86 | + |
| 87 | +**Files to modify**: |
| 88 | +- `src/services/research_agent.rs` - Render AI responses as markdown |
| 89 | +- Add markdown rendering utility |
| 90 | + |
| 91 | +## Implementation Order: |
| 92 | + |
| 93 | +1. **FIRST**: Fix horizontal pipeline renderer (user's main complaint) |
| 94 | +2. **SECOND**: Add logging system (infrastructure for other changes) |
| 95 | +3. **THIRD**: Hide OVSM output + redirect to logs |
| 96 | +4. **FOURTH**: Add maxTokens parameter |
| 97 | +5. **FIFTH**: Render markdown |
| 98 | + |
| 99 | +## Expected Result: |
| 100 | + |
| 101 | +When user runs `osvm research --agent ADDRESS`: |
| 102 | +- ✅ Beautiful horizontal ASCII chart with LEFT→RIGHT flow |
| 103 | +- ✅ No OVSM execution output visible |
| 104 | +- ✅ All details logged to `~/.osvm/logs/log-{timestamp}.log` |
| 105 | +- ✅ Concise AI responses (max 128 tokens) |
| 106 | +- ✅ Markdown rendered with colors/formatting |
| 107 | +- ✅ Clean, professional terminal output |
| 108 | + |
| 109 | +## Self-Check Questions: |
| 110 | + |
| 111 | +- ❓ Do I understand what "horizontal" means? → YES: Side-by-side wallets, not vertical sections |
| 112 | +- ❓ Do I know what output to hide? → YES: OVSM LISP execution details |
| 113 | +- ❓ Do I know where to log? → YES: `~/.osvm/logs/log-{unixtimestamp}.log` |
| 114 | +- ❓ Do I know what maxTokens does? → YES: Limits AI response length |
| 115 | +- ❓ Do I know what markdown rendering means? → YES: Convert `**bold**` to ANSI colors |
| 116 | + |
| 117 | +## Files to Read/Modify: |
| 118 | + |
| 119 | +1. `/home/larp/larpdevs/osvm-cli/src/services/research_agent.rs` - Fix renderer |
| 120 | +2. `/home/larp/larpdevs/osvm-cli/src/main.rs` - Add logging init |
| 121 | +3. `/home/larp/larpdevs/osvm-cli/src/services/ai_service.rs` - Add maxTokens |
| 122 | +4. `/home/larp/larpdevs/osvm-cli/Cargo.toml` - Add logging/markdown deps |
| 123 | +5. `/tmp/pipeline_with_metadata.rs` - Reference for beautiful chart |
| 124 | + |
| 125 | +## Notes: |
| 126 | + |
| 127 | +- User emphasized "read this message again" - did that ✅ |
| 128 | +- User wants self-asking - doing that now ✅ |
| 129 | +- User wants plan in plan_fix.md - writing this ✅ |
| 130 | +- User's tone suggests frustration with current output - prioritize visual fixes |
0 commit comments