total-recall-brain 3.1.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.
- package/LICENSE +21 -0
- package/README.md +173 -0
- package/bin/antigravity.mjs +212 -0
- package/bin/init.mjs +36 -0
- package/bin/oci-sniper.sh +69 -0
- package/bin/total-recall.mjs +229 -0
- package/docs/ARCHITECTURE.md +251 -0
- package/docs/IDE_INTEGRATION.md +112 -0
- package/package.json +71 -0
- package/scaffold/.agent/skills/total-recall/SKILL.md +195 -0
- package/scaffold/.agent/skills/total-recall/evals/evals.json +20 -0
- package/scaffold/.agent/skills/total-recall/memory-vault/concepts/cli-help-reference.md +145 -0
- package/scaffold/.agent/skills/total-recall/memory-vault/invariants/operating-instructions.md +75 -0
- package/scaffold/.agent/skills/total-recall/memory-vault/preferences/always-websearch-gap.md +16 -0
- package/scaffold/.agent/skills/total-recall/memory-vault/preferences/topic-research-sop.md +17 -0
- package/scaffold/.agent/skills/total-recall/references/api-reference.md +187 -0
- package/scaffold/.agent/skills/total-recall/references/architecture-reference.md +81 -0
- package/scaffold/.agent/skills/total-recall/references/cli-reference.md +103 -0
- package/scaffold/.agent/skills/total-recall/references/ssss-reference.md +88 -0
- package/scaffold/.agent/skills/total-recall/references/troubleshooting.md +68 -0
- package/scaffold/.agent/skills/total-recall/scripts/sync-repo.mjs +83 -0
- package/scaffold/.agent/skills/total-recall/skills/cli-agents/SKILL.md +122 -0
- package/scaffold/.agent/skills/total-recall/skills/cli-agents/agents.yml +27 -0
- package/scaffold/.agent/skills/total-recall/skills/cli-agents/references/antigravity.txt +20 -0
- package/scaffold/.agent/skills/total-recall/skills/cli-agents/references/claude.txt +58 -0
- package/scaffold/.agent/skills/total-recall/skills/cli-agents/references/codex.txt +81 -0
- package/scaffold/.agent/skills/total-recall/skills/cli-agents/references/gemini.txt +44 -0
- package/scaffold/.agent/skills/total-recall/skills/research/SKILL.md +337 -0
- package/scaffold/.agent/skills/total-recall/skills/skill/SKILL.md +281 -0
- package/scaffold/.agent/skills/total-recall/skills/skill/assets/skill-template/SKILL.md +20 -0
- package/scaffold/.agent/skills/total-recall/skills/skill/evals/evals.json +20 -0
- package/scaffold/.agent/skills/total-recall/skills/skill/hooks/on-skill-add.sh +14 -0
- package/scaffold/.agent/skills/total-recall/skills/skill/hooks/on-skill-delete.sh +14 -0
- package/scaffold/.agent/skills/total-recall/skills/skill/learnings/.gitkeep +0 -0
- package/scaffold/.agent/skills/total-recall/skills/skill/references/.gitkeep +0 -0
- package/scaffold/.agent/skills/total-recall/skills/skill/scripts/.gitkeep +0 -0
- package/scaffold/.agent/skills/total-recall/skills/skill/scripts/create-skill.sh +65 -0
- package/scaffold/.agent/skills/total-recall/skills/skill/scripts/enforce-skill-optimization.mjs +135 -0
- package/scaffold/.agent/skills/total-recall/skills/skill/scripts/find-skills.mjs +124 -0
- package/scaffold/.agent/skills/total-recall/skills/skill/scripts/scan-skill.mjs +207 -0
- package/scaffold/.agent/skills/total-recall/skills/skill/scripts/skill-watcher.mjs +64 -0
- package/scaffold/.agent/skills/total-recall/skills/skill/subagents/audit-all-skills.md +62 -0
- package/scaffold/.agent/skills/total-recall/skills/ssss/SKILL.md +27 -0
- package/scaffold/.agent/skills/total-recall/skills/ssss/evals/evals.json +17 -0
- package/scaffold/.agent/skills/total-recall/skills/ssss/references/ssss-spec.md +117 -0
- package/scaffold/.agent/skills/total-recall/skills/ssss/scripts/validate-schema.mjs +54 -0
- package/scaffold/.agent/skills/total-recall/skills/ssss/subagents/audit-ssss-node.md +9 -0
- package/scaffold/.agent/skills/total-recall/subagents/total-recall-diagnostician.md +13 -0
- package/src/cli/agent-dir.mjs +105 -0
- package/src/cli/backup.mjs +313 -0
- package/src/cli/brain.mjs +224 -0
- package/src/cli/chat.mjs +74 -0
- package/src/cli/config.mjs +247 -0
- package/src/cli/connect.mjs +872 -0
- package/src/cli/daemon.mjs +228 -0
- package/src/cli/deploy-ui.mjs +1793 -0
- package/src/cli/deploy.mjs +1726 -0
- package/src/cli/doctor.mjs +254 -0
- package/src/cli/dream.mjs +80 -0
- package/src/cli/forget.mjs +92 -0
- package/src/cli/friction.mjs +21 -0
- package/src/cli/generate-pat.mjs +65 -0
- package/src/cli/hash-password.mjs +22 -0
- package/src/cli/help.mjs +153 -0
- package/src/cli/import-rules.mjs +102 -0
- package/src/cli/ingest/index.mjs +318 -0
- package/src/cli/ingest/parsers/chrome-bookmarks.mjs +238 -0
- package/src/cli/ingest/parsers/google-keep.mjs +147 -0
- package/src/cli/ingest/parsers/search-history.mjs +142 -0
- package/src/cli/ingest/parsers/youtube-history.mjs +181 -0
- package/src/cli/ingest/utils/dedup.mjs +69 -0
- package/src/cli/ingest/utils/takeout-walker.mjs +101 -0
- package/src/cli/ingest.mjs +102 -0
- package/src/cli/init.mjs +736 -0
- package/src/cli/integration-dispatcher.mjs +128 -0
- package/src/cli/lint.mjs +166 -0
- package/src/cli/map.mjs +194 -0
- package/src/cli/migrate.mjs +87 -0
- package/src/cli/rebuild.mjs +88 -0
- package/src/cli/recall.mjs +219 -0
- package/src/cli/relay.mjs +518 -0
- package/src/cli/remember.mjs +306 -0
- package/src/cli/research.mjs +381 -0
- package/src/cli/reset-password.mjs +75 -0
- package/src/cli/restore.mjs +135 -0
- package/src/cli/setup.mjs +616 -0
- package/src/cli/share.mjs +180 -0
- package/src/cli/skill.mjs +313 -0
- package/src/cli/snapshot.mjs +108 -0
- package/src/cli/start.mjs +63 -0
- package/src/cli/status.mjs +296 -0
- package/src/cli/sync.mjs +383 -0
- package/src/cli/uninstall.mjs +613 -0
- package/src/cli/upgrade.mjs +141 -0
- package/src/cli/wizard.html +3682 -0
- package/src/core/blackboard.mjs +54 -0
- package/src/core/clarity-rewriter.mjs +770 -0
- package/src/core/conclusion-writer.mjs +259 -0
- package/src/core/config.mjs +277 -0
- package/src/core/conflict-detector.mjs +536 -0
- package/src/core/crypto.mjs +107 -0
- package/src/core/daemon-control.mjs +158 -0
- package/src/core/daemon-loop.mjs +364 -0
- package/src/core/dream.mjs +347 -0
- package/src/core/drift-detector.mjs +143 -0
- package/src/core/embeddings.mjs +632 -0
- package/src/core/emergency-alerts.mjs +137 -0
- package/src/core/evolution.mjs +107 -0
- package/src/core/fact-seeker.mjs +1602 -0
- package/src/core/friction.mjs +95 -0
- package/src/core/import-rules.mjs +308 -0
- package/src/core/inference-engine.mjs +367 -0
- package/src/core/logger.mjs +75 -0
- package/src/core/memory-layers.mjs +96 -0
- package/src/core/migrate.mjs +116 -0
- package/src/core/notifications.mjs +77 -0
- package/src/core/operation-validator.mjs +272 -0
- package/src/core/optimizer.mjs +330 -0
- package/src/core/pattern_detector.mjs +113 -0
- package/src/core/post-mortem.mjs +413 -0
- package/src/core/protect-instructions.mjs +148 -0
- package/src/core/quick-capture.mjs +145 -0
- package/src/core/research-queue.mjs +431 -0
- package/src/core/research.mjs +461 -0
- package/src/core/runtime.mjs +515 -0
- package/src/core/sandbox.mjs +163 -0
- package/src/core/scheduler.mjs +569 -0
- package/src/core/schema.mjs +333 -0
- package/src/core/search.mjs +219 -0
- package/src/core/semantic-index.mjs +276 -0
- package/src/core/session-watcher.mjs +850 -0
- package/src/core/snapshot.mjs +133 -0
- package/src/core/source-adapters.mjs +1038 -0
- package/src/core/steering.mjs +137 -0
- package/src/core/surface.mjs +444 -0
- package/src/core/task_runner.mjs +125 -0
- package/src/core/tts.mjs +142 -0
- package/src/core/usage-tracker.mjs +349 -0
- package/src/core/vault-cache.mjs +76 -0
- package/src/core/vault.mjs +273 -0
- package/src/core/watchdog.mjs +236 -0
- package/src/server/api.mjs +944 -0
- package/src/server/auth.mjs +410 -0
- package/src/server/index.mjs +868 -0
- package/src/server/keys.mjs +181 -0
- package/src/server/rest.mjs +1652 -0
- package/src/server/route-manifest.json +77 -0
- package/src/server/routes/_shared.mjs +93 -0
- package/src/server/routes/keys.mjs +55 -0
- package/src/server/routes/memory.mjs +249 -0
- package/src/server/routes/sessions.mjs +336 -0
- package/src/server/routes/share.mjs +138 -0
- package/src/server/tools.mjs +618 -0
- package/templates/Caddyfile +37 -0
- package/templates/com.totalrecall.backup.plist +42 -0
- package/templates/com.totalrecall.daemon.plist +40 -0
- package/templates/com.totalrecall.duckdns.plist +23 -0
- package/templates/com.totalrecall.server.plist +46 -0
- package/templates/default-config/budget.yml +6 -0
- package/templates/default-config/runtime.yml +11 -0
- package/templates/default-config/security.yml +53 -0
- package/templates/default-config/voice.yml +34 -0
- package/templates/obsidian-queries/conflicts.md +26 -0
- package/templates/obsidian-queries/daily.md +17 -0
- package/templates/obsidian-queries/index.md +38 -0
- package/templates/obsidian-queries/skills.md +14 -0
- package/templates/onboarding-interview.md +72 -0
- package/templates/skill_engineering.md +40 -0
- package/templates/total-recall-daemon.service +21 -0
- package/templates/total-recall-server.service +20 -0
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* total-recall CLI
|
|
5
|
+
*
|
|
6
|
+
* Entry point for `npx total-recall <command>`.
|
|
7
|
+
* Routes subcommands to handlers in src/cli/.
|
|
8
|
+
*
|
|
9
|
+
* Usage:
|
|
10
|
+
* npx total-recall init Bootstrap Total Recall into an existing project
|
|
11
|
+
* npx total-recall setup Interactive setup wizard (provider โ deploy โ connect IDEs)
|
|
12
|
+
* npx total-recall deploy Provision a target machine
|
|
13
|
+
* npx total-recall import Import existing rule files into the vault
|
|
14
|
+
* npx total-recall compile Rebuild indexes + INSTRUCTIONS.md (alias: rebuild)
|
|
15
|
+
* npx total-recall dream Trigger a dream cycle
|
|
16
|
+
* npx total-recall ingest Ingest IDE conversation logs or Google Takeout data
|
|
17
|
+
* npx total-recall connect Configure an IDE or external system
|
|
18
|
+
* npx total-recall sync Pull remote brain instructions into workspace
|
|
19
|
+
* npx total-recall lint Validate vault nodes against schema v2
|
|
20
|
+
* npx total-recall daemon <cmd> start | stop | status
|
|
21
|
+
* npx total-recall status Show brain connection and sync state
|
|
22
|
+
* npx total-recall generate-pat Issue a hashed Personal Access Token
|
|
23
|
+
* npx total-recall hash-password Generate a dashboard password hash
|
|
24
|
+
* npx total-recall backup Create encrypted VFS tarball
|
|
25
|
+
* npx total-recall restore <path> Restore from backup
|
|
26
|
+
* npx total-recall snapshot Manage point-in-time VFS snapshots
|
|
27
|
+
* npx total-recall migrate Run SSSS schema migrations
|
|
28
|
+
* npx total-recall chat Interactive terminal chat
|
|
29
|
+
* npx total-recall friction Analyze logs for workflow bottlenecks
|
|
30
|
+
* npx total-recall upgrade Swap kernel model
|
|
31
|
+
* npx total-recall research <cmd> Manage/query ongoing autonomous research agenda
|
|
32
|
+
* npx total-recall share [url] Share a URL or text snippet to the brain
|
|
33
|
+
* npx total-recall --help Show this help
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
import { fileURLToPath } from 'node:url';
|
|
37
|
+
import path from 'node:path';
|
|
38
|
+
|
|
39
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
40
|
+
const CLI_DIR = path.join(__dirname, '..', 'src', 'cli');
|
|
41
|
+
|
|
42
|
+
const COMMANDS = {
|
|
43
|
+
init: 'init.mjs',
|
|
44
|
+
setup: 'setup.mjs',
|
|
45
|
+
start: 'start.mjs',
|
|
46
|
+
deploy: 'deploy.mjs',
|
|
47
|
+
doctor: 'doctor.mjs',
|
|
48
|
+
backup: 'backup.mjs',
|
|
49
|
+
dream: 'dream.mjs',
|
|
50
|
+
lint: 'lint.mjs',
|
|
51
|
+
daemon: 'daemon.mjs',
|
|
52
|
+
restore: 'restore.mjs',
|
|
53
|
+
upgrade: 'upgrade.mjs',
|
|
54
|
+
friction: 'friction.mjs',
|
|
55
|
+
chat: 'chat.mjs',
|
|
56
|
+
status: 'status.mjs',
|
|
57
|
+
remember: 'remember.mjs',
|
|
58
|
+
forget: 'forget.mjs',
|
|
59
|
+
recall: 'recall.mjs',
|
|
60
|
+
search: 'recall.mjs',
|
|
61
|
+
research: 'research.mjs',
|
|
62
|
+
share: 'share.mjs',
|
|
63
|
+
'generate-pat': 'generate-pat.mjs',
|
|
64
|
+
'hash-password': 'hash-password.mjs',
|
|
65
|
+
'reset-password': 'reset-password.mjs',
|
|
66
|
+
compile: 'rebuild.mjs',
|
|
67
|
+
rebuild: 'rebuild.mjs',
|
|
68
|
+
snapshot: 'snapshot.mjs',
|
|
69
|
+
migrate: 'migrate.mjs',
|
|
70
|
+
ingest: 'ingest.mjs',
|
|
71
|
+
import: 'import-rules.mjs',
|
|
72
|
+
connect: 'connect.mjs',
|
|
73
|
+
sync: 'sync.mjs',
|
|
74
|
+
relay: 'relay.mjs',
|
|
75
|
+
uninstall: 'uninstall.mjs',
|
|
76
|
+
map: 'map.mjs',
|
|
77
|
+
brain: 'brain.mjs',
|
|
78
|
+
config: 'config.mjs',
|
|
79
|
+
skill: 'skill.mjs',
|
|
80
|
+
help: 'help.mjs',
|
|
81
|
+
};
|
|
82
|
+
function printHelp() {
|
|
83
|
+
console.log(`
|
|
84
|
+
total-recall โ Sovereign AI System CLI
|
|
85
|
+
|
|
86
|
+
Usage: total-recall <command> [options]
|
|
87
|
+
|
|
88
|
+
Commands:
|
|
89
|
+
init Bootstrap Total Recall into an existing project repo
|
|
90
|
+
setup Interactive wizard: provider โ API key โ provision โ connect IDEs
|
|
91
|
+
start [--port N] Start the brain server in the foreground (alias for running the server directly)
|
|
92
|
+
deploy Provision a target machine (Caddy/TLS, system services, VFS setup, environment checks)
|
|
93
|
+
doctor Run environment diagnostics and verify dependency health
|
|
94
|
+
dream Manually trigger a dream cycle (Light โ REM โ Deep)
|
|
95
|
+
lint Validate all vault nodes against SSSS schema v2
|
|
96
|
+
daemon <start|stop|status> Manage the background daemon
|
|
97
|
+
status Show server health, active deploy mode, dashboard URL, tunnel PID, and daemon state
|
|
98
|
+
backup [options] Create encrypted VFS tarball, push git backup, or Obsidian sync
|
|
99
|
+
restore <path> Restore from an encrypted backup
|
|
100
|
+
upgrade --model <n> Swap the kernel model (e.g., gemma5-32b)
|
|
101
|
+
friction Analyze logs to detect workflow bottlenecks
|
|
102
|
+
chat Interactive terminal chat with the Sovereign OS
|
|
103
|
+
remember Remember new rules, preferences, or corrections in real time
|
|
104
|
+
forget <slug> Delete a memory node by slug (with auto-recompile)
|
|
105
|
+
recall Recall semantic memory or search existing knowledge/rules/session-history
|
|
106
|
+
map Visualize memory vault category trees and link relationships
|
|
107
|
+
brain <cmd> Manage registered brains and context resolution (list, status, register, unregister)
|
|
108
|
+
research <command> Manage/query ongoing autonomous research agenda (list, add, show, report, cancel)
|
|
109
|
+
share [url] Share a URL or text snippet to the brain (auto-routes to remember or research)
|
|
110
|
+
config <get|set> Read, write, and toggle UI, security, and budget settings
|
|
111
|
+
skill <command> Manage AI agent skills: find, install, scan, list, remove
|
|
112
|
+
generate-pat Issue a PAT; stores only a hash in keys.jsonl
|
|
113
|
+
hash-password Generate a bcrypt dashboard password hash
|
|
114
|
+
reset-password Reset the dashboard admin password and force a change on login
|
|
115
|
+
compile Alias for rebuild: deterministically rebuild projections
|
|
116
|
+
rebuild [--check] Detect index drift and deterministically rebuild projections
|
|
117
|
+
snapshot Manage fast point-in-time VFS snapshots and rollbacks
|
|
118
|
+
migrate Run backwards-incompatible SSSS schema migrations
|
|
119
|
+
import [--dir <path>] [--force] Import existing AGENTS.md, .cursorrules, CLAUDE.md, etc.
|
|
120
|
+
into the vault (run before compile on first install)
|
|
121
|
+
ingest [--watch] Ingest IDE conversation logs (Claude Code, Codex, Gemini, etc.)
|
|
122
|
+
ingest google-takeout <path> Ingest Google Takeout export data
|
|
123
|
+
connect <client> Configure Cursor, Claude Code, Codex, UltraChat, Gemini, etc.
|
|
124
|
+
sync [--watch] Pull remote brain instructions into the current workspace
|
|
125
|
+
relay <cmd> Local background relay: ship IDE sessions to remote brain
|
|
126
|
+
Commands: start | stop | status | once | install | uninstall
|
|
127
|
+
uninstall Completely uninstall all services, launchd agents, VFS, and shims
|
|
128
|
+
help <topic> Interactive offline documentation, SSSS reference, and system help
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
Autonomous operations (sync, compile, backup) are now handled by the
|
|
133
|
+
Cloud Agent via SSSS task nodes in .agent/scheduler/queue/.
|
|
134
|
+
The agent cron trigger (every 5 min) processes these automatically.
|
|
135
|
+
|
|
136
|
+
Options:
|
|
137
|
+
--help, -h Show this help message
|
|
138
|
+
--version, -v Show version
|
|
139
|
+
|
|
140
|
+
Examples:
|
|
141
|
+
npx total-recall deploy
|
|
142
|
+
npx total-recall dream
|
|
143
|
+
npx total-recall daemon status
|
|
144
|
+
`);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
async function main() {
|
|
148
|
+
const args = process.argv.slice(2);
|
|
149
|
+
const command = args[0];
|
|
150
|
+
|
|
151
|
+
if (!command || command === '--help' || command === '-h') {
|
|
152
|
+
printHelp();
|
|
153
|
+
process.exit(0);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
if (command === '--version' || command === '-v') {
|
|
157
|
+
const pkg = await import(path.join(__dirname, '..', 'package.json'), { with: { type: 'json' } });
|
|
158
|
+
console.log(`total-recall v${pkg.default.version}`);
|
|
159
|
+
process.exit(0);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
const handlerFile = COMMANDS[command];
|
|
163
|
+
if (!handlerFile) {
|
|
164
|
+
// Check if it is a dynamic integration command configured in the VFS
|
|
165
|
+
try {
|
|
166
|
+
const { agentDir } = await import('../src/core/config.mjs');
|
|
167
|
+
const fs = await import('node:fs');
|
|
168
|
+
const integrationPath = path.join(agentDir, 'skills', 'total-recall', 'integrations', `${command}.md`);
|
|
169
|
+
|
|
170
|
+
if (fs.existsSync(integrationPath)) {
|
|
171
|
+
const action = args[1];
|
|
172
|
+
if (!action) {
|
|
173
|
+
console.error(`Error: Missing action name for service "${command}".`);
|
|
174
|
+
console.error(`Usage: npx total-recall ${command} <action> [options]`);
|
|
175
|
+
process.exit(1);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// Parse CLI options (e.g. --owner value)
|
|
179
|
+
const options = {};
|
|
180
|
+
for (let i = 2; i < args.length; i++) {
|
|
181
|
+
const arg = args[i];
|
|
182
|
+
if (arg.startsWith('--')) {
|
|
183
|
+
const key = arg.slice(2);
|
|
184
|
+
const val = args[i + 1];
|
|
185
|
+
if (val && !val.startsWith('--')) {
|
|
186
|
+
options[key] = val;
|
|
187
|
+
i++;
|
|
188
|
+
} else {
|
|
189
|
+
options[key] = true;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
const { default: dispatch } = await import('../src/cli/integration-dispatcher.mjs');
|
|
195
|
+
const result = await dispatch(command, action, options);
|
|
196
|
+
console.log(typeof result === 'object' ? JSON.stringify(result, null, 2) : result);
|
|
197
|
+
process.exit(0);
|
|
198
|
+
}
|
|
199
|
+
} catch (err) {
|
|
200
|
+
console.error(`Error executing integration command: ${err.message}`);
|
|
201
|
+
process.exit(1);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
console.error(`Unknown command: ${command}`);
|
|
205
|
+
console.error(`Run 'total-recall --help' for usage.`);
|
|
206
|
+
process.exit(1);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
const handlerPath = path.join(CLI_DIR, handlerFile);
|
|
210
|
+
|
|
211
|
+
try {
|
|
212
|
+
const handler = await import(handlerPath);
|
|
213
|
+
if (handler.run) {
|
|
214
|
+
await handler.run(process.argv);
|
|
215
|
+
} else {
|
|
216
|
+
await handler.default(process.argv.slice(3));
|
|
217
|
+
}
|
|
218
|
+
} catch (err) {
|
|
219
|
+
if (err.code === 'ERR_MODULE_NOT_FOUND') {
|
|
220
|
+
console.error(`Command '${command}' is not yet implemented.`);
|
|
221
|
+
console.error(`Expected handler at: ${handlerPath}`);
|
|
222
|
+
process.exit(1);
|
|
223
|
+
}
|
|
224
|
+
console.error(`Error executing '${command}':`, err.message);
|
|
225
|
+
process.exit(1);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
main();
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
# Total Recall โ System Architecture
|
|
2
|
+
|
|
3
|
+
> Verified against codebase: `relay.mjs`, `session-watcher.mjs`, `daemon-loop.mjs`, `surface.mjs`, `scheduler.mjs`, `embeddings.mjs`, `dispatch.mjs`, `vault-cache.mjs`, `config.mjs`, `sandbox.mjs`.
|
|
4
|
+
> Last Updated: May 25, 2026
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## โก The One-Sentence Summary
|
|
9
|
+
|
|
10
|
+
Total Recall is a **database-free, local background session relay + remote intelligence brain** system: a lightweight relay daemon watches local IDE conversation files and ships updates to your remote brain server, which employs high-fidelity vector semantic search (Google `gemini-embedding-2` with OpenAI fallback), structured cost-limiting controls, and a headless CLI agent execution framework to ingest history, resolve rules, and recompile a **5-line progressive disclosure pointer shim** that all IDEs inherit automatically.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## ๐๏ธ Two-Component Topology
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
YOUR WORKSTATION YOUR BRAIN SERVER
|
|
18
|
+
(any machine you write code on) (Mac Mini, Vast.ai VPS, local host, etc.)
|
|
19
|
+
|
|
20
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
21
|
+
โ IDE Session Logs โ โ Total Recall REST Server โ
|
|
22
|
+
โ โ โ โ
|
|
23
|
+
โ ~/.claude/projects/ โ relay โ POST /api/sessions/ingest โ
|
|
24
|
+
โ ~/.cursor/projects/ โ โโโโโโโโโโโโโโบ โ โ
|
|
25
|
+
โ ~/.codex/sessions/ โ (every 60s, โ Headless CLI Agent Dispatch โ
|
|
26
|
+
โ ~/.gemini/antigravity/ โ new files โ (spawns subagents from registry โ
|
|
27
|
+
โ ~/Library/.../chatSessions/โ only) โ to run dream & research tasks) โ
|
|
28
|
+
โ โ โ โ
|
|
29
|
+
โ npx total-recall relay โ โโโโโโโโโโโโโโ โ Google gemini-embedding-2 โ
|
|
30
|
+
โ (launchd/systemd service) โ INSTRUCTIONS. โ (and OpenAI fallback) handles โ
|
|
31
|
+
โ โ md pulled โ semantic search & indexing โ
|
|
32
|
+
โ CLAUDE.md โ (connect) โ โ
|
|
33
|
+
โ MEMORY.md (5-line shim) โ โ VFS (.agent/skills/total-recall/)โ
|
|
34
|
+
โ .cursor/rules/ โ โ โโโ INSTRUCTIONS.md (shim) โ
|
|
35
|
+
โ GEMINI.md โ โ โโโ memory-vault/ โ
|
|
36
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Component 1: The Session Relay (Workstation client)
|
|
40
|
+
|
|
41
|
+
**File:** `src/cli/relay.mjs`
|
|
42
|
+
|
|
43
|
+
The session relay is a silent Node.js daemon that:
|
|
44
|
+
1. Watches active IDE log folders for changes to active conversation files.
|
|
45
|
+
2. Ingests modified lines and pushes them to the brain's REST API (`POST /api/sessions/ingest`).
|
|
46
|
+
3. Employs filesystem `mtime` modification timestamps to prevent redundant network transmissions.
|
|
47
|
+
4. Standardized as macOS launchd plists or Linux systemd user services that run on startup.
|
|
48
|
+
|
|
49
|
+
**Watched Locations:**
|
|
50
|
+
|
|
51
|
+
| Client / Editor | Directory Path | Log Format |
|
|
52
|
+
| :--- | :--- | :--- |
|
|
53
|
+
| **Claude Code** | `~/.claude/projects/` | Line-delimited JSONL |
|
|
54
|
+
| **Codex CLI** | `~/.codex/sessions/` | JSON log sequences |
|
|
55
|
+
| **Cursor** | `~/.cursor/projects/` | SQLite/JSON logs |
|
|
56
|
+
| **VS Code Copilot** | `~/Library/Application Support/Code/User/workspaceStorage/*/chatSessions/` | JSON delta sequences |
|
|
57
|
+
| **Antigravity** | `~/.gemini/antigravity/brain/` | JSONL history logs |
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
### Component 2: The Sovereign Brain Server
|
|
62
|
+
|
|
63
|
+
The brain server runs the primary REST API, compiles instructions, runs the background daemons, and maintains the Virtual File System (VFS).
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
### Component 3: The Setup Web Wizard (Graphical Browser Installer)
|
|
68
|
+
|
|
69
|
+
**Files:** `src/cli/deploy-ui.mjs`, `src/cli/wizard.html`
|
|
70
|
+
|
|
71
|
+
The Setup Web Wizard is served by a local Express instance during installation/deployment (`npx total-recall deploy --ui` or `setup`) and provides a premium, graphical onboarding dashboard that opens automatically in your default macOS/Linux web browser:
|
|
72
|
+
1. **Interactive Provisioning Phases**: Steps through deployment targets (Local, network SSH computer, renting a GPU in the cloud via Vast.ai credentials, or your own VPS), SSL auto-TLS configurations, and dashboard admin password hashing.
|
|
73
|
+
2. **One-Click Automated Installer**: Spawns an internal Server-Sent Events (SSE) progress pipeline, emitting live terminal compilation, model download, and installation logs directly to the browser screen.
|
|
74
|
+
3. **Omni-Channel Integration Selector**: A multi-select visual panel to wire up Claude Code, Codex, Cursor, VS Code Copilot, Gemini CLI, Aider, and Obsidian, plus installing launchd/systemd background relays.
|
|
75
|
+
4. **Credential Restoration**: Integrates with local persistent fallbacks, automatically identifying and restoring AES-encrypted tokens and bcrypt password hashes from `~/.agent/secrets.enc` or `.agent/secrets.enc` to avoid credential resets on fresh setups.
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
#### 1. โก High-Speed Semantic Vector Indexing
|
|
80
|
+
- **Primary Model**: Google `gemini-embedding-2` (768 dimensions), with fallback vectors configured in the active API models registry (e.g., OpenAI `text-embedding-3-small`).
|
|
81
|
+
- **File-Native Indexes**: Vector indexes are written directly to plain JSONL (`embeddings.jsonl`) under the meta-skill's `memory-derived/` directory, backed by a high-speed cosine memory cache (`embeddings-cache.json`) for <50ms lookup times.
|
|
82
|
+
- **Auto-Healing Dimension Mismatch Purging**: If you switch embedding models (e.g. from a 384-dim Ollama model to the 768-dim Google API), the engine detects the dimension length mismatch, automatically clears out the obsolete cache files, and indexes the entire vault cleanly from scratch.
|
|
83
|
+
|
|
84
|
+
#### 2. ๐ค Headless CLI Agent Dispatch Framework
|
|
85
|
+
Total Recall completely eliminates heavy local GPU hardware overhead (Ollama and local VM models are fully deprecated). Instead, cognitive tasks (post-mortems, web research crawls, and dream cycle updates) are routed to specialized, headlessly spawned CLI agents running via non-interactive subshells (`spawnSync`):
|
|
86
|
+
|
|
87
|
+
- **Antigravity CLI** (`antigravity`): Ingests massive token context bounds for broad log post-mortems and repository-wide gap discovery.
|
|
88
|
+
- **Claude Code** (`claude`): Resolves complex logical rules, verifies integration tests, and performs precise SSSS ontology checking.
|
|
89
|
+
- **Codex CLI** (`codex`): Executes sandboxed test suites and automated file writes.
|
|
90
|
+
|
|
91
|
+
All dispatches are configured via the prioritized execution registry in `~/.agent/skills/total-recall/skills/cli-agents/agents.yml` and utilize the **Dynamic Model Selector (`resolveGenerativeModel`)** to dynamically translate general aliases (`flash`, `pro`, `default`) into the active, optimal model endpoints.
|
|
92
|
+
|
|
93
|
+
#### 3. ๐ Progressive Disclosure Surface Compiler
|
|
94
|
+
- Avoids prompt bloat by keeping active system prompts under 1,000 tokens.
|
|
95
|
+
- **Tier 1 (Hot Invariants)**: Absolutely binding rules (`priority: absolute` and `modality: must|must_not`) are compiled into a tiny, **5-line progressive pointer shim** that references the meta-skill `SKILL.md` system.
|
|
96
|
+
- **Tier 2 (Contextual Skills)**: The hybrid BM25 + TF-IDF router (`surface.mjs`) dynamically injects only the top-7 relevant memory nodes into domain-specific skill manifests on demand.
|
|
97
|
+
|
|
98
|
+
#### 4. ๐๏ธ Unified Merged Vault Caching (`vault-cache.mjs`)
|
|
99
|
+
- To eliminate expensive per-request disk scanning operations, `vault-cache.mjs` starts a persistent `fs.watch` file watcher over the SSSS memory directories, caching nodes in-memory.
|
|
100
|
+
- Standard read requests resolve instantly against the memory cache.
|
|
101
|
+
- In-process writes (POST, PUT, PATCH, DELETE) automatically call `invalidate()` to guarantee real-time updates are reflected instantly without waiting for disk watcher polls.
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## ๐ง The Dual-Layer Brain Cascade
|
|
106
|
+
|
|
107
|
+
Total Recall partitions your sovereign brain memory into two virtual directories:
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
~ (User Home)
|
|
111
|
+
โโโ .agent/skills/total-recall/ <-- GLOBAL BRAIN LAYER
|
|
112
|
+
โโโ config/brain.json # Master PAT credentials
|
|
113
|
+
โโโ memory-vault/ # General user preferences
|
|
114
|
+
โโโ memory-derived/ # Ephemeral caches
|
|
115
|
+
|
|
116
|
+
/Users/greg/Github/total-recall/ <-- LOCAL PROJECT BRAIN LAYER
|
|
117
|
+
โโโ .agent/skills/total-recall/
|
|
118
|
+
โโโ memory-vault/ # Project-specific facts
|
|
119
|
+
โโโ memory-derived/ # Unified project-local compiled index
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Cascade Precedence Rules:
|
|
123
|
+
1. **Local Dominance**: If a memory node with the same `slug` exists in both the global vault and the project vault, the **project vault version overrides the global node** on compilation.
|
|
124
|
+
2. **Category Defaulting**: CLI writes default target layers based on memory taxonomy:
|
|
125
|
+
- **Global**: `invariants`, `preferences`, and `lore`.
|
|
126
|
+
- **Project**: `facts`, `concepts`, `patterns`, and `decisions`.
|
|
127
|
+
3. **Drift Detection**: The `drift-detector.mjs` continuously validates compiled `graph-index.jsonl` entries against both the local and global canonical `.md` vaults, preventing "ghost records" or missing index entries.
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## ๐ The Daemon Loop & Priority Task Scheduler
|
|
132
|
+
|
|
133
|
+
The background daemon (`dream.mjs`) manages the **Continuous Intelligent Scheduler** ([src/core/scheduler.mjs](file:///Users/greg/Github/total-recall/src/core/scheduler.mjs)) and task execution loops:
|
|
134
|
+
|
|
135
|
+
### 1. Priority-Driven Queue Mechanics
|
|
136
|
+
Tasks are enqueued dynamically as standard Markdown files (`type: task`) located in your vault's `scheduler/queue/` directory. The scheduler resolves an **Effective Priority** by multiplying the task's base `priority` (10 to 100) by a strictly-regulated **layer weight** (`LAYER_WEIGHTS`), prioritizing critical correctness and active developer guidance over passive exploration:
|
|
137
|
+
- `conscious-enforcement` (Conscious Layer): **1.0** (layer weight)
|
|
138
|
+
- `cutoff-audit` (Training drift validation): **0.9**
|
|
139
|
+
- `system2-deliberation` (Slow System 2 reasoning): **0.8**
|
|
140
|
+
- `memory-maintenance` (Hygiene, decay pruning): **0.6**
|
|
141
|
+
- `skill-engineering` (Scaffolding new capability rules): **0.5**
|
|
142
|
+
- `proactive-research` / `research-acquisition` (Deep crawls): **0.4**
|
|
143
|
+
- `self-evaluation` (Frontier validation benchmarks): **0.3**
|
|
144
|
+
- `exploration` (Speculative tangents): **0.2**
|
|
145
|
+
|
|
146
|
+
### 2. The Dream Cycle Consolidation
|
|
147
|
+
Every 20 task ticks, the background daemon conducts the **Dream Cycle**:
|
|
148
|
+
- **Light Sleep**: Scans for modified files, updates vector embeddings, and purges/re-indexes caches upon detecting embedding model dimension mismatches.
|
|
149
|
+
- **REM**: Conducts clustering, prunes low-confidence nodes, and decays confidence scores on disused cards.
|
|
150
|
+
- **Deep Sleep**: Re-compiles rules and shims, and writes a daily summary note (`daily/YYYY-MM-DD.md`).
|
|
151
|
+
|
|
152
|
+
### 3. Continuous Idle Self-Improvement Loops (The Queue is NEVER Empty)
|
|
153
|
+
When the active developer queues are empty, the scheduler **automatically auto-generates idle tasks** to drive continuous optimization at $0 hardware cost. To maintain absolute security and zero local network footprint, it skips internet searches during idle, deploying a round-robin of **clean local strategies**:
|
|
154
|
+
- **Inference Task**: Scans tag clusters of related memory nodes to draw high-level SSSS ontological decisions or flag subtle rule contradictions.
|
|
155
|
+
- **Post-Mortem Task**: Reads and parses the most recent session history log to extract newly observed user preferences, style patterns, and identify subagent skill gaps.
|
|
156
|
+
- **Clarity Review Task**: Selects a random active memory node to audit its JSDoc annotations, title actionability, and Zod schema compliance.
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## ๐ hard Task Execution
|
|
161
|
+
|
|
162
|
+
Pending priority tasks are executed by the **Task Runner** ([src/core/task_runner.mjs](file:///Users/greg/Github/total-recall/src/core/task_runner.mjs)):
|
|
163
|
+
- **State Machine Updates**: Tasks transition transparently through states: `pending` โ `in_progress` โ `done` or `failed` (logging full exceptions to disk).
|
|
164
|
+
- **Subagent Routing**: Routes tasks to specialized subagents depending on category:
|
|
165
|
+
- `proactive-research`: Spawns autonomous web crawls and gathers cited research reports (`research.mjs`).
|
|
166
|
+
- `system2-deliberation`: Executes slow-deliberation inference engines (`inference-engine.mjs`) to consolidate vault data.
|
|
167
|
+
- `memory-maintenance`: Triggers memory optimization and garbage-collection loops (`optimizer.mjs`).
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
## ๐ก๏ธ Sandbox Isolation, Costs, & Firewalls
|
|
172
|
+
|
|
173
|
+
### 1. Hardened Sandbox Environment
|
|
174
|
+
The sandbox execution layer (`sandbox.mjs`) utilizes strict OS security constraints:
|
|
175
|
+
- **POSIX Namespaces**: Scopes execution boundaries using platform isolation (`sandbox-exec` under macOS, `unshare` under Linux).
|
|
176
|
+
- **Default Offline**: Completely disables outbound network routing unless explicit whitelisted API targets (like the Google Gemini endpoint) are accessed.
|
|
177
|
+
- **Resource Constraints**: Imposes a 512MB RAM utilization threshold and a 60-second execution timeout.
|
|
178
|
+
- **Default Disabled**: Set to `security.yml.sandbox.enabled: false` by default, requiring high-privilege `sandbox:run` token scopes to execute.
|
|
179
|
+
|
|
180
|
+
### 2. Cost Control watchdog
|
|
181
|
+
- Evaluates cost logging on every subagent dispatch call.
|
|
182
|
+
- Tracks daily and weekly USD costs against threshold limits in `config/budget.yml`.
|
|
183
|
+
- If caps are exceeded, the cost supervisor dynamically aborts outbound dispatches and alerts the developer.
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
## ๐ Consolidated VFS Directory Hierarchy
|
|
188
|
+
|
|
189
|
+
Total Recall consolidates all data folders under the meta-skill `skills/total-recall/` directory, ensuring simple diff-based git backups and robust security:
|
|
190
|
+
|
|
191
|
+
```
|
|
192
|
+
.agent/
|
|
193
|
+
โโโ skills/
|
|
194
|
+
โโโ code-quality/ # Development skill (not backed up)
|
|
195
|
+
โโโ repo-expert/ # Development skill (not backed up)
|
|
196
|
+
โโโ total-recall/ # THE BRAIN (Consolidated User Data VFS)
|
|
197
|
+
โโโ SKILL.md # Master total-recall capability manifest
|
|
198
|
+
โโโ memory-vault/ # SSSS Canonical Markdown Vault
|
|
199
|
+
โ โโโ invariants/ # priority: absolute โ Tier 1 (INSTRUCTIONS.md)
|
|
200
|
+
โ โโโ patterns/ # "Always do X" rules
|
|
201
|
+
โ โโโ anti-patterns/ # "Never do X" rules
|
|
202
|
+
โ โโโ preferences/ # Style preferences
|
|
203
|
+
โ โโโ decisions/ # Architectural history
|
|
204
|
+
โ โโโ concepts/ # High-level domain concepts
|
|
205
|
+
โ โโโ facts/ # Verified facts and evidence
|
|
206
|
+
โโโ memory-derived/ # Ephemeral cached indexes (disposable)
|
|
207
|
+
โ โโโ graph-index.jsonl # Merged memory index manifest
|
|
208
|
+
โ โโโ embeddings.jsonl # Vector index coordinates
|
|
209
|
+
โ โโโ embeddings-cache.json # Vector similarity cache
|
|
210
|
+
โโโ memory-inbox/ # Staging area for new nodes
|
|
211
|
+
โ โโโ pending/ # Awaiting ingestion check
|
|
212
|
+
โ โโโ conflicts/ # Quarantined rule clashes
|
|
213
|
+
โโโ sessions/ # Ingested IDE logs and conversation DAGs
|
|
214
|
+
โโโ scheduler/ # Scheduler metadata
|
|
215
|
+
โ โโโ queue/ # Priority task markdown files
|
|
216
|
+
โโโ config/ # Config files
|
|
217
|
+
โ โโโ brain.json # Remote brain URLs and token registries
|
|
218
|
+
โ โโโ budget.yml # Cost control thresholds
|
|
219
|
+
โ โโโ secrets.enc # AES-256 scrypt-encrypted master API keys
|
|
220
|
+
โโโ logs/ # JSONL subsystem logs
|
|
221
|
+
โโโ .backups/ # Local encrypted backup snapshots
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
## ๐ฌ Interactive CLI Agent Chat REPL
|
|
226
|
+
|
|
227
|
+
Total Recall features a native terminal-based chat REPL (`npx total-recall chat`) running [src/cli/chat.mjs](file:///Users/greg/Github/total-recall/src/cli/chat.mjs) that enables direct, conversational access to your active brain kernel from the terminal:
|
|
228
|
+
|
|
229
|
+
- **CLI-Agent Execution**: Conversation turns are dispatched dynamically to your prioritized **Unified Headless CLI Agents Registry** (`antigravity`, `gemini`, `claude`, `codex`) via `spawnSync`.
|
|
230
|
+
- **Pre-flight Health Routing**: Upon starting, `chat` checks agent binary availability, selecting the highest-priority active subagent found in your `$PATH`.
|
|
231
|
+
- **System Prompts & Context Cascades**: The REPL automatically injects baseline instructions ("Keep responses concise and direct") and formats chat session history sequences cleanly, allowing you to debug rules, steer preferences, and prompt the kernel in real time.
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
## ๐ Session Security & Token Management
|
|
236
|
+
|
|
237
|
+
Total Recall implements role-based granular authorization schemas to protect your sovereign brain while maintaining 100% database-free isolation.
|
|
238
|
+
|
|
239
|
+
### 1. Local Dashboard Session Management (JWT-based)
|
|
240
|
+
For web dashboard access, Total Recall strictly avoids external third-party OAuth provider dependencies (e.g. Google, GitHub, Auth0) to protect your privacy and ensure standalone local operation:
|
|
241
|
+
- **Local Password Authentication**: Submitting a password to `/api/login` verifies it against a high-cost `dashboard.password_hash` (`bcrypt-cost: 12`) stored in `security.yml` and securely mirrored in `secrets.enc`.
|
|
242
|
+
- **Rest-Persistent JWT Cookies**: Upon successful login, the server signs a secure JSON Web Token (`sessionToken`) with a randomly generated 256-bit cryptographic secret (`session-secret`) persisted directly to `config/session-secret` so that logged-in dashboard sessions cleanly survive daemon restarts.
|
|
243
|
+
- **TLS Protection**: The daemon blocks non-secure remote connections, requiring active HTTPS TLS layers (automated via Caddy proxying) for all production traffic.
|
|
244
|
+
|
|
245
|
+
### 2. Personal Access Token (PAT) Key Lifecycle Manager
|
|
246
|
+
Headless tools, IDE editors, and session Relays authenticate via standard HTTP Bearer headers (`Authorization: Bearer tr_<token>`), managed by the **Keys Lifecycle Manager** ([src/server/keys.mjs](file:///Users/greg/Github/total-recall/src/server/keys.mjs)):
|
|
247
|
+
- **SHA-256 Hash Preservation**: To eliminate credential exposure risk, the server **never writes tokens to disk in plaintext**. It persists only a timing-safe SHA-256 hash (`token_hash`) and a short identifying prefix (`token_prefix`) inside the owner-exclusive `config/keys.jsonl` file (written with `0o600` access modes). Diffs are cleanly git-versioned.
|
|
248
|
+
- **Timing-Attack Protection**: Inbound Bearer PAT tokens are verified using cryptographically secure timing-safe comparisons (`crypto.timingSafeEqual`) on SHA-256 hashes, eliminating timing vector leaks.
|
|
249
|
+
- **Role-Based Granular Scopes**: Validated PAT keys carry granular permission scopes (e.g., `chat:write`, `memory:read`, `sandbox:run`), permitting fine-grained access control boundaries for different editors.
|
|
250
|
+
|
|
251
|
+
```
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# Total Recall โ IDE & Agent Integration Guide
|
|
2
|
+
|
|
3
|
+
Total Recall serves as the core sovereign memory kernel. **Claude Code**, **Cursor**, **Codex CLI**, **Antigravity CLI**, **Aider**, and **VS Code Copilot** act as specialized interfaces on top of it. This guide details how to seamlessly wire each client to the brain.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## โก The Integration Workflow
|
|
8
|
+
|
|
9
|
+
Every IDE and agent reads specific memory instruction files at startup. Total Recall automates this lifecycle:
|
|
10
|
+
|
|
11
|
+
1. **Watch**: The background relay daemon (`relay.mjs`) automatically watches and captures conversation session traces written by IDE editors.
|
|
12
|
+
2. **Ingest**: Pushes changes to the brain REST API, executing SHA-256 content-hash deduplication.
|
|
13
|
+
3. **Process**: dispatches background post-mortems headlessly to the prioritized **CLI Agents Registry** (e.g. Antigravity CLI, Claude Code) to extract rules, facts, and decisions.
|
|
14
|
+
4. **Compile**: The Dream Cycle compiles your vaults, writing a highly-optimized **5-line progressive disclosure pointer shim** into `INSTRUCTIONS.md`.
|
|
15
|
+
5. **Inject**: Symlinks or projects the compiled memory surface directly into each tool's expected rule file location, ensuring they absorb custom preferences.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## ๐ Coexistence & Compatibility Matrix
|
|
20
|
+
|
|
21
|
+
| Client Editor | Read Target File | Total Recall Action | Relay watched Folder |
|
|
22
|
+
| :--- | :--- | :--- | :--- |
|
|
23
|
+
| **Claude Code** | `CLAUDE.md` | Symlinks `CLAUDE.md` โ `INSTRUCTIONS.md` | `~/.claude/projects/*.jsonl` |
|
|
24
|
+
| **Codex CLI** | `AGENTS.md` | Symlinks `AGENTS.md` โ `INSTRUCTIONS.md` | `~/.codex/sessions/*.jsonl` |
|
|
25
|
+
| **Antigravity** | `AGENTS.md` | Symlinks `AGENTS.md` โ `INSTRUCTIONS.md` | `~/.gemini/antigravity/brain/` |
|
|
26
|
+
| **Cursor** | `.cursor/rules/*.mdc` | Writes `.cursor/rules/total-recall.mdc` | `~/.cursor/projects/*.jsonl` |
|
|
27
|
+
| **Aider** | `.aider.rules.md` | Writes `.aider.rules.md` | Git repo logs |
|
|
28
|
+
| **VS Copilot** | `.github/copilot-instructions.md` | Writes `.github/copilot-instructions.md` | `workspaceStorage/*/chatSessions/` |
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## ๐ ๏ธ Client Configuration Recipes
|
|
33
|
+
|
|
34
|
+
### 1. Claude Code
|
|
35
|
+
- **Connection Command**:
|
|
36
|
+
```bash
|
|
37
|
+
npx total-recall connect claude-code
|
|
38
|
+
```
|
|
39
|
+
- **Coexistence Strategy**: Full compatibility. Claude Code's auto-memories are saved in `~/.claude/memories/` (completely separate). Keep auto-memories enabled; they provide raw context. Total Recall maps `CLAUDE.md` to `INSTRUCTIONS.md`, ensuring all SSSS absolute invariants govern every session.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
### 2. Antigravity (Google DeepMind SDK)
|
|
44
|
+
- **Connection Command**:
|
|
45
|
+
```bash
|
|
46
|
+
npx total-recall connect antigravity
|
|
47
|
+
```
|
|
48
|
+
- **Coexistence Strategy**: Highly complementary. Antigravity reads `AGENTS.md` in your project root, which we symlink to `INSTRUCTIONS.md`. Antigravity's local Knowledge Items (KIs) feed the session watcher logs, which the background daemon digests and promotes into SSSS invariants, updating the pointer shim automatically.
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
### 3. Cursor
|
|
53
|
+
- **Connection Command**:
|
|
54
|
+
```bash
|
|
55
|
+
npx total-recall connect cursor
|
|
56
|
+
```
|
|
57
|
+
- **Coexistence Strategy**: Since Cursor has no built-in auto-memory, Total Recall bridges the gap. Connecting writes a modular rule `.cursor/rules/total-recall.mdc` pointing to the rule shim, and the relay daemon captures and digests all your Cursor session logs seamlessly.
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
### 4. VS Code Copilot
|
|
62
|
+
- **Connection Command**:
|
|
63
|
+
```bash
|
|
64
|
+
npx total-recall connect vscode
|
|
65
|
+
```
|
|
66
|
+
- **Coexistence Strategy**: Integrates directly. Total Recall projects the compiled rules into `.github/copilot-instructions.md` at the repository root. Scoped local user storage logs are continuously tracked by the relay daemon.
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
### 5. OpenAI Codex
|
|
71
|
+
- **Connection Command**:
|
|
72
|
+
```bash
|
|
73
|
+
npx total-recall connect codex
|
|
74
|
+
```
|
|
75
|
+
- **Coexistence Strategy**: Codex reads `AGENTS.md` in the project root, symlinked to our pointer rules. Keep Codex memories enabled; their session traces are picked up by the relay to enrich SSSS.
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## ๐ The Self-Improving Feedback Loop
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
IDE Conversation Sessions (any tool)
|
|
83
|
+
โ
|
|
84
|
+
โผ Local Relay Daemon (every 60s)
|
|
85
|
+
Inbound Ingestion API (/api/sessions/ingest)
|
|
86
|
+
โ
|
|
87
|
+
โผ SHA-256 Deduplication
|
|
88
|
+
Headless subagent dispatches (Post-Mortem engine)
|
|
89
|
+
โ
|
|
90
|
+
โผ In-box pending/ (Quarantine Checks)
|
|
91
|
+
Conflict Steering auto-resolution (Jaccard + SPO)
|
|
92
|
+
โ
|
|
93
|
+
โผ memory-vault/ Category Folder
|
|
94
|
+
Background Dream Cycle (Light โ REM โ Deep sleep)
|
|
95
|
+
โ
|
|
96
|
+
โผ compile & rebuild (surface.mjs)
|
|
97
|
+
INSTRUCTIONS.md Compiled Surface Shims Rebuilt
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
The system is completely **self-improving**: the scheduler automatically creates `skill-engineering` tasks to write new `SKILL.md` rules, `memory-maintenance` tasks to prune disused cards, and `proactive-research` tasks to crawl cited facts in the background.
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## ๐งน Coexistence Verification
|
|
105
|
+
|
|
106
|
+
Total Recall never overrides your custom configs. All rules are injected inside the clearly demarcated comment blocks:
|
|
107
|
+
```markdown
|
|
108
|
+
<!-- BEGIN INJECTED MEMORY: do not edit by hand; rebuilt by total-recall surface -->
|
|
109
|
+
...
|
|
110
|
+
<!-- END INJECTED MEMORY -->
|
|
111
|
+
```
|
|
112
|
+
This guarantees that you can safely connect multiple IDEs, Obsidian vaults, and Relays concurrently without risking code loss or compilation lockouts.
|
package/package.json
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "total-recall-brain",
|
|
3
|
+
"version": "3.1.0",
|
|
4
|
+
"description": "Sovereign AI system โ database-free, SSSS-powered personal intelligence engine deployable to any POSIX host.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"total-recall": "./bin/total-recall.mjs",
|
|
8
|
+
"antigravity": "./bin/antigravity.mjs"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"bin/",
|
|
12
|
+
"src/",
|
|
13
|
+
"!src/**/*.spec.mjs",
|
|
14
|
+
"!src/**/*.test.mjs",
|
|
15
|
+
"templates/",
|
|
16
|
+
"scaffold/",
|
|
17
|
+
"docs/ARCHITECTURE.md",
|
|
18
|
+
"docs/IDE_INTEGRATION.md",
|
|
19
|
+
"README.md",
|
|
20
|
+
"LICENSE",
|
|
21
|
+
"package.json"
|
|
22
|
+
],
|
|
23
|
+
"exports": {
|
|
24
|
+
".": "./src/server/index.mjs",
|
|
25
|
+
"./fixtures/*": "./fixtures/*",
|
|
26
|
+
"./src/core/*": "./src/core/*"
|
|
27
|
+
},
|
|
28
|
+
"scripts": {
|
|
29
|
+
"dev": "node src/server/index.mjs",
|
|
30
|
+
"start": "node src/server/index.mjs",
|
|
31
|
+
"test": "vitest run",
|
|
32
|
+
"clean": "rm -rf scratch/* .remember/* *.log"
|
|
33
|
+
},
|
|
34
|
+
"repository": {
|
|
35
|
+
"type": "git",
|
|
36
|
+
"url": "git+https://github.com/gregiteen/total-recall.git"
|
|
37
|
+
},
|
|
38
|
+
"keywords": [
|
|
39
|
+
"ai",
|
|
40
|
+
"sovereign",
|
|
41
|
+
"ssss",
|
|
42
|
+
"memory",
|
|
43
|
+
"local-llm"
|
|
44
|
+
],
|
|
45
|
+
"author": "gregiteen",
|
|
46
|
+
"license": "ISC",
|
|
47
|
+
"bugs": {
|
|
48
|
+
"url": "https://github.com/gregiteen/total-recall/issues"
|
|
49
|
+
},
|
|
50
|
+
"homepage": "https://github.com/gregiteen/total-recall#readme",
|
|
51
|
+
"dependencies": {
|
|
52
|
+
"bcrypt": "^6.0.0",
|
|
53
|
+
"cookie-parser": "^1.4.7",
|
|
54
|
+
"cors": "^2.8.6",
|
|
55
|
+
"express": "^5.2.1",
|
|
56
|
+
"express-rate-limit": "^8.5.1",
|
|
57
|
+
"gray-matter": "^4.0.3",
|
|
58
|
+
"jsonwebtoken": "^9.0.3",
|
|
59
|
+
"natural": "^8.1.1",
|
|
60
|
+
"yaml": "^2.9.0",
|
|
61
|
+
"zod": "^4.4.3"
|
|
62
|
+
},
|
|
63
|
+
"devDependencies": {
|
|
64
|
+
"skills": "^1.5.7",
|
|
65
|
+
"supertest": "^7.2.2",
|
|
66
|
+
"vitest": "^4.1.6"
|
|
67
|
+
},
|
|
68
|
+
"optionalDependencies": {
|
|
69
|
+
"playwright": "^1.60.0"
|
|
70
|
+
}
|
|
71
|
+
}
|