An open API service indexing awesome lists of open source software.

https://github.com/theblazehen/p4oc

OpenCode client. Streaming chat, inline diffs, terminal UI. BYO server.
https://github.com/theblazehen/p4oc

ai-coding-assistant android jetpack-compose kotlin mobile-client opencode self-hosted terminal-ui

Last synced: about 1 month ago
JSON representation

OpenCode client. Streaming chat, inline diffs, terminal UI. BYO server.

Awesome Lists containing this project

README

          

# P4OC (Pocket for OpenCode)

[![GitHub Release](https://img.shields.io/github/v/release/theblazehen/P4OC?style=flat-square)](https://github.com/theblazehen/P4OC/releases)
[![Build](https://img.shields.io/github/actions/workflow/status/theblazehen/P4OC/build.yml?style=flat-square)](https://github.com/theblazehen/P4OC/actions)
[![License](https://img.shields.io/github/license/theblazehen/P4OC?style=flat-square)](LICENSE)


Get it on Google Play

An Android client for [OpenCode](https://github.com/sst/opencode), the terminal-based AI coding assistant. You point it at a running OpenCode server and talk to it from your phone.

> **Note:** P4OC is a community project and is not built by or affiliated with the OpenCode team.

The whole thing is built around a terminal UI aesthetic. No stock Material3 cards or rounded corners. Everything is flat, monospaced where it matters, and styled to look like it belongs in a terminal.

## Quick Start

1. Start OpenCode in server mode:
```bash
opencode serve --hostname 0.0.0.0 --port 4096
```
To require authentication, set `OPENCODE_SERVER_PASSWORD` before starting the server.

2. Install P4OC from [Google Play](https://play.google.com/store/apps/details?id=dev.blazelight.p4oc) or [GitHub Releases](https://github.com/theblazehen/P4OC/releases)

3. Enter your server URL (e.g. `http://192.168.1.100:4096`) and start chatting

## What it does

You connect to an OpenCode server instance by entering its URL. From there you can:

- Chat with the AI assistant, with streaming responses via SSE
- Manage sessions — create, rename, share, summarize, view diffs, revert changes
- Browse project files with symbol search and syntax highlighting
- View file diffs from AI edits with additions/deletions
- Use an embedded terminal (Termux-based)
- Open sub-agent sessions in their own tabs
- Configure providers, models, agents, and skills
- Switch between 9 bundled color themes (catppuccin, dracula, nord, tokyonight, gruvbox, and others)

The release APK is around 2.9 MB.

## Screenshots



  

## Requirements

- Android 8.0+ (API 26)
- A running [OpenCode](https://github.com/sst/opencode) server instance to connect to

## Building

You need Java 17 and the Android SDK.

```bash
# Debug build (no signing required)
export JAVA_HOME=/usr/lib/jvm/java-17-openjdk
./gradlew :app:assembleDebug
```

The APK lands in `app/build/outputs/apk/debug/`.

For release builds, create a `local.properties` file in the project root with your signing config:

```properties
RELEASE_STORE_FILE=/path/to/your/keystore.jks
RELEASE_STORE_PASSWORD=your_store_password
RELEASE_KEY_ALIAS=your_key_alias
RELEASE_KEY_PASSWORD=your_key_password
```

Then:

```bash
./gradlew :app:assembleRelease
```

## How it works

The app connects to an OpenCode server over HTTP. It uses Retrofit for REST calls and [LaunchDarkly's EventSource](https://github.com/launchdarkly/okhttp-eventsource) for SSE streaming. Messages come in as server-sent events, which the app parses and renders in real time.

The architecture is MVVM with clean architecture layers:

```
app/src/main/java/dev/blazelight/p4oc/
├── core/ # Network layer, DataStore, connection management
├── data/ # DTOs, mappers, repository implementations
├── di/ # Koin dependency injection modules
├── domain/ # Models, repository interfaces
├── terminal/ # Termux terminal emulator integration
└── ui/
├── components/ # Shared TUI components, markdown renderer, code blocks
├── navigation/ # NavGraph, route definitions
├── screens/ # Chat, sessions, projects, settings, terminal, files, diff
└── theme/ # Theme system (SemanticColors, Spacing, Sizing, Typography, Motion)
```

## Theme system

The app uses a custom theme system instead of Material3's built-in theming. There are about 50 semantic color tokens (`LocalOpenCodeTheme.current`), plus `Spacing.*`, `Sizing.*`, `TuiShapes` (all 0dp corners), and `Motion.*` tokens. Themes are loaded from JSON files that follow OpenCode's theme format.

Bundled themes: catppuccin, catppuccin-frappe, catppuccin-macchiato, dracula, gruvbox, nord, opencode, tokyonight, xterm.

## Tech stack

| What | Version |
|------|---------|
| Kotlin | 2.3.0 |
| AGP | 9.0.0 |
| Compose BOM | 2026.01.01 |
| Min SDK | 26 (Android 8.0) |
| Target SDK | 35 |
| Compile SDK | 36 |

Networking: OkHttp 5.3 + Retrofit 3.0. DI: Koin 4.1. Database: Room 2.8. Serialization: kotlinx.serialization 1.10. Markdown: mikepenz multiplatform-markdown-renderer. Terminal: Termux terminal-emulator + terminal-view.

## Contributing

See [CONTRIBUTING.md](CONTRIBUTING.md).

## License

Copyright 2025 Jasmin Le Roux

Licensed under the GNU General Public License v3.0. See [LICENSE](LICENSE) for the full text.