daydream
Daydream CLI docs

Extensions

Load and validate

Extensions execute Python inside Daydream and require application programming interface (API) version 8. Use the source example and contract to create $HOME/daydream_ext/__init__.py. Export DAYDREAM_EXT_API = 8 and register(registry). The example removes low-severity findings before publication and fixing.

Set the package directory and validate registration:

export DAYDREAM_EXT_DIR="$HOME/daydream_ext"
daydream ext validate

The loader uses DAYDREAM_EXT_DIR, then imports daydream_ext, then uses built-ins when no package exists. Invalid extensions stop the run before workspace or agent execution. Validation requires no target repository, model work, or exporter credentials. Test the affected flow separately to check execution and outputs.

Customization boundaries

Built-in flows are deep, improve, and diagram. Review, comment, and shallow modes use deep. Registry operations add, replace, remove, or reorder phases and flow entries. Select custom flows through CLI reference. The deep and diagram flows share the exploration and diagram steps. Replacing either step affects both flows.

Follow these requirements when implementing phases:

  • Call agents through daydream.agent.run_agent with ctx.backend_for(phase_name), ctx.work.repo, and run_context=ctx.run_context.
  • Write through ctx.artifacts and supplied paths under the same session's runs/SESSION_ID/.
  • Join writers before returning.
  • Bind generated model inputs with prepare_sanctioned_inputs. Bindings grant access to exact inputs, not directories.
  • Pass ctx.github_execution.auth to GitHub helpers. Never serialize the authentication capability.
  • Use run-context confirmation methods with explicit unattended defaults.
  • Read optional shared data with .get(). Unlisted keys remain internal.
  • Preserve uid, item_uid, and source_uids when rewriting findings. Display position id can change.

Prompt overrides must preserve the response contract and host validation. The host owns parse, test, and commit prompts. Renderer overrides must preserve body_block and optional diagrams verbatim for deduplication and grounded diagrams. The host owns approval decisions, footer, and separators. Invalid renderers warn and use built-ins.

Extension tool supervision conflicts with configured tool_supervisor = "rules". A veto stops the affected turn when the backend reports the event. Independent concurrent turns continue.

Trace registration must not construct exporters, require credentials, or contact providers. Exporter factories must return fresh exporters with finite timeouts and bounded shutdown. The host owns exporter lifecycle, content policy, and redaction. Configuration owns model precedence and trace selection.

Use the flow contract for signatures, stable step names, and shared fields. After a Daydream API change, adapt the extension before changing DAYDREAM_EXT_API and validating again.

Back to Daydream