# llm-engine

## Role

`llm-engine` owns provider-independent model turn orchestration over committed history, tools, callbacks, retries, continuation, pruning, and compaction boundaries.

## Boundaries

Owns:

- Engine history mutation and append contracts
- tool-call loop semantics
- pre-stream retry and stream-started continuation policy
- pruning/compaction coordination from the Engine perspective
- provider-neutral events/callbacks/interceptors

Does not own:

- Host application names, sockets, process lifecycle, or scope delegation
- Product CLI shape
- Provider catalog and secret resolution
- Durable application state outside engine history

## Design notes

The Engine is where turn lifecycle belongs because it sees history, in-flight usage, partial output, and tool-call state. It should not receive context-only volatile facts; model-affecting inputs must first be appended to history.

## See also

- [`../../docs/design/context-history.md`](../../docs/design/context-history.md)
- [`../../docs/design/compaction.md`](../../docs/design/compaction.md)
- [`../../docs/design/provider-model-boundary.md`](../../docs/design/provider-model-boundary.md)
