Cohere.Intent (Cohere v0.1.0)

Copy Markdown View Source

Loads, parses, generates, and updates intent cards.

Cards are markdown files with a small machine-managed frontmatter block (parsed by hand — no YAML dependency) and typed ## sections. Humans and agents edit the sections; cohere manages the frontmatter.

Summary

Functions

Rebinds a card's frontmatter to a new surface and appends an accepted-drift annotation. opts[:by] names who judged, in the annotation — attribution lives in event traces only, never frontmatter (DEC-AGE-004 in cohere/design/agent-surfaces.md). Returns the updated card text.

Conventional card filename for a context group.

Loads every card in the project's intent directory.

Parses card text. Returns {:ok, %Card{}} or {:error, reason}.

Fully-qualified module references in the card body (backticked, inside the given namespace) — the checkable claims a card makes about code.

Generates a skeleton card for a context group, bound to its current surface so a fresh card is born non-drifted.

Functions

accept_drift(text, group, date, opts \\ [])

Rebinds a card's frontmatter to a new surface and appends an accepted-drift annotation. opts[:by] names who judged, in the annotation — attribution lives in event traces only, never frontmatter (DEC-AGE-004 in cohere/design/agent-surfaces.md). Returns the updated card text.

filename(group)

Conventional card filename for a context group.

load_all(project)

@spec load_all(Cohere.Project.t()) :: [Cohere.Intent.Card.t()]

Loads every card in the project's intent directory.

parse(text, path \\ nil)

@spec parse(String.t(), String.t() | nil) ::
  {:ok, Cohere.Intent.Card.t()} | {:error, term()}

Parses card text. Returns {:ok, %Card{}} or {:error, reason}.

refs(card, namespace)

Fully-qualified module references in the card body (backticked, inside the given namespace) — the checkable claims a card makes about code.

Returns [{module_string, function_name | nil, arity | nil}].

skeleton(group, date)

Generates a skeleton card for a context group, bound to its current surface so a fresh card is born non-drifted.