docs: replace alkvault scaffold with alkcall project conventions

- AGENTS.md: full rewrite for the call+channels RPC crate (async/tokio,
  vendored core types, alktype dep, producer/consumer framing, the two
  stable wire formats, no-env-vars invariant, OperationEnv trait, abort
  cascade, AccessControl peer auth, ADR index for both halves)
- implementation-specialist.md: replace vault crypto conventions (OsRng,
  zeroize, AES-GCM) with 15 alkcall protocol conventions matching AGENTS.md
- docs/sdd_process.md: fix alkvault -> alkcall reference

Verification: no code changed (docs-only)

commit 0a031cd..HEAD
This commit is contained in:
2026-08-12 05:47:59 +00:00
parent 0a031cd378
commit a779dd0d0d
3 changed files with 263 additions and 74 deletions

View File

@@ -209,28 +209,56 @@ This is especially important for complex tasks that span many file operations.
Read `AGENTS.md` at project root for full details. Key rules:
1. **No comments in code** — Per project convention.
2. **Error handling** — Use `anyhow::Result` for application code, `thiserror` for
library error types. Never panic in library code.
3. **No `unwrap()` or `expect()` outside tests** — These are debug signals that
something wasn't clear. If you reach for `unwrap()`, it means the error
handling path wasn't specified — stop and think about what should actually
happen on that error. For poisoned locks, use
`unwrap_or_else(|e| e.into_inner())` or explicit error propagation. A panic
in one operation must not cascade to other operations.
4. **Cryptographic nonces use `OsRng`** — AES-GCM IVs and any other cryptographic
nonces must use `OsRng` (or equivalent CSPRNG), never `rand::random()`. IV
reuse under the same key is catastrophic for GCM.
5. **Secret material is zeroized on drop** — Any type holding derived keys,
decrypted credentials, or other secret material must derive `Zeroize` and
`ZeroizeOnDrop`. Secrets must not linger in freed heap memory.
6. **Feature flags** — Transports are feature-gated (`tls`, `iroh`, `acme`). Base
crate should compile lean.
7. **Async runtime** — `tokio` is the async runtime. All I/O is async.
8. **Naming conventions** — Rust standard: `snake_case` for functions/variables/
modules, `PascalCase` for types/traits, `SCREAMING_SNAKE_CASE` for constants.
9. **Module structure** — One module per component under `src/`. Re-export via
`mod.rs` or `lib.rs` as appropriate.
1. **No comments in code** — Per project convention. Doc comments (`///`, `//!`)
are fine and expected on public API.
2. **Error handling** — `thiserror` for library error types. No panics in
library code. No `unwrap()` or `expect()` outside tests. For poisoned
`RwLock`/`Mutex`, use `unwrap_or_else(|e| e.into_inner())` so a panic in one
operation does not cascade to other operations.
3. **`tokio` is the async runtime** — all I/O is async. Use `tokio::sync`
primitives (`oneshot`, `mpsc`) for request correlation and subscription
channels; `parking_lot` for short-held internal locks (`PendingRequestMap`).
4. **No secret material on the wire** — `call.requested`/`call.responded`
payloads and `OperationContext.metadata` carry no private keys, API keys, or
decrypted credentials. Outbound credentials flow through `Capabilities`
injected at the assembly layer → `HandlerRegistration.capabilities` →
`OperationContext.capabilities` → handler.
5. **No-env-vars invariant** — no handler reads outbound credentials from any
source other than `OperationContext.capabilities`. This is a spec-level
invariant, not a runtime convention.
6. **`OperationEnv` must remain a trait** — the trait-based design enables
registry layering (session overlays, connection overlays, peer-keyed
composition). Do not make it concrete or hardcode the global registry.
7. **Wire formats are stable** — `EventEnvelope` (`{ type, id, payload }` +
length-prefixed JSON framing) and the channels 8-byte chunk header
(`[channel_id:u32 BE][length:u32 BE][payload]`) are one-way doors. New event
types may be added; existing shapes must not change.
8. **Producer/consumer, not server/client** — both sides of a call or channels
connection can initiate. Use "producer"/"consumer" or "accept side"/"connect
side," not "server"/"client."
9. **Vendored core types** — `Connection`, `ProtocolHandler`, `BiStream`,
`BidiStreamSource`, `AuthContext`, `IdentityProvider`, `Identity`,
`AuthToken`, `Capabilities`, `OwnershipProvider`, `HandlerError`,
`StreamError` live in this crate. Do not add a separate `alkcore` dependency.
Keep them lean (no TLS, no transport coupling, no endpoint/accept-loop).
10. **`alktype` dependency** — use `alktype` for binary layout (channels chunk
header, future binary payload schemas) and JSON payload schema validation
(`OperationSpec`'s `input_schema`/`output_schema`). Do not roll your own.
11. **Feature flags** — transports may be feature-gated if the need arises. The
base crate should compile lean (no `quinn`, no `iroh` unless the feature is
on). Verify both `cargo test` (default) and `cargo test --all-features` pass
if features are added.
12. **Abort cascades to descendants** — `call.aborted` for a parent cascades to
all non-terminal descendants. Default `abort-dependents`;
`continue-running` opt-in. The composing handler decides the child's policy,
not the wire caller.
13. **Peer authorization via `AccessControl`** — a remote peer's call is
authorized by `AccessControl::check(peer_identity)`. No `remote_safe` flag,
no `trusted_peer` bypass. `Visibility::Internal` ops are never wire-callable.
14. **Naming conventions** — Rust standard: `snake_case` for functions/variables/
modules, `PascalCase` for types/traits, `SCREAMING_SNAKE_CASE` for constants.
15. **Module structure** — one module per file under `src/`, re-exported from
`src/lib.rs`. Public API surface is `lib.rs` re-exports.
## Key Principles