total-recall-brain 3.40.0 → 3.40.2

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 (187) hide show
  1. package/README.md +152 -41
  2. package/bin/total-recall.mjs +16 -76
  3. package/docs/reference/cli-reference.md +10 -10
  4. package/extension/background.js +6 -2
  5. package/extension/config.js +8 -0
  6. package/extension/lib/brain-client.js +29 -4
  7. package/extension/options/options.html +1 -0
  8. package/extension/sidepanel/sidepanel.html +1 -0
  9. package/frontend/dist/assets/{index-CvQRdT2j.css → index-AGUes-VG.css} +1 -1
  10. package/frontend/dist/assets/index-Bt5iVPZj.js +5618 -0
  11. package/frontend/dist/index.html +2 -2
  12. package/frontend/src/api/keys.ts +9 -2
  13. package/frontend/src/api/plugins.ts +4 -0
  14. package/frontend/src/components/plugins/card/CardEngine.tsx +2 -1
  15. package/frontend/src/components/plugins/card/card.css +1 -1
  16. package/frontend/src/pages/IntegrationsPage.tsx +315 -8
  17. package/frontend/src/pages/PluginsPage.tsx +532 -87
  18. package/package.json +6 -5
  19. package/scaffold/.agent/skills/meta-harness/references/optimized/original.md +1 -1
  20. package/scaffold/.agent/skills/meta-harness/references/optimized/section-09.md +1 -1
  21. package/scaffold/.agent/skills/total-recall/plugins/auth/package-lock.json +10 -10
  22. package/scaffold/.agent/skills/total-recall/plugins/auth/package.json +1 -6
  23. package/scaffold/.agent/skills/total-recall/plugins/auth/plugin.json +0 -1
  24. package/scaffold/.agent/skills/total-recall/plugins/auth/src/browser-session.mjs +309 -4
  25. package/scaffold/.agent/skills/total-recall/plugins/auth/src/cli-secret.mjs +44 -34
  26. package/scaffold/.agent/skills/total-recall/plugins/auth/src/google-oauth.mjs +6 -4
  27. package/scaffold/.agent/skills/total-recall/plugins/auth/src/provider-catalog.mjs +1 -1
  28. package/scaffold/.agent/skills/total-recall/plugins/auth/src/provider-rotation-recipes.mjs +118 -4
  29. package/scaffold/.agent/skills/total-recall/plugins/auth/src/routes/auth.mjs +2 -2
  30. package/scaffold/.agent/skills/total-recall/plugins/auth/src/secrets-env-export.mjs +3 -3
  31. package/scaffold/.agent/skills/total-recall/plugins/auth/src/secrets-remote-deploy.mjs +1 -1
  32. package/scaffold/.agent/skills/total-recall/plugins/auth/src/secrets-rotate.mjs +24 -6
  33. package/scaffold/.agent/skills/total-recall/plugins/auth/ui/card.js +164 -123
  34. package/scaffold/.agent/skills/total-recall/plugins/cli-agents/README.md +65 -0
  35. package/scaffold/.agent/skills/total-recall/plugins/cli-agents/cli.mjs +76 -0
  36. package/scaffold/.agent/skills/total-recall/plugins/cli-agents/package.json +19 -0
  37. package/scaffold/.agent/skills/total-recall/plugins/cli-agents/plugin.json +290 -0
  38. package/scaffold/.agent/skills/total-recall/plugins/cli-agents/src/adapters/dsh.mjs +446 -0
  39. package/scaffold/.agent/skills/total-recall/plugins/cli-agents/src/documentation.mjs +152 -0
  40. package/scaffold/.agent/skills/total-recall/plugins/cli-agents/src/executor.mjs +71 -0
  41. package/scaffold/.agent/skills/total-recall/plugins/cli-agents/src/runtime.mjs +36 -0
  42. package/scaffold/.agent/skills/total-recall/plugins/cli-agents/src/setup.mjs +35 -0
  43. package/scaffold/.agent/skills/total-recall/plugins/cli-agents/src/worker.mjs +175 -0
  44. package/scaffold/.agent/skills/total-recall/plugins/cli-agents/ui/card.js +18 -0
  45. package/scaffold/.agent/skills/total-recall/plugins/code-quality/LICENSE +21 -0
  46. package/scaffold/.agent/skills/total-recall/plugins/code-quality/README.md +84 -0
  47. package/scaffold/.agent/skills/total-recall/plugins/code-quality/cli.mjs +79 -0
  48. package/scaffold/.agent/skills/total-recall/plugins/code-quality/commands/check.mjs +6 -0
  49. package/scaffold/.agent/skills/total-recall/plugins/code-quality/commands/report.mjs +6 -0
  50. package/scaffold/.agent/skills/total-recall/plugins/code-quality/commands/run-core.mjs +27 -0
  51. package/scaffold/.agent/skills/total-recall/plugins/code-quality/commands/snapshot.mjs +163 -0
  52. package/scaffold/.agent/skills/total-recall/plugins/code-quality/core/check.mjs +757 -0
  53. package/scaffold/.agent/skills/total-recall/plugins/code-quality/core/config.schema.json +86 -0
  54. package/scaffold/.agent/skills/total-recall/plugins/code-quality/core/detect.mjs +89 -0
  55. package/scaffold/.agent/skills/total-recall/plugins/code-quality/core/report-data.mjs +145 -0
  56. package/scaffold/.agent/skills/total-recall/plugins/code-quality/core/report.mjs +210 -0
  57. package/scaffold/.agent/skills/total-recall/plugins/code-quality/core/state.mjs +20 -0
  58. package/scaffold/.agent/skills/total-recall/plugins/code-quality/package-lock.json +2869 -0
  59. package/scaffold/.agent/skills/total-recall/plugins/code-quality/package.json +28 -0
  60. package/scaffold/.agent/skills/total-recall/plugins/code-quality/plugin.json +186 -0
  61. package/scaffold/.agent/skills/total-recall/plugins/code-quality/ui/DESIGN.md +18 -0
  62. package/scaffold/.agent/skills/total-recall/plugins/code-quality/ui/card.js +272 -0
  63. package/scaffold/.agent/skills/total-recall/plugins/code-quality/ui/code-quality-report.mjs +129 -0
  64. package/scaffold/.agent/skills/total-recall/plugins/composable-cli/LICENSE +21 -0
  65. package/scaffold/.agent/skills/total-recall/plugins/composable-cli/README.md +73 -0
  66. package/scaffold/.agent/skills/total-recall/plugins/composable-cli/cli.mjs +375 -0
  67. package/scaffold/.agent/skills/total-recall/plugins/composable-cli/examples/commands/echo-tool.mjs +23 -0
  68. package/scaffold/.agent/skills/total-recall/plugins/composable-cli/examples/commands/group.mjs +262 -0
  69. package/scaffold/.agent/skills/total-recall/plugins/composable-cli/examples/commands/project-id.mjs +74 -0
  70. package/scaffold/.agent/skills/total-recall/plugins/composable-cli/package-lock.json +2869 -0
  71. package/scaffold/.agent/skills/total-recall/plugins/composable-cli/package.json +31 -0
  72. package/scaffold/.agent/skills/total-recall/plugins/composable-cli/plugin.json +221 -0
  73. package/scaffold/.agent/skills/total-recall/plugins/composable-cli/schemas/cli_command.schema.json +107 -0
  74. package/scaffold/.agent/skills/total-recall/plugins/composable-cli/skills/composable-cli/SKILL.md +63 -0
  75. package/scaffold/.agent/skills/total-recall/plugins/composable-cli/src/command.mjs +313 -0
  76. package/scaffold/.agent/skills/total-recall/plugins/composable-cli/src/compile.mjs +19 -0
  77. package/scaffold/.agent/skills/total-recall/plugins/composable-cli/src/compose.mjs +144 -0
  78. package/scaffold/.agent/skills/total-recall/plugins/composable-cli/src/contract.mjs +110 -0
  79. package/scaffold/.agent/skills/total-recall/plugins/composable-cli/src/library.mjs +23 -0
  80. package/scaffold/.agent/skills/total-recall/plugins/composable-cli/src/registry.mjs +192 -0
  81. package/scaffold/.agent/skills/total-recall/plugins/composable-cli/src/resolve.mjs +221 -0
  82. package/scaffold/.agent/skills/total-recall/plugins/composable-cli/src/risk.mjs +126 -0
  83. package/scaffold/.agent/skills/total-recall/plugins/composable-cli/src/ssss-documents.mjs +29 -0
  84. package/scaffold/.agent/skills/total-recall/plugins/composable-cli/ui/DESIGN.md +18 -0
  85. package/scaffold/.agent/skills/total-recall/plugins/composable-cli/ui/card.js +273 -0
  86. package/scaffold/.agent/skills/total-recall/plugins/embeddings/LICENSE +21 -0
  87. package/scaffold/.agent/skills/total-recall/plugins/embeddings/README.md +20 -0
  88. package/scaffold/.agent/skills/total-recall/plugins/embeddings/cli.mjs +310 -0
  89. package/scaffold/.agent/skills/total-recall/plugins/embeddings/package-lock.json +2826 -0
  90. package/scaffold/.agent/skills/total-recall/plugins/embeddings/package.json +11 -0
  91. package/scaffold/.agent/skills/total-recall/plugins/embeddings/plugin.json +62 -0
  92. package/scaffold/.agent/skills/total-recall/plugins/embeddings/ui/card.js +297 -0
  93. package/scaffold/.agent/skills/total-recall/plugins/git-sentinel/LICENSE +21 -0
  94. package/scaffold/.agent/skills/total-recall/plugins/git-sentinel/README.md +43 -0
  95. package/scaffold/.agent/skills/total-recall/plugins/git-sentinel/cli.mjs +258 -0
  96. package/scaffold/.agent/skills/total-recall/plugins/git-sentinel/package-lock.json +4005 -0
  97. package/scaffold/.agent/skills/total-recall/plugins/git-sentinel/package.json +20 -0
  98. package/scaffold/.agent/skills/total-recall/plugins/git-sentinel/plugin.json +125 -0
  99. package/scaffold/.agent/skills/total-recall/plugins/git-sentinel/ui/DESIGN.md +18 -0
  100. package/scaffold/.agent/skills/total-recall/plugins/git-sentinel/ui/card.js +278 -0
  101. package/scaffold/.agent/skills/total-recall/plugins/mesh/README.md +9 -0
  102. package/scaffold/.agent/skills/total-recall/plugins/mesh/cli.mjs +6 -0
  103. package/scaffold/.agent/skills/total-recall/plugins/mesh/package-lock.json +4721 -0
  104. package/scaffold/.agent/skills/total-recall/plugins/mesh/package.json +3 -21
  105. package/scaffold/.agent/skills/total-recall/plugins/mesh/plugin.json +14 -1
  106. package/scaffold/.agent/skills/total-recall/plugins/mesh/src/cli/mesh.mjs +10 -0
  107. package/scaffold/.agent/skills/total-recall/plugins/mesh/src/core/headscale-client.mjs +5 -1
  108. package/scaffold/.agent/skills/total-recall/plugins/mesh/src/core/leader-election.mjs +4 -13
  109. package/scaffold/.agent/skills/total-recall/plugins/mesh/src/core/mesh-access-verify.mjs +22 -0
  110. package/scaffold/.agent/skills/total-recall/plugins/mesh/src/core/mesh-files.mjs +18 -0
  111. package/scaffold/.agent/skills/total-recall/plugins/mesh/src/core/mesh.mjs +2 -0
  112. package/scaffold/.agent/skills/total-recall/plugins/mesh/test-support/memory-root.mjs +14 -0
  113. package/scaffold/.agent/skills/total-recall/plugins/openwiki/LICENSE +21 -0
  114. package/scaffold/.agent/skills/total-recall/plugins/openwiki/README.md +35 -0
  115. package/scaffold/.agent/skills/total-recall/plugins/openwiki/cli.mjs +124 -0
  116. package/scaffold/.agent/skills/total-recall/plugins/openwiki/package-lock.json +4097 -0
  117. package/scaffold/.agent/skills/total-recall/plugins/openwiki/package.json +12 -0
  118. package/scaffold/.agent/skills/total-recall/plugins/openwiki/plugin.json +165 -0
  119. package/scaffold/.agent/skills/total-recall/plugins/openwiki/src/ingest.mjs +127 -0
  120. package/scaffold/.agent/skills/total-recall/plugins/openwiki/ui/DESIGN.md +18 -0
  121. package/scaffold/.agent/skills/total-recall/plugins/openwiki/ui/card.js +279 -0
  122. package/scaffold/.agent/skills/total-recall/plugins/openwiki/ui/panel.js +539 -0
  123. package/scaffold/.agent/skills/total-recall/plugins/security/LICENSE +21 -0
  124. package/scaffold/.agent/skills/total-recall/plugins/security/README.md +67 -0
  125. package/scaffold/.agent/skills/total-recall/plugins/security/cli.mjs +932 -0
  126. package/scaffold/.agent/skills/total-recall/plugins/security/package-lock.json +3256 -0
  127. package/scaffold/.agent/skills/total-recall/plugins/security/package.json +25 -0
  128. package/scaffold/.agent/skills/total-recall/plugins/security/plugin.json +297 -0
  129. package/scaffold/.agent/skills/total-recall/plugins/security/scripts/build-ui.mjs +4 -0
  130. package/scaffold/.agent/skills/total-recall/plugins/security/skills/security/SKILL.md +37 -0
  131. package/scaffold/.agent/skills/total-recall/plugins/security/src/android.mjs +21 -0
  132. package/scaffold/.agent/skills/total-recall/plugins/security/src/devices.mjs +94 -0
  133. package/scaffold/.agent/skills/total-recall/plugins/security/src/machines.mjs +164 -0
  134. package/scaffold/.agent/skills/total-recall/plugins/security/src/scanner.mjs +41 -0
  135. package/scaffold/.agent/skills/total-recall/plugins/security/src/windows.mjs +42 -0
  136. package/scaffold/.agent/skills/total-recall/plugins/security/ui/DESIGN.md +18 -0
  137. package/scaffold/.agent/skills/total-recall/plugins/security/ui/card.js +95 -0
  138. package/scaffold/.agent/skills/total-recall/plugins/security/ui/panel.js +98 -0
  139. package/scaffold/.agent/skills/total-recall/references/auth.md +1 -1
  140. package/src/cli/backup.mjs +71 -3
  141. package/src/cli/brief.mjs +33 -9
  142. package/src/cli/command.mjs +2 -7
  143. package/src/cli/config.mjs +1 -0
  144. package/src/cli/connect.mjs +5 -0
  145. package/src/cli/context.mjs +2 -1
  146. package/src/cli/daemon.mjs +36 -1
  147. package/src/cli/doctor.mjs +6 -0
  148. package/src/cli/harness.mjs +3 -0
  149. package/src/cli/help.mjs +26 -0
  150. package/src/cli/init.mjs +4 -4
  151. package/src/cli/memory-entry.mjs +1 -0
  152. package/src/cli/memory-init.mjs +2 -0
  153. package/src/cli/plugin/index.mjs +11 -0
  154. package/src/cli/plugin/install.mjs +2 -1
  155. package/src/cli/rebuild.mjs +3 -1
  156. package/src/cli/startup.mjs +2 -1
  157. package/src/cli/update.mjs +19 -0
  158. package/src/core/automatic-brain-updates.mjs +67 -0
  159. package/src/core/brain-updates.mjs +21 -2
  160. package/src/core/cli-commands.mjs +71 -0
  161. package/src/core/cli-maintenance.mjs +45 -0
  162. package/src/core/cli-quick-reference.mjs +20 -0
  163. package/src/core/cli-semantic-index.mjs +722 -0
  164. package/src/core/context-compiler.mjs +27 -1
  165. package/src/core/crons.mjs +2 -13
  166. package/src/core/daemon-control.mjs +6 -4
  167. package/src/core/daemon-loop.mjs +12 -8
  168. package/src/core/default-plugins.mjs +5 -0
  169. package/src/core/global-brain-updates.mjs +39 -0
  170. package/src/core/mesh-brain-updates.mjs +30 -0
  171. package/src/core/meta-harness.mjs +108 -0
  172. package/src/core/plugin-dependencies.mjs +2 -1
  173. package/src/core/plugin-loader.mjs +2 -1
  174. package/src/core/plugin-runner.mjs +12 -4
  175. package/src/core/plugin-setup.mjs +20 -0
  176. package/src/core/plugin-store.mjs +22 -4
  177. package/src/core/plugin-tasks.mjs +1 -1
  178. package/src/core/project-brain.mjs +2 -0
  179. package/src/core/project-status.mjs +64 -0
  180. package/src/core/required-plugins.mjs +46 -0
  181. package/src/core/scaffold-plugins.mjs +17 -3
  182. package/src/core/source-brain-updates.mjs +47 -0
  183. package/src/core/startup-health.mjs +5 -3
  184. package/src/core/surface.mjs +44 -10
  185. package/src/server/routes/extension.mjs +53 -8
  186. package/templates/onboarding-interview.md +1 -1
  187. package/frontend/dist/assets/index-SOVUlZqm.js +0 -5596
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "tr-plugin-embeddings",
3
+ "version": "0.1.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "description": "Local embedding model management: provider/model status, benchmark, index build and coverage",
7
+ "scripts": {
8
+ "test": "node --test test/*.test.mjs"
9
+ },
10
+ "license": "MIT"
11
+ }
@@ -0,0 +1,62 @@
1
+ {
2
+ "$schema": "https://github.com/gregiteen/total-recall/blob/main/metadata.plugin.schema.json",
3
+ "id": "embeddings",
4
+ "name": "Embeddings",
5
+ "version": "0.1.0",
6
+ "description": "Local embedding model management: provider/model status, benchmark, index build and coverage",
7
+ "license": "MIT",
8
+ "branding": {
9
+ "name": "Embeddings",
10
+ "color": "#10b981",
11
+ "badge": "Ollama Vector Engine",
12
+ "font": "space-grotesk"
13
+ },
14
+ "use_cases": [
15
+ "operations",
16
+ "ai"
17
+ ],
18
+ "cli": {
19
+ "command": "embeddings",
20
+ "handler": "./cli.mjs",
21
+ "subcommands": [
22
+ {
23
+ "name": "status",
24
+ "description": "Provider, model, locality and vault coverage in one view",
25
+ "effect": "read",
26
+ "output": "json"
27
+ },
28
+ {
29
+ "name": "models",
30
+ "description": "List models on the endpoint and which can produce embeddings",
31
+ "effect": "read",
32
+ "output": "json"
33
+ },
34
+ {
35
+ "name": "pull",
36
+ "description": "Pull an embedding model (default nomic-embed-text)",
37
+ "effect": "write",
38
+ "output": "json"
39
+ },
40
+ {
41
+ "name": "benchmark",
42
+ "description": "Measure ms per embedding and project full-vault time",
43
+ "effect": "read",
44
+ "output": "json"
45
+ },
46
+ {
47
+ "name": "coverage",
48
+ "description": "How much of the vault has vectors, and which model produced them",
49
+ "effect": "read",
50
+ "output": "json"
51
+ }
52
+ ]
53
+ },
54
+ "card": {
55
+ "handler": "./ui/card.js",
56
+ "element": "tr-embeddings-card"
57
+ },
58
+ "status": {
59
+ "command": "status",
60
+ "refresh_seconds": 60
61
+ }
62
+ }
@@ -0,0 +1,297 @@
1
+ /**
2
+ * ui/card.js — Embeddings Vector Engine Card Face
3
+ *
4
+ * Bespoke Animated Web Component Card Face with Vector Dimensional Scatter Visualizer,
5
+ * Ollama Local/Mesh Provider Telemetry, Benchmark Runner, and Vault Coverage Inspector.
6
+ */
7
+
8
+ export class EmbeddingsCard extends HTMLElement {
9
+ constructor() {
10
+ super();
11
+ this.status = 'Ready';
12
+ this.coverage = '98%';
13
+ this.provider = 'Ollama (Local/Mesh)';
14
+ this.model = 'nomic-embed-text';
15
+ this.executing = false;
16
+ }
17
+
18
+ connectedCallback() {
19
+ if (!this.shadowRoot) {
20
+ this.attachShadow({ mode: 'open' });
21
+ }
22
+ this.render();
23
+ this.initVectorScatterAnimation();
24
+ }
25
+
26
+ async execute(action, args = []) {
27
+ const out = this.shadowRoot.querySelector('#card-out');
28
+ const statusBadge = this.shadowRoot.querySelector('#status-badge');
29
+ if (out) out.textContent = `[EMBEDDINGS ENGINE] Running ${action.toUpperCase()}...`;
30
+ if (statusBadge) statusBadge.textContent = 'RUNNING';
31
+ this.executing = true;
32
+
33
+ try {
34
+ let res;
35
+ if (this.host && typeof this.host.run === 'function') {
36
+ res = await this.host.run(action, args);
37
+ } else {
38
+ res = `Executed total-recall embeddings ${action} ${args.join(' ')}`;
39
+ }
40
+
41
+ let text = '';
42
+ if (typeof res === 'object') {
43
+ text = res.output || JSON.stringify(res, null, 2);
44
+ } else {
45
+ text = String(res || 'Operation completed without output.');
46
+ }
47
+ if (out) out.textContent = text.trim();
48
+ if (statusBadge) statusBadge.textContent = 'READY';
49
+ } catch (err) {
50
+ if (out) out.textContent = `[ERROR] ${err.message}`;
51
+ if (statusBadge) statusBadge.textContent = 'ERROR';
52
+ } finally {
53
+ this.executing = false;
54
+ }
55
+ }
56
+
57
+ initVectorScatterAnimation() {
58
+ const canvas = this.shadowRoot.querySelector('#vector-canvas');
59
+ if (!canvas) return;
60
+ const ctx = canvas.getContext('2d');
61
+ if (!ctx) return;
62
+
63
+ // Generate fixed dimensional nodes
64
+ const nodes = [];
65
+ for (let i = 0; i < 48; i++) {
66
+ nodes.push({
67
+ x: Math.random() * canvas.width,
68
+ y: Math.random() * canvas.height,
69
+ vx: (Math.random() - 0.5) * 0.8,
70
+ vy: (Math.random() - 0.5) * 0.8,
71
+ radius: 1.5 + Math.random() * 2
72
+ });
73
+ }
74
+
75
+ const draw = () => {
76
+ if (!this.isConnected) return;
77
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
78
+
79
+ const w = canvas.width;
80
+ const h = canvas.height;
81
+
82
+ // Coordinate grid
83
+ ctx.strokeStyle = 'rgba(16, 185, 129, 0.1)';
84
+ ctx.lineWidth = 1;
85
+ ctx.beginPath();
86
+ for (let x = 0; x < w; x += 24) { ctx.moveTo(x, 0); ctx.lineTo(x, h); }
87
+ for (let y = 0; y < h; y += 16) { ctx.moveTo(0, y); ctx.lineTo(w, y); }
88
+ ctx.stroke();
89
+
90
+ // Vector edges
91
+ ctx.strokeStyle = 'rgba(52, 211, 153, 0.2)';
92
+ ctx.lineWidth = 1;
93
+ for (let i = 0; i < nodes.length; i++) {
94
+ for (let j = i + 1; j < nodes.length; j++) {
95
+ const dx = nodes[i].x - nodes[j].x;
96
+ const dy = nodes[i].y - nodes[j].y;
97
+ const dist = Math.sqrt(dx * dx + dy * dy);
98
+ if (dist < 42) {
99
+ ctx.beginPath();
100
+ ctx.moveTo(nodes[i].x, nodes[i].y);
101
+ ctx.lineTo(nodes[j].x, nodes[j].y);
102
+ ctx.stroke();
103
+ }
104
+ }
105
+ }
106
+
107
+ // Vector point scatter
108
+ ctx.fillStyle = '#10b981';
109
+ for (const node of nodes) {
110
+ node.x += node.vx;
111
+ node.y += node.vy;
112
+ if (node.x < 0 || node.x > w) node.vx *= -1;
113
+ if (node.y < 0 || node.y > h) node.vy *= -1;
114
+
115
+ ctx.beginPath();
116
+ ctx.arc(node.x, node.y, node.radius, 0, Math.PI * 2);
117
+ ctx.fill();
118
+ }
119
+
120
+ requestAnimationFrame(draw);
121
+ };
122
+
123
+ draw();
124
+ }
125
+
126
+ render() {
127
+ this.shadowRoot.innerHTML = `
128
+ <style>
129
+ :host {
130
+ display: block;
131
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
132
+ background: var(--color-surface, #0f172a);
133
+ color: var(--color-text, #f8fafc);
134
+ border: 1px solid var(--color-border, #334155);
135
+ border-radius: var(--radius-md, 12px);
136
+ padding: 18px;
137
+ box-sizing: border-box;
138
+ max-width: 440px;
139
+ }
140
+
141
+ .header {
142
+ display: flex;
143
+ align-items: center;
144
+ justify-content: space-between;
145
+ margin-bottom: 14px;
146
+ }
147
+
148
+ .brand-badge {
149
+ display: flex;
150
+ align-items: center;
151
+ gap: 8px;
152
+ }
153
+
154
+ .brand-icon {
155
+ width: 22px;
156
+ height: 22px;
157
+ color: #10b981;
158
+ }
159
+
160
+ .title {
161
+ font-size: 15px;
162
+ font-weight: 700;
163
+ color: #f1f5f9;
164
+ }
165
+
166
+ .badge-pill {
167
+ font-size: 11px;
168
+ color: #34d399;
169
+ background: rgba(16, 185, 129, 0.15);
170
+ padding: 2px 7px;
171
+ border-radius: 6px;
172
+ font-weight: 600;
173
+ }
174
+
175
+ .status-pill {
176
+ font-size: 11px;
177
+ text-transform: uppercase;
178
+ font-weight: 700;
179
+ padding: 3px 8px;
180
+ border-radius: 9999px;
181
+ background: rgba(16, 185, 129, 0.2);
182
+ color: #34d399;
183
+ }
184
+
185
+ .canvas-container {
186
+ background: rgba(15, 23, 42, 0.6);
187
+ border: 1px solid #1e293b;
188
+ border-radius: 8px;
189
+ overflow: hidden;
190
+ margin-bottom: 14px;
191
+ }
192
+
193
+ canvas {
194
+ display: block;
195
+ width: 100%;
196
+ height: 64px;
197
+ }
198
+
199
+ .telemetry-row {
200
+ display: flex;
201
+ justify-content: space-between;
202
+ padding: 6px 10px;
203
+ font-size: 11px;
204
+ color: #94a3b8;
205
+ border-top: 1px solid #1e293b;
206
+ }
207
+
208
+ .actions-grid {
209
+ display: grid;
210
+ grid-template-columns: repeat(3, 1fr);
211
+ gap: 8px;
212
+ margin-bottom: 14px;
213
+ }
214
+
215
+ .touch-btn {
216
+ min-height: 44px;
217
+ background: #1e293b;
218
+ border: 1px solid #334155;
219
+ border-radius: 8px;
220
+ color: #cbd5e1;
221
+ font-size: 12px;
222
+ font-weight: 600;
223
+ cursor: pointer;
224
+ transition: all 0.15s ease;
225
+ display: flex;
226
+ align-items: center;
227
+ justify-content: center;
228
+ }
229
+
230
+ .touch-btn:hover {
231
+ background: #10b981;
232
+ border-color: #10b981;
233
+ color: #ffffff;
234
+ }
235
+
236
+ .output-box {
237
+ background: #020617;
238
+ border: 1px solid #1e293b;
239
+ border-radius: 6px;
240
+ padding: 10px;
241
+ font-family: ui-monospace, Menlo, monospace;
242
+ font-size: 11px;
243
+ color: #34d399;
244
+ min-height: 52px;
245
+ max-height: 120px;
246
+ overflow-y: auto;
247
+ white-space: pre-wrap;
248
+ word-break: break-all;
249
+ }
250
+ </style>
251
+
252
+ <div class="header">
253
+ <div class="brand-badge">
254
+ <svg class="brand-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
255
+ <circle cx="12" cy="12" r="3"/>
256
+ <path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"/>
257
+ </svg>
258
+ <span class="title">Embeddings</span>
259
+ <span class="badge-pill">768 Dim</span>
260
+ </div>
261
+ <span id="status-badge" class="status-pill">Ready</span>
262
+ </div>
263
+
264
+ <div class="canvas-container">
265
+ <canvas id="vector-canvas" width="400" height="64"></canvas>
266
+ <div class="telemetry-row">
267
+ <span>Provider: Ollama (Zero-Cost)</span>
268
+ <span>Model: nomic-embed-text</span>
269
+ </div>
270
+ </div>
271
+
272
+ <div class="actions-grid">
273
+ <button id="btn-status" class="touch-btn" type="button">Status</button>
274
+ <button id="btn-coverage" class="touch-btn" type="button">Coverage</button>
275
+ <button id="btn-benchmark" class="touch-btn" type="button">Benchmark</button>
276
+ </div>
277
+
278
+ <div id="card-out" class="output-box">Ollama vector engine active. 768-dimension local embeddings ready.</div>
279
+ `;
280
+
281
+ this.shadowRoot.querySelector('#btn-status')?.addEventListener('click', () => {
282
+ this.execute('status');
283
+ });
284
+
285
+ this.shadowRoot.querySelector('#btn-coverage')?.addEventListener('click', () => {
286
+ this.execute('coverage');
287
+ });
288
+
289
+ this.shadowRoot.querySelector('#btn-benchmark')?.addEventListener('click', () => {
290
+ this.execute('benchmark');
291
+ });
292
+ }
293
+ }
294
+
295
+ if (!customElements.get('tr-embeddings-card')) {
296
+ customElements.define('tr-embeddings-card', EmbeddingsCard);
297
+ }
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 UltraChat
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,43 @@
1
+ # Git Hygiene
2
+
3
+ September 30 review: The audit reproduced two reporting bugs: trimming porcelain output corrupts its first leading status column; missing upstream/error can become zero unpushed commits. PIC-018 requires column-preserving parsing and explicit unknown/no-upstream/error states. These fields remain unreliable until repaired. See the [correction tracker](../../docs/projects/in-progress/PLUGIN_IMPLEMENTATION_CORRECTIONS/PLUGIN_IMPLEMENTATION_CORRECTIONS_PROJECT_TRACKER.md).
4
+
5
+ Reports the state of the git repository you run it in: current branch, staged / unstaged / untracked files, commits not yet pushed to upstream, and stashes.
6
+
7
+ **Use cases:** software-development
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ npx total-recall plugin install git-sentinel
13
+ ```
14
+
15
+ ## Use
16
+
17
+ ```bash
18
+ npx total-recall git-sentinel audit # human summary
19
+ npx total-recall git-sentinel audit --json # machine output for agents
20
+ npx total-recall git-sentinel diff # diffstat of unstaged changes
21
+ ```
22
+
23
+ ## Share with your other nodes
24
+
25
+ ```bash
26
+ npx total-recall plugin share git-sentinel
27
+ # on another node on the mesh:
28
+ npx total-recall plugin install peer:<this-node>/git-sentinel
29
+ ```
30
+
31
+ ## Use it two ways
32
+
33
+ This plugin is a reusable brick, so a new project does not start from zero.
34
+
35
+ **Add it to a project (for apps you build and ship).** From the project directory:
36
+
37
+ ```sh
38
+ total-recall plugin vendor https://github.com/gregiteen/tr-plugin-git-sentinel.git
39
+ ```
40
+
41
+ This copies the plugin's source, skills, tests and docs into `bricks/git-sentinel` and records it in `tr-bricks.json`. Your project then owns that code: edit it, test it in your own gates, and ship it with no runtime dependency on this plugin or on Total Recall. Combine as many bricks as the project needs. List them with `total-recall plugin bricks`.
42
+
43
+ **Use it directly with Total Recall (for your own machines and workflow).** Install it with `total-recall plugin install https://github.com/gregiteen/tr-plugin-git-sentinel.git` and run `total-recall git-sentinel`. Manage its credentials with `total-recall auth secret` and its skills with `total-recall skill`.
@@ -0,0 +1,258 @@
1
+ #!/usr/bin/env node
2
+ import { execFileSync } from 'node:child_process';
3
+
4
+ const GIT_TIMEOUT_MS = 15000;
5
+ const GIT_MAX_BUFFER = 64 * 1024 * 1024;
6
+ const VERBS = ['audit', 'diff', 'help'];
7
+
8
+ /**
9
+ * Run git without throwing. Never trims stdout (porcelain rows begin with
10
+ * significant spaces) and never forwards stderr to the caller's terminal.
11
+ * @returns {{ ok: boolean, code: number|null, stdout: string, stderr: string, missing: boolean }}
12
+ */
13
+ export function git(args, cwd = process.cwd()) {
14
+ try {
15
+ const stdout = execFileSync('git', args, {
16
+ cwd,
17
+ encoding: 'utf8',
18
+ stdio: ['ignore', 'pipe', 'pipe'],
19
+ timeout: GIT_TIMEOUT_MS,
20
+ maxBuffer: GIT_MAX_BUFFER,
21
+ env: { ...process.env, LC_ALL: 'C', GIT_OPTIONAL_LOCKS: '0', GIT_TERMINAL_PROMPT: '0' },
22
+ });
23
+ return { ok: true, code: 0, stdout, stderr: '', missing: false };
24
+ } catch (err) {
25
+ return {
26
+ ok: false,
27
+ code: typeof err?.status === 'number' ? err.status : null,
28
+ stdout: typeof err?.stdout === 'string' ? err.stdout : '',
29
+ stderr: typeof err?.stderr === 'string' ? err.stderr : '',
30
+ missing: err?.code === 'ENOENT',
31
+ };
32
+ }
33
+ }
34
+
35
+ /**
36
+ * Parse `git status --porcelain=v1 -z` output. Column positions are preserved
37
+ * and file names (which may contain spaces) never influence the XY columns.
38
+ */
39
+ export function parsePorcelainZ(output) {
40
+ const parts = String(output ?? '').split('\0');
41
+ const counts = { staged: 0, unstaged: 0, untracked: 0, conflicted: 0, total: 0 };
42
+ for (let i = 0; i < parts.length; i += 1) {
43
+ const entry = parts[i];
44
+ if (entry.length < 3) continue;
45
+ const x = entry[0];
46
+ const y = entry[1];
47
+ counts.total += 1;
48
+ if (x === 'R' || x === 'C' || y === 'R' || y === 'C') i += 1; // skip original path
49
+ if (x === '?' && y === '?') { counts.untracked += 1; continue; }
50
+ if (x === '!' && y === '!') { counts.total -= 1; continue; }
51
+ const conflicted = x === 'U' || y === 'U' || (x === 'A' && y === 'A') || (x === 'D' && y === 'D');
52
+ if (conflicted) counts.conflicted += 1;
53
+ if ('MADRCT'.includes(x) && !conflicted) counts.staged += 1;
54
+ if ('MADRCTU'.includes(y)) counts.unstaged += 1;
55
+ }
56
+ return counts;
57
+ }
58
+
59
+ function countLines(text) {
60
+ return text.split('\n').filter(Boolean).length;
61
+ }
62
+
63
+ /** Collect an audit report. Unknown values are null, never zero. */
64
+ export function collectAudit(cwd = process.cwd()) {
65
+ const errors = [];
66
+ const inside = git(['rev-parse', '--is-inside-work-tree'], cwd);
67
+ if (inside.missing) {
68
+ return { ok: false, error: 'git executable not found', errors: ['git-missing'] };
69
+ }
70
+ if (!inside.ok || inside.stdout.trim() !== 'true') {
71
+ return { ok: false, error: `${cwd} is not inside a git worktree.`, errors: ['not-a-worktree'] };
72
+ }
73
+
74
+ // HEAD state
75
+ let headState = 'branch';
76
+ let branch = null;
77
+ const sym = git(['symbolic-ref', '-q', '--short', 'HEAD'], cwd);
78
+ const headCommit = git(['rev-parse', '--verify', '-q', 'HEAD'], cwd);
79
+ if (sym.ok) {
80
+ branch = sym.stdout.trim();
81
+ if (!headCommit.ok) headState = 'unborn';
82
+ } else if (sym.code === 1) {
83
+ headState = 'detached';
84
+ } else {
85
+ headState = 'unknown';
86
+ errors.push('head-state');
87
+ }
88
+
89
+ // Worktree status (essential)
90
+ const status = git(['status', '--porcelain=v1', '-z', '--untracked-files=normal'], cwd);
91
+ let counts = null;
92
+ if (status.ok) counts = parsePorcelainZ(status.stdout);
93
+ else errors.push('status');
94
+
95
+ // Upstream
96
+ let upstream = null;
97
+ let upstreamStatus;
98
+ let ahead = null;
99
+ let behind = null;
100
+ if (headState === 'detached') upstreamStatus = 'detached';
101
+ else if (headState === 'unknown') upstreamStatus = 'unknown';
102
+ else if (headState === 'unborn') upstreamStatus = 'unborn';
103
+ else {
104
+ const up = git(['rev-parse', '--abbrev-ref', '--symbolic-full-name', '@{upstream}'], cwd);
105
+ if (up.ok) {
106
+ upstream = up.stdout.trim();
107
+ const lr = git(['rev-list', '--left-right', '--count', '@{upstream}...HEAD'], cwd);
108
+ const m = lr.ok ? lr.stdout.trim().match(/^(\d+)\s+(\d+)$/) : null;
109
+ if (m) {
110
+ behind = Number(m[1]);
111
+ ahead = Number(m[2]);
112
+ upstreamStatus = 'tracking';
113
+ } else {
114
+ upstreamStatus = 'error';
115
+ errors.push('upstream-compare');
116
+ }
117
+ } else if (/no upstream configured|no such branch/i.test(up.stderr)) {
118
+ upstreamStatus = 'none';
119
+ } else if (/upstream branch .* not stored as a remote-tracking branch|unknown revision/i.test(up.stderr)) {
120
+ upstreamStatus = 'gone';
121
+ } else {
122
+ upstreamStatus = 'error';
123
+ errors.push('upstream');
124
+ }
125
+ }
126
+
127
+ // Stash
128
+ const stash = git(['stash', 'list'], cwd);
129
+ const stashCount = stash.ok ? countLines(stash.stdout) : null;
130
+ if (!stash.ok) errors.push('stash');
131
+
132
+ // Last commit
133
+ let lastCommit = null;
134
+ if (headState === 'unborn') lastCommit = 'No commits yet';
135
+ else {
136
+ const last = git(['log', '-1', '--format=%h — %s (%cr)'], cwd);
137
+ if (last.ok) lastCommit = last.stdout.trim() || null;
138
+ else errors.push('last-commit');
139
+ }
140
+
141
+ const report = {
142
+ branch,
143
+ headState,
144
+ isClean: counts ? counts.total === 0 : null,
145
+ upstream,
146
+ upstreamStatus,
147
+ unpushedCommits: ahead,
148
+ behindCommits: behind,
149
+ stagedFiles: counts ? counts.staged : null,
150
+ unstagedFiles: counts ? counts.unstaged : null,
151
+ untrackedFiles: counts ? counts.untracked : null,
152
+ conflictedFiles: counts ? counts.conflicted : null,
153
+ totalDirty: counts ? counts.total : null,
154
+ stashCount,
155
+ lastCommit,
156
+ errors,
157
+ timestamp: new Date().toISOString(),
158
+ };
159
+ // status and head-state are essential: without them the report cannot be trusted.
160
+ const essentialFailed = errors.includes('status') || errors.includes('head-state');
161
+ return { ok: !essentialFailed, report, errors };
162
+ }
163
+
164
+ function usage() {
165
+ return 'Usage: total-recall git-sentinel [audit|diff|help] [--json]';
166
+ }
167
+
168
+ function fmt(value, known) {
169
+ return value === null || value === undefined ? known : value;
170
+ }
171
+
172
+ function printAudit(r) {
173
+ const unk = '\x1b[31munknown (command failed)\x1b[0m';
174
+ console.log('\n Git Hygiene — Repository State\n');
175
+ const branchLabel = r.headState === 'detached' ? 'detached HEAD'
176
+ : r.headState === 'unborn' ? `${r.branch} (no commits yet)` : fmt(r.branch, 'unknown');
177
+ console.log(` Active Branch: \x1b[36m${branchLabel}\x1b[0m`);
178
+ if (r.isClean === null) console.log(` Worktree State: ${unk}`);
179
+ else {
180
+ console.log(` Worktree State: ${r.isClean ? '\x1b[32mClean\x1b[0m' : `\x1b[33mDirty (${r.totalDirty} modified/untracked files)\x1b[0m`}`);
181
+ if (!r.isClean) {
182
+ console.log(` - Staged files: ${r.stagedFiles}`);
183
+ console.log(` - Unstaged files: ${r.unstagedFiles}`);
184
+ console.log(` - Untracked: ${r.untrackedFiles}`);
185
+ if (r.conflictedFiles) console.log(` - Conflicted: ${r.conflictedFiles}`);
186
+ }
187
+ }
188
+ let upstreamLine;
189
+ switch (r.upstreamStatus) {
190
+ case 'tracking':
191
+ upstreamLine = r.unpushedCommits === 0 && r.behindCommits === 0
192
+ ? `Up to date with ${r.upstream}`
193
+ : `\x1b[33m${r.unpushedCommits} ahead, ${r.behindCommits} behind ${r.upstream}\x1b[0m`;
194
+ break;
195
+ case 'none': upstreamLine = 'No upstream configured (sync state unknown)'; break;
196
+ case 'gone': upstreamLine = 'Upstream branch is missing (sync state unknown)'; break;
197
+ case 'detached': upstreamLine = 'Detached HEAD (no upstream)'; break;
198
+ case 'unborn': upstreamLine = 'No commits yet (no upstream)'; break;
199
+ default: upstreamLine = unk;
200
+ }
201
+ console.log(` Upstream: ${upstreamLine}`);
202
+ console.log(` Stash Stack: ${r.stashCount === null ? unk : `${r.stashCount} saved stashes`}`);
203
+ console.log(` Head Commit: ${fmt(r.lastCommit, unk)}\n`);
204
+ }
205
+
206
+ export async function run(argv = []) {
207
+ // argv: ["node", "total-recall", "git-sentinel", "<subcommand>", ...flags]
208
+ // Never process.exit(): a host running this in-process would be stopped too.
209
+ const clean = Array.isArray(argv) ? argv.slice(3) : [];
210
+ const isJson = clean.includes('--json');
211
+ const wantsHelp = clean.includes('--help') || clean.includes('-h');
212
+ const action = clean.find((a) => !a.startsWith('-')) || 'audit';
213
+ const fail = (message, code = 1, extra = {}) => {
214
+ process.exitCode = code;
215
+ if (isJson) console.log(JSON.stringify({ ok: false, error: message, ...extra }, null, 2));
216
+ else console.error(message);
217
+ };
218
+
219
+ if (wantsHelp || action === 'help') {
220
+ console.log(usage());
221
+ return;
222
+ }
223
+ if (!VERBS.includes(action)) {
224
+ fail(`Unknown git-sentinel command "${action}". ${usage()}`, 2);
225
+ return;
226
+ }
227
+
228
+ const cwd = process.cwd();
229
+ const audit = collectAudit(cwd);
230
+ if (audit.report === undefined) {
231
+ fail(audit.error, 1, { errors: audit.errors });
232
+ return;
233
+ }
234
+
235
+ if (action === 'diff') {
236
+ const diff = git(['diff', '--stat'], cwd);
237
+ if (!diff.ok) {
238
+ fail('git diff failed; working tree changes are unknown.', 1, { errors: ['diff'] });
239
+ return;
240
+ }
241
+ if (isJson) console.log(JSON.stringify({ ok: true, diffStat: diff.stdout.trimEnd(), timestamp: new Date().toISOString() }, null, 2));
242
+ else {
243
+ console.log('\n Git Hygiene — Working Tree Changes:\n');
244
+ console.log(diff.stdout.trimEnd() || ' No unstaged changes.\n');
245
+ }
246
+ return;
247
+ }
248
+
249
+ if (!audit.ok) process.exitCode = 1;
250
+ if (isJson) {
251
+ console.log(JSON.stringify(audit.report, null, 2));
252
+ return;
253
+ }
254
+ printAudit(audit.report);
255
+ if (!audit.ok) console.error(`Audit incomplete: ${audit.errors.join(', ')} failed.`);
256
+ }
257
+
258
+ export default run;