@clipboard-health/groundcrew 4.51.0 → 4.52.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 +1 -1
- package/dist/commands/eligibility.d.ts +2 -2
- package/dist/commands/eligibility.d.ts.map +1 -1
- package/dist/commands/eligibility.js +6 -3
- package/dist/lib/config.d.ts +2 -0
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +12 -2
- package/docs/configuration.md +13 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -81,7 +81,7 @@ Stop or finish every active Groundcrew task and save work in every other tmux se
|
|
|
81
81
|
Linear works out of the box: assign tasks to yourself and add an `agent-*` label.
|
|
82
82
|
|
|
83
83
|
- `agent-claude`, `agent-codex`, `agent-pi`, or `agent-<name>` routes to that enabled launch profile.
|
|
84
|
-
- `agent-any` routes to the enabled agent with the
|
|
84
|
+
- `agent-any` routes to the enabled agent with the lowest weighted session score, after skipping agents over their session limit or weekly paced budget. See [agent weights](./docs/configuration.md#agent-label-routing).
|
|
85
85
|
- Tasks without an `agent-*` label are ignored by `crew run`; dispatch one manually with `crew start <TASK>`.
|
|
86
86
|
|
|
87
87
|
Agent names are launch profiles, so you can use them to pick model tiers. For example,
|
|
@@ -77,9 +77,9 @@ interface BlockerClassification {
|
|
|
77
77
|
skips: SkipVerdict[];
|
|
78
78
|
}
|
|
79
79
|
/**
|
|
80
|
-
* Pick the configured agent with the
|
|
80
|
+
* Pick the configured agent with the lowest weighted session score.
|
|
81
81
|
* Agents flagged exhausted (over `sessionLimitPercentage`) are excluded.
|
|
82
|
-
* Score is `usage[agent].session
|
|
82
|
+
* Score is `(usage[agent].session ?? 0) / (weight ?? 1)`, with missing usage treated as 0
|
|
83
83
|
* (maximum headroom), so when no usage data is available every agent
|
|
84
84
|
* ties at 0 and the default agent wins the tiebreak — `agent-any` then
|
|
85
85
|
* falls back to the default predictably.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"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AC;IAC1C,cAAc,EAAE,cAAc,CAAC;IAC/B,KAAK,EAAE,YAAY,CAAC;IACpB,oDAAoD;IACpD,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACvB,qDAAqD;IACrD,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,UAAU,qBAAqB;IAC7B,SAAS,EAAE,eAAe,EAAE,CAAC;IAC7B,KAAK,EAAE,WAAW,EAAE,CAAC;CACtB;AAgCD;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,cAAc,EACtB,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,GACrB,MAAM,GAAG,SAAS,CAkBpB;AAaD,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,cAAc,EACtB,KAAK,EAAE,YAAY,GAClB,oBAAoB,EAAE,CA2CxB;AA6CD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,SAAS,eAAe,EAAE,GAAG,qBAAqB,CAYxF;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,iBAAiB,GAAG,OAAO,EAAE,CAgE5E"}
|
|
@@ -40,9 +40,9 @@ function blockerVerdictFor(issue) {
|
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
42
|
/**
|
|
43
|
-
* Pick the configured agent with the
|
|
43
|
+
* Pick the configured agent with the lowest weighted session score.
|
|
44
44
|
* Agents flagged exhausted (over `sessionLimitPercentage`) are excluded.
|
|
45
|
-
* Score is `usage[agent].session
|
|
45
|
+
* Score is `(usage[agent].session ?? 0) / (weight ?? 1)`, with missing usage treated as 0
|
|
46
46
|
* (maximum headroom), so when no usage data is available every agent
|
|
47
47
|
* ties at 0 and the default agent wins the tiebreak — `agent-any` then
|
|
48
48
|
* falls back to the default predictably.
|
|
@@ -52,7 +52,10 @@ export function pickBestAgent(config, usage, exhausted) {
|
|
|
52
52
|
if (candidates.length === 0) {
|
|
53
53
|
return undefined;
|
|
54
54
|
}
|
|
55
|
-
const scored = candidates.map((name) => ({
|
|
55
|
+
const scored = candidates.map((name) => ({
|
|
56
|
+
name,
|
|
57
|
+
score: (usage[name]?.session ?? 0) / (config.agents.definitions[name]?.weight ?? 1),
|
|
58
|
+
}));
|
|
56
59
|
return scored.reduce((best, candidate) => {
|
|
57
60
|
if (candidate.score < best.score) {
|
|
58
61
|
return candidate;
|
package/dist/lib/config.d.ts
CHANGED
|
@@ -117,6 +117,8 @@ export interface AgentDefinition {
|
|
|
117
117
|
*/
|
|
118
118
|
preLaunchEnv?: string[];
|
|
119
119
|
color: string;
|
|
120
|
+
/** Positive finite divisor for agent-any session scoring; defaults to 1 when omitted. */
|
|
121
|
+
weight?: number;
|
|
120
122
|
usage?: {
|
|
121
123
|
codexbar: {
|
|
122
124
|
provider: string;
|
package/dist/lib/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAO1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEvD,eAAO,MAAM,wBAAwB,YAAI,oBAAoB,EAAE,qBAAqB,CAAU,CAAC;AAE/F;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,Q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FileSync } from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { pathToFileURL } from "node:url";
|
|
5
|
+
import { inspect } from "node:util";
|
|
5
6
|
import { cosmiconfig } from "cosmiconfig";
|
|
6
7
|
import { expandHome } from "./paths.js";
|
|
7
8
|
import { debug, log, readEnvironmentVariable, setLogFile } from "./util.js";
|
|
@@ -477,6 +478,9 @@ function buildOverrideCandidate(name, override, existing) {
|
|
|
477
478
|
if (override.color !== undefined) {
|
|
478
479
|
candidate.color = override.color;
|
|
479
480
|
}
|
|
481
|
+
if (override.weight !== undefined) {
|
|
482
|
+
candidate.weight = override.weight;
|
|
483
|
+
}
|
|
480
484
|
if (override.usage !== undefined) {
|
|
481
485
|
if (isUsageDisableSentinel(override.usage)) {
|
|
482
486
|
delete candidate.usage;
|
|
@@ -511,7 +515,7 @@ function mergeDefinitions(user) {
|
|
|
511
515
|
failIfLegacyModelKeys(name, override);
|
|
512
516
|
const builtIn = BUILT_IN_AGENT_DEFINITIONS[name];
|
|
513
517
|
const candidate = buildOverrideCandidate(name, override, builtIn);
|
|
514
|
-
const { cmd, color, usage, sandbox, resumeArgs, preLaunch, preLaunchEnv } = candidate;
|
|
518
|
+
const { cmd, color, weight, usage, sandbox, resumeArgs, preLaunch, preLaunchEnv } = candidate;
|
|
515
519
|
if (typeof cmd !== "string" || cmd.length === 0) {
|
|
516
520
|
fail(`agents.definitions.${name}.cmd must be a non-empty string`);
|
|
517
521
|
}
|
|
@@ -519,6 +523,12 @@ function mergeDefinitions(user) {
|
|
|
519
523
|
fail(`agents.definitions.${name}.color must be a non-empty string`);
|
|
520
524
|
}
|
|
521
525
|
const definition = { cmd, color };
|
|
526
|
+
if (weight !== undefined) {
|
|
527
|
+
if (typeof weight !== "number" || !Number.isFinite(weight) || weight <= 0) {
|
|
528
|
+
fail(`agents.definitions.${name}.weight must be a positive finite number (got ${typeof weight === "string" ? JSON.stringify(weight) : inspect(weight)})`);
|
|
529
|
+
}
|
|
530
|
+
definition.weight = weight;
|
|
531
|
+
}
|
|
522
532
|
if (usage !== undefined) {
|
|
523
533
|
definition.usage = usage;
|
|
524
534
|
}
|
|
@@ -832,7 +842,7 @@ function validate(config) {
|
|
|
832
842
|
fail("agents.definitions must contain at least one agent");
|
|
833
843
|
}
|
|
834
844
|
if (Object.hasOwn(definitions, AGENT_ANY)) {
|
|
835
|
-
fail(`agents.definitions cannot contain "${AGENT_ANY}" — it is reserved for the agent-any label, which routes to the agent with the
|
|
845
|
+
fail(`agents.definitions cannot contain "${AGENT_ANY}" — it is reserved for the agent-any label, which routes to the agent with the lowest weighted session score`);
|
|
836
846
|
}
|
|
837
847
|
for (const [name, definition] of Object.entries(definitions)) {
|
|
838
848
|
requireString(definition.cmd, `agents.definitions.${name}.cmd`);
|
package/docs/configuration.md
CHANGED
|
@@ -95,12 +95,23 @@ The "Loaded config from ..." line at startup tells you which config won.
|
|
|
95
95
|
## Agent Label Routing
|
|
96
96
|
|
|
97
97
|
- `agent-claude`, `agent-codex`, `agent-pi`, or `agent-<name>` routes to that enabled launch profile.
|
|
98
|
-
- `agent-any` routes to the agent with the
|
|
98
|
+
- `agent-any` routes to the agent with the lowest weighted session score, after skipping agents over their session limit or weekly paced budget.
|
|
99
99
|
- Unknown `agent-<name>` falls back to `agents.default`.
|
|
100
100
|
- A built-in `agent-<name>` label whose agent is not enabled falls back to `agents.default` with a warning.
|
|
101
101
|
- No `agent-*` label is ignored by `crew run`. Dispatch on demand with `crew start <TASK>`, which falls back to `agents.default`.
|
|
102
102
|
- Todo tasks blocked by non-terminal blockers are skipped until their blockers reach a terminal status.
|
|
103
103
|
|
|
104
|
+
Bias `agent-any` with `agents.definitions.<name>.weight`, a positive finite number.
|
|
105
|
+
The score is `(session usage ?? 0) / (weight ?? 1)`; lower wins, with exact ties
|
|
106
|
+
going to `agents.default`. Omitted weight behaves as `1` and remains undefined
|
|
107
|
+
in the resolved definition. Missing or null session usage counts as zero.
|
|
108
|
+
|
|
109
|
+
For example, enable `claude: { weight: 2 }` alongside `codex: {}` to make Claude
|
|
110
|
+
look half as busy. Claude at 50% session usage then beats Codex at 30%; Claude
|
|
111
|
+
wins until its usage reaches twice Codex's, when the default breaks the tie.
|
|
112
|
+
Weight only affects ranking: `sessionLimitPercentage` exhaustion and weekly
|
|
113
|
+
paced budget gating still use unweighted usage.
|
|
114
|
+
|
|
104
115
|
Agent names are launch profiles, not just vendor names. To choose a model per
|
|
105
116
|
task, define model-specific profiles and route tasks to them:
|
|
106
117
|
|
|
@@ -332,6 +343,7 @@ and hook contract.
|
|
|
332
343
|
| `orchestrator.sessionLimitPercentage` | `85` | Number in `(0, 100]`. An agent whose codexbar session window exceeds this percentage is skipped that tick. Agents are also skipped when codexbar reports weekly usage over the current weekly paced budget. |
|
|
333
344
|
| `agents.default` | `"claude"` | Tiebreak for `agent-any` resolution and fallback for explicit but unknown `agent-*` labels. Also used by `crew start <TASK>` for unlabeled tasks. `crew run` ignores unlabeled tasks and does not apply this default. Must exist in `agents.definitions`. If you enable only `codex`, set `default: "codex"`. |
|
|
334
345
|
| `agents.definitions` | **required** | Enabled launch profile set. Built-in keys (`claude`, `codex`, `cursor`, `cursor-grok`, `pi`) can use `{}` to opt into the shipped preset. Custom profile names must provide `cmd` and `color`; use custom profiles such as `claude-fable` and `claude-opus` to select model-specific commands per task. |
|
|
346
|
+
| `agents.definitions.<name>.weight` | `1` (when omitted) | Positive finite number dividing session usage for `agent-any` ranking. Higher weight favors an agent; session and weekly exhaustion gates are unchanged. |
|
|
335
347
|
| `agents.definitions.<name>.cmd` | preset for built-ins | Shell command launched for the agent. Required for custom profiles. Runs in the worktree through the resolved `local.runner`. `{{worktree}}` is replaced before launch; `{{sandbox}}` expands to the sbx sandbox name under the sdx runner and an empty string otherwise. |
|
|
336
348
|
| `agents.definitions.<name>.color` | preset for built-ins | Color for the workspace status pill (cmux only; tmux and zellij silently drop it). Required for custom profiles. |
|
|
337
349
|
| `agents.definitions.<name>.usage` | preset for built-ins | If set, codexbar usage is fetched for this agent and gated by `sessionLimitPercentage` plus the weekly paced budget when codexbar exposes a weekly window. When `usage.codexbar.source` is omitted, groundcrew uses `oauth` for Codex on macOS, `cli` for Claude on macOS (its OAuth probe breaks whenever the token rotates, and codexbar's CLI cannot refresh it), `auto` for other macOS providers, and `cli` elsewhere. Set to `{ disabled: true }` to disable usage gating while keeping the agent enabled. |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clipboard-health/groundcrew",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.52.0",
|
|
4
4
|
"description": "Linear-driven orchestrator that launches AI coding agents in git worktrees, with workspace lifecycle and usage tracking.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"agent-trust": "1.0.0",
|
|
75
75
|
"cosmiconfig": "10.0.1",
|
|
76
76
|
"tslib": "2.8.1",
|
|
77
|
-
"zod": "4.5
|
|
77
|
+
"zod": "4.6.5"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
80
|
"@clipboard-health/ai-rules": "2.46.2",
|