plans

package
v0.4.11 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package plans holds the shared vocabulary of captured Claude Code plans: the note-slug prefixes, the plan-status tag lifecycle, and the tracking-task composition. The hooks capture path, the console Plans surface, the briefing assembler, and the gardener all speak this vocabulary; keeping it here stops the tag spellings from drifting apart.

Index

Constants

View Source
const (
	TagPlan  = "cc-plan"
	TagAgent = "agent-cache"
)

Marker tags on captured notes: TagPlan marks the plan note itself, TagAgent the cached planning-subagent runs attached to it.

View Source
const (
	StatusDraft     = "draft"
	StatusPresented = "presented"
	StatusApproved  = "approved"
	StatusAbandoned = "abandoned"
	StatusShipped   = "shipped"
	StatusMerged    = "merged"
)

Plan lifecycle statuses, stored as a plan-status:<v> note tag. Draft -> presented -> approved is the capture flow; abandoned, shipped and merged are the gardener's terminal settlements for plans that were never approved -- abandoned when nothing came of the plan, shipped when the repo's history shows the work landed without the approval ceremony, merged when the capture was folded into another composition that already held the steps for the same work. All three leave the briefing's awaiting-approval lines; the note stays recallable.

View Source
const AgentNotePrefix = "cc-agent-"

AgentNotePrefix + the CC agent id is the agent-cache note slug.

View Source
const NotePrefix = "cc-plan-"

NotePrefix + the CC plan file basename is the captured-plan note slug -- the correlation key across iterations (a direct NoteBySlug lookup, no tag query).

Variables

This section is empty.

Functions

func Basename

func Basename(noteSlug string) string

Basename recovers the CC plan file basename from a captured-plan note slug.

func Composition added in v0.4.0

func Composition(ctx context.Context, db *sql.DB, slug string) (primary core.Note, others []core.Note, ok bool, err error)

Composition resolves a plan slug to its primary note and the other notes tagged into the composition (agent caches and supporting notes). The primary is the cc-plan capture when one carries the tag; otherwise it is the composed plan's narrative -- the earliest-created non-agent note (EarlierPrimary). ok is false when no note carries the tag at all -- a task-only plan has no composition and, notably, nothing to hang a favorite on.

func EarlierPrimary added in v0.4.0

func EarlierPrimary(a, b core.Note) bool

EarlierPrimary reports whether a should win over b as a plan's narrative primary: the earlier Created wins, ties broken by the lower id for stability.

func EnsureTask

func EnsureTask(ctx context.Context, db *sql.DB, note core.Note, planSlug, createdBy string) (core.Task, bool, error)

EnsureTask creates the "Implement plan" tracking task for an approved plan unless the plan already has an open or in-progress step (idempotent on re-approval). It returns the created task and true, or a zero task and false when one already exists. Event recording is the caller's job (hooks and the console attribute differently).

func NoteDescription

func NoteDescription(basename string, iter int, status string) string

NoteDescription is the captured-plan note's one-line index text.

func NoteIteration

func NoteIteration(n core.Note) int

NoteIteration reads a captured-plan note's plan_iteration frontmatter (preserved in Extra), tolerating the numeric types YAML/JSON round-trips produce.

func SetStatusTag

func SetStatusTag(tags []string, status string) []string

SetStatusTag replaces the plan-status:<v> tag, preserving all others.

func SlugFromTags

func SlugFromTags(tags []string) string

SlugFromTags returns the plan:<slug> composition slug, or "".

func SlugTag

func SlugTag(planSlug string) string

SlugTag renders the composition tag for a plan slug.

func SlugTagPrefix

func SlugTagPrefix() string

SlugTagPrefix is the literal prefix every composition tag carries, for surfaces that enumerate the plan:<slug> family without a known slug.

func StampHead added in v0.4.6

func StampHead(body string) string

StampHead extracts the short git head from a captured note's provenance stamp line ("> captured from ... | git <head> | ...", written by the hooks capture). "" means no stamp; "unknown" means the capture ran outside a git repo. cmd/seam/plan.go keeps a local transcription (the seam binary must not link internal/store, which this package imports).

func StatusFromTags

func StatusFromTags(tags []string) string

StatusFromTags returns the plan-status:<v> value, or "".

Types

This section is empty.

Jump to

Keyboard shortcuts

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