Project Files
docs / initial-docs / MEMORIZE-DOC-IMAGES.md
memorize_docThe memorize_doc tool allows the agent to save notes and automatically copy attached images into the notesDirectory/images/ folder. However, there are two distinct scenarios for image embedding depending on whether you know the final filename upfront.
This note demonstrates both approaches:
1781249564486_-_534.png) was only revealed after saving. This applies to all media types registered during the conversation: Attachments (aN), Images (iN), Pictures (pN) and Variants (vN).agent-model.jpeg already exists in the images folder, so it can be linked directly on first write.When media is registered during the conversation via tools like find_doc, read_doc, as a user attachment (a1), or generated by image/video tools (iN, vN)…, the agent does not know what final filename memorize_doc will assign. This applies to all four media classes:
| Media class | Notation | Source |
|---|---|---|
| Attachments | a1, a2… | User-uploaded images |
| Pictures | p1, p2… | Search results from find_doc, read_doc |
| Images | i1, i2… | Rendered PDF pages via extract_image or annotated frames |
| Variants | v1, v2… | AI-generated image/video outputs |
The tool copies the media to notesDirectory/images/ and appends a Markdown reference at the end of the body (e.g., ).
Use read_doc(filename) or find_doc(query) to retrieve the saved note. The appended image line reveals the actual filename used by memorize_doc.
Example: This very note initially placed the screenshot at the bottom as:
After reading back, we discovered the real name is
1781249564486_-_534.pngand moved it inline below.
If you placed placeholder links in the body text during Step 1, use rewrite_doc to replace them with the correct filenames discovered in Step 2. This is exactly what we did for this note!
Result: The tools reference screenshot now appears correctly embedded:

When media is manually copied or previously stored in notesDirectory/images/, their exact filenames are known. The agent can write correct links on the first attempt without needing a correction pass.
All images live under images/ relative to the note's Markdown file. So if your image is called agent-model..jpeg, the correct link in any note is simply:
No second read or rewrite needed — one-and-done workflow.
Example: The agent model configuration below was linked directly on first write because its filename was known:

| Situation | Filename known? | Steps required | Tools used |
|---|---|---|---|
| Media from chat (attachment, search result, extracted PDF page, generated image/video) | ❌ No | 2–3 steps: write → read back → rewrite if needed | memorize_doc → read_doc → rewrite_doc |
| Media already in images/ folder | ✅ Yes | 1 step: write note with correct links directly | memorize_doc only |
find_doc before creating a new note to avoid duplicates. If a similar title exists, prefer rewrite_doc.memorize_doc(title, tags, body, images=["a1"])
 ← placeholder or auto-appended
