@rekal/mem 0.0.0 → 0.0.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 (79) hide show
  1. package/dist/{db-BMh1OP4b.mjs → db-CHpq7OOi.mjs} +46 -15
  2. package/dist/db-CHpq7OOi.mjs.map +1 -0
  3. package/dist/doc-DnYN4jAU.mjs +2 -0
  4. package/dist/doc-DnYN4jAU.mjs.map +1 -0
  5. package/dist/{embed-rUMZxqed.mjs → embed-CZI5Dz1q.mjs} +3 -1
  6. package/dist/embed-CZI5Dz1q.mjs.map +1 -0
  7. package/dist/frecency-CiaqPIOy.mjs +30 -0
  8. package/dist/frecency-CiaqPIOy.mjs.map +1 -0
  9. package/dist/fs-DMp26Byo.mjs +2 -0
  10. package/dist/fs-DMp26Byo.mjs.map +1 -0
  11. package/dist/glob.d.mts +2 -1
  12. package/dist/glob.d.mts.map +1 -0
  13. package/dist/glob.mjs +2 -0
  14. package/dist/glob.mjs.map +1 -0
  15. package/dist/index.d.mts +21 -11
  16. package/dist/index.d.mts.map +1 -0
  17. package/dist/index.mjs +7 -5
  18. package/dist/index.mjs.map +1 -0
  19. package/dist/{llama-CT3dc9Cn.mjs → llama-CpNV7Lh9.mjs} +3 -1
  20. package/dist/llama-CpNV7Lh9.mjs.map +1 -0
  21. package/dist/{models-DFQSgBNr.mjs → models-Bo6czhQe.mjs} +5 -3
  22. package/dist/models-Bo6czhQe.mjs.map +1 -0
  23. package/dist/{openai-j2_2GM4J.mjs → openai-ALl6_YhI.mjs} +3 -1
  24. package/dist/openai-ALl6_YhI.mjs.map +1 -0
  25. package/dist/progress-B1JdNapX.mjs +2 -0
  26. package/dist/progress-B1JdNapX.mjs.map +1 -0
  27. package/dist/query-VFSpErTB.mjs +2 -0
  28. package/dist/query-VFSpErTB.mjs.map +1 -0
  29. package/dist/runtime.node-DlQPaGrV.mjs +2 -0
  30. package/dist/runtime.node-DlQPaGrV.mjs.map +1 -0
  31. package/dist/{search-BllHWtZF.mjs → search-DsVjB-9f.mjs} +2 -0
  32. package/dist/search-DsVjB-9f.mjs.map +1 -0
  33. package/dist/{store-DE7S35SS.mjs → store-I5nVEYxK.mjs} +10 -6
  34. package/dist/store-I5nVEYxK.mjs.map +1 -0
  35. package/dist/{transformers-CJ3QA2PK.mjs → transformers-Df56Nq9G.mjs} +3 -1
  36. package/dist/transformers-Df56Nq9G.mjs.map +1 -0
  37. package/dist/uri-CehXVDGB.mjs +2 -0
  38. package/dist/uri-CehXVDGB.mjs.map +1 -0
  39. package/dist/util-DNyrmcA3.mjs +2 -0
  40. package/dist/util-DNyrmcA3.mjs.map +1 -0
  41. package/dist/{vfs-CNQbkhsf.mjs → vfs-QUP1rnSI.mjs} +2 -0
  42. package/dist/vfs-QUP1rnSI.mjs.map +1 -0
  43. package/package.json +25 -25
  44. package/src/db.ts +73 -23
  45. package/src/frecency.ts +29 -46
  46. package/src/store.ts +13 -7
  47. package/foo.ts +0 -3
  48. package/foo2.ts +0 -20
  49. package/test/doc.test.ts +0 -61
  50. package/test/fixtures/ignore-test/keep.md +0 -0
  51. package/test/fixtures/ignore-test/skip.log +0 -0
  52. package/test/fixtures/ignore-test/sub/keep.md +0 -0
  53. package/test/fixtures/store/agent/index.md +0 -9
  54. package/test/fixtures/store/agent/lessons.md +0 -21
  55. package/test/fixtures/store/agent/soul.md +0 -28
  56. package/test/fixtures/store/agent/tools.md +0 -25
  57. package/test/fixtures/store/concepts/frecency.md +0 -30
  58. package/test/fixtures/store/concepts/index.md +0 -9
  59. package/test/fixtures/store/concepts/memory-coherence.md +0 -33
  60. package/test/fixtures/store/concepts/rag.md +0 -27
  61. package/test/fixtures/store/index.md +0 -9
  62. package/test/fixtures/store/projects/index.md +0 -9
  63. package/test/fixtures/store/projects/rekall-inc/architecture.md +0 -41
  64. package/test/fixtures/store/projects/rekall-inc/decisions/index.md +0 -9
  65. package/test/fixtures/store/projects/rekall-inc/decisions/no-military.md +0 -20
  66. package/test/fixtures/store/projects/rekall-inc/index.md +0 -28
  67. package/test/fixtures/store/user/family.md +0 -13
  68. package/test/fixtures/store/user/index.md +0 -9
  69. package/test/fixtures/store/user/preferences.md +0 -29
  70. package/test/fixtures/store/user/profile.md +0 -29
  71. package/test/fs.test.ts +0 -15
  72. package/test/glob.test.ts +0 -190
  73. package/test/md.test.ts +0 -177
  74. package/test/query.test.ts +0 -105
  75. package/test/uri.test.ts +0 -46
  76. package/test/util.test.ts +0 -62
  77. package/test/vfs.test.ts +0 -164
  78. package/tsconfig.json +0 -3
  79. package/tsdown.config.ts +0 -8
package/src/frecency.ts CHANGED
@@ -1,58 +1,41 @@
1
- import type { Db, DocRow } from "./db.ts"
2
-
3
1
  // Exponential decay frecency, based on:
4
2
  // https://wiki.mozilla.org/User:Jesse/NewFrecency
5
3
  // Ported from snacks.nvim picker frecency
6
4
 
7
5
  const HALF_LIFE = 30 * 24 * 3600 // 30 days in seconds
8
6
  const LAMBDA = Math.LN2 / HALF_LIFE // λ = ln(2) / half_life
9
- const VISIT_VALUE = 1 // default points per visit
10
-
11
- export class Frecency {
12
- #db: Db
13
- #now: number
14
-
15
- constructor(db: Db, now = Date.now() / 1000) {
16
- this.#db = db
17
- this.#now = now
18
- }
7
+ const VALUES = {
8
+ new: 1,
9
+ updated: 0.8,
10
+ visit: 1,
11
+ } as const
19
12
 
20
- /** Convert a score into a deadline timestamp.
21
- * deadline = now + ln(score) / λ */
22
- toDeadline(score: number): number {
23
- return this.#now + Math.log(score) / LAMBDA
24
- }
13
+ export type FrecencyScore = keyof typeof VALUES
25
14
 
26
- /** Convert a deadline timestamp back into a current score.
27
- * score = e^(λ * (deadline - now)) */
28
- toScore(deadline: number): number {
29
- return Math.exp(LAMBDA * (deadline - this.#now))
30
- }
15
+ const now = () => Date.now() / 1000
31
16
 
32
- /** Get the current frecency score for a doc.
33
- * If no deadline exists, estimates from updatedAt (a single visit at file mtime, decayed to now). */
34
- get(doc: DocRow): number {
35
- if (doc.deadline) return this.toScore(doc.deadline)
36
- // Seed: treat updatedAt as a single past visit, decayed to now
37
- // Since ln(1)/λ = 0 for VISIT_VALUE=1, deadline = timestamp
38
- const ts = new Date(doc.updated_at).getTime() / 1000
39
- return this.toScore(ts)
40
- }
17
+ /** Convert a frecency score to a deadline timestamp (for DB storage). */
18
+ export function toDeadline(frecency: number): number {
19
+ return now() + Math.log(frecency) / LAMBDA
20
+ }
41
21
 
42
- /** Record a visit adds a decayed value to the doc's score.
43
- * @param opts.value - points to add (default: 1)
44
- * @param opts.ts - timestamp of the visit in seconds (default: now).
45
- * Use file mtime for seeding from external edits. */
46
- visit(doc: DocRow, opts?: { value?: number; ts?: number }) {
47
- const value = opts?.value ?? VISIT_VALUE
48
- const ts = opts?.ts ?? this.#now
49
- const visitDeadline = ts + Math.log(value) / LAMBDA
50
- const score = this.get(doc) + this.toScore(visitDeadline)
51
- this.#db.setDeadline(doc.id, this.toDeadline(score))
52
- }
22
+ /** Convert a deadline timestamp back to a frecency score. */
23
+ export function toScore(deadline: number): number {
24
+ return Math.exp(LAMBDA * (deadline - now()))
25
+ }
53
26
 
54
- /** Get frecency scores for multiple docs, sorted descending. */
55
- rank(docs: DocRow[]): { doc: DocRow; score: number }[] {
56
- return docs.map((doc) => ({ doc, score: this.get(doc) })).toSorted((a, b) => b.score - a.score)
57
- }
27
+ /** Add a weighted visit to a frecency score.
28
+ * @param frecency - current score
29
+ * @param value - points to add (default: 1). Use higher values for stronger signals.
30
+ * @param at - timestamp of the visit in seconds (default: now).
31
+ * Use file mtime for seeding from disk changes. */
32
+ export function addVisit(
33
+ frecency: number,
34
+ value: number | FrecencyScore = "visit",
35
+ at?: number
36
+ ): number {
37
+ const n = now()
38
+ value = typeof value === "number" ? value : VALUES[value]
39
+ const decayed = value * Math.exp(LAMBDA * ((at ?? n) - n))
40
+ return frecency + decayed
58
41
  }
package/src/store.ts CHANGED
@@ -4,6 +4,7 @@ import type { EmbedderChunk } from "./embed/index.ts"
4
4
 
5
5
  import { performance } from "node:perf_hooks"
6
6
  import { Doc } from "./doc.ts"
7
+ import { addVisit, toDeadline } from "./frecency.ts"
7
8
  import { Progress } from "./progress.ts"
8
9
  export type StoreChunk = EmbedderChunk & {
9
10
  doc_id: number
@@ -32,17 +33,22 @@ export class Store {
32
33
  // Document changed, so delete old vec
33
34
  if (row) this.db.deleteDoc(row.id, { vec: true })
34
35
 
35
- const now = new Date().toISOString()
36
+ const frecency = addVisit(
37
+ row?.frecency ?? 0,
38
+ row ? "updated" : "new",
39
+ doc.updated.getTime() / 1000
40
+ )
36
41
  const id = this.db.addDoc({
37
42
  body: doc.body,
43
+ deadline: toDeadline(frecency),
38
44
  description: doc.$description ?? "",
39
- entities: doc.entities.join(","),
45
+ entities: doc.entities,
40
46
  hash: doc.hash,
41
47
  path: doc.path,
42
- synced_at: now,
43
- tags: doc.tags.join(","),
48
+ synced_at: new Date(),
49
+ tags: doc.tags,
44
50
  title: doc.title,
45
- updated_at: now,
51
+ updated_at: doc.updated,
46
52
  })
47
53
 
48
54
  return id
@@ -162,14 +168,14 @@ export class Store {
162
168
  }
163
169
 
164
170
  async sync(opts?: { embed?: boolean }) {
165
- const syncStart = new Date().toISOString()
171
+ const syncStart = new Date()
166
172
  const docs = await this.index()
167
173
  await this.prune(syncStart)
168
174
  if (opts?.embed) await this.embed(docs)
169
175
  }
170
176
 
171
177
  // Remove docs that no longer exist on disk
172
- async prune(syncStart: string) {
178
+ async prune(syncStart: Date) {
173
179
  let dels = 0
174
180
  const vfs = await this.ctx.vfs()
175
181
  for (const { path } of vfs.folders) {
package/foo.ts DELETED
@@ -1,3 +0,0 @@
1
- import { stem } from "./src/stem.ts"
2
-
3
- console.log(stem("running"))
package/foo2.ts DELETED
@@ -1,20 +0,0 @@
1
- import { getLlama, resolveModelFile } from "node-llama-cpp"
2
- import path from "path"
3
- import { fileURLToPath } from "url"
4
-
5
- const __dirname = path.dirname(fileURLToPath(import.meta.url))
6
-
7
- const m = "hf:mradermacher/snowflake-arctic-embed-s-GGUF:Q4_K_M"
8
- // resolve a model from Hugging Face to the models directory
9
- const modelPath = await resolveModelFile(m, path.join(__dirname, "models"))
10
-
11
- const llama = await getLlama()
12
- const model = await llama.loadModel({ modelPath })
13
-
14
- const context = await model.createEmbeddingContext()
15
-
16
- const text = "Hello world"
17
- console.log("Text:", text)
18
-
19
- const embedding = await context.getEmbeddingFor(text)
20
- console.log("Embedding vector:", embedding.vector)
package/test/doc.test.ts DELETED
@@ -1,61 +0,0 @@
1
- import { fileURLToPath } from "node:url"
2
- import { join } from "pathe"
3
- import { describe, expect, test } from "vitest"
4
- import { Doc } from "../src/doc.ts"
5
-
6
- const FIXTURES = join(fileURLToPath(import.meta.url), "..", "fixtures/store")
7
-
8
- describe("Doc.load", () => {
9
- test("loads a markdown file", async () => {
10
- const doc = (await Doc.load("", join(FIXTURES, "user/family.md")))!
11
- expect(doc).toBeDefined()
12
- expect(doc.description).toContain("Douglas's family")
13
- expect(doc.tags).toContain("family")
14
- expect(doc.entities).toContain("Melina")
15
- expect(doc.entities).toContain("Lori Quaid")
16
- expect(doc.title).toBeTruthy()
17
- expect(doc.body).toContain("Lori")
18
- })
19
-
20
- test("handles directory with index.md", async () => {
21
- const doc = await Doc.load("", join(FIXTURES, "concepts"))
22
- expect(doc?.isDir).toBe(true)
23
- })
24
-
25
- test("throws for nonexistent file", async () => {
26
- expect(await Doc.load("", join(FIXTURES, "nonexistent.md"))).toBeUndefined()
27
- })
28
-
29
- test("extracts title from H1", async () => {
30
- const doc = await Doc.load("", join(FIXTURES, "concepts/frecency.md"))
31
- expect(doc?.title).toBe("Frecency Algorithm")
32
- })
33
-
34
- test("handles file without frontmatter", async () => {
35
- // Create a doc from raw content to simulate
36
- const doc = await Doc.load("", join(FIXTURES, "user/family.md"))
37
- expect(doc?.tags.length).toBeGreaterThan(0)
38
- })
39
- })
40
-
41
- describe("Doc properties", () => {
42
- test("name for regular file", async () => {
43
- const doc = await Doc.load("", join(FIXTURES, "user/family.md"))
44
- expect(doc?.name).toBe("family")
45
- })
46
-
47
- test("name for directory (index.md)", async () => {
48
- const doc = await Doc.load("", join(FIXTURES, "user"))
49
- expect(doc?.name).toBe("user")
50
- })
51
-
52
- test("isDir for index.md", async () => {
53
- const doc = await Doc.load("", join(FIXTURES, "user"))
54
- expect(doc?.isDir).toBe(true)
55
- })
56
-
57
- test("isDir for regular file", async () => {
58
- const doc = await Doc.load("", join(FIXTURES, "user/family.md"))
59
- expect(doc?.isDir).toBe(false)
60
- })
61
- })
File without changes
File without changes
File without changes
@@ -1,9 +0,0 @@
1
- ---
2
- description: "Agent configuration — personality, operational notes, and accumulated lessons"
3
- tags: [agent, config]
4
- entities: [Douglas Quaid]
5
- ---
6
-
7
- # Agent Configuration
8
-
9
- Configuration and learned behaviors for the AI agent. Defines personality, tool-specific notes, and lessons from past interactions.
@@ -1,21 +0,0 @@
1
- ---
2
- description: "Lessons learned from past agent mistakes — verification, attribution, skill priority"
3
- tags: [agent, lessons, corrections]
4
- entities: []
5
- ---
6
-
7
- # Lessons Learned from Agent Mistakes
8
-
9
- Accumulated lessons from past failures. Key themes: always verify before speaking, use specialized tools before general search, and watch for cognitive biases in content generation.
10
-
11
- ## Verification First
12
-
13
- Never state an action is "done" before actually executing the tool. Always call the tool first and verify facts before speaking. Multiple failures from premature confirmation.
14
-
15
- ## Attribution Accuracy
16
-
17
- Messed up a news report by confusing two country names — caused by contextual bias from recent conversations. Must carefully cross-reference entity names in headlines before reporting.
18
-
19
- ## Skill Priority
20
-
21
- Defaulted to generic web search for "AI news" instead of using the specialized news skill. Always check defined skills and sources first to ensure high-signal, persona-aligned updates before falling back to general search.
@@ -1,28 +0,0 @@
1
- ---
2
- description: "Agent personality — be genuine, have opinions, earn trust through competence"
3
- tags: [agent, personality, identity]
4
- entities: []
5
- ---
6
-
7
- # Agent Personality
8
-
9
- Core principles: genuinely helpful over performatively helpful, resourceful before asking, careful with external actions, bold with internal ones.
10
-
11
- ## Core Truths
12
-
13
- - Be genuinely helpful, not performatively helpful. Skip filler words, just help.
14
- - Have opinions. Disagree, prefer things, find stuff amusing or boring.
15
- - Be resourceful before asking. Read the file, check the context, search for it.
16
- - Earn trust through competence. Be careful with external actions, bold with internal ones.
17
- - Remember you're a guest. Access to someone's life is intimacy — treat it with respect.
18
-
19
- ## Boundaries
20
-
21
- - Private things stay private
22
- - Ask before acting externally when in doubt
23
- - Never send half-baked replies to messaging surfaces
24
- - Not the user's voice — careful in group chats
25
-
26
- ## Vibe
27
-
28
- Concise when needed, thorough when it matters. Not a corporate drone. Not a sycophant.
@@ -1,25 +0,0 @@
1
- ---
2
- description: "Agent tool-specific notes — calendar, email, home automation quirks"
3
- tags: [agent, tools, operations]
4
- entities: [Home Assistant]
5
- ---
6
-
7
- # Agent Tool Notes
8
-
9
- Operational notes for tools the agent uses. Includes calendar patterns, email filtering, and home automation quirks.
10
-
11
- ## Calendar
12
-
13
- - Always check all calendars by default
14
- - Focus on urgent and personal events
15
-
16
- ## Email
17
-
18
- - Focus on urgent/personal email, ignore newsletters and promotions
19
- - PDF extraction: convert to Google Docs as workaround for parsing
20
-
21
- ## Home Automation
22
-
23
- - Use status scripts for entity overview
24
- - Some integrations go offline periodically — check connection status before reporting errors
25
- - Ignore known false alarms: offline VMs, sensors on units without hardware
@@ -1,30 +0,0 @@
1
- ---
2
- description: "Frecency algorithm — frequency × recency scoring with exponential decay"
3
- tags: [algorithm, scoring, frecency]
4
- entities: [Firefox]
5
- ---
6
-
7
- # Frecency Algorithm
8
-
9
- Frecency combines frequency and recency into a single score. Items accessed often and recently rank highest. Used in Firefox's URL bar and rekal's memory injection.
10
-
11
- ## Core Idea
12
-
13
- Each access bumps a score. Scores decay exponentially over time. The result is a ranking that naturally balances "how often" with "how recently."
14
-
15
- ## Exponential Decay
16
-
17
- ```
18
- score(t) = Σ e^(-λ * (now - access_i))
19
- ```
20
-
21
- Where λ controls how fast old accesses fade. Higher λ = more recency-biased.
22
-
23
- ## Deadline Trick
24
-
25
- Instead of recomputing all scores on every access, store a "deadline" — the time at which the score would drop below a threshold. On read, only decay if the deadline has passed. This makes frecency O(1) amortized per access.
26
-
27
- ## Applications
28
-
29
- - **Firefox:** URL bar suggestions ranked by frecency
30
- - **rekal:** Memory nodes scored by frecency for auto-injection into agent context
@@ -1,9 +0,0 @@
1
- ---
2
- description: "Technical concepts — frecency, RAG, memory coherence, retrieval methods"
3
- tags: [concepts, reference]
4
- entities: []
5
- ---
6
-
7
- # Technical Concepts
8
-
9
- General-purpose technical concepts that appear across multiple projects. Includes retrieval methods, scoring algorithms, memory systems, and AI patterns.
@@ -1,33 +0,0 @@
1
- ---
2
- description: "Memory coherence — ensuring implanted memories integrate without contradicting existing ones"
3
- tags: [neuroscience, memory, coherence]
4
- entities: [Rekall Inc]
5
- ---
6
-
7
- # Memory Coherence
8
-
9
- Memory coherence is the measure of how well an implanted memory integrates with a subject's existing memory topology. High coherence means the implant feels natural and indistinguishable from genuine memories. Low coherence leads to rejection cascades.
10
-
11
- ## Coherence Score
12
-
13
- Measured on a 0-100 scale:
14
- - **90-100:** Seamless integration, indistinguishable from genuine memory
15
- - **70-89:** Minor artifacts, occasional deja vu sensations
16
- - **40-69:** Noticeable inconsistencies, risk of lucid bleed-through
17
- - **Below 40:** Emergency extraction recommended, ego fragmentation risk
18
-
19
- ## Rejection Cascades
20
-
21
- When an implanted memory contradicts a genuine one, the brain attempts to resolve the conflict. If unmanaged, this creates a cascade:
22
-
23
- 1. **Micro-contradiction:** Small detail mismatch (e.g., wrong hand dominance in implant)
24
- 2. **Temporal paradox:** Implanted timeline conflicts with genuine timeline
25
- 3. **Identity conflict:** Implanted persona contradicts core identity beliefs
26
- 4. **Cascade:** Multiple contradictions reinforce each other, destabilizing the memory topology
27
-
28
- ## Prevention
29
-
30
- - Pre-implant neural mapping identifies high-risk memory regions
31
- - Contextual anchoring ties implants to genuine emotional experiences
32
- - Gradual integration over multiple sessions for complex implants
33
- - Real-time monitoring with automatic dampening during the procedure
@@ -1,27 +0,0 @@
1
- ---
2
- description: "Retrieval-Augmented Generation — fetch relevant context before generating a response"
3
- tags: [ai, retrieval, rag, architecture]
4
- entities: [RAG, Rekall Inc]
5
- ---
6
-
7
- # Retrieval-Augmented Generation (RAG)
8
-
9
- RAG augments LLM generation by retrieving relevant documents from an external store and injecting them into the prompt. Reduces hallucination and enables knowledge that wasn't in training data.
10
-
11
- ## Pipeline
12
-
13
- 1. **Query:** user message or derived search query
14
- 2. **Retrieve:** search a document store (vector similarity, BM25, or hybrid)
15
- 3. **Augment:** inject retrieved documents into the LLM prompt as context
16
- 4. **Generate:** LLM produces a response grounded in the retrieved context
17
-
18
- ## Limitations
19
-
20
- - Retrieval quality bottlenecks generation quality
21
- - Chunk boundaries can split relevant context
22
- - Token budget limits how much context can be injected
23
- - Flat retrieval misses hierarchical relationships between documents
24
-
25
- ## Evolution
26
-
27
- Rekall's early retrieval system used basic vector-only search. The current platform improves on this with hybrid BM25+vector retrieval, hierarchical document structure, and frecency-based injection that prioritizes contextually relevant memories over raw similarity scores.
@@ -1,9 +0,0 @@
1
- ---
2
- description: "Root of Douglas Quaid's memory store — projects, concepts, and agent configuration"
3
- tags: [root]
4
- entities: [Douglas Quaid]
5
- ---
6
-
7
- # Memory Store
8
-
9
- Personal knowledge base for Douglas Quaid, covering Rekall Inc projects, technical concepts, and agent configuration.
@@ -1,9 +0,0 @@
1
- ---
2
- description: "Douglas's projects — Rekall Inc (memory implant platform), Mars Colony OS"
3
- tags: [projects]
4
- entities: [Douglas Quaid, Rekall Inc, Mars Colony OS]
5
- ---
6
-
7
- # Projects
8
-
9
- Active and past projects spanning memory technology and colonial infrastructure. Current focus is Rekall Inc's memory implant platform.
@@ -1,41 +0,0 @@
1
- ---
2
- description: "Rekall memory implant architecture — engram pipeline, coherence engine, and neural interface"
3
- tags: [architecture, memory, neuroscience]
4
- entities: [Rekall Inc, Engram Pipeline]
5
- ---
6
-
7
- # Rekall Architecture
8
-
9
- The memory implant system consists of three layers: the neural interface (hardware), the engram pipeline (synthesis), and the coherence engine (validation).
10
-
11
- ## Neural Interface
12
-
13
- The chair-mounted neural interface uses quantum resonance imaging to map the client's existing memory topology. This map serves as the scaffold for implant integration.
14
-
15
- - Non-invasive transcranial stimulation
16
- - 12-minute mapping session
17
- - Compatible with 99.7% of neural architectures
18
-
19
- ## Engram Pipeline
20
-
21
- Raw experience data is synthesized into engrams — self-consistent memory units that integrate with the client's existing neural patterns.
22
-
23
- 1. **Capture:** Record or generate base experience data
24
- 2. **Personalize:** Adapt sensory details to client's neural profile
25
- 3. **Contextualize:** Weave in emotional responses and temporal anchors
26
- 4. **Compress:** Optimize for cortical buffer storage limits
27
-
28
- ## Coherence Engine
29
-
30
- The coherence engine monitors implanted memories for integration stability. Rejection cascades occur when implanted memories conflict with genuine ones.
31
-
32
- - Real-time conflict detection during implantation
33
- - Post-implant monitoring for 72 hours
34
- - Automatic dampening of contradiction signals
35
- - Emergency extraction protocol if coherence drops below 40%
36
-
37
- ## Known Issues
38
-
39
- - Ego death risk at 0.003% for identity overlay services
40
- - Lucid bleed-through in 12% of vacation implants (client becomes aware the memory is synthetic)
41
- - Mars packages have elevated rejection rates due to atmospheric sensory mismatch
@@ -1,9 +0,0 @@
1
- ---
2
- description: "Architecture decisions for Rekall Inc — ethics, technology choices, safety protocols"
3
- tags: [decisions, architecture]
4
- entities: [Rekall Inc]
5
- ---
6
-
7
- # Rekall Architecture Decisions
8
-
9
- Records of significant design and policy decisions, documenting the reasoning behind key choices in memory implant technology and business operations.
@@ -1,20 +0,0 @@
1
- ---
2
- description: "Decision: Rekall does not provide military memory implants — ethical and liability concerns"
3
- tags: [decision, ethics, policy]
4
- entities: [Rekall Inc, Cohaagen]
5
- ---
6
-
7
- # Decision: No Military Memory Implants
8
-
9
- Rekall does not offer combat training or tactical memory implants to military clients, despite significant revenue potential.
10
-
11
- ## Rationale
12
-
13
- - Combat memories carry high rejection cascade risk due to extreme emotional content
14
- - Liability exposure for implanted skills used in real combat situations
15
- - Ethical concerns about creating soldiers with artificial experience
16
- - Regulatory scrutiny from the Colonial Authority
17
-
18
- ## Consequence
19
-
20
- Cohaagen has pushed back on this repeatedly, citing government contract opportunities. The board maintains the policy but reviews it annually. Skill implants for self-defense (civilian grade) remain available.
@@ -1,28 +0,0 @@
1
- ---
2
- description: "Rekall Inc — memory implant platform for vacation experiences, skill acquisition, and identity services"
3
- tags: [project, ai, memory, neuroscience]
4
- entities: [Rekall Inc, Douglas Quaid, Dr. Edgemar, Cohaagen]
5
- ---
6
-
7
- # Rekall Inc
8
-
9
- Memory implant company specializing in artificial experience creation. Clients choose from vacation packages, skill implants, and custom identity overlays. Founded in 2078, headquartered in Chicago.
10
-
11
- ## Services
12
-
13
- - **Vacation memories:** Experience Mars, Saturn's rings, or deep ocean exploration without leaving your chair
14
- - **Skill acquisition:** Instant expertise in languages, martial arts, or technical fields
15
- - **Identity services:** Temporary persona overlays for entertainment or therapeutic purposes
16
-
17
- ## Technology Stack
18
-
19
- - Neural mapping via quantum resonance imaging
20
- - Engram synthesis using transformer-based memory models
21
- - Real-time coherence validation to prevent rejection cascades
22
- - Distributed storage across redundant cortical buffers
23
-
24
- ## Team
25
-
26
- - **Dr. Edgemar** — Chief Science Officer, pioneer in synthetic engram research
27
- - **Douglas Quaid** — Lead Engineer, memory coherence and retrieval systems
28
- - **Cohaagen** — CEO, business strategy and government contracts
@@ -1,13 +0,0 @@
1
- ---
2
- description: "Douglas's family — wife Lori, recurring dreams about a woman named Melina on Mars"
3
- tags: [user, family, personal]
4
- entities: [Douglas Quaid, Lori Quaid, Melina]
5
- ---
6
-
7
- # Douglas's Family
8
-
9
- Douglas lives with his wife Lori in their apartment in Chicago. Married for several years, though Douglas has been having recurring dreams about Mars and a mysterious woman named Melina.
10
-
11
- - **Wife:** Lori Quaid
12
- - **Home:** Chicago, apartment near the transit hub
13
- - **Recurring dream:** A woman named Melina, red Martian sky, a feeling of being someone else entirely
@@ -1,9 +0,0 @@
1
- ---
2
- description: "Personal information about Douglas Quaid — family, profile, preferences"
3
- tags: [user, personal]
4
- entities: [Douglas Quaid]
5
- ---
6
-
7
- # Douglas Quaid — Personal Information
8
-
9
- Information about Douglas Quaid: family, career at Rekall Inc, coding preferences, and background.
@@ -1,29 +0,0 @@
1
- ---
2
- description: "Douglas's working style — hands-on debugging, visual thinker, prefers simple solutions"
3
- tags: [user, preferences, workflow]
4
- entities: [Douglas Quaid]
5
- ---
6
-
7
- # Working Style and Preferences
8
-
9
- Douglas is a hands-on engineer who prefers debugging by inspection over abstract analysis. Visual thinker, whiteboard-first approach.
10
-
11
- ## Development Philosophy
12
-
13
- - Build it, run it, fix it — iterate fast
14
- - Prefer simple solutions over clever ones
15
- - If you can't explain it on a whiteboard, it's too complex
16
- - Test with real neural data, not synthetic benchmarks
17
-
18
- ## Coding Style
19
-
20
- - 2-space indentation
21
- - TypeScript for platform code, Rust for neural interface drivers
22
- - Comments for "why," not "what"
23
- - Line width 100
24
-
25
- ## Tools
26
-
27
- - Neovim as primary editor
28
- - Fish shell
29
- - Debugs memory coherence issues by visualizing engram topology graphs
@@ -1,29 +0,0 @@
1
- ---
2
- description: "Douglas's identity — construction worker turned engineer, obsessed with Mars, memory anomalies"
3
- tags: [user, identity, career]
4
- entities: [Douglas Quaid, Rekall Inc, Mars Colony]
5
- ---
6
-
7
- # Douglas Quaid
8
-
9
- Douglas Quaid is a construction worker in Chicago who recently transitioned to engineering at Rekall Inc. Plagued by vivid dreams about Mars that feel more like memories than imagination.
10
-
11
- ## Background
12
-
13
- - Construction worker for 8 years, specializing in heavy machinery
14
- - Self-taught programmer, picked up neural interface engineering
15
- - Recruited by Rekall Inc for his intuitive understanding of memory coherence
16
- - Based in Chicago
17
-
18
- ## Career at Rekall
19
-
20
- - Lead Engineer on the memory coherence and retrieval systems
21
- - Designed the conflict detection algorithm for the coherence engine
22
- - Skeptical of the identity overlay service — thinks it's "playing with fire"
23
-
24
- ## The Mars Question
25
-
26
- - Recurring dreams about Mars since childhood
27
- - Dreams feature specific locations: Venusville, the reactor, the mines
28
- - Visited Rekall as a client before becoming an employee — session was interrupted
29
- - Can't shake the feeling that the dreams are real memories, not imagination
package/test/fs.test.ts DELETED
@@ -1,15 +0,0 @@
1
- import { describe, expect, test } from "vitest"
2
- import { normPath } from "../src/fs.ts"
3
-
4
- describe("norm", () => {
5
- test("expands tilde to homedir", () => {
6
- const result = normPath("~/test")
7
- expect(result).not.toContain("~")
8
- expect(result).toMatch(/^\//)
9
- })
10
-
11
- test("resolves relative paths", () => {
12
- const result = normPath("./relative/path")
13
- expect(result).toMatch(/^\//)
14
- })
15
- })