total-recall-brain 3.26.0 → 3.28.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.
Files changed (65) hide show
  1. package/bin/total-recall.mjs +31 -1
  2. package/docs/ARCHITECTURE.md +76 -9
  3. package/frontend/dist/assets/index-U7o-qU99.js +5742 -0
  4. package/frontend/dist/index.html +1 -1
  5. package/frontend/src/App.tsx +39 -1
  6. package/frontend/src/api/index.ts +1 -0
  7. package/frontend/src/api/plugins.ts +167 -0
  8. package/frontend/src/pages/ChatPage.tsx +44 -17
  9. package/frontend/src/pages/IntegrationsPage.tsx +7 -0
  10. package/frontend/src/pages/PluginsPage.spec.tsx +17 -0
  11. package/frontend/src/pages/PluginsPage.tsx +1331 -0
  12. package/package.json +1 -1
  13. package/scaffold/.agent/plugins/.gitkeep +0 -0
  14. package/scaffold/.agent/plugins/code-quality/README.md +16 -0
  15. package/scaffold/.agent/plugins/code-quality/cli.mjs +15 -0
  16. package/scaffold/.agent/plugins/code-quality/plugin.json +34 -0
  17. package/scaffold/.agent/plugins/git-sentinel/README.md +16 -0
  18. package/scaffold/.agent/plugins/git-sentinel/cli.mjs +86 -0
  19. package/scaffold/.agent/plugins/git-sentinel/plugin.json +34 -0
  20. package/scaffold/.agent/plugins/meta-harness/README.md +16 -0
  21. package/scaffold/.agent/plugins/meta-harness/cli.mjs +34 -0
  22. package/scaffold/.agent/plugins/meta-harness/plugin.json +34 -0
  23. package/scaffold/.agent/plugins/system-monitor/README.md +16 -0
  24. package/scaffold/.agent/plugins/system-monitor/cli.mjs +79 -0
  25. package/scaffold/.agent/plugins/system-monitor/generator.mjs +20 -0
  26. package/scaffold/.agent/plugins/system-monitor/plugin.json +38 -0
  27. package/scaffold/.agent/skills/meta-harness/SKILL.md +113 -0
  28. package/scaffold/.agent/skills/total-recall/references/cli-reference.md +23 -0
  29. package/src/cli/agent.mjs +173 -0
  30. package/src/cli/connect.mjs +89 -4
  31. package/src/cli/deploy-ui.mjs +6 -0
  32. package/src/cli/harness.mjs +135 -0
  33. package/src/cli/ingest-openwiki.mjs +71 -2
  34. package/src/cli/init.mjs +1 -0
  35. package/src/cli/lint.mjs +47 -3
  36. package/src/cli/mesh.mjs +286 -0
  37. package/src/cli/plugin/create.mjs +186 -0
  38. package/src/cli/plugin/index.mjs +139 -0
  39. package/src/cli/plugin/install.mjs +141 -0
  40. package/src/cli/plugin/list.mjs +83 -0
  41. package/src/cli/plugin/remove.mjs +51 -0
  42. package/src/cli/plugin/search.mjs +37 -0
  43. package/src/cli/skill-projection.mjs +14 -0
  44. package/src/cli/wizard.html +9 -0
  45. package/src/core/agent-manager.mjs +290 -0
  46. package/src/core/cache-prune.mjs +341 -0
  47. package/src/core/context-cache.mjs +130 -0
  48. package/src/core/daemon-loop.mjs +47 -1
  49. package/src/core/evolving-context.mjs +171 -0
  50. package/src/core/mesh-activity.mjs +140 -0
  51. package/src/core/mesh.mjs +174 -1
  52. package/src/core/meta-harness.mjs +251 -0
  53. package/src/core/plugin-context.mjs +206 -0
  54. package/src/core/plugin-loader.mjs +210 -0
  55. package/src/core/runtime.mjs +65 -13
  56. package/src/core/surface.mjs +32 -10
  57. package/src/server/api.mjs +18 -2
  58. package/src/server/index.mjs +8 -2
  59. package/src/server/rest.mjs +4 -0
  60. package/src/server/routes/integrations.mjs +5 -1
  61. package/src/server/routes/mesh-presence.mjs +143 -0
  62. package/src/server/routes/models.mjs +42 -30
  63. package/src/server/routes/plugins.mjs +517 -0
  64. package/src/server/tools.mjs +266 -0
  65. package/frontend/dist/assets/index-Bl3I11B0.js +0 -5742
@@ -92,6 +92,12 @@ const COMMANDS = {
92
92
  collab: 'collab.mjs',
93
93
  command: 'command.mjs',
94
94
  export: 'export.mjs',
95
+ harness: 'harness.mjs',
96
+ watch: 'rebuild.mjs',
97
+ agent: 'agent.mjs',
98
+ agents: 'agent.mjs',
99
+ plugin: 'plugin/index.mjs',
100
+ plugins: 'plugin/index.mjs',
95
101
  };
96
102
  function printHelp() {
97
103
  console.log(`
@@ -110,8 +116,11 @@ function printHelp() {
110
116
  task <cmd> Enqueue daemon work (open envelope)
111
117
  daemon <cmd> Background worker (start|stop|status)
112
118
  skill <cmd> Skills registry, deploy, multi-repo sync
119
+ plugin <cmd> Plugin manager: list, install, remove, info
113
120
  secret <cmd> Secrets store + usage (not the vault)
114
121
  mesh <cmd> Control-server mesh: nodes, ACL policy, Tailscale SSH
122
+ harness <cmd> Meta-harness orchestration & council across IDEs & local LLMs
123
+ agent <cmd> Process controller: spawn, list, logs, kill across mesh
115
124
  brain <cmd> Register / ensure any project brain
116
125
  status / doctor Health and diagnostics
117
126
 
@@ -210,8 +219,29 @@ async function main() {
210
219
  console.log(typeof result === 'object' ? JSON.stringify(result, null, 2) : result);
211
220
  process.exit(0);
212
221
  }
222
+
223
+ // Check installed plugins for custom CLI commands declared in manifest
224
+ const { discoverPlugins } = await import('../src/core/plugin-loader.mjs');
225
+ const plugins = discoverPlugins(process.cwd());
226
+ for (const p of plugins) {
227
+ if (p.valid && p.manifest.cli?.command === command) {
228
+ const handlerRel = p.manifest.cli.handler;
229
+ if (handlerRel) {
230
+ const absHandler = path.resolve(p.dir, handlerRel);
231
+ if (fs.existsSync(absHandler)) {
232
+ const handler = await import(absHandler);
233
+ if (handler.run) {
234
+ await handler.run(process.argv);
235
+ } else if (handler.default) {
236
+ await handler.default(process.argv.slice(3));
237
+ }
238
+ process.exit(0);
239
+ }
240
+ }
241
+ }
242
+ }
213
243
  } catch (err) {
214
- console.error(`Error executing integration command: ${err.message}`);
244
+ console.error(`Error executing dynamic command: ${err.message}`);
215
245
  process.exit(1);
216
246
  }
217
247
 
@@ -58,7 +58,7 @@ The session relay is a silent Node.js daemon that:
58
58
 
59
59
  ---
60
60
 
61
- ### Component 2: The Sovereign Brain Server
61
+ ### Component 2: The Central Brain Server
62
62
 
63
63
  The brain server runs the primary REST API, compiles instructions, runs the background daemons, and maintains the Virtual File System (VFS).
64
64
 
@@ -81,14 +81,16 @@ The Setup Web Wizard is served by a local Express instance during installation/d
81
81
  - **File-Native Indexes**: Vector indexes are written directly to plain JSONL (`embeddings.jsonl`) under the meta-skill's `memory-derived/` directory, backed by a high-speed cosine memory cache (`embeddings-cache.json`) for <50ms lookup times.
82
82
  - **Auto-Healing Dimension Mismatch Purging**: If you switch embedding models (e.g. from a 384-dim Ollama model to the 768-dim Google API), the engine detects the dimension length mismatch, automatically clears out the obsolete cache files, and indexes the entire vault cleanly from scratch.
83
83
 
84
- #### 2. 🤖 Headless CLI Agent Dispatch Framework
85
- Total Recall completely eliminates heavy local GPU hardware overhead (Ollama and local VM models are fully deprecated). Instead, cognitive tasks (post-mortems, web research crawls, and dream cycle updates) are routed to specialized, headlessly spawned CLI agents running via non-interactive subshells (`spawnSync`):
84
+ #### 2. 🤖 Meta Harness & Headless CLI Agent Dispatch
85
+ Total Recall executes background cognitive tasks (post-mortems, web research crawls, dream cycle updates, and multi-agent councils) through headlessly spawned CLI agent harnesses and local neural models:
86
86
 
87
- - **Antigravity CLI** (`antigravity`): Ingests massive token context bounds for broad log post-mortems and repository-wide gap discovery.
88
- - **Claude Code** (`claude`): Resolves complex logical rules, verifies integration tests, and performs precise SSSS ontology checking.
89
- - **Codex CLI** (`codex`): Executes sandboxed test suites and automated file writes.
87
+ - **Antigravity CLI** (`agy`): Ingests massive token context bounds for broad log post-mortems, complex reasoning, and repository-wide gap discovery.
88
+ - **Claude Code** (`claude`): Resolves complex logical rules, verifies integration tests, and performs terminal-native codebase refactoring.
89
+ - **Codex CLI** (`codex`): Executes sandboxed test suites and automated program synthesis.
90
+ - **Gemini CLI** (`gemini`): Fast utility completions and lightweight tool chaining.
91
+ - **Ollama Local LLM** (`ollama`): Zero-token-cost local neural inference (e.g. `gemma4:latest`) executing non-interactively via standard input piping (`pipe_stdin`).
90
92
 
91
- All dispatches are configured via the prioritized execution registry in `~/.agent/skills/total-recall/skills/cli-agents/agents.yml` and utilize the **Dynamic Model Selector (`resolveGenerativeModel`)** to dynamically translate general aliases (`flash`, `pro`, `default`) into the active, optimal model endpoints.
93
+ All dispatches can run locally or route remotely across the Headscale mesh (`--node <target>`). Multi-agent consensus deliberations can be executed concurrently using `total-recall harness council "<task>"`. Dispatches are also configured via the prioritized execution registry in `~/.agent/skills/total-recall/skills/cli-agents/agents.yml` utilizing the **Dynamic Model Selector (`resolveGenerativeModel`)**.
92
94
 
93
95
  #### 3. 📂 Progressive Disclosure Surface Compiler
94
96
  - Avoids prompt bloat by keeping active system prompts under 1,000 tokens.
@@ -104,7 +106,7 @@ All dispatches are configured via the prioritized execution registry in `~/.agen
104
106
 
105
107
  ## 🧠 The Dual-Layer Brain Cascade
106
108
 
107
- Total Recall partitions your sovereign brain memory into two virtual directories:
109
+ Total Recall partitions your brain memory into two virtual directories:
108
110
 
109
111
  ```
110
112
  ~ (User Home)
@@ -232,9 +234,74 @@ Total Recall features a native terminal-based chat REPL (`npx total-recall chat`
232
234
 
233
235
  ---
234
236
 
237
+ ---
238
+
239
+ ## 🧩 Plugin System & Extension Architecture
240
+
241
+ Total Recall features a decentralized, filesystem-native plugin system that allows modular capability suites, background scholarly daemons, and custom SSSS graph schemas to extend the memory kernel without modifying core packages.
242
+
243
+ ### 1. Plugin Manifest Specification (`plugin.json`)
244
+ Every plugin is a self-contained directory under `.agent/plugins/<id>/` (or global `~/.agent/plugins/<id>/`) containing a validated `plugin.json` conforming to `metadata.plugin.schema.json`:
245
+ - **Metadata**: Unique lowercase kebab-case `id`, semantic `version`, `name`, and `description`.
246
+ - **Custom SSSS Categories**: Declares domain-specific memory node categories (`ssss_schemas.categories`) with schemas and templates automatically registered during vault builds.
247
+ - **Surface Compilation Hook**: Defines a custom context generator script (`compile.generator`) and watch triggers that assemble prioritized evolving context surfaces (up to 500k tokens).
248
+ - **Background Tasks & Daemons**: Registers recurring cron envelopes (`tasks`) and execution entrypoints (`entrypoint`) automatically picked up by the daemon loop.
249
+ - **Pure Unix CLI Commands**: Exposes first-class CLI commands (`cli.command` and `cli.handler`) seamlessly routed under `total-recall <command>`.
250
+
251
+ ### 2. Plugin Discovery & Lifecycle (`src/core/plugin-loader.mjs`)
252
+ - **Layered Discovery**: Scans project-level (`.agent/plugins/`) and global-level (`~/.agent/plugins/`) directories. Project plugins take precedence over global plugins with identical IDs.
253
+ - **Strict Schema Validation**: Validates all manifests against the plugin schema prior to runtime execution, flagging errors without breaking host brain stability.
254
+ - **Symlink & Development Linking**: Developers can link in-progress plugins using `total-recall plugin install <path> --link` (or via the web UI) to enable real-time edits without reinstallation.
255
+
256
+ ### 3. Web Dashboard & Rating System (`frontend/src/pages/PluginsPage.tsx`)
257
+ - **Plugin Management UI**: Dedicated `/plugins` dashboard view for browsing installed extensions, inspecting raw manifests, exploring documentation, and one-click uninstallation.
258
+ - **Curated Discovery Catalog**: Browsable catalog of ecosystem plugins (Scientific Frontiers Engine, Meta-Harness, Code Quality & SSSS Conformance, Chrome DevTools) with single-click installation.
259
+ - **Interactive 5-Star Rating System**: Persistent local ratings and reviews (`.agent/config/plugin-ratings.json`), verified badges, and sorting by rating, reviews, or alphabetical order.
260
+
261
+ ---
262
+
263
+ ## 🌐 Mesh Compute Topology & Meta-Harness Layer
264
+
265
+ Total Recall unifies developer machines, remote compute nodes, and cloud servers across a private **Headscale WireGuard mesh network** (tailnet `100.64.0.0/10`), providing zero-configuration cross-host execution without third-party cloud dependencies or open incoming firewall ports.
266
+
267
+ ### 1. Mesh Compute Topology & Diagnostics
268
+
269
+ Each machine on the network is tracked as an SSSS `mesh_node` entity in the vault (`memory-vault/system/mesh-nodes/<slug>.md`). Remote execution is mediated by the mesh runtime:
270
+
271
+ - **Non-Interactive Command Execution (`total-recall mesh exec <node> <cmd…>`)**: Executes commands remotely over SSH with sanitized `$PATH` exports (`/opt/homebrew/bin`, `/usr/local/bin`, `$HOME/.local/bin`) directly prepended, eliminating subshell quoting fragility on Darwin and Linux.
272
+ - **Cluster Diagnostics (`total-recall mesh doctor`)**: Concurrently audits reachability, development runtimes (`node`, `docker`, `git`), and AI harnesses (`agy`, `claude`, `codex`, `gemini`, `ollama`) across all cluster nodes, formatting the results into character-aligned terminal tables or structured JSON (`--json`).
273
+ - **Cryptographic SSH Access Resolution**: Automatically resolves SSH user, port, and key path from the local `mesh_node` entity or `~/.ssh/config` using `IdentitiesOnly=yes` pinning.
274
+
275
+ ### 2. Meta-Harness Layer (`src/core/meta-harness.mjs`)
276
+
277
+ The Meta-Harness treats external AI CLI tools and local neural models as pluggable execution engines:
278
+
279
+ | Harness ID | Engine | Execution Mode | Role |
280
+ | :--- | :--- | :--- | :--- |
281
+ | `agy` | Google Antigravity | CLI arguments | Frontier reasoning, broad context analysis |
282
+ | `claude` | Anthropic Claude Code | CLI arguments (`-p`) | Codebase refactoring, terminal tasks |
283
+ | `codex` | OpenAI Codex | CLI arguments (`exec`) | Program synthesis, sandboxed mutation |
284
+ | `gemini` | Google Gemini CLI | CLI arguments | Lightweight utilities, tool chaining |
285
+ | `ollama` | Ollama Local LLM | `pipe_stdin` | Zero-token-cost local neural inference |
286
+
287
+ - **Multi-Harness Council (`total-recall harness council "<task>"`)**: Runs concurrent deliberative queries across all available local harnesses, compiling multiple perspectives into a structured comparative report.
288
+ - **Cross-Node Harness Dispatch (`total-recall harness dispatch <id> --node <node> "<task>"`)**: Dispatches tasks to a specific harness located on another mesh node (e.g. running `ollama` models on a dedicated local machine like `macmini`).
289
+
290
+ ### 3. Agent Process Management (`src/core/agent-manager.mjs`)
291
+
292
+ The agent management layer provides process supervision for background subagents across the cluster:
293
+
294
+ - **Lifecycle Tracking (`sessions/agents.json`)**: Tracks running agent processes with unique IDs, PIDs, harnesses, target nodes, and execution statuses (`running`, `completed`, `failed`, `stopped`).
295
+ - **Detached Execution**: Spawns subagents in the background (`total-recall agent spawn <harness> "<task>"`) with stdout/stderr automatically streamed to session logs (`sessions/logs/`).
296
+ - **Remote Observability & Control**:
297
+ - `total-recall agent logs <id>`: Tails logs in real time from local files or over mesh SSH.
298
+ - `total-recall agent kill <id>`: Sends termination signals (`SIGTERM` or remote `kill`) to shut down runaway processes.
299
+
300
+ ---
301
+
235
302
  ## 🔒 Session Security & Token Management
236
303
 
237
- Total Recall implements role-based granular authorization schemas to protect your sovereign brain while maintaining 100% database-free isolation.
304
+ Total Recall implements role-based granular authorization schemas to protect your brain while maintaining 100% database-free isolation.
238
305
 
239
306
  ### 1. Local Dashboard Session Management (JWT-based)
240
307
  For web dashboard access, Total Recall strictly avoids external third-party OAuth provider dependencies (e.g. Google, GitHub, Auth0) to protect your privacy and ensure standalone local operation: