Skip to content

Commit 08ef5d0

Browse files
authored
Merge pull request KafClaw#28 from scalytics/novatechflow/operations
Novatechflow/operations
2 parents 9261501 + fffc371 commit 08ef5d0

53 files changed

Lines changed: 4554 additions & 198 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/operations-admin/maintenance.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,14 @@ Guided alternative:
7373

7474
## Service Operation (Linux systemd)
7575

76-
If installed as system service:
76+
Preferred (CLI-managed):
77+
78+
```bash
79+
sudo ./kafclaw daemon status
80+
sudo ./kafclaw daemon restart
81+
```
82+
83+
Direct `systemctl` fallback:
7784

7885
```bash
7986
sudo systemctl daemon-reload

docs/operations-admin/manage-kafclaw.md

Lines changed: 196 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,18 @@ Operator-focused guide for managing KafClaw from CLI and runtime endpoints.
1717
| `kafclaw doctor` | Run setup/config diagnostics including skills readiness checks |
1818
| `kafclaw security` | Unified security checks/audit/fix (`check`, `audit --deep`, `fix --yes`) |
1919
| `kafclaw config` | Low-level dotted-path config read/write/unset |
20-
| `kafclaw configure` | Guided/non-interactive config updates (subagents + skills toggles) |
21-
| `kafclaw skills` | Skills lifecycle (`enable/disable/list/status/verify/install/update/auth/prereq`) |
20+
| `kafclaw configure` | Guided/non-interactive config updates (subagents, skills, Kafka group security) |
21+
| `kafclaw skills` | Skills lifecycle (`enable/disable/list/status/enable-skill/disable-skill/verify/install/update/exec/auth/prereq`) |
2222
| `kafclaw group` | Join/leave/status/members for Kafka collaboration group |
2323
| `kafclaw kshark` | Kafka connectivity and protocol diagnostics |
2424
| `kafclaw agent -m` | Single-shot direct CLI interaction with agent loop |
2525
| `kafclaw pairing` | Approve/deny pending Slack/Teams sender pairings |
2626
| `kafclaw whatsapp-setup` | Configure WhatsApp auth and initial lists |
2727
| `kafclaw whatsapp-auth` | Approve/deny/list WhatsApp JIDs |
28-
| `kafclaw install` | Install binary to `/usr/local/bin` |
28+
| `kafclaw install` | Install local binary (`/usr/local/bin` as root, `~/.local/bin` as non-root) |
29+
| `kafclaw daemon` | Manage systemd service lifecycle (`install`, `uninstall`, `start`, `stop`, `restart`, `status`) |
30+
| `kafclaw update` | Update lifecycle (`plan`, `apply`, `backup`, `rollback`) |
31+
| `kafclaw completion` | Generate shell completion scripts (`bash|zsh|fish|powershell`) |
2932
| `kafclaw version` | Print build version |
3033

3134
## 2. First-Time Operator Runbook
@@ -42,7 +45,119 @@ Then verify:
4245
- API: `http://127.0.0.1:18790`
4346
- Dashboard: `http://127.0.0.1:18791`
4447

45-
## 3. Onboarding and Modes
48+
## 3. Release Installer (Recommended for Operators)
49+
50+
Install via release script (host OS/arch auto-detected):
51+
52+
```bash
53+
curl --fail --show-error --silent --location \
54+
https://raw.githubusercontent.com/kafclaw/kafclaw/main/scripts/install.sh \
55+
| bash -s -- --latest
56+
```
57+
58+
List available versions:
59+
60+
```bash
61+
curl --fail --show-error --silent --location \
62+
https://raw.githubusercontent.com/kafclaw/kafclaw/main/scripts/install.sh \
63+
| bash -s -- --list-releases
64+
```
65+
66+
Pinned install:
67+
68+
```bash
69+
curl --fail --show-error --silent --location \
70+
https://raw.githubusercontent.com/kafclaw/kafclaw/main/scripts/install.sh \
71+
| bash -s -- --version v2.6.3
72+
```
73+
74+
Unattended/headless install requires explicit version selection:
75+
76+
```bash
77+
# Latest channel
78+
curl --fail --show-error --silent --location \
79+
https://raw.githubusercontent.com/kafclaw/kafclaw/main/scripts/install.sh \
80+
| bash -s -- --unattended --latest
81+
82+
# Pinned version
83+
curl --fail --show-error --silent --location \
84+
https://raw.githubusercontent.com/kafclaw/kafclaw/main/scripts/install.sh \
85+
| bash -s -- --unattended --version v2.6.3
86+
```
87+
88+
Security behavior:
89+
90+
- Checksum verification (`SHA256SUMS`) is always required.
91+
- Signature verification (`cosign`) is enabled by default.
92+
- Use `--no-signature-verify` only in constrained environments where `cosign` is unavailable.
93+
- Installer failures use structured error codes (for example `INSTALL_PREREQ_MISSING`, `INSTALL_DOWNLOAD_FAILED`) and include remediation text.
94+
95+
Root install behavior:
96+
97+
- Installer warns that root service install is a security risk.
98+
- If accepted, it creates non-root user `kafclaw` (Linux) for service runtime.
99+
- If declined (`n`), installer continues with root runtime and prints `Installing as root service.`
100+
101+
Install verification path (automatic at end of install):
102+
103+
- version check (`kafclaw version` / `kafclaw --version`)
104+
- PATH check (whether `kafclaw` resolves from current shell)
105+
- status check when config exists (`~/.kafclaw/config.json`), otherwise prints onboarding reminder
106+
107+
## 3.1 Update / Rollback Lifecycle
108+
109+
Plan the flow:
110+
111+
```bash
112+
./kafclaw update plan
113+
```
114+
115+
Create backup snapshot only:
116+
117+
```bash
118+
./kafclaw update backup
119+
```
120+
121+
Apply binary update:
122+
123+
```bash
124+
./kafclaw update apply --latest
125+
./kafclaw update apply --version v2.6.3
126+
```
127+
128+
Apply source update:
129+
130+
```bash
131+
./kafclaw update apply --source --repo-path /path/to/KafClaw
132+
```
133+
134+
Rollback state from latest snapshot:
135+
136+
```bash
137+
./kafclaw update rollback
138+
```
139+
140+
Rollback state from specific snapshot:
141+
142+
```bash
143+
./kafclaw update rollback --backup-path ~/.kafclaw/backups/update-YYYYMMDD-HHMMSSZ
144+
```
145+
146+
`update apply` runs:
147+
148+
- preflight compatibility checks (config + timeline migration readiness)
149+
- pre-update backup snapshot
150+
- update apply (binary/source path)
151+
- post-update health gates (`doctor`, security check)
152+
- config drift report
153+
154+
Lifecycle event logs:
155+
156+
- Critical onboarding/update/rollback phases append JSONL events to:
157+
- `~/.kafclaw/lifecycle-events.jsonl`
158+
- Use this for troubleshooting automation/non-interactive lifecycle runs.
159+
160+
## 4. Onboarding and Modes
46161

47162
### Interactive
48163

@@ -77,7 +192,42 @@ Onboarding also scaffolds workspace files:
77192

78193
Use `--force` to overwrite existing config and scaffold files.
79194

80-
## 4. Daily Health Checks
195+
Lifecycle flags (operator-focused):
196+
197+
```bash
198+
./kafclaw onboard --reset-scope config --non-interactive --accept-risk --profile local --llm skip
199+
./kafclaw onboard --wait-for-gateway --health-timeout 20s
200+
./kafclaw onboard --skip-healthcheck
201+
./kafclaw onboard --daemon-runtime native
202+
```
203+
204+
If onboarding installs systemd (`--systemd`), service activation is automatic by default.
205+
Disable auto-activation with `--systemd-activate=false`.
206+
207+
## 4.1 Daemon / Service Lifecycle (Linux systemd)
208+
209+
Install service and activate immediately:
210+
211+
```bash
212+
sudo ./kafclaw daemon install --activate
213+
```
214+
215+
Service operations:
216+
217+
```bash
218+
sudo ./kafclaw daemon status
219+
sudo ./kafclaw daemon restart
220+
sudo ./kafclaw daemon stop
221+
sudo ./kafclaw daemon start
222+
```
223+
224+
Uninstall service:
225+
226+
```bash
227+
sudo ./kafclaw daemon uninstall
228+
```
229+
230+
## 5. Daily Health Checks
81231

82232
### Status snapshot
83233

@@ -104,7 +254,7 @@ Highlights include:
104254
When skills are enabled, doctor also checks `node`, `clawhub` (if external installs are enabled), runtime dir permissions, and channel-onboarding readiness.
105255
Use `kafclaw security` for consolidated security posture and deep skill audits.
106256

107-
## 5. Config Management
257+
## 6. Config Management
108258

109259
### Low-level config edits
110260

@@ -123,6 +273,7 @@ Use `kafclaw security` for consolidated security posture and deep skill audits.
123273
./kafclaw configure --non-interactive --skills-enabled-set --skills-enabled=true --skills-node-manager npm
124274
./kafclaw configure --non-interactive --skills-scope selected
125275
./kafclaw configure --non-interactive --enable-skill github --disable-skill weather
276+
./kafclaw configure --non-interactive --kafka-brokers "broker1:9092,broker2:9092" --kafka-security-protocol SASL_SSL --kafka-sasl-mechanism SCRAM-SHA-512 --kafka-sasl-username "<username>" --kafka-sasl-password "<password>" --kafka-tls-ca-file "/path/to/ca.pem"
126277
```
127278

128279
Skills policy defaults:
@@ -155,7 +306,7 @@ Direct config edits:
155306
./kafclaw config set model.name "anthropic/claude-sonnet-4-5"
156307
```
157308

158-
## 6. Group Collaboration Operations
309+
## 7. Group Collaboration Operations
159310

160311
```bash
161312
./kafclaw group join mygroup
@@ -178,6 +329,18 @@ Using onboarding profile:
178329
./kafclaw onboard --non-interactive --profile local-kafka --kafka-brokers "broker1:9092,broker2:9092" --group-name kafclaw --agent-id agent-ops --role worker --llm skip
179330
```
180331

332+
Using onboarding profile with broker security:
333+
334+
```bash
335+
./kafclaw onboard --non-interactive --profile local-kafka --llm skip \
336+
--kafka-brokers "broker1:9092,broker2:9092" \
337+
--kafka-security-protocol SASL_SSL \
338+
--kafka-sasl-mechanism SCRAM-SHA-512 \
339+
--kafka-sasl-username "<username>" \
340+
--kafka-sasl-password "<password>" \
341+
--kafka-tls-ca-file "/path/to/ca.pem"
342+
```
343+
181344
Using direct config commands:
182345

183346
```bash
@@ -188,6 +351,27 @@ Using direct config commands:
188351
./kafclaw config set group.agentId "agent-ops"
189352
```
190353

354+
Kafka security options are optional. Plaintext/non-mTLS installs continue to work by default.
355+
356+
Direct broker security (Confluent/Redpanda-style SASL/SSL):
357+
358+
```bash
359+
./kafclaw config set group.kafkaSecurityProtocol "SASL_SSL"
360+
./kafclaw config set group.kafkaSaslMechanism "PLAIN"
361+
./kafclaw config set group.kafkaSaslUsername "<username>"
362+
./kafclaw config set group.kafkaSaslPassword "<password>"
363+
./kafclaw config set group.kafkaTlsCAFile "/path/to/ca.pem"
364+
```
365+
366+
Mutual TLS (when required by cluster policy):
367+
368+
```bash
369+
./kafclaw config set group.kafkaSecurityProtocol "SSL"
370+
./kafclaw config set group.kafkaTlsCAFile "/path/to/ca.pem"
371+
./kafclaw config set group.kafkaTlsCertFile "/path/to/client-cert.pem"
372+
./kafclaw config set group.kafkaTlsKeyFile "/path/to/client-key.pem"
373+
```
374+
191375
Using KafScale proxy style settings:
192376

193377
```bash
@@ -203,7 +387,9 @@ Verification:
203387
./kafclaw kshark --auto --yes
204388
```
205389

206-
## 7. Kafka Diagnostics with KShark
390+
`kshark --auto` now reads the same group Kafka security settings used by runtime group consumers.
391+
392+
## 8. Kafka Diagnostics with KShark
207393

208394
Auto-config from current KafClaw group config:
209395

@@ -223,7 +409,7 @@ Useful options:
223409
- `--diag` include traceroute/MTU diagnostics
224410
- `--preset` for predefined connection templates
225411

226-
## 8. Channel Auth and Pairing
412+
## 9. Channel Auth and Pairing
227413

228414
### Pairing queue (Slack/Teams)
229415

@@ -242,7 +428,7 @@ Useful options:
242428
./kafclaw whatsapp-auth --deny "+123456789@s.whatsapp.net"
243429
```
244430

245-
## 9. Channel Bridge (`cmd/channelbridge`)
431+
## 10. Channel Bridge (`cmd/channelbridge`)
246432

247433
Build and run:
248434

docs/operations-admin/operations-guide.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ WhatsApp/CLI/Web/Scheduler --> Message Bus --> Agent Loop --> LLM Provider
8383
| `make build` | Build the `kafclaw` binary |
8484
| `make run` | Build and run the gateway |
8585
| `make rerun` | Kill ports 18790/18791, rebuild, run |
86-
| `make install` | Install via `kafclaw install` |
86+
| `make install` | Install local binary via `kafclaw install` |
8787
| `make test` | `go test ./...` |
8888
| `make test-smoke` | Fast critical-path smoke tests |
8989
| `make test-critical` | Enforce 100% critical logic coverage |
@@ -144,9 +144,11 @@ Container mounts:
144144
### System Install
145145

146146
```bash
147-
kafclaw install # copies to /usr/local/bin
147+
kafclaw install # root: /usr/local/bin, non-root: ~/.local/bin
148148
```
149149

150+
For release-binary install flows (`--latest`, `--version`, `--list-releases`, unattended, signature verification), see [KafClaw Management Guide](../operations-admin/manage-kafclaw/).
151+
150152
### Deployment Modes
151153

152154
| Mode | Command | Bind Address | Auth Required | Description |

docs/reference/cli-reference.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,33 @@ Primary command groups:
1010
- `kafclaw gateway` - start API + dashboard + runtime services
1111
- `kafclaw status` - runtime/config health snapshot
1212
- `kafclaw doctor` - diagnostics and setup checks
13+
- `kafclaw security` - security checks, deep audit, and safe remediation (`check|audit|fix`)
1314
- `kafclaw config` / `kafclaw configure` - low-level and guided config changes
1415
- `kafclaw agent -m` - one-shot interaction
16+
- `kafclaw skills` - bundled/external skill lifecycle and auth/prereq flows (`enable|disable|list|status|enable-skill|disable-skill|verify|install|update|exec|prereq|auth`)
17+
- `kafclaw install` - install local built binary (`/usr/local/bin` root, `~/.local/bin` non-root)
18+
- `kafclaw update` - update lifecycle (`plan`, `apply`, `backup`, `rollback`)
19+
- `kafclaw daemon` - system service lifecycle (`install`, `uninstall`, `start`, `stop`, `restart`, `status`)
20+
- `kafclaw completion` - generate shell completion scripts
1521
- `kafclaw whatsapp-setup` / `kafclaw whatsapp-auth` - WhatsApp setup and auth controls
1622
- `kafclaw pairing` - Slack/Teams pairing approvals
1723
- `kafclaw group` - group collaboration controls
1824
- `kafclaw kshark` - Kafka diagnostics
25+
- `kafclaw version` - print build version
26+
27+
Automation-friendly lifecycle output:
28+
- `kafclaw onboard --json`
29+
- `kafclaw install --json`
30+
- `kafclaw configure --json`
31+
- `kafclaw doctor --json`
32+
- `kafclaw security <check|audit|fix> --json`
33+
- `kafclaw update <plan|backup|apply|rollback> --json`
34+
- `kafclaw daemon <install|uninstall|start|stop|restart|status> --json`
1935

2036
Detailed command examples:
2137
- [Getting Started](../start-here/getting-started/)
2238
- [User Manual - CLI Reference section](../start-here/user-manual/#3-cli-reference)
2339
- [Manage KafClaw](../operations-admin/manage-kafclaw/)
40+
41+
Skills execution example:
42+
- `kafclaw skills exec <skill-id> --input '{"text":"..."}'`

docs/reference/config-keys.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,14 @@ kafclaw doctor
7171
- `KAFCLAW_GATEWAY_HOST`
7272
- `KAFCLAW_GATEWAY_PORT`
7373
- `KAFCLAW_GATEWAY_AUTH_TOKEN`
74+
- `KAFCLAW_GROUP_KAFKA_BROKERS`
75+
- `KAFCLAW_GROUP_KAFKA_SECURITY_PROTOCOL` (`PLAINTEXT`, `SSL`, `SASL_PLAINTEXT`, `SASL_SSL`)
76+
- `KAFCLAW_GROUP_KAFKA_SASL_MECHANISM` (`PLAIN`, `SCRAM-SHA-256`, `SCRAM-SHA-512`)
77+
- `KAFCLAW_GROUP_KAFKA_SASL_USERNAME`
78+
- `KAFCLAW_GROUP_KAFKA_SASL_PASSWORD`
79+
- `KAFCLAW_GROUP_KAFKA_TLS_CA_FILE`
80+
- `KAFCLAW_GROUP_KAFKA_TLS_CERT_FILE`
81+
- `KAFCLAW_GROUP_KAFKA_TLS_KEY_FILE`
7482

7583
## Related Docs
7684

docs/skills/channel-onboarding.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
2-
title: channel-onboarding
2+
title: Channel Onboarding
33
parent: Skills
44
nav_order: 1
55
---
66

7-
# channel-onboarding
7+
# Channel Onboarding
88

99
Guides setup and verification for Slack, Teams, and WhatsApp channel integrations.
1010

0 commit comments

Comments
 (0)