Foundry.SpecKit.SessionMemory (foundry v0.1.1)

Copy Markdown

Extracts durable session findings from assistant responses and persists them as canonical spec-kit artifacts under docs/findings/.

The assistant appends a fenced foundry-memory JSON block only when a turn produced stable technical knowledge worth preserving beyond the current chat. Foundry strips that block from the visible response, validates it, and writes a markdown artifact that can be indexed alongside ADRs, runbooks, and regulations.

Summary

Types

extraction_result()

@type extraction_result() :: %{
  response: String.t(),
  payload: map() | nil,
  error: term() | nil
}

Functions

extract(response)

@spec extract(String.t()) :: extraction_result()

extract_hidden(response)

@spec extract_hidden(String.t()) :: %{
  response: String.t(),
  memory: %{payload: map() | nil, error: term() | nil},
  session: %{payload: map() | nil, error: term() | nil}
}

persist(project_root, session_id, payload, metadata \\ %{})

@spec persist(String.t(), String.t(), map(), map()) :: {:ok, map()} | {:error, term()}