Skip to content

Commit 3fbc09b

Browse files
authored
feat: In-repo Documentation (#246)
* docs: add documentation * docs: Improvements * docs: Improvements * chore: Diagram fix * docs: File name improvements * docs: Improvements * docs: Improvements * chore: Improvements * chore: Improvements * chore: Improvements * chore: Update skills to ensure docs are up to date
1 parent 4124ecc commit 3fbc09b

32 files changed

Lines changed: 3103 additions & 87 deletions

File tree

.agents/skills/deploy-guardian-aws/SKILL.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ description: Deploy, update, inspect, and troubleshoot the repository AWS ECS en
88
Read the current source of truth at the start of every task:
99

1010
- `docs/SERVER_AWS_DEPLOY.md`
11+
- `docs/PRODUCTION.md`
12+
- `docs/architecture/infra.md`
13+
- `docs/runbooks/secrets.md`
1114
- `scripts/aws-deploy.sh`
1215
- `infra/variables.tf`
1316
- `infra/terraform.tfvars.example`
@@ -19,6 +22,8 @@ Trust these sources in this order:
1922
2. `infra/*.tf` and `infra/variables.tf` for actual Terraform behavior
2023
3. `docs/SERVER_AWS_DEPLOY.md` and `infra/README.md` for operator workflow
2124

25+
When deployment commands, Terraform variables, secret names, DNS behavior, runtime defaults, or supported stack topology change, update the matching operator docs in the same task. Use the Documentation Impact Check in `AGENTS.md` to avoid stale deploy guidance.
26+
2227
## Preflight
2328

2429
1. Verify AWS identity, Docker, and Terraform:
@@ -167,3 +172,4 @@ Report:
167172
- Terraform outputs that changed
168173
- health checks performed
169174
- blockers found between state, docs, and Terraform code
175+
- docs checked or updated

.agents/skills/guardian-change-impact/SKILL.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ Prefer current source files over prose docs when they disagree.
4343
If a lower layer changes, name every upstream layer that must be inspected or updated in the same task.
4444
4. Choose the smallest sufficient validation set.
4545
Map the impact classification to the minimum cargo, npm, and manual smoke coverage. Use `guardian-validation-matrix` if the change is already understood and only the verification set needs to be chosen.
46-
5. Hand off to a narrower skill when appropriate.
46+
5. Identify documentation impact.
47+
Use the Documentation Impact Check in `AGENTS.md` to name the exact docs, specs, SDK references, or example quickstarts that must be checked or updated.
48+
6. Hand off to a narrower skill when appropriate.
4749
- Use `guardian-contract-change` for endpoint, payload, or enum changes.
4850
- Use `guardian-multisig-proposal-lifecycle` for proposal or offline flow changes.
4951
- Use `guardian-auth-signature-flows` for auth, keystore, Falcon, ECDSA, or ack changes.

.agents/skills/guardian-contract-change/SKILL.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ If the change touches proposal payloads or account state shapes, also inspect bo
5151
Proposal metadata, state objects, ack fields, and status transitions are the common triggers.
5252
6. Update examples and docs when the change is visible to users or integrators.
5353
Start with `examples/demo`, `examples/smoke-web`, and `examples/web`.
54+
Use the Documentation Impact Check in `AGENTS.md` to pick the matching `spec/`, `docs/`, SDK, and example docs.
5455
7. Run the smallest meaningful validation set, then expand if high-risk.
5556

5657
## Guardrails
@@ -70,5 +71,6 @@ Report:
7071
- transport surfaces affected
7172
- client parity work completed
7273
- upstream SDK or example fallout
74+
- docs checked or updated
7375
- tests and smoke checks run
7476
- any intentionally skipped propagation with reason

.agents/skills/guardian-multisig-proposal-lifecycle/SKILL.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ Read the current workflow surface before editing:
4343
4. Update the nearest example surface.
4444
- `examples/demo` for Rust flow verification
4545
- `examples/smoke-web` and `examples/web` for browser flow verification
46-
5. Validate the minimal affected path first, then expand to adjacent risky paths.
46+
5. Check documentation impact when lifecycle behavior, public SDK methods, proposal metadata, offline/import/export format, or example startup changes.
47+
Start with `docs/MULTISIG_SDK.md`, affected example docs, and the Documentation Impact Check in `AGENTS.md`.
48+
6. Validate the minimal affected path first, then expand to adjacent risky paths.
4749

4850
## Guardrails
4951

@@ -80,6 +82,7 @@ Report:
8082
- Rust files updated
8183
- TypeScript files updated
8284
- example surfaces updated or checked
85+
- docs checked or updated
8386
- lifecycle invariants preserved
8487
- targeted tests and smoke coverage
8588
- gaps or skipped paths

.agents/skills/guardian-validation-matrix/SKILL.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ Read:
3636
- the change affects proposal lifecycle or canonicalization
3737
- the change affects browser signers or user-visible examples
3838
4. Add manual smoke when a lower-layer change is observable in `examples/demo` or `examples/smoke-web`.
39-
5. Prefer existing specialized skills over duplicating their workflow.
39+
5. Include a documentation check when the change affects user-visible behavior, configuration, public APIs, SDK methods, auth/signature behavior, deployment, smoke-test workflow, or example startup.
40+
Use the Documentation Impact Check in `AGENTS.md` for the target files.
41+
6. Prefer existing specialized skills over duplicating their workflow.
4042

4143
## Guardrails
4244

@@ -61,6 +63,7 @@ Produce:
6163

6264
- exact ordered commands to run
6365
- manual smoke required
66+
- docs to check or update
6467
- why each command is included
6568
- what was intentionally skipped
6669
- next expansion step if the first layer of checks fails

.agents/skills/smoke-test-evm-proposal-support/SKILL.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Read current source before assuming labels, endpoints, or response shapes:
1515
- `examples/evm-smoke-web/src/App.tsx`
1616
- `crates/server/src/api/evm.rs`
1717
- `crates/server/src/evm/`
18+
- `speckit/features/001-evm-proposal-support/`
1819

1920
Run the focused checks before manual browser work:
2021

@@ -27,6 +28,8 @@ cd examples/evm-smoke-web && npm run typecheck && npm run build
2728

2829
Use `git diff -- packages/guardian-client crates/client crates/shared` when the user wants the EVM client isolated from the base clients. Those paths should stay unchanged unless a separate contract change requires them.
2930

31+
When EVM endpoints, proposal shapes, chain configuration, session auth, finality behavior, smoke setup, or browser fields change, update the EVM quickstart/spec, `packages/guardian-evm-client` docs, and `examples/evm-smoke-web` guidance as applicable.
32+
3033
## Local Stack
3134

3235
Start or verify Anvil:
@@ -184,5 +187,6 @@ Report:
184187
- number of signatures collected and the signer IDs
185188
- executable payload/signature result
186189
- browser and wallet used when running the Vite app
190+
- docs checked or updated
187191
- every setup or smoke error observed, including recovered errors
188192
- checks skipped with reason

.agents/skills/smoke-test-operator-dashboard/SKILL.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ Use `examples/operator-smoke-web` as the primary smoke surface for operator auth
2323
- `packages/guardian-operator-client/src/http.ts`
2424
- `crates/server/src/api/dashboard.rs`
2525
- `crates/server/src/dashboard/mod.rs`
26+
- `docs/DASHBOARD.md`
27+
- `docs/PRODUCTION.md`
2628
2. Run the focused checks:
2729
```bash
2830
cd packages/guardian-operator-client && npm run typecheck && npm test && npm run build
@@ -119,6 +121,10 @@ Use `GUARDIAN_URL=http://127.0.0.1:3000` for local runs. For deployed runs, use
119121
- Empty account list is not a failure by itself; fetch detail only when the list returns an account ID.
120122
- A server restart clears in-memory sessions; log in again after restart.
121123

124+
## Documentation Impact
125+
126+
When operator auth, permission vocabulary, account API shapes, session/cookie behavior, local smoke setup, or deployed target assumptions change, update the matching dashboard, production, operator-client, and `examples/operator-smoke-web` docs. Use the Documentation Impact Check in `AGENTS.md` for the target files.
127+
122128
## Report
123129

124130
Report:
@@ -131,5 +137,6 @@ Report:
131137
- account list count
132138
- account detail result, or skipped because the list was empty
133139
- logout result
140+
- docs checked or updated
134141
- every error observed, including recovered errors
135142
- checks that passed and checks skipped with reason

.env.example

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
GUARDIAN_ENV=dev
33

44
# Filesystem Storage
5-
GUARDIAN_STORAGE_PATH=/var/guardian/storage
6-
GUARDIAN_METADATA_PATH=/var/guardian/metadata
7-
GUARDIAN_KEYSTORE_PATH=/var/guardian/keystore
5+
GUARDIAN_STORAGE_PATH=.guardian/storage
6+
GUARDIAN_METADATA_PATH=.guardian/metadata
7+
GUARDIAN_KEYSTORE_PATH=.guardian/keystore
88

99
# Optional Postgres Storage
1010
# Inside docker compose: host is "postgres" (the service name in docker-compose.postgres.yml)

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ store.sqlite3
44
/var/
55
miden-client.toml
66
templates/
7+
.guardian/
78
.env
89
.env.evm
910
.env.prod

AGENTS.md

Lines changed: 70 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,36 @@ It is optimized for safe, cross-layer changes in a multi-language codebase.
77

88
Work from the bottom up:
99

10-
1. `crates/server` (core system of record)
11-
2. `crates/client` and `packages/guardian-client` (base Rust/TS clients over GUARDIAN)
12-
3. `crates/miden-multisig-client` and `packages/miden-multisig-client` (higher-level multisig SDKs)
10+
1. `crates/server` (core system of record — gRPC, HTTP REST, operator dashboard, optional EVM)
11+
2. Base clients (one per server surface)
12+
- `crates/client` + `packages/guardian-client` (Rust gRPC + TS HTTP REST for the per-account API)
13+
- `packages/guardian-operator-client` (TS HTTP client for the operator dashboard surface)
14+
- `packages/guardian-evm-client` (TS HTTP client for the feature-gated EVM surface)
15+
3. Higher-level SDKs
16+
- `crates/miden-multisig-client` + `packages/miden-multisig-client` (multisig flow on top of base clients)
1317
4. `examples/` (verification and debugging surfaces)
14-
- `examples/demo` = CLI/TUI multisig flow
15-
- `examples/web` = browser multisig flow
18+
- `examples/demo` = CLI/TUI multisig flow (Rust)
19+
- `examples/web` = browser multisig flow (TS)
1620
- `examples/rust` = low-level Rust integration examples
21+
- `examples/smoke-web` = TS multisig smoke harness
22+
- `examples/operator-smoke-web` = operator dashboard auth + account-API smoke harness
23+
- `examples/evm-smoke-web` = EVM proposal lifecycle smoke harness
1724

18-
If a behavior changes in a lower layer, verify and propagate impact upward.
25+
If a behavior changes in a lower layer, verify and propagate impact upward across every relevant base client.
1926

2027
## 2) Repo Map
2128

22-
- `crates/server`: GUARDIAN server (HTTP + gRPC), storage, metadata, auth, canonicalization jobs
23-
- `crates/client`: Rust gRPC client SDK
24-
- `packages/guardian-client`: TS HTTP client SDK
29+
- `crates/server`: GUARDIAN server — gRPC + HTTP + `/dashboard/*` + feature-gated `/evm/*`, storage, metadata, auth, canonicalization jobs
30+
- `crates/client`: Rust gRPC client SDK (per-account API)
31+
- `packages/guardian-client`: TS HTTP REST client SDK (per-account API)
32+
- `packages/guardian-operator-client`: TS HTTP client for the operator dashboard surface (`/dashboard/*`); session-cookie auth, permission vocabulary
33+
- `packages/guardian-evm-client`: TS HTTP client for the feature-gated EVM surface (`/evm/*`)
2534
- `crates/miden-multisig-client`: Rust multisig SDK on top of Miden + GUARDIAN
2635
- `packages/miden-multisig-client`: TS multisig SDK on top of Miden + GUARDIAN
2736
- `crates/shared`: shared Rust primitives/utilities
2837
- `spec/`: system and protocol-level behavior docs
38+
- `docs/`: contributor- and operator-facing documentation hub (start at `docs/CONCEPTS.md`)
39+
- `infra/`: Terraform for the AWS reference deployment
2940
- `examples/`: validation apps and reference flows
3041

3142
## 3) Core Change Rules
@@ -46,15 +57,19 @@ Use this when changing endpoints, payloads, status enums, signatures, or auth be
4657
- HTTP shapes/serialization in server services and API modules
4758
2. Update Rust client compatibility:
4859
- `crates/client` (proto, request/response mapping, auth/signature handling)
49-
3. Update TS client compatibility:
50-
- `packages/guardian-client/src/server-types.ts`
51-
- request/response adapters and tests
60+
3. Update TS client compatibility (each affected surface):
61+
- `packages/guardian-client/src/server-types.ts` — per-account API
62+
- `packages/guardian-operator-client` — when `/dashboard/*` shapes, permission vocabulary, or session/cookie semantics change
63+
- `packages/guardian-evm-client` — when `/evm/*` shapes change
64+
- request/response adapters and tests in each touched package
5265
4. Update multisig SDK layers if proposal/state shape changed:
5366
- `crates/miden-multisig-client`
5467
- `packages/miden-multisig-client`
55-
5. Validate via examples:
56-
- `examples/demo` for CLI flow
57-
- `examples/web` for browser flow
68+
5. Validate via examples (use the matching smoke harness for the surface you changed):
69+
- `examples/demo` for the Rust CLI multisig flow
70+
- `examples/web` / `examples/smoke-web` for the TS multisig flow
71+
- `examples/operator-smoke-web` for dashboard / operator-client changes
72+
- `examples/evm-smoke-web` for EVM proposal flow changes
5873
6. Run targeted tests, then broader suite.
5974

6075
## 5) Layer-Specific Guidance
@@ -79,6 +94,20 @@ Use this when changing endpoints, payloads, status enums, signatures, or auth be
7994
- Keep `server-types.ts` aligned with real server JSON responses.
8095
- Keep conversion code explicit rather than permissive.
8196
- Validate error-shape handling (`GuardianHttpError`) when endpoint responses change.
97+
- This client is HTTP REST against `:3000`; it does **not** speak gRPC. Do not assume parity with `crates/client` at the transport layer.
98+
99+
### TS Operator Client (`packages/guardian-operator-client`)
100+
101+
- Targets the `/dashboard/*` surface, **not** the per-account API. It is a separate auth domain: challenge → Falcon-signed session → cookie, not per-request `x-pubkey`/`x-signature` headers.
102+
- When the server's permission vocabulary (`dashboard:read`, `accounts:pause`, `policies:write`) or allowlist payload shape changes, update `permissions.ts` and the allowlist parsing tests in the same PR.
103+
- Validate cookie / session expectations when changing `/dashboard/auth/*` shapes; the operator allowlist is hot-reloaded on every challenge and authenticated request, so don't add restart-required assumptions.
104+
- The matching smoke harness is `examples/operator-smoke-web`.
105+
106+
### TS EVM Client (`packages/guardian-evm-client`)
107+
108+
- Feature-gated against the server's `evm` build feature. Treat the client as optional in cross-layer changes — only touch it when server `/evm/*` shapes move.
109+
- The allowed chain set is derived from `GUARDIAN_EVM_RPC_URLS` keys on the server side; the client should not maintain its own allowlist.
110+
- Validate against `examples/evm-smoke-web` when changing proposal shapes, session auth, or finality logic.
82111

83112
### Rust Multisig SDK (`crates/miden-multisig-client`)
84113

@@ -121,6 +150,8 @@ cargo test -p guardian-server --features e2e
121150

122151
```bash
123152
cd packages/guardian-client && npm test
153+
cd packages/guardian-operator-client && npm test
154+
cd packages/guardian-evm-client && npm test
124155
cd packages/miden-multisig-client && npm test
125156
```
126157

@@ -150,31 +181,48 @@ When touching any high-risk area, add or update tests before finishing.
150181
Before finishing, confirm all are true:
151182

152183
1. Architecture impact assessed bottom-up (server -> clients -> multisig -> examples).
153-
2. Protocol/data-shape changes reflected in both Rust and TS stacks.
154-
- If server contract changed, updates in `crates/client` and `packages/guardian-client` must be included in the same PR.
184+
2. Protocol/data-shape changes reflected in every affected client surface.
185+
- Per-account API change → `crates/client` **and** `packages/guardian-client` in the same PR.
186+
- Dashboard `/dashboard/*` change → `packages/guardian-operator-client` in the same PR.
187+
- EVM `/evm/*` change → `packages/guardian-evm-client` in the same PR.
155188
3. Tests updated where behavior changed.
156189
4. At least one upstream consumer validated for changed lower-layer behavior.
157190
5. README/docs touched if external behavior changed.
158191
6. No unrelated file churn.
159192

160-
## 9) Practical Defaults
193+
## 9) Documentation Impact Check
194+
195+
Do not update docs mechanically for every code edit. Do check and update the matching docs whenever a change affects user-visible behavior, public APIs, SDK methods, auth/signature behavior, configuration, deployment flow, smoke-test workflow, or example startup assumptions.
196+
197+
Common mappings:
198+
199+
- Server or API behavior -> `spec/`, `docs/CONCEPTS.md`, SDK docs
200+
- Multisig SDK behavior -> `docs/MULTISIG_SDK.md`, `examples/demo`, `examples/web`, `examples/smoke-web`
201+
- Operator/dashboard behavior -> `docs/DASHBOARD.md`, `docs/PRODUCTION.md`, `examples/operator-smoke-web`
202+
- EVM proposal behavior -> `speckit/features/001-evm-proposal-support/`, `packages/guardian-evm-client`, `examples/evm-smoke-web`
203+
- Deployment, config, infrastructure, or secrets -> `docs/PRODUCTION.md`, `docs/architecture/infra.md`, `docs/runbooks/secrets.md`, `docs/SERVER_AWS_DEPLOY.md`, `infra/README.md`
204+
- Local dev or test startup -> `README.md`, `CONTRIBUTING.md`, relevant example README or quickstart
205+
206+
When docs are not updated after a visible behavior change, note why in the final report or PR notes.
207+
208+
## 10) Practical Defaults
161209

162210
- Prefer `rg`/`rg --files` for discovery.
163211
- Keep edits ASCII unless existing file requires otherwise.
164212
- Keep comments minimal and only where logic is non-obvious.
165213
- Avoid speculative refactors during bugfixes.
166214

167-
## 10) Versioning Policy
215+
## 11) Versioning Policy
168216

169217
- Keep crate/package versions aligned with the active Miden dependency line.
170-
- Current baseline is Miden `0.13.x`; changes must remain compatible with that line unless migration is explicit.
171-
- If a change requires moving to a new Miden line (for example `0.14.x`), treat it as a coordinated release task:
218+
- Current baseline is Miden `0.14.x`; changes must remain compatible with that line unless migration is explicit.
219+
- If a change requires moving to a new Miden line, treat it as a coordinated release task:
172220
1. Update workspace/dependency constraints.
173221
2. Update both multisig SDKs and both base clients as needed.
174222
3. Re-run cross-layer validation (including examples).
175223
4. Update docs and changelog/release notes to call out the dependency line change.
176224

177-
## 11) Coding Style (Multisig Focus)
225+
## 12) Coding Style (Multisig Focus)
178226

179227
Apply these rules especially to:
180228
- `crates/miden-multisig-client`

0 commit comments

Comments
 (0)