toolctx

package
v0.702.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2026 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package toolctx serves static per-tool cheat sheets the agent appends to tool descriptions at catalog registration time. Each sheet covers the "things the model forgets" for a given tool — file format headers, command quirks, bit-layout conventions — content that would otherwise bloat the system prompt and isn't specific enough to warrant a full RAG lookup.

The sheets are bundled at compile time so the binary stays self-contained. Adding a sheet is a new entry in the sheets map below; the tool builder picks it up automatically via EnrichDescription.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnrichDescription

func EnrichDescription(toolName, description string) string

EnrichDescription appends the cheat sheet for toolName to an existing description, prefixed with a stable "Context:" section marker. When no sheet exists the description passes through unchanged. Used by the tool catalog at registration time.

func Get

func Get(toolName string) string

Get returns the cheat sheet for toolName, or "" when no sheet is bundled. Safe to call on any tool name — absent sheets are treated as "no extra context" rather than an error.

func Has

func Has(toolName string) bool

Has reports whether a cheat sheet is registered for toolName. Used by tests to lock sheet presence on high-priority tools so a future refactor can't silently drop them.

func ToolsWithSheets

func ToolsWithSheets() []string

ToolsWithSheets returns every tool name that has a bundled cheat sheet, sorted alphabetically. Useful for the /tools REPL command and for tests that want to enforce coverage on specific tool families.

The sort is load-bearing for the docstring contract: Go map iteration is randomised, so without it the slice order shuffles every call and any caller relying on a stable layout (a test comparing returned[0], the /tools UI rendering top-N families, a future regression-baseline checker) would silently flake.

Types

This section is empty.

Jump to

Keyboard shortcuts

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