AGENT SKILL

find-session

Find opencode sessions by name or content across ALL project directories, bypassing the cwd scoping of session_list/session_search. Use when looking for a session that was started in a different folder.

License 许可
MIT
所属仓库
twidxuga/dotfiles
最近更新
2026-10-28
Stars
★ 0
Forks
0

01 前言 Front Matter

name
find-session
description
Find opencode sessions by name or content across ALL project directories, bypassing the cwd scoping of session_list/session_search. Use when looking for a session that was started in a different folder.

03 SKILL.md 正文

Find Session Skill

The built-in session_list and session_search tools are scoped to the current working directory. This skill bypasses that by querying the opencode SQLite database directly.

Database location

~/.local/share/opencode/opencode.db

How to find a session

1. By title (fast — use this first)

sqlite3 ~/.local/share/opencode/opencode.db \
  "SELECT id, title, directory, datetime(time_updated/1000,'unixepoch') as last_active
   FROM session
   WHERE title LIKE '%<search term>%'
   ORDER BY time_updated DESC
   LIMIT 10;"

2. By content (slower — use if title search returns nothing)

sqlite3 ~/.local/share/opencode/opencode.db \
  "SELECT DISTINCT s.id, s.title, s.directory, datetime(s.time_updated/1000,'unixepoch') as last_active
   FROM session s
   JOIN part p ON p.session_id = s.id
   WHERE p.data LIKE '%<search term>%'
   ORDER BY s.time_updated DESC
   LIMIT 10;"

3. List all recent sessions across all projects

sqlite3 ~/.local/share/opencode/opencode.db \
  "SELECT id, title, directory, datetime(time_updated/1000,'unixepoch') as last_active
   FROM session
   ORDER BY time_updated DESC
   LIMIT 20;"

Once you have the session ID

Read its recent messages via the part table (the session_read tool won't work cross-project):

sqlite3 ~/.local/share/opencode/opencode.db \
  "SELECT substr(p.data, 1, 800), datetime(p.time_created/1000,'unixepoch')
   FROM part p
   JOIN message m ON p.message_id = m.id
   WHERE m.session_id = '<session_id>'
   AND p.data LIKE '{\"type\":\"text\"%'
   ORDER BY p.time_created DESC
   LIMIT 20;"

To get tool calls and actions too (broader view):

sqlite3 ~/.local/share/opencode/opencode.db \
  "SELECT substr(p.data, 1, 1000), datetime(p.time_created/1000,'unixepoch')
   FROM part p
   JOIN message m ON p.message_id = m.id
   WHERE m.session_id = '<session_id>'
   ORDER BY p.time_created DESC
   LIMIT 30;"

Workflow

  1. Run the title search first — it's instant
  2. If no match, run the content search (may be slow on large DBs)
  3. Report: session ID, title, directory, and last active time
  4. If user wants to know what's happening, read the last 15-20 parts and summarise

04 同仓库更多 Skills

twidxuga
twidxuga/dotfiles

terraform-test

Comprehensive guide for writing and running Terraform tests. Use when creating test files (.tftest.hcl), writing test scenarios with run blocks, validating infrastructure behavior with assertions, mocking providers and data sources, testing module outputs and resource configurations, or troubleshooting Terraform test syntax and execution.

测试与质量运维与部署
★ 0
twidxuga
twidxuga/dotfiles

terraform-style-guide

Generate Terraform HCL code following HashiCorp's official style conventions and best practices. Use when writing, reviewing, or generating Terraform configurations.

运维与部署
★ 0
twidxuga
twidxuga/dotfiles

terraform-stacks

Comprehensive guide for working with HashiCorp Terraform Stacks. Use when creating, modifying, or validating Terraform Stack configurations (.tfcomponent.hcl, .tfdeploy.hcl files), working with stack components and deployments from local modules, public registry, or private registry sources, managing multi-region or multi-environment infrastructure, or troubleshooting Terraform Stacks syntax and structure.

运维与部署
★ 0
twidxuga
twidxuga/dotfiles

terraform-search-import

Discover existing cloud resources using Terraform Search queries and bulk import them into Terraform management. Use when bringing unmanaged infrastructure under Terraform control, auditing cloud resources, or migrating to IaC.

运维与部署
★ 0
twidxuga
twidxuga/dotfiles

run-acceptance-tests

Guide for running acceptance tests for a Terraform provider. Use this when asked to run an acceptance test or to run a test with the prefix `TestAcc`.

运维与部署
★ 0
twidxuga
twidxuga/dotfiles

refactor-module

Transform monolithic Terraform configurations into reusable, maintainable modules following HashiCorp's module design principles and community best practices.

代码审查运维与部署
★ 0