diff --git a/.agents/agents/contract-reviewer.md b/.agents/agents/contract-reviewer.md new file mode 100644 index 0000000..9ffe572 --- /dev/null +++ b/.agents/agents/contract-reviewer.md @@ -0,0 +1,6 @@ +--- +name: contract-reviewer +description: Review OCAP addon locality, public mission APIs, and extension payload compatibility. +--- + +Read [AGENTS.md](../../AGENTS.md) and the [contract review skill](../skills/ocap-addon-contract-review/SKILL.md). Work read-only. Trace the boundary through its producers and consumers. Return severity, trigger, observable result, and source evidence for each finding. Include missing checks. diff --git a/.agents/agents/explorer.md b/.agents/agents/explorer.md new file mode 100644 index 0000000..c954fa6 --- /dev/null +++ b/.agents/agents/explorer.md @@ -0,0 +1,6 @@ +--- +name: explorer +description: Trace one OCAP addon workflow and its compatibility or recovery evidence. +--- + +Read [AGENTS.md](../../AGENTS.md) and the [handoff guide](../../docs/agent-workflows.md). Work read-only. Report the entry point, machine and scheduler context, relevant history, consumers, and case that verifies the behavior. Include file and line evidence. diff --git a/.agents/agents/recovery-reviewer.md b/.agents/agents/recovery-reviewer.md new file mode 100644 index 0000000..ab9d999 --- /dev/null +++ b/.agents/agents/recovery-reviewer.md @@ -0,0 +1,6 @@ +--- +name: recovery-reviewer +description: Review OCAP addon registration, asynchronous callbacks, save and discard, and cleanup. +--- + +Read [AGENTS.md](../../AGENTS.md) and the [handoff guide](../../docs/agent-workflows.md). Work read-only. Follow the [recording lifecycle](../../docs/recording-lifecycle.md) through delayed registration, pause, save, discard, reset, and restart. Return concrete failure sequences, remaining handlers or state, observable effects, and missing evidence. diff --git a/.agents/agents/worker.md b/.agents/agents/worker.md new file mode 100644 index 0000000..0a209f4 --- /dev/null +++ b/.agents/agents/worker.md @@ -0,0 +1,6 @@ +--- +name: worker +description: Implement one scoped OCAP addon change in assigned files. +--- + +Read [AGENTS.md](../../AGENTS.md) and the [handoff guide](../../docs/agent-workflows.md). Edit only assigned files and preserve local changes. Run the applicable HEMTT and regression checks. Return changed files, exact results, runtime gaps, and integration needs. diff --git a/.agents/skills/ocap-addon-context-recovery/SKILL.md b/.agents/skills/ocap-addon-context-recovery/SKILL.md new file mode 100644 index 0000000..0231c54 --- /dev/null +++ b/.agents/skills/ocap-addon-context-recovery/SKILL.md @@ -0,0 +1,6 @@ +--- +name: ocap-addon-context-recovery +description: Recover why an OCAP Arma 3 addon locality, recording lifecycle, or compatibility guard exists using SQF callers, history, and regression cases. +--- + +Start with [Maintainer context](../../../docs/maintainer-context.md) and record the revision and relevant working-tree changes. Search the owning SQF function and integration history for the rule. Trace the machine, scheduler, and state owner, then follow any remote or extension consumer. Report the historical reason, present behavior, and [verification case](../../../docs/testkit.md), with any remaining evidence gaps. diff --git a/.agents/skills/ocap-addon-contract-review/SKILL.md b/.agents/skills/ocap-addon-contract-review/SKILL.md new file mode 100644 index 0000000..8223df7 --- /dev/null +++ b/.agents/skills/ocap-addon-contract-review/SKILL.md @@ -0,0 +1,6 @@ +--- +name: ocap-addon-contract-review +description: Review OCAP Arma 3 addon changes that affect remote submissions, public CBA events or settings, extension commands, or playback payloads. +--- + +Use [Maintainer context](../../../docs/maintainer-context.md) to trace the changed boundary. For remote submissions, check the actual sender, object locality, join-in-progress behavior, and server or listen-host path. For public CBA or extension changes, check names, argument positions and types, defaults, callbacks, and downstream frame or event consumers. Report the triggering call, changed behavior, compatibility impact, and the [case](../../../docs/testkit.md) that verifies it. diff --git a/.agents/skills/ocap-addon-local-verification/SKILL.md b/.agents/skills/ocap-addon-local-verification/SKILL.md new file mode 100644 index 0000000..8a9f583 --- /dev/null +++ b/.agents/skills/ocap-addon-local-verification/SKILL.md @@ -0,0 +1,6 @@ +--- +name: ocap-addon-local-verification +description: Select and run HEMTT and in-game checks for OCAP Arma 3 addon changes, with CI, PBO packaging, and multiplayer topology in view. +--- + +Start with [Contributing](../../../CONTRIBUTING.md#running-checks), [build CI](../../../.github/workflows/build.yml), and the [case catalog](../../../docs/testkit.md). Run applicable HEMTT checks. Select runtime cases by the changed locality, scheduler, or extension boundary, using dedicated and listen servers when the affected paths differ. Record HEMTT results separately from runtime assertions and note known fixture limits or untested cases. diff --git a/.agents/skills/ocap-addon-testkit/SKILL.md b/.agents/skills/ocap-addon-testkit/SKILL.md new file mode 100644 index 0000000..cee37ef --- /dev/null +++ b/.agents/skills/ocap-addon-testkit/SKILL.md @@ -0,0 +1,6 @@ +--- +name: ocap-addon-testkit +description: Run the existing OCAP addon SQF regression cases for save limits, multiplayer submissions, client sampling, and same-mission restart. +--- + +Choose a case from the [local catalog](../../../docs/testkit.md). Follow the [regression README](../../../tests/README.md) for the disposable mission, test-only build, multiplayer roles, execution commands, and expected RPT markers. Check accepted and rejected behavior and the resulting recording state. Report the topology, exact result, and any sections blocked by the documented CBA final-function limitation. diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..cf38e4e --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,20 @@ +# OCAP Arma 3 addon agent guide + +Start with [Contributing](CONTRIBUTING.md). Use [Maintainer context](docs/maintainer-context.md) to trace an SQF contract, failure path, or guard and [Comment hygiene](docs/comment-hygiene.md) for comment edits. + +- Preserve server ownership of recording state. Trace client submissions and join-in-progress behavior through the actual producers and receivers. Preserve sender, object-owner, and curator checks where they apply, including on a listen server. +- Follow the [recording lifecycle](docs/recording-lifecycle.md) for extension readiness, registration, pause, save, discard, and restart. Preserve callback correlation, frame numbering, and cleanup of per-recording handlers and state. +- Preserve [extension commands](addons/extension/fnc_sendData.sqf), positional arguments, defaults, and event payloads used by existing missions, extension releases, and playback. The web server stores native v2 as protobuf and generates v1 JSON on demand for downloads. +- Follow the existing SQF and CBA conventions in [Contributing](CONTRIBUTING.md#sqf-and-cba). Use [player detail tracking](docs/player-detail-tracking.md) for settings, localization, and optional integration behavior. +- Inspect the working tree before editing and preserve local changes. Use disposable missions, synthetic player data, and isolated storage for [local cases](docs/testkit.md). Match [HEMTT CI](.github/workflows/build.yml) and aim to cover every changed success and failure path. Record which runtime cases ran and which still need Arma 3. + +## Agent workflows + +Use [roles and handoffs](docs/agent-workflows.md) for independent exploration, a disjoint implementation assignment, or a fresh review of a consequential change. The coordinator owns integration and final verification. + +| Skill | Use when | +| --- | --- | +| [ocap-addon-context-recovery](.agents/skills/ocap-addon-context-recovery/SKILL.md) | Recover why a compatibility, locality, or lifecycle rule exists | +| [ocap-addon-contract-review](.agents/skills/ocap-addon-contract-review/SKILL.md) | Review network locality, mission APIs, or extension and playback payloads | +| [ocap-addon-local-verification](.agents/skills/ocap-addon-local-verification/SKILL.md) | Select HEMTT checks and in-game acceptance cases | +| [ocap-addon-testkit](.agents/skills/ocap-addon-testkit/SKILL.md) | Run the existing SQF regression cases | diff --git a/CLAUDE.md b/CLAUDE.md index caaed33..0dd135c 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1,5 +1,7 @@ # CLAUDE.md +@AGENTS.md + This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. ## Project Overview @@ -7,7 +9,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co OCAP2 (Operation Capture and Playback v2) is an Arma 3 addon that records gameplay data during missions for web-based playback analysis. It captures unit positions, vehicles, weapons, markers, and events to facilitate tactical analysis and training. **Language**: SQF (Arma 3 scripting language) -**Dependencies**: Arma 3 2.04+, CBA (Community Base Addons), optional ACE3 integration +**Dependencies**: Arma 3 2.10+, CBA (Community Base Addons), optional ACE3 integration ## Build @@ -27,8 +29,7 @@ Modular CBA-style addon structure: addons/ ├── main/ # Core settings, macros, version info ├── recorder/ # Capture loop, event handlers, export -├── database/ # Database connection, metrics, real-time data streaming -└── extension/ # Extension DLL wrapper +└── extension/ # Extension calls, callbacks, and session registration ``` Each addon follows XEH structure: @@ -43,8 +44,8 @@ Each addon follows XEH structure: - **recorder/fnc_captureLoop.sqf**: Core capture loop, tracks units and vehicles per frame - **recorder/fnc_addEventMission.sqf**: Mission event handlers setup - **recorder/fnc_eh_firedMan.sqf**: Fired event handler with projectile tracking -- **database/fnc_initDB.sqf**: Database connection and mission context initialization -- **database/fnc_metricsLoop.sqf**: Server performance metrics collection +- **extension/fnc_initSession.sqf**: Initial extension session state +- **extension/fnc_handleCallback.sqf**: Storage readiness and mission registration callbacks ### Configuration diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..8951fe5 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,25 @@ +# Contributing + +- [Maintainer context](docs/maintainer-context.md) maps addon boundaries and their consumers. +- [Comment hygiene](docs/comment-hygiene.md) covers SQF comments, configuration, and preprocessor directives. +- [Agent roles and handoffs](docs/agent-workflows.md) describes source navigation and verification evidence. +- [Local test cases](docs/testkit.md) maps changes to HEMTT checks and SQF regressions. + +## SQF and CBA + +Follow the nearby code and [.editorconfig](.editorconfig). Use each component's `script_component.hpp` and existing `FUNC`, `EFUNC`, `GVAR`, and `EGVAR` macros. Register prepared functions in the component's `XEH_prep.sqf` and check its [CBA and PBO configuration](addons/recorder/config.cpp). Trace the machine and scheduler context wherever a function can be reached from both a local call and a remote event. + +Keep public CBA event and setting names, defaults, ranges, and value types compatible with existing missions. Use the existing [stringtable](addons/recorder/stringtable.xml) for localized player detail labels and tooltips, and check the matching [CBA registrations](addons/recorder/XEH_preInit.sqf). Preserve feature detection and vanilla fallbacks for optional mods such as ACE3 and TFAR. + +## Running checks + +Run the same HEMTT commands as [build CI](.github/workflows/build.yml) from the repository root. + +```sh +hemtt check +hemtt build +``` + +`hemtt build` writes testable PBOs under `.hemttout/build/`. Use `hemtt release` for release packaging checks when needed. See the [release workflow](.github/workflows/release.yml) and [build instructions](README.md#building-from-source). + +HEMTT verifies static and build behavior. For runtime changes, select a [local case](docs/testkit.md) and follow the [regression setup](tests/README.md) in a disposable Arma 3 mission. Aim to exercise every changed success and failure path and report the cases, topology, RPT results, and remaining gaps. HEMTT does not execute the SQF regression scripts or measure their coverage. diff --git a/docs/agent-workflows.md b/docs/agent-workflows.md new file mode 100644 index 0000000..5f79dbd --- /dev/null +++ b/docs/agent-workflows.md @@ -0,0 +1,20 @@ +# Agent roles and handoffs + +Delegate when separate context or independent work improves the result. Assign each agent one bounded question and give it the applicable brief. + +| Role | Scope | Return | +| --- | --- | --- | +| [Explorer](../.agents/agents/explorer.md) | Read-only caller or history trace | Entry points, execution context, consumers, and evidence gaps | +| [Worker](../.agents/agents/worker.md) | Named files for an agreed change | Changed files, checks, and integration needs | +| [Contract reviewer](../.agents/agents/contract-reviewer.md) | Read-only review of locality, caller, and payload compatibility | Concrete consequences with source links | +| [Recovery reviewer](../.agents/agents/recovery-reviewer.md) | Read-only review of lifecycle ordering and cleanup | Trigger, failure sequence, and remaining state | + +Include the revision and relevant working-tree diff, scope, compatibility constraints, checks, and a stopping point. Assign workers disjoint files. The coordinator checks the findings against source and owns final integration and verification. + +## SQF source navigation + +Use `rg` to find `PREP(name)` in `XEH_prep.sqf`, `fnc_name.sqf`, and the `FUNC`, `EFUNC`, `QFUNC`, or expanded `OCAP_*_fnc_*` spellings. Search for public CBA settings and events by both their macro form and expanded string. For a remote path, trace the target, sender validation, locality, join-in-progress installation, and removal. For extension calls, search for the exact `:RESOURCE:ACTION:` string in both repositories and verify any callback and playback consumer separately. + +## Discovery + +Keep shared instructions in [AGENTS.md](../AGENTS.md) and briefs and skills in [`.agents/`](../.agents). Claude Code imports the shared guide through [CLAUDE.md](../CLAUDE.md). Validate relative links, skill frontmatter, and `git diff --check` when editing the guidance. diff --git a/docs/comment-hygiene.md b/docs/comment-hygiene.md new file mode 100644 index 0000000..3788843 --- /dev/null +++ b/docs/comment-hygiene.md @@ -0,0 +1,9 @@ +# Comment hygiene + +Keep the reasons that a future edit could miss. Preserve public Natural Docs topics, documented examples, and setting help. Check the [documentation workflow](../.github/workflows/docs.yml) when editing generated documentation inputs. + +- Explain locality and scheduler constraints near the affected handler. Keep the reason for ordering across registration, first capture, final capture, export, and discard. +- Document positional extension arguments, payload defaults, and public CBA names at the boundary that owns them. Put longer history and operational evidence in [Maintainer context](maintainer-context.md) or the relevant runtime guide. +- Preserve `#include`, `#define`, conditional preprocessing, macro continuation lines, and HEMTT suppressions. Check token boundaries when moving inline comments in macros and configuration. + +Keep comment-only diffs focused and review the SQF and config around every changed block. Use [HEMTT check](../CONTRIBUTING.md#running-checks) when comments touch preprocessing or build inputs. diff --git a/docs/maintainer-context.md b/docs/maintainer-context.md new file mode 100644 index 0000000..4224850 --- /dev/null +++ b/docs/maintainer-context.md @@ -0,0 +1,13 @@ +# Maintainer context + +For a contract or recovery change, trace the triggering event, machine and scheduler context, state owner, consumer, and observable result. Use owning-file history to check why a guard exists and the [local case catalog](testkit.md) to find verification. + +| Boundary | Invariants to trace | +| --- | --- | +| CBA startup and settings | Follow component `config.cpp`, `XEH_preInit.sqf`, `XEH_postInit.sqf`, and `XEH_prep.sqf`. Check initialization order, persisted CBA setting names and defaults, and matching [player detail labels](../addons/recorder/stringtable.xml). | +| Recording lifecycle | Follow [start](../addons/recorder/fnc_startRecording.sqf), [registration](../addons/extension/fnc_newMission.sqf), and [callbacks](../addons/extension/fnc_handleCallback.sqf) into [capture](../addons/recorder/fnc_captureLoop.sqf). Check pause while waiting, late callbacks, duplicate starts, save limits, same-frame mission-script export, and [discard and restart](recording-lifecycle.md#save-limits-and-storage). | +| Client submissions | Follow [client bootstrap and sampling](../addons/recorder/fnc_installPlayerTrackingClients.sqf) to the server's `fnc_submit*.sqf` receivers. Track join-in-progress installation, `remoteExecutedOwner`, object ownership, curator assignment, and direct server calls where applicable. Check the listen host separately because it runs both server and client code. | +| Per-recording state | Follow [handler removal](../addons/recorder/fnc_removeCaptureHandlers.sqf), [reset](../addons/recorder/fnc_resetRecording.sqf), and [automatic restart](../addons/recorder/fnc_autoRestartMonitor.sqf). Check CBA per-frame handlers, event handlers, delayed callbacks, diff baselines, and reused entity IDs across two recordings in one mission. | +| Extension and playback | Follow [extension calls](../addons/extension/fnc_sendData.sqf) and [callback dispatch](../addons/extension/fnc_handleCallback.sqf). Check exact command names, argument slots and types, response and callback shapes, optional fields, and frame numbering at each boundary. For [player detail payloads](player-detail-tracking.md), trace the sampler, server baseline, emitted event, and playback consumer. Account for older peers explicitly where the [lifecycle protocol notes](recording-lifecycle.md#save-limits-and-storage) document them. | + +Record which extension and web revisions you checked for changes that cross repositories. Review consequential changes with the [contract or recovery roles](agent-workflows.md). diff --git a/docs/testkit.md b/docs/testkit.md new file mode 100644 index 0000000..7b3dcb5 --- /dev/null +++ b/docs/testkit.md @@ -0,0 +1,12 @@ +# Local test cases + +Run [HEMTT check and build](../CONTRIBUTING.md#running-checks) from the repository root. For in-game cases, follow the test-only compile setup, mission configuration, and RPT checks in the [regression README](../tests/README.md). + +| Case | Existing check | +| --- | --- | +| Mission registration and save limits | [Save limits script](../tests/save_limits_regressions.sqf) exercises delayed and failed registration, pause and resume, save versus discard, and same-frame mission-script export. | +| Multiplayer submission ownership | [Recorder script](../tests/recorder_regressions.sqf) exercises rejected and accepted submissions for player snapshots, Zeus, and static weapons on dedicated and listen servers. | +| Client sampler state | The recorder script invokes the [client sampler subtest](../tests/client_sampler_regressions.sqf) to cover player-object and entity-ID changes, initial inventory, cache reset, and TFAR fallback. | +| Servicing and same-mission restart | The recorder script includes servicing thresholds, export reset, and stale callbacks. Use [dedicated-server lifecycle checks](recording-lifecycle.md#dedicated-server-verification) for extension and web outcomes. | + +Use disposable missions and synthetic data. Keep test builds that disable the CBA compile cache out of release artifacts. The [regression README](../tests/README.md#test-build) documents final CBA functions that block parts of the recorder and client suites. Report what actually ran, any RPT errors, and which cases still need a working game setup. Restart the disposable mission after a suite that replaces recording state.