- Archive
- /
- Foreman Assistant
- /
- Downloadable Artifacts in Foreman Assistant
Downloadable Artifacts in Foreman Assistant
Learn how Foreman Assistant generates, displays, and lets you preview or download artifacts like files, code, markdown, and diagrams using the side panel and resizable layout.
What is an artifact?
An artifact is a piece of content the AI produces that deserves its own surface — not inlined into the chat thread. Every artifact appears as a card under the assistant message that produced it. Click the card to open it in the side panel where you can preview, copy, and download.
Foreman Assistant creates artifacts in three ways:
- Explicit file generation — the AI calls its
create_artifacttool when you ask for a CSV, JSON, config, script, or any named file. - Large code blocks — any fenced code block of 15 lines or more in a reply is automatically pulled out into a code artifact.
- Diagrams & long docs — mermaid diagrams, and markdown documents with a heading and 30+ non-empty lines, become diagram and markdown artifacts respectively.
The side panel
When you click an artifact card, a panel slides in from the right. It's split into:
- Header — artifact kind (FILE / CODE / MARKDOWN / DIAGRAM) and title.
- Toolbar — copy, download, close.
- Content area — the actual preview, rendered according to kind.
Kinds and rendering
| Kind | Rendering | Example |
|---|---|---|
| file | Raw content in a light mono-font pane. | snowdon-members.csv |
| code | Prism.js syntax highlighting with the language tag. | deploy-script.py |
| markdown | Fully rendered Markdown (headings, lists, tables, links in new tabs). | Long status report |
| diagram | Rendered mermaid diagram (flowchart, sequence, ER, etc.). | Project workflow diagram |
Resizable width
Drag the left edge of the panel to resize it. A 6-pixel hot zone turns brand-blue on hover. Width is clamped between 320 px and 85% of the window. Your chosen width is saved to localStorage so it persists across sessions and browsers signed in as you.
On the full-page surface (/foreman-assistant), the panel sits inline between the chat and the right edge — your chat reflows. In the floating widget, the panel overlays the right side as a drawer.
Copying and downloading
- Copy — copies the full artifact content to your clipboard. The icon flashes green for 1.5s when successful.
- Download — writes the content to a file. The filename uses:
- The exact filename the AI provided for
create_artifact(including extension). - Otherwise, the artifact title plus an extension derived from the language tag (
csv → .csv,python → .py,mermaid → .mmd, and so on — see the full table below). - If the title already has an extension, it isn't doubled.
- The exact filename the AI provided for
Supported download extensions
.cs, .ts, .js, .py, .sql, .json, .yaml, .xml, .html, .css, .sh, .ps1, .go, .rs, .java, .rb, .csv, .tsv, .toml, .ini, .env, .dockerfile, .mk, .mmd, .md
Unknown languages fall back to .txt.
Asking the AI for a file
Be explicit. Examples that work well:
- "Give me a CSV of all members of the Snowdon Towers project with columns for name, email, role, and admin status."
- "Export the last QA check results as a JSON file I can download."
- "Write a Python script that polls
/api/scheduled-jobsevery hour and alerts on failures. Make it downloadable." - "Produce a mermaid diagram of the project setup workflow."
The AI will call create_artifact (you'll see the tool call flash in the thread), write the file, and respond with a short message telling you it's ready in the side panel.
For tabular data, a CSV artifact is almost always better than an inline markdown table — it preserves quoting, survives large row counts, and opens cleanly in Excel or Google Sheets.
Artifacts and conversation history
- Artifacts are persisted with their parent assistant message. Reopening the conversation re-renders the cards and the side panel can fetch their content on demand.
- Forking a conversation ("Start new chat from here") copies messages up to the fork point but does not duplicate artifacts — the original session retains them.
- Regenerating an assistant message ("Try again") creates a sibling response with its own artifacts. Sibling count is shown as a badge on the bubble.
- Deleting a user or assistant message cascades to its artifacts.
Automatic extraction rules
The background extractor runs once the assistant reply is fully saved and inspects the final text for:
| Pattern | Triggers | Artifact kind |
|---|---|---|
```<lang> fenced block, ≥ 15 lines |
Always | code (or file if AI used create_artifact) |
```mermaid fenced block |
Always | diagram |
Remaining reply, ≥ 30 non-empty lines AND contains a # / ## / ### heading |
After code/diagram blocks stripped | markdown |
Short code snippets (< 15 lines) stay inline in the message bubble and get Prism syntax highlighting there. They don't create artifacts.
Side-panel vs inline
Both full-page and widget surfaces render the side panel:
- Full-page — the panel sits as the third column (sidebar / chat / panel) and the chat reflows.
- Widget — the panel appears as a right-edge drawer with a drop shadow, overlaying the chat until closed.
In both cases, the same resize logic and stored width apply.
Troubleshooting
- "I don't see my artifact card" — check you actually received a reply. The card appears below the assistant message after streaming completes. Refresh the session if it never shows; the artifact is already persisted server-side.
- "Syntax highlighting looks plain" — Prism loads languages on demand from a CDN. The first render of a new language may take a fraction of a second. If your network blocks jsdelivr.net, colours won't apply but text is still readable.
- "Mermaid render error" — the diagram source didn't parse. Open the side panel, copy the content, and validate at mermaid.live. You can also ask the AI to simplify: "regenerate with a simpler flow".
- "Download gave me
.csv.csv" — fixed; titles that already carry an extension aren't doubled.
See Also
- Foreman Assistant Overview — where artifacts fit into the feature set.
- Attachments in AI Chat — files you upload for the AI to read (the inverse direction).
- Managing Conversations — forking, regenerating, and sibling versions.
- Slash Commands — pre-built prompts including ones that produce files.