> For the complete documentation index, see [llms.txt](https://docs.alpha-security.app/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.alpha-security.app/architecture/data-model.md).

# Data Model

Alpha stores data in two tiers: evidence (immutable) and the entity graph (mutable). Both live in PostgreSQL.

## Tier 1: Evidence

Evidence is append-only. Once captured, it never changes.

**Runs** store the metadata for each captured command:

* Command line (argv)
* Working directory
* Timing (start, end, duration)
* Exit code
* Operator attribution
* Tags

**Run output** stores the raw bytes from the terminal. The raw capture is preserved verbatim. A second, normalized text layer (ANSI-stripped, PTY de-wrapped) is generated for full-text search and parser input.

Even if Alpha has no parser for a tool, the raw output is stored and searchable. Nothing is ever lost.

## Tier 2: Entity Graph

The entity graph is a property graph built from parsed evidence. It consists of **nodes** and **edges**.

### Node kinds

| Kind           | Natural key            | Description                           |
| -------------- | ---------------------- | ------------------------------------- |
| `host`         | IP address             | A network host                        |
| `service`      | host + port + protocol | A listening service                   |
| `web_endpoint` | URL                    | A web endpoint (path, status, title)  |
| `credential`   | type-dependent         | A credential (password, hash, ticket) |
| `identity`     | username + domain      | A user account                        |
| `finding`      | title + severity       | A vulnerability                       |
| `share`        | host + name            | A network share (SMB, NFS)            |
| `note`         | (manual)               | Operator notes attached to entities   |

Each node has a small typed core (indexed for queries) plus an open JSONB `props` bag for arbitrary tool-specific data.

### Edges

Edges connect nodes with typed relationships:

| Edge kind   | Example                          |
| ----------- | -------------------------------- |
| `exposes`   | host exposes service             |
| `valid_on`  | credential valid on host/service |
| `runs`      | identity runs service            |
| `member_of` | identity member of group         |
| `admin_on`  | identity admin on host           |
| `affects`   | finding affects host/service     |

### Evidence links

Every node and edge links back to the run(s) that produced it through `evidence_links`. This means you can always trace a fact back to the exact command output that discovered it.

### Deduplication

Nodes are deduplicated within an engagement by their natural key. If nmap finds port 22 on 10.0.0.5 and then netexec also touches port 22 on 10.0.0.5, they merge into one service entity. Both runs appear in the evidence links.

This deduplication happens automatically during parsing. The entity graph grows richer as you run more tools against the same targets.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.alpha-security.app/architecture/data-model.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
