opencode-swarm 7.97.0 → 7.98.1

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.
Files changed (31) hide show
  1. package/README.md +7 -1
  2. package/dist/agents/architect.d.ts +1 -1
  3. package/dist/cli/{config-doctor-h1xrvq83.js → config-doctor-7yrxfa6b.js} +2 -2
  4. package/dist/cli/{guardrail-explain-t6svvtmn.js → guardrail-explain-cm08h4mt.js} +5 -5
  5. package/dist/cli/{guardrail-log-9yyeccv5.js → guardrail-log-53z1cf46.js} +3 -3
  6. package/dist/cli/{index-a9ghr5cx.js → index-0rgde8qc.js} +2 -2
  7. package/dist/cli/{index-tqbb2jx6.js → index-471qxz9g.js} +33 -9
  8. package/dist/cli/{index-b223mczb.js → index-5z2e78tv.js} +1 -1
  9. package/dist/cli/{index-byb9tgay.js → index-attgb1ma.js} +6 -6
  10. package/dist/cli/{index-rdc6nvmw.js → index-gnd1280x.js} +1 -1
  11. package/dist/cli/{index-sgdr2e4n.js → index-zgba613y.js} +63 -64
  12. package/dist/cli/{index-xx3sv77e.js → index-zy22fg5h.js} +1 -1
  13. package/dist/cli/index.js +4 -4
  14. package/dist/cli/{schema-a8fneygm.js → schema-mygkbbe9.js} +5 -1
  15. package/dist/config/constants.d.ts +4 -0
  16. package/dist/config/schema.d.ts +11 -0
  17. package/dist/evidence/normalize-verdict.d.ts +67 -0
  18. package/dist/hooks/knowledge-curator.d.ts +1 -0
  19. package/dist/hooks/knowledge-injector.d.ts +1 -1
  20. package/dist/index.js +758 -355
  21. package/dist/services/external-skill-validator.d.ts +10 -2
  22. package/dist/services/injection-budget.d.ts +98 -0
  23. package/dist/summaries/summarizer.d.ts +36 -0
  24. package/dist/tools/context-status.d.ts +102 -0
  25. package/dist/tools/index.d.ts +1 -0
  26. package/dist/tools/manifest.d.ts +1 -0
  27. package/dist/tools/tool-metadata.d.ts +11 -7
  28. package/dist/tools/write-drift-evidence.d.ts +11 -0
  29. package/dist/tools/write-hallucination-evidence.d.ts +11 -0
  30. package/dist/tools/write-mutation-evidence.d.ts +11 -0
  31. package/package.json +1 -1
package/README.md CHANGED
@@ -561,6 +561,8 @@ The Context Budget Guard monitors how much context Swarm is injecting into the c
561
561
 
562
562
  To disable entirely, set `context_budget.enabled: false` in your swarm config.
563
563
 
564
+ **On-demand status check:** architects can invoke the `context_status` tool at any time to read current context-window headroom (tokens used, model limit, usage percent, threshold state, model ID, provider) without triggering advisory warnings or mutating state. Works even when `context_budget.enabled` is false.
565
+
564
566
  ---
565
567
 
566
568
  ### Skill Propagation
@@ -614,7 +616,9 @@ Routing skills are merged with scored recommendations, with explicitly routed sk
614
616
 
615
617
  ### Skill Lifecycle Management
616
618
 
617
- Swarm provides tools for managing generated skill lifecycles:
619
+ Seven skill-management tools (`skill_generate`, `skill_list`, `skill_apply`, `skill_inspect`, `skill_regenerate`, `skill_retire`, `skill_improve`) are **opt-in** via the `skills.enabled` config flag (default `false`). With the flag off, the architect does not see them; with the flag on, they reappear. Tools remain exported and registered — only the merged architect tool map is gated.
620
+
621
+ Swarm provides tools for managing generated skill lifecycles:
618
622
 
619
623
  - **`skill_retire`** — Retires an active generated skill by creating a `retired.marker` file in its directory. Retired skills are excluded from discovery, scoring, and injection. The SKILL.md file is preserved for auditability. Use `skill_retire(slug, reason?)` to retire a skill, or pass a reason for tracking purposes.
620
624
 
@@ -699,7 +703,9 @@ Every candidate passes a 3-gate pipeline before entering quarantine:
699
703
  | `context_budget.tracked_agents` | string[] | `['architect']` | Agents to track for context budget warnings |
700
704
  | `context_budget.enforce_on_agent_switch` | boolean | `true` | Enforce budget limits when switching agents |
701
705
  | `context_budget.model_limits` | record | `{ default: 128000 }` | Per-model token limits (model name -> max tokens) |
706
+ | `context_budget.unified_injection_tokens` | number | `undefined` | Opt-in unified ceiling (tokens) for combined system-enhancer + knowledge-injector injection per turn. When set, both hooks share this budget with proportional split |
702
707
  | `context_budget.tool_output_mask_threshold` | number | `2000` | Threshold for masking tool outputs (chars) |
708
+ | `skills.enabled` | boolean | `false` | Gates the 7 skill-management tools (`skill_generate`, `skill_list`, `skill_apply`, `skill_inspect`, `skill_regenerate`, `skill_retire`, `skill_improve`) behind an opt-in flag. When `false` (default), these tools are hidden from the architect's tool map. |
703
709
  | `context_budget.scoring.enabled` | boolean | `false` | Enable context scoring/ranking |
704
710
  | `context_budget.scoring.max_candidates` | number | `100` | Maximum items to score (10-500) |
705
711
  | `context_budget.scoring.weights` | object | `{ recency: 0.3, ... }` | Scoring weights for priority |
@@ -71,4 +71,4 @@ export declare function buildCouncilWorkflow(council?: CouncilWorkflowConfig): s
71
71
  * BRAINSTORM, and PLAN inline paths stay in lockstep.
72
72
  */
73
73
  export declare function buildQaGateSelectionDialogue(modeLabel: 'BRAINSTORM' | 'SPECIFY' | 'PLAN'): string;
74
- export declare function createArchitectAgent(model: string, customPrompt?: string, customAppendPrompt?: string, adversarialTesting?: AdversarialTestingConfig, council?: CouncilWorkflowConfig, uiReview?: UIReviewConfig, memoryEnabled?: boolean, architecturalSupervision?: ArchitectureSupervisionWorkflowConfig, designDocsEnabled?: boolean, externalSkillsEnabled?: boolean, turboEnabled?: boolean): AgentDefinition;
74
+ export declare function createArchitectAgent(model: string, customPrompt?: string, customAppendPrompt?: string, adversarialTesting?: AdversarialTestingConfig, council?: CouncilWorkflowConfig, uiReview?: UIReviewConfig, memoryEnabled?: boolean, architecturalSupervision?: ArchitectureSupervisionWorkflowConfig, designDocsEnabled?: boolean, externalSkillsEnabled?: boolean, turboEnabled?: boolean, skillsEnabled?: boolean): AgentDefinition;
@@ -12,8 +12,8 @@ import {
12
12
  shouldRunOnStartup,
13
13
  writeBackupArtifact,
14
14
  writeDoctorArtifact
15
- } from "./index-xx3sv77e.js";
16
- import"./index-tqbb2jx6.js";
15
+ } from "./index-zy22fg5h.js";
16
+ import"./index-471qxz9g.js";
17
17
  import"./index-5e4e2hvv.js";
18
18
  import"./index-p0arc26j.js";
19
19
  import"./index-zgwm4ryv.js";
@@ -1,14 +1,14 @@
1
1
  // @bun
2
2
  import {
3
3
  handleGuardrailExplain
4
- } from "./index-a9ghr5cx.js";
5
- import"./index-sgdr2e4n.js";
6
- import"./index-b223mczb.js";
4
+ } from "./index-0rgde8qc.js";
5
+ import"./index-zgba613y.js";
6
+ import"./index-5z2e78tv.js";
7
7
  import"./index-2a6ppa65.js";
8
8
  import"./index-fjxjb66n.js";
9
9
  import"./index-hb10a2g8.js";
10
- import"./index-xx3sv77e.js";
11
- import"./index-tqbb2jx6.js";
10
+ import"./index-zy22fg5h.js";
11
+ import"./index-471qxz9g.js";
12
12
  import"./index-4c5jpmn9.js";
13
13
  import"./index-adz3nk9b.js";
14
14
  import"./index-v4fcn4tr.js";
@@ -1,9 +1,9 @@
1
1
  // @bun
2
2
  import {
3
3
  handleGuardrailLog
4
- } from "./index-rdc6nvmw.js";
5
- import"./index-b223mczb.js";
6
- import"./index-tqbb2jx6.js";
4
+ } from "./index-gnd1280x.js";
5
+ import"./index-5z2e78tv.js";
6
+ import"./index-471qxz9g.js";
7
7
  import"./index-5e4e2hvv.js";
8
8
  import"./index-p0arc26j.js";
9
9
  import"./index-zgwm4ryv.js";
@@ -12,14 +12,14 @@ import {
12
12
  detectPosixWrites,
13
13
  detectWindowsWrites,
14
14
  resolveWriteTargets
15
- } from "./index-sgdr2e4n.js";
15
+ } from "./index-zgba613y.js";
16
16
  import {
17
17
  checkFileAuthority,
18
18
  classifyFile,
19
19
  isInDeclaredScope,
20
20
  redactPath,
21
21
  redactShellCommand
22
- } from "./index-b223mczb.js";
22
+ } from "./index-5z2e78tv.js";
23
23
 
24
24
  // src/services/guardrail-explain-service.ts
25
25
  import path from "path";
@@ -365,6 +365,10 @@ var TOOL_METADATA = {
365
365
  description: "detect hidden couplings by analyzing git history",
366
366
  agents: ["architect"]
367
367
  },
368
+ context_status: {
369
+ description: "report current context-window headroom for the active session \u2014 returns tokens-used, model-limit, usage-percent, threshold-state (none/warn/critical), model name, and provider. Pure read-only: no state mutation, no warning injection. Works whether context_budget.enabled is true or false.",
370
+ agents: ["architect"]
371
+ },
368
372
  search: {
369
373
  description: "Workspace-scoped ripgrep-style text search with structured JSON output. Supports literal and regex modes, glob filtering, and result limits. NOTE: This is text search, not structural AST search \u2014 use symbols and imports tools for structural queries.",
370
374
  agents: [
@@ -481,19 +485,19 @@ var TOOL_METADATA = {
481
485
  },
482
486
  skill_generate: {
483
487
  description: "compile knowledge entries into a structured SKILL.md draft",
484
- agents: ["architect", "skill_improver"]
488
+ agents: ["skill_improver"]
485
489
  },
486
490
  skill_list: {
487
491
  description: "list generated skill files and their status",
488
- agents: ["architect", "skill_improver"]
492
+ agents: ["skill_improver"]
489
493
  },
490
494
  skill_apply: {
491
495
  description: "activate a draft skill proposal",
492
- agents: ["architect"]
496
+ agents: []
493
497
  },
494
498
  skill_inspect: {
495
499
  description: "inspect the content and source entries of a skill file",
496
- agents: ["architect", "skill_improver"]
500
+ agents: ["skill_improver"]
497
501
  },
498
502
  run_stale_reconciliation: {
499
503
  description: "reconcile skills against the knowledge store: mark skills stale when source knowledge is archived or deleted, or clear stale markers",
@@ -501,15 +505,15 @@ var TOOL_METADATA = {
501
505
  },
502
506
  skill_regenerate: {
503
507
  description: "regenerate an active skill by re-clustering its source knowledge entries and updating the SKILL.md in place",
504
- agents: ["architect"]
508
+ agents: []
505
509
  },
506
510
  skill_retire: {
507
511
  description: "retire a generated skill by adding a retired.marker file; retired skills are excluded from scoring and injection",
508
- agents: ["architect"]
512
+ agents: []
509
513
  },
510
514
  skill_improve: {
511
515
  description: "run the skill_improver agent to review and refine skills",
512
- agents: ["architect", "skill_improver"]
516
+ agents: ["skill_improver"]
513
517
  },
514
518
  spec_write: {
515
519
  description: "author or update .swarm/spec.md for the current project",
@@ -851,6 +855,18 @@ var TURBO_TOOL_NAMES = [
851
855
  var TURBO_AGENT_TOOL_MAP = {
852
856
  architect: [...TURBO_TOOL_NAMES]
853
857
  };
858
+ var SKILL_TOOL_NAMES = [
859
+ "skill_generate",
860
+ "skill_list",
861
+ "skill_apply",
862
+ "skill_inspect",
863
+ "skill_regenerate",
864
+ "skill_retire",
865
+ "skill_improve"
866
+ ];
867
+ var SKILL_AGENT_TOOL_MAP = {
868
+ architect: [...SKILL_TOOL_NAMES]
869
+ };
854
870
  var DEFAULT_AGENT_CONFIGS = {
855
871
  coder: {
856
872
  model: "opencode/minimax-m2.5-free",
@@ -1049,6 +1065,7 @@ var ContextBudgetConfigSchema = exports_external.object({
1049
1065
  critical_threshold: exports_external.number().min(0).max(1).default(0.9),
1050
1066
  model_limits: exports_external.record(exports_external.string(), exports_external.number().min(1000)).default({ default: 128000 }),
1051
1067
  max_injection_tokens: exports_external.number().min(100).max(50000).default(4000),
1068
+ unified_injection_tokens: exports_external.number().min(100).max(50000).optional(),
1052
1069
  tracked_agents: exports_external.array(exports_external.string()).default(["architect"]),
1053
1070
  scoring: ScoringConfigSchema.optional(),
1054
1071
  enforce: exports_external.boolean().default(true),
@@ -1688,6 +1705,9 @@ var SkillImproverConfigSchema = exports_external.object({
1688
1705
  quota_window: exports_external.enum(["utc", "local"]).default("utc"),
1689
1706
  allow_deterministic_fallback: exports_external.boolean().default(true)
1690
1707
  });
1708
+ var SkillsConfigSchema = exports_external.object({
1709
+ enabled: exports_external.boolean().default(false)
1710
+ });
1691
1711
  var SpecWriterConfigSchema = exports_external.object({
1692
1712
  enabled: exports_external.boolean().default(true),
1693
1713
  model: exports_external.string().nullable().default(null),
@@ -1948,6 +1968,9 @@ var DEFAULT_EXTERNAL_SKILLS_CONFIG = {
1948
1968
  max_concurrent_fetches: 5,
1949
1969
  fetch_timeout_ms: 30000
1950
1970
  };
1971
+ var DEFAULT_SKILLS_CONFIG = {
1972
+ enabled: false
1973
+ };
1951
1974
  function resolveExternalSkillsConfig(input) {
1952
1975
  if (input === undefined || input === null || typeof input !== "object" || Array.isArray(input)) {
1953
1976
  return { ...DEFAULT_EXTERNAL_SKILLS_CONFIG };
@@ -2194,7 +2217,8 @@ var PluginConfigSchema = exports_external.object({
2194
2217
  }
2195
2218
  })),
2196
2219
  pr_monitor: PrMonitorConfigSchema.optional(),
2197
- external_skills: ExternalSkillsConfigSchema.optional()
2220
+ external_skills: ExternalSkillsConfigSchema.optional(),
2221
+ skills: SkillsConfigSchema.optional()
2198
2222
  });
2199
2223
 
2200
- export { ORCHESTRATOR_NAME, ALL_SUBAGENT_NAMES, ALL_AGENT_NAMES, TOOL_NAMES, TOOL_NAME_SET, AGENT_TOOL_MAP, DEFAULT_AGENT_CONFIGS, _internals, isKnownCanonicalRole, getCanonicalAgentRole, resolveGeneratedAgentRole, stripKnownSwarmPrefix, AgentReasoningConfigSchema, AgentThinkingConfigSchema, AgentOverrideConfigSchema, SwarmConfigSchema, HooksConfigSchema, ScoringWeightsSchema, DecisionDecaySchema, TokenRatiosSchema, ScoringConfigSchema, ContextBudgetConfigSchema, EvidenceConfigSchema, GateFeatureSchema, PlaceholderScanConfigSchema, QualityBudgetConfigSchema, GateConfigSchema, PipelineConfigSchema, PhaseCompleteConfigSchema, SummaryConfigSchema, ReviewPassesConfigSchema, AutoReviewConfigSchema, AdversarialDetectionConfigSchema, AdversarialTestingConfigSchema, IntegrationAnalysisConfigSchema, DocsConfigSchema, DesignDocsConfigSchema, UIReviewConfigSchema, CompactionAdvisoryConfigSchema, LintConfigSchema, SecretscanConfigSchema, GuardrailsProfileSchema, DEFAULT_AGENT_PROFILES, DEFAULT_ARCHITECT_PROFILE, GuardrailsConfigSchema, WatchdogConfigSchema, SelfReviewConfigSchema, resolveGuardrailsConfig, ToolFilterConfigSchema, PlanCursorConfigSchema, ContextMapConfigSchema, RepoGraphConfigSchema, CheckpointConfigSchema, AutomationModeSchema, AutomationCapabilitiesSchema, AutomationConfigSchema, KnowledgeConfigSchema, MemoryConfigSchema, CuratorConfigSchema, ArchitecturalSupervisionConfigSchema, KnowledgeApplicationConfigSchema, SkillPropagationConfigSchema, SkillImproverConfigSchema, SpecWriterConfigSchema, SlopDetectorConfigSchema, IncrementalVerifyConfigSchema, CompactionConfigSchema, PrmConfigSchema, AgentAuthorityRuleSchema, AuthorityConfigSchema, GeneralCouncilConfigSchema, CouncilConfigSchema, PrMonitorConfigSchema, ParallelizationConfigSchema, WorktreeIsolationConfigSchema, LeanTurboConfigSchema, EpicConfigSchema, StandardTurboConfigSchema, LeanTurboStrategyConfigSchema, TurboConfigSchema, ExternalSkillCandidateSourceTypeSchema, ExternalSkillCandidateEvaluationVerdictSchema, DiscoverySourceSchema, ExternalSkillCandidateSchema, ExternalSkillsConfigSchema, DEFAULT_EXTERNAL_SKILLS_CONFIG, resolveExternalSkillsConfig, PluginConfigSchema };
2224
+ export { ORCHESTRATOR_NAME, ALL_SUBAGENT_NAMES, ALL_AGENT_NAMES, TOOL_NAMES, TOOL_NAME_SET, AGENT_TOOL_MAP, DEFAULT_AGENT_CONFIGS, _internals, isKnownCanonicalRole, getCanonicalAgentRole, resolveGeneratedAgentRole, stripKnownSwarmPrefix, AgentReasoningConfigSchema, AgentThinkingConfigSchema, AgentOverrideConfigSchema, SwarmConfigSchema, HooksConfigSchema, ScoringWeightsSchema, DecisionDecaySchema, TokenRatiosSchema, ScoringConfigSchema, ContextBudgetConfigSchema, EvidenceConfigSchema, GateFeatureSchema, PlaceholderScanConfigSchema, QualityBudgetConfigSchema, GateConfigSchema, PipelineConfigSchema, PhaseCompleteConfigSchema, SummaryConfigSchema, ReviewPassesConfigSchema, AutoReviewConfigSchema, AdversarialDetectionConfigSchema, AdversarialTestingConfigSchema, IntegrationAnalysisConfigSchema, DocsConfigSchema, DesignDocsConfigSchema, UIReviewConfigSchema, CompactionAdvisoryConfigSchema, LintConfigSchema, SecretscanConfigSchema, GuardrailsProfileSchema, DEFAULT_AGENT_PROFILES, DEFAULT_ARCHITECT_PROFILE, GuardrailsConfigSchema, WatchdogConfigSchema, SelfReviewConfigSchema, resolveGuardrailsConfig, ToolFilterConfigSchema, PlanCursorConfigSchema, ContextMapConfigSchema, RepoGraphConfigSchema, CheckpointConfigSchema, AutomationModeSchema, AutomationCapabilitiesSchema, AutomationConfigSchema, KnowledgeConfigSchema, MemoryConfigSchema, CuratorConfigSchema, ArchitecturalSupervisionConfigSchema, KnowledgeApplicationConfigSchema, SkillPropagationConfigSchema, SkillImproverConfigSchema, SkillsConfigSchema, SpecWriterConfigSchema, SlopDetectorConfigSchema, IncrementalVerifyConfigSchema, CompactionConfigSchema, PrmConfigSchema, AgentAuthorityRuleSchema, AuthorityConfigSchema, GeneralCouncilConfigSchema, CouncilConfigSchema, PrMonitorConfigSchema, ParallelizationConfigSchema, WorktreeIsolationConfigSchema, LeanTurboConfigSchema, EpicConfigSchema, StandardTurboConfigSchema, LeanTurboStrategyConfigSchema, TurboConfigSchema, ExternalSkillCandidateSourceTypeSchema, ExternalSkillCandidateEvaluationVerdictSchema, DiscoverySourceSchema, ExternalSkillCandidateSchema, ExternalSkillsConfigSchema, DEFAULT_EXTERNAL_SKILLS_CONFIG, DEFAULT_SKILLS_CONFIG, resolveExternalSkillsConfig, PluginConfigSchema };
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  stripKnownSwarmPrefix
4
- } from "./index-tqbb2jx6.js";
4
+ } from "./index-471qxz9g.js";
5
5
  import {
6
6
  init_logger,
7
7
  warn
@@ -1,10 +1,10 @@
1
1
  // @bun
2
2
  import {
3
3
  handleGuardrailExplain
4
- } from "./index-a9ghr5cx.js";
4
+ } from "./index-0rgde8qc.js";
5
5
  import {
6
6
  handleGuardrailLog
7
- } from "./index-rdc6nvmw.js";
7
+ } from "./index-gnd1280x.js";
8
8
  import {
9
9
  COMMAND_REGISTRY,
10
10
  SWARM_COMMAND_TOOL_ALLOWLIST,
@@ -78,17 +78,17 @@ import {
78
78
  handleWriteRetroCommand,
79
79
  normalizeSwarmCommandInput,
80
80
  resolveCommand
81
- } from "./index-sgdr2e4n.js";
82
- import"./index-b223mczb.js";
81
+ } from "./index-zgba613y.js";
82
+ import"./index-5z2e78tv.js";
83
83
  import"./index-2a6ppa65.js";
84
84
  import"./index-fjxjb66n.js";
85
85
  import"./index-hb10a2g8.js";
86
- import"./index-xx3sv77e.js";
86
+ import"./index-zy22fg5h.js";
87
87
  import {
88
88
  AGENT_TOOL_MAP,
89
89
  ORCHESTRATOR_NAME,
90
90
  stripKnownSwarmPrefix
91
- } from "./index-tqbb2jx6.js";
91
+ } from "./index-471qxz9g.js";
92
92
  import"./index-4c5jpmn9.js";
93
93
  import"./index-adz3nk9b.js";
94
94
  import"./index-v4fcn4tr.js";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  redactPath,
4
4
  redactShellCommand
5
- } from "./index-b223mczb.js";
5
+ } from "./index-5z2e78tv.js";
6
6
 
7
7
  // src/services/guardrail-log-service.ts
8
8
  import * as fs from "fs/promises";
@@ -57,7 +57,7 @@ import {
57
57
  readDoctorArtifact,
58
58
  removeStraySwarmDir,
59
59
  runConfigDoctor
60
- } from "./index-xx3sv77e.js";
60
+ } from "./index-zy22fg5h.js";
61
61
  import {
62
62
  AGENT_TOOL_MAP,
63
63
  ALL_SUBAGENT_NAMES,
@@ -70,7 +70,7 @@ import {
70
70
  TOOL_NAME_SET,
71
71
  resolveExternalSkillsConfig,
72
72
  stripKnownSwarmPrefix
73
- } from "./index-tqbb2jx6.js";
73
+ } from "./index-471qxz9g.js";
74
74
  import {
75
75
  MAX_TRANSIENT_RETRIES,
76
76
  PlanSchema,
@@ -909,7 +909,7 @@ var init_executor = __esm(() => {
909
909
  // package.json
910
910
  var package_default = {
911
911
  name: "opencode-swarm",
912
- version: "7.97.0",
912
+ version: "7.98.1",
913
913
  description: "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
914
914
  main: "dist/index.js",
915
915
  types: "dist/index.d.ts",
@@ -10193,48 +10193,49 @@ function recordSeenRetroSection(key, value, timestamp) {
10193
10193
  function hashContent(content) {
10194
10194
  return createHash3("sha1").update(content).digest("hex");
10195
10195
  }
10196
- function isWriteToSwarmPlan(input) {
10197
- if (typeof input !== "object" || input === null)
10198
- return false;
10199
- const record = input;
10200
- const toolName = record.toolName;
10201
- if (typeof toolName !== "string")
10202
- return false;
10203
- if (!["write", "edit", "apply_patch", "swarm_apply_patch"].includes(toolName))
10204
- return false;
10205
- const rawPath = record.path;
10206
- const rawFile = record.file;
10207
- const pathField = typeof rawPath === "string" ? rawPath.replace(/\\/g, "/") : undefined;
10208
- const fileField = typeof rawFile === "string" ? rawFile.replace(/\\/g, "/") : undefined;
10209
- if (typeof pathField === "string" && pathField.includes(".swarm/plan.md")) {
10210
- return true;
10211
- }
10212
- if (typeof fileField === "string" && fileField.includes(".swarm/plan.md")) {
10213
- return true;
10214
- }
10215
- return false;
10216
- }
10217
10196
  function isWriteToEvidenceFile(input) {
10218
- if (typeof input !== "object" || input === null)
10219
- return false;
10220
- const record = input;
10221
- const toolName = record.toolName;
10222
- if (typeof toolName !== "string")
10223
- return false;
10224
- if (!["write", "edit", "apply_patch", "swarm_apply_patch"].includes(toolName))
10197
+ const trigger = normalizeWriteTrigger(input);
10198
+ return isEvidencePath(trigger?.filePath);
10199
+ }
10200
+ var WRITE_TOOLS = new Set([
10201
+ "write",
10202
+ "edit",
10203
+ "apply_patch",
10204
+ "swarm_apply_patch"
10205
+ ]);
10206
+ function isRecord(value) {
10207
+ return typeof value === "object" && value !== null;
10208
+ }
10209
+ function normalizePathField(value) {
10210
+ return typeof value === "string" ? value.replace(/\\/g, "/") : null;
10211
+ }
10212
+ function firstPathFromRecord(record) {
10213
+ return normalizePathField(record.path) ?? normalizePathField(record.filePath) ?? normalizePathField(record.file);
10214
+ }
10215
+ function normalizeWriteTrigger(input, output) {
10216
+ if (!isRecord(input))
10217
+ return null;
10218
+ const toolName = typeof input.toolName === "string" ? input.toolName : typeof input.tool === "string" ? input.tool : null;
10219
+ if (!toolName || !WRITE_TOOLS.has(toolName))
10220
+ return null;
10221
+ const inputArgs = isRecord(input.args) ? input.args : null;
10222
+ const outputArgs = isRecord(output) && isRecord(output.args) ? output.args : null;
10223
+ const filePath = firstPathFromRecord(input) ?? (inputArgs ? firstPathFromRecord(inputArgs) : null) ?? (outputArgs ? firstPathFromRecord(outputArgs) : null);
10224
+ if (!filePath)
10225
+ return null;
10226
+ return {
10227
+ toolName,
10228
+ filePath,
10229
+ sessionID: typeof input.sessionID === "string" ? input.sessionID : "default"
10230
+ };
10231
+ }
10232
+ function isEvidencePath(filePath) {
10233
+ if (!filePath)
10225
10234
  return false;
10226
- const rawPath = record.path;
10227
- const rawFile = record.file;
10228
- const pathField = typeof rawPath === "string" ? rawPath.replace(/\\/g, "/") : undefined;
10229
- const fileField = typeof rawFile === "string" ? rawFile.replace(/\\/g, "/") : undefined;
10230
- const evidenceRegex = /\.swarm\/+evidence\/+/i;
10231
- if (typeof pathField === "string" && evidenceRegex.test(pathField)) {
10232
- return true;
10233
- }
10234
- if (typeof fileField === "string" && evidenceRegex.test(fileField)) {
10235
- return true;
10236
- }
10237
- return false;
10235
+ return /(?:^|\/)\.swarm\/+evidence\//i.test(filePath);
10236
+ }
10237
+ function isPlanPath(filePath) {
10238
+ return filePath?.includes(".swarm/plan.md") ?? false;
10238
10239
  }
10239
10240
  function extractRetrospectiveSection(planContent) {
10240
10241
  const headingRegex = /^###\s+Lessons\s+Learned$/m;
@@ -10941,24 +10942,22 @@ async function runAutoPromotion(directory, config) {
10941
10942
  }
10942
10943
  }
10943
10944
  function createKnowledgeCuratorHook(directory, config, options = {}) {
10944
- const handler = async (input, _output) => {
10945
+ const handler = async (input, output) => {
10945
10946
  pruneSeenRetroSections();
10946
10947
  if (!config.enabled)
10947
10948
  return;
10948
- if (!isWriteToSwarmPlan(input) && !isWriteToEvidenceFile(input))
10949
+ const trigger = normalizeWriteTrigger(input, output);
10950
+ if (!trigger)
10951
+ return;
10952
+ const isPlanTrigger = isPlanPath(trigger.filePath);
10953
+ const isEvidenceTrigger = isEvidencePath(trigger.filePath) && !isPlanTrigger;
10954
+ if (!isPlanTrigger && !isEvidenceTrigger)
10949
10955
  return;
10950
- const sessionID = input?.sessionID ?? "default";
10951
- const isEvidenceTrigger = isWriteToEvidenceFile(input) && !isWriteToSwarmPlan(input);
10952
10956
  if (isEvidenceTrigger) {
10953
- const record = input;
10954
- const rawPath = record.path;
10955
- const rawFile = record.file;
10956
- const filePath = typeof rawPath === "string" ? rawPath.replace(/\\/g, "/") : typeof rawFile === "string" ? rawFile.replace(/\\/g, "/") : null;
10957
- if (!filePath)
10958
- return;
10959
- const evidenceKey = `evidence:${sessionID}:${filePath}`;
10957
+ const relativeEvidencePath = trigger.filePath.replace(/^.*\.swarm\//, "");
10958
+ const evidenceKey = `evidence:${trigger.sessionID}:${relativeEvidencePath}`;
10960
10959
  const lastSeenEvidence = seenRetroSections.get(evidenceKey);
10961
- const evidenceContent = await readSwarmFileAsync(directory, filePath.replace(/^.*\.swarm\//, ""));
10960
+ const evidenceContent = await readSwarmFileAsync(directory, relativeEvidencePath);
10962
10961
  if (!evidenceContent)
10963
10962
  return;
10964
10963
  let evidenceData;
@@ -10986,7 +10985,7 @@ function createKnowledgeCuratorHook(directory, config, options = {}) {
10986
10985
  const projectName2 = evidenceData.project_name ?? "unknown";
10987
10986
  const phaseNumber2 = typeof evidenceData.phase_number === "number" ? evidenceData.phase_number : 1;
10988
10987
  await _internals17.curateAndStoreSwarm(lessons, projectName2, { phase_number: phaseNumber2 }, directory, config, {
10989
- llmDelegate: options.llmDelegateFactory?.(sessionID),
10988
+ llmDelegate: options.llmDelegateFactory?.(trigger.sessionID),
10990
10989
  enrichmentQuota: options.enrichmentQuota
10991
10990
  });
10992
10991
  return;
@@ -10997,7 +10996,7 @@ function createKnowledgeCuratorHook(directory, config, options = {}) {
10997
10996
  const section = extractRetrospectiveSection(planContent);
10998
10997
  if (!section)
10999
10998
  return;
11000
- if (!checkRetroChanged(sessionID, section))
10999
+ if (!checkRetroChanged(trigger.sessionID, section))
11001
11000
  return;
11002
11001
  const allLessons = extractLessonsFromRetro(section);
11003
11002
  if (allLessons.length === 0)
@@ -11011,7 +11010,7 @@ function createKnowledgeCuratorHook(directory, config, options = {}) {
11011
11010
  const phaseMatch = /^Phase:\s*(\d+)/m.exec(planContent);
11012
11011
  const phaseNumber = phaseMatch ? parseInt(phaseMatch[1], 10) : 1;
11013
11012
  await _internals17.curateAndStoreSwarm(normalLessons, projectName, { phase_number: phaseNumber }, directory, config, {
11014
- llmDelegate: options.llmDelegateFactory?.(sessionID),
11013
+ llmDelegate: options.llmDelegateFactory?.(trigger.sessionID),
11015
11014
  enrichmentQuota: options.enrichmentQuota
11016
11015
  });
11017
11016
  };
@@ -13070,7 +13069,7 @@ async function runFinalizeStage(ctx) {
13070
13069
  }
13071
13070
  }
13072
13071
  try {
13073
- const { CuratorConfigSchema: CCS } = await import("./schema-a8fneygm.js");
13072
+ const { CuratorConfigSchema: CCS } = await import("./schema-mygkbbe9.js");
13074
13073
  const { config: pmLoadedConfig } = _internals20.loadPluginConfigWithMeta(ctx.directory);
13075
13074
  const curatorCfg = CCS.parse(pmLoadedConfig.curator ?? {});
13076
13075
  if (curatorCfg.enabled && curatorCfg.postmortem_enabled) {
@@ -16793,7 +16792,7 @@ async function handleDoctorCommand(directory, args) {
16793
16792
  const result = runConfigDoctor(config, directory);
16794
16793
  let output;
16795
16794
  if (enableAutoFix && result.hasAutoFixableIssues) {
16796
- const { runConfigDoctorWithFixes } = await import("./config-doctor-h1xrvq83.js");
16795
+ const { runConfigDoctorWithFixes } = await import("./config-doctor-7yrxfa6b.js");
16797
16796
  const fixResult = await runConfigDoctorWithFixes(directory, config, true);
16798
16797
  output = formatDoctorMarkdown(fixResult.result);
16799
16798
  } else {
@@ -31857,7 +31856,7 @@ function buildDetailedHelp(commandName, entry) {
31857
31856
  async function handleHelpCommand(ctx) {
31858
31857
  const targetCommand = ctx.args.join(" ");
31859
31858
  if (!targetCommand) {
31860
- const { buildHelpText } = await import("./index-byb9tgay.js");
31859
+ const { buildHelpText } = await import("./index-attgb1ma.js");
31861
31860
  return buildHelpText();
31862
31861
  }
31863
31862
  const tokens = targetCommand.split(/\s+/);
@@ -31866,7 +31865,7 @@ async function handleHelpCommand(ctx) {
31866
31865
  return _internals45.buildDetailedHelp(resolved.key, resolved.entry);
31867
31866
  }
31868
31867
  const similar = _internals45.findSimilarCommands(targetCommand);
31869
- const { buildHelpText: fullHelp } = await import("./index-byb9tgay.js");
31868
+ const { buildHelpText: fullHelp } = await import("./index-attgb1ma.js");
31870
31869
  if (similar.length > 0) {
31871
31870
  return `Command '/swarm ${targetCommand}' not found.
31872
31871
 
@@ -31999,7 +31998,7 @@ var COMMAND_REGISTRY = {
31999
31998
  },
32000
31999
  "guardrail explain": {
32001
32000
  handler: async (ctx) => {
32002
- const { handleGuardrailExplain } = await import("./guardrail-explain-t6svvtmn.js");
32001
+ const { handleGuardrailExplain } = await import("./guardrail-explain-cm08h4mt.js");
32003
32002
  return handleGuardrailExplain(ctx.directory, ctx.args);
32004
32003
  },
32005
32004
  description: "Dry-run: show what the guardrails would do to a command or write target (executes nothing)",
@@ -32009,7 +32008,7 @@ var COMMAND_REGISTRY = {
32009
32008
  },
32010
32009
  "guardrail-log": {
32011
32010
  handler: async (ctx) => {
32012
- const { handleGuardrailLog } = await import("./guardrail-log-9yyeccv5.js");
32011
+ const { handleGuardrailLog } = await import("./guardrail-log-53z1cf46.js");
32013
32012
  return handleGuardrailLog(ctx.directory, ctx.args);
32014
32013
  },
32015
32014
  description: "Read the guardrail decision log (use --blocks-only for blocks)",
@@ -3,7 +3,7 @@ import {
3
3
  ALL_AGENT_NAMES,
4
4
  PluginConfigSchema,
5
5
  stripKnownSwarmPrefix
6
- } from "./index-tqbb2jx6.js";
6
+ } from "./index-471qxz9g.js";
7
7
  import {
8
8
  log
9
9
  } from "./index-zgwm4ryv.js";
package/dist/cli/index.js CHANGED
@@ -7,15 +7,15 @@ import {
7
7
  getPluginLockFilePaths,
8
8
  package_default,
9
9
  resolveCommand
10
- } from "./index-sgdr2e4n.js";
11
- import"./index-b223mczb.js";
10
+ } from "./index-zgba613y.js";
11
+ import"./index-5z2e78tv.js";
12
12
  import"./index-2a6ppa65.js";
13
13
  import"./index-fjxjb66n.js";
14
14
  import"./index-hb10a2g8.js";
15
- import"./index-xx3sv77e.js";
15
+ import"./index-zy22fg5h.js";
16
16
  import {
17
17
  DEFAULT_AGENT_CONFIGS
18
- } from "./index-tqbb2jx6.js";
18
+ } from "./index-471qxz9g.js";
19
19
  import"./index-4c5jpmn9.js";
20
20
  import"./index-adz3nk9b.js";
21
21
  import"./index-v4fcn4tr.js";
@@ -22,6 +22,7 @@ import {
22
22
  DEFAULT_AGENT_PROFILES,
23
23
  DEFAULT_ARCHITECT_PROFILE,
24
24
  DEFAULT_EXTERNAL_SKILLS_CONFIG,
25
+ DEFAULT_SKILLS_CONFIG,
25
26
  DecisionDecaySchema,
26
27
  DesignDocsConfigSchema,
27
28
  DiscoverySourceSchema,
@@ -63,6 +64,7 @@ import {
63
64
  SelfReviewConfigSchema,
64
65
  SkillImproverConfigSchema,
65
66
  SkillPropagationConfigSchema,
67
+ SkillsConfigSchema,
66
68
  SlopDetectorConfigSchema,
67
69
  SpecWriterConfigSchema,
68
70
  StandardTurboConfigSchema,
@@ -81,7 +83,7 @@ import {
81
83
  resolveGeneratedAgentRole,
82
84
  resolveGuardrailsConfig,
83
85
  stripKnownSwarmPrefix
84
- } from "./index-tqbb2jx6.js";
86
+ } from "./index-471qxz9g.js";
85
87
  import"./index-p0arc26j.js";
86
88
  import"./index-293f68mj.js";
87
89
  import"./index-a76rekgs.js";
@@ -104,6 +106,7 @@ export {
104
106
  StandardTurboConfigSchema,
105
107
  SpecWriterConfigSchema,
106
108
  SlopDetectorConfigSchema,
109
+ SkillsConfigSchema,
107
110
  SkillPropagationConfigSchema,
108
111
  SkillImproverConfigSchema,
109
112
  SelfReviewConfigSchema,
@@ -145,6 +148,7 @@ export {
145
148
  DiscoverySourceSchema,
146
149
  DesignDocsConfigSchema,
147
150
  DecisionDecaySchema,
151
+ DEFAULT_SKILLS_CONFIG,
148
152
  DEFAULT_EXTERNAL_SKILLS_CONFIG,
149
153
  DEFAULT_ARCHITECT_PROFILE,
150
154
  DEFAULT_AGENT_PROFILES,
@@ -15,6 +15,8 @@ export declare const GENERAL_COUNCIL_TOOL_NAMES: readonly ["convene_general_coun
15
15
  export declare const GENERAL_COUNCIL_AGENT_TOOL_MAP: Partial<Record<AgentName, ToolName[]>>;
16
16
  export declare const TURBO_TOOL_NAMES: readonly ["lean_turbo_plan_lanes", "lean_turbo_acquire_locks", "lean_turbo_runner_status", "lean_turbo_review", "lean_turbo_run_phase", "lean_turbo_status"];
17
17
  export declare const TURBO_AGENT_TOOL_MAP: Partial<Record<AgentName, ToolName[]>>;
18
+ export declare const SKILL_TOOL_NAMES: readonly ["skill_generate", "skill_list", "skill_apply", "skill_inspect", "skill_regenerate", "skill_retire", "skill_improve"];
19
+ export declare const SKILL_AGENT_TOOL_MAP: Partial<Record<AgentName, ToolName[]>>;
18
20
  /**
19
21
  * Human-readable descriptions for tools shown in the architect Available Tools block.
20
22
  * Used to generate the Available Tools section of the architect prompt at construction time.
@@ -36,6 +38,8 @@ export declare function isQAAgent(name: string): name is QAAgentName;
36
38
  export declare function isSubagent(name: string): boolean;
37
39
  import type { LeanTurboConfig, ScoringConfig, WorktreeIsolationConfig } from './schema';
38
40
  export declare const DEFAULT_SCORING_CONFIG: ScoringConfig;
41
+ /** Unified injection budget is now configured only at the top level (context_budget.unified_injection_tokens). */
42
+ export declare const KNOWLEDGE_UNIFIED_INJECTION_TOKENS_DEFAULT: number | null;
39
43
  /**
40
44
  * Resolve scoring configuration by deep-merging user config with defaults.
41
45
  * Missing scoring block → use defaults; partial weights → merge with defaults.
@@ -204,6 +204,7 @@ export declare const ContextBudgetConfigSchema: z.ZodObject<{
204
204
  critical_threshold: z.ZodDefault<z.ZodNumber>;
205
205
  model_limits: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodNumber>>;
206
206
  max_injection_tokens: z.ZodDefault<z.ZodNumber>;
207
+ unified_injection_tokens: z.ZodOptional<z.ZodNumber>;
207
208
  tracked_agents: z.ZodDefault<z.ZodArray<z.ZodString>>;
208
209
  scoring: z.ZodOptional<z.ZodObject<{
209
210
  enabled: z.ZodDefault<z.ZodBoolean>;
@@ -757,6 +758,10 @@ export declare const SkillImproverConfigSchema: z.ZodObject<{
757
758
  allow_deterministic_fallback: z.ZodDefault<z.ZodBoolean>;
758
759
  }, z.core.$strip>;
759
760
  export type SkillImproverConfig = z.infer<typeof SkillImproverConfigSchema>;
761
+ export declare const SkillsConfigSchema: z.ZodObject<{
762
+ enabled: z.ZodDefault<z.ZodBoolean>;
763
+ }, z.core.$strip>;
764
+ export type SkillsConfig = z.infer<typeof SkillsConfigSchema>;
760
765
  export declare const SpecWriterConfigSchema: z.ZodObject<{
761
766
  enabled: z.ZodDefault<z.ZodBoolean>;
762
767
  model: z.ZodDefault<z.ZodNullable<z.ZodString>>;
@@ -1341,6 +1346,8 @@ export declare const ExternalSkillsConfigSchema: z.ZodObject<{
1341
1346
  export type ExternalSkillsConfig = z.infer<typeof ExternalSkillsConfigSchema>;
1342
1347
  /** Default external skills configuration (all subsystems disabled). */
1343
1348
  export declare const DEFAULT_EXTERNAL_SKILLS_CONFIG: ExternalSkillsConfig;
1349
+ /** Default skills configuration (tools gated off). */
1350
+ export declare const DEFAULT_SKILLS_CONFIG: SkillsConfig;
1344
1351
  /**
1345
1352
  * Resolve the external_skills config section, merging user-provided values
1346
1353
  * over defaults. Returns the default (all-disabled) config when
@@ -1474,6 +1481,7 @@ export declare const PluginConfigSchema: z.ZodObject<{
1474
1481
  critical_threshold: z.ZodDefault<z.ZodNumber>;
1475
1482
  model_limits: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodNumber>>;
1476
1483
  max_injection_tokens: z.ZodDefault<z.ZodNumber>;
1484
+ unified_injection_tokens: z.ZodOptional<z.ZodNumber>;
1477
1485
  tracked_agents: z.ZodDefault<z.ZodArray<z.ZodString>>;
1478
1486
  scoring: z.ZodOptional<z.ZodObject<{
1479
1487
  enabled: z.ZodDefault<z.ZodBoolean>;
@@ -2183,6 +2191,9 @@ export declare const PluginConfigSchema: z.ZodObject<{
2183
2191
  max_concurrent_fetches: z.ZodDefault<z.ZodNumber>;
2184
2192
  fetch_timeout_ms: z.ZodDefault<z.ZodNumber>;
2185
2193
  }, z.core.$strip>>;
2194
+ skills: z.ZodOptional<z.ZodObject<{
2195
+ enabled: z.ZodDefault<z.ZodBoolean>;
2196
+ }, z.core.$strip>>;
2186
2197
  }, z.core.$strip>;
2187
2198
  export type PluginConfig = z.infer<typeof PluginConfigSchema>;
2188
2199
  export type { AgentName, PipelineAgentName, QAAgentName, } from './constants';