[Feature]: Support Artifacts Inside One AO Session - WIP

Author: neversettle17-101Created Aug 26, 2026Updated Sep 29, 2026
Labelsenhancementcomp/daemon

Session Artifacts

TL;DR

We want AO sessions to produce a first-class artifact, not only a PR.

The design:

  • the user starts a session normally
  • AO creates a session-owned artifact directory under AO's data directory, outside the git workspace
  • AO instructs the worker to write deliverables through that artifact path when producing non-PR outputs
  • AO lists session artifacts from that AO-managed artifact directory and from PR facts
  • file artifacts may be markdown, html, or file, inferred from extension or MIME type at read time
  • a session may show multiple file artifacts without storing one DB row per file
  • AO stores the session's current output type as none, pr, or artifact
  • HTML artifacts can open in the existing browser preview flow

The main architectural choice is to keep sessions as the primary lifecycle object and add artifacts as a durable session-owned output layer on top.

How this works with the orchestrator: the orchestrator (or any caller) will read a session's artifacts the same way it reads PR facts — the existing session read APIs (GET /sessions/{id}, GET /orchestrators/{id}) return artifactFiles alongside prs, computed live from the session's artifact directory on every read. This gives the orchestrator listing parity with PRs from day one: it can always see what artifacts a session has produced. Reading an artifact file's content is planned as a second delivery on top of that: #5895 will add a dedicated content-read endpoint (and an ao CLI command), so the orchestrator — or any caller that isn't co-located with the daemon's filesystem — can fetch artifact bytes the same way it already fetches PR file content via GET /sessions/{id}/pr/{n}/file. Until that lands, the orchestrator can still reach artifact bytes through the preview boundary (built for the Browser tab) or, if co-located with the daemon, by reading the artifact directory directly.

AO Cloud: in Cloud, an artifact will be shareable through a generated link, restricted to users within the artifact-owning organization — nobody outside that org can open it. The cloud-side technical implementation (link generation, org-scoped access checks, storage) is TBD and out of scope for this issue.

How this fits ao report: ao report --artifact <ref> already exists as a worker-facing CLI flag, but it is an opaque string reference with no connection to the artifact directory this design introduces. It stays that way by design — the same loose coupling ao report already has with PRs. --pr-created <url> doesn't create the PR; it narrates one that git/GitHub already made. Artifacts follow the same pattern: the artifact directory remains the sole system of record for what artifacts exist (computed live, not trusted from a worker claim), and ao report --artifact stays a free-form annotation a worker can optionally add to its report history for a human or orchestrator to read. A natural follow-on, not required for this design, is validating --artifact <path> against the session's real artifact directory at report time and surfacing its Label as an optional caption on the artifact's card in the UI.

Competitive Analysis

Superset has "Pages" rather than artifacts, and the mental model is meaningfully different from our file-viewer approach: a user clicks "+" to create a page, then prompts an agent to fill it in — the page is the starting point, not an inferred output of a task. Where it does overlap with our direction: users can send feedback on a page back to the worker agent, the same way our solution lets a user leave feedback on an artifact file back to the worker.

Claude (Code / claude.ai) follows an approach much closer to ours: nothing is created until the user explicitly asks for it — when a user says "create an artifact" or "create a document," it gets generated, and from there it can be shared and iterated on further.

Building a dedicated page/artifact-creation surface like Superset's — a standing "+" entry point independent of a task — doesn't make sense for AO at this stage; it adds a whole extra creation flow and mental model for users to learn before we've validated the simpler one. The better direction is the one Claude Code already takes: artifacts fall out of what the worker was already asked to do, with no separate creation step, which keeps onboarding easy and fast. This design follows that direction.

Goal

Let a user start any AO task without declaring in advance whether the outcome should be a PR or some other deliverable. AO should create a session-owned artifact area outside the git workspace, instruct the worker to place non-PR deliverables there, list artifact files from that area, combine them with observed PR facts, and let users open each artifact in the appropriate UI surface.

High-Level Overview

The system should work like this:

  1. user starts a session
  2. AO creates the session workspace and a dedicated artifact directory under AO's data directory
  3. AO gives the worker instructions for writing non-PR deliverables into that artifact directory
  4. the worker produces either:
    • a PR
    • a file inside the artifact directory
  5. AO inspects only those durable outputs
  6. AO returns a computed artifact list for the session
  7. AO updates the session output type to pr, artifact, or none
  8. session read APIs return session plus artifact files and existing PR metadata
  9. the UI opens HTML artifacts in Browser and other file artifacts in Files

Mermaid Flow

mermaid
flowchart TD
    A[User starts a session] --> B[AO creates workspace]
    B --> C[AO creates artifact store outside workspace]
    C --> D[Worker writes file artifact there or opens a PR]
    D --> E[AO inspects PR facts and artifact store]
    E --> F[AO computes artifact list]
    F --> G[AO updates session output type]
    G --> H[Session UI shows artifacts]
    H --> J{Artifact kind?}
    J -->|HTML| K[Open in Browser]
    J -->|Markdown/File| L[Open in Files]
    J -->|PR| M[Open PR surface]

Tech Design

Model And Schema Changes

SQLite Changes Required

This design should not add one DB row per file artifact. Store only the session's artifact folder and a small output summary on sessions:

sql
ALTER TABLE sessions ADD COLUMN artifact_dir TEXT NOT NULL DEFAULT '';
ALTER TABLE sessions ADD COLUMN session_output_type TEXT NOT NULL DEFAULT 'none'
    CHECK (session_output_type IN ('none', 'pr', 'artifact'));

session_output_type lets Kanban distinguish no output, PR output, and file-artifact output. File artifacts themselves are computed by listing artifact_dir.

Artifact Directory

artifact_dir should point under AO's durable data directory, not inside the git workspace:

$AO_DATA_DIR/artifacts/<session-id>/

AO lists files from that folder at read time and derives each file's display kind from extension or MIME type. This keeps generated artifacts outside the workspace so they cannot be accidentally committed.

Kanban Behavior

For this phase, we should keep the Kanban change deliberately small and leave review behavior out.

Suggested rules:

  • if the session has no PR and no artifact files, keep it in building
  • if the session has artifact files, move it to validating
  • if the session has PRs, keep using the existing PR-derived Kanban behavior
  • do not introduce artifact review states yet
  • do not add new artifact-specific display statuses yet

This means artifact availability is enough to move the card out of pure building, but not enough to mark it ready. A generated artifact has not been reviewed or accepted; it is simply available for the user to inspect.

Code Changes

Implemented in PR #4805 (backend slice #4804 + frontend follow-up, stacked on it).

Backend changes required:

  • session spawn flow
    • create or reserve the session artifact directory under AO's data directory
    • persist the artifact directory in session metadata
    • include worker instructions that non-PR deliverable outputs should be written there
  • artifact inference flow
    • add daemon-side logic that checks only two sources:
      • session-owned PR facts
      • files inside the AO-managed artifact directory
    • if PRs exist, expose them as PR artifact metadata from existing PR tables
    • inspect the artifact directory for html, markdown, or generic file artifacts on read
    • do not persist one artifact row per file
    • update session_output_type to pr, artifact, or none
  • session read flow
    • list artifact files from the artifact directory
    • return artifact files and output type on session APIs
  • Kanban derivation
    • feed output type or artifact-file presence into the backend Kanban reducer
    • place sessions with artifact output in validating
    • keep sessions with no output in building
  • preview integration
    • if the artifact is html, resolve it into the existing browser preview flow
    • non-HTML artifacts do not go through browser preview by default

Planned follow-on: #5895 adds a dedicated content-read endpoint (and ao CLI command) for artifact files, so an orchestrator or any non-co-located caller can fetch artifact bytes the same way it already fetches PR file content — this design delivers the artifact list first, with content-read landing on top of it.

Frontend changes required (see PR #4805 for the shipped implementation):

  • session types extended with artifactFiles and outputType (frontend/src/renderer/types/workspace.ts)
  • the session Summary panel shows an Artifacts section, one row per file, rendered by ArtifactSummaryCard (SessionInspector.tsx) — a small pill with a file/globe icon and the artifact's name
  • clicking a row:
    • if the artifact kind is html, it opens in the Browser tab via the existing preview flow (useOpenArtifactPreview posts the artifact's resolved preview URL to POST /sessions/{id}/preview, then switches the inspector to the Browser view) — the same panel and ao preview machinery used for regular workspace preview
    • if the artifact kind is markdown or file, it opens in the Files tab instead, in a dedicated read-only ArtifactFileView component (frontend/src/renderer/components/ArtifactFileView.tsx) rendered inside SessionFileExplorer — artifacts live outside the git workspace, so they get their own viewer rather than reusing the workspace-diff file view
    • both paths reuse the existing file-viewer/Browser feedback (commenting) mechanism — the same feedbackRequestKey flow used to leave review feedback on a regular file or preview is passed straight through to ArtifactFileView, so a user can leave feedback on an artifact exactly the way they already do on a workspace file or browser preview, with no new UI built for it
  • PR artifacts continue using the existing PR presentation

Source: Untrivial-ai/agent-orchestrator