# agent-doc Ontology

Domain ontology for the agent-doc system, extending the [existence-lang](https://github.com/btakita/existence-lang) kernel vocabulary.

## Terms

| Term | Extends | Definition |
|------|---------|------------|
| **[Document](./src/document.md)** | [Entity](../../existence-lang/ontology/src/entity.md) | A markdown file that serves as the shared UI surface for agent-human interaction, carrying both content and session metadata. |
| **[Session](./src/session.md)** | [System](../../existence-lang/ontology/src/system.md) | A stateful agent-document conversation identified by UUID, binding a document, an agent process, and a tmux pane. |
| **[Component](./src/component.md)** | [Entity](../../existence-lang/ontology/src/entity.md) | A named region in a template document bounded by HTML comment markers, targeting a specific patch destination. |
| **[Boundary](./src/boundary.md)** | [Signal](../../existence-lang/ontology/src/signal.md) | A marker inserted into a document that separates the agent's response space from the user's input space. |
| **[Snapshot](./src/snapshot.md)** | [State](../../existence-lang/ontology/src/state.md) | A frozen copy of document content at a point in time, used as the baseline for diff computation and undo. |
| **[Patch](./src/patch.md)** | [Signal](../../existence-lang/ontology/src/signal.md) | A content delta targeting a specific component, carrying the replacement or appended text the agent intends to write. |
| **[Exchange](./src/exchange.md)** | [Communication](../../existence-lang/ontology/src/communication.md) | The shared document surface where user and agent write inline, constituting the visible conversation history. |
| **[Route](./src/route.md)** | [Algorithm](../../existence-lang/ontology/src/algorithm.md) | The decision process that maps an incoming agent-doc command to the correct tmux pane for execution. |
| **[Claim](./src/claim.md)** | [Agreement](../../existence-lang/ontology/src/agreement.md) | The binding between a document path and a tmux pane, establishing which pane owns a given session document. |

## Ontology Chain

```
Existence → Entity → Document
                  → Component

Existence → Entity → System → Session

Existence → Entity → Signal → Boundary
                            → Patch

Existence → Entity → State  → Snapshot

Existence → Entity → System → Communication → Exchange

Existence → Entity → Algorithm → Route

Existence → Entity → Agreement → Claim
```

## Design Principle

agent-doc separates deterministic document logic (binary, Rust) from non-deterministic interpretation (skill, LLM). The ontology reflects this split: [Document](./src/document.md), [Component](./src/component.md), [Snapshot](./src/snapshot.md), [Patch](./src/patch.md), [Boundary](./src/boundary.md), [Route](./src/route.md), and [Claim](./src/claim.md) are owned by the binary. [Exchange](./src/exchange.md) and [Session](./src/session.md) span both — their structure is managed by the binary, their content is generated by the skill.
