# `MingaAgent.ContextArtifact`
[🔗](https://github.com/jsmestad/minga/blob/main/lib/minga_agent/context_artifact.ex#L1)

Generates condensed context artifacts from agent sessions.

Unlike session export (#284) which produces a full transcript for humans,
context artifacts produce a compact summary designed for feeding to a
future agent session via `@.minga/context/session-summary-{id}.md`.

A 50K-token session with dozens of tool calls collapses into a 1-2K
token context file that a fresh session can consume efficiently.

# `artifact_opts`

```elixir
@type artifact_opts() :: [project_root: String.t(), session_id: String.t() | nil]
```

Options for artifact generation.

# `list`

```elixir
@spec list(String.t()) :: [String.t()]
```

Lists existing context artifacts in the project.

# `save`

```elixir
@spec save(String.t(), artifact_opts()) :: {:ok, String.t()} | {:error, String.t()}
```

Saves a generated summary to the `.minga/context/` directory.

Returns `{:ok, path}` or `{:error, reason}`.

# `summarizable?`

```elixir
@spec summarizable?([ReqLLM.Message.t()]) :: boolean()
```

Returns true if the conversation has enough content to be worth summarizing.

Requires at least 2 non-system messages (one user + one assistant).

# `summary_prompt`

```elixir
@spec summary_prompt() :: String.t()
```

Returns the meta-prompt to inject for summary generation.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
