# `Cortexa.Workspace`
[🔗](https://github.com/swadhinbiswas/Cortexa/blob/main/lib/cortexa/workspace.ex#L1)

GCCWorkspace — persistent versioned memory workspace for LLM agents.

cortexa — Git-inspired context management.
Based on arXiv:2508.00031.

# `t`

```elixir
@type t() :: %Cortexa.Workspace{
  current_branch: String.t(),
  gcc_dir: String.t(),
  root: String.t()
}
```

# `branch`

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

BRANCH — create an isolated reasoning workspace.

# `commit`

```elixir
@spec commit(t(), String.t(), String.t() | nil, String.t() | nil) ::
  {t(), Cortexa.Models.CommitRecord.t()}
```

COMMIT — checkpoint a milestone on the current branch.

# `context`

```elixir
@spec context(t(), String.t() | nil, non_neg_integer()) ::
  Cortexa.Models.ContextResult.t()
```

CONTEXT — hierarchical memory retrieval.

# `init`

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

Initialize a fresh .GCC workspace.

# `list_branches`

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

List all branches.

# `load`

```elixir
@spec load(t()) :: t()
```

Attach to an existing .GCC workspace.

# `log_ota`

```elixir
@spec log_ota(t(), String.t(), String.t(), String.t()) ::
  {t(), Cortexa.Models.OTARecord.t()}
```

Append an OTA cycle to the current branch.

# `merge`

```elixir
@spec merge(t(), String.t(), String.t() | nil, String.t()) ::
  {t(), Cortexa.Models.CommitRecord.t()}
```

MERGE — integrate a branch back into a target.

# `new`

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

Create a new workspace handle.

# `switch_branch`

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

Switch to an existing branch.

---

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