Documentation
¶
Index ¶
- Variables
- func BuildInstructions(data prompt.SectionData) string
- func ModelName(id string) string
- func ReadProjectInstructions(wd string) string
- func SessionsDir(workingDir string) string
- type Agent
- type Model
- type UI
- type Workspace
- func (w *Workspace) Checkpoints() ([]rewind.Checkpoint, error)
- func (w *Workspace) Close()
- func (w *Workspace) Commit(msg string) error
- func (w *Workspace) Diagnostics(ctx context.Context) map[string][]lsp.Diagnostic
- func (w *Workspace) Diffs() ([]rewind.FileDiff, error)
- func (w *Workspace) InitMCP(ctx context.Context) error
- func (w *Workspace) IsGitRepo() bool
- func (w *Workspace) MemoryContent() string
- func (ws *Workspace) NewAgent(cfg *agent.Config, ui UI) *Agent
- func (w *Workspace) Restore(hash string) error
- func (w *Workspace) SyncProjectMode()
- func (w *Workspace) WarmUp()
Constants ¶
This section is empty.
Variables ¶
var AvailableModels = []Model{
{ID: "claude-sonnet-4-6", Name: "Claude Sonnet 4.6"},
{ID: "claude-sonnet-4-5", Name: "Claude Sonnet 4.5"},
{ID: "gpt-5.5", Name: "GPT 5.5"},
{ID: "gpt-5.4", Name: "GPT 5.4"},
{ID: "gpt-5.3-codex", Name: "GPT 5.3 Codex"},
{ID: "gpt-5.2-codex", Name: "GPT 5.2 Codex"},
{ID: "claude-opus-4-7", Name: "Claude Opus 4.7"},
{ID: "claude-opus-4-6", Name: "Claude Opus 4.6"},
{ID: "claude-opus-4-5", Name: "Claude Opus 4.5"},
}
AvailableModels lives here (not pkg/agent) so the agent runtime stays provider-agnostic.
Functions ¶
func BuildInstructions ¶
func BuildInstructions(data prompt.SectionData) string
func ReadProjectInstructions ¶
ReadProjectInstructions walks from wd up to the filesystem root, concatenating AGENTS.md / CLAUDE.md with headers, closest ancestor first. Truncates at 25KB. Use Agent.projectInstructions for the cached path.
func SessionsDir ¶ added in v0.6.9
Types ¶
type Agent ¶
type Agent struct {
*agent.Agent
*Workspace
PlanMode bool
// contains filtered or unexported fields
}
func (*Agent) Instructions ¶ added in v0.6.9
func (*Agent) InstructionsData ¶
func (a *Agent) InstructionsData() prompt.SectionData
type UI ¶
type UI interface {
Ask(ctx context.Context, message string) (string, error)
Confirm(ctx context.Context, message string) (bool, error)
}
UI is the elicitation hook a frontend provides for tool ask/confirm prompts. Pass nil to NewAgent for safe defaults (Confirm → true, Ask → "").
type Workspace ¶ added in v0.6.9
type Workspace struct {
Root *os.Root
RootPath string
MemoryPath string
ScratchPath string
Skills []skill.Skill
MCP *mcp.Manager
// LSP and Rewind are set by WarmUp; nil for unsupported workspaces.
LSP *lsp.Manager
Rewind *rewind.Manager
// contains filtered or unexported fields
}
func NewWorkspace ¶ added in v0.6.9
func (*Workspace) Checkpoints ¶ added in v0.6.9
func (w *Workspace) Checkpoints() ([]rewind.Checkpoint, error)
func (*Workspace) Diagnostics ¶ added in v0.6.9
func (*Workspace) IsGitRepo ¶ added in v0.6.9
IsGitRepo is re-evaluated each call so callers can react to mid-session `git init` / `rm -rf .git`.
func (*Workspace) MemoryContent ¶ added in v0.6.9
MemoryContent renders an index of the memory dir for injection into the system prompt: one line per `*.md` file with a short hook. The hook is the file's frontmatter `description`, falling back to the first non-empty line of the body (heading markers stripped). Cached by per-file mtime so repeat turns don't re-read.
func (*Workspace) SyncProjectMode ¶ added in v0.6.9
func (w *Workspace) SyncProjectMode()
SyncProjectMode rebuilds LSP when the working dir's git status flips. No-op on unsupported workspaces.
func (*Workspace) WarmUp ¶ added in v0.6.9
func (w *Workspace) WarmUp()
WarmUp probes the workspace and initializes Rewind/LSP. Idempotent. Resulting modes:
- supported git repo → Rewind set, LSP set, lspTools set
- supported scratch → Rewind set, LSP nil, lspTools nil
- unsupported (huge) → Rewind nil, LSP nil