[FEATURE] Allow headless (claude -p) sessions to publish and update Artifacts
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
Headless claude -p sessions don't get the Artifact tool, so a scheduled job can't keep a published artifact up to date. I have a job that rebuilds a dashboard's data file every day. Today the dashboard only updates when someone opens an interactive session afterwards and publishes it.
Proposed Solution
Make the Artifact tool available in claude -p sessions, at least for updating an artifact the account already owns (publish with url). An explicit opt-in, such as a flag or a settings entry, would be fine.
Alternative Solutions
My current workaround is a SessionStart hook. It checks whether the data file is newer than a "last published" marker and, if so, tells the next interactive session to publish. It works, but the publish runs in whatever session I open next, even one about something unrelated, and the dashboard stays stale on days I don't open a session.
Priority
Medium - Would be very helpful
Feature Category
CLI commands and flags
Use Case Example
- A local scheduler runs
claude -pat a fixed time each day. - The job queries a data source and writes a fresh
data.jsfor an existing artifact. - The job publishes the page and
data.jsto the artifact's existing URL, so viewers see today's numbers without anyone opening a session.
Additional Context
- Claude Code 2.1.280, macOS.
- When asked whether a tool named Artifact was available, a
claude -psession said no. The same account has the tool in interactive sessions.