OFTR-005: Run Command and Composite profile Lifecycle
Synced from
outfitter/docs/requirements/OFTR-005-run-and-composite-profile.md. The repository is the source of truth.
Transition (RFC #165): OFTR-005.1/005.2/005.3 are amended (2026-07-17) to the run/composition model (run selects an agent + harness and resolves → composes → projects → launches). The remaining sections (005.4 watching, 005.6 state persistence, 005.7 prompt export) describe profile-era features that are not yet reprojected — the current run projects composed identity, skills, model, and thinking into an ephemeral runtime directory. Those features return incrementally with the fuller adapter parity. Target design: docs/architecture/README.md.
Overview
Section titled “Overview”The run command assembles a temporary agent-specific configuration directory called a composite profile, launches the selected agent CLI, and keeps Outfitter alive to manage the composite profile while the child process runs.
Requirements
Section titled “Requirements”OFTR-005.1: Run Command Defaults
Section titled “OFTR-005.1: Run Command Defaults”Amended (2026-07-17, RFC #165): run selects an agent slug and a harness, not a profile.
- Outfitter MUST provide a
runcommand. runMUST be the default command when no command is specified.- The default command behavior MUST be implemented with Commander rather than a custom
process.argvparser. - The
runcommand MUST accept a positional agent slug selecting which agent to run. - The
runcommand MUST use the resolveddefault_agentwhen no agent is provided, and error when neither is available. - The
runcommand MUST accept--harness <pi|claude|codex>, defaulting todefault_harnessthenpi. - The
runcommand MUST pass unrecognized arguments through to the selected harness CLI unaltered. - The
runcommand MUST resolve, compose, project, and launch through the shared resolver and composer. - The
runcommand MUST accept a repeatable--append-prompt <path>, appending each named document to the system prompt after the composition’s own fragments, in the order given. - The
runcommand MUST reject an--append-promptpath that is not a readable file before launching, naming both the flag and the path. - For a harness that exposes a native append-prompt flag,
--append-promptMUST project through that flag so a caller does not have to know which harness will launch. Passthrough after--cannot satisfy this, because it reaches the harness unaltered per OFTR-005.1.7. A harness without a native append flag MUST warn that the prompt cannot be projected, subject to the OFTR-006.1.4--strictpolicy.
OFTR-005.2: Composition Definition
Section titled “OFTR-005.2: Composition Definition”Amended (2026-07-17, RFC #165): a run is defined by a harness-neutral composition, not a profile.
- Outfitter MUST compose a harness-neutral composition plan for a run from the effective resource set and a selected agent.
- A composition plan MUST be scoped to one selected agent slug and is projected per harness by an adapter.
- A composition plan MUST carry the composed identity (effective system prompt, shared
agents.mdcontext, appended prompt fragments, inherited agent bodies, prompt template provenance when selected) and the agent’s resolved loadout. - Composition MUST be deterministic: identical sources, refs, and selections produce an identical composition plan.
- A composition plan MUST expose the selected agent’s inheritance chain and prompt-fragment provenance so dump and verbose surfaces can audit where each prompt part came from.
OFTR-005.3: Composition Assembly
Section titled “OFTR-005.3: Composition Assembly”Amended (2026-07-17, RFC #165): composition assembles from the effective resource set.
- Outfitter MUST compose identity in this deterministic order: nearest declared
system_promptor the winning rootsystem-prompt.md; winning rootagents.md; inherited then childappend_system_promptfragments; inherited then child agent bodies; runtime passthrough append prompts. - Outfitter MUST resolve each inherited loadout slug against the declaring agent’s local namespace before catalog-wide fallback; selected-child local resources MUST NOT accidentally satisfy parent-declared selections.
- Outfitter MUST report an error when the selected agent slug does not resolve or its definition is invalid.
- Outfitter MUST surface a loadout slug that does not resolve as a non-fatal composition warning.
list,validate,run, anddumpMUST share one resolver (a single effective resource set); the commands that create a selected composition (run,dump) MUST use the same shared composer.- Runtime projection MUST materialize a selected agent-local skill with the same instructions, references, scripts, and assets as a catalog-wide skill.
- Dump MUST place selected agent-local skills under top-level
skills/<id>/in its closure output so target harnesses discover them. outfitter validateMUST diagnose inheritance graph errors and prompt-source containment errors without requiring a harness launch.- Existing agents that declare no inheritance or prompt-source controls MUST keep the same effective prompt order and equivalent launch arguments.
OFTR-005.4: Composite profile Watching
Section titled “OFTR-005.4: Composite profile Watching”- Outfitter MUST keep its process alive while the child agent CLI is running.
- Outfitter MUST use
fs.watchor an equivalent Node file watching mechanism on composite profile input files while the child process is running. - Outfitter MUST update generated composite profile files when watched inputs change and the generated output path remains inside the composite profile root.
- Outfitter MUST warn when a live update cannot be applied because regeneration or composite profile-root path validation fails.
OFTR-005.5: Unsupported Controls and Strict Mode
Section titled “OFTR-005.5: Unsupported Controls and Strict Mode”- Outfitter MUST write a warning to stderr when a profile requests a control that the selected agent adapter cannot support.
- The
runcommand MUST accept a--strictoption. - When
--strictis enabled, unsupported controls MUST cause composite profile assembly to fail instead of only warning. - Strict failures MUST identify the unsupported control and selected agent CLI.
OFTR-005.6: Composite profile State Persistence
Section titled “OFTR-005.6: Composite profile State Persistence”- Profiles MAY define
state_persistenceentries that map adapter-declared state paths to persistence strategies. - Outfitter MUST validate
state_persistencevalues at profile read boundaries. - Before launch, Outfitter MUST resolve each adapter-declared state path to either a profile override strategy or the adapter default strategy.
- Outfitter MUST reject profile
state_persistencekeys that are not declared by the selected adapter. - Outfitter MUST reject strategies that are not allowed for the adapter-declared state path.
- For
symlinkstrategy paths, Outfitter MUST materialize the composite profile path as a symlink to the resolved profile or native CLI source path. - For non-persistent strategies, Outfitter MUST materialize normal temporary composite profile paths and detect writes after the child agent exits.
- Unknown writes MUST be governed by the adapter’s
unknownpseudo-path strategy and MUST NOT be persisted by symlink. - Outfitter MUST warn for
warn, non-interactiveprompt, and symlink-replacement state write issues, fail forerrorstate write issues, and ignorediscardstate writes. - State path materialization MUST reject paths that escape the composite profile root.
- During live composite profile updates, Outfitter MUST update generated composite profile files without re-materializing declared state paths so post-launch write detection can still observe agent changes to those paths.
- When a declared
promptstrategy path changed and the session is interactive (stdin and stdout are terminals), Outfitter MUST prompt after the agent exits with persist, discard, and always-persist-for-this-profile choices. - The persist choice MUST copy the composite profile change to the path’s resolved durable source; the always choice MUST additionally record a
symlinkoverride in the selected local profile’sstate_persistence, and Outfitter MUST persist once and warn when the choice cannot be recorded (non-local selected profile orsymlinknot allowed for the path). - When the session is not interactive, changed
promptstrategy paths MUST fall back towarnbehavior with an explicit “prompt skipped: non-interactive” notice. - Undeclared writes governed by an
unknown: promptstrategy MUST be reported as warnings with an explicit notice that undeclared writes cannot be persisted.
OFTR-005.7: Generated Pi Prompt Export
Section titled “OFTR-005.7: Generated Pi Prompt Export”- Generated prompt export MUST be disabled unless effective settings or the selected resolved profile enables it.
- Top-level settings
profile_export: trueMUST enable generated prompt export by default for selected local profiles. - Top-level profile
profile_exportMUST override the settings default when present. - Directory-layout profiles MUST export to
generated-system-prompt.mdunder the selected profile directory. - Flat-layout profiles MUST export to sibling
<profile-id>.generated-system-prompt.mdwithout creating a resource directory. - Generated prompt export filenames MUST NOT include an agent or version suffix while only Pi prompt export is supported.
- Before Pi starts, Outfitter MAY seed a deterministic fallback artifact that includes the selected profile ID, a Pi prompt-source label, the effective Pi
system_prompt, and ordered effective Piappend_system_promptentries. - For interactive Pi launches, Outfitter MUST pass the export path to its Pi launch extension and overwrite the fallback with the fully built Pi runtime system prompt from
ctx.getSystemPrompt()when the session starts. - Outfitter MUST NOT mutate cache-backed or remote selected profile owners for generated prompt export and MUST emit an actionable warning when export is skipped for that reason.
- Generated prompt export MUST NOT change launch args except for Outfitter’s own runtime export extension plumbing, launch environment except for the export-path handoff, composite profile contents, or state persistence behavior.
- During live composite profile updates, Outfitter SHOULD refresh generated prompt fallback artifacts when enabled.