@karmaniverous/jeeves 0.4.7 → 0.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
@@ -169,18 +169,28 @@ See the [Building a Component Plugin](https://docs.karmanivero.us/jeeves/documen
169
169
  - **`probeAllServices(consumerName?, timeoutMs?)`** — probes all known services (server, watcher, runner, meta).
170
170
  - **`checkRegistryVersion(packageName, cacheDir, ttlSeconds?)`** — checks npm registry for the latest version with local file caching (default 1-hour TTL).
171
171
 
172
+ ## Prerequisites
173
+
174
+ - **Node.js >= 22** — the CLI enforces this at startup.
175
+
172
176
  ## CLI
173
177
 
174
178
  ```bash
175
- jeeves install # Seed identity, protocols, platform content; create core config
179
+ jeeves install # Seed identity, protocols, platform content, skill, core config
176
180
  jeeves uninstall # Remove managed sections, templates, config schema
177
- jeeves status # Probe all service ports, report health table
181
+ jeeves status # Probe all service ports, report health + memory hygiene
182
+ jeeves config # Print effective config with provenance
183
+ jeeves config '$' # JSONPath query against effective config
178
184
  ```
179
185
 
180
- All three commands accept `--workspace <path>` and `--config-root <path>` options.
186
+ All commands accept `--workspace <path>` and `--config-root <path>` options.
187
+
188
+ `jeeves status` probes all registered component services, reports a health table, and prints a memory hygiene summary showing MEMORY.md character usage, budget utilization, and any stale sections.
181
189
 
182
190
  ## Configuration
183
191
 
192
+ ### Core Config
193
+
184
194
  Core config at `{configRoot}/jeeves-core/config.json`:
185
195
 
186
196
  ```json
@@ -196,6 +206,49 @@ Core config at `{configRoot}/jeeves-core/config.json`:
196
206
  }
197
207
  ```
198
208
 
209
+ ### Workspace Config
210
+
211
+ Optional `jeeves.config.json` at the workspace root provides shared defaults for all CLI commands:
212
+
213
+ ```json
214
+ {
215
+ "$schema": "./jeeves.config.schema.json",
216
+ "core": {
217
+ "workspace": "/path/to/workspace",
218
+ "configRoot": "/path/to/config",
219
+ "gatewayUrl": "http://localhost:3000"
220
+ },
221
+ "memory": {
222
+ "budget": 20000,
223
+ "warningThreshold": 0.8,
224
+ "staleDays": 90
225
+ }
226
+ }
227
+ ```
228
+
229
+ Precedence: **CLI flags → environment variables → `jeeves.config.json` → defaults**. Run `jeeves config` to see the effective resolved values with provenance tracking (which source each value came from).
230
+
231
+ ### Workspace Config API
232
+
233
+ - **`loadWorkspaceConfig(workspacePath)`** — loads and validates `jeeves.config.json` via Zod. Returns `undefined` (with a console warning) if the file is missing, corrupt, or fails validation.
234
+ - **`resolveConfigValue(options)`** — resolves a single config key through the precedence chain (flag → env → file → default) with provenance tracking.
235
+ - **`buildEffectiveConfig(options)`** — resolves all config keys and returns the full effective config with per-key provenance.
236
+ - **`generateWorkspaceJsonSchema()`** — generates a JSON Schema for IDE autocomplete in `jeeves.config.json`.
237
+
238
+ ## Memory Hygiene
239
+
240
+ MEMORY.md has a character budget (default: 20,000 characters). The `analyzeMemory()` function tracks:
241
+
242
+ - **Character count and usage percentage** — warns at 80% of budget (configurable via `warningThreshold`)
243
+ - **Stale section detection** — scans ISO dates (`YYYY-MM-DD`) in H2/H3 headings and bullet items; sections whose most recent date exceeds `staleDays` (default: 90) are flagged as stale candidates
244
+ - **Evergreen sections** — sections without parseable dates are never flagged
245
+
246
+ Memory hygiene is reporting-only. Core does not auto-delete content; the assistant or human reviews stale candidates and decides what to prune.
247
+
248
+ ## Skill Seeding
249
+
250
+ `jeeves install` and component plugin installers seed a platform skill at `{workspace}/skills/jeeves/SKILL.md`. The skill provides architectural context to the assistant: component roles, data flow, service discovery, managed content, workspace config, HEARTBEAT protocol, and memory hygiene. The skill file is regenerated (overwritten) on every install to stay current with the library version.
251
+
199
252
  <!-- TYPEDOC_EXCLUDE -->
200
253
 
201
254
  ## Documentation
@@ -0,0 +1,105 @@
1
+ ---
2
+ name: jeeves
3
+ description: Jeeves platform architecture, data flow, component interaction, scripts repo, and coordination knowledge. Use when making architectural decisions, coordinating across components, checking platform health, managing service lifecycle, or working with the scripts repo.
4
+ ---
5
+
6
+ # Jeeves Platform Skill
7
+
8
+ ## Platform Architecture
9
+
10
+ Jeeves is a four-component platform coordinated by a shared library (`@karmaniverous/jeeves`):
11
+
12
+ | Component | Role | Port |
13
+ |-----------|------|------|
14
+ | **jeeves-runner** | Execute: scheduled jobs, SQLite state, HTTP API | 1937 |
15
+ | **jeeves-watcher** | Index: file→Qdrant semantic indexing, inference rules | 1936 |
16
+ | **jeeves-server** | Present: web UI, file browser, doc render, export | 1934 |
17
+ | **jeeves-meta** | Distill: LLM synthesis, .meta/ directories, scheduling | 1938 |
18
+
19
+ Core (`@karmaniverous/jeeves`) is a **library + CLI**, not a service. No port.
20
+
21
+ ## Data Flow
22
+
23
+ ```
24
+ Files → Watcher (index) → Qdrant → Meta (synthesize) → .meta/ → Watcher (re-index)
25
+ ↓
26
+ Runner (schedule) → Scripts → Services ← Server (present) ← Browser
27
+ ```
28
+
29
+ ## Component Interaction
30
+
31
+ - **Watcher** indexes files into Qdrant with inference rules and enrichments.
32
+ - **Meta** reads from Qdrant, synthesizes `.meta/` directories, which watcher re-indexes.
33
+ - **Runner** executes scheduled scripts that may call any service's HTTP API.
34
+ - **Server** presents files, renders documents, and provides the event gateway.
35
+ - **Core** provides shared content management (TOOLS.md, SOUL.md, AGENTS.md), service discovery, config resolution, and the component SDK.
36
+
37
+ ## Service Discovery
38
+
39
+ Services find each other via config resolution:
40
+ 1. Component's own config file (`{configRoot}/jeeves-{name}/config.json`)
41
+ 2. Core config file (`{configRoot}/jeeves-core/config.json`)
42
+ 3. Default port constants
43
+
44
+ ## Scripts Repo
45
+
46
+ Location: `{configRoot}/jeeves-core/scripts/`
47
+ Template: `@karmaniverous/jeeves-scripts-template`
48
+
49
+ Scripts use utilities from `@karmaniverous/jeeves` (general) and `@karmaniverous/jeeves-runner` (runner-specific). Any script that could be useful outside runner scheduling belongs in core.
50
+
51
+ ## Managed Content System
52
+
53
+ Core maintains managed sections in workspace files using comment markers:
54
+ - **TOOLS.md** — Component sections (section mode) + Platform section
55
+ - **SOUL.md** — Professional discipline and behavioral foundations (block mode)
56
+ - **AGENTS.md** — Operational protocols and memory architecture (block mode)
57
+ - **HEARTBEAT.md** — Platform health status (heading-based)
58
+
59
+ Managed blocks are stationary after initial insertion. Cleanup detection uses Jaccard similarity on 3-word shingles. Cleanup escalation spawns a gateway session when orphaned content is detected.
60
+
61
+ ## Workspace Configuration
62
+
63
+ `jeeves.config.json` at workspace root provides shared defaults:
64
+ - Precedence: CLI flags → env vars → file → defaults
65
+ - Namespaced: `core.*` (workspace, configRoot, gatewayUrl) and `memory.*` (budget, warningThreshold, staleDays)
66
+ - Inspect with `jeeves config [jsonpath]`
67
+
68
+ ## HEARTBEAT Protocol
69
+
70
+ The HEARTBEAT system uses a state machine per component:
71
+ `not_installed → deps_missing → config_missing → service_not_installed → service_stopped → healthy`
72
+
73
+ Dependency-aware: hard deps block alerts, soft deps add informational notes. Declined components are tracked via heading suffix.
74
+
75
+ ## Plugin Lifecycle
76
+
77
+ ```bash
78
+ # Core install (seed workspace content)
79
+ npx @karmaniverous/jeeves install
80
+
81
+ # Component plugin install
82
+ npx @karmaniverous/jeeves-{component}-openclaw install
83
+
84
+ # Component plugin uninstall
85
+ npx @karmaniverous/jeeves-{component}-openclaw uninstall
86
+
87
+ # Core uninstall (remove managed sections)
88
+ npx @karmaniverous/jeeves uninstall
89
+ ```
90
+
91
+ ## Memory Hygiene
92
+
93
+ MEMORY.md has a character budget (default 20,000). Core tracks:
94
+ - Character count and usage percentage
95
+ - Warning at 80% of budget
96
+ - Stale section candidates (H2 sections whose most recent ISO date exceeds the staleness threshold)
97
+ - Evergreen sections (no dates) are never flagged
98
+
99
+ Review is human/agent-mediated — core does not auto-delete.
100
+
101
+ ### HEARTBEAT Integration
102
+
103
+ Memory hygiene is checked on every `ComponentWriter` cycle alongside component health. When budget or staleness thresholds are breached, a `## MEMORY.md` alert appears in HEARTBEAT.md under `# Jeeves Platform Status`. The alert includes character count, budget usage percentage, and any stale section names. When memory is healthy, the heading is absent — no alert content, no LLM cost on heartbeat polls.
104
+
105
+ The `## MEMORY.md` heading follows the same declined/active lifecycle as component headings (`## jeeves-{name}`). Users can decline memory alerts by changing the heading to `## MEMORY.md: declined`.