You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 3899682
Browse filesBrowse the repository at this point in the historyBrowse files
docs(generate-user-docs): add hub-and-spokes deployment structure and ops-pattern import
Restructure skill to produce guides/deploying/ as a hub plus six spokes
(local-development, single-server, public-access, upgrading,
backup-and-restore, monitoring) instead of one flat deploy guide.
Add an "operational guide" template (When to Run → Pre-flight →
Procedure → Verify → Rollback) for procedural docs that don't fit the
feature-shaped dual-audience template, plus verbatim-reuse snippets for
the load-bearing rules: never down/up, rebuild platform services only,
six-probe verification, resource-thresholds table, alpine cp backup.
Add Step 2h to draw operational patterns from the private ops runbook
under ../trinity-ops/, with explicit safe/forbidden import lists and a
sshpass→localhost rewrite rule.
Strengthen Step 2e to cross-check .env.example keys against each
compose's environment block — docs must not promise behavior the
chosen compose can't deliver.
Add public-safety greps in Step 7 (sshpass, trinity-ops, tailnet, real
IPs, instance-dir refs) so leaked private detail blocks completion.
Tracks issue #504.
| Trinity Docs site |`../trinity-docs/app/getting-started/*.tsx`| Yes | No |
35
35
| Abilities repo |`github.com/abilityai/abilities` (README) | Yes | No |
36
+
| Ops runbook (private, pattern source for ops content) |`../trinity-ops/playbooks/*.md`, `../trinity-ops/instances/_template/scripts/*.sh`, `../trinity-ops/instances/_template/CLAUDE.md`| Yes | No |
36
37
| Git history |`git log --since`| Yes | No |
37
38
| Existing user docs |`docs/user-docs/**/*.md`| Yes | Yes |
38
39
@@ -47,19 +48,34 @@ These tutorial-style guides walk users through end-to-end tasks. Keep them in sy
47
48
48
49
| Guide | Source | Purpose |
49
50
|-------|--------|---------|
50
-
|`guides/deploying-trinity.md`|`trinity-docs/app/getting-started/deploying-trinity/page.tsx`| Cloud vs self-hosted setup |
51
+
|`guides/deploying-trinity.md`|`trinity-docs/app/getting-started/deploying-trinity/page.tsx` + this skill's deploy hub rules | Hub: cloud vs self-hosted decision, prerequisites, links into spokes |
52
+
|`guides/deploying/local-development.md`|`docker-compose.yml`, `scripts/deploy/start.sh`, `.env.example`| Docker Desktop, dev compose, hot reload, base image build |
|`guides/building-agents.md`|`trinity-docs/app/getting-started/building-agents/page.tsx`| Create, develop, deploy with abilities |
53
60
54
61
**Sync rule**: When the trinity-docs source changes, update the corresponding guide to match. Convert TSX to markdown, preserving structure and content. **Code wins on conflict** — if trinity-docs disagrees with `.env.example`, `scripts/deploy/*.sh`, or `docker-compose.yml`, fix the local guide to match observed repo behavior and note the divergence for upstream.
55
62
63
+
**Ops-runbook rule**: Pages under `guides/deploying/` (especially `upgrading.md`, `backup-and-restore.md`, `monitoring.md`) draw their *patterns* from the private ops runbook at `../trinity-ops/`. Treat that as a pattern library, not a paste source. See Step 2h for what's safe to import vs. what must stay private.
64
+
56
65
## Target Structure
57
66
58
67
```
59
68
docs/user-docs/
60
69
├── README.md # Index + navigation
61
70
├── guides/ # Tutorial-style walkthroughs
62
-
│ ├── deploying-trinity.md # Cloud vs self-hosted setup
71
+
│ ├── deploying-trinity.md # Hub: cloud vs self-hosted decision, links into spokes
This identifies what has changed recently and which docs may need updating.
142
158
143
-
**2e. Deployment config (for deploying/setup guides)** — Read `.env.example`, `scripts/deploy/start.sh`, `scripts/deploy/stop.sh`, and`docker-compose.yml`. Extract: required env vars, auto-generated vs user-set secrets, default ports and override vars (e.g., `FRONTEND_PORT`), first-boot behavior, and what the start/stop scripts actually print and do. This is the authoritative source for deploy/setup docs.
159
+
**2e. Deployment config (for deploying/setup guides)** — Read `.env.example`, `scripts/deploy/start.sh`, `scripts/deploy/stop.sh`, `scripts/deploy/build-base-image.sh`,`docker-compose.yml`, `docker-compose.prod.yml`, `docker-compose.gitea.yml`, and `deploy.config.example`. Extract: required env vars, auto-generated vs user-set secrets, default ports and override vars (e.g., `FRONTEND_PORT`), first-boot behavior, and what the start/stop scripts actually print and do. **Cross-check `.env.example` keys against the `environment:` blocks in each compose file** — flag any key present in `.env.example` but not forwarded by a given compose as "prod-only / overlay-only / requires compose edit," because docs should not promise behavior the chosen compose can't deliver. This is the authoritative source for deploy/setup docs.
144
160
145
161
**2f. Backend routers** — Glob `src/backend/routers/*.py` and read router files relevant to the section being written. Extract:
146
162
- Endpoint paths and HTTP methods
@@ -152,6 +168,29 @@ This identifies what has changed recently and which docs may need updating.
152
168
- User-facing labels and actions
153
169
- State management patterns
154
170
171
+
**2h. Ops-runbook patterns (for `guides/deploying/upgrading.md`, `backup-and-restore.md`, `monitoring.md`)** — Read `../trinity-ops/playbooks/upgrade-instance.md`, `../trinity-ops/playbooks/monitoring-instance.md`, `../trinity-ops/instances/_template/CLAUDE.md`, and the helper scripts in `../trinity-ops/instances/_template/scripts/` (`update.sh`, `health-check.sh`, `restart.sh`, `status.sh`). Treat as a **pattern library**, not a paste source.
172
+
173
+
**Safe to import (the rules and shapes that make production work):**
174
+
- The "use `docker compose restart`, never `down/up`" rule and *why* (preserves agent containers and `trinity-agent-network`).
175
+
- The "rebuild only platform services, not the base image" rule (`docker compose build --no-cache backend frontend mcp-server scheduler`).
- The daily-DB-backup + 14-day-retention cron template.
183
+
184
+
**Forbidden to import (private detail; would leak in a public repo):**
185
+
- Any host name, IP address, Tailscale identity, or tailnet name.
186
+
- Any `sshpass`, `ssh -i`, or `ssh user@host`-prefixed command — local-host examples only.
187
+
- Any reference to specific instance directories (`instances/dgx/` etc.) or instance-specific scripts.
188
+
- Any password, token, or API-key value (even masked) from ops `.env` files.
189
+
- The phrase "trinity-ops" itself, or any path that reveals the private repo's structure.
190
+
- Multi-instance management workflows (`source .env && ./scripts/run.sh ...`) — that's an operator-fleet pattern, not a single-instance user pattern.
191
+
192
+
When in doubt, rewrite the *idea* in localhost form. A production-ops `sshpass -p $PW ssh user@host "sudo docker logs trinity-backend"` becomes the public `docker logs trinity-backend`. The rule survives; the access pattern stays private.
193
+
155
194
### Step 3: Generate/Update Documentation
156
195
157
196
For each section in the target structure, produce or update the markdown file following these rules:
@@ -208,6 +247,137 @@ Only include if meaningful.]
208
247
209
248
Use judgment: if the same content keeps needing to sit awkwardly inside "How It Works" or "Limitations," promote it to its own `##` section.
210
249
250
+
#### Operational guide template (use for `guides/deploying/upgrading.md`, `backup-and-restore.md`, `monitoring.md`)
251
+
252
+
The dual-audience template above is for *features*. Operational guides are *procedures with checkpoints* — different shape. Use this instead:
253
+
254
+
```markdown
255
+
# [Procedure Name]
256
+
257
+
[1-2 sentence summary: what this procedure achieves and when an operator runs it.]
258
+
259
+
## When to Run This
260
+
261
+
[Trigger conditions. E.g. "Before every Trinity update," "Daily as a cron job,"
262
+
"When the dashboard sync-health dot goes red." Concrete, not aspirational.]
263
+
264
+
## Pre-flight
265
+
266
+
-[ ][Check 1 — e.g., backup target has space]
267
+
-[ ][Check 2 — e.g., no scheduled tasks running in the next N minutes]
268
+
-[ ][Check 3 — e.g., on the right branch / version]
269
+
270
+
## Procedure
271
+
272
+
### Step 1: [name]
273
+
274
+
[What and why. Then the command in a code block. Then "expected output: ..."]
275
+
276
+
### Step 2: [name]
277
+
...
278
+
279
+
## Verify
280
+
281
+
After the procedure, confirm each of these returns the expected result. If any
282
+
fails, do NOT proceed — go to **Rollback** or **Recovery** below.
[For procedures with destructive or risky steps, include the inverse procedure.
292
+
For monitoring guides, include common-issue resolution table instead.]
293
+
294
+
## Automation
295
+
296
+
[Optional: cron template, CI hook, or scheduling guidance if the procedure is
297
+
intended to run regularly.]
298
+
299
+
## See Also
300
+
```
301
+
302
+
**Why this shape:** operators care about (1) when to run, (2) safety pre-checks, (3) numbered steps, (4) explicit verification, (5) rollback. The feature template's "How It Works / For Agents / Limitations" doesn't map to any of those.
303
+
304
+
#### Reusable snippets for operational guides
305
+
306
+
The following are canonical snippets. Use verbatim across the deploy spokes so the same rule reads identically in every place. Do **not** paraphrase; consistency is the point.
307
+
308
+
**The "use restart, never down/up" rule:**
309
+
310
+
> **Use `docker compose restart`, not `down/up`.**`docker compose down` removes the `trinity-agent-network`, which orphans every running agent container — they keep running but lose their network and have to be removed and recreated. `restart` preserves both the agents and the network. The only times to use `down` are: (1) intentional full teardown, (2) recovering from a corrupted compose state.
311
+
312
+
**The "rebuild platform services only" rule:**
313
+
314
+
> When updating Trinity code, rebuild the platform images only:
> The `trinity-agent-base` image is **not** rebuilt by this command. It changes much less often, and rebuilding it forces every agent to be re-deployed. Rebuild it only when `docker/base-image/Dockerfile` itself changes, via `./scripts/deploy/build-base-image.sh`.
3.**No redundancy** — Do not repeat information from other docs. Cross-reference instead. The `Concepts` section in `getting-started/overview.md` is the canonical glossary; other docs reference it rather than re-defining terms.
212
382
213
383
4.**Code-derived accuracy** — Every claim must trace to code or a feature flow. Do not invent features. If a feature flow says "planned" or a router has TODO comments, note it as upcoming rather than documenting it as available.
@@ -263,25 +433,46 @@ Create directories and write all approved files:
Write each markdown file using the Write or Edit tool.
269
440
270
441
### Step 7: Verify
271
442
443
+
**Count files written:**
444
+
272
445
```bash
273
446
find docs/user-docs -name "*.md" -type f | wc -l
274
447
```
275
448
449
+
**Public-safety scan** — every page generated under `guides/deploying/` must pass these greps with zero hits. If any hit, the page is leaking ops-internal detail and must be rewritten:
450
+
451
+
```bash
452
+
# Tokens that indicate private-repo or operator-fleet patterns
Confirm the expected number of files were created/updated. Report the final count.
277
464
278
465
## Completion Checklist
279
466
280
-
-[ ] All sections in target structure have corresponding files
281
-
-[ ] Every doc follows the dual-audience template (How It Works + For Agents)
467
+
-[ ] All sections in target structure have corresponding files (including `guides/deploying/` spokes)
468
+
-[ ] Every feature doc follows the dual-audience template (How It Works + For Agents)
469
+
-[ ] Every operational doc under `guides/deploying/` follows the operational template (When to Run → Pre-flight → Procedure → Verify → Rollback)
282
470
-[ ] No redundant explanations across docs (MECE verified)
283
471
-[ ] All API references link to Swagger (`/docs`) rather than duplicating schemas
284
-
-[ ] No real credentials, internal URLs, or PII in any doc
472
+
-[ ] Every key in `.env.example` is annotated in the relevant deploy spoke as: dev-compose / prod-compose-only / overlay-only / requires-compose-edit (no key promised to work in a compose that doesn't forward it)
473
+
-[ ] Reusable snippets (the "use restart" rule, "rebuild platform services only" rule, six-probe verification, thresholds table, alpine `cp` backup pattern) are used verbatim, not paraphrased, across deploy spokes
474
+
-[ ] No real credentials, internal URLs, host IPs, or PII in any doc
475
+
-[ ] Public-safety greps from Step 7 return zero hits across `guides/deploying/`
285
476
-[ ] README.md index is complete and links are valid
0 commit comments