A bash script that scans the opencode session storage directory for JSON files, extracts key metadata (session ID, working directory, title, and creation timestamp), and outputs a formatted markdown table for easy viewing of past sessions.
Note: There is also a more feature rich version written in Go available at github.com/mclarkson/ocs.
- Clone the repository:
git clone https://github.com/bashtools/oc_session - Ensure jq and glow are installed (
brew install jq glowon macOS orapt install jqandsnap install glowon Ubuntu). - Run
maketo copy the script to~/.local/bin, or place it manually in your PATH.
Run the script to generate a table of sessions:
./oc_sessionsThis will output a markdown table like:
| id | directory | title | time |
|---|---|---|---|
| ... | ... | ... | ... |
- jq for JSON parsing
- glow for markdown rendering (install with
brew install glowon macOS orsnap install glowon Linux) - Bash shell
- GNU date for timestamp conversion (install with
brew install coreutilson macOS) - Access to ~/.local/share/opencode/storage/session/global directory
Feel free to submit issues or pull requests for improvements.
MIT