Integration
Wire Lifeline into Claude Code, Cursor, Claude Desktop, and Gemini CLI via MCP — with auto-connect.
Lifeline has two sides, and the AI drives both:
- Read on connect → MCP resource
lifeline://project/context(orpython -m lifeline context). - Write while working → MCP tools
lifeline_append/lifeline_recontextualize(orpython -m lifeline log).
MCP client (any of them)
Point the client at the stdio server. The server command is lifeline-mcp (installed by
pip install lifeline-context); it reads the DB from LIFELINE_DB (default .lifeline/ledger.db).
Set the env var the way your client config does — e.g. an "env" block in the JSON snippets below.
At a shell directly:
LIFELINE_DB=.lifeline/ledger.db lifeline-mcp # bash/zsh
$env:LIFELINE_DB=".lifeline/ledger.db"; lifeline-mcp # PowerShell
- Resource:
lifeline://project/context— read it when opening the session. - Tools:
lifeline_append(kind, summary, body, …),lifeline_recontextualize(parent_id, summary, body, …),lifeline_recall(query, …). - Server command:
lifeline-mcp(orpython -m lifeline.mcp_serverfrom the repo root). - Named line: set
LIFELINE_LINE=<name>instead ofLIFELINE_DB— the server derives.lifeline/<name>.db(an explicitLIFELINE_DBalways wins).
Per-client snippets (copy-and-paste)
Claude Code — already reads the project's .mcp.json automatically. Without it: claude mcp add lifeline -- lifeline-mcp.
Cursor — .cursor/mcp.json (at the project root):
{ "mcpServers": { "lifeline": { "command": "lifeline-mcp", "env": { "LIFELINE_DB": ".lifeline/ledger.db" } } } }
Claude Desktop — claude_desktop_config.json (use an ABSOLUTE path — the cwd differs):
{ "mcpServers": { "lifeline": { "command": "lifeline-mcp", "env": { "LIFELINE_DB": "C:/path/to/project/.lifeline/ledger.db" } } } }
Gemini CLI — ~/.gemini/settings.json:
{ "mcpServers": { "lifeline": { "command": "lifeline-mcp", "env": { "LIFELINE_DB": ".lifeline/ledger.db" } } } }
WEB chat apps (claude.ai, ChatGPT) do not belong here — they require a remote server + OAuth (see
docs/MCP_REMOTE.md). These snippets are for dev/CLI/IDE clients (stdio, local).
Verification status (honest): Claude Code (stdio, .mcp.json, named lines) and the remote
path (claude.ai connector via OAuth RS mode: 401 without a token, 200 with a valid JWT, consent
page) are validated live on this very repo. The Cursor / Claude Desktop / Gemini CLI snippets
follow each client's documented config format but haven't been exercised end-to-end by us yet —
if you run one, tell us what happened
(works-fine reports are as valuable as bugs).
Capture while you work (close the loop automatically)
- Local, zero-LLM:
lifeline capturedrafts proposals from your recent git commit messages (the commit body is the why; commits without one are skipped). Run it at the end of a work session; curate withlifeline review. - Team, on GitHub: the Lifeline GitHub App drafts proposals from every merged PR's human-written text (description + reviews) into the hub's Review queue — edit, approve or reject there. Opt-in per repo; PRs with no written rationale are skipped silently.
Auto-connect in Claude Code (SessionStart hook)
Inject the context at the start of each session via the project's .claude/settings.json
(the hook's stdout enters the context). Example — adjust to your version's hook schema:
{
"hooks": {
"SessionStart": [
{ "hooks": [ { "type": "command", "command": "python -m lifeline context" } ] }
]
}
}
Without a hook, the minimal convention (in CLAUDE.md) is: on opening, run python -m lifeline context
and read it before acting. When making any decision/feature/fix, append — that way the next AI
(or you tomorrow) connects and already knows.