# och — OpenCode Custom Hindsight Build

Custom build of [opencode](https://github.com/opencode-ai/opencode) with MCP/TUI integrations for Hindsight, Whisperer, and work-tracker.

**Branch:** `feat/mcp-notifications` plus the local Enter submit fix
**Base:** upstream `dev`
**Version:** `0.0.0-feat/mcp-notifications-202605310623`
**SHA256:** `f293367f905661044bcc1abe43c8bc40c62b54b33bbca0aa4540c0ad956f851a`

## What's Included

- **MCP synthetic prompt transport** — hidden channel for MCP integrations (Whisperer, work-tracker) that bypasses the visible input
- **Visible synthetic rendering** — MCP prompts with `visible: true` render muted in the transcript with `◇ MCP · <server-name>` header
- **Agent state notifications** — `notifications/opencode/agent/state` for MCP clients
- **Session status notifications** — `notifications/opencode/session/status` (idle/busy/retry)
- **Enter submit fix** — accepts `linefeed` and `kpenter` in addition to `return` for terminals that send LF or keypad Enter

## Quick Install (Linux x64)

```sh
curl -fsSL https://s3.casonatto.dev/shared/opencode-custom/install.sh | sh
```

This installs to `~/.opencode-custom-hindsight/bin/och`.

## Manual Install

```sh
# Download
curl -fLo /tmp/och.tar.gz \
  https://s3.casonatto.dev/shared/opencode-custom/opencode-custom-pr-30019-linux-x64-202605310623.tar.gz

# Extract
mkdir -p ~/.opencode-custom-hindsight/bin
tar -xzf /tmp/och.tar.gz -C ~/.opencode-custom-hindsight/bin

# Make executable
chmod +x ~/.opencode-custom-hindsight/bin/opencode
mv ~/.opencode-custom-hindsight/bin/opencode ~/.opencode-custom-hindsight/bin/och
```

## Wrapper Script (recommended)

Create `~/.local/bin/opencode-custom-hindsight.sh`:

```sh
#!/usr/bin/env sh
set -eu

# Load launcher env as strict key=value data (do not source it as shell code).
if [ -f "$HOME/.config/opencode/launcher.env" ]; then
  exec python3 - "$HOME/.config/opencode/launcher.env" "$HOME/.opencode-custom-hindsight/bin/och" "$@" <<'PY'
import os
import re
import sys

env_path = sys.argv[1]
cmd = sys.argv[2]
args = sys.argv[3:]

with open(env_path, encoding="utf-8") as env_file:
    for line in env_file:
        line = line.strip()
        if not line or line.startswith("#"):
            continue
        if "=" not in line:
            raise SystemExit(f"Invalid launcher env line: {line}")
        key, value = line.split("=", 1)
        if not re.fullmatch(r"[A-Za-z_][A-Za-z0-9_]*", key):
            raise SystemExit(f"Invalid launcher env key: {key}")
        os.environ[key] = value

os.execv(cmd, [cmd, *args])
PY
fi

exec "$HOME/.opencode-custom-hindsight/bin/och" "$@"
```

Then add an alias to your shell rc:

```sh
alias och="$HOME/.local/bin/opencode-custom-hindsight.sh"
```

## Verify

```sh
och --version
# 0.0.0-feat/mcp-notifications-202605310623

och mcp list
# Should show: codegraph, serena, context7, brave-search (all connected)
```

## Configuration

`och` shares the default opencode config/data paths:

| Path | Location |
|------|----------|
| Config | `~/.config/opencode` |
| Data | `~/.local/share/opencode` |
| State | `~/.local/state/opencode` |
| Cache | `~/.cache/opencode` |

No separate config is needed — it reads the same `opencode.json`/`opencode.jsonc`.

## Updating

Re-run the install script to get the latest build:

```sh
curl -fsSL https://s3.casonatto.dev/shared/opencode-custom/install.sh | sh
```

## Artifacts

| File | URL |
|------|-----|
| Tarball | https://s3.casonatto.dev/shared/opencode-custom/opencode-custom-pr-19211-linux-x64.tar.gz |
| Versioned tarball | https://s3.casonatto.dev/shared/opencode-custom/opencode-custom-pr-30019-linux-x64-202605310623.tar.gz |
| Install script | https://s3.casonatto.dev/shared/opencode-custom/install.sh |
| This doc | https://s3.casonatto.dev/shared/opencode-custom/opencode-custom-hindsight-install.md |
