total-recall-brain 3.13.0 → 3.13.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 (152) hide show
  1. package/README.md +91 -108
  2. package/bin/antigravity.mjs +81 -52
  3. package/bin/total-recall.mjs +32 -57
  4. package/extension/background.js +1 -1
  5. package/extension/options/options.js +9 -3
  6. package/extension/sidepanel/sidepanel.js +0 -2
  7. package/frontend/index.html +4 -3
  8. package/frontend/package.json +1 -0
  9. package/frontend/src/App.tsx +109 -152
  10. package/frontend/src/api.ts +605 -23
  11. package/frontend/src/components/BrainSelector.tsx +211 -199
  12. package/frontend/src/components/DocumentEditorModal.tsx +57 -0
  13. package/frontend/src/components/DocumentTable.tsx +47 -0
  14. package/frontend/src/components/Graph3D.tsx +120 -71
  15. package/frontend/src/components/UsageChart.tsx +3 -3
  16. package/frontend/src/components/brand/BrandMark.tsx +95 -0
  17. package/frontend/src/index.css +286 -86
  18. package/frontend/src/pages/ApiKeysPage.tsx +1878 -215
  19. package/frontend/src/pages/ChatPage.tsx +103 -45
  20. package/frontend/src/pages/DesignDocsPage.tsx +5 -5
  21. package/frontend/src/pages/FilesPage.tsx +10 -6
  22. package/frontend/src/pages/GraphPage.tsx +5 -3
  23. package/frontend/src/pages/HelpPage.tsx +2 -2
  24. package/frontend/src/pages/InboxPage.tsx +82 -0
  25. package/frontend/src/pages/InstructionsPage.tsx +1 -1
  26. package/frontend/src/pages/IntegrationsPage.tsx +21 -10
  27. package/frontend/src/pages/LoginPage.tsx +95 -77
  28. package/frontend/src/pages/MemoryPage.tsx +31 -8
  29. package/frontend/src/pages/OnboardingPage.tsx +690 -0
  30. package/frontend/src/pages/OpenWikiPage.tsx +412 -323
  31. package/frontend/src/pages/SettingsPage.tsx +825 -922
  32. package/frontend/src/pages/SkillsPage.tsx +272 -147
  33. package/frontend/src/pages/UsagePage.tsx +23 -31
  34. package/frontend/src/pages/VaultPage.tsx +223 -0
  35. package/frontend/src/types.ts +13 -0
  36. package/package.json +4 -4
  37. package/scaffold/.agent/skills/total-recall/SKILL.md +43 -4
  38. package/scaffold/.agent/skills/total-recall/modules/README.md +10 -0
  39. package/scaffold/.agent/skills/total-recall/modules/agents/README.md +5 -0
  40. package/scaffold/.agent/skills/total-recall/{skills/tr-cli-agents → modules/agents}/agents.yml +8 -0
  41. package/scaffold/.agent/skills/total-recall/modules/skill-deploy/README.md +9 -0
  42. package/scaffold/.agent/skills/total-recall/openwiki/README.md +10 -0
  43. package/scaffold/.agent/skills/total-recall/openwiki/architecture.md +5 -0
  44. package/scaffold/.agent/skills/total-recall/openwiki/ide.md +10 -0
  45. package/scaffold/.agent/skills/total-recall/openwiki/memory.md +11 -0
  46. package/scaffold/.agent/skills/total-recall/openwiki/secrets.md +7 -0
  47. package/scaffold/.agent/skills/total-recall/openwiki/skills.md +7 -0
  48. package/src/cli/brain.mjs +63 -5
  49. package/src/cli/connect.mjs +11 -19
  50. package/src/cli/daemon.mjs +5 -4
  51. package/src/cli/deploy-ui.mjs +8 -3
  52. package/src/cli/deploy.mjs +84 -27
  53. package/src/cli/ingest/index.mjs +1 -1
  54. package/src/cli/init.mjs +63 -34
  55. package/src/cli/remember.mjs +3 -3
  56. package/src/cli/secret.mjs +812 -0
  57. package/src/cli/setup.mjs +34 -7
  58. package/src/cli/share.mjs +2 -2
  59. package/src/cli/skill.mjs +396 -35
  60. package/src/cli/sync.mjs +4 -4
  61. package/src/cli/task.mjs +287 -0
  62. package/src/core/clarity-rewriter.mjs +5 -5
  63. package/src/core/config.mjs +44 -2
  64. package/src/core/conflict-detector.mjs +5 -5
  65. package/src/core/crons.mjs +54 -0
  66. package/src/core/daemon-loop.mjs +87 -235
  67. package/src/core/dream.mjs +170 -10
  68. package/src/core/env-import.mjs +456 -0
  69. package/src/core/fact-seeker.mjs +14 -14
  70. package/src/core/import-rules.mjs +20 -7
  71. package/src/core/inference-engine.mjs +3 -3
  72. package/src/core/migrate.mjs +14 -8
  73. package/src/core/okf-adapter.mjs +2 -2
  74. package/src/core/operation-validator.mjs +39 -331
  75. package/src/core/optimizer.mjs +7 -0
  76. package/src/core/post-mortem.mjs +2 -2
  77. package/src/core/project-brain.mjs +349 -0
  78. package/src/core/provider-catalog.mjs +296 -0
  79. package/src/core/quick-capture.mjs +1 -1
  80. package/src/core/remote-vault-sync.mjs +194 -0
  81. package/src/core/research-queue.mjs +7 -11
  82. package/src/core/runtime.mjs +33 -9
  83. package/src/core/scheduler.mjs +59 -5
  84. package/src/core/schema.mjs +14 -0
  85. package/src/core/search.mjs +1 -1
  86. package/src/core/secrets-env-export.mjs +323 -0
  87. package/src/core/secrets-rotate.mjs +245 -0
  88. package/src/core/secrets-store.mjs +645 -0
  89. package/src/core/semantic-index.mjs +3 -3
  90. package/src/core/skills-registry.mjs +1062 -0
  91. package/src/core/source-adapters.mjs +4 -1
  92. package/src/core/ssss-host-extension.mjs +94 -0
  93. package/src/core/ssss-kernel-bridge.mjs +530 -0
  94. package/src/core/surface.mjs +14 -0
  95. package/src/core/task-envelope.mjs +298 -0
  96. package/src/core/task-executors.mjs +600 -0
  97. package/src/core/validated-write.mjs +124 -56
  98. package/src/core/vault.mjs +21 -34
  99. package/src/core/webauthn-store.mjs +272 -0
  100. package/src/server/api.mjs +26 -16
  101. package/src/server/auth.mjs +51 -0
  102. package/src/server/index.mjs +3 -3
  103. package/src/server/keys.mjs +30 -4
  104. package/src/server/rest.mjs +198 -25
  105. package/src/server/route-manifest.json +156 -0
  106. package/src/server/routes/_shared.mjs +40 -1
  107. package/src/server/routes/docs.mjs +260 -0
  108. package/src/server/routes/memory.mjs +145 -32
  109. package/src/server/routes/research.mjs +30 -0
  110. package/src/server/routes/secrets.mjs +470 -0
  111. package/src/server/routes/share.mjs +2 -2
  112. package/src/server/routes/skills.mjs +452 -54
  113. package/src/server/routes/sync.mjs +48 -0
  114. package/src/server/routes/webauthn.mjs +184 -0
  115. package/src/server/update-route-manifest.mjs +39 -0
  116. package/templates/onboarding-interview.md +32 -22
  117. package/templates/openwiki/README.md +10 -0
  118. package/templates/openwiki/architecture.md +5 -0
  119. package/templates/openwiki/ide.md +10 -0
  120. package/templates/openwiki/memory.md +11 -0
  121. package/templates/openwiki/secrets.md +7 -0
  122. package/templates/openwiki/skills.md +7 -0
  123. package/scaffold/.agent/skills/total-recall/skills/tr-cli-agents/SKILL.md +0 -121
  124. package/scaffold/.agent/skills/total-recall/skills/tr-cli-agents/references/antigravity.txt +0 -20
  125. package/scaffold/.agent/skills/total-recall/skills/tr-cli-agents/references/claude.txt +0 -58
  126. package/scaffold/.agent/skills/total-recall/skills/tr-cli-agents/references/codex.txt +0 -81
  127. package/scaffold/.agent/skills/total-recall/skills/tr-cli-agents/references/gemini.txt +0 -44
  128. package/scaffold/.agent/skills/total-recall/skills/tr-cli-agents/scripts/.gitkeep +0 -0
  129. package/scaffold/.agent/skills/total-recall/skills/tr-cli-agents/subagents/.gitkeep +0 -0
  130. package/scaffold/.agent/skills/total-recall/skills/tr-research/SKILL.md +0 -338
  131. package/scaffold/.agent/skills/total-recall/skills/tr-skill/SKILL.md +0 -282
  132. package/scaffold/.agent/skills/total-recall/skills/tr-skill/assets/skill-template/SKILL.md +0 -20
  133. package/scaffold/.agent/skills/total-recall/skills/tr-skill/evals/evals.json +0 -20
  134. package/scaffold/.agent/skills/total-recall/skills/tr-skill/hooks/on-skill-add.sh +0 -14
  135. package/scaffold/.agent/skills/total-recall/skills/tr-skill/hooks/on-skill-delete.sh +0 -14
  136. package/scaffold/.agent/skills/total-recall/skills/tr-skill/learnings/.gitkeep +0 -0
  137. package/scaffold/.agent/skills/total-recall/skills/tr-skill/references/.gitkeep +0 -0
  138. package/scaffold/.agent/skills/total-recall/skills/tr-skill/scripts/.gitkeep +0 -0
  139. package/scaffold/.agent/skills/total-recall/skills/tr-skill/scripts/create-skill.sh +0 -65
  140. package/scaffold/.agent/skills/total-recall/skills/tr-skill/scripts/enforce-skill-optimization.mjs +0 -135
  141. package/scaffold/.agent/skills/total-recall/skills/tr-skill/scripts/skill-watcher.mjs +0 -64
  142. package/scaffold/.agent/skills/total-recall/skills/tr-skill/subagents/audit-all-skills.md +0 -62
  143. package/scaffold/.agent/skills/total-recall/skills/tr-ssss/SKILL.md +0 -298
  144. package/scaffold/.agent/skills/total-recall/skills/tr-ssss/evals/evals.json +0 -17
  145. package/scaffold/.agent/skills/total-recall/skills/tr-ssss/references/CHANGELOG.md +0 -124
  146. package/scaffold/.agent/skills/total-recall/skills/tr-ssss/references/ssss-spec.md +0 -1325
  147. package/scaffold/.agent/skills/total-recall/skills/tr-ssss/scripts/validate-schema.mjs +0 -232
  148. package/scaffold/.agent/skills/total-recall/skills/tr-ssss/subagents/audit-ssss-node.md +0 -9
  149. /package/scaffold/.agent/skills/total-recall/{skills/tr-cli-agents/evals → modules/skill-deploy/scripts}/.gitkeep +0 -0
  150. /package/scaffold/.agent/skills/total-recall/{skills/tr-skill → modules/skill-deploy}/scripts/find-skills.mjs +0 -0
  151. /package/scaffold/.agent/skills/total-recall/{skills/tr-skill → modules/skill-deploy}/scripts/install-skill.mjs +0 -0
  152. /package/scaffold/.agent/skills/total-recall/{skills/tr-skill → modules/skill-deploy}/scripts/scan-skill.mjs +0 -0
@@ -0,0 +1,184 @@
1
+ /**
2
+ * WebAuthn / passkey routes for dashboard step-up (secret reveal).
3
+ *
4
+ * - GET /api/webauthn/status
5
+ * - POST /api/webauthn/register/options
6
+ * - POST /api/webauthn/register/verify
7
+ * - POST /api/webauthn/assert/options
8
+ * - POST /api/webauthn/assert/verify → { step_up_token }
9
+ * - POST /api/webauthn/step-up/password → { step_up_token } (fallback if no passkeys)
10
+ * - DELETE /api/webauthn/credentials/:id
11
+ */
12
+
13
+ import express from 'express';
14
+ import { requireAuth, requireScope, mintStepUpToken, verifyDashboardPassword } from '../auth.mjs';
15
+ import { badRequest, serverError, BRAIN_DIR } from './_shared.mjs';
16
+ import {
17
+ listPasskeys,
18
+ hasPasskeys,
19
+ beginRegistration,
20
+ finishRegistration,
21
+ beginAuthentication,
22
+ finishAuthentication,
23
+ deletePasskey,
24
+ resolveWebAuthnPath,
25
+ } from '../../core/webauthn-store.mjs';
26
+ import { logger } from '../../core/logger.mjs';
27
+
28
+ const router = express.Router();
29
+
30
+ function brainDir() {
31
+ return process.env.TR_SECRETS_BRAIN || BRAIN_DIR;
32
+ }
33
+
34
+ router.get('/api/webauthn/status', requireAuth, requireScope('keys:read', 'config:read'), (req, res) => {
35
+ try {
36
+ const dir = brainDir();
37
+ const passkeys = listPasskeys(dir);
38
+ res.json({
39
+ enabled: true,
40
+ has_passkeys: passkeys.length > 0,
41
+ count: passkeys.length,
42
+ passkeys,
43
+ store: resolveWebAuthnPath(dir),
44
+ // When false, UI may offer password re-entry as step-up fallback
45
+ password_step_up_allowed: true,
46
+ });
47
+ } catch (err) {
48
+ serverError(res, err);
49
+ }
50
+ });
51
+
52
+ router.post(
53
+ '/api/webauthn/register/options',
54
+ requireAuth,
55
+ requireScope('keys:write', 'config:write'),
56
+ async (req, res) => {
57
+ try {
58
+ const options = await beginRegistration(brainDir(), req);
59
+ res.json(options);
60
+ } catch (err) {
61
+ logger.warn('webauthn', `register options failed: ${err.message}`);
62
+ return badRequest(res, err.message);
63
+ }
64
+ },
65
+ );
66
+
67
+ router.post(
68
+ '/api/webauthn/register/verify',
69
+ requireAuth,
70
+ requireScope('keys:write', 'config:write'),
71
+ async (req, res) => {
72
+ try {
73
+ const body = req.body || {};
74
+ const response = body.response || body;
75
+ if (!response?.id) return badRequest(res, 'WebAuthn registration response required');
76
+ const result = await finishRegistration(brainDir(), req, response, {
77
+ label: body.label,
78
+ });
79
+ res.status(201).json({
80
+ ...result,
81
+ passkeys: listPasskeys(brainDir()),
82
+ });
83
+ } catch (err) {
84
+ logger.warn('webauthn', `register verify failed: ${err.message}`);
85
+ return badRequest(res, err.message);
86
+ }
87
+ },
88
+ );
89
+
90
+ router.post(
91
+ '/api/webauthn/assert/options',
92
+ requireAuth,
93
+ requireScope('keys:read', 'config:read'),
94
+ async (req, res) => {
95
+ try {
96
+ const options = await beginAuthentication(brainDir(), req);
97
+ res.json(options);
98
+ } catch (err) {
99
+ return badRequest(res, err.message);
100
+ }
101
+ },
102
+ );
103
+
104
+ router.post(
105
+ '/api/webauthn/assert/verify',
106
+ requireAuth,
107
+ requireScope('keys:read', 'config:read'),
108
+ async (req, res) => {
109
+ try {
110
+ const body = req.body || {};
111
+ const response = body.response || body;
112
+ if (!response?.id) return badRequest(res, 'WebAuthn authentication response required');
113
+ const result = await finishAuthentication(brainDir(), req, response);
114
+ const step_up_token = mintStepUpToken({
115
+ purpose: body.purpose || 'secrets:reveal',
116
+ ttlSeconds: body.ttl_seconds || 60,
117
+ actor: 'passkey',
118
+ });
119
+ logger.info('webauthn', 'Passkey step-up granted', {
120
+ credentialId: result.credentialId,
121
+ purpose: body.purpose || 'secrets:reveal',
122
+ });
123
+ res.json({
124
+ verified: true,
125
+ step_up_token,
126
+ expires_in: body.ttl_seconds || 60,
127
+ });
128
+ } catch (err) {
129
+ logger.warn('webauthn', `assert verify failed: ${err.message}`);
130
+ return badRequest(res, err.message);
131
+ }
132
+ },
133
+ );
134
+
135
+ /** Password re-entry step-up (works always; preferred when no passkeys). */
136
+ router.post(
137
+ '/api/webauthn/step-up/password',
138
+ requireAuth,
139
+ requireScope('keys:read', 'config:read'),
140
+ async (req, res) => {
141
+ try {
142
+ const password = req.body?.password;
143
+ if (!password) return badRequest(res, 'password is required');
144
+ const ok = await verifyDashboardPassword(password);
145
+ if (!ok) {
146
+ return res.status(401).json({ error: 'Invalid password' });
147
+ }
148
+ // If passkeys exist, still allow password as fallback but log it
149
+ if (hasPasskeys(brainDir())) {
150
+ logger.info('webauthn', 'Password step-up used while passkeys registered');
151
+ }
152
+ const step_up_token = mintStepUpToken({
153
+ purpose: req.body?.purpose || 'secrets:reveal',
154
+ ttlSeconds: req.body?.ttl_seconds || 60,
155
+ actor: 'password',
156
+ });
157
+ res.json({
158
+ verified: true,
159
+ method: 'password',
160
+ step_up_token,
161
+ expires_in: req.body?.ttl_seconds || 60,
162
+ });
163
+ } catch (err) {
164
+ serverError(res, err);
165
+ }
166
+ },
167
+ );
168
+
169
+ router.delete(
170
+ '/api/webauthn/credentials/:id',
171
+ requireAuth,
172
+ requireScope('keys:write', 'config:write'),
173
+ (req, res) => {
174
+ try {
175
+ const r = deletePasskey(brainDir(), req.params.id);
176
+ if (!r.found) return res.status(404).json({ error: 'Passkey not found' });
177
+ res.json({ deleted: true, passkeys: listPasskeys(brainDir()) });
178
+ } catch (err) {
179
+ serverError(res, err);
180
+ }
181
+ },
182
+ );
183
+
184
+ export { router as webauthnRouter };
@@ -0,0 +1,39 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+ import { restRouter } from './rest.mjs';
5
+
6
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
7
+ const MANIFEST_PATH = path.join(__dirname, 'route-manifest.json');
8
+
9
+ function extractRoutes(router) {
10
+ const routes = [];
11
+ function traverse(stack) {
12
+ if (!stack || !Array.isArray(stack)) return;
13
+ for (const layer of stack) {
14
+ if (layer.route) {
15
+ const pathStr = layer.route.path;
16
+ const methods = Object.keys(layer.route.methods)
17
+ .filter(m => layer.route.methods[m])
18
+ .map(m => m.toUpperCase());
19
+ for (const method of methods) {
20
+ routes.push({ method, path: pathStr });
21
+ }
22
+ } else if (layer.name === 'router' && layer.handle && layer.handle.stack) {
23
+ traverse(layer.handle.stack);
24
+ }
25
+ }
26
+ }
27
+ traverse(router.stack);
28
+ return routes;
29
+ }
30
+
31
+ const liveRoutes = extractRoutes(restRouter);
32
+ const sortFn = (a, b) => {
33
+ const cmp = a.path.localeCompare(b.path);
34
+ if (cmp !== 0) return cmp;
35
+ return a.method.localeCompare(b.method);
36
+ };
37
+ liveRoutes.sort(sortFn);
38
+ fs.writeFileSync(MANIFEST_PATH, JSON.stringify(liveRoutes, null, 2) + '\n');
39
+ console.log('Updated route-manifest.json with ' + liveRoutes.length + ' routes');
@@ -2,7 +2,7 @@
2
2
  type: task
3
3
  slug: onboarding-interview
4
4
  category: onboarding
5
- title: "Conduct user onboarding interview"
5
+ title: "Conduct portable-memory onboarding interview"
6
6
  status: pending
7
7
  priority: 1
8
8
  created: {{CREATED_AT}}
@@ -11,49 +11,59 @@ updated: {{CREATED_AT}}
11
11
 
12
12
  ## Objective
13
13
 
14
- Conduct a warm, conversational onboarding interview with the user to deeply understand who they are, what they care about, and how you can best serve them. This is the most important task in the queue.
14
+ Conduct a warm, practical onboarding interview so Total Recall can store durable preferences and facts as Markdown memory nodes. This is personal portable memory — not an operating system takeover. Keep the tone helpful and concrete.
15
15
 
16
16
  ## Instructions for the Agent
17
17
 
18
- When the user starts their next chat session, you MUST conduct this interview BEFORE doing any other work. Do NOT dump all the questions at once. Ask them one at a time, naturally, like a thoughtful conversation. Acknowledge and reflect on each answer before asking the next question.
18
+ When the user starts their next chat session (and they have no `user-profile` yet), conduct this interview BEFORE unrelated work. Do NOT dump all questions at once. Ask one at a time. Acknowledge each answer before the next.
19
19
 
20
- Once the user has answered all questions (or says they want to skip any), write their answers into the vault immediately using your file tools.
20
+ Once the user has answered (or skipped any), write their answers into the vault using tools / CLI (`remember` or direct vault writes). Prefer CLI when available:
21
21
 
22
- ## Interview Questions (ask one at a time, conversationally)
22
+ ```bash
23
+ npx total-recall remember preference "..." --tags "user,profile,onboarding" --importance 5
24
+ ```
25
+
26
+ ## Interview Questions (ask one at a time)
27
+
28
+ 1. **Who are you?** — "Quick intro: what do you do, and what are you most focused on right now?"
23
29
 
24
- 1. **Who are you?** — "To get started, can you tell me a bit about yourself? What do you do for work or what are you most focused on in life right now?"
30
+ 2. **What should I remember?** — "What kinds of things matter most for me to keep: decisions, preferences, project facts, people, or something else?"
25
31
 
26
- 2. **What are you working on?** — "What are the main projects or goals you're working toward? These could be professional, personal, creative — anything you want me to help you with."
32
+ 3. **Which tools do you use?** — "Which IDEs or agents should share this memory? (Claude Code, Cursor, Codex, Gemini, Aider, Obsidian, HTTP, etc.) I can guide you with `npx total-recall connect …`."
27
33
 
28
- 3. **What do you want to remember?** — "What kinds of things are most important for me to keep track of for you? (Ideas, research, decisions, people, tasks, reading, etc.)"
34
+ 4. **How should I talk?** — "Prefer short answers or detailed ones? Should I push back or mostly support?"
29
35
 
30
- 4. **What topics excite you?** — "What subjects, fields, or areas of knowledge do you find yourself coming back to? What should I research and follow for you automatically?"
36
+ 5. **Hard rules** — "Any absolute do's or don'ts I must always follow (style, tools, safety)?"
31
37
 
32
- 5. **How do you like to communicate?** — "Do you prefer direct, brief answers or detailed explanations? Do you want me to push back on ideas or mostly support your thinking?"
38
+ 6. **Background work** — "Want dream consolidation and optional daemon tasks running in the background, or on-demand only?"
33
39
 
34
- 6. **What frustrates you?** — "Is there anything that drives you crazy — things you keep forgetting, information that's hard to find, tasks that slip through the cracks?"
40
+ 7. **Secrets** — "API keys never go in the vault. Use `npx total-recall secret set`. Any keys you want to set up next?"
35
41
 
36
- 7. **What would success look like?** — "Six months from now, if I've done my job perfectly, what would be different for you?"
42
+ 8. **Notifications (optional)** — "Want Telegram pings when background tasks finish? If yes, BotFather token + chat ID."
37
43
 
38
- 8. **Telegram Notifications** — "Would you like me to message you on Telegram when I finish background tasks or find something interesting during my idle time? If yes, you'll need to create a bot on Telegram via BotFather and give me the Bot Token and your Chat ID."
44
+ ## Product context to reinforce (lightly, not as a lecture)
45
+
46
+ - **Write** → `remember` / session ingest
47
+ - **Sleep** → `dream` (consolidate, conflict-check, recompile)
48
+ - **Read** → `recall` + compiled surfaces in any connected IDE
49
+ - **Async** → open task queue / daemon under policy
50
+ - Hosts are equal — track any repo; no product-specific hardcoding
39
51
 
40
52
  ## After the Interview
41
53
 
42
- Write the following files using your terminal tools:
54
+ Write (or update) these files:
43
55
 
44
- **`.agent/config/notifications.yml`** — If they provided Telegram details, write them exactly like this:
56
+ **`.agent/config/notifications.yml`** — only if they provided Telegram details:
45
57
  ```yaml
46
58
  telegram_bot_token: "their-token-here"
47
59
  telegram_chat_id: "their-chat-id-here"
48
60
  ```
49
61
 
50
- **`.agent/memory-vault/preferences/user-profile.md`** — Full SSSS memory node with the user's identity, role, and communication style.
51
-
52
- **`.agent/memory-vault/preferences/user-priorities.md`** — SSSS memory node listing the user's top goals, active projects, and what they want from Total Recall.
53
-
54
- **`.agent/memory-vault/preferences/user-interests.md`** — SSSS memory node listing topics to research autonomously.
62
+ **`.agent/memory-vault/preferences/user-profile.md`** — identity + communication style
63
+ **`.agent/memory-vault/preferences/user-priorities.md`** — goals and what they want from memory
64
+ **`.agent/memory-vault/preferences/user-interests.md`** — topics worth tracking
55
65
 
56
- Use this frontmatter template for each file:
66
+ Frontmatter template:
57
67
  ```yaml
58
68
  ---
59
69
  type: memory
@@ -69,4 +79,4 @@ tags: [user, profile, onboarding]
69
79
  ---
70
80
  ```
71
81
 
72
- After writing the files, mark this task `status: done` and confirm to the user that their profile has been saved.
82
+ Then mark this task `status: done` and confirm the profile was saved. Point them at the dashboard **Onboarding** page or `init → connect → remember → dream` if they prefer CLI-only.
@@ -0,0 +1,10 @@
1
+ # OpenWiki
2
+
3
+ Portable knowledge documentation for this Total Recall brain.
4
+
5
+ | Layer | Purpose |
6
+ |-------|---------|
7
+ | **Memory vault** | SSSS nodes (rules, prefs, facts) — machine-enforceable |
8
+ | **OpenWiki** | Human/agent docs (architecture, how-tos, stack notes) |
9
+
10
+ OpenWiki ships with Total Recall. Edit freely; do not put secrets here.
@@ -0,0 +1,5 @@
1
+ # Architecture (this brain)
2
+
3
+ Describe the systems this brain cares about: repos, stacks, deploy targets.
4
+
5
+ Project brains should document the local codebase; the global brain documents cross-repo identity and preferences.
@@ -0,0 +1,10 @@
1
+ # IDE personalization
2
+
3
+ ```bash
4
+ npx total-recall connect claude-code # CLAUDE.md
5
+ npx total-recall connect codex # AGENTS.md
6
+ npx total-recall connect cursor # .cursor/rules/
7
+ npx total-recall connect gemini # GEMINI.md
8
+ ```
9
+
10
+ Total Recall only writes inside managed inject markers. Your local rules stay intact.
@@ -0,0 +1,11 @@
1
+ # Memory
2
+
3
+ Use the Total Recall CLI for durable memory:
4
+
5
+ ```bash
6
+ npx total-recall remember invariant "Never commit secrets." --importance 5
7
+ npx total-recall recall "secrets"
8
+ npx total-recall compile
9
+ ```
10
+
11
+ Categories: invariants, preferences, facts, decisions, patterns, anti-patterns, concepts, lore.
@@ -0,0 +1,7 @@
1
+ # Secrets & API keys
2
+
3
+ Store credentials in Total Recall's secrets store (`config/secrets.enc` / future CLI).
4
+
5
+ **Never** put API keys in openwiki pages or compiled IDE instruction files.
6
+
7
+ Planned CLI surface (TR_CORE_FOCUS Phase 4): `secret set|list|rotate|audit` and usage/cost meters.
@@ -0,0 +1,7 @@
1
+ # Skills
2
+
3
+ - **Total Recall skill** (only nested agent skill): `.agent/skills/total-recall/SKILL.md`
4
+ - **User skills**: `.agent/skills/<name>/SKILL.md` — project or global
5
+ - **TR modules** (not skills): `.agent/skills/total-recall/modules/` — internal docs/scripts
6
+
7
+ TR will track skill installs across repos and support adaptive deploy (see TR_CORE_FOCUS).
@@ -1,121 +0,0 @@
1
- ---
2
- name: tr-cli-agents
3
- provenance: total-recall
4
- description: "Orchestrate headlessly spawned CLI agents from the central registry."
5
- ---
6
-
7
- # CLI Agents — Headless Multi-Agent Orchestration & Dispatch Engine
8
-
9
- This system skill governs the discovery, configuration, and execution of headless **CLI Agents** within the Total Recall Sovereign OS. It replaces local models (via Ollama/Gemma) with a high-speed, parallelized dispatch engine that orchestrates elite external developer agents (`antigravity`, `gemini`, `claude`, `codex`) via synchronous subprocess execution (`spawnSync`).
10
-
11
- ---
12
-
13
- ## 🎯 SYSTEM OVERVIEW
14
-
15
- The CLI Agent Dispatch Engine parses agent profiles from the central registry file:
16
- `.agent/skills/total-recall/skills/tr-cli-agents/agents.yml`
17
-
18
- ```mermaid
19
- flowchart TD
20
- User[Chat Request / Dispatch Event] --> Engine[Dispatch Engine]
21
- Engine --> Registry[Load cli-agents/agents.yml]
22
- Registry --> Router{Select Enabled Agent}
23
-
24
- Router -->|Antigravity| AG[spawnSync: 'antigravity']
25
- Router -->|Gemini| GM[spawnSync: 'gemini']
26
- Router -->|Claude Code| CC[spawnSync: 'claude']
27
- Router -->|Codex CLI| CX[spawnSync: 'codex']
28
-
29
- AG & GM & CC & CX --> Out[Parse JSON Output]
30
- Out --> Response[Consolidated Response & Memory Ingestion]
31
- ```
32
-
33
- ### Core Execution Modality
34
- To maintain deterministic control, security compliance, and bypass complex permission prompts, agents are headlessly spawned with custom default models, auto-accept parameters, and yolo bypass flags configured per-binary.
35
-
36
- ---
37
-
38
- ## 📂 REGISTRY CONFIGURATION (`agents.yml`)
39
-
40
- The primary configuration format defines active binaries, default flags, priorities, and execution modes:
41
-
42
- ```yaml
43
- agents:
44
- - name: antigravity
45
- binary: antigravity
46
- flags: --sandbox=false --yolo -o json
47
- priority: 1
48
- enabled: true
49
- exec: flag
50
- - name: gemini
51
- binary: gemini
52
- flags: --sandbox=false --yolo -o json
53
- priority: 2
54
- enabled: true
55
- exec: flag
56
- - name: claude
57
- binary: claude
58
- flags: --output-format json --permission-mode bypassPermissions
59
- priority: 3
60
- enabled: true
61
- exec: flag
62
- - name: codex
63
- binary: codex
64
- flags: --full-auto --json
65
- priority: 4
66
- enabled: true
67
- exec: subcommand
68
- timeout: 300
69
- max_retries: 2
70
- ```
71
-
72
- ### Key Execution Modes (`exec`)
73
- * **`flag`**: Appends input strings or JSON schemas as standard execution flags directly to the command invocation.
74
- * **`subcommand`**: Passes execution commands as a nested subcommand (e.g., `codex run --payload=...`).
75
-
76
- ---
77
-
78
- ## 🛡️ SECURITY & COMPLIANCE
79
-
80
- 1. **Strict Sandbox Isolation**: When running third-party code generated during multi-agent dispatches, dispatches MUST enforce `--sandbox=true` unless explicitly overridden by `security.yml` locality rules.
81
- 2. **State Verification**: The dispatch engine captures and parses `stderr` streams separately. Any unhandled exit code > 0 automatically raises a fallback sequence to the next enabled agent in the priority queue.
82
- 3. **Authentication Handshake**: All spawned dispatches carry the active brain PAT token securely mapped via the `TR_PAT` environment variable to ensure seamless VFS memory access during execution.
83
-
84
- ---
85
-
86
- ## ⚠️ HARD-EARNED LESSONS & RECOVERY MANUAL (CRITICAL RUNTIME KNOWLEDGE)
87
-
88
- The following architectural realities represent hard-earned technical breakthroughs required to ensure 100% stable execution of the `antigravity` agent and associated background dispatch loops. **DO NOT DEVIATE from these patterns during future updates or refactoring sessions.**
89
-
90
- ### 1. macOS LaunchAgent & Background Process PATH Isolation Pathology
91
- * **The Problem**: Background execution managers (like macOS LaunchAgents, cron jobs, and daemon processes) boot with a highly restricted, shell-isolated environment. This results in an empty or deeply stripped `$PATH` variable.
92
- * **The Pathology**: Spawning standard child processes (such as `spawnSync('which antigravity')`) under these contexts fails silently or throws empty strings, making active agents completely undiscoverable even if they are globally linked or installed.
93
- * **The Immutable Resolution**:
94
- 1. **Boot PATH Expansion**: Maintain proactive PATH expansion at the absolute top of the configuration system ([src/core/config.mjs](file:///Users/greg/Github/total-recall/src/core/config.mjs)) to expand `$PATH` using verified node versions and standard locations before any other logic compiles.
95
- 2. **Pure JS Resolver (`findBinaryInPath`)**: Never spawn external process calls (like `which`) for discovery. Instead, use the native Node.js filesystem resolver (`findBinaryInPath` in [src/core/runtime.mjs](file:///Users/greg/Github/total-recall/src/core/runtime.mjs)) which checks stat entries (`fs.statSync`) and file execution modes directly against path segments.
96
-
97
- ### 2. Gemini API Active Model Realities (2026)
98
- * **The Problem**: Many standard or legacy model mappings are deprecated, causing silent failures or standard `404` errors directly from the Google API endpoints.
99
- * **The Pathology**:
100
- - `gemini-2.0-flash` is deprecated on modern API profiles and returns a `404` error for standard generation calls.
101
- - `gemini-3.1-flash-live-preview` exists in the model registry but is restricted to audio/bidi streaming (`bidiGenerateContent`) and throws error codes for standard text generation.
102
- * **The Immutable Resolution**:
103
- 1. **Frontier Default**: Always default standard text dispatches directly to **`gemini-3.5-flash`** (verified active).
104
- 2. **Alias Mapping**: Maintain the robust alias mapping inside the CLI agent wrapper to dynamically map generic aliases to verified, functional frontier models:
105
- - `gemini`, `default`, `flash`, `gemini-flash`, `3.5-flash` $\to$ **`gemini-3.5-flash`**
106
- - `pro`, `gemini-pro`, `3.1-pro` $\to$ **`gemini-3.1-pro-preview`**
107
-
108
- ### 3. Standalone CLI Ingestion & Budget Safety compliance
109
- * **The Problem**: Standalone executions of custom CLI wrappers (like `antigravity`) run outside the main Express route controllers, making their token spend completely invisible to local tracking tools.
110
- * **The Pathology**: The `total-recall` budget safety system ([src/core/usage-tracker.mjs](file:///Users/greg/Github/total-recall/src/core/usage-tracker.mjs)) scans `~/.gemini/tmp/<folder>/chats/*.jsonl` to calculate daily/weekly spending. If an agent does not log its token metadata upon execution, the budget watchdog remains blind to its consumption, leaving the user vulnerable to rate limit bans or massive billing spikes.
111
- * **The Immutable Resolution**:
112
- - The `antigravity` wrapper *must* capture `usageMetadata` (`promptTokenCount` and `candidatesTokenCount`) from successful API responses and append it directly as a standard JSONL line to:
113
- `~/.gemini/tmp/antigravity/chats/usage.jsonl`
114
- - This guarantees perfect compliance and zero-leak tracking under both manual shell executions and high-throughput background daemon runs.
115
-
116
- ### 4. System-Wide CLI Agent Ingestion & Inherent Tracking Mechanics
117
- To maintain accurate monitoring and ensure budget safeties remain 100% synchronized across all reasoning tasks, the central `usage-tracker` scans and parses execution metrics dynamically per agent:
118
- * **`claude` (Claude Code)**: Automatically writes local logs to `~/.claude/stats-cache.json`. Total Recall parses this file on demand to sum token usages and calculate current expenditure.
119
- * **`codex` (OpenAI Codex CLI)**: Appends JSONL logs recursively under `~/.codex/sessions/`. Total Recall traverses this folder structure and aggregates `prompt_tokens` and `completion_tokens` directly.
120
- * **`gemini` (Standard Gemini CLI)**: Saves chat history files ending with `.jsonl` directly to `~/.gemini/tmp/<hash>/chats/`. Total Recall reads the `tokens.input` and `tokens.output` fields for each log turn.
121
- * **`antigravity` (Native Agent Wrapper)**: Replicates standard Gemini CLI structure by appending token entries directly to `~/.gemini/tmp/antigravity/chats/usage.jsonl` on every single query turn, ensuring full compliance with the central tracking core.
@@ -1,20 +0,0 @@
1
- Antigravity CLI Agent Wrapper — Headless Zero-Dependency Cognitive Agent
2
-
3
- Usage:
4
- antigravity [options] [prompt]
5
- antigravity -p "prompt"
6
-
7
- Options:
8
- -p, --prompt The text prompt to generate content for
9
- -m, --model Gemini API model identifier or alias (default: gemini-3.5-flash)
10
- Supported aliases:
11
- - flash / gemini-flash / 3.5-flash -> gemini-3.5-flash (Frontier default)
12
- - pro / gemini-pro / 3.1-pro -> gemini-3.1-pro-preview (Frontier Pro)
13
- -o, --json Output dynamic JSON response payload (choices: stream/json/default)
14
- --json Output dynamic JSON response payload
15
- -h, --help Show this help information
16
-
17
- Examples:
18
- antigravity "Say hello"
19
- antigravity -p "Write an essay about AI" -m pro
20
- antigravity -p "Get system stats" --json
@@ -1,58 +0,0 @@
1
- Usage: claude [options] [command] [prompt]
2
-
3
- Claude Code - starts an interactive session by default, use -p/--print for
4
- non-interactive output
5
-
6
- Arguments:
7
- prompt Your prompt
8
-
9
- Options:
10
- --add-dir <directories...> Additional directories to allow tool access to
11
- --agent <agent> Agent for the current session. Overrides the 'agent' setting.
12
- --agents <json> JSON object defining custom agents (e.g. '{"reviewer": {"description": "Reviews code", "prompt": "You are a code reviewer"}}')
13
- --allow-dangerously-skip-permissions Enable bypassing all permission checks as an option, without it being enabled by default. Recommended only for sandboxes with no internet access.
14
- --allowedTools, --allowed-tools <tools...> Comma or space-separated list of tool names to allow (e.g. "Bash(git:*) Edit")
15
- --append-system-prompt <prompt> Append a system prompt to the default system prompt
16
- --betas <betas...> Beta headers to include in API requests (API key users only)
17
- --chrome Enable Claude in Chrome integration
18
- -c, --continue Continue the most recent conversation in the current directory
19
- --dangerously-skip-permissions Bypass all permission checks. Recommended only for sandboxes with no internet access.
20
- -d, --debug [filter] Enable debug mode with optional category filtering (e.g., "api,hooks" or "!statsig,!file")
21
- --disable-slash-commands Disable all skills
22
- --disallowedTools, --disallowed-tools <tools...> Comma or space-separated list of tool names to deny (e.g. "Bash(git:*) Edit")
23
- --fallback-model <model> Enable automatic fallback to specified model when default model is overloaded (only works with --print)
24
- --file <specs...> File resources to download at startup. Format: file_id:relative_path (e.g., --file file_abc:doc.txt file_def:img.png)
25
- --fork-session When resuming, create a new session ID instead of reusing the original (use with --resume or --continue)
26
- -h, --help Display help for command
27
- --ide Automatically connect to IDE on startup if exactly one valid IDE is available
28
- --include-partial-messages Include partial message chunks as they arrive (only works with --print and --output-format=stream-json)
29
- --input-format <format> Input format (only works with --print): "text" (default), or "stream-json" (realtime streaming input) (choices: "text", "stream-json")
30
- --json-schema <schema> JSON Schema for structured output validation. Example: {"type":"object","properties":{"name":{"type":"string"}},"required":["name"]}
31
- --max-budget-usd <amount> Maximum dollar amount to spend on API calls (only works with --print)
32
- --mcp-config <configs...> Load MCP servers from JSON files or strings (space-separated)
33
- --mcp-debug [DEPRECATED. Use --debug instead] Enable MCP debug mode (shows MCP server errors)
34
- --model <model> Model for the current session. Provide an alias for the latest model (e.g. 'sonnet' or 'opus') or a model's full name (e.g. 'claude-sonnet-4-5-20250929').
35
- --no-chrome Disable Claude in Chrome integration
36
- --no-session-persistence Disable session persistence - sessions will not be saved to disk and cannot be resumed (only works with --print)
37
- --output-format <format> Output format (only works with --print): "text" (default), "json" (single result), or "stream-json" (realtime streaming) (choices: "text", "json", "stream-json")
38
- --permission-mode <mode> Permission mode to use for the session (choices: "acceptEdits", "bypassPermissions", "default", "delegate", "dontAsk", "plan")
39
- --plugin-dir <paths...> Load plugins from directories for this session only (repeatable)
40
- -p, --print Print response and exit (useful for pipes). Note: The workspace trust dialog is skipped when Claude is run with the -p mode. Only use this flag in directories you trust.
41
- --replay-user-messages Re-emit user messages from stdin back on stdout for acknowledgment (only works with --input-format=stream-json and --output-format=stream-json)
42
- -r, --resume [value] Resume a conversation by session ID, or open interactive picker with optional search term
43
- --session-id <uuid> Use a specific session ID for the conversation (must be a valid UUID)
44
- --setting-sources <sources> Comma-separated list of setting sources to load (user, project, local).
45
- --settings <file-or-json> Path to a settings JSON file or a JSON string to load additional settings from
46
- --strict-mcp-config Only use MCP servers from --mcp-config, ignoring all other MCP configurations
47
- --system-prompt <prompt> System prompt to use for the session
48
- --tools <tools...> Specify the list of available tools from the built-in set. Use "" to disable all tools, "default" to use all tools, or specify tool names (e.g. "Bash,Edit,Read").
49
- --verbose Override verbose mode setting from config
50
- -v, --version Output the version number
51
-
52
- Commands:
53
- doctor Check the health of your Claude Code auto-updater
54
- install [options] [target] Install Claude Code native build. Use [target] to specify version (stable, latest, or specific version)
55
- mcp Configure and manage MCP servers
56
- plugin Manage Claude Code plugins
57
- setup-token Set up a long-lived authentication token (requires Claude subscription)
58
- update Check for updates and install if available