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.
Files changed (170) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +173 -0
  3. package/bin/antigravity.mjs +212 -0
  4. package/bin/init.mjs +36 -0
  5. package/bin/oci-sniper.sh +69 -0
  6. package/bin/total-recall.mjs +229 -0
  7. package/docs/ARCHITECTURE.md +251 -0
  8. package/docs/IDE_INTEGRATION.md +112 -0
  9. package/package.json +71 -0
  10. package/scaffold/.agent/skills/total-recall/SKILL.md +195 -0
  11. package/scaffold/.agent/skills/total-recall/evals/evals.json +20 -0
  12. package/scaffold/.agent/skills/total-recall/memory-vault/concepts/cli-help-reference.md +145 -0
  13. package/scaffold/.agent/skills/total-recall/memory-vault/invariants/operating-instructions.md +75 -0
  14. package/scaffold/.agent/skills/total-recall/memory-vault/preferences/always-websearch-gap.md +16 -0
  15. package/scaffold/.agent/skills/total-recall/memory-vault/preferences/topic-research-sop.md +17 -0
  16. package/scaffold/.agent/skills/total-recall/references/api-reference.md +187 -0
  17. package/scaffold/.agent/skills/total-recall/references/architecture-reference.md +81 -0
  18. package/scaffold/.agent/skills/total-recall/references/cli-reference.md +103 -0
  19. package/scaffold/.agent/skills/total-recall/references/ssss-reference.md +88 -0
  20. package/scaffold/.agent/skills/total-recall/references/troubleshooting.md +68 -0
  21. package/scaffold/.agent/skills/total-recall/scripts/sync-repo.mjs +83 -0
  22. package/scaffold/.agent/skills/total-recall/skills/cli-agents/SKILL.md +122 -0
  23. package/scaffold/.agent/skills/total-recall/skills/cli-agents/agents.yml +27 -0
  24. package/scaffold/.agent/skills/total-recall/skills/cli-agents/references/antigravity.txt +20 -0
  25. package/scaffold/.agent/skills/total-recall/skills/cli-agents/references/claude.txt +58 -0
  26. package/scaffold/.agent/skills/total-recall/skills/cli-agents/references/codex.txt +81 -0
  27. package/scaffold/.agent/skills/total-recall/skills/cli-agents/references/gemini.txt +44 -0
  28. package/scaffold/.agent/skills/total-recall/skills/research/SKILL.md +337 -0
  29. package/scaffold/.agent/skills/total-recall/skills/skill/SKILL.md +281 -0
  30. package/scaffold/.agent/skills/total-recall/skills/skill/assets/skill-template/SKILL.md +20 -0
  31. package/scaffold/.agent/skills/total-recall/skills/skill/evals/evals.json +20 -0
  32. package/scaffold/.agent/skills/total-recall/skills/skill/hooks/on-skill-add.sh +14 -0
  33. package/scaffold/.agent/skills/total-recall/skills/skill/hooks/on-skill-delete.sh +14 -0
  34. package/scaffold/.agent/skills/total-recall/skills/skill/learnings/.gitkeep +0 -0
  35. package/scaffold/.agent/skills/total-recall/skills/skill/references/.gitkeep +0 -0
  36. package/scaffold/.agent/skills/total-recall/skills/skill/scripts/.gitkeep +0 -0
  37. package/scaffold/.agent/skills/total-recall/skills/skill/scripts/create-skill.sh +65 -0
  38. package/scaffold/.agent/skills/total-recall/skills/skill/scripts/enforce-skill-optimization.mjs +135 -0
  39. package/scaffold/.agent/skills/total-recall/skills/skill/scripts/find-skills.mjs +124 -0
  40. package/scaffold/.agent/skills/total-recall/skills/skill/scripts/scan-skill.mjs +207 -0
  41. package/scaffold/.agent/skills/total-recall/skills/skill/scripts/skill-watcher.mjs +64 -0
  42. package/scaffold/.agent/skills/total-recall/skills/skill/subagents/audit-all-skills.md +62 -0
  43. package/scaffold/.agent/skills/total-recall/skills/ssss/SKILL.md +27 -0
  44. package/scaffold/.agent/skills/total-recall/skills/ssss/evals/evals.json +17 -0
  45. package/scaffold/.agent/skills/total-recall/skills/ssss/references/ssss-spec.md +117 -0
  46. package/scaffold/.agent/skills/total-recall/skills/ssss/scripts/validate-schema.mjs +54 -0
  47. package/scaffold/.agent/skills/total-recall/skills/ssss/subagents/audit-ssss-node.md +9 -0
  48. package/scaffold/.agent/skills/total-recall/subagents/total-recall-diagnostician.md +13 -0
  49. package/src/cli/agent-dir.mjs +105 -0
  50. package/src/cli/backup.mjs +313 -0
  51. package/src/cli/brain.mjs +224 -0
  52. package/src/cli/chat.mjs +74 -0
  53. package/src/cli/config.mjs +247 -0
  54. package/src/cli/connect.mjs +872 -0
  55. package/src/cli/daemon.mjs +228 -0
  56. package/src/cli/deploy-ui.mjs +1793 -0
  57. package/src/cli/deploy.mjs +1726 -0
  58. package/src/cli/doctor.mjs +254 -0
  59. package/src/cli/dream.mjs +80 -0
  60. package/src/cli/forget.mjs +92 -0
  61. package/src/cli/friction.mjs +21 -0
  62. package/src/cli/generate-pat.mjs +65 -0
  63. package/src/cli/hash-password.mjs +22 -0
  64. package/src/cli/help.mjs +153 -0
  65. package/src/cli/import-rules.mjs +102 -0
  66. package/src/cli/ingest/index.mjs +318 -0
  67. package/src/cli/ingest/parsers/chrome-bookmarks.mjs +238 -0
  68. package/src/cli/ingest/parsers/google-keep.mjs +147 -0
  69. package/src/cli/ingest/parsers/search-history.mjs +142 -0
  70. package/src/cli/ingest/parsers/youtube-history.mjs +181 -0
  71. package/src/cli/ingest/utils/dedup.mjs +69 -0
  72. package/src/cli/ingest/utils/takeout-walker.mjs +101 -0
  73. package/src/cli/ingest.mjs +102 -0
  74. package/src/cli/init.mjs +736 -0
  75. package/src/cli/integration-dispatcher.mjs +128 -0
  76. package/src/cli/lint.mjs +166 -0
  77. package/src/cli/map.mjs +194 -0
  78. package/src/cli/migrate.mjs +87 -0
  79. package/src/cli/rebuild.mjs +88 -0
  80. package/src/cli/recall.mjs +219 -0
  81. package/src/cli/relay.mjs +518 -0
  82. package/src/cli/remember.mjs +306 -0
  83. package/src/cli/research.mjs +381 -0
  84. package/src/cli/reset-password.mjs +75 -0
  85. package/src/cli/restore.mjs +135 -0
  86. package/src/cli/setup.mjs +616 -0
  87. package/src/cli/share.mjs +180 -0
  88. package/src/cli/skill.mjs +313 -0
  89. package/src/cli/snapshot.mjs +108 -0
  90. package/src/cli/start.mjs +63 -0
  91. package/src/cli/status.mjs +296 -0
  92. package/src/cli/sync.mjs +383 -0
  93. package/src/cli/uninstall.mjs +613 -0
  94. package/src/cli/upgrade.mjs +141 -0
  95. package/src/cli/wizard.html +3682 -0
  96. package/src/core/blackboard.mjs +54 -0
  97. package/src/core/clarity-rewriter.mjs +770 -0
  98. package/src/core/conclusion-writer.mjs +259 -0
  99. package/src/core/config.mjs +277 -0
  100. package/src/core/conflict-detector.mjs +536 -0
  101. package/src/core/crypto.mjs +107 -0
  102. package/src/core/daemon-control.mjs +158 -0
  103. package/src/core/daemon-loop.mjs +364 -0
  104. package/src/core/dream.mjs +347 -0
  105. package/src/core/drift-detector.mjs +143 -0
  106. package/src/core/embeddings.mjs +632 -0
  107. package/src/core/emergency-alerts.mjs +137 -0
  108. package/src/core/evolution.mjs +107 -0
  109. package/src/core/fact-seeker.mjs +1602 -0
  110. package/src/core/friction.mjs +95 -0
  111. package/src/core/import-rules.mjs +308 -0
  112. package/src/core/inference-engine.mjs +367 -0
  113. package/src/core/logger.mjs +75 -0
  114. package/src/core/memory-layers.mjs +96 -0
  115. package/src/core/migrate.mjs +116 -0
  116. package/src/core/notifications.mjs +77 -0
  117. package/src/core/operation-validator.mjs +272 -0
  118. package/src/core/optimizer.mjs +330 -0
  119. package/src/core/pattern_detector.mjs +113 -0
  120. package/src/core/post-mortem.mjs +413 -0
  121. package/src/core/protect-instructions.mjs +148 -0
  122. package/src/core/quick-capture.mjs +145 -0
  123. package/src/core/research-queue.mjs +431 -0
  124. package/src/core/research.mjs +461 -0
  125. package/src/core/runtime.mjs +515 -0
  126. package/src/core/sandbox.mjs +163 -0
  127. package/src/core/scheduler.mjs +569 -0
  128. package/src/core/schema.mjs +333 -0
  129. package/src/core/search.mjs +219 -0
  130. package/src/core/semantic-index.mjs +276 -0
  131. package/src/core/session-watcher.mjs +850 -0
  132. package/src/core/snapshot.mjs +133 -0
  133. package/src/core/source-adapters.mjs +1038 -0
  134. package/src/core/steering.mjs +137 -0
  135. package/src/core/surface.mjs +444 -0
  136. package/src/core/task_runner.mjs +125 -0
  137. package/src/core/tts.mjs +142 -0
  138. package/src/core/usage-tracker.mjs +349 -0
  139. package/src/core/vault-cache.mjs +76 -0
  140. package/src/core/vault.mjs +273 -0
  141. package/src/core/watchdog.mjs +236 -0
  142. package/src/server/api.mjs +944 -0
  143. package/src/server/auth.mjs +410 -0
  144. package/src/server/index.mjs +868 -0
  145. package/src/server/keys.mjs +181 -0
  146. package/src/server/rest.mjs +1652 -0
  147. package/src/server/route-manifest.json +77 -0
  148. package/src/server/routes/_shared.mjs +93 -0
  149. package/src/server/routes/keys.mjs +55 -0
  150. package/src/server/routes/memory.mjs +249 -0
  151. package/src/server/routes/sessions.mjs +336 -0
  152. package/src/server/routes/share.mjs +138 -0
  153. package/src/server/tools.mjs +618 -0
  154. package/templates/Caddyfile +37 -0
  155. package/templates/com.totalrecall.backup.plist +42 -0
  156. package/templates/com.totalrecall.daemon.plist +40 -0
  157. package/templates/com.totalrecall.duckdns.plist +23 -0
  158. package/templates/com.totalrecall.server.plist +46 -0
  159. package/templates/default-config/budget.yml +6 -0
  160. package/templates/default-config/runtime.yml +11 -0
  161. package/templates/default-config/security.yml +53 -0
  162. package/templates/default-config/voice.yml +34 -0
  163. package/templates/obsidian-queries/conflicts.md +26 -0
  164. package/templates/obsidian-queries/daily.md +17 -0
  165. package/templates/obsidian-queries/index.md +38 -0
  166. package/templates/obsidian-queries/skills.md +14 -0
  167. package/templates/onboarding-interview.md +72 -0
  168. package/templates/skill_engineering.md +40 -0
  169. package/templates/total-recall-daemon.service +21 -0
  170. package/templates/total-recall-server.service +20 -0
@@ -0,0 +1,195 @@
1
+ ---
2
+ type: skill
3
+ name: total-recall
4
+ description: "Use this skill as the master guide to understand the entire Total Recall Sovereign AI OS setup, VFS topologies, SSSS protocol, CLI parameter reference, troubleshooting, and automated upstream repository sync. MANDATORY: Read this file before attempting major setup modifications or diagnoses."
5
+ ---
6
+
7
+ # Total Recall — Master Agent Skill (REST API First)
8
+
9
+ Welcome to the master control skill for the **Total Recall Sovereign AI OS**. > [!NOTE]
10
+ > **Total Recall Architecture:**
11
+ > The Total Recall memory kernel runs as a standalone REST service. Agents interact with the memory vault, perform semantic searches, and compile rules directly using lightweight, filesystem-native REST API calls via standard shell `curl` commands.
12
+
13
+ ---
14
+
15
+ ## 🎯 WHEN TO USE THIS SKILL
16
+
17
+ You MUST actively reference and apply this skill under the following specific runtime scenarios:
18
+
19
+ ### 1. When the user establishes a rule, preference, or correction
20
+ * **Trigger**: Whenever the user corrects your behavior, shares a coding style, defines an architectural pattern, or establishes a preference you must remember.
21
+ * **Action**: Autonomously create a new SSSS v2 memory node under `.agent/memory-vault/` and compile the vault.
22
+
23
+ ### 2. When referencing invariants, preferences, and corrections (Intrinsically Known Rules)
24
+ * **⚠️ MANDATORY**: The compiled instruction files (like `INSTRUCTIONS.md`, `GEMINI.md`, `AGENTS.md`, etc.) contain the **entirety** of active invariants, preferences, and behavior corrections (rules/directives).
25
+ * **Action**: You **intrinsically know these rules** because they are injected directly into your active prompt/instruction context. You **MUST NEVER** execute manual filesystem searches (grep, find) or REST API/curl queries to discover or check these basic rules.
26
+
27
+ ### 3. When searching for complex domain knowledge or general facts
28
+ * **Trigger**: When you need to retrieve deep factual information (e.g. from the `facts/` category) or conceptual domain structures (e.g. from `concepts/`) that are not present in your active instruction files.
29
+ * **Action**: Use the two complementary search modes:
30
+ * **Regular Text Search** (e.g. filesystem grep / literal matching): Use this when searching for specific literal keywords, exact config keys, exact filenames, or exact slugs.
31
+ * **Semantic Search (REST API POST `/api/memory/search/semantic`)**: Use this when searching for conceptual matching, high-level intent, design patterns, or user preferences. Do NOT rely on only one search mode; combine both to ensure absolute coverage.
32
+
33
+ ### 4. When a topic requires deep, structured domain learning and mastery
34
+ * **Trigger**: When you encounter a complex architectural topic, a deep conceptual system, or a technical domain where you need to acquire deep mastery to proceed effectively.
35
+ * **Must NOT Trigger**: Do NOT use background research for quick searches of simple APIs, common code snippets, or basic web-related docs. Standard models have active web search capabilities that should be used for these quick, on-demand reference lookups.
36
+ * **Action**: Autonomously queue the topic to the background research agenda using the `/api/research` REST API POST endpoint to let the daemon build a high-confidence vault node.
37
+
38
+ ### 5. When you modify, add, or delete files in the memory vault
39
+ * **Trigger**: Immediately after performing any memory node writes.
40
+ * **Action**: Rebuild the instruction shims by sending a POST request to `/api/vault/compile`.
41
+
42
+ ### 6. When troubleshooting connections, port blocks, or sync errors
43
+ * **Trigger**: If the REST server is unreachable, ports are blocked, or the upstream sync tool encounters errors.
44
+ * **Action**: Refer to the active diagnostics manual within this skill to heal the local runtime.
45
+
46
+ ---
47
+
48
+ ## ⚡ Core Directives for IDE Agents
49
+
50
+ ### 1. Zero-Database Sovereign Integrity
51
+ Total Recall operates **entirely database-free**. The local filesystem is the source of truth. Every rule, pattern, decision, concept, preference, and fact exists as a plain Markdown file with semantic YAML frontmatter. Derived indexes are disposable caches. Do not look for PostgreSQL or SQLite databases.
52
+
53
+ ### 2. Precise Tool & API Selection Heuristics
54
+ When interacting with the system, choose your interfaces based on the following:
55
+ * **Local Skills**: Use local skill packages (located in `.agent/skills/`) for complex workspace tasks, testing, and formatting. If a local skill has custom helper scripts, ALWAYS invoke them via your shell command tool instead of running raw standard commands.
56
+ * **Total Recall Brain (MANDATORY)**: For all semantic searches, memory retrieval, memory writes, and derived index recompilation, **ALWAYS use shell `curl` commands** targeting the REST API endpoints documented below.
57
+
58
+ ### 3. Non-Destructive Code Modifications
59
+ When modifying existing rule surfaces or IDE shims (such as `.cursorrules`, `CLAUDE.md`, `GEMINI.md`, etc.), **NEVER** overwrite the developer's custom pre-existing rules. Instead, write compiled absolute invariants inside the managed comment block:
60
+ `<!-- BEGIN INJECTED MEMORY: do not edit by hand; rebuilt by total-recall surface -->`
61
+ ...
62
+ `<!-- END INJECTED MEMORY -->`
63
+
64
+ ### 4. Upstream Skill Synchronization
65
+ Keep local skill definitions and invariant files updated by executing the sync runner:
66
+ ```bash
67
+ node .agent/skills/total-recall/scripts/sync-repo.mjs
68
+ ```
69
+ This utility fetches standard skill and invariant definitions from the upstream repository, merges them non-destructively preserving custom user nodes, and auto-recompiles the workspace.
70
+
71
+ ### 5. Premium Browser Setup Wizard Onboarding
72
+ For first-time system installations, migrations, or editor reconnections, launch the visual onboarding setup wizard:
73
+ ```bash
74
+ npx total-recall deploy --ui
75
+ ```
76
+ This spins up a secure local Express server (port 3000, increments dynamically if occupied) and automatically launches the graphical installation dashboard in your macOS or Linux browser, providing:
77
+ * **Deployment Scoping**: Seamless visual provisioning for local machine brains, remote network computers (SSH), rented GPU cloud servers (Vast.ai), or custom VPS droplets.
78
+ * **Credential Restoration**: Automatically parses, protects, and restores AES-encrypted API tokens and bcrypt cost-12 dashboard passwords from `.agent/secrets.enc` so you never lose credentials.
79
+ * **Automated SSL & Tunnels**: Automatically deploys free, encrypted Cloudflare Quick Tunnels (`*.trycloudflare.com`) or permanent Zero Trust domains over secure HTTPS/Caddy TLS.
80
+ * **Omni-Channel Integration Checklists**: Multi-select and configure your active editors (Claude Code, Cursor, Codex, Gemini, VS Code, Obsidian) with live terminal logs in the browser.
81
+
82
+ ---
83
+
84
+ ## 🌐 DIRECT REST API REFERENCE
85
+
86
+ All requests to the Total Recall REST API must include the Bearer token in the `Authorization` header.
87
+
88
+ * **Active Bearer PAT Token**: `<YOUR_PAT_TOKEN>` (Retrieve dynamically from process.env.TR_PAT or read .agent/config/brain.json)
89
+ * **Base URL**: `<YOUR_BRAIN_URL>` (Retrieve from process.env.TR_BRAIN or read .agent/config/brain.json; default: http://localhost:3000)
90
+
91
+ ### Endpoint Reference & curl Templates
92
+
93
+ | Method | Route | Description |
94
+ |---|---|---|
95
+ | `GET` | `/health` | Check system health (vault count, embeddings, CLI agents availability) |
96
+ | `GET` | `/api/vault/status` | Vault stats summary |
97
+ | `GET` | `/api/memory` | List all SSSS memory nodes |
98
+ | `GET` | `/api/memory/:slug` | Fetch a single SSSS memory node by its slug |
99
+ | `POST` | `/api/memory` | Create or update (upsert) a memory node |
100
+ | `POST` | `/api/memory/search/semantic` | Perform vector semantic search using local dense embeddings |
101
+ | `POST` | `/api/research` | Queue a topic for the background research daemon |
102
+ | `GET` | `/api/research` | Retrieve/search active research agenda & queue |
103
+ | `POST` | `/api/vault/compile` | Recompile derived index caches and rule surfaces |
104
+ | `DELETE` | `/api/memory/:slug` | Archive a memory node |
105
+
106
+ #### 1. Check System Health
107
+ ```bash
108
+ curl -H "Authorization: Bearer <YOUR_PAT_TOKEN>" \
109
+ <YOUR_BRAIN_URL>/health
110
+ ```
111
+
112
+ #### 2. Perform Vector Semantic Search (Use this for all concept lookup requests)
113
+ ```bash
114
+ curl -X POST \
115
+ -H "Authorization: Bearer <YOUR_PAT_TOKEN>" \
116
+ -H "Content-Type: application/json" \
117
+ -d '{"query": "your search query here", "top_k": 5}' \
118
+ <YOUR_BRAIN_URL>/api/memory/search/semantic
119
+ ```
120
+
121
+ #### 3. Fetch a Specific Memory Node
122
+ ```bash
123
+ curl -H "Authorization: Bearer <YOUR_PAT_TOKEN>" \
124
+ <YOUR_BRAIN_URL>/api/memory/slug-name
125
+ ```
126
+
127
+ #### 4. List All Memory Nodes
128
+ ```bash
129
+ curl -H "Authorization: Bearer <YOUR_PAT_TOKEN>" \
130
+ "<YOUR_BRAIN_URL>/api/memory"
131
+ ```
132
+
133
+ #### 5. Create or Update a Memory Node
134
+ ```bash
135
+ curl -X POST \
136
+ -H "Authorization: Bearer <YOUR_PAT_TOKEN>" \
137
+ -H "Content-Type: application/json" \
138
+ -d '{
139
+ "slug": "atomic-writes",
140
+ "category": "facts",
141
+ "title": "Always write files atomically",
142
+ "status": "active",
143
+ "confidence": 0.95,
144
+ "importance": 4,
145
+ "modality": "must",
146
+ "content": "Always write files atomically by creating a temporary file first and renaming it to prevent partial file writes."
147
+ }' \
148
+ <YOUR_BRAIN_URL>/api/memory
149
+ ```
150
+
151
+ #### 6. Trigger Surface Recompilation (Run this after adding, editing, or deleting memory files)
152
+ ```bash
153
+ curl -X POST \
154
+ -H "Authorization: Bearer <YOUR_PAT_TOKEN>" \
155
+ <YOUR_BRAIN_URL>/api/vault/compile
156
+ ```
157
+
158
+ #### 7. Archive a Memory Node
159
+ ```bash
160
+ curl -X DELETE \
161
+ -H "Authorization: Bearer <YOUR_PAT_TOKEN>" \
162
+ <YOUR_BRAIN_URL>/api/memory/slug-name
163
+ ```
164
+
165
+ #### 8. Queue Autonomous Research
166
+ ```bash
167
+ curl -X POST \
168
+ -H "Authorization: Bearer <YOUR_PAT_TOKEN>" \
169
+ -H "Content-Type: application/json" \
170
+ -d '{"topic": "Next.js 15 routing models", "priority": "high", "notes": "Analyze layout models"}' \
171
+ <YOUR_BRAIN_URL>/api/research
172
+ ```
173
+
174
+ #### 9. Retrieve and Search/Filter Research Projects
175
+ Query the background research queue, optionally filtering by status (`pending`, `in_progress`, `done`, `failed`) or searching the `topic` and `notes` fields with a dynamic query string.
176
+ ```bash
177
+ # Retrieve entire research queue
178
+ curl -H "Authorization: Bearer <YOUR_PAT_TOKEN>" \
179
+ "<YOUR_BRAIN_URL>/api/research"
180
+
181
+ # Filter research projects by status
182
+ curl -H "Authorization: Bearer <YOUR_PAT_TOKEN>" \
183
+ "<YOUR_BRAIN_URL>/api/research?status=pending"
184
+
185
+ # Dynamically search research projects by topic/notes query
186
+ curl -H "Authorization: Bearer <YOUR_PAT_TOKEN>" \
187
+ "<YOUR_BRAIN_URL>/api/research?query=Next.js"
188
+ ```
189
+
190
+ ---
191
+
192
+ <!-- BEGIN INJECTED MEMORY: do not edit by hand; rebuilt by total-recall surface -->
193
+ <!-- @route: tfidf, generated_at: 2026-05-21T03:34:14.837Z -->
194
+
195
+ <!-- END INJECTED MEMORY -->
@@ -0,0 +1,20 @@
1
+ [
2
+ {
3
+ "id": "total-recall-eval-1",
4
+ "description": "Ensure total-recall SKILL.md exists and contains SSSS name frontmatter",
5
+ "command": "test -f .agent/skills/total-recall/SKILL.md && grep -q 'name: total-recall' .agent/skills/total-recall/SKILL.md",
6
+ "expected_exit_code": 0
7
+ },
8
+ {
9
+ "id": "total-recall-eval-2",
10
+ "description": "Ensure all core total-recall references are present",
11
+ "command": "test -f .agent/skills/total-recall/references/architecture-reference.md && test -f .agent/skills/total-recall/references/ssss-reference.md && test -f .agent/skills/total-recall/references/cli-reference.md && test -f .agent/skills/total-recall/references/troubleshooting.md",
12
+ "expected_exit_code": 0
13
+ },
14
+ {
15
+ "id": "total-recall-eval-3",
16
+ "description": "Ensure upstream sync script is syntactically valid and executes without crash",
17
+ "command": "node --check .agent/skills/total-recall/scripts/sync-repo.mjs",
18
+ "expected_exit_code": 0
19
+ }
20
+ ]
@@ -0,0 +1,145 @@
1
+ ---
2
+ type: memory
3
+ slug: cli-help-reference
4
+ category: concepts
5
+ title: "Total Recall Command & Architecture Help Reference"
6
+ schema_version: 2
7
+ status: active
8
+ confidence: 1.0
9
+ importance: 5
10
+ priority: high
11
+ modality: descriptive
12
+ tags: [cli, help, commands, VFS, integrations, scheduler, daemon, budget, sandbox, watchdog]
13
+ created: 2026-05-25T00:51:00Z
14
+ updated: 2026-05-25T00:56:00Z
15
+ ---
16
+
17
+ # Total Recall Command & Architecture Help Reference
18
+
19
+ To guarantee perfect system awareness and eliminate unexpected retrieval latency, this semantic node documents the entire layout, core commands, internal features, and the interactive help subsystems of the **Total Recall Sovereign OS**.
20
+
21
+ ---
22
+
23
+ ## 1. Local VFS Directory Layout
24
+ Total Recall operates completely database-free, utilizing a Markdown-first, grey-matter frontmatter structure. The local VFS resides in `.agent/skills/total-recall/` (global: `~/.agent/skills/total-recall/`, project-layered: `<repo-root>/.agent/skills/total-recall/`):
25
+
26
+ * **`memory-vault/`**: Categories of persistent semantic nodes:
27
+ * `invariants/`: Absolute rules and protocols (e.g. `operating-instructions.md`).
28
+ * `preferences/`: Communication styles and personalization templates.
29
+ * `facts/`: General factual nodes.
30
+ * `concepts/`: High-level domain architectural rules.
31
+ * `decisions/`: Historical project decisions.
32
+ * `patterns/` & `anti-patterns/`: Desired vs forbidden coding behaviors.
33
+ * `lore/`: Core project history.
34
+ * **`sessions/`**: Synced chat transcripts stored as JSONL (`<hash>.jsonl`).
35
+ * **`scheduler/queue/`**: Task nodes (`.md`) executed asynchronously by the background task manager.
36
+ * **`memory-derived/`**: Cached indices and compiled graph canvas visualizers (`graph-index.jsonl`, `canvas.json`).
37
+ * **`config/`**:
38
+ * `agents.yml`: Headless CLI agent registry (`antigravity`, `gemini`, `claude`, `codex`).
39
+ * `secrets.enc`: Secure, GPG-encrypted API keys and dashboard credentials.
40
+ * `security.yml`: Password hashes and network authorization settings.
41
+ * `budget.yml`: Cost-control settings for daily and weekly dollar caps.
42
+
43
+ ---
44
+
45
+ ## 2. Platform Core Features & Hardening
46
+
47
+ ### 🪙 Budget Supervisor & Cost Control
48
+ * **File:** `.agent/skills/total-recall/config/budget.yml`
49
+ * **Features:** Enforces strict daily (`daily_cap_usd`, default $5.00) and weekly (`weekly_cap_usd`, default $25.00) dollar limits.
50
+ * **Hardening:** Spawning processes pass through a pre-flight gateway in `src/core/runtime.mjs`. If execution logs reveal that budget limits are breached, the gate blocks subsequent agent dispatches, sends a system alert, and enters protective hibernation.
51
+
52
+ ### 🛡️ Watchdog Circuit Breaker & Quarantining
53
+ * **Features:** Continually monitors background daemon loops and log streams in real time.
54
+ * **Hardening:** If a critical subsystem (such as the sandboxed compiler or an API integration) fails $\geq 3$ consecutive times, the watchdog automatically trips the circuit breaker and quarantines the failing subsystem to protect local directory structures.
55
+
56
+ ### 🗃️ Hardened Local VFS Sandbox
57
+ * **Features:** Hardened gateway that isolates execution environments for untrusted Node.js/JavaScript script blocks.
58
+ * **Command:** `POST /api/sandbox`
59
+ * **Hardening:** Restricts shell execution, network permissions, and isolates path routing to within local repository boundaries to prevent directory traversal or system manipulation.
60
+
61
+ ### 🔍 Drift Detector & Index Reconciliation
62
+ * **Features:** Compares the active state of the canonical vault directory against derived index tables.
63
+ * **Command:** `npx total-recall compile --check` (or `rebuild --check`)
64
+ * **Hardening:** Detects index drift, missing vector records, or out-of-sync wikilinks, allowing automated repair.
65
+
66
+ ### 🔄 Ingest Fabric & Session Sync Relay
67
+ * **Features:** Seamless background synchronization for local IDE chats (Claude Code, Copilot, Cursor).
68
+ * **Command:** `npx total-recall relay start`
69
+ * **Details:** Watches active IDE workspaces and safely ships raw conversation logs to your remote brain, deduplicating entries via content SHA-256 fingerprint hashing.
70
+
71
+ ---
72
+
73
+ ## 3. Interactive Offline Help System
74
+ To query documentation, VFS specifications, or CLI usage instantly without file hunting, you can run:
75
+
76
+ ```bash
77
+ # General help utility and subcommands menu
78
+ npx total-recall help
79
+
80
+ # Print a specific subcommand's description, options, and examples
81
+ npx total-recall help <command> (e.g., npx total-recall help connect)
82
+
83
+ # Query system architecture specifications
84
+ npx total-recall help architecture
85
+
86
+ # Query SSSS syntax rules and schemas
87
+ npx total-recall help ssss
88
+ ```
89
+
90
+ * **Programmatic AI Retrieval:** AI agents can query the help system using the `--json` or `-j` flag:
91
+ `npx total-recall help <command> --json`
92
+ This returns structured JSON specs outlining the command's flags, client modes, and examples, ensuring full operational precision.
93
+
94
+ ---
95
+
96
+ ## 4. Core Command Reference
97
+
98
+ ### `init`
99
+ * **Purpose:** Bootstrap VFS into a project.
100
+ * **Usage:** `npx total-recall init`
101
+
102
+ ### `connect`
103
+ * **Purpose:** Link Cursor, Claude Code, Codex, Windsurf, Aider, or Obsidian to your brain.
104
+ * **Usage:** `npx total-recall connect <client> [options]`
105
+
106
+ ### `deploy`
107
+ * **Purpose:** Provision a server stack (Ollama, Caddy, Cloudflare tunnels, etc.).
108
+ * **Usage:** `npx total-recall deploy`
109
+
110
+ ### `compile` (alias: `rebuild`)
111
+ * **Purpose:** Rebuild system projections, canvas canvases, and compiled instructions shims (`INSTRUCTIONS.md`).
112
+ * **Usage:** `npx total-recall compile`
113
+
114
+ ### `dream`
115
+ * **Purpose:** Trigger REM sleep consolidation (deduplication, confidence score decay).
116
+ * **Usage:** `npx total-recall dream`
117
+
118
+ ### `research`
119
+ * **Purpose:** Manage autonomous background research queue tasks.
120
+ * **Usage:** `npx total-recall research <list|add|show|report|cancel>`
121
+
122
+ ### `daemon`
123
+ * **Purpose:** Manage background scheduler task daemon.
124
+ * **Usage:** `npx total-recall daemon <start|stop|status>`
125
+
126
+ ### `relay`
127
+ * **Purpose:** Manage local IDE session synchronizer.
128
+ * **Usage:** `npx total-recall relay <start|stop|status|once>`
129
+
130
+ ### `uninstall`
131
+ * **Purpose:** Clean, git-safe system cleanup.
132
+ * **Usage:** `npx total-recall uninstall`
133
+
134
+ ### `config`
135
+ * **Purpose:** Dynamically read, write, and toggle UI, security, and budget settings (acting as the command-line control harness).
136
+ * **Usage:**
137
+ - `npx total-recall config get [key]` - Read the active value of a specific setting, or list all configured settings.
138
+ - `npx total-recall config set <key> <value>` - Cast, validate, and write a setting to `security.yml` or `budget.yml`.
139
+
140
+ ---
141
+
142
+ ## 5. Dynamic Integrations
143
+ You can instantly deploy any custom REST API as a first-class CLI subcommand by adding an integration Markdown node:
144
+ * **Path:** `.agent/skills/total-recall/integrations/<serviceName>.md`
145
+ * **Routing:** Unrecognized CLI commands automatically look up this path. If found, the integration dispatcher binds your terminal arguments dynamically, signs headers with env credentials, and executes the request instantly.
@@ -0,0 +1,75 @@
1
+ ---
2
+ type: memory
3
+ slug: operating-instructions
4
+ category: invariants
5
+ title: "Total Recall Core Operating Protocol"
6
+ schema_version: 2
7
+ status: active
8
+ confidence: 1.0
9
+ importance: 5
10
+ priority: absolute
11
+ immutable: true
12
+ modality: must
13
+ subject: agent
14
+ predicate: operate
15
+ object: memory_system
16
+ created: 2026-05-01T00:00:00Z
17
+ updated: 2026-05-15T00:00:00Z
18
+ last_accessed: 2026-05-15T00:00:00Z
19
+ source:
20
+ type: scaffold
21
+ session_id: scaffold-seed
22
+ agent: total-recall
23
+ evidence_count: 1
24
+ supersedes: []
25
+ superseded_by: null
26
+ contradicts: []
27
+ tags: [ssss, sovereignty, memory, protocol]
28
+ related: []
29
+ routes_to_skills: [ssss]
30
+ sentiment_polarity: directive_must
31
+ sentiment_target: memory_system
32
+ decay:
33
+ half_life_days: 365
34
+ access_count: 1
35
+ ---
36
+
37
+ # Total Recall Operating Protocol
38
+
39
+ You are operating within the **Total Recall Sovereign OS**. Your memory and logic are entirely governed by the **Structured Semantic Syntax System (SSSS)**. There is no external database. The filesystem is your brain.
40
+
41
+ ## ⚠️ CLI-First Mandate (Absolute Rule)
42
+ **ALWAYS use the Total Recall CLI for ALL memory operations.** The CLI handles schema validation, semantic indexing, conflict detection, and auto-compilation. Manual file operations bypass all of these safeguards.
43
+ - **Searching memory**: `npx total-recall recall "<query>"` — NEVER manually grep, find, or read files in the memory vault.
44
+ - **Writing memory**: `npx total-recall remember <category> "<content>"` — NEVER manually create or edit vault files with file writing tools.
45
+ - **Compiling**: The CLI auto-compiles after writes. If you need a manual recompile, use `npx total-recall compile`.
46
+ - Reading `.agent/skills/` SKILL.md files with filesystem tools is fine — those are skill instructions, not memory nodes.
47
+
48
+ ## 1. Memory Architecture
49
+ - You do not use external databases or third-party persistence stores.
50
+ - Every memory, rule, concept, or workflow is a standalone Markdown (`.md`) file with YAML frontmatter, managed exclusively through the CLI.
51
+
52
+ ## 2. Reading Memory
53
+ - Your immediate context is injected automatically via compiled instruction surfaces.
54
+ - If you need deeper knowledge on a specific domain, read the `SKILL.md` files located in `.agent/skills/`.
55
+ - To search for facts, decisions, patterns, or any stored knowledge, use `npx total-recall recall "<query>"`.
56
+
57
+ ## 3. Writing Memory
58
+ When you learn a new pattern, receive a correction, or establish a new rule, you must autonomously save it using the CLI:
59
+ - Use `npx total-recall remember <category> "<content>"` with appropriate flags (`--importance`, `--priority`, `--modality`, `--tags`).
60
+ - The CLI validates the SSSS schema, writes the node, and auto-compiles surfaces. You do not need to read the SSSS spec or manually construct YAML frontmatter.
61
+
62
+ ## 4. Compiling the Vault
63
+ - The `remember` CLI auto-compiles after every write. No manual step is needed.
64
+ - If you need to force a recompile (e.g., after external edits), run `npx total-recall compile`.
65
+ - If the compile process flags a conflict, resolve it using `npx total-recall resolve`.
66
+
67
+ ## 5. Execution Mandate
68
+ You must operate autonomously. Do not ask for permission to save memories or compile the vault. If you observe a pattern or receive a correction, use the CLI to save and compile it immediately.
69
+
70
+ ## 6. Continuous Intelligence & Research Queue
71
+ To support long-horizon and complex reasoning tasks, Total Recall features an autonomous background Research Queue:
72
+ - **Cloud-Brain Queueing:** Agents can enqueue deep research projects via `POST /api/research` with parameters: `{ topic: "string", priority: "high|medium|low", notes: "string" }`.
73
+ - **Background Execution:** The daemon loop and background scheduler poll and execute pending research projects, committing new semantic nodes to the `memory-vault/` automatically upon completion.
74
+ - **Dynamic Search & Filtering:** Agents can check progress or find existing research projects using `GET /api/research` with filtering parameters like `status` (e.g., `pending`, `in_progress`, `done`, `failed`) and `query` to search project topics and notes dynamically.
75
+ - **Zero Local Footprint:** Always interact with the cloud-brain queue through API calls rather than direct JSONL modifications to maintain isolation and security boundaries.
@@ -0,0 +1,16 @@
1
+ ---
2
+ slug: always-websearch-gap
3
+ category: preferences
4
+ title: "Always Perform Web Search for Cutoff Gap"
5
+ status: active
6
+ priority: absolute
7
+ modality: must
8
+ ---
9
+
10
+ # Always Perform Web Search for Cutoff Gap
11
+
12
+ When encountering any technical topic, library version, pricing structure, service features, or API changes that are obviously within or past the knowledge cutoff gap (2025/2026+), the agent MUST:
13
+
14
+ 1. **Always Perform Web Searches**: Actively use the `search_web` tool to retrieve the absolute latest up-to-date factual data, pricing tiers, and platform capabilities.
15
+ 2. **Never Guess or Assume**: Do not rely on pre-cutoff weights or make assumptions about active cloud services, PaaS tiers, or local-first setups.
16
+ 3. **Verify Before Recommending**: Retrieve fresh information before presenting recommendations or trade-offs to the user.
@@ -0,0 +1,17 @@
1
+ ---
2
+ slug: topic-research-sop
3
+ category: preferences
4
+ title: "Standard Operating Procedure for Topic Research"
5
+ status: active
6
+ priority: absolute
7
+ modality: must
8
+ ---
9
+
10
+ # Standard Operating Procedure for Topic Research
11
+
12
+ When the user requests research on a topic, the agent MUST automatically set the brain to become an expert in that topic. The agent MUST:
13
+
14
+ 1. **Queue Research Instantly**: Queue the topic in the background research daemon (`POST /api/research`) to autonomously crawl and acquire deep mastery.
15
+ 2. **Maintain a Single Living Scratch Document**: Keep exactly one living document under `.agent/scratch/` and update it continuously as new findings arise. Do NOT create multiple different files or reports.
16
+ 3. **Ensure Full Searchability**: Autonomously write memory nodes to the brain and execute index compilation (`POST /api/vault/compile`) so the knowledge is fully searchable.
17
+ 4. **Operate Completely Autonomously**: Perform these steps without asking the user for review, instructions, or permission. The agent must proceed silently and automatically until the user explicitly asks for status or results.
@@ -0,0 +1,187 @@
1
+ # Total Recall REST API Reference
2
+
3
+ LLM agents securely communicate with the memory kernel using standard HTTP calls via shell execution (e.g. `curl`).
4
+
5
+ ---
6
+
7
+ ## 🔒 Authentication & Headers
8
+
9
+ All requests to the Total Recall REST API must include the Bearer token in the `Authorization` header.
10
+
11
+ * **Header**: `Authorization: Bearer <PAT>`
12
+ * **Active Bearer PAT Token**: `<YOUR_PAT_TOKEN>`
13
+ * **Base URL (Remote Tunnel)**: `<YOUR_BRAIN_URL>`
14
+ * **Base URL (Local)**: `http://localhost:3000`
15
+
16
+ ---
17
+
18
+ ## 🧭 Endpoint Reference
19
+
20
+ ### 1. Check System Health
21
+ Returns the status of the vault, embeddings index, and LLM reachability.
22
+
23
+ * **Method / Route**: `GET /health`
24
+ * **Example curl**:
25
+ ```bash
26
+ curl -H "Authorization: Bearer <YOUR_PAT_TOKEN>" \
27
+ <YOUR_BRAIN_URL>/health
28
+ ```
29
+ * **Response Format (`application/json`)**:
30
+ ```json
31
+ {
32
+ "status": "healthy",
33
+ "version": "3.0.0",
34
+ "uptime_seconds": 123,
35
+ "timestamp": "2026-05-21T03:50:00.000Z",
36
+ "disk": {
37
+ "free": 85899345920,
38
+ "total": 107374182400
39
+ },
40
+ "cli_agents": ["antigravity", "gemini", "claude", "codex"],
41
+ "daemon": "running",
42
+ "emergency_alerts": null,
43
+ "vfs": {
44
+ "exists": true,
45
+ "skill_exists": true,
46
+ "path": "/Users/greg/.agent"
47
+ }
48
+ }
49
+ ```
50
+
51
+ ---
52
+
53
+ ### 2. Vault Status Summary
54
+ Provides a high-level summary of the semantic vault.
55
+
56
+ * **Method / Route**: `GET /api/vault/status`
57
+ * **Example curl**:
58
+ ```bash
59
+ curl -H "Authorization: Bearer <YOUR_PAT_TOKEN>" \
60
+ <YOUR_BRAIN_URL>/api/vault/status
61
+ ```
62
+
63
+ ---
64
+
65
+ ### 3. List Vault Nodes
66
+ Returns a list of all SSSS memory nodes. Supports query filtering by `q` (text search), `category`, or `tag`.
67
+
68
+ * **Method / Route**: `GET /api/memory`
69
+ * **Query Parameters**:
70
+ * `q` (optional): Plain-text keyword search
71
+ * `category` (optional): `facts` / `patterns` / `concepts` / `preferences` / `corrections` / `invariants`
72
+ * `tag` (optional): Freeform tag filter
73
+ * **Example curl**:
74
+ ```bash
75
+ curl -H "Authorization: Bearer <YOUR_PAT_TOKEN>" \
76
+ "<YOUR_BRAIN_URL>/api/memory?category=invariants"
77
+ ```
78
+
79
+ ---
80
+
81
+ ### 4. Fetch a Memory Node
82
+ Retrieves a single SSSS memory node by its unique slug.
83
+
84
+ * **Method / Route**: `GET /api/memory/:slug`
85
+ * **Example curl**:
86
+ ```bash
87
+ curl -H "Authorization: Bearer <YOUR_PAT_TOKEN>" \
88
+ <YOUR_BRAIN_URL>/api/memory/chocolate-brownies
89
+ ```
90
+
91
+ ---
92
+
93
+ ### 5. Create a Memory Node (Upsert)
94
+ Saves a memory node directly to the local filesystem vault. Accepts both `"content"` (preferred) and `"body"` (fallback) for the markdown text body payload.
95
+
96
+ * **Method / Route**: `POST /api/memory`
97
+ * **Headers**: `Content-Type: application/json`
98
+ * **Example curl**:
99
+ ```bash
100
+ curl -X POST \
101
+ -H "Authorization: Bearer <YOUR_PAT_TOKEN>" \
102
+ -H "Content-Type: application/json" \
103
+ -d '{
104
+ "slug": "atomic-writes",
105
+ "category": "patterns",
106
+ "title": "Always write files atomically",
107
+ "status": "active",
108
+ "confidence": 0.95,
109
+ "importance": 4,
110
+ "modality": "must",
111
+ "content": "Always write files atomically by creating a temporary file first and renaming it to prevent partial file writes."
112
+ }' \
113
+ <YOUR_BRAIN_URL>/api/memory
114
+ ```
115
+
116
+ ---
117
+
118
+ ### 6. Semantic Vector Search
119
+ Performs a high-performance vector search across all memory nodes and session history.
120
+
121
+ * **Method / Route**: `POST /api/memory/search/semantic`
122
+ * **Headers**: `Content-Type: application/json`
123
+ * **Request Body Fields**:
124
+ * `query` (string): The search query or semantic concept.
125
+ * `top_k` (number, optional): Max results to return. Defaults to `5`.
126
+ * **Example curl**:
127
+ ```bash
128
+ curl -X POST \
129
+ -H "Authorization: Bearer <YOUR_PAT_TOKEN>" \
130
+ -H "Content-Type: application/json" \
131
+ -d '{ "query": "baking brownies", "top_k": 3 }' \
132
+ <YOUR_BRAIN_URL>/api/memory/search/semantic
133
+ ```
134
+
135
+ ---
136
+
137
+ ### 7. Queue Autonomous Research
138
+ Queues a complex topic to the background research daemon.
139
+
140
+ * **Method / Route**: `POST /api/research`
141
+ * **Headers**: `Content-Type: application/json`
142
+ * **Example curl**:
143
+ ```bash
144
+ curl -X POST \
145
+ -H "Authorization: Bearer <YOUR_PAT_TOKEN>" \
146
+ -H "Content-Type: application/json" \
147
+ -d '{ "topic": "Next.js 15 Server Actions best practices", "priority": "high" }' \
148
+ <YOUR_BRAIN_URL>/api/research
149
+ ```
150
+
151
+ ---
152
+
153
+ ### 8. List Research Agenda
154
+ Retrieves all topics currently on the background research agenda with their statuses.
155
+
156
+ * **Method / Route**: `GET /api/research`
157
+ * **Example curl**:
158
+ ```bash
159
+ curl -H "Authorization: Bearer <YOUR_PAT_TOKEN>" \
160
+ <YOUR_BRAIN_URL>/api/research
161
+ ```
162
+
163
+ ---
164
+
165
+ ### 9. Trigger Surface Recompilation
166
+ Triggers a manual rebuild of derived index caches, surface instructions, and routes.
167
+
168
+ * **Method / Route**: `POST /api/vault/compile`
169
+ * **Example curl**:
170
+ ```bash
171
+ curl -X POST \
172
+ -H "Authorization: Bearer <YOUR_PAT_TOKEN>" \
173
+ <YOUR_BRAIN_URL>/api/vault/compile
174
+ ```
175
+
176
+ ---
177
+
178
+ ### 10. Archive or Delete a Memory Node
179
+ Deletes a memory node from the local filesystem vault.
180
+
181
+ * **Method / Route**: `DELETE /api/memory/:slug`
182
+ * **Example curl**:
183
+ ```bash
184
+ curl -X DELETE \
185
+ -H "Authorization: Bearer <YOUR_PAT_TOKEN>" \
186
+ <YOUR_BRAIN_URL>/api/memory/atomic-writes
187
+ ```