systemg 0.53.4

An agent-friendly general process composer.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
# systemg Full LLM Guide

systemg is an agent-friendly general process composer. It manages a graph of local
programs from a YAML manifest, starts dependencies in order, supervises long
running services, runs cron-style units, captures logs, reports status, and
supports targeted service control through a single CLI named `sysg`.

Current release: `0.51.0`
Release context: the changes since commit `b1a640d` make systemg much friendlier
for LLMs, scripts, SSH commands, and other non-interactive automation.

Primary links:

- Documentation: https://sysg.dev
- Quickstart: https://sysg.dev/quickstart
- Installation: https://sysg.dev/installation
- Commands: https://sysg.dev/how-it-works/commands
- Logs command: https://sysg.dev/how-it-works/commands/logs
- Status command: https://sysg.dev/how-it-works/commands/status
- Inspect command: https://sysg.dev/how-it-works/commands/inspect
- Validate command: https://sysg.dev/how-it-works/commands/validate
- Claude Code integration: https://sysg.dev/integrations/claude-code
- Configuration: https://sysg.dev/how-it-works/configuration
- Runtime state: https://sysg.dev/how-it-works/state
- Logging model: https://sysg.dev/how-it-works/logs
- Repository: https://github.com/ra0x3/systemg

## What Changed For Agents In 0.50.0

The release after `b1a640d` added an agent-friendly command surface:

- Global `--plain` mode for non-interactive callers.
- `SYSTEMG_AGENT=1` support for environment-based agent mode.
- `NO_COLOR` also implies agent-friendly output.
- `sysg logs` no longer blocks by default when called from pipes, files, SSH, or
  agent sessions.
- Explicit `sysg logs --follow` and `sysg logs --no-follow` controls.
- Structured `sysg logs --format json` output.
- `sysg logs --raw` for application lines without systemg prefixes.
- Default ANSI stripping for JSON, raw, non-interactive, and agent log output.
- `sysg logs --since`, `--until`, `--grep`, and `--all` for bounded log
  searches across active and rotated history.
- `sysg logs --path` for locating log files without scraping internal paths.
- Status and inspect output avoid color and truncation under `--plain`.

There was also dependency maintenance in this range, including a
`crossbeam-epoch` CVE bump, and the package version was released as `0.50.0`.

## Agent Mode

Prefer `--plain` whenever an LLM, script, CI job, remote shell, or parser is
driving `sysg`.

```sh
sysg --plain status
sysg --plain logs -s api
sysg --plain inspect -s api --format json
```

`--plain` is global, so it can be placed before or after the subcommand. It is
equivalent to setting `SYSTEMG_AGENT=1` for the current process. Agent mode is
also enabled if either `SYSTEMG_AGENT` or `NO_COLOR` is set in the environment.

Agent mode is intended to:

- Disable color and decorative terminal output.
- Avoid banners and paging where applicable.
- Preserve full unit names instead of truncating for a terminal table.
- Make `sysg logs` one-shot by default instead of following forever.
- Strip ANSI escape sequences from log output by default.

Recommended environment for tools that run many `sysg` commands:

```sh
export SYSTEMG_AGENT=1
```

## Install

Install latest:

```sh
curl --proto '=https' --tlsv1.2 -fsSL https://sh.sysg.dev/ | sh
```

Install or activate a specific version:

```sh
curl --proto '=https' --tlsv1.2 -fsSL https://sh.sysg.dev/ | sh -s -- --version 0.51.0
```

System deployments use `scripts/install-systemg.sh` to set up `/usr/bin/sysg`,
`/etc/systemg`, and `/var/lib/systemg`. In system mode (`--sys`), state lives in
`/var/lib/systemg` and logs live in `/var/log/systemg`.

## Core Mental Model

systemg runs a supervisor. Projects are usually loaded from a `systemg.yaml`
configuration file. Units can be services or cron jobs. Services are long
running processes that may be restarted. Cron units are scheduled jobs and are
not persistent services.

Common operations:

```sh
sysg start
sysg start --config systemg.yaml
sysg start --daemonize
sysg stop
sysg restart
sysg status
sysg inspect -s api
sysg logs -s api
```

Most service-specific commands accept:

```sh
--service <name>
-s <name>
--project <project-id>
-p <project-id>
--config <path>
-c <path>
```

When multiple registered projects contain the same service name, include
`--project` to disambiguate.

## Status

Use `status` to inspect supervisor health.

Best commands for LLMs:

```sh
sysg --plain status
sysg status --format json
sysg status --project <project-id> --format json
sysg status --service api --format json
```

`sysg status` can run without a config file when a supervisor is already
running. If no supervisor is running and no config is provided, it reports that
there is no running supervisor.

Useful status options:

- `--format json`: structured machine-readable output. If `--format` is passed
  without a value, JSON is the default.
- `--format xml`: XML status output.
- `--plain`: disable color and print full, un-truncated unit names.
- `--project <id>`: filter by stable project id.
- `--service <name>`: filter to one unit.
- `--all`: include orphaned state outside the selected project/config set.
- `--live`: force immediate runtime collection instead of using the configured
  snapshot mode.
- `--stream <duration>`: continuously refresh status. Avoid this for one-shot
  LLM calls unless streaming is explicitly requested.

Exit-code convention for rendered status and inspect views:

- `0`: healthy
- `1`: warning
- `2`: failing

## Inspect

Use `inspect` for one service or cron unit.

Best commands for LLMs:

```sh
sysg --plain inspect -s api
sysg inspect -s api --format json
sysg inspect -s api --project <project-id> --format json
```

Useful inspect options:

- `--format json`: structured detail for parsers.
- `--format xml`: XML detail.
- `--plain`: inherited global flag for agent-friendly output.
- `--project <id>`: disambiguate duplicate service names.
- `--live`: force immediate runtime collection.
- `--stream <duration>`: continuously refresh. Avoid for one-shot agent calls.

## Validate

Use `validate` to check a manifest before running it. It parses the file,
resolves the dependency graph, and reports precise, fixable diagnostics.

Best commands for LLMs:

```sh
sysg validate -c sysg.yaml
sysg validate -c sysg.yaml --format json
sysg --plain validate -c sysg.yaml
```

Behavior:

- Exit code `0` when the manifest is valid, `1` when it has problems.
- Human output shows the offending line with a caret, plus a plain-language
  `why`, a suggested `fix`, and a docs link. It is colored for terminals and
  falls back to plain text under `--plain` / `--no-color` / agent mode.
- `--format json` emits `{config, valid, diagnostics[]}` where each diagnostic
  has `line`, `column`, `kind`, `message`, `why`, `suggestion`, and `doc`.

Checks performed: supported `version`, a `services` map with a `command` per
service, valid YAML syntax, `deployment.health_check` with a `url` or `command`,
`depends_on` references that exist and contain no cycle, a valid `project.id`,
and `${VAR}` interpolations that resolve. Run `sysg validate` after writing or
editing any config, and gate deploys on it:

```sh
sysg validate -c production.yaml --plain || exit 1
sysg start -c production.yaml --daemonize
```

## Logs

Use `logs` to read service output captured by systemg.

Best commands for LLMs:

```sh
sysg --plain logs -s api
sysg logs -s api --format json
sysg logs -s api --raw
sysg logs -s api --grep ERROR --since 2h
sysg logs -s api --all --grep "panic|ERROR|failed"
sysg logs --kind supervisor --format json
sysg logs --path
sysg logs -s api --path --all
```

Important log-following behavior:

- `--follow` or `-f` always follows until interrupted.
- `--no-follow` always prints one snapshot and exits.
- With neither flag, systemg follows only when stdout is an interactive terminal
  and agent mode is unset.
- In pipes, files, SSH commands, and `SYSTEMG_AGENT=1` sessions, logs are
  one-shot by default.

This means these commands are safe for LLMs and automation:

```sh
sysg logs -s api
sysg --plain logs -s api
sysg logs -s api | grep ERROR
ssh host 'SYSTEMG_AGENT=1 sysg logs -s api'
```

Use `--follow` only when a long-running tail is intentional:

```sh
sysg logs -s api --follow
```

### Structured Logs

Use JSON-lines output for reliable parsing:

```sh
sysg logs -s api --format json
```

Each emitted line is a JSON object with:

```json
{"ts":"2026-07-07T12:00:00Z","stream":"stdout","service":"api","line":"request completed"}
```

Properties:

- `ts`: systemg capture timestamp.
- `stream`: `stdout`, `stderr`, or supervisor stream label.
- `service`: service name when available.
- `line`: original application line after requested stripping/prefix handling.

`--format json` drops banners and section headers, and strips ANSI escapes by
default.

### Raw Logs

Use raw output when the application line itself is the only useful payload:

```sh
sysg logs -s api --raw
```

`--raw` removes systemg's capture timestamp and stream label. ANSI escapes are
stripped by default.

### Time And Pattern Filtering

Use bounded log reads instead of asking for unbounded output:

```sh
sysg logs -s api --since 30m
sysg logs -s api --since 2h --grep ERROR
sysg logs -s api --since 2026-07-07 --until 2026-07-07T12:00:00Z
```

Accepted time forms:

- RFC3339 timestamp, such as `2026-07-07T14:00:00Z`.
- Bare UTC date, such as `2026-07-07`.
- Relative age in the past, such as `30m`, `2h`, or `7d`.

`--grep` is a regular expression. It composes with `--kind`, `--since`,
`--until`, and `--all`.

Any `--since`, `--until`, or `--all` read is a one-shot snapshot because an
upper-bounded or historical read cannot be followed continuously.

### Active And Rotated History

By default, `sysg logs` reads recent lines from the active log. Use `--all` to
read active plus rotated history:

```sh
sysg logs -s api --all --grep ERROR
```

The output is ordered oldest to newest, with rotated backups before the active
file. `--all` ignores `--lines`.

### Log Paths

Use `--path` to locate logs without relying on internal path conventions:

```sh
sysg logs --path
sysg logs -s api --path
sysg logs -s api --path --all
```

With no service, `--path` prints the log directory. With a service, it prints
that service's active log path. With `--all`, it prints active plus rotated
backup paths.

### ANSI Handling

systemg records service output verbatim, including ANSI escapes. For downstream
tools:

- ANSI stripping is on by default for `--format json`.
- ANSI stripping is on by default for `--raw`.
- ANSI stripping is on by default for non-interactive output.
- ANSI stripping is on by default in agent mode.
- Use `--strip-ansi` to force stripping.
- Use `--no-strip-ansi` to preserve escapes.

### Log Maintenance

Truncate retained logs or prune rotated backups when disk usage matters:

```sh
sysg logs --purge
sysg logs -s api --purge
sysg logs --prune --max-size 100MB
sysg logs --prune --max-age 7d
```

`--purge` truncates log files (all services plus `supervisor.log`, or one
service with `-s`). `--prune` deletes rotated backups by total size or age and
requires at least one of `--max-size` or `--max-age`.

## Configuration Keys

Manifest reference (see `docs/how-it-works/configuration.mdx` for details):

- Top level: `version` (required), `project` (`id`, `name`, or shorthand
  string), `env`, `logs` (`sink: file|none`, `max_bytes`, `max_files`),
  `status` (`snapshot_mode: off|summary|detailed`, `snapshot_interval_secs`),
  `metrics` (`retention_minutes`, `sample_interval_secs`, `max_memory_bytes`,
  `spillover_path`), and `services` (required).
- Per service: `command` (required), `depends_on`, `env` (`vars`, `file`,
  `inherit_env`, `clear_session_vars`, `strip`), `restart_policy`
  (`always|on-failure|never`; clean exits never restart), `backoff`,
  `max_restarts`, `hooks` (`on_start`/`on_stop`/`on_restart` with
  `success`/`error` handlers), `cron` (`expression`, `timezone`),
  `deployment` (`strategy: rolling|immediate`, `pre_start`, `health_check`,
  `grace_period`, `blue_green`), `logs`, `skip`, `spawn` (`mode`, `limits`).
- Privileged mode only: `user`, `group`, `supplementary_groups`,
  `capabilities`, `limits`, `isolation`.

Health checks live under `deployment.health_check`, not at the service level.

## Command Recipes For LLMs

Get a parseable view of the system:

```sh
sysg status --format json
```

Get a readable view without terminal decoration:

```sh
sysg --plain status
```

Inspect one service:

```sh
sysg inspect -s api --format json
```

Check recent errors:

```sh
sysg logs -s api --format json --grep "ERROR|WARN|panic|failed" --since 2h
```

Get only application log text:

```sh
sysg logs -s api --raw --since 30m
```

Search all retained history:

```sh
sysg logs -s api --all --grep "database|timeout|connection"
```

Disambiguate a service name across projects:

```sh
sysg status --project <project-id> --service api --format json
sysg inspect --project <project-id> -s api --format json
sysg logs --project <project-id> -s api --format json
```

Restart one service:

```sh
sysg restart -s api
```

Stop one service:

```sh
sysg stop -s api
```

Restart a service in a specific project:

```sh
sysg restart --project <project-id> -s api
```

## Avoid These In One-Shot Agent Calls

Avoid long-running or interactive commands unless the user explicitly asked for
streaming:

```sh
sysg logs -s api --follow
sysg status --stream 5
sysg inspect -s api --stream 5
sysg logs -s api --stream 2
```

Prefer one-shot alternatives:

```sh
sysg --plain logs -s api --lines 200
sysg status --format json
sysg inspect -s api --format json
```

## Output Selection

For LLM and automation workflows:

- Prefer JSON for parsing and decision making.
- Prefer `--plain` for human-readable summaries.
- Prefer `--raw` when only application log text matters.
- Prefer `--grep`, `--since`, and `--lines` to bound log volume.
- Prefer `--project` when service names may be duplicated across projects.
- Prefer `--path` when another tool should read the logs directly.

## Claude Code Integration

systemg ships an official Claude Code plugin and skill from a self-hosted
marketplace in the repository. The skill teaches the `sysg` CLI, the config
schema, deployments, cron units, and log inspection, and instructs the agent to
use `--plain` in non-interactive contexts, prefer `--format json`, and run
`sysg validate` before starting a stack.

Install:

```text
/plugin marketplace add ra0x3/systemg
/plugin install systemg
```

The plugin version tracks the crate version (CI stamps
`.claude-plugin/plugin.json` from `Cargo.toml` on release). Refresh with
`/plugin marketplace update systemg`; Claude Code prompts for updates
automatically. Full details: https://sysg.dev/integrations/claude-code

## Relevant Local Docs

These docs contain the canonical user-facing descriptions:

- `docs/how-it-works/commands/index.mdx`: global flags, including `--plain`.
- `docs/how-it-works/commands/status.mdx`: status behavior and options.
- `docs/how-it-works/commands/validate.mdx`: config validation and diagnostics.
- `docs/how-it-works/commands/logs.mdx`: logs behavior, filters, JSON/raw
  output, ANSI handling, path lookup, and rotation.
- `docs/how-it-works/logs.mdx`: logging architecture and retention model.
- `docs/how-it-works/configuration.mdx`: service and project configuration.
- `docs/integrations/claude-code.mdx`: the Claude Code plugin and skill.