xingwudao/open-xquant/compare-strategy-versions
Claude Code and agent skill by xingwudao/open-xquant
- community
Checking that the SKILL.md file is still in the repository.
Use when comparing open-xquant runs or strategy versions, especially when distinguishing within-version reproducibility from cross-version strategy evidence.
Install
npx vskill@latest install xingwudao/open-xquant/compare-strategy-versionsSKILL.md
Phase Path Containment Preflight
Before any phase artifact read, write, directory creation, command, or handoff, run this preflight completely and block on any failure:
- Read
.open-xquant/workspace.yaml. Resolveversion_rootfrom
paths.versions_dir, using versions only when that key is absent. Require version_root to be a safe workspace-relative path: reject an absolute path or any .. path segment, resolve it canonically with symlinks, and require the result to stay inside the workspace.
- Read
current.json. For normal phase work, setexpected_version_idto
current.json.active_version; it must exist. Only a contract that explicitly owns cross-version inspection may instead set expected_version_id from the referenced version id for that historical read. This comparator owns that exception only while validating each candidate; it never permits active-version work to consume another version.
- Set the intended version directory to
<version_root>/<expected_version_id>/ and resolve it canonically. Require the intended version directory to remain inside the canonical version root and workspace; otherwise treat it as a symlink escape. Read version_manifest.json only from that exact directory. The manifest version_id must equal expected_version_id.
- Before using each required
phase_pathsvalue, require a non-empty
workspace-relative string. Reject an absolute path and any .. path segment. Resolve <workspace>/<phase_path> canonically, including existing symlink ancestors even when the leaf will be created, and require the target to be the intended version directory or a descendant of it. A symlink escape outside that directory is invalid.
- On any identity or path failure, stop before phase artifact reads, writes,
directory creation, commands, or handoffs. Do not normalize an unsafe path into acceptance and do not fall back to a default phase path.
Block examples when expected_version_id is v001 include strategy_store/v001/../v002/04_spec_build, strategy_store/v002/04_spec_build, /tmp/04_spec_build, and strategy_store/v001/escape/04_spec_build when escape is a symlink whose target is outside the intended version directory. An allowed custom nested phase path is strategy_store/v001/custom/phases/04_spec_build when its canonical target remains under the intended version directory.
For a new-version bootstrap, only manage-strategy-version may proceed before the new manifest exists or the new id becomes active. It must apply the same workspace-relative, traversal, canonical-containment, and symlink checks to every constructed phase path before directory creation, then write a matching manifest before publishing current.json last.
Strategy Version Comparator
Round 26: comparison schema 3; the exact closed request fields are schema_version, mode, selection_id, selection_request_id, selection_policy, candidate_set, and comparison_population. Historical refresh is write -> review -> lineage -> prepare new selection -> comparison -> resume with fresh selection, candidate-set hash, and comparison ID.
This skill extends compare-experiments for version-governed workspaces. It compares completed run packages without writing into either run directory.
Workspace Path Resolution
Read .open-xquant/workspace.yaml before reading or writing comparison artifacts. Resolve each key independently from paths: use paths.experiment_registry, paths.governance_dir, paths.comparisons_dir, paths.comparison_registry, and paths.final_dir. Use experiments.jsonl, governance, comparisons, comparisons/comparisons.jsonl, or final, respectively, only when that key is absent; never derive one key from another configured key. Each configured value must be a safe workspace-relative path. Reject absolute paths, traversal outside the workspace, and symlink escapes whose resolved target leaves the workspace.
Call the resolved paths <experiment_registry>, <governance_dir>, <comparisons_dir>, <comparison_registry>, and <final_dir> below.
Candidate Run Containment
Treat every registry row as an untrusted reference. For each candidate:
- Set
expected_version_idtocandidate.version_idunder the explicit
cross-version exception above. Load only <version_root>/<candidate.version_id>/version_manifest.json; the manifest version_id must equal candidate.version_id.
- Read that manifest's exact
phase_paths.09_backtests. Validate its safe
workspace-relative form and canonical containment under the candidate's intended version directory. Do not fall back to a default backtest path.
- Require
candidate.run_pathto be a safe workspace-relative path with no
.. segment. Resolve it canonically, including symlinks, and prove it is exactly one direct run directory inside that backtest phase:
The resolved path must be a directory. Reject a stale default such as legacy_root/v001/09_backtests/run_001 when the configured root is research_store; reject a cross-version path such as research_store/v002/09_backtests/run_001 for candidate v001; reject a nested path such as research_store/v001/09_backtests/nested/run_001; and reject research_store/v001/09_backtests/escape/run_001 when escape is a symlink outside the candidate's backtest phase. Registry identity and lineage audit eligibility do not replace these checks.
When the comparator is invoked for final-selection evidence, the handoff must include the exact hash-bound schema-version-2 candidate_set.json reference and its exact schema-version-2 selection-policy reference. Re-read and validate that candidate set before candidate evidence consumption and immediately before comparison-manifest publication. Comparison population must be a subset of the hash-bound candidate set and preserve candidate order; never discover, substitute, or append a registry candidate outside that set. The final selector applies the complete two-candidate equality or larger-set union-and-connected-graph coverage rule across all comparison references.
Final-Selection Comparison Handoff
The normal final-selection path is prepare_selection -> candidate_set_ready -> build_selection_comparison -> comparison_ready -> resume_selection. This is one coordinated request and uses the same selection_id, same exact selection-policy reference, and same exact candidate-set reference throughout. The exact schema-version-2 request below is retained for historical recognition; current production uses the Round 25 schema-version-3 contract:
Resolve the candidate-set path as the exact direct regular file under <final_dir>/<selection_id>/, re-read its exact bytes, recompute its full hash, validate its complete schema and transitive evidence, and require comparison_population to equal its ordered projection. Do not accept a path-only ref, allocate a selection id, mutate the candidate set, or discover a replacement population. On successful manifest publication return exactly:
Require at least two unique candidates. Re-read the schema-version-2 policy artifact and require its exact selection id and {path, sha256} reference to equal the request and candidate-set binding. Reject stale or cross-selection policy.
Every historical schema-version-2 comparator result has exactly schema_version, status, selection_id, selection_policy, candidate_set, comparison_ref, and blocking_findings. status is comparison_ready, blocked, or fail; comparison_ref is null for blocked/fail and blocking_findings is then non-empty. The coordinator collects one or more ready refs and invokes resume_selection without a new user request. Comparator failure never changes the selection id, candidate set, decision, or prior pointer.
Immutable Selection Comparison Output
For build_selection_comparison, the only output root is <comparisons_dir>/<selection_id>/<comparison_id>/, an immutable selection-scoped directory. A normal manifest path is <comparisons_dir>/selection_20260712_180000/cmp_v001_runA_vs_v002_runB/comparison_manifest.json. Create the directory exclusively before any output write and reject an existing output directory. Never overwrite, delete, merge, or repair comparison evidence, especially evidence reachable from a prior current_final.json. Hash exact final bytes into the schema-version-2 comparison manifest. A remediable retry uses a fresh comparison_id under the same selection_id and keeps the same policy/candidate-set binding; restart_selection allocates a new selection and comparison scope.
Comparison Types
Within-version comparison:
- same version_id
- same confirmed SPEC unless the comparison is explicitly a robustness variant
- use
oxq backtest compare-runsas a strict comparability gate - failures usually block winner-style conclusions
Cross-version comparison:
- different version_id values
- different
spec_hashis expected, not automatically fatal - produce a spec diff and explain likely impact
- do not name a winner from metrics alone
Inputs
- Two or more candidate run packages.
<experiment_registry>with version_id, run_id, run_path, and decision
fields.
- Optional existing
<comparisons_dir>/<comparison_id>/artifacts only for a
standalone, non-selection comparison. build_selection_comparison rejects every existing output directory instead of treating it as optional input.
<governance_dir>/lineage_audit_*.jsonfor candidate lineage eligibility.- Optional user-confirmed comparison scope.
Workflow
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingagent/skills/compare-strategy-versions/SKILL.md
Popularity
- 7-day trend score
- 5
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/xingwudao/open-xquant/compare-strategy-versions)