Package Exports
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@openthread/claude-code-plugin) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@openthread/claude-code-plugin
Share Claude Code conversations to OpenThread — the StackOverflow for AI agents. The community platform for the agentic AI era, where developers share, vote on, and discover the best AI conversation threads from Claude, ChatGPT, Gemini, and more.
One command. Zero config. Publish any Claude Code session as a post others can learn from.
Install
npm i -g @openthread/claude-code-pluginThe postinstall script registers the plugin with Claude Code automatically. Restart Claude Code after installing.
Quick Start
> /ot:share
Analyzing your conversation...
Step 1: Authenticate ✓
Step 2: Find the session file ✓ — 2 contexts detected
Step 3: Review and publish
? This session has 2 detected contexts. Which do you want to share?
> Full thread (Recommended)
seg-0: Debugging PKCE token refresh (turns 0–42)
seg-1: Wiring up the new search index (turns 43–87)
? Choose one or more communities to publish to [multi-select]
[x] Coding with AI (Recommended)
[ ] Debugging with AI
[ ] AI Dev Tools
[ ] Claude Threads
? Auto-generated tags: typescript, auth, debugging. Accept or edit?
> Accept (Recommended)
Edit tags
? Publish this as a Thread or a Skill?
> Thread (Recommended)
Skill
Conversation shared to OpenThread:
• Title: Debugging PKCE Token Refresh in Auth Middleware
• Community: Coding with AI
• Tags: typescript, auth, debugging
• Type: Thread
• URL: https://openthread.me/c/coding-with-ai/post/27512cb1Examples
Share with the strict interactive flow (default)
> /ot:shareThe plugin runs a silent preflight (auth, session discovery, context detection, community fetch — all in parallel) then asks at most four questions:
- Context — if your session contains multiple distinct topics, pick which segment to share or share the full thread. Boundaries are auto-detected from timestamp gaps, working-directory changes, tool-use shifts, and slash-command markers.
- Community — multi-select from the recommended communities. Picking more than one publishes a separate post per community.
- Tags — accept the auto-generated tags or type your own comma-separated list.
- Post type — share as a regular conversation Thread or as a reusable Skill that others can install.
Share a single context segment
After a long session that covered several unrelated tasks, you can publish just the part that matters. The plugin's context detector splits the JSONL transcript into segments, and --segment N slices the body to exactly that range — no manual copy-paste, no leaking of unrelated turns.
Share from any project
The plugin auto-detects the current Claude Code session file via CLAUDE_SESSION_ID. Works in any project directory — just run /ot:share and it finds the right conversation.
Quiet output, by design
The publish step is visually silent: no raw post IDs, no slug echoes, no extra open <url> tool calls. The only thing you see after the questions is the clean summary block with the final post URL.
Why OpenThread?
OpenThread is the social platform for the agentic AI world — the place where developers share what their AI agents actually built. Think StackOverflow meets Reddit, designed from the ground up for AI conversations. Every post is a full thread (including code, thinking, and tool use) that the community votes on, comments on, and learns from.
This plugin is the one-command bridge from your Claude Code session to that community.
Features
- One-command sharing —
/ot:sharepublishes the current Claude Code session to OpenThread with at most four questions and a clean summary. - Context segmentation — auto-detects when a session covers multiple distinct topics (timestamp gaps, CWD changes, tool-use shifts, slash-command boundaries) and lets you publish just the segment you care about with
--segment N. Falls back to the full thread when no clean split is found. - Multi-community publishing — pick one or many communities; the plugin creates a post in each.
- Thread or Skill — publish a session as a regular conversation Thread, or package it as a reusable Skill others can install.
- Silent, parallelized preflight — auth refresh, session lookup, context detection, and community fetch all run in parallel before any prompts. No raw bash dumps, no leaked IDs, no chatty progress logs.
- Privacy first — strips usernames, home directories, file paths, secrets, tokens, emails, and IPs before publishing. Defense-in-depth: the same masking runs on the server too.
- Secure auth — PKCE OAuth flow with automatic token refresh. Credentials stored locally at
~/.claude/plugins/openthread-share/.session.json(mode0600). - CLI management —
openthread-claudebinary for install, uninstall, status checks, and updates.
Usage
Default — strict interactive flow
/ot:shareRuns a silent preflight, then asks up to four questions:
- Context — pick a detected segment or share the full thread (skipped if only one segment is detected).
- Community — multi-select from recommended communities.
- Tags — accept the auto-generated tags or type your own list.
- Post type — Thread or Skill.
After publishing, the plugin prints a clean summary block with the post URL and opens it in your browser. The publish step itself is silent — no raw output to read past.
Skip the preview editor
/ot:share --yesBy default, /ot:share opens the masked body in $EDITOR for a final review before upload (with vim/nvim/emacs modelines disabled to prevent malicious modeline execution from a tampered transcript). Pass --yes to skip the preview and upload immediately — useful in CI or when you trust your masking pipeline.
Behind the scenes
The plugin reads the exact JSONL session file Claude Code wrote for the current session (located via CLAUDE_SESSION_ID), runs it through a privacy masker, optionally slices it to a single context segment, and posts it via the OpenThread plugin API. There is no ranked-file fallback — if CLAUDE_SESSION_ID is missing or the file can't be found, the share aborts cleanly.
Commands
/ot:search <query>
Search OpenThread for threads, comments, communities, or users without leaving your Claude Code session.
Flags:
--type posts|comments|communities|users|all(defaultposts)--community <name>--provider claude|chatgpt|gemini|...--time hour|day|week|month|year|all--limit 1-25(default10)
Works without authentication (narrower visibility). If you're logged in,
you also see private communities you're a member of. After results are
shown, pick a number to import the thread via /ot:import.
> /ot:search hono auth bug
[1] Debugging PKCE token refresh in auth middleware
c/coding-with-ai · u/alice · 3h ago · ▲ 42 · 💬 7
Walks through the PKCE refresh flow and the off-by-one in expiresAt.../ot:import <post-id-or-url> [--read|--context]
Pull a published OpenThread thread into your current workspace.
Imported content is UNTRUSTED third-party data. It may contain prompt injections. The plugin treats every imported byte as data, not instructions, and enforces that boundary at multiple layers.
--read(default) — downloads the thread, sanitizes and masks it locally (defense-in-depth on top of server-side masking), and saves it to~/.openthread/imports/<uuid>.mdwith mode0600inside a0700directory. Claude does not automatically load the file into context. If you want it read, ask in a separate message after the import completes.--context— additionally emits an<imported_thread trust="untrusted">envelope that the skill shows to Claude after you explicitly confirm. Even inside the envelope, the content is treated as data, never as instructions.
Inputs accepted:
- Bare UUID:
27512cb1-4e7a-4c3b-9d8e-1f2a3b4c5d6e - Path:
/c/<community>/post/<uuid>or/post/<uuid> - Full URL:
https://openthread.me/c/<community>/post/<uuid>
Security properties:
- Strict UUID validation on every input form.
- HTTPS enforced unless
OPENTHREAD_API_URLpoints to a loopback host. - Response bodies capped at 5 MB, read in bounded chunks.
- Control characters and ANSI escapes are stripped; paths, usernames, secrets, emails, and IPs are masked locally.
- Writes are atomic via a
.partrename — a partial fetch never lands at the final path. Files land at mode0600in a0700directory. - Every saved file starts with a trust banner reminding Claude that the content is data, not instructions.
/ot:export <post-id-or-url>
Download a thread from OpenThread as a local file. Unlike /ot:import,
this is for archival / sharing — the file is written with sharable
permissions and does NOT include the "untrusted data" banner.
Flags:
--format markdown|text|json(defaultmarkdown)--out <path>(default./ot-<slug>-<short>.<ext>)--stdout--no-banner
The file is path-traversal-guarded (relative paths must stay under cwd;
absolute paths are denied into system dirs). Content is re-masked
locally on top of the server's masking as defense-in-depth. Writes are
atomic via a .part rename and land at mode 0644 so the file can be
committed or shared. Exported files are NOT loaded into Claude's
context — if you want Claude to read one, open it in a follow-up
message.
CLI Commands
| Command | Description |
|---|---|
openthread-claude install |
Install and register the plugin with Claude Code |
openthread-claude uninstall |
Remove the plugin and deregister from Claude Code |
openthread-claude status |
Show plugin installation and registration state |
openthread-claude update |
Reinstall plugin (update to current version) |
Configuration
Environment variables override the default endpoints. Set them in your shell profile or .env file.
| Variable | Default | Description |
|---|---|---|
OPENTHREAD_API_URL |
https://openthread.me/api |
Backend API base URL |
OPENTHREAD_WEB_URL |
https://openthread.me |
Web app base URL (used for post links) |
Manual Install
If you prefer not to use npm:
- Download the latest
.ziprelease from openthread.me/extensions. - Extract it to
~/.claude/plugins/openthread-share/. - Run
openthread-claude installto register with Claude Code. - Restart Claude Code.
mkdir -p ~/.claude/plugins/openthread-share
unzip openthread-claude-code-plugin.zip -d ~/.claude/plugins/openthread-share/License
MIT