@openviking/openclaw-plugin 2026.11.2 → 2026.11.5-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.
package/README.md CHANGED
@@ -45,6 +45,7 @@ Once installed, the plugin provides these agent tools:
45
45
  | `add_resource` | Import documents, URLs, or Git repos when explicitly enabled |
46
46
  | `add_skill` | Import OpenViking skills |
47
47
  | `ov_search` | Search imported resources and skills |
48
+ | `ov_rule_search` | Check constraints before an action or response and return complete compiled Rules |
48
49
  | `ov_read` | Read the full original content of one exact OpenViking URI |
49
50
  | `ov_multi_read` | Read the full original content of multiple OpenViking URIs |
50
51
  | `ov_list` | List OpenViking directories after search to inspect sibling chunks and overview files |
@@ -270,6 +271,7 @@ Beyond automatic behavior, the plugin exposes these tools directly:
270
271
  - `add_resource`: import a document, directory, URL, or Git repository as an OpenViking resource when explicitly enabled
271
272
  - `add_skill`: import or register an OpenViking skill
272
273
  - `ov_search`: search OpenViking resources and skills, especially after importing them
274
+ - `ov_rule_search`: send `task_context` and optional `rule_probability_threshold` (default `0.65`) to `POST /api/v1/rules/search`. Returns complete Rules with conditions and exceptions. Enabled by default; the `rules` group can select or disable it.
273
275
  - `ov_read`: read one exact `viking://` URI returned by `ov_search` or `ov_list`
274
276
  - `ov_multi_read`: read multiple exact `viking://` URIs, useful for an overview plus sibling chunks
275
277
  - `ov_list`: list a hit's parent directory after `ov_search` to recover sibling chunks, `.overview.md`, and related split-document context
package/client.ts CHANGED
@@ -42,6 +42,12 @@ export type SearchContextResult = {
42
42
  stats?: Record<string, unknown>;
43
43
  };
44
44
 
45
+ export type RuleSearchResult = {
46
+ rendered?: string;
47
+ rules?: unknown[];
48
+ [key: string]: unknown;
49
+ };
50
+
45
51
  export type SearchContextOptions = {
46
52
  sessionId?: string;
47
53
  limit?: number;
@@ -487,6 +493,20 @@ export class OpenVikingClient {
487
493
  }, undefined, actorPeerId);
488
494
  }
489
495
 
496
+ async ruleSearch(
497
+ taskContext: string,
498
+ ruleProbabilityThreshold: number = 0.65,
499
+ actorPeerId?: string,
500
+ ): Promise<RuleSearchResult> {
501
+ return this.request<RuleSearchResult>("/api/v1/rules/search", {
502
+ method: "POST",
503
+ body: JSON.stringify({
504
+ task_context: taskContext,
505
+ rule_probability_threshold: ruleProbabilityThreshold,
506
+ }),
507
+ }, undefined, actorPeerId);
508
+ }
509
+
490
510
  async searchContext(
491
511
  query: string,
492
512
  options: SearchContextOptions = {},
package/config.ts CHANGED
@@ -177,6 +177,7 @@ export const OPENVIKING_ADD_RESOURCE_TOOL_NAME = "add_resource" as const;
177
177
  export const OPENVIKING_DEFAULT_ENABLED_TOOL_NAMES = [
178
178
  "add_skill",
179
179
  "ov_search",
180
+ "ov_rule_search",
180
181
  "ov_read",
181
182
  "ov_multi_read",
182
183
  "ov_list",
@@ -200,6 +201,7 @@ export const OPENVIKING_TOOL_GROUPS: Record<string, readonly OpenVikingToolName[
200
201
  default: OPENVIKING_DEFAULT_ENABLED_TOOL_NAMES,
201
202
  memory: ["memory_recall", "memory_store", "memory_forget"],
202
203
  resource_query: ["ov_search", "ov_read", "ov_multi_read", "ov_list"],
204
+ rules: ["ov_rule_search"],
203
205
  import: ["add_resource", "add_skill"],
204
206
  recall_trace: ["ov_recall_trace"],
205
207
  archive: ["ov_archive_search", "ov_archive_expand"],
@@ -996,7 +998,7 @@ export const memoryOpenVikingConfigSchema = {
996
998
  enabledTools: {
997
999
  label: "Enabled Tools",
998
1000
  placeholder: "default",
999
- help: "Agent-visible tool allowlist. Accepts tool names or groups: default, all, memory, resource_query, import, recall_trace, archive, tool_result. add_resource also requires enableAddResourceTool=true.",
1001
+ help: "Agent-visible tool allowlist. Accepts tool names or groups: default, all, memory, resource_query, rules, import, recall_trace, archive, tool_result. add_resource also requires enableAddResourceTool=true.",
1000
1002
  advanced: true,
1001
1003
  },
1002
1004
  disabledTools: {
package/dist/client.js CHANGED
@@ -189,6 +189,15 @@ export class OpenVikingClient {
189
189
  body: JSON.stringify(body),
190
190
  }, undefined, actorPeerId);
191
191
  }
192
+ async ruleSearch(taskContext, ruleProbabilityThreshold = 0.65, actorPeerId) {
193
+ return this.request("/api/v1/rules/search", {
194
+ method: "POST",
195
+ body: JSON.stringify({
196
+ task_context: taskContext,
197
+ rule_probability_threshold: ruleProbabilityThreshold,
198
+ }),
199
+ }, undefined, actorPeerId);
200
+ }
192
201
  async searchContext(query, options = {}) {
193
202
  const contractConfig = {
194
203
  recallLimit: options.limit,
package/dist/config.js CHANGED
@@ -34,6 +34,7 @@ export const OPENVIKING_ADD_RESOURCE_TOOL_NAME = "add_resource";
34
34
  export const OPENVIKING_DEFAULT_ENABLED_TOOL_NAMES = [
35
35
  "add_skill",
36
36
  "ov_search",
37
+ "ov_rule_search",
37
38
  "ov_read",
38
39
  "ov_multi_read",
39
40
  "ov_list",
@@ -56,6 +57,7 @@ export const OPENVIKING_TOOL_GROUPS = {
56
57
  default: OPENVIKING_DEFAULT_ENABLED_TOOL_NAMES,
57
58
  memory: ["memory_recall", "memory_store", "memory_forget"],
58
59
  resource_query: ["ov_search", "ov_read", "ov_multi_read", "ov_list"],
60
+ rules: ["ov_rule_search"],
59
61
  import: ["add_resource", "add_skill"],
60
62
  recall_trace: ["ov_recall_trace"],
61
63
  archive: ["ov_archive_search", "ov_archive_expand"],
@@ -683,7 +685,7 @@ export const memoryOpenVikingConfigSchema = {
683
685
  enabledTools: {
684
686
  label: "Enabled Tools",
685
687
  placeholder: "default",
686
- help: "Agent-visible tool allowlist. Accepts tool names or groups: default, all, memory, resource_query, import, recall_trace, archive, tool_result. add_resource also requires enableAddResourceTool=true.",
688
+ help: "Agent-visible tool allowlist. Accepts tool names or groups: default, all, memory, resource_query, rules, import, recall_trace, archive, tool_result. add_resource also requires enableAddResourceTool=true.",
687
689
  advanced: true,
688
690
  },
689
691
  disabledTools: {
package/dist/index.js CHANGED
@@ -21,6 +21,7 @@ import { registerOpenVikingLifecycleHooks } from "./plugin/openviking-lifecycle-
21
21
  import { registerOpenVikingMemoryRecallTools } from "./plugin/openviking-memory-recall-tools.js";
22
22
  import { registerOpenVikingMemoryTools } from "./plugin/openviking-memory-tools.js";
23
23
  import { registerOpenVikingQueryTools } from "./plugin/openviking-query-tools.js";
24
+ import { registerOpenVikingRuleTools } from "./plugin/openviking-rule-tools.js";
24
25
  import { registerOpenVikingRecallTraceTools } from "./plugin/openviking-recall-trace-tools.js";
25
26
  import { createOpenVikingRuntimeState } from "./plugin/openviking-runtime-state.js";
26
27
  import { createOpenVikingSessionRoutingRuntime } from "./plugin/openviking-session-routing-runtime.js";
@@ -136,6 +137,13 @@ const contextEnginePlugin = {
136
137
  isBypassedSession,
137
138
  makeBypassedToolResult,
138
139
  });
140
+ registerOpenVikingRuleTools({
141
+ registerTool: registerOpenVikingTool,
142
+ getClient,
143
+ resolvePluginSessionRouting,
144
+ isBypassedSession,
145
+ makeBypassedToolResult,
146
+ });
139
147
  registerOpenVikingMemoryRecallTools({
140
148
  registerTool: registerOpenVikingTool,
141
149
  getClient,
@@ -0,0 +1,42 @@
1
+ import { Type } from "@sinclair/typebox";
2
+ export function registerOpenVikingRuleTools(deps) {
3
+ deps.registerTool((ctx) => ({
4
+ name: "ov_rule_search",
5
+ label: "Rule Search (OpenViking)",
6
+ description: "Check task-specific constraints before a planned action or response. " +
7
+ "Search compiled OpenViking Rules and return complete rule blocks, including applicability conditions and exceptions.",
8
+ parameters: Type.Object({
9
+ task_context: Type.String({
10
+ minLength: 1,
11
+ maxLength: 64000,
12
+ description: "User goal, planned action, and facts affecting Rule applicability.",
13
+ }),
14
+ rule_probability_threshold: Type.Optional(Type.Number({
15
+ minimum: 0,
16
+ maximum: 1,
17
+ default: 0.65,
18
+ description: "Minimum applicability probability.",
19
+ })),
20
+ }, { additionalProperties: false }),
21
+ async execute(_toolCallId, params) {
22
+ if (deps.isBypassedSession(ctx)) {
23
+ return deps.makeBypassedToolResult("ov_rule_search");
24
+ }
25
+ const taskContext = params.task_context;
26
+ const threshold = params.rule_probability_threshold === undefined ? 0.65 : params.rule_probability_threshold;
27
+ if (typeof taskContext !== "string" || !taskContext.trim() || taskContext.length > 64000) {
28
+ throw new Error("task_context must be a non-empty string of at most 64000 characters");
29
+ }
30
+ if (typeof threshold !== "number" || !Number.isFinite(threshold) || threshold < 0 || threshold > 1) {
31
+ throw new Error("rule_probability_threshold must be between 0 and 1");
32
+ }
33
+ const session = deps.resolvePluginSessionRouting(ctx);
34
+ const client = await deps.getClient();
35
+ const result = await client.ruleSearch(taskContext, threshold, session.actorPeerId);
36
+ if (typeof result.rendered !== "string") {
37
+ throw new Error("OpenViking Rule search returned no rendered Rules");
38
+ }
39
+ return { content: [{ type: "text", text: result.rendered }], details: result };
40
+ },
41
+ }), { name: "ov_rule_search" });
42
+ }
package/index.ts CHANGED
@@ -25,6 +25,7 @@ import { registerOpenVikingLifecycleHooks } from "./plugin/openviking-lifecycle-
25
25
  import { registerOpenVikingMemoryRecallTools } from "./plugin/openviking-memory-recall-tools.js";
26
26
  import { registerOpenVikingMemoryTools } from "./plugin/openviking-memory-tools.js";
27
27
  import { registerOpenVikingQueryTools } from "./plugin/openviking-query-tools.js";
28
+ import { registerOpenVikingRuleTools } from "./plugin/openviking-rule-tools.js";
28
29
  import { registerOpenVikingRecallTraceTools } from "./plugin/openviking-recall-trace-tools.js";
29
30
  import { createOpenVikingRuntimeState } from "./plugin/openviking-runtime-state.js";
30
31
  import { createOpenVikingSessionRoutingRuntime } from "./plugin/openviking-session-routing-runtime.js";
@@ -281,6 +282,14 @@ const contextEnginePlugin = {
281
282
  makeBypassedToolResult,
282
283
  });
283
284
 
285
+ registerOpenVikingRuleTools({
286
+ registerTool: registerOpenVikingTool,
287
+ getClient,
288
+ resolvePluginSessionRouting,
289
+ isBypassedSession,
290
+ makeBypassedToolResult,
291
+ });
292
+
284
293
  registerOpenVikingMemoryRecallTools({
285
294
  registerTool: registerOpenVikingTool,
286
295
  getClient,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "manifestVersion": "1.0",
3
- "pluginVersion": "2026.9.22",
3
+ "pluginVersion": "2026.11.3",
4
4
  "plugin": {
5
5
  "id": "openviking",
6
6
  "kind": "context-engine",
@@ -43,6 +43,7 @@
43
43
  "skills/install-openviking-memory/SKILL.md",
44
44
  "skills/openviking-context-database/SKILL.md",
45
45
  "skills/ov-experience-memory/SKILL.md",
46
+ "skills/openviking-rule-search/SKILL.md",
46
47
  "INSTALL-AGENT.md"
47
48
  ]
48
49
  },
@@ -16,6 +16,7 @@
16
16
  "add_resource",
17
17
  "add_skill",
18
18
  "ov_search",
19
+ "ov_rule_search",
19
20
  "ov_read",
20
21
  "ov_multi_read",
21
22
  "ov_list",
@@ -45,7 +46,8 @@
45
46
  "skills": [
46
47
  "./skills/install-openviking-memory",
47
48
  "./skills/openviking-context-database",
48
- "./skills/ov-experience-memory"
49
+ "./skills/ov-experience-memory",
50
+ "./skills/openviking-rule-search"
49
51
  ],
50
52
  "setup": {
51
53
  "providers": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openviking/openclaw-plugin",
3
- "version": "2026.11.2",
3
+ "version": "2026.11.5-1",
4
4
  "displayName": "OpenViking",
5
5
  "description": "OpenClaw context-engine plugin — OpenViking AI memory, long-term memory, knowledge base, semantic search, RAG, context engine. 长期记忆 · 知识库 · 语义检索 · 上下文引擎",
6
6
  "type": "module",
@@ -0,0 +1,60 @@
1
+ import { Type } from "@sinclair/typebox";
2
+ import type { OpenVikingClient } from "../client.js";
3
+ import type {
4
+ OpenVikingQuerySession,
5
+ OpenVikingQueryToolContext,
6
+ } from "./openviking-query-tools.js";
7
+
8
+ export type OpenVikingRuleToolsDeps = {
9
+ registerTool: (toolOrFactory: unknown, opts: { name: string }) => void;
10
+ getClient: () => Promise<Pick<OpenVikingClient, "ruleSearch">>;
11
+ resolvePluginSessionRouting: (ctx?: OpenVikingQueryToolContext) => OpenVikingQuerySession;
12
+ isBypassedSession: (ctx?: OpenVikingQueryToolContext) => boolean;
13
+ makeBypassedToolResult: (toolName: string) => unknown;
14
+ };
15
+
16
+ export function registerOpenVikingRuleTools(deps: OpenVikingRuleToolsDeps): void {
17
+ deps.registerTool(
18
+ (ctx: OpenVikingQueryToolContext) => ({
19
+ name: "ov_rule_search",
20
+ label: "Rule Search (OpenViking)",
21
+ description:
22
+ "Check task-specific constraints before a planned action or response. " +
23
+ "Search compiled OpenViking Rules and return complete rule blocks, including applicability conditions and exceptions.",
24
+ parameters: Type.Object({
25
+ task_context: Type.String({
26
+ minLength: 1,
27
+ maxLength: 64000,
28
+ description: "User goal, planned action, and facts affecting Rule applicability.",
29
+ }),
30
+ rule_probability_threshold: Type.Optional(Type.Number({
31
+ minimum: 0,
32
+ maximum: 1,
33
+ default: 0.65,
34
+ description: "Minimum applicability probability.",
35
+ })),
36
+ }, { additionalProperties: false }),
37
+ async execute(_toolCallId: string, params: Record<string, unknown>) {
38
+ if (deps.isBypassedSession(ctx)) {
39
+ return deps.makeBypassedToolResult("ov_rule_search");
40
+ }
41
+ const taskContext = params.task_context;
42
+ const threshold = params.rule_probability_threshold === undefined ? 0.65 : params.rule_probability_threshold;
43
+ if (typeof taskContext !== "string" || !taskContext.trim() || taskContext.length > 64000) {
44
+ throw new Error("task_context must be a non-empty string of at most 64000 characters");
45
+ }
46
+ if (typeof threshold !== "number" || !Number.isFinite(threshold) || threshold < 0 || threshold > 1) {
47
+ throw new Error("rule_probability_threshold must be between 0 and 1");
48
+ }
49
+ const session = deps.resolvePluginSessionRouting(ctx);
50
+ const client = await deps.getClient();
51
+ const result = await client.ruleSearch(taskContext, threshold, session.actorPeerId);
52
+ if (typeof result.rendered !== "string") {
53
+ throw new Error("OpenViking Rule search returned no rendered Rules");
54
+ }
55
+ return { content: [{ type: "text" as const, text: result.rendered }], details: result };
56
+ },
57
+ }),
58
+ { name: "ov_rule_search" },
59
+ );
60
+ }
@@ -1,6 +1,7 @@
1
1
  export type OpenVikingToolGroup =
2
2
  | "memory"
3
3
  | "resource_query"
4
+ | "rules"
4
5
  | "import"
5
6
  | "recall_trace"
6
7
  | "archive"
@@ -10,6 +11,7 @@ export type OpenVikingToolName =
10
11
  | "add_resource"
11
12
  | "add_skill"
12
13
  | "ov_search"
14
+ | "ov_rule_search"
13
15
  | "ov_read"
14
16
  | "ov_multi_read"
15
17
  | "ov_list"
@@ -41,6 +43,7 @@ export const OPENVIKING_TOOL_SPECS = [
41
43
  },
42
44
  { name: "add_skill", group: "import", defaultEnabled: true },
43
45
  { name: "ov_search", group: "resource_query", defaultEnabled: true },
46
+ { name: "ov_rule_search", group: "rules", defaultEnabled: true },
44
47
  { name: "ov_read", group: "resource_query", defaultEnabled: true },
45
48
  { name: "ov_multi_read", group: "resource_query", defaultEnabled: true },
46
49
  { name: "ov_list", group: "resource_query", defaultEnabled: true },
@@ -64,6 +67,7 @@ export const OPENVIKING_DEFAULT_ENABLED_TOOL_NAMES = OPENVIKING_TOOL_SPECS
64
67
  const OPENVIKING_TOOL_GROUP_ORDER: readonly OpenVikingToolGroup[] = [
65
68
  "memory",
66
69
  "resource_query",
70
+ "rules",
67
71
  "import",
68
72
  "recall_trace",
69
73
  "archive",
@@ -0,0 +1,39 @@
1
+ ---
2
+ name: openviking-rule-search
3
+ description: Retrieve applicable OpenViking Rules and check compliance. Use when planning an action or response subject to task-specific constraints.
4
+ metadata:
5
+ vikingbot:
6
+ always: true
7
+ ---
8
+
9
+ # OpenViking Rule Search
10
+
11
+ ## Goal
12
+
13
+ Use the registered OpenViking Rule search tool to retrieve the compiled Rules that constrain
14
+ the current task, then validate the planned action or response against every applicable Rule.
15
+ The host may expose it as `rule_search`, `openviking_rule_search`,
16
+ `mcp__openviking__rule_search`, `ov_rule_search`, `viking_rule_search`, or another
17
+ server-qualified variant; use the exact registered name.
18
+
19
+ ## Workflow
20
+
21
+ 1. Build `task_context` from the user's goal, the planned action or decision, and concrete facts
22
+ that may affect which Rules apply. Include material unknowns instead of guessing them.
23
+ 2. Call the registered Rule search tool with that `task_context`.
24
+ 3. Review every returned Rule independently. Apply a Rule when its `applies_when` condition is
25
+ supported by the task context and no `exception` applies.
26
+ 4. Adjust the planned action or response to comply with all applicable Rules.
27
+ 5. Call the Rule search tool again when new information materially changes the task context.
28
+
29
+ ## Boundaries
30
+
31
+ - Treat returned Rules as constraints, not as evidence that unobserved facts are true.
32
+ - Do not omit known facts from `task_context` to force a preferred result.
33
+ - A missing tool or failed request does not mean no Rules apply. Report the unavailable
34
+ check instead of substituting ordinary memory search for Rule search.
35
+ - `delivery.complete=false` means some matched Rules are absent from the inline context.
36
+ Read omitted compiled Rule URIs or the saved full result in bounded sections before acting.
37
+ Do not repeat an identical oversized search or treat the delivered subset as a complete check.
38
+ If the remaining Rules cannot be retrieved, report the incomplete check and pause the action.
39
+ - After context compaction expires older Rule lookups, refresh Rules for the current task.