feat: add per-workflow model assignment configuration
This commit is contained in:
@@ -26,6 +26,30 @@ memory:
|
||||
max_lessons: 10
|
||||
decay_after_runs: 10
|
||||
|
||||
# Models — default and per-archetype/per-workflow model selection.
|
||||
# ArcheFlow reads this to assign models to agents. The default applies unless overridden.
|
||||
models:
|
||||
default: sonnet
|
||||
# Per-archetype overrides (uncomment to customize):
|
||||
# archetypes:
|
||||
# explorer: haiku # Cheap model for research/exploration
|
||||
# creator: sonnet # Creative tasks need stronger model
|
||||
# maker: sonnet # Implementation needs full capability
|
||||
# guardian: sonnet # Security review — don't skimp
|
||||
# skeptic: haiku # Assumption checking is analytical
|
||||
# sage: haiku # Quality review can use cheaper model
|
||||
# trickster: sonnet # Adversarial testing benefits from stronger model
|
||||
# Per-workflow overrides (uncomment to customize):
|
||||
# workflows:
|
||||
# fast:
|
||||
# default: haiku # Fast workflow uses cheaper models by default
|
||||
# archetypes:
|
||||
# guardian: sonnet # Except Guardian — always needs strong model
|
||||
# standard:
|
||||
# default: sonnet
|
||||
# thorough:
|
||||
# default: sonnet
|
||||
|
||||
# Progress
|
||||
progress:
|
||||
enabled: true
|
||||
|
||||
@@ -89,6 +89,12 @@ Events are optional — if the events dir doesn't exist, skip logging. Never let
|
||||
|
||||
---
|
||||
|
||||
## Model Configuration
|
||||
|
||||
Model assignment per archetype and workflow is configured in `.archeflow/config.yaml` under the `models:` section. The `archeflow:run` skill (section 0c) handles resolution with fallback chain: per-workflow per-archetype > per-workflow default > per-archetype > global default. When spawning agents manually, read the config to select the appropriate model.
|
||||
|
||||
---
|
||||
|
||||
## Step 1: Plan Phase
|
||||
|
||||
Spawn agents sequentially — Creator needs Explorer's findings.
|
||||
|
||||
@@ -121,6 +121,49 @@ ${MEMORY_LESSONS}"
|
||||
fi
|
||||
```
|
||||
|
||||
#### 0c. Model Configuration
|
||||
|
||||
Read model assignment from `.archeflow/config.yaml` and resolve the model for each archetype based on the current workflow. Per-workflow overrides take precedence over per-archetype overrides, which take precedence over the default.
|
||||
|
||||
```bash
|
||||
CONFIG=".archeflow/config.yaml"
|
||||
|
||||
# Read default model
|
||||
DEFAULT_MODEL=$(grep -A1 '^models:' "$CONFIG" 2>/dev/null | grep 'default:' | sed 's/.*default:\s*//' | tr -d '"' | head -1)
|
||||
DEFAULT_MODEL="${DEFAULT_MODEL:-sonnet}"
|
||||
|
||||
# Resolve model for a given archetype and workflow
|
||||
# Usage: resolve_model <archetype> <workflow>
|
||||
resolve_model() {
|
||||
local arch="$1" wf="$2" model=""
|
||||
|
||||
# Check per-workflow per-archetype override
|
||||
model=$(sed -n "/workflows:/,\$p" "$CONFIG" 2>/dev/null \
|
||||
| sed -n "/${wf}:/,/^ [a-z]/p" \
|
||||
| grep -A1 "archetypes:" | grep "${arch}:" \
|
||||
| sed "s/.*${arch}:\s*//" | tr -d '"' | head -1)
|
||||
[[ -n "$model" ]] && echo "$model" && return
|
||||
|
||||
# Check per-workflow default
|
||||
model=$(sed -n "/workflows:/,\$p" "$CONFIG" 2>/dev/null \
|
||||
| sed -n "/${wf}:/,/^ [a-z]/p" \
|
||||
| grep 'default:' | sed 's/.*default:\s*//' | tr -d '"' | head -1)
|
||||
[[ -n "$model" ]] && echo "$model" && return
|
||||
|
||||
# Check per-archetype override
|
||||
model=$(sed -n "/^ archetypes:/,/^ [a-z]/p" "$CONFIG" 2>/dev/null \
|
||||
| grep "${arch}:" | sed "s/.*${arch}:\s*//" | tr -d '"' | head -1)
|
||||
[[ -n "$model" ]] && echo "$model" && return
|
||||
|
||||
# Fall back to default
|
||||
echo "$DEFAULT_MODEL"
|
||||
}
|
||||
|
||||
# Example: EXPLORER_MODEL=$(resolve_model explorer "$WORKFLOW")
|
||||
```
|
||||
|
||||
Use `resolve_model` when spawning each agent to pass the correct model. The resolved model can be included in the `agent.start` event data for cost tracking.
|
||||
|
||||
---
|
||||
|
||||
### 1. Plan Phase
|
||||
|
||||
Reference in New Issue
Block a user