plural-core

module
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 22, 2026 License: MIT

README

plural-core

Shared Go library providing the core backend for Plural (TUI) and Plural Agent (headless daemon).

Overview

plural-core handles the backend concerns shared across Plural applications:

  • Claude Code CLI management — process lifecycle, message streaming, and auto-recovery
  • Session isolation — each session runs in its own git worktree for conflict-free parallel work
  • Permission system — MCP-based permission prompts routed through unix sockets
  • Git operations — worktree creation, branching, merging, and GitHub PR integration
  • Issue tracking — pluggable providers for GitHub, Asana, and Linear
  • Configuration — thread-safe, JSON-based config with XDG path support

Installation

go get github.com/zhubert/plural-core

Requires Go 1.25+.

Packages

Package Description
claude Claude Code CLI wrapper — Runner, streaming, permission channels
mcp Model Context Protocol server over JSON-RPC 2.0 / unix sockets
git Git operations — worktrees, branches, merges, GitHub PRs via gh
config Configuration loading/saving with thread-safe access
manager Session lifecycle management and state coordination
session Session creation with isolated git worktrees
issues Issue provider interface (GitHub, Asana, Linear)
logger Structured logging via slog
paths XDG-compliant path resolution
process Docker/container utilities
exec Testable command execution abstraction
cli CLI tool prerequisite checks (claude, git, gh)

Usage

import "github.com/zhubert/plural-core/claude"

runner := claude.New(sessionID, workingDir, repoPath, sessionStarted, initialMessages)
responseChan := runner.Send(ctx, "Hello, Claude!")
for chunk := range responseChan {
    if chunk.Error != nil {
        log.Fatal(chunk.Error)
    }
    fmt.Print(chunk.Content)
}
defer runner.Stop()

Development

make test    # run all tests
make clean   # clear build/test cache

Architecture

Claude CLI ──→ MCP Server (subprocess) ──→ Unix Socket ──→ Consumer (TUI / Agent)
               (--permission-prompt-tool)    (/tmp/plural-<id>.sock)

Each session gets its own git worktree under ~/.plural/worktrees/<uuid>/, keeping parallel Claude conversations fully isolated.

License

MIT

Directories

Path Synopsis
Package claude provides the Claude CLI wrapper for managing conversations.
Package claude provides the Claude CLI wrapper for managing conversations.
Package cli provides utilities for CLI tool management and validation.
Package cli provides utilities for CLI tool management and validation.
Package exec provides an abstraction over command execution for testability.
Package exec provides an abstraction over command execution for testability.
Package git provides Git operations for managing worktrees, branches, merges, and PRs.
Package git provides Git operations for managing worktrees, branches, merges, and PRs.
Package issues provides a generic interface for fetching issues from multiple sources (GitHub, Asana, etc.) to create Plural sessions.
Package issues provides a generic interface for fetching issues from multiple sources (GitHub, Asana, etc.) to create Plural sessions.
Package mcp implements the Model Context Protocol (MCP) for handling permission prompts.
Package mcp implements the Model Context Protocol (MCP) for handling permission prompts.
Package paths provides centralized path resolution for Plural's data directories.
Package paths provides centralized path resolution for Plural's data directories.
Package session manages Claude Code sessions and their git worktrees.
Package session manages Claude Code sessions and their git worktrees.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL