Skip to content

Commit ebb9841

Browse files
rgriffiths-scottlogicSiteleaf
authored andcommitted
Updated Building Jarvis Properly Phase 7 Eating My Own Dog Food
1 parent 6dcf183 commit ebb9841

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

_drafts/building-jarvis-properly-phase-7-eating-my-own-dog-food.markdown

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ The TUI refused to release the mouse capture.
212212

213213
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.
214214

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!
216216

217217
## Post-Credits Scene: The Memory Hole
218218

@@ -221,19 +221,22 @@ Just as I was about to wrap up, I realised a fatal flaw. I had a beautiful dashb
221221
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.
222222

223223
**The Recorder**
224+
224225
I hooked into the Agent's chat loop to log every interaction to a new `chat_history` table in `jarvis.db`.
225226

226227
* **User Input:** Logged immediately.
227228
* **Tool Calls:** Logged as "System" events.
228229
* **Final Answers:** Logged as "Assistant" responses.
229230

230231
**The Final Crash**
232+
231233
Of course, it wasn't that simple. The first time I ran it:
232234
`InterfaceError: Error binding parameter 3 - probably unsupported type.`
233235

234236
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.
235237

236238
**The Viewer**
239+
237240
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.
238241

239242
NOW, Phase 7 is complete.

0 commit comments

Comments
 (0)