Imported from wspulse/client-swift (
AGENTS.md). Install upstream withnpx skills add wspulse/client-swift. Copyright stays with the author.
AGENTS.md — wspulse/client-swift
This file is the entry point for all AI coding agents (GitHub Copilot, Codex,
Cursor, Claude, etc.). Full working rules are in
.github/copilot-instructions.md — read it completely before
making any changes.
Quick Reference
Package: WspulseClient (SPM) | Module: WspulseClient
Key files:
Sources/WspulseClient/WspulseClient.swift—public actor WspulseClient:connect(),send(),close(),done; internal read/write/reconnect/ping loop TasksSources/WspulseClient/WspulseClientOptions.swift—WspulseClientOptionsvalue type with all configurationSources/WspulseClient/Codec.swift—WspulseCodecprotocol,WireTypeenum,JSONCodecdefaultSources/WspulseClient/Message.swift—struct Message: Codable, SendableSources/WspulseClient/AnyJSON.swift— type-erasedCodableJSON valueSources/WspulseClient/Errors.swift—WspulseErrorenumSources/WspulseClient/Backoff.swift—backoff(attempt:base:max:)with equal jitterSources/WspulseClient/ConnectionActor.swift— internalactorwrappingURLSessionWebSocketTask
Pre-commit gate: make check (lint → test)
Non-negotiable Rules
- Read before write — read the target file before any edit.
- Actor isolation —
send()andclose()are actor-isolated methods. All shared state is protected by the actor. Nononisolatedescape hatches without explicit justification. - Task lifecycle — every spawned
Taskmust have an explicit cancellation path.close()must cancel all internal Tasks andawaittheir completion. - Sendable conformance — all public types must conform to
Sendable. Callbacks must be@Sendable. - No breaking changes without version bump.
- No hardcoded secrets.
- Minimal changes — one concern per edit; no drive-by refactors.
Session Protocol
doc/local/is git-ignored. Never commit files under it.
- Start of session: read
doc/local/ai-learning.mdin full (create with header if missing) and checkdoc/local/plan/for any in-progress plan. - Feature work: save plan to
doc/local/plan/<feature-name>.mdbefore starting. - End of session: append at least one entry to
doc/local/ai-learning.md— mandatory even if no mistakes were made. An empty file proves the session protocol was ignored. Format:Date/Issue or Learning/Root Cause/Prevention Rule.
