Portable memory for AI workflows.
CTX is a local-first app for turning chats, GitHub context, notes, and project decisions into reusable AI memory capsules. A capsule can be searched, reviewed, exported, injected into another AI tool, or exposed to MCP-compatible agents.
- Next.js web dashboard for capsules, projects, search, GitHub capture, monitoring, MCP setup, import/export, editing, deletion, and injection previews.
- Fast capsule creator: paste text or import
.txt,.md,.json, or.ctx.json, preview the generated capsule, review key fields, then save. - Local deterministic extraction for title, summary, tags, project hints, goals, decisions, constraints, open questions, next steps, importance, and markdown notes.
- Browser extension for ChatGPT, Claude, Gemini, Perplexity, and GitHub with Generate, Drop, Open CTX, health checks, and copy fallback.
- GitHub capture for repositories, issues, pull requests, README context, commits, and review-oriented handoff capsules when
GITHUB_TOKENis configured. - MCP server tools, resources, and prompts for agents that need to create, search, update, export, retrieve project memory, and prepare task handoffs.
- Local SQLite storage, secret redaction, version snapshots, latest-version diff, activity history, and backup/restore.
- Encrypted team share bundles for local-first memory exchange between CTX workspaces.
- Node.js 20 or newer
- pnpm 9.15 or newer
- Git
- Chrome or Chromium-based browser for the extension
Enable pnpm with Corepack if needed:
corepack enable
corepack prepare pnpm@9.15.4 --activategit clone https://github.com/Abhi190702/ctx.git
cd ctx
pnpm install
cp .env.example .env
pnpm db:push
pnpm devOpen http://localhost:3000.
On Windows PowerShell, use this instead of cp:
Copy-Item .env.example .envBuild the app and run the optimized Next.js server:
pnpm install
pnpm db:push
pnpm build
pnpm startThe production server uses the root start script, which runs the web app with next start.
For a custom port:
pnpm --dir apps/web start -p 3000Create .env from .env.example.
DATABASE_URL="file:./dev.db"
CTX_APP_URL="http://localhost:3000"
CTX_API_URL="http://localhost:3000/api"
GITHUB_TOKEN=""DATABASE_URL points to the local SQLite database used by Prisma.
CTX_APP_URL and CTX_API_URL are shown in settings and used by MCP/examples.
GITHUB_TOKEN is optional. Add a fine-grained read-only token if you want CTX to capture private GitHub repositories, issues, and pull requests.
Create a capsule from pasted context:
- Go to
/capsules/new. - Paste a chat, error log, PR review, notes, or research text.
- Click
Preview Capsule. - Review title, project, tags, summary, next steps, and quality hints.
- Click
Save Reviewed Capsule.
Drop memory into an AI chat:
- Start CTX on
localhost:3000. - Load the extension from
apps/extension/dist. - Open ChatGPT, Claude, Gemini, Perplexity, or GitHub.
- Click the floating
CTXbutton. - Use
Dropand pick a capsule.
Capture GitHub context:
- Add
GITHUB_TOKENto.env. - Restart the web app.
- Go to
/github. - Capture a repository, issue, pull request, README, or review context.
Build the extension:
pnpm --filter @ctx/extension buildLoad it in Chrome:
- Open
chrome://extensions. - Enable Developer Mode.
- Click
Load unpacked. - Select
apps/extension/dist. - Keep the CTX web app running.
The default extension API URL is:
http://localhost:3000/api
You can change it from the extension popup or options page. The extension includes local host permissions for localhost and 127.0.0.1.
Run the MCP server during development:
pnpm mcp:devIf CTX is not running on the default API URL:
CTX_API_URL=http://localhost:3000/api pnpm mcp:devExample client configs are in examples/mcp.
CTX exposes MCP tools, resources, and prompts. Useful agent-facing entries include ctx_agent_brief, ctx_semantic_search_capsules, ctx://capsules/recent, ctx://projects/{projectName}/memory, ctx_project_handoff, and ctx_retrieve_task_memory.
Use the dashboard backup controls on the Capsules page to export all capsules. The export is a portable JSON bundle that can be restored through the same UI.
Keep backups somewhere outside the repo if the data matters.
For team handoff, use Settings to create an encrypted share bundle. Share the bundle file and passphrase separately.
Stage a local release folder:
pnpm releaseThe generated release/ctx-v<version> folder includes docs, examples, Docker files, unpacked extension assets, checksums, and install notes.
apps/web Next.js app, API routes, Prisma schema, dashboard UI
apps/extension Manifest V3 extension for capture and injection
apps/mcp-server MCP server for agent access
packages/core Capsule schema, formatting, redaction, GitHub mapping
packages/database Repository helpers
packages/ui Shared UI primitives
docs Integration and architecture notes
examples Sample capsules and MCP configs
pnpm dev # push schema and run the web app in development
pnpm start # run the built web app
pnpm build # build all packages/apps
pnpm lint # lint all packages/apps
pnpm test # run tests
pnpm typecheck # run TypeScript checks
pnpm db:push # apply SQLite schema and generate Prisma client
pnpm db:reset # reset local SQLite database
pnpm web:dev # run only the web app in development
pnpm mcp:dev # run the MCP server
pnpm extension:dev # watch-build the extension
pnpm release # stage docs, checksums, and extension release assetsRun these before publishing changes:
pnpm typecheck
pnpm test
pnpm lint
pnpm buildFor extension-only changes:
pnpm --filter @ctx/extension lint
pnpm --filter @ctx/extension build- CTX stores data locally in SQLite by default.
- Captured text is redacted for common API keys, tokens, passwords, and private keys before storage.
- GitHub capture uses the official GitHub REST API and only runs when
GITHUB_TOKENis configured. - The extension talks to your configured CTX API URL. By default, that is local only.
- Do not commit
.env, database files, or exported capsule backups that contain private data.
Failed to load capsules in the extension:
- Make sure the web app is running.
- Confirm the extension API URL is
http://localhost:3000/api. - Open http://localhost:3000/api/health. It should return a healthy JSON response.
GitHub capture says token is missing:
- Add
GITHUB_TOKENto.env. - Restart the web app.
- Use a token with read access to the repository you are capturing.
Database errors after changing schema:
pnpm db:pushFor a full local reset:
pnpm db:resetExtension changes are not visible:
- Rebuild the extension.
- Go to
chrome://extensions. - Click reload on CTX.
- Refresh the target AI/GitHub page.
- AI extraction is local and heuristic by default. Hosted model extraction is not wired into this build.
- Search is hybrid keyword/alias ranking, not a full embedding index yet.
- The Chrome extension is load-unpacked for now, not signed or Chrome Web Store packaged.
- Sync is local export/restore, not cloud sync.
MIT. See LICENSE.