explaingit

fariello/ocman

Analysis updated 2026-05-18

1PythonAudience · developerComplexity · 2/5Setup · easy

TLDR

A command-line and terminal dashboard tool for managing OpenCode AI agent sessions: clean old sessions, recover crashed ones, compact bloated transcripts, and back up or restore your OpenCode database.

Mindmap

mindmap
  root((ocman))
    What It Does
      Manage OpenCode sessions
      Clean and vacuum database
      Recover crashed sessions
    Features
      Age-based session cleanup
      ZIP backup and restore
      LLM transcript compaction
      Audit log with totals
    TUI Dashboard
      Browse projects and sessions
      Recovery wizard
      Database admin tab
      Configuration settings
    Setup
      pip install ocman
      Python 3.10 required
      Textual for TUI mode
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Clean up OpenCode sessions older than a set number of days and vacuum the database to free disk space.

USE CASE 2

Recover a crashed OpenCode session by truncating its transcript to the last 50 exchanges and restarting fresh.

USE CASE 3

Back up your entire OpenCode system state to a ZIP file before making configuration changes, with automatic rollback on failure.

USE CASE 4

Use the interactive TUI dashboard to browse all your OpenCode projects, preview transcripts, and view how much space you have reclaimed over time.

What is it built with?

PythonTextualRichSQLite

How does it compare?

fariello/ocmana-bissell/unleash-liteabhiinnovates/whatsapp-hr-assistant
Stars111
LanguagePythonPythonPython
Setup difficultyeasyhardhard
Complexity2/54/53/5
Audiencedeveloperresearcherdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min

TUI mode requires the Textual and Rich packages, LLM compaction requires an OpenAI-compatible API key.

In plain English

ocman, short for OpenCode Manager, is a command-line and terminal-based administration tool for OpenCode, an AI coding agent. If you use OpenCode regularly, its session database can grow large over time, sessions can crash mid-run leaving orphaned data, and long conversation transcripts can bloat the context window. ocman gives you a set of tools to clean all of this up without digging into the database manually. The main things it can do: clean up old sessions by age, remove orphaned database records, vacuum the SQLite database to recover disk space, back up your entire OpenCode system state to a ZIP file, and restore from those backups with an automatic rollback if anything goes wrong partway through. It also keeps an audit log of every cleanup run, showing you how much space and cost you have reclaimed over time. For recovering a crashed or oversized session, you can pick a session interactively or by ID, truncate the transcript to the last N exchanges, and optionally pass it through an AI model via an OpenAI-compatible API to produce a compacted summary that can be used as a fresh starting point for a new session. This is useful when a session grew so long that the AI became less effective due to context limits. Alongside the command-line interface, there is a full interactive terminal dashboard built with the Textual library. It has separate tabs for browsing projects and sessions, previewing transcripts, running the recovery wizard with cost estimates, managing the database, viewing historical activity logs, and editing configuration settings. Installation is via pip from PyPI. The basic CLI requires only Python 3.10 and the OpenCode CLI on your system path. The interactive dashboard additionally needs the Textual and Rich Python packages. A standalone single-file script version is available for zero-dependency use. The README is sparse on license information.

Copy-paste prompts

Prompt 1
Using ocman, show me how to clean all OpenCode sessions older than 7 days and reclaim database disk space in a single command.
Prompt 2
I have a crashed OpenCode session. Walk me through using ocman to recover it, truncate it to the last 30 user-assistant pairs, and compact it with an LLM model.
Prompt 3
How do I back up my entire OpenCode environment with ocman and then restore it if something goes wrong?
Prompt 4
Show me how to launch the ocman TUI dashboard and navigate the Database Admin tab to run a SQLite vacuum.

Frequently asked questions

What is ocman?

A command-line and terminal dashboard tool for managing OpenCode AI agent sessions: clean old sessions, recover crashed ones, compact bloated transcripts, and back up or restore your OpenCode database.

What language is ocman written in?

Mainly Python. The stack also includes Python, Textual, Rich.

How hard is ocman to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is ocman for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Scan in gitsafehub Deploy in gitdeployhub fariello on gitmyhub

Verify against the repo before relying on details.