Skip to content

Implement missing ambient.json fields: startupPrompt and results #570

@jwm4

Description

@jwm4

Summary

The ambient.json workflow configuration schema includes fields that are documented but not implemented in the platform:

  • startupPrompt - Workflow greeting message (documented as required)
  • results - Artifact location patterns (documented as optional)

Reference: AMBIENT_JSON_SCHEMA.md

Current State

What the platform actually implements:

Field Documented Platform Implementation
name Required ✅ Read (logging/metadata only)
description Required ✅ Read (backend metadata)
systemPrompt Required Used (injected into Claude's context)
startupPrompt Required ❌ Not implemented
results Optional ❌ Not implemented

The workaround

Workflow authors work around this by including instructions in systemPrompt that tell the agent to read .ambient/ambient.json using the Read tool. This makes the fields "accessible" but:

  • Wastes tokens (platform already loaded the file)
  • Fragile (depends on agent following instructions)
  • No UI integration (frontend can't use results for artifact discovery)
  • Indirect (platform has the data but doesn't use it)

Proposed Implementation

1. startupPrompt support

In components/runners/claude-code-runner/adapter.py:

ambient_config = self._load_ambient_config(cwd_path)

# Send workflow greeting as first message (if not a continuation)
if ambient_config.get('startupPrompt') and not is_continuation:
    # Send as initial assistant message or first prompt
    pass

2. results support

Options:

  • Frontend artifact discovery: Expose patterns to UI for showing generated files
  • Session completion summary: Use patterns to list outputs in status
  • Inject into system prompt: So agent knows where to write without re-reading config

3. Update Go backend struct

In components/backend/handlers/content.go:

type AmbientConfig struct {
    Name         string            `json:"name"`
    Description  string            `json:"description"`
    SystemPrompt string            `json:"systemPrompt"`
    ArtifactsDir string            `json:"artifactsDir"`
    StartupPrompt string           `json:"startupPrompt"`  // NEW
    Results      map[string]string `json:"results"`        // NEW
}

Relevant Code Locations

  • Python loader: components/runners/claude-code-runner/adapter.py:1691 (_load_ambient_config)
  • Go struct: components/backend/handlers/content.go:716 (AmbientConfig)
  • Design doc: docs/design/session-initialization-flow.md (mentions startupPrompt in pseudocode)

Acceptance Criteria

  • startupPrompt sent as greeting when workflow activates (not on continuation)
  • results patterns available to frontend for artifact discovery
  • Update docs/reference/index.md to document actual implementation
  • Add schema validation or at least warning for missing required fields

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions