Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Subprocess coding agents (Claude Code, Codex, Cursor) reach core's in-process MC

`.gaviero-workspace` files (any basename, fixed extension) describe multi-folder workspaces; bare directories are treated as single-folder workspaces — a bare directory holding a workspace file first asks whether to open that workspace instead (`--folder` skips the question). Dispatched at TUI startup in [crates/gaviero-tui/src/main.rs](crates/gaviero-tui/src/main.rs). `gaviero --workspace <dir>` opens the workspace file already in `<dir>`, or has the first-run wizard ([crates/gaviero-tui/src/setup.rs](crates/gaviero-tui/src/setup.rs)) build `<dirname>.gaviero-workspace` from the sub-folders the user picks. That setup screen is the only place initial configuration is authored — it runs before `App` exists, at every launch while the target has no `.gaviero/settings.json` (a folder's own, or the one beside an opened `.gaviero-workspace` file — the workspace layer), and offers: editor-only (preselected, also Esc — writes nothing; `App::enter_editor_only` hides the side panel and skips agents, memory, code graph, MCP, remote and the root `.cursor`/`.cursorignore` writes), minimal (`{}`), or full — a byte-for-byte copy of the global `$GAVIERO_ROOT/.gaviero/settings.json`, or gaviero's built-in full settings when that file does not exist. Workspaces get the same three choices for that one workspace-layer file, which every member inherits; `--workspace` on a directory without a workspace file first picks the members and writes it (editor-only then writes just the workspace file). A `gaviero-cli` run never creates `.gaviero/settings.json`: it finds the workspace the TUI would open by walking up from its run root ([crates/gaviero-cli/src/state.rs](crates/gaviero-cli/src/state.rs)) and shares its memory, or runs on throwaway state with `--isolated` (also the fallback when no workspace is found).

Scripts choose models in one way only: by tier. Every agent declares its default tier (`agent { tier high }`); a workflow's `tiers { <agent> <tier> }` block moves agents in that workflow, `gaviero-cli --tier <agent>=<tier>` moves one for a run (beating the block), and a list item's `tier` moves its clone. Scripts never declare `client` blocks, `tier <alias> <client>` lines or model-valued params. **Model profiles** are the one place a tier becomes a model: `.gaviero/dsl/profiles/<name>.gaviero` holds only `client` + `tier` declarations (discovered like scripts — [crates/gaviero-core/src/script_profiles.rs](crates/gaviero-core/src/script_profiles.rs); merged in [crates/gaviero-dsl/src/profile.rs](crates/gaviero-dsl/src/profile.rs)). Chosen with `gaviero-cli --profile <name|path>` or the SWARM form; with no choice the profile named `default` is used. Shipped example: [crates/gaviero-dsl/examples/profiles/default.gaviero](crates/gaviero-dsl/examples/profiles/default.gaviero).
Scripts choose models in one way only: by tier. Every agent declares its default tier (`agent { tier high }`); a workflow's `tiers { <agent> <tier> }` block moves agents in that workflow, `gaviero-cli --tier <agent>=<tier>` moves one for a run (beating the block), and a list item's `tier` moves its clone; `gaviero-cli --tier-client <tier>=<client>` / `--tier-effort <tier>=<effort>` (or the SWARM form's Tiers rows) point a tier at another client **of the selected profile** and/or another effort for one run. Scripts never declare `client` blocks, `tier <alias> <client>` lines or model-valued params. **Model profiles** are the one place a tier becomes a model: `.gaviero/dsl/profiles/<name>.gaviero` holds only `client` + `tier` declarations (discovered like scripts — [crates/gaviero-core/src/script_profiles.rs](crates/gaviero-core/src/script_profiles.rs); merged in [crates/gaviero-dsl/src/profile.rs](crates/gaviero-dsl/src/profile.rs)). Chosen with `gaviero-cli --profile <name|path>` or the SWARM form; with no choice the profile named `default` is used. Shipped example: [crates/gaviero-dsl/examples/profiles/default.gaviero](crates/gaviero-dsl/examples/profiles/default.gaviero).

### Agent Runtime Parity

Expand Down
4 changes: 2 additions & 2 deletions crates/gaviero-cli/CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Full user-facing flag tables: [README.md](README.md). Do not duplicate every fie
- **stdout = results, stderr = telemetry.** Observers always log to stderr.
- **Model spec:** `provider:model` required. Accepted prefixes include `claude:`, `codex:`, `cursor:`, `ollama:`, `local:`, `deepseek:`, `dsh:` ([`validate_model_spec`](../gaviero-core/src/swarm/backend/shared.rs)). Default: workspace `agent.model`, then `claude:sonnet`.
- **`--repo` vs `--workspace`:** `execution repo` vs `execution document` ([`workflow_execution_mode`](../gaviero-dsl/src/lib.rs)). Conflicts with each other; `--workspace` defaults to the plan file's directory when `--var PLAN_FILE=...` is set.
- **DSL precedence.** Models: `--profile` (else the profile named `default`) says what each tier means; an agent's tier is `--tier AGENT=TIER` > the workflow's `tiers { }` > its own `tier`. Vars: agent-level > `--var` > script-level. Params: `--param` (see [`workflow_params`](../gaviero-dsl/src/workflow_params.rs)).
- **DSL precedence.** Models: `--profile` (else the profile named `default`) says what each tier means; an agent's tier is `--tier AGENT=TIER` > the workflow's `tiers { }` > its own `tier`; `--tier-client TIER=CLIENT` points a tier at another client of the same profile and `--tier-effort TIER=EFFORT` changes its effort, for one run (merged per tier by `gaviero_dsl::TierOverride::from_pairs`). Vars: agent-level > `--var` > script-level. Params: `--param` (see [`workflow_params`](../gaviero-dsl/src/workflow_params.rs)).
- **State follows the TUI.** [`state::discover`](src/state.rs) walks the run root and its parents for `.gaviero/settings.json` or `.gaviero/memory.db` (never `$HOME`) and honours a `*.gaviero-workspace` listing that folder. Runs share that workspace's memory (`MemoryStores::open` at its state root, configured embedder, repo scope = the member folder containing the run root). `--isolated`, or no workspace found, means throwaway memory/graph/telemetry in a temp dir; settings are still read, skills are off, and synthesized agent configs are restored at exit. Admin commands require a discovered workspace; `--history` / `--mcp-stats` fall back to the run root.
- **Never build a code graph for one root into another root's DB.** A build deletes every file it did not scan. A run from a workspace folder uses the graph the TUI keeps for that folder; subfolder runs use `<state_root>/.gaviero/graphs/<hash>/` (`RunState::graph_db`).
- **Memory ops open the same `MemoryServices`** as the TUI; never bypass the writer task.
Expand All @@ -49,7 +49,7 @@ Full user-facing flag tables: [README.md](README.md). Do not duplicate every fie

- **Never add a flag without adding the field on `Cli` first.** Docs trail the struct.
- **Never write directly to a file.** Synthetic-task mode still goes through the Write Gate (`AutoAccept` when `--auto-accept`).
- **Models come from tiers only.** There is no `--tiers-file` and no model-valued `--param`; do not add one. `--param` values are list items (`id=tier`).
- **Models come from tiers only.** There is no `--tiers-file` and no model-valued `--param`; do not add one. `--tier-client` names a client the profile declares, never a model string. `--param` values are list items (`id=tier`).
- **Always validate the model spec via core** — do not re-parse prefixes in CLI code.
- **Never document `--no-memory`.** It does not exist on `Cli`.

Expand Down
2 changes: 2 additions & 0 deletions crates/gaviero-cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ No public library API. The `Cli` struct in `src/main.rs` is authoritative; this
| `--param` | `NAME=VALUE` | Supply a workflow list `param`: `id=tier,…`, ids, or a list literal (repeatable, requires `--script`) |
| `--profile` | `<name|path>` | Model profile from `.gaviero/dsl/profiles/` or a file path (`client` + `tier` only; requires `--script`); default: the profile named `default` |
| `--tier` | `AGENT=TIER` | Run one agent on another tier; beats the workflow's `tiers { }` entry (repeatable; requires `--script`) |
| `--tier-client` | `TIER=CLIENT` | For this run, point a tier at another client of the selected profile; a tier the profile lacks is added (repeatable; requires `--script`) |
| `--tier-effort` | `TIER=EFFORT` | For this run, run a tier at another effort (on its client, or the `--tier-client` one); other tiers sharing that client keep theirs (repeatable; requires `--script`) |
| `--coordinated` | — | Emit a reviewable plan and exit (requires `--task`) |
| `--output` | `<path>` | Save the generated plan (`--coordinated` only) |

Expand Down
55 changes: 49 additions & 6 deletions crates/gaviero-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,23 @@ struct Cli {
#[arg(long = "profile", value_name = "NAME|PATH", requires = "script")]
profile: Option<String>,

/// Point one tier of the model profile at another of the profile's
/// clients for this run. Format: `TIER=CLIENT` (e.g. `--tier-client
/// high=sol` runs every `high` agent on the profile's `sol` client). A
/// tier the profile lacks is added. The profile file is not changed and
/// stays the only place a model is declared. Can be specified multiple
/// times. Only valid with `--script`.
#[arg(long = "tier-client", value_name = "TIER=CLIENT", requires = "script")]
tier_clients: Vec<String>,

/// Run one tier of the model profile at another effort for this run.
/// Format: `TIER=EFFORT` (e.g. `--tier-effort high=xhigh`). Applies to
/// the tier's client, or the one `--tier-client` gives it; other tiers on
/// the same client keep theirs. The model must offer that effort.
/// Can be specified multiple times. Only valid with `--script`.
#[arg(long = "tier-effort", value_name = "TIER=EFFORT", requires = "script")]
tier_efforts: Vec<String>,

/// Print the N most recent retrieval manifests (Tier S / S4) and exit.
/// Useful for auditing what memory was injected into recent chat turns.
#[arg(long = "manifest-last")]
Expand Down Expand Up @@ -1393,14 +1410,30 @@ fn parse_param_overrides(raw: &[String]) -> Result<Vec<(String, String)>> {

/// `--tier AGENT=TIER` pairs.
fn parse_agent_tiers(raw: &[String]) -> Result<Vec<(String, String)>> {
parse_pairs(raw, "--tier", "AGENT=TIER")
}

/// `--tier-client TIER=CLIENT` and `--tier-effort TIER=EFFORT`, one override
/// per tier.
fn parse_tier_overrides(
clients: &[String],
efforts: &[String],
) -> Result<Vec<gaviero_dsl::TierOverride>> {
Ok(gaviero_dsl::TierOverride::from_pairs(
&parse_pairs(clients, "--tier-client", "TIER=CLIENT")?,
&parse_pairs(efforts, "--tier-effort", "TIER=EFFORT")?,
))
}

fn parse_pairs(raw: &[String], flag: &str, shape: &str) -> Result<Vec<(String, String)>> {
raw.iter()
.map(|s| {
let (agent, tier) = s
let (key, value) = s
.split_once('=')
.map(|(a, t)| (a.trim(), t.trim()))
.filter(|(a, t)| !a.is_empty() && !t.is_empty())
.ok_or_else(|| anyhow::anyhow!("--tier `{s}`: expected AGENT=TIER"))?;
Ok((agent.to_string(), tier.to_string()))
.map(|(k, v)| (k.trim(), v.trim()))
.filter(|(k, v)| !k.is_empty() && !v.is_empty())
.ok_or_else(|| anyhow::anyhow!("{flag} `{s}`: expected {shape}"))?;
Ok((key.to_string(), value.to_string()))
})
.collect()
}
Expand Down Expand Up @@ -4475,6 +4508,7 @@ async fn main() -> Result<()> {
);
let override_params = parse_param_overrides(&cli.params)?;
let agent_tiers = parse_agent_tiers(&cli.agent_tiers)?;
let tier_overrides = parse_tier_overrides(&cli.tier_clients, &cli.tier_efforts)?;
let profile = ProfileCatalog::scan(&workspace, &ScriptCatalog::global_scripts_dir())
.select(
cli.profile.as_deref(),
Expand All @@ -4487,9 +4521,18 @@ async fn main() -> Result<()> {
}
// Resolves any `include "..."` directives transitively, so multi-file
// scripts (shared clients/prompts/etc.) work here.
gaviero_dsl::compile_file_with_profile(
for o in &tier_overrides {
eprintln!(
"[tier] {} -> client {}, effort {}",
o.tier,
o.client.as_deref().unwrap_or("(profile's)"),
o.effort.as_deref().unwrap_or("(client's)")
);
}
gaviero_dsl::compile_file_with_models(
script_path,
profile.as_ref(),
&tier_overrides,
cli.workflow.as_deref(),
runtime_prompt.as_deref(),
&override_vars,
Expand Down
4 changes: 3 additions & 1 deletion crates/gaviero-dsl/CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ Examples: **12** workflows + **4** model profiles (`default`, `claude`, `codex`,

- `compile` / `compile_with_vars` (inline, take a profile) / `compile_file` — `override_vars`, `agent_tiers` (`--tier`), `override_params`.
- `compile_file_with_profile` — `compile_file` plus a [`SelectedProfile`](../gaviero-core/src/script_profiles.rs). Without a profile no tier is bound, so any script with agents fails to compile.
- `compile_file_with_models` — plus `&[TierOverride]` (`--tier-client TIER=CLIENT`, `--tier-effort TIER=EFFORT`): per-run rebinding of a tier to another client **of the same profile** and/or another effort (`profile::rebind_tiers`; an effort clones the client as `<client>__<tier>` so tiers sharing it are untouched; unknown client or effort = error; a missing tier is added only with a client).
- `inspect_profile` — a profile's clients (model, effort) and tier bindings; `ScriptInspection::agent_tiers(workflow)` — the agents a workflow runs and their default tier. Both back the SWARM form's Agents / Tiers rows.
- `workflow_execution_mode` / `peek_workflow_execution_mode` — `repo` vs `document` anchoring before full compile.
- `inspect_file` ([`inspect.rs`](src/inspect.rs)) — a script's inputs (workflows, params, vars, prompt use) without compiling; backs the TUI SWARM form.

**Precedence:** agent-level `vars {}` > CLI `--var` > script-level `vars {}`. Item vars (`for` / roster) are substituted before agent, CLI and script vars. Models — one way only: the profile (chosen, else the one named `default`) maps tiers to clients; an agent's tier is `--tier` > the workflow's `tiers { }` > its own required `tier`, and a list item's `tier` moves its clone. Scripts declare no clients or tier lines.
**Precedence:** agent-level `vars {}` > CLI `--var` > script-level `vars {}`. Item vars (`for` / roster) are substituted before agent, CLI and script vars. Models — one way only: the profile (chosen, else the one named `default`) maps tiers to clients; an agent's tier is `--tier` > the workflow's `tiers { }` > its own required `tier`, and a list item's `tier` moves its clone; `--tier-client` / `--tier-effort` may point a tier at another of the profile's own clients and change its effort for one run. Scripts declare no clients or tier lines.

Exact field shapes: [`ast.rs`](src/ast.rs). Language reference: [README.md](README.md).

Expand Down
3 changes: 3 additions & 0 deletions crates/gaviero-dsl/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ The DSL has no runtime config — behaviour is declared in the script and adjust
| Vars | `--var KEY=VALUE` | agent `vars {}` > CLI > script `vars {}` |
| What each tier means | `--profile NAME\|PATH` | chosen profile, else the profile named `default` |
| An agent's tier | `--tier AGENT=TIER` | CLI > workflow `tiers { }` > the agent's own `tier`; a list item's `tier` moves its clone |
| A tier's model, this run | `--tier-client TIER=CLIENT` | Points a tier at another client **of the same profile** (adds the tier if the profile lacks it); the profile file is unchanged |
| A tier's effort, this run | `--tier-effort TIER=EFFORT` | Runs that tier's client at another effort; other tiers on the same client are untouched |
| Workflow list params | `--param NAME=VALUE` | Required params without defaults must be supplied |

Provider resolution, memory namespaces, and verification execution are configured via `.gaviero/settings.json` on the `gaviero-core` side. See [gaviero-cli](../gaviero-cli/README.md#configuration).
Expand Down Expand Up @@ -144,6 +146,7 @@ A script chooses models in one way only: by tier. Tier names are free-form; `low
- **Every agent declares its default tier** with `tier <name>`. An agent without one is a compile error.
- **A workflow may move agents** to other tiers in its `tiers { <agent> <tier> … }` block; agents it does not name keep their own.
- **A run may move agents** with `--tier AGENT=TIER`, which overrides the block.
- **A run may rebind a tier** with `--tier-client TIER=CLIENT` to another client the profile declares, and change its effort with `--tier-effort TIER=EFFORT` (the SWARM form's Tiers rows do both). Models are still declared only in the profile.
- **A list item's `tier`** (`{ id "a" tier top }`, `--param panel=a=top`) moves that item's clones; items without one keep their body agent's tier.

```gaviero
Expand Down
Loading
Loading