You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _drafts/building-jarvis-properly-phase-7-eating-my-own-dog-food.markdown
+4-1Lines changed: 4 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -212,7 +212,7 @@ The TUI refused to release the mouse capture.
212
212
213
213
I was building an autonomous AI system, but I couldn't copy text out of my own terminal which was one of the very first key drivers that set me down the path for this whole project! The irony is not lost on me! See [Extracting Data From AI Models - Phase 3: A Tale of Three Approaches](https://blog.scottlogic.com/2025/07/23/extracting-data-from-ai-models-a-tale-of-three-approaches.html) for additional context.
214
214
215
-
I fought the framework for an hour and lost. In the end, I implemented the "Ultimate Give-Up": a custom `/copy` command. Now, when I type `/copy`, JARVIS programmatically dumps his last response into my system clipboard using `pyperclip`. It is not elegant, but it works sufficiently well for now.
215
+
I fought the framework for an hour and lost. In the end, I implemented the "Ultimate Give-Up": a custom `/copy` command. Now, when I type `/copy`, JARVIS programmatically dumps his last response into my system clipboard using `pyperclip`. It is not elegant, but it works sufficiently well for now. This will be revisited!
216
216
217
217
## Post-Credits Scene: The Memory Hole
218
218
@@ -221,19 +221,22 @@ Just as I was about to wrap up, I realised a fatal flaw. I had a beautiful dashb
221
221
If I quit the TUI, the conversation vanished. `tasks` were stored in SQLite, but the actual *thinking* (the prompts, the tool outputs, the reasoning) was purely in RAM. JARVIS had amnesia, poor chap.
222
222
223
223
**The Recorder**
224
+
224
225
I hooked into the Agent's chat loop to log every interaction to a new `chat_history` table in `jarvis.db`.
225
226
226
227
***User Input:** Logged immediately.
227
228
***Tool Calls:** Logged as "System" events.
228
229
***Final Answers:** Logged as "Assistant" responses.
229
230
230
231
**The Final Crash**
232
+
231
233
Of course, it wasn't that simple. The first time I ran it:
I was trying to shove the raw `CallToolResult` object from the MCP SDK directly into a SQLite `TEXT` column. One quick `str(result)` cast later, and the crash was gone.
235
237
236
238
**The Viewer**
239
+
237
240
Reading raw JSON from SQLite is painful. I didn't want to use a SQL client to read my chat logs: that felt unnecessarily cumbersome. So, I built a small utility script, `view_chats.py`. It uses the `Rich` library to render the database rows into a beautiful, colour-coded script, stripping away the GUIDs and metadata so I can just read the story.
0 commit comments