@workit-dev/opencode 2.13.0 → 2.14.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.
|
@@ -39,7 +39,7 @@ units of ~100+ lines each. Coupled work stays with one owner. Workit never spawn
|
|
|
39
39
|
6. **Retry once, then escalate.** A stuck or failed slice gets one retry with
|
|
40
40
|
a fresh brief (`workit fanout brief <slice> --mode resume`, same branch);
|
|
41
41
|
if that fails too, re-slice it, take it over, or report the gap. Never
|
|
42
|
-
chain resumes. A fix round and recheck that both fail:
|
|
42
|
+
chain resumes. A fix round and recheck that both fail: the decider agent, not a
|
|
43
43
|
third round; product choices go to the user (`references/orchestration.md`).
|
|
44
44
|
7. **Verify by the workspace `verification` setting** (`workit grant show`).
|
|
45
45
|
A report is a pointer, never evidence. `proportional` (default): each slice's lane (`workit pr status`) decides; none needs no verdict, self the author's `--self`, focused and full a verifier (Claude Code: the `model` and `effort` of `workit models show --role verifier`) after the last push; one verdict at a stack's top covers its unchanged lower PRs, and a stale one with `reverify: focused` re-checks only the new diff, reusing green CI. `self`: a verifier that wrote none
|
|
@@ -5,35 +5,37 @@ and fans in. Workit records and checks; the host's own subagents run the work.
|
|
|
5
5
|
|
|
6
6
|
## TIER to model
|
|
7
7
|
|
|
8
|
-
TIER is a field of each slice and of its brief.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
| Role or TIER |
|
|
8
|
+
TIER is a field of each slice and of its brief. Each Workit role is a host
|
|
9
|
+
agent that carries its own model: spawn it by name and pass no `model` or
|
|
10
|
+
`effort` unless the user named one (a named model always wins).
|
|
11
|
+
|
|
12
|
+
| Host | Spawn by name |
|
|
13
|
+
| --- | --- |
|
|
14
|
+
| Claude Code | `workit:implementer`, `workit:verifier`, `workit:reviewer`, `workit:decider`, `workit:babysitter`; search: `Explore` |
|
|
15
|
+
| OpenCode | `workit-implementer`, `workit-verifier`, `workit-reviewer`, `workit-decider`, `workit-babysitter` |
|
|
16
|
+
| Codex | the same `workit-*` names |
|
|
17
|
+
| Cursor | `workit-verifier`, `workit-reviewer`, `workit-decider`, `workit-babysitter` |
|
|
18
|
+
|
|
19
|
+
Claude Code, with nothing configured (pass a brief's `SPAWN:` line as printed):
|
|
20
|
+
|
|
21
|
+
| Role or TIER | Model |
|
|
22
22
|
| --- | --- |
|
|
23
|
-
| decider | `fable`, effort `high` |
|
|
24
|
-
| hard | `opus` |
|
|
25
|
-
| standard | `sonnet` |
|
|
26
|
-
| mundane | `haiku` |
|
|
27
|
-
|
|
|
28
|
-
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
`
|
|
35
|
-
`models.
|
|
36
|
-
|
|
23
|
+
| decider | `fable`, effort `high` (agent file) |
|
|
24
|
+
| hard | `opus` (the brief's SPAWN line) |
|
|
25
|
+
| standard, verifier | `sonnet` (agent file) |
|
|
26
|
+
| mundane | `haiku` (the brief's SPAWN line) |
|
|
27
|
+
| reviewer | `opus` (agent file) |
|
|
28
|
+
| babysitter | `haiku` (agent file) |
|
|
29
|
+
|
|
30
|
+
A role
|
|
31
|
+
configured in `models.roles` to another model is listed in your session
|
|
32
|
+
contract (Claude Code) or set on the host's agent (OpenCode, Codex); `workit
|
|
33
|
+
models show [--role r] [--host h]` prints per host whether it comes from the
|
|
34
|
+
`agent file`, a `spawn fill` or is `advisory` (pass it yourself), and the
|
|
35
|
+
`models.enforce` mode. Under `strict` a configured role model beats a named
|
|
36
|
+
one and Claude Code's auto mode denies a spawn that lacks it. A role with no
|
|
37
|
+
model runs on the host's model, and TIER only sizes the timebox and decides
|
|
38
|
+
whether to race. `models.lead` (your own model) is advisory.
|
|
37
39
|
|
|
38
40
|
## Rolling window
|
|
39
41
|
|
|
@@ -66,10 +68,9 @@ reversibility (the option cheapest to undo wins a tie), and the exact change
|
|
|
66
68
|
list. The fixer applies that list once, then one focused recheck follows.
|
|
67
69
|
|
|
68
70
|
- Hard call (shared contract, security, migration): two deciders on different
|
|
69
|
-
models (Claude Code, OpenCode, Cursor:
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
more reversible option.
|
|
71
|
+
models (Claude Code, OpenCode, Cursor: one bare decider spawn and one that
|
|
72
|
+
names another `model`; Codex and Pi: one decider). If they disagree, you
|
|
73
|
+
take the more reversible option.
|
|
73
74
|
- Record it: `workit ledger decision "<pick>" --by decider --why "<why it is
|
|
74
75
|
the more reversible>" --view "<decider A: view>" --view "<decider B: view>"`.
|
|
75
76
|
The row is listed as a decider call; it is never the user's answer to a
|
|
@@ -45,7 +45,7 @@ those files since the judged head and reuse green CI there (no fresh install, no
|
|
|
45
45
|
under your own session (the one the lead or the hook gave you).
|
|
46
46
|
8. **Bound the loop.** A failed verdict gets one fix round and one recheck of
|
|
47
47
|
the changed hunks. Still failing, or stuck: no third round; the lead spawns
|
|
48
|
-
|
|
48
|
+
the decider agent by name, no model (call the skill tool with `workit-fanout`). A product choice: the user.
|
|
49
49
|
9. **Harness note** (optional): friction caused by the repo or harness, not
|
|
50
50
|
the change (a flaky fixture, a missing check, a misleading doc or skill
|
|
51
51
|
line), goes on its own `Harness note:` line in the report and any PR
|
|
@@ -29,7 +29,7 @@ once the verdict is accepted. `merged`: step 7. `null` (closed, not merged):
|
|
|
29
29
|
stop and report. Stop early only for a new consequential choice, a host
|
|
30
30
|
denial, a review comment that needs a product decision, a required update
|
|
31
31
|
that repeats because the base keeps moving, or after 3 failed fix attempts on
|
|
32
|
-
the same check. Fix round and recheck both failed:
|
|
32
|
+
the same check. Fix round and recheck both failed: the decider agent (call the skill tool with `workit-fanout`).
|
|
33
33
|
|
|
34
34
|
1. **Open.** Last before the PR, if `workit grant show` has `changelog: update|create`: write the Unreleased entry with `workit changelog apply`, commit it; with `docs: when-user-facing` fix only docs the diff made false (`references/changelog.md`).
|
|
35
35
|
Full local check (`workit check ci` when `.workit/checks.json` has a `ci` group), push once: `workit git push`, then `workit pr template` and fill the template it prints: every heading, each `<!-- -->` replaced (Workit's: `references/pr-body.md`).
|
package/dist/plugin.js
CHANGED
|
@@ -9500,7 +9500,7 @@ var workspaceConfigSchema = object({
|
|
|
9500
9500
|
fanout: object({
|
|
9501
9501
|
tierModels: unknown().optional().describe("The model per slice TIER (mundane, standard, hard), as one name or per host.")
|
|
9502
9502
|
}).passthrough().optional().describe("Fanout settings."),
|
|
9503
|
-
models: object({ roles: modelRoles }).passthrough().optional().describe("Model and effort per role and host (roles), the lead's own advisory model (lead) and whether a model the lead names on a spawn wins (allowLeadOverride, default false); the same key at the top of workspaces.json is the global default."),
|
|
9503
|
+
models: object({ roles: modelRoles }).passthrough().optional().describe("Model and effort per role and host (roles), the lead's own advisory model (lead), how a role model applies (enforce: advise, the default, or strict) and, under strict, whether a model the lead names on a spawn wins (allowLeadOverride, default false); the same key at the top of workspaces.json is the global default."),
|
|
9504
9504
|
resources: unknown().optional().describe("Heavy-check limits on this machine: slots, scope, heavy, light, memoryMax, cpuQuota, wait."),
|
|
9505
9505
|
remotes: array(nonBlank.refine((pattern) => remotePattern(pattern) !== null, "is not a remote URL (https://host/owner/repo, git@host:owner/repo, a path, or owner/*)")).optional().describe("Remote URLs this entry owns: a checkout pushing to or opening PRs on one never exceeds this entry's grants, wherever the folder is (`owner/*` claims a whole owner). Only the user changes it, in their own terminal."),
|
|
9506
9506
|
autonomy: object(Object.fromEntries(["push", "pr", "merge", "release", "rerun"].map((kind) => [
|
|
@@ -9538,7 +9538,7 @@ var workspaceConfigSchema = object({
|
|
|
9538
9538
|
});
|
|
9539
9539
|
var workspacesFileSchema = object({
|
|
9540
9540
|
workspaces: array(workspaceConfigSchema).optional().describe("Workspace entries, each mapping a path glob to its forge, policies and grants."),
|
|
9541
|
-
models: object({ roles: modelRoles }).passthrough().optional().describe("The global default model and effort per role and host (roles), the lead's own advisory model (lead) and whether a model the lead names on a spawn wins (allowLeadOverride, default false).")
|
|
9541
|
+
models: object({ roles: modelRoles }).passthrough().optional().describe("The global default model and effort per role and host (roles), the lead's own advisory model (lead), how a role model applies (enforce: advise, the default, or strict) and, under strict, whether a model the lead names on a spawn wins (allowLeadOverride, default false).")
|
|
9542
9542
|
}).passthrough().superRefine((file, context) => {
|
|
9543
9543
|
const names = new Set;
|
|
9544
9544
|
for (const [index, workspace] of (file.workspaces ?? []).entries()) {
|
|
@@ -9552,6 +9552,7 @@ var workspacesFileSchema = object({
|
|
|
9552
9552
|
names.add(workspace.name);
|
|
9553
9553
|
}
|
|
9554
9554
|
});
|
|
9555
|
+
var workspacesPath = () => path9.join(configDir2(), "workspaces.json");
|
|
9555
9556
|
var workspacesRevision = (contents) => createHash5("sha256").update(contents ?? "<missing>").digest("hex");
|
|
9556
9557
|
var validateWorkspacesDocument = (parsed, file) => {
|
|
9557
9558
|
if (!isConfigObject(parsed)) {
|
|
@@ -10466,7 +10467,7 @@ function resolveTrackFor(cwd, options) {
|
|
|
10466
10467
|
}
|
|
10467
10468
|
|
|
10468
10469
|
// packages/workit-core/src/core/vcs-config.ts
|
|
10469
|
-
var
|
|
10470
|
+
var workspacesPath2 = () => path10.join(configDir2(), "workspaces.json");
|
|
10470
10471
|
var vcsCwd = (cwd) => cwd ?? process.env.WORKIT_WORKSPACE_ROOT ?? process.cwd();
|
|
10471
10472
|
var remoteProvider = (cwd) => {
|
|
10472
10473
|
const url = originUrl(cwd) ?? "";
|
|
@@ -10644,7 +10645,7 @@ function vcsConfig(mode, cwd, options = {}) {
|
|
|
10644
10645
|
defaultBranch: workspaceDefault
|
|
10645
10646
|
});
|
|
10646
10647
|
if (trackResolution.status === "invalid")
|
|
10647
|
-
return { ok: false, error: trackResolution.error, configPath:
|
|
10648
|
+
return { ok: false, error: trackResolution.error, configPath: workspacesPath2() };
|
|
10648
10649
|
const releaseTrack = trackSummary(trackResolution);
|
|
10649
10650
|
const defaultTarget = releaseTrack?.track?.pullRequestTarget ?? workspaceDefault;
|
|
10650
10651
|
const baseBranch = releaseTrack?.track?.baseBranch ?? defaultTarget;
|
|
@@ -18077,16 +18078,19 @@ var HOST_KEYS = new Set([
|
|
|
18077
18078
|
"pi",
|
|
18078
18079
|
"default"
|
|
18079
18080
|
]);
|
|
18080
|
-
var
|
|
18081
|
+
var CLAUDE_AGENT_FILES = {
|
|
18081
18082
|
decider: { model: "fable", effort: "high" },
|
|
18082
|
-
|
|
18083
|
-
"implementer.standard": { model: "sonnet" },
|
|
18084
|
-
"implementer.mundane": { model: "haiku" },
|
|
18083
|
+
implementer: { model: "sonnet" },
|
|
18085
18084
|
verifier: { model: "sonnet" },
|
|
18086
18085
|
reviewer: { model: "opus" },
|
|
18087
|
-
explore: { model: "haiku" },
|
|
18088
18086
|
babysit: { model: "haiku" }
|
|
18089
18087
|
};
|
|
18088
|
+
var BUILT_IN_CLAUDE_CODE = {
|
|
18089
|
+
...CLAUDE_AGENT_FILES,
|
|
18090
|
+
"implementer.hard": { model: "opus" },
|
|
18091
|
+
"implementer.standard": { model: "sonnet" },
|
|
18092
|
+
"implementer.mundane": { model: "haiku" }
|
|
18093
|
+
};
|
|
18090
18094
|
var isObject6 = (value) => !!value && typeof value === "object" && !Array.isArray(value);
|
|
18091
18095
|
var name = (value) => typeof value === "string" && value.trim() ? value.trim() : null;
|
|
18092
18096
|
var leaf = (value) => {
|
|
@@ -18170,6 +18174,7 @@ var firstAvailable = (candidates, host, now = new Date) => {
|
|
|
18170
18174
|
}
|
|
18171
18175
|
return { ...primary, skipped, allExhausted: true };
|
|
18172
18176
|
};
|
|
18177
|
+
var resolveAvailableRoleModel = (cwd, selector, host, now = new Date, dir) => firstAvailable(resolveRoleModels(cwd, selector, host, dir), host, now);
|
|
18173
18178
|
var fallbackText = (chosen) => {
|
|
18174
18179
|
if (!chosen.skipped.length)
|
|
18175
18180
|
return null;
|
|
@@ -18208,12 +18213,15 @@ var leadSwitchNotice = (cwd, host, current, now = new Date, dir) => {
|
|
|
18208
18213
|
const how = SWITCH_HOW[hostFamily(host) ?? ""] ?? "the host's model switch";
|
|
18209
18214
|
return next ? `Workit cannot switch this session's model: ${blocked.provider} is exhausted until ${shortTime(blocked.until)}. Switch the lead to ${next.model} with ${how}${hostFamily(host) === "claude_code" && providerOf(next.model, host) !== "anthropic" ? " (another host: Claude Code runs only Anthropic models)" : ""}.` : `Workit cannot switch this session's model: ${blocked.provider} is exhausted until ${shortTime(blocked.until)}, and models.lead names no model of another provider. Add one to models.lead in workspaces.json, then run \`workit models show\`.`;
|
|
18210
18215
|
};
|
|
18211
|
-
var
|
|
18216
|
+
var modelsKey = (cwd, key, dir) => {
|
|
18212
18217
|
for (const source of modelSources(cwd, dir))
|
|
18213
|
-
if (isObject6(source.models) && Object.hasOwn(source.models,
|
|
18214
|
-
return source.models
|
|
18215
|
-
return
|
|
18218
|
+
if (isObject6(source.models) && Object.hasOwn(source.models, key))
|
|
18219
|
+
return source.models[key];
|
|
18220
|
+
return;
|
|
18216
18221
|
};
|
|
18222
|
+
var leadOverrideAllowed = (cwd, dir) => modelsKey(cwd, "allowLeadOverride", dir) === true;
|
|
18223
|
+
var enforceMode = (cwd, dir) => modelsKey(cwd, "enforce", dir) === "strict" ? "strict" : "advise";
|
|
18224
|
+
var FILE_ROLES = new Set(["decider", "verifier", "reviewer", "babysit"]);
|
|
18217
18225
|
var CLAUDE_ALIASES = new Set(["sonnet", "opus", "haiku", "fable"]);
|
|
18218
18226
|
var CLAUDE_EFFORTS = new Set(["low", "medium", "high", "xhigh", "max"]);
|
|
18219
18227
|
var FULL_CLAUDE_ID = /^(?:[\w.-]+[./])?claude-(?:\d[\d.-]*-)?(sonnet|opus|haiku|fable)(?:[-.@[]|$)/u;
|
|
@@ -18239,7 +18247,7 @@ var chooseSpawnModel = (cwd, selector, host, given, accept, dir) => {
|
|
|
18239
18247
|
const givenModel = name(given.model);
|
|
18240
18248
|
const label = roleLabel(selector);
|
|
18241
18249
|
const configured = resolved.source !== "built-in";
|
|
18242
|
-
if (givenModel && (!configured || leadOverrideAllowed(cwd, dir)))
|
|
18250
|
+
if (givenModel && (!configured || enforceMode(cwd, dir) === "advise" || leadOverrideAllowed(cwd, dir)))
|
|
18243
18251
|
return none;
|
|
18244
18252
|
const model = accept(resolved.model);
|
|
18245
18253
|
const effort = resolved.effort && !name(given.effort) ? resolved.effort : null;
|
|
@@ -18265,40 +18273,39 @@ var chooseSpawnModel = (cwd, selector, host, given, accept, dir) => {
|
|
|
18265
18273
|
model,
|
|
18266
18274
|
effort,
|
|
18267
18275
|
basis,
|
|
18268
|
-
note: givenModel ? `Workit replaced model ${givenModel} with ${model} on this spawn: role ${label} is set in ${resolved.source}.${why} Next time ${next} on the spawn
|
|
18269
|
-
};
|
|
18270
|
-
};
|
|
18271
|
-
var claudeSpawnArgs = (cwd, selector, dir) => {
|
|
18272
|
-
const choice = chooseSpawnModel(cwd, selector, "claude_code", {}, claudeAgentModel, dir);
|
|
18273
|
-
if (!choice.model)
|
|
18274
|
-
return null;
|
|
18275
|
-
const effort = choice.effort?.toLowerCase() ?? null;
|
|
18276
|
-
return {
|
|
18277
|
-
model: choice.model,
|
|
18278
|
-
effort: effort && CLAUDE_EFFORTS.has(effort) ? effort : null
|
|
18276
|
+
note: givenModel ? `Workit replaced model ${givenModel} with ${model} on this spawn: role ${label} is set in ${resolved.source}.${why} Next time ${next} on the spawn, or set models.enforce "advise" so a named model wins.` : `Workit set ${model}${effort ? ` (effort ${effort})` : ""} on this spawn: role ${label}, ${resolved.source}.${why}${configured ? "" : " Name a model to choose another."}`
|
|
18279
18277
|
};
|
|
18280
18278
|
};
|
|
18281
18279
|
var CLAUDE_SPAWNS = [
|
|
18282
|
-
...
|
|
18283
|
-
label:
|
|
18280
|
+
...MODEL_TIERS.map((tier) => ({
|
|
18281
|
+
label: `workit:implementer ${tier}`,
|
|
18284
18282
|
selector: { role: "implementer", tier }
|
|
18285
18283
|
})),
|
|
18286
|
-
|
|
18287
|
-
|
|
18284
|
+
...["verifier", "reviewer", "decider"].map((role) => ({
|
|
18285
|
+
label: `workit:${role}`,
|
|
18286
|
+
selector: { role }
|
|
18287
|
+
})),
|
|
18288
|
+
{ label: "workit:babysitter", selector: { role: "babysit" } },
|
|
18288
18289
|
{ label: "Explore", selector: { role: "explore" } },
|
|
18289
|
-
{ label: "ROLE: decider", selector: { role: "decider" } },
|
|
18290
|
-
{ label: "ROLE: babysit", selector: { role: "babysit" } },
|
|
18291
18290
|
{ label: "general-purpose", selector: { role: "default" } }
|
|
18292
18291
|
];
|
|
18293
18292
|
var claudeSpawnTable = (cwd, dir) => {
|
|
18294
18293
|
const rows = CLAUDE_SPAWNS.flatMap(({ label, selector }) => {
|
|
18295
|
-
const
|
|
18296
|
-
|
|
18294
|
+
const want = resolveRoleModel(cwd, selector, "claude_code", dir);
|
|
18295
|
+
const model = want && want.source !== "built-in" ? claudeAgentModel(want.model) : null;
|
|
18296
|
+
const effort = want?.effort?.toLowerCase();
|
|
18297
|
+
const file = label.startsWith("workit:") ? CLAUDE_AGENT_FILES[selector.role] : undefined;
|
|
18298
|
+
return model && (model !== file?.model || effort !== file.effort) ? [`${label} ${model}${effort ? `/${effort}` : ""}`] : [];
|
|
18297
18299
|
});
|
|
18298
|
-
return
|
|
18300
|
+
return `Spawn Workit roles by name (workit:implementer, workit:verifier, workit:reviewer, workit:decider, workit:babysitter; search: Explore), workers with run_in_background: true, and pass no model or effort unless the user named one${rows.length ? `; configured here (pass them): ${rows.join(", ")}` : ""}. Implementer prompt: \`workit fanout brief <slice>\` after \`workit fanout worktree create <slice>\`, even for one slice.`;
|
|
18301
|
+
};
|
|
18302
|
+
var uniformImplementerModel = (cwd, host, dir) => {
|
|
18303
|
+
const tiers = MODEL_TIERS.map((tier) => resolveRoleModel(cwd, { role: "implementer", tier }, host, dir));
|
|
18304
|
+
const [first] = tiers;
|
|
18305
|
+
return first && tiers.every((t) => t?.model === first.model && t.effort === first.effort) ? first : null;
|
|
18299
18306
|
};
|
|
18300
18307
|
var ROLE_SELECTORS = MODEL_ROLES.flatMap((role) => role === "implementer" ? MODEL_TIERS.map((tier) => ({ role, tier })) : [{ role }]);
|
|
18301
|
-
var AGENT_ROLE = /^(?:workit[:-])?(decider|implementer|verifier|reviewer|explore|babysit)
|
|
18308
|
+
var AGENT_ROLE = /^(?:workit[:-])?(decider|implementer|verifier|reviewer|explore|babysit)(?:(?<=babysit)ter)?$/iu;
|
|
18302
18309
|
var ROLE_LINE = /^[ \t]*ROLE:[ \t]*(decider|implementer|verifier|reviewer|explore|babysit)\b/imu;
|
|
18303
18310
|
var TIER_LINE = /^[ \t]*TIER:[ \t]*(mundane|standard|hard)\b/imu;
|
|
18304
18311
|
var isBrief = (text) => TIER_LINE.test(text) && /^WORKTREE:/mu.test(text);
|
|
@@ -32015,6 +32022,237 @@ var injectSkillNudge = (root, session, messages, system) => {
|
|
|
32015
32022
|
} catch {}
|
|
32016
32023
|
};
|
|
32017
32024
|
|
|
32025
|
+
// packages/workit-opencode/src/v2/agents.ts
|
|
32026
|
+
import { unwatchFile, watchFile } from "node:fs";
|
|
32027
|
+
|
|
32028
|
+
// packages/workit-claude-code/agents/babysitter.md
|
|
32029
|
+
var babysitter_default = "---\nname: babysitter\ndescription: Drives one pushed PR to its endpoint - polls its status, fixes red CI in the PR's own worktree, answers review threads - and reports when it is ready, merged or blocked. Use to babysit a PR in the background after it is opened.\nmodel: haiku\n---\n\nYou are the workit babysitter for one PR. Follow the workit-ship skill\n(`/workit:ship`): its babysit loop is your job.\n\n1. Work only in the checkout or worktree your prompt names, on the PR's own\n branch; never in another branch. Run Workit against it, one verb per call:\n `workit pr status --cwd <worktree> --json`, `workit check --cwd <worktree> <name>`,\n `workit git --cwd <worktree> commit …`.\n2. Act on `babysit` in `workit pr status --json`: wait, fix a red check at its\n root (reproduce it with `workit check` first), answer each unresolved thread,\n or stop at the endpoint your prompt names (`ready` by default).\n3. Merge only when your prompt or the grant says `merged`; never force-push,\n rebase or retarget unless your prompt says so.\n4. A fix you cannot make in one round, a product choice, or a check that stays\n red after one fix: stop and report it.\n\nBefore your final report, wait for or stop every background command you started\n(the host shows you running while one lives); never report with one still running.\n\nReport: the PR, its head SHA and endpoint, each check and thread you acted on,\nand anything left for the lead.\n";
|
|
32030
|
+
|
|
32031
|
+
// packages/workit-claude-code/agents/decider.md
|
|
32032
|
+
var decider_default = `---
|
|
32033
|
+
name: decider
|
|
32034
|
+
description: Fresh read-only decider for a stuck call - a failed fix round and recheck, or a worker and a reviewer who disagree - that returns the options, a pick by reversibility and the exact change list. Use instead of a third review round; never for a product choice.
|
|
32035
|
+
model: fable
|
|
32036
|
+
effort: high
|
|
32037
|
+
tools: Read, Grep, Glob, Bash, Skill
|
|
32038
|
+
disallowedTools: Write, Edit, NotebookEdit
|
|
32039
|
+
---
|
|
32040
|
+
|
|
32041
|
+
You are the workit decider. You wrote none of the work and change none of it:
|
|
32042
|
+
you read, decide and report. Follow the workit-fanout skill
|
|
32043
|
+
(\`/workit:fanout\`, "Stuck calls: the decider").
|
|
32044
|
+
|
|
32045
|
+
1. Read the dispute itself: the brief or acceptance, the diff
|
|
32046
|
+
(\`git -C <worktree> diff <base>...HEAD\`), the failed findings and the
|
|
32047
|
+
author's answer, and \`workit ledger list --type decision\`.
|
|
32048
|
+
2. List the real options (two or three), each with what it costs if wrong.
|
|
32049
|
+
3. Pick one by reversibility: the option cheapest to undo wins a tie.
|
|
32050
|
+
4. Give the exact change list for the pick: file, what changes, and the check
|
|
32051
|
+
that proves it, so the fixer applies it once.
|
|
32052
|
+
|
|
32053
|
+
A product choice, or authority nobody here has, is not yours: say so and name
|
|
32054
|
+
the question for the user. The lead records your pick with
|
|
32055
|
+
\`workit ledger decision\`; you record nothing.
|
|
32056
|
+
|
|
32057
|
+
Before your final report, wait for or stop every background command you started
|
|
32058
|
+
(the host shows you running while one lives); never report with one still running.
|
|
32059
|
+
|
|
32060
|
+
Never commit, push, merge or edit. Write only in your session's scratchpad.
|
|
32061
|
+
`;
|
|
32062
|
+
|
|
32063
|
+
// packages/workit-claude-code/agents/implementer.md
|
|
32064
|
+
var implementer_default = `---
|
|
32065
|
+
name: implementer
|
|
32066
|
+
description: Implements one scoped workit brief in the git worktree its lead made with \`workit fanout worktree create\`, and reports what changed and how it was checked. Use to delegate a well-defined slice (goal, scope, acceptance, verify, forbidden, report, worktree) so it can run in parallel with other work.
|
|
32067
|
+
model: sonnet
|
|
32068
|
+
---
|
|
32069
|
+
|
|
32070
|
+
You are a workit implementer. You work only in the git worktree your brief
|
|
32071
|
+
names (its WORKTREE line), which the lead made with
|
|
32072
|
+
\`workit fanout worktree create <slice>\` before spawning you; never in the
|
|
32073
|
+
lead's checkout.
|
|
32074
|
+
|
|
32075
|
+
Refuse to start without a complete brief. It must state: goal, scope (files
|
|
32076
|
+
or areas you may touch), acceptance (observable outcomes), verify (exact
|
|
32077
|
+
commands), timebox, forbidden (what you must not touch or do), report (what to
|
|
32078
|
+
hand back), standing orders, mode (\`new\` or \`resume\`) and the worktree path.
|
|
32079
|
+
If a field is missing, report which and stop.
|
|
32080
|
+
|
|
32081
|
+
1. In a Workit worktree (the default), run each git and check command against
|
|
32082
|
+
it, one verb per call:
|
|
32083
|
+
\`workit git --cwd <worktree> commit …\`, \`workit check --cwd <worktree> <name>\`
|
|
32084
|
+
(verb first, so the host's allow rules match).
|
|
32085
|
+
Never \`cd <worktree> && …\` chains, \`$VAR\` paths or compound commands. Edit
|
|
32086
|
+
files by their path under the worktree. Workit's hooks deny an edit or a
|
|
32087
|
+
mutating git command outside it.
|
|
32088
|
+
2. The worktree is already on the brief's branch. If it is not: \`MODE: new\`,
|
|
32089
|
+
\`workit git --cwd <worktree> branch <branch> --base <base>\`; \`MODE: resume\`
|
|
32090
|
+
(you replace a stopped worker), \`git -C <worktree> switch <branch>\` and
|
|
32091
|
+
continue from its head. A hook denies protected or non-compliant names;
|
|
32092
|
+
follow the unblock it prints.
|
|
32093
|
+
3. Stay inside the scope. Anything outside it is a follow-up in the report,
|
|
32094
|
+
not a diff. Follow the workit-implement skill (\`/workit:implement\`).
|
|
32095
|
+
4. Decide ambiguities yourself and record them:
|
|
32096
|
+
\`workit ledger ruling "<what>" --why "<why>" --cost-if-wrong "<cost>"\`.
|
|
32097
|
+
Stop only for an irreversible or security-sensitive action, or a side effect
|
|
32098
|
+
outside your worktree.
|
|
32099
|
+
5. Commit in small steps with
|
|
32100
|
+
\`workit git --cwd <worktree> commit -m "<conventional message>" -- <paths in scope>\`.
|
|
32101
|
+
Add Co-Authored-By in the same commit with
|
|
32102
|
+
\`workit git commit --trailer "Co-Authored-By: <name> <email>" -- <paths>\`
|
|
32103
|
+
(the brief's RULES give your host's exact line), never by amending.
|
|
32104
|
+
6. Run every verify command as \`workit check --cwd <worktree> …\` and keep the
|
|
32105
|
+
real exit codes.
|
|
32106
|
+
7. Never record a verdict on your own work and never pass \`--self\`: a separate
|
|
32107
|
+
verifier judges it. Never push, open a PR, rebase or merge unless the brief
|
|
32108
|
+
says so.
|
|
32109
|
+
|
|
32110
|
+
In a Claude Code host-isolated worktree (\`.claude/worktrees/agent-<id>\`,
|
|
32111
|
+
whose SubagentStart text says "Run git as plain") the rule flips: run git as
|
|
32112
|
+
plain commands there, never \`workit git …\` (Claude Code's isolation refuses a
|
|
32113
|
+
git wrapper), and keep workit for \`check\`, \`ledger\` and \`pr\`.
|
|
32114
|
+
|
|
32115
|
+
Before your final report, wait for or stop every background command you started
|
|
32116
|
+
(the host shows you running while one lives); never report with one still running.
|
|
32117
|
+
|
|
32118
|
+
Report: worktree, branch and head SHA, files changed, each verify command with
|
|
32119
|
+
its exit code, each acceptance item met or not, rulings recorded, and any
|
|
32120
|
+
deviation from the brief.
|
|
32121
|
+
`;
|
|
32122
|
+
|
|
32123
|
+
// packages/workit-claude-code/agents/reviewer.md
|
|
32124
|
+
var reviewer_default = `---
|
|
32125
|
+
name: reviewer
|
|
32126
|
+
description: Fresh-context reviewer for a workit branch or PR - spec fidelity and standards as separate axes, test quality and blast radius - that records findings and a non-author verdict. Use for independent review of a diff, branch or PR.
|
|
32127
|
+
model: opus
|
|
32128
|
+
tools: Read, Grep, Glob, Bash, Skill
|
|
32129
|
+
disallowedTools: Write, Edit, NotebookEdit
|
|
32130
|
+
---
|
|
32131
|
+
|
|
32132
|
+
You are the workit reviewer. Review the real candidate, not the author's
|
|
32133
|
+
account. Follow the workit-review skill (\`/workit:review\`).
|
|
32134
|
+
|
|
32135
|
+
1. Pin the candidate: \`git rev-parse HEAD\`, the base, \`git diff <base>...HEAD\`;
|
|
32136
|
+
for a PR, \`workit pr status --json\` (checks, unresolved threads).
|
|
32137
|
+
2. Read the intent: brief or acceptance, spec, PR body, and
|
|
32138
|
+
\`workit ledger list --type decision\`.
|
|
32139
|
+
3. Judge two axes separately: spec fidelity (missing, creep, wrong; quote the
|
|
32140
|
+
line) and standards (repo rules first, then smells). Then test quality
|
|
32141
|
+
(\`workit test-audit --diff\`) and blast radius: one fact plus one proof per
|
|
32142
|
+
touched contract or caller, run with \`workit check -- <cmd>\`; label anything
|
|
32143
|
+
unproven UNPROVEN.
|
|
32144
|
+
4. Each finding: file:line, severity (blocker, major, minor, nit), evidence
|
|
32145
|
+
(hunk, test or output), concrete fix.
|
|
32146
|
+
5. Record the verdict:
|
|
32147
|
+
start from the exact verdict command the SubagentStart hook gave you (it
|
|
32148
|
+
carries your session and \`--token=<token>\`; the token is yours alone: never put it in a report); it names \`--kind review\`:
|
|
32149
|
+
\`workit ledger verdict verified|failed|blocked --cwd <candidate worktree> --kind review --branch <b> --session <id> --token=<token> --how "<what you read and ran>"\`
|
|
32150
|
+
(\`verified\`: no blocker or major left).
|
|
32151
|
+
Record a design choice as \`workit ledger ruling\`.
|
|
32152
|
+
|
|
32153
|
+
Before your final report, wait for or stop every background command you started
|
|
32154
|
+
(the host shows you running while one lives); never report with one still running.
|
|
32155
|
+
|
|
32156
|
+
Never commit, push, merge or edit. Write only in the candidate
|
|
32157
|
+
worktree's \`.workit-scratch/\` or your session's scratchpad: test cases go into files there via a quoted heredoc
|
|
32158
|
+
(\`<<'EOF'\`), never run by the shell. A \`node -e\` or \`python3 -c\` that only reads runs anywhere. If the ledger refuses you as an author, report that instead of a verdict.
|
|
32159
|
+
`;
|
|
32160
|
+
|
|
32161
|
+
// packages/workit-claude-code/agents/verifier.md
|
|
32162
|
+
var verifier_default = `---
|
|
32163
|
+
name: verifier
|
|
32164
|
+
description: Independently verifies a workit candidate (branch, commit or PR) on its real surface and records a SHA-keyed verdict in the ledger. Use after an implementer finishes and before shipping, never on work this session authored.
|
|
32165
|
+
model: sonnet
|
|
32166
|
+
tools: Read, Grep, Glob, Bash, Skill
|
|
32167
|
+
disallowedTools: Write, Edit, NotebookEdit
|
|
32168
|
+
---
|
|
32169
|
+
|
|
32170
|
+
You are the workit verifier. You did not write the candidate and never
|
|
32171
|
+
change it: you observe, judge and record. Work backward from the goal: what
|
|
32172
|
+
must be true, exist and be wired. The author's summary is a claim:
|
|
32173
|
+
the goal is unmet until you observe it.
|
|
32174
|
+
|
|
32175
|
+
1. Pin the candidate in its own checkout (run workit as
|
|
32176
|
+
\`workit <verb> --cwd <worktree> …\`, verb first; never \`cd\` first): \`git -C <worktree> rev-parse HEAD\` and \`git -C <worktree> status --short\`. A dirty tree
|
|
32177
|
+
or a moving HEAD is a finding; the ledger refuses a verdict on it.
|
|
32178
|
+
2. Read the brief: goal, acceptance (Given/When/Then), verify commands.
|
|
32179
|
+
3. Run every verify command through the CLI:
|
|
32180
|
+
\`workit check <name>\` for configured checks, \`workit check -- <cmd>\` for the
|
|
32181
|
+
rest. Never substitute an easier command. Run every configured check by name
|
|
32182
|
+
(your SubagentStart context lists them) or cite green CI on that head, else \`verified\` is refused.
|
|
32183
|
+
4. Drive the real surface with the project's \`verify-<app>\` skill when it
|
|
32184
|
+
exists (\`/workit:verify-app\` generates one). Tests alone are unit evidence.
|
|
32185
|
+
5. Judge each acceptance line met, not met or not verifiable, citing what
|
|
32186
|
+
you observed. Label every claim measured, inferred or guess.
|
|
32187
|
+
6. Record the verdict, then report it:
|
|
32188
|
+
start from the exact verdict command the SubagentStart hook put in your context (it
|
|
32189
|
+
carries your session and \`--token=<token>\`; you share the lead's
|
|
32190
|
+
\`WORKIT_SESSION_ID\`, which authored the work) and pick its \`--kind <live|unit>\`:
|
|
32191
|
+
\`workit ledger verdict verified|tests-verified|type-check-only|failed|blocked --cwd <candidate worktree> --kind <live|unit> --branch <b> --session <id> --token=<token> --how "<what you ran and saw>"\`.
|
|
32192
|
+
\`verified\` means the change was seen working on its real surface
|
|
32193
|
+
(verify-<app>, \`--kind live\`); \`tests-verified\` means only tests ran. If the ledger refuses you as an author, report that;
|
|
32194
|
+
never pass \`--self\`.
|
|
32195
|
+
|
|
32196
|
+
Before your final report, wait for or stop every background command you started
|
|
32197
|
+
(the host shows you running while one lives); never report with one still running.
|
|
32198
|
+
|
|
32199
|
+
Write only in the candidate worktree's \`.workit-scratch/\` or your session's
|
|
32200
|
+
scratchpad: a test case goes in a file there via a quoted heredoc (\`<<'EOF'\`),
|
|
32201
|
+
never run by the shell. Reads (\`git fetch -q origin\`, a \`node -e\` or \`python3 -c\`
|
|
32202
|
+
that only reads) run anywhere.
|
|
32203
|
+
|
|
32204
|
+
Report: candidate SHA, each check with its exit code, each acceptance line,
|
|
32205
|
+
the verdict row you recorded. Fix nothing: a failing check is a verdict.
|
|
32206
|
+
`;
|
|
32207
|
+
|
|
32208
|
+
// packages/workit-opencode/src/v2/agents.ts
|
|
32209
|
+
var OPENCODE_AGENTS = [
|
|
32210
|
+
{ id: "workit-implementer", role: "implementer", markdown: implementer_default, readOnly: false },
|
|
32211
|
+
{ id: "workit-verifier", role: "verifier", markdown: verifier_default, readOnly: true },
|
|
32212
|
+
{ id: "workit-reviewer", role: "reviewer", markdown: reviewer_default, readOnly: true },
|
|
32213
|
+
{ id: "workit-decider", role: "decider", markdown: decider_default, readOnly: true },
|
|
32214
|
+
{ id: "workit-babysitter", role: "babysit", markdown: babysitter_default, readOnly: false }
|
|
32215
|
+
];
|
|
32216
|
+
var opencodeAgentModel = (value) => {
|
|
32217
|
+
const match = /^([^\s/#]+)\/([^\s#]+)(?:#(\S+))?$/u.exec(value.trim());
|
|
32218
|
+
if (!match)
|
|
32219
|
+
return null;
|
|
32220
|
+
const [, providerID, id, variant] = match;
|
|
32221
|
+
return variant ? { providerID, id, variant } : { providerID, id };
|
|
32222
|
+
};
|
|
32223
|
+
var opencodeAgentText = (markdown) => {
|
|
32224
|
+
const match = /^---\r?\n([\s\S]*?)\r?\n---\r?\n([\s\S]*)$/u.exec(markdown);
|
|
32225
|
+
const description = /^description:\s*(.+)$/mu.exec(match?.[1] ?? "")?.[1].trim() ?? "";
|
|
32226
|
+
const system = (match?.[2] ?? markdown).trim().replace(/\n\nIn a Claude Code host-isolated worktree[\s\S]*?(?=\n\n)/u, "").replace(/\(`\/workit:([a-z-]+)`\)/gu, "(call the skill tool with `workit-$1`)").replace(/`\/workit:([a-z-]+)`/gu, "`workit-$1`").replace(/\(it\s+carries your session and `--token=<token>`;[^)]*\)/gu, "(it names no --session or --token: your shell already acts as your own session)").replaceAll(" --session <id> --token=<token>", "");
|
|
32227
|
+
return { description, system };
|
|
32228
|
+
};
|
|
32229
|
+
var roleModel = (root, role) => role === "implementer" ? uniformImplementerModel(root, "opencode") : resolveAvailableRoleModel(root, { role }, "opencode");
|
|
32230
|
+
var registerRoleAgents = (root, editor) => {
|
|
32231
|
+
for (const agent of OPENCODE_AGENTS) {
|
|
32232
|
+
const { description, system } = opencodeAgentText(agent.markdown);
|
|
32233
|
+
const configured = roleModel(root, agent.role);
|
|
32234
|
+
const model = configured ? opencodeAgentModel(configured.model) : null;
|
|
32235
|
+
editor.update(agent.id, (info) => {
|
|
32236
|
+
info.description = description;
|
|
32237
|
+
info.system = system;
|
|
32238
|
+
info.mode = "subagent";
|
|
32239
|
+
if (model)
|
|
32240
|
+
info.model = model;
|
|
32241
|
+
if (agent.readOnly)
|
|
32242
|
+
info.permissions.push({ action: "edit", resource: "*", effect: "deny" });
|
|
32243
|
+
});
|
|
32244
|
+
}
|
|
32245
|
+
};
|
|
32246
|
+
var installRoleAgents = async (root, agents) => {
|
|
32247
|
+
if (!agents?.transform)
|
|
32248
|
+
return () => {};
|
|
32249
|
+
await agents.transform((editor) => registerRoleAgents(root, editor));
|
|
32250
|
+
const file = workspacesPath();
|
|
32251
|
+
const reload = () => void agents.reload?.().catch(() => {});
|
|
32252
|
+
watchFile(file, { interval: 2000, persistent: false }, reload);
|
|
32253
|
+
return () => unwatchFile(file, reload);
|
|
32254
|
+
};
|
|
32255
|
+
|
|
32018
32256
|
// packages/workit-opencode/src/v2/spawn-model.ts
|
|
32019
32257
|
var opencodeSubagentModel = (value) => {
|
|
32020
32258
|
const trimmed = value.trim();
|
|
@@ -32031,6 +32269,9 @@ var applySpawnModel = (root, event, notes) => {
|
|
|
32031
32269
|
if (!selector)
|
|
32032
32270
|
return;
|
|
32033
32271
|
const choice = chooseSpawnModel(root, selector, "opencode", { model: fields.model }, opencodeSubagentModel);
|
|
32272
|
+
const agentModel = typeof fields.agent === "string" && fields.agent.startsWith("workit-") && selector.role !== "implementer" ? resolveRoleModels(root, selector, "opencode")[0]?.model : undefined;
|
|
32273
|
+
if (choice.model && choice.model === agentModel)
|
|
32274
|
+
return;
|
|
32034
32275
|
if (choice.model)
|
|
32035
32276
|
fields.model = choice.model;
|
|
32036
32277
|
if (choice.note)
|
|
@@ -32481,6 +32722,7 @@ var setup = async (ctx) => {
|
|
|
32481
32722
|
});
|
|
32482
32723
|
}
|
|
32483
32724
|
});
|
|
32725
|
+
const stopRoleAgents = await installRoleAgents(root, ctx.agent);
|
|
32484
32726
|
const shellWorkdirs = new Map;
|
|
32485
32727
|
const pendingShells = new Map;
|
|
32486
32728
|
const spawnNotes = new Map;
|
|
@@ -32596,6 +32838,7 @@ var setup = async (ctx) => {
|
|
|
32596
32838
|
})();
|
|
32597
32839
|
return () => {
|
|
32598
32840
|
subscription.abort();
|
|
32841
|
+
stopRoleAgents();
|
|
32599
32842
|
};
|
|
32600
32843
|
};
|
|
32601
32844
|
var definition = define({ id: "workit", setup });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workit-dev/opencode",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.14.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Workit OpenCode plugin — native tools, adaptive policy, and sixteen method skills",
|
|
6
6
|
"keywords": [
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@opencode/plugin": "2.0.18",
|
|
44
|
-
"@workit-dev/core": "^2.
|
|
44
|
+
"@workit-dev/core": "^2.14.0"
|
|
45
45
|
},
|
|
46
46
|
"engines": {
|
|
47
47
|
"node": ">=24"
|