Documentation
¶
Index ¶
- Variables
- func ApplyPowerLevel(sess *engine.Session, level int)
- func BuildResearchPrompt(cfg ResearchConfig) string
- func DescribePower(level int) string
- func DetectRunCommand(dir string) string
- func Execute() error
- func ExportContext(dir string, focus string) (string, error)
- func ExportContextToFile(dir, focus, outputPath string) error
- func FormatReviewReport(findings []ReviewFinding) string
- func GenerateAgentsTemplate(projectType string) string
- func GenerateManPage() string
- func RenderBreakdown(tb TokenBreakdown, windowSize int) string
- func SetBuildDate(d string)
- func SetVersion(v string)
- func ShortVersion() string
- func VersionString() string
- func VibeLoop(ctx context.Context, sess *engine.Session, prompt string, config VibeConfig) error
- type AIDirective
- type CommandState
- type CommandType
- type ContextState
- type ContextVisualization
- type ExecResult
- type FileWatcher
- type Operator
- type PersistentState
- type PowerConfig
- type QueryProfile
- type RecordedChange
- type ResearchConfig
- type ReviewConcern
- type ReviewFinding
- type StartupWarning
- type Tip
- type TokenBreakdown
- type VibeConfig
- type VimMode
- type VimState
Constants ¶
This section is empty.
Variables ¶
var ( Version = "dev" Commit = "none" Date = "unknown" )
Build-time variables injected by goreleaser/ldflags.
Functions ¶
func ApplyPowerLevel ¶
ApplyPowerLevel configures a session based on power level.
func BuildResearchPrompt ¶
func BuildResearchPrompt(cfg ResearchConfig) string
BuildResearchPrompt generates the full autonomous research prompt based on Karpathy's autoresearch program.md pattern.
func DescribePower ¶
DescribePower returns a human-readable description of what a power level does.
func DetectRunCommand ¶
DetectRunCommand auto-detects the project's test/build command by looking for well-known build files in the given directory.
func ExportContext ¶
ExportContext generates a comprehensive context document about the current project. Output is optimized for pasting into any LLM chat.
func ExportContextToFile ¶
ExportContextToFile writes context to a .md file.
func FormatReviewReport ¶
func FormatReviewReport(findings []ReviewFinding) string
FormatReviewReport formats findings as a readable report grouped by severity.
func GenerateAgentsTemplate ¶
GenerateAgentsTemplate returns an AGENTS.md template for the given project type.
func GenerateManPage ¶
func GenerateManPage() string
GenerateManPage produces a man page in roff format for hawk.
func RenderBreakdown ¶
func RenderBreakdown(tb TokenBreakdown, windowSize int) string
RenderBreakdown produces a multi-line token breakdown for /context command.
func VibeLoop ¶
VibeLoop runs the vibe coding loop: edit -> run -> check -> fix -> repeat.
1. Send prompt to LLM 2. Auto-apply all file changes (no permission prompt) 3. Run RunCommand 4. If passes: done, print success 5. If fails: send error output back to LLM, ask it to fix 6. Repeat until passes or MaxIterations reached
Types ¶
type AIDirective ¶
type AIDirective struct {
Path string
Line int
Instruction string
Mode string // "!" (do) or "?" (ask)
}
AIDirective represents a found AI comment directive in a source file.
type CommandState ¶
type CommandState struct {
Type CommandType
Op Operator
Count int
Digits string
FindType byte // f, F, t, T
Scope byte // i (inner), a (around)
}
CommandState tracks the in-progress vim command.
type CommandType ¶
type CommandType int
CommandType represents what the command state is waiting for.
const ( CmdIdle CommandType = iota CmdCount CmdOperator CmdFind CmdOperatorFind CmdOperatorTextObj CmdReplace )
type ContextState ¶
type ContextState int
ContextState represents the urgency level of context usage.
const ( ContextNormal ContextState = iota ContextWarning // approaching compact threshold ContextError // approaching blocking ContextBlocking // at capacity )
type ContextVisualization ¶
type ContextVisualization struct {
ContextWindowSize int
CurrentTokens int
CompactThreshold int
WarningThreshold int
BlockingThreshold int
}
ContextVisualization renders token usage as a visual bar in the TUI.
func NewContextVisualization ¶
func NewContextVisualization(windowSize int) *ContextVisualization
NewContextVisualization creates a visualization with default thresholds.
func (*ContextVisualization) PercentUsed ¶
func (cv *ContextVisualization) PercentUsed() float64
PercentUsed returns the percentage of context window used.
func (*ContextVisualization) Render ¶
func (cv *ContextVisualization) Render(width int) string
Render produces a styled context bar for the TUI status line.
func (*ContextVisualization) State ¶
func (cv *ContextVisualization) State() ContextState
State returns the current warning state.
func (*ContextVisualization) Update ¶
func (cv *ContextVisualization) Update(tokens int)
Update sets the current token count.
type ExecResult ¶
type ExecResult struct {
SessionID string `json:"session_id"`
Response string `json:"response"`
ExitCode int `json:"exit_code"`
TokensIn int `json:"tokens_in,omitempty"`
TokensOut int `json:"tokens_out,omitempty"`
TurnsTaken int `json:"turns_taken"`
Duration string `json:"duration"`
Model string `json:"model,omitempty"`
Worktree string `json:"worktree,omitempty"`
Branch string `json:"branch,omitempty"`
}
ExecResult is the structured output for --output-format json.
type FileWatcher ¶
type FileWatcher struct {
// contains filtered or unexported fields
}
FileWatcher watches a directory tree for file changes, debounces them, computes a git diff, and calls an onChange callback.
func NewFileWatcher ¶
func NewFileWatcher(dir string, ignore []string, onChange func(string, string)) *FileWatcher
NewFileWatcher creates a new FileWatcher. ignore is a list of path substrings to skip (e.g. ".git", "node_modules"). onChange is called with the changed file path and the git diff for that file.
type PersistentState ¶
type PersistentState struct {
LastFind byte
LastFindType byte
Register string
RegisterLine bool
LastChange *RecordedChange
Recording *RecordedChange
}
PersistentState survives across commands.
type PowerConfig ¶
type PowerConfig struct {
Level int
Model string
MaxTokens int
ContextWindow int
Temperature float64
MaxTurns int
ToolParallelism int
ReviewDepth string // "none", "quick", "thorough"
AutoApply bool
BudgetUSD float64
}
PowerConfig maps a power level (1-10) to all relevant settings.
func PowerPreset ¶
func PowerPreset(level int) PowerConfig
PowerPreset returns the configuration for a given power level (1-10).
1-2: haiku/flash, 4K context, fast, no review, $0.05 budget -- quick questions 3-4: sonnet-mini/gpt-4o-mini, 16K context, moderate -- simple tasks 5-6: sonnet/gpt-4o, 64K context, standard -- normal coding (DEFAULT) 7-8: sonnet/opus, 128K context, thorough review -- complex tasks 9-10: opus, 200K context, multi-pass review, council mode -- critical work
type QueryProfile ¶
type QueryProfile struct {
StartTime time.Time
TTFT time.Duration // time to first token
APICall time.Duration
ToolExec time.Duration
TotalTime time.Duration
TokensIn int
TokensOut int
// contains filtered or unexported fields
}
QueryProfile tracks timing for a single query.
func (*QueryProfile) Finish ¶
func (p *QueryProfile) Finish()
Finish completes the profile and records the total time.
func (*QueryProfile) RecordAPICallEnd ¶
func (p *QueryProfile) RecordAPICallEnd()
RecordAPICallEnd marks the end of an API call and accumulates duration.
func (*QueryProfile) RecordAPICallStart ¶
func (p *QueryProfile) RecordAPICallStart()
RecordAPICallStart marks the beginning of an API call.
func (*QueryProfile) RecordTTFT ¶
func (p *QueryProfile) RecordTTFT()
RecordTTFT records the time to first token.
func (*QueryProfile) RecordToolExecEnd ¶
func (p *QueryProfile) RecordToolExecEnd()
RecordToolExecEnd marks the end of a tool execution and accumulates duration.
func (*QueryProfile) RecordToolExecStart ¶
func (p *QueryProfile) RecordToolExecStart()
RecordToolExecStart marks the beginning of a tool execution.
func (*QueryProfile) String ¶
func (p *QueryProfile) String() string
String returns a formatted summary of the profile, suitable for debug output.
type RecordedChange ¶
type RecordedChange struct {
Type string // "insert", "operator", "replace", "x", "toggleCase"
Keys []tea.KeyMsg
Text string
StartPos int
EndPos int
}
RecordedChange stores info needed for dot-repeat.
type ResearchConfig ¶
type ResearchConfig struct {
MetricCmd string // command to run the experiment (e.g. "go test -bench .")
MetricGrep string // grep pattern to extract the metric (e.g. "^val_bpb:")
Direction string // "lower" or "higher" — whether lower or higher metric is better
Budget int // time budget per experiment in minutes (default: 5)
BranchPrefix string // git branch prefix (default: "autoresearch")
ResultsFile string // TSV results file (default: "results.tsv")
}
ResearchConfig controls the autonomous research loop. The loop itself is executed by the LLM agent via the generated prompt.
func DefaultResearchConfig ¶
func DefaultResearchConfig() ResearchConfig
DefaultResearchConfig returns sensible defaults.
type ReviewConcern ¶
type ReviewConcern struct {
Name string // "security", "performance", "style", "bugs", "correctness"
Prompt string // specialized review prompt for this concern
}
ReviewConcern represents one aspect of code review.
func DefaultConcerns ¶
func DefaultConcerns() []ReviewConcern
DefaultConcerns returns standard review concerns.
type ReviewFinding ¶
type ReviewFinding struct {
Concern string
Severity string // "critical", "high", "medium", "low"
File string
Line int
Message string
Fix string // suggested fix
}
ReviewFinding represents one issue found.
func RunReviewPipeline ¶
func RunReviewPipeline(files []string, concerns []ReviewConcern) ([]ReviewFinding, string)
RunReviewPipeline performs multi-concern parallel review. In this implementation, the LLM calls are simulated by building per-concern prompts and collecting placeholder findings. The caller is expected to wire in actual LLM queries. Returns deduplicated findings sorted by severity and a formatted report string.
type StartupWarning ¶
StartupWarning represents a non-fatal startup issue.
func (StartupWarning) String ¶
func (w StartupWarning) String() string
type Tip ¶
type Tip struct {
ID string `json:"id"`
Text string `json:"text"`
Category string `json:"category"`
}
Tip represents a single hawk usage tip.
type TokenBreakdown ¶
type TokenBreakdown struct {
System int `json:"system"`
UserMsgs int `json:"user_messages"`
Assistant int `json:"assistant"`
ToolUse int `json:"tool_use"`
ToolResult int `json:"tool_results"`
Total int `json:"total"`
}
TokenBreakdown provides a detailed breakdown of token usage by category.
type VibeConfig ¶
type VibeConfig struct {
Enabled bool
AutoApply bool // apply file changes without asking
AutoRun bool // run build/test after each change
RunCommand string // command to run (default: auto-detect)
ShowDiffs bool // show diffs briefly (default: false in full vibe, true in semi-vibe)
MaxIterations int // max auto-fix iterations (default: 10)
}
VibeConfig controls vibe coding behavior.
func DefaultVibeConfig ¶
func DefaultVibeConfig() VibeConfig
DefaultVibeConfig returns the default vibe coding configuration.
type VimState ¶
type VimState struct {
Mode VimMode
Command CommandState
Persistent PersistentState
// contains filtered or unexported fields
}
VimState is the full vim state machine.
func NewVimState ¶
func NewVimState() *VimState
NewVimState creates a new vim state starting in insert mode.
func (*VimState) HandleKey ¶
HandleKey processes a key event and returns the new text, cursor position, and whether the key was consumed by vim.
func (*VimState) ModeString ¶
ModeString returns a display string for the current mode.
func (*VimState) SetEnabled ¶
SetEnabled enables or disables vim mode.
Source Files
¶
- agent.go
- agents_template.go
- ai_comments.go
- away_summary.go
- bugfind.go
- chat.go
- chat_commands.go
- chat_config_panel.go
- chat_model.go
- chat_print.go
- chat_stream.go
- chat_view.go
- chat_welcome.go
- clipboard.go
- cmdhistory_cmd.go
- container_boot.go
- context_export.go
- context_viz.go
- cost.go
- daemon.go
- diagnostics.go
- dx.go
- errors.go
- exec.go
- fingerprint.go
- fuzzy.go
- history.go
- inspect.go
- manpage.go
- markdown.go
- mission.go
- notifications.go
- options.go
- plan.go
- power.go
- profiler.go
- research.go
- review_pipeline.go
- root.go
- rules.go
- sandbox.go
- schema.go
- search.go
- sessioncapture.go
- sight.go
- skills_cmd.go
- sleep_prevent.go
- snapshot_cmd.go
- statusbar.go
- tabcomplete.go
- terminal_notify.go
- tips.go
- version.go
- vibe.go
- vim.go
- watch.go
- waza.go