CLASSIFICATION: PUBLIC LICENCE: MIT DOC-ID: JGS-LIT-MEMORY REV 1.1.0

jgs-lit-memory

Capture the papers once. Query the corpus, not the internet, next time.

One skill and one script: papers from OpenAlex into a git-tracked .lit corpus in your project.

§01 · What it is

A corpus on your disk, not a subscription

Research conversations re-find the same papers every week. jgs-lit-memory turns each keep-worthy paper into one normalized JSON record under .lit/ in the project that produced it, with citation edges between records. The corpus is plain files, git-tracked, and survives every session. The next conversation asks the corpus before it asks the internet.

Papers and edges

papers/<W-id>.json, one record per work; graph/edges.jsonl carries who cites whom. Atomic writes: a crash never leaves a half-written file.

Offline inbox

Papers land in inbox.jsonl the moment they come up. No network needed. A triage run resolves the queue and reports what failed, with reasons.

Corpus answers first

A generated .lit/SKILL.md index carries counts and query recipes, so the agent checks the corpus before re-searching OpenAlex.

§02 · Verbs

One resolution verb per call

lit_fetch.py is the only component that touches the network, and it talks to OpenAlex only. Everything else is agent reading and writing. Singleton DOI and W-id lookups are free; budgeted calls warn without an API key.

Resolution verbs. Exit codes: 0 success or already present, 1 failure, 2 usage error.
InvocationBehavior
--doi <doi>Singleton capture by DOI (free). seed=true, source=capture.
--openalex <W-id>Singleton capture by W-id (free). Same write semantics.
--arxiv <id> --title <t>OpenAlex has no arXiv lookup; resolves through the verified title search. Bare --arxiv is a usage error.
--title <t> [--author] [--year]Budgeted search with client-side verification. Near-misses print as candidates and write nothing.
--ids "W1|W2|..."Batch fetch, 100 per call, skips existing records.
--inboxTriage the offline queue: dedupe, resolve, rewrite once. Failures stay queued with their reason.
--statusCorpus summary. Read-only.
--checkLive smoke test of the four endpoint forms.
§03 · Agents

One pack, every main host

install.py already targets the main coding agents. Native folder copy for ZCode, Claude Code, OpenAI Codex, GitHub Copilot CLI, and OpenClaw. Gemini CLI as an extension. Cursor as project-local rules. Run python install.py --agent all for the user-global hosts, then --agent cursor in the repo that needs rules. Per-path table: docs/other-agents.md.

ZCode

Native folder. ~/.zcode/skills/<skill>/. --agent zcode

Claude Code

Native folder, namespaced. ~/.claude/skills/jgs/<skill>/. --agent claude

Cursor

Project-local .mdc rules. Run in the repo you want. --agent cursor

Gemini CLI

Extension under ~/.gemini/extensions/. --agent gemini

OpenAI Codex

Native folder. ~/.agents/skills/jgs/<skill>/. --agent codex

GitHub Copilot CLI

Native folder. ~/.copilot/skills/jgs/<skill>/. --agent copilot

§04 · Usage

Conversational, not a slash command

The lit-capture skill triggers when a paper comes up with enough identity to fetch (DOI, arXiv id, OpenAlex W-id, or exact title plus author or year) and looks worth keeping. It scans the conversation, dedupes against the corpus, then captures offline or fetches now with your consent.

# say this in a research conversation
Capture this one: 10.1038/nature12373
Save that arXiv paper, 2401.12345, "Attention Is All You Need"
What do we have on citation graph bias? Check the corpus first.

Direct script use, after install (ZCode path shown; other hosts use their installed folder):

# status is read-only; try it first
python "$HOME/.zcode/skills/lit-capture/lit_fetch.py" --status
python "$HOME/.zcode/skills/lit-capture/lit_fetch.py" --doi 10.1038/nature12373
python "$HOME/.zcode/skills/lit-capture/lit_fetch.py" --inbox

Full invoke and first-run detail, limits, and corpus layout: docs/skill-usage.md. Skill index: SKILLS.md.

§05 · Install

Clone, install, restart, capture

Prerequisites: Python 3.9+ (stdlib only), network access to api.openalex.org, an OpenAlex API key optional. Install into every user-global host, or pick one. Restart the agent session so it discovers the skill.

# Python 3.9+, stdlib only. OpenAlex over HTTPS.
git clone https://github.com/jgsystemsconsulting/jgs-lit-memory
cd jgs-lit-memory
python install.py --agent all     # ZCode, Claude Code, Codex, Copilot, OpenClaw, Gemini
python install.py --agent cursor  # project-local .cursor/rules
python install.py --dry-run
python install.py --list-agents

Prefer your agent to do it? The paste-ready "Install with your AI agent" prompt is in the README. In-host install also works: Claude Code /plugin marketplace add jgsystemsconsulting/jgs-lit-memory, Gemini gemini extensions install from the repo URL.