agent

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2026 License: MIT Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildSystemPrompt added in v0.2.0

func BuildSystemPrompt(projectContext, globalContext string) string

BuildSystemPrompt constructs the complete system prompt with project and global context.

func FindProjectContext added in v0.2.0

func FindProjectContext(startDir string) (string, string, error)

FindProjectContext scans startDir and parent directories for AGENTS.md, .gocode/AGENTS.md, or docs/AGENTS.md.

func LoadGlobalContext added in v0.2.0

func LoadGlobalContext() (string, string, error)

LoadGlobalContext loads ~/.config/gocode/CONTEXT.md or %APPDATA%\gocode\CONTEXT.md.

Types

type AgentLoop

type AgentLoop struct {
	Registry       *provider.Registry
	Session        *Session
	ToolRegistry   *tools.Registry
	Approval       *tools.ApprovalGate
	ContextManager *ContextManager
}

func NewAgentLoop

func NewAgentLoop(registry *provider.Registry, session *Session, toolReg *tools.Registry, approval *tools.ApprovalGate) *AgentLoop

func (*AgentLoop) Run

func (a *AgentLoop) Run(ctx context.Context) error

type ContextManager

type ContextManager struct {
	MaxTokens int
}

func NewContextManager

func NewContextManager(maxTokens int) *ContextManager

func (*ContextManager) EstimateTokens

func (cm *ContextManager) EstimateTokens(msg provider.Message) int

func (*ContextManager) Truncate

func (cm *ContextManager) Truncate(history []provider.Message) []provider.Message

type Session

type Session struct {
	// contains filtered or unexported fields
}

func NewSession

func NewSession(model string) *Session

func NewSessionWithStore added in v0.2.0

func NewSessionWithStore(id, providerName, model string, store *session.SessionStore) *Session

func (*Session) AddMessage

func (s *Session) AddMessage(msg provider.Message)

func (*Session) Clear

func (s *Session) Clear()

func (*Session) ClearModifiedFiles added in v0.2.0

func (s *Session) ClearModifiedFiles()

func (*Session) History

func (s *Session) History() []provider.Message

func (*Session) ID added in v0.2.0

func (s *Session) ID() string

func (*Session) LastAssistantMessage

func (s *Session) LastAssistantMessage() string

func (*Session) LoadMessages added in v0.2.0

func (s *Session) LoadMessages(msgs []provider.Message)

func (*Session) Model

func (s *Session) Model() string

func (*Session) ModifiedFiles added in v0.2.0

func (s *Session) ModifiedFiles() []string

func (*Session) Provider added in v0.2.0

func (s *Session) Provider() string

func (*Session) SetID added in v0.2.0

func (s *Session) SetID(id string)

func (*Session) SetModel

func (s *Session) SetModel(model string)

func (*Session) SetProvider added in v0.2.0

func (s *Session) SetProvider(p string)

func (*Session) Store added in v0.2.0

func (s *Session) Store() *session.SessionStore

func (*Session) TrackModifiedFile added in v0.2.0

func (s *Session) TrackModifiedFile(path string)

Jump to

Keyboard shortcuts

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