Imported from xshifty/oh-my-opencode (
AGENTS.md). Install upstream withnpx skills add xshifty/oh-my-opencode. Copyright stays with the author.
AGENTS.md — oh-my-opencode
Repo Purpose
A collection of OpenCode skills, commands, scripts, and agent configs. Components are symlinked into the user's OpenCode config dir via install.sh.
Key Commands
./install.sh # Symlink everything to ~/.config/opencode
./install.sh --target ~/.config/opencode # Custom target dir
Scripts are standalone Python:
python3 agents/scripts/<script>.py [db_path] # JSON to stdout (most scripts)
python3 agents/scripts/session_analyzer.py [db_path] # Combined JSON output
python3 agents/scripts/generate_report.py [--out path] [db_path] # Writes insights.html
Most scripts output JSON to stdout. The exception is generate_report.py which writes insights.html to the current directory (or --out path).
Architecture
agents/
├── AGENTS.md # Agent constitution (symlinked to OpenCode config)
├── commands/ # OpenCode command definitions (*.md with frontmatter)
├── scripts/ # Python DB query scripts
│ ├── shared.py # DB helpers: find_db_path(), get_db(), fetch_rows()
│ ├── find_db.py # Returns {"db_path": "..."} JSON
│ ├── get_*.py # Individual stats scripts (JSON to stdout)
│ └── generate_report.py # Self-contained HTML dashboard generator
├── skills/ # SKILL.md directories (context7-mcp, session-analyzer, etc.)
└── templates/ # insights.html — dark theme dashboard template
Script Conventions
- All scripts import from
shared.pyfor DB access - Accept optional
db_pathas first CLI arg; auto-discovers viafind_db_path()if omitted - Most scripts output valid JSON to stdout (never print debug info)
generate_report.pyis the exception — it writesinsights.htmlto disk (accepts--out path)- DB timestamps are in milliseconds (divide by 1000 for Python datetime)
session_analyzer.pyis the combined runner — use--recent Nto limit sessions
DB Schema Notes
sessiontable:time_created,time_updated(ms epoch),id,cwdmessagetable:datais JSON with$.rolefield ("user" / "assistant")parttable:datais JSON — useshared.parse_part_data()to handle str/dict- Use
shared.build_placeholders()for safe SQL IN clauses
Installation Behavior
install.sh symlinks top-level items from agents/ into OpenCode config:
AGENTS.md,commands/,skills/→ direct symlinksscripts/,templates/→ explicit folder symlinks (skipped in main loop)- Existing symlinks are replaced (safe to re-run)
- Creates target dir if missing
DB Discovery Order
$OPENCODE_CONFIGenv var~/.config/opencode$XDG_CONFIG_HOME/opencode~/Library/Application Support/opencode(macOS)~/.local/share/opencode/opencode.db(Linux default)
Python Requirements
- Python 3.12+
- No external dependencies — stdlib only (
sqlite3,json,os,collections)
Important Notes
insights.htmltemplate uses{placeholder}syntax —generate_report.pyhandles replacement- Skills are activated by their
namefield in SKILL.md frontmatter - The
insightscommand (incommands/insights.md) runsgenerate_report.pyas its primary step — no manual script orchestration needed generate_report.pyusesscripts/../templates/insights.htmlto resolve the template path__pycache__/is gitignored — scripts work fine with or without it