Bug description
The CLI TUI prompt history (arrow-up/down navigation in the input) is stored in a single global file rather than being scoped per project. This means pressing arrow-up in one project shows messages typed in completely different projects.
Steps to reproduce
- Open opencode CLI in project A, type and send several messages
- Close opencode
- Open opencode CLI in project B
- Press arrow-up in the input
Expected: See messages previously typed in project B
Actual: See messages from project A (and all other projects) mixed together
Root cause
packages/opencode/src/cli/cmd/tui/component/prompt/history.tsx:32 stores history at a global path:
const historyPath = path.join(Global.Path.state, "prompt-history.jsonl")
Global.Path.state resolves to the OS XDG state directory (~/.local/state/opencode/) which is shared across all projects. The file has no project identifier in its path, and the load/append/move functions have no project filtering.
Suggested fix
Scope the history file per project, e.g.:
const historyPath = path.join(Global.Path.state, `${projectID}`, "prompt-history.jsonl")
Or use Instance.context to derive a project-specific path rather than the global one.
Bug description
The CLI TUI prompt history (arrow-up/down navigation in the input) is stored in a single global file rather than being scoped per project. This means pressing arrow-up in one project shows messages typed in completely different projects.
Steps to reproduce
Expected: See messages previously typed in project B
Actual: See messages from project A (and all other projects) mixed together
Root cause
packages/opencode/src/cli/cmd/tui/component/prompt/history.tsx:32stores history at a global path:Global.Path.stateresolves to the OS XDG state directory (~/.local/state/opencode/) which is shared across all projects. The file has no project identifier in its path, and theload/append/movefunctions have no project filtering.Suggested fix
Scope the history file per project, e.g.:
Or use
Instance.contextto derive a project-specific path rather than the global one.