sensitive

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Sensitive projects — the per-repository opt-out that stops automatic session recall from moving a project's conversations across the network. See yottacode-roadmap/memory-auto-recall.md (fork 3).

The threat this closes is specific. Embedding, storage, and cosine are all local, but an *injected* recall excerpt egresses to the cloud LLM with the turn. For a PHI/medical repository that is unacceptable, and it cuts both ways:

  • inbound — auto-recall is off inside a sensitive project, so nothing is swept into its prompts automatically;
  • outbound — a sensitive project's sessions are never candidates for any *other* project's recall, whatever the configured scope. Without this half, `scope = "user"` would quietly carry PHI into an unrelated repo's turn, which is the same leak facing the other direction.

What it deliberately does NOT do: sessions are still indexed and embedded, and the manual session_recall tool still reaches them. The gate is about what leaves *automatically*, not about making your own history unreachable when you deliberately ask for it. Use Full quarantine semantics elsewhere if that is ever needed.

Storage mirrors internal/trust deliberately — same JSON shape, same atomic write, same descendant inheritance, same DefaultDenyPaths entry so the model's write tools cannot mark a repo non-sensitive. Two small stores with one obvious pattern beat one generic store with a mode flag.

Index

Constants

View Source
const Version = 1

Version is the on-disk schema version. Bumped only on a breaking change; readers tolerate unknown fields so additive changes don't require a bump.

Variables

This section is empty.

Functions

func DefaultStorePath

func DefaultStorePath() (string, error)

DefaultStorePath returns ~/.yottacode/sensitive-roots.json.

func Save

func Save(path string, s *Store) error

Save writes s to path atomically (temp + rename), creating the parent dir at 0700 if missing. The file is 0644 — these are preferences, not secrets; the protection comes from the deny-list, not from file mode.

Types

type Root

type Root struct {
	Path     string    `json:"path"`
	MarkedAt time.Time `json:"marked_at"`
}

Root is one sensitive directory entry. Path is absolute and filepath.Clean-ed at the moment it was marked. MarkedAt is informational — printed by `yottacode sensitive list`, never consulted for gating.

type Store

type Store struct {
	Version int    `json:"version"`
	Roots   []Root `json:"roots"`
}

Store is the in-memory representation of sensitive-roots.json.

func Load

func Load(path string) (*Store, error)

Load reads the store at path. A missing file is the normal state for most users and returns an empty Store, not an error.

A malformed file IS an error, and callers must not degrade to "no roots" on one: silently treating an unreadable store as empty would turn a typo into an unannounced loss of protection. Fail loudly so the user fixes it.

func (*Store) Add

func (s *Store) Add(path string) (bool, error)

Add inserts a root if not already present by exact path match. Returns true if the entry is new. Adding /foo when /foo/bar is already marked records /foo too — the user has now named the broader root explicitly.

func (*Store) Clear

func (s *Store) Clear()

Clear empties the store.

func (*Store) Contains

func (s *Store) Contains(path string) bool

Contains reports whether path equals or is descended from any sensitive root. Descendant inheritance is what makes marking a repo root enough to cover every subdirectory a session might have started in.

func (*Store) Paths

func (s *Store) Paths() []string

Paths returns every recorded root path. Used to build the outbound exclusion predicate, which must consider all sensitive roots — not just the current project's — so another repo's PHI can't surface here.

func (*Store) Remove

func (s *Store) Remove(path string) (bool, error)

Remove deletes a root by exact-path match. Returns true if an entry was removed. Exact match, not descendant match: removing /foo/bar must not silently strip protection from the broader /foo entry that also covers it.

Jump to

Keyboard shortcuts

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