claude

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package claude implements adapters.HarnessAdapter for Claude Code.

Package placement: internal/adapters/claude/ (internal/adapters/ hosts the shared interface; each harness sub-package hosts its implementation).

Stopping convention (Phase 3-b): SIGUSR1 is delivered to the runtime process group by api.JobLifecycle.SignalJobRuntime. Run()'s signal.Notify(SIGUSR1) handler intercepts it and forwards SIGTERM to the claude child only, normalising the resulting exit status into Result.StoppedByDaemon=true. There is no separate "stop agent" entry on the adapter — the daemon owns the signal, the adapter owns the response.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

type Adapter struct{}

Adapter implements adapters.HarnessAdapter for Claude Code.

func New

func New() *Adapter

New returns a new Adapter.

func (*Adapter) Bindings

func (a *Adapter) Bindings(homeDir string) []adapters.BindMount

Bindings declares the host bind-mounts claude.Adapter.Run() needs inside the sandbox. They replace the bindings that boid-kits' claude-code/kit.yaml used to declare; once Phase 3-d retires that kit the dispatcher no longer reads it at all on the claude path.

Layout (Phase 3-c):

  • ~/.local/bin (ro, dir) — claude CLI directory; also bin → PATH
  • ~/.local/share/claude (ro, dir) — claude shared data
  • ~/.claude (rw, dir) — claude config / state
  • ~/.claude.json (rw, file) — claude main settings
  • ~/.local/share/boid/skills/<name> → ~/.claude/skills/<name> per embedded skill so /boid-task / /boid-orchestrate / /boid-web resolve inside claude.

All entries are Optional so a missing source on the host is silently skipped (the dispatcher converts Optional → shell-level if-guard, matching the previous dirGuardExpr / existsGuardExpr behaviour).

func (*Adapter) Run

Run is the agent-process entry point. See RunContext / Result in package adapters for the I/O contract. Run owns:

  • generating a fresh session id and persisting it to payload_patch.json up front so the jsonl transcript path is recorded in the task artifact even when the child terminates abnormally (SIGKILL, OOM)
  • prompt selection (UserAnswer → bootstrap, otherwise /boid-task or "")
  • claude argv construction (always --session-id, never --resume)
  • signal.Notify(SIGUSR1 / SIGWINCH) and forwarding to the child
  • exit code normalisation (StoppedByDaemon → 0)
  • IS_SANDBOX=1 env injection (Claude CLI 2.1.181+ uid 0 bypass)

Session-id resume was removed: reopen and Q&A both start a fresh claude process. The agent recovers prior-turn context by reading ~/.boid/context/{task,instructions,payload}.yaml on cold start.

func (*Adapter) Usage

func (a *Adapter) Usage(_ context.Context, _ string) (adapters.Usage, error)

Usage is not yet implemented. It will be wired in Phase 4 when the jobs table gains usage columns and the jsonl read path is finalised.

Jump to

Keyboard shortcuts

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