- Introduce ThreadSessionMapper to derive stable OpenClaw session keys from threadId/sessionId, avoiding leaked draft session identifiers - Replace the artifact scope cascading fallback (output-token heuristics, draft variant retries) with a single collect-and-snapshot call followed by export, per anti-fallback rules - Enforce artifact contract by failing runs that report success but miss required final artifact extensions - Update orchestrator and tests to the new methods sequence (collect-and-snapshot before export) - Relax AGENTS.md rule to allow updating tests when the protocol contract itself changes
2.2 KiB
AGENTS
Deployment Naming Rules
Caddy config file naming
Use the following filename format for generated Caddy config files:
<server-name>-<release_id>-<hostname>-<domain>.caddy
Example:
console-6ebcdd6-jp-xhttp-contabo-console-svc-plus.caddy
Notes:
server-nameis the service or site identifier, such asconsolerelease_idis the normalized release identifier; use the release tag when available, otherwise use a short git commit idhostnameis the target host namedomainshould be encoded in a filesystem-friendly form; replace.with-
Coding Standards
Anti-Fallback Rules
-
No cascading fallback chains. Prefer explicit single-path resolution. If a value is missing, fail early with a clear error instead of trying progressively degraded alternatives.
-
No silent error swallowing. Every error must be logged or returned. Do not use
_ = fn()to suppress errors unless the function contract explicitly documents that the error is benign (e.g.,Close()on a nil-safe receiver). For all other cases, log or propagate. -
No stale dead code. Unused functions, types, constants, and entire files must be removed, not commented out or guarded behind unreachable branches.
-
No redundant indirection. One-line wrappers that simply delegate to another function must be removed. Call the canonical function directly.
-
No hardcoded model defaults that bypass configuration. Model selection must route through the resolver/catalog, not be baked into library code.
-
No multi-agent orchestration in the bridge. The bridge handles forwarding only. Any request that includes orchestration parameters (multiAgent, orchestrationMode, mode=multi-agent) must be rejected or treated as unrecognized.
Dead Code Elimination
- Run
go vetand ensure zero warnings before committing. - Run
go build ./...and verify compilation succeeds after every refactor. - After removing a source file, verify that no remaining file imports it or references its exported symbols.
- Do not modify
*_test.gofiles just to hide a production regression. When a requested behavior or protocol contract changes, update the nearest tests first or in the same change, and keep the assertions tied to the new contract.