From 2686890508b22f0a9ae3f703040cb08264175b1e Mon Sep 17 00:00:00 2001 From: Zhibo Lin <147509942+LE0-Lin@users.noreply.github.com> Date: Thu, 19 Nov 2026 06:41:39 +0800 Subject: [PATCH 1/2] Tighten core documentation and remove repetitive boilerplate --- README.simplified.md | 4 +- README.traditional.md | 4 +- docs/architecture.md | 90 +++--- docs/limitations.md | 541 ++++++++++---------------------- docs/maintainer-workflow.md | 169 ++++------ docs/simplified/limitations.md | 147 +++------ docs/simplified/user-guide.md | 117 +++---- docs/traditional/limitations.md | 147 +++------ docs/traditional/user-guide.md | 121 +++---- docs/user-guide.md | 315 +++++++------------ 10 files changed, 556 insertions(+), 1099 deletions(-) diff --git a/README.simplified.md b/README.simplified.md index d10efad..8d2f012 100644 --- a/README.simplified.md +++ b/README.simplified.md @@ -1,7 +1,5 @@ # AgentConfigScore -[真实文档案例](docs/path-case-study.md):生成文件误报的修复、目录检查的新增覆盖,以及真实文档复跑如何拦住一次新误报。新路径逻辑已纳入 v0.26.2,报告保留修复前后的证据。 - [English](README.md) | 简体中文 | [繁體中文](README.traditional.md) @@ -39,7 +37,7 @@ AgentConfigScore 检查 `AGENTS.md`、`CLAUDE.md`、Cursor、Copilot、Gemini ![工作流程图,展示仓库初始化、基线回归检查与报告留存](https://raw.githubusercontent.com/LE0-Lin/AgentConfigScore/main/assets/agent-config-score-workflow.svg?v=0.24.0) -它是确定性检查器,不是 AI 评委。**A 100 只表示没有命中生效的规则,不表示指令有用、语义完美或安全无误。** 中文文档也不意味着检测器已经能够理解任意中文指令。 +它是确定性静态检查器,不是 AI 评委。**A 100 只表示没有命中生效规则,不代表指令有用或绝对安全**(中文文档也不代表规则能理解任意中文语义)。另见[真实文档路径案例(英文)](docs/path-case-study.md)。 diff --git a/README.traditional.md b/README.traditional.md index 16298f6..1e76da9 100644 --- a/README.traditional.md +++ b/README.traditional.md @@ -1,7 +1,5 @@ # AgentConfigScore -[真實文件案例](docs/path-case-study.md):產生檔案誤報的修復、目錄檢查的新增涵蓋,以及真實文件重跑如何攔下一次新誤報。新路徑邏輯已納入 v0.26.2,報告保留修復前後的證據。 - [English](README.md) | [简体中文](README.simplified.md) | 繁體中文 @@ -39,7 +37,7 @@ AgentConfigScore 檢查 `AGENTS.md`、`CLAUDE.md`、Cursor、Copilot、Gemini ![工作流程圖,展示儲存庫初始化、基準回歸檢查與報告保存](https://raw.githubusercontent.com/LE0-Lin/AgentConfigScore/main/assets/agent-config-score-workflow.svg?v=0.24.0) -它是確定性的檢查工具,不是 AI 評審。**A 100 只表示沒有命中生效的規則,不代表指令實用、語意完美或完全安全。** 提供中文文件也不表示檢查工具已經能理解任意中文指令。 +它是確定性靜態檢查器,不是 AI 評審。**A 100 只表示沒有命中生效規則,不代表指令有用或絕對安全**(中文文件也不代表規則能理解任意中文語意)。另見[真實文件路徑案例(英文)](docs/path-case-study.md)。 diff --git a/docs/architecture.md b/docs/architecture.md index 4347960..2217753 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -1,60 +1,54 @@ -# Design and shipped product boundary +# Architecture and scope -AgentConfigScore ships a dependency-free Python CLI and GitHub Action for local -instruction lint and deterministic change review. A complete supported journey -is installation, safe setup, a baseline comparison, source-located findings, -reviewed correction or audited exception, rerun and retained CI evidence. +AgentConfigScore is a dependency-free Python CLI and GitHub Action for local +instruction linting and deterministic PR regression checks. ```mermaid flowchart LR A[Selected repository trees] --> B[Discovery and source validation] B --> C[Captured instruction text] C --> D[Rule findings and baseline-governed score gate] - C --> E[Optional bounded Cursor attachment model] - E --> F[Same-task or independent-file comparisons] + C --> E[Optional Cursor attachment model] + E --> F[Declared-context or per-file comparisons] D --> G[CLI decision and review evidence] F --> G G --> H[JSON / Markdown / CI summary / artifacts] ``` -## Decisions that matter - -- **Baseline ownership.** Normal score comparisons apply the reviewed baseline - policy and suppression set to both trees. A candidate cannot use its own - weaker threshold or new exception to authorize that same change. Explicit - CLI/Action overrides and workflow/tool revisions remain caller trust boundaries. -- **Captured source.** Instruction text that produced a scan is reused for its - regression checks. Cursor sources are captured once per side and evaluated - repeatedly without reopening each rule for each target. Filesystem checks - reduce accidental boundary violations while requiring stable trees. -- **Two context questions.** A declared multi-file task can retain a rule through - any matching file. Per-file coverage independently evaluates each selected - existing name and can reveal an API-only loss. This does not infer a user's - real task or establish native attachment. -- **Explicit uncertainty.** Manual/model loading, unsupported metadata and - opaque potentially active bodies stay unknown. Unknowns have a separate review - flag. An empty recognized baseline protects zero identities and stays visible. -- **Reproducible decisions.** Stable rule IDs, input/source identities, original - line evidence and typed exit behavior make specified decisions reviewable. - Scores describe active rule matches. Tool fingerprints identify covered - source bytes and do not authenticate a whole execution environment. - -## Product acceptance - -| Surface | Shipped behavior | Acceptance evidence | -| --- | --- | --- | -| Installation | Wheel, source distribution, two aliases and module entrypoint | Isolated installed acceptance on three operating systems | -| Setup | Dry run, conflict refusal, idempotence, explicit overwrite and workflow-only scope | Disposable repositories and input-byte preservation checks | -| Review | Scored regressions plus opt-in unscored coverage, with source locations | Positive, repair, rename, unchanged and unknown controls | -| CI | Ordinary gate plus optional strict coverage, summaries and retained reports | Actual composite Action on disposable Git fixtures | -| Failure handling | Operational failures use exit `2`, without successful coverage evidence | Empty/invalid/unreadable inputs and report-write failures | -| Recovery | Documented policy migration, history recovery and audited exceptions | Core guides, installed checks and explicit compatibility notes | - -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. +## Core design decisions + +- **Baseline ownership:** `diff` and `compare` apply the baseline repository's + policy and suppressions to both trees. A candidate PR cannot lower its own + threshold or suppress its own new errors. Explicit CLI/Action overrides remain + caller-owned. +- **Captured source:** instruction text read during a scan is reused for + regression checks (`instruction-file-removed`, `directive-polarity-flip`), and + Cursor rules are parsed once per tree rather than reopened per target file. +- **Two Cursor context views:** `scope compare`/`diff` evaluates a declared + multi-file task context; `scope coverage` evaluates each inventoried regular + file independently so an API-only rule loss is not masked by a matching + frontend file. +- **Explicit uncertainty:** manual/model-selected rules, unsupported metadata, + and uninterpreted rule bodies stay `unknown` rather than being treated as + clean. +- **Reproducible decisions:** stable rule IDs, source-line locations, typed exit + codes (`0` pass, `1` gate failed, `2` operational failure), and tool source + fingerprints make CI decisions auditable. + +## Shipped surfaces and verification + +| Surface | Shipped behavior | Verification | +|---|---|---| +| Packaging | Wheel, sdist, `agent-config-score`, `acs`, and `python -m agent_config_score` | Installed-package acceptance on Linux, Windows, and macOS | +| Setup | `init` with dry-run, conflict refusal, idempotence, `--force`, and `--workflow-only` | Disposable repo tests and input-byte preservation checks | +| Review | Scored regressions plus opt-in unscored Cursor coverage with source lines | Positive, repair, rename, unchanged, and unknown controls | +| CI | Read-only Action gate, optional PR comment recipe, summaries, and artifacts | Composite Action tests on disposable Git fixtures | +| Failure handling | Operational errors exit `2` without emitting a success report | Invalid/unreadable inputs and report-write failure tests | + +## Out of scope + +Runtime agent enforcement, native Cursor attachment observation, arbitrary-prose +semantics, and independent real-world accuracy benchmarks are outside the +shipped static CLI contract. See the separate +[native Cursor smoke report](../benchmarks/cursor-native-v1/README.md) and +[limitations](limitations.md) for details. diff --git a/docs/limitations.md b/docs/limitations.md index eaed09e..b9995d9 100644 --- a/docs/limitations.md +++ b/docs/limitations.md @@ -2,396 +2,189 @@ English | [简体中文](simplified/limitations.md) | [繁體中文](traditional/limitations.md) -AgentConfigScore is a deterministic linter and regression gate for persistent -coding-agent instructions. Its score measures detected, rule-defined risks. It -does not measure whether an AI agent is intelligent, whether a prompt will solve -a task, or whether an instruction file is generally “good.” - -**An A 100 result means that no active deterministic rule matched. It is not a -semantic quality certification.** - -v0.24.0+ includes [tool source identity](report-identity.md) to -distinguish implementations that declare the same version. A matching digest is -not an accuracy result or a reproducibility guarantee: repository inputs, policy, -runtime and filesystem behavior are outside that fingerprint. Missing source is -explicitly unknown, and historic reports are not relabelled. - -## Configuration decoding - -v0.25.0+ builds reject duplicate decoded JSON member names at every -configuration depth, non-standard `NaN`/`Infinity` constants and a Boolean format -`version`. They do not choose the first or last repeated value. Both comparison -trees must validate; CLI threshold overrides cannot authorize malformed config. -`doctor` uses one read for policy and schema metadata. These changes are included from -v0.25.0. See [failure and compatibility details](doctor.md#configuration-decoding). -The check does not validate policy adequacy, authenticate config authors, provide -an atomic snapshot or recover names already lost by a caller's JSON decoder. - -v0.25.0+ config-source checks also distinguish absent files from dangling -links. Config must resolve to a regular file inside the selected repository root; -internal file links and explicit root aliases remain supported. External/cyclic/ -nonregular/unreadable sources fail rather than using defaults. Both Git worktrees -must satisfy the boundary independently. This is not atomic against concurrent -path replacement, and hard-link/mount identity is not certified. Workflow-only -setup and unscored guardrails remain separate from policy validation. See -[compatibility and migration](doctor.md#configuration-file-boundary). - -## Local history integrity - -v0.25.0+ builds distinguish an absent local history index from damaged -or unreadable data. Invalid history returns operational exit `2`, not an empty -success report. The Python append helper refuses to reset it and uses a complete -same-directory replacement instead of truncating existing bytes. Partial legacy -snapshots remain supported; missing scores are unknown. Linked/reparse history -paths require manual migration. These changes are included from v0.25.0. - -History validation is not evidence authenticity, policy/tool comparability or -semantic quality. The append helper needs serialized writers and does not claim -locking, a hostile-filesystem transaction or power-loss durability. Normal scans -do not automatically record local snapshots; immutable CI artifacts are separate. -See [recovery, retention and metadata limits](score-history-cli.md). - -## Instruction-file filesystem boundary +AgentConfigScore is a deterministic linter and regression gate for coding-agent +instruction files. Its score reflects matches against a fixed rule catalog. It +does not measure model intelligence, task success, or overall prompt quality. + +**An A 100 means no active rule matched. It is not a semantic quality or safety +certification.** + +A few general boundaries apply across the whole tool: + +- **Static, local analysis:** ACS never calls an AI model, fetches URLs, or + executes commands found in instruction files. +- **Not a filesystem sandbox:** source, config, and path checks catch broken + links and out-of-root escapes on a stable checkout, but are not atomic + against concurrent writes or hostile filesystems. +- **Provenance:** reports include the tool version and source SHA-256 + fingerprint ([report identity](report-identity.md)) to identify the build, not + to certify inputs or accuracy. + +## What can still score A 100 + +Any file that avoids the active deterministic rules can score 100, including: + +- vague or unhelpful instructions (for example, `"Do a good job."`); +- harmful intent phrased without a recognized dangerous command or prose form; +- paraphrased contradictions whose directive bodies do not match exactly; +- destructive tools or shell forms outside the rule catalog; +- syntactically clean instructions that do not match the actual repository. + +We intentionally avoid awarding keyword-based “best practice” points, which are +easy to game. Broader semantic review belongs in a separately evaluated +model-assisted workflow. + +## Configuration, history, and filesystem boundaries + +- **Strict JSON config:** `.agentconfigscore.json` rejects duplicate keys at any + depth, `NaN`/`Infinity`, and Boolean `version`. It must resolve to a regular + file inside the repository root; dangling, cyclic, external, or unreadable + configs fail with exit `2` (`doctor` exits `1`) instead of falling back to + defaults ([doctor](doctor.md#configuration-decoding)). +- **Local score history:** `history` treats a damaged or unreadable index as + exit `2` rather than an empty success. The append helper replaces the file + instead of truncating it, and expects serialized writers + ([score history](score-history-cli.md)). + +### Instruction-file filesystem boundary Selected instruction files and `.agentconfigscoreignore` must resolve to regular -files inside the resolved scan root. Internal file symlinks remain supported; -findings, Markdown links and instruction scopes use the discovered alias's -repository-relative location, not the shared target's directory. An explicitly -supplied root alias is allowed and defines the resolved boundary. - -Discovery does not descend through child directory symlinks or Windows junctions, -even when their targets are internal. Excluded dependency/build trees and -subtrees covered by an ignore pattern ending in `/**` are pruned before descent. -Other ignore patterns retain their filename-matching meaning. A source explicitly -excluded from discovery is not inspected and has no coverage claim. - -Selected external, dangling, cyclic or non-regular file sources fail before their -contents are opened. Sources are revalidated before reading, and the resolved -target is opened. Failed discovery, resolution or instruction-content reads are -operational errors: scan/compare/feedback return `2` without a successful score or -new success report. `doctor` checks source readability and reports an `instructions` -error with exit `1`. Raw target paths and filesystem error details are not echoed -in these source diagnostics. Legacy `read-error` remains in the catalog for old -report/suppression compatibility, but cannot suppress a current operational failure. - -This is **not a filesystem sandbox or an atomic snapshot**. A concurrent process -can still replace parents or targets between validation and open. Hard-link -identity and mount boundaries are not certified. Other explicitly chosen inputs, -configuration/workflow readers and report destinations are separate interfaces; -this guard does not claim to constrain every filesystem operation in the tool. -Non-instruction link cycles are excluded from the path index, not judged safe or -semantically correct. Keep repositories stable while scanning. - -## Cursor file-context profile (v0.25.0+) - -The v0.25.0+ [per-file coverage](cursor-coverage.md) enumerates filtered regular -file names from both trees and checks each independently. It shares the profile's -recognition/activation limits and supplies no native Cursor observation. Inventory -exclusions, file lifecycle, empty selections and resource limits remain explicit. - -The opt-in `scope` command predicts automatic rule attachment from declared file -paths for root `.cursor/rules/`. It is unscored and does not observe Cursor, -validate target existence, resolve other formats/precedence or change normal -scan/regression findings. Inactive means not triggered under this profile; -manual/model selection, unsupported metadata and runtime settings remain -unobserved. Disjoint globs can co-activate in a multi-file task. - -Bounded English opposing-directive pairs are review signals with source lines, -not semantic-conflict proofs. Uninterpreted bodies and unknown activation stay -visible; no signals is not a clean bill of health. Completed advisory analysis -returns `0` even with signals; input/read/limit errors use `2`. Whole-repository -supported-source preflight still applies. See the [grammar, report and limits](cursor-scope.md). -The v0.25.0+ [comparison commands](cursor-scope-impact.md) additionally compare -the same declared context across trees/a local Git baseline. File lifecycle and -trigger losses are distinct from loss of aggregated exact recognized directives; -another active copy or remaining trigger may retain availability. Opt-in -caller-owned flags gate known recognition losses and unknowns separately with -exit `1`; default comparisons remain advisory. Neither semantic paraphrase -equivalence, arbitrary scope narrowing nor runtime compliance is established. -An unrecognized/empty baseline protects zero identities. These additions are available from v0.25.0 and remain separate from the -existing baseline score-policy schema. +files inside the scan root. Internal file symlinks are supported (findings and +relative links use the discovered alias's location). Discovery does not descend +into child directory symlinks or Windows junctions, and prunes excluded +dependency/build trees and `/**` ignore subtrees before descent. + +Dangling, cyclic, external, non-regular, or unreadable selected sources abort +scans, `compare`, and `feedback` with exit `2` (`doctor` reports an +`instructions` error and exits `1`) without echoing raw target paths. Legacy +`read-error` remains in the catalog only for historical report/suppression +compatibility. ## Command interpretation -The `rm-rf`, `git-clean-force`, and `docker-system-prune` rules tokenize bounded -shell fragments before interpreting options. They recognize reordered, split, -and long options, explicit line continuations, and quoted option values. Shell -separators and `--` stop option interpretation. Git preview/interactive modes -are excluded; for `rm`, a later interactive option overrides force. An option -used as an exclusion/filter value is not treated as an execution flag. - -This is a conservative command grammar: options after ordinary operands, -shell variable expansion, aliases, wrapper functions, and global options before -subcommands are not resolved. Fragments are limited to 1,000 characters. Only -explicit backslash continuations span lines. Other command rules still use -narrow patterns. English prohibitions are scoped conservatively; arbitrary -prose and other languages need human review. - -The scanner also builds a shared, source-positioned document context once per -file. A narrowly recognized English prohibition can cover an immediately adjacent -closed fence or a contiguous list of direct command entries. This is not a full -Markdown parser or an intent classifier: unlabeled code remains active for -dangerous-command rules, unclosed fences do not inherit prohibitions, and literal -credentials are checked independently. See the supported grammar and safety -boundaries in [instruction context](instruction-context.md). - -Option behavior is checked against the [Git clean manual](https://git-scm.com/docs/git-clean), +`rm-rf`, `git-clean-force`, and `docker-system-prune` tokenize bounded shell +fragments (up to 1,000 characters, supporting reordered/split/long flags, +backslash line continuations, and quoted option values) and stop at shell +separators or `--`. Git dry-run/interactive modes are excluded, a later +interactive flag overrides `rm -f`, and filter/exclude values are not treated as +flags. Options after ordinary operands, shell variables, aliases, wrappers, and +global options before subcommands are not resolved. + +A shared document-context pass lets narrowly recognized prohibition labels cover +an immediately adjacent closed code fence or contiguous command list. Unlabeled +code remains active, unclosed fences do not inherit prohibitions, and literal +credentials are always checked independently +([instruction context](instruction-context.md)). + +Option semantics follow the [Git clean manual](https://git-scm.com/docs/git-clean), [GNU rm manual](https://www.gnu.org/software/coreutils/manual/html_node/rm-invocation.html), and [Docker prune reference](https://docs.docker.com/reference/cli/docker/system/prune/). ## Prompt-injection warnings -The `prompt-injection-override` warning recognizes explicit English phrases such -as `ignore previous instructions`. A match is a review signal, not proof of an -attack. Explicit prohibitions and whole-line examples such as -`Attack example: "ignore previous instructions"` are excluded. Quotes or code -fences alone do not exempt a phrase. An explicit adjacent prohibition such as -`Do not follow these instructions:` can also cover a closed instruction block. -More elaborate educational examples can -still trigger warnings; use a reasoned suppression after review. This rule does -not detect arbitrary paraphrases, other languages, or instructions delivered at -runtime through tool output or remote content. - -## Verification reporting - -The `false-success-report` error requires a complete English prose clause that -explicitly conceals errors while reporting success, or claims tests passed -despite failure or without running them. Merely skipping tests, prohibitions, -and quoted/code examples are not enough. It does not combine evidence across -sentences or lines, inspect actual test execution, or judge arbitrary workflow -intent. Other harmful prose can still pass. See the [supported grammar and -negative controls](verification-reporting.md). - -v0.27.0+ additionally recognizes finite Simplified/Traditional Chinese -false-passing claims and explicit [deletion approval bypass](deletion-approval-bypass.md) -directives in English and Chinese. The former requires explicit failed/unrun -tests and a passing claim; the latter requires a destructive target and an -attached approval exemption. Neither infers missing rules from silence or -generalizes to arbitrary prose, language variants, live authorization or runtime -behavior. These additions require v0.27.0+. - -## Bulk environment transfers - -The `broad-environment-upload` warning requires an explicit transfer action, -a full environment-variable source, and a network sink in one English prose -clause. Names-only metadata, qualified redaction, logs, prohibitions, and code -examples do not satisfy this grammar. The scanner does not examine the process -environment, verify sanitization, resolve destinations, or prove malicious -intent. Literal loopback is excluded without analyzing forwarding. Shell uploads, -other languages, and arbitrary paraphrases remain unsupported. See the -[supported evidence and deliberate limits](environment-upload.md). +`prompt-injection-override` flags explicit English override phrases such as +`ignore previous instructions`. Explicit prohibitions, whole-line labeled +examples (`Attack example: "ignore previous instructions"`), and adjacent +prohibited instruction blocks are excluded; quotes or code fences alone are not. +More elaborate educational examples can still trigger warnings—review and add a +reasoned suppression if needed. Arbitrary paraphrases, other languages, and +runtime tool-output injections are out of scope. + +## Prose safety rules + +- **`false-success-report`:** requires a single-sentence English directive to + conceal errors while reporting success, or an English or Simplified/Traditional + Chinese directive claiming tests passed despite failure or without running + them. Prohibitions, quotes, code examples, and merely skipping tests do not + trigger it ([verification reporting](verification-reporting.md)). +- **`deletion-approval-bypass`:** requires an explicit English or Chinese prose + directive combining deletion of a production database or existing/user files + with an attached approval bypass. Authorized or disposable cleanup, + prohibitions, and examples stay distinct + ([deletion approval bypass](deletion-approval-bypass.md)). +- **`broad-environment-upload`:** requires a transfer verb, full environment + source, and non-loopback network destination in one English clause. Names-only + metadata, redaction, logs, prohibitions, and code examples are excluded + ([environment upload](environment-upload.md)). + +None of these rules combine evidence across sentences, inspect runtime behavior, +or catch arbitrary paraphrases. ## Local Markdown links -Simple inline links and image destinations are checked relative to the instruction -file's directory. For example, `[Guide](../CONTRIBUTING.md#setup)` checks that the -file exists inside the repository; it does not validate the `setup` heading. -URL-encoded spaces and angle-bracket destinations are supported. Remote links, -anchor-only links, fenced examples, absolute paths, and paths escaping the -repository are skipped. Nested parentheses in inline link destinations are not -currently parsed. This is a limited link check, not a full Markdown validator. - -v0.27.0+ also excludes inline-link syntax inside matched backtick code -spans, including multiline spans, and links with an escaped opening bracket. -Real links next to code and links containing code only in their labels stay -active. An unclosed backtick does not turn the rest of the document into an -example. These exclusions do not apply to ordinary backtick path literals or -independent command/credential rules. This correction requires v0.27.0+. - -v0.25.0+ builds additionally check simple full `[Guide][setup]` and -collapsed `[setup][]` reference links, including images, when a matching -single-line definition such as `[setup]: GUIDE.md` exists in the same instruction -file. Paths stay document-relative; a missing used target is reported once at -its definition line. Labels use Unicode case folding and ASCII whitespace -normalization; the first matching definition wins, including external/anchor -targets. This follows the relevant [CommonMark reference-link conventions](https://spec.commonmark.org/0.31.2/#reference-link), -not full parser conformance. Unused supported definitions and resolved captions -are not separately treated as prose paths. These changes are included from v0.25.0. - -This subset accepts at most 999 label characters without escapes/nested brackets, -zero to three spaces before top-level definitions, bare/angle destinations and -optional single-line quoted/parenthesized titles. Definitions must start a block -or follow another supported definition; they cannot interrupt a paragraph. -Fenced/indented code, escaped links and matched inline code do not activate new -reference checks. Shortcut `[setup]`, multiline definitions/labels, container -definitions, escaped or parenthesized destinations and HTML-like layouts need -manual review. Unknown first definitions do not select later duplicates. Inline -code recognition is conservative, not a complete block parser; unsupported forms -may remain unchecked. Existing inline/prose checks and independent danger rules -still run; reference handling does not exempt commands or certify file contents. +Inline links, images, and simple full/collapsed reference links (`[Guide][ref]`, +`[ref][]` with a same-file single-line definition) are resolved relative to the +instruction file's directory. URL-encoded spaces and angle-bracket destinations +are supported; fragment headings are not validated. Remote links, anchor-only +links, fenced/indented code, matched inline code spans, escaped opening +brackets, absolute paths, and out-of-root paths are skipped. Shortcut reference +links (`[ref]`), multiline definitions, container definitions, nested +parentheses, and HTML layouts are left to manual review. ## Plain prose path references -Backtick file references starting with `./` or `../` are checked against the -repository root and applicable instruction-directory bases. Nested AGENTS-family -files retain their in-repository ancestor interpretations; other formats also -accept an explicit document-relative reference. These paths cannot pass merely -because an unrelated package has a matching suffix. Significant leading dots, -such as `.github`, are preserved. If no interpretation stays inside the repository, -the reference is skipped rather than probed outside or substituted with an -indexed path. Actual Markdown links remain strictly document-relative. - -Unprefixed prose still uses conservative package-relative suffix matching. -Neither mode infers the working directory of a described command, follows `cd` -instructions, or proves which interpretation the author intended. - -File-like prose references are heuristic, not a complete natural-language path -resolver. An immediate, closed `(if exists)` or `(if it exists)` condition makes -only that prose reference optional; Markdown link destinations remain checked. -An explanatory suffix after `-` or `:` inside that condition is supported. -Unclosed conditions, distant optionality words and unrelated paths on the same -line do not receive this exemption. - -Two-component slugs such as `owner/tool.js` are excluded only in narrow, -same-line repository roles: followed by `repository`/`remote` and punctuation, -or after `merge target is`, `fork of`, `re-pushed to a branch in`, or -`CI trusts branches inside`. A repeated same-slug `fork of ... and not ... itself` -form is also recognized. Merely mentioning GitHub or a repository does not -exempt local paths. Other paraphrases and languages may still be misclassified. - -A complete same-line declaration such as `` `docs/out.json` is generated by -`make docs` `` or `` `docs/out.json` is generated from `src/schema.ts`. `` exempts -only the output prose reference from an existence warning. `regenerated` and -`rewritten` are also recognized. The producer must be a closed, single-backtick -span; an optional short parenthesized note may follow it. Negated, conditional, -unfinished or extended clauses remain checked. The generator's own file path -and actual Markdown link destinations remain checked. This recognizes a declared -output role; it does not verify the producer, build the artifact, or establish -that the declaration is truthful. Command and credential rules remain active. - -Single-backtick directory references with an explicit `./` or `../` prefix and -a trailing `/`, such as `./packages/` and `../src/`, require a real directory under the repository root or an applicable -instruction-scope base. A regular file cannot satisfy them. Directory references -do not use the ambiguous package-suffix fallback. Unquoted directory prose and -unprefixed names such as `packages/` and extensionless names without a trailing -slash, such as `test/unit`, remain outside this heuristic; use an explicit -relative prefix and trailing slash or a Markdown link when an -existence check is intended. Branch prefixes, URLs, placeholders and out-of-root -paths remain excluded. These checks do not infer working-directory changes. -This avoids guessing whether unprefixed names denote package exports or -install/build outputs. `./dist/` and `./packages/client/dist/` opt into a -concrete existence check. - -Package-relative suffix lookup includes existing paths under `build`, `dist`, -`target` and `.next`; instruction discovery still skips those trees. Dependency -and administration trees remain excluded from the suffix index, directory -symlinks are not traversed, and external/broken symlink entries are excluded. -Existence does not establish that a file is authoritative, generated correctly, -or intended by an ambiguous reference. Generated/untracked files without one of -the bounded output declarations can still be reported missing; filesystem case behavior remains -host-dependent. These exemptions do not disable command or credential checks. - -Directory traversal errors while building the index stop the scan with an -operational error, not a partial clean report or inferred missing path. CLI scan, -compare and feedback return exit `2` without a success report; `doctor` exposes -an error check named `repository-paths` and returns `1`. Dependency/admin trees -excluded from the index remain pruned. This is a local filesystem check, not a -Git-tracked-only index or an atomic filesystem snapshot. - -## Red-team audit - -The project added the following adversarial cases after testing the v0.18.0 -scanner against empty, misleading, and deliberately weakened instructions. - -| Case | v0.18.0 behavior | Hardened behavior | -|---|---|---| -| Repository has no supported instruction file | A 100 | `no-config` error; below A | -| Supported instruction file is empty | A 100 | `empty-instructions` error; below A | -| An active error has a small numeric penalty | Could still display A | Active errors cap the result below A | -| `Must X` and `Must not X` appear together | Missed | `contradiction` error | -| A prohibition-like double negative precedes a dangerous command | Dangerous command could be hidden | Dangerous command remains active | -| Candidate deletes an instruction file | Could report no regression | `instruction-file-removed` error | -| Candidate changes `Always X` to `Never X` | Could report no regression | `directive-polarity-flip` error | - -Each hardened case has an automated regression test. In v0.24.0+, -only one-to-one, nonempty exact decoded-text moves to newly added supported files -in the same directory are exempt from removal. Existing copies, cross-directory -moves and whitespace-folded lookalikes are not exemptions. This does not certify -equivalent agent/format/scope behavior. Baseline-owned suppressions can document -an intentional exception. See [regression coverage](regression-coverage.md). - -v0.24.0+ comparisons also reuse each scan's captured instruction text rather -than reopening sources and silently skipping second-read failures. Initial read -failures still stop the check; raw captured text is not retained in public report -objects or exports. This is not an atomic snapshot or concurrent-change detector. -Regression-only errors can coexist with two standalone `100` scores; enable the -baseline's `fail_on_new_errors` policy or `--fail-on-new-errors` to block them. -The bare CLI's score-only compatibility default is unchanged. - -## Known blind spots - -v0.24.0+ `--explain` output and the [maintainer checklist](best-practices.md) -give static review guidance, not new detection coverage or an automatic fix. -They do not execute referenced commands, infer replacement paths, change score -arithmetic or certify safety. Optional `init --pr-comment` generates a workflow -with explicit write permissions; it posts nothing itself and keeps the default -generated workflow's GitHub permissions read-only. See the [maintainer workflow](maintainer-workflow.md). -v0.24.0+ `init --workflow-only` leaves policy outside its read/write scope, -including under `--force`; it does not validate that policy. Selected linked, -reparse, shared or non-file initialization targets require manual setup. Exclusive -creation and opened-file checks reduce accidental writes, not all filesystem -races; initialization is not an atomic transaction and failed writes may leave -partial selected targets. Generated `@v0` is not necessarily the local CLI source. - -The optional v0.24.0+ [guardrail completion command](guardrail-suggestions.md) -does not add keyword-based quality points. It checks only narrow deletion-policy -phrases in one selected file, offers a preview and requires content-bound -confirmation to append. Unrecognized text is review-needed, not proof of missing -safety; recognized wording is neither complete coverage nor enforcement. External -permissions, inheritance and arbitrary language semantics are outside this check. -Initial previews are read-only; append is explicitly requested, not an atomic -transaction, and may fail partially. Existing scoring and CI gates are unchanged. -Explicit example headings exclude their section; an open example section at EOF -requires manual merging. HTML-like tags disable policy interpretation for the -whole selected file. Narrow approval-bypass directives also require manual -resolution even alongside recognized protection; they are unscored review -signals, not complete conflict detection or evidence of actual agent behavior. - -v0.25.0+ builds scope explicit guardrail selection without whole-tree -discovery. Only relevant ignore rules and the selected ancestry/parent names are -inspected for selection; unselected broken/external/nonregular instruction files -are not validated or repaired. Directory aliases/reparse ancestors and ambiguous -directory casing require manual integration. This does not change full scans or -doctor: an unsafe source elsewhere still stops the whole-tree check. Selected -review/append success is not a clean repository result. This refinement is not -in v0.24.0; confirmation and non-atomic append boundaries remain unchanged. - -The scanner intentionally does not claim to understand arbitrary prose. These -inputs can still receive A 100 when they avoid every known deterministic rule: - -- vague or useless instructions; -- harmful intent written without a recognized dangerous command; -- paraphrased contradictions whose directive bodies are not equivalent text; -- destructive tools and command forms that are not in the rule catalog; -- instructions that are syntactically valid but poorly matched to the repository. - -Keyword-based “best practice” points are not added to hide these limitations; -they would be easy to game by copying phrases into a file. Broader semantic -judgment requires a separately evaluated model-assisted mode and a labeled -corpus, not a stronger marketing claim for the deterministic score. - -The offline [Adversarial Benchmark v1](../benchmarks/adversarial-v1-report.md) -keeps both sides visible: 474/474 maintained deterministic contracts currently -match, while 6/8 labeled challenges are detected. The two remaining misses are -semantic cases. Fixing already-known false-reporting and environment-upload cases is development -progress, not an independent accuracy estimate. -The contract figure is a regression guarantee for a closed fixture suite, not a -real-world accuracy estimate. - -There is also no completed independent comparison against direct AI review. -The [blinded review-comparison workflow](review-comparison.md) supports imported -model responses and held-out dataset declarations, but its bundled fixtures -are known synthetic calibration data with provisional labels. Missing answers -remain unreviewed, unresolved reference labels are excluded explicitly, and -unperformed AI runs are never presented as successful measurements. +- **Explicit relative paths (`./`, `../`):** checked against the repository root + and applicable instruction-directory bases (nested `AGENTS` files also check + in-repository ancestors). They never pass via an unrelated package suffix. + Single-backtick directories with `./` or `../` and a trailing `/` require a + real directory; unprefixed names (`packages/`, `dist/`, `test/unit`) are not + guessed. +- **Unprefixed file paths:** use conservative package-relative suffix lookup + across the repository (including existing files under `build`, `dist`, + `target`, and `.next`, while excluding dependency/admin trees and directory + symlinks). Directory traversal errors stop the scan with exit `2` rather than + producing a partial index. +- **Narrow non-required exemptions:** immediate closed `(if exists)` / + `(if it exists)` notes, same-line passive generated-output clauses such as + `` `docs/out.json` is generated by `make docs` ``, and two-component GitHub + slugs (`owner/tool.js`) in explicit repository/remote roles skip only that + prose reference. Actual Markdown links, generator paths, commands, and + credentials stay checked. + +ACS does not infer `cd` working directories or build generated artifacts; +case-sensitivity depends on the host filesystem. + +## Cursor file-context profile + +`scope`, `scope compare`, `scope diff`, and `scope coverage` predict automatic +attachment for root `.cursor/rules/` files from declared or inventoried paths +([cursor-scope](cursor-scope.md), [cursor-scope-impact](cursor-scope-impact.md), +[cursor-coverage](cursor-coverage.md)). Manual/model-selected rules and +unsupported bodies stay `unknown`, and opposing-directive checks use bounded +English grammar. These commands are unscored and do not observe Cursor at +runtime. + +## Regression checks, `--explain`, and `guardrails` + +- **Regression-only errors:** `no-config` and `empty-instructions` cap the grade + below A, as does any active error. `instruction-file-removed` only exempts + one-to-one exact-text moves to newly added supported files in the same + directory. `directive-polarity-flip` and `contradiction` match exact directive + bodies ([regression coverage](regression-coverage.md)). Enable + `fail_on_new_errors` to block regression-only errors when both scores are 100. +- **`--explain` and `init`:** `--explain` adds static review advice only (no + auto-fixes or score changes). `init --pr-comment` opts into + `pull-requests: write`; default `init` stays read-only. `init --workflow-only` + leaves `.agentconfigscore.json` untouched. +- **`guardrails`:** unscored, selected-file preview for deletion-approval + wording; appending requires a content-bound confirmation token + ([guardrail suggestions](guardrail-suggestions.md)). + +## What benchmarks do—and do not—establish + +- **Offline adversarial suite** ([report](../benchmarks/adversarial-v1-report.md)): + 474/474 maintained deterministic contracts match, and 6/8 labeled challenges + are detected (the remaining 2 are semantic misses). This is a closed + regression suite, not a real-world accuracy rate. +- **AI comparison** ([workflow](review-comparison.md)): no independent held-out + human-adjudicated comparison against AI review has been completed yet. +- **Public-repo smoke checks** ([benchmarks](../benchmarks/README.md)): useful + for catching real false positives, not a substitute for independent accuracy + evaluation. ## Appropriate use -Use AgentConfigScore to catch concrete regressions covered by its stable rule -catalog, review findings in CI, and keep accepted exceptions auditable. Do not -use it as the sole approval signal for generated code, repository security, or -instruction quality. - -See the [real-repository smoke benchmark](../benchmarks/README.md) for pinned -public inputs. Real false positives, false negatives, and before/after cases are -especially valuable through the repository's **Real-world case** issue form. +Use AgentConfigScore to catch concrete regressions covered by its rule catalog, +review changes in CI, and keep accepted exceptions auditable. Do not use it as +the sole approval signal for generated code, repository security, or instruction +quality. diff --git a/docs/maintainer-workflow.md b/docs/maintainer-workflow.md index 0e3f6bd..61a90a7 100644 --- a/docs/maintainer-workflow.md +++ b/docs/maintainer-workflow.md @@ -1,11 +1,10 @@ -# Maintainer workflow: findings, next steps and one PR comment +# Maintainer workflow: findings, next steps, and PR comments -`--explain`, `init --pr-comment` and `init --workflow-only` are available in -**v0.24.0+**. The [copy-ready comment recipe](../examples/pr-comment.yml) remains -an alternative setup method. Upgrade the installed CLI and review the Action -revision independently: generating a workflow does not update remote refs. +Use `--explain`, `init --pr-comment`, and `init --workflow-only` (or the +copy-ready [pr-comment.yml](../examples/pr-comment.yml) recipe) to surface +actionable review guidance locally and on pull requests. -## 1. Inspect concrete problems locally +## 1. Inspect findings locally ```bash agent-config-score . --explain @@ -13,43 +12,33 @@ agent-config-score rules dead-path agent-config-score rules prompt-injection-override ``` -Each active finding retains its rule ID, severity, message and location, followed -by a static next step. For example, a missing path asks you to verify its intended -scope and update/remove the stale reference, not create a placeholder just to -make the warning disappear. A credential finding recommends revocation/rotation -if real, rather than repeating its value. General guidance is also available in -the [unscored best-practice checklist](best-practices.md). +Each active finding includes its rule ID, severity, message, location, and a +static next step. `--explain` only changes text and Markdown presentation—it +does not modify files, execute commands, or alter scores, JSON, SARIF, HTML, or +exit codes. Suppressed/resolved findings and clean scans receive no extra +prompts. For general review guidance, see the unscored +[best-practice checklist](best-practices.md). -The command changes no instruction files, executes no referenced commands and -uploads nothing. Suggestions are **review guidance, not automatic fixes**. -`--explain` changes only text/Markdown presentation, not scores, findings, -suppressions, JSON, SARIF, HTML or exit policy. Suppressed/resolved findings do -not get new fix prompts. A clean scan gets no generic missing-keyword advice. - -## 2. Review only changes against the baseline +## 2. Review regressions against a baseline ```bash agent-config-score diff --explain --markdown .agent-config-score/regression.md ``` -Use an explicit baseline ref if automatic local detection is not appropriate. -The baseline policy and suppressions still govern the comparison. Guidance is -attached only to new findings, so unchanged historical findings do not become -new fix requests on every PR. Review accepted exceptions separately. - -The v0.24.0+ Action requests explanatory Markdown in its job -summary automatically. It does not publish a comment unless a caller workflow -opts in. Generated comments contain validated numeric results and a link to -details, not raw instruction text or arbitrary finding messages. +Baseline policy and suppressions govern both sides. Next steps are attached only +to **new** findings so existing debt is not repeated on every PR. -v0.27.0+ adds a compact rule/severity/count table and local recheck -commands to the optional comment. The detailed report remains the source for -file/line evidence and static remediation guidance. A passing gate with new -findings still asks for review; see the [updated recipe and compatibility](pr-comments.md). +In GitHub Actions, the composite Action writes explanatory Markdown to the job +summary automatically, and stays read-only unless your workflow opts into PR +comments. Optional PR comments show validated numeric results, a compact +rule/severity/count table (up to five rule types plus remaining count), local +recheck commands, and a link to the full report—never raw instruction text or +dynamic finding messages. When a gate passes with new warnings, the comment +still asks for review ([PR comment setup and compatibility](pr-comments.md)). -## 3. Opt into one PR comment +## 3. Enable a single PR comment -For a new integration, preview first: +Preview first, then generate: ```bash agent-config-score init --pr-comment --dry-run @@ -57,97 +46,47 @@ agent-config-score init --pr-comment ``` Review and commit `.agentconfigscore.json` and -`.github/workflows/agent-config-score.yml`. No GitHub API is called by `init`. -The generated file is identical to the tested copy-ready recipe, including: +`.github/workflows/agent-config-score.yml`. The generated workflow matches +`examples/pr-comment.yml`: -- `pull_request`, not `pull_request_target`; -- explicit `pull-requests: write`, with credentials not persisted by checkout; -- same-repository PR comments only; fork PRs retain scanning and job summaries; -- one bot-owned marked comment, updated rather than appended on each run; -- pagination, output validation and cancelled/setup-failure handling; -- comment failures do not override the regression step's result. +- runs on `pull_request` (never `pull_request_target`) with `persist-credentials: false`; +- requests `pull-requests: write` only for same-repo PRs (fork PRs keep scanning and job summaries); +- updates one bot-owned comment instead of posting duplicates on every push; +- handles pagination, output validation, and comment-step failures without masking a failed regression gate. -Default `init` generates a workflow with read-only GitHub permissions, and -`--pr-comment` cannot be combined with -`--no-workflow`. Existing conflicting files are not overwritten. For an existing -setup, manually review the diff first; only use `--force` if you intend to replace -the generated targets. Do not install a second workflow alongside an existing -comment recipe. See [PR comment security and behavior](pr-comments.md). +Default `init` keeps GitHub permissions read-only. `--pr-comment` cannot be +combined with `--no-workflow`. Do not install a second workflow alongside an +existing comment recipe. -### Upgrade a workflow without resetting repository policy +### Upgrade only the workflow -v0.24.0+ also accepts `--workflow-only`. The selected targets are: +To update `.github/workflows/agent-config-score.yml` without touching +`.agentconfigscore.json`: | Mode | Policy file | Workflow file | |---|---|---| -| Default `init` | Generate/check | Generate/check | -| `init --no-workflow` | Generate/check | Out of scope | -| `init --workflow-only` | Out of scope | Generate/check | - -For an existing integration, compare the desired recipe with any workflow -customizations, then preview the replacement explicitly: +| Default `init` | Generate / check | Generate / check | +| `init --no-workflow` | Generate / check | Untouched | +| `init --workflow-only` | Untouched | Generate / check | ```bash agent-config-score init --workflow-only --pr-comment --force --dry-run agent-config-score init --workflow-only --pr-comment --force ``` -This mode does not read, validate, create or reset `.agentconfigscore.json`, even -with `--force`. It preserves custom policy/suppression bytes, BOM and newlines -by leaving that file out of the operation entirely. A missing policy stays -missing. Run `doctor` and review policy separately; workflow generation is not -proof of a valid configuration or installed remote Action. - -`--force` still **replaces the selected workflow**, including its customizations; -it is not a YAML merge. Dry-run lists target actions, not a full content diff. -Without `--force`, an existing different workflow remains a conflict. Repeating -an identical setup is a no-op. `--workflow-only` and `--no-workflow` cannot be -combined. Ordinary unscoped `init --force` still replaces both selected generated -targets; use workflow-only mode when that is not what you intend. - -The generated workflow currently uses the existing rolling `v0` Action ref. -Review/pin the tested revision suitable for your repository before committing; -explanatory summaries require v0.24.0+ (or a verified revision containing -that feature). Keep scanning dependencies separate from candidate repository code. -CLI output also discloses this Action ref instead of implying it matches the -installed CLI source. Initialization does not fetch, verify or update remote refs. - -### Generated-file write boundaries - -Selected targets and their existing parent directories must not be symbolic -links or Windows reparse points, even when they resolve inside the repository. -Hard-linked/unknown-identity selected files and non-file targets are rejected -before content reads; this includes dangling links and FIFOs. The explicitly -selected root itself is canonicalized. Unselected targets are not inspected. - -All selected targets are preflighted before any writes. Creation uses exclusive -open so a newly appeared file is not silently overwritten. Opened regular-file -identity/link checks occur before truncation on an explicit overwrite; no-follow -and nonblocking flags are used where available. Permissions of an overwritten -regular file are retained. Expected target I/O failures return exit `2` without -raw exception details or a successful setup message. - -Keep the repository stable: these checks are **not an atomic multi-file -transaction or hostile-filesystem sandbox**. Concurrent edits/replacements can -still race checks, and an I/O failure can leave earlier generated files or a -partially written selected target. Inspect before retrying; no destructive -rollback is attempted. Alias layouts need manual integration, not `--force`. - -## Coverage is deliberately bounded - -v0.25.0+ builds also check simple `[Guide][setup]` / `[setup][]` links -with single-line definitions. Missing targets point to the definition line you -can review/edit; restoring the target or correcting that definition can then -pass recheck. This support requires v0.25.0+. Shortcut, container and complex/HTML forms -still need manual review. See [Markdown link limits](limitations.md#local-markdown-links). - -Path checks cover the [documented reference grammar](limitations.md#plain-prose-path-references), -not every possible reference, generated artifact, or shell command argument. -Prompt-injection flagging recognizes a narrow override grammar and certain -other cataloged risks; it does not inspect arbitrary retrieved web pages, -prove malicious intent, or enforce agent behavior. No new detection grammar is -introduced by the explanatory output. Read the [score limitations](limitations.md). - -The maintained workflow tests use disposable synthetic repositories and a fake -GitHub client. They cover finding-to-fix-to-recheck and comment create/update -behavior, not a live user's adoption, a real deployment, or independent accuracy. +`--workflow-only` never reads, creates, or resets `.agentconfigscore.json`, even +with `--force`. Compare your existing workflow before passing `--force` (it +replaces the file rather than merging YAML), and run `doctor` separately to +validate your policy. Review or pin the generated `v0` Action ref as needed. + +### Write boundaries + +`init` refuses symlinks, Windows reparse points, hard-linked files, and non-file +targets for selected paths and their existing parent directories. Targets are +preflighted before writing, created exclusively when new, and keep existing +permissions on `--force` overwrite. Expected I/O failures exit `2`. + +## Scope notes + +Path, Markdown-link, and prompt-injection checks remain bounded deterministic +heuristics; see [limitations.md](limitations.md) for exact grammar boundaries. diff --git a/docs/simplified/limitations.md b/docs/simplified/limitations.md index 9b0cf26..b15db89 100644 --- a/docs/simplified/limitations.md +++ b/docs/simplified/limitations.md @@ -2,134 +2,65 @@ [English](../limitations.md) | 简体中文 | [繁體中文](../traditional/limitations.md) · [使用指南](user-guide.md) -AgentConfigScore 的分数衡量已经检测到的、由规则定义的风险,不衡量模型智力、任务成功率或指令总体质量。**A 100 表示没有命中生效的确定性规则,不是语义质量或安全认证。** +AgentConfigScore 是确定性静态检查器与回归门禁。分数只反映固定规则目录的命中情况,不衡量模型能力、任务成功率或指令整体质量。 -v0.24.0+ 提供[工具源码身份(英文)](../report-identity.md),用于区分声明同一版本号的不同实现。相同指纹不证明准确率或可复现性:仓库输入、策略、运行环境和文件系统行为不在该指纹范围内。工具源码缺失时明确记为未知,历史报告不补标成当前版本。 +**A 100 表示没有命中生效规则,不是语义质量或安全认证。** -## 配置解析 +全工具共有的基本边界: -v0.25.0+拒绝各层配置中解码后重复的 JSON 字段名、非标准 `NaN`/`Infinity` 常量以及布尔类型的格式 `version`,不选择重复字段的第一个或最后一个值。比较的两侧都必须通过验证;命令行门槛覆盖不能批准格式错误的配置。`doctor` 从同一次读取的内容获取策略和 schema 元数据。这些变化从 v0.25.0 起可用。[失败行为与兼容性细节(英文)](../doctor.md#configuration-decoding)。这不证明策略充分、不认证作者、不提供原子快照,也不能恢复调用方 JSON 解析时已经丢失的重复字段。 +- **纯本地静态分析**:不调用 AI 模型、不访问网络,也不执行指令文件中的任何命令。 +- **不是文件系统沙箱**:路径、配置与符号链接检查适用于稳定的本地工作区,不针对并发写入或恶意文件系统提供原子事务保证。 +- **来源指纹**:报告附带工具版本与源码 SHA-256 指纹([报告身份(英文)](../report-identity.md)),用于标识构建版本,不代表准确率认证。 -v0.25.0+ 配置来源检查还区分文件不存在与链接失效,要求配置解析为选定仓库根目录内的普通文件。仓库内的文件链接和显式根目录别名仍受支持;越界、循环、非普通文件或不可读来源报错,不回退到默认值。Git 比较两侧各自满足边界;这不对并发路径替换提供原子保证,也不认证硬链接/挂载身份。只生成工作流的初始化及非计分 guardrails 不验证策略。[兼容性与迁移(英文)](../doctor.md#configuration-file-boundary)。这些变化从 v0.25.0 起可用。 +## 哪些问题仍可能得 A 100 -## 本地历史完整性 +只要避开已启用的规则,下列情况仍可能得到 100 分: -v0.25.0+区分本地历史索引不存在与数据损坏/不可读。历史无效时返回操作错误 `2`,不是空的成功报告。Python 追加接口拒绝重置损坏的索引,并在同一目录写入完整临时文件后替换,不直接截断原记录。旧版部分字段快照仍受支持;缺失分数表示未知。带链接或 reparse 的历史路径需要手动迁移。这些变化从 v0.25.0 起可用。 +- 空泛、没有实际帮助但非空的指令(如 `"Do a good job."`)。 +- 未使用已收录危险命令或固定句式表达的有害意图。 +- 经过改写、措辞不完全一致的指令矛盾。 +- 规则目录之外的破坏性工具或 shell 写法。 +- 语法无误但与实际仓库不匹配的指导。 -历史验证不证明记录真实、策略/工具版本可比或语义质量。追加接口要求调用方串行写入,不提供写入锁、恶意文件系统事务或断电持久性保证。普通扫描不会自动记录本地快照;不可变 CI 产物是独立机制。[恢复、保留上限及元数据限制(英文)](../score-history-cli.md)。 +我们不靠容易刷分的“最佳实践关键词”加分。更广义的语义评审应放在独立评测的模型辅助流程中。另外,中文文档只是可选阅读入口,**不代表工具能理解任意中文语义**。 -## 指令文件的文件系统边界 +## 配置、历史与文件系统边界 -选中的指令文件和 `.agentconfigscoreignore` 必须解析为扫描根目录内的普通文件。仓库内的文件符号链接仍受支持;发现位置、Markdown 相对链接和指令作用域使用链接所在的位置,不是共享目标的目录。用户明确指定的根目录别名可用,并以其解析后的目录为边界。 - -发现过程不跟随子目录符号链接或 Windows junction,即使目标在仓库内;依赖、构建目录以及明确由 `/**` 忽略模式覆盖的整棵子树会在进入前排除,其他忽略模式保留文件名匹配含义。明确忽略的来源不检查,也没有覆盖声明。 - -选中的越界、失效、循环或非普通文件来源会在打开内容前失败;读取前再次验证,并打开解析后的目标。发现、解析或指令内容读取失败时,扫描、`compare`、`feedback` 返回 `2`,不生成成功分数或新的成功报告;`doctor` 检查实际可读性,给出 `instructions` 错误并返回 `1`。这些来源诊断不回显原始目标路径或系统错误详情。`read-error` 仅为旧报告和旧豁免保留,不能豁免当前操作错误。 - -这不是文件系统沙箱,也不是原子快照:并发进程仍可能在验证与打开之间替换父目录或目标;不认证硬链接身份或挂载边界。其他显式输入、配置或工作流读取器、报告输出是独立接口,这个守卫不约束工具的所有文件系统操作。非指令文件的循环链接从路径索引排除,不代表安全或语义正确。扫描期间应保持仓库稳定。[完整英文边界](../limitations.md#instruction-file-filesystem-boundary)。 - -## 高分不代表没有问题 - -只要避开已知规则,下列内容仍可能得到 100 分: - -- 空泛、无用但非空的指令。 -- 没有使用已知危险命令表达的恶意或有害意图。 -- 经过改写、措辞不完全相同的矛盾。 -- 不在规则目录中的破坏性工具、命令形式。 -- 语法正确但与实际仓库任务不匹配的指导。 - -我们不会用容易复制的“最佳实践”关键词加分来掩盖这些限制。模型辅助的语义判断需要独立评测和标注数据,不能通过更强的宣传措辞替代。 - -中文文档是可选阅读入口。**它不表示检测规则能理解任意简体或繁体中文语义。** 英文散文规则的跨语言表现尚未得到验证;中文的否定、例子、改写和矛盾仍需要人工审核。 - -## Cursor 文件上下文模型(v0.25.0+) - -可选 `scope` 根据声明的文件路径,预测根目录 `.cursor/rules/` 规则的自动加载。它不计分,不观察 Cursor、不检查目标存在性、不解析其他格式/优先级,也不改变正常扫描和回归发现。inactive 仅表示这些路径未触发规则;手动引用、模型选择、不支持的元数据与运行设置仍未被观察。多个文件可触发不同 glob 的规则共同加载。 - -有限英文语法识别的相反指令对只提供带来源行号的审核信号,不是语义冲突证明。未知加载条件和未解释的正文会保留;没有信号不代表没有问题。独立上下文分析完成返回 `0`,包括存在信号的情况;输入/读取/限制错误返回 `2`。仍会执行全仓库支持来源预检查。详见[语法、报告与限制(英文)](../cursor-scope.md)。这些能力尚未包含在已发布 v0.24.0 中,也未实现通用语义约束影响分析或执行验证。 - -v0.25.0+ [scope 比较命令(英文)](../cursor-scope-impact.md)还可比较两个目录或本地 Git 基线下相同的声明上下文,区分文件/触发路径变化与精确识别的指令失去全部活动来源。相同指令的另一份活动来源或其他仍匹配的任务文件可以保留可用性。可选调用方标志分别对已知识别丢失和未知返回 `1`;默认比较仍只给建议。不证明语义改写等价、任意路径上的范围收缩或运行时遵守。空/未识别基线保护零个指令身份。这些能力从 v0.25.0 起可用,与现有基线评分策略格式分开。 - -v0.25.0+ 的 [逐文件覆盖检查(英文)](../cursor-coverage.md) 枚举两侧仓库中经过过滤的普通文件名,逐一建立独立上下文。报告列出排除数量、文件在两侧是否存在、来源行号及未知情况。它不读取目标代码内容来判断任务,也不观察原生 Cursor;空选择、读取失败及资源上限返回 `2`,不会悄悄截断后给出成功结果。 +- **严格 JSON 配置**:`.agentconfigscore.json` 拒绝任意层级的重复键名、`NaN`/`Infinity` 以及布尔类型 `version`,且必须解析为仓库根目录内的普通文件。损坏、失效链接或越界配置直接返回退出码 `2`(`doctor` 返回 `1`),不会悄悄回退到默认值([配置解析(英文)](../doctor.md#configuration-decoding))。 +- **本地历史索引**:历史文件损坏或不可读时,`history` 返回 `2` 而不会清空重置;追加写入采用整文件替换,要求串行调用([本地历史(英文)](../score-history-cli.md))。 +- **指令文件边界**:选中的指令文件与 `.agentconfigscoreignore` 必须是仓库内的普通文件(支持仓库内文件符号链接,但不进入子目录符号链接或 Windows junction)。失效、循环、越界或不可读来源会直接中止扫描并返回 `2`(`doctor` 报 `instructions` 错误并返回 `1`),不回显原始目标路径;旧规则 `read-error` 仅为历史兼容保留。 ## 命令与禁止上下文 -`rm-rf`、`git-clean-force`、`docker-system-prune` 解析有限 shell 片段的选项,支持部分重排、拆分、长选项、引号内的选项值和显式反斜杠续行。shell 分隔符与 `--` 会停止选项解释。Git 的预览/交互模式排除在危险匹配外;`rm` 后出现的交互选项会覆盖强制模式。排除/过滤选项的值不会当成执行标志。 - -片段最多 1,000 个字符。普通操作数之后的选项、变量展开、别名、包装函数、子命令前的全局选项不解析。其他命令规则仍采用较窄的模式,不能覆盖所有 shell 语法。 - -明确识别的英文禁止语句可以覆盖紧邻且闭合的代码块,或连续的直接命令列表。这不是完整 Markdown 解析器或意图分类器:没有标签的代码仍会接受危险命令检查;未闭合代码块不继承禁止作用域;直接出现的凭据独立检查。引号或代码围栏本身也不是通用豁免。 - -复杂教学示例可能误报。先核对上下文,再使用有理由、有到期日期且经基线审核的豁免。[具体语法与负例(英文)](../instruction-context.md)。 - -## 提示注入与工作流规则 - -`prompt-injection-override` 识别 `ignore previous instructions` 等明确英文短语。命中只代表需要审核,不证明发生攻击。明确禁止以及整行标记的攻击示例可排除;任意改写、其他语言、运行时工具输出或远程内容的注入不在覆盖范围。[英文限制说明](../limitations.md#prompt-injection-warnings)。 - -`false-success-report` 要求完整的英文散文子句,明确隐瞒错误却报告成功,或在失败/未执行时声称测试通过。仅跳过测试、禁止性描述、引号或代码示例不足以满足该规则。它不跨句、跨行拼接证据,也不检查实际测试是否运行。其他有害指导仍可能通过。[规则细节(英文)](../verification-reporting.md)。 - -`broad-environment-upload` 要求同一英文子句同时包含明确传输行为、完整环境变量来源和网络接收端。仅变量名称、明确脱敏、日志、禁止描述、代码示例不满足此语法。它不读取进程环境、不验证脱敏、不解析目标,也不证明恶意意图或实际传输。字面回环地址被排除,但转发不分析;shell 上传、其他语言和任意改写仍不支持。[规则细节(英文)](../environment-upload.md)。 - -**v0.27.0+** 补充了有限的简体/繁体中文虚假测试通过句式,并新增 `deletion-approval-bypass`:必须同时有删除生产数据库或现有/用户文件的明确指令,以及与该操作相连的免授权要求。禁止、正常授权、临时清理和明确示例与违规正例分开测试。这些改进从 v0.27.0 起可用;不代表通用语义判断、任意中文覆盖或运行时拦截。空泛指导仍可能得高分。[新增规则及边界(英文)](../deletion-approval-bypass.md)。 - -## 本地 Markdown 链接 - -简单的行内链接、图片目标相对于指令文件目录检查。URL 编码空格和尖括号目标受支持;只检查文件是否存在,不检查片段对应的标题。远程链接、纯锚点、代码块示例、绝对路径和逃出仓库的路径会跳过。行内目标中嵌套括号暂不解析。这不是完整 Markdown 校验器。 - -v0.25.0+还检查简单的 `[指南][setup]`、`[setup][]` 引用式链接及图片,要求同一指令文件里有 `[setup]: GUIDE.md` 这样的单行定义。目标仍严格相对于文档目录;实际使用的缺失目标在定义行报告一次。标签忽略 Unicode 大小写并规范 ASCII 空白,首个匹配定义优先(包括远程目标和纯锚点);未使用的已支持定义、已解析的显示文本不会重复当成散文路径。这些变化从 v0.25.0 起可用。 - -此子集只处理无转义/嵌套括号、最长 999 字符的标签,缩进零至三个空格的顶层单行定义,以及裸目标/尖括号目标和可选的单行标题;定义不能打断普通段落。代码块、缩进代码、已转义链接及匹配的行内代码不激活新的引用检查。简写 `[setup]`、跨行语法、容器内定义、含转义或括号的目标、HTML 类布局须人工检查;首个定义不明确时不会猜用后续副本。现有行内/散文检查和危险命令规则仍运行;它不是完整 Markdown 解析器,也不证明目标内容正确。[详细边界(英文)](../limitations.md#local-markdown-links)。 - -## 普通散文中的路径 - -目录引用须同时具有明确的 `./` 或 `../` 前缀和末尾 `/`,如 `./packages/`、`../src/`,才检查适用仓库/指令作用域内的真实目录;普通文件不能满足目录引用,目录也不使用模糊后缀匹配。无前缀的 `packages/`、`dist/`、`.husky/_/` 及没有末尾斜杠的 `test/unit` 不推断,因为它们可能指包内位置或安装/构建产物。真正的 Markdown 目录链接仍按文档相对位置检查。 - -v0.26.2+ 增加两项有界处理:同一行紧邻路径、完整且闭合的 `` `docs/out.json` is generated by `make docs` ``(也支持 `generated from`、`regenerated`、`rewritten`)仅把产物视为可在构建后出现;生产者须为单反引号代码,末尾可带简短括号说明。生成器自身的文件路径、真正的 Markdown 链接、危险命令与凭据仍检查。不验证生成声明是否真实,不执行构建;否定、条件、未闭合或继续扩展的子句不豁免。 - -未加反引号的目录散文、分支、URL、示例占位符及越界路径继续排除。PyPI v0.26.1 的既有报告不因这些源码变更而重写。 - -反引号中的 `./`、`../` 文件路径按仓库根目录及适用的指令目录核对;嵌套 AGENTS 文件保留仓库内祖先目录的解释,其他格式也接受明确的文档相对路径。这些路径不会因无关包有相同后缀而通过。`.github` 等名称中的开头圆点会保留;所有解释都逃出仓库时,不访问外部路径,也不拿索引中的其他文件代替。真正的 Markdown 链接仍严格相对于文档目录。 - -无前缀的散文路径仍使用保守的包相对后缀匹配。两种模式都不推断命令的工作目录、不执行或跟踪 `cd` 指令,也不证明哪一种解释符合作者意图。 - -只在紧邻路径且闭合的 `(if exists)`、`(if it exists)` 条件下,把对应散文路径视为可选;括号内 `-` 或 `:` 后可带简短解释。真正的 Markdown 链接仍检查目标。同一行的其他路径、远处的“可选”字样、不闭合的条件不会因此豁免。 - -`owner/tool.js` 这类两段名称,只在明确的同一行仓库角色语法中跳过:后接 `repository`/`remote` 及标点,或前接 `merge target is`、`fork of`、`re-pushed to a branch in`、`CI trusts branches inside`;也识别相同仓库名的 `fork of ... and not ... itself` 形式。仅提到 GitHub 或仓库,不会让本地路径免检。其他改写和语言仍可能误判。[完整英文边界](../limitations.md#plain-prose-path-references)。 - -包相对路径的后缀索引包含 `build`、`dist`、`target`、`.next` 中已经存在的路径,但不会因此扩大指令文件的发现范围。依赖、管理目录仍排除在后缀索引外;不遍历目录符号链接,也不索引外部或失效链接。存在不代表内容正确或路径意图明确;未生成的文件仍可能被报告缺失,大小写判断依赖宿主文件系统。这些豁免不会关闭危险命令或凭据检查。 - -构建索引时的目录遍历错误会停止扫描,不把部分索引当作干净结果或文件缺失的证据。扫描、`compare`、`feedback` 返回 `2`,不输出成功报告;`doctor` 给出 `repository-paths` 错误项并返回 `1`。已排除的依赖、管理目录仍不遍历。这是本地文件系统检查,不是仅限 Git 跟踪文件的索引,也不是原子文件系统快照。 - -## 回归保护的具体范围 - -- 没有支持的指令文件会产生 `no-config`;空文件会产生 `empty-instructions`,不会显示 A 等级。 -- 生效的错误发现会限制等级,不能仅因数值惩罚较小就显示 A。 -- 精确指令形式的矛盾可以检出,改写后的语义矛盾不保证检出。 -- 删除指令文件会产生回归专用的 `instruction-file-removed`;v0.24.0+ 仅豁免同目录内、一对一匹配、非空且解码文本完全相同的新增文件移动。现存副本、跨目录搬移和折叠空白后才相同的内容不能豁免;不证明不同工具格式、优先级或实际作用域等价。 -- 相同指令正文的明确极性翻转会产生 `directive-polarity-flip`,不推断任意语义相反的句子。 - -对应行为有回归测试,基线审核的豁免可记录有意接受的例外。通过测试只证明符合这些已指定的行为。 - -v0.24.0+ 的对比逻辑复用每次扫描捕获的文本,不再二次读取并跳过读取失败;初次读取失败仍中止检查,原始捕获文本不保留在公开报告对象或导出中。这不是原子快照或并发修改检测,应保持两侧目录稳定,编辑后重跑。回归专用错误不扣数值分;两边 `100` 分仍需通过基线 `fail_on_new_errors` 或 `--fail-on-new-errors` 阻断。裸 CLI 的仅检查降分默认值不变。[完整边界(英文)](../regression-coverage.md)。 +`rm-rf`、`git-clean-force`、`docker-system-prune` 会对受限长度(1,000 字符内)的 shell 片段做选项解析,支持重排、拆分、长选项、引号值与反斜杠续行,并在分隔符或 `--` 处停止。Git 预览/交互模式、`rm` 后续交互选项以及过滤参数值不会误判;操作数之后的选项、变量展开、别名和包装函数不解析。 -v0.24.0+ 的[删除保护补全功能(英文)](../guardrail-suggestions.md)是独立的非计分建议,不靠安全关键词加分。它只识别选定文件里的有限句式,不继承其他文件、工具权限或沙箱设置;未识别到不证明缺少保护,识别到也不证明完整或会被执行。默认只读预览,追加必须明确确认,且不是原子事务,写入失败可能留下部分追加片段。现有评分和 CI 门禁不变。 +明确标注的禁止语句可覆盖紧邻的闭合代码块或连续命令列表;未标注代码块、未闭合代码块不会自动豁免,凭据规则始终独立生效([指令上下文(英文)](../instruction-context.md))。 -v0.24.0+ 的 `--explain` 和[维护者清单(英文)](../best-practices.md)只给静态审核建议,不增加检测范围、不自动修复,也不执行引用的命令、猜测替代路径或改变评分。可选的 `init --pr-comment` 生成明确带写权限的工作流,本身不发评论;默认生成的工作流仍只申请 GitHub 只读权限。详见[维护者流程(英文)](../maintainer-workflow.md)。 +## 提示注入与散文安全规则 -明确的示例标题会排除其章节;示例章节延续到文件末尾时须手动合并。HTML 类标签会让整个选定文件停止策略识别。少数跳过删除确认的明确句式,即使与已识别的保护并存,也须先手动处理;这些只是不计分的审核信号,不代表完整的冲突检测或实际代理行为。 +- **`prompt-injection-override`**:识别 `ignore previous instructions` 等明确英文覆写短语。明确禁止、整行标注示例和紧邻禁止块可排除,但纯引号或代码围栏不自动豁免;任意改写、其他语言及运行时工具输出注入不在覆盖范围内([英文详细边界](../limitations.md#prompt-injection-warnings))。 +- **`false-success-report`**:覆盖单句英文隐瞒错误报告成功,以及英文和有限简体/繁体中文的“测试失败或未运行仍宣称通过”句式;不跨句拼接,也不检查测试是否真的执行([规则细节(英文)](../verification-reporting.md))。 +- **`deletion-approval-bypass`**:覆盖英文和有限中文中同时包含“删除生产数据库或现有/用户文件”与“免授权”的明确句式;正常授权、临时清理、禁止语句和示例分开处理([规则细节(英文)](../deletion-approval-bypass.md))。 +- **`broad-environment-upload`**:要求同一英文子句同时出现传输动作、完整环境变量来源和非回环网络目标;仅列变量名、脱敏、日志、禁止句和代码示例不触发([规则细节(英文)](../environment-upload.md))。 -v0.24.0+ 的 `init --workflow-only` 将策略排除在读写范围外,即使使用 `--force` 也不会重置策略,但也不会验证策略。初始化选定目标若涉及链接、reparse point、共享文件或非普通文件,须手动接入。独占创建和已打开文件检查减少误写风险,不代表完全消除文件系统竞争;初始化不是原子事务,写入失败可能留下部分文件。生成的 `@v0` 不一定与本地 CLI 源码相同。 +## 本地 Markdown 链接与散文路径 -v0.25.0+ 不再为单文件保护审阅先遍历整仓,仅检查相关忽略规则、所选路径的祖先目录及父目录名称。无关的坏链接、外部或非普通指令文件不在本次验证/修复范围内;目录别名、reparse 祖先及大小写有歧义的目录须手动接入。整仓扫描和 doctor 仍会因不安全来源报错,单文件审阅/追加成功不代表整仓检查通过。此修正从 v0.25.0 起可用,确认及非原子追加边界不变。 +- **Markdown 链接**:检查行内链接、图片,以及同文件单行定义的简单引用式链接(`[指南][setup]`、`[setup][]`),按指令文件所在目录解析。跳过远程链接、纯锚点、代码块、匹配的行内代码、转义左括号、绝对路径和越界路径;简写引用、跨行定义、容器内定义、嵌套括号和 HTML 布局需人工核对([英文详细边界](../limitations.md#local-markdown-links))。 +- **显式相对路径(`./`、`../`)**:按仓库根目录及适用的指令作用域目录核对,不走无关包后缀兜底。带 `./` 或 `../` 且以 `/` 结尾的单反引号目录引用要求目标为真实目录;无前缀的 `packages/`、`dist/`、`test/unit` 不做猜测。 +- **无前缀文件路径**:使用保守的包相对后缀索引(包含 `build`、`dist`、`target`、`.next` 中已存在的文件,但跳过依赖/管理目录和目录符号链接)。构建索引遇到目录遍历错误时直接返回 `2`,不会用不完整索引继续扫描。 +- **窄范围非必需豁免**:紧邻的 `(if exists)` / `(if it exists)`、同行的被动生成声明(如 `` `docs/out.json` is generated by `make docs` ``),以及明确仓库角色中的 `owner/tool.js` 两段名称只豁免对应散文路径;真正的 Markdown 链接、生成器路径、危险命令和凭据不受影响([英文详细边界](../limitations.md#plain-prose-path-references))。 -## 评测尚未证明什么 +## Cursor 上下文、回归门禁与辅助命令 -维护的离线对抗用例目前有 474/474 个确定性契约匹配;公开挑战中检出 6/8,仍保留两个语义漏报。这是封闭开发用例的回归结果,**不是现实仓库准确率**。修复已知的虚假成功报告和环境上传案例是开发进展,不是独立准确率估计。 +- **Cursor `scope` / `coverage`**:静态预测根目录 `.cursor/rules/` 的自动加载情况;手动/模型选择规则和不支持的正文保持 `unknown`,不观察 Cursor 实际运行([cursor-scope](../cursor-scope.md)、[cursor-coverage](../cursor-coverage.md))。 +- **回归门禁**:缺少指令文件(`no-config`)、空文件(`empty-instructions`)及任意生效错误都会把等级限制在 A 以下。`instruction-file-removed` 仅豁免同目录内一对一、原文完全一致的新增文件移动;`directive-polarity-flip` 与 `contradiction` 仅匹配精确指令正文([回归覆盖(英文)](../regression-coverage.md))。两侧同为 100 分时,需开启 `fail_on_new_errors` 才会阻断回归专用错误。 +- **`--explain`、`init` 与 `guardrails`**:`--explain` 只补充静态建议,不自动修改文件;`init --pr-comment` 显式申请 `pull-requests: write`,默认 `init` 保持只读;`guardrails` 为单文件不计分检查,追加写入需显式确认令牌([维护者流程(英文)](../maintainer-workflow.md)、[删除保护(英文)](../guardrail-suggestions.md))。 -与直接 AI 审查的独立对照尚未完成。比较工具包含已知的合成校准数据和暂定标签;未回答、未审核、未执行、参考标签未解决的情况,不会被当成完成的成功测量。一次未定论 AI 预评审、失败的源码获取,以及公共仓库片段,都不是已核验的用户反馈或优于 AI 的证据。[评测方法(英文)](../review-comparison.md)。 +## 评测边界 -## 合适的用途 +- **离线对抗用例集**:474/474 项确定性契约全部匹配,8 项公开挑战检出 6/8(剩余 2 项为语义漏报)。这是封闭回归集,不代表真实仓库准确率。 +- **AI 对比评测**:目前尚未完成有独立人工仲裁标签的留出集对比([评测方法(英文)](../review-comparison.md))。 -用于发现稳定规则覆盖的具体回归、在 CI 中审核发现、保留例外审计记录。不要作为生成代码、仓库安全或指令质量的唯一审批依据。安装验收、文档本地化和真实用户价值是不同问题。 +## 适用方式 -本文根据英文限制说明整理,保留核心边界;历史版本的逐项对照表和外部手册引用请见[英文原文](../limitations.md)。[翻译范围与维护说明](../translations.md)。 +把 AgentConfigScore 用作稳定的确定性回归门禁与例外审计工具,而不是生成代码、仓库安全或指令质量的唯一审批依据。[翻译范围与维护说明](../translations.md)。 diff --git a/docs/simplified/user-guide.md b/docs/simplified/user-guide.md index c2e0190..efe55c3 100644 --- a/docs/simplified/user-guide.md +++ b/docs/simplified/user-guide.md @@ -2,13 +2,13 @@ [English](../user-guide.md) | 简体中文 | [繁體中文](../traditional/user-guide.md) · [项目主页](../../README.simplified.md) -AgentConfigScore 是本地、确定性的编程助手指令检查器和 PR 回归门禁。它不调用 AI 服务,也不执行指令文件中的命令。100 分不代表指令有用、始终安全或比 AI 审查更好。 +AgentConfigScore 是本地运行的确定性编程助手指令检查器和 PR 回归门禁。它不调用 AI 服务,不执行指令文件中的命令,也不是文件系统沙箱。100 分只表示没有命中生效规则,不代表指令完整或绝对安全。 -[可运行的设计演示(英文)](../../examples/regression-lab/README.md) 展示了仅看分数变化与采用基线新错误门禁的区别。正常通过的对照及显式调用方覆盖都是合成开发示例,不是真实用户案例或 AI 对照评测;演示脚本需要源码仓库。 +如果想直观对比“单纯看分数变化”与“基线新错误门禁”的区别,可以在源码仓库中运行[回归设计演示(英文)](../../examples/regression-lab/README.md)。 -## 1. 安装并确认版本 +## 1. 安装 -需要 Python 3.10+。`diff` 需要 Git;普通目录扫描和两个目录间的 `compare` 不需要 Git。 +需要 Python 3.10+。`diff` 还需要 Git;普通目录扫描和 `compare` 不需要 Git。 ```bash python -m pip install agent-config-score @@ -16,9 +16,9 @@ agent-config-score --version agent-config-score --help ``` -`acs` 是短命令别名。v0.23.0+ 支持相同功能的 `python -m agent_config_score`,不依赖主命令的 PATH 设置。旧版本没有此模块入口。查看[已发布版本](https://github.com/LE0-Lin/AgentConfigScore/releases),不要默认认为 `main` 的改动已经进入 PyPI 或滚动 `v0` 引用。 +也可以用短别名 `acs`,或在 `PATH` 未配置时直接运行 `python -m agent_config_score`。PyPI 与 `main` 分支的差异请以[已发布版本](https://github.com/LE0-Lin/AgentConfigScore/releases)为准。 -## 2. 在自己的仓库初始化 +## 2. 初始化仓库 ```bash agent-config-score init --dry-run @@ -26,17 +26,15 @@ agent-config-score init agent-config-score doctor ``` -`init` 生成 `.agentconfigscore.json` 和 `.github/workflows/agent-config-score.yml`,不创建或改写指令文件。已有冲突文件默认不覆盖;使用 `--force` 前先检查。与生成内容相同的重复初始化不会改动文件。 +`init` 会生成 `.agentconfigscore.json` 和 `.github/workflows/agent-config-score.yml`,不会改动你的指令文件。已有冲突文件默认不覆盖(需要显式加 `--force`),内容一致时重复运行不会修改文件。审核后提交生成的文件即可;如果只需要本地检查,使用 `init --no-workflow`。 -审核后提交生成的配置和工作流。只想本地使用时选 `init --no-workflow`;标准工作流缺失会成为 doctor 的提示性警告,而不是错误。 +配置注意事项: -v0.25.0+拒绝配置中重复的字段名(包括嵌套对象和转义拼写)、`NaN`/`Infinity` 常量及布尔类型的格式 `version`,不会悄悄采用覆盖后的值。请审核并为每个字段保留一个值。扫描、`feedback`、`diff` 和 `compare` 返回 `2` 且不生成成功报告;doctor 给出 `config` 错误并返回 `1`。命令行门槛覆盖不能跳过配置验证;缺失配置时的默认行为不变。这些变化从 v0.25.0 起可用。[配置解析细节(英文)](../doctor.md#configuration-decoding)。 +- `.agentconfigscore.json` 必须是严格有效的 JSON(不允许重复键名、`NaN`/`Infinity` 或布尔类型 `version`),且必须解析为仓库根目录内的普通文件。文件缺失时回退到默认值;损坏、失效链接或越界配置会直接返回退出码 `2`(`doctor` 返回 `1`)。 +- 详见[配置解析与边界(英文)](../doctor.md#configuration-decoding)。 +- 若 `doctor` 未发现支持的指令文件,可按仓库实际情况编写,或参考[模板(英文)](../../examples/README.md)与[扫描范围(英文)](../../README.md#what-it-scans)。 -v0.25.0+ 配置来源检查还要求 `.agentconfigscore.json` 解析为选定仓库根目录内的普通文件。只有目录项不存在时才使用默认值;失效、越界、循环或不可读的来源均报错。仓库内的文件链接及用户显式指定的根目录别名仍受支持。共享配置宜使用指向已跟踪文件的相对链接,确保每个 Git 基线都有自己的仓库内目标。检查期间保持目录稳定;这不是原子文件系统沙箱。无效链接须明确修复,不要删除链接来绕过策略。[配置边界与迁移(英文)](../doctor.md#configuration-file-boundary)。升级时请单独审核所选包和 Action 的版本。 - -若没有找到支持的指令文件,请编写符合仓库实际情况的指令,或采用[模板(英文)](../../examples/README.md)。不要仅为涨分添加词句。[完整发现范围(英文)](../../README.md#what-it-scans)。 - -## 3. 检查当前目录 +## 3. 本地扫描 ```bash agent-config-score . @@ -44,13 +42,13 @@ agent-config-score rules agent-config-score rules curl-pipe-shell ``` -普通扫描默认报告发现,不因为有发现就自动阻止后续操作。需要绝对分数门槛时,在策略中设置 `fail_under` 或明确传入: +普通扫描默认只输出发现项并返回 `0`。如需绝对分数门槛,可在 `.agentconfigscore.json` 中设置 `fail_under` 或通过命令行传入: ```bash agent-config-score . --fail-under 90 ``` -仓库不必先达到 90 分才能采用回归门禁。请结合规则、位置、上下文审核结果,不要把分数当成总体质量排名。 +不必先把仓库做到 90 分再接入 PR 回归门禁。请结合规则 ID、位置和上下文查看结果,不要把分数当成总体质量排名。 ## 4. 推送前检查改动 @@ -58,40 +56,33 @@ agent-config-score . --fail-under 90 agent-config-score diff ``` -包括未提交的工作区改动。尽可能采用本地已有的安全默认分支基线,不自动 fetch。也可明确指定: +`diff` 会把当前工作区(含未提交改动)与本地已有的默认分支对比,不会自动 `git fetch`。也可显式指定基线引用: ```bash agent-config-score diff origin/main ``` -如果引用不存在,请自己获取该分支。应选择项目真正的默认分支,而非已经包含改动的功能分支。浅克隆需要足够的历史;生成的 Actions 工作流使用 `fetch-depth: 0`。 - -没有 Git 时,可以比较两个已存在的目录: +浅克隆仓库请先拉取足够历史(生成的 GitHub Actions 工作流默认使用 `fetch-depth: 0`)。没有 Git 时可直接对比两个目录: ```bash agent-config-score compare ../repo-base . --max-drop 0 --fail-on-new-errors ``` -两侧均使用基线策略和豁免。候选改动不能通过提高自己的降分预算或豁免新错误来批准自己;可信调用方的命令行覆盖必须明确传入。 +两侧统一使用**基线**的策略与豁免,因此候选 PR 无法靠调低自身阈值或给自己加豁免来放行。迁移指令文件只有在“同目录、一对一、原文完全一致、目标为新增支持文件”时才不会触发 `instruction-file-removed`(详见[回归覆盖范围(英文)](../regression-coverage.md))。 -v0.24.0+ 仅豁免同一目录内、一对一匹配、文本完全相同且目标为新增文件的移动;现存副本或把根目录规则搬入子目录不能掩盖删除。对比复用扫描时读取的文本,不再重新打开指令文件;请保持两侧目录稳定,编辑后重新检查。[回归覆盖范围(英文)](../regression-coverage.md)。两边都是 `100` 分仍可能有回归专用错误;上面的示例启用了新错误阻断,没有策略的裸 CLI 默认仍只检查降分。 +## 5. 退出码与处理方式 -## 5. 理解失败并处理 - -- `diff` / `compare` 返回 `1`:配置的回归门禁未通过。检查新发现与允许的降分幅度,处理实际指令问题。 -- 疑似误报仍需审核。接受的例外可以使用经基线审核的豁免,填写稳定规则 ID、原因、到期日期;结果保留审计记录。[豁免细节(英文)](../../README.md#auditable-exceptions)。 -- 返回 `2`:检查无法完成,如配置无效、Git 引用缺失、报告不可写。**这不是干净的结果**,不能因为没有 JSON 就批准改动。 +- **返回 `1`(`diff` / `compare`)**:未通过回归门禁。修复指令改动;若确认属于合理例外,则在基线配置中添加带规则 ID、原因和到期日的豁免([可审计豁免(英文)](../../README.md#auditable-exceptions))。 +- **返回 `2`**:运行失败(配置错误、Git 引用缺失、文件不可读、报告不可写等)。**切勿把退出码 `2` 当成通过。** | 命令 | 返回 0 | 返回 1 | 返回 2 | |---|---|---|---| -| 扫描(`agent-config-score .`) | 扫描完成,满足可选门槛 | 低于设置的分数门槛 | 输入无效或操作错误 | +| 扫描(`agent-config-score .`) | 扫描完成,满足可选门槛 | 低于设置的分数门槛 | 输入无效或运行失败 | | `diff`、`compare` | 基线策略通过 | 新错误或降分门禁未通过 | 无法完成比较 | -| `doctor` | 无错误项,可能有警告 | 有错误检查项 | 参数或调用错误 | -| `scope` | 建议性分析完成,可包含未知 | 不使用 | 输入无效或读取失败 | -| `scope compare`、`scope diff`、`scope coverage` | 分析完成或已启用门禁通过 | 已启用的丢失/未知审核门禁触发 | 输入、读取或资源限制错误 | -| 其他命令 | 请求的操作完成 | 不是 lint 门禁 | 输入无效或操作错误 | - -意外的程序错误不会被通用异常捕获隐藏。分享堆栈前先删除私密信息;回归测试通过并不保证程序没有 bug。 +| `doctor` | 无错误项(允许警告) | 存在错误项 | 参数或调用错误 | +| `scope` | 建议性分析完成 | 不使用 | 输入无效或读取失败 | +| `scope compare`、`scope diff`、`scope coverage` | 分析完成或已启用门禁通过 | 已启用的丢失/未知门禁触发 | 输入、读取或限额错误 | +| 其他命令 | 操作完成 | 不使用 | 输入无效或运行失败 | ## 6. 在本地保存报告 @@ -101,60 +92,48 @@ agent-config-score . --html .agent-config-score/report.html --badge .agent-confi agent-config-score diff --markdown .agent-config-score/regression.md ``` -不要把报告放在会被当成指令文件扫描的位置。JSON、HTML、SARIF 和回归报告可能包含仓库路径及发现信息,分享前先检查。输出路径不要选成源码或策略文件,避免覆盖。多个报告写入不是事务:后一个写入失败时,前一个报告可能已生成。 - -v0.24.0+ 还会在 JSON、HTML、SARIF 和新的历史快照中保留声明版本及尽力读取的工具源码 SHA-256;`compare` / `diff` JSON 分别保留两次扫描的身份。它用于区分同版本号的不同实现,本身不证明准确率或可复现性。工具源码缺失时指纹不可用,但不使扫描失效。覆盖范围、兼容性和环境/输入限制见[报告身份说明(英文)](../report-identity.md);不会为旧报告补标新的身份。 +请把报告写到不会被当成指令文件扫描的位置。JSON、HTML、SARIF 和 Markdown 报告可能包含仓库路径和发现信息,对外分享前请先检查。每份报告都会记录工具版本与源码 SHA-256 指纹([报告身份(英文)](../report-identity.md))。 -本地快照方面,v0.25.0+会区分历史不存在和历史损坏/不可读。历史索引无效时,`history` 返回 `2` 且没有成功输出;Python 追加接口不会将它重置。请先备份并修复索引。旧版部分字段记录仍可读取,缺失分数表示未知,不是零分。接口采用完整文件替换,但要求调用方串行写入,不提供并发事务;普通扫描不会自动追加本地历史。[本地历史及恢复说明(英文)](../score-history-cli.md)。这些变化从 v0.25.0 起可用,也不修改不可变的 CI 产物。 +本地历史索引损坏时,`history` 会直接返回 `2` 而不会悄悄重置数据([本地历史与恢复(英文)](../score-history-cli.md))。 -需要隐私最小化草稿时: +如需生成隐私最小化的问题草稿(不会自动上传): ```bash agent-config-score feedback . --output .agent-config-score/case.md ``` -不会上传任何内容。请自行审核、脱敏后再分享。 - -## 可选:检查删除保护缺项(v0.24.0+) +## 可选:删除保护检查 ```bash agent-config-score guardrails . --file AGENTS.md agent-config-score guardrails . --file AGENTS.md --template-language simplified --json ``` -此独立命令只给出选定文件的非计分建议。“未识别到保护”表示需要审核,不等于不安全。默认预览不改文件;审核完整策略上下文和补全文本后,使用打印出的确切确认值,以同一命令加上 `--apply TOKEN` 追加。输入变化须重新预览;有歧义的标记和文件别名需手动合并。英文、简体和繁体补全文本不改变 CLI 界面语言。[语法、范围、隐私及非原子/部分写入限制(英文)](../guardrail-suggestions.md)。现有评分和 CI 默认行为不变。 - -明确标注的示例章节不算有效策略;如果该章节延续到文件末尾,就不能自动追加。少数明确要求跳过删除确认的句式会产生只含行号与类型的 `review_signals`,即使其他位置已识别到保护,也不能自动追加。请先手动处理这些策略;这不是通用的矛盾检测器。 - -v0.25.0+ 可直接选择 `--file`,不先遍历整仓,因此无关指令文件的坏链接不会阻止这次单文件审阅。相关忽略规则和所选路径的祖先目录检查仍生效;目录别名或大小写有歧义的目录须手动接入。其他文件不会因此被验证或修复,普通扫描/doctor 的失败仍须单独处理;追加成功不代表整仓扫描完整或安全。此范围修正从 v0.25.0 起可用。 +`guardrails` 只检查单个指定文件是否包含删除确认保护语句,不计分,也不会触发整仓扫描。默认仅预览建议文本;确认无误后用输出的 `--apply TOKEN` 追加(令牌与当前文件内容绑定)。示例章节、HTML 标记或冲突的绕过语句需要手动合并,详见[删除保护建议(英文)](../guardrail-suggestions.md)。 -## 可选:Cursor 文件上下文分析(v0.25.0+) +## 可选:Cursor 文件上下文与覆盖检查 ```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 ``` -v0.25.0+ 可根据你声明在上下文中的逻辑文件路径,预测根目录 `.cursor/rules/` 项目规则的自动加载条件。不会检查目标文件是否存在。手动引用、模型选择和不支持的元数据保留为未知;inactive 仅表示这些路径未触发规则,不代表实际未加载。多个文件可以触发不同 glob 的规则共同加载。 +`scope` 根据声明的目标路径静态预测根目录 `.cursor/rules/` 的自动加载情况(不计分,手动/模型选择规则保持 `unknown`,详见[模型与限制(英文)](../cursor-scope.md)和[运行示例(英文)](../../examples/cursor-scope/README.md))。 -这是带来源行号、不计分的审核建议,不是实际 Agent 轨迹或阻断门禁。分析完成返回 `0`,包括存在信号/未知的情况;输入或读取失败返回 `2`。原有扫描和回归评分不变。该命令仍使用全仓库支持来源预检查,无关的失效指令链接也可能导致失败。详见[模型与限制(英文)](../cursor-scope.md)及[可运行的合成示例(英文)](../../examples/cursor-scope/README.md)。此命令从 v0.25.0 起可用,需要显式调用 CLI。 - -比较修改前后同一组声明的上下文: +对比同一上下文的改动前后变化,或逐个检查目录下所有普通文件: ```bash agent-config-score scope compare ../repo-base . --target src/web/app.ts --fail-on-lost-directives --fail-on-unknown agent-config-score scope diff origin/main --target src/web/app.ts --fail-on-lost-directives --fail-on-unknown --json ``` -对于实际文件,可将每个枚举到的路径作为独立上下文检查。[逐文件覆盖、排除范围与完整复跑(英文)](../cursor-coverage.md)。 - ```bash agent-config-score scope coverage --base-ref origin/main --under src --fail-on-lost-directives --fail-on-unknown --json ``` -这些 v0.25.0+ 命令分别报告文件变化、触发路径减少,以及精确识别的指令失去全部预计活动来源。另一条活动规则中的相同指令,或仍匹配的其他任务文件,可以保留可用性。两个标志显式启用调用方配置的审核门禁:丢失或未知返回 `1`,操作失败返回 `2`;不带标志时,完成的比较仍为建议性结果(`0`)。基线未识别到活动指令,就没有受保护的指令身份。详见[比较约定与 CI 示例(英文)](../cursor-scope-impact.md)及[四个合成对照(英文)](../../examples/cursor-scope-impact/README.md)。 +不加 `--fail-on-*` 时为建议模式(返回 `0`);加上后,基线生效指令丢失或出现未知规则会返回 `1`。详见[范围对比(英文)](../cursor-scope-impact.md)、[逐文件覆盖(英文)](../cursor-coverage.md)和[四个对照示例(英文)](../../examples/cursor-scope-impact/README.md)。 -## 可选:面向维护者的具体建议(v0.24.0+) +## 可选:`--explain` 与 PR 评论 ```bash agent-config-score . --explain @@ -162,28 +141,28 @@ agent-config-score diff --explain --markdown .agent-config-score/regression.md agent-config-score init --pr-comment --dry-run ``` -`--explain` 在文本/Markdown 中为扫描的有效发现、回归比较的新增发现补充静态处理建议,不改变 JSON、评分或退出策略;不执行命令、不修复文件。[最佳实践清单(英文)](../best-practices.md)也不计分。`init --pr-comment` 显式选择生成同仓库 PR 评论工作流,并提示 `pull-requests: write` 权限;默认 `init` 生成的工作流仍只申请 GitHub 只读权限。先预览、审核,只提交一份工作流;已有冲突须主动审核,不能自动覆盖。Fork PR 保留任务摘要,不发评论。生成的 Action 引用仍为 `v0`,解释摘要需要 v0.24.0+ 或包含该功能的已验证 Action 版本。升级本地 CLI 不会改变已有工作流固定的 Action 版本。详见[维护者流程(英文)](../maintainer-workflow.md)。 +`--explain` 在文本和 Markdown 输出中附带静态处理建议,不改变分数、JSON 或退出码(另见不计分的[最佳实践清单(英文)](../best-practices.md))。`init --pr-comment` 会生成带 `pull-requests: write` 权限的同仓库 PR 评论工作流(Fork PR 仍只输出只读任务摘要)。详见[维护者流程(英文)](../maintainer-workflow.md)。 -仅更新 CI、不读取或重置自定义策略时(v0.24.0+): +如需只更新 CI 工作流而不触碰 `.agentconfigscore.json`: ```bash agent-config-score init --workflow-only --pr-comment --force --dry-run agent-config-score init --workflow-only --pr-comment --force ``` -执行第二条命令前,先将示例与已有工作流的自定义内容比较;`--force` 会替换该工作流,不会合并 YAML。策略文件不在操作范围内,即使缺失或无效也不会读取,请另行运行 `doctor`。选定目标涉及链接、reparse point 或共享文件时须手动接入。初始化会提示生成的 Action 引用,它可能与本地 CLI 版本不同,也不会更新远程引用。写入有预检,但不是原子文件系统事务。 +`--force` 会整体替换工作流文件(不会合并 YAML);请先核对已有自定义配置,并单独运行 `doctor` 验证策略。 ## 常见问题 | 现象 | 检查方法 | |---|---| -| 找不到命令 | 确认装入当前 Python 环境,并检查 Scripts/bin 的 PATH。v0.23.0+ 可用 `python -m agent_config_score`。 | -| 配置或工作流编码错误 | 保存为 UTF-8,不要用 UTF-16 文件替代。 | -| `Unable to read repository path index` | 运行 `doctor`,核对 `repository-paths` 错误并修复目录访问或 I/O 问题。部分索引不会生成成功报告。 | -| 扫描源解析或读取错误 | 在本地核对已选择的指令文件和忽略文件链接,目标必须是仓库内的普通文件;修复失效、循环链接或权限问题。`doctor` 给出 `instructions` 错误,不要把不完整扫描当成通过。 | -| 报告不可写 | 选择可写的文件路径,不是已有目录;检查父目录权限。 | -| 无法检测基线 | 运行 `doctor`,然后指定本地已有的默认分支引用。 | -| 禁止示例被报为危险指令 | 对照[支持的禁止语法(英文)](../instruction-context.md)检查具体上下文;工具不理解任意语言和改写。 | -| 旧 GitHub 运行记录是红色 | 查看当前提交对应的运行。后续修复不会抹掉历史失败记录。 | - -使用前阅读[限制说明](limitations.md)。发现是审核信号,不代替代码审查或安全评估。[翻译范围](../translations.md)。 +| 找不到命令 | 确认当前 Python 环境的 `Scripts`/`bin` 在 `PATH` 中,或改用 `python -m agent_config_score`。 | +| 配置或工作流编码错误 | 保存为 UTF-8,不要使用 UTF-16。 | +| 报告无法写入 | 选择可写文件路径(不是已有目录),并检查父目录权限。 | +| `Unable to read repository path index` | 运行 `doctor`,按 `repository-paths` 错误排查不可读目录。 | +| 扫描源解析或读取错误 | 检查指令文件与忽略文件的符号链接,目标必须是仓库内的普通文件(`doctor` 会报 `instructions`)。 | +| `diff` 无法检测基线 | 运行 `doctor`,然后显式指定本地已有的默认分支引用。 | +| 禁止示例被报为危险指令 | 对照[支持的禁止语法(英文)](../instruction-context.md)核对上下文。 | +| 旧 GitHub 运行记录为红色 | 查看最新提交对应的运行;后续修复不会清除历史失败记录。 | + +用作 CI 门禁前请先阅读[限制说明](limitations.md)。[翻译范围](../translations.md)。 diff --git a/docs/traditional/limitations.md b/docs/traditional/limitations.md index 2e50942..cc1e9cc 100644 --- a/docs/traditional/limitations.md +++ b/docs/traditional/limitations.md @@ -2,134 +2,65 @@ [English](../limitations.md) | [简体中文](../simplified/limitations.md) | 繁體中文 · [使用指南](user-guide.md) -AgentConfigScore 的分數衡量已偵測到、由規則定義的風險,不衡量模型智力、任務成功率或指令整體品質。**A 100 表示沒有命中生效的確定性規則,不是語意品質或安全認證。** +AgentConfigScore 是確定性靜態檢查器與回歸門禁。分數只反映固定規則目錄的命中情況,不衡量模型能力、任務成功率或指令整體品質。 -v0.24.0+ 提供[工具原始碼身分(英文)](../report-identity.md),用來區分宣告同一版本號的不同實作。相同指紋不證明準確率或可重現性:儲存庫輸入、策略、執行環境與檔案系統行為不在該指紋範圍內。工具原始碼缺失時明確記為未知,歷史報告不補標為目前版本。 +**A 100 表示沒有命中生效規則,不是語意品質或安全認證。** -## 設定解析 +全工具共有的基本邊界: -v0.25.0+拒絕各層設定中解碼後重複的 JSON 欄位名稱、非標準 `NaN`/`Infinity` 常數以及布林型別的格式 `version`,不選取重複欄位的第一個或最後一個值。比較的兩側都必須通過驗證;命令列門檻覆寫不能核准格式錯誤的設定。`doctor` 從同一次讀取的內容取得策略及 schema 中繼資料。這些變更從 v0.25.0 起可用。[失敗行為與相容性細節(英文)](../doctor.md#configuration-decoding)。這不證明策略充分、不認證作者、不提供原子快照,也不能復原呼叫端 JSON 解析時已遺失的重複欄位。 +- **純本機靜態分析**:不呼叫 AI 模型、不存取網路,也不執行指令檔中的任何命令。 +- **不是檔案系統沙箱**:路徑、設定與符號連結檢查適用於穩定的本機工作目錄,不針對並行寫入或惡意檔案系統提供原子交易保證。 +- **來源指紋**:報告附帶工具版本與原始碼 SHA-256 指紋([報告身分(英文)](../report-identity.md)),用來識別建置版本,不代表準確率認證。 -v0.25.0+ 設定來源檢查也區分檔案不存在與連結失效,要求設定解析為選定儲存庫根目錄內的一般檔案。儲存庫內的檔案連結與明確根目錄別名仍受支援;越界、循環、非一般檔案或無法讀取的來源報錯,不退回預設值。Git 比較兩側各自滿足邊界;這不對並行路徑替換提供原子保證,也不認證硬連結/掛載身分。僅產生工作流程的初始化與不計分 guardrails 不驗證策略。[相容性與遷移(英文)](../doctor.md#configuration-file-boundary)。這些變更從 v0.25.0 起可用。 +## 哪些問題仍可能得 A 100 -## 本機歷史完整性 +只要避開已啟用的規則,下列情況仍可能得到 100 分: -v0.25.0+區分本機歷史索引不存在與資料損壞/無法讀取。歷史無效時返回操作錯誤 `2`,不是空的成功報告。Python 附加介面拒絕重設損壞的索引,並在同一目錄寫入完整暫存檔案後替換,不直接截斷原記錄。舊版部分欄位快照仍受支援;缺失分數表示未知。含連結或 reparse 的歷史路徑需要手動遷移。這些變更從 v0.25.0 起可用。 +- 空泛、沒有實際幫助但非空白的指令(如 `"Do a good job."`)。 +- 未使用已收錄危險命令或固定句式表達的有害意圖。 +- 經過改寫、措辭不完全一致的指令矛盾。 +- 規則目錄以外的破壞性工具或 shell 寫法。 +- 語法無誤但與實際儲存庫不符的指導。 -歷史驗證不證明記錄真實、策略/工具版本可比或語意品質。附加介面要求呼叫端循序寫入,不提供寫入鎖、惡意檔案系統交易或斷電持久性保證。一般掃描不會自動記錄本機快照;不可變 CI 成品是獨立機制。[復原、保留上限與中繼資料限制(英文)](../score-history-cli.md)。 +我們不靠容易刷分的「最佳實務關鍵字」加分。更廣義的語意評審應放在獨立評測的模型輔助流程中。此外,中文文件只是選用的閱讀入口,**不代表工具能理解任意中文語意**。 -## 指令檔的檔案系統邊界 +## 設定、歷史與檔案系統邊界 -選取的指令檔與 `.agentconfigscoreignore` 必須解析為掃描根目錄內的一般檔案。儲存庫內的檔案符號連結仍受支援;發現位置、Markdown 相對連結與指令作用域使用連結所在位置,不是共享目標的目錄。使用者明確指定的根目錄別名可用,並以其解析後的目錄為邊界。 - -探索過程不跟隨子目錄符號連結或 Windows junction,即使目標在儲存庫內;相依套件、建置目錄,以及明確由 `/**` 忽略模式涵蓋的整棵子樹會在進入前排除,其他忽略模式保留檔名匹配的意義。明確忽略的來源不檢查,也沒有涵蓋範圍的聲明。 - -選取的越界、失效、循環或非一般檔案來源會在開啟內容前失敗;讀取前再次驗證,並開啟解析後的目標。探索、解析或指令內容讀取失敗時,掃描、`compare`、`feedback` 返回 `2`,不產生成功分數或新的成功報告;`doctor` 檢查實際可讀性,提供 `instructions` 錯誤並返回 `1`。這些來源診斷不回顯原始目標路徑或系統錯誤細節。`read-error` 僅為舊報告及舊排除設定保留,不能豁免目前的操作錯誤。 - -這不是檔案系統沙箱,也不是原子快照:並行處理程序仍可能在驗證與開啟之間替換父目錄或目標;不認證硬連結身分或掛載邊界。其他明確輸入、設定或工作流程讀取器、報告輸出是獨立介面,這個守衛不約束工具的所有檔案系統操作。非指令檔的循環連結從路徑索引排除,不代表安全或語意正確。掃描期間應保持儲存庫穩定。[完整英文界線](../limitations.md#instruction-file-filesystem-boundary)。 - -## 高分不代表沒有問題 - -只要避開已知規則,下列內容仍可能得到 100 分: - -- 空泛、沒有實際用途但並非空白的指令。 -- 未透過已知危險命令表達的惡意或有害意圖。 -- 經過改寫、措辭不完全相同的矛盾。 -- 規則目錄以外的破壞性工具或命令形式。 -- 語法正確卻不符合實際儲存庫任務的指導。 - -我們不會藉由容易複製的「最佳實務」關鍵字加分來掩飾限制。模型輔助的語意判斷需要獨立評測與標註資料,不能用更強的宣傳措辭取代。 - -中文文件是選用的閱讀入口。**它不表示偵測規則能理解任意簡體或繁體中文語意。** 英文敘述規則的跨語言表現尚未驗證;中文的否定、範例、改寫與矛盾仍須人工審查。 - -## Cursor 檔案上下文模型(v0.25.0+) - -選用 `scope` 根據宣告的檔案路徑,預測根目錄 `.cursor/rules/` 規則的自動載入。它不計分,不觀察 Cursor、不檢查目標存在性、不解析其他格式/優先順序,也不改變正常掃描和回歸發現。inactive 僅表示這些路徑未觸發規則;手動引用、模型選擇、不支援的中繼資料與執行設定仍未被觀察。多個檔案可觸發不同 glob 的規則共同載入。 - -有限英文語法識別的相反指令對只提供帶來源行號的審閱訊號,不是語意衝突證明。未知載入條件和未解釋的正文會保留;沒有訊號不代表沒有問題。獨立上下文分析完成回傳 `0`,包括存在訊號的情況;輸入/讀取/限制錯誤回傳 `2`。仍會執行全儲存庫支援來源預先檢查。詳見[語法、報告與限制(英文)](../cursor-scope.md)。這些能力尚未包含在已發布 v0.24.0 中,也未實現通用語意約束影響分析或執行驗證。 - -v0.25.0+ [scope 比較命令(英文)](../cursor-scope-impact.md)還可比較兩個目錄或本機 Git 基準下相同的宣告上下文,區分檔案/觸發路徑變化與精確識別的指令失去全部活動來源。相同指令的另一份活動來源或其他仍符合的任務檔案可以保留可用性。選用呼叫端旗標分別對已知識別遺失和未知回傳 `1`;預設比較仍只給建議。不證明語意改寫等價、任意路徑上的範圍收縮或執行時遵守。空/未識別基準保護零個指令身分。這些能力從 v0.25.0 起可用,與現有基準評分策略格式分開。 - -v0.25.0+ 的 [逐檔覆蓋檢查(英文)](../cursor-coverage.md) 列舉兩側儲存庫中經過篩選的一般檔案名稱,逐一建立獨立上下文。報告列出排除數量、檔案在兩側是否存在、來源行號與未知情況。它不讀取目標程式碼內容來判斷任務,也不觀察原生 Cursor;空選擇、讀取失敗及資源上限回傳 `2`,不會默默截斷後給出成功結果。 +- **嚴格 JSON 設定**:`.agentconfigscore.json` 拒絕任意層級的重複鍵名、`NaN`/`Infinity` 以及布林型別 `version`,且必須解析為儲存庫根目錄內的一般檔案。損壞、失效連結或越界設定直接回傳退出碼 `2`(`doctor` 回傳 `1`),不會悄悄回退到預設值([設定解析(英文)](../doctor.md#configuration-decoding))。 +- **本機歷史索引**:歷史檔案損壞或無法讀取時,`history` 回傳 `2` 而不會清空重設;附加寫入採用整檔替換,要求循序呼叫([本機歷史(英文)](../score-history-cli.md))。 +- **指令檔邊界**:選取的指令檔與 `.agentconfigscoreignore` 必須是儲存庫內的一般檔案(支援儲存庫內檔案符號連結,但不進入子目錄符號連結或 Windows junction)。失效、循環、越界或無法讀取的來源會直接中止掃描並回傳 `2`(`doctor` 報 `instructions` 錯誤並回傳 `1`),不回顯原始目標路徑;舊規則 `read-error` 僅為歷史相容保留。 ## 命令與禁止上下文 -`rm-rf`、`git-clean-force`、`docker-system-prune` 解析有限 shell 片段的選項,支援部分重新排序、拆分、長選項、引號內的選項值與明確反斜線續行。shell 分隔符號與 `--` 會停止解讀選項。Git 的預覽/互動模式排除於危險匹配之外;`rm` 後續的互動選項會覆蓋強制模式。排除/過濾選項的值不會被當作執行旗標。 - -片段最多 1,000 個字元。一般運算元之後的選項、變數展開、別名、包裝函式與子命令前的全域選項不解析。其他命令規則仍使用較窄的模式,無法涵蓋所有 shell 語法。 - -可明確識別的英文禁止語句,能涵蓋緊鄰且已閉合的程式碼區塊,或連續的直接命令清單。這不是完整 Markdown 解析器或意圖分類器:沒有標籤的程式碼仍接受危險命令檢查;未閉合區塊不繼承禁止範圍;直接出現的認證資訊會獨立檢查。引號或程式碼圍欄本身也不是通用豁免。 - -複雜的教學範例可能誤報。先核對上下文,再使用附有原因、到期日且經基準審查的排除設定。[具體語法與反例(英文)](../instruction-context.md)。 - -## 提示注入與工作流程規則 - -`prompt-injection-override` 識別 `ignore previous instructions` 等明確英文片語。命中只表示需要審查,不證明發生攻擊。明確禁止及整行標記的攻擊範例可排除;任意改寫、其他語言、執行時工具輸出或遠端內容的注入不在涵蓋範圍。[英文限制說明](../limitations.md#prompt-injection-warnings)。 - -`false-success-report` 要求完整英文敘述子句,明確隱瞞錯誤卻回報成功,或在失敗/未執行時宣稱測試通過。僅略過測試、禁止性描述、引號或程式碼範例不足以符合規則。它不跨句、跨行組合證據,也不檢查實際測試是否執行。其他有害指導仍可能通過。[規則細節(英文)](../verification-reporting.md)。 - -`broad-environment-upload` 要求同一英文子句同時包含明確傳輸行為、完整環境變數來源與網路接收端。只有變數名稱、明確移除敏感資訊、日誌、禁止描述或程式碼範例,不符合此語法。它不讀取處理程序環境、不驗證敏感資訊處理、不解析目標,也不證明惡意意圖或實際傳輸。字面回環位址排除在外,但不分析轉送;shell 上傳、其他語言和任意改寫仍不支援。[規則細節(英文)](../environment-upload.md)。 - -**v0.27.0+** 補充了有限的簡體/繁體中文虛假測試通過句式,並新增 `deletion-approval-bypass`:必須同時有刪除生產資料庫或既有/使用者檔案的明確指令,以及與該操作相連的免授權要求。禁止、正常授權、暫存清理和明確範例與違規正例分開測試。這些改進從 v0.27.0 起可用;不代表通用語義判斷、任意中文涵蓋或執行時攔截。空泛指導仍可能得高分。[新增規則及邊界(英文)](../deletion-approval-bypass.md)。 - -## 本機 Markdown 連結 - -簡單的行內連結、圖片目標依指令檔目錄檢查。支援 URL 編碼空格與尖括號目標;只檢查檔案是否存在,不檢查片段對應的標題。遠端連結、純錨點、程式碼區塊範例、絕對路徑與離開儲存庫的路徑會略過。行內目標中巢狀括號暫不解析。這不是完整 Markdown 驗證工具。 - -v0.25.0+也檢查簡單的 `[指南][setup]`、`[setup][]` 參照式連結及圖片,要求同一指令檔內有 `[setup]: GUIDE.md` 這類單行定義。目標仍嚴格依文件目錄解析;實際使用的缺失目標在定義行回報一次。標籤忽略 Unicode 大小寫並正規化 ASCII 空白,首個相符定義優先(包括遠端目標及純錨點);未使用的已支援定義、已解析的顯示文字不會重複視為敘述路徑。這些變更從 v0.25.0 起可用。 - -此子集只處理無跳脫/巢狀括號、最長 999 字元的標籤,縮排零至三個空格的頂層單行定義,以及裸目標/尖括號目標和選用的單行標題;定義不能打斷一般段落。程式碼區塊、縮排程式碼、已跳脫連結及相符的行內程式碼不啟用新的參照檢查。簡寫 `[setup]`、跨行語法、容器內定義、含跳脫或括號的目標、HTML 類配置須人工檢查;首個定義不明確時不會猜用後續副本。既有行內/敘述檢查及危險命令規則仍執行;它不是完整 Markdown 解析器,也不證明目標內容正確。[詳細界線(英文)](../limitations.md#local-markdown-links)。 - -## 一般敘述中的路徑 - -目錄引用須同時具有明確的 `./` 或 `../` 前綴與末尾 `/`,如 `./packages/`、`../src/`,才檢查適用儲存庫/指令作用域內的真實目錄;一般檔案不能滿足目錄引用,目錄也不使用模糊後綴匹配。無前綴的 `packages/`、`dist/`、`.husky/_/` 及沒有末尾斜杠的 `test/unit` 不推論,因為它們可能指套件內位置或安裝/建置產物。實際的 Markdown 目錄連結仍按文件相對位置檢查。 - -v0.26.2+ 增加兩項有界處理:同一行緊鄰路徑、完整且閉合的 `` `docs/out.json` is generated by `make docs` ``(也支援 `generated from`、`regenerated`、`rewritten`)僅將產物視為可在建置後出現;產生者須為單反引號程式碼,末尾可帶簡短括號說明。產生器自身的檔案路徑、實際的 Markdown 連結、危險命令與認證資訊仍檢查。不驗證產生宣告是否真實,不執行建置;否定、條件、未閉合或繼續擴展的子句不豁免。 - -未加反引號的目錄敘述、分支、URL、範例佔位符及越界路徑繼續排除。PyPI v0.26.1 的既有報告不因這些原始碼變更而重寫。 - -反引號中的 `./`、`../` 檔案路徑依儲存庫根目錄及適用的指令目錄檢查;巢狀 AGENTS 檔保留儲存庫內祖先目錄的解釋,其他格式也接受明確的文件相對路徑。這些路徑不會因無關套件有相同後綴而通過。`.github` 等名稱的開頭圓點會保留;所有解釋都離開儲存庫時,不存取外部路徑,也不以索引中的其他檔案替代。實際的 Markdown 連結仍嚴格依文件目錄解析。 - -無前綴的敘述路徑仍使用保守的套件相對後綴匹配。兩種模式都不推論命令的工作目錄、不執行或追蹤 `cd` 指令,也不證明哪一種解釋符合作者意圖。 - -只在緊鄰路徑且閉合的 `(if exists)`、`(if it exists)` 條件下,將對應敘述路徑視為選用;括號內 `-` 或 `:` 後可附簡短說明。實際的 Markdown 連結仍檢查目標。同一行的其他路徑、遠處的「選用」字樣、未閉合條件不會因此豁免。 - -`owner/tool.js` 這類兩段名稱,只在明確的同一行儲存庫角色語法中略過:後接 `repository`/`remote` 及標點,或前接 `merge target is`、`fork of`、`re-pushed to a branch in`、`CI trusts branches inside`;也識別相同儲存庫名稱的 `fork of ... and not ... itself` 形式。僅提到 GitHub 或儲存庫,不會讓本機路徑免檢。其他改寫及語言仍可能誤判。[完整英文界線](../limitations.md#plain-prose-path-references)。 - -套件相對路徑的後綴索引包含 `build`、`dist`、`target`、`.next` 中已存在的路徑,但不會因此擴大指令檔的探索範圍。相依套件、管理目錄仍排除於後綴索引之外;不遍歷目錄符號連結,也不索引外部或失效連結。存在不代表內容正確或路徑意圖明確;未產生的檔案仍可能被回報缺失,大小寫判斷依賴宿主檔案系統。這些豁免不會關閉危險命令或認證資訊檢查。 - -建立索引時的目錄遍歷錯誤會停止掃描,不將部分索引當成乾淨結果或檔案缺失的證據。掃描、`compare`、`feedback` 返回 `2`,不輸出成功報告;`doctor` 提供 `repository-paths` 錯誤項並返回 `1`。已排除的相依套件、管理目錄仍不遍歷。這是本機檔案系統檢查,不是僅限 Git 追蹤檔案的索引,也不是原子檔案系統快照。 - -## 回歸保護的具體範圍 - -- 沒有支援的指令檔會產生 `no-config`;空白檔案會產生 `empty-instructions`,不會顯示 A 等級。 -- 生效的錯誤發現會限制等級,不會只因數值懲罰較小就顯示 A。 -- 可以偵測精確指令形式的矛盾,但不保證識別改寫後的語意矛盾。 -- 刪除指令檔會產生回歸專用的 `instruction-file-removed`;v0.24.0+ 僅豁免同目錄內、一對一配對、非空白且解碼文字完全相同的新增檔案搬移。既有副本、跨目錄搬移及折疊空白後才相同的內容不能豁免;不證明不同工具格式、優先順序或實際作用域等價。 -- 相同指令正文的明確極性翻轉會產生 `directive-polarity-flip`,不推論任意語意相反的句子。 - -對應行為有回歸測試,基準審查的排除設定可記錄有意接受的例外。測試通過只證明符合這些已指定的行為。 - -v0.24.0+ 的比較邏輯重用每次掃描擷取的文字,不再二次讀取並略過讀取失敗;初次讀取失敗仍中止檢查,原始擷取文字不保留於公開報告物件或匯出中。這不是原子快照或並行修改偵測,應保持兩側目錄穩定,編輯後重跑。回歸專用錯誤不扣數值分;兩邊 `100` 分仍須透過基準 `fail_on_new_errors` 或 `--fail-on-new-errors` 阻擋。裸 CLI 僅檢查降分的預設值不變。[完整界線(英文)](../regression-coverage.md)。 +`rm-rf`、`git-clean-force`、`docker-system-prune` 會對受限長度(1,000 字元內)的 shell 片段做選項解析,支援重排、拆分、長選項、引號值與反斜線續行,並在分隔符號或 `--` 處停止。Git 預覽/互動模式、`rm` 後續互動選項以及過濾參數值不會誤判;運算元之後的選項、變數展開、別名與包裝函式不解析。 -v0.24.0+ 的[刪除保護補全功能(英文)](../guardrail-suggestions.md)是獨立的不計分建議,不靠安全關鍵字加分。它只識別選定檔案中的有限句式,不繼承其他檔案、工具權限或沙箱設定;未識別到不證明缺少保護,識別到也不證明完整或會被執行。預設僅提供唯讀預覽,追加必須明確確認,且不是原子交易,寫入失敗可能留下部分追加片段。既有評分與 CI 檢查不變。 +明確標示的禁止語句可涵蓋緊鄰的閉合程式碼區塊或連續命令清單;未標示區塊、未閉合區塊不會自動豁免,認證資訊規則始終獨立生效([指令上下文(英文)](../instruction-context.md))。 -v0.24.0+ 的 `--explain` 和[維護者清單(英文)](../best-practices.md)只給靜態審閱建議,不增加偵測範圍、不自動修復,也不執行引用的命令、猜測替代路徑或改變評分。選用的 `init --pr-comment` 產生明確帶有寫入權限的工作流程,本身不發評論;預設產生的工作流程仍僅申請 GitHub 唯讀權限。詳見[維護者流程(英文)](../maintainer-workflow.md)。 +## 提示注入與敘述安全規則 -明確的範例標題會排除其章節;範例章節延續到檔案末尾時須手動合併。HTML 類標籤會讓整個選定檔案停止策略識別。少數略過刪除確認的明確句式,即使與已識別的保護並存,也須先手動處理;這些只是不計分的審閱訊號,不代表完整的衝突偵測或實際代理行為。 +- **`prompt-injection-override`**:識別 `ignore previous instructions` 等明確英文覆寫片語。明確禁止、整行標示範例與緊鄰禁止區塊可排除,但純引號或程式碼圍欄不自動豁免;任意改寫、其他語言及執行時工具輸出注入不在涵蓋範圍內([英文詳細邊界](../limitations.md#prompt-injection-warnings))。 +- **`false-success-report`**:涵蓋單句英文隱瞞錯誤回報成功,以及英文與有限簡體/繁體中文的「測試失敗或未執行仍宣稱通過」句式;不跨句拼接,也不檢查測試是否真的執行([規則細節(英文)](../verification-reporting.md))。 +- **`deletion-approval-bypass`**:涵蓋英文與有限中文中同時包含「刪除生產資料庫或既有/使用者檔案」與「免授權」的明確句式;正常授權、暫存清理、禁止語句與範例分開處理([規則細節(英文)](../deletion-approval-bypass.md))。 +- **`broad-environment-upload`**:要求同一英文子句同時出現傳輸動作、完整環境變數來源與非回環網路目標;僅列變數名、移除敏感資訊、日誌、禁止句與程式碼範例不觸發([規則細節(英文)](../environment-upload.md))。 -v0.24.0+ 的 `init --workflow-only` 將策略排除在讀寫範圍外,即使使用 `--force` 也不會重設策略,但也不會驗證策略。初始化選定目標若涉及連結、reparse point、共用檔案或非一般檔案,須手動整合。獨佔建立與已開啟檔案檢查減少誤寫風險,不代表完全消除檔案系統競爭;初始化不是原子交易,寫入失敗可能留下部分檔案。產生的 `@v0` 不一定與本機 CLI 原始碼相同。 +## 本機 Markdown 連結與敘述路徑 -v0.25.0+ 不再為單檔保護審閱先遍歷整個儲存庫,僅檢查相關排除規則、所選路徑的祖先目錄及父目錄名稱。無關的失效連結、外部或非一般指令檔不在本次驗證/修復範圍內;目錄別名、reparse 祖先及大小寫有歧義的目錄須手動整合。整個儲存庫的掃描及 doctor 仍會因不安全來源報錯,單檔審閱/追加成功不代表整體檢查通過。此修正從 v0.25.0 起可用,確認及非原子追加界線不變。 +- **Markdown 連結**:檢查行內連結、圖片,以及同檔單行定義的簡單參照式連結(`[指南][setup]`、`[setup][]`),依指令檔所在目錄解析。略過遠端連結、純錨點、程式碼區塊、相符的行內程式碼、跳脫左括號、絕對路徑與越界路徑;簡寫參照、跨行定義、容器內定義、巢狀括號與 HTML 排版需人工核對([英文詳細邊界](../limitations.md#local-markdown-links))。 +- **明確相對路徑(`./`、`../`)**:依儲存庫根目錄及適用的指令作用域目錄核對,不走無關套件後綴兜底。帶 `./` 或 `../` 且以 `/` 結尾的單反引號目錄引用要求目標為真實目錄;無前綴的 `packages/`、`dist/`、`test/unit` 不做猜測。 +- **無前綴檔案路徑**:使用保守的套件相對後綴索引(包含 `build`、`dist`、`target`、`.next` 中已存在的檔案,但略過相依套件/管理目錄與目錄符號連結)。建立索引遇到目錄遍歷錯誤時直接回傳 `2`,不會用不完整索引繼續掃描。 +- **窄範圍非必需豁免**:緊鄰的 `(if exists)` / `(if it exists)`、同行的被動產生宣告(如 `` `docs/out.json` is generated by `make docs` ``),以及明確儲存庫角色中的 `owner/tool.js` 兩段名稱只豁免對應敘述路徑;實際的 Markdown 連結、產生器路徑、危險命令與認證資訊不受影響([英文詳細邊界](../limitations.md#plain-prose-path-references))。 -## 評測尚未證明什麼 +## Cursor 上下文、回歸門禁與輔助命令 -持續維護的離線對抗案例目前有 474/474 個確定性契約符合預期;公開挑戰中偵測到 6/8,仍保留兩個語意漏報。這是封閉開發案例的回歸結果,**不是實際儲存庫的準確率**。修正已知的虛假成功回報與環境上傳案例是開發進展,不是獨立準確率估計。 +- **Cursor `scope` / `coverage`**:靜態預測根目錄 `.cursor/rules/` 的自動載入情況;手動/模型選擇規則與不支援的正文保持 `unknown`,不觀察 Cursor 實際執行([cursor-scope](../cursor-scope.md)、[cursor-coverage](../cursor-coverage.md))。 +- **回歸門禁**:缺少指令檔(`no-config`)、空白檔案(`empty-instructions`)及任意生效錯誤都會把等級限制在 A 以下。`instruction-file-removed` 僅豁免同目錄內一對一、原文完全一致的新增檔案搬移;`directive-polarity-flip` 與 `contradiction` 僅比對精確指令正文([回歸涵蓋範圍(英文)](../regression-coverage.md))。兩側同為 100 分時,需開啟 `fail_on_new_errors` 才會阻擋回歸專用錯誤。 +- **`--explain`、`init` 與 `guardrails`**:`--explain` 只補充靜態建議,不自動修改檔案;`init --pr-comment` 明確申請 `pull-requests: write`,預設 `init` 保持唯讀;`guardrails` 為單檔不計分檢查,追加寫入需明確確認權杖([維護者流程(英文)](../maintainer-workflow.md)、[刪除保護(英文)](../guardrail-suggestions.md))。 -與直接 AI 審查的獨立對照尚未完成。比較工具包含已知的合成校準資料與暫定標籤;未回答、未審查、未執行、參考標籤尚未解決的情況,不會被視為已完成的成功測量。一次未定論 AI 預審、失敗的原始碼取得,以及公開儲存庫片段,都不是已驗證的使用者回饋或優於 AI 的證據。[評測方法(英文)](../review-comparison.md)。 +## 評測邊界 -## 合適的用途 +- **離線對抗案例集**:474/474 項確定性契約全部相符,8 項公開挑戰偵測到 6/8(剩餘 2 項為語意漏報)。這是封閉回歸集,不代表真實儲存庫準確率。 +- **AI 對比評測**:目前尚未完成具獨立人工仲裁標籤的留出集對比([評測方法(英文)](../review-comparison.md))。 -用於發現穩定規則涵蓋的具體回歸、在 CI 中審閱發現,以及保留例外稽核紀錄。不要作為產生的程式碼、儲存庫安全或指令品質的唯一核准依據。安裝驗收、文件在地化與真實使用者價值是不同問題。 +## 適用方式 -本文依英文限制說明整理,保留核心界線;歷史版本逐項比較表和外部手冊引用請見[英文原文](../limitations.md)。[翻譯範圍與維護說明](../translations.md)。 +把 AgentConfigScore 用作穩定的確定性回歸門禁與例外稽核工具,而不是產出程式碼、儲存庫安全或指令品質的唯一核准依據。[翻譯範圍與維護說明](../translations.md)。 diff --git a/docs/traditional/user-guide.md b/docs/traditional/user-guide.md index 6be2d9f..b255f97 100644 --- a/docs/traditional/user-guide.md +++ b/docs/traditional/user-guide.md @@ -2,13 +2,13 @@ [English](../user-guide.md) | [简体中文](../simplified/user-guide.md) | 繁體中文 · [專案首頁](../../README.traditional.md) -AgentConfigScore 是在本機執行、結果確定的開發助手指令檢查工具與 PR 回歸檢查。它不呼叫 AI 服務,也不執行指令檔內的命令。100 分不代表指令實用、始終安全或優於 AI 審查。 +AgentConfigScore 是在本機執行的確定性程式開發助手指令檢查器與 PR 回歸門禁。它不呼叫 AI 服務,不執行指令檔內的命令,也不是檔案系統沙箱。100 分只表示沒有命中生效規則,不代表指令完整或絕對安全。 -[可執行的設計示範(英文)](../../examples/regression-lab/README.md) 展示僅看分數變化與採用基準新錯誤檢查的差異。正常通過的對照及明確呼叫端覆寫都是合成開發範例,不是真實使用者案例或 AI 對照評測;示範腳本需要原始碼儲存庫。 +若想直觀對比「只看分數變化」與「基準新錯誤門禁」的差異,可在原始碼儲存庫中執行[回歸設計示範(英文)](../../examples/regression-lab/README.md)。 -## 1. 安裝並確認版本 +## 1. 安裝 -需要 Python 3.10+。`diff` 需要 Git;一般目錄掃描和兩個目錄之間的 `compare` 不需要 Git。 +需要 Python 3.10+。`diff` 還需要 Git;一般目錄掃描和 `compare` 不需要 Git。 ```bash python -m pip install agent-config-score @@ -16,9 +16,9 @@ agent-config-score --version agent-config-score --help ``` -`acs` 是較短的命令別名。v0.23.0+ 支援相同功能的 `python -m agent_config_score`,不依賴主命令的 PATH 設定。舊版本沒有此模組入口。請查看[已發布版本](https://github.com/LE0-Lin/AgentConfigScore/releases),不要假設 `main` 的改動已經出現在 PyPI 或滾動 `v0` 參照。 +也可以使用短別名 `acs`,或在 `PATH` 未設定時直接執行 `python -m agent_config_score`。PyPI 與 `main` 分支的差異請以[已發布版本](https://github.com/LE0-Lin/AgentConfigScore/releases)為準。 -## 2. 在自己的儲存庫初始化 +## 2. 初始化儲存庫 ```bash agent-config-score init --dry-run @@ -26,17 +26,15 @@ agent-config-score init agent-config-score doctor ``` -`init` 建立 `.agentconfigscore.json` 和 `.github/workflows/agent-config-score.yml`,不建立或改寫指令檔。既有衝突檔案預設不覆寫;使用 `--force` 前請先檢查。若內容與產生的設定相同,重複初始化不會改動檔案。 +`init` 會建立 `.agentconfigscore.json` 與 `.github/workflows/agent-config-score.yml`,不會改動你的指令檔。既有衝突檔案預設不覆寫(須明確加 `--force`),內容一致時重複執行不會修改檔案。審閱後提交產生的檔案即可;若只需要本機檢查,使用 `init --no-workflow`。 -審閱後提交產生的設定與工作流程。只想在本機使用時選 `init --no-workflow`;缺少標準工作流程只會成為 doctor 的提示性警告,不是錯誤。 +設定注意事項: -v0.25.0+拒絕設定中重複的欄位名稱(包括巢狀物件及跳脫拼寫)、`NaN`/`Infinity` 常數與布林型別的格式 `version`,不會悄悄採用覆蓋後的值。請審閱並為每個欄位保留一個值。掃描、`feedback`、`diff` 與 `compare` 返回 `2` 且不產生成功報告;doctor 提供 `config` 錯誤並返回 `1`。命令列門檻覆寫不能略過設定驗證;缺少設定時的預設行為不變。這些變更從 v0.25.0 起可用。[設定解析細節(英文)](../doctor.md#configuration-decoding)。 +- `.agentconfigscore.json` 必須是嚴格有效的 JSON(不允許重複鍵名、`NaN`/`Infinity` 或布林型別 `version`),且必須解析為儲存庫根目錄內的一般檔案。檔案缺失時回退到預設值;損壞、失效連結或越界設定會直接回傳退出碼 `2`(`doctor` 回傳 `1`)。 +- 詳見[設定解析與邊界(英文)](../doctor.md#configuration-decoding)。 +- 若 `doctor` 未找到支援的指令檔,可依儲存庫實際情況撰寫,或參考[範本(英文)](../../examples/README.md)與[掃描範圍(英文)](../../README.md#what-it-scans)。 -v0.25.0+ 設定來源檢查也要求 `.agentconfigscore.json` 解析為選定儲存庫根目錄內的一般檔案。只有目錄項目不存在時才使用預設值;失效、越界、循環或無法讀取的來源均報錯。儲存庫內的檔案連結與使用者明確指定的根目錄別名仍受支援。共享設定宜使用指向已追蹤檔案的相對連結,確保每個 Git 基準都有自己的儲存庫內目標。檢查期間保持目錄穩定;這不是原子檔案系統沙箱。無效連結須明確修復,不要刪除連結來繞過策略。[設定邊界與遷移(英文)](../doctor.md#configuration-file-boundary)。升級時請分別審閱所選套件與 Action 版本。 - -若沒有找到支援的指令檔,請撰寫符合儲存庫實際需求的指令,或使用[範本(英文)](../../examples/README.md)。不要只為提高分數添加詞句。[完整探索範圍(英文)](../../README.md#what-it-scans)。 - -## 3. 檢查目前目錄 +## 3. 本機掃描 ```bash agent-config-score . @@ -44,13 +42,13 @@ agent-config-score rules agent-config-score rules curl-pipe-shell ``` -一般掃描預設回報結果,不會只因有發現就自動阻擋後續操作。需要絕對分數門檻時,在策略中設定 `fail_under` 或明確傳入: +一般掃描預設只輸出發現項目並回傳 `0`。如需絕對分數門檻,可在 `.agentconfigscore.json` 中設定 `fail_under` 或透過命令列傳入: ```bash agent-config-score . --fail-under 90 ``` -儲存庫不必先達到 90 分才能導入回歸檢查。請依規則、位置與上下文審閱結果,不要把分數當成整體品質排名。 +不必先把儲存庫做到 90 分再導入 PR 回歸門禁。請結合規則 ID、位置與上下文檢視結果,不要把分數當成整體品質排名。 ## 4. 推送前檢查改動 @@ -58,40 +56,33 @@ agent-config-score . --fail-under 90 agent-config-score diff ``` -包含尚未提交的工作目錄改動。盡可能使用本機已存在的安全預設分支基準,不會自動 fetch。也能明確指定: +`diff` 會把目前工作目錄(含未提交改動)與本機既有的預設分支對比,不會自動 `git fetch`。也可明確指定基準參照: ```bash agent-config-score diff origin/main ``` -如果參照不存在,請自行取得該分支。應選專案真正的預設分支,而不是已經包含改動的功能分支。淺層複製需要足夠的歷史;產生的 Actions 工作流程使用 `fetch-depth: 0`。 - -沒有 Git 時,可以比較兩個已存在的目錄: +淺層複製請先拉取足夠歷史(產生的 GitHub Actions 工作流程預設使用 `fetch-depth: 0`)。沒有 Git 時可直接對比兩個目錄: ```bash agent-config-score compare ../repo-base . --max-drop 0 --fail-on-new-errors ``` -兩側都套用基準策略與排除設定。候選改動不能藉由增加自己的降分預算或排除新錯誤來核准自身;受信任呼叫端若要覆寫命令列設定,必須明確傳入。 +兩側統一套用**基準**的策略與排除設定,因此候選 PR 無法靠調低自身門檻或替自己加例外來放行。搬移指令檔只有在「同目錄、一對一、原文完全一致、目標為新增支援檔案」時才不會觸發 `instruction-file-removed`(詳見[回歸涵蓋範圍(英文)](../regression-coverage.md))。 -v0.24.0+ 僅豁免同一目錄內、一對一配對、文字完全相同且目標為新增檔案的搬移;既有副本或把根目錄規則搬入子目錄不能掩蓋刪除。比較重用掃描時讀取的文字,不再重新開啟指令檔;請保持兩側目錄穩定,編輯後重新檢查。[回歸涵蓋範圍(英文)](../regression-coverage.md)。兩邊都是 `100` 分仍可能有回歸專用錯誤;上述範例啟用了新錯誤阻擋,沒有策略的裸 CLI 預設仍只檢查降分。 +## 5. 退出碼與處理方式 -## 5. 理解失敗並處理 +- **回傳 `1`(`diff` / `compare`)**:未通過回歸門禁。修正指令改動;若確認屬於合理例外,則在基準設定中加入附規則 ID、原因與到期日的排除項目([可稽核例外(英文)](../../README.md#auditable-exceptions))。 +- **回傳 `2`**:執行失敗(設定錯誤、Git 參照缺失、檔案無法讀取、報告無法寫入等)。**切勿把退出碼 `2` 當成通過。** -- `diff` / `compare` 返回 `1`:設定的回歸檢查未通過。檢查新增發現與允許的降分幅度,處理實際指令問題。 -- 疑似誤報仍須審閱。接受的例外可以使用經基準審查的排除設定,指定穩定規則 ID、原因與到期日;結果仍保留稽核紀錄。[例外細節(英文)](../../README.md#auditable-exceptions)。 -- 返回 `2`:檢查無法完成,例如設定無效、Git 參照不存在或報告無法寫入。**這不是乾淨的結果**,不能因為沒有 JSON 就核准改動。 - -| 命令 | 返回 0 | 返回 1 | 返回 2 | +| 命令 | 回傳 0 | 回傳 1 | 回傳 2 | |---|---|---|---| -| 掃描(`agent-config-score .`) | 掃描完成,符合選用門檻 | 低於設定的分數門檻 | 輸入無效或操作錯誤 | -| `diff`、`compare` | 基準策略通過 | 新錯誤或降分檢查未通過 | 無法完成比較 | -| `doctor` | 無錯誤項目,可能有警告 | 有錯誤檢查項目 | 參數或呼叫錯誤 | -| `scope` | 建議性分析完成,可包含未知 | 不使用 | 輸入無效或讀取失敗 | -| `scope compare`、`scope diff`、`scope coverage` | 分析完成或已啟用檢查通過 | 已啟用的遺失/未知審閱檢查觸發 | 輸入、讀取或資源限制錯誤 | -| 其他命令 | 要求的操作完成 | 不是 lint 門檻檢查 | 輸入無效或操作錯誤 | - -非預期的程式錯誤不會被通用例外處理隱藏。分享堆疊資訊前請移除私人內容;回歸測試通過不保證程式沒有 bug。 +| 掃描(`agent-config-score .`) | 掃描完成,符合選用門檻 | 低於設定的分數門檻 | 輸入無效或執行失敗 | +| `diff`、`compare` | 基準策略通過 | 新錯誤或降分門禁未通過 | 無法完成比較 | +| `doctor` | 無錯誤項目(允許警告) | 存在錯誤項目 | 參數或呼叫錯誤 | +| `scope` | 建議性分析完成 | 不使用 | 輸入無效或讀取失敗 | +| `scope compare`、`scope diff`、`scope coverage` | 分析完成或已啟用門禁通過 | 已啟用的遺失/未知門禁觸發 | 輸入、讀取或限額錯誤 | +| 其他命令 | 操作完成 | 不使用 | 輸入無效或執行失敗 | ## 6. 在本機儲存報告 @@ -101,60 +92,48 @@ agent-config-score . --html .agent-config-score/report.html --badge .agent-confi agent-config-score diff --markdown .agent-config-score/regression.md ``` -不要將報告放在會被視為指令檔掃描的位置。JSON、HTML、SARIF 與回歸報告可能包含儲存庫路徑和檢查資訊,分享前請先檢查。輸出路徑不要選擇原始碼或策略檔案,以免覆寫。多份報告寫入不是交易:後一份寫入失敗時,前一份可能已經產生。 - -v0.24.0+ 也會在 JSON、HTML、SARIF 與新的歷史快照中保留宣告版本及盡力讀取的工具原始碼 SHA-256;`compare` / `diff` JSON 分別保留兩次掃描的身分。它用來區分同版本號的不同實作,本身不證明準確率或可重現性。工具原始碼缺失時指紋不可用,但不使掃描失效。涵蓋範圍、相容性及環境/輸入限制見[報告身分說明(英文)](../report-identity.md);不會為舊報告補標新的身分。 +請把報告寫到不會被視為指令檔掃描的位置。JSON、HTML、SARIF 與 Markdown 報告可能包含儲存庫路徑與發現訊息,對外分享前請先檢查。每份報告都會記錄工具版本與原始碼 SHA-256 指紋([報告身分(英文)](../report-identity.md))。 -本機快照方面,v0.25.0+會區分歷史不存在和歷史損壞/無法讀取。歷史索引無效時,`history` 返回 `2` 且沒有成功輸出;Python 附加介面不會將它重設。請先備份並修復索引。舊版部分欄位記錄仍可讀取,缺失分數表示未知,不是零分。介面採用完整檔案替換,但要求呼叫端循序寫入,不提供並行交易;一般掃描不會自動附加本機歷史。[本機歷史與復原說明(英文)](../score-history-cli.md)。這些變更從 v0.25.0 起可用,也不修改不可變的 CI 成品。 +本機歷史索引損壞時,`history` 會直接回傳 `2` 而不會悄悄重設資料([本機歷史與復原(英文)](../score-history-cli.md))。 -需要盡量減少私人資訊的草稿時: +如需產生隱私最小化的問題草稿(不會自動上傳): ```bash agent-config-score feedback . --output .agent-config-score/case.md ``` -不會上傳任何內容。請自行審閱並移除敏感資訊後再分享。 - -## 選用:檢查刪除保護缺項(v0.24.0+) +## 選用:刪除保護檢查 ```bash agent-config-score guardrails . --file AGENTS.md agent-config-score guardrails . --file AGENTS.md --template-language simplified --json ``` -此獨立命令僅提供選定檔案的不計分建議。「未識別到保護」表示需要審閱,不等於不安全。預設預覽不改檔案;審閱完整策略脈絡及補全文字後,使用列出的確切確認值,以同一命令加上 `--apply TOKEN` 追加。輸入改變須重新預覽;有歧義的標記與檔案別名需手動合併。英文、簡體及繁體補全文字不改變 CLI 介面語言。[語法、範圍、隱私及非原子/部分寫入限制(英文)](../guardrail-suggestions.md)。既有評分與 CI 預設行為不變。 - -明確標示的範例章節不算有效策略;如果該章節延續到檔案末尾,就不能自動追加。少數明確要求略過刪除確認的句式會產生只含行號與類型的 `review_signals`,即使其他位置已識別到保護,也不能自動追加。請先手動處理這些策略;這不是通用的矛盾偵測器。 - -v0.25.0+ 可直接選擇 `--file`,不先遍歷整個儲存庫,因此無關指令檔的失效連結不會阻止這次單檔審閱。相關排除規則及所選路徑的祖先目錄檢查仍生效;目錄別名或大小寫有歧義的目錄須手動整合。其他檔案不會因此被驗證或修復,一般掃描/doctor 的失敗仍須另行處理;追加成功不代表整個儲存庫已完整掃描或安全。此範圍修正從 v0.25.0 起可用。 +`guardrails` 只檢查單一指定檔案是否包含刪除確認保護語句,不計分,也不會觸發全儲存庫掃描。預設僅預覽建議文字;確認無誤後用輸出的 `--apply TOKEN` 追加(權杖與目前檔案內容綁定)。範例章節、HTML 標記或衝突的繞過語句需要手動合併,詳見[刪除保護建議(英文)](../guardrail-suggestions.md)。 -## 選用:Cursor 檔案上下文分析(v0.25.0+) +## 選用:Cursor 檔案上下文與覆蓋檢查 ```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 ``` -v0.25.0+ 可根據你宣告在上下文中的邏輯檔案路徑,預測根目錄 `.cursor/rules/` 專案規則的自動載入條件。不會檢查目標檔案是否存在。手動引用、模型選擇和不支援的中繼資料保留為未知;inactive 僅表示這些路徑未觸發規則,不代表實際未載入。多個檔案可以觸發不同 glob 的規則共同載入。 +`scope` 根據宣告的目標路徑靜態預測根目錄 `.cursor/rules/` 的自動載入情況(不計分,手動/模型選擇規則保持 `unknown`,詳見[模型與限制(英文)](../cursor-scope.md)與[執行範例(英文)](../../examples/cursor-scope/README.md))。 -這是帶來源行號、不計分的審閱建議,不是實際 Agent 軌跡或阻斷門禁。分析完成回傳 `0`,包括存在訊號/未知的情況;輸入或讀取失敗回傳 `2`。原有掃描和回歸評分不變。此命令仍使用全儲存庫支援來源預先檢查,無關的失效指令連結也可能導致失敗。詳見[模型與限制(英文)](../cursor-scope.md)及[可執行的合成範例(英文)](../../examples/cursor-scope/README.md)。此命令從 v0.25.0 起可用,需要明確呼叫 CLI。 - -比較修改前後同一組宣告的上下文: +對比同一上下文的改動前後變化,或逐一檢查目錄下所有一般檔案: ```bash agent-config-score scope compare ../repo-base . --target src/web/app.ts --fail-on-lost-directives --fail-on-unknown agent-config-score scope diff origin/main --target src/web/app.ts --fail-on-lost-directives --fail-on-unknown --json ``` -對於實際檔案,可將每個列舉到的路徑作為獨立上下文檢查。[逐檔覆蓋、排除範圍與完整重現(英文)](../cursor-coverage.md)。 - ```bash agent-config-score scope coverage --base-ref origin/main --under src --fail-on-lost-directives --fail-on-unknown --json ``` -這些 v0.25.0+ 命令分別報告檔案變化、觸發路徑減少,以及精確識別的指令失去全部預測活動來源。另一條活動規則中的相同指令,或仍符合的其他任務檔案,可以保留可用性。兩個旗標明確啟用呼叫端設定的審閱門禁:遺失或未知回傳 `1`,操作失敗回傳 `2`;不帶旗標時,完成的比較仍為建議性結果(`0`)。基準未識別到活動指令,就沒有受保護的指令身分。詳見[比較約定與 CI 範例(英文)](../cursor-scope-impact.md)及[四個合成對照(英文)](../../examples/cursor-scope-impact/README.md)。 +不加 `--fail-on-*` 時為建議模式(回傳 `0`);加上後,基準生效指令遺失或出現未知規則會回傳 `1`。詳見[範圍對比(英文)](../cursor-scope-impact.md)、[逐檔覆蓋(英文)](../cursor-coverage.md)與[四個對照範例(英文)](../../examples/cursor-scope-impact/README.md)。 -## 選用:面向維護者的具體建議(v0.24.0+) +## 選用:`--explain` 與 PR 評論 ```bash agent-config-score . --explain @@ -162,28 +141,28 @@ agent-config-score diff --explain --markdown .agent-config-score/regression.md agent-config-score init --pr-comment --dry-run ``` -`--explain` 在文字/Markdown 中為掃描的有效發現、回歸比較的新增發現補充靜態處理建議,不改變 JSON、評分或退出策略;不執行命令、不修復檔案。[最佳實務清單(英文)](../best-practices.md)也不計分。`init --pr-comment` 明確選擇產生同儲存庫 PR 評論工作流程,並提示 `pull-requests: write` 權限;預設 `init` 產生的工作流程仍僅申請 GitHub 唯讀權限。先預覽、審閱,只提交一份工作流程;既有衝突須主動審閱,不能自動覆寫。Fork PR 保留工作摘要,不發評論。產生的 Action 參照仍為 `v0`,解釋摘要需要 v0.24.0+ 或包含該功能的已驗證 Action 版本。升級本機 CLI 不會改變既有工作流程固定的 Action 版本。詳見[維護者流程(英文)](../maintainer-workflow.md)。 +`--explain` 在文字與 Markdown 輸出中附帶靜態處理建議,不改變分數、JSON 或退出碼(另見不計分的[最佳實務清單(英文)](../best-practices.md))。`init --pr-comment` 會產生附 `pull-requests: write` 權限的同儲存庫 PR 評論工作流程(Fork PR 仍只輸出唯讀工作摘要)。詳見[維護者流程(英文)](../maintainer-workflow.md)。 -僅更新 CI、不讀取或重設自訂策略時(v0.24.0+): +如需只更新 CI 工作流程而不觸碰 `.agentconfigscore.json`: ```bash agent-config-score init --workflow-only --pr-comment --force --dry-run agent-config-score init --workflow-only --pr-comment --force ``` -執行第二條命令前,先將範例與既有工作流程的自訂內容比較;`--force` 會替換該工作流程,不會合併 YAML。策略檔案不在操作範圍內,即使缺少或無效也不會讀取,請另行執行 `doctor`。選定目標涉及連結、reparse point 或共用檔案時須手動整合。初始化會提示產生的 Action 參照,它可能與本機 CLI 版本不同,也不會更新遠端參照。寫入有預先檢查,但不是原子檔案系統交易。 +`--force` 會整體替換工作流程檔案(不會合併 YAML);請先核對既有自訂設定,並單獨執行 `doctor` 驗證策略。 ## 常見問題 | 現象 | 檢查方法 | |---|---| -| 找不到命令 | 確認安裝在目前 Python 環境,並檢查 Scripts/bin 的 PATH。v0.23.0+ 可用 `python -m agent_config_score`。 | -| 設定或工作流程編碼錯誤 | 儲存為 UTF-8,不要以 UTF-16 檔案取代。 | -| `Unable to read repository path index` | 執行 `doctor`,檢查 `repository-paths` 錯誤並修正目錄存取或 I/O 問題。部分索引不會產生成功報告。 | -| 掃描來源解析或讀取錯誤 | 在本機檢查已選取的指令檔與忽略檔連結,目標必須是儲存庫內的一般檔案;修正失效、循環連結或權限問題。`doctor` 提供 `instructions` 錯誤,不要將不完整掃描當成通過。 | -| 報告無法寫入 | 選擇可寫入的檔案路徑,不是既有目錄;檢查父目錄權限。 | -| 無法偵測基準 | 執行 `doctor`,再指定本機已存在的預設分支參照。 | -| 禁止範例被判為危險指令 | 對照[支援的禁止語法(英文)](../instruction-context.md)檢查上下文;工具不理解任意語言和改寫。 | -| 舊 GitHub 執行紀錄是紅色 | 查看目前提交對應的執行結果。後續修正不會抹除歷史失敗紀錄。 | - -使用前閱讀[限制說明](limitations.md)。發現是審查訊號,不代替程式碼審查或安全評估。[翻譯範圍](../translations.md)。 +| 找不到命令 | 確認目前 Python 環境的 `Scripts`/`bin` 在 `PATH` 中,或改用 `python -m agent_config_score`。 | +| 設定或工作流程編碼錯誤 | 儲存為 UTF-8,不要使用 UTF-16。 | +| 報告無法寫入 | 選擇可寫檔案路徑(不是既有目錄),並檢查父目錄權限。 | +| `Unable to read repository path index` | 執行 `doctor`,依 `repository-paths` 錯誤排查無法讀取的目錄。 | +| 掃描來源解析或讀取錯誤 | 檢查指令檔與忽略檔的符號連結,目標必須是儲存庫內的一般檔案(`doctor` 會報 `instructions`)。 | +| `diff` 無法偵測基準 | 執行 `doctor`,再明確指定本機既有的預設分支參照。 | +| 禁止範例被判為危險指令 | 對照[支援的禁止語法(英文)](../instruction-context.md)核對上下文。 | +| 舊 GitHub 執行紀錄為紅色 | 查看最新提交對應的執行;後續修正不會清除歷史失敗紀錄。 | + +用作 CI 門禁前請先閱讀[限制說明](limitations.md)。[翻譯範圍](../translations.md)。 diff --git a/docs/user-guide.md b/docs/user-guide.md index e9c30a7..d8eb226 100644 --- a/docs/user-guide.md +++ b/docs/user-guide.md @@ -2,20 +2,20 @@ English | [简体中文](simplified/user-guide.md) | [繁體中文](traditional/user-guide.md) -AgentConfigScore is a local, deterministic linter and pull-request regression -gate for coding-agent instructions. It does not call an AI service or execute -commands found in instruction files. A 100 means no active rule matched, not -that instructions are useful, safe in every context, or better than AI review. +AgentConfigScore is a local, deterministic linter and PR regression gate for +coding-agent instruction files. It does not call an AI model, execute commands +from instruction files, or act as a filesystem sandbox. A score of 100 means no +active rule matched—not that the instructions are useful or safe in every +context. -The [runnable design lab](../examples/regression-lab/README.md) shows why a numeric -score delta alone differs from baseline-governed new-error gating. Its passing -controls and explicit caller overrides are synthetic development demonstrations, -not user cases or an AI comparison. The runner requires a source checkout. +To see how baseline-governed new-error gating differs from a plain score delta, +try the [regression design lab](../examples/regression-lab/README.md) from a +source checkout. -## 1. Install and check the version +## 1. Install -Python 3.10 or later is required. Git is required for `diff`, but not for a -normal directory scan or `compare` of two directories. +Requires Python 3.10+. `diff` also requires Git; regular scans and `compare` +work without Git. ```bash python -m pip install agent-config-score @@ -23,13 +23,12 @@ agent-config-score --version agent-config-score --help ``` -`acs` is a shorter alias. Version 0.23.0 and later also support -`python -m agent_config_score` with the same product commands, without relying -on the console script's PATH setup. Older versions do not provide this module -entrypoint. Check [releases](https://github.com/LE0-Lin/AgentConfigScore/releases) -before assuming a change on `main` is available on PyPI or the rolling `v0` ref. +You can also invoke the CLI via `acs` or `python -m agent_config_score` (handy +when the console script directory is not on `PATH`). Check +[releases](https://github.com/LE0-Lin/AgentConfigScore/releases) for what is +published on PyPI versus `main`. -## 2. Initialize in your repository +## 2. Initialize a repository ```bash agent-config-score init --dry-run @@ -38,37 +37,24 @@ agent-config-score doctor ``` `init` creates `.agentconfigscore.json` and -`.github/workflows/agent-config-score.yml`. It does not create or rewrite your -instruction files. Existing conflicting files are not overwritten by default; -review them before using `--force`. A matching second initialization is a no-op. - -Commit the generated files after reviewing them. If you only want local checks, -use `init --no-workflow`. A missing standard workflow is then an advisory doctor -warning, not an error. - -v0.25.0+ builds reject duplicate config member names (including nested -objects and escaped spellings), `NaN`/`Infinity` constants and a Boolean format -`version`, rather than choosing an overwritten value. Review and keep one value -per field. Scans, `feedback`, `diff` and `compare` return `2` without a success -report; doctor returns `1` with a `config` error. Threshold overrides do not bypass -config validation. Missing-config defaults remain unchanged. This is not in -v0.24.0; see [configuration decoding](doctor.md#configuration-decoding). - -v0.25.0+ config-source checks also require `.agentconfigscore.json` to resolve -to a regular file inside the selected repository root. Only an absent entry uses -defaults; dangling/external/cyclic/unreadable sources are errors. Internal file -links and explicit repository-root aliases remain supported. Use a relative, -tracked shared config so each Git baseline has its own in-root target. Keep the -tree stable: this is not an atomic filesystem sandbox. Existing invalid links -need deliberate repair, not deletion to bypass policy. See -[config boundary and migration](doctor.md#configuration-file-boundary). -Review the selected package and Action revision when upgrading. - -If doctor finds no supported instruction files, add repository-specific -instructions or adapt one of the [templates](../examples/README.md). Do not add -phrases just to increase the score. See [supported discovery](../README.md#what-it-scans). - -## 3. Inspect the current tree +`.github/workflows/agent-config-score.yml` without touching your instruction +files. Existing conflicting files are never overwritten unless you pass +`--force`; repeating an identical setup is a no-op. Review and commit the +generated files. If you only want local checks, use `init --no-workflow`. + +Configuration rules to keep in mind: + +- `.agentconfigscore.json` must be valid strict JSON (no duplicate keys, + `NaN`/`Infinity`, or Boolean `version`) and resolve to a regular file inside + the repository root. Missing config falls back to defaults; broken, dangling, + or out-of-root config fails with exit `2` (`doctor` exits `1`). +- See [doctor and config boundaries](doctor.md#configuration-decoding) for + details and migration steps. +- If `doctor` finds no supported instruction files, add repository-specific + guidance or adapt one of the [templates](../examples/README.md). See + [supported discovery](../README.md#what-it-scans). + +## 3. Scan locally ```bash agent-config-score . @@ -76,78 +62,62 @@ agent-config-score rules agent-config-score rules curl-pipe-shell ``` -A normal scan reports findings without blocking by default. To require an -absolute score floor, use a policy `fail_under` or an explicit option: +A plain scan prints findings and exits `0` by default. To enforce an absolute +score floor, set `fail_under` in `.agentconfigscore.json` or pass it on the +command line: ```bash agent-config-score . --fail-under 90 ``` -This distinction is intentional: an existing repository does not need to reach -90 before adopting a regression gate. Review each finding's rule, location and -context instead of treating the numeric score as a quality ranking. +You do not need a 90+ score to adopt the PR regression gate. Review findings by +rule, location, and context rather than treating the score as an overall quality +ranking. -## 4. Check the change before pushing +## 4. Check changes before pushing ```bash agent-config-score diff ``` -This checks the current working tree, including uncommitted edits. It uses a -safe locally available default-branch baseline where possible and never fetches. -To choose the baseline explicitly: +`diff` compares your current working tree (including uncommitted edits) against +a locally available default branch without fetching. To specify a baseline ref +explicitly: ```bash agent-config-score diff origin/main ``` -If `origin/main` is missing, fetch that branch yourself. Use the project's actual -default branch, not a feature branch that already contains the change. In a -shallow checkout, obtain sufficient history before retrying. The generated -GitHub Actions workflow uses `fetch-depth: 0`. - -Without Git you can compare already available trees: +In a shallow clone, fetch enough history first (the generated GitHub Actions +workflow uses `fetch-depth: 0`). Without Git, compare two directories directly: ```bash agent-config-score compare ../repo-base . --max-drop 0 --fail-on-new-errors ``` -The baseline policy and suppressions govern both sides. A candidate cannot -increase its drop budget or suppress its newly introduced error to approve -itself. Trusted invocation-time overrides are explicit. - -In v0.24.0+, removal checks only exempt one-to-one exact-text -moves to newly added files in the same directory. Existing copies and moving root -rules into a subtree do not hide removal. Comparisons reuse scan-time text instead -of reopening sources; keep both trees stable and rerun after edits. See -[regression coverage and limits](regression-coverage.md). A regression-only error -may occur with two `100` scores: the example above enables new-error blocking; -the bare CLI without a policy remains score-only by default. - -## 5. Read a failure and resolve it - -- Exit `1` from `diff` / `compare` means the configured regression gate failed. - Review new findings and the allowed score drop; fix the actual instructions - rather than weakening the candidate policy. -- A suspected false positive needs review. An accepted exception can use a - baseline-reviewed suppression with a stable rule ID, reason and expiry. - It stays visible in the audit output. See [auditable exceptions](../README.md#auditable-exceptions). -- Exit `2` means the command could not perform the requested check, for example - invalid configuration, a missing Git ref, or an unwritable report. This is - **not** a clean result. Do not approve a change merely because no JSON appeared. +Both sides are evaluated under the **baseline** policy and suppressions, so a +candidate PR cannot lower its own threshold or suppress its own new errors. +Moving an instruction file only avoids an `instruction-file-removed` error when +it is a one-to-one exact-text move to a newly added supported file in the same +directory (see [regression coverage](regression-coverage.md)). + +## 5. Exit codes and resolving failures + +- **Exit `1` (`diff` / `compare`)**: the regression gate failed. Fix the + instruction change, or—if a finding is a deliberate exception—add a + baseline-reviewed suppression with rule ID, reason, and expiry + ([auditable exceptions](../README.md#auditable-exceptions)). +- **Exit `2`**: operational failure (bad config, missing Git ref, unreadable + source, unwritable report). Never treat exit `2` as a passing check. | Command | Exit 0 | Exit 1 | Exit 2 | |---|---|---|---| | Scan (`agent-config-score .`) | Scan completed; optional floor met | Score below configured floor | Invalid input or operational error | -| `diff`, `compare` | Baseline policy passed | New-error / score-drop gate failed | Comparison could not complete | -| `doctor` | No error checks; warnings may exist | One or more error checks | Argument / invocation error | -| `scope` | Advisory analysis completed, including unknowns | Not used | Invalid input or read failure | -| `scope compare`, `scope diff`, `scope coverage` | Advisory completion or opted-in gate passed | Opted-in loss/unknown review gate triggered | Invalid input, read failure or resource limit | -| Other commands | Requested operation completed | Not a lint gate | Invalid input or operational error | - -Unexpected programming errors are not hidden by a catch-all handler. Report a -traceback after removing private content; passing the maintained tests does not -guarantee a bug-free program. +| `diff`, `compare` | Baseline policy passed | New-error or score-drop gate failed | Comparison could not complete | +| `doctor` | No error checks (warnings allowed) | One or more error checks | Argument or invocation error | +| `scope` | Advisory analysis completed | Not used | Invalid input or read failure | +| `scope compare`, `scope diff`, `scope coverage` | Advisory completion or opted-in gate passed | Opted-in loss or unknown gate triggered | Invalid input, read failure, or limit hit | +| Other commands | Operation completed | Not used | Invalid input or operational error | ## 6. Save reports locally @@ -157,108 +127,65 @@ agent-config-score . --html .agent-config-score/report.html --badge .agent-confi agent-config-score diff --markdown .agent-config-score/regression.md ``` -Keep generated reports outside supported instruction-file locations. JSON, -HTML, SARIF and regression reports can contain repository paths and finding -messages; inspect them before sharing. Do not overwrite your source or policy -files by choosing their paths as report destinations. Multiple output writes -are not a transaction: an earlier artifact may remain if a later write fails. - -v0.24.0+ also retains the declared tool version and a best-effort -tool-source SHA-256 in JSON, HTML, SARIF and new history snapshots. Compare/diff -JSON retains both scan identities. This distinguishes local implementations with -the same version, not accuracy or reproducibility by itself. Missing source makes -the digest unavailable, not the scan invalid. See [report identity](report-identity.md) -for coverage, compatibility and environment/input limits; older reports are not relabelled. - -For local snapshots, v0.25.0+ builds distinguish absent history from -damaged/unreadable history. `history` returns `2` with no success output for an -invalid index; appending through the Python helper refuses to reset it. Back up -and repair the index before retrying. Partial legacy records remain readable; -missing scores are unknown, not zero. The helper uses complete-file replacement -but requires serialized writers, not concurrent transactions. Scans do not -automatically append local history. See [local history and recovery](score-history-cli.md). -These changes are included from v0.25.0. Immutable CI artifacts retain their recorded data. - -For a privacy-minimized draft instead: +Write reports outside supported instruction paths so they are not scanned back +in. JSON, HTML, SARIF, and Markdown reports can include repository paths and +finding messages—inspect them before sharing. Each report also records the tool +version and source SHA-256 fingerprint ([report identity](report-identity.md)). + +For local score snapshots, `history` fails with exit `2` on a damaged index +rather than silently resetting it ([local history](score-history-cli.md)). + +To generate a privacy-minimized issue draft (nothing is uploaded): ```bash agent-config-score feedback . --output .agent-config-score/case.md ``` -Nothing is uploaded. Review and sanitize the draft yourself before sharing. - -## Optional: review missing deletion safeguards (v0.24.0+) +## Optional: deletion safeguard review ```bash agent-config-score guardrails . --file AGENTS.md agent-config-score guardrails . --file AGENTS.md --template-language simplified --json ``` -This independent command gives unscored, selected-file advice. No recognized -constraint means “review needed,” not “unsafe.” Default previews change nothing. -After reviewing the full policy context and addition, rerun the same command -with `--apply TOKEN` using its exact printed confirmation. Changed input requires -a new preview; ambiguous markup and aliases require manual merging. English, -Simplified and Traditional addition templates do not localize CLI messages. -Explicitly labeled example sections do not count as active policy; if such a -section remains open at end of file, automatic append is unavailable. A few -explicit approval-bypass directives produce line-only `review_signals` and -disable append even when another constraint is recognized. Resolve those -policies manually; this is not a general contradiction detector. -See [guardrail suggestions](guardrail-suggestions.md) for grammar, scope, privacy -and non-atomic/partial-write limits. Existing scoring and CI defaults are unchanged. - -v0.25.0+ builds resolve `--file` without whole-tree discovery, so an -unrelated broken instruction link does not block this selected-file review. -Relevant ignore rules and selected ancestry still apply; directory aliases or -ambiguous directory casing need manual integration. Other sources are not -certified or repaired. Normal scan/doctor failures still need separate attention; -an append does not turn an incomplete whole-tree scan into a clean result. -This scope refinement is included from v0.25.0. - -## Optional: Cursor file-context analysis (v0.25.0+) +`guardrails` performs an unscored, single-file check for deletion-approval +wording without scanning the rest of the repository. By default it only previews +a suggested block. To append after reviewing the file, rerun with the printed +`--apply TOKEN` (which is bound to the exact file content). Example sections, +HTML markup, and opposing bypass phrases require manual editing; see +[guardrail suggestions](guardrail-suggestions.md). + +## Optional: Cursor file-context and coverage analysis ```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 ``` -v0.25.0+ can predict automatic attachment of root -`.cursor/rules/` project rules for logical file paths you declare in context. -Target existence is not checked. Manual/model selection and unsupported -metadata remain unknown; inactive means not triggered by these paths, not -observed absent. Different globs can co-activate in multi-file tasks. +`scope` predicts automatic attachment for root `.cursor/rules/` files given +declared target paths (unscored; manual/model-selected rules stay `unknown`; +see [cursor-scope](cursor-scope.md) and the +[runnable example](../examples/cursor-scope/README.md)). -This is unscored advice with source-line evidence, not an observed agent run or -blocking gate. Completion returns `0`, including signals/unknowns; input/read -failures return `2`. Existing scan and regression scores remain unchanged. -The command still uses whole-repository supported-source preflight, so unrelated -invalid instruction links can stop it. See the [model and limits](cursor-scope.md) -and [runnable synthetic example](../examples/cursor-scope/README.md). -This command requires v0.25.0+ and an explicit CLI invocation. - -Compare the same declared context before and after a change: +Compare the same declared context across changes, or check every regular file +under a directory independently: ```bash agent-config-score scope compare ../repo-base . --target src/web/app.ts --fail-on-lost-directives --fail-on-unknown agent-config-score scope diff origin/main --target src/web/app.ts --fail-on-lost-directives --fail-on-unknown --json ``` -For existing files, check each inventoried path as an independent context. [Coverage, exclusions and complete replay](cursor-coverage.md). - ```bash agent-config-score scope coverage --base-ref origin/main --under src --fail-on-lost-directives --fail-on-unknown --json ``` -These commands (v0.25.0+) separate file changes, lost trigger matches and exact -recognized directives losing all predicted active sources. Another active copy -or a remaining multi-file trigger can preserve availability. Both flags opt into -a caller-configured review gate: loss or unknown uses `1`; operational failures -use `2`. Without flags, completed comparisons remain advisory (`0`). No recognized -baseline means zero protected identities. See the [comparison contract and CI -recipe](cursor-scope-impact.md) and [four synthetic controls](../examples/cursor-scope-impact/README.md). +Without `--fail-on-*` flags these commands are advisory (exit `0`); with flags, +lost baseline-active directives or unknowns exit `1`. See +[cursor-scope-impact](cursor-scope-impact.md), +[cursor-coverage](cursor-coverage.md), and the +[four controls](../examples/cursor-scope-impact/README.md). -## Optional: actionable maintainer results (v0.24.0+) +## Optional: `--explain` and PR comments ```bash agent-config-score . --explain @@ -266,45 +193,33 @@ agent-config-score diff --explain --markdown .agent-config-score/regression.md agent-config-score init --pr-comment --dry-run ``` -`--explain` adds static next steps to active scan/new regression findings in -text/Markdown, not JSON, scores or exit policy. It does not execute commands or -repair files. The [best-practice checklist](best-practices.md) is also unscored. -`init --pr-comment` opts into a generated same-repository PR comment workflow and -discloses `pull-requests: write`; the default generated workflow keeps read-only -GitHub permissions. Preview, -review and commit only one workflow. Existing conflicts require deliberate -review, not an automatic overwrite. Fork PRs use job summaries without comments. -The generated Action ref remains rolling `v0`; explanations require v0.24.0+ -or a verified Action revision containing this feature. Older pinned workflows -remain unchanged when you upgrade the local CLI. -See the [maintainer workflow](maintainer-workflow.md) for setup and limits. - -To update only CI without reading/resetting custom policy (v0.24.0+): +`--explain` adds static next-step guidance to text and Markdown output without +changing scores, JSON, or exit codes (see also the unscored +[best-practice checklist](best-practices.md)). `init --pr-comment` generates a +same-repository PR comment workflow with `pull-requests: write` (fork PRs still +use read-only job summaries). See [maintainer workflow](maintainer-workflow.md). + +To upgrade only the CI workflow without touching `.agentconfigscore.json`: ```bash agent-config-score init --workflow-only --pr-comment --force --dry-run agent-config-score init --workflow-only --pr-comment --force ``` -Compare the recipe with existing workflow customizations before the second -command: `--force` replaces that workflow, not a YAML merge. The policy file is -out of scope even if missing or invalid; run `doctor` separately. Selected linked, -reparse or shared files need manual setup. Initialization prints the generated -Action ref, which may differ from the installed CLI; it does not update remote -refs. Writes are preflighted, not an atomic filesystem transaction. +`--force` replaces the workflow file outright (it does not merge YAML); review +any custom edits first and run `doctor` separately to validate your policy. -## Common setup problems +## Troubleshooting | Symptom | What to check | |---|---| -| Command is not found | Install into the active Python environment; confirm its Scripts/bin directory is on PATH. In v0.23.0+, use `python -m agent_config_score` as a PATH-independent alternative. | -| Configuration / workflow encoding error | Save the file as UTF-8; do not copy a UTF-16 file into the integration. | -| Cannot write HTML, SARIF or Markdown | Choose a writable file path, not an existing directory; inspect parent-directory permissions. | -| `Unable to read repository path index` | Run `doctor` and check its `repository-paths` error. Fix directory access or I/O failures; no success report is emitted from a partial index. | -| Scanner source resolution/read error | Inspect selected instruction and ignore-file links locally. They must point to in-repository regular files; fix dangling links, cycles or permissions. `doctor` reports an `instructions` error. Do not treat an incomplete scan as a passing score. | -| `diff` cannot detect a baseline | Check `doctor`, then pass an available default-branch ref explicitly. | -| A prohibited command was flagged | Compare its exact context with the [supported prohibition grammar](instruction-context.md); arbitrary languages and paraphrases are not understood. | -| Historic GitHub run is red | Open the run for the current commit. Fixing a later commit does not erase an earlier failed run. | - -Read the [limitations](limitations.md) before relying on the tool. Findings are -review signals, not a substitute for code review or a security assessment. +| Command not found | Confirm the active Python environment's `Scripts`/`bin` directory is on `PATH`, or use `python -m agent_config_score`. | +| Config / workflow encoding error | Save the file as UTF-8, not UTF-16. | +| Cannot write HTML / SARIF / Markdown | Pass a writable file path, not an existing directory, and check parent permissions. | +| `Unable to read repository path index` | Run `doctor` and check the `repository-paths` error for unreadable directories. | +| Source resolution or read error | Check symlinks on instruction and ignore files; targets must be regular files inside the repo (`doctor` reports `instructions`). | +| `diff` cannot detect a baseline | Run `doctor`, then pass an available default-branch ref explicitly. | +| Prohibited command was flagged | Check [instruction-context.md](instruction-context.md) for the exact supported prohibition forms. | +| Old GitHub run is red | Check the run for the latest commit; later fixes do not clear earlier runs. | + +Read [limitations.md](limitations.md) before relying on the tool as a CI gate. From 937a475e4fe272a5efee67906f675d0000855a56 Mon Sep 17 00:00:00 2001 From: Zhibo Lin <147509942+LE0-Lin@users.noreply.github.com> Date: Fri, 20 Nov 2026 20:53:35 +0800 Subject: [PATCH 2/2] Tighten case study, self-use, feedback, and review-comparison docs --- docs/feedback-to-delivery.md | 49 ++----- docs/path-case-study.md | 122 +++++++---------- docs/review-comparison.md | 247 +++++++++++------------------------ docs/self-use-check.md | 128 +++++++----------- 4 files changed, 181 insertions(+), 365 deletions(-) diff --git a/docs/feedback-to-delivery.md b/docs/feedback-to-delivery.md index 920f1af..3a417d0 100644 --- a/docs/feedback-to-delivery.md +++ b/docs/feedback-to-delivery.md @@ -1,40 +1,19 @@ -# Public maintainer feedback and delivered behavior +# Maintainer feedback to delivered features In [issue #46](https://github.com/LE0-Lin/AgentConfigScore/issues/46), -JasonLandbridge described four capabilities he would find useful. This is -public, externally authored **requirements feedback**. It establishes the -origin of a request. External installation, sustained use, measured time saved -and maintainer-confirmed effectiveness remain unverified. +JasonLandbridge listed four capabilities he wanted from an instruction linter. +The table below maps those requests to what is currently shipped and where the +boundaries remain. (This tracks requirements feedback—not external adoption or +measured time saved.) -| Requested capability, paraphrased | Delivered surface | Verification and boundary | +| Requested capability | Shipped surface | Scope and limits | |---|---|---| -| Check whether instruction-file references remain valid | `dead-path`, Markdown link resolution, repository/scope path checks | Released checks have deterministic tests. The [new path case study](path-case-study.md) adds a generated-output correction and explicit relative-directory handling in v0.26.2. Generated and package-relative ambiguity remain bounded. | -| Give practical instruction-file guidance | [Advisory checklist](best-practices.md), [maintainer workflow](maintainer-workflow.md), opt-in [safeguard review](guardrail-suggestions.md) | Documentation and narrowly recognized review suggestions are available. They do not constitute a general semantic reviewer or a scored best-practice certification. | -| Surface prompt-injection concerns | The released `prompt-injection-override` warning and its conservative context handling | The rule targets explicit prior-instruction override phrases. It does not detect arbitrary injection attacks or enforce agent behavior. | -| Make review results visible on PRs | [Opt-in single-comment workflow](pr-comments.md), including generated setup via `init --pr-comment` | The repository's CI and integration tests validate the maintained recipe. A caller explicitly grants comment permission. Adoption by the requester's repository is not established. | +| Check whether referenced paths stay valid | `dead-path`, local Markdown inline/reference links, explicit relative directory checks, generated-output and inline-code example handling | Deterministic rules with regression tests and a [public-source case study](path-case-study.md). Unprefixed directories and arbitrary build outputs stay conservative. | +| Give practical instruction-file guidance | `--explain` next steps, [best-practice checklist](best-practices.md), [maintainer workflow](maintainer-workflow.md), opt-in `guardrails` | Static review advice and narrow deletion-safeguard checks—not a general semantic reviewer or keyword-scored quality grade. | +| Surface prompt-injection concerns | `prompt-injection-override` with conservative prohibition/example context handling | Targets explicit override phrases; does not detect arbitrary paraphrases or runtime tool-output injections. | +| Make results visible on PRs | Opt-in single PR comment workflow (`init --pr-comment` / `examples/pr-comment.yml`) with per-rule breakdown and recheck commands | Tested in CI against a fake GitHub client; caller explicitly grants comment permissions and forks remain read-only ([PR comments](pr-comments.md)). | -## How to use this evidence - -v0.27.0 strengthens two of these interfaces: Markdown link syntax -inside matched inline code is no longer treated as a live reference, and the -optional PR comment adds a validated per-rule breakdown plus recheck commands. -The [comment preview and compatibility guide](pr-comments.md) distinguish these -changes from the older v0.26.2 behavior. Neither change establishes -adoption by Jason or expands prompt-injection detection into a general defense. - -The defensible project story is a concrete feedback loop: a public maintainer -requested review features; corresponding interfaces were implemented; the -project retained acceptance tests, versioned releases and limits; real source -inputs then exposed scanner errors that required further maintenance. - -The [path replay](../benchmarks/path-check-v2/README.md) makes one of those -maintenance changes inspectable without executing upstream commands or asking -another maintainer to confirm an obvious sentence. It preserves failed attempts -and the final conservative scope. It remains project-authored development -evidence. - -Independent reference labels, a matched AI comparison and externally observed -workflow outcomes are separate open evidence gaps. This document does not turn -a feature request, a GitHub star or a project-maintained test suite into a user -success metric. It makes the existing request and implemented response easy to -verify directly. +Open evidence gaps—independent human reference labels, a matched AI comparison, +and observed external adoption—remain tracked separately in +[review-comparison.md](review-comparison.md) and +[benchmarks/path-check-v2/README.md](../benchmarks/path-check-v2/README.md). diff --git a/docs/path-case-study.md b/docs/path-case-study.md index 674da4d..f98c487 100644 --- a/docs/path-case-study.md +++ b/docs/path-case-study.md @@ -1,78 +1,54 @@ -# A generated file should not become a broken-path warning +# Case study: generated outputs and directory path checks -This case shows a concrete scanner failure on a public project's instructions, -the correction, and a regression caught while implementing it. It is a -maintainer development case with reproducible source evidence; it does not -establish external adoption or independent detection accuracy. +This case study documents a real false positive found on a public repository's +instructions, how we fixed it in v0.26.2, and a regression our replay caught +before merge. (This is development evidence, not an independent accuracy study.) -## The user's review problem - -An instruction file can mention checked-in source, a required directory, and a -file that appears only after a build. Reporting every absent name as a broken -reference makes a CI report noisy. Ignoring all paths near the word "generated" -could instead conceal a missing generator or an unrelated required source file. +## The problem +Instruction files mix checked-in source files, directories, and build outputs. At [the pinned Vitest revision](https://github.com/vitest-dev/vitest/blob/f4fdbcae08ec365f35d9e1866ce3e7d04880ea60/AGENTS.md#L201), -the document declares that `docs/.vitepress/contributor-names.json` is generated -by `pnpm docs:contributors`. The published ACS v0.26.1 warns about that absent -output in an unbuilt checkout. The retained package script and producer source -confirm the exact write target; the audit never runs the upstream command. - -## Correction and an observed failure - -The changed scanner recognizes a bounded output declaration attached to that -single prose reference. It continues checking the generator's source path, -actual Markdown link destinations, dangerous commands and credentials. A -general generated-files heading does not exempt later references, and a -conditional or unfinished sentence does not satisfy the grammar. - -The same maintenance pass explores checks for quoted directories ending in `/`. -The first real-source replay then catches a regression in this new rule: -Vitest uses bare `dist/` as a package export/build-output location, and the -scanner incorrectly demands a root directory. The known-negative gate fails. -That failing report is retained. Bare output names are subsequently excluded; -explicit paths such as `./dist/` still request an existence check. A wider -inspection then finds package `lib/` outputs and Husky's install-time directory. -The final rule requires an explicit `./` or `../` prefix for directory prose; -unprefixed directory names stay unresolved instead of accumulating exemptions. - -## What the completed replay establishes - -| Check | Frozen published version | Changed source | +`AGENTS.md` notes that `docs/.vitepress/contributor-names.json` is generated by +`pnpm docs:contributors`. In an unbuilt checkout, ACS v0.26.1 flagged that file +as a missing path—even though `package.json` and `scripts/update-contributors.ts` +confirm it is a build output. + +Simply ignoring every path near the word "generated" would be too loose and +could hide a missing generator script or required source file. + +## Fix and caught regression + +1. **Generated-output declarations:** ACS now exempts a prose path only when + followed on the same line by a complete passive declaration such as + `` `docs/out.json` is generated by `make docs` `` (`generated from`, + `regenerated`, and `rewritten` also match). Generator paths, actual Markdown + links, commands, and credentials remain checked. +2. **Explicit directory checks (and a caught false positive):** While adding + checks for quoted directory literals ending in `/`, our first real-source + replay failed its negative gate: Vitest's bare `dist/` (line 67), package + `lib/` outputs, and Husky's install-time directory were falsely flagged as + missing root directories. We retained those failing intermediate runs + ([benchmarks/path-check-v2](../benchmarks/path-check-v2/README.md)) and + narrowed the rule to require an explicit `./` or `../` prefix plus a trailing + `/` (such as `./packages/` or `./dist/`), leaving unprefixed names alone. + +## Replay summary + +| Check | Frozen v0.26.1 | v0.26.2+ | |---|---|---| -| Generated contributor file | Warning | Warning removed | -| Eight independently applied target-removal controls, original wording | 3 detected | 3 detected | -| Original 16 selected natural occurrences | 0 flagged | 0 flagged | - -Four separate controls explicitly prefix the directory literal with `./` before -removing its target. Both the wording and inventory change; those controls are -kept separate from the original eight. Unprefixed directory names remain outside -the conservative prose heuristic. Sixteen correlated selected occurrences -cannot establish general precision, and these development controls cannot -establish independent recall. - -The [raw results, failed attempt, source hashes and offline reproduction](../benchmarks/path-check-v2/README.md) -allow readers to inspect the unfavorable observations as well as the fixes. -The complete source suite and installed-package CI check other formats and -operating systems separately. The names-only replay itself uses Linux because -some retained repository trees require a case-sensitive filesystem. - -## Apply the result - -These path checks ship in **v0.26.2**. Install with -`python -m pip install --upgrade agent-config-score==0.26.2` and run ordinary -ACS scans/comparisons. The retained report identifies the pre-release source -build used for the original replay; publishing is not a new accuracy evaluation. A passing -result means the selected deterministic checks passed; the generated-output -declaration is not authenticated and no upstream build is executed. - -For a directory intended to exist at a concrete location, use `./` or `../` -with a trailing slash. For an output that may be absent before -a build, state its producer clearly. Actual Markdown links continue to require -their destinations. The [documented path grammar](limitations.md#plain-prose-path-references) -defines the exact supported forms and remaining ambiguity. - -This gives a user-reviewable engineering result: fewer known noisy warnings, -additional explicit directory coverage, and a demonstrated failing gate during -development. External users' sustained workflows and independently adjudicated -accuracy remain open validation work. +| Vitest declared generated contributor file | Warning | No warning | +| 8 target-removal controls (original wording) | 3 detected | 3 detected | +| 16 unmodified natural occurrences | 0 flagged | 0 flagged | + +Four separate synthetic controls prefixed `./` to the directory literals before +removing their targets and were all detected (4/4). Full raw JSON, failed +attempts, source hashes, and offline Linux replay commands are in +[benchmarks/path-check-v2/README.md](../benchmarks/path-check-v2/README.md). + +## Practical takeaway + +In instruction files, write explicit `./dir/` or `../dir/` when you want ACS to +verify a directory exists, and state the generator clearly for build outputs +that do not exist in a fresh checkout. See the +[path reference grammar](limitations.md#plain-prose-path-references) for exact +supported forms. diff --git a/docs/review-comparison.md b/docs/review-comparison.md index d10327d..98a1783 100644 --- a/docs/review-comparison.md +++ b/docs/review-comparison.md @@ -1,104 +1,54 @@ # Compare local lint with AI review -AgentConfigScore has not established that it is more accurate than asking an AI -to review an instruction file. Its maintained rule contracts are development -evidence, not a head-to-head evaluation. This workflow makes that comparison -possible without a model API dependency, automatic uploads, or fabricated model -results. - -**Status: no independent AI comparison has been completed.** The bundled twelve -inputs are synthetic calibration fixtures with provisional project-authored -labels. They reuse known cases and must not be called held-out or real user data. - -A separate [bounded path-reference maintainer audit](../benchmarks/path-audit-v1/README.md) -now retains actual frozen-wheel results, including misses and a post-hoc warning -review. It uses provisional AI-authored maintainer observations and names-only -path projections. It does not satisfy the independent-label or matched AI -comparison requirements below. - -A separate [prospective candidate collection](../benchmarks/prospective-review-v1/README.md) -now retains five pinned public root instruction files, a predeclared twelve-repository -registry, every exclusion, and third-party license notices. It is **unreviewed -preparation material**, not a completed study. Equivalent tool-checkout evidence, human reference -labels, and a matched comparative model batch still need to be supplied. A -[single-case exploratory pilot](../benchmarks/prospective-review-v1/pilot/README.md) -retains an actual fresh-context response, not a reference label or scored study. - -The [context extension](../benchmarks/prospective-review-v1/context/README.md) -adds bounded referenced text and tracked-path facts without predicting defects. -Export preserves this allowlisted evidence and changes the packet fingerprint. -Scoring refuses these bundles until an equivalent tool checkout and matched -instruction scope can be provided; directory metadata is not actual file content. - -The separate [pinned-source tool probe](../benchmarks/prospective-review-v1/tool-probe/README.md) -verifies real source archive bytes against Git objects and distinguishes native -discovery from a research-only root scope. Local archive replay requires no -network. It now retains an actual Linux replay of the frozen 0.22.0 code, -including complete source verification and unscored native/root findings. -Transport failures and a Windows case-sensitivity mismatch are retained, not -counted as predictions. Its scopes/path evidence remain different from the -bounded AI packet, so it does not bypass the scoring gates. - -A [short human review page](../benchmarks/prospective-review-v1/human-pilot/review.md) -presents one unchanged 28-line candidate without tool/model conclusions and -accepts a plain-language decision, rationale and prior-exposure note. This is a -single-reviewer preannotation task, not an adjudicated holdout. Consent is not a -reference label, and no completed annotation is currently retained. Human review -is now deferred; product maintenance can continue without fabricating labels. - -The Next.js probe subsequently informed three path false-positive fixes. Its -[development-reuse record](../benchmarks/prospective-review-v1/development-reuse.json) -supersedes collection-time non-development status for that case, not the frozen -artifacts themselves. Current-code replays are development checks, not validation -on untouched inputs. A future independent study requires fresh cases. - -## Run the local baseline - -From a repository checkout with the package installed: +AgentConfigScore has not yet been evaluated head-to-head against AI review on an +independent held-out dataset. `scripts/run_review_comparison.py` provides an +offline workflow for running that comparison without calling a model API, +uploading files, or inventing results. + +## Current status + +- **Calibration set** ([report](../benchmarks/review-calibration-report.md)): 12 + synthetic development fixtures (11 provisionally resolved, 1 unresolved). ACS + baseline is recorded (1 semantic miss); AI and hybrid columns remain `not run`. +- **Prospective candidates** ([prospective-review-v1](../benchmarks/prospective-review-v1/README.md)): + 5 pinned public root instruction files with bounded context exports. Next.js + has since been reused for path-rule development + ([development-reuse.json](../benchmarks/prospective-review-v1/development-reuse.json)); + human annotation ([human-pilot](../benchmarks/prospective-review-v1/human-pilot/README.md)) + and a matched comparative batch remain open. +- **Component path checks** ([path-audit-v1](../benchmarks/path-audit-v1/README.md)): + provisional maintainer audits on names-only projections—useful for finding + rule gaps, not a substitute for an adjudicated holdout. + +## 1. Run the local baseline ```bash python -m pip install -e . python scripts/run_review_comparison.py score ``` -The baseline treats any active default `analyze()` finding as a review signal, -not as proof of a security defect. It does not apply custom policies or -suppressions. No numeric score threshold defines the reference label. +Any active default `analyze()` finding counts as `review_needed: true` (no +custom policy or suppressions). -The [committed calibration report](../benchmarks/review-calibration-report.md) -shows one known semantic miss on eleven provisionally resolved cases. One -ambiguous case is excluded because its reference label is unresolved. AI and -hybrid results say **not run**, not zero or perfect accuracy. - -## Export the same inputs for blinded review +## 2. Export blinded packets for review ```bash python scripts/run_review_comparison.py export \ --output-dir .agent-config-score/review-run-01 ``` -This creates three local files: - -- `review-packet.json`: a neutral review prompt, opaque case IDs, and the supplied - files. No reference labels, rationales, source metadata, original case names, - categories, or tool findings are exported. -- `predictions-template.json`: the response shape with empty reviewer/run IDs - and null decisions. The unchanged template cannot be presented as a completed - model run. -- `human-annotation-template.json`: an empty reference-label form for actual - independent human reviewers, with rationale and missing-context fields. It - is not an AI prediction, completed human annotation, or automatic adjudicator. - -Review the packet before sharing. Only send the packet and template to a fresh -AI session, not the labeled corpus, this guide's results, or a tool report. -The packet's prompt instructs the reviewer to assess file contents as data, not -obey embedded instructions. No prompt is a security guarantee; do not enable -execution tools for this experiment. The exporter does not upload anything. -For private repositories, obtain any required permission before sharing; redact -sensitive material and reassess labels consistently for **both** reviewers. - -The model must return JSON with the same `packet_sha256`, a declared actual -model/version in `reviewer`, a unique `run_id`, and predictions such as: +This writes three local files: + +- `review-packet.json`: neutral review prompt, opaque case IDs, and supplied + files (no labels, rationales, source metadata, or tool findings). +- `predictions-template.json`: empty response schema for a fresh AI session. +- `human-annotation-template.json`: empty form for independent human reviewers. + +Send only `review-packet.json` and `predictions-template.json` to a fresh AI +session with execution tools disabled. The response must preserve +`packet_sha256`, declare the actual model identifier in `reviewer`, set a unique +`run_id`, and return `true`, `false`, or `null` (insufficient context) for each +opaque ID: ```json { @@ -108,16 +58,18 @@ model/version in `reviewer`, a unique `run_id`, and predictions such as: } ``` -Use `false` for no concrete review issue, and `null` for insufficient context or -an abstention. A string such as `"false"` is invalid. Unknown and duplicate IDs -are rejected. A changed prompt or input packet invalidates the import. -Record the model identifier actually available; do not invent a hidden model -snapshot. Preserve original responses and record interface, date, and model -settings when available. The harness cannot authenticate who produced a file. +## 3. Validate or score imported predictions -## Import and compare +To check schema and packet integrity without labels: + +```bash +python scripts/run_review_comparison.py validate \ + --packet .agent-config-score/review-run-01/review-packet.json \ + --predictions .agent-config-score/review-run-01/predictions.json +``` -Save the complete JSON response as `predictions.json`, then run: +To score against a labeled corpus (outputs must be new files; pass multiple +`--predictions` flags to compare runs or measure repeat-run disagreement): ```bash python scripts/run_review_comparison.py score \ @@ -126,89 +78,36 @@ python scripts/run_review_comparison.py score \ --markdown .agent-config-score/comparison-01.md ``` -All output paths must be new. Existing files are never overwritten. Multiple -`--predictions` arguments compare multiple runs. Repeated runs with the same -declared reviewer identifier receive a disagreement count and explicit coverage; -different model identifiers are not mixed into a repeatability measure. +## Scoring rules -## What is measured +Evaluation is case-level (`review_needed`), not finding-level localization: -The reference task is **case-level maintainer review needed**, not general prompt -quality, exploitability, or exact issue localization. A correct flag for one -problem can conceal another missed problem in that case. Use focused cases and -inspect per-case results; do not equate these numbers with finding-level recall. - -| Reference label | Decision | Count | +| Reference label | Decision | Outcome | |---|---|---| | Review needed | `true` | True positive | -| Review needed | `false` | Miss / false negative | +| Review needed | `false` | False negative (miss) | | Clean | `true` | False positive | | Clean | `false` | True negative | -| Resolved label | Missing or `null` | Unreviewed; never implicitly clean | -| Unresolved reference label | Any | Explicitly excluded from correctness scoring | - -Missing answers and abstentions reduce coverage. If any resolved case is -unreviewed, that run has **no headline precision, recall, F1, or accuracy**. Counts -remain visible so dropping difficult cases cannot improve a completed metric. -Zero detected positives do not become perfect precision; undefined ratios are -null. Category breakdowns are included in JSON; Markdown lists disagreements and -unreviewed cases. - -The hybrid baseline is an OR, not an AI adjudication of scanner findings: -either reviewer flagging a case makes it reviewable; a clean tool decision plus -an unknown AI decision stays unknown. Combining flags can increase false -positives. The harness does not silently let either reviewer overrule the other. - -Optional prediction `usage` fields are `input_tokens`, `output_tokens`, -`elapsed_seconds`, and `cost_usd`. Unknown values remain null, not free or instant. -These are self-reported metadata, not measured API billing or end-to-end workflow -latency. Repeated accuracy or speed claims need actual controlled measurements. - -JSON reports bind the full labeled corpus, blinded packet/prompt, tool and metric -source, and each imported response with separate SHA-256 fingerprints. Label -corrections change the corpus fingerprint without changing the blinded packet. -The Python version is also recorded. Reports omit input contents and model -explanations; locally retained source artifacts still need privacy review. - -## Build a real holdout before drawing conclusions - -Use [the calibration manifest](../benchmarks/review-calibration.json) as a format -example, **not** as an independent dataset: - -1. Define the review rubric and sampling method before inspecting predictions. - Include genuinely clean inputs, concrete risks, semantics, and ambiguous - context. Preserve relevant repository files so both reviewers get the same - evidence; do not penalize missing context as if it were supplied. -2. Collect unseen, licensed or authorized snapshots/excerpts. Record provenance - and pinned revisions, and group related examples by repository or mutation - family. Do not split variants of the same example across development and - holdout data, or choose only cases where one reviewer wins. -3. Have at least two reviewers label independently without seeing either - system's output, then adjudicate disagreements. Keep genuinely unresolved - labels unresolved. Record reviewer identifiers and annotation rationales. -4. Freeze the corpus and prompt, then run both systems. Retain all responses, - failures, abstentions, and repeat runs, including unfavorable results. -5. If the inputs or results guide subsequent rule/prompt tuning, mark them - development/calibration data and evaluate on a new holdout. - -A manifest with `tier: "holdout"` must declare `used_for_rule_development: false`, -`label_status: "adjudicated"`, and at least two distinct labelers. The loader -checks these declarations, rejects duplicate input snapshots, and validates -portable in-repository fixture paths. **It cannot prove independence, correct -labels, provenance, licensing, or reviewer identity.** Metadata is not evidence -of a study having happened. Small correlated samples also do not support a -general real-world accuracy claim. - -Unlabeled preparations can instead use `tier: "candidate"`, -`used_for_rule_development: false`, `label_status: "unreviewed"`, `labelers: []`, -and only `unresolved` labels. They may be exported but **cannot be scored**. -This records work still missing without inventing reviewers or reference labels. - -This is a repository research script, not a new installed CLI subcommand. The -deterministic scanner, report schema, runtime dependencies, and existing rule -contracts are unchanged. - -For a retained packet/response without human reference labels, use the research -script's `validate --packet PATH --predictions PATH` command. It verifies packet -integrity, prediction shape, and coverage without running lint or computing -correctness metrics. Format validity cannot establish the answer is right. +| Resolved label | Missing or `null` | Unreviewed (reduces coverage; suppresses headline P/R/F1) | +| Unresolved label | Any | Excluded from scoring | + +- **Hybrid baseline:** three-valued OR (`tool OR ai`; clean + unknown stays + unknown). +- **Optional usage metadata:** `input_tokens`, `output_tokens`, + `elapsed_seconds`, and `cost_usd` stay `null` when unknown. +- **Fingerprints:** JSON reports record SHA-256 hashes for the corpus, blinded + packet, tool/script source, and each prediction file. + +## Building a real holdout + +Use [benchmarks/review-calibration.json](../benchmarks/review-calibration.json) +as a schema template only. A manifest with `tier: "holdout"` must declare: + +- `used_for_rule_development: false` +- `label_status: "adjudicated"` +- at least two distinct human `labelers` who labeled unseen, licensed snapshots + independently before seeing tool or AI outputs. + +Unlabeled collections use `tier: "candidate"` (`label_status: "unreviewed"`, +`labelers: []`) and can be exported and validated, but cannot be scored until +adjudicated labels are added. diff --git a/docs/self-use-check.md b/docs/self-use-check.md index b363eff..5ecf962 100644 --- a/docs/self-use-check.md +++ b/docs/self-use-check.md @@ -1,112 +1,74 @@ # Can ACS catch problems in its own instructions? -We tested the published **v0.26.2** wheel against copies of our own complete -tracked repository at `b782906aeea0dbfc3e99d1d7e95a81a699741c97`. -The untouched baseline scores **100**, with no active findings in five supported -instruction files: root `AGENTS.md` and the Claude, Cursor, Copilot and Gemini -examples. Ordinary README files are not treated as agent instructions. +We tested the published **v0.26.2** wheel against disposable copies of this +repository at `b782906aeea0dbfc3e99d1d7e95a81a699741c97` (without executing any +commands written in the instruction files). The untouched repository scores +**100** across its five supported instruction files (`AGENTS.md` plus the +Claude, Cursor, Copilot, and Gemini examples). Full raw outputs are retained in +[evidence/self-use-0262.json](evidence/self-use-0262.json). -The [retained raw report](evidence/self-use-0262.json) includes the source revision, -archive hash, installed tool identity, original case text, scan findings, -comparison findings and actual process exits. All modifications took place in -disposable copies; no deletion, network installer or other instruction was run. +## Fixes shipped in v0.27.0 -## Working behavior and limits +Two of the original high-score misses below were fixed in v0.27.0. A matched +comparison on the same archive (`1cec1aafe1d02259d94df5d785b604deda895de2`) is +retained in [evidence/self-use-prose-comparison.json](evidence/self-use-prose-comparison.json): -### Correction shipped in v0.27.0 - -Two of the original high-score probes below now produce active errors. A -[matched installed-tool comparison](evidence/self-use-prose-comparison.json) -uses the **same input archive and unchanged instruction scenarios** at -`1cec1aafe1d02259d94df5d785b604deda895de2` for the public wheel and changed source: - -| Known probe | Published 0.26.2 | Pre-release source | New comparison exit | +| Known probe | Published v0.26.2 | v0.27.0+ | Compare exit | |---|---:|---:|---:| -| Production database deletion with explicit approval exemption | 100 | 85, `deletion-approval-bypass` | 1 | -| Chinese instruction to falsely report passing tests | 100 | 88, `false-success-report` | 1 | -| Vague filler only | 100 | 100 | 0 | +| Production database deletion with explicit approval bypass | 100 | 85 (`deletion-approval-bypass`) | 1 | +| Chinese instruction to falsely report passing tests | 100 | 88 (`false-success-report`) | 1 | +| Vague filler only (`"Do a good job."`) | 100 | 100 | 0 | -All nine existing acceptance contracts still pass. Positive and negative -language/format variants are separately covered by regression tests. These -are corrections to known development cases, not independently measured accuracy. -The original comparison used two implementations declaring version 0.26.2; -the comparison records distinct **source fingerprints**, so the source build is -not confused with PyPI v0.26.2. The original failures below remain unchanged. The corrections now ship in v0.27.0+. +These fix known development cases; vague or arbitrary prose can still score 100. -### Original published-wheel observations +## Original published-wheel results (v0.26.2) -| Change to our actual root instructions | Scan score | Scan exit | Compare exit | +| Change to root `AGENTS.md` | Scan score | Scan exit | Compare exit | |---|---:|---:|---:| | No change | 100 | 0 | 0 | | Recommend `rm -rf build` | 89 | 1 | 1 | -| Prohibit that same deletion command | 100 | 0 | 0 | +| Prohibit `rm -rf build` | 100 | 0 | 0 | | Link to a nonexistent guide | 96 | 0 | 1 | -| Correct the link to the existing user guide | 100 | 0 | 0 | -| Require claiming that failed tests passed | 88 | 1 | 1 | -| Recommend piping a remote installer into bash | 82 | 1 | 1 | -| Recommend deletion and weaken the candidate policy | 89 | 0 | 1 | +| Fix link to existing user guide | 100 | 0 | 0 | +| Require claiming failed tests passed | 88 | 1 | 1 | +| Recommend piping a remote installer into `bash` | 82 | 1 | 1 | +| Recommend deletion and weaken candidate policy | 89 | 0 | 1 | | Empty the root instruction file | 70 | 1 | 1 | -The standalone scan applies its candidate's score floor, which our fixture sets -to 90. A missing guide is only a four-point warning, so the standalone command -returns success at 96. **Use baseline comparison for a PR gate**: the baseline's -zero-drop and new-error policies reject that regression. A PR lowering its own -threshold to zero also cannot authorize the deletion regression against the -unchanged baseline. Exit 0 never means every instruction is safe. +A broken link only deducts 4 points, so a standalone scan with a floor of 90 +still exits `0` at 96—**use baseline comparison (`diff` / `compare`) for PR +gates**, where the baseline's zero-drop and new-error rules reject both the +broken link and a candidate that tries to weaken its own policy. -We also ran three explicit limitation probes. These are **observations, not -passing detection tests**: +### Original limitation probes (v0.26.2) -| Instruction change | Observed score | Observed gate | +| Instruction change | Score | Gate | |---|---:|---| -| Replace useful root guidance with “Do a good job.” | 100 | Pass | -| Authorize removing the production database without confirmation, using prose rather than a recognized command | 100 | Pass | +| Replace root guidance with `"Do a good job."` | 100 | Pass | +| Authorize removing the production database without confirmation (prose, no shell command) | 100 | Pass | | Require falsely claiming tests passed, written in Chinese | 100 | Pass | -These results directly rule out using ACS as a complete instruction safety or -semantic quality reviewer. A 100 means no active deterministic rule matched; -it cannot distinguish all useful instructions from vague or unsafe ones. -Localized documentation/output does not imply semantic detection in those -languages. A maintainer should review important policy changes and use other -checks for behavior outside the documented rule grammar. - -The separate, **unscored** `guardrails` review also notices that the original -root `AGENTS.md` does not state deletion/overwrite approval safeguards, despite -its 100 score. We used that finding to add explicit approval guidance to our own -root file in this maintenance change. This improves our instructions; it is not -runtime enforcement, and it does not solve the semantic probes above. +The separate, unscored `guardrails` check also flagged that our original root +`AGENTS.md` lacked explicit deletion/overwrite approval wording, which we added +as part of this maintenance pass. ## Reproduce locally -Create an isolated environment, install ACS 0.26.2, then run from a local ACS -checkout containing the pinned source revision: +Install the target wheel in an isolated venv, then run from a local checkout: ```bash python scripts/run_self_acceptance.py --python /path/to/venv/bin/python \ --ref b782906aeea0dbfc3e99d1d7e95a81a699741c97 --output self-use-new.json ``` -On Windows, pass the environment's `Scripts/python.exe`. The controller uses -only the standard library and local Git; the worker uses the specified installed -ACS package in isolated mode. Package installation needs network access; the -replay itself does not. Existing output files are never overwritten. `--ref HEAD` -tests the current committed repository; it does not test uncommitted changes. - -For v0.27.0+ use `--require-current-fixes` to promote the database-bypass and -Chinese false-passing probes to required detections and add a clean inline-link -example control. This profile has twelve known contracts and one remaining -descriptive filler probe. CI and release acceptance require that profile on -each installed platform. Keep the default profile when reproducing the original -published v0.26.2 observations. - -The nine known acceptance contracts must match their declared rule IDs and gate -exits. The three limitation probes remain descriptive: detecting one after a -future improvement must not fail the runner. A failed contract is retained in -the JSON result and returns exit 1. Operational failures do not produce a clean -report. Installed-wheel CI replays these checks on Linux, Windows and macOS. - -This is **maintainer-authored development acceptance**, not independent accuracy -or evidence that another maintainer uses ACS. It supports a small read-only trial -of the bounded linter; it does not justify promising a comprehensive security -audit. See [rule and score limitations](limitations.md) and the -[maintainer workflow](maintainer-workflow.md) before selecting a gate policy. +On Windows, pass `Scripts/python.exe`. `--ref HEAD` tests the current committed +snapshot (ignoring uncommitted edits), and `--output` must be a new file. + +For v0.27.0+, pass `--require-current-fixes` to enforce the 12 known contracts +(including the database-bypass, Chinese false-passing, and inline-link example +cases) while keeping the vague-filler probe descriptive. CI and release +acceptance run this profile on Linux, Windows, and macOS. + +This is maintainer self-acceptance on our own repository—not an independent +accuracy benchmark or external adoption metric. See [limitations.md](limitations.md) +and [maintainer-workflow.md](maintainer-workflow.md).