opencode-memory

Browse local OpenCode history including sessions, messages, plans, prompt history, and prior decisions. Use when users mention “history/previous session/last/remember/recollect/plan/prior work” or when restoring/debugging repeatable work. Not intended for brand‑new tasks or cases where current files/Git already provide the answer.

Last repository push
GitHub Stars
111
Forks
4
Issues / PRs
0

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "opencode-memory" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-8e5f9298c47118445b23dd2d06bdecc9ea0bf5b09626420cce26312009369244. Verify the upstream source and version against https://github.com/carson2222/skills before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

github.com

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

Browse local OpenCode history including sessions, messages, plans, prompt history, and prior decisions. Use when users mention “history/previous session/last/remember/recollect/plan/prior work” or when restoring/debugging repeatable work. Not intended for brand‑new tasks or cases where current files/Git already provide the answer.

0 Downloads

Introduction source: third_party · carson2222 · 0.0.1 Reference

SkillPi interpretation

Tasks
Read-only lookup for local OpenCode history. Use it only when prior sessions, plans, or decisions would help. Do not inject history by default.
Audience
User asks for history, previous sessions, last time, plans, recall, or memory. Resuming a project where prior OpenCode context may matter. Debugging a repeat issue that may have appeared earlier. Do not use when repo files/git already answer the question or the task is new.
Inputs and outputs
Not specified in the source documentation.
Software, accounts and paid services
Run this first in bash: Useful files: Plans: `$DATA_ROOT/plans/*.md` Prompt history: `$STATE_ROOT/prompt-history.jsonl` Session diffs: `$DATA_ROOT/storage/session_diff/<session-id>.json`
Limits and differences
Not specified in the source documentation.
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: opencode-memory
description: >
  Browse local OpenCode history: sessions, messages, plans, prompt history, and
  prior decisions. Use when the user says history, previous session, last time,
  remember, recall, plans, prior work, or when resuming/debugging repeated work
  where earlier OpenCode context may help. Do not use for fresh tasks or when
  current files/git already answer the question.
license: Apache-2.0
compatibility: opencode

OpenCode Memory Browser

Read-only lookup for local OpenCode history. Use it only when prior sessions, plans, or decisions would help. Do not inject history by default.

Use When

  • User asks for history, previous sessions, last time, plans, recall, or memory.
  • Resuming a project where prior OpenCode context may matter.
  • Debugging a repeat issue that may have appeared earlier.

Do not use when repo files/git already answer the question or the task is new.

Rules

  • Read-only. Never modify OpenCode DB/files.
  • Use sqlite3 with read-only URI. Do not read the DB with file-read tools.
  • Keep results small with LIMIT and targeted LIKE.
  • Summarize relevant findings; do not dump raw history.
  • Avoid auth/provider tables: account, credential, control_account, account_state.

Setup

Run this first in bash:

DATA_ROOT="${XDG_DATA_HOME:-$HOME/.local/share}/opencode"
STATE_ROOT="${XDG_STATE_HOME:-$HOME/.local/state}/opencode"
DB="$(opencode db path 2>/dev/null || true)"
[ -n "$DB" ] || DB="${OPENCODE_DB:-$DATA_ROOT/opencode.db}"
case "$DB" in :memory:|/*) ;; *) DB="$DATA_ROOT/$DB" ;; esac
if [ ! -f "$DB" ]; then
  for candidate in "$DATA_ROOT"/opencode*.db; do
    [ -f "$candidate" ] && DB="$candidate" && break
  done
fi
DB_URI="file:${DB}?mode=ro"

Useful files:

  • Plans: $DATA_ROOT/plans/*.md
  • Prompt history: $STATE_ROOT/prompt-history.jsonl
  • Session diffs: $DATA_ROOT/storage/session_diff/<session-id>.json

Queries

Summary

sqlite3 "$DB_URI" "
  SELECT 'projects', COUNT(*) FROM project
  UNION ALL SELECT 'main sessions', COUNT(*) FROM session WHERE parent_id IS NULL
  UNION ALL SELECT 'messages', COUNT(*) FROM message
  UNION ALL SELECT 'parts', COUNT(*) FROM part
  UNION ALL SELECT 'todos', COUNT(*) FROM todo;
"

Recent sessions

sqlite3 "$DB_URI" "
  SELECT s.id, COALESCE(s.title, 'untitled') AS title,
    COALESCE(p.name, p.worktree, '') AS project,
    datetime(s.time_updated/1000, 'unixepoch', 'localtime') AS updated,
    (SELECT COUNT(*) FROM message m WHERE m.session_id = s.id) AS messages
  FROM session s
  LEFT JOIN project p ON p.id = s.project_id
  WHERE s.parent_id IS NULL
  ORDER BY s.time_updated DESC
  LIMIT 10;
"

Search text

Replace SEARCH_TERM first.

sqlite3 "$DB_URI" "
  SELECT s.id, COALESCE(s.title, 'untitled') AS title,
    json_extract(m.data, '$.role') AS role,
    datetime(m.time_created/1000, 'unixepoch', 'localtime') AS time,
    substr(json_extract(p.data, '$.text'), 1, 200) AS snippet
  FROM part p
  JOIN message m ON m.id = p.message_id
  JOIN session s ON s.id = m.session_id
  WHERE s.parent_id IS NULL
    AND json_extract(p.data, '$.type') = 'text'
    AND json_extract(p.data, '$.text') LIKE '%SEARCH_TERM%'
  ORDER BY m.time_created DESC
  LIMIT 10;
"

Read session text

Replace SESSION_ID_HERE first. Text parts only; use the reference for tool, patch, file, reasoning, or V2 internals.

sqlite3 "$DB_URI" "
  SELECT json_extract(m.data, '$.role') AS role,
    datetime(m.time_created/1000, 'unixepoch', 'localtime') AS time,
    GROUP_CONCAT(json_extract(p.data, '$.text'), char(10)) AS text
  FROM message m
  LEFT JOIN part p ON p.message_id = m.id
    AND json_extract(p.data, '$.type') = 'text'
  WHERE m.session_id = 'SESSION_ID_HERE'
  GROUP BY m.id
  ORDER BY m.time_created ASC
  LIMIT 50;
"

Plans And Prompt History

ls -lt "$DATA_ROOT"/plans/*.md 2>/dev/null | head -20
tail -20 "$STATE_ROOT"/prompt-history.jsonl 2>/dev/null

Prompt history entries currently use input, mode, and parts[]; do not assume root text.

Deep Reference

Use references/storage-format.md only when you need table details, part/tool shapes, legacy JSON paths, or debug queries.

Current listing version

0.0.1

Verify the source revision ↗

Safety and assessment details

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value88/100

Highlights

  • 高效解决用户恢复项目、调试重复问题的核心痛点
  • 显著提升 AI 协作中的上下文检索效率
Trigger Precision92/100

Highlights

  • 触发词覆盖全面且边界清晰
  • 明确排除不适用场景,降低误触风险
Structure and Standards85/100

Areas to improve

  • 缺少显式 When to Use 章节标题 Reported severity: Minor

    文档内容已涵盖使用场景说明,但未使用标准章节标题

    Recommendation: 建议添加显式的 '## When to Use' 章节以提升可读性

Highlights

  • Phase 划分清晰,包含完整 setup 和 query 示例
  • frontmatter 信息完整,单文件长度适中
Execution Reliability70/100

Areas to improve

  • 引用文件缺失 Reported severity: Major

    SKILL.md 引用了 references/storage-format.md 但未传入该文件

    Recommendation: 请确保所有被引用的文件都包含在 Skill ZIP 包中

  • description 写错位置 Reported severity: Minor

    顶层 description 字段为空,实际描述内容位于 skill_body 内部

    Recommendation: 建议将核心描述内容移至顶层 description 字段

Highlights

  • 数据库访问采用只读模式,安全可靠
  • 路径查找逻辑健壮,支持多候选路径回退
Evidence Verifiability (mean of the first four)84/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

  • Accounts, secrets or authorization

    Use a dedicated least-privilege account. Keep secrets out of public content and command logs; verify the receiving service and tenant.

    Mentioned in main document · lines 32

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Run this first in bash: Useful files: Plans: `$DATA_ROOT/plans/*.md` Prompt history: `$STATE_ROOT/prompt-history.jsonl` Session diffs: `$DATA_ROOT/storage/session_diff/<session-id>.json`

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.