@contextline/contextline 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +178 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +716 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +695 -0
- package/dist/index.js.map +1 -0
- package/dist/postinstall.d.ts +2 -0
- package/dist/postinstall.js +11 -0
- package/dist/postinstall.js.map +1 -0
- package/docs/why-contextline.md +120 -0
- package/package.json +59 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/mcpServer.ts","../src/tools/dispatch.ts","../src/tools/appendFragment.ts","../src/config.ts","../src/paths.ts","../src/core/errors.ts","../src/core/atomicWrite.ts","../src/core/markdown.ts","../src/core/details.ts","../src/core/lock.ts","../src/tools/init.ts","../src/core/instructions.ts","../src/tools/hydrate.ts","../src/tools/inspect.ts","../src/tools/proposeCompaction.ts","../src/tools/readDeep.ts","../src/core/links.ts","../src/tools/readDetails.ts","../src/tools/updateDeepPointer.ts","../src/tools/updateIndexPointer.ts","../src/core/topology.ts","../src/tools/validateTopology.ts","../src/prompts/compilerPrompt.ts","../src/prompts/hydrationPrompt.ts","../src/index.ts"],"sourcesContent":["import { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { StdioServerTransport } from \"@modelcontextprotocol/sdk/server/stdio.js\";\nimport { contextlineInputSchema, dispatchContextline } from \"./tools/dispatch.js\";\nimport { compilerPrompt } from \"./prompts/compilerPrompt.js\";\nimport { hydrationPrompt } from \"./prompts/hydrationPrompt.js\";\n\nfunction textResult(data: unknown) {\n if (data && typeof data === \"object\" && \"display\" in data && typeof data.display === \"string\") {\n return {\n content: [{ type: \"text\" as const, text: data.display }],\n structuredContent: data as Record<string, unknown>\n };\n }\n return { content: [{ type: \"text\" as const, text: JSON.stringify(data, null, 2) }] };\n}\n\nexport function createServer() {\n const server = new McpServer({ name: \"contextline\", version: \"0.1.0\" });\n\n server.registerTool(\"contextline\", { inputSchema: contextlineInputSchema }, async (input) => textResult(await dispatchContextline(input as never)));\n\n server.registerPrompt(\"contextline_hydration_guide\", {}, () => ({\n messages: [{ role: \"user\", content: { type: \"text\", text: hydrationPrompt } }]\n }));\n server.registerPrompt(\"contextline_compile_update\", {}, () => ({\n messages: [{ role: \"user\", content: { type: \"text\", text: compilerPrompt } }]\n }));\n\n return server;\n}\n\nexport async function startServer() {\n const server = createServer();\n await server.connect(new StdioServerTransport());\n}\n","import { z } from \"zod\";\nimport { appendFragment } from \"./appendFragment.js\";\nimport { hydrate } from \"./hydrate.js\";\nimport { initContextLine } from \"./init.js\";\nimport { inspect } from \"./inspect.js\";\nimport { proposeCompaction } from \"./proposeCompaction.js\";\nimport { readDeep } from \"./readDeep.js\";\nimport { readDetails } from \"./readDetails.js\";\nimport { updateDeepPointer } from \"./updateDeepPointer.js\";\nimport { updateIndexPointer } from \"./updateIndexPointer.js\";\nimport { validateTopology } from \"./validateTopology.js\";\n\nexport const contextlineInputSchema = {\n action: z.enum([\n \"init\",\n \"hydrate\",\n \"read_deep\",\n \"read_details\",\n \"append_detail\",\n \"update_deep\",\n \"update_index\",\n \"save_memory\",\n \"validate\",\n \"inspect\",\n \"propose_compaction\"\n ]),\n root: z.string().optional(),\n file: z.string().optional(),\n detail_file: z.string().optional(),\n text: z.string().optional(),\n date: z.string().optional(),\n files: z.array(z.string()).optional(),\n detail: z\n .object({\n text: z.string(),\n date: z.string().optional()\n })\n .optional(),\n deep: z\n .array(\n z.object({\n file: z.string(),\n text: z.string()\n })\n )\n .optional(),\n quick: z\n .array(\n z.object({\n text: z.string(),\n files: z.array(z.string())\n })\n )\n .optional(),\n file_a: z.string().optional(),\n file_b: z.string().optional(),\n reason: z.string().optional()\n};\n\ntype ContextlineInput = {\n action: keyof typeof handlers;\n root?: string;\n file?: string;\n detail_file?: string;\n text?: string;\n date?: string;\n files?: string[];\n detail?: { text: string; date?: string };\n deep?: Array<{ file: string; text: string }>;\n quick?: Array<{ text: string; files: string[] }>;\n file_a?: string;\n file_b?: string;\n reason?: string;\n};\n\nfunction requireString(value: string | undefined, name: string): string {\n if (!value) throw new Error(`Missing required field: ${name}`);\n return value;\n}\n\nasync function saveMemory(input: ContextlineInput) {\n await initContextLine(input.root);\n let detailFile = input.detail_file;\n let detailResult: unknown = null;\n if (input.detail) {\n const result = await appendFragment(input.detail.text, input.detail.date, input.root);\n detailFile = result.detail_file;\n detailResult = result;\n }\n const deepResults = [];\n for (const item of input.deep ?? []) {\n if (!detailFile) throw new Error(\"save_memory deep updates require detail_file or detail.\");\n deepResults.push(await updateDeepPointer(item.file, item.text, detailFile, input.root));\n }\n const quickResults = [];\n for (const item of input.quick ?? []) {\n quickResults.push(await updateIndexPointer(item.text, item.files, input.root));\n }\n const validation = await validateTopology(input.root);\n const deepFiles = deepResults.map((result) => result.file);\n return {\n ok: validation.ok,\n detail_file: detailFile,\n detail: detailResult,\n deep: deepResults,\n quick: quickResults,\n validation,\n display: [\n \"ContextLine memory saved\",\n detailFile ? `- L3 detail: ${detailFile}` : undefined,\n deepFiles.length ? `- L2 updated: ${deepFiles.join(\", \")}` : undefined,\n quickResults.length ? `- L1 updated: ${quickResults.length} line${quickResults.length === 1 ? \"\" : \"s\"}` : undefined,\n validation.ok ? \"- Topology: valid\" : `- Topology errors: ${validation.errors.length}`\n ]\n .filter(Boolean)\n .join(\"\\n\")\n };\n}\n\nconst handlers = {\n init: (input: ContextlineInput) => initContextLine(input.root),\n hydrate: (input: ContextlineInput) => hydrate(input.root),\n read_deep: (input: ContextlineInput) => readDeep(requireString(input.file, \"file\"), input.root),\n read_details: (input: ContextlineInput) => readDetails(requireString(input.file ?? input.detail_file, \"file\"), input.root),\n append_detail: (input: ContextlineInput) => appendFragment(requireString(input.text, \"text\"), input.date, input.root),\n update_deep: (input: ContextlineInput) =>\n updateDeepPointer(requireString(input.file, \"file\"), requireString(input.text, \"text\"), requireString(input.detail_file, \"detail_file\"), input.root),\n update_index: (input: ContextlineInput) => updateIndexPointer(requireString(input.text, \"text\"), input.files ?? [], input.root),\n save_memory: saveMemory,\n validate: (input: ContextlineInput) => validateTopology(input.root),\n inspect: (input: ContextlineInput) => inspect(input.root),\n propose_compaction: (input: ContextlineInput) =>\n proposeCompaction(requireString(input.file_a, \"file_a\"), requireString(input.file_b, \"file_b\"), requireString(input.reason, \"reason\"), input.root)\n};\n\nexport async function dispatchContextline(input: ContextlineInput) {\n return handlers[input.action](input);\n}\n","import fs from \"node:fs/promises\";\nimport { resolveRoot } from \"../config.js\";\nimport { detailPath } from \"../paths.js\";\nimport { atomicWriteFile } from \"../core/atomicWrite.js\";\nimport { ensureTrailingNewline } from \"../core/markdown.js\";\nimport { detailFilename, detailHeader, detailLine } from \"../core/details.js\";\nimport { withLock } from \"../core/lock.js\";\nimport { initContextLine } from \"./init.js\";\n\nexport async function appendFragment(text: string, date?: string, rootInput?: string) {\n const root = resolveRoot(rootInput);\n await initContextLine(root);\n return withLock(root, async () => {\n const detail_file = detailFilename(date);\n const filePath = detailPath(root, detail_file);\n let content: string;\n try {\n content = await fs.readFile(filePath, \"utf8\");\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code !== \"ENOENT\") {\n throw error;\n }\n content = detailHeader(date);\n }\n const fragment = detailLine(text, date);\n await atomicWriteFile(filePath, `${ensureTrailingNewline(content)}${fragment}\\n`);\n return {\n ok: true as const,\n detail_file,\n fragment,\n next_required_steps: [\n \"Call contextline with action save_memory to save L3, L2, and L1 together.\",\n \"If manually continuing, call contextline action update_deep for every relevant L2_Deep file and action update_index for compact L1_Quick facts.\"\n ],\n display: `ContextLine L3 detail appended\\n- Detail file: ${detail_file}`\n };\n });\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\n\nexport function getMemoryRoot(): string {\n if (process.env.CONTEXTLINE_ROOT) return path.resolve(process.env.CONTEXTLINE_ROOT);\n // v1: memory lives in the current working directory.\n // The dream is to support a user-configured global root (OneDrive, GDrive, etc.)\n // so memory is shared across projects and synced across machines.\n // Blocked by host sandbox policies (e.g. Codex auto-review) that deny MCP access\n // to paths outside the project folder. Contributions welcome:\n // https://github.com/contextline/core/issues\n return path.join(process.cwd(), \".contextline\");\n}\n\nexport function resolveRoot(folder?: string): string {\n if (folder) return path.resolve(folder);\n return getMemoryRoot();\n}\n\nexport function ensureGlobalConfigDir(): void {\n const dir = getMemoryRoot();\n if (!fs.existsSync(dir)) {\n fs.mkdirSync(dir, { recursive: true });\n }\n}\n","import path from \"node:path\";\nimport { PathSafetyError } from \"./core/errors.js\";\n\nexport const L1_FILE = \"L1_Quick.md\";\nexport const L2_DIR = \"L2_Deep\";\nexport const L3_DIR = \"L3_Details\";\n\nexport function assertSafeRelative(input: string): void {\n if (!input || input.trim() !== input) {\n throw new PathSafetyError(\"Path input must be non-empty and contain no leading/trailing whitespace.\");\n }\n if (path.isAbsolute(input)) {\n throw new PathSafetyError(\"Absolute paths are not allowed in tool inputs.\");\n }\n const parts = input.split(/[\\\\/]+/);\n if (parts.includes(\"..\") || parts.includes(\"\")) {\n throw new PathSafetyError(\"Path traversal and empty path segments are not allowed.\");\n }\n}\n\nexport function assertSafeRelativeFile(input: string): void {\n assertSafeRelative(input);\n if (!input.endsWith(\".md\")) {\n throw new PathSafetyError(\"Memory file paths must end with .md.\");\n }\n}\n\nexport function safeJoin(root: string, ...segments: string[]): string {\n for (const segment of segments) {\n assertSafeRelative(segment);\n }\n const resolvedRoot = path.resolve(root);\n const target = path.resolve(resolvedRoot, ...segments);\n const rel = path.relative(resolvedRoot, target);\n if (rel.startsWith(\"..\") || path.isAbsolute(rel)) {\n throw new PathSafetyError(\"Resolved path escapes ContextLine root.\");\n }\n return target;\n}\n\nexport function deepPath(root: string, file: string): string {\n assertSafeRelativeFile(file);\n if (file.includes(\"/\") || file.includes(\"\\\\\")) {\n throw new PathSafetyError(\"L2 deep memory files must be flat filenames inside L2_Deep for V1.\");\n }\n return safeJoin(root, L2_DIR, file);\n}\n\nexport function detailPath(root: string, file: string): string {\n assertSafeRelativeFile(file);\n return safeJoin(root, L3_DIR, file);\n}\n\n\nexport function l1Path(root: string): string {\n return safeJoin(root, L1_FILE);\n}\n","export class ContextLineError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"ContextLineError\";\n }\n}\n\nexport class PathSafetyError extends ContextLineError {\n constructor(message: string) {\n super(message);\n this.name = \"PathSafetyError\";\n }\n}\n","import fs from \"node:fs/promises\";\nimport path from \"node:path\";\n\nexport async function atomicWriteFile(filePath: string, content: string): Promise<void> {\n await fs.mkdir(path.dirname(filePath), { recursive: true });\n const tmp = path.join(path.dirname(filePath), `.${path.basename(filePath)}.${process.pid}.${Date.now()}.tmp`);\n const handle = await fs.open(tmp, \"w\");\n try {\n await handle.writeFile(content, \"utf8\");\n await handle.sync();\n } finally {\n await handle.close();\n }\n await fs.rename(tmp, filePath);\n}\n","export function ensureTrailingNewline(content: string): string {\n return content.endsWith(\"\\n\") ? content : `${content}\\n`;\n}\n\nexport function upsertLineByPrefix(content: string, prefix: string, nextLine: string): string {\n const lines = ensureTrailingNewline(content).split(\"\\n\");\n const index = lines.findIndex((line) => line.trimStart().startsWith(prefix));\n if (index >= 0) {\n lines[index] = nextLine;\n } else {\n lines.splice(Math.max(0, lines.length - 1), 0, nextLine);\n }\n return ensureTrailingNewline(lines.join(\"\\n\").replace(/\\n{3,}/g, \"\\n\\n\"));\n}\n","import { format, parseISO } from \"date-fns\";\n\nexport function detailFilename(dateInput?: string): string {\n const date = dateInput ? parseISO(dateInput) : new Date();\n if (Number.isNaN(date.getTime())) {\n throw new Error(\"Invalid date. Expected YYYY-MM-DD.\");\n }\n return `L3_${format(date, \"yyyy_MM\")}.md`;\n}\n\nexport function detailHeader(dateInput?: string): string {\n const date = dateInput ? parseISO(dateInput) : new Date();\n if (Number.isNaN(date.getTime())) {\n throw new Error(\"Invalid date. Expected YYYY-MM-DD.\");\n }\n return `# ${format(date, \"MMMM yyyy\")} Detailed Memory\\n\\n`;\n}\n\nexport function detailLine(text: string, dateInput?: string): string {\n const date = dateInput ? parseISO(dateInput) : new Date();\n if (Number.isNaN(date.getTime())) {\n throw new Error(\"Invalid date. Expected YYYY-MM-DD.\");\n }\n const clean = text.replace(/\\s+/g, \" \").trim();\n if (!clean) {\n throw new Error(\"Detail text must be non-empty.\");\n }\n return `* [${format(date, \"yyyy-MM-dd\")}]: ${clean}`;\n}\n","import fs from \"node:fs/promises\";\nimport path from \"node:path\";\n\nconst sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));\n\nexport async function withLock<T>(root: string, fn: () => Promise<T>): Promise<T> {\n const lockPath = path.join(root, \".lock\");\n const start = Date.now();\n let handle: fs.FileHandle | undefined;\n while (!handle) {\n try {\n await fs.mkdir(root, { recursive: true });\n handle = await fs.open(lockPath, \"wx\");\n } catch (error) {\n const code = (error as NodeJS.ErrnoException).code;\n if (code !== \"EEXIST\" || Date.now() - start > 5000) {\n throw error;\n }\n await sleep(50);\n }\n }\n try {\n return await fn();\n } finally {\n await handle.close();\n await fs.rm(lockPath, { force: true });\n }\n}\n","import fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { CONTEXTLINE_INSTRUCTIONS_FILE, DEFAULT_CONTEXTLINE_INSTRUCTIONS } from \"../core/instructions.js\";\nimport { L1_FILE, L2_DIR, L3_DIR, safeJoin } from \"../paths.js\";\nimport type { InitResult } from \"../core/types.js\";\n\nconst DEFAULT_L1 = `# ContextLine L1 Index\n\nThis is the quick memory cache: compact facts, summaries, and active pointers.\n\n## Quick Facts\n\n`;\n\nexport async function initContextLine(root: string): Promise<InitResult> {\n const created: string[] = [];\n await fs.mkdir(root, { recursive: true });\n\n for (const dir of [\n L2_DIR,\n L3_DIR,\n \"maintenance\",\n \"maintenance/proposals\"\n ]) {\n const target = safeJoin(root, ...dir.split(\"/\"));\n await fs.mkdir(target, { recursive: true });\n created.push(path.relative(root, target));\n }\n\n const files: Array<[string, string]> = [\n [L1_FILE, DEFAULT_L1],\n [CONTEXTLINE_INSTRUCTIONS_FILE, DEFAULT_CONTEXTLINE_INSTRUCTIONS],\n [\"config.json\", `${JSON.stringify({ version: 1, capture: { promotion: \"selective\" } }, null, 2)}\\n`]\n ];\n\n for (const [file, content] of files) {\n const target = safeJoin(root, file);\n try {\n await fs.writeFile(target, content, { encoding: \"utf8\", flag: \"wx\" });\n created.push(path.relative(root, target));\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code !== \"EEXIST\") {\n throw error;\n }\n }\n }\n\n return { ok: true, root, created };\n}\n","export const CONTEXTLINE_INSTRUCTIONS_FILE = \"contextline_instructions.md\";\n\nexport const DEFAULT_CONTEXTLINE_INSTRUCTIONS = `# ContextLine Instructions\n\nCONTEXTLINE-INSTRUCTIONS-V1\nThis file contains generic operating instructions for ContextLine memory.\nUse the single MCP tool named \"contextline\" for all ContextLine reads and writes.\nDo not use shell commands to read or write .contextline files.\nDo not mention memory saving unless the user asks.\n\n## Operating Policy\n\nUse the single ContextLine MCP tool \"contextline\" silently for durable memory. Do not use shell commands to read or write .contextline files. Do not mention memory saving unless asked.\n\nDurable memory means stable facts likely to help future sessions: user/project facts, preferences, goals, constraints, decisions, relationships, recurring patterns, and important events. Do not save filler, acknowledgements, or one-off chatter.\n\nDo not save every message. Periodically batch-save useful durable memory since the last ContextLine save in this session.\n\nUse ContextLine as a human-like cache:\n\n- L1_Quick.md stores compact facts, summaries, and active pointers.\n- L2_Deep/ stores deeper facts per important object, person, event, project, preference area, or decision thread.\n- L3_Details/ stores timestamped specifics, receipts, and supporting history.\n\nFor V1, use flat L2 filenames with semantic prefixes instead of folders. Prefer names like person_user.md, project_contextline.md, area_work.md, place_san_jose.md, preference_media.md, preference_language.md, decision_memory_architecture.md, event_launch.md, or org_meta.md.\n\nWhen saving durable memory, complete the full chain. Do not stop after writing L3_Details:\n\n1. Append one L3_Details receipt when supporting specifics are useful.\n2. Cross-save extracted meaning into every relevant L2_Deep file.\n3. Update L1_Quick only for compact high-level facts or active pointers.\n4. Link every L1 line to relevant L2 files.\n5. Link every L2 line to relevant L3 details when supporting detail exists.\n\nTypical tool sequence:\n\nCall \"contextline\" once with action \"save_memory\", including:\n\n- detail.text for the L3_Details receipt\n- deep[] entries for every relevant L2_Deep file, such as person_user.md, area_work.md, place_san_jose.md, or preference_media.md\n- quick[] entries for compact L1_Quick facts linked to L2 files\n\nIf you write L3_Details but do not update L2_Deep and L1_Quick, the memory is incomplete. Prefer the bundled \"save_memory\" action so the full chain is saved together.\n`;\n","import fs from \"node:fs/promises\";\nimport { CONTEXTLINE_INSTRUCTIONS_FILE } from \"../core/instructions.js\";\nimport { resolveRoot } from \"../config.js\";\nimport { l1Path, safeJoin } from \"../paths.js\";\nimport { initContextLine } from \"./init.js\";\n\nexport async function hydrate(rootInput?: string) {\n const root = resolveRoot(rootInput);\n await initContextLine(root);\n const l1_path = l1Path(root);\n const instructions_path = safeJoin(root, CONTEXTLINE_INSTRUCTIONS_FILE);\n const content = await fs.readFile(l1_path, \"utf8\");\n const instructions = await fs.readFile(instructions_path, \"utf8\");\n return {\n ok: true,\n root,\n l1_path,\n instructions_path,\n content,\n instructions,\n instruction: \"Use this L1 content as quick memory. Follow the included ContextLine instructions for reading and saving memory.\",\n display: `ContextLine hydrated\\n- Quick memory: ${l1_path}\\n- Instructions: ${instructions_path}`\n };\n}\n","import fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { resolveRoot } from \"../config.js\";\nimport { L1_FILE, L2_DIR, L3_DIR, safeJoin } from \"../paths.js\";\n\nasync function countFiles(dir: string): Promise<number> {\n try {\n return (await fs.readdir(dir)).length;\n } catch {\n return 0;\n }\n}\n\nexport async function inspect(rootInput?: string) {\n const root = resolveRoot(rootInput);\n return {\n root,\n l1: path.join(root, L1_FILE),\n l2_deep_files: await countFiles(safeJoin(root, L2_DIR)),\n l3_detail_files: await countFiles(safeJoin(root, L3_DIR))\n };\n}\n","import { format } from \"date-fns\";\nimport { resolveRoot } from \"../config.js\";\nimport { deepPath, safeJoin } from \"../paths.js\";\nimport { atomicWriteFile } from \"../core/atomicWrite.js\";\nimport { withLock } from \"../core/lock.js\";\n\nexport async function proposeCompaction(fileA: string, fileB: string, reason: string, rootInput?: string) {\n const root = resolveRoot(rootInput);\n deepPath(root, fileA);\n deepPath(root, fileB);\n return withLock(root, async () => {\n const stamp = format(new Date(), \"yyyyMMdd_HHmmss\");\n const proposal = `proposal_${stamp}_${fileA.replace(/\\W+/g, \"_\")}_${fileB.replace(/\\W+/g, \"_\")}.md`;\n const proposal_path = safeJoin(root, \"maintenance\", \"proposals\", proposal);\n const content = `# Deep Memory Compaction Proposal\n\nCreated: ${new Date().toISOString()}\n\nL2 File A: [[${fileA}]]\nL2 File B: [[${fileB}]]\n\n## Reason\n\n${reason.trim()}\n\n## Instruction\n\nReview manually. V1 never merges or mutates deep memory files automatically.\n`;\n await atomicWriteFile(proposal_path, content);\n return { ok: true as const, proposal_path };\n });\n}\n","import fs from \"node:fs/promises\";\nimport { resolveRoot } from \"../config.js\";\nimport { deepPath } from \"../paths.js\";\nimport { extractWikiLinks } from \"../core/links.js\";\nimport { initContextLine } from \"./init.js\";\n\nexport async function readDeep(file: string, rootInput?: string) {\n const root = resolveRoot(rootInput);\n await initContextLine(root);\n const deep_memory_path = deepPath(root, file);\n const content = await fs.readFile(deep_memory_path, \"utf8\");\n const l3_links = extractWikiLinks(content).filter((link) => link.startsWith(\"L3_\") && link.endsWith(\".md\"));\n return { l2_path: deep_memory_path, deep_memory_path, content, l3_links };\n}\n","export const WIKI_LINK_RE = /\\[\\[([^\\]]+)\\]\\]/g;\n\nexport function extractWikiLinks(content: string): string[] {\n return [...content.matchAll(WIKI_LINK_RE)].map((match) => match[1]);\n}\n\nexport function hasWikiLink(line: string, filename: string): boolean {\n return extractWikiLinks(line).includes(filename);\n}\n\nexport function ensureWikiLink(line: string, filename: string): string {\n return hasWikiLink(line, filename) ? line : `${line.trim()} [[${filename}]]`;\n}\n","import fs from \"node:fs/promises\";\nimport { resolveRoot } from \"../config.js\";\nimport { detailPath } from \"../paths.js\";\nimport { initContextLine } from \"./init.js\";\n\nexport async function readDetails(file: string, rootInput?: string) {\n const root = resolveRoot(rootInput);\n await initContextLine(root);\n const detail_path = detailPath(root, file);\n const content = await fs.readFile(detail_path, \"utf8\");\n return { l3_path: detail_path, detail_path, content };\n}\n","import fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { resolveRoot } from \"../config.js\";\nimport { deepPath, detailPath } from \"../paths.js\";\nimport { atomicWriteFile } from \"../core/atomicWrite.js\";\nimport { ensureWikiLink } from \"../core/links.js\";\nimport { ensureTrailingNewline, upsertLineByPrefix } from \"../core/markdown.js\";\nimport { withLock } from \"../core/lock.js\";\nimport { initContextLine } from \"./init.js\";\n\nexport async function updateDeepPointer(file: string, factText: string, detailFile: string, rootInput?: string) {\n const root = resolveRoot(rootInput);\n await initContextLine(root);\n detailPath(root, detailFile);\n return withLock(root, async () => {\n const filePath = deepPath(root, file);\n let content = \"\";\n try {\n content = await fs.readFile(filePath, \"utf8\");\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code !== \"ENOENT\") {\n throw error;\n }\n content = `# ${path.basename(file, \".md\")}\\n\\n`;\n }\n const updated_line = ensureWikiLink(factText, detailFile);\n const next = upsertLineByPrefix(ensureTrailingNewline(content), factText.trim(), updated_line);\n await atomicWriteFile(filePath, next);\n return { ok: true as const, file, updated_line, display: `ContextLine L2 updated\\n- File: ${file}` };\n });\n}\n","import fs from \"node:fs/promises\";\nimport { resolveRoot } from \"../config.js\";\nimport { deepPath, l1Path } from \"../paths.js\";\nimport { atomicWriteFile } from \"../core/atomicWrite.js\";\nimport { ensureWikiLink } from \"../core/links.js\";\nimport { ensureTrailingNewline, upsertLineByPrefix } from \"../core/markdown.js\";\nimport { withLock } from \"../core/lock.js\";\nimport { initContextLine } from \"./init.js\";\n\nexport async function updateIndexPointer(indexLine: string, files: string[], rootInput?: string) {\n if (files.some((file) => file.startsWith(\"L3_\"))) {\n throw new Error(\"L1 quick memory pointers may only reference L2 deep memory files.\");\n }\n const root = resolveRoot(rootInput);\n await initContextLine(root);\n for (const file of files) {\n deepPath(root, file);\n }\n return withLock(root, async () => {\n const filePath = l1Path(root);\n const content = await fs.readFile(filePath, \"utf8\");\n const updated_line = files.reduce((line, file) => ensureWikiLink(line, file), indexLine);\n const next = upsertLineByPrefix(ensureTrailingNewline(content), indexLine.trim(), updated_line);\n await atomicWriteFile(filePath, next);\n return { ok: true as const, updated_line, display: \"ContextLine L1 updated\" };\n });\n}\n","import fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { L1_FILE, L2_DIR, L3_DIR, l1Path, safeJoin } from \"../paths.js\";\nimport { extractWikiLinks } from \"./links.js\";\nimport type { ValidationResult } from \"./types.js\";\n\nasync function exists(target: string): Promise<boolean> {\n try {\n await fs.access(target);\n return true;\n } catch {\n return false;\n }\n}\n\nasync function listMarkdown(dir: string): Promise<string[]> {\n const out: string[] = [];\n try {\n const entries = await fs.readdir(dir, { withFileTypes: true });\n for (const entry of entries) {\n const full = path.join(dir, entry.name);\n if (entry.isDirectory()) {\n const nested = await listMarkdown(full);\n out.push(...nested.map((file) => path.join(entry.name, file)));\n } else if (entry.name.endsWith(\".md\")) {\n out.push(entry.name);\n }\n }\n return out;\n } catch {\n return [];\n }\n}\n\nexport async function validateTopology(root: string): Promise<ValidationResult> {\n const errors: string[] = [];\n const warnings: string[] = [];\n const l1 = l1Path(root);\n const l2 = safeJoin(root, L2_DIR);\n const l3 = safeJoin(root, L3_DIR);\n\n if (!(await exists(l1))) errors.push(\"L1_Quick.md is missing.\");\n if (!(await exists(l2))) errors.push(\"L2_Deep directory is missing.\");\n if (!(await exists(l3))) errors.push(\"L3_Details directory is missing.\");\n\n if (errors.length) return { ok: false, errors, warnings };\n\n const l1Content = await fs.readFile(l1, \"utf8\");\n for (const link of extractWikiLinks(l1Content)) {\n if (link.startsWith(\"L3_\")) {\n errors.push(`L1 must not link directly to L3 detail file: ${link}`);\n } else if (!(await exists(path.join(l2, link)))) {\n errors.push(`L1 links to missing L2 deep memory file: ${link}`);\n }\n }\n\n for (const file of await listMarkdown(l2)) {\n const content = await fs.readFile(path.join(l2, file), \"utf8\");\n for (const link of extractWikiLinks(content)) {\n if (link === L1_FILE) {\n errors.push(`L2 deep memory file ${file} must not link upward to L1_Quick.md.`);\n } else if (!link.startsWith(\"L3_\")) {\n warnings.push(`L2 deep memory file ${file} links to non-L3 file: ${link}`);\n } else if (!(await exists(path.join(l3, link)))) {\n errors.push(`L2 deep memory file ${file} links to missing L3 detail file: ${link}`);\n }\n }\n }\n\n for (const file of await listMarkdown(l3)) {\n const content = await fs.readFile(path.join(l3, file), \"utf8\");\n const links = extractWikiLinks(content);\n if (links.length) {\n errors.push(`L3 detail file ${file} must not contain wiki links.`);\n }\n }\n\n return { ok: errors.length === 0, errors, warnings };\n}\n","import { resolveRoot } from \"../config.js\";\nimport { validateTopology as validate } from \"../core/topology.js\";\nimport { initContextLine } from \"./init.js\";\n\nexport async function validateTopology(rootInput?: string) {\n const root = resolveRoot(rootInput);\n await initContextLine(root);\n const result = await validate(root);\n return {\n ...result,\n display: result.ok ? \"ContextLine topology valid\" : `ContextLine topology invalid\\n- Errors: ${result.errors.length}\\n- Warnings: ${result.warnings.length}`\n };\n}\n","export const compilerPrompt = `Compile durable ContextLine memory from the conversation.\n\nRules:\n1. Treat L1, L2, and L3 as a human-like memory cache hierarchy.\n2. L1 Quick Memory stores compact facts, summaries, and active pointers.\n3. L2 Deep Memory stores richer facts per important object, person, event, project, preference area, or decision thread. For V1, use flat filenames with semantic prefixes, such as person_user.md, project_contextline.md, area_work.md, place_san_jose.md, preference_media.md, decision_architecture.md, event_launch.md, or org_meta.md.\n4. L3 Details stores timestamped specifics, receipts, and supporting history.\n5. Deconstruct durable facts into timestamped L3 detail fragments when supporting specifics are useful.\n6. Cross-save meaning into every relevant L2 deep memory file. If a fact involves person A and project B, update both the person file and the project file with the relevant angle for each, pointing both to the same L3 detail receipt when one exists.\n7. Every L1 memory line should include one or more wiki links to relevant L2 files.\n8. Every L2 memory line should include one or more wiki links to relevant L3 detail files when supporting detail exists. If no L3 detail is needed, keep the L2 line concise and link it later when detail is created.\n9. Evolve L1 only for compact high-level facts, important summaries, or active pointers.\n10. Do not duplicate raw wording across L1, L2, and L3. Store the right level of detail at each cache layer.\n11. Prefer updating existing L2 lines when possible.\n12. Do not create new L2 files unless necessary.\n13. Prefer one call to the \"contextline\" MCP tool with action \"save_memory\" so L3, L2, and L1 updates are saved together.`;\n","export const hydrationPrompt = `Use ContextLine as a human-like memory cache.\n\nAt the start of work, use L1 Quick Memory as the only cold-start memory map. Follow links into L2 Deep Memory files and L3 Details only when needed for the current task. Do not load the entire memory tree.`;\n","import { startServer } from \"./mcpServer.js\";\n\nstartServer().catch((error) => {\n console.error(error);\n process.exit(1);\n});\n"],"mappings":";;;AAAA,SAAS,iBAAiB;AAC1B,SAAS,4BAA4B;;;ACDrC,SAAS,SAAS;;;ACAlB,OAAOA,SAAQ;;;ACAf,OAAO,QAAQ;AACf,OAAO,UAAU;AAEV,SAAS,gBAAwB;AACtC,MAAI,QAAQ,IAAI,iBAAkB,QAAO,KAAK,QAAQ,QAAQ,IAAI,gBAAgB;AAOlF,SAAO,KAAK,KAAK,QAAQ,IAAI,GAAG,cAAc;AAChD;AAEO,SAAS,YAAY,QAAyB;AACnD,MAAI,OAAQ,QAAO,KAAK,QAAQ,MAAM;AACtC,SAAO,cAAc;AACvB;;;ACjBA,OAAOC,WAAU;;;ACAV,IAAM,mBAAN,cAA+B,MAAM;AAAA,EAC1C,YAAY,SAAiB;AAC3B,UAAM,OAAO;AACb,SAAK,OAAO;AAAA,EACd;AACF;AAEO,IAAM,kBAAN,cAA8B,iBAAiB;AAAA,EACpD,YAAY,SAAiB;AAC3B,UAAM,OAAO;AACb,SAAK,OAAO;AAAA,EACd;AACF;;;ADTO,IAAM,UAAU;AAChB,IAAM,SAAS;AACf,IAAM,SAAS;AAEf,SAAS,m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C7B,QAAM,SAAS,IAAI,UAAU,EAAE,MAAM,eAAe,SAAS,QAAQ,CAAC;AAEtE,SAAO,aAAa,eAAe,EAAE,aAAa,uBAAuB,GAAG,OAAO,UAAU,WAAW,MAAM,oBAAoB,KAAc,CAAC,CAAC;AAElJ,SAAO,eAAe,+BAA+B,CAAC,GAAG,OAAO;AAAA,IAC9D,UAAU,CAAC,EAAE,MAAM,QAAQ,SAAS,EAAE,MAAM,QAAQ,MAAM,gBAAgB,EAAE,CAAC;AAAA,EAC/E,EAAE;AACF,SAAO,eAAe,8BAA8B,CAAC,GAAG,OAAO;AAAA,IAC7D,UAAU,CAAC,EAAE,MAAM,QAAQ,SAAS,EAAE,MAAM,QAAQ,MAAM,eAAe,EAAE,CAAC;AAAA,EAC9E,EAAE;AAEF,SAAO;AACT;AAEA,eAAsB,cAAc;AAClC,QAAM,SAAS,aAAa;AAC5B,QAAM,OAAO,QAAQ,IAAI,qBAAqB,CAAC;AACjD;;;AwBhCA,YAAY,EAAE,MAAM,CAAC,UAAU;AAC7B,UAAQ,MAAM,KAAK;AACnB,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":["fs","path","path","fs","path","fs","path","fs","path","fs","path","fs","fs","fs","fs","path","fs","path","format","format","fs","fs","fs","fs","fs","path","fs","path","fs","fs","fs","path","fs","path","validateTopology","validateTopology"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/postinstall.ts
|
|
4
|
+
console.log(`ContextLine installed.
|
|
5
|
+
|
|
6
|
+
Next step:
|
|
7
|
+
contextline setup
|
|
8
|
+
|
|
9
|
+
This will choose a memory folder, initialize .contextline, detect supported hosts, and configure MCP/hooks where possible.
|
|
10
|
+
`);
|
|
11
|
+
//# sourceMappingURL=postinstall.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/postinstall.ts"],"sourcesContent":["console.log(`ContextLine installed.\n\nNext step:\n contextline setup\n\nThis will choose a memory folder, initialize .contextline, detect supported hosts, and configure MCP/hooks where possible.\n`);\n"],"mappings":";;;AAAA,QAAQ,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAMX;","names":[]}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# Why ContextLine Exists
|
|
2
|
+
|
|
3
|
+
AI assistants are increasingly useful as long-running collaborators, but they still struggle with durable memory. They may remember too little between sessions, or they may rely on opaque chat history that is hard to inspect, edit, move, or trust.
|
|
4
|
+
|
|
5
|
+
ContextLine solves this by giving assistants a local, file-backed memory cache that is structured enough to retrieve and maintain, but simple enough for users to inspect in Markdown.
|
|
6
|
+
|
|
7
|
+
## The Problem
|
|
8
|
+
|
|
9
|
+
Useful context often appears naturally in conversation:
|
|
10
|
+
|
|
11
|
+
- personal preferences
|
|
12
|
+
- work constraints
|
|
13
|
+
- project decisions
|
|
14
|
+
- recurring workflows
|
|
15
|
+
- important people, places, and organizations
|
|
16
|
+
- facts that should influence future answers
|
|
17
|
+
|
|
18
|
+
Without a durable memory layer, the user has to repeat that context in every new session. With naive memory, the assistant may save too much, creating noisy files, stale facts, privacy risk, and bloated prompts.
|
|
19
|
+
|
|
20
|
+
The core problem is not just storage. It is deciding where durable context should live so future sessions can find it without replaying entire conversations.
|
|
21
|
+
|
|
22
|
+
## Common Workarounds
|
|
23
|
+
|
|
24
|
+
Chat history is convenient, but it is usually host-specific, opaque, difficult to edit, and hard to move between tools.
|
|
25
|
+
|
|
26
|
+
Vector memory can retrieve similar text, but similarity alone does not create a clean memory map. It may surface fragments without showing what is current, important, or connected.
|
|
27
|
+
|
|
28
|
+
Project docs are useful, but they are manual. They drift unless someone actively maintains them.
|
|
29
|
+
|
|
30
|
+
Long system prompts can carry context forward, but they become stale, expensive, and hard to audit.
|
|
31
|
+
|
|
32
|
+
Transcript logging captures everything, but most messages are not durable memory. Storing every turn creates noise instead of recall.
|
|
33
|
+
|
|
34
|
+
## ContextLine's Approach
|
|
35
|
+
|
|
36
|
+
ContextLine treats memory like a human-style cache:
|
|
37
|
+
|
|
38
|
+
- `L1_Quick.md`: compact facts, summaries, and active pointers.
|
|
39
|
+
- `L2_Deep/`: deeper fact files by important person, project, place, preference area, event, organization, or decision thread.
|
|
40
|
+
- `L3_Details/`: timestamped specifics, receipts, and supporting history.
|
|
41
|
+
|
|
42
|
+
The host model decides what matters. ContextLine stores, links, validates, and retrieves the files.
|
|
43
|
+
|
|
44
|
+
This separation is intentional. ContextLine does not try to be the semantic brain. It is the durable memory substrate that lets the assistant preserve useful context in a predictable topology.
|
|
45
|
+
|
|
46
|
+
## Example: Personal Preference
|
|
47
|
+
|
|
48
|
+
The user says:
|
|
49
|
+
|
|
50
|
+
> I prefer concise technical explanations, and I usually want examples in TypeScript.
|
|
51
|
+
|
|
52
|
+
The assistant may save:
|
|
53
|
+
|
|
54
|
+
- an L1 summary that the user prefers concise technical explanations and TypeScript examples
|
|
55
|
+
- L2 entries in `person_user.md`, `preference_writing.md`, and `preference_programming.md`
|
|
56
|
+
- an L3 dated detail recording the source conversation
|
|
57
|
+
|
|
58
|
+
Later, the user asks:
|
|
59
|
+
|
|
60
|
+
> Show me how to debounce this API call.
|
|
61
|
+
|
|
62
|
+
The assistant can answer in the user's preferred style without asking them to repeat it.
|
|
63
|
+
|
|
64
|
+
## Example: Project Decision
|
|
65
|
+
|
|
66
|
+
The user says:
|
|
67
|
+
|
|
68
|
+
> For Project Atlas, we decided to keep Postgres for v1 and defer vector search.
|
|
69
|
+
|
|
70
|
+
The assistant may save:
|
|
71
|
+
|
|
72
|
+
- an L1 project pointer for Project Atlas
|
|
73
|
+
- an L2 entry in `project_atlas.md`
|
|
74
|
+
- an L3 dated decision receipt
|
|
75
|
+
|
|
76
|
+
Later, the user asks:
|
|
77
|
+
|
|
78
|
+
> What did we decide about search for Atlas?
|
|
79
|
+
|
|
80
|
+
The assistant can retrieve the project-specific memory and answer from the preserved decision context.
|
|
81
|
+
|
|
82
|
+
## Example: Reusable Work Context
|
|
83
|
+
|
|
84
|
+
The user says:
|
|
85
|
+
|
|
86
|
+
> When I ask for release notes, keep them short, customer-facing, and grouped by feature area.
|
|
87
|
+
|
|
88
|
+
The assistant may save:
|
|
89
|
+
|
|
90
|
+
- an L1 preference pointer
|
|
91
|
+
- an L2 entry in `preference_writing.md` or `area_release_process.md`
|
|
92
|
+
- an L3 detail with the original instruction
|
|
93
|
+
|
|
94
|
+
Later release-note tasks can follow the preference without the user restating it.
|
|
95
|
+
|
|
96
|
+
## What ContextLine Is Not
|
|
97
|
+
|
|
98
|
+
ContextLine is not:
|
|
99
|
+
|
|
100
|
+
- a vector database
|
|
101
|
+
- a semantic extractor
|
|
102
|
+
- a transcript logger
|
|
103
|
+
- cloud sync
|
|
104
|
+
- a private data service
|
|
105
|
+
- a replacement for source control
|
|
106
|
+
- a replacement for canonical project docs
|
|
107
|
+
|
|
108
|
+
It is a local memory topology and MCP tool surface for assistants that already know how to reason over context.
|
|
109
|
+
|
|
110
|
+
## Why Local Markdown
|
|
111
|
+
|
|
112
|
+
Local Markdown has practical advantages:
|
|
113
|
+
|
|
114
|
+
- users can inspect what was saved
|
|
115
|
+
- users can edit or delete memory with normal tools
|
|
116
|
+
- files can be backed up or versioned if desired
|
|
117
|
+
- memory is not locked into one hosted product
|
|
118
|
+
- the format is understandable without a database or UI
|
|
119
|
+
|
|
120
|
+
The goal is durable context that remains user-owned, portable, and auditable.
|
package/package.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@contextline/contextline",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Local-first pointer-chain memory for MCP-capable AI agents.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"author": "",
|
|
8
|
+
"homepage": "https://github.com/contextline/core#readme",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/contextline/core.git"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/contextline/core/issues"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"mcp",
|
|
18
|
+
"memory",
|
|
19
|
+
"codex",
|
|
20
|
+
"ai",
|
|
21
|
+
"context"
|
|
22
|
+
],
|
|
23
|
+
"bin": {
|
|
24
|
+
"contextline": "./dist/cli.js",
|
|
25
|
+
"contextline-mcp": "./dist/index.js"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"dist",
|
|
29
|
+
"docs",
|
|
30
|
+
"README.md",
|
|
31
|
+
"LICENSE"
|
|
32
|
+
],
|
|
33
|
+
"scripts": {
|
|
34
|
+
"build": "tsup",
|
|
35
|
+
"clear": "pwsh ../scripts/clear-codex.ps1",
|
|
36
|
+
"build:clear": "tsup && pwsh ../scripts/clear-codex.ps1",
|
|
37
|
+
"dev": "tsx src/index.ts",
|
|
38
|
+
"test": "vitest run",
|
|
39
|
+
"lint": "eslint .",
|
|
40
|
+
"postinstall": "node -e \"console.log('ContextLine installed.\\n\\nNext step:\\n contextline setup\\n\\nThis will choose a memory folder, initialize .contextline, detect supported hosts, and configure MCP/hooks where possible.\\n')\""
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
44
|
+
"commander": "^12.1.0",
|
|
45
|
+
"date-fns": "^3.6.0",
|
|
46
|
+
"zod": "^3.25.0"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@types/node": "^20.14.0",
|
|
50
|
+
"eslint": "^9.8.0",
|
|
51
|
+
"tsup": "^8.2.4",
|
|
52
|
+
"tsx": "^4.16.2",
|
|
53
|
+
"typescript": "^5.5.4",
|
|
54
|
+
"vitest": "^2.0.5"
|
|
55
|
+
},
|
|
56
|
+
"engines": {
|
|
57
|
+
"node": ">=20"
|
|
58
|
+
}
|
|
59
|
+
}
|