diff --git a/.gitattributes b/.gitattributes index fcc214d..5414973 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,3 +1,4 @@ # Preserve third-party license notices byte-for-byte on every checkout. benchmarks/prospective-review-v1/*/licenses/* -text benchmarks/path-audit-v1/** -text +benchmarks/cursor-native-v1/** -text diff --git a/benchmarks/README.md b/benchmarks/README.md index 92cc731..f07eacd 100644 --- a/benchmarks/README.md +++ b/benchmarks/README.md @@ -12,6 +12,12 @@ with the published v0.26.1 wheel. It records five directory-reference misses and a separate post-hoc generated-output false positive. Its provisional observations are not independent human labels or a general accuracy estimate. +A [native Cursor behavioral smoke check](cursor-native-v1/README.md) retains four +file-context cases and one explicit-selection control run in the desktop client. +Visible reply markers matched the frozen predictions in those contexts. Empty +hook attachment lists and their observability limit are retained too. This is +not a complete attachment trace or independent accuracy estimate. + None of these workflows claims that A 100 means semantic prompt quality. ## AI comparison status diff --git a/benchmarks/cursor-native-v1/README.md b/benchmarks/cursor-native-v1/README.md new file mode 100644 index 0000000..25c908f --- /dev/null +++ b/benchmarks/cursor-native-v1/README.md @@ -0,0 +1,92 @@ +# Native Cursor behavioral smoke check + +Completed **2026-11-13**, with a user operating **Cursor desktop 3.29.15 on +Windows x64**. The model picker showed **Grok 4.7** at setup; the backend model +snapshot was not attested per run. Predictions came from the unchanged published +**ACS v0.26.1** wheel, with its retained runtime source identity. + +Four automatic file-context cases produced visible marker sets matching the +frozen predictions. One explicit-selection control also emitted its requested +marker. **This is a small native behavioral smoke check, not a complete attachment +trace, general compatibility guarantee or independent accuracy study.** + +## Observations + +| Case / screenshot | Explicit file context | Predicted active rule names | Visible marker names | Observed file reads | +| --- | --- | --- | --- | --- | +| [API only](screenshots/api-only.png) | `src/api/service.py` | ALWAYS, API | ALWAYS, API | `src/api/service.py` | +| [Web only](screenshots/web-only.png) | `src/web/app.ts` | ALWAYS, WEB | ALWAYS, WEB | `src/web/app.ts` | +| [Joint](screenshots/joint.png) | Both files above | ALWAYS, API, WEB | ALWAYS, API, WEB | Both files above | +| [Root TypeScript](screenshots/root-ts.png) | `index.ts` | ALWAYS, ROOT_ONLY | ALWAYS, ROOT_ONLY | `index.ts` | +| [Explicit-selection control](screenshots/manual-control.png) | Select `always.mdc` | Control expects ALWAYS | ALWAYS | No read event retained | + +Five distinct conversation identifiers and ten native events were retained: +five prompt events and five file-read events. The fixture's rule, target and +collector bytes stayed unchanged. Observed reads were all declared targets; +these two hooks are not assumed to record every possible action. + +The last control selects an **always-apply** rule. It checks that the marker +response can be elicited with deliberate selection; it does not independently +validate a manual-only rule mode. + +[Prepared inputs](prepared-inputs.json) retain random marker keys, original +hashes and complete frozen ACS predictions. Keys and predictions were outside +the workspace, not in prompts or target code. [Observations](observations.json) +contain assistant transcriptions of user-supplied screenshots. These are not +OCR, independent labels or complete exported transcripts. Cropped screenshots +are retained for inspection; account UI screenshots are not published. + +## Preserved observability limits + +The [original protocol](protocol.json) used neutral rules and proposed reading +native hook attachment lists. Actual lists remained empty even with a visible +explicit rule chip. The diagnostic collector recorded the raw count before +filtering: zero attachments, zero discarded entries. [Initial events](initial-hook-events.jsonl) +preserve both collector versions. The [transcript export](initial-transcript.md) +contained conversation text and a rule name, not its body or full context. +No Context Usage entry was visible in the supplied full-window screenshot; +the component's presence in installed code did not establish UI availability. + +These limits were preserved. A [behavior addendum](behavior-protocol.json) +declared the separate marker experiment before queries. Preparation was committed +at `c97f307` before the five observed queries. This is local evidence ordering, +not independently timestamped preregistration. The user selected target file +chips in fresh chats and supplied screenshots; no assistant model run was +substituted for the native client. + +Marker appearance is behavior consistent with access to a rule body. Missing +markers could be noncompliance. Neither outcome identifies the complete hidden +prompt or proves how a rule became available. User/team settings were not +independently captured. There was one run per context, with no alternate-model, +OS, nested-workspace, adversarial or long-session measurement. Do not turn these +counts into general accuracy or security claims. + +## Verify retained evidence offline + +From a checkout with Python 3.10+: + +```bash +python scripts/verify_cursor_native_evidence.py +``` + +This checks the integrity index, fixture hashes, distinct conversations, event +attribution and transcribed marker sets against frozen predictions. Disagreements +remain completed observations. Exit zero means offline verification completed; +it does not mean Cursor was rerun or is safe. The index is not authentication. + +For a **new** user-operated native run with an installed v0.26.1 wheel: + +```bash +python scripts/prepare_cursor_behavior_probe.py --workspace /path/to/new-probe --evidence-dir /path/to/separate-evidence --python /path/to/frozen-env/bin/python +``` + +On Windows, use the environment's `Scripts/python.exe`. The generator launches +the installed package with isolated Python flags and checks its source identity. +It creates fresh random markers, neutral code and project hooks. It never calls +a model or uploads files. Keep keys outside the workspace; run each generated +prompt in a fresh chat, explicitly select its files, and retain all outcomes. + +[Fixture](fixture) retains all captured input bytes except the host-specific +hook command configuration. Its original hash is retained, but absolute local +interpreter/workspace paths are omitted. Generate commands for your own machine. +Keep collector unit-test events separate from real native observations. diff --git a/benchmarks/cursor-native-v1/behavior-events.jsonl b/benchmarks/cursor-native-v1/behavior-events.jsonl new file mode 100644 index 0000000..70d91c6 --- /dev/null +++ b/benchmarks/cursor-native-v1/behavior-events.jsonl @@ -0,0 +1,10 @@ +{"schema_version": 3, "event": "beforeSubmitPrompt", "captured_at_utc": "2026-11-13T09:55:37.716747+00:00", "collector_sha256": "1ef5cc6efb02c131576483d376d86af1b56023a290eb49323fef407b9e0d9d85", "known_input_field_types": {"attachments": "list", "conversation_id": "str", "cursor_version": "str", "hook_event_name": "str", "model": "str", "prompt": "str", "session_id": "str", "workspace_roots": "list"}, "attachments_field_present": true, "input_attachment_count": 0, "attachment_entry_shapes": [], "unsupported_attachment_count": 0, "unusable_attachment_path_count": 0, "reported_attachments": [], "outside_workspace_attachments_omitted": 0, "interpretation": "client-reported metadata at this hook, not model compliance or proof of complete context", "recognized_probe_marker": "NATIVE_BEHAVIOR_V1 api-only", "conversation_id_sha256": "11b686d11ee999b52c669fbfa1e45a4093539e640c77f5b3313a70dfe3d0ce72", "session_id_sha256": "11b686d11ee999b52c669fbfa1e45a4093539e640c77f5b3313a70dfe3d0ce72"} +{"schema_version": 3, "event": "beforeReadFile", "captured_at_utc": "2026-11-13T09:55:42.318618+00:00", "collector_sha256": "1ef5cc6efb02c131576483d376d86af1b56023a290eb49323fef407b9e0d9d85", "known_input_field_types": {"attachments": "list", "content": "str", "conversation_id": "str", "cursor_version": "str", "file_path": "str", "hook_event_name": "str", "model": "str", "session_id": "str", "workspace_roots": "list"}, "attachments_field_present": true, "input_attachment_count": 0, "attachment_entry_shapes": [], "unsupported_attachment_count": 0, "unusable_attachment_path_count": 0, "reported_attachments": [], "outside_workspace_attachments_omitted": 0, "interpretation": "client-reported metadata at this hook, not model compliance or proof of complete context", "observed_read_target": "src/api/service.py", "conversation_id_sha256": "11b686d11ee999b52c669fbfa1e45a4093539e640c77f5b3313a70dfe3d0ce72", "session_id_sha256": "11b686d11ee999b52c669fbfa1e45a4093539e640c77f5b3313a70dfe3d0ce72"} +{"schema_version": 3, "event": "beforeSubmitPrompt", "captured_at_utc": "2026-11-13T09:58:28.291914+00:00", "collector_sha256": "1ef5cc6efb02c131576483d376d86af1b56023a290eb49323fef407b9e0d9d85", "known_input_field_types": {"attachments": "list", "conversation_id": "str", "cursor_version": "str", "hook_event_name": "str", "model": "str", "prompt": "str", "session_id": "str", "workspace_roots": "list"}, "attachments_field_present": true, "input_attachment_count": 0, "attachment_entry_shapes": [], "unsupported_attachment_count": 0, "unusable_attachment_path_count": 0, "reported_attachments": [], "outside_workspace_attachments_omitted": 0, "interpretation": "client-reported metadata at this hook, not model compliance or proof of complete context", "recognized_probe_marker": "NATIVE_BEHAVIOR_V1 web-only", "conversation_id_sha256": "4684fa5cf1b8faec2a8071df26b17bb939be38b5086fc0185c6a43eba7880608", "session_id_sha256": "4684fa5cf1b8faec2a8071df26b17bb939be38b5086fc0185c6a43eba7880608"} +{"schema_version": 3, "event": "beforeReadFile", "captured_at_utc": "2026-11-13T09:58:33.282503+00:00", "collector_sha256": "1ef5cc6efb02c131576483d376d86af1b56023a290eb49323fef407b9e0d9d85", "known_input_field_types": {"attachments": "list", "content": "str", "conversation_id": "str", "cursor_version": "str", "file_path": "str", "hook_event_name": "str", "model": "str", "session_id": "str", "workspace_roots": "list"}, "attachments_field_present": true, "input_attachment_count": 0, "attachment_entry_shapes": [], "unsupported_attachment_count": 0, "unusable_attachment_path_count": 0, "reported_attachments": [], "outside_workspace_attachments_omitted": 0, "interpretation": "client-reported metadata at this hook, not model compliance or proof of complete context", "observed_read_target": "src/web/app.ts", "conversation_id_sha256": "4684fa5cf1b8faec2a8071df26b17bb939be38b5086fc0185c6a43eba7880608", "session_id_sha256": "4684fa5cf1b8faec2a8071df26b17bb939be38b5086fc0185c6a43eba7880608"} +{"schema_version": 3, "event": "beforeSubmitPrompt", "captured_at_utc": "2026-11-13T10:00:49.276566+00:00", "collector_sha256": "1ef5cc6efb02c131576483d376d86af1b56023a290eb49323fef407b9e0d9d85", "known_input_field_types": {"attachments": "list", "conversation_id": "str", "cursor_version": "str", "hook_event_name": "str", "model": "str", "prompt": "str", "session_id": "str", "workspace_roots": "list"}, "attachments_field_present": true, "input_attachment_count": 0, "attachment_entry_shapes": [], "unsupported_attachment_count": 0, "unusable_attachment_path_count": 0, "reported_attachments": [], "outside_workspace_attachments_omitted": 0, "interpretation": "client-reported metadata at this hook, not model compliance or proof of complete context", "recognized_probe_marker": "NATIVE_BEHAVIOR_V1 joint", "conversation_id_sha256": "1c8765f0ad56bcce997a009630bf5a85f05a18d0bab04453cd4b9d7a21b004f8", "session_id_sha256": "1c8765f0ad56bcce997a009630bf5a85f05a18d0bab04453cd4b9d7a21b004f8"} +{"schema_version": 3, "event": "beforeReadFile", "captured_at_utc": "2026-11-13T10:00:53.192002+00:00", "collector_sha256": "1ef5cc6efb02c131576483d376d86af1b56023a290eb49323fef407b9e0d9d85", "known_input_field_types": {"attachments": "list", "content": "str", "conversation_id": "str", "cursor_version": "str", "file_path": "str", "hook_event_name": "str", "model": "str", "session_id": "str", "workspace_roots": "list"}, "attachments_field_present": true, "input_attachment_count": 0, "attachment_entry_shapes": [], "unsupported_attachment_count": 0, "unusable_attachment_path_count": 0, "reported_attachments": [], "outside_workspace_attachments_omitted": 0, "interpretation": "client-reported metadata at this hook, not model compliance or proof of complete context", "observed_read_target": "src/web/app.ts", "conversation_id_sha256": "1c8765f0ad56bcce997a009630bf5a85f05a18d0bab04453cd4b9d7a21b004f8", "session_id_sha256": "1c8765f0ad56bcce997a009630bf5a85f05a18d0bab04453cd4b9d7a21b004f8"} +{"schema_version": 3, "event": "beforeReadFile", "captured_at_utc": "2026-11-13T10:00:53.192002+00:00", "collector_sha256": "1ef5cc6efb02c131576483d376d86af1b56023a290eb49323fef407b9e0d9d85", "known_input_field_types": {"attachments": "list", "content": "str", "conversation_id": "str", "cursor_version": "str", "file_path": "str", "hook_event_name": "str", "model": "str", "session_id": "str", "workspace_roots": "list"}, "attachments_field_present": true, "input_attachment_count": 0, "attachment_entry_shapes": [], "unsupported_attachment_count": 0, "unusable_attachment_path_count": 0, "reported_attachments": [], "outside_workspace_attachments_omitted": 0, "interpretation": "client-reported metadata at this hook, not model compliance or proof of complete context", "observed_read_target": "src/api/service.py", "conversation_id_sha256": "1c8765f0ad56bcce997a009630bf5a85f05a18d0bab04453cd4b9d7a21b004f8", "session_id_sha256": "1c8765f0ad56bcce997a009630bf5a85f05a18d0bab04453cd4b9d7a21b004f8"} +{"schema_version": 3, "event": "beforeSubmitPrompt", "captured_at_utc": "2026-11-13T10:03:08.779568+00:00", "collector_sha256": "1ef5cc6efb02c131576483d376d86af1b56023a290eb49323fef407b9e0d9d85", "known_input_field_types": {"attachments": "list", "conversation_id": "str", "cursor_version": "str", "hook_event_name": "str", "model": "str", "prompt": "str", "session_id": "str", "workspace_roots": "list"}, "attachments_field_present": true, "input_attachment_count": 0, "attachment_entry_shapes": [], "unsupported_attachment_count": 0, "unusable_attachment_path_count": 0, "reported_attachments": [], "outside_workspace_attachments_omitted": 0, "interpretation": "client-reported metadata at this hook, not model compliance or proof of complete context", "recognized_probe_marker": "NATIVE_BEHAVIOR_V1 root-ts", "conversation_id_sha256": "e0b40bc2d447a40abf5ffd5f1a56bbc5f47accb7e5fc245e235817288fc08274", "session_id_sha256": "e0b40bc2d447a40abf5ffd5f1a56bbc5f47accb7e5fc245e235817288fc08274"} +{"schema_version": 3, "event": "beforeReadFile", "captured_at_utc": "2026-11-13T10:03:14.057555+00:00", "collector_sha256": "1ef5cc6efb02c131576483d376d86af1b56023a290eb49323fef407b9e0d9d85", "known_input_field_types": {"attachments": "list", "content": "str", "conversation_id": "str", "cursor_version": "str", "file_path": "str", "hook_event_name": "str", "model": "str", "session_id": "str", "workspace_roots": "list"}, "attachments_field_present": true, "input_attachment_count": 0, "attachment_entry_shapes": [], "unsupported_attachment_count": 0, "unusable_attachment_path_count": 0, "reported_attachments": [], "outside_workspace_attachments_omitted": 0, "interpretation": "client-reported metadata at this hook, not model compliance or proof of complete context", "observed_read_target": "index.ts", "conversation_id_sha256": "e0b40bc2d447a40abf5ffd5f1a56bbc5f47accb7e5fc245e235817288fc08274", "session_id_sha256": "e0b40bc2d447a40abf5ffd5f1a56bbc5f47accb7e5fc245e235817288fc08274"} +{"schema_version": 3, "event": "beforeSubmitPrompt", "captured_at_utc": "2026-11-13T10:03:21.005317+00:00", "collector_sha256": "1ef5cc6efb02c131576483d376d86af1b56023a290eb49323fef407b9e0d9d85", "known_input_field_types": {"attachments": "list", "conversation_id": "str", "cursor_version": "str", "hook_event_name": "str", "model": "str", "prompt": "str", "session_id": "str", "workspace_roots": "list"}, "attachments_field_present": true, "input_attachment_count": 0, "attachment_entry_shapes": [], "unsupported_attachment_count": 0, "unusable_attachment_path_count": 0, "reported_attachments": [], "outside_workspace_attachments_omitted": 0, "interpretation": "client-reported metadata at this hook, not model compliance or proof of complete context", "recognized_probe_marker": "NATIVE_BEHAVIOR_V1 manual-control", "conversation_id_sha256": "2f1fd6b1ca564a41735e8166cb81838bf5fb5298c62494da5d496dfdc5e54cba", "session_id_sha256": "2f1fd6b1ca564a41735e8166cb81838bf5fb5298c62494da5d496dfdc5e54cba"} diff --git a/benchmarks/cursor-native-v1/behavior-protocol.json b/benchmarks/cursor-native-v1/behavior-protocol.json new file mode 100644 index 0000000..23e3441 --- /dev/null +++ b/benchmarks/cursor-native-v1/behavior-protocol.json @@ -0,0 +1,15 @@ +{ + "schema_version": 1, + "registered_date": "2026-11-12", + "status": "behavior_addendum_before_behavior_queries", + "reason": "Actual native hook events included an empty raw attachment list even with a visible manually selected rule chip. Export Transcript retained conversation text only. The current account UI did not visibly expose a context usage entry. Preserve these observations and use a separate behavioral smoke experiment; do not reinterpret it as a complete attachment trace.", + "product_version": "0.26.1", + "client_version_at_preparation": "Cursor desktop Windows x64 3.29.15", + "fixture": "New synthetic workspace separate from the earlier unchanged neutral-rule probe. Four rules keep the original metadata/globs and receive independent random 64-bit markers. Marker keys and ACS predictions remain outside the workspace, never in the user prompts or target code.", + "cases": ["api-only", "web-only", "joint", "root-ts"], + "manual_control": "Explicitly select always.mdc in a separate fresh chat. This tests whether marker behavior can be elicited with deliberate rule selection, not automatic attachment.", + "operator": "User operates Cursor. Use fresh chat per case, attach only the listed target file chips in automatic cases, record all replies and any tool activity. No other projects, terminal commands or edits.", + "measurement": "Compare reply marker occurrences with the frozen ACS activation predictions. Marker presence is behavior consistent with availability of that rule body. Missing markers can be noncompliance, not absence. Rule/manifest searches, input changes and unexpected reads are confounds, not silently discarded cases. Hook read-target observations help identify some extra reads but are not assumed exhaustive.", + "claims": "Versioned native behavioral smoke evidence only. No complete native context claim, general compatibility pass, independent accuracy, model superiority or adoption claim. Preserve empty attachment observations and initial sampling/observability failures.", + "cost": "Use the current available account/model. No subscription purchase, additional credits or security/privacy setting changes. Stop if the client requires payment." +} diff --git a/benchmarks/cursor-native-v1/evidence-index.json b/benchmarks/cursor-native-v1/evidence-index.json new file mode 100644 index 0000000..0eec504 --- /dev/null +++ b/benchmarks/cursor-native-v1/evidence-index.json @@ -0,0 +1,26 @@ +{ + "schema_version": 1, + "meaning": "Integrity index only; not authentication or independent review", + "files": { + "behavior-events.jsonl": "29ca288720c20a00e1cbf5f0acf95076a1a92eb3d0886326c6d2b8728173c61f", + "behavior-protocol.json": "9a2dcd044fc6ea8ea61d0de972d60f204edca7468eeab7c2ce578380e7d9b192", + "fixture/.cursor/rules/always.mdc": "4faff5a899e29c22cab4934beed5f7adab1b7d0e106ee929f94a61bcd2b6085b", + "fixture/.cursor/rules/api.mdc": "7c759220e18009d1405dc2b7d223ed82d9ceaed02f5c609c841d4ab1f659469a", + "fixture/.cursor/rules/root-only.mdc": "a1a41f25d55a39c2f47ee18e1bdb0a30f1a5d65ffaf564d247c69cc193834894", + "fixture/.cursor/rules/web.mdc": "a32d281170011466e6fa86a5f62133fa956a78c566102ce9a1ff4036dfe5a56a", + "fixture/capture_native.py": "1ef5cc6efb02c131576483d376d86af1b56023a290eb49323fef407b9e0d9d85", + "fixture/index.ts": "95211e1c8fcccb22c6683f9ddcfe70a1e96de8e4ad432473549df00a79c94f82", + "fixture/src/api/service.py": "ff22838f0579268925b6d63d9d872e80a808bd0728abcdfd90b63e7ca2aa568a", + "fixture/src/web/app.ts": "68a939480299f36dcb24dc3bde6919951aff9386638a26ec84a387f5243f85ba", + "initial-hook-events.jsonl": "a8890c80db2224503489bfbba9fa00f424fbf47a6b1f3f046ff9a96d8532fd9c", + "initial-transcript.md": "d8aba6b30a98551191c4e7d083458566df49ba02a03b54fe0b474ee968545ca9", + "observations.json": "ff818de97ede73f29ecd824cf48bc218d179df65a4798235763f90bfe98ad734", + "prepared-inputs.json": "86a426c46f1cd061028dc8eca5d5d882332f412824ec0db663d6d2d1aeaa6ab7", + "protocol.json": "5578e3f6f8ec0cae1b0bc9965ab6c33b90f44f847e4c7b4bc304b163559bb182", + "screenshots/api-only.png": "38c9321ff73f9da220205b7d187019e1be19c3282cdbc1ae7d3ded59f6342441", + "screenshots/joint.png": "696e36b1d820058dda41f4634b4d200d1138365911b9767e96e7c351579818bc", + "screenshots/manual-control.png": "fafa0f485b25eeccdad48d2f5a99d81667f4aa15606893347f11b767e6d51f9f", + "screenshots/root-ts.png": "183d9624e7d43c99161a40410c29140ffd721f2edaf16dad58c0f48bc6bf9ef0", + "screenshots/web-only.png": "e3cd42cd8c41805f03f3254691095d9bf6559cea0a1c4d4462f2d0cb6a90fdc5" + } +} diff --git a/benchmarks/cursor-native-v1/fixture/.cursor/rules/always.mdc b/benchmarks/cursor-native-v1/fixture/.cursor/rules/always.mdc new file mode 100644 index 0000000..5a954ba --- /dev/null +++ b/benchmarks/cursor-native-v1/fixture/.cursor/rules/always.mdc @@ -0,0 +1,4 @@ +--- +alwaysApply: true +--- +When the user message contains NATIVE_BEHAVIOR_V1, include the exact marker `ACS_ALWAYS_fb4542f53803d117` once in your final answer. Do not search for additional marker sources. diff --git a/benchmarks/cursor-native-v1/fixture/.cursor/rules/api.mdc b/benchmarks/cursor-native-v1/fixture/.cursor/rules/api.mdc new file mode 100644 index 0000000..adefe5b --- /dev/null +++ b/benchmarks/cursor-native-v1/fixture/.cursor/rules/api.mdc @@ -0,0 +1,5 @@ +--- +alwaysApply: false +globs: "src/**/*.py" +--- +When the user message contains NATIVE_BEHAVIOR_V1, include the exact marker `ACS_API_01a00dd6d8467526` once in your final answer. Do not search for additional marker sources. diff --git a/benchmarks/cursor-native-v1/fixture/.cursor/rules/root-only.mdc b/benchmarks/cursor-native-v1/fixture/.cursor/rules/root-only.mdc new file mode 100644 index 0000000..185c9fa --- /dev/null +++ b/benchmarks/cursor-native-v1/fixture/.cursor/rules/root-only.mdc @@ -0,0 +1,5 @@ +--- +alwaysApply: false +globs: "*.ts" +--- +When the user message contains NATIVE_BEHAVIOR_V1, include the exact marker `ACS_ROOT_ONLY_53d10df74eb84806` once in your final answer. Do not search for additional marker sources. diff --git a/benchmarks/cursor-native-v1/fixture/.cursor/rules/web.mdc b/benchmarks/cursor-native-v1/fixture/.cursor/rules/web.mdc new file mode 100644 index 0000000..bab24a6 --- /dev/null +++ b/benchmarks/cursor-native-v1/fixture/.cursor/rules/web.mdc @@ -0,0 +1,5 @@ +--- +alwaysApply: false +globs: "src/**/*.ts" +--- +When the user message contains NATIVE_BEHAVIOR_V1, include the exact marker `ACS_WEB_cce8ef647b17ead1` once in your final answer. Do not search for additional marker sources. diff --git a/benchmarks/cursor-native-v1/fixture/capture_native.py b/benchmarks/cursor-native-v1/fixture/capture_native.py new file mode 100644 index 0000000..9875fb8 --- /dev/null +++ b/benchmarks/cursor-native-v1/fixture/capture_native.py @@ -0,0 +1,76 @@ +from datetime import datetime, timezone +import hashlib +import json +from pathlib import Path +import sys + +root = Path(__file__).resolve().parent +event = sys.argv[1] +response = {"continue": True} if event == "beforeSubmitPrompt" else {"permission": "allow"} +try: + raw = sys.stdin.buffer.read(1048577) + if len(raw) > 1048576: + raise ValueError("oversized input") + data = json.loads(raw) + if not isinstance(data, dict): + raise ValueError("expected object") + attachments = [] + outside = unsupported = unusable = 0 + raw_attachments = data.get("attachments") + entries = raw_attachments if isinstance(raw_attachments, list) else [] + entry_shapes = [] + safe_keys = {"type", "file_path", "filePath", "path", "uri", "name", "content"} + for entry in entries: + entry_shapes.append({"value_type": type(entry).__name__, + "known_keys": sorted(safe_keys.intersection(entry)) if isinstance(entry, dict) else []}) + if not isinstance(entry, dict) or entry.get("type") not in {"file", "rule"}: + unsupported += 1 + continue + try: + target = Path(entry["file_path"]).resolve() + except (KeyError, TypeError, ValueError, OSError): + unusable += 1 + continue + try: + relative = target.relative_to(root).as_posix() + except ValueError: + outside += 1 + continue + attachments.append({"type": entry["type"], "path": relative}) + known_input_keys = {"attachments", "prompt", "file_path", "content", "conversation_id", "session_id", + "hook_event_name", "cursor_version", "workspace_roots", "model", "tool_input"} + record = {"schema_version": 3, "event": event, + "captured_at_utc": datetime.now(timezone.utc).isoformat(), + "collector_sha256": hashlib.sha256(Path(__file__).read_bytes()).hexdigest(), + "known_input_field_types": {key: type(data[key]).__name__ for key in sorted(known_input_keys.intersection(data))}, + "attachments_field_present": "attachments" in data, + "input_attachment_count": len(entries) if isinstance(raw_attachments, list) else None, + "attachment_entry_shapes": entry_shapes, + "unsupported_attachment_count": unsupported, + "unusable_attachment_path_count": unusable, + "reported_attachments": attachments, + "outside_workspace_attachments_omitted": outside, + "interpretation": "client-reported metadata at this hook, not model compliance or proof of complete context"} + if event == "beforeReadFile" and isinstance(data.get("file_path"), str): + try: + record["observed_read_target"] = Path(data["file_path"]).resolve().relative_to(root).as_posix() + except (ValueError, OSError): + record["outside_or_invalid_read_target_omitted"] = True + prompt = data.get("prompt") + if isinstance(prompt, str): + # Retain only a fixed synthetic case marker, never arbitrary prompt text. + for marker in ("Probe api-only.", "Probe web-only.", "Probe joint.", "Probe root-ts.", "CAPTURE_CONTROL_V2", + "NATIVE_BEHAVIOR_V1 api-only", "NATIVE_BEHAVIOR_V1 web-only", "NATIVE_BEHAVIOR_V1 joint", + "NATIVE_BEHAVIOR_V1 root-ts", "NATIVE_BEHAVIOR_V1 manual-control"): + if marker in prompt: + record["recognized_probe_marker"] = marker + break + for name in ("conversation_id", "session_id"): + if isinstance(data.get(name), str): + record[name + "_sha256"] = hashlib.sha256(data[name].encode()).hexdigest() + with (root / "native-observations.jsonl").open("a", encoding="utf-8") as output: + output.write(json.dumps(record, ensure_ascii=False) + "\n") +except Exception: + # Collection failure must not disrupt the user's client. No raw input/error. + print("Native probe could not retain this observation.", file=sys.stderr) +print(json.dumps(response)) diff --git a/benchmarks/cursor-native-v1/fixture/index.ts b/benchmarks/cursor-native-v1/fixture/index.ts new file mode 100644 index 0000000..6a576eb --- /dev/null +++ b/benchmarks/cursor-native-v1/fixture/index.ts @@ -0,0 +1 @@ +export const rootStatus = 'ok'; diff --git a/benchmarks/cursor-native-v1/fixture/src/api/service.py b/benchmarks/cursor-native-v1/fixture/src/api/service.py new file mode 100644 index 0000000..4fe499e --- /dev/null +++ b/benchmarks/cursor-native-v1/fixture/src/api/service.py @@ -0,0 +1,2 @@ +def health(): + return 'ok' diff --git a/benchmarks/cursor-native-v1/fixture/src/web/app.ts b/benchmarks/cursor-native-v1/fixture/src/web/app.ts new file mode 100644 index 0000000..bb8a462 --- /dev/null +++ b/benchmarks/cursor-native-v1/fixture/src/web/app.ts @@ -0,0 +1 @@ +export const status = 'ok'; diff --git a/benchmarks/cursor-native-v1/initial-hook-events.jsonl b/benchmarks/cursor-native-v1/initial-hook-events.jsonl new file mode 100644 index 0000000..475693f --- /dev/null +++ b/benchmarks/cursor-native-v1/initial-hook-events.jsonl @@ -0,0 +1,4 @@ +{"schema_version": 1, "event": "beforeSubmitPrompt", "captured_at_utc": "2026-11-11T17:07:30.874514+00:00", "attachments_field_present": true, "reported_attachments": [], "outside_workspace_attachments_omitted": 0, "interpretation": "client-reported metadata at this hook, not model compliance or proof of complete context", "conversation_id_sha256": "6a5e9a4f6ab75014e4a4026f62d29ea678885162d2928be9d8eb0c7db8054bf7", "session_id_sha256": "6a5e9a4f6ab75014e4a4026f62d29ea678885162d2928be9d8eb0c7db8054bf7"} +{"schema_version": 1, "event": "beforeReadFile", "captured_at_utc": "2026-11-11T17:07:36.657846+00:00", "attachments_field_present": true, "reported_attachments": [], "outside_workspace_attachments_omitted": 0, "interpretation": "client-reported metadata at this hook, not model compliance or proof of complete context", "conversation_id_sha256": "6a5e9a4f6ab75014e4a4026f62d29ea678885162d2928be9d8eb0c7db8054bf7", "session_id_sha256": "6a5e9a4f6ab75014e4a4026f62d29ea678885162d2928be9d8eb0c7db8054bf7"} +{"schema_version": 1, "event": "beforeSubmitPrompt", "captured_at_utc": "2026-11-11T17:11:19.296250+00:00", "attachments_field_present": true, "reported_attachments": [], "outside_workspace_attachments_omitted": 0, "interpretation": "client-reported metadata at this hook, not model compliance or proof of complete context", "conversation_id_sha256": "6a5e9a4f6ab75014e4a4026f62d29ea678885162d2928be9d8eb0c7db8054bf7", "session_id_sha256": "6a5e9a4f6ab75014e4a4026f62d29ea678885162d2928be9d8eb0c7db8054bf7"} +{"schema_version": 2, "event": "beforeSubmitPrompt", "captured_at_utc": "2026-11-11T17:14:48.660090+00:00", "collector_sha256": "51f09ed8a1eda394b34e50bc9f5411df66a8cd8b12c05e5563ea3af9f06c34f3", "known_input_field_types": {"attachments": "list", "conversation_id": "str", "cursor_version": "str", "hook_event_name": "str", "model": "str", "prompt": "str", "session_id": "str", "workspace_roots": "list"}, "attachments_field_present": true, "input_attachment_count": 0, "attachment_entry_shapes": [], "unsupported_attachment_count": 0, "unusable_attachment_path_count": 0, "reported_attachments": [], "outside_workspace_attachments_omitted": 0, "interpretation": "client-reported metadata at this hook, not model compliance or proof of complete context", "recognized_probe_marker": "CAPTURE_CONTROL_V2", "conversation_id_sha256": "6a5e9a4f6ab75014e4a4026f62d29ea678885162d2928be9d8eb0c7db8054bf7", "session_id_sha256": "6a5e9a4f6ab75014e4a4026f62d29ea678885162d2928be9d8eb0c7db8054bf7"} diff --git a/benchmarks/cursor-native-v1/initial-transcript.md b/benchmarks/cursor-native-v1/initial-transcript.md new file mode 100644 index 0000000..befab48 --- /dev/null +++ b/benchmarks/cursor-native-v1/initial-transcript.md @@ -0,0 +1,16 @@ +# Capture control rules +_Exported on 11/12/2026 at 01:18:46 GMT+8 from Cursor (3.29.15)_ + +--- + +**User** + +.cursor/rules/always.mdc CAPTURE_CONTROL_V2 +只回复 OK,不读写文件,也不运行命令。 + +--- + +**Cursor** + +OK + diff --git a/benchmarks/cursor-native-v1/observations.json b/benchmarks/cursor-native-v1/observations.json new file mode 100644 index 0000000..bcc61bf --- /dev/null +++ b/benchmarks/cursor-native-v1/observations.json @@ -0,0 +1,100 @@ +{ + "schema_version": 1, + "status": "native_behavior_smoke_observations_completed", + "completed_date": "2026-11-13", + "client": "Cursor desktop Windows x64 3.29.15", + "model_ui_label_at_setup": "Grok 4.7", + "per_run_model_attestation": false, + "operator": "User manually operated the native client; assistant prepared inputs and transcribed screenshots.", + "source_commit_before_behavior_queries": "c97f307", + "workspace_input_hashes_unchanged_after_all_queries": true, + "global_or_team_rules_independently_captured": false, + "complete_attachment_trace_available": false, + "independent_accuracy_established": false, + "cases": [ + { + "id": "api-only", + "kind": "automatic_file_context", + "screenshot": "screenshots/api-only.png", + "visible_final_excerpt": "src/api/service.py declares health.\nACS_ALWAYS_fb4542f53803d117 ACS_API_01a00dd6d8467526", + "observed_visible_markers": [ + "ACS_ALWAYS_fb4542f53803d117", + "ACS_API_01a00dd6d8467526" + ], + "conversation_id_sha256": "11b686d11ee999b52c669fbfa1e45a4093539e640c77f5b3313a70dfe3d0ce72", + "event_count": 2, + "observed_read_targets": [ + "src/api/service.py" + ], + "complete_transcript_retained": false, + "evidence_kind": "user_supplied_native_screenshot_with_assistant_transcription" + }, + { + "id": "web-only", + "kind": "automatic_file_context", + "screenshot": "screenshots/web-only.png", + "visible_final_excerpt": "src/web/app.ts declares status.\nACS_ALWAYS_fb4542f53803d117 ACS_WEB_cce8ef647b17ead1", + "observed_visible_markers": [ + "ACS_ALWAYS_fb4542f53803d117", + "ACS_WEB_cce8ef647b17ead1" + ], + "conversation_id_sha256": "4684fa5cf1b8faec2a8071df26b17bb939be38b5086fc0185c6a43eba7880608", + "event_count": 2, + "observed_read_targets": [ + "src/web/app.ts" + ], + "complete_transcript_retained": false, + "evidence_kind": "user_supplied_native_screenshot_with_assistant_transcription" + }, + { + "id": "joint", + "kind": "automatic_file_context", + "screenshot": "screenshots/joint.png", + "visible_final_excerpt": "src/api/service.py declares health. src/web/app.ts declares status.\nACS_ALWAYS_fb4542f53803d117 ACS_API_01a00dd6d8467526\nACS_WEB_cce8ef647b17ead1", + "observed_visible_markers": [ + "ACS_ALWAYS_fb4542f53803d117", + "ACS_API_01a00dd6d8467526", + "ACS_WEB_cce8ef647b17ead1" + ], + "conversation_id_sha256": "1c8765f0ad56bcce997a009630bf5a85f05a18d0bab04453cd4b9d7a21b004f8", + "event_count": 3, + "observed_read_targets": [ + "src/api/service.py", + "src/web/app.ts" + ], + "complete_transcript_retained": false, + "evidence_kind": "user_supplied_native_screenshot_with_assistant_transcription" + }, + { + "id": "root-ts", + "kind": "automatic_file_context", + "screenshot": "screenshots/root-ts.png", + "visible_final_excerpt": "index.ts declares rootStatus.\nACS_ALWAYS_fb4542f53803d117 ACS_ROOT_ONLY_53d10df74eb84806", + "observed_visible_markers": [ + "ACS_ALWAYS_fb4542f53803d117", + "ACS_ROOT_ONLY_53d10df74eb84806" + ], + "conversation_id_sha256": "e0b40bc2d447a40abf5ffd5f1a56bbc5f47accb7e5fc245e235817288fc08274", + "event_count": 2, + "observed_read_targets": [ + "index.ts" + ], + "complete_transcript_retained": false, + "evidence_kind": "user_supplied_native_screenshot_with_assistant_transcription" + }, + { + "id": "manual-control", + "kind": "explicit_selection_of_always_rule", + "screenshot": "screenshots/manual-control.png", + "visible_final_excerpt": "ACS_ALWAYS_fb4542f53803d117", + "observed_visible_markers": [ + "ACS_ALWAYS_fb4542f53803d117" + ], + "conversation_id_sha256": "2f1fd6b1ca564a41735e8166cb81838bf5fb5298c62494da5d496dfdc5e54cba", + "event_count": 1, + "observed_read_targets": [], + "complete_transcript_retained": false, + "evidence_kind": "user_supplied_native_screenshot_with_assistant_transcription" + } + ] +} diff --git a/benchmarks/cursor-native-v1/prepared-inputs.json b/benchmarks/cursor-native-v1/prepared-inputs.json new file mode 100644 index 0000000..5778933 --- /dev/null +++ b/benchmarks/cursor-native-v1/prepared-inputs.json @@ -0,0 +1,570 @@ +{ + "schema_version": 1, + "status": "prepared_no_native_behavior_results", + "prepared_at_utc": "2026-11-12T03:39:28.949179+00:00", + "markers": { + "always.mdc": "ACS_ALWAYS_fb4542f53803d117", + "api.mdc": "ACS_API_01a00dd6d8467526", + "web.mdc": "ACS_WEB_cce8ef647b17ead1", + "root-only.mdc": "ACS_ROOT_ONLY_53d10df74eb84806" + }, + "inputs_sha256": { + "capture_native.py": "1ef5cc6efb02c131576483d376d86af1b56023a290eb49323fef407b9e0d9d85", + "src/api/service.py": "ff22838f0579268925b6d63d9d872e80a808bd0728abcdfd90b63e7ca2aa568a", + "src/web/app.ts": "68a939480299f36dcb24dc3bde6919951aff9386638a26ec84a387f5243f85ba", + "index.ts": "95211e1c8fcccb22c6683f9ddcfe70a1e96de8e4ad432473549df00a79c94f82", + ".cursor/rules/always.mdc": "4faff5a899e29c22cab4934beed5f7adab1b7d0e106ee929f94a61bcd2b6085b", + ".cursor/rules/api.mdc": "7c759220e18009d1405dc2b7d223ed82d9ceaed02f5c609c841d4ab1f659469a", + ".cursor/rules/web.mdc": "a32d281170011466e6fa86a5f62133fa956a78c566102ce9a1ff4036dfe5a56a", + ".cursor/rules/root-only.mdc": "a1a41f25d55a39c2f47ee18e1bdb0a30f1a5d65ffaf564d247c69cc193834894", + ".cursor/hooks.json": "5b46f5f0402221b74c897cc71392ba42d0d8ebe1837619590428b442b60759be" + }, + "cases": [ + { + "id": "api-only", + "targets": [ + "src/api/service.py" + ], + "prompt": "NATIVE_BEHAVIOR_V1 api-only. Read only the attached src/api/service.py. Reply with its declared name(s) and any probe markers required by the project rules. Do not inspect other files, search, edit, or run shell commands.", + "acs_prediction": { + "schema_version": 1, + "analysis": "cursor_file_context", + "profile": "cursor-file-context-v1", + "tool": { + "name": "AgentConfigScore", + "version": "0.26.1", + "source_fingerprint": { + "format": "acs-python-source-v1", + "sha256": "d6b3b079d6a8ab0d870020abe5f6489b59536c5a6602e2083dfc80b0c97d1ed5", + "files": [ + "__init__.py", + "__main__.py", + "cli.py", + "config.py", + "doctor.py", + "entrypoint.py", + "feedback.py", + "gitdiff.py", + "guardrails.py", + "history.py", + "initializer.py", + "provenance.py", + "regression.py", + "rules.py", + "sarif.py", + "scanner.py", + "scopes.py" + ] + } + }, + "status": "completed", + "scored": false, + "targets": [ + "src/api/service.py" + ], + "targets_existence_checked": false, + "observed_agent_context": false, + "activation_inputs": "declared_file_paths_only", + "unmodelled_inputs": [ + "manual_mentions", + "model_selection", + "user_team_rules", + "runtime_settings", + "other_instruction_formats" + ], + "rules": [ + { + "file": ".cursor/rules/always.mdc", + "mode": "always", + "activation": "active", + "reason": "always_apply", + "pattern_count": 0, + "metadata_lines": { + "alwaysApply": 2 + }, + "body_line": 4, + "matched_targets": [ + "src/api/service.py" + ], + "source_sha256": "4faff5a899e29c22cab4934beed5f7adab1b7d0e106ee929f94a61bcd2b6085b", + "directive_analysis": "bounded_prose", + "recognized_directives": 1 + }, + { + "file": ".cursor/rules/api.mdc", + "mode": "patterns", + "activation": "active", + "reason": "declared_target_matches", + "pattern_count": 1, + "metadata_lines": { + "alwaysApply": 2, + "globs": 3 + }, + "body_line": 5, + "matched_targets": [ + "src/api/service.py" + ], + "source_sha256": "7c759220e18009d1405dc2b7d223ed82d9ceaed02f5c609c841d4ab1f659469a", + "directive_analysis": "bounded_prose", + "recognized_directives": 1 + }, + { + "file": ".cursor/rules/root-only.mdc", + "mode": "patterns", + "activation": "inactive", + "reason": "no_declared_target_matches", + "pattern_count": 1, + "metadata_lines": { + "alwaysApply": 2, + "globs": 3 + }, + "body_line": 5, + "matched_targets": [], + "source_sha256": "a1a41f25d55a39c2f47ee18e1bdb0a30f1a5d65ffaf564d247c69cc193834894", + "directive_analysis": "bounded_prose", + "recognized_directives": 0 + }, + { + "file": ".cursor/rules/web.mdc", + "mode": "patterns", + "activation": "inactive", + "reason": "no_declared_target_matches", + "pattern_count": 1, + "metadata_lines": { + "alwaysApply": 2, + "globs": 3 + }, + "body_line": 5, + "matched_targets": [], + "source_sha256": "a32d281170011466e6fa86a5f62133fa956a78c566102ce9a1ff4036dfe5a56a", + "directive_analysis": "bounded_prose", + "recognized_directives": 0 + } + ], + "opposing_directives": [], + "summary": { + "rules": 4, + "other_supported_sources": 0, + "active": 2, + "inactive": 2, + "unknown": 0, + "uninterpreted_bodies": 0, + "active_signals": 0, + "uncertain_signals": 0 + } + } + }, + { + "id": "web-only", + "targets": [ + "src/web/app.ts" + ], + "prompt": "NATIVE_BEHAVIOR_V1 web-only. Read only the attached src/web/app.ts. Reply with its declared name(s) and any probe markers required by the project rules. Do not inspect other files, search, edit, or run shell commands.", + "acs_prediction": { + "schema_version": 1, + "analysis": "cursor_file_context", + "profile": "cursor-file-context-v1", + "tool": { + "name": "AgentConfigScore", + "version": "0.26.1", + "source_fingerprint": { + "format": "acs-python-source-v1", + "sha256": "d6b3b079d6a8ab0d870020abe5f6489b59536c5a6602e2083dfc80b0c97d1ed5", + "files": [ + "__init__.py", + "__main__.py", + "cli.py", + "config.py", + "doctor.py", + "entrypoint.py", + "feedback.py", + "gitdiff.py", + "guardrails.py", + "history.py", + "initializer.py", + "provenance.py", + "regression.py", + "rules.py", + "sarif.py", + "scanner.py", + "scopes.py" + ] + } + }, + "status": "completed", + "scored": false, + "targets": [ + "src/web/app.ts" + ], + "targets_existence_checked": false, + "observed_agent_context": false, + "activation_inputs": "declared_file_paths_only", + "unmodelled_inputs": [ + "manual_mentions", + "model_selection", + "user_team_rules", + "runtime_settings", + "other_instruction_formats" + ], + "rules": [ + { + "file": ".cursor/rules/always.mdc", + "mode": "always", + "activation": "active", + "reason": "always_apply", + "pattern_count": 0, + "metadata_lines": { + "alwaysApply": 2 + }, + "body_line": 4, + "matched_targets": [ + "src/web/app.ts" + ], + "source_sha256": "4faff5a899e29c22cab4934beed5f7adab1b7d0e106ee929f94a61bcd2b6085b", + "directive_analysis": "bounded_prose", + "recognized_directives": 1 + }, + { + "file": ".cursor/rules/api.mdc", + "mode": "patterns", + "activation": "inactive", + "reason": "no_declared_target_matches", + "pattern_count": 1, + "metadata_lines": { + "alwaysApply": 2, + "globs": 3 + }, + "body_line": 5, + "matched_targets": [], + "source_sha256": "7c759220e18009d1405dc2b7d223ed82d9ceaed02f5c609c841d4ab1f659469a", + "directive_analysis": "bounded_prose", + "recognized_directives": 0 + }, + { + "file": ".cursor/rules/root-only.mdc", + "mode": "patterns", + "activation": "inactive", + "reason": "no_declared_target_matches", + "pattern_count": 1, + "metadata_lines": { + "alwaysApply": 2, + "globs": 3 + }, + "body_line": 5, + "matched_targets": [], + "source_sha256": "a1a41f25d55a39c2f47ee18e1bdb0a30f1a5d65ffaf564d247c69cc193834894", + "directive_analysis": "bounded_prose", + "recognized_directives": 0 + }, + { + "file": ".cursor/rules/web.mdc", + "mode": "patterns", + "activation": "active", + "reason": "declared_target_matches", + "pattern_count": 1, + "metadata_lines": { + "alwaysApply": 2, + "globs": 3 + }, + "body_line": 5, + "matched_targets": [ + "src/web/app.ts" + ], + "source_sha256": "a32d281170011466e6fa86a5f62133fa956a78c566102ce9a1ff4036dfe5a56a", + "directive_analysis": "bounded_prose", + "recognized_directives": 1 + } + ], + "opposing_directives": [], + "summary": { + "rules": 4, + "other_supported_sources": 0, + "active": 2, + "inactive": 2, + "unknown": 0, + "uninterpreted_bodies": 0, + "active_signals": 0, + "uncertain_signals": 0 + } + } + }, + { + "id": "joint", + "targets": [ + "src/api/service.py", + "src/web/app.ts" + ], + "prompt": "NATIVE_BEHAVIOR_V1 joint. Read only the attached src/api/service.py, src/web/app.ts. Reply with its declared name(s) and any probe markers required by the project rules. Do not inspect other files, search, edit, or run shell commands.", + "acs_prediction": { + "schema_version": 1, + "analysis": "cursor_file_context", + "profile": "cursor-file-context-v1", + "tool": { + "name": "AgentConfigScore", + "version": "0.26.1", + "source_fingerprint": { + "format": "acs-python-source-v1", + "sha256": "d6b3b079d6a8ab0d870020abe5f6489b59536c5a6602e2083dfc80b0c97d1ed5", + "files": [ + "__init__.py", + "__main__.py", + "cli.py", + "config.py", + "doctor.py", + "entrypoint.py", + "feedback.py", + "gitdiff.py", + "guardrails.py", + "history.py", + "initializer.py", + "provenance.py", + "regression.py", + "rules.py", + "sarif.py", + "scanner.py", + "scopes.py" + ] + } + }, + "status": "completed", + "scored": false, + "targets": [ + "src/api/service.py", + "src/web/app.ts" + ], + "targets_existence_checked": false, + "observed_agent_context": false, + "activation_inputs": "declared_file_paths_only", + "unmodelled_inputs": [ + "manual_mentions", + "model_selection", + "user_team_rules", + "runtime_settings", + "other_instruction_formats" + ], + "rules": [ + { + "file": ".cursor/rules/always.mdc", + "mode": "always", + "activation": "active", + "reason": "always_apply", + "pattern_count": 0, + "metadata_lines": { + "alwaysApply": 2 + }, + "body_line": 4, + "matched_targets": [ + "src/api/service.py", + "src/web/app.ts" + ], + "source_sha256": "4faff5a899e29c22cab4934beed5f7adab1b7d0e106ee929f94a61bcd2b6085b", + "directive_analysis": "bounded_prose", + "recognized_directives": 1 + }, + { + "file": ".cursor/rules/api.mdc", + "mode": "patterns", + "activation": "active", + "reason": "declared_target_matches", + "pattern_count": 1, + "metadata_lines": { + "alwaysApply": 2, + "globs": 3 + }, + "body_line": 5, + "matched_targets": [ + "src/api/service.py" + ], + "source_sha256": "7c759220e18009d1405dc2b7d223ed82d9ceaed02f5c609c841d4ab1f659469a", + "directive_analysis": "bounded_prose", + "recognized_directives": 1 + }, + { + "file": ".cursor/rules/root-only.mdc", + "mode": "patterns", + "activation": "inactive", + "reason": "no_declared_target_matches", + "pattern_count": 1, + "metadata_lines": { + "alwaysApply": 2, + "globs": 3 + }, + "body_line": 5, + "matched_targets": [], + "source_sha256": "a1a41f25d55a39c2f47ee18e1bdb0a30f1a5d65ffaf564d247c69cc193834894", + "directive_analysis": "bounded_prose", + "recognized_directives": 0 + }, + { + "file": ".cursor/rules/web.mdc", + "mode": "patterns", + "activation": "active", + "reason": "declared_target_matches", + "pattern_count": 1, + "metadata_lines": { + "alwaysApply": 2, + "globs": 3 + }, + "body_line": 5, + "matched_targets": [ + "src/web/app.ts" + ], + "source_sha256": "a32d281170011466e6fa86a5f62133fa956a78c566102ce9a1ff4036dfe5a56a", + "directive_analysis": "bounded_prose", + "recognized_directives": 1 + } + ], + "opposing_directives": [], + "summary": { + "rules": 4, + "other_supported_sources": 0, + "active": 3, + "inactive": 1, + "unknown": 0, + "uninterpreted_bodies": 0, + "active_signals": 0, + "uncertain_signals": 0 + } + } + }, + { + "id": "root-ts", + "targets": [ + "index.ts" + ], + "prompt": "NATIVE_BEHAVIOR_V1 root-ts. Read only the attached index.ts. Reply with its declared name(s) and any probe markers required by the project rules. Do not inspect other files, search, edit, or run shell commands.", + "acs_prediction": { + "schema_version": 1, + "analysis": "cursor_file_context", + "profile": "cursor-file-context-v1", + "tool": { + "name": "AgentConfigScore", + "version": "0.26.1", + "source_fingerprint": { + "format": "acs-python-source-v1", + "sha256": "d6b3b079d6a8ab0d870020abe5f6489b59536c5a6602e2083dfc80b0c97d1ed5", + "files": [ + "__init__.py", + "__main__.py", + "cli.py", + "config.py", + "doctor.py", + "entrypoint.py", + "feedback.py", + "gitdiff.py", + "guardrails.py", + "history.py", + "initializer.py", + "provenance.py", + "regression.py", + "rules.py", + "sarif.py", + "scanner.py", + "scopes.py" + ] + } + }, + "status": "completed", + "scored": false, + "targets": [ + "index.ts" + ], + "targets_existence_checked": false, + "observed_agent_context": false, + "activation_inputs": "declared_file_paths_only", + "unmodelled_inputs": [ + "manual_mentions", + "model_selection", + "user_team_rules", + "runtime_settings", + "other_instruction_formats" + ], + "rules": [ + { + "file": ".cursor/rules/always.mdc", + "mode": "always", + "activation": "active", + "reason": "always_apply", + "pattern_count": 0, + "metadata_lines": { + "alwaysApply": 2 + }, + "body_line": 4, + "matched_targets": [ + "index.ts" + ], + "source_sha256": "4faff5a899e29c22cab4934beed5f7adab1b7d0e106ee929f94a61bcd2b6085b", + "directive_analysis": "bounded_prose", + "recognized_directives": 1 + }, + { + "file": ".cursor/rules/api.mdc", + "mode": "patterns", + "activation": "inactive", + "reason": "no_declared_target_matches", + "pattern_count": 1, + "metadata_lines": { + "alwaysApply": 2, + "globs": 3 + }, + "body_line": 5, + "matched_targets": [], + "source_sha256": "7c759220e18009d1405dc2b7d223ed82d9ceaed02f5c609c841d4ab1f659469a", + "directive_analysis": "bounded_prose", + "recognized_directives": 0 + }, + { + "file": ".cursor/rules/root-only.mdc", + "mode": "patterns", + "activation": "active", + "reason": "declared_target_matches", + "pattern_count": 1, + "metadata_lines": { + "alwaysApply": 2, + "globs": 3 + }, + "body_line": 5, + "matched_targets": [ + "index.ts" + ], + "source_sha256": "a1a41f25d55a39c2f47ee18e1bdb0a30f1a5d65ffaf564d247c69cc193834894", + "directive_analysis": "bounded_prose", + "recognized_directives": 1 + }, + { + "file": ".cursor/rules/web.mdc", + "mode": "patterns", + "activation": "inactive", + "reason": "no_declared_target_matches", + "pattern_count": 1, + "metadata_lines": { + "alwaysApply": 2, + "globs": 3 + }, + "body_line": 5, + "matched_targets": [], + "source_sha256": "a32d281170011466e6fa86a5f62133fa956a78c566102ce9a1ff4036dfe5a56a", + "directive_analysis": "bounded_prose", + "recognized_directives": 0 + } + ], + "opposing_directives": [], + "summary": { + "rules": 4, + "other_supported_sources": 0, + "active": 2, + "inactive": 2, + "unknown": 0, + "uninterpreted_bodies": 0, + "active_signals": 0, + "uncertain_signals": 0 + } + } + } + ], + "manual_positive_control": "Explicitly select @always.mdc. Send NATIVE_BEHAVIOR_V1 manual-control. Reply only with the probe marker required by this rule. Do not inspect other files, search, edit, or run commands.", + "interpretation": "Marker appearance is observed behavior consistent with access to a rule body, not a complete rule-attachment trace. Missing markers can be noncompliance, not absence. Unexpected file/rule reads confound interpretation. Keep client version, UI evidence, hook limits, failures and all replies. This is not independent accuracy.", + "operator": "user-controlled UI; separate fresh chat per case; explicitly attach target file chips only, without manually attaching rules in automatic cases", + "local_hook_config_not_published": true, + "local_hook_config_boundary": "Original hook-command hash retained; use the generator for your own interpreter/workspace. All other captured input bytes are retained under fixture/. No markers or predictions were stored inside the native workspace." +} diff --git a/benchmarks/cursor-native-v1/protocol.json b/benchmarks/cursor-native-v1/protocol.json new file mode 100644 index 0000000..9c7b46b --- /dev/null +++ b/benchmarks/cursor-native-v1/protocol.json @@ -0,0 +1,17 @@ +{ + "schema_version": 1, + "registered_date": "2026-11-12", + "status": "registered_before_native_queries", + "product_version": "0.26.1", + "native_client": "Cursor desktop Windows x64 3.29.15; record actual version if it updates", + "cases": [ + {"id": "api-only", "targets": ["src/api/service.py"]}, + {"id": "web-only", "targets": ["src/web/app.ts"]}, + {"id": "joint", "targets": ["src/api/service.py", "src/web/app.ts"]}, + {"id": "root-ts", "targets": ["index.ts"]} + ], + "setup": "Synthetic workspace created before native queries. Four neutral rules: always, Python files, TypeScript files, root-only TypeScript glob. ACS predictions are frozen before native queries. Fresh chat per case; explicitly attach the listed files and record UI resolution. No rule/body/file change while collecting.", + "observations": "Collect client-reported beforeSubmitPrompt and beforeReadFile attachment metadata, plus UI observations when available. Retain original event timing and the actual surface. Do not interpret model self-report or obedience as loading ground truth. Absent rule entries in a hook are unknown unless that hook's completeness for automatic rules is independently established. Keep disagreements and failures.", + "privacy": "Only synthetic workspace contents may be sent for the probe. Hook logs retain allowlisted in-workspace attachment paths, event names, timestamps and hashed session identifiers. Prompts, file contents, email, credentials and external paths are omitted. No personal repository or account artifact is published.", + "limits": "This is a versioned local smoke check, not platform-wide compatibility or an independent accuracy study. Account limitations, missing hooks or insufficient visibility remain unresolved. No subscription purchase or security-setting change is authorized by this experiment." +} diff --git a/benchmarks/cursor-native-v1/screenshots/api-only.png b/benchmarks/cursor-native-v1/screenshots/api-only.png new file mode 100644 index 0000000..8013b5d Binary files /dev/null and b/benchmarks/cursor-native-v1/screenshots/api-only.png differ diff --git a/benchmarks/cursor-native-v1/screenshots/joint.png b/benchmarks/cursor-native-v1/screenshots/joint.png new file mode 100644 index 0000000..89a1ab9 Binary files /dev/null and b/benchmarks/cursor-native-v1/screenshots/joint.png differ diff --git a/benchmarks/cursor-native-v1/screenshots/manual-control.png b/benchmarks/cursor-native-v1/screenshots/manual-control.png new file mode 100644 index 0000000..7b6ff4c Binary files /dev/null and b/benchmarks/cursor-native-v1/screenshots/manual-control.png differ diff --git a/benchmarks/cursor-native-v1/screenshots/root-ts.png b/benchmarks/cursor-native-v1/screenshots/root-ts.png new file mode 100644 index 0000000..a283147 Binary files /dev/null and b/benchmarks/cursor-native-v1/screenshots/root-ts.png differ diff --git a/benchmarks/cursor-native-v1/screenshots/web-only.png b/benchmarks/cursor-native-v1/screenshots/web-only.png new file mode 100644 index 0000000..36034cb Binary files /dev/null and b/benchmarks/cursor-native-v1/screenshots/web-only.png differ diff --git a/docs/architecture.md b/docs/architecture.md index 9d7e14b..4347960 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -54,3 +54,7 @@ Native Cursor attachment fidelity, arbitrary-prose semantics, agent execution enforcement and independent real-world accuracy are outside the shipped static contract. They remain separate validation or product directions. Maintained acceptance cases demonstrate engineering behavior and do not establish adoption. + +A [separate native Cursor smoke report](../benchmarks/cursor-native-v1/README.md) +now retains versioned behavioral observations with screenshot and hook evidence. +It does not expand the static product's guarantees or establish complete loading. diff --git a/docs/cursor-scope.md b/docs/cursor-scope.md index 7330dc6..81397a3 100644 --- a/docs/cursor-scope.md +++ b/docs/cursor-scope.md @@ -4,6 +4,11 @@ root `.cursor/rules/` project rules attach automatically given explicitly declared file paths. It does not query Cursor or observe an agent run. +A separate [native behavioral smoke check](../benchmarks/cursor-native-v1/README.md) +retains four actual file-context runs and one explicit-selection control with +Cursor desktop 3.29.15. Visible markers agreed with frozen v0.26.1 predictions; +complete attachment fidelity and independent accuracy remain unestablished. + ```bash agent-config-score scope . --target src/web/app.ts agent-config-score scope . --target src/web/app.ts --target src/api/service.py --json diff --git a/scripts/prepare_cursor_behavior_probe.py b/scripts/prepare_cursor_behavior_probe.py new file mode 100644 index 0000000..103be17 --- /dev/null +++ b/scripts/prepare_cursor_behavior_probe.py @@ -0,0 +1,94 @@ +#!/usr/bin/env python3 +"""Prepare a separate synthetic Cursor behavior probe, not a loading oracle. + +Random marker keys and ACS predictions stay outside the workspace. The user +operates Cursor; this helper never starts a model or uploads files. +""" +from __future__ import annotations + +import argparse +from datetime import datetime, timezone +import hashlib +import json +from pathlib import Path +import secrets +import subprocess + +from prepare_cursor_native_probe import HOOK, RULES, CASES + + +FROZEN_SOURCE = "d6b3b079d6a8ab0d870020abe5f6489b59536c5a6602e2083dfc80b0c97d1ed5" + + +def prepare(root: Path, evidence: Path, python: Path) -> dict: + root, evidence = root.resolve(), evidence.resolve() + if (root.exists() or evidence.exists() or root.is_relative_to(evidence) + or evidence.is_relative_to(root)): + raise ValueError("use new, separate workspace and evidence directories") + markers = {name: "ACS_" + name.removesuffix(".mdc").replace("-", "_").upper() + + "_" + secrets.token_hex(8) for name in RULES} + files = { + "capture_native.py": HOOK, + "src/api/service.py": "def health():\n return 'ok'\n", + "src/web/app.ts": "export const status = 'ok';\n", + "index.ts": "export const rootStatus = 'ok';\n", + } + for name, text in RULES.items(): + metadata = text[:text.index("---", 3) + 3] + files[".cursor/rules/" + name] = (metadata + "\nWhen the user message contains NATIVE_BEHAVIOR_V1, " + "include the exact marker `" + markers[name] + "` once in your final answer. " + "Do not search for additional marker sources.\n") + command = f'"{python.absolute().as_posix()}" -I "{(root / "capture_native.py").as_posix()}"' + files[".cursor/hooks.json"] = json.dumps({"version": 1, "hooks": { + event: [{"command": command + " " + event}] for event in ("beforeSubmitPrompt", "beforeReadFile") + }}, indent=2) + "\n" + root.mkdir(parents=True) + for name, text in files.items(): + path = root / name + path.parent.mkdir(parents=True, exist_ok=True) + with path.open("x", encoding="utf-8", newline="\n") as handle: + handle.write(text) + rows = [] + for case in CASES: + command = [str(python.absolute()), "-I", "-X", "utf8", "-m", "agent_config_score.cli", + "scope", str(root), *[arg for target in case["targets"] for arg in ("--target", target)], "--json"] + run = subprocess.run(command, cwd=root, capture_output=True, encoding="utf-8", timeout=45) + if run.returncode: + raise ValueError("frozen scope prediction failed; workspace preparation is incomplete") + prediction = json.loads(run.stdout) + tool = prediction["tool"] + if tool["version"] != "0.26.1" or tool["source_fingerprint"]["sha256"] != FROZEN_SOURCE: + raise ValueError("use the unchanged published v0.26.1 installation") + targets = ", ".join(case["targets"]) + prompt = (f"NATIVE_BEHAVIOR_V1 {case['id']}. Read only the attached {targets}. " + "Reply with its declared name(s) and any probe markers required by the project rules. " + "Do not inspect other files, search, edit, or run shell commands.") + rows.append({"id": case["id"], "targets": case["targets"], "prompt": prompt, + "acs_prediction": prediction}) + manifest = {"schema_version": 1, "status": "prepared_no_native_behavior_results", + "prepared_at_utc": datetime.now(timezone.utc).isoformat(), "markers": markers, + "inputs_sha256": {name: hashlib.sha256(text.encode()).hexdigest() for name, text in files.items()}, + "cases": rows, + "manual_positive_control": "Explicitly select @always.mdc. Send NATIVE_BEHAVIOR_V1 manual-control. Reply only with the probe marker required by this rule. Do not inspect other files, search, edit, or run commands.", + "interpretation": "Marker appearance is observed behavior consistent with access to a rule body, not a complete rule-attachment trace. Missing markers can be noncompliance, not absence. Unexpected file/rule reads confound interpretation. Keep client version, UI evidence, hook limits, failures and all replies. This is not independent accuracy.", + "operator": "user-controlled UI; separate fresh chat per case; explicitly attach target file chips only, without manually attaching rules in automatic cases"} + evidence.mkdir(parents=True) + with (evidence / "behavior-manifest.json").open("x", encoding="utf-8") as handle: + json.dump(manifest, handle, indent=2) + handle.write("\n") + return manifest + + +def main() -> int: + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--workspace", type=Path, required=True) + parser.add_argument("--evidence-dir", type=Path, required=True) + parser.add_argument("--python", type=Path, required=True) + args = parser.parse_args() + result = prepare(args.workspace, args.evidence_dir, args.python) + print(f"Prepared {len(result['cases'])} behavioral contexts and one manual control. No model run or compatibility verdict.") + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/scripts/prepare_cursor_native_probe.py b/scripts/prepare_cursor_native_probe.py new file mode 100644 index 0000000..f76af94 --- /dev/null +++ b/scripts/prepare_cursor_native_probe.py @@ -0,0 +1,166 @@ +#!/usr/bin/env python3 +"""Create a new synthetic workspace for native Cursor observation; no model call. + +Hooks retain allowlisted attachment metadata only, never prompt/file contents, +email, credentials or paths outside this synthetic workspace. The output is +observation preparation, not a compatibility result. +""" +from __future__ import annotations + +import argparse +from datetime import datetime, timezone +import hashlib +import json +from pathlib import Path +import subprocess +import sys + + +HOOK = r'''from datetime import datetime, timezone +import hashlib +import json +from pathlib import Path +import sys + +root = Path(__file__).resolve().parent +event = sys.argv[1] +response = {"continue": True} if event == "beforeSubmitPrompt" else {"permission": "allow"} +try: + raw = sys.stdin.buffer.read(1048577) + if len(raw) > 1048576: + raise ValueError("oversized input") + data = json.loads(raw) + if not isinstance(data, dict): + raise ValueError("expected object") + attachments = [] + outside = unsupported = unusable = 0 + raw_attachments = data.get("attachments") + entries = raw_attachments if isinstance(raw_attachments, list) else [] + entry_shapes = [] + safe_keys = {"type", "file_path", "filePath", "path", "uri", "name", "content"} + for entry in entries: + entry_shapes.append({"value_type": type(entry).__name__, + "known_keys": sorted(safe_keys.intersection(entry)) if isinstance(entry, dict) else []}) + if not isinstance(entry, dict) or entry.get("type") not in {"file", "rule"}: + unsupported += 1 + continue + try: + target = Path(entry["file_path"]).resolve() + except (KeyError, TypeError, ValueError, OSError): + unusable += 1 + continue + try: + relative = target.relative_to(root).as_posix() + except ValueError: + outside += 1 + continue + attachments.append({"type": entry["type"], "path": relative}) + known_input_keys = {"attachments", "prompt", "file_path", "content", "conversation_id", "session_id", + "hook_event_name", "cursor_version", "workspace_roots", "model", "tool_input"} + record = {"schema_version": 3, "event": event, + "captured_at_utc": datetime.now(timezone.utc).isoformat(), + "collector_sha256": hashlib.sha256(Path(__file__).read_bytes()).hexdigest(), + "known_input_field_types": {key: type(data[key]).__name__ for key in sorted(known_input_keys.intersection(data))}, + "attachments_field_present": "attachments" in data, + "input_attachment_count": len(entries) if isinstance(raw_attachments, list) else None, + "attachment_entry_shapes": entry_shapes, + "unsupported_attachment_count": unsupported, + "unusable_attachment_path_count": unusable, + "reported_attachments": attachments, + "outside_workspace_attachments_omitted": outside, + "interpretation": "client-reported metadata at this hook, not model compliance or proof of complete context"} + if event == "beforeReadFile" and isinstance(data.get("file_path"), str): + try: + record["observed_read_target"] = Path(data["file_path"]).resolve().relative_to(root).as_posix() + except (ValueError, OSError): + record["outside_or_invalid_read_target_omitted"] = True + prompt = data.get("prompt") + if isinstance(prompt, str): + # Retain only a fixed synthetic case marker, never arbitrary prompt text. + for marker in ("Probe api-only.", "Probe web-only.", "Probe joint.", "Probe root-ts.", "CAPTURE_CONTROL_V2", + "NATIVE_BEHAVIOR_V1 api-only", "NATIVE_BEHAVIOR_V1 web-only", "NATIVE_BEHAVIOR_V1 joint", + "NATIVE_BEHAVIOR_V1 root-ts", "NATIVE_BEHAVIOR_V1 manual-control"): + if marker in prompt: + record["recognized_probe_marker"] = marker + break + for name in ("conversation_id", "session_id"): + if isinstance(data.get(name), str): + record[name + "_sha256"] = hashlib.sha256(data[name].encode()).hexdigest() + with (root / "native-observations.jsonl").open("a", encoding="utf-8") as output: + output.write(json.dumps(record, ensure_ascii=False) + "\n") +except Exception: + # Collection failure must not disrupt the user's client. No raw input/error. + print("Native probe could not retain this observation.", file=sys.stderr) +print(json.dumps(response)) +''' + +RULES = { + "always.mdc": '---\nalwaysApply: true\n---\nUse concise factual answers in this synthetic probe.\n', + "api.mdc": '---\nalwaysApply: false\nglobs: "src/**/*.py"\n---\nPreserve Python function names in this synthetic probe.\n', + "web.mdc": '---\nalwaysApply: false\nglobs: "src/**/*.ts"\n---\nPreserve TypeScript export names in this synthetic probe.\n', + "root-only.mdc": '---\nalwaysApply: false\nglobs: "*.ts"\n---\nPreserve root-level TypeScript filenames in this synthetic probe.\n', +} +CASES = [ + {"id": "api-only", "targets": ["src/api/service.py"], + "prompt": "Probe api-only. Read @src/api/service.py and state its function name. Do not edit files or run shell commands."}, + {"id": "web-only", "targets": ["src/web/app.ts"], + "prompt": "Probe web-only. Read @src/web/app.ts and state its export name. Do not edit files or run shell commands."}, + {"id": "joint", "targets": ["src/api/service.py", "src/web/app.ts"], + "prompt": "Probe joint. Read @src/api/service.py and @src/web/app.ts and state their declared names. Do not edit files or run shell commands."}, + {"id": "root-ts", "targets": ["index.ts"], + "prompt": "Probe root-ts. Read @index.ts and state its export name. Do not edit files or run shell commands."}, +] + + +def main() -> int: + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--output-dir", type=Path, required=True) + parser.add_argument("--python", type=Path, default=Path(sys.executable), + help="Python with the published agent-config-score==0.26.1 installed") + args = parser.parse_args() + root = args.output_dir.absolute() + if root.exists(): + parser.error("requires a new workspace") + python = args.python.absolute() + root.mkdir(parents=True) + files = { + "capture_native.py": HOOK, + "src/api/service.py": "def health():\n return 'ok'\n", + "src/web/app.ts": "export const status = 'ok';\n", + "index.ts": "export const rootStatus = 'ok';\n", + **{f".cursor/rules/{name}": text for name, text in RULES.items()}, + } + command = f'"{python.as_posix()}" -I "{(root / "capture_native.py").as_posix()}"' + hooks = {"version": 1, "hooks": {event: [{"command": command + " " + event}] + for event in ("beforeSubmitPrompt", "beforeReadFile")}} + files[".cursor/hooks.json"] = json.dumps(hooks, indent=2) + "\n" + for name, text in files.items(): + path = root / name + path.parent.mkdir(parents=True, exist_ok=True) + with path.open("x", encoding="utf-8", newline="\n") as output: + output.write(text) + predictions = [] + for case in CASES: + completed = subprocess.run([str(python), "-I", "-X", "utf8", "-m", "agent_config_score.cli", + "scope", str(root), *[arg for name in case["targets"] for arg in ("--target", name)], + "--json"], cwd=root, capture_output=True, encoding="utf-8", timeout=45) + if completed.returncode: + raise ValueError("scope prediction failed; workspace is incomplete") + result = json.loads(completed.stdout) + if result["tool"]["version"] != "0.26.1": + raise ValueError("use the frozen published version") + predictions.append({"case": case, "prediction": result}) + manifest = {"schema_version": 1, "status": "prepared_no_native_observations", + "prepared_at_utc": datetime.now(timezone.utc).isoformat(), + "case_instructions": "Use a fresh chat per case. Attach the listed files explicitly; ensure @ references resolve to file chips. Record client version and any global/team rule settings. No model answer is an attachment oracle. Retain disagreements. Absent rule entries in a hook are unobserved unless completeness is established.", + "input_sha256": {name: hashlib.sha256(text.encode()).hexdigest() for name, text in files.items()}, + "predictions": predictions} + with (root / "probe-manifest.json").open("x", encoding="utf-8") as output: + json.dump(manifest, output, indent=2) + output.write("\n") + print(f"Prepared {len(CASES)} contexts; no native observation or model call has occurred.") + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/scripts/verify_cursor_native_evidence.py b/scripts/verify_cursor_native_evidence.py new file mode 100644 index 0000000..5824b04 --- /dev/null +++ b/scripts/verify_cursor_native_evidence.py @@ -0,0 +1,112 @@ +#!/usr/bin/env python3 +"""Verify retained native evidence offline, without Cursor or a model. + +Integrity and internal agreement do not authenticate screenshots, reviewer +identity, complete context loading, or general accuracy. Disagreements remain +completed observations; exit zero means verification completed, not safety. +""" +from __future__ import annotations + +import argparse +import hashlib +import json +from pathlib import Path, PurePosixPath +import re + + +BASE = Path(__file__).resolve().parents[1] / "benchmarks/cursor-native-v1" +MARKER = re.compile(r"ACS_[A-Z_]+_[0-9a-f]{16}") + + +def load(path: Path) -> dict: + return json.loads(path.read_text(encoding="utf-8")) + + +def member(base: Path, name: str) -> Path: + if (not isinstance(name, str) or "\\" in name or ":" in name + or PurePosixPath(name).is_absolute() or ".." in PurePosixPath(name).parts): + raise ValueError("invalid evidence path") + path = base / name + if not path.resolve().is_relative_to(base.resolve()) or not path.is_file() or path.is_symlink(): + raise ValueError("evidence requires an in-tree regular file") + return path + + +def assess(prepared: dict, observed: dict, events: list[dict]) -> dict: + predictions = {case["id"]: case for case in prepared["cases"]} + markers = prepared["markers"] + cases = observed["cases"] + expected_ids = set(predictions) | {"manual-control"} + if len(cases) != 5 or {case["id"] for case in cases} != expected_ids: + raise ValueError("exactly the registered four contexts and explicit control are required") + if len({case["conversation_id_sha256"] for case in cases}) != len(cases): + raise ValueError("fresh conversations are required") + if len(set(markers.values())) != 4 or any(not MARKER.fullmatch(m) for m in markers.values()): + raise ValueError("four distinct marker keys required") + results = [] + for case in cases: + cid = case["id"] + visible = set(MARKER.findall(case["visible_final_excerpt"])) + if visible != set(case["observed_visible_markers"]): + raise ValueError("transcribed marker set is inconsistent") + session = [e for e in events if e.get("conversation_id_sha256") == case["conversation_id_sha256"]] + if len(session) != case["event_count"]: + raise ValueError("case event count mismatch") + prompts = [e for e in session if e["event"] == "beforeSubmitPrompt"] + if len(prompts) != 1 or prompts[0].get("recognized_probe_marker") != f"NATIVE_BEHAVIOR_V1 {cid}": + raise ValueError("case does not bind to one native prompt event") + reads = sorted(e["observed_read_target"] for e in session if "observed_read_target" in e) + if reads != case["observed_read_targets"]: + raise ValueError("read observation mismatch") + if cid == "manual-control": + expected, targets = {markers["always.mdc"]}, [] + else: + pred = predictions[cid] + expected = {markers[PurePosixPath(r["file"]).name] for r in pred["acs_prediction"]["rules"] + if r["activation"] == "active"} + targets = pred["targets"] + results.append({"id": cid, "visible_marker_set_matches": visible == expected, + "unexpected_observed_reads": sorted(set(reads) - set(targets)), + "complete_transcript_retained": case["complete_transcript_retained"]}) + return {"status": "retained_evidence_verified", "native_cases": len(cases), + "automatic_contexts": len(predictions), + "automatic_visible_marker_set_matches": sum(r["visible_marker_set_matches"] for r in results + if r["id"] != "manual-control"), + "case_results": results, "complete_attachment_fidelity": "unresolved", + "independent_accuracy_established": False, "general_accuracy_percentage": None, + "note": "Offline artifact verification and comparison of assistant-transcribed screenshots; no native rerun, OCR or independent reviewer."} + + +def verify(base: Path) -> dict: + index = load(base / "evidence-index.json") + if not index.get("files"): + raise ValueError("nonempty integrity index required") + for name, expected in index["files"].items(): + if hashlib.sha256(member(base, name).read_bytes()).hexdigest() != expected: + raise ValueError("retained evidence fingerprint mismatch") + prepared, observed = load(base / "prepared-inputs.json"), load(base / "observations.json") + for name, expected in prepared["inputs_sha256"].items(): + if name == ".cursor/hooks.json" and prepared["local_hook_config_not_published"]: + continue + if hashlib.sha256(member(base / "fixture", name).read_bytes()).hexdigest() != expected: + raise ValueError("captured fixture fingerprint mismatch") + for case in observed["cases"]: + member(base, case["screenshot"]) + events = [json.loads(line) for line in (base / "behavior-events.jsonl").read_text(encoding="utf-8").splitlines()] + return assess(prepared, observed, events) + + +def main() -> int: + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--base", type=Path, default=BASE) + args = parser.parse_args() + try: + result = verify(args.base) + except (ValueError, OSError, KeyError) as error: + parser.exit(2, f"native evidence verification failed ({type(error).__name__})\n") + print(json.dumps(result, indent=2)) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/tests/test_cursor_behavior_probe.py b/tests/test_cursor_behavior_probe.py new file mode 100644 index 0000000..10b776b --- /dev/null +++ b/tests/test_cursor_behavior_probe.py @@ -0,0 +1,59 @@ +import importlib.util +import json +from pathlib import Path +import sys +import tempfile +from types import SimpleNamespace +import unittest +from unittest.mock import patch + + +ROOT = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(ROOT / "scripts")) +SPEC = importlib.util.spec_from_file_location("behavior_probe", ROOT / "scripts/prepare_cursor_behavior_probe.py") +PROBE = importlib.util.module_from_spec(SPEC) +SPEC.loader.exec_module(PROBE) + + +class BehaviorPreparationTests(unittest.TestCase): + def prediction(self, source=None): + return SimpleNamespace(returncode=0, stdout=json.dumps({"tool": {"version": "0.26.1", + "source_fingerprint": {"sha256": source or PROBE.FROZEN_SOURCE}}})) + + def test_answer_keys_stay_outside_workspace_and_user_prompts(self): + with tempfile.TemporaryDirectory() as directory: + root, evidence = Path(directory) / "workspace", Path(directory) / "evidence" + with patch.object(PROBE.subprocess, "run", return_value=self.prediction()): + manifest = PROBE.prepare(root, evidence, Path(sys.executable)) + self.assertTrue((evidence / "behavior-manifest.json").is_file()) + self.assertFalse((root / "behavior-manifest.json").exists()) + self.assertEqual(len(set(manifest["markers"].values())), 4) + self.assertEqual(manifest["status"], "prepared_no_native_behavior_results") + for name, marker in manifest["markers"].items(): + self.assertIn(marker, (root / ".cursor/rules" / name).read_text(encoding="utf-8")) + for case in manifest["cases"]: + self.assertNotIn(marker, case["prompt"]) + self.assertNotIn(marker, (root / "src/api/service.py").read_text(encoding="utf-8")) + + def test_nested_evidence_and_existing_inputs_are_refused(self): + with tempfile.TemporaryDirectory() as directory: + root = Path(directory) / "workspace" + with self.assertRaises(ValueError): + PROBE.prepare(root, root / "answers", Path(sys.executable)) + root.mkdir() + (root / "user-file.txt").write_text("preserve", encoding="utf-8") + with self.assertRaises(ValueError): + PROBE.prepare(root, Path(directory) / "evidence", Path(sys.executable)) + self.assertEqual((root / "user-file.txt").read_text(), "preserve") + + def test_different_runtime_source_never_becomes_a_completed_preparation(self): + with tempfile.TemporaryDirectory() as directory: + root, evidence = Path(directory) / "workspace", Path(directory) / "evidence" + with patch.object(PROBE.subprocess, "run", return_value=self.prediction("0" * 64)): + with self.assertRaises(ValueError): + PROBE.prepare(root, evidence, Path(sys.executable)) + self.assertFalse((evidence / "behavior-manifest.json").exists()) + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/test_cursor_native_evidence.py b/tests/test_cursor_native_evidence.py new file mode 100644 index 0000000..2bea248 --- /dev/null +++ b/tests/test_cursor_native_evidence.py @@ -0,0 +1,48 @@ +import copy +import importlib.util +import json +from pathlib import Path +import unittest + + +ROOT = Path(__file__).resolve().parents[1] +SPEC = importlib.util.spec_from_file_location("native_evidence", ROOT / "scripts/verify_cursor_native_evidence.py") +EVIDENCE = importlib.util.module_from_spec(SPEC) +SPEC.loader.exec_module(EVIDENCE) + + +class NativeEvidenceTests(unittest.TestCase): + def inputs(self): + base = EVIDENCE.BASE + return (EVIDENCE.load(base / "prepared-inputs.json"), EVIDENCE.load(base / "observations.json"), + [json.loads(s) for s in (base / "behavior-events.jsonl").read_text(encoding="utf-8").splitlines()]) + + def test_retained_evidence_is_reproducible_without_native_client_or_model(self): + result = EVIDENCE.verify(EVIDENCE.BASE) + self.assertEqual(result["automatic_visible_marker_set_matches"], 4) + self.assertEqual(result["native_cases"], 5) + self.assertFalse(result["independent_accuracy_established"]) + self.assertIsNone(result["general_accuracy_percentage"]) + + def test_nonmatching_behavior_remains_a_completed_observation(self): + prepared, observed, events = self.inputs() + observed = copy.deepcopy(observed) + observed["cases"][0]["visible_final_excerpt"] = "health" + observed["cases"][0]["observed_visible_markers"] = [] + result = EVIDENCE.assess(prepared, observed, events) + self.assertEqual(result["status"], "retained_evidence_verified") + self.assertEqual(result["automatic_visible_marker_set_matches"], 3) + + def test_misattributed_case_and_unreported_extra_marker_are_rejected(self): + for mutation in ("session", "marker"): + prepared, observed, events = self.inputs() + if mutation == "session": + observed["cases"][1]["conversation_id_sha256"] = observed["cases"][0]["conversation_id_sha256"] + else: + observed["cases"][0]["visible_final_excerpt"] += " ACS_FAKE_0000000000000000" + with self.subTest(mutation=mutation), self.assertRaises(ValueError): + EVIDENCE.assess(prepared, observed, events) + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/test_cursor_native_probe.py b/tests/test_cursor_native_probe.py new file mode 100644 index 0000000..d1c1e0f --- /dev/null +++ b/tests/test_cursor_native_probe.py @@ -0,0 +1,68 @@ +import importlib.util +import json +from pathlib import Path +import subprocess +import sys +import tempfile +import unittest + + +ROOT = Path(__file__).resolve().parents[1] +SPEC = importlib.util.spec_from_file_location("prepare_native_probe", ROOT / "scripts/prepare_cursor_native_probe.py") +PROBE = importlib.util.module_from_spec(SPEC) +SPEC.loader.exec_module(PROBE) + + +class NativeCaptureTests(unittest.TestCase): + def run_capture(self, payload, directory): + script = Path(directory) / "capture.py" + script.write_text(PROBE.HOOK, encoding="utf-8") + result = subprocess.run([sys.executable, "-I", "-X", "utf8", str(script), "beforeSubmitPrompt"], + input=json.dumps(payload), capture_output=True, encoding="utf-8", timeout=10) + self.assertEqual(result.returncode, 0) + self.assertEqual(json.loads(result.stdout), {"continue": True}) + path = Path(directory) / "native-observations.jsonl" + return json.loads(path.read_text(encoding="utf-8")) if path.exists() else None + + def test_observation_records_structure_without_prompt_email_or_contents(self): + with tempfile.TemporaryDirectory() as directory: + result = self.run_capture({"prompt": "CAPTURE_CONTROL_V2 secret-sentinel", + "user_email": "private-sentinel@example.org", "content": "private-file-sentinel", + "attachments": [{"type": "rule", "file_path": str(Path(directory) / "always.mdc"), + "content": "private-rule-sentinel"}]}, directory) + self.assertEqual(result["input_attachment_count"], 1) + self.assertEqual(result["reported_attachments"], [{"type": "rule", "path": "always.mdc"}]) + self.assertEqual(result["recognized_probe_marker"], "CAPTURE_CONTROL_V2") + encoded = json.dumps(result) + self.assertNotIn("sentinel", encoded) + self.assertNotIn(directory, encoded) + + def test_empty_missing_and_malformed_attachment_fields_are_distinguished(self): + for payload, present, count in (({}, False, None), ({"attachments": []}, True, 0), + ({"attachments": None}, True, None), ({"attachments": {}}, True, None)): + with self.subTest(payload=payload), tempfile.TemporaryDirectory() as directory: + result = self.run_capture(payload, directory) + self.assertEqual(result["attachments_field_present"], present) + self.assertEqual(result["input_attachment_count"], count) + + def test_filtered_entries_are_counted_without_leaking_their_values(self): + with tempfile.TemporaryDirectory() as directory: + result = self.run_capture({"attachments": [ + {"type": "unknown-private-sentinel", "filePath": "private-sentinel"}, + {"type": "rule", "filePath": "private-sentinel"}, + {"type": "file", "file_path": str(Path(directory).parent / "outside-private-sentinel")}, + ]}, directory) + self.assertEqual(result["input_attachment_count"], 3) + self.assertEqual(result["unsupported_attachment_count"], 1) + self.assertEqual(result["unusable_attachment_path_count"], 1) + self.assertEqual(result["outside_workspace_attachments_omitted"], 1) + self.assertEqual(result["reported_attachments"], []) + self.assertNotIn("sentinel", json.dumps(result)) + + def test_non_object_input_is_not_a_successful_observation(self): + with tempfile.TemporaryDirectory() as directory: + self.assertIsNone(self.run_capture(["private-sentinel"], directory)) + + +if __name__ == "__main__": + unittest.main()