guides

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package guides ships brainjar-authored markdown content as Claude Code SKILL.md files. Two transports serve the same registry:

  • MCP — `guide_list` / `guide_show` so an agent driving brainjar can pull a guide on demand.
  • Disk emit — `brainjar sync` writes every guide to the active platform's skills directory so Claude Code's native loader picks them up via description-match.

Guides are server-shipped, embedded in the binary. Updates ride the binary: `brainjar upgrade` swaps the guides the same instant it swaps the tools they document. There is no SQLite seed and no user authoring path; user content uses souls/personas/rules/procedures/ skills (Core M11).

Index

Constants

View Source
const MarkerFile = skillemit.MarkerFile

MarkerFile sits inside every brainjar-emitted skill directory so the prune step knows which dirs we own. User-authored skills (Core M11) share the same parent directory but lack this file, so they survive every sync.

Aliased from internal/platform/skillemit so callers in this package keep their existing import surface.

Variables

This section is empty.

Functions

func AsSkillEmits

func AsSkillEmits(r *Registry) []platform.SkillEmit

AsSkillEmits returns every guide as a platform.SkillEmit suitable for passing to Platform.EmitSkills. Raw is preserved so the on-disk SKILL.md bytes match the embedded source.

Types

type Guide

type Guide struct {
	Slug        string `json:"slug"`
	Description string `json:"description"`
	Version     int    `json:"version"`
	Checksum    string `json:"checksum"`
	Scope       Scope  `json:"scope"`
	Body        string `json:"body"`

	// Raw is excluded from JSON — it's only used by the emit step.
	Raw []byte `json:"-"`
}

Guide is a single embedded guide. Each guide is shipped on disk as a Claude Code SKILL.md file at `content/<slug>/SKILL.md`. The slug is the directory name, validated against the `name:` field in the SKILL.md's YAML front-matter so the on-disk name and the in-binary identity stay in sync.

Raw is the byte-for-byte file content (frontmatter + body) used by the disk-emit step; Body is the post-frontmatter markdown returned by `guide_show` and `brainjar guide show`.

type Registry

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

Registry holds the parsed embedded guides keyed by slug.

func Default

func Default() *Registry

Default returns the singleton registry over the embedded guides. Parse failures are fatal — the embed ships inside the binary, so a malformed file is a build bug, not a runtime one.

func Load

func Load(fsys fs.FS, dir string) (*Registry, error)

Load walks dir within fsys for `<slug>/SKILL.md` files and parses each into the registry.

func (*Registry) All

func (r *Registry) All() []Guide

All returns every guide in slug order, including bodies and raw bytes. Used by the emit step.

func (*Registry) AllAtScope

func (r *Registry) AllAtScope(s Scope) []Guide

AllAtScope returns every guide whose Scope == s, in slug order. Used by the emit step to split per-scope target dirs.

func (*Registry) Get

func (r *Registry) Get(slug string) (Guide, error)

Get returns the guide with the given slug. Unknown slug returns a CodeNotFound app error so callers (MCP tools, CLI) surface the right envelope.

func (*Registry) IsReservedSlug

func (r *Registry) IsReservedSlug(slug string) bool

IsReservedSlug reports whether slug names a built-in guide. Skill save paths reject reserved slugs so a workspace skill can't silently overwrite a shipped guide's SKILL.md on next sync.

func (*Registry) List

func (r *Registry) List() []Summary

List returns every guide's summary in slug order.

type Scope

type Scope string

Scope selects where a guide's SKILL.md is emitted on `brainjar sync`. ScopeProject lives under `<projectRoot>/.claude/skills/` — only Claude Code sessions in that project see the skill. ScopeUser lives under `~/.claude/skills/` — every Claude Code session sees it.

const (
	ScopeProject Scope = "project"
	ScopeUser    Scope = "user"
)

type Summary

type Summary struct {
	Slug        string `json:"slug"`
	Description string `json:"description"`
	Version     int    `json:"version"`
	Checksum    string `json:"checksum"`
	Scope       Scope  `json:"scope"`
}

Summary is the list view returned by guide_list and brainjar guide list. No body, no raw — just the lookup metadata.

Jump to

Keyboard shortcuts

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