total-recall-brain 3.35.0 → 3.37.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 (72) hide show
  1. package/bin/total-recall.mjs +17 -4
  2. package/frontend/dist/assets/index-CpvEw3iA.js +5786 -0
  3. package/frontend/dist/brand/plugins/phone.svg +20 -0
  4. package/frontend/dist/index.html +1 -1
  5. package/frontend/src/App.tsx +3 -30
  6. package/frontend/src/api/plugins.ts +18 -0
  7. package/frontend/src/components/plugins/previews/CodeQualityPreview.tsx +78 -86
  8. package/frontend/src/components/plugins/previews/ComposableCliPreview.tsx +74 -84
  9. package/frontend/src/components/plugins/previews/DecisionPreview.tsx +158 -106
  10. package/frontend/src/components/plugins/previews/DesignPreview.tsx +109 -75
  11. package/frontend/src/components/plugins/previews/DomainsPreview.tsx +69 -88
  12. package/frontend/src/components/plugins/previews/ImageGeneratorPreview.tsx +286 -0
  13. package/frontend/src/components/plugins/previews/PhonePreview.tsx +490 -76
  14. package/frontend/src/components/plugins/previews/SigningPreview.tsx +164 -50
  15. package/frontend/src/components/plugins/previews/TextPreview.tsx +85 -86
  16. package/frontend/src/components/plugins/previews/UserAutomationsPreview.tsx +30 -0
  17. package/frontend/src/components/plugins/previews/index.tsx +6 -1
  18. package/frontend/src/pages/PluginsPage.tsx +603 -136
  19. package/package.json +2 -5
  20. package/scaffold/.agent/skills/plugins/SKILL.md +200 -6
  21. package/src/cli/agent.mjs +59 -18
  22. package/src/cli/plugin/create.mjs +266 -13
  23. package/src/cli/plugin/index.mjs +5 -0
  24. package/src/cli/secret.mjs +28 -1
  25. package/src/core/agent-manager.mjs +47 -6
  26. package/src/core/cache-prune.mjs +60 -2
  27. package/src/core/embeddings.mjs +2 -0
  28. package/src/core/meta-harness.mjs +93 -6
  29. package/src/core/plugin-loader.mjs +20 -4
  30. package/src/core/plugin-store.mjs +122 -11
  31. package/src/core/surface.mjs +29 -1
  32. package/src/core/vault.mjs +6 -2
  33. package/src/server/route-manifest.json +22 -2
  34. package/src/server/routes/plugins-mesh.mjs +9 -1
  35. package/src/server/routes/plugins.mjs +65 -1
  36. package/frontend/dist/assets/index-BPrkIYkZ.js +0 -5786
  37. package/frontend/src/pages/AutomationsPage.spec.tsx +0 -61
  38. package/frontend/src/pages/AutomationsPage.tsx +0 -354
  39. package/plugins/creative-search/README.md +0 -33
  40. package/plugins/creative-search/cli.mjs +0 -415
  41. package/plugins/creative-search/config.mjs +0 -129
  42. package/plugins/creative-search/generator.mjs +0 -13
  43. package/plugins/creative-search/plugin.json +0 -61
  44. package/plugins/creative-search/ui/DESIGN.md +0 -50
  45. package/plugins/creative-search/ui/csearch-main.js +0 -314
  46. package/plugins/creative-search/ui/csearch-settings.js +0 -392
  47. package/plugins/creative-search/ui/index.js +0 -2
  48. package/plugins/creative-search/ui/tokens.css +0 -34
  49. package/plugins/dsh/README.md +0 -20
  50. package/plugins/dsh/cli.mjs +0 -232
  51. package/plugins/dsh/generator.mjs +0 -65
  52. package/plugins/dsh/plugin.json +0 -57
  53. package/plugins/dsh/ui/DESIGN.md +0 -48
  54. package/plugins/dsh/ui/dsh-main.js +0 -226
  55. package/plugins/dsh/ui/dsh-status.js +0 -265
  56. package/plugins/dsh/ui/index.js +0 -2
  57. package/plugins/dsh/ui/tokens.css +0 -32
  58. package/plugins/git-sentinel/README.md +0 -29
  59. package/plugins/git-sentinel/cli.mjs +0 -89
  60. package/plugins/git-sentinel/plugin.json +0 -18
  61. package/plugins/operator-alerts/README.md +0 -32
  62. package/plugins/operator-alerts/cli.mjs +0 -57
  63. package/plugins/operator-alerts/notify-core.mjs +0 -216
  64. package/plugins/operator-alerts/plugin.json +0 -20
  65. package/plugins/skill-manager/README.md +0 -57
  66. package/plugins/skill-manager/cli.mjs +0 -123
  67. package/plugins/skill-manager/plugin.json +0 -25
  68. package/plugins/skill-manager/route.mjs +0 -106
  69. package/plugins/system-monitor/README.md +0 -28
  70. package/plugins/system-monitor/cli.mjs +0 -80
  71. package/plugins/system-monitor/generator.mjs +0 -19
  72. package/plugins/system-monitor/plugin.json +0 -29
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "total-recall-brain",
3
- "version": "3.35.0",
3
+ "version": "3.37.0",
4
4
  "description": "Personal AI system — database-free, SSSS-powered intelligence engine deployable to any POSIX host.",
5
5
  "type": "module",
6
6
  "workspaces": [
@@ -22,8 +22,6 @@
22
22
  "frontend/index.html",
23
23
  "frontend/src/",
24
24
  "extension/",
25
- "plugins/",
26
- "!plugins/**/*.spec.mjs",
27
25
  "templates/",
28
26
  "scaffold/",
29
27
  "docs/ARCHITECTURE.md",
@@ -47,7 +45,7 @@
47
45
  "routes:manifest": "node scripts/generate-route-manifest.mjs",
48
46
  "clean": "rm -rf scratch/* .remember/* *.log",
49
47
  "check:dist": "node scripts/check-dist-freshness.mjs",
50
- "prepublishOnly": "npm run check:dist",
48
+ "prepublishOnly": "npm run check:dist && node scripts/check-scaffold-state.mjs",
51
49
  "check:ssss-registry": "node scripts/check-ssss-registry.mjs"
52
50
  },
53
51
  "repository": {
@@ -82,7 +80,6 @@
82
80
  "natural": "^8.1.1",
83
81
  "preact": "^10.29.7",
84
82
  "sqlite-vss": "^0.1.2",
85
- "total-recall-brain": "^3.17.0",
86
83
  "ws": "^8.18.0",
87
84
  "yaml": "^2.9.0",
88
85
  "zod": "^4.4.3"
@@ -1,15 +1,209 @@
1
1
  ---
2
2
  name: plugins
3
- description: Create, validate, install or share Total Recall plugins.
3
+ description: Standards, authoring guide, and CLI workflows for Total Recall plugins.
4
4
  repo_scoped: false
5
5
  ---
6
6
 
7
- <!-- total-recall:skill-router:v1 -->
7
+ # Total Recall Plugin Standard & Authoring Guide
8
8
 
9
- # Plugins
9
+ Total Recall capabilities beyond portable memory belong in standalone plugins. This specification details the executable plugin contract, step-by-step authoring procedures, and CLI workflows ensuring any user-authored plugin remains completely compatible across the Total Recall ecosystem.
10
10
 
11
- Use the plugin workspace and current `plugin.json`/extension contracts. Keep optional capabilities in plugins rather than portable memory core. Every claimed command, schedule, UI/API action or memory extension needs a real handler and validation.
11
+ ## Core Architectural Invariants
12
12
 
13
- Read implementation or installation references for that operation. Verify scopes, invalid input, canonical SSSS writes, failure reporting and actual execution. Sharing requires explicit authorization; public bundles exclude credentials, private vault content and runtime state. Read sharing procedures only when sharing is requested.
13
+ 1. **Portable Memory Separation**: Core Total Recall maintains only portable memory, the SSSS vault, and instruction compilers. Auxiliary tools, domain features, telephony, specialized analyzers, and user interfaces must exist as independent plugins.
14
+ 2. **Standard Manifest (`plugin.json`)**: Every plugin defines an authoritative `plugin.json` adhering to `metadata.plugin.schema.json`.
15
+ 3. **Canonical State via SSSS**: Plugins must never perform unmanaged raw filesystem writes. Persistent records, configuration overlays, and event telemetry must use SSSS VFS operations.
16
+ 4. **Token-Driven UI Elements**: Plugin interface components must avoid hardcoded color values. Visual styling must reference standard design tokens from `DESIGN.md`.
17
+ 5. **No AI Slop & Clean Copy**: Plugin documentation and user-facing text must avoid trite terms such as "sovereign", "synergy", or "leverage", and must never conclude any sentence with a preposition.
14
18
 
15
- Before an operation, read its [task references](references/optimized/index.md), including prerequisites and constraints. If the applicable procedure is unclear, read the preserved original instead of guessing. Commands assume the skill root.
19
+ ---
20
+
21
+ ## The Plugin Manifest Contract (`plugin.json`)
22
+
23
+ A valid plugin contains `plugin.json` at its root:
24
+
25
+ ```json
26
+ {
27
+ "$schema": "https://github.com/gregiteen/total-recall/blob/main/metadata.plugin.schema.json",
28
+ "id": "my-plugin",
29
+ "name": "My Plugin",
30
+ "version": "1.0.0",
31
+ "description": "Concrete explanation of the exact job this plugin performs.",
32
+ "author": "Author Name",
33
+ "license": "MIT",
34
+ "use_cases": ["developer-tools"],
35
+ "cli": {
36
+ "command": "my-tool",
37
+ "handler": "./cli.mjs",
38
+ "subcommands": [
39
+ { "name": "status", "description": "Display runtime status" },
40
+ { "name": "run", "description": "Execute main capability" }
41
+ ]
42
+ },
43
+ "runtime": {
44
+ "jobs": [
45
+ {
46
+ "id": "periodic-check",
47
+ "schedule": "0 * * * *",
48
+ "command": "status",
49
+ "description": "Hourly status verification"
50
+ }
51
+ ],
52
+ "daemons": [],
53
+ "startup": []
54
+ },
55
+ "deploy": {
56
+ "targets": ["ssss-app", "nextjs", "react", "flask"],
57
+ "required_ssss_version": ">=0.9.3",
58
+ "access_grants": ["ssss:vault:read", "ssss:vault:write"]
59
+ }
60
+ }
61
+ ```
62
+
63
+ ### Manifest Specifications
64
+
65
+ - **`id`** *(required)*: Lowercase kebab-case string (`^[a-z][a-z0-9-]{1,63}$`). Must match the repository or folder identifier.
66
+ - **`name`** *(required)*: Human-readable display label.
67
+ - **`version`** *(required)*: Semantic version string (`x.y.z`).
68
+ - **`description`** *(required)*: Clear, functional explanation (minimum 5 characters).
69
+ - **`use_cases`** *(optional)*: Array of kebab-case tags used for catalog indexing and search filters.
70
+ - **`cli`** *(optional)*: Declares the CLI command name, the relative ES module handler (`cli.mjs`), and an array of subcommands.
71
+ - **`runtime`** *(optional)*:
72
+ - **`jobs`**: Scheduled background cron routines (`schedule`, `command`, `timeout_seconds`, `secrets`).
73
+ - **`daemons`**: Continuously running background services (`handler`, `restart`, `stop_signal`).
74
+ - **`startup`**: Lifecycle initialization hooks executed when the host begins execution.
75
+ - **`deploy`** *(optional)*: Target application hosts and required SSSS permission scopes.
76
+ - **`ui`** *(optional)*: Declares reusable custom web component elements (`elements[]`), property interfaces, and required design tokens.
77
+
78
+ ---
79
+
80
+ ## Step-by-Step Plugin Creation Workflow
81
+
82
+ ### Step 1: Scaffold the Plugin
83
+ Initialize a new plugin structure through the CLI:
84
+ ```bash
85
+ total-recall plugin create my-plugin --name "My Plugin" --description "Handles custom workflows" --use-case automation --with-cli
86
+ ```
87
+ This scaffolds a standard directory containing `plugin.json`, `cli.mjs`, and documentation.
88
+
89
+ ### Step 2: Implement the Command Handler (`cli.mjs`)
90
+ The handler module must export a callable function:
91
+ ```javascript
92
+ /**
93
+ * CLI Handler for my-plugin
94
+ * @param {string[]} argv - Command-line arguments passed after the command name
95
+ */
96
+ export async function run(argv) {
97
+ const [subcommand, ...args] = argv.slice(2);
98
+
99
+ if (subcommand === "status") {
100
+ console.log("My Plugin is fully operational.");
101
+ return;
102
+ }
103
+
104
+ if (subcommand === "run") {
105
+ console.log("Executing capability with arguments:", args);
106
+ return;
107
+ }
108
+
109
+ console.log("Usage: total-recall my-tool <status|run>");
110
+ }
111
+
112
+ export default run;
113
+ ```
114
+
115
+ ### Step 3: Add SSSS Memory Categories (Optional)
116
+ If your plugin defines new structured memory types, declare them inside `plugin.json`:
117
+ ```json
118
+ "ssss_schemas": {
119
+ "categories": [
120
+ {
121
+ "name": "custom-audit",
122
+ "description": "Structured records for compliance tracking",
123
+ "node_type": "memory",
124
+ "template": "./templates/audit.md"
125
+ }
126
+ ]
127
+ }
128
+ ```
129
+
130
+ ### Step 4: Validate the Plugin
131
+ Run validation before publishing or deploying:
132
+ ```bash
133
+ total-recall plugin info my-plugin
134
+ ```
135
+ Ensure the validator returns zero schema errors.
136
+
137
+ ---
138
+
139
+ ## Operating Plugins Through the Total Recall CLI
140
+
141
+ The Total Recall CLI provides complete lifecycle management for plugins:
142
+
143
+ ### 1. Discover and Search
144
+ - **List installed plugins**:
145
+ ```bash
146
+ total-recall plugin list
147
+ ```
148
+ - **List available bundled plugins**:
149
+ ```bash
150
+ total-recall plugin available
151
+ ```
152
+ - **Search plugins by keyword or use case**:
153
+ ```bash
154
+ total-recall plugin search telemetry --use-case monitoring
155
+ ```
156
+
157
+ ### 2. Install and Link
158
+ - **Install from a local directory (symlink during active development)**:
159
+ ```bash
160
+ total-recall plugin install /path/to/my-plugin --link
161
+ ```
162
+ - **Install globally for all workspaces across the machine**:
163
+ ```bash
164
+ total-recall plugin install /path/to/my-plugin --global
165
+ ```
166
+ - **Install from a remote git repository**:
167
+ ```bash
168
+ total-recall plugin install https://github.com/org/plugin-repo.git
169
+ ```
170
+ - **Install from a mesh peer node**:
171
+ ```bash
172
+ total-recall plugin install peer:mac-mini/code-quality
173
+ ```
174
+
175
+ ### 3. Inspect and Execute
176
+ - **Inspect detailed plugin metadata, hashes, and scheduled task logs**:
177
+ ```bash
178
+ total-recall plugin info my-plugin
179
+ ```
180
+ - **Execute installed plugin commands directly**:
181
+ ```bash
182
+ total-recall my-tool status
183
+ ```
184
+
185
+ ### 4. Share and Distribute
186
+ - **Share a plugin via a verified hash-pinned link**:
187
+ ```bash
188
+ total-recall plugin share my-plugin
189
+ ```
190
+ - **Revoke sharing access**:
191
+ ```bash
192
+ total-recall plugin unshare my-plugin
193
+ ```
194
+ - **Remove or uninstall a plugin**:
195
+ ```bash
196
+ total-recall plugin remove my-plugin
197
+ ```
198
+
199
+ ---
200
+
201
+ ## Authoring Standards Checklist
202
+
203
+ Before distributing any plugin, confirm each requirement:
204
+ - [ ] `plugin.json` passes validation against `metadata.plugin.schema.json`.
205
+ - [ ] CLI commands exit with code `0` on success and non-zero on failure.
206
+ - [ ] No private secrets, personal user paths, or session tokens exist in the repository.
207
+ - [ ] SSSS data modifications use validated operations rather than raw disk writes.
208
+ - [ ] User interface components utilize design tokens without hardcoded colors.
209
+ - [ ] All written documentation avoids forbidden words and concludes every sentence without a preposition.
package/src/cli/agent.mjs CHANGED
@@ -23,6 +23,14 @@ Options:
23
23
  --detach Spawn process detached in background (default: true)
24
24
  --name <label> Assign a human-readable name to the agent session
25
25
  --tail <lines> Number of log lines to inspect (default: 50)
26
+ --cwd <dir> Working directory for the agent (on the target node with --node)
27
+ --tools <list> Built-in tools for the harness: default (all), none, or e.g. "Bash,Read,WebFetch"
28
+ (alias --allow-tools; --no-tools = none). Spawns default to all tools.
29
+ --setting-sources <list> Settings layers the harness loads (e.g. local, or user,project)
30
+
31
+ Auth:
32
+ Claude Code reads CLAUDE_CODE_OAUTH_TOKEN (from \`claude setup-token\`) from the environment,
33
+ else from the Total Recall secret store, so SSH/launchd sessions without a login keychain work.
26
34
 
27
35
  Available Harnesses:
28
36
  agy, claude, codex, gemini
@@ -31,11 +39,53 @@ Examples:
31
39
  npx total-recall agent list
32
40
  npx total-recall agent spawn claude "Refactor src/cli/harness.mjs error handling"
33
41
  npx total-recall agent spawn agy "Crawl recent preprints on quantum shuttling" --name "Quantum Scout"
42
+ npx total-recall agent spawn claude "Run the lead search workflow" --node build-box --cwd '~/code/app'
34
43
  npx total-recall agent logs agent-claude-xyz --tail 100
35
44
  npx total-recall agent kill agent-claude-xyz
36
45
  `);
37
46
  }
38
47
 
48
+ const SPAWN_VALUE_FLAGS = {
49
+ '--node': 'targetNode',
50
+ '-n': 'targetNode',
51
+ '--name': 'name',
52
+ '--cwd': 'cwd',
53
+ '--tools': 'tools',
54
+ '--allow-tools': 'tools',
55
+ '--setting-sources': 'settingSources',
56
+ };
57
+
58
+ /**
59
+ * Parse `agent spawn` arguments. Option values are consumed with their flag, so
60
+ * they never leak into the task text; `--tools ""` is a real (empty) value.
61
+ */
62
+ export function parseSpawnArgs(rest) {
63
+ const out = { detach: true, isJson: false, name: null, targetNode: null, cwd: undefined, tools: undefined, settingSources: undefined };
64
+ const positional = [];
65
+ for (let i = 0; i < rest.length; i++) {
66
+ const arg = rest[i];
67
+ const eq = arg.startsWith('--') ? arg.indexOf('=') : -1;
68
+ const flag = eq > 0 ? arg.slice(0, eq) : arg;
69
+ if (SPAWN_VALUE_FLAGS[flag]) {
70
+ let value;
71
+ if (eq > 0) value = arg.slice(eq + 1);
72
+ else {
73
+ if (i + 1 >= rest.length) throw new Error(`${flag} requires a value`);
74
+ value = rest[++i];
75
+ }
76
+ out[SPAWN_VALUE_FLAGS[flag]] = value;
77
+ } else if (arg === '--json') out.isJson = true;
78
+ else if (arg === '--no-detach') out.detach = false;
79
+ else if (arg === '--detach') out.detach = true;
80
+ else if (arg === '--no-tools') out.tools = 'none';
81
+ else if (arg.startsWith('--')) throw new Error(`Unknown option for agent spawn: ${arg}`);
82
+ else positional.push(arg);
83
+ }
84
+ out.harness = positional[0];
85
+ out.task = positional.slice(1).join(' ').trim();
86
+ return out;
87
+ }
88
+
39
89
  export async function run(argv) {
40
90
  let args = argv;
41
91
  if (Array.isArray(args) && args[0]?.endsWith('node')) {
@@ -79,34 +129,25 @@ export async function run(argv) {
79
129
  }
80
130
 
81
131
  if (command === 'spawn') {
82
- let targetNode = null;
83
- const filteredRest = [];
84
- for (let i = 0; i < rest.length; i++) {
85
- if (rest[i] === '--node' || rest[i] === '-n') {
86
- targetNode = rest[i + 1];
87
- i++;
88
- } else {
89
- filteredRest.push(rest[i]);
90
- }
132
+ let parsed;
133
+ try {
134
+ parsed = parseSpawnArgs(rest);
135
+ } catch (err) {
136
+ console.error(`Error: ${err.message}`);
137
+ process.exit(1);
91
138
  }
92
-
93
- const harness = filteredRest[0];
94
- const task = filteredRest.filter(r => !r.startsWith('--')).slice(1).join(' ').trim();
95
- const detach = !filteredRest.includes('--no-detach');
96
- const isJson = filteredRest.includes('--json');
97
- const nameIdx = filteredRest.indexOf('--name');
98
- const name = nameIdx !== -1 ? filteredRest[nameIdx + 1] : null;
139
+ const { harness, task, detach, isJson, name, targetNode, cwd, tools, settingSources } = parsed;
99
140
 
100
141
  if (!harness || !task) {
101
142
  console.error('Error: Please specify harness ID and task prompt.');
102
- console.error('Usage: npx total-recall agent spawn <harness> "<task>" [--name "..."] [--node <node>]');
143
+ console.error('Usage: npx total-recall agent spawn <harness> "<task>" [--name "..."] [--node <node>] [--cwd <dir>] [--tools <list|none|default>]');
103
144
  process.exit(1);
104
145
  }
105
146
 
106
147
  const nodeStr = targetNode ? ` on mesh node \x1b[1;33m${targetNode}\x1b[0m` : '';
107
148
  if (!isJson) console.log(`\nšŸš€ Spawning agent on harness: \x1b[1;36m${harness}\x1b[0m${nodeStr}...`);
108
149
  try {
109
- const record = await spawnAgent(harness, task, { detach, name, node: targetNode });
150
+ const record = await spawnAgent(harness, task, { detach, name, node: targetNode, cwd, tools, settingSources });
110
151
  if (isJson) {
111
152
  console.log(JSON.stringify(record, null, 2));
112
153
  return;