Problem
The output: section in flux.yaml is static — every directory mapping is always processed during ailloy cast, regardless of flux variable values. There is no way to conditionally include/exclude output directories based on configuration.
This makes multi-agent molds cumbersome. A mold targeting Claude, Copilot, and Cursor needs separate output directories for each agent:
output:
commands: .claude/commands # Claude slash commands
cursor_rules: .cursor/rules # Cursor .mdc rules
copilot_prompts: .github/copilot # Copilot instructions
When a user casts with --set agent.targets="[claude]", the cursor_rules and copilot_prompts directories are still processed and written (producing empty files if the template content is conditional, or the full files if it isn't).
Proposed Solution
Add an agents field (or more general when field) to the expanded output mapping syntax:
Option A: agents field (simpler, purpose-built)
output:
commands:
dest:
claude: .claude/command
agents: [claude]
rules:
agents: [cursor, claude]
dest:
cursor: .cursor/rules
claude: .claude/rules
prompts:
dest:
copilot: .github/copilot
agents: [copilot]
agents: . # No agents field = always included
The agents field is a list of agent names. The directory is only processed if at least one value in agents appears in agent.targets (from flux context). Directories without an agents field are always processed (backward compatible). destinations are tightly coupled to the agents array, destinations is an kvp object of mappings for each agent. So if rules has cursor and claude agents in it's list, then destinations dest must have keys for cursor and claude where the values are the file path destinations.
Use Case
This is needed for the nimble-mold multi-agent output architecture (nimble-giant/nimble-mold#3). The mold needs to produce output for Claude, Copilot, and/or Cursor depending on configuration, with each agent's files going to their expected directories — without producing artifacts for non-targeted agents.
Acceptance Criteria
- Output directories can be conditionally included based on flux variables
- Directories without the conditional field are always processed (backward compatible)
- The
ailloy forge dry-run reflects which directories would be included
- Works with
--set overrides (e.g., --set agent.targets="[claude,cursor]")
depends on
#102
Problem
The
output:section influx.yamlis static — every directory mapping is always processed duringailloy cast, regardless of flux variable values. There is no way to conditionally include/exclude output directories based on configuration.This makes multi-agent molds cumbersome. A mold targeting Claude, Copilot, and Cursor needs separate output directories for each agent:
When a user casts with
--set agent.targets="[claude]", thecursor_rulesandcopilot_promptsdirectories are still processed and written (producing empty files if the template content is conditional, or the full files if it isn't).Proposed Solution
Add an
agentsfield (or more generalwhenfield) to the expanded output mapping syntax:Option A:
agentsfield (simpler, purpose-built)The
agentsfield is a list of agent names. The directory is only processed if at least one value inagentsappears inagent.targets(from flux context). Directories without anagentsfield are always processed (backward compatible). destinations are tightly coupled to the agents array, destinations is an kvp object of mappings for each agent. So ifruleshas cursor and claude agents in it's list, then destinationsdestmust have keys forcursorandclaudewhere the values are the file path destinations.Use Case
This is needed for the nimble-mold multi-agent output architecture (nimble-giant/nimble-mold#3). The mold needs to produce output for Claude, Copilot, and/or Cursor depending on configuration, with each agent's files going to their expected directories — without producing artifacts for non-targeted agents.
Acceptance Criteria
ailloy forgedry-run reflects which directories would be included--setoverrides (e.g.,--set agent.targets="[claude,cursor]")depends on
#102