# `H.Session`
[🔗](https://github.com/parlant/harness/blob/v0.3.0/lib/h/session.ex#L1)

Pure session history: a working directory, conversations, and immutable entries.

Conversation 1 is the root. Forks reference visible entry cutoffs rather than
copying transcripts. Conversation and entry IDs come from one strictly monotonic
session-local sequence (`next_id`), which fork prefix traversal relies on
(`entry.id <= cutoff`). All functions return new values; this module performs no
persistence, process management, model requests, or tool execution.

This is the trusted in-memory core. External data validation and durable
command admission belong to the daemon boundary, not these constructors.

# `error`

```elixir
@type error() :: :conversation_not_found | :entry_not_visible
```

# `t`

```elixir
@opaque t()
```

# `append`

```elixir
@spec append(t(), pos_integer(), String.t(), map()) ::
  {:ok, t(), H.Entry.t()} | {:error, error()}
```

Appends a raw entry to a conversation's own segment.

# `create_conversation`

```elixir
@spec create_conversation(t()) :: {:ok, t(), H.Conversation.t()}
```

Creates another independent conversation in the session.

# `entries`

```elixir
@spec entries(t(), pos_integer()) :: {:ok, [H.Entry.t()]} | {:error, error()}
```

Returns visible entries oldest first, respecting every ancestor's fork cutoff.

# `fork`

```elixir
@spec fork(t(), pos_integer(), pos_integer()) ::
  {:ok, t(), H.Conversation.t()} | {:error, error()}
```

Forks through a concrete entry visible in the source conversation, inclusively.

# `new`

```elixir
@spec new(String.t(), String.t()) :: t()
```

Creates an empty root conversation. The working directory must be absolute.

---

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