# kand1ss/knot-ops architecture

> Architecture diagram of the GitHub repository kand1ss/knot-ops, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kand1ss/knot-ops
- Repository: https://github.com/kand1ss/knot-ops

## Overview

Knot is a daemon-first development-service orchestrator: a client connects to the daemon, issues lifecycle and inspection commands, and the runtime manages services through readiness, dependency ordering, state, and logs. The tree exposes SDK, IPC, process-control, protocol, and terminal-rendering components, but not the daemon’s orchestration internals; README-backed capability nodes are therefore mapped to existing enclosing directories. The terminal crate is an internal progress-rendering library, not evidence of runtime health reporting.

Main entry points: [`components/knotd/cmd/knotd/main.go`](https://github.com/kand1ss/knot-ops/blob/main/components/knotd/cmd/knotd/main.go) (knot daemon), [`components/sdk/facade/src/client.rs`](https://github.com/kand1ss/knot-ops/blob/main/components/sdk/facade/src/client.rs) (Client entry), [`components/sdk/facade/src/builder.rs`](https://github.com/kand1ss/knot-ops/blob/main/components/sdk/facade/src/builder.rs) (Connection builder), [`components/sdk/facade/src/handles/control.rs`](https://github.com/kand1ss/knot-ops/blob/main/components/sdk/facade/src/handles/control.rs) (Control commands)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["Client SDK"]
  node_client["Client entry<br/>[client.rs]"]
  node_builder["Connection builder<br/>[builder.rs]"]
  node_handles["Lifecycle handles"]
  node_control["Control commands<br/>[control.rs]"]
  node_client_states["Connection states<br/>[states.rs]"]
end

subgraph group_transport["Daemon Transport"]
  node_grpc["gRPC and IPC"]
  node_protocol["Command protocol"]
end

subgraph group_runtime["Service Runtime"]
  node_service_model["Service model"]
  node_configuration["Service configuration<br/>[config.proto]"]
  node_dependencies["Dependency ordering"]
  node_health["Health checks"]
  node_lifecycle["Lifecycle management"]
  node_backends["Process backend<br/>[process.rs]"]
  node_runtime_state[("Runtime state")]
  node_logs["Service logs"]
end

subgraph group_terminal["Terminal Rendering"]
  node_engine["Task engine<br/>[engine.rs]"]
  node_layout["Progress layout<br/>[layout.rs]"]
  node_renderer["Task renderer<br/>[renderer.rs]"]
end

node_developer(("Developer"))
node_cli(("knot CLI"))
node_daemon["knot daemon<br/>[main.go]"]

node_developer -->|"runs commands"| node_cli
node_cli -.->|"uses SDK"| node_client
node_client -->|"creates builder"| node_builder
node_builder -->|"returns connection state"| node_client_states
node_builder -.->|"connects daemon"| node_grpc
node_client -.->|"connects"| node_daemon
node_daemon -.->|"serves IPC"| node_grpc
node_control -->|"sends commands"| node_protocol
node_control -.->|"exposes operations"| node_handles
node_cli -->|"requests lifecycle"| node_daemon
node_daemon -->|"loads declarations"| node_configuration
node_daemon -->|"manages services"| node_service_model
node_daemon -->|"orders startup"| node_dependencies
node_daemon -->|"checks readiness"| node_health
node_daemon -->|"controls services"| node_lifecycle
node_lifecycle -.->|"runs processes"| node_backends
node_daemon -->|"persists state"| node_runtime_state
node_daemon -->|"exposes logs"| node_logs
node_engine -->|"inserts progress"| node_layout
node_engine -->|"creates renderer"| node_renderer
node_layout -.->|"positions progress"| node_renderer

click node_daemon "https://github.com/kand1ss/knot-ops/blob/main/components/knotd/cmd/knotd/main.go"
click node_client "https://github.com/kand1ss/knot-ops/blob/main/components/sdk/facade/src/client.rs"
click node_builder "https://github.com/kand1ss/knot-ops/blob/main/components/sdk/facade/src/builder.rs"
click node_handles "https://github.com/kand1ss/knot-ops/tree/main/components/sdk/facade/src/handles"
click node_control "https://github.com/kand1ss/knot-ops/blob/main/components/sdk/facade/src/handles/control.rs"
click node_client_states "https://github.com/kand1ss/knot-ops/blob/main/components/sdk/facade/src/states.rs"
click node_grpc "https://github.com/kand1ss/knot-ops/tree/main/components/sdk/grpc/src"
click node_protocol "https://github.com/kand1ss/knot-ops/tree/main/proto/knot/v1"
click node_service_model "https://github.com/kand1ss/knot-ops/tree/main/components/sdk/core/src"
click node_configuration "https://github.com/kand1ss/knot-ops/blob/main/proto/knot/v1/config/config.proto"
click node_dependencies "https://github.com/kand1ss/knot-ops/tree/main/components/knotd"
click node_health "https://github.com/kand1ss/knot-ops/tree/main/components/knotd"
click node_lifecycle "https://github.com/kand1ss/knot-ops/tree/main/components/knotd"
click node_backends "https://github.com/kand1ss/knot-ops/blob/main/components/sdk/sys/src/process.rs"
click node_runtime_state "https://github.com/kand1ss/knot-ops/tree/main/components/knotd"
click node_logs "https://github.com/kand1ss/knot-ops/tree/main/components/knotd"
click node_engine "https://github.com/kand1ss/knot-ops/blob/main/components/shared/terminal/src/engine.rs"
click node_layout "https://github.com/kand1ss/knot-ops/blob/main/components/shared/terminal/src/layout.rs"
click node_renderer "https://github.com/kand1ss/knot-ops/blob/main/components/shared/terminal/src/renderer.rs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_client,node_builder,node_handles,node_control,node_client_states toneBlue
class node_grpc,node_protocol toneAmber
class node_service_model,node_configuration,node_dependencies,node_health,node_lifecycle,node_backends,node_runtime_state,node_logs toneMint
class node_engine,node_layout,node_renderer toneRose
class node_developer,node_cli toneIndigo
class node_daemon toneTeal
```

## Components

### Client SDK

- [Client entry](https://github.com/kand1ss/knot-ops/blob/main/components/sdk/facade/src/client.rs): `components/sdk/facade/src/client.rs`
- [Connection builder](https://github.com/kand1ss/knot-ops/blob/main/components/sdk/facade/src/builder.rs): `components/sdk/facade/src/builder.rs`
- [Lifecycle handles](https://github.com/kand1ss/knot-ops/tree/main/components/sdk/facade/src/handles): `components/sdk/facade/src/handles`
- [Control commands](https://github.com/kand1ss/knot-ops/blob/main/components/sdk/facade/src/handles/control.rs): `components/sdk/facade/src/handles/control.rs`
- [Connection states](https://github.com/kand1ss/knot-ops/blob/main/components/sdk/facade/src/states.rs): `components/sdk/facade/src/states.rs`

### Daemon Transport

- [gRPC and IPC](https://github.com/kand1ss/knot-ops/tree/main/components/sdk/grpc/src): `components/sdk/grpc/src`
- [Command protocol](https://github.com/kand1ss/knot-ops/tree/main/proto/knot/v1): `proto/knot/v1`

### Service Runtime

- [Service model](https://github.com/kand1ss/knot-ops/tree/main/components/sdk/core/src): `components/sdk/core/src`
- [Service configuration](https://github.com/kand1ss/knot-ops/blob/main/proto/knot/v1/config/config.proto): `proto/knot/v1/config/config.proto`
- [Dependency ordering](https://github.com/kand1ss/knot-ops/tree/main/components/knotd): `components/knotd`
- [Health checks](https://github.com/kand1ss/knot-ops/tree/main/components/knotd): `components/knotd`
- [Lifecycle management](https://github.com/kand1ss/knot-ops/tree/main/components/knotd): `components/knotd`
- [Process backend](https://github.com/kand1ss/knot-ops/blob/main/components/sdk/sys/src/process.rs): `components/sdk/sys/src/process.rs`
- [Runtime state](https://github.com/kand1ss/knot-ops/tree/main/components/knotd): `components/knotd`
- [Service logs](https://github.com/kand1ss/knot-ops/tree/main/components/knotd): `components/knotd`

### Terminal Rendering

- [Task engine](https://github.com/kand1ss/knot-ops/blob/main/components/shared/terminal/src/engine.rs): `components/shared/terminal/src/engine.rs`
- [Progress layout](https://github.com/kand1ss/knot-ops/blob/main/components/shared/terminal/src/layout.rs): `components/shared/terminal/src/layout.rs`
- [Task renderer](https://github.com/kand1ss/knot-ops/blob/main/components/shared/terminal/src/renderer.rs): `components/shared/terminal/src/renderer.rs`

### Other components

- **Developer**
- **knot CLI**
- [knot daemon](https://github.com/kand1ss/knot-ops/blob/main/components/knotd/cmd/knotd/main.go): `components/knotd/cmd/knotd/main.go`

## Connections

- Developer → knot CLI: runs commands (evidence: `README.md`)
- knot CLI → Client entry: uses SDK (evidence: `README.md`)
- Client entry → Connection builder: creates builder (evidence: `components/sdk/facade/src/client.rs`)
- Connection builder → Connection states: returns connection state (evidence: `components/sdk/facade/src/builder.rs`)
- Connection builder → gRPC and IPC: connects daemon (evidence: `README.md`)
- Client entry → knot daemon: connects (evidence: `README.md`)
- knot daemon → gRPC and IPC: serves IPC (evidence: `README.md`)
- Control commands → Command protocol: sends commands (evidence: `components/sdk/facade/src/handles/control.rs`)
- Control commands → Lifecycle handles: exposes operations
- knot CLI → knot daemon: requests lifecycle (evidence: `README.md`)
- knot daemon → Service configuration: loads declarations (evidence: `README.md`)
- knot daemon → Service model: manages services (evidence: `README.md`)
- knot daemon → Dependency ordering: orders startup (evidence: `README.md`)
- knot daemon → Health checks: checks readiness (evidence: `README.md`)
- knot daemon → Lifecycle management: controls services (evidence: `README.md`)
- Lifecycle management → Process backend: runs processes (evidence: `README.md`)
- knot daemon → Runtime state: persists state (evidence: `README.md`)
- knot daemon → Service logs: exposes logs (evidence: `README.md`)
- Task engine → Progress layout: inserts progress (evidence: `components/shared/terminal/src/engine.rs`)
- Task engine → Task renderer: creates renderer (evidence: `components/shared/terminal/src/engine.rs`)
- Progress layout → Task renderer: positions progress
