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
package/README.md CHANGED
@@ -1,173 +1,156 @@
1
- # Total Recall — SSSS Sovereign AI OS
1
+ # Total Recall
2
2
 
3
- [![Version](https://img.shields.io/badge/version-3.3.0-indigo.svg)](package.json)
3
+ [![Version](https://img.shields.io/badge/version-3.13.0-indigo.svg)](package.json)
4
4
  [![License](https://img.shields.io/badge/license-MIT-emerald.svg)](LICENSE)
5
- [![Continuous Integration](https://img.shields.io/badge/CI-passing-teal.svg)](.github/workflows/test.yml)
6
5
 
7
- > **A database-free, filesystem-native AI memory layer.** Works in any IDE. Self-hosts on any VM. Costs nothing to store.
6
+ **Portable personal memory for any IDE** — filesystem-native, database-free, open source.
8
7
 
9
- Total Recall is the open-source reference implementation of the **SSSS (Structured Semantic Syntax System)** — a specification for storing AI memory, skills, and workflows as plain Markdown files instead of opaque, hosted databases.
8
+ Total Recall stores your rules, preferences, facts, and project knowledge as plain Markdown (SSSS). It compiles them into IDE instruction surfaces, runs a dream consolidation cycle, and lets agents enqueue background tasks. Host apps and product repos are equal implementations: **nothing is hard-coded to a specific codebase.**
10
9
 
11
10
  ```text
12
- your AI brain = ~/.agent/skills/total-recall/memory-vault/*.md
11
+ write → remember / session ingest
12
+ sleep → dream (consolidate, conflict, compile, prune)
13
+ read → recall + compiled surfaces
14
+ async → daemon task queue (agents may enqueue anything under policy)
13
15
  ```
14
16
 
15
- No database overhead. No vendor lock-in. Your thoughts, on your machine.
17
+ ```text
18
+ your brain = ~/.agent/skills/total-recall/
19
+ your project = <repo>/.agent/skills/total-recall/
20
+ ```
16
21
 
17
22
  ---
18
23
 
19
- ## 🚀 Choose Your Setup
20
-
21
- ### 🖥️ 1. IDE Memory Only (2 minutes)
24
+ ## Quick start (IDE memory, ~2 minutes)
22
25
 
23
- Add persistent, highly contextual memory to **Claude Code**, **Cursor**, **Codex CLI**, or any IDE agent in your active workspace:
26
+ No always-on LLM and no research daemon required.
24
27
 
25
28
  ```bash
26
- cd ~/my-project
27
- npx total-recall init # provision global brain and local project VFS shims
28
- npx total-recall connect claude-code # symlink CLAUDE.md → INSTRUCTIONS.md
29
+ cd /path/to/any-project
30
+ npx total-recall init --project # project brain + openwiki scaffold
31
+ npx total-recall connect claude-code # or: cursor | codex | gemini | aider | obsidian | http-api
32
+ npx total-recall remember preference "Prefer clear, short answers."
33
+ npx total-recall recall "short answers"
34
+ npx total-recall compile # rebuild INSTRUCTIONS.md inject blocks
29
35
  ```
30
36
 
31
- Supported IDEs and surfaces:
37
+ Injected rules sit only between:
32
38
 
33
- | Client Command | Connection Mode | Targeted Projection Target |
34
- | :--- | :--- | :--- |
35
- | `npx total-recall connect claude-code` | Symlink | Symlinks `CLAUDE.md` to the compiled instruction surface |
36
- | `npx total-recall connect codex` | Symlink | Symlinks `AGENTS.md` to the compiled instruction surface |
37
- | `npx total-recall connect antigravity` | Symlink | Symlinks `AGENTS.md` to the compiled instruction surface |
38
- | `npx total-recall connect gemini` | Symlink | Symlinks `GEMINI.md` to the compiled instruction surface |
39
- | `npx total-recall connect cursor` | File Projection | Writes/updates `.cursor/rules/total-recall.mdc` with frontmatter rules |
40
- | `npx total-recall connect aider` | File Projection | Writes/updates `.aider.rules.md` file rules |
39
+ ```text
40
+ <!-- BEGIN INJECTED MEMORY: do not edit by hand; rebuilt by total-recall surface -->
41
+ …
42
+ <!-- END INJECTED MEMORY -->
43
+ ```
41
44
 
42
- > [!NOTE]
43
- > **Non-Destructive Integration:**
44
- > Your existing custom rules are **never overwritten**. Total Recall operates exclusively inside the clearly-marked comment bounds:
45
- > `<!-- BEGIN INJECTED MEMORY: do not edit by hand; rebuilt by total-recall surface -->`
46
- > `...`
47
- > `<!-- END INJECTED MEMORY -->`
45
+ Existing local rules outside those markers are never clobbered.
48
46
 
49
47
  ---
50
48
 
51
- ### 🧠 2. Full Sovereign Brain VM (10 minutes)
49
+ ## Core workflows
52
50
 
53
- Deploy the full autonomous stack — a secure OpenAI-compatible REST server, dynamic React dashboard, continuous Dream Cycle daemon, and local session relays — on your own VM.
51
+ | Workflow | Commands |
52
+ |----------|----------|
53
+ | **Remember / recall** | `remember`, `forget`, `recall` |
54
+ | **Dream (sleep)** | `dream` — or daemon system dream on empty queue |
55
+ | **Defer work** | `task add "<intent>"` then `daemon start` |
56
+ | **Skills across repos** | `skill track <path>`, `skill deploy`, `skill sync` |
57
+ | **Secrets (not vault)** | `secret set\|list\|rotate\|usage\|check-surfaces` |
58
+ | **Connect an IDE** | `connect <client>` |
54
59
 
55
- **Prerequisites:**
56
- - A standard Linux or macOS server/workstation.
57
- - Node.js ≥ 20.
58
- - A primary API Key (e.g. `GOOGLE_API_KEY` for high-speed Google `gemini-embedding-2` vectors, featuring OpenAI fallback).
60
+ ### Multi-repo skills (any path you choose)
59
61
 
60
62
  ```bash
61
- # Start the interactive configuration wizard:
62
- npx total-recall init
63
+ npx total-recall skill track /path/to/any-app
64
+ npx total-recall skill sync --repo /path/a --repo /path/b
65
+ # or: export TR_SYNC_REPOS="/path/a:/path/b"
63
66
  ```
64
67
 
65
- The interactive wizard provisions the configuration, registers authorized Personal Access Tokens (PATs), configures secure Caddy reverse-proxying, and prompts you to choose your **Selectable UI Deployment Location**:
68
+ Roots come only from: project registry, install map, `TR_SYNC_REPOS`, CLI `--repo`, and cwd when it looks like a project.
66
69
 
67
- | Mode | Target URL | Primary Target |
68
- | :--- | :--- | :--- |
69
- | **Local Bind** | `http://127.0.0.1:3000` | Local operations. Binds strictly to your loopback interface. |
70
- | **Quick Tunnel** | `https://*.trycloudflare.com` | Spawns a background Cloudflare tunnel for zero-configuration public URL access. |
71
- | **Named Tunnel** | `https://your-tunnel.domain.com` | Hooks up securely to a pre-registered Cloudflare tunnel daemon. |
72
- | **Custom Domain** | `https://your-domain.com` | Hooks up to your public DNS, reverse-proxied and secured by Caddy TLS. |
70
+ ### Secrets
73
71
 
74
- To start the server daemon, run:
75
72
  ```bash
76
- npm start
73
+ npx total-recall secret set some_api_key "$KEY" --provider example
74
+ npx total-recall secret list # metadata only
75
+ npx total-recall secret check-surfaces # fail if values leaked into surfaces
77
76
  ```
78
- *Vite automatically installs and builds the beautiful Glassmorphic React SPA on first boot, serving the dashboard dynamically.*
79
-
80
- ---
81
77
 
82
- ### 📔 3. Obsidian Integration
78
+ Optional AES: `TR_SECRETS_PASSWORD`. Values never belong in vault markdown or openwiki.
83
79
 
84
- Visualize your entire memory vault, rules network, and daily logs directly inside Obsidian with native backlinks and graphs:
80
+ ### Optional background daemon
85
81
 
86
82
  ```bash
87
- npx total-recall connect obsidian
83
+ npx total-recall daemon start # idle invent OFF unless TR_IDLE_TASKS=1
84
+ npx total-recall task add "Extract decisions from last session" --cap vault:write
88
85
  ```
89
- *Auto-detects your vault path on macOS (or pass `--vault ~/path/to/vault` on Linux/other), symlinking your memory vault and installing interactive Dataview dashboard trackers.*
90
86
 
91
87
  ---
92
88
 
93
- ### 💬 4. UltraChat Integration
94
-
95
- UltraChat integrates securely with your brain via our OpenAI-compatible chat API, injecting active memory instructions into system prompts on the fly:
89
+ ## Dual-layer brain
96
90
 
97
- ```bash
98
- npx total-recall connect ultrachat --brain https://your-server.com --token YOUR_PAT
91
+ ```text
92
+ GLOBAL ~/.agent/skills/total-recall/ identity, shared preferences
93
+ PROJECT <repo>/.agent/skills/total-recall/ repo facts, decisions, openwiki
99
94
  ```
100
- *Generates the OpenAI-compatible configuration parameters (baseURL, model, token auth header).*
95
+
96
+ CLI flags: `--global` / `--project`. Project wins on slug conflicts when both apply.
101
97
 
102
98
  ---
103
99
 
104
- ## 🧠 Dual-Layer Brain Architecture
100
+ ## CLI inventory
105
101
 
106
- Total Recall partitions your sovereign brain memory into two virtual layers:
102
+ Commands are classified as **core** (default product path), **optional** (power features), or **legacy** (still shipped, not the focus).
107
103
 
108
- ```
109
- ┌────────────────────────┐
110
- │ GLOBAL LAYER │
111
- │ ~/.agent/skills/tr/ │
112
- └───────────┬────────────┘
113
- │
114
- ▼ Overridden by
115
- ┌────────────────────────┐
116
- │ PROJECT LAYER │
117
- │ <repo>/.agent/skills/ │
118
- └────────────────────────┘
119
- ```
104
+ Full table: [`docs/reference/CLI_INVENTORY.md`](docs/reference/CLI_INVENTORY.md)
120
105
 
121
- 1. **Global Layer** (`~/.agent/skills/total-recall/`): Contains global user preferences, master API keys, global logs, and the baseline identity context (`SOUL.md`, `USER.md`).
122
- 2. **Project Layer** (`<repo>/.agent/skills/total-recall/`): Contains local repository facts, project-specific habits, and specialized research agendas.
106
+ | Tier | Examples |
107
+ |------|----------|
108
+ | **Core** | `init`, `connect`, `remember`, `forget`, `recall`, `compile`, `dream`, `task`, `daemon`, `skill`, `secret`, `brain`, `status`, `doctor` |
109
+ | **Optional** | `research`, `relay`, `deploy`, `setup`, `backup`/`restore`, `chat`, `map`, `export`/`import`, `ingest` |
110
+ | **Legacy / niche** | `collab`, `friction`, `upgrade`, `migrate`, `snapshot`, `command` |
123
111
 
124
- *When compiling rules or searching, project-level nodes take precedence and override global nodes on slug collisions. CLI operations like `remember`, `recall`, `research`, `backup`, and `restore` accept `--global` and `--project` flags to steer memories to the right layer.*
112
+ Default install story: **init → connect → remember/recall → dream**. No LLM required.
125
113
 
126
114
  ---
127
115
 
128
- ## ⚡ CLI Command Reference
129
-
130
- | Command | Description |
131
- | :--- | :--- |
132
- | `npx total-recall init` | Initialize the global or local project VFS memory schemas. |
133
- | `npx total-recall connect <client>` | Wire a local IDE, Obsidian vault, or UltraChat client to your brain. |
134
- | `npx total-recall deploy` | Configure startup services, Caddy proxy servers, and platform auto-starts. |
135
- | `npx total-recall compile` | Rebuild `INSTRUCTIONS.md` from merged global & project memory nodes. |
136
- | `npx total-recall dream` | Trigger a manual Dream Cycle (GC, pattern extraction, decay consolidation). |
137
- | `npx total-recall lint` | Validate vault nodes against the SSSS v2 frontmatter Zod schema. |
138
- | `npx total-recall backup` | Create password-encrypted tarballs, push git backups, or sync Obsidian. |
139
- | `npx total-recall restore <file>` | Restore your sovereign VFS from an encrypted tarball backup. |
140
- | `npx total-recall status` | Show brain health summary, connected client registries, and daemon status. |
141
- | `npx total-recall generate-pat` | Provision granular, label-based Personal Access Tokens (PATs) for auth. |
142
- | `npx total-recall daemon` | Manage the background Dream Cycle daemon (start / stop / status). |
143
- | `npx total-recall relay` | Manage background local session-sync relays watching IDE log files. |
144
- | `npx total-recall config` | Read or update system settings, Allowed Origins, or USD budget caps dynamically. |
145
- | `npx total-recall skill` | Search, install, security-audit, and remove packages from the skills.sh registry. |
146
- | `npx total-recall uninstall` | Completely stop background services and wipe Total Recall from the system. |
147
- | `npx total-recall friction` | Inspect watchdog telemetry logs to identify workflow latency bottlenecks. |
116
+ ## Optional full server
148
117
 
149
- ---
118
+ For a local REST API + dashboard (not required for IDE memory):
150
119
 
151
- ## 🔒 Security, Sandboxing, & Safety
120
+ ```bash
121
+ npx total-recall start
122
+ # or: npm start
123
+ ```
152
124
 
153
- - **硬 Hardened VM Sandbox:** All subagent script executions run inside an isolated vm sandbox environment (`sandbox.mjs`) featuring POSIX namespace restrictions, strict memory/CPU bounds, and a command execution whitelist. The sandbox is **disabled by default** (`security.yml.sandbox.enabled: false`) for maximum security.
154
- - **Cost Watchdog & Limits:** Daily and weekly maximum cost thresholds (`config/budget.yml`) are enforced dynamically via a cost supervisor in `runtime.mjs` that instantly suspends subagent dispatches if budget caps are exceeded.
155
- - **OWASP-aligned scrypt Security:** Master credentials and API keys are AES-256-GCM encrypted under `secrets.enc` with OWASP-aligned scrypt key derivation.
156
- - **Privacy Redactions:** Memory nodes marked with `privacy: local_only` are automatically stripped before any external API dispatches or reasoning agent calls.
125
+ Deploy/tunnels are optional (`deploy`, `setup`). Configure only what you need.
157
126
 
158
127
  ---
159
128
 
160
- ## 🧹 Service Uninstallation
129
+ ## Architecture sketch
130
+
131
+ - **SSSS vault** — Markdown + YAML frontmatter (filesystem SSOT)
132
+ - **Openwiki** — human/agent long-form docs (ships with init)
133
+ - **Surfaces** — compiled inject blocks for IDEs
134
+ - **Dream** — consolidation cycle (deterministic first)
135
+ - **Daemon tasks** — open envelope + capability policy
136
+ - **Secrets** — separate store from vault
161
137
 
162
- To cleanly stop background daemons, unload platform agents (macOS launchd plists / Linux systemd services), remove symlink shims from all workspaces, and purge global configs:
138
+ Host apps consume TR the same way: PAT + brain URL (`connect http-api`) or local files.
139
+
140
+ ---
141
+
142
+ ## Uninstall
163
143
 
164
144
  ```bash
165
145
  npx total-recall uninstall
166
146
  ```
167
- > [!IMPORTANT]
168
- > **Safety First:**
169
- > The uninstaller automatically detects version-controlled files, **preserving** local workspace `.agent/skills/` and `.agent/memory-vault/` directories inside active git project repositories to ensure you never lose custom rules and memories.
147
+
148
+ Project brains inside git repos are preserved when possible so you do not lose custom rules and memories.
170
149
 
171
150
  ---
172
151
 
173
- *Sovereign. Database-free. Yours.*
152
+ ## License
153
+
154
+ MIT — see [LICENSE](LICENSE).
155
+
156
+ *Portable memory. Your files. Any IDE.*
@@ -1,20 +1,17 @@
1
1
  #!/usr/bin/env node
2
- // Antigravity CLI Agent Wrapper — routes through the running Antigravity IDE
3
- // via agentapi, using the user's logged-in Google account.
4
2
 
5
3
  import fs from 'node:fs';
6
4
  import path from 'node:path';
7
5
  import os from 'node:os';
8
- import { spawnSync } from 'node:child_process';
9
6
 
10
7
  const args = process.argv.slice(2);
11
8
  let prompt = '';
12
9
  let outputJson = false;
13
- let requestedModel = process.env.TR_CLI_MODEL || 'flash';
10
+ let requestedModel = process.env.TR_CLI_MODEL || 'default';
14
11
 
15
12
  if (args.includes('-h') || args.includes('--help')) {
16
13
  console.log(`
17
- Antigravity CLI Agent Wrapper — Headless via agentapi (logged-in account)
14
+ Antigravity CLI Agent Wrapper — Headless Zero-Dependency Cognitive Agent
18
15
 
19
16
  Usage:
20
17
  antigravity [options] [prompt]
@@ -22,15 +19,15 @@ Usage:
22
19
 
23
20
  Options:
24
21
  -p, --prompt The text prompt to generate content for
25
- -m, --model Model: flash_lite, flash, pro (default: flash)
26
- -o json Output JSON response payload
27
- --json Output JSON response payload
22
+ -m, --model Gemini API model identifier or alias (default: default / gemini-3.5-flash)
23
+ -o, --json Output dynamic JSON response payload
24
+ --json Output dynamic JSON response payload
28
25
  -h, --help Show this help information
29
26
  `);
30
27
  process.exit(0);
31
28
  }
32
29
 
33
- // Ignored flags for compatibility with tr-cli-agents dispatch
30
+ // Ignored flags for compat with tr-cli-agents dispatch
34
31
  const IGNORED = new Set(['--sandbox=false', '--yolo']);
35
32
 
36
33
  for (let i = 0; i < args.length; i++) {
@@ -42,7 +39,6 @@ for (let i = 0; i < args.length; i++) {
42
39
  }
43
40
 
44
41
  if (!prompt && args.length > 0) {
45
- // Last non-flag arg is the prompt
46
42
  for (let i = args.length - 1; i >= 0; i--) {
47
43
  if (!args[i].startsWith('-') && !IGNORED.has(args[i])) { prompt = args[i]; break; }
48
44
  }
@@ -53,50 +49,83 @@ if (!prompt) {
53
49
  process.exit(1);
54
50
  }
55
51
 
56
- // Map model aliases
57
- const modelMap = {
58
- default: 'flash', gemini: 'flash', 'gemini-flash': 'flash',
59
- 'gemini-3.5-flash': 'flash', '3.5-flash': 'flash',
60
- pro: 'pro', 'gemini-pro': 'pro', '3.1-pro': 'pro',
61
- lite: 'flash_lite', 'flash-lite': 'flash_lite',
62
- };
63
- const model = modelMap[requestedModel] || requestedModel;
64
-
65
- // Spawn agentapi new-conversation and capture the response
66
- const result = spawnSync('agentapi', [
67
- 'new-conversation',
68
- `--model=${model}`,
69
- '--title=antigravity-cli',
70
- prompt,
71
- ], {
72
- encoding: 'utf8',
73
- timeout: 300_000,
74
- maxBuffer: 10 * 1024 * 1024,
75
- env: process.env,
76
- });
77
-
78
- if (result.status !== 0) {
79
- const err = result.stderr || result.stdout || 'agentapi failed';
80
- console.error('Error:', err);
81
- process.exit(1);
52
+ // Load GOOGLE_API_KEY from env or .env files
53
+ if (!process.env.GOOGLE_API_KEY) {
54
+ try {
55
+ let dir = process.cwd();
56
+ while (dir !== path.dirname(dir)) {
57
+ const envPath = path.join(dir, '.env');
58
+ if (fs.existsSync(envPath)) {
59
+ const content = fs.readFileSync(envPath, 'utf8');
60
+ for (const line of content.split('\n')) {
61
+ const match = line.match(/^\s*GOOGLE_API_KEY\s*=\s*(["']?)(.*?)\1\s*$/);
62
+ if (match) { process.env.GOOGLE_API_KEY = match[2]; break; }
63
+ }
64
+ }
65
+ if (process.env.GOOGLE_API_KEY) break;
66
+ dir = path.dirname(dir);
67
+ }
68
+ } catch {}
82
69
  }
83
70
 
84
- const raw = result.stdout?.trim() || '';
85
-
86
- // Parse agentapi response
87
- let text = raw;
88
- try {
89
- const parsed = JSON.parse(raw);
90
- // agentapi returns { response: { conversationId, content } }
91
- if (parsed.response?.content) text = parsed.response.content;
92
- else if (parsed.content) text = parsed.content;
93
- else if (parsed.response) text = typeof parsed.response === 'string' ? parsed.response : JSON.stringify(parsed.response);
94
- } catch {
95
- // Not JSON, use raw output
71
+ const apiKey = process.env.GOOGLE_API_KEY || '';
72
+ if (!apiKey) {
73
+ console.error('Error: GOOGLE_API_KEY not set.');
74
+ process.exit(1);
96
75
  }
97
76
 
98
- if (outputJson) {
99
- console.log(JSON.stringify({ response: text }));
100
- } else {
101
- console.log(text);
77
+ // Model alias resolution
78
+ const aliases = {
79
+ gemini: 'gemini-3.5-flash', default: 'gemini-3.5-flash',
80
+ flash: 'gemini-3.5-flash', 'gemini-flash': 'gemini-3.5-flash', '3.5-flash': 'gemini-3.5-flash',
81
+ pro: 'gemini-3.1-pro-preview', 'gemini-pro': 'gemini-3.1-pro-preview', '3.1-pro': 'gemini-3.1-pro-preview',
82
+ };
83
+ const resolvedModel = aliases[requestedModel] || requestedModel;
84
+
85
+ async function main() {
86
+ try {
87
+ const url = `https://generativelanguage.googleapis.com/v1beta/models/${resolvedModel}:generateContent?key=${apiKey}`;
88
+
89
+ const res = await fetch(url, {
90
+ method: 'POST',
91
+ headers: { 'Content-Type': 'application/json' },
92
+ body: JSON.stringify({
93
+ contents: [{ parts: [{ text: prompt }] }]
94
+ })
95
+ });
96
+
97
+ if (!res.ok) {
98
+ const errText = await res.text();
99
+ throw new Error(`Gemini API returned status ${res.status}: ${errText}`);
100
+ }
101
+
102
+ const data = await res.json();
103
+ const text = data.candidates?.[0]?.content?.parts?.[0]?.text || '';
104
+
105
+ // Save usage data for budget safety
106
+ try {
107
+ const promptTokens = data.usageMetadata?.promptTokenCount || 0;
108
+ const candidatesTokens = data.usageMetadata?.candidatesTokenCount || 0;
109
+ if (promptTokens > 0 || candidatesTokens > 0) {
110
+ const tmpDir = path.join(os.homedir(), '.gemini', 'tmp', 'antigravity', 'chats');
111
+ if (!fs.existsSync(tmpDir)) fs.mkdirSync(tmpDir, { recursive: true });
112
+ const usageLine = JSON.stringify({
113
+ timestamp: new Date().toISOString(),
114
+ tokens: { input: promptTokens, output: candidatesTokens }
115
+ });
116
+ fs.appendFileSync(path.join(tmpDir, 'usage.jsonl'), usageLine + '\n', 'utf8');
117
+ }
118
+ } catch {}
119
+
120
+ if (outputJson) {
121
+ console.log(JSON.stringify({ response: text }));
122
+ } else {
123
+ console.log(text);
124
+ }
125
+ } catch (err) {
126
+ console.error('Error calling Gemini API:', err.message);
127
+ process.exit(1);
128
+ }
102
129
  }
130
+
131
+ main();
@@ -59,6 +59,7 @@ const COMMANDS = {
59
59
  recall: 'recall.mjs',
60
60
  search: 'recall.mjs',
61
61
  research: 'research.mjs',
62
+ task: 'task.mjs',
62
63
  share: 'share.mjs',
63
64
  'generate-pat': 'generate-pat.mjs',
64
65
  'hash-password': 'hash-password.mjs',
@@ -77,6 +78,8 @@ const COMMANDS = {
77
78
  brain: 'brain.mjs',
78
79
  config: 'config.mjs',
79
80
  skill: 'skill.mjs',
81
+ secret: 'secret.mjs',
82
+ secrets: 'secret.mjs',
80
83
  help: 'help.mjs',
81
84
  collab: 'collab.mjs',
82
85
  command: 'command.mjs',
@@ -84,70 +87,42 @@ const COMMANDS = {
84
87
  };
85
88
  function printHelp() {
86
89
  console.log(`
87
- total-recall — Sovereign AI System CLI
90
+ total-recall — Portable personal memory for any IDE
88
91
 
89
92
  Usage: total-recall <command> [options]
90
93
 
91
- Commands:
92
- init Bootstrap Total Recall into an existing project repo
93
- setup Interactive wizard: provider → API key → provision → connect IDEs
94
- start [--port N] Start the brain server in the foreground (alias for running the server directly)
95
- deploy Provision a target machine (Caddy/TLS, system services, VFS setup, environment checks)
96
- doctor Run environment diagnostics and verify dependency health
97
- dream Manually trigger a dream cycle (Light → REM → Deep)
98
- lint Validate all vault nodes against SSSS schema v2
99
- daemon <start|stop|status> Manage the background daemon
100
- status Show server health, active deploy mode, dashboard URL, tunnel PID, and daemon state
101
- backup [options] Create encrypted VFS tarball, push git backup, or Obsidian sync
102
- restore <path> Restore from an encrypted backup
103
- upgrade --model <n> Swap the kernel model (e.g., gemma5-32b)
104
- friction Analyze logs to detect workflow bottlenecks
105
- chat Interactive terminal chat with the Sovereign OS
106
- remember Remember new rules, preferences, or corrections in real time
107
- forget <slug> Delete a memory node by slug (with auto-recompile)
108
- recall Recall semantic memory or search existing knowledge/rules/session-history
109
- map Visualize memory vault category trees and link relationships
110
- brain <cmd> Manage registered brains and context resolution (list, status, register, unregister)
111
- research <command> Manage/query ongoing autonomous research agenda (list, add, show, report, cancel)
112
- share [url] Share a URL or text snippet to the brain (auto-routes to remember or research)
113
- config <get|set> Read, write, and toggle UI, security, and budget settings
114
- skill <command> Manage AI agent skills: find, install, scan, list, remove
115
- generate-pat Issue a PAT; stores only a hash in keys.jsonl
116
- hash-password Generate a bcrypt dashboard password hash
117
- reset-password Reset the dashboard admin password and force a change on login
118
- compile Alias for rebuild: deterministically rebuild projections
119
- rebuild [--check] Detect index drift and deterministically rebuild projections
120
- snapshot Manage fast point-in-time VFS snapshots and rollbacks
121
- migrate Run backwards-incompatible SSSS schema migrations
122
- import [--dir <path>] [--force] Import existing AGENTS.md, .cursorrules, CLAUDE.md, etc.
123
- into the vault (run before compile on first install)
124
- ingest [--watch] Ingest IDE conversation logs (Claude Code, Codex, Gemini, etc.)
125
- ingest google-takeout <path> Ingest Google Takeout export data
126
- export <path> --okf Export memory vault as an OKF-compliant bundle
127
- connect <client> Configure Cursor, Claude Code, Codex, UltraChat, Gemini, etc.
128
- sync [--watch] Pull remote brain instructions into the current workspace
129
- relay <cmd> Local background relay: ship IDE sessions to remote brain
130
- Commands: start | stop | status | once | install | uninstall
131
- uninstall Completely uninstall all services, launchd agents, VFS, and shims
132
- help <topic> Interactive offline documentation, SSSS reference, and system help
133
- collab Start Express/WebSockets backend & React collab sandbox dev server
134
- command <create|read|update|remove|list> Manage custom project-local CLI commands
94
+ Core (default product path):
95
+ init [--project] Bootstrap global or project brain + openwiki
96
+ connect <client> Wire IDE / Obsidian / http-api host
97
+ remember / forget Write-path memory (SSSS vault)
98
+ recall Read-path hybrid search
99
+ compile Rebuild instruction surfaces
100
+ dream Memory consolidation cycle
101
+ task <cmd> Enqueue daemon work (open envelope)
102
+ daemon <cmd> Background worker (start|stop|status)
103
+ skill <cmd> Skills registry, deploy, multi-repo sync
104
+ secret <cmd> Secrets store + usage (not the vault)
105
+ brain <cmd> Register / ensure any project brain
106
+ status / doctor Health and diagnostics
107
+
108
+ Optional:
109
+ research, share, ingest, import, export, relay, setup, deploy,
110
+ start, backup, restore, config, map, generate-pat, lint, sync, …
111
+
112
+ Full inventory: docs/reference/CLI_INVENTORY.md
113
+ Default story: init → connect → remember/recall → dream (no LLM required)
135
114
 
136
-
137
-
138
-
139
- Autonomous operations (sync, compile, backup) are now handled by the
140
- Cloud Agent via SSSS task nodes in .agent/scheduler/queue/.
141
- The agent cron trigger (every 5 min) processes these automatically.
115
+ Examples:
116
+ npx total-recall init --project
117
+ npx total-recall connect claude-code
118
+ npx total-recall remember fact "The API uses port 3000."
119
+ npx total-recall dream
120
+ npx total-recall skill track .
121
+ npx total-recall secret list
142
122
 
143
123
  Options:
144
- --help, -h Show this help message
124
+ --help, -h Show this help
145
125
  --version, -v Show version
146
-
147
- Examples:
148
- npx total-recall deploy
149
- npx total-recall dream
150
- npx total-recall daemon status
151
126
  `);
152
127
  }
153
128
 
@@ -40,7 +40,7 @@ chrome.contextMenus.onClicked.addListener(async (info, tab) => {
40
40
  await share({
41
41
  url: tab.url,
42
42
  title: tab.title,
43
- action: 'research',
43
+ action: 'remember',
44
44
  source: 'chrome-extension'
45
45
  });
46
46
  showBadge('\u2713', '#22c55e');
@@ -17,7 +17,8 @@
17
17
  chrome.storage.local.get(['brainUrl', 'pat']),
18
18
  chrome.storage.sync.get([
19
19
  'blocklist',
20
- 'captureGranularity'
20
+ 'captureGranularity',
21
+ 'passiveTracking'
21
22
  ])
22
23
  ]);
23
24
  const settings = { ...syncSettings, ...localSettings };
@@ -32,7 +33,10 @@
32
33
  }
33
34
 
34
35
  // Granularity radio
35
- const granularity = settings.captureGranularity || 'minimal';
36
+ let granularity = settings.captureGranularity || 'minimal';
37
+ if (settings.passiveTracking === false) {
38
+ granularity = 'off';
39
+ }
36
40
  const radio = document.querySelector(`input[name="granularity"][value="${granularity}"]`);
37
41
  if (radio) radio.checked = true;
38
42
  }
@@ -49,6 +53,7 @@
49
53
  // Get selected granularity
50
54
  const granularityRadio = document.querySelector('input[name="granularity"]:checked');
51
55
  const captureGranularity = granularityRadio ? granularityRadio.value : 'minimal';
56
+ const passiveTracking = captureGranularity !== 'off';
52
57
 
53
58
  await chrome.storage.local.set({
54
59
  brainUrl: brainUrlInput.value.trim() || 'http://127.0.0.1:3000',
@@ -57,7 +62,8 @@
57
62
  await chrome.storage.sync.remove('pat');
58
63
  await chrome.storage.sync.set({
59
64
  blocklist,
60
- captureGranularity
65
+ captureGranularity,
66
+ passiveTracking
61
67
  });
62
68
 
63
69
  showSaveStatus('Settings saved!', false);
@@ -558,8 +558,6 @@ Provide helpful analysis grounded on both the user's brain memory and this page
558
558
  settingsTrackingToggle.addEventListener('change', async () => {
559
559
  const passiveTracking = settingsTrackingToggle.checked;
560
560
  await chrome.storage.sync.set({ passiveTracking });
561
- // Signal active preference back to service worker
562
- chrome.runtime.sendMessage({ type: 'UPDATE_PREFERENCES', passiveTracking });
563
561
  showToast(`Passive tracking ${passiveTracking ? 'enabled' : 'disabled'}`);
564
562
  });
565
563
 
@@ -3,13 +3,14 @@
3
3
  <head>
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <meta name="description" content="Total Recall — Sovereign AI Brain Dashboard. Memory explorer, chat interface, code sandbox, and system health monitoring." />
7
- <meta name="theme-color" content="#0a0a0f" />
6
+ <meta name="description" content="Total Recall — portable personal memory for any IDE. Memory explorer, chat, dream consolidation, and system health." />
7
+ <meta name="theme-color" content="#070b14" />
8
+ <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
8
9
  <link rel="manifest" href="/manifest.json" />
9
10
  <link rel="preconnect" href="https://fonts.googleapis.com" />
10
11
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
11
12
  <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet" />
12
- <title>Total Recall — Sovereign Brain</title>
13
+ <title>Total Recall — Portable Memory</title>
13
14
  </head>
14
15
  <body>
15
16
  <div id="root"></div>