This is an OpenCode plugin that displays timestamp, session duration, and git context on each user prompt. The breadcrumb appears at the top of each message.
Single file plugin - All logic is in index.js:
- Uses the
chat.messagehook to inject breadcrumb into user message parts - Persists state (session start, last prompt time) to
~/.config/opencode/breadcrumb/ - Executes git commands synchronously to gather repo context
The breadcrumb text is injected into message parts, which means it becomes part of the conversation context sent to the LLM. Each breadcrumb costs ~30 tokens.
Why not use ignored: true?
We attempted to use the ignored flag on text parts to exclude from context while still displaying. Results:
- Without required IDs (id, sessionID, messageID): Validation error
- With proper IDs: Breadcrumb shows but user's message text disappears
OpenCode's ignored flag hides content from both UI and context. There's no "display-only" option. See docs/FEATURE_REQUEST_STATUSLINE.md for proposed solution.
State persists in ~/.config/opencode/breadcrumb/:
session_start_ts- Resets on OpenCode restartlast_prompt_ts- For calculating delta between promptslast_interval_ts- For 30-minute marker
π MM-DD HH:MM (+Xm Xs) β±οΈXhXm * β β branch βXβX wt:name(N) β βX +X β "commit msg" Xh
| Component | Description |
|---|---|
| π | Date and time |
| (+...) | Delta since last prompt |
| β±οΈ | Session duration |
| * | 30-minute marker (every 30 min) |
| β | Git branch |
| ββ | Ahead/behind upstream |
| wt: | Worktree info |
| β | Modified files |
| + | Untracked files |
| "..." | Last commit message and age |
# Local testing - edit index.js directly
vim ~/.config/opencode/node_modules/opencode-breadcrumb/index.js
# Restart OpenCode to reload plugin
# Changes take effect on next promptnpm version patch|minor|major
npm publish
git pushRequires npm token with 2FA bypass for automation.