op0ai/usectx
usectx Memory kit: attach hosted MCP, session lease, hop, extract. Tokens stay out of mcp.json.
Changelog
All notable changes to the usectx public Memory kit live here.
Engine work (buckets, doctor, native MCP door, extract container) ships in the private lab (usectx-lab) and is not versioned by this pack. This kit stays a thin attach / session / skills surface over hosted https://ctx.op0.ai.
[0.4.2] — 2026-09-11
Reconcile to Origin Empty-hook fail-closed contract
Replaces the thin 0.3.1 { allowed, reason } surface with Origin kit 0.4.2 security semantics.
- Canonical hook pack:
hooks/hooks.json+hooks/usectx-hook.mjs. Commands run vianode ./hooks/usectx-hook.mjs(Node-on-PATH residual stays open). Repo-roothooks.jsonis kept identical for GH / Cursor project-root loaders. failClosed: trueonbeforeSubmitPromptandbeforeMCPExecutionso crash / timeout / invalid JSON blocks the action.- Stdout contract is
{ permission, continue }(plususer_messageon decisions). Never empty or null JSON — handler faults still emit a deny object. op0mt_allowlist unchanged:agent_identity,action_invoke,packet_export.- Workspace
cleandenied for non-restricted tokens (orphan prune is not a default workspace MCP). - validate-hooks gate now also requires
failClosedon the two security events and resolvesnode ./hooks/…script paths. - Never disable security hooks. Documented in
HOOKS.md.
Delta vs 0.3.1: richer Cursor-native decision fields, fail-closed handler flags, Origin hooks/ layout, and explicit clean deny. Same empty-command rejection and op0mt_ catalog.
Marketplace packaging (still 0.4.2)
Public-kit manifests for Cursor Marketplace, Grok Build, and cursor.directory. No version bump.
- Cursor Plugin:
.cursor-plugin/plugin.json+.cursor-plugin/mcp.jsonwith${OP0MT_TOKEN}(Host grant only). Root Agent Pluginplugin.jsonunchanged. - Grok Build:
.grok-plugin/plugin.jsonand a single-plugin.grok-plugin/marketplace.jsonforgrok plugin marketplace add. - Docs:
docs/marketplace-submission.md(Cursor publish checklist, xAI SHA-pinned entry template, cursor.directory form). Ready catalog JSON:docs/marketplace/xai-official.entry.json. - Honest surface: this GH kit does not ship
usectx agent/usectx packetCLIs.op0mt_grants stay limited to hostedagent_identity,action_invoke,packet_export. - Bearer resolver reads
OP0MT_TOKENonly after explicitCTX_*env and a saved project/home workspace login, so a Host grant cannot shadowusectx ask/search/ stdio. Marketplace MCP Authorization stays${OP0MT_TOKEN}(never a workspace bearer).
[0.3.1] — 2026-09-11
Security hooks & Cursor Empty-hook fix
- Ship non-empty
hooks.json: declaressessionStart,beforeSubmitPrompt,beforeMCPExecution, andsessionEndpointing to executable./bin/usectx-hook.mjs. Fixes native Cursor hook loader rejecting empty command declarations ("Empty hook is not allowed"). - Security hook handler (
bin/usectx-hook.mjs):- Fail-closed JSON allow/deny output (never null or empty JSON).
- Bearer requirement on session start, prompt submission, and MCP tool execution.
- For
op0mt_agent tokens, strictly restricts permitted tool catalog toagent_identity,action_invoke, andpacket_export. All other tools fail closed cleanly.
- Hook validation gate (
bin/usectx-validate-hooks.mjs):- Static gate verifying that
hooks.jsonexists, is valid JSON, contains all required hook events, and all handlers declare non-emptycommandstrings referencing valid files. - Exposed via CLI
usectx validate-hooksand enforced duringinstall.sh.
- Static gate verifying that
- Separate MCP client examples:
examples/cursor.mcp.json: human/workspace token pattern (CTX_HTTP_TOKEN).examples/cursor.agent.mcp.json: agent token pattern (op0mt_).
- Safeguard docs: Updated
HOOKS.md,README.md, andexamples/README.mdto document the security model and remind operators to never disable security hooks or safeguards.
[0.3.0] — 2026-09-06
Memory kit for agents
Attach hosted Memory in one login. Agents lease search; they do not invent a bigger window.
What works
- Session attach for Cursor, Claude Desktop, Claude Code, Codex, and similar harnesses
usectx-sessionskill: lease on start, refuse closed (no bearer / 401 / door refuse), hopcode_graphfor named symbols, settle ingest only whentools/listlists itusectx-attachskill: MCP-only wiring or CLIlogin- Hosted MCP at
https://ctx.op0.ai/mcp(bearer owned by the client config — never packmcp.json) - Accept probe:
GET https://ctx.op0.ai/readyz→ok+retrievalModehybrid(orlexicaldegraded) - Install:
install.sh/ CDN mirror; skills via pinnednpx skills add op0ai/usectx@… - CLI:
login,readyz,whoami,ask,search, posture helpers for extract/ingest
What needs usectx login (or a workspace bearer)
- Any leased
search/ask/ MCP Memory call - Writing home MCP (
usectx login --global→~/.cursor/mcp.jsonand Claude Desktop when present) - Token path:
~/.op0/usectx/tokenorCTX_HTTP_TOKEN - Mint at app.op0.ai/ctx — not
/work
Honest limits
- This repo is the public kit, not the engine. Lab/engine iterates separately.
- Hosted
extractis bind/queue — not a local container from this pack alone. ingestTranscriptProjectiononly when the hosted catalog exposes it.- Empty index → honest empty; never fabricates hits.
Stranger path
- Install (optional):
git clone … && bash install.sh --global - Login:
usectx login --global(or paste bearer into client MCP) - Prove: MCP
search{ "query": "ready", "limit": 1 }orusectx ask "ready"
[0.2.0] — 2026-09-01
- Split skills (
attach,retrieve,code-graph,extract) - Consent-aware installer; Claude adapter /
.claude-plugin - Piped curl stays project-local;
--globalfor home pack + MCP
[0.1.0] — initial
- Initial public harness pack release