بنقرة واحدة
session-history
Recall prior work from local session stores (opencode SQLite + Claude Code JSONL)
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Recall prior work from local session stores (opencode SQLite + Claude Code JSONL)
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
| name | session-history |
| description | Recall prior work from local session stores (opencode SQLite + Claude Code JSONL) |
opencode db "<sql>" --format json~/.claude/projects/<encoded-cwd>/*.jsonlAGENTS.md, skills), not a side store.stephen-context feels stale — verify against real session activity and propose updates to that skill's markdown.insert/update/delete in the opencode DB; never mutate JSONL.opencode db queries over the interactive shell.pragma table_info(...).rg then parse with jq.Locate the database (don't hardcode the path):
opencode db path
Inspect schema first:
opencode db "select name, type from sqlite_master where type in ('table','index') order by type, name;"
opencode db "pragma table_info(session);"
opencode db "pragma table_info(message);"
opencode db "pragma table_info(part);"
Recent sessions:
opencode db "select id, title, directory, time_created from session order by time_created desc limit 20;" --format json
Sessions joined to project + workspace:
opencode db "
select s.id, s.title, s.directory, p.worktree, w.name as workspace, s.time_created
from session s
join project p on p.id = s.project_id
left join workspace w on w.id = s.workspace_id
order by s.time_created desc limit 20;
" --format json
Messages in a session (data column is JSON):
opencode db "
select id, json_extract(data,'$.role') as role, json_extract(data,'$.model') as model, time_created
from message where session_id='SESSION_ID' order by time_created, id;
" --format json
Parts in a session:
opencode db "
select id, message_id, json_extract(data,'$.type') as type, time_created
from part where session_id='SESSION_ID' order by time_created, id;
" --format json
Project dirs encode the cwd by replacing / with - (leading dash preserved):
ls ~/.claude/projects/
# e.g. -Users-sjd-claude-test
Each *.jsonl is one session; one JSON event per line. Useful type values: user, assistant, mode, permission-mode. User/assistant lines carry message.content, cwd, gitBranch, timestamp, sessionId, version. Subagent transcripts live in <session-id>/subagents/*.jsonl.
List sessions for a project (newest by mtime):
ls -t ~/.claude/projects/-Users-sjd-<project>/*.jsonl
First user prompt of each recent session (across all projects):
for f in $(find ~/.claude/projects -maxdepth 2 -name '*.jsonl' -print0 | xargs -0 ls -t | head -10); do
ts=$(rg '"type":"user"' "$f" | head -1 | jq -r '.timestamp')
msg=$(rg '"type":"user"' "$f" | head -1 | jq -r '
if (.message.content|type)=="string" then .message.content
else (.message.content[]?|select(.type=="text")|.text // empty) end')
echo "[$ts] $(basename "$f")"; echo " $msg"
done
Find sessions mentioning a topic:
rg -l '"type":"user"' ~/.claude/projects/ | xargs rg -l 'PATTERN'
Extract user prompts from one session (skip command/caveat wrappers):
rg '"type":"user"' ~/.claude/projects/-Users-sjd-<project>/<session>.jsonl \
| jq -r 'select(.message.content|type=="string") | .message.content' \
| grep -vE 'local-command-caveat|command-name|command-message|command-args'
Note: message.content may be a string or an array of content blocks (text/tool_use/tool_result). Handle both; for arrays, pull text fields from type:"text" blocks.
Global typed-prompt history:
rg 'PATTERN' ~/.claude/history.jsonl
stephen-context), flag it and propose a markdown update rather than silently overriding.opencode db --help~/.claude/stephen-context skill for the durable profile; opencode-db-inspect for opencode-only deep dives.Write documentation consumed by LLM agents — AGENTS.md, skill files, .ai/ plans, and agent instructions
Keep DESIGN.md and plan docs synchronized with implementation decisions across repositories
Draft and create pull requests using the repository's conventions and template
Write documentation for human readers — READMEs, design docs, protocol specs, ADRs, runbooks, and API guides
Iterate on Grafana dashboard JSON files. Use when the user wants to create, modify, or fix Grafana dashboards — including panel layout, queries, colors, variables, and styling.
Inspect local OpenCode session data safely with the `opencode db` command