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
- func Basename(noteSlug string) string
- func Composition(ctx context.Context, db *sql.DB, slug string) (primary core.Note, others []core.Note, ok bool, err error)
- func EarlierPrimary(a, b core.Note) bool
- func EnsureTask(ctx context.Context, db *sql.DB, note core.Note, planSlug, createdBy string) (core.Task, bool, error)
- func NoteDescription(basename string, iter int, status string) string
- func NoteIteration(n core.Note) int
- func SetStatusTag(tags []string, status string) []string
- func SlugFromTags(tags []string) string
- func SlugTag(planSlug string) string
- func SlugTagPrefix() string
- func StampHead(body string) string
- func StatusFromTags(tags []string) string
Constants ¶
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.
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.
const AgentNotePrefix = "cc-agent-"
AgentNotePrefix + the CC agent id is the agent-cache note slug.
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 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
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 ¶
NoteDescription is the captured-plan note's one-line index text.
func NoteIteration ¶
NoteIteration reads a captured-plan note's plan_iteration frontmatter (preserved in Extra), tolerating the numeric types YAML/JSON round-trips produce.
func SetStatusTag ¶
SetStatusTag replaces the plan-status:<v> tag, preserving all others.
func SlugFromTags ¶
SlugFromTags returns the plan:<slug> composition slug, or "".
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
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 ¶
StatusFromTags returns the plan-status:<v> value, or "".
Types ¶
This section is empty.