cc-session-io weekly downloads statistics
By elidickinson (2 listings) · npm · Claude Code
Read, write, and create Claude Code session files (unofficial)
cc-session-io has 76,388 recorded weekly downloads on npm, an increase of 151% over the past 30 days, ranking #685 of 3,247 tracked listings.
About cc-session-io
cc-session-io
Read, write, and create Claude Code session files.
Can create new session history files or read/write existing ones that will work with /resume in Claude Code. Useful for importing conversation history from another coding agent to continue it with claude.
No runtime dependencies. Not affiliated or supported by Anthropic, the makers of Claude Code.
Scope
Reads and writes user and assistant message records, with text, thinking,
tool_use, tool_result and image content blocks, and attachment records —
Claude Code's own injected context, such as an @file expansion. importMessages
repairs tool_use/tool_result pairing on the way in. Sessions written this way
resume in Claude Code.
Preserves every other record type Claude Code writes (queue-operation,
last-prompt, summaries, and anything added by a future release) through
UnknownRecord, so a read-modify-write leaves them untouched. Writing one means
dangerousAppendRecord(), which appends whatever you hand it — the typed helpers
only cover messages and attachments, because the other record types share almost
none of their fields and synthesizing those would produce records Claude Code
never writes.
Does not handle subagent transcripts: isSidechain is always written false,
and Claude Code keeps sub-agent conversations in a separate subagents/ directory
that this library neither creates nor manages. See also the Bun/Node hash
mismatch for project paths
over 200 characters.
Install
npm install cc-session-io
Requires Node >= 20.
Simple CLI Demo
# Create new session
cc-session create -p /my/project
# Add messages to session
cc-session add user "Hello!" -p /my/project -s <id>
cc-session add assistant "Hi, how can I help?" -p /my/project -s <id>
# Read conversation
cc-session read -p /my/project -s <id>
# List sessions
cc-session list -p /my/project
Options:
-p <path>- Project path (required)-s <id>- Session ID (required for add/read)
Quick Start
Create a new session
import { createSession } from 'cc-session-io';
const session = createSession({ projectPath: '/path/to/project' });
session.addUserMessage('Refactor the auth module');
session.addAssistantMessage([{ type: 'text', text: 'I will refactor the auth module.' }]);
session.save();
// Resume it: claude --resume <session.sessionId>
Append to an existing session
import { openSession } from 'cc-session-io';
const session = openSession({
sessionId: 'existing-uuid-here',
projectPath: '/path/to/project',
});
// Existing messages are available
console.log(`${session.messages.length} messages loaded`);
// Append new messages — they chain onto the last existing record
session.addUserMessage('One more thing...');
session.addAssistantMessage([{ type: 'text', text: 'Sure, what is it?' }]);
session.save(); // appends to the existing JSONL file
API
createSession(opts): Session
Creates a new session. Generates a UUID session ID and resolves the JSONL path.
| Option | Type | Default | Description |
|---|---|---|---|
projectPath | string | required | Absolute path to the project. Determines where the JSONL file is written. |
claudeDir | string? | ~/.claude | Override the Claude config directory. |
cwd | string? | projectPath | Working directory written into records. |
gitBranch | string? | "HEAD" | Git branch name written into records. |
version | string? | "2.1.83" | Claude Code version to claim. |
model | string? | "claude-sonnet-4-6" | Default model for assistant messages. |
openSession(opts): Session
Opens an existing session by ID for reading or appending.
| Option | Type | Description |
|---|---|---|
sessionId | string | UUID of the session. |
projectPath | string | Absolute path to the project. |
claudeDir | string? | Override the Claude config directory. |
readSession(jsonlPath, projectPath?): Session
Reads a session directly from a JSONL file path.
Session
Properties
| Property | Type | Description |
|---|---|---|
sessionId | string | UUID of the session. |
projectPath | string | Project path. |
jsonlPath | string | Absolute path to the JSONL file. |
records | JsonlRecord[] | All JSONL records (including non-message types). |
messages | (UserRecord | AssistantRecord)[] | Only user and assistant records. |
attachments | AttachmentRecord[] | Only attachment records. |
session.addUserMessage(content): string
Adds a user message. content is either a string or an array of user content
blocks (text, image, tool_result), which are written unchanged. Throws on
an empty array, which Anthropic rejects. Returns the record's UUID.
session.dangerousAppendRecord(record, opts?): void
Appends a record verbatim. The escape hatch for record types this library does not
model, and for carrying records from one session into another — with one
exception: use addAttachment for attachments.
Dangerous because nothing is synthesized or validated beyond sessionId and the
parent link — the shape is whatever you pass, and Claude Code will read it back.
sessionId is overwritten with this session's, since a record claiming another
session is never what a caller wants. The record is appended verbatim and does
not advance the chain, so the next message parents to whatever came before it.
That is right for chain-external records like queue-operation, but wrong for
attachments — Claude Code threads those through the chain, so carry them with
addAttachment instead.
parentUuid is the one thing checked: a dangling parent makes Claude Code resume
with empty context and answer confidently from nothing, and it does not
announce itself, so it throws instead.…
Description from the npm listing.
- claude
- claude-code
- session
- resume
README badge
Show your rank in a README or on your website. The badge updates automatically.
Charts
Images: 30d · 1y · all time · 1600×900 dark
Adoption over time
7/30/90-day growth
Ranking history
Listing placement
Listing placement
Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.
Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.
Recent observations
Full history (592)Similar npm Claude Code plugins
All 20 cc-session-io alternativesData source
Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.
Listing: https://www.npmjs.com/package/cc-session-io. First seen Oct 16, 2026; last successful collection Dec 6, 2026. See the methodology.