aligndev 0.25.0 → 0.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -30,7 +30,7 @@ A task can also start at any intermediate step.
30
30
 
31
31
  **As an OpenClaw bot.** [AlignDev for OpenClaw](#start-as-an-openclaw-bot) deploys the assistant on a server, under its own name in Slack or Discord. It works on every project of the host, one thread per task.
32
32
 
33
- For a coding-agent assistant, parent host and delegated child are independent: a coding profile selects Claude Code, Codex or Pi. Without a profile selection, the detected parent kind supplies the default child. OpenClaw deployment templates offer all three agents on Slack or Discord, with explicit profiles and inventoried default/custom native stores. The Pi overlay uses a protected absolute-Node launcher while retaining project PATH. Its [deployment boundary](https://github.com/paleo/alignfirst/blob/main/skills/alignfirst-setup-guide/references/aligndev-openclaw.md#deployment-gate) explicitly permits writable native `auth.json` and adjacent locks for OAuth renewal. That file can persist same-account executable API-key commands; this is account-level persistence, not administrator privilege escalation. Other managed resources and trust retain controlled-maintenance protection. Project trust is not a sandbox, and offline checks do not certify live deployment.
33
+ For a coding-agent assistant, parent host and delegated child are independent: a coding profile selects Claude Code, Codex or Pi. Without a named selection, the detected parent kind selects a matching profile or built-in child defaults. OpenClaw deployment templates offer all three agents on Slack or Discord, with explicit profiles and inventoried default/custom native stores. The Pi overlay uses a protected absolute-Node launcher while retaining project PATH. Its [deployment boundary](https://github.com/paleo/alignfirst/blob/main/skills/alignfirst-setup-guide/references/aligndev-openclaw.md#deployment-gate) explicitly permits writable native `auth.json` and adjacent locks for OAuth renewal. That file can persist same-account executable API-key commands; this is account-level persistence, not administrator privilege escalation. Other managed resources and trust retain controlled-maintenance protection. Project trust is not a sandbox, and offline checks do not certify live deployment.
34
34
 
35
35
  ## Start in Claude Code, Codex or Pi
36
36
 
@@ -80,17 +80,28 @@ Then ask your session to work with aligndev.
80
80
 
81
81
  ## Configuration
82
82
 
83
- `~/.alignfirst/aligndev.settings.json` is optional. Without it, the detected parent kind supplies built-in child defaults. For example:
83
+ `~/.alignfirst/aligndev.settings.json` is optional. Without it, one detected parent kind supplies built-in child defaults. A minimal singleton setup is:
84
+
85
+ ```json
86
+ {
87
+ "code": {
88
+ "profiles": { "work": { "agent": "claude" } }
89
+ }
90
+ }
91
+ ```
92
+
93
+ A Claude parent selects `work` automatically. With no detected parent, a sole total profile is also selected. A Codex or Pi parent keeps its own built-ins when no profile matches. Multiple detected kinds require a named selection.
94
+
95
+ For multiple accounts and independent quota sources:
84
96
 
85
97
  ```json
86
98
  {
87
99
  "code": {
88
100
  "profile": "codex-personal",
89
- "defaultProfiles": { "claude": "claude-personal", "codex": "codex-personal" },
90
101
  "profiles": {
91
- "codex-personal": { "agent": "codex", "configDir": "~/.codex", "defaultModel": "sol" },
102
+ "codex-personal": { "agent": "codex", "defaultModel": "sol" },
92
103
  "claude-personal": {
93
- "agent": "claude", "configDir": "~/.claude", "defaultModel": "opus",
104
+ "agent": "claude", "default": true, "defaultModel": "opus",
94
105
  "unset": ["ANTHROPIC_API_KEY"]
95
106
  },
96
107
  "claude-work": {
@@ -98,14 +109,14 @@ Then ask your session to work with aligndev.
98
109
  "unset": ["ANTHROPIC_API_KEY"]
99
110
  },
100
111
  "pi-codex": {
101
- "agent": "pi", "configDir": "~/.pi/agent", "defaultModel": "sol",
112
+ "agent": "pi", "default": true, "defaultModel": "sol",
102
113
  "modelAliases": { "sol": "openai/sol" },
103
- "quota": { "source": "codex", "configDir": "~/.codex" }
114
+ "quota": { "source": "codex" }
104
115
  },
105
116
  "pi-anthropic": {
106
117
  "agent": "pi", "configDir": "~/.pi/anthropic", "defaultModel": "opus",
107
118
  "modelAliases": { "opus": "anthropic/opus" },
108
- "quota": { "source": "claude", "configDir": "~/.claude" }
119
+ "quota": { "source": "claude" }
109
120
  }
110
121
  }
111
122
  }
@@ -117,29 +128,35 @@ The Pi targets illustrate native shorthand; availability depends on Pi's catalog
117
128
  - `platform` — `codingAgent` (default), or `openclaw`.
118
129
  - `projectsRoot` — projects directory, required by the OpenClaw playbook. `~/` uses the configured home; relative paths resolve against the settings directory.
119
130
  - `code.profile` — global named child profile, independent of the parent host.
120
- - `code.defaultProfiles` — defaults by detected agent kind. Remove `code.profile` above to use these defaults.
121
131
  - `code.profiles` — complete profiles, with required `agent` (`claude`, `codex`, `pi`). Names and references are exact, nonblank strings. Profiles have no inheritance or merging.
122
132
 
133
+ Remove `code.profile` above to use automatic per-agent selection: the sole Codex profile, the preferred Claude profile or the preferred Pi profile.
134
+
123
135
  Each profile accepts:
124
136
 
125
- - `configDir` — native configuration and authentication storage: `CLAUDE_CONFIG_DIR`, `CODEX_HOME`, or `PI_CODING_AGENT_DIR`. `~/` uses the configured home; relative paths resolve against the settings directory. Omission keeps native inherited/default storage.
137
+ - `default` — optional boolean preference for this profile's agent. With several matching profiles, exactly one true flag selects the preference. Omitted and false are equivalent; a sole matching profile needs no flag. At most one true flag per agent is allowed, even with a named choice. Independent defaults for different agents are valid. The flag never selects an agent kind.
138
+ - `configDir` — native directory selection through `CLAUDE_CONFIG_DIR`, `CODEX_HOME`, or `PI_CODING_AGENT_DIR`. Omit it for ordinary setup: the caller's variable is inherited unless `env` or `unset` changes it; without a variable, native defaults apply. `null` deliberately removes that variable to force native-default directory behavior. A string resolves and sets it, including when naming the default path. `~/` uses the configured home; relative paths resolve against the settings directory.
126
139
  - `env` — literal environment values for non-secret configuration. No interpolation or shell expansion. Keep credentials in native stores or separately provisioned process environments.
127
- - `unset` — inherited variables to remove, including API keys that select an unintended authentication route. A variable cannot occur in both `env` and `unset`. An explicit `configDir` cannot coexist with its native directory variable in either field.
140
+ - `unset` — inherited variables to remove, including API keys that select an unintended authentication route. A variable cannot occur in both `env` and `unset`. A string or null `configDir` cannot coexist with its native directory variable in either field.
128
141
  - `defaultModel` — new-session default, validated against accepted names. Omission uses the native default.
129
142
  - `models` — a nonempty list replaces accepted names. Otherwise Claude accepts `fable`, `opus`, `sonnet`, `haiku`, Codex accepts `astra`, `sol`, `terra`, `luna`, and both add configured alias names. Pi accepts every nonblank selector. An empty list adds no override.
130
143
  - `modelAliases` — one-step user-facing name → native selector mappings. Validate the chosen name first, expand once, then apply native handling. A Codex alias target such as `sol` still resolves through its bundled catalog.
131
144
  - `skipPermissions` — defaults to false. Claude uses `--permission-mode auto`, or `--dangerously-skip-permissions`; Codex uses `--sandbox workspace-write`, or `--dangerously-bypass-approvals-and-sandbox`. Pi ignores this setting.
132
- - `quota` — independent native usage reader: `source` is `claude`, `codex`, or `none`, with optional `configDir`, `env`, `unset`. `none` disables quota and accepts no other options. Omitted quota uses a native Claude/Codex profile's coding environment; Pi requires an explicit source.
145
+ - `quota` — independent native usage reader: `source` is `claude`, `codex`, or `none`, with optional `configDir`, `env`, `unset`. `none` disables quota and accepts no other recognized options. Omitted quota uses a native Claude/Codex profile's coding environment; Pi requires an explicit source.
133
146
 
134
- Selection for new sessions, help, `guide code`, and quota: `--profile` → project registry selection → `code.profile` → detected-agent `code.defaultProfiles` → detected built-in defaults. Resume inserts its latest recorded profile before the global default. Explicit selections work without parent detection. Project selections use the actual working directory, matching linked worktrees through AlignFirst; help/guide/quota need no `.plans` or Git repository. `--profile` is rejected on status and unrelated guide topics.
147
+ Selection for new sessions, help, `guide code`, and quota: `--profile` → project registry selection → `code.profile` → automatic resolution. Resume inserts its latest recorded named profile before the global selection. Named choices bypass parent detection; a missing name fails rather than falling through. Automatic resolution selects a sole matching profile or the unique true flag among several matches; without either, several matches are ambiguous. No matching profile uses the detected agent's built-ins. Without a parent, zero or several profiles require a named choice, regardless of flags. Several detected kinds always require a named choice. Project selections use the actual working directory, matching linked worktrees through AlignFirst; help/guide/quota need no `.plans` or Git repository. `--profile` is rejected on status and unrelated guide topics.
135
148
 
136
- `aligndev code quota [--profile <name>]` needs neither a ticket nor `.plans` and starts no coding session. Explicit quota settings start from the original caller environment, apply only their own `unset`, `env` and source-specific `configDir`, then strip parent-session identities. Coding-profile overrides and Pi credentials are not copied into the quota environment. The same path and validation rules apply. For multiple accounts, set quota `configDir` explicitly; omission deliberately keeps the native CLI's inherited/default configuration. Pair each Pi profile with the intended Codex or Claude account, as in the examples above. Reports name the profile and native source; the limits belong to that CLI's account. AlignDev does not verify that it matches Pi's account or infer it from a model. Native requests time out after 30 seconds and await bounded process cleanup.
149
+ `aligndev code quota [--profile <name>]` needs neither a ticket nor `.plans` and starts no coding session. Explicit quota settings start from the original caller environment, apply only their own `unset`, `env` and source-specific `configDir`, then strip parent-session identities. Coding-profile overrides and Pi credentials are not copied into the quota environment. The same path and validation rules apply. Select quota storage only when needed: omission inherits independently from the original caller, null removes the source's native directory variable, and a string selects explicit storage. Pair each Pi profile with the intended Codex or Claude account, using a custom quota directory when account separation is intended. Reports name the profile and native source; the limits belong to that CLI's account. AlignDev does not verify that it matches Pi's account or infer it from a model. Native requests time out after 30 seconds and await bounded process cleanup.
137
150
 
138
- The child inherits the caller environment, removes `unset`, then applies `env` and `configDir`. Parent-session identities are stripped afterward, and required adapter values win. The same finalized environment reaches discovery, execution and native context lookup. Help, guides and failures identify native storage selected through `configDir`, profile environment overrides, inherited variables or profile removal. They show environment-variable names and origins, never their values. Login must reproduce that effective environment and cwd. No environment values are printed or saved in run metadata.
151
+ For example, `"configDir": null` forces native-default mode despite an inherited directory variable; `"configDir": "~/.claude-work"` deliberately selects custom Claude storage. On macOS, explicitly setting `CLAUDE_CONFIG_DIR` to the default path can select different Keychain credentials from leaving it unset. Such a string remains valid and is distinct from omission or null. Confirm the intended mode before changing an existing selection; AlignDev performs no settings rewrite, credential transfer or automatic login. A null reset changes only directory routing, not HOME, PATH or API-key precedence.
139
152
 
140
- Resume requires the same native agent and, for Pi, the same real directory. A selected account must contain the native conversation; failure never falls back to an old profile or accepts a new conversation. `--model` overrides the recorded user-facing model; otherwise that name is retained and validated under the current profile. A disallowed retained name requires an explicit replacement; a recorded null keeps the native conversation's model. Profile defaults apply only to new sessions. Retained aliases use the selected profile's current mappings, so changing a mapping can change the native target. Session metadata records profile, agent, chosen name, native ID and cwd; historical records without a profile read as null. Status reads durable metadata even when a launch profile has been deleted.
153
+ The child inherits the caller environment, removes `unset`, then applies `env` and the directory selection (setting a string or removing the native variable for null). Parent-session identities are stripped afterward, and required adapter values win. The same finalized environment reaches discovery, execution and native context lookup. Help, guides and failures identify native storage selected through a string `configDir`, a null reset, profile environment overrides, inherited variables or profile removal. They show environment-variable names and origins, never their values. Login must reproduce that effective environment and cwd. No environment values are printed or saved in run metadata.
141
154
 
142
- Unknown keys and invalid structural values fail with the settings path and field. Direct `code.agent/defaultModel/models/skipPermissions/unset` settings are retired and rejected. Move them manually into a named profile and select it with `code.profile`; see the [upgrade reference](https://github.com/paleo/alignfirst/blob/main/skills/alignfirst-setup-guide/references/alignfirst-upgrade.md#convert-aligndev-launch-settings). Authenticate under the selected native configuration before launching. Never retry against another account after an authentication or missing-conversation failure.
155
+ Resume requires the same native agent and, for Pi, the same real directory. A selected account must contain the native conversation; failure never falls back to an old profile or accepts a new conversation. `--model` overrides the recorded user-facing model; otherwise that name is retained and validated under the current profile. A disallowed retained name requires an explicit replacement; a recorded null keeps the native conversation's model. Profile defaults apply only to new sessions. Retained aliases use the selected profile's current mappings, so changing a mapping can change the native target. Session metadata records profile, agent, chosen name, native ID and cwd; historical records with blank or missing profiles read as null. Unless an explicit, project or global named choice replaces null, resume uses detected built-ins, ignoring configured profile counts and flags, and records null in the new run. No or several detected parents still fail. Original records remain unchanged. A deleted recorded name needs an explicit or project replacement; global selection and inference cannot rescue it. Status reads durable metadata even when launch settings are invalid or a profile has been deleted.
156
+
157
+ `code.defaultProfiles` is retired and ignored with a warning. Move needed preferences to matching profiles' `default: true`, omit singleton flags and remove the map. Keep profile names unchanged; see [profile-default migration](https://github.com/paleo/alignfirst/blob/main/skills/alignfirst-setup-guide/references/alignfirst-upgrade.md#convert-aligndev-profile-defaults). Unique-profile inference now selects configured native storage, model, environment and permission settings for new runs that previously used built-ins. Historical null-profile resumes retain their built-in fallback. OpenClaw deployments continue to require an explicit valid `code.profile`.
158
+
159
+ Unknown or obsolete keys at the settings root, `code`, each profile and each quota object are ignored with warnings on stderr. Profile names, environment names and model aliases remain dynamic map keys. Warnings omit values, redact dynamic map names and escape control characters. Recognized invalid values and duplicate defaults still fail. The CLI never rewrites the settings file. Direct `code.agent/defaultModel/models/skipPermissions/unset` settings are retired and ignored; they no longer select or configure a child. Move them manually into a named profile and select it with `code.profile`; see the [upgrade reference](https://github.com/paleo/alignfirst/blob/main/skills/alignfirst-setup-guide/references/alignfirst-upgrade.md#convert-aligndev-launch-settings). Authenticate under the selected native configuration before launching. Never retry against another account after an authentication or missing-conversation failure.
143
160
 
144
161
  ## Start as an OpenClaw Bot
145
162
 
@@ -158,6 +175,8 @@ Install the setup skill where your agent will assemble the deployment's private
158
175
  npx -y skills add https://github.com/paleo/alignfirst --global --skill alignfirst-setup-guide
159
176
  ```
160
177
 
178
+ Deployments require null or a string for every coding profile and enabled explicit quota source; omission is invalid there. Generated service defaults use null. Inventory still records absolute filesystem paths, while native commands unset the directory variable for null or set its resolved value for a string.
179
+
161
180
  Then ask the agent to create an assistant. The skill collects the deployment values, renders one Slack or Discord variant and one Claude Code, Codex or Pi variant, and writes the installation, security, operation and recovery runbooks. Each managed project receives the full preparation contract: the `alignfirst context` section in its `AGENTS.md`, an optional work-files repository, docmap, isolated workspaces and a project-specific `DEVELOPERS.md`.
162
181
 
163
182
  ## Under the Hood
@@ -4,6 +4,7 @@ export interface AlignfirstResult {
4
4
  stderr: string;
5
5
  }
6
6
  export declare function runAlignfirst(command: string[], args: string[], cwd: string, env?: NodeJS.ProcessEnv): AlignfirstResult;
7
+ export declare function forwardSettingsWarnings(stderr: string): string;
7
8
  export declare function describeAlignfirst(command: string[], cwd: string, env: NodeJS.ProcessEnv): string;
8
9
  export declare function reserveSideTicket(command: string[], cwd: string, env: NodeJS.ProcessEnv): string;
9
10
  export declare function openTicket(command: string[], cwd: string, ticket: string, env: NodeJS.ProcessEnv): void;
@@ -14,12 +14,31 @@ export function runAlignfirst(command, args, cwd, env = process.env) {
14
14
  }
15
15
  if (result.error)
16
16
  throw result.error;
17
+ if (result.status === 0)
18
+ forwardSettingsWarnings(result.stderr);
17
19
  return {
18
20
  status: result.status ?? 1,
19
21
  stdout: result.stdout,
20
22
  stderr: result.stderr,
21
23
  };
22
24
  }
25
+ // Forward only recognized settings warnings, leaving other diagnostics to the caller.
26
+ export function forwardSettingsWarnings(stderr) {
27
+ const diagnostics = [];
28
+ for (const line of stderr.split(/\r?\n/)) {
29
+ if (isSettingsWarning(line))
30
+ console.warn(line);
31
+ else
32
+ diagnostics.push(line);
33
+ }
34
+ return diagnostics.join("\n");
35
+ }
36
+ function isSettingsWarning(line) {
37
+ if (/[\p{Cc}\p{Cf}\p{Zl}\p{Zp}]/u.test(line))
38
+ return false;
39
+ return (/^Warning: ignoring unknown (?:\.alignfirst\.json|companion registry) setting /u.test(line) ||
40
+ /^Warning: .+: plans\.folder is deprecated; rename it to plans\.repositoryFolder\. See "Rename the Work-Files Folder Setting" in the setup guide's alignfirst-upgrade reference\.$/u.test(line));
41
+ }
23
42
  export function describeAlignfirst(command, cwd, env) {
24
43
  const npx = command[0] === "npx";
25
44
  const reason = npx
package/dist/cli.js CHANGED
@@ -57,7 +57,8 @@ Run \`${aligndev} <command> --help\` for the usage of a command.
57
57
 
58
58
  Config (optional): ~/.alignfirst/aligndev.settings.json. "platform" (${PLATFORMS.join(" or ")})
59
59
  defaults to codingAgent. Named code.profiles select child agents and native configuration.
60
- Use code.profile for a global selection, or code.defaultProfiles for detected-agent defaults.
60
+ Use code.profile for a global selection. A sole matching profile is inferred; with several,
61
+ set one profile's default: true per agent. Without a parent, only a sole total profile is inferred.
61
62
  `;
62
63
  }
63
64
  // Each row is a command, optionally followed by its description in an aligned column.
@@ -759,12 +759,32 @@ Options (new, resume):
759
759
  ${requires}
760
760
 
761
761
  Config (~/.alignfirst/aligndev.settings.json):
762
+ Unknown/obsolete keys are ignored with value-free warnings on stderr. Recognized invalid values
763
+ and duplicate defaults still fail. Settings are never rewritten. Retired direct launch keys and
764
+ code.defaultProfiles have no effect; convert them manually to profiles and profile.default flags.
762
765
  code.profile Global named profile. Effective profile: ${profile ?? "(built-in)"} (selected: ${agent}).
763
- code.defaultProfiles Per detected-agent default profile names.
764
- code.profiles Complete named profiles: agent, configDir, env, unset, defaultModel,
765
- models, modelAliases, skipPermissions, quota. No inheritance.
766
+ code.profiles Complete named profiles: agent, default, configDir, env, unset,
767
+ defaultModel, models, modelAliases, skipPermissions, quota. No inheritance.
768
+ profile.configDir Omit for ordinary setup: inherit the native directory variable unless
769
+ env/unset changes it; otherwise use native defaults. null deliberately
770
+ removes it for native-default mode. A string resolves and sets it,
771
+ even when naming the default path. ~/ uses the configured home;
772
+ relative paths use the settings directory. String/null conflicts with
773
+ the matching native variable in env/unset: CLAUDE_CONFIG_DIR (claude),
774
+ CODEX_HOME (codex), PI_CODING_AGENT_DIR (pi).
775
+ profile.quota source: claude, codex or none. Enabled sources use the same omitted/null/
776
+ string directory rules, starting from the original caller env without
777
+ coding-profile overrides. Omitted Claude/Codex quota uses the coding
778
+ environment; pi requires an explicit source or none. none accepts no
779
+ other recognized fields, including configDir: null.
780
+ profile.default Optional boolean preference for that agent; at most one true per agent.
781
+ A sole matching profile is inferred without a flag. No matching profile
782
+ uses detected built-ins. Without a parent, only a sole total profile is
783
+ inferred; multiple parents require a named choice.
766
784
  --profile <name> Override for new, resume, quota and help (also guide code).
767
- Precedence: explicit > project > recorded resume > global > detected default.
785
+ Precedence: explicit > project > recorded named resume > global > automatic.
786
+ Historical null/missing-profile resumes keep detected built-ins unless
787
+ explicit/project/global selection replaces them; no automatic inference.
768
788
  Model default ${defaultModel ?? "native default"} (new only). Resume retains and validates its model.
769
789
  One configured alias expands before native model handling.
770
790
 
@@ -772,7 +792,11 @@ Native configuration: ${describeNativeStorage(code)}.
772
792
  Login must use the same effective environment as the child: apply profile unset/env/configDir,
773
793
  including HOME, PATH and credential routing, from the same working directory. Then use
774
794
  ${authenticationInstruction(agent)}. A bare login in another shell may use a different account.
775
- Environment values are omitted.
795
+ Environment values are omitted. A null reset changes directory routing only, not HOME, PATH
796
+ or API-key precedence. On macOS, setting Claude's default path can select different Keychain
797
+ credentials from an unset CLAUDE_CONFIG_DIR. Confirm the intended mode before changing existing
798
+ strings; no automatic settings rewrite, login or credential transfer occurs. OpenClaw deployments
799
+ require null/string selections for every coding profile and enabled explicit quota source.
776
800
 
777
801
  Selected-agent permissions: ${permissionMode}
778
802
  The project's companion directory is prepared before launch; pi uses ordinary OS access.
@@ -1,9 +1,11 @@
1
1
  import { CONFIG_DIRECTORY_VARIABLES } from "../config.js";
2
2
  export function describeNativeStorage(code) {
3
3
  const variable = CONFIG_DIRECTORY_VARIABLES[code.agent];
4
- const directory = code.configDir === undefined
5
- ? describeVariable(code, variable)
6
- : `${variable}: configDir ${JSON.stringify(code.configDir)}`;
4
+ const directory = code.configDir === null
5
+ ? `${variable}: unset by configDir: null; native defaults apply`
6
+ : code.configDir === undefined
7
+ ? describeVariable(code, variable)
8
+ : `${variable}: configDir ${JSON.stringify(code.configDir)}`;
7
9
  const home = ["HOME", "USERPROFILE"]
8
10
  .filter((name) => code.childEnv[name] !== undefined || code.unset?.includes(name))
9
11
  .map((name) => describeVariable(code, name));
package/dist/config.d.ts CHANGED
@@ -19,12 +19,12 @@ export interface ProjectsRoot {
19
19
  }
20
20
  export interface CodeSettings {
21
21
  profile?: string;
22
- defaultProfiles?: Partial<Record<CodingAgent, string>>;
23
22
  profiles?: Record<string, CodingProfile>;
24
23
  }
25
24
  export interface CodingProfile {
26
25
  agent: CodingAgent;
27
- configDir?: string;
26
+ default?: boolean;
27
+ configDir?: string | null;
28
28
  defaultModel?: string;
29
29
  models?: string[];
30
30
  modelAliases?: Record<string, string>;
@@ -35,7 +35,7 @@ export interface CodingProfile {
35
35
  }
36
36
  export interface QuotaSettings {
37
37
  source: "claude" | "codex" | "none";
38
- configDir?: string;
38
+ configDir?: string | null;
39
39
  env?: Record<string, string>;
40
40
  unset?: string[];
41
41
  }
package/dist/config.js CHANGED
@@ -18,9 +18,10 @@ const quotaShape = object({
18
18
  configDir: optional(directoryValue),
19
19
  env: optional(environmentShape),
20
20
  unset: optional(arrayOf(environmentName)),
21
- });
21
+ }, warnUnknownSetting);
22
22
  const profileShape = object({
23
23
  agent: literal(...CODING_AGENTS),
24
+ default: optional(boolean),
24
25
  configDir: optional(directoryValue),
25
26
  defaultModel: optional(nonblankString),
26
27
  models: optional(arrayOf(nonblankString)),
@@ -29,21 +30,16 @@ const profileShape = object({
29
30
  env: optional(environmentShape),
30
31
  unset: optional(arrayOf(environmentName)),
31
32
  quota: optional(quotaShape),
32
- });
33
+ }, warnUnknownSetting);
33
34
  const codeShape = object({
34
35
  profile: optional(nonblankString),
35
- defaultProfiles: optional(object({
36
- claude: optional(nonblankString),
37
- codex: optional(nonblankString),
38
- pi: optional(nonblankString),
39
- })),
40
36
  profiles: optional(record(profileShape, nonblankString)),
41
- });
37
+ }, warnUnknownSetting);
42
38
  const configShape = object({
43
39
  platform: optional(literal(...PLATFORMS)),
44
40
  projectsRoot: optional(nonEmptyString),
45
41
  code: optional(codeShape),
46
- });
42
+ }, warnUnknownSetting);
47
43
  const RETIRED_CODE_KEYS = ["agent", "defaultModel", "models", "skipPermissions", "unset"];
48
44
  export function loadConfig(home) {
49
45
  const path = join(home, ".alignfirst", "aligndev.settings.json");
@@ -52,7 +48,7 @@ export function loadConfig(home) {
52
48
  for (const [name, profile] of Object.entries(code.profiles ?? {})) {
53
49
  const field = `code.profiles[${JSON.stringify(name)}]`;
54
50
  validateEnvironment(profile, profile.agent, field, path);
55
- if (profile.configDir !== undefined)
51
+ if (typeof profile.configDir === "string")
56
52
  profile.configDir = resolvePath(profile.configDir, home, path);
57
53
  if (profile.quota !== undefined) {
58
54
  const quota = profile.quota;
@@ -64,7 +60,7 @@ export function loadConfig(home) {
64
60
  else {
65
61
  validateEnvironment(quota, quota.source, `${field}.quota`, path);
66
62
  }
67
- if (quota.configDir !== undefined)
63
+ if (typeof quota.configDir === "string")
68
64
  quota.configDir = resolvePath(quota.configDir, home, path);
69
65
  }
70
66
  }
@@ -90,30 +86,52 @@ function absentConfig(home) {
90
86
  return {};
91
87
  }
92
88
  function parseConfigFile(path) {
93
- let value;
89
+ let text;
94
90
  try {
95
- value = JSON.parse(readFileSync(path, "utf8"));
91
+ text = readFileSync(path, "utf8");
96
92
  }
97
93
  catch (error) {
98
94
  throw invalidConfig(path, errorMessage(error));
99
95
  }
100
- if (typeof value === "object" &&
101
- value !== null &&
102
- "code" in value &&
103
- typeof value.code === "object" &&
104
- value.code !== null) {
105
- const retired = RETIRED_CODE_KEYS.find((key) => Object.hasOwn(value.code ?? {}, key));
106
- if (retired !== undefined) {
107
- throw invalidConfig(path, `code.${retired} is retired: move launch settings into ` +
108
- "code.profiles and select one with code.profile (manual conversion required)");
109
- }
96
+ let value;
97
+ try {
98
+ value = JSON.parse(text);
99
+ }
100
+ catch {
101
+ throw invalidConfig(path, "must contain valid JSON");
110
102
  }
111
103
  return parseShape(configShape, value, (detail) => invalidConfig(path, detail));
112
104
  }
105
+ function warnUnknownSetting(path, key) {
106
+ const quoted = JSON.stringify(key).replace(/[\p{Cc}\p{Cf}\p{Zl}\p{Zp}]/gu, (character) => character
107
+ .split("")
108
+ .map((unit) => `\\u${unit.charCodeAt(0).toString(16).padStart(4, "0")}`)
109
+ .join(""));
110
+ const field = /^[A-Za-z_$][\w$]*$/.test(key)
111
+ ? `${path === "" ? "" : `${path}.`}${key}`
112
+ : `${path === "" ? "settings" : path}[${quoted}]`;
113
+ let migration = "Remove it or check its spelling.";
114
+ if (path === "code" && key === "defaultProfiles") {
115
+ migration =
116
+ "code.defaultProfiles is retired: manually move each needed preference to its referenced " +
117
+ "matching-agent profile's default: true (omit singleton flags), remove the map and " +
118
+ "keep profile names unchanged. See " +
119
+ "https://github.com/paleo/alignfirst/blob/main/skills/alignfirst-setup-guide/" +
120
+ "references/alignfirst-upgrade.md#convert-aligndev-profile-defaults";
121
+ }
122
+ else if (path === "code" && RETIRED_CODE_KEYS.includes(key)) {
123
+ migration =
124
+ "Retired launch setting: move it into code.profiles and select one with code.profile " +
125
+ "(manual conversion required).";
126
+ }
127
+ console.warn(`Warning: ignoring unknown aligndev setting ${field}. ${migration}`);
128
+ }
113
129
  function invalidConfig(path, detail) {
114
130
  return new Error(`Error: invalid aligndev config ${path}: ${detail}`);
115
131
  }
116
132
  function directoryValue(value, path) {
133
+ if (value === null)
134
+ return null;
117
135
  nonblankString(value, path);
118
136
  return nulFreeString(value, path);
119
137
  }
@@ -141,18 +159,24 @@ export function resolveQuotaConfig(code, callerEnv) {
141
159
  if (quota === undefined) {
142
160
  if (code.agent === "pi") {
143
161
  throw new Error("Pi account quota is unsupported without explicit configuration: " +
144
- "set quota.source to claude or codex with its native configDir, or none to disable it.");
162
+ "set quota.source to claude or codex, or none to disable it.");
145
163
  }
146
164
  return { source: code.agent, env: code.childEnv };
147
165
  }
148
- const overrides = { ...quota.env };
149
- if (quota.configDir !== undefined)
150
- overrides[CONFIG_DIRECTORY_VARIABLES[quota.source]] = quota.configDir;
151
166
  return {
152
167
  source: quota.source,
153
- env: buildAgentEnv(callerEnv, quota.unset ?? [], overrides),
168
+ env: buildNativeEnv(callerEnv, quota, quota.source),
154
169
  };
155
170
  }
171
+ function buildNativeEnv(callerEnv, settings, agent, required = {}) {
172
+ const variable = CONFIG_DIRECTORY_VARIABLES[agent];
173
+ const overrides = { ...settings.env };
174
+ if (typeof settings.configDir === "string")
175
+ overrides[variable] = settings.configDir;
176
+ const unset = settings.unset ?? [];
177
+ const removals = settings.configDir === null ? [...unset, variable] : unset;
178
+ return buildAgentEnv(callerEnv, removals, overrides, required);
179
+ }
156
180
  export function resolveCodeConfig(config, env, selection = {}) {
157
181
  validateReferences(config);
158
182
  const name = selection.explicit ?? selection.project?.profile ?? selection.recorded ?? config.code.profile;
@@ -161,33 +185,33 @@ export function resolveCodeConfig(config, env, selection = {}) {
161
185
  if (name !== undefined) {
162
186
  profile = referencedProfile(config, name, "selected profile");
163
187
  }
188
+ else if (selection.recorded === null) {
189
+ profile = { agent: detectAgent(config, env) };
190
+ }
164
191
  else {
165
- const agent = detectAgent(config, env);
166
- effectiveName = config.code.defaultProfiles?.[agent];
167
- profile =
168
- effectiveName === undefined
169
- ? { agent }
170
- : referencedProfile(config, effectiveName, "defaultProfiles");
192
+ const automatic = resolveAutomaticProfile(config, env);
193
+ profile = automatic.profile;
194
+ effectiveName = automatic.name;
171
195
  }
172
196
  checkDefaultModel(profile, config.path, effectiveName);
173
- const overrides = { ...profile.env };
174
- if (profile.configDir !== undefined)
175
- overrides[CONFIG_DIRECTORY_VARIABLES[profile.agent]] = profile.configDir;
176
197
  return {
177
198
  ...profile,
178
199
  profile: effectiveName ?? null,
179
200
  skipPermissions: profile.skipPermissions ?? false,
180
201
  unset: profile.unset ?? [],
181
- childEnv: buildAgentEnv(env, profile.unset ?? [], overrides, createAgentAdapter(profile.agent).env),
202
+ childEnv: buildNativeEnv(env, profile, profile.agent, createAgentAdapter(profile.agent).env),
182
203
  };
183
204
  }
184
205
  function validateReferences(config) {
185
206
  if (config.code.profile !== undefined)
186
207
  referencedProfile(config, config.code.profile, "code.profile");
187
- for (const [agent, name] of Object.entries(config.code.defaultProfiles ?? {})) {
188
- const profile = referencedProfile(config, name, `code.defaultProfiles.${agent}`);
189
- if (profile.agent !== agent)
190
- throw invalidConfig(config.path, `code.defaultProfiles.${agent} references a ${profile.agent} profile`);
208
+ for (const agent of CODING_AGENTS) {
209
+ const names = Object.entries(config.code.profiles ?? {})
210
+ .filter(([, profile]) => profile.agent === agent && profile.default === true)
211
+ .map(([name]) => JSON.stringify(name));
212
+ if (names.length > 1)
213
+ throw invalidConfig(config.path, `multiple default: true profiles for ${agent}: ${names.join(", ")}; ` +
214
+ `leave only one default: true for ${agent}`);
191
215
  }
192
216
  }
193
217
  function referencedProfile(config, name, field) {
@@ -199,14 +223,37 @@ function referencedProfile(config, name, field) {
199
223
  }
200
224
  return profile;
201
225
  }
226
+ function resolveAutomaticProfile(config, env) {
227
+ const detected = detectCodingAgents(env);
228
+ const profiles = Object.entries(config.code.profiles ?? {});
229
+ if (detected.length === 0 && profiles.length === 1) {
230
+ const [name, profile] = profiles[0];
231
+ return { name, profile };
232
+ }
233
+ if (detected.length !== 1)
234
+ throw selectionRequired(config, detected);
235
+ const agent = detected[0];
236
+ const matching = profiles.filter(([, profile]) => profile.agent === agent);
237
+ if (matching.length === 0)
238
+ return { profile: { agent } };
239
+ const selected = matching.length === 1 ? matching[0] : matching.find(([, p]) => p.default === true);
240
+ if (selected !== undefined)
241
+ return { name: selected[0], profile: selected[1] };
242
+ throw invalidConfig(config.path, `multiple profiles for detected ${agent}: ${matching.map(([name]) => JSON.stringify(name)).join(", ")}; ` +
243
+ "select --profile, a project registry profile, code.profile, or set one matching " +
244
+ "profile's default: true");
245
+ }
202
246
  function detectAgent(config, env) {
203
247
  const detected = detectCodingAgents(env);
204
248
  if (detected.length === 1)
205
249
  return detected[0];
250
+ throw selectionRequired(config, detected);
251
+ }
252
+ function selectionRequired(config, detected) {
206
253
  const problem = detected.length === 0
207
254
  ? `no coding agent detected (${CODING_AGENTS.join(", ")})`
208
255
  : `multiple coding agents detected (${detected.join(", ")})`;
209
- throw new Error(`Error: ${problem}: select --profile or set "code.profile" in ${config.path}.`);
256
+ return new Error(`Error: ${problem}: select --profile, a project registry profile, or set "code.profile" in ${config.path}.`);
210
257
  }
211
258
  function checkDefaultModel(code, path, profile) {
212
259
  if (code.defaultModel === undefined)
@@ -1,4 +1,4 @@
1
- export type Check<T> = (value: unknown, path: string) => T;
1
+ export type Check<T> = (value: unknown, path: string, warningPath?: string) => T;
2
2
  export interface OptionalField<T> {
3
3
  optional: Check<T>;
4
4
  }
@@ -7,8 +7,7 @@ type Fields<T> = {
7
7
  };
8
8
  /** Runs `check` at the root; a shape failure becomes `toError(<message>)`. */
9
9
  export declare function parseShape<T>(check: Check<T>, value: unknown, toError: (detail: string) => Error): T;
10
- /** Rejects the first unknown key, then checks each field in declaration order. */
11
- export declare function object<T extends object>(fields: Fields<T>): Check<T>;
10
+ export declare function object<T extends object>(fields: Fields<T>, onUnknown?: (path: string, key: string) => void): Check<T>;
12
11
  export declare function record<T>(check: Check<T>, keyCheck?: Check<string>): Check<Record<string, T>>;
13
12
  export declare function nonblankString(value: unknown, path: string): string;
14
13
  export declare function nulFreeString(value: unknown, path: string): string;
@@ -12,35 +12,39 @@ export function parseShape(check, value, toError) {
12
12
  throw error;
13
13
  }
14
14
  }
15
- /** Rejects the first unknown key, then checks each field in declaration order. */
16
- export function object(fields) {
15
+ export function object(fields, onUnknown) {
17
16
  const entries = Object.entries(fields);
18
- return (value, path) => {
17
+ return (value, path, warningPath = path) => {
19
18
  if (!isPlainObject(value))
20
19
  throw shapeError(path, "be an object");
21
- const unknownKey = Object.keys(value).find((key) => !Object.hasOwn(fields, key));
22
- if (unknownKey !== undefined)
23
- throw shapeError(childPath(path, unknownKey), "be removed");
20
+ for (const key of Object.keys(value)) {
21
+ if (Object.hasOwn(fields, key))
22
+ continue;
23
+ if (onUnknown === undefined)
24
+ throw shapeError(childPath(path, key), "be removed");
25
+ onUnknown(warningPath, key);
26
+ }
24
27
  const result = {};
25
28
  for (const [key, field] of entries) {
26
29
  const fieldPath = childPath(path, key);
30
+ const fieldWarningPath = childPath(warningPath, key);
27
31
  if (typeof field === "function")
28
- result[key] = field(value[key], fieldPath);
32
+ result[key] = field(value[key], fieldPath, fieldWarningPath);
29
33
  else if (value[key] !== undefined)
30
- result[key] = field.optional(value[key], fieldPath);
34
+ result[key] = field.optional(value[key], fieldPath, fieldWarningPath);
31
35
  }
32
36
  // The fields mirror T key by key.
33
37
  return result;
34
38
  };
35
39
  }
36
40
  export function record(check, keyCheck = string) {
37
- return (value, path) => {
41
+ return (value, path, warningPath = path) => {
38
42
  if (!isPlainObject(value))
39
43
  throw shapeError(path, "be an object");
40
44
  return Object.fromEntries(Object.entries(value).map(([key, item]) => {
41
45
  const fieldPath = childPath(path, key);
42
46
  keyCheck(key, fieldPath);
43
- return [key, check(item, fieldPath)];
47
+ return [key, check(item, fieldPath, `${warningPath}[<entry>]`)];
44
48
  }));
45
49
  };
46
50
  }
@@ -121,16 +125,16 @@ export function matching(pattern) {
121
125
  };
122
126
  }
123
127
  export function arrayOf(check) {
124
- return (value, path) => {
128
+ return (value, path, warningPath = path) => {
125
129
  if (!Array.isArray(value))
126
130
  throw shapeError(path, "be an array");
127
- return value.map((item, index) => check(item, bracketPath(path, String(index))));
131
+ return value.map((item, index) => check(item, bracketPath(path, String(index)), bracketPath(warningPath, String(index))));
128
132
  };
129
133
  }
130
134
  export function nonEmptyArrayOf(check) {
131
135
  const checkArray = arrayOf(check);
132
- return (value, path) => {
133
- const items = checkArray(value, path);
136
+ return (value, path, warningPath = path) => {
137
+ const items = checkArray(value, path, warningPath);
134
138
  if (items.length === 0)
135
139
  throw shapeError(path, "be a non-empty array");
136
140
  return items;
@@ -1,9 +1,9 @@
1
- import { describeAlignfirst, runAlignfirst } from "../alignfirst-cli.js";
1
+ import { describeAlignfirst, forwardSettingsWarnings, runAlignfirst } from "../alignfirst-cli.js";
2
2
  import { errorMessage } from "../errors.js";
3
3
  export function readProjectReport(command, cwd, env) {
4
4
  const result = runAlignfirst(command, ["config", "--json"], cwd, env);
5
5
  if (result.status !== 0) {
6
- const error = firstLine(result.stderr);
6
+ const error = firstLine(forwardSettingsWarnings(result.stderr));
7
7
  return { error: error === "" ? "alignfirst config failed" : error };
8
8
  }
9
9
  let value;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aligndev",
3
- "version": "0.25.0",
3
+ "version": "0.27.0",
4
4
  "license": "CC0-1.0",
5
5
  "author": "Thomas MUR",
6
6
  "description": "The AlignDev CLI: the assistant's playbook, coding-agent delegation, and project inventory.",
@@ -24,7 +24,7 @@
24
24
  "engines": {
25
25
  "node": ">=22.11.0"
26
26
  },
27
- "packageManager": "npm@11.19.0",
27
+ "packageManager": "npm@12.2.0",
28
28
  "type": "module",
29
29
  "bin": {
30
30
  "aligndev": "bin/aligndev.mjs"
@@ -38,9 +38,9 @@
38
38
  "access": "public"
39
39
  },
40
40
  "devDependencies": {
41
- "@types/node": "~24.13.3",
41
+ "@types/node": "~26.6.5",
42
42
  "rimraf": "~6.1.3",
43
43
  "typescript": "~7.0.2",
44
- "vitest": "~5.0.1"
44
+ "vitest": "~5.0.5"
45
45
  }
46
46
  }
@@ -193,15 +193,26 @@ The current coding agent is `{{AGENT}}`, profile `{{PROFILE}}`. A nonempty profi
193
193
 
194
194
  Effective profile: `{{PROFILE}}`; agent: `{{AGENT}}`; native configuration: `{{NATIVE_CONFIG}}`. Environment values are omitted. Login must use the same effective environment as the child: apply profile `unset/env/configDir`, including HOME, PATH and credential routing, from the same working directory. A bare login in another shell may use a different account.
195
195
 
196
- New-session, help, guide and quota selection: explicit `--profile` → project's registry selection → global `code.profile` → detected-agent `code.defaultProfiles` → detected built-in defaults. Resume inserts the latest run's recorded named profile before the global default. A missing selected profile is an error; profiles never merge. Help, guide and quota use the actual cwd and require no `.plans`.
196
+ New-session, help, guide and quota selection: explicit `--profile` → project's registry selection → global `code.profile` → automatic resolution. Resume inserts the latest run's recorded named profile before the global selection. A missing selected profile is an error; profiles never merge. Named choices bypass parent detection. Help, guide and quota use the actual cwd and require neither Git nor `.plans`.
197
197
 
198
- Profiles select native configuration/authentication through `configDir` or the corresponding effective environment variable: `CLAUDE_CONFIG_DIR`, `CODEX_HOME`, or `PI_CODING_AGENT_DIR`. `~/` uses the configured home; relative paths use the settings directory. Authenticate in this selected native configuration, not a different account. `env` values are literal non-secret configuration; `unset` removes inherited variables. Credentials remain in native stores or provisioned process environments. Parent identities are stripped after these overrides. Environment values are never recorded in session metadata.
198
+ Automatic resolution uses a sole profile matching the detected agent, or that agent's unique `default: true` among several profiles. Omitted and false flags are equivalent; at most one true flag per agent is allowed. With no matching profile, use that agent's built-ins. A profile for another agent never overrides the detected parent. Without a detected parent, only a sole total profile is inferred; several detected kinds require a named choice. A per-agent flag never chooses the agent kind.
199
199
 
200
- Select a user-facing model name, validate it against the accepted names, expand one `modelAliases` mapping, then apply native handling. Without a nonempty `models` override, Claude/Codex add alias names to their native default names; Pi accepts any nonblank selector. Pi exact provider-qualified IDs pin models; fuzzy selectors and thinking suffixes pass through to Pi. Use separate Pi profiles for Codex-backed and Anthropic-backed choices; AlignDev never guesses providers or accounts. Omitted quota uses a native Claude/Codex profile's environment; Pi needs explicit `quota.source: "codex"` or `"claude"`. `"none"` disables quota. Explicit quota starts from the caller environment, applies only quota `unset/env/configDir` and strips parent identities. It never copies coding-profile overrides or Pi credentials. Set quota `configDir` for the intended native account; omission deliberately keeps inherited/default storage. Quota paths follow profile expansion rules. Do not infer account pairing from model selection or retry against a different account after failure.
200
+ Historical resumes with a null or missing profile use detected built-ins unless an explicit, project or global named choice replaces them. They ignore profile counts and flags, still require one detected parent and keep null in the new record. Original transcripts remain unchanged. A deleted recorded name requires an explicit or project replacement; global settings and inference cannot rescue it.
201
+
202
+ Profiles select native configuration/authentication through `CLAUDE_CONFIG_DIR`, `CODEX_HOME`, or `PI_CODING_AGENT_DIR`. For ordinary setup, omit `configDir`: inherit the caller's variable unless `env` or `unset` changes it; otherwise native defaults apply. `configDir: null` deliberately removes the variable to force native-default directory behavior. A string resolves and sets it, even when naming the default path. `~/` uses the configured home; relative paths use the settings directory. A string or null conflicts with the matching variable in `env` or `unset`. `env` values are literal non-secret configuration; credentials remain in native stores or provisioned process environments. Parent identities are stripped after these overrides. Environment values are never recorded in session metadata.
203
+
204
+ On macOS, explicitly setting Claude's default path can select different Keychain credentials from leaving `CLAUDE_CONFIG_DIR` unset. Strings remain valid deliberate selections; confirm the intended mode before changing one. A null reset changes only directory routing, not HOME, PATH or API-key precedence. There is no automatic login, credential transfer or settings rewrite.
205
+ {{#openclaw}}
206
+ Deployment settings require null or an explicit string for every coding profile and enabled explicit quota source. Generated service defaults use null. Inventory paths remain absolute filesystem paths; native commands must unset the directory variable for null or set its resolved value for a string. Shared paths do not imply the same invocation mode.
207
+ {{/openclaw}}
208
+
209
+ Select a user-facing model name, validate it against the accepted names, expand one `modelAliases` mapping, then apply native handling. Without a nonempty `models` override, Claude/Codex add alias names to their native default names; Pi accepts any nonblank selector. Pi exact provider-qualified IDs pin models; fuzzy selectors and thinking suffixes pass through to Pi. Use separate Pi profiles for Codex-backed and Anthropic-backed choices; AlignDev never guesses providers or accounts. Omitted quota uses a native Claude/Codex profile's environment; Pi needs explicit `quota.source: "codex"` or `"claude"`. `"none"` disables quota. Explicit quota starts from the caller environment, applies only quota `unset/env/configDir` and strips parent identities. It never copies coding-profile overrides or Pi credentials. Choose quota storage only when needed: omitted `configDir` inherits independently from the original caller, null removes the source's directory variable, and a string selects explicit storage. Coding and explicit-quota resets do not affect each other. Disabled quota accepts no other fields, including `configDir: null`. Quota paths follow profile expansion rules. Do not infer account pairing from model selection or retry against a different account after failure.
201
210
 
202
211
  Resume keeps the latest user-facing model unless `--model` replaces it; new-session defaults are ignored. A retained name disallowed by the selected profile requires an explicit accepted replacement. Null keeps the native conversation model. Retained aliases use current mappings, which can change their native targets. Resume requires the same agent and native identity; Pi also requires its recorded real directory. An unavailable conversation fails under the selected account with no fallback, copying or replacement conversation. Run metadata records the effective profile (or null), agent, model name, native ID and cwd. Historical records stay readable; status does not validate launch profiles.
203
212
 
204
- Direct launch keys under `code` are retired. Move them into `code.profiles.<name>` and select the name with `code.profile`; no automatic conversion occurs.
213
+ Unknown or obsolete settings keys are ignored with value-free warnings on stderr at each fixed settings/profile/quota shape; profile, environment and alias dictionaries remain maps. Recognized invalid values and duplicate defaults still fail. Settings are never rewritten.
214
+
215
+ Direct launch keys and `code.defaultProfiles` are retired and ignored; they supply no legacy behavior. Move launch keys into `code.profiles.<name>`. Move needed per-agent preferences onto matching profiles as `default: true`, omitting singleton flags, and remove the map. Keep profile names unchanged; no automatic conversion occurs. Unique-profile inference can now select configured storage, model, environment and permission settings for new runs that previously used built-ins. Historical null-profile resumes retain their built-in fallback.
205
216
 
206
217
  `contextTokens` is what the run left in the agent's context window, measured from its last model response. It describes the conversation, so resuming a session carries the figure forward and each run reports a larger one.
207
218