daemon

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package daemon wires up and runs the Kram daemon's HTTP server — extracted out of cmd/daemon so the unified cmd/kram binary can start a daemon in-process (a goroutine, not a subprocess) instead of shelling out to a separate binary. Subpackages (store, session, agent, tools, server, gatewayclient, compaction) hold the actual logic; this is just the wiring cmd/daemon and cmd/kram both need.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, cfg Config, logger *slog.Logger) error

Run opens the store, builds the agent loop, and serves the daemon's HTTP API until ctx is canceled, then shuts down gracefully. It blocks until the server has fully stopped.

Types

type Config

type Config struct {
	Host       string
	Port       int
	DBPath     string
	GatewayURL string
	Model      string // gateway combo used for new messages
	Workspace  string // project root the agent's tools operate within
	MaxTurns   int    // iteration budget per agent run
}

Config configures one daemon instance.

Directories

Path Synopsis
Package agent is Kram's tool-calling loop: the piece that actually makes the daemon useful rather than a plain chat relay.
Package agent is Kram's tool-calling loop: the piece that actually makes the daemon useful rather than a plain chat relay.
Package compaction keeps a long session's history within a model's context budget using the tiered strategy every production agent loop we looked at converges on (opencode, Crush): cheap structural pruning first, full LLM summarization only as a last resort.
Package compaction keeps a long session's history within a model's context budget using the tiered strategy every production agent loop we looked at converges on (opencode, Crush): cheap structural pruning first, full LLM summarization only as a last resort.
Package contextpolicy turns Kram's context limits into one explicit plan.
Package contextpolicy turns Kram's context limits into one explicit plan.
Package gatewayclient is the daemon's HTTP client for kram-gateway.
Package gatewayclient is the daemon's HTTP client for kram-gateway.
Package server exposes the daemon's HTTP control surface: sessions are created, listed and messaged through here.
Package server exposes the daemon's HTTP control surface: sessions are created, listed and messaged through here.
Package session owns session lifecycle (create/list/get) — the durable record a client attaches to.
Package session owns session lifecycle (create/list/get) — the durable record a client attaches to.
Package store persists sessions and messages to a local SQLite database so the daemon remains the single source of truth across restarts — a client disconnecting, or the daemon itself being restarted, never loses a session's history, including its tool-call trail.
Package store persists sessions and messages to a local SQLite database so the daemon remains the single source of truth across restarts — a client disconnecting, or the daemon itself being restarted, never loses a session's history, including its tool-call trail.
Package tools: grep is a pure-Go recursive search over the workspace — no dependency on an external ripgrep/grep binary being installed, in keeping with Kram's "never crash / always works" goal.
Package tools: grep is a pure-Go recursive search over the workspace — no dependency on an external ripgrep/grep binary being installed, in keeping with Kram's "never crash / always works" goal.

Jump to

Keyboard shortcuts

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