sources

package
v0.32.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package sources discovers the instruction/memory/doc artifacts left by AI coding tools and humans (CLAUDE.md, .claude/, .cursor/rules, AGENTS.md, copilot/windsurf/aider configs, README, docs, ADRs) and records them as doctrine *candidates*.

Principle: these are EVIDENCE, not truth. Each source is scoped to the directory it governs and carries recency, so memcode can tell when a source is likely stale relative to the code it describes. Turning candidates into current doctrine — and reconciling conflicts — is the reducer's job (`learn`).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Persist

func Persist(ctx context.Context, st store.Store, srcs []Source) error

Persist stores discovered sources as doctrine candidates (doctrine entities) so context/why and the agent can surface the ones applicable to an area.

Types

type Source

type Source struct {
	Kind        string    `json:"kind"`  // claude | cursor | codex/agents | copilot | windsurf | aider | readme | docs
	Path        string    `json:"path"`  // relative to repo root
	Scope       string    `json:"scope"` // directory it governs ("." = whole repo)
	Bytes       int64     `json:"bytes"`
	ModTime     time.Time `json:"mod_time"`
	GitDate     string    `json:"git_date"` // last commit date touching it (YYYY-MM-DD)
	Stale       bool      `json:"stale"`    // code in scope changed after this last did
	StaleReason string    `json:"stale_reason,omitempty"`
}

Source is one discovered evidence document.

func Discover

func Discover(ctx context.Context, root string) ([]Source, error)

Discover returns every recognized source document among the project's non-ignored files (so vendored/cached/gitignored files never count). Tracked AI-config files (CLAUDE.md, .claude/*, .cursor/rules) are included; purely local-ignored ones are not.

func Load

func Load(ctx context.Context, st store.Store) ([]Source, error)

Load reads previously discovered sources back from the store.

func (Source) AppliesTo

func (s Source) AppliesTo(rel string) bool

AppliesTo reports whether a source governs the given path.

Jump to

Keyboard shortcuts

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