@karmaniverous/jeeves-meta-openclaw 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Rollup configuration for the OpenClaw plugin package.
3
+ * Two entry points: plugin (ESM + declarations) and CLI (ESM executable).
4
+ *
5
+ * @module rollup.config
6
+ */
7
+ import type { RollupOptions } from 'rollup';
8
+ declare const _default: RollupOptions[];
9
+ export default _default;
@@ -0,0 +1,207 @@
1
+ # jeeves-meta — OpenClaw Skill
2
+
3
+ ## Overview
4
+
5
+ jeeves-meta is the Jeeves platform's knowledge synthesis engine. It discovers
6
+ `.meta/` directories, gathers context from the Qdrant vector index, and uses
7
+ a three-step LLM process (architect, builder, critic) to produce structured
8
+ synthesis artifacts.
9
+
10
+ ## Available Tools
11
+
12
+ ### synth_list
13
+ List all `.meta/` directories with summary stats and per-meta projection.
14
+ Supports filtering by path prefix, error status, staleness, and lock state.
15
+ Use for engine health checks and finding stale knowledge.
16
+
17
+ **Parameters:**
18
+ - `pathPrefix` (optional): Filter by path prefix (e.g. "github/")
19
+ - `filter` (optional): Structured filter (`{ hasError: true }`, `{ staleHours: 24 }`)
20
+ - `fields` (optional): Property projection array
21
+
22
+ ### synth_detail
23
+ Full detail for a single meta, with optional archive history.
24
+
25
+ **Parameters:**
26
+ - `path` (required): `.meta/` or owner directory path
27
+ - `fields` (optional): Property projection
28
+ - `includeArchive` (optional): false, true, or number (N most recent)
29
+
30
+ ### synth_preview
31
+ Dry-run for the next synthesis cycle. Shows scope files, delta files,
32
+ architect trigger reasons, steer status, and structure changes — without
33
+ running any LLM calls. Use before `synth_trigger` to understand what
34
+ will happen.
35
+
36
+ ### synth_trigger
37
+ Manually trigger a full synthesis cycle (architect → builder → critic) for
38
+ a specific meta or the next-stalest candidate.
39
+
40
+ **Parameters:**
41
+ - `path` (optional): Specific `.meta/` or owner directory path. If omitted,
42
+ synthesizes the stalest candidate.
43
+
44
+ ## When to Use
45
+
46
+ - **Checking synthesis health:** `synth_list`
47
+ - **Finding stale knowledge:** `synth_list` with `filter: { staleHours: 24 }`
48
+ - **Checking errors:** `synth_list` with `filter: { hasError: true }`
49
+ - **Getting full details:** `synth_detail` with optional `includeArchive: 5`
50
+ - **Understanding what a cycle will do:** `synth_preview`
51
+ - **Forcing a refresh:** `synth_trigger` with optional path
52
+ - **Reading synthesis output:** Use `watcher_search` with domain `synth-meta`
53
+
54
+ ## Key Concepts
55
+
56
+ - **Steering (`_steer`):** Human-written prompt in `meta.json` that guides
57
+ synthesis focus. The only field humans typically write.
58
+ - **Staleness:** Time since last synthesis. Deeper metas (leaves) update more
59
+ often than rollup metas (parents).
60
+ - **Three steps:** Architect crafts the task brief, Builder produces content,
61
+ Critic evaluates quality. The feedback loop self-improves over cycles.
62
+ - **Archives:** Each cycle creates a timestamped snapshot in `.meta/archive/`.
63
+
64
+ ## Configuration
65
+
66
+ ### Config File
67
+
68
+ Location determined by `JEEVES_META_CONFIG` env var or plugin `configPath` setting.
69
+ Canonical deployment: `J:\config\jeeves-meta.config.json`.
70
+
71
+ Key settings:
72
+ | Setting | Default | Description |
73
+ |---------|---------|-------------|
74
+ | `watchPaths` | (required) | Array of paths to scan for `.meta/` directories |
75
+ | `watcherUrl` | (required) | Watcher service URL (e.g. `http://localhost:1936`) |
76
+ | `gatewayUrl` | `http://127.0.0.1:3000` | OpenClaw gateway URL for subprocess spawning |
77
+ | `architectEvery` | 10 | Re-run architect every N cycles even if structure unchanged |
78
+ | `depthWeight` | 0.5 | Exponent for depth-based scheduling (0 = pure staleness) |
79
+ | `maxArchive` | 20 | Max archived snapshots per meta |
80
+ | `maxLines` | 500 | Max lines for builder context |
81
+ | `architectTimeout` | 120s | Architect subprocess timeout |
82
+ | `builderTimeout` | 600s | Builder subprocess timeout |
83
+ | `criticTimeout` | 300s | Critic subprocess timeout |
84
+
85
+ ### Prompt Customization
86
+
87
+ Default prompts live at `J:\config\jeeves-meta\prompts\{architect,critic}.md`,
88
+ referenced via `@file:` in the config:
89
+
90
+ ```json
91
+ {
92
+ "defaultArchitect": "@file:jeeves-meta/prompts/architect.md",
93
+ "defaultCritic": "@file:jeeves-meta/prompts/critic.md"
94
+ }
95
+ ```
96
+
97
+ **Per-meta overrides:** Set `_architect` or `_critic` directly in a `meta.json`
98
+ to override the defaults for that specific entity.
99
+
100
+ ### Adding New Domains
101
+
102
+ 1. Create a `.meta/` directory under the domain path
103
+ 2. The engine auto-creates `meta.json` with a UUID on first discovery
104
+ 3. Optionally set `_steer`, `_depth`, and `_emphasis` in `meta.json`
105
+ 4. The entity appears in `synth_list` on the next cycle
106
+
107
+ ### Tuning Scheduling
108
+
109
+ - **`_depth`:** Higher = updates more often. Defaults from tree nesting.
110
+ - **`_emphasis`:** Per-meta multiplier (default 1). Set 2 to double depth effect, 0 to ignore depth.
111
+ - **`depthWeight`:** Global exponent. Set 0 for pure staleness rotation.
112
+
113
+ ## Bootstrapping
114
+
115
+ ### Prerequisites
116
+
117
+ Before the synthesis engine can operate:
118
+
119
+ 1. **jeeves-watcher** must be running and indexing data
120
+ - Verify: `curl http://localhost:1936/status` should return point count > 0
121
+ - The watcher provides both semantic search and structured scan
122
+
123
+ 2. **Qdrant** must be running with indexed data
124
+ - Verify: `curl http://localhost:6333/healthz`
125
+
126
+ 3. **Config file** must exist
127
+ - Default: path from `JEEVES_META_CONFIG` env var
128
+ - Must contain valid `watchPaths` and `watcherUrl`
129
+
130
+ 4. **Prompt files** must exist
131
+ - `J:\config\jeeves-meta\prompts\architect.md`
132
+ - `J:\config\jeeves-meta\prompts\critic.md`
133
+
134
+ 5. **Watch paths** must be indexed by the watcher
135
+ - The paths in `watchPaths` must overlap with the watcher's configured paths
136
+
137
+ ### Installation
138
+
139
+ ```bash
140
+ npx @karmaniverous/jeeves-meta-openclaw install
141
+ ```
142
+
143
+ Then restart the OpenClaw gateway to load the plugin.
144
+
145
+ ### First Synthesis
146
+
147
+ 1. Check discovery: `synth_list` — should show your `.meta/` entities
148
+ 2. Preview: `synth_preview` — verify scope files and delta detection
149
+ 3. Trigger: `synth_trigger` — run the first cycle
150
+ 4. Review: `synth_detail <path> --includeArchive 1` — check output quality
151
+ 5. Iterate on `_steer` prompts if needed
152
+
153
+ ## Troubleshooting
154
+
155
+ ### Watcher unreachable
156
+
157
+ **Symptom:** TOOLS.md shows "ACTION REQUIRED: jeeves-watcher is unreachable"
158
+ **Cause:** Watcher service not running or wrong URL in config
159
+ **Fix:**
160
+ 1. Check watcher status: `curl http://localhost:1936/status`
161
+ 2. If down, start the watcher service
162
+ 3. If running on a different port, update `watcherUrl` in config
163
+
164
+ ### No entities discovered
165
+
166
+ **Symptom:** `synth_list` returns empty, TOOLS.md shows "No synthesis entities found"
167
+ **Cause:** No `.meta/` directories in configured `watchPaths`, or paths not indexed
168
+ **Fix:**
169
+ 1. Check `watchPaths` in config matches where `.meta/` dirs exist
170
+ 2. Create `.meta/` directories if needed: `mkdir <domain>/.meta`
171
+ 3. Verify watcher indexes those paths
172
+
173
+ ### Synthesis stuck (locked entities)
174
+
175
+ **Symptom:** `synth_list` shows locked entities that never unlock
176
+ **Cause:** Previous synthesis crashed, leaving stale `.lock` file
177
+ **Fix:**
178
+ 1. Check lock: `synth_detail <path>` — look for `locked: true`
179
+ 2. Locks auto-expire after 30 minutes
180
+ 3. For immediate unlock: delete `.meta/.lock` file manually
181
+
182
+ ### Executor timeouts
183
+
184
+ **Symptom:** `synth_trigger` fails with timeout error
185
+ **Cause:** Subprocess took longer than configured timeout
186
+ **Fix:**
187
+ 1. Increase timeout in config (`architectTimeout`, `builderTimeout`, `criticTimeout`)
188
+ 2. Check if the LLM provider is slow or rate-limited
189
+ 3. Check scope size: large scopes with many files take longer
190
+
191
+ ### LLM errors in synthesis steps
192
+
193
+ **Symptom:** `synth_detail` shows `_error` field with step/code/message
194
+ **Cause:** Subprocess failed (API error, malformed output, rate limit)
195
+ **Fix:**
196
+ 1. Check error details: `synth_detail <path>` — the `_error.step` tells you which step failed
197
+ 2. Architect failure with existing `_builder`: engine reuses cached brief (self-healing)
198
+ 3. Architect failure without `_builder` (first run): retry with `synth_trigger`
199
+ 4. Builder failure: meta stays stale, retried next cycle automatically
200
+ 5. Critic failure: content saved without feedback, not critical
201
+
202
+ ## Gotchas
203
+
204
+ - `synth_trigger` runs a full LLM cycle (3 subprocess calls). It can take
205
+ several minutes.
206
+ - A locked meta (another synthesis in progress) will be skipped silently.
207
+ - First-run quality is lower — the feedback loop needs 2-3 cycles to calibrate.
@@ -0,0 +1,19 @@
1
+ /**
2
+ * CLI for installing/uninstalling the jeeves-meta OpenClaw plugin.
3
+ *
4
+ * Usage:
5
+ * npx \@karmaniverous/jeeves-meta-openclaw install
6
+ * npx \@karmaniverous/jeeves-meta-openclaw uninstall
7
+ *
8
+ * Bypasses OpenClaw's `plugins install` command, which has a known
9
+ * spawn EINVAL bug on Windows (https://github.com/openclaw/openclaw/issues/9224).
10
+ *
11
+ * Supports non-default installations via:
12
+ * - OPENCLAW_CONFIG env var (path to openclaw.json)
13
+ * - OPENCLAW_HOME env var (path to .openclaw directory)
14
+ * - Default: ~/.openclaw/openclaw.json
15
+ *
16
+ * @module cli
17
+ */
18
+ /** Patch OpenClaw config for install or uninstall. Returns log messages. */
19
+ export declare function patchConfig(config: Record<string, unknown>, mode: 'add' | 'remove'): string[];
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Config loader — re-exports from the library package.
3
+ *
4
+ * @module configLoader
5
+ */
6
+ export { loadSynthConfig } from '@karmaniverous/jeeves-meta';
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Shared types and utilities for the OpenClaw plugin.
3
+ *
4
+ * @module helpers
5
+ */
6
+ /** Minimal OpenClaw plugin API surface. */
7
+ export interface PluginApi {
8
+ config?: {
9
+ plugins?: {
10
+ entries?: Record<string, {
11
+ config?: Record<string, unknown>;
12
+ }>;
13
+ };
14
+ };
15
+ registerTool(tool: {
16
+ name: string;
17
+ description: string;
18
+ parameters: Record<string, unknown>;
19
+ execute: (id: string, params: Record<string, unknown>) => Promise<ToolResult>;
20
+ }, options?: {
21
+ optional?: boolean;
22
+ }): void;
23
+ }
24
+ /** Tool result shape. */
25
+ export interface ToolResult {
26
+ content: Array<{
27
+ type: string;
28
+ text: string;
29
+ }>;
30
+ isError?: boolean;
31
+ }
32
+ /**
33
+ * Resolve the config file path.
34
+ *
35
+ * Resolution order:
36
+ * 1. Plugin config `configPath` setting
37
+ * 2. `JEEVES_META_CONFIG` environment variable
38
+ * 3. Error — no default path
39
+ */
40
+ export declare function getConfigPath(api: PluginApi): string;
41
+ /** Format a successful tool result. */
42
+ export declare function ok(data: unknown): ToolResult;
43
+ /** Format an error tool result. */
44
+ export declare function fail(error: unknown): ToolResult;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * OpenClaw plugin for jeeves-meta.
3
+ *
4
+ * Registers synthesis tools, virtual inference rules, and starts
5
+ * the periodic TOOLS.md writer at gateway startup.
6
+ *
7
+ * @packageDocumentation
8
+ */
9
+ import type { PluginApi } from './helpers.js';
10
+ /** Register all jeeves-meta tools and rules with the OpenClaw plugin API. */
11
+ export default function register(api: PluginApi): void;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Generate the Meta menu content for TOOLS.md injection.
3
+ *
4
+ * Queries the watcher API for synthesis entity stats and produces
5
+ * a Markdown section suitable for agent system prompt injection.
6
+ *
7
+ * @module promptInjection
8
+ */
9
+ /**
10
+ * Generate the Meta menu Markdown for TOOLS.md.
11
+ *
12
+ * Three output modes:
13
+ * 1. Watcher unreachable - ACTION REQUIRED with diagnostic
14
+ * 2. No entities found - ACTION REQUIRED with setup guidance
15
+ * 3. Healthy - entity stats + tool listing + skill reference
16
+ *
17
+ * @param watcherUrl - Watcher API base URL.
18
+ * @returns Markdown string for the Meta section.
19
+ */
20
+ export declare function generateMetaMenu(watcherUrl: string): Promise<string>;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Virtual rule definitions and registration for jeeves-meta.
3
+ *
4
+ * Registers three inference rules with the watcher at plugin startup:
5
+ * 1. synth-meta-live — indexes live .meta/meta.json files
6
+ * 2. synth-meta-archive — indexes archived snapshots
7
+ * 3. synth-config — indexes the synth config file
8
+ *
9
+ * @module rules
10
+ */
11
+ /**
12
+ * Register jeeves-meta virtual rules with the watcher.
13
+ *
14
+ * Called at plugin startup. Rules are additive — the watcher appends
15
+ * them after config-file rules (last-match-wins).
16
+ *
17
+ * @param watcherUrl - Base URL for the watcher service.
18
+ */
19
+ export declare function registerSynthRules(watcherUrl: string): Promise<void>;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Synth tool registrations for OpenClaw.
3
+ *
4
+ * @module tools
5
+ */
6
+ import { type PluginApi } from './helpers.js';
7
+ /** Register all synth_* tools. */
8
+ export declare function registerSynthTools(api: PluginApi): void;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Periodic TOOLS.md disk writer for the Meta section.
3
+ *
4
+ * Upserts a `## Meta` section under the shared `# Jeeves Platform Tools`
5
+ * header. The gateway reads TOOLS.md fresh from disk on each new session.
6
+ *
7
+ * @module toolsWriter
8
+ */
9
+ import type { PluginApi } from './helpers.js';
10
+ /**
11
+ * Upsert the Meta section in TOOLS.md content.
12
+ *
13
+ * Ordering convention: Watcher, Server, Meta.
14
+ * - If `## Meta` exists, replace in place.
15
+ * - Otherwise insert after `## Server` if present, after `## Watcher` if
16
+ * Server is absent, or after the H1.
17
+ */
18
+ export declare function upsertMetaSection(existing: string, metaMenu: string): string;
19
+ /**
20
+ * Start the periodic TOOLS.md writer.
21
+ * Defers first write by 5s, then refreshes every 60s.
22
+ *
23
+ * @param api - Plugin API.
24
+ * @param watcherUrl - Watcher API base URL.
25
+ */
26
+ export declare function startToolsWriter(api: PluginApi, watcherUrl: string): void;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Tests for the TOOLS.md upsert logic.
3
+ *
4
+ * @module toolsWriter.test
5
+ */
6
+ export {};
@@ -0,0 +1,18 @@
1
+ {
2
+ "id": "jeeves-meta-openclaw",
3
+ "name": "Jeeves Meta",
4
+ "description": "Knowledge synthesis tools — trigger synthesis, view status, manage entities.",
5
+ "version": "0.1.0",
6
+ "skills": [
7
+ "dist/skills/jeeves-meta"
8
+ ],
9
+ "configSchema": {
10
+ "type": "object",
11
+ "properties": {
12
+ "configPath": {
13
+ "type": "string",
14
+ "description": "Path to jeeves-meta.config.json. Falls back to JEEVES_META_CONFIG env var."
15
+ }
16
+ }
17
+ }
18
+ }
package/package.json ADDED
@@ -0,0 +1,119 @@
1
+ {
2
+ "name": "@karmaniverous/jeeves-meta-openclaw",
3
+ "version": "0.1.0",
4
+ "author": "Jason Williscroft",
5
+ "description": "OpenClaw plugin for jeeves-meta — synthesis tools and virtual rule registration",
6
+ "license": "BSD-3-Clause",
7
+ "type": "module",
8
+ "main": "dist/index.js",
9
+ "types": "dist/index.d.ts",
10
+ "bin": {
11
+ "jeeves-meta-openclaw": "./dist/cli.js"
12
+ },
13
+ "exports": {
14
+ ".": {
15
+ "import": {
16
+ "types": "./dist/index.d.ts",
17
+ "default": "./dist/index.js"
18
+ }
19
+ }
20
+ },
21
+ "files": [
22
+ "dist",
23
+ "openclaw.plugin.json"
24
+ ],
25
+ "publishConfig": {
26
+ "access": "public"
27
+ },
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "git+https://github.com/karmaniverous/jeeves-meta.git",
31
+ "directory": "packages/openclaw"
32
+ },
33
+ "bugs": {
34
+ "url": "https://github.com/karmaniverous/jeeves-meta/issues"
35
+ },
36
+ "homepage": "https://github.com/karmaniverous/jeeves-meta#readme",
37
+ "keywords": [
38
+ "openclaw",
39
+ "plugin",
40
+ "jeeves-meta",
41
+ "synthesis"
42
+ ],
43
+ "engines": {
44
+ "node": ">=20"
45
+ },
46
+ "openclaw": {
47
+ "extensions": [
48
+ "./dist/index.js"
49
+ ]
50
+ },
51
+ "auto-changelog": {
52
+ "output": "CHANGELOG.md",
53
+ "unreleased": true,
54
+ "commitLimit": false,
55
+ "hideCredit": true
56
+ },
57
+ "devDependencies": {
58
+ "@dotenvx/dotenvx": "^1.54.1",
59
+ "@rollup/plugin-typescript": "^12.3.0",
60
+ "auto-changelog": "^2.5.0",
61
+ "cross-env": "^10.1.0",
62
+ "knip": "^5.85.0",
63
+ "release-it": "^19.2.4",
64
+ "rollup": "^4.59.0",
65
+ "tslib": "^2.8.1",
66
+ "vitest": "^4.0.18"
67
+ },
68
+ "scripts": {
69
+ "build": "npm run build:plugin && npm run build:skills",
70
+ "changelog": "auto-changelog",
71
+ "lint": "eslint .",
72
+ "lint:fix": "eslint --fix .",
73
+ "release": "dotenvx run -f .env.local -- release-it",
74
+ "release:pre": "dotenvx run -f .env.local -- release-it --no-git.requireBranch --github.prerelease --preRelease",
75
+ "knip": "knip",
76
+ "test": "vitest run",
77
+ "typecheck": "tsc",
78
+ "diagrams": "cd diagrams && plantuml -tpng -o ../assets -r .",
79
+ "build:plugin": "rimraf dist && cross-env NO_COLOR=1 rollup --config rollup.config.ts --configPlugin @rollup/plugin-typescript",
80
+ "build:skills": "node scripts/build-skills.mjs"
81
+ },
82
+ "release-it": {
83
+ "git": {
84
+ "changelog": "npx auto-changelog --unreleased-only --stdout --template https://raw.githubusercontent.com/release-it/release-it/main/templates/changelog-compact.hbs",
85
+ "commitMessage": "chore: release @karmaniverous/jeeves-meta-openclaw v${version}",
86
+ "tagName": "openclaw/${version}",
87
+ "requireBranch": "main"
88
+ },
89
+ "github": {
90
+ "release": true
91
+ },
92
+ "hooks": {
93
+ "after:bump": [
94
+ "node -e \"const f='openclaw.plugin.json';const j=JSON.parse(require('fs').readFileSync(f,'utf8'));j.version='${version}';require('fs').writeFileSync(f,JSON.stringify(j,null,2)+'\\n')\""
95
+ ],
96
+ "after:init": [
97
+ "npm run lint",
98
+ "npm run typecheck",
99
+ "npm run test",
100
+ "npm run build"
101
+ ],
102
+ "before:npm:release": [
103
+ "npx auto-changelog -p",
104
+ "git add -A"
105
+ ],
106
+ "after:release": [
107
+ "git switch -c release/openclaw/${version}",
108
+ "git push -u origin release/openclaw/${version}",
109
+ "git switch ${branchName}"
110
+ ]
111
+ },
112
+ "npm": {
113
+ "publish": true
114
+ }
115
+ },
116
+ "dependencies": {
117
+ "@karmaniverous/jeeves-meta": "*"
118
+ }
119
+ }