@fro.bot/systematic 3.27.1 → 3.27.2

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/ATTRIBUTIONS.md CHANGED
@@ -272,7 +272,7 @@ The following is the full Apache License, Version 2.0 text, reproduced here in c
272
272
  ## vercel-labs/agent-browser — Apache-2.0
273
273
 
274
274
  **Source repository:** [`vercel-labs/agent-browser`](https://github.com/vercel-labs/agent-browser)
275
- **Pinned version:** `v0.39.2` (npm `agent-browser@0.39.2`)
275
+ **Pinned version:** `v0.39.3` (npm `agent-browser@0.39.3`)
276
276
  **License:** Apache-2.0
277
277
  **Copyright:** Copyright 2025 Vercel Inc.
278
278
 
@@ -296,7 +296,7 @@ This is fully automated — no human adaptation pass is required, in contrast to
296
296
 
297
297
  ### Upstream Apache-2.0 license text
298
298
 
299
- The following is the full Apache License, Version 2.0 text from `agent-browser@0.39.2`, reproduced here in compliance with the license's notice requirements:
299
+ The following is the full Apache License, Version 2.0 text from `agent-browser@0.39.3`, reproduced here in compliance with the license's notice requirements:
300
300
 
301
301
  ```
302
302
  Apache License
package/HARNESSES.md CHANGED
@@ -41,7 +41,7 @@ Each v2 mechanism was chosen by a probe against OpenCode 2.2.0 on 2026-10-27. Th
41
41
  | Native skill tool | Partial | The host tool loads plugin-added skills and refuses denied ones, but takes only an `{id}`, so `$ARGUMENTS` cannot be passed. `systematic_skill` is ported | [OC2-SKILL] |
42
42
  | Plugin tool registration | Passed | `ctx.tool.transform` with a JSON Schema input and `options: {codemode: false}` (the default registration is reachable only through Code Mode) | [OC2-TOOL] |
43
43
  | Output truncation | Truncates | The host cuts tool output at 2000 lines or 51200 bytes after the plugin's `execute.after` hook sees the full text. The full text is kept by call id and put back in the `context` hook; nothing depends on the marker text | [OC2-TRUNC] |
44
- | Commands | Passed, with constraints | `ctx.command.transform`; a plugin command receives only the typed text and does its own expansion; routing is not offered to plugin commands, so a command that declares `agent`, `model` or `subtask` is refused; a name that matches a built-in replaces it | [OC2-CMD] |
44
+ | Commands | Passed, with constraints | `ctx.command.transform`; a plugin command receives only the typed text and does its own expansion; routing is not offered to plugin commands, so a bundled command that declares `agent`, `model` or `subtask` is refused, while a discovered skill's fields are dropped with a note; a name that matches a built-in replaces it | [OC2-CMD] |
45
45
  | Apply order | Documented | Plugin transforms run first, then user config and discovered sources; `reload()` replays transforms on a fresh editor and does not re-run `setup` | [OC2-ORDER] |
46
46
  | Error handling | Documented | A rejected `setup` leaves the plugin unloaded and the host running; a throwing transform disables the whole plugin; a throwing hook breaks the turn. Every callback is guarded, and invalid config rejects `setup` as it throws on v1 | [OC2-ERR] |
47
47
  | Project directory | Documented | `ctx.location.directory` is the project directory (the service's working directory is not); each location gets a fresh module instance and its own `setup` | [OC2-TRUST] |
@@ -215,7 +215,7 @@ Migrated-skill discipline is enforced by the [content-integrity gate](scripts/co
215
215
  - **OC2-SKILL** — CI job `Host Contract v2 shard N/4` (OpenCode 2.2.0): `tests/integration/opencode-v2.test.ts` › "the native skill tool sees the registered bundled skills, and not a disabled one" and "an on-disk skill with the same id replaces the registered one in the native tool, with no diagnostic". Local probe, OpenCode 2.2.0, 2026-10-27: the native tool refuses denied skills per agent, including in subagents; `<available_skills>` lists only the skills the agent may load; the permission resource is the skill id; an inline skill's base directory is `dirname(path)`; the tool takes only `{id}`, so `$ARGUMENTS` stays literal.
216
216
  - **OC2-TOOL** — CI job `Host Contract v2 shard N/4` (OpenCode 2.2.0): `tests/integration/opencode-v2.test.ts` › "systematic_skill is offered to the model and loads an enabled skill by bare and prefixed name", "arguments are substituted into the skill the model receives" and "a skill in disabled_skills is refused by systematic_skill". Local probe, OpenCode 2.2.0, 2026-10-27: a plugin tool takes a JSON Schema input; the default registration is reachable only through Code Mode, and `options: {codemode: false}` makes it a direct tool (`pinned: true` did not).
217
217
  - **OC2-TRUNC** — CI job `Host Contract v2 shard N/4` (OpenCode 2.2.0): `tests/integration/opencode-v2.test.ts` › "a skill above the host output limit reaches the model in full on the continuation request and later turns" and "a discovered project skill above the host output limit reaches the model whole as a command, with its arguments". Local probe, OpenCode 2.2.0, 2026-10-27: tool output over 2000 lines or 51200 bytes is cut after the plugin's `execute.after` hook has seen the full text, with a trailing `[showing lines a-b of N; full output saved to <path>]` part; the bundled `ce-review`, `ce-plan` and `ce-compound-refresh` skills are over the limit. Restoration matches the tool result by call id and does not read the marker. v2 has no runtime prune placeholder: `[Old tool result content cleared]` exists only in the v1-to-v2 migration converter, so v1's compacted-result restore has no v2 counterpart.
218
- - **OC2-CMD** — CI job `Host Contract v2 shard N/4` (OpenCode 2.2.0): `tests/integration/opencode-v2.test.ts` › "a command with $ARGUMENTS reaches the model expanded, on the invoking session as it is", "a command that declares agent is refused with a message and nothing is prompted" (and the same for `model` and `subtask`), "a !-backtick block in a command stays literal text in the prompt", "the command names and descriptions match the v1 set" and "a discovered skill named like a built-in command is skipped and the built-in stays". Local probe, OpenCode 2.2.0, 2026-10-27: a plugin command receives `{sessionID, prompt: {text, files, agents, skills}, delivery}` with the raw typed text; `prompt` takes no agent or model; `switchAgent` to an unregistered agent succeeds and the next turn fails; a plugin command named like a built-in replaces it; the command editor has only `add`; a throwing `execute` makes `session.command` reject with `CommandExecutionError` and leaves the plugin loaded. A session created with no agent or model reports neither from `session.get`, even after a turn; it runs on the host's default agent (`build` here) and the model `model.default` returns. `switchAgent` and `switchModel` make a session's choice explicit and persistent, and no call clears it; the host also reads a session's agent and model for every model request, so a switch made during a running turn changes that turn's later requests. Because of those three facts a plugin command cannot route without leaving the user's session changed or racing a running turn, so Systematic does not route: a command whose plan declares `agent`, `model` or `subtask` is refused with a message that points to an OpenCode command in Markdown or JSON. Only bundled skills can declare those fields (discovered skills drop them on both hosts), and no bundled skill does.
218
+ - **OC2-CMD** — CI job `Host Contract v2 shard N/4` (OpenCode 2.2.0): `tests/integration/opencode-v2.test.ts` › "a command with $ARGUMENTS reaches the model expanded, on the invoking session as it is", "a command that declares agent is refused with a message and nothing is prompted" (and the same for `model` and `subtask`), "a !-backtick block in a command stays literal text in the prompt", "the command names and descriptions match the v1 set" and "a discovered skill named like a built-in command is skipped and the built-in stays". Local probe, OpenCode 2.2.0, 2026-10-27: a plugin command receives `{sessionID, prompt: {text, files, agents, skills}, delivery}` with the raw typed text; `prompt` takes no agent or model; `switchAgent` to an unregistered agent succeeds and the next turn fails; a plugin command named like a built-in replaces it; the command editor has only `add`; a throwing `execute` makes `session.command` reject with `CommandExecutionError` and leaves the plugin loaded. A session created with no agent or model reports neither from `session.get`, even after a turn; it runs on the host's default agent (`build` here) and the model `model.default` returns. `switchAgent` and `switchModel` make a session's choice explicit and persistent, and no call clears it; the host also reads a session's agent and model for every model request, so a switch made during a running turn changes that turn's later requests. Because of those three facts a plugin command cannot route without leaving the user's session changed or racing a running turn, so Systematic does not route: a command whose plan declares `agent`, `model` or `subtask` is refused with a message that points to an OpenCode command in Markdown or JSON. Only bundled skills can reach that refusal, and no bundled skill declares those fields. A discovered skill is never refused: its fields are dropped with one note per skill (`tests/unit/opencode-v2-commands.test.ts` › "a discovered skill that declares routing"; `tests/integration/opencode-v2.test.ts` › "a discovered skill that declares routing is not refused"). On OpenCode v1 the same skill's `subtask` passes through, `agent` passes only for a subtask that names a known agent, and `model` passes only as `provider/model`; anything else is dropped with a warning (`tests/unit/config-handler.test.ts` › "routing fields").
219
219
  - **OC2-ORDER** — CI job `Host Contract v2 shard N/4` (OpenCode 2.2.0): `tests/integration/opencode-v2.test.ts` › "a user agent with the same id in config keeps the user system prompt" and "an on-disk skill with the same id replaces the registered one in the native tool, with no diagnostic" (user config and disk sources win over plugin transforms); `tests/unit/opencode-v2.test.ts` › "agents installer" › "replaying the transform on a fresh editor yields the same single agent set" (replay on a fresh editor). Local probe, OpenCode 2.2.0, 2026-10-27: plugins apply in config order and see earlier plugins' edits; `reload()` replays transforms and does not re-run `setup`.
220
220
  - **OC2-ERR** — CI job `Host Contract v2 shard N/4` (OpenCode 2.2.0): `tests/integration/opencode-v2.test.ts` › "invalid systematic.json fails the plugin load, is logged, and the session still answers" and "a command that declares %s is refused with a message and nothing is prompted" (a `systematic:` diagnostic reaches the server's standard error); `tests/unit/opencode-v2.test.ts` › "createSafeGuard". Local probe, OpenCode 2.2.0, 2026-10-27: a rejected `setup` leaves the plugin unloaded with one `WARN failed to load plugin` and the host and other plugins unaffected; a throwing transform disables the whole plugin; a throwing `prompt` hook returns HTTP 500; a throwing `context` hook fails the turn; a throwing `execute.before` or `execute.after` turns the tool result into an error; `console.error` reaches only the server's standard error.
221
221
  - **OC2-TRUST** — CI job `Host Contract v2 shard N/4` (OpenCode 2.2.0): `tests/integration/opencode-v2.test.ts` › "the packed plugin loads, setup runs once and stderr carries nothing unexpected" and every test that writes a project `.opencode/systematic.json`, such as "a skill in disabled_skills is refused by systematic_skill". Local probe, OpenCode 2.2.0, 2026-10-27: `ctx.location.directory` is the project directory and `ctx.location.project` has `id`, `directory` and `canonical`; one shared service creates one plugin instance per location, with a fresh module instance and its own `setup`; project config plugins load with no trust prompt.
package/dist/index.js CHANGED
@@ -670,8 +670,17 @@ function loadDiscoveredSkillAsCommand(skill) {
670
670
  description
671
671
  };
672
672
  }
673
+ function declaredRoutingOf(skill) {
674
+ const { agent, model, subtask } = skill.frontmatter;
675
+ return {
676
+ ...agent === undefined ? {} : { agent },
677
+ ...model === undefined ? {} : { model },
678
+ ...subtask === undefined ? {} : { subtask }
679
+ };
680
+ }
673
681
  function collectDiscoveredSkillsAsCommands(startDir, homeDir, configDir, opencodeConfigDirOverride, disabledCommands) {
674
682
  const commands = {};
683
+ const routing = {};
675
684
  let discovered;
676
685
  try {
677
686
  discovered = discoverSkills({
@@ -681,7 +690,7 @@ function collectDiscoveredSkillsAsCommands(startDir, homeDir, configDir, opencod
681
690
  opencodeConfigDirOverride
682
691
  });
683
692
  } catch {
684
- return commands;
693
+ return { commands, routing };
685
694
  }
686
695
  for (const skill of discovered) {
687
696
  if (skill.frontmatter.userInvocable === false)
@@ -690,9 +699,12 @@ function collectDiscoveredSkillsAsCommands(startDir, homeDir, configDir, opencod
690
699
  continue;
691
700
  try {
692
701
  commands[skill.name] = loadDiscoveredSkillAsCommand(skill);
702
+ const declared = declaredRoutingOf(skill);
703
+ if (Object.keys(declared).length > 0)
704
+ routing[skill.name] = declared;
693
705
  } catch {}
694
706
  }
695
- return commands;
707
+ return { commands, routing };
696
708
  }
697
709
  function collectEnabledSkillNames(dir, disabledSkills) {
698
710
  const disabledSet = new Set(disabledSkills);
@@ -713,7 +725,7 @@ function buildAssetPlan(input) {
713
725
  const resolvedOverlays = resolveAgentOverlaySet(validatedOverlays);
714
726
  const agents = collectAgents(bundledAgentsDir, config.disabled_agents, nativeAgentNames, resolvedOverlays, overlays);
715
727
  const bundledCommands = collectCommands(input.bundledCommandsDir, config.disabled_commands);
716
- const discoveredSkillCommands = config.skills_as_commands !== false ? collectDiscoveredSkillsAsCommands(input.directory, input.homeDir, input.opencodeConfigDir, input.opencodeConfigDirOverride, config.disabled_commands) : {};
728
+ const discovered = config.skills_as_commands !== false ? collectDiscoveredSkillsAsCommands(input.directory, input.homeDir, input.opencodeConfigDir, input.opencodeConfigDirOverride, config.disabled_commands) : { commands: {}, routing: {} };
717
729
  return {
718
730
  skillsDir: bundledSkillsDir,
719
731
  enabledSkills,
@@ -721,8 +733,9 @@ function buildAssetPlan(input) {
721
733
  commands: {
722
734
  ...bundledCommands,
723
735
  ...skillCommands,
724
- ...discoveredSkillCommands
725
- }
736
+ ...discovered.commands
737
+ },
738
+ discoveredRouting: discovered.routing
726
739
  };
727
740
  }
728
741
 
@@ -793,11 +806,71 @@ function toV1AgentConfig(planned) {
793
806
  }
794
807
  return result;
795
808
  }
809
+ var OPENCODE_V1_BUILT_IN_AGENTS = [
810
+ "build",
811
+ "plan",
812
+ "general",
813
+ "explore"
814
+ ];
815
+ function knownAgentNames(agents) {
816
+ const known = new Set(OPENCODE_V1_BUILT_IN_AGENTS);
817
+ for (const [name, agent] of Object.entries(agents ?? {})) {
818
+ if (agent?.disable === true)
819
+ known.delete(name);
820
+ else
821
+ known.add(name);
822
+ }
823
+ return known;
824
+ }
825
+ function agentProblem(agent, isSubtask, known) {
826
+ if (!isSubtask) {
827
+ return `sets agent "${agent}" but does not run as a subtask (context: fork or subtask: true)`;
828
+ }
829
+ return known.has(agent) ? undefined : `sets agent "${agent}", which is not an OpenCode agent`;
830
+ }
831
+ function modelProblem(model) {
832
+ const slash = model.indexOf("/");
833
+ return slash > 0 && slash < model.length - 1 ? undefined : `sets model "${model}", which is not in provider/model form`;
834
+ }
835
+ var IGNORED_ROUTING_HINT = "it is ignored. Write an OpenCode command to route it.";
836
+ function applyDiscoveredRouting(config, plan, reported) {
837
+ const known = knownAgentNames(config.agent);
838
+ const drop = (name, field, reason) => {
839
+ const key = `${name}\x00${field}`;
840
+ if (reported.has(key))
841
+ return;
842
+ reported.add(key);
843
+ console.warn(`[systematic] skill "${name}" ${reason}; ${IGNORED_ROUTING_HINT}`);
844
+ };
845
+ for (const [name, declared] of Object.entries(plan.discoveredRouting)) {
846
+ const command = config.command?.[name];
847
+ if (command === undefined || command !== plan.commands[name])
848
+ continue;
849
+ const { agent, model, subtask } = declared;
850
+ if (agent !== undefined) {
851
+ const problem = agentProblem(agent, subtask === true, known);
852
+ if (problem === undefined)
853
+ command.agent = agent;
854
+ else
855
+ drop(name, "agent", problem);
856
+ }
857
+ if (model !== undefined) {
858
+ const problem = modelProblem(model);
859
+ if (problem === undefined)
860
+ command.model = model;
861
+ else
862
+ drop(name, "model", problem);
863
+ }
864
+ if (subtask !== undefined)
865
+ command.subtask = subtask;
866
+ }
867
+ }
796
868
  function createConfigHandler(deps) {
797
869
  const { directory, bundledSkillsDir, bundledAgentsDir, bundledCommandsDir } = deps;
798
870
  const homeDir = deps.homeDir ?? os2.homedir();
799
871
  const opencodeConfigDir = deps.opencodeConfigDir ?? path4.join(homeDir, ".config/opencode");
800
872
  const opencodeConfigDirOverride = process.env.OPENCODE_CONFIG_DIR?.trim() ? process.env.OPENCODE_CONFIG_DIR : undefined;
873
+ const reportedRouting = new Set;
801
874
  return async (config) => {
802
875
  const { config: systematicConfig, overlays } = loadConfigWithSources(directory);
803
876
  const existingAgents = { ...config.agent ?? {} };
@@ -822,6 +895,7 @@ function createConfigHandler(deps) {
822
895
  const bundledAgentKeys = new Set(Object.keys(bundledAgents));
823
896
  config.agent = mergeSystematicEntries(existingAgents, bundledAgents, (key, agent) => bundledAgentKeys.has(key) && isSystematicAgentConfig(agent));
824
897
  config.command = mergeSystematicEntries(existingCommands, plan.commands, (_key, command) => isSystematicCommandConfig(command));
898
+ applyDiscoveredRouting(config, plan, reportedRouting);
825
899
  registerSkillsPaths(config, plan.skillsDir);
826
900
  denyDisabledSkills(config, systematicConfig.disabled_skills);
827
901
  };
@@ -1427,6 +1501,10 @@ function declaredRouting(planned) {
1427
1501
  function refusalMessage(name, field) {
1428
1502
  return `Systematic command "${name}" declares ${field}, which OpenCode v2 plugin commands cannot route. Define it as an OpenCode command in Markdown or JSON to choose its agent or model.`;
1429
1503
  }
1504
+ function ignoredRoutingMessage(name, declared) {
1505
+ const fields = ["agent", "model", "subtask"].filter((field) => declared[field] !== undefined);
1506
+ return `skill "${name}" declares ${fields.join(", ")}, which OpenCode v2 plugin commands cannot route; it is ignored and the skill runs as it is. Write an OpenCode command in Markdown or JSON to route it.`;
1507
+ }
1430
1508
  async function submit(runtime, planned, invocation) {
1431
1509
  const text = substituteSkillArguments(planned.template, invocation.prompt.text);
1432
1510
  const { files, agents, skills } = invocation.prompt;
@@ -1476,6 +1554,10 @@ var installCommands = async ({
1476
1554
  guard.sync(`command "${name}"`, () => {
1477
1555
  editor.add(buildCommand(runtime, name, planned));
1478
1556
  })();
1557
+ const declared = snapshot.plan.discoveredRouting[name];
1558
+ if (declared !== undefined) {
1559
+ reportOnce(runtime, `ignored-routing:${name}`, ignoredRoutingMessage(name, declared));
1560
+ }
1479
1561
  }
1480
1562
  });
1481
1563
  await guard.async("command registration", () => ctx.command.transform(transform))();
@@ -60,6 +60,17 @@ export interface PlannedCommand {
60
60
  model?: string;
61
61
  subtask?: boolean;
62
62
  }
63
+ /**
64
+ * Routing fields a discovered skill declared in its frontmatter, as written.
65
+ * Discovered skills are the user's own and are often written for other agent
66
+ * harnesses, so the values are not trusted: each host decides what to do with
67
+ * them.
68
+ */
69
+ export interface DeclaredRouting {
70
+ agent?: string;
71
+ model?: string;
72
+ subtask?: boolean;
73
+ }
63
74
  export interface AssetPlan {
64
75
  /** Bundled skills directory, for hosts that register it for native discovery. */
65
76
  skillsDir: string;
@@ -67,8 +78,19 @@ export interface AssetPlan {
67
78
  enabledSkills: readonly string[];
68
79
  /** Agents keyed by emitted agent name, in discovery order. */
69
80
  agents: Record<string, PlannedAgent>;
70
- /** Commands keyed by emitted command name: bundled commands, then skills, then discovered skills. */
81
+ /**
82
+ * Commands keyed by emitted command name: bundled commands, then skills,
83
+ * then discovered skills. A discovered command never carries `agent`,
84
+ * `model` or `subtask`; see `discoveredRouting`.
85
+ */
71
86
  commands: Record<string, PlannedCommand>;
87
+ /**
88
+ * What each discovered skill declared, keyed by its command name. Only
89
+ * skills that declare at least one routing field, and whose command is in
90
+ * `commands`, are listed. A host that can route validates these and applies
91
+ * what is valid; a host that cannot reports them.
92
+ */
93
+ discoveredRouting: Record<string, DeclaredRouting>;
72
94
  }
73
95
  export interface AssetPlanInput {
74
96
  /** Loaded Systematic config. The builder reads only the disabled lists and `skills_as_commands`. */
@@ -13,9 +13,10 @@ import type { V2Installer } from './opencode-v2.js';
13
13
  *
14
14
  * It does not route. A v2 plugin command cannot choose an agent or a model for
15
15
  * its prompt, and switching the session around the turn leaves the user's
16
- * session changed. A command that declares `agent`, `model` or `subtask` is
17
- * refused with a message instead; OpenCode commands written in Markdown or JSON
18
- * can do that routing.
16
+ * session changed. A bundled command that declares `agent`, `model` or
17
+ * `subtask` is refused with a message instead; OpenCode commands written in
18
+ * Markdown or JSON can do that routing. A discovered skill is never refused: its
19
+ * routing fields are dropped with a note and it runs on the invoking session.
19
20
  */
20
21
  type CommandEditor = Parameters<Parameters<Plugin.Context['command']['transform']>[0]>[0];
21
22
  export type V2CommandDefinition = Parameters<CommandEditor['add']>[0];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fro.bot/systematic",
3
- "version": "3.27.1",
3
+ "version": "3.27.2",
4
4
  "description": "Compound-engineering loops for OpenCode, Pi, and Claude Code",
5
5
  "type": "module",
6
6
  "homepage": "https://fro.bot/systematic",
@@ -127,7 +127,7 @@
127
127
  "@types/bun": "latest",
128
128
  "@types/js-yaml": "4.0.9",
129
129
  "@types/node": "26.6.5",
130
- "agent-browser": "0.39.2",
130
+ "agent-browser": "0.39.3",
131
131
  "ajv": "8.20.0",
132
132
  "ajv-formats": "3.0.1",
133
133
  "conventional-changelog-conventionalcommits": "10.4.1",