Help us shape the future of Go! Take the 2026 Go Developer Survey

agentguide

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package agentguide owns Grafo's canonical agent guidance: the embedded structural tool-routing and repository-setup playbooks, their independent format versions, and the exact markers that make installed copies provably Grafo-owned.

The package renders the same canonical text into the two surfaces installers need — an isolated Grafo-owned skill file and a delimited managed block inside a user-authored instruction file — and never parses or rewrites anything outside its own markers.

Index

Constants

View Source
const (
	BeginMarker = "<!-- BEGIN grafo-guidance -->"
	EndMarker   = "<!-- END grafo-guidance -->"
)

BeginMarker and EndMarker delimit the managed block. They are matched exactly; ownership is never inferred from a substring of the guidance body itself.

View Source
const Description = "Route structural code questions through Grafo's semantic graph: " +
	"confirm the branch is indexed, resolve symbols before searching text, find reusable " +
	"code before adding code, and run bidirectional impact before a behaviour-changing edit."

Description is the one-line summary clients show when listing skills.

View Source
const Name = "grafo"

Name is the stable identity Grafo installs guidance under.

View Source
const SetupDescription = "Set up or improve Grafo for a repository: inspect project boundaries, " +
	"transports, serialization, semantic application wrappers, SQL, and test conventions; update only supported " +
	"grafo.yaml settings; index the project; and verify graph coverage without inventing configuration."

SetupDescription tells skill-capable clients when to invoke the repository onboarding workflow.

View Source
const SetupMarker = "<!-- grafo-setup version "

SetupMarker is recorded in install receipts for the repository-setup skill.

View Source
const SetupName = "grafo-setup"

SetupName is the stable identity of the installed repository onboarding skill.

View Source
const SetupVersion = "2"

SetupVersion is the repository-setup skill format version. It is independent from Version because either installed skill may evolve without making the other stale.

View Source
const Version = "4"

Version is the guidance format version. Bumping it makes every installed copy stale, so `grafo install` replaces older Grafo-owned content exactly.

Variables

This section is empty.

Functions

func Block

func Block() string

Block renders the managed block that may be embedded in a user-authored instruction file.

func Digest

func Digest(content string) string

Digest labels the SHA-256 of installed content so a receipt can prove that an artifact is still exactly what Grafo wrote.

func HasBlock

func HasBlock(document string) bool

HasBlock reports whether a document already carries a Grafo-owned block.

func Owns

func Owns(document string) bool

Owns reports whether a document carries Grafo's ownership marker, for any guidance version. Ownership is never inferred from the guidance prose.

func OwnsSetup

func OwnsSetup(document string) bool

OwnsSetup reports whether a document carries the setup skill's ownership marker, for any setup format version.

func SetupSkill

func SetupSkill() string

SetupSkill renders the isolated Grafo-owned repository-setup skill file.

func Skill

func Skill() string

Skill renders the isolated Grafo-owned skill file: the whole file belongs to Grafo, so it carries frontmatter and nothing of the user's.

The description contains ": ", which is not a legal YAML plain scalar, so it is emitted as a double-quoted scalar. An unquoted value makes the frontmatter unparseable and the skill undiscoverable.

func Text

func Text() string

Text returns the canonical guidance with its version marker.

Types

type Change

type Change int

Change reports what an upsert or removal did to a document.

const (
	// Unchanged means the document already holds exactly the current content.
	Unchanged Change = iota
	// Added means a managed block was appended.
	Added
	// Updated means an existing Grafo-owned block was replaced.
	Updated
	// Removed means an existing Grafo-owned block was deleted.
	Removed
)

func RemoveBlock

func RemoveBlock(document string) (string, Change, error)

RemoveBlock deletes a Grafo-owned block and restores the surrounding text, leaving unrelated content byte-equivalent. It is idempotent.

func UpsertBlock

func UpsertBlock(document string) (string, Change, error)

UpsertBlock returns the document with exactly one current managed block, leaving every byte outside the markers untouched.

func (Change) String

func (c Change) String() string

type ConflictError

type ConflictError struct{ Reason string }

ConflictError reports that a document's Grafo markers are partial, duplicated, or out of order. Callers must leave the document byte-identical.

func (*ConflictError) Error

func (e *ConflictError) Error() string

Jump to

Keyboard shortcuts

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