instructions

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package instructions is what every agent building on this installation is told (R-424): Pando's built-in guidance for writing apps that run well and safely here, then the company's own, which administrators write.

The two are kept apart so each has one owner. The built-in part ships in the binary and changes with Pando's releases; the company part is stored and changes only when an administrator saves it. An upgrade that improves the guidance never overwrites what an administrator wrote, and an administrator never has to merge a release's changes into their own text.

Agents receive the two as one document: in MCP's initialize answer, which clients load as instructions, and from GET /instructions for a client that ignores that field.

Index

Constants

View Source
const MaxCompany = 32 << 10

MaxCompany is the longest company section, in bytes [P: 32 KiB]. An MCP client puts the whole document in the agent's context on every conversation, so a long one costs every agent on the installation, every time; this is several pages, which is more than an agent follows well.

Variables

This section is empty.

Functions

func Builtin

func Builtin() string

Builtin is Pando's own guidance, the same on every installation of a release.

Types

type Document

type Document struct {
	// Text is what an agent receives: Builtin, then Company under its own
	// heading when there is any.
	Text string `json:"text"`
	// Builtin is Pando's own part.
	Builtin string `json:"builtin"`
	// Company is the administrators' part, empty when there is none.
	Company string `json:"company"`
	// UpdatedAt and UpdatedBy say who last saved Company, and when. Null
	// and empty when nobody ever has.
	UpdatedAt *time.Time `json:"updated_at"`
	UpdatedBy string     `json:"updated_by"`
}

Document is the instructions as the API serves them.

type Service

type Service struct {
	Store Store
}

Service reads and writes the instructions.

func (*Service) Get

func (s *Service) Get(ctx context.Context) (Document, error)

Get returns the instructions.

func (*Service) Set

func (s *Service) Set(ctx context.Context, company, updatedBy string) (Document, error)

Set replaces the company's part. Surrounding blank space is dropped, and empty clears it.

func (*Service) Text

func (s *Service) Text(ctx context.Context) string

Text returns what an agent receives, or Builtin alone when the company's part cannot be read: an agent connecting while the database is unreachable still gets Pando's guidance.

type Store

type Store interface {
	Load(ctx context.Context) (state.StoredInstructions, error)
	Save(ctx context.Context, body, updatedBy string) (state.StoredInstructions, error)
}

Store keeps the company section.

Jump to

Keyboard shortcuts

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