opencode-matrixx 2.6.10 → 2.6.12

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 (132) hide show
  1. package/README.md +6 -5
  2. package/dist/agents/architect/default.d.ts +1 -1
  3. package/dist/agents/architect/gpt.d.ts +1 -1
  4. package/dist/agents/dynamic-agent-prompt-builder.d.ts +6 -5
  5. package/dist/agents/oracle/plan-template.d.ts +1 -7
  6. package/dist/agents/oracle/system-prompt.d.ts +1 -1
  7. package/dist/cli.js +29 -86
  8. package/dist/config/schema/agent-overrides.d.ts +126 -126
  9. package/dist/config/schema/commands.d.ts +0 -5
  10. package/dist/config/schema/dcp.d.ts +3 -3
  11. package/dist/config/schema/hooks.d.ts +3 -2
  12. package/dist/config/schema/internal/permission.d.ts +8 -8
  13. package/dist/config/schema/knowledge.d.ts +34 -0
  14. package/dist/config/schema/matrixx-config.d.ts +145 -132
  15. package/dist/config/schema/tool-gating.d.ts +9 -0
  16. package/dist/config/schema.d.ts +2 -1
  17. package/dist/create-hooks.d.ts +3 -2
  18. package/dist/features/background-agent/manager.d.ts +19 -0
  19. package/dist/features/bdd/schema.d.ts +5 -5
  20. package/dist/features/builtin-commands/templates/evolution.d.ts +1 -1
  21. package/dist/features/builtin-commands/templates/start-work.d.ts +1 -1
  22. package/dist/features/builtin-commands/types.d.ts +1 -1
  23. package/dist/features/evolution/compressor/index.d.ts +2 -2
  24. package/dist/features/evolution/compressor/interface.d.ts +9 -4
  25. package/dist/features/evolution/compressor/llm.d.ts +14 -4
  26. package/dist/features/evolution/evaluator.d.ts +10 -0
  27. package/dist/features/evolution/pipeline.d.ts +3 -1
  28. package/dist/features/evolution/schema.d.ts +46 -0
  29. package/dist/features/evolution/store/budget-ledger.d.ts +46 -0
  30. package/dist/features/evolution/store/index.d.ts +5 -0
  31. package/dist/features/evolution/store/lifecycle.d.ts +52 -0
  32. package/dist/features/evolution/store/project-identity.d.ts +27 -0
  33. package/dist/features/evolution/store/query.d.ts +23 -0
  34. package/dist/features/evolution/{store.d.ts → store/trace-store.d.ts} +1 -1
  35. package/dist/features/evolution/types.d.ts +34 -1
  36. package/dist/features/evolution/writer-emit.d.ts +17 -0
  37. package/dist/features/evolution/writer-frontmatter.d.ts +23 -0
  38. package/dist/features/evolution/writer-supersede.d.ts +20 -0
  39. package/dist/features/evolution/writer.d.ts +4 -0
  40. package/dist/features/knowledge-hub/index.d.ts +3 -0
  41. package/dist/features/knowledge-hub/loader.d.ts +11 -0
  42. package/dist/features/knowledge-hub/resolver.d.ts +2 -0
  43. package/dist/features/mission-state/constants.d.ts +20 -0
  44. package/dist/features/mission-state/index.d.ts +1 -0
  45. package/dist/features/mission-state/plan-storage.d.ts +32 -6
  46. package/dist/features/mission-state/reconcile.d.ts +75 -0
  47. package/dist/features/mission-state/reconcile.test.d.ts +1 -0
  48. package/dist/features/mission-state/storage.d.ts +26 -0
  49. package/dist/features/mission-state/types.d.ts +6 -0
  50. package/dist/features/plan-contract/appendix.d.ts +14 -0
  51. package/dist/features/plan-contract/constants.d.ts +16 -0
  52. package/dist/features/plan-contract/front-matter.d.ts +34 -0
  53. package/dist/features/plan-contract/index.d.ts +14 -0
  54. package/dist/features/plan-contract/migration.d.ts +36 -0
  55. package/dist/features/plan-contract/schema.d.ts +32 -0
  56. package/dist/features/plan-contract/skeleton.d.ts +5 -0
  57. package/dist/features/plan-contract/types.d.ts +56 -0
  58. package/dist/features/plan-contract/validate.d.ts +9 -0
  59. package/dist/features/session-state/state.d.ts +0 -11
  60. package/dist/hooks/auto-slash-command/executor.d.ts +11 -3
  61. package/dist/hooks/auto-slash-command/hook.d.ts +0 -2
  62. package/dist/hooks/evolution-compressor/host-llm-call.d.ts +17 -0
  63. package/dist/hooks/index.d.ts +3 -2
  64. package/dist/hooks/knowledge-hub-guard/approvals.d.ts +5 -0
  65. package/dist/hooks/knowledge-hub-guard/hook.d.ts +15 -0
  66. package/dist/hooks/knowledge-hub-guard/hook.test.d.ts +1 -0
  67. package/dist/hooks/knowledge-hub-guard/index.d.ts +3 -0
  68. package/dist/hooks/knowledge-hub-injector/hook.d.ts +26 -0
  69. package/dist/hooks/knowledge-hub-injector/hook.test.d.ts +1 -0
  70. package/dist/hooks/knowledge-hub-injector/index.d.ts +2 -0
  71. package/dist/hooks/knowledge-hub-search-nudge/hook.d.ts +16 -0
  72. package/dist/hooks/knowledge-hub-search-nudge/hook.test.d.ts +1 -0
  73. package/dist/hooks/knowledge-hub-search-nudge/index.d.ts +2 -0
  74. package/dist/hooks/plan-persister/index.d.ts +4 -0
  75. package/dist/hooks/plan-persister/task-link.d.ts +31 -0
  76. package/dist/hooks/plan-persister/task-sync.d.ts +39 -0
  77. package/dist/hooks/plan-persister/task-sync.test.d.ts +1 -0
  78. package/dist/hooks/start-work/index.d.ts +1 -0
  79. package/dist/hooks/start-work/plan-filter.d.ts +48 -0
  80. package/dist/hooks/task-continuation-enforcer/constants.d.ts +0 -5
  81. package/dist/index.js +6247 -4111
  82. package/dist/matrixx.schema.json +88 -145
  83. package/dist/plugin/hooks/create-core-hooks.d.ts +3 -2
  84. package/dist/plugin/hooks/create-session-hooks.d.ts +1 -2
  85. package/dist/plugin/hooks/create-tool-guard-hooks.d.ts +3 -2
  86. package/dist/plugin/hooks/create-transform-hooks.d.ts +2 -1
  87. package/dist/plugin/tool-gating.d.ts +35 -0
  88. package/dist/shared/dcp-guidance.d.ts +16 -0
  89. package/dist/{tools/dcp-switch-profile/tools.d.ts → shared/dcp-switch-profile.d.ts} +1 -3
  90. package/dist/shared/index.d.ts +1 -0
  91. package/dist/tools/background-task/constants.d.ts +1 -0
  92. package/dist/tools/background-task/create-background-wait-all.d.ts +3 -0
  93. package/dist/tools/background-task/index.d.ts +1 -1
  94. package/dist/tools/background-task/tools.d.ts +1 -0
  95. package/dist/tools/background-task/types.d.ts +3 -0
  96. package/dist/tools/delegate-task/constants.d.ts +6 -0
  97. package/dist/tools/delegate-task/prompt-builder.d.ts +1 -0
  98. package/dist/tools/delegate-task/prompt-builder.tdd.test.d.ts +1 -0
  99. package/dist/tools/delegate-task/tdd-enforcement.test.d.ts +1 -0
  100. package/dist/tools/delegate-task/tools.d.ts +6 -0
  101. package/dist/tools/delegate-task/types.d.ts +1 -0
  102. package/dist/tools/evolution/constants.d.ts +24 -0
  103. package/dist/tools/evolution/index.d.ts +3 -0
  104. package/dist/tools/evolution/query-actions.d.ts +3 -0
  105. package/dist/tools/evolution/query-actions.test.d.ts +1 -0
  106. package/dist/tools/evolution/tools.d.ts +16 -0
  107. package/dist/tools/evolution/tools.test.d.ts +1 -0
  108. package/dist/tools/evolution/types.d.ts +20 -0
  109. package/dist/tools/index.d.ts +2 -1
  110. package/dist/tools/knowledge-hub-confirm/index.d.ts +1 -0
  111. package/dist/tools/knowledge-hub-confirm/tools.d.ts +12 -0
  112. package/dist/tools/knowledge-hub-confirm/tools.test.d.ts +1 -0
  113. package/dist/tools/plan/constants.d.ts +1 -0
  114. package/dist/tools/plan/index.d.ts +1 -0
  115. package/dist/tools/plan/plan-tasks.d.ts +3 -0
  116. package/dist/tools/plan/types.d.ts +10 -0
  117. package/package.json +1 -1
  118. package/dist/config/schema/failure-counter.d.ts +0 -7
  119. package/dist/features/builtin-commands/templates/bdd-backend.d.ts +0 -1
  120. package/dist/features/builtin-commands/templates/bdd-contract.d.ts +0 -1
  121. package/dist/features/builtin-commands/templates/bdd-frontend.d.ts +0 -1
  122. package/dist/features/builtin-commands/templates/bdd-tests.d.ts +0 -1
  123. package/dist/features/builtin-commands/templates/dcp-profile.d.ts +0 -1
  124. package/dist/hooks/failure-counter/counter.d.ts +0 -7
  125. package/dist/hooks/failure-counter/hook.d.ts +0 -18
  126. package/dist/hooks/failure-counter/index.d.ts +0 -3
  127. package/dist/hooks/failure-counter/patterns.d.ts +0 -6
  128. package/dist/hooks/hashline-edit-diff-enhancer/hook.d.ts +0 -28
  129. package/dist/hooks/hashline-edit-diff-enhancer/index.d.ts +0 -1
  130. package/dist/tools/dcp-switch-profile/index.d.ts +0 -1
  131. /package/dist/{hooks/failure-counter/counter.test.d.ts → features/knowledge-hub/loader.test.d.ts} +0 -0
  132. /package/dist/{hooks/failure-counter/patterns.test.d.ts → features/knowledge-hub/resolver.test.d.ts} +0 -0
@@ -209,7 +209,6 @@
209
209
  "runtime-fallback",
210
210
  "read-image-resizer",
211
211
  "webfetch-redirect-guard",
212
- "hashline-edit-diff-enhancer",
213
212
  "tool-pair-validator",
214
213
  "quality-gate",
215
214
  "task-notepad",
@@ -221,7 +220,9 @@
221
220
  "context-mode-enforcer",
222
221
  "task-edit-guard",
223
222
  "document-reader-guard",
224
- "failure-counter"
223
+ "knowledge-hub-guard",
224
+ "knowledge-hub-injector",
225
+ "knowledge-hub-search-nudge"
225
226
  ]
226
227
  },
227
228
  {}
@@ -246,12 +247,7 @@
246
247
  "research",
247
248
  "assembly",
248
249
  "ultrawork",
249
- "bdd-backend",
250
- "bdd-contract",
251
- "bdd-frontend",
252
- "bdd-pipeline",
253
- "bdd-tests",
254
- "dcp-profile"
250
+ "bdd-pipeline"
255
251
  ]
256
252
  }
257
253
  },
@@ -3976,117 +3972,7 @@
3976
3972
  "type": "boolean"
3977
3973
  },
3978
3974
  "profiles": {
3979
- "default": {
3980
- "economy": {
3981
- "pruneNotification": "off",
3982
- "compress": {
3983
- "maxContextLimit": "30%",
3984
- "minContextLimit": "20%",
3985
- "nudgeFrequency": 2,
3986
- "nudgeForce": "strong",
3987
- "iterationNudgeThreshold": 7
3988
- },
3989
- "turnProtection": {
3990
- "enabled": false
3991
- },
3992
- "experimental": {
3993
- "allowSubAgents": false
3994
- },
3995
- "strategies": {
3996
- "purgeErrors": {
3997
- "turns": 1
3998
- }
3999
- }
4000
- },
4001
- "balanced": {
4002
- "pruneNotification": "minimal",
4003
- "compress": {
4004
- "maxContextLimit": "60%",
4005
- "minContextLimit": "30%",
4006
- "nudgeFrequency": 3,
4007
- "nudgeForce": "strong",
4008
- "iterationNudgeThreshold": 10
4009
- },
4010
- "turnProtection": {
4011
- "enabled": true,
4012
- "turns": 2
4013
- },
4014
- "experimental": {
4015
- "allowSubAgents": true
4016
- },
4017
- "strategies": {
4018
- "purgeErrors": {
4019
- "turns": 2
4020
- }
4021
- }
4022
- },
4023
- "performance": {
4024
- "pruneNotification": "minimal",
4025
- "compress": {
4026
- "maxContextLimit": "80%",
4027
- "minContextLimit": "35%",
4028
- "nudgeFrequency": 4,
4029
- "nudgeForce": "strong",
4030
- "iterationNudgeThreshold": 12
4031
- },
4032
- "turnProtection": {
4033
- "enabled": true,
4034
- "turns": 3
4035
- },
4036
- "experimental": {
4037
- "allowSubAgents": true
4038
- },
4039
- "strategies": {
4040
- "purgeErrors": {
4041
- "turns": 2
4042
- }
4043
- }
4044
- },
4045
- "ultimate": {
4046
- "pruneNotification": "detailed",
4047
- "compress": {
4048
- "maxContextLimit": "85%",
4049
- "minContextLimit": "40%",
4050
- "nudgeFrequency": 5,
4051
- "nudgeForce": "strong",
4052
- "iterationNudgeThreshold": 15,
4053
- "protectTags": true
4054
- },
4055
- "turnProtection": {
4056
- "enabled": true,
4057
- "turns": 5
4058
- },
4059
- "experimental": {
4060
- "allowSubAgents": true
4061
- },
4062
- "strategies": {
4063
- "purgeErrors": {
4064
- "turns": 4
4065
- }
4066
- }
4067
- },
4068
- "brutal": {
4069
- "pruneNotification": "off",
4070
- "compress": {
4071
- "maxContextLimit": "20%",
4072
- "minContextLimit": "10%",
4073
- "nudgeFrequency": 1,
4074
- "nudgeForce": "strong",
4075
- "iterationNudgeThreshold": 1
4076
- },
4077
- "turnProtection": {
4078
- "enabled": false
4079
- },
4080
- "experimental": {
4081
- "allowSubAgents": false
4082
- },
4083
- "strategies": {
4084
- "purgeErrors": {
4085
- "turns": 1
4086
- }
4087
- }
4088
- }
4089
- },
3975
+ "default": {},
4090
3976
  "type": "object",
4091
3977
  "propertyNames": {
4092
3978
  "type": "string"
@@ -4651,51 +4537,86 @@
4651
4537
  }
4652
4538
  ]
4653
4539
  },
4654
- "matrix_loop": {
4540
+ "knowledge": {
4655
4541
  "type": "object",
4656
4542
  "properties": {
4657
- "enabled": {
4658
- "default": false,
4659
- "type": "boolean"
4660
- },
4661
- "default_max_iterations": {
4662
- "default": 100,
4663
- "type": "number",
4664
- "minimum": 1,
4665
- "maximum": 1000
4666
- },
4667
- "state_dir": {
4668
- "type": "string"
4543
+ "hubs": {
4544
+ "default": [],
4545
+ "type": "array",
4546
+ "items": {
4547
+ "type": "object",
4548
+ "properties": {
4549
+ "name": {
4550
+ "type": "string"
4551
+ },
4552
+ "path": {
4553
+ "type": "string"
4554
+ },
4555
+ "index": {
4556
+ "default": "_index.md",
4557
+ "type": "string"
4558
+ },
4559
+ "scope": {
4560
+ "default": "global",
4561
+ "type": "string",
4562
+ "enum": [
4563
+ "global",
4564
+ "project"
4565
+ ]
4566
+ },
4567
+ "mode": {
4568
+ "default": "router-only",
4569
+ "type": "string",
4570
+ "enum": [
4571
+ "router-only",
4572
+ "pinned"
4573
+ ]
4574
+ },
4575
+ "exclude": {
4576
+ "default": [],
4577
+ "type": "array",
4578
+ "items": {
4579
+ "type": "string"
4580
+ }
4581
+ }
4582
+ },
4583
+ "required": [
4584
+ "name",
4585
+ "path",
4586
+ "index",
4587
+ "scope",
4588
+ "mode",
4589
+ "exclude"
4590
+ ],
4591
+ "additionalProperties": false
4592
+ }
4669
4593
  }
4670
4594
  },
4671
4595
  "required": [
4672
- "enabled",
4673
- "default_max_iterations"
4596
+ "hubs"
4674
4597
  ],
4675
4598
  "additionalProperties": false
4676
4599
  },
4677
- "failure_counter": {
4600
+ "matrix_loop": {
4678
4601
  "type": "object",
4679
4602
  "properties": {
4680
4603
  "enabled": {
4681
- "default": true,
4604
+ "default": false,
4682
4605
  "type": "boolean"
4683
4606
  },
4684
- "threshold": {
4685
- "default": 2,
4607
+ "default_max_iterations": {
4608
+ "default": 100,
4686
4609
  "type": "number",
4687
4610
  "minimum": 1,
4688
- "maximum": 10
4611
+ "maximum": 1000
4689
4612
  },
4690
- "resetOnSuccess": {
4691
- "default": true,
4692
- "type": "boolean"
4613
+ "state_dir": {
4614
+ "type": "string"
4693
4615
  }
4694
4616
  },
4695
4617
  "required": [
4696
4618
  "enabled",
4697
- "threshold",
4698
- "resetOnSuccess"
4619
+ "default_max_iterations"
4699
4620
  ],
4700
4621
  "additionalProperties": false
4701
4622
  },
@@ -4925,7 +4846,7 @@
4925
4846
  "type": "object",
4926
4847
  "properties": {
4927
4848
  "enabled": {
4928
- "default": false,
4849
+ "default": true,
4929
4850
  "type": "boolean"
4930
4851
  }
4931
4852
  },
@@ -5095,6 +5016,28 @@
5095
5016
  ],
5096
5017
  "additionalProperties": false
5097
5018
  },
5019
+ "tool_gating": {
5020
+ "type": "object",
5021
+ "properties": {
5022
+ "bdd_tools": {
5023
+ "type": "boolean"
5024
+ },
5025
+ "pdf_figures": {
5026
+ "type": "boolean"
5027
+ },
5028
+ "look_at": {
5029
+ "type": "boolean"
5030
+ },
5031
+ "preset_tools": {
5032
+ "default": false,
5033
+ "type": "boolean"
5034
+ }
5035
+ },
5036
+ "required": [
5037
+ "preset_tools"
5038
+ ],
5039
+ "additionalProperties": false
5040
+ },
5098
5041
  "security": {
5099
5042
  "type": "object",
5100
5043
  "properties": {
@@ -9,6 +9,7 @@ export declare function createCoreHooks(args: {
9
9
  inputSecretGuard: ReturnType<typeof import("../../hooks").createInputSecretGuardHook> | null;
10
10
  keywordDetector: ReturnType<typeof import("../../hooks").createKeywordDetectorHook> | null;
11
11
  contextInjectorMessagesTransform: ReturnType<typeof import("../../features/context-injector").createContextInjectorMessagesTransformHook>;
12
+ knowledgeHubInjector: ReturnType<typeof import("../../hooks").createKnowledgeHubInjectorHook> | null;
12
13
  envContextInjector: ReturnType<typeof import("../../hooks").createEnvContextInjectorHook> | null;
13
14
  thinkingBlockValidator: ReturnType<typeof import("../../hooks").createThinkingBlockValidatorHook> | null;
14
15
  toolPairValidator: ReturnType<typeof import("../../hooks").createToolPairValidatorHook> | null;
@@ -29,11 +30,12 @@ export declare function createCoreHooks(args: {
29
30
  contextModeEnforcer: ReturnType<typeof import("../../hooks").createContextModeEnforcerHook> | null;
30
31
  readImageResizer: ReturnType<typeof import("../../hooks").createReadImageResizerHook> | null;
31
32
  webfetchRedirectGuard: ReturnType<typeof import("../../hooks").createWebFetchRedirectGuardHook> | null;
32
- hashlineEditDiffEnhancer: ReturnType<typeof import("../../hooks").createHashlineEditDiffEnhancerHook> | null;
33
33
  qualityGate: ReturnType<typeof import("../../hooks").createQualityGateHook> | null;
34
34
  taskNotepad: ReturnType<typeof import("../../hooks").createTaskNotepadHook> | null;
35
35
  taskEditGuard: ReturnType<typeof import("../../hooks").createTaskEditGuardHook> | null;
36
36
  documentReaderGuard: ReturnType<typeof import("../../hooks").createDocumentReaderGuardHook> | null;
37
+ knowledgeHubGuard: ReturnType<typeof import("../../hooks").createKnowledgeHubGuardHook> | null;
38
+ knowledgeHubSearchNudge: ReturnType<typeof import("../../hooks").createKnowledgeHubSearchNudgeHook> | null;
37
39
  evolutionWatcher: ReturnType<typeof import("../../hooks").createEvolutionWatcherHook> | null;
38
40
  contextWindowMonitor: ReturnType<typeof import("../../hooks").createContextWindowMonitorHook> | null;
39
41
  preemptiveCompaction: ReturnType<typeof import("../../hooks").createPreemptiveCompactionHook> | null;
@@ -48,7 +50,6 @@ export declare function createCoreHooks(args: {
48
50
  matrixLoop: ReturnType<typeof import("../../hooks").createMatrixLoopHook> | null;
49
51
  editErrorRecovery: ReturnType<typeof import("../../hooks").createEditErrorRecoveryHook> | null;
50
52
  delegateTaskRetry: ReturnType<typeof import("../../hooks").createDelegateTaskRetryHook> | null;
51
- failureCounter: ReturnType<typeof import("../../hooks").createFailureCounterHook> | null;
52
53
  startWork: ReturnType<typeof import("../../hooks").createStartWorkHook> | null;
53
54
  oracleMdOnly: ReturnType<typeof import("../../hooks").createOracleMdOnlyHook> | null;
54
55
  mouseNotepad: ReturnType<typeof import("../../hooks").createMouseNotepadHook> | null;
@@ -1,5 +1,5 @@
1
1
  import type { HookName, MatrixxConfig } from "../../config";
2
- import { createAgentUsageReminderHook, createAutoUpdateCheckerHook, createContextWindowLimitRecoveryHook, createContextWindowMonitorHook, createDelegateTaskRetryHook, createEditErrorRecoveryHook, createFailureCounterHook, createInteractiveBashSessionHook, createMatrixLoopHook, createMouseNotepadHook, createNonInteractiveEnvHook, createOracleMdOnlyHook, createPreemptiveCompactionHook, createRtkBashRewriterHook, createRuntimeFallbackHook, createSessionNotification, createSessionRecoveryHook, createStartWorkHook, createTaskResumeInfoHook, createThinkModeHook } from "../../hooks";
2
+ import { createAgentUsageReminderHook, createAutoUpdateCheckerHook, createContextWindowLimitRecoveryHook, createContextWindowMonitorHook, createDelegateTaskRetryHook, createEditErrorRecoveryHook, createInteractiveBashSessionHook, createMatrixLoopHook, createMouseNotepadHook, createNonInteractiveEnvHook, createOracleMdOnlyHook, createPreemptiveCompactionHook, createRtkBashRewriterHook, createRuntimeFallbackHook, createSessionNotification, createSessionRecoveryHook, createStartWorkHook, createTaskResumeInfoHook, createThinkModeHook } from "../../hooks";
3
3
  import { createAnthropicEffortHook } from "../../hooks/anthropic-effort";
4
4
  import type { PluginContext } from "../types";
5
5
  export type SessionHooks = {
@@ -16,7 +16,6 @@ export type SessionHooks = {
16
16
  matrixLoop: ReturnType<typeof createMatrixLoopHook> | null;
17
17
  editErrorRecovery: ReturnType<typeof createEditErrorRecoveryHook> | null;
18
18
  delegateTaskRetry: ReturnType<typeof createDelegateTaskRetryHook> | null;
19
- failureCounter: ReturnType<typeof createFailureCounterHook> | null;
20
19
  startWork: ReturnType<typeof createStartWorkHook> | null;
21
20
  oracleMdOnly: ReturnType<typeof createOracleMdOnlyHook> | null;
22
21
  mouseNotepad: ReturnType<typeof createMouseNotepadHook> | null;
@@ -1,5 +1,5 @@
1
1
  import type { HookName, MatrixxConfig } from "../../config";
2
- import { createBackgroundTaskBlockerHook, createBashFileReadGuardHook, createCommentCheckerHooks, createContextModeEnforcerHook, createDirectoryAgentsInjectorHook, createDocumentReaderGuardHook, createEmptyTaskResponseDetectorHook, createEnvFileWriteGuardHook, createEvolutionWatcherHook, createHashlineEditDiffEnhancerHook, createHashlineReadEnhancerHook, createJsonErrorRecoveryHook, createQualityGateHook, createReadImageResizerHook, createRulesInjectorHook, createSecretLeakGuardHook, createTaskEditGuardHook, createTaskNotepadHook, createTasksTodowriteDisablerHook, createToolOutputTruncatorHook, createWebFetchRedirectGuardHook, createWriteExistingFileGuardHook } from "../../hooks";
2
+ import { createBackgroundTaskBlockerHook, createBashFileReadGuardHook, createCommentCheckerHooks, createContextModeEnforcerHook, createDirectoryAgentsInjectorHook, createDocumentReaderGuardHook, createEmptyTaskResponseDetectorHook, createEnvFileWriteGuardHook, createEvolutionWatcherHook, createHashlineReadEnhancerHook, createJsonErrorRecoveryHook, createKnowledgeHubGuardHook, createKnowledgeHubSearchNudgeHook, createQualityGateHook, createReadImageResizerHook, createRulesInjectorHook, createSecretLeakGuardHook, createTaskEditGuardHook, createTaskNotepadHook, createTasksTodowriteDisablerHook, createToolOutputTruncatorHook, createWebFetchRedirectGuardHook, createWriteExistingFileGuardHook } from "../../hooks";
3
3
  import type { PluginContext } from "../types";
4
4
  export type ToolGuardHooks = {
5
5
  backgroundTaskBlocker: ReturnType<typeof createBackgroundTaskBlockerHook> | null;
@@ -18,11 +18,12 @@ export type ToolGuardHooks = {
18
18
  contextModeEnforcer: ReturnType<typeof createContextModeEnforcerHook> | null;
19
19
  readImageResizer: ReturnType<typeof createReadImageResizerHook> | null;
20
20
  webfetchRedirectGuard: ReturnType<typeof createWebFetchRedirectGuardHook> | null;
21
- hashlineEditDiffEnhancer: ReturnType<typeof createHashlineEditDiffEnhancerHook> | null;
22
21
  qualityGate: ReturnType<typeof createQualityGateHook> | null;
23
22
  taskNotepad: ReturnType<typeof createTaskNotepadHook> | null;
24
23
  taskEditGuard: ReturnType<typeof createTaskEditGuardHook> | null;
25
24
  documentReaderGuard: ReturnType<typeof createDocumentReaderGuardHook> | null;
25
+ knowledgeHubGuard: ReturnType<typeof createKnowledgeHubGuardHook> | null;
26
+ knowledgeHubSearchNudge: ReturnType<typeof createKnowledgeHubSearchNudgeHook> | null;
26
27
  evolutionWatcher: ReturnType<typeof createEvolutionWatcherHook> | null;
27
28
  };
28
29
  export declare function createToolGuardHooks(args: {
@@ -1,12 +1,13 @@
1
1
  import type { MatrixxConfig } from "../../config";
2
2
  import { createContextInjectorMessagesTransformHook } from "../../features/context-injector";
3
- import { createDesignIntentPreserverHook, createEnvContextInjectorHook, createKeywordDetectorHook, createThinkingBlockValidatorHook, createToolPairValidatorHook } from "../../hooks";
3
+ import { createDesignIntentPreserverHook, createEnvContextInjectorHook, createKeywordDetectorHook, createKnowledgeHubInjectorHook, createThinkingBlockValidatorHook, createToolPairValidatorHook } from "../../hooks";
4
4
  import { createInputSecretGuardHook } from "../../hooks/input-secret-guard";
5
5
  import type { PluginContext } from "../types";
6
6
  export type TransformHooks = {
7
7
  inputSecretGuard: ReturnType<typeof createInputSecretGuardHook> | null;
8
8
  keywordDetector: ReturnType<typeof createKeywordDetectorHook> | null;
9
9
  contextInjectorMessagesTransform: ReturnType<typeof createContextInjectorMessagesTransformHook>;
10
+ knowledgeHubInjector: ReturnType<typeof createKnowledgeHubInjectorHook> | null;
10
11
  envContextInjector: ReturnType<typeof createEnvContextInjectorHook> | null;
11
12
  thinkingBlockValidator: ReturnType<typeof createThinkingBlockValidatorHook> | null;
12
13
  toolPairValidator: ReturnType<typeof createToolPairValidatorHook> | null;
@@ -0,0 +1,35 @@
1
+ /** Directories never descended into during the bounded startup scan. */
2
+ export declare const TOOL_GATING_SKIP_DIRS: readonly string[];
3
+ /** Maximum directory depth visited by the startup scan. */
4
+ export declare const TOOL_GATING_MAX_DEPTH = 4;
5
+ /** Maximum filesystem entries visited before the scan gives up. */
6
+ export declare const TOOL_GATING_MAX_ENTRIES = 2000;
7
+ /** File extensions that trigger look_at registration (lowercase, with leading dot). */
8
+ export declare const LOOK_AT_MEDIA_EXTENSIONS: readonly string[];
9
+ /** File extension that triggers BDD tool registration. */
10
+ export declare const BDD_FILE_EXTENSION = ".feature";
11
+ /** File extension that triggers pdf_extract_figures registration. */
12
+ export declare const PDF_FILE_EXTENSION = ".pdf";
13
+ /**
14
+ * Bounded sync scan: true when a file with one of the given extensions exists
15
+ * under the directory. Skips ignored dirs, caps depth and entries, exits early
16
+ * on the first match. Never throws — returns false on any filesystem error.
17
+ */
18
+ export declare function directoryHasMatch(directory: string | undefined, extensions: readonly string[]): boolean;
19
+ /** True unless the construct agent is listed in disabled_agents (case-insensitive). */
20
+ export declare function isConstructAgentEnabled(disabledAgents: readonly string[] | undefined): boolean;
21
+ /** BDD tools: explicit override wins, otherwise auto iff a *.feature file is found. */
22
+ export declare function shouldEnableBddTools(directory: string | undefined, override: boolean | undefined): boolean;
23
+ /** pdf_extract_figures: explicit override wins, otherwise auto iff a *.pdf file is found. */
24
+ export declare function shouldEnablePdfFigures(directory: string | undefined, override: boolean | undefined): boolean;
25
+ /**
26
+ * look_at: explicit true forces registration (bypasses both gates), explicit
27
+ * false forces skip, otherwise requires construct enabled AND a media file.
28
+ */
29
+ export declare function shouldEnableLookAt(directory: string | undefined, constructEnabled: boolean, override: boolean | undefined): boolean;
30
+ /** knowledge_hub_confirm: register iff at least one knowledge hub is configured. */
31
+ export declare function shouldEnableKnowledgeHubConfirm(hubs: readonly unknown[] | undefined): boolean;
32
+ /** preset: opt-in only, default false. */
33
+ export declare function shouldEnablePresetTools(override: boolean | undefined): boolean;
34
+ /** evolution tool: register iff evolution.enabled is true (default false). */
35
+ export declare function shouldEnableEvolutionTool(enabled: boolean | undefined): boolean;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * How DCP compression is available. "guided" = DCP auto-mode (nudges drive
3
+ * DCP's `compress` tool); "manual" = DCP manualMode (tool exists,
4
+ * trigger-only, no nudges); "none" = no `compress` tool exists.
5
+ */
6
+ export type DcpCompressionMode = "guided" | "manual" | "none";
7
+ export declare function _setDcpConfigPathForTesting(p: string | null | undefined): void;
8
+ export declare function _resetDcpGuidanceForTesting(): void;
9
+ /**
10
+ * How DCP compression is available in this environment.
11
+ * True model (DCP owns the only `compress` tool — the host has none):
12
+ * - "guided": DCP auto-mode — never bare without message IDs; proactive on closed sections with IDs + usage signals.
13
+ * - "manual": DCP manualMode — call `compress` only after the manual trigger; no nudges.
14
+ * - "none": no `compress` tool exists — never call it.
15
+ */
16
+ export declare function resolveDcpCompressionMode(): DcpCompressionMode;
@@ -1,5 +1,4 @@
1
- import { type ToolDefinition } from "@opencode-ai/plugin/tool";
2
- import type { DcpConfig } from "../../config/schema/dcp";
1
+ import type { DcpConfig } from "../config/schema/dcp";
3
2
  export interface DcpSwitchProfileOptions {
4
3
  pluginConfig?: {
5
4
  dcp?: DcpConfig;
@@ -12,4 +11,3 @@ export declare function deepMergeProfile(builtin: Record<string, unknown>, overr
12
11
  * a full inline DCP config to ~/.config/opencode/dcp.jsonc.
13
12
  */
14
13
  export declare function switchProfile(profile: string, options?: DcpSwitchProfileOptions): string;
15
- export declare function createDcpSwitchProfileTool(options?: DcpSwitchProfileOptions): Record<string, ToolDefinition>;
@@ -6,6 +6,7 @@ export * from "./config-errors";
6
6
  export * from "./connected-providers-cache";
7
7
  export * from "./context-mode-enforcement";
8
8
  export * from "./data-path";
9
+ export * from "./dcp-switch-profile";
9
10
  export * from "./deep-merge";
10
11
  export * from "./delay";
11
12
  export * from "./dynamic-truncator";
@@ -1,3 +1,4 @@
1
1
  export declare const BACKGROUND_OUTPUT_DESCRIPTION = "Get output from background task. Use full_session=true to fetch session messages with filters. System notifies on completion, so block=true rarely needed.";
2
2
  export declare const BACKGROUND_CANCEL_DESCRIPTION = "Cancel running background task(s). Use all=true to cancel ALL before final answer.";
3
3
  export declare const BACKGROUND_REVIVE_DESCRIPTION = "Revive a retained terminal background task with a NEW instruction.\n\nCall with no arguments (or list=true) to DISCOVER revivable tasks.\n\nRevivable: cancelled, stopped, interrupt, error, completed \u2014 provided the task still has a session ID.\nNot revivable: pending/running (still active \u2014 use background_output), statusUncertain (unknown liveness \u2014 pass force=true to acknowledge), and tasks that never produced a session (e.g. queue-saturated).\n\nHandles are retained for 30 minutes, so revive works after a task was pruned or the plugin restarted.";
4
+ export declare const BACKGROUND_WAIT_ALL_DESCRIPTION = "Wait for ALL running/pending background tasks in the current session to complete. Polls until all tasks reach a terminal state or timeout. Use this BEFORE background_cancel(all=true) to allow exploration tasks to finish and return their results.";
@@ -0,0 +1,3 @@
1
+ import { type ToolDefinition } from "@opencode-ai/plugin";
2
+ import type { BackgroundManager } from "../../features/background-agent";
3
+ export declare function createBackgroundWaitAll(manager: BackgroundManager): ToolDefinition;
@@ -1,3 +1,3 @@
1
1
  export * from "./constants";
2
- export { createBackgroundCancel, createBackgroundOutput, createBackgroundRevive, } from "./tools";
2
+ export { createBackgroundCancel, createBackgroundOutput, createBackgroundRevive, createBackgroundWaitAll, } from "./tools";
3
3
  export type * from "./types";
@@ -2,3 +2,4 @@ export type { BackgroundCancelClient, BackgroundOutputClient, BackgroundOutputMa
2
2
  export { createBackgroundCancel } from "./create-background-cancel";
3
3
  export { createBackgroundOutput } from "./create-background-output";
4
4
  export { createBackgroundRevive } from "./create-background-revive";
5
+ export { createBackgroundWaitAll } from "./create-background-wait-all";
@@ -13,6 +13,9 @@ export interface BackgroundCancelArgs {
13
13
  taskId?: string;
14
14
  all?: boolean;
15
15
  }
16
+ export interface BackgroundWaitAllArgs {
17
+ timeout?: number;
18
+ }
16
19
  export interface BackgroundReviveArgs {
17
20
  taskId?: string;
18
21
  session_id?: string;
@@ -1,5 +1,11 @@
1
1
  import type { AvailableCategory, AvailableSkill } from "../../agents/dynamic-agent-prompt-builder";
2
2
  import type { CategoryConfig } from "../../config/schema";
3
+ export declare const TDD_TEST_FIRST_APPEND = "<TDD_Test_First>\n**NO IMPLEMENTATION WITHOUT A FAILING TEST FIRST.**\n\nMandatory RED-GREEN-REFACTOR cycle:\n- RED: write a failing test first; run it and confirm it fails for the right reason.\n- GREEN: write the minimum code to make the test pass.\n- REFACTOR: clean up; tests stay green throughout.\n\nEvery test uses //#given (setup), //#when (action), //#then (assert) markers.\nVerify with `bun test` (0 failures) before reporting done.\n</TDD_Test_First>";
4
+ /**
5
+ * Code-writing categories requiring TDD enforcement (issue #127).
6
+ * Single source of truth for banner gating + fail-closed guard.
7
+ */
8
+ export declare function isCodeWritingCategory(category: string | undefined): boolean;
3
9
  export declare const DEFAULT_CATEGORIES: Record<string, CategoryConfig>;
4
10
  export declare const CATEGORY_PROMPT_APPENDS: Record<string, string>;
5
11
  export declare const CATEGORY_DESCRIPTIONS: Record<string, string>;
@@ -2,5 +2,6 @@ import type { BuildSystemContentInput } from "./types";
2
2
  /**
3
3
  * Build the system content to inject into the agent prompt.
4
4
  * Combines skill content, category prompt append, and plan agent system prepend.
5
+ * Appends the TDD test-first banner LAST only for code-writing categories.
5
6
  */
6
7
  export declare function buildSystemContent(input: BuildSystemContentInput): string | undefined;
@@ -0,0 +1 @@
1
+ export {};
@@ -3,4 +3,10 @@ import type { DelegateTaskToolOptions } from "./types";
3
3
  export { resolveCategoryConfig } from "./categories";
4
4
  export { buildSystemContent } from "./prompt-builder";
5
5
  export type { BuildSystemContentInput, DelegateTaskToolOptions, SyncSessionCreatedEvent } from "./types";
6
+ /**
7
+ * Fail-closed TDD enforcement for code-writing delegations (issue #127).
8
+ * Returns a hard error string when the delegation must be rejected, else null.
9
+ * Complexity: 1 — single exception path (source without the skill).
10
+ */
11
+ export declare function requireTddEnforcerForCodeWriting(category: string | undefined, loadSkills: string[]): string | null;
6
12
  export declare function createDelegateTask(options: DelegateTaskToolOptions): ToolDefinition;
@@ -81,6 +81,7 @@ export interface BuildSystemContentInput {
81
81
  skillContent?: string;
82
82
  categoryPromptAppend?: string;
83
83
  agentName?: string;
84
+ category?: string;
84
85
  availableCategories?: AvailableCategory[];
85
86
  availableSkills?: AvailableSkill[];
86
87
  }
@@ -0,0 +1,24 @@
1
+ /**
2
+ * evolution tool — description string and shared constants.
3
+ *
4
+ * The tool description is referenced by the tool factory and included in the
5
+ * LLM-facing tool schema, so keep it factual, concise, and triggerable.
6
+ */
7
+ /** Tool description — governance plus read-only retrieval actions. */
8
+ export declare const EVOLUTION_DESCRIPTION = "Govern self-evolution proposals staged in .matrixx/evolution/pending, and retrieve approved knowledge. Actions: 'list' (show pending proposals with version and confidence), 'get' (show a staged proposal), 'approve' (promote a pending skill and record the audit entry), 'reject' (discard a pending proposal), 'status' (state totals, pending count, and audit tail), 'search' (read-only scoped search over approved knowledge), 'get_context' (read-only scoped context, truncated at a char cap). Use this tool instead of shell commands for all evolution state.";
9
+ /** Allowlisted actions: Wave1 governance plus read-only retrieval queries. */
10
+ export declare const EVOLUTION_TOOL_ACTIONS: readonly ["list", "get", "approve", "reject", "status", "search", "get_context"];
11
+ /** The read-only retrieval surface — no action here may mutate evolution state. */
12
+ export declare const EVOLUTION_QUERY_ACTIONS: readonly ["search", "get_context"];
13
+ /** How many audit lines `status` reports. */
14
+ export declare const AUDIT_TAIL_LIMIT = 20;
15
+ /** Hard char cap for `get_context` output; cut text gets a truncation marker. */
16
+ export declare const GET_CONTEXT_CHAR_CAP = 4000;
17
+ /** Max records `search` reports. */
18
+ export declare const SEARCH_RESULT_LIMIT = 20;
19
+ /** Message when the scoped query finds nothing. */
20
+ export declare const NO_RETRIEVABLE_MESSAGE = "No retrievable knowledge for this scope.";
21
+ /** Slugs must stay inside the pending dir — no separators, no traversal. */
22
+ export declare const SLUG_PATTERN: RegExp;
23
+ /** Message when nothing is staged. */
24
+ export declare const NO_PENDING_MESSAGE = "No pending evolution proposals.";
@@ -0,0 +1,3 @@
1
+ export { AUDIT_TAIL_LIMIT, EVOLUTION_DESCRIPTION, EVOLUTION_QUERY_ACTIONS, EVOLUTION_TOOL_ACTIONS, GET_CONTEXT_CHAR_CAP, NO_PENDING_MESSAGE, NO_RETRIEVABLE_MESSAGE, SEARCH_RESULT_LIMIT, SLUG_PATTERN, } from "./constants";
2
+ export { createEvolutionTool, type EvolutionToolOptions } from "./tools";
3
+ export type { EvolutionToolAction, EvolutionToolArgs, PendingProposalSummary } from "./types";
@@ -0,0 +1,3 @@
1
+ import type { EvolutionToolArgs } from "./types";
2
+ export declare function handleSearch(projectRoot: string, args: EvolutionToolArgs): string;
3
+ export declare function handleGetContext(projectRoot: string, args: EvolutionToolArgs): string;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,16 @@
1
+ import type { PluginInput } from "@opencode-ai/plugin";
2
+ import { type ToolDefinition } from "@opencode-ai/plugin/tool";
3
+ import { type EvolutionWriterConfig } from "../../config/schema/evolution";
4
+ export type EvolutionToolOptions = {
5
+ writerConfig?: EvolutionWriterConfig;
6
+ };
7
+ /**
8
+ * `evolution` tool factory — governance + query host for self-evolution.
9
+ *
10
+ * Wave1 exposes the governance actions `list/get/approve/reject/status`,
11
+ * all delegated to the evolution store APIs (`EvolutionWriter`, `TraceStore`)
12
+ * so no shell command ever touches evolution state. T9 adds the read-only
13
+ * retrieval actions `search` and `get_context`, filtered through the T4a
14
+ * retrieval contract and scoped to the current project.
15
+ */
16
+ export declare function createEvolutionTool(ctx: PluginInput, options?: EvolutionToolOptions): Record<string, ToolDefinition>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,20 @@
1
+ import type { KnowledgeKind } from "../../features/evolution/types";
2
+ import type { EVOLUTION_TOOL_ACTIONS } from "./constants";
3
+ /** Allowlisted actions for the `evolution` tool. */
4
+ export type EvolutionToolAction = (typeof EVOLUTION_TOOL_ACTIONS)[number];
5
+ /** Flat args shape for the multi-action `evolution` tool. */
6
+ export type EvolutionToolArgs = {
7
+ action: EvolutionToolAction;
8
+ slug?: string;
9
+ global?: boolean;
10
+ /** (action=search/get_context) Case-insensitive text match; absent returns all in scope. */
11
+ query?: string;
12
+ /** (action=search/get_context) Restrict results to one knowledge kind. */
13
+ kind?: KnowledgeKind;
14
+ };
15
+ /** Pending proposal summary shown by the `list` action. */
16
+ export type PendingProposalSummary = {
17
+ slug: string;
18
+ version: string | null;
19
+ confidence: number | null;
20
+ };