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
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,8 @@ aicoding-sync --blueprint /path/to/aiCodingBaseSetup --dry-run # test a local c
including the unattended `--boot` pass, applies managed config the same way
and never prompts (`--yes` is accepted for old callers). The rules are listed
under [Managed config](#managed-config) below. For Codex, `model`,
`model_reasoning_effort`, `[projects.*]` and `[tui]` stay personal; the
`model_reasoning_effort`, `[projects.*]` and `[tui]` stay personal (a `model`
still equal to an earlier blueprint default follows the new one); the
blueprint enforces `notify`, the approval and sandbox posture, its
`[mcp_servers.*]` entries and its `[features]` keys.

Expand Down Expand Up @@ -478,7 +479,14 @@ resolve.
keys in [`configs/managed-config.json`](configs/managed-config.json). Owned
keys take the blueprint value on every pass; `.*` owns each blueprint entry
under a key and `[]` adds missing array items, so personal entries stay.
Seeded keys are written only when missing. Everything else is personal. A
Seeded keys are written only when missing. A seeded key listed in
`reseeded_keys` also moves to the current seed while it still holds a
value the blueprint shipped before (for example the Codex and OpenCode
default `model`). Sync compares values only, so an old default you set on
purpose moves too; any value outside the shipped list stays. An entry with
`requires` waits until that tool reports at least `min_version`, so a new
default never replaces a working one the installed tool cannot run.
Everything else is personal. A
blueprint MCP entry whose secret is missing is removed. A file that is not
valid JSON or TOML is reported and never overwritten. `~/.bashrc` gets one
marker block that sources `~/.bashrc.d/*.sh`; the rest of the file is yours.
Expand Down
4 changes: 4 additions & 0 deletions configs/managed-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
{"dest": ".claude/skills/logfire/SKILL.md", "source": "skills/logfire/SKILL.md"},
{"dest": ".aicodingsetup/templates/paseo-config.json", "source": "configs/paseo/config.json"}
],
"reseeded_keys": [
{"dest": ".codex/config.toml", "path": ["model"], "shipped": ["gpt-5.5", "gpt-5.6-sol", "gpt-6.1-sol"], "requires": {"tool": "codex", "min_version": "0.171.0"}},
{"dest": ".config/opencode/opencode.json", "path": ["model"], "shipped": ["openai/gpt-6.1-sol"], "requires": {"tool": "opencode", "min_version": "2.3.1"}}
],
"retired_keys": [
{"dest": ".claude/settings.json", "path": ["enabledPlugins", "skill-creator@claude-plugins-official"], "shipped": [true]},
{"dest": ".claude/settings.json", "path": ["enabledPlugins", "code-review@claude-plugins-official"], "shipped": [true]},
Expand Down
9 changes: 6 additions & 3 deletions docs/agent-release-audits.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,12 @@ end to end: its separate stored login was expired. models.dev gives 6.2-sol
the same 1,050,000 / 922,000 / 128,000 limits as 6.1-sol, so the `limit`
block carries over.

Both `model` keys are seed-only (`configs/managed-config.json`), so only new
installs get the new default; machines that already have a `model` keep it
until it is changed by hand.
Both `model` keys are seeded (`configs/managed-config.json`). They are also
listed in `reseeded_keys`, so a machine whose `model` still equals an earlier
blueprint default (`gpt-6.1-sol` and older) moves to `gpt-6.2-sol` on its
next sync, even if that old value was set by hand; any other model stays.
The OpenCode reseed requires `opencode` 2.3.1+ and the Codex one
`codex` 0.171.0+, so a v1 or older v2 OpenCode keeps its working model.

### OpenCode default model `openai/gpt-6.1-sol` (2026-09-29, opencode 1.18.33)

Expand Down
42 changes: 39 additions & 3 deletions lib/blueprint-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -439,19 +439,55 @@ def member($xs; $x): $xs | any(.[]; . == $x);
if at($r.p + [$k]) == null then setpath($r.p + [$k]; $in[$k]) else . end)
elif at($r.p) == null then setpath($r.p; $in)
else . end)
| reduce $rules.reseeded[] as $x (.;
($b | at($x.path)) as $in
| if $in != null and member($x.shipped; at($x.path)) then setpath($x.path; $in) else . end)
| reduce $rules.retired[] as $x (.;
if member($x.shipped; at($x.path)) then delpaths([$x.path]) else . end)
'

# Owned keys take the blueprint value, seeded keys are set only when missing,
# and everything else in the file stays personal. Returns 3 for a malformed
# Owned keys take the blueprint value, seeded keys are set only when missing
# (or moved to the current seed while they still hold an earlier shipped
# one), and everything else in the file stays personal. Returns 3 for a malformed
# destination, which is never overwritten.
# A reseed with "requires" waits until that tool reports at least min_version,
# so a new default never replaces a working one the installed tool cannot run.
_managed_reseed_ready() {
local v
command -v "$1" >/dev/null 2>&1 || return 1
v=$(timeout "${AICODING_PROBE_TIMEOUT:-15}" "$1" --version </dev/null 2>/dev/null \
| grep -Eo '[0-9]+\.[0-9]+\.[0-9]+' | head -1)
[[ -n "$v" ]] && [[ "$(printf '%s\n%s\n' "$2" "$v" | sort -V | head -1)" == "$2" ]]
}

# Only entries whose old value appears in the destination are probed, so a
# pass with nothing to reseed (and every dry run on a fresh home) starts no tool.
_managed_reseed_filter() {
local rules=$1 dest=$2 entry tool min value hit keep='[]'
while IFS= read -r entry; do
[[ -n "$entry" ]] || continue
hit=0
while IFS= read -r value; do
[[ -n "$value" ]] && grep -qF -- "\"$value\"" "$dest" 2>/dev/null && { hit=1; break; }
done < <(jq -r '.shipped[] | strings' <<<"$entry")
[[ "$hit" == 1 ]] || continue
tool=$(jq -r '.requires.tool // empty' <<<"$entry")
min=$(jq -r '.requires.min_version // empty' <<<"$entry")
if [[ -z "$tool" ]] || _managed_reseed_ready "$tool" "$min"; then
keep=$(jq -c --argjson e "$entry" '. + [$e]' <<<"$keep")
fi
done < <(jq -c '.reseeded[]?' <<<"$rules")
jq -c --argjson k "$keep" '.reseeded = $k' <<<"$rules"
}

_managed_mixed() {
local dest=$1 src=$2 out=$3 rel rules rendered rc=0
rel=${dest#"$HOME"/}
rules=$(jq -c --arg r "$rel" \
'.mixed[$r] + {retired: [.retired_keys[] | select(.dest == $r)]}' \
'.mixed[$r] + {retired: [.retired_keys[] | select(.dest == $r)],
reseeded: [(.reseeded_keys // [])[] | select(.dest == $r)]}' \
"$(_managed_config_data)") || return 1
rules=$(_managed_reseed_filter "$rules" "$dest") || return 1
rendered=$(mktemp) || return 1
_substitute_file_to "$src" "$rendered" || { rm -f "$rendered"; return 1; }
if [[ ! -s "$dest" ]]; then
Expand Down
5 changes: 5 additions & 0 deletions lib/managed_toml.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ def apply(doc, rendered, raw, rules, retired):
for key_path in keys:
if get(doc, key_path) is MISSING:
put(doc, key_path, get(rendered, key_path))
for entry in rules.get("reseeded", []):
incoming = get(rendered, entry["path"])
current = get(doc, entry["path"])
if incoming is not MISSING and current is not MISSING and plain(current) in entry["shipped"]:
put(doc, entry["path"], incoming)
for entry in retired:
current = get(doc, entry["path"])
if current is not MISSING and plain(current) in entry["shipped"]:
Expand Down
62 changes: 62 additions & 0 deletions tests/bats/blueprint-deploy.bats
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,68 @@ TOML
jq -e '.mcp.kanban.command == ["my-kanban"]' "$HOME/.config/opencode/opencode.json"
}

_reseed_tool_stubs() {
mkdir -p "$TMPDIR/bin"
printf '#!/bin/sh\necho "codex-cli %s"\n' "$1" > "$TMPDIR/bin/codex"
printf '#!/bin/sh\necho "opencode v%s"\n' "$2" > "$TMPDIR/bin/opencode"
chmod +x "$TMPDIR/bin/codex" "$TMPDIR/bin/opencode"
export PATH="$TMPDIR/bin:$PATH"
}

@test "rule 2: a seed still at an earlier shipped value moves to the current seed" {
unset KANBAN_TOKEN
_reseed_tool_stubs 0.171.0 2.3.2
source "$BLUEPRINT_ROOT/lib/blueprint-deploy.sh"
local codex_now opencode_now
codex_now=$(sed -n 's/^model = "\(.*\)"$/\1/p' "$BLUEPRINT_ROOT/configs/codex/config.toml")
opencode_now=$(jq -r .model "$BLUEPRINT_ROOT/configs/opencode/opencode.json")
mkdir -p "$HOME/.codex" "$HOME/.config/opencode"
printf 'model = "gpt-6.1-sol"\nmodel_reasoning_effort = "high"\n' > "$HOME/.codex/config.toml"
echo '{"model":"openai/gpt-6.1-sol","personal":1}' > "$HOME/.config/opencode/opencode.json"
managed_config_apply >/dev/null
grep -qx "model = \"$codex_now\"" "$HOME/.codex/config.toml"
grep -qx 'model_reasoning_effort = "high"' "$HOME/.codex/config.toml"
jq -e --arg m "$opencode_now" '.model == $m and .personal == 1' "$HOME/.config/opencode/opencode.json"
}

@test "rule 2: a reseed waits while the installed tool is older than it requires" {
unset KANBAN_TOKEN
_reseed_tool_stubs 0.170.0 1.19.6
source "$BLUEPRINT_ROOT/lib/blueprint-deploy.sh"
mkdir -p "$HOME/.codex" "$HOME/.config/opencode"
printf 'model = "gpt-6.1-sol"\n' > "$HOME/.codex/config.toml"
echo '{"model":"openai/gpt-6.1-sol"}' > "$HOME/.config/opencode/opencode.json"
managed_config_apply >/dev/null
grep -qx 'model = "gpt-6.1-sol"' "$HOME/.codex/config.toml"
jq -e '.model == "openai/gpt-6.1-sol"' "$HOME/.config/opencode/opencode.json"
rm "$TMPDIR/bin/opencode" "$TMPDIR/bin/codex"
PATH="$TMPDIR/bin:/usr/bin:/bin" managed_config_apply >/dev/null
jq -e '.model == "openai/gpt-6.1-sol"' "$HOME/.config/opencode/opencode.json"
}

@test "rule 2: a model outside the shipped list is never reseeded" {
unset KANBAN_TOKEN
_reseed_tool_stubs 0.171.0 2.3.2
source "$BLUEPRINT_ROOT/lib/blueprint-deploy.sh"
mkdir -p "$HOME/.codex" "$HOME/.config/opencode"
printf 'model = "gpt-6.2-astra"\n' > "$HOME/.codex/config.toml"
echo '{"model":"openai/gpt-6-luna"}' > "$HOME/.config/opencode/opencode.json"
managed_config_apply >/dev/null
grep -qx 'model = "gpt-6.2-astra"' "$HOME/.codex/config.toml"
jq -e '.model == "openai/gpt-6-luna"' "$HOME/.config/opencode/opencode.json"
}

@test "rule 2: reseeded keys are seeded keys and never list the current seed" {
local cfg="$BLUEPRINT_ROOT/configs/managed-config.json" codex_now opencode_now
codex_now=$(sed -n 's/^model = "\(.*\)"$/\1/p' "$BLUEPRINT_ROOT/configs/codex/config.toml")
opencode_now=$(jq -r .model "$BLUEPRINT_ROOT/configs/opencode/opencode.json")
jq -e '[.reseeded_keys[] as $x | .mixed[$x.dest].seeded | index($x.path | join("."))] | all(. != null)' "$cfg"
jq -e --arg c "$codex_now" --arg o "$opencode_now" '
[.reseeded_keys[] | select(.path == ["model"])
| if .dest == ".codex/config.toml" then (.shipped | index($c)) else (.shipped | index($o)) end]
| all(. == null)' "$cfg"
}

@test "rule 3: the retired local Codex Kanban server is removed, a personal one kept" {
unset KANBAN_TOKEN
source "$BLUEPRINT_ROOT/lib/blueprint-deploy.sh"
Expand Down