@ictechgy/context-guard 0.4.14 → 0.4.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/README.ko.md +72 -1
- package/README.md +85 -2
- package/docs/benchmark-fixtures/image-context-pack-full-evidence.prompt.example.md +28 -0
- package/docs/benchmark-fixtures/image-context-pack-packed-evidence.prompt.example.md +31 -0
- package/docs/benchmark-fixtures/image-context-pack.evidence.example.jsonl +2 -0
- package/docs/benchmark-fixtures/image-context-pack.tasks.example.json +18 -0
- package/docs/benchmark-fixtures/image-context-pack.variants.example.json +10 -0
- package/docs/benchmark-workflow-examples.md +16 -0
- package/docs/experimental-benchmark-fixtures.md +52 -1
- package/package.json +2 -1
- package/plugins/context-guard/.claude-plugin/plugin.json +1 -1
- package/plugins/context-guard/README.ko.md +43 -0
- package/plugins/context-guard/README.md +43 -0
- package/plugins/context-guard/bin/context-guard-artifact +90 -9
- package/plugins/context-guard/bin/context-guard-audit +169 -66
- package/plugins/context-guard/bin/context-guard-bench +7038 -307
- package/plugins/context-guard/bin/context-guard-compress +90 -8
- package/plugins/context-guard/bin/context-guard-diet +1 -7
- package/plugins/context-guard/bin/context-guard-experiments +3085 -134
- package/plugins/context-guard/bin/context-guard-failed-nudge +705 -83
- package/plugins/context-guard/bin/context-guard-guard-read +490 -55
- package/plugins/context-guard/bin/context-guard-mcp +999 -0
- package/plugins/context-guard/bin/context-guard-pack +744 -20
- package/plugins/context-guard/bin/context-guard-read-symbol +7 -2
- package/plugins/context-guard/bin/context-guard-rewrite-bash +2204 -223
- package/plugins/context-guard/bin/context-guard-sanitize-output +560 -85
- package/plugins/context-guard/bin/context-guard-setup +1073 -147
- package/plugins/context-guard/bin/context-guard-statusline +131 -54
- package/plugins/context-guard/bin/context-guard-statusline-merged +7 -3
- package/plugins/context-guard/bin/context-guard-tool-prune +44 -11
- package/plugins/context-guard/bin/context-guard-trim-output +89 -13
- package/plugins/context-guard/brief/README.md +19 -0
- package/plugins/context-guard/brief/narration-mode.quiet.md +21 -0
- package/plugins/context-guard/lib/context_guard_commands.py +14 -2
- package/plugins/context-guard/lib/credential_policy.py +177 -0
- package/plugins/context-guard/lib/transcript_usage_reducer.py +378 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,21 @@ All notable changes for the ContextGuard plugin are documented here.
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [0.4.16] - 2026-08-01
|
|
8
|
+
|
|
9
|
+
- Sanitizer output-scanning is now one monotonic left-to-right pass. All nine location-prefix consumers previously re-parsed the same optional `path:line:` fragment at every offset, which made lines with few colons quadratic: a single 82,015-byte line took 2.62 s and a 100,014-byte line took 3.98 s. The leading prefix is identified once and the seven unanchored consumers run as fragment-free twins, while the two `^`-anchored header consumers keep their original patterns because they were never a per-offset cost. The same lines now take 64.3 ms and 0.078 s, with doubling ratios of 1.84 to 2.01. Redaction output is byte-identical to the previous implementation, pinned by a differential oracle against a hash-frozen baseline across eleven corpora, three sanitization contexts, both path-display modes, and both shared-state and per-line runs.
|
|
10
|
+
- `context-guard-trim-output --digest` no longer inflates small output. When a command succeeds and its output is already smaller than the digest would be, the output is passed through with a one-line marker; a 19-byte output previously produced a 461-byte markdown digest or a 755-byte JSON digest. A failing command always keeps the digest, because that is where the exit code and failure signature live, and requesting `--artifact-receipt` always keeps it too. Pass `--digest-always` to force the structured digest in every case.
|
|
11
|
+
- Both READMEs now document the standing per-request cost of the advisory rule blocks (`brief-mode.lite` 1,487 bytes, `brief-mode.standard` 1,568, `brief-mode.ultra` 1,523, `narration-mode.quiet` 866) and frame that size as the break-even threshold a reply-length reduction has to clear. Hook guardrails are contrasted honestly: they charge only when they act, and a sub-threshold `Read` adds 3 bytes.
|
|
12
|
+
- Added a default-off, Claude-only quiet-narration rule managed through a dedicated rules-only setup path. It suppresses discretionary narration while preserving approvals, blockers, failures, safety warnings, final results, changed files, and verification; it does not activate settings or hooks or claim guaranteed savings.
|
|
13
|
+
- Benchmark measurement substrate for the planned token-savings study: scheduling, accounting, resume, and inference surfaces plus a real twelve-task fixture suite with out-of-workspace success checkers and a zero-cost seventy-two-run fake-provider rehearsal. These are measurement-enabling only. No provider-measured token or cost savings are claimed, and the rehearsal explicitly records that its own token counts are scripted local fixtures.
|
|
14
|
+
|
|
15
|
+
## [0.4.15] - 2026-07-15
|
|
16
|
+
|
|
17
|
+
- Added conservative plan-only and evaluation-only proof-carrying-context, semantic-GC, and image-context-pack surfaces without enabling automatic omission, renderer/OCR/provider/proxy execution, promotion authority, or hosted savings claims.
|
|
18
|
+
- Added deterministic matched image-context benchmark fixtures and the optional `contextguard.bench.image-context-pack-evaluation.v1` profile with prompt binding, imported fallback attestation, protected-zone review, missed-context/correction checks, provider/shifted-cost agreement, prewrite rejection, and authority clamps.
|
|
19
|
+
- Added local proof verification, content-addressed pack and rolling-delta metadata, an opt-in sketch duplicate veto, local stdio MCP compress/retrieve/stats middleware, and bounded caller-supplied static relevance evidence.
|
|
20
|
+
- Expanded hostile-input, concurrency, source/package parity, release-smoke, and cross-platform regression coverage while preserving default-off, local-first, no-new-dependency behavior.
|
|
21
|
+
|
|
7
22
|
## [0.4.14] - 2026-07-10
|
|
8
23
|
|
|
9
24
|
- Added the default-off `semantic-checkpoint` experimental planning gate with deterministic readiness payloads, explicit scope/metric/rollback validation, prompt-cache caveats, and hosted-savings claim boundaries.
|
package/README.ko.md
CHANGED
|
@@ -95,6 +95,33 @@ brief 모드는 코딩 에이전트가 군더더기를 줄이도록 요청하되
|
|
|
95
95
|
|
|
96
96
|
사전 정의된 세 레벨이 [`plugins/context-guard/brief/`](plugins/context-guard/brief/)에 포함됩니다: `lite`, `standard`, `ultra`. 각 레벨은 에이전트 규칙·지시 파일(`AGENTS.md`, `CLAUDE.md`, Cursor 규칙 파일, Copilot 지시 등)에 들어가는 마커 구분 블록입니다. `context-guard setup --agent codex --scope project --brief-mode standard --plan`으로 미리 보고, 적용은 `--yes`로 다시 실행하며, 제거는 `--brief-mode off`를 사용하세요. 자세한 내용은 [`plugins/context-guard/brief/README.md`](plugins/context-guard/brief/README.md)를 참고하세요.
|
|
97
97
|
|
|
98
|
+
### 상시 비용과 손익분기
|
|
99
|
+
|
|
100
|
+
안내용 규칙 블록은 공짜가 아닙니다. 에이전트의 규칙 파일에 상주하므로 설치해 둔 동안 모든 요청에 다시 실려 갑니다.
|
|
101
|
+
|
|
102
|
+
| 관리 블록 | 설치 크기 |
|
|
103
|
+
| --- | --- |
|
|
104
|
+
| `brief-mode.lite` | 1,487 바이트 |
|
|
105
|
+
| `brief-mode.standard` | 1,568 바이트 |
|
|
106
|
+
| `brief-mode.ultra` | 1,523 바이트 |
|
|
107
|
+
| `narration-mode.quiet` | 866 바이트 |
|
|
108
|
+
|
|
109
|
+
이 비용은 요청마다 선불로 확정되는 반면, 이득은 ContextGuard가 강제할 수 없는 확률적인 응답 길이 감소입니다. 턴 수가 적은 세션이나 이미 간결하게 답하는 에이전트에서는 블록이 절감분보다 더 들 수 있습니다. 훅 기반 가드레일은 성질이 다릅니다. 실제로 개입할 때만 비용이 들고, 측정된 최악의 경우도 작습니다. 임계값 이하 `Read`는 3바이트를 더하고, 대용량 읽기를 반복 시도해도 첫 경고 이후에는 누적되지 않고 오히려 줄어듭니다.
|
|
110
|
+
|
|
111
|
+
토큰 효과를 노려 규칙 블록을 설치하기 전에 직접 측정하십시오. `context-guard-bench`로 블록이 있는 경우와 없는 경우를 동일 과제에서 비교하고, 블록의 설치 크기를 응답 길이 감소가 넘어야 하는 손익분기점으로 취급하십시오. 여기 적힌 바이트 수는 관측값이지만 토큰 효과는 관측값이 아니며, 고정된 절감률을 보장하지 않습니다.
|
|
112
|
+
|
|
113
|
+
## Claude 조용한 진행 설명 (안내용)
|
|
114
|
+
|
|
115
|
+
조용한 진행 설명은 기본적으로 꺼져 있는 별도의 Claude 전용 규칙입니다. 선택적 사전 설명, 도구별 진행 중계, 군더더기, 반복 중간 요약은 줄이지만 승인·결정 요청, 차단 요인, 실패, 파괴적 작업·보안 경고, 상위 우선순위가 요구하는 진행 보고, 최종 결과, 변경 파일, 검증 결과는 유지합니다. 최종 답변의 간결성이나 추론 깊이와는 별개인 최선 노력 규칙이며, 토큰·비용 절감을 **보장하지 않습니다.**
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
context-guard setup --rules-only --agent claude --scope project --narration-mode quiet --plan
|
|
119
|
+
context-guard setup --rules-only --agent claude --scope project --narration-mode quiet --yes
|
|
120
|
+
context-guard setup --rules-only --agent claude --scope project --narration-mode default --yes
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
이 격리된 작업은 프로젝트 `CLAUDE.md` 안의 ContextGuard narration 구간만 관리합니다. Claude settings, hook, permission, statusline, model default 또는 다른 에이전트 규칙 파일은 읽거나 바꾸지 않습니다. brief mode, 초기화, skill 생성 또는 일반 setup 작업과 함께 사용할 수 없습니다. Gate C는 정적 규칙과 setup 부작용만 검증하며 모델의 준수나 수치 절감 주장을 증명하지 않습니다.
|
|
124
|
+
|
|
98
125
|
## 직접 측정하는 방법
|
|
99
126
|
|
|
100
127
|
절감 수치가 필요하면 실제 작업에서 직접 측정하세요.
|
|
@@ -234,6 +261,19 @@ context-guard setup --agent claude --scope user --verify --json
|
|
|
234
261
|
|
|
235
262
|
선택형 Read 가드는 큰 파일에 대해 검색 → 심볼 구간 → 작은 줄 범위 순서의 단계적 축소 전략을 제안합니다. 가능하면 제한된 최상위 개요도 함께 보여줍니다. 같은 대용량 파일을 반복해서 전체 읽으려 하면 중복 읽기 경고를 표시해 같은 컨텍스트 낭비 경로를 반복하지 않게 합니다.
|
|
236
263
|
|
|
264
|
+
적용 범위는 의도적으로 Claude Code `PreToolUse`의 `Read` matcher 훅으로 한정됩니다.
|
|
265
|
+
|
|
266
|
+
이 Read 가드를 선택하면 setup은 기존 deny 값 중 정확히 `Read(./.env)`와 `Read(./.env.*)`만 제거합니다. 비슷한 permission 항목과 그 상대적 순서는 유지합니다.
|
|
267
|
+
|
|
268
|
+
| Claude 도구 | 보호 범위 |
|
|
269
|
+
| --- | --- |
|
|
270
|
+
| `Read` | 제한된 대용량 파일 범위를 검사하고, basename이 `.env`로 시작하면 차단합니다. 단, 정확히 `.env.example`, `.env.sample`, `.env.template`인 템플릿 이름은 허용합니다. 중첩 경로도 포함하며 symlink 여부가 모호하면 닫힌 상태로 실패합니다. |
|
|
271
|
+
| `Glob` | 일치하는 이름을 나열할 수 있습니다. 이 `Read` 훅을 통해 파일 내용을 읽지는 않습니다. |
|
|
272
|
+
| `Grep` | 이 훅의 범위 밖이며 일치하는 파일 내용을 읽을 수 있습니다. |
|
|
273
|
+
| `Bash` | 이 훅의 범위 밖이며 파일 내용을 읽을 수 있습니다. |
|
|
274
|
+
|
|
275
|
+
이는 Claude `Read` 보호이지 범용 `.env` 보호나 Bash 보호가 아닙니다. 훅은 symlink를 따라가지 않고 직접 연 파일 descriptor의 상태를 다시 검증하지만, 실제 Claude `Read`는 훅이 반환된 뒤 파일을 다시 엽니다. 그 사이 파일이 교체될 수 있는 post-hook 구간은 문서화된 TOCTOU 한계입니다.
|
|
276
|
+
|
|
237
277
|
### 큰 로그를 로컬에 저장하고 필요한 부분만 조회
|
|
238
278
|
|
|
239
279
|
```bash
|
|
@@ -261,6 +301,10 @@ long-command 2>&1 | ./plugins/context-guard/bin/context-guard-artifact store --c
|
|
|
261
301
|
--manifest-out suggested-pack.json --budget-bytes 12000 --json --adaptive-k --adaptive-k-policy recall
|
|
262
302
|
./plugins/context-guard/bin/context-guard-pack build \
|
|
263
303
|
--root . --manifest suggested-pack.json --budget-bytes 12000 --json
|
|
304
|
+
# 하나의 정확한 private local receipt와 선택적으로 진단 비교:
|
|
305
|
+
./plugins/context-guard/bin/context-guard-pack build \
|
|
306
|
+
--root . --manifest suggested-pack.json --budget-bytes 12000 --json --no-artifact \
|
|
307
|
+
--delta-from-pack-id 0123456789abcdef0123
|
|
264
308
|
./plugins/context-guard/bin/context-guard-pack slice --root . --path README.md --lines 1:40 --json
|
|
265
309
|
```
|
|
266
310
|
|
|
@@ -276,6 +320,8 @@ long-command 2>&1 | ./plugins/context-guard/bin/context-guard-artifact store --c
|
|
|
276
320
|
- `--manifest-out`은 `build`가 읽을 수 있는 manifest를 저장하고, `--pack-out`은 렌더링된 팩 본문을 저장합니다.
|
|
277
321
|
- `context-guard-pack suggest`는 더 낮은 수준의 로컬 전용 준비 단계입니다. `--query`, `--diff`, 반복 `--files`, 그리고 `--root` 아래의 선택적 `--output` / `--test-output` 텍스트 파일을 가림 처리한 신호에서 후보 파일과 줄 범위를 순위화한 뒤 `build --manifest`가 바로 읽을 수 있는 manifest를 씁니다.
|
|
278
322
|
- `context-guard-pack build`는 우선순위가 있는 로컬 파일 근거를 렌더링된 UTF-8 바이트 기준 `--budget-bytes` 안의 Markdown 팩으로 조립합니다. JSON 출력은 포함·부분 포함·중복·unsafe·missing·예산 초과로 누락된 source를 기록합니다.
|
|
323
|
+
- 모든 build는 정확히 렌더링된 pack byte의 `content_address`(`sha256:<digest>`)를 제공하면서 기존 `pack_id`는 유지합니다. `build` 또는 `auto`의 선택적 `--delta-from-pack-id PACK_ID`는 `.context-guard/packs/PACK_ID.json` 하나만 읽고 bounded/fail-soft `rolling_delta` 진단을 반환합니다. selection, pack 본문, `pack_id`, 기본 동작을 바꾸지 않으며 provider token/cost savings claim이 아닙니다. 진단은 `--json` 출력 또는 저장된 artifact receipt에서만 보고됩니다. `--no-artifact`를 쓰면 진단 보고에 `--json`이 필요하며, 기존 text stdout은 정확한 pack 본문을 그대로 유지합니다.
|
|
324
|
+
- 선택적 `build`/`auto --sketch-duplicate-veto`는 sanitizer를 거친 slice에 rank-stable pre-budget duplicate gate를 적용하며 `suggest`는 바꾸지 않습니다. 먼저 SHA-256 digest가 같은 후보를 byte 단위로 확인하고, 이후 Unicode casefold된 순서 보존 5-token shingle, 고정 length framing, bottom 64 unique digest, 양쪽 최소 cardinality 12, inclusive 0.90의 정직하게 명명된 sketch-set Jaccard heuristic을 사용합니다. 짧은 sketch는 exact-only입니다. eligible pair 100,000개를 검증한 뒤 실제로 처음 건너뛴 pair에서 fail open하고 이후 sketch 작업을 끄지만 exact digest/byte 확인은 계속합니다. 더 높은 rank의 winner도 최종 byte budget에 들어가지 않을 수 있으므로 편집하거나 근거로 의존하기 전에 누락 source 자체를 exact retrieval 하십시오. JSON/receipt은 standalone build 결과(또는 `auto.build`)의 `sketch_duplicate_veto.comparison_cap_reached`만 노출하고 omission reason은 `sketch_duplicate_source`이며, flagged text summary는 artifact 저장 실패와 무관하게 `sketch_comparison_cap_reached=true|false`를 붙입니다. fingerprint, match identity, overlap, score, provider token/cost savings claim은 내보내지 않으며 flag가 없으면 selection과 출력은 호환됩니다.
|
|
279
325
|
- 제한된 로컬 요약 기록은 `.context-guard/packs`에 저장됩니다. `path`와 `root`를 안전하게 표시할 수 있을 때만 정확한 가림 처리 slice 명령을 제공하고, 안전하지 않으면 팩 본문과 JSON 메타데이터에 `retrieval_omitted_reason`을 남깁니다.
|
|
280
326
|
|
|
281
327
|
표준 라이브러리 기반의 결정적 휴리스틱만 사용하며, 네트워크·모델 호출·임베딩·provider 비용 추정은 하지 않습니다. 바이트 수는 관측값이고, 토큰 수는 provider가 실제 측정한 토큰 절감값이 아니라 추정 `chars_div_4` proxy입니다.
|
|
@@ -326,7 +372,7 @@ cat sanitized-prose.txt | ./plugins/context-guard/bin/context-guard-compress --j
|
|
|
326
372
|
./plugins/context-guard/bin/context-guard-trim-output --max-lines 120 -- npm test
|
|
327
373
|
```
|
|
328
374
|
|
|
329
|
-
head/tail 로그 대신 의미 요약이 필요하면 `--digest markdown` 또는 `--digest json`을 사용하세요. 요약 모드는 원래 종료 코드를 보존하면서 상태, 종료 코드, 잘린 줄 수, 실행기 실패 정보, 가림 처리된 실패 signature, 중복 라인 그룹, 대표 라인, 가림 처리 횟수, 다음 조회 제안을 남깁니다. 요약 모드에서 가림 처리된 전체 출력을 로컬 `context-guard-artifact` 보관본에 저장하려면 `--artifact-receipt`를 함께 사용하세요. 출력된 `contextguard-artifact:<id>` 핸들을 agent context에 남기고, 생략된 세부 내용에 의존하기 전에 `context-guard-artifact receipt/get/search ...` 명령으로 필요한 부분을 정확히 다시 가져오세요. 래핑된 명령은 기본 600초 뒤 종료되며, `--timeout-seconds`로 조정할 수 있습니다.
|
|
375
|
+
head/tail 로그 대신 의미 요약이 필요하면 `--digest markdown` 또는 `--digest json`을 사용하세요. 명령이 성공하고 출력이 이미 요약보다 작으면 요약 대신 원래 출력을 한 줄 표식과 함께 그대로 통과시키므로, 출력이 적은 명령에 요약 모드를 켜도 컨텍스트가 늘어나지 않습니다. 실패한 명령은 종료 코드와 실패 signature가 요약에 담기므로 항상 요약을 유지합니다. 모든 경우에 구조화된 요약을 유지하려면 `--digest-always`를 전달하세요. 요약 모드는 원래 종료 코드를 보존하면서 상태, 종료 코드, 잘린 줄 수, 실행기 실패 정보, 가림 처리된 실패 signature, 중복 라인 그룹, 대표 라인, 가림 처리 횟수, 다음 조회 제안을 남깁니다. 요약 모드에서 가림 처리된 전체 출력을 로컬 `context-guard-artifact` 보관본에 저장하려면 `--artifact-receipt`를 함께 사용하세요. 출력된 `contextguard-artifact:<id>` 핸들을 agent context에 남기고, 생략된 세부 내용에 의존하기 전에 `context-guard-artifact receipt/get/search ...` 명령으로 필요한 부분을 정확히 다시 가져오세요. 래핑된 명령은 기본 600초 뒤 종료되며, `--timeout-seconds`로 조정할 수 있습니다.
|
|
330
376
|
|
|
331
377
|
### 검색·diff 출력 민감정보 가림
|
|
332
378
|
|
|
@@ -369,6 +415,11 @@ JSON 출력에는 여러 증거 surface가 포함될 수 있습니다.
|
|
|
369
415
|
--ledger-jsonl bench/cost-shift.jsonl --report-json bench/report.json
|
|
370
416
|
```
|
|
371
417
|
|
|
418
|
+
각 task fixture의 선택 필드 `output_format`은 기본값이 `json`이며 `json|stream-json`만
|
|
419
|
+
허용합니다. `stream-json` 모드는 runner가 관리하는 `--verbose`를 추가하고 bounded NDJSON의
|
|
420
|
+
마지막 event가 유효한 terminal result일 때만 성공으로 처리합니다. 이 경로의 client cost도
|
|
421
|
+
provider billing을 authoritative하게 증명하지 않는 진단값입니다.
|
|
422
|
+
|
|
372
423
|
보고서를 읽을 때는 먼저 주장 범위를 확인하세요.
|
|
373
424
|
|
|
374
425
|
- 성공한 기준/변형 실행은 실제 토큰과 `cost_usd + external_cost_usd` 기준으로 비교하고, 바이트 감소는 간접 증거로만 기록합니다.
|
|
@@ -396,6 +447,8 @@ context-guard experiments plan visual-crop-ocr --json --full-evidence-receipt <i
|
|
|
396
447
|
context-guard experiments emit visual-crop-ocr --json --full-evidence-receipt <id> --crop-label <label> --crop-bounds 0,0,100,100 --image-size 800,600 --ocr-text "visible text" --ocr-confidence 0.9 --ocr-error-note "glyph may be uncertain" --missed-context-note "outside crop omitted"
|
|
397
448
|
context-guard experiments plan image-context-pack --json --exact-text-fallback-receipt <id> --reexpand-command "context-guard-artifact get <id> --full" --provider-boundary-ack --protected-zone-policy deny --missed-context-note "omitted text remains retrievable before any future image pack is used" --image-size 800,600 --packed-image-size 400,300
|
|
398
449
|
context-guard experiments plan semantic-checkpoint --json --goal "preserve current task state for review" --constraint "do not rewrite protected evidence" --decision "ship plan-only semantic-checkpoint gate first" --open-task "verify exact fallback before any checkpoint is used" --evidence-handle "roadmap=contextguard-artifact:0123456789abcdef" --missing-provenance-note "none known after review" --unresolved-question "which provenance handle fields become mandatory later" --exact-context-fallback-receipt 0123456789abcdef --reexpand-command "context-guard-artifact get 0123456789abcdef --full" --provider-boundary-ack --protected-zone-policy deny --missed-context-note "raw transcript remains retrievable before checkpoint metadata is used"
|
|
450
|
+
context-guard experiments plan proof-carrying-context --json --proof-unit-json '{"source_label":"context-filesystem-roadmap","receipt_id":"0123456789abcdef","content_sha256":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","safe_range":{"kind":"lines","start":82,"end":85},"captured_at":"2026-07-10T04:11:12Z","transform_policy":"safe_range_extract","rehydrate_command":"context-guard-artifact get 0123456789abcdef --full"}' --provider-boundary-ack --protected-zone-policy deny
|
|
451
|
+
context-guard experiments verify proof-carrying-context --artifact-dir ./artifacts --proof-unit-json '{"source_label":"context-filesystem-roadmap","receipt_id":"0123456789abcdef","content_sha256":"12637068ee51f2ddfe27f1c00836a51cb54ba6a5cfca7f2301a4a45fbade2d14","safe_range":{"kind":"lines","start":1,"end":1},"captured_at":"2026-07-10T04:11:12Z","transform_policy":"safe_range_extract","rehydrate_command":"context-guard-artifact get 0123456789abcdef --full"}' --json
|
|
399
452
|
context-guard experiments plan learned-compression --json --sanitized --trusted-source --exact-fallback-receipt <id> --reexpand-command "context-guard-artifact get <id> --full" < sanitized-prose.txt
|
|
400
453
|
context-guard experiments emit learned-compression --json --sanitized --trusted-source --exact-fallback-receipt <id> --reexpand-command "context-guard-artifact get <id> --full" --replacement-file compact-prose.txt < sanitized-prose.txt
|
|
401
454
|
context-guard experiments plan self-hosted-metrics-ledger --json --latency-ms 123.5 --peak-memory-mb 2048 --quality-score 0.98
|
|
@@ -410,6 +463,10 @@ context-guard experiments disable output-receipt-trim --root .
|
|
|
410
463
|
|
|
411
464
|
`plan semantic-checkpoint`는 plan-only/eval-only gate입니다. CLI flag는 dry-run 검토를 위해 optional이지만, JSON payload에서는 goal, exact fallback receipt, local re-expand command, provider-boundary ack, protected-zone policy `deny`, missed-context note, provenance review note가 없으면 readiness blocker로 남습니다. re-expand command는 `context-guard-artifact get <id> --full` 또는 `context-guard artifact get <id> --full` 형태의 로컬 artifact 재조회만 허용합니다. `--missing-provenance-note`는 `none known after review` 같은 검토 확인 문구일 수 있습니다. 이 gate는 `emit`/`record`/`serve` runtime, 새 `context-guard-semantic-checkpoint` binary, file write, transcript/prompt edit, model/provider/network call, replacement context, hosted token/cost savings claim을 제공하지 않습니다.
|
|
412
465
|
|
|
466
|
+
`plan proof-carrying-context`는 기본 비활성 plan-only proof-envelope metadata readiness gate입니다. 반복 가능한 bounded inline JSON의 구문과 정의된 일관성만 검사하고 caller timestamp를 그대로 유지하며 현재 시간을 생성하거나 freshness를 비교하지 않습니다. Protected-zone policy는 선언 전용이고 range bounds, receipt storage, source content, SHA-256, timestamp freshness, rehydration은 검사하지 않은 warning으로 남습니다. Source/artifact/config/stdin content를 읽지 않고 file write, model/provider/network/subprocess call, context 생성·대체를 하지 않으며 `candidate_replacement`는 항상 `null`입니다. `emit`/`record`/`serve` runtime이나 새 binary도 없고 provider가 측정한 matched successful task 없이는 hosted token/cost savings claim을 허용하지 않습니다.
|
|
467
|
+
|
|
468
|
+
`verify proof-carrying-context`는 별도의 read-only local verifier입니다. 문서 fixture는 정확한 UTF-8 문자열 `ContextGuard proof fixture\n`(27 bytes, 1 line)이고 SHA-256은 `12637068ee51f2ddfe27f1c00836a51cb54ba6a5cfca7f2301a4a45fbade2d14`입니다. Verifier는 explicit artifact directory 하나만 사용하고 fallback search를 수행하지 않고 symlink를 follow하지 않으며, effective user 소유의 directory mode `0700`과 두 receipt leaf 모두 mode `0600`을 요구합니다. Bounded whole file을 읽어 receipt/proof hash, byte/line count, range bounds만 검증하고 range content는 retrieve/echo하지 않습니다. Exit `0`은 이 local binding만 통과했다는 뜻이고 exit `2`는 verification failure입니다. Timestamp freshness와 protected-zone semantics는 unchecked이고, rehydrate command는 syntax/receipt binding만 확인하며 실행하지 않습니다. `candidate_replacement`는 `null`이고 replacement, omission, hosted-savings claim 권한을 부여하지 않습니다.
|
|
469
|
+
|
|
413
470
|
local-proxy 예시는 side effect 기준으로 나뉩니다.
|
|
414
471
|
|
|
415
472
|
- `plan local-proxy`는 advisory metadata만 만들며 forwarding을 켜지 않습니다.
|
|
@@ -484,6 +541,10 @@ context-guard-setup --plan
|
|
|
484
541
|
|
|
485
542
|
생성되는 hook 명령은 기본적으로 `PATH` 조회에 의존하지 않습니다. setup 마법사는 명시적인 패키지/체크아웃 헬퍼 경로를 기록하며, `--allow-path-helper-fallback`은 신뢰한 외부 설치를 사용할 때만 canonical 경로·symlink 없음·bounded identity probe 검증 후 허용됩니다. macOS 앱 헬퍼도 같은 신뢰 모델을 따릅니다. launch CWD 탐색, 상대 override 경로, 필요한 allowlist 값을 넘어선 상위 셸 환경 상속을 사용하지 않습니다.
|
|
486
543
|
|
|
544
|
+
## 로컬 MCP 어댑터
|
|
545
|
+
|
|
546
|
+
`context-guard mcp`(또는 `context-guard-mcp`)는 의존성 없는 로컬 stdio MCP 서버입니다. 프로세스 하나는 root와 namespace 하나에 고정되며 compression, sanitization된 artifact 조회, 로컬 통계만 제공합니다. HTTP, SSE, 네트워크, provider, model, proxy, 자동 client 설정 기능은 없습니다. 저장되는 fallback은 원문이 아닌 정확한 sanitization 완료 사본이고 다른 namespace의 artifact는 조회할 수 없습니다. 이 로컬 어댑터는 hosted token/cost 절감을 주장하지 않습니다.
|
|
547
|
+
|
|
487
548
|
## 릴리스 확인
|
|
488
549
|
|
|
489
550
|
릴리스에 민감한 변경을 배포하거나 머지하기 전에는 동기화 확인과 두 게이트를 모두 실행하세요.
|
|
@@ -498,6 +559,16 @@ python3 scripts/release_smoke.py
|
|
|
498
559
|
|
|
499
560
|
버전별 릴리스 노트는 [CHANGELOG.md](CHANGELOG.md)에 기록하며, 사전 배포 게이트는 플러그인 매니페스트 버전과 일치하는 항목이 있는지 확인합니다.
|
|
500
561
|
|
|
562
|
+
### 실험적 semantic-GC plan gate
|
|
563
|
+
|
|
564
|
+
`semantic-gc`는 기본 비활성화된 deny 전용 계획 검토 gate입니다. 기본 비활성화는 registry intent를 뜻하며, 명시적 plan CLI는 계속 실행할 수 있지만 omission이나 runtime action을 활성화하지 않습니다. 전체 envelope나 graph topology가 모호하면 graph evaluation을 억제합니다. 도달할 수 없는 node는 semantic irrelevance의 증명이 아니라 검토 후보일 뿐이며 omission과 runtime action은 승인되지 않습니다. missed-context note는 신뢰되지 않은 입력입니다. 이 planner는 context/artifact 내용을 읽지 않고 provenance, fallback, provider, hosted 절감을 검증하지 않습니다. Exit 0은 `ready_for_plan_review`만 뜻하며 delete/omit 권한이 아닙니다.
|
|
565
|
+
|
|
566
|
+
context-guard experiments plan semantic-gc --json --context-unit-json '{"schema":"contextguard.semantic-gc-unit.v1","unit_id":"root","references":[],"is_root":true,"protected_zone":false}' --context-unit-json '{"schema":"contextguard.semantic-gc-unit.v1","unit_id":"orphan","references":[],"is_root":false,"protected_zone":false,"content_sha256":"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb","provenance":{"source_label":"canonical-example","receipt_id":"0123456789abcdef"},"missed_context_note":"A reviewer could lose the orphaned rationale.","exact_fallback_command":"context-guard-artifact get 0123456789abcdef --full"}' --provider-boundary-ack --human-review-ack --protected-zone-policy deny
|
|
567
|
+
|
|
568
|
+
`static-relevance`는 호출자가 제공한 제한된 static evidence를 컴파일하는 기본 비활성화 기능입니다. 누락된 signal은 모든 slice와 review ordering을 억제하며, 빈 edge list도 검증된 관측이 아니라 선언입니다. protected path match와 명시적 보호 reason은 사람 검토에서 먼저 보게 하는 hard retention veto일 뿐입니다. 이 명령은 계획 검토 전용이며 repo를 읽지 않고, git을 호출하지 않으며, parser·provider·network·subprocess도 호출하지 않습니다. 결정적 review order에는 omit 권한이 없고 삭제·deprioritization·대체·runtime action도 승인하지 않습니다.
|
|
569
|
+
|
|
570
|
+
context-guard experiments plan static-relevance --json --relevance-unit-json '{"schema":"contextguard.static-relevance-unit.v1","unit_id":"src/cli.py::main","path":"src/cli.py","task_anchor":true,"protection_reasons":[],"symbol":{"name":"main","kind":"function","start_line":1,"end_line":40},"symbol_references":[],"dataflow_predecessors":[],"dataflow_successors":[],"git":{"blame_age_days":2,"blame_contributor_count":1,"path_change_count_90d":3}}' --protected-path-policy deny --provider-boundary-ack
|
|
571
|
+
|
|
501
572
|
## 라이선스
|
|
502
573
|
|
|
503
574
|
Copyright 2026 jinhongan. Apache License 2.0으로 배포됩니다. 자세한 내용은 [LICENSE](LICENSE)와 [NOTICE](NOTICE)를 참고하세요.
|
package/README.md
CHANGED
|
@@ -80,7 +80,7 @@ ContextGuard complements provider and semantic caches, and works alongside promp
|
|
|
80
80
|
| Provider prompt/context caching | Reusing stable prompt prefixes. | Complementary; ContextGuard helps keep the changing tail of context smaller and cleaner, `context-guard-audit` can flag likely volatile prefix layouts, and `context-guard cost` can warn when an Anthropic request is likely to cache-write instead of cache-read. |
|
|
81
81
|
| Semantic response cache | Reusing answers to identical or similar requests. | Complementary; ContextGuard does not serve cached AI answers. |
|
|
82
82
|
| Prompt/context compression | Shortening text that is already selected for the model. | Adjacent; ContextGuard trims and summarizes local output, but does not promise lossless semantic compression. |
|
|
83
|
-
| Experimental planners and local runtimes | Default-off and explicit-command-only; covers plan-only `image-context-pack` and `semantic-checkpoint` gates plus local-proxy plans/gate records and narrow local runtimes for caller-supplied context-diff, visual evidence-pack, learned-compression, and self-hosted metrics evidence. | `image-context-pack`
|
|
83
|
+
| Experimental planners and local runtimes | Default-off and explicit-command-only; covers plan-only `image-context-pack` and `semantic-checkpoint` gates plus local-proxy plans/gate records and narrow local runtimes for caller-supplied context-diff, visual evidence-pack, learned-compression, and self-hosted metrics evidence. | `image-context-pack` is a pxpipe-inspired dry-run planning gate only: it does not render images, run OCR, emit replacements, store binary image artifacts, call providers, or proxy traffic, and it requires exact text fallback plus provider-measured matched-task evidence before claims. `semantic-checkpoint` likewise emits planning metadata only, writes no files or replacement context, and requires exact fallback/re-expand metadata, provenance review acknowledgement, provider-boundary acknowledgement, protected-zone denial, and missed-context notes before reporting readiness. The local proxy `record` command starts no listener and forwards no traffic; `serve local-proxy` binds and forwards only literal loopback IPs for one bounded request; `--response-sandbox` can replace a safe UTF-8 upstream body with a compact local artifact rehydration envelope. Compressor/model execution, OCR/crop services, external forwarding, credential persistence, runtime checkpoint replacement, and hosted-savings claims stay out of scope until a separate evidence gate and future PR allow them. |
|
|
84
84
|
| ContextGuard | Avoiding unnecessary files, logs, repeated failures, and noisy output before they enter agent context. | Local guardrails, reversible artifacts, and measurement. |
|
|
85
85
|
|
|
86
86
|
Related patterns that informed the design:
|
|
@@ -97,6 +97,44 @@ Brief mode is a set of agent-neutral, advisory rule snippets that ask a coding a
|
|
|
97
97
|
|
|
98
98
|
Three deterministic levels ship under [`plugins/context-guard/brief/`](plugins/context-guard/brief/): `lite`, `standard`, and `ultra`. Each level is a single marker-delimited block for an agent's rule/instruction file (for example `AGENTS.md`, `CLAUDE.md`, a Cursor rules file, or Copilot instructions). Manage it through setup with `context-guard setup --agent codex --scope project --brief-mode standard --plan`, rerun with `--yes` to apply, and use `--brief-mode off` to remove the managed block. See [`plugins/context-guard/brief/README.md`](plugins/context-guard/brief/README.md).
|
|
99
99
|
|
|
100
|
+
### Standing cost and break-even
|
|
101
|
+
|
|
102
|
+
Advisory rule blocks are not free. They live in an agent's rule file, so they are
|
|
103
|
+
re-sent with every request for as long as they are installed:
|
|
104
|
+
|
|
105
|
+
| Managed block | Installed size |
|
|
106
|
+
| --- | --- |
|
|
107
|
+
| `brief-mode.lite` | 1,487 bytes |
|
|
108
|
+
| `brief-mode.standard` | 1,568 bytes |
|
|
109
|
+
| `brief-mode.ultra` | 1,523 bytes |
|
|
110
|
+
| `narration-mode.quiet` | 866 bytes |
|
|
111
|
+
|
|
112
|
+
That is a fixed per-request cost paid up front, while the benefit is a
|
|
113
|
+
probabilistic reduction in reply length that ContextGuard cannot enforce. On a
|
|
114
|
+
session with few turns, or with an agent that already answers tersely, the block
|
|
115
|
+
can cost more than it saves. The hook-based guardrails behave differently: they
|
|
116
|
+
charge only when they act, and the measured worst cases stay small — a
|
|
117
|
+
sub-threshold `Read` adds 3 bytes, and repeated large-read attempts shrink after
|
|
118
|
+
the first warning instead of accumulating.
|
|
119
|
+
|
|
120
|
+
Before installing a rule block for its token effect, measure it. Use
|
|
121
|
+
`context-guard-bench` on matched tasks with and without the block, and treat the
|
|
122
|
+
block's installed size as the break-even threshold your reply-length reduction has
|
|
123
|
+
to clear. Byte counts here are observed; token effects are not, and no fixed
|
|
124
|
+
saving is claimed.
|
|
125
|
+
|
|
126
|
+
## Quiet narration for Claude (advisory)
|
|
127
|
+
|
|
128
|
+
Quiet narration is a separate, default-off Claude-only rule for reducing discretionary preambles, per-tool narration, filler, and repeated interim summaries. It still requires approvals and decisions, blockers, failures, destructive or security warnings, higher-priority progress updates, the final result, changed files, and verification. It is best-effort guidance, independent of final-answer brevity or reasoning depth, and does **not** guarantee token or cost savings.
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
context-guard setup --rules-only --agent claude --scope project --narration-mode quiet --plan
|
|
132
|
+
context-guard setup --rules-only --agent claude --scope project --narration-mode quiet --yes
|
|
133
|
+
context-guard setup --rules-only --agent claude --scope project --narration-mode default --yes
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
This isolated operation manages only ContextGuard's narration span in the project's `CLAUDE.md`. It does not read or change Claude settings, hooks, permissions, statusline, model defaults, or other agents' rule files. It cannot be combined with brief mode, initialization, skill generation, or normal setup actions. Gate C verifies the static rule and setup side effects only; it does not prove model compliance or authorize a numeric savings claim.
|
|
137
|
+
|
|
100
138
|
## What to measure
|
|
101
139
|
|
|
102
140
|
If you need a savings claim, measure it on your own tasks:
|
|
@@ -247,6 +285,19 @@ The structural-waste doctor is opt-in and read-only. It reuses the diet scanner'
|
|
|
247
285
|
|
|
248
286
|
The optional Read guard uses a progressive path for oversized files: search first, then symbol slices, then small line ranges. When possible, it also returns a bounded top-level outline. Repeated attempts to full-read the same oversized file get a deduplicated warning instead of repeating the same context-heavy path.
|
|
249
287
|
|
|
288
|
+
Its enforcement surface is deliberately limited to the installed Claude Code `PreToolUse` hook whose matcher is `Read`:
|
|
289
|
+
|
|
290
|
+
When that Read guard is selected, setup removes only the exact legacy deny values `Read(./.env)` and `Read(./.env.*)`; similar permission entries and their relative order are preserved.
|
|
291
|
+
|
|
292
|
+
| Claude tool | Covered behavior |
|
|
293
|
+
| --- | --- |
|
|
294
|
+
| `Read` | The hook checks bounded large-file ranges and denies a basename beginning with `.env`, except the exact template names `.env.example`, `.env.sample`, and `.env.template`. Nested paths are included; ambiguous symlink paths fail closed. |
|
|
295
|
+
| `Glob` | May list matching names. It does not read file contents through this `Read` hook. |
|
|
296
|
+
| `Grep` | Out of scope for this hook and may read matching file contents. |
|
|
297
|
+
| `Bash` | Out of scope for this hook and may read file contents. |
|
|
298
|
+
|
|
299
|
+
This is Claude `Read` protection, not universal `.env` or Bash protection. The hook proves the file state it opens without following symlinks and revalidates that same descriptor, but Claude performs the actual `Read` with a later open after the hook returns. A replacement in that post-hook window is a documented TOCTOU limitation.
|
|
300
|
+
|
|
250
301
|
### Store and query large logs locally
|
|
251
302
|
|
|
252
303
|
```bash
|
|
@@ -274,6 +325,10 @@ Artifact mode is for capture, sandbox search, and retrieval. It stores sanitized
|
|
|
274
325
|
--manifest-out suggested-pack.json --budget-bytes 12000 --json --adaptive-k --adaptive-k-policy recall
|
|
275
326
|
./plugins/context-guard/bin/context-guard-pack build \
|
|
276
327
|
--root . --manifest suggested-pack.json --budget-bytes 12000 --json
|
|
328
|
+
# Optional diagnostic comparison against one exact private local receipt:
|
|
329
|
+
./plugins/context-guard/bin/context-guard-pack build \
|
|
330
|
+
--root . --manifest suggested-pack.json --budget-bytes 12000 --json --no-artifact \
|
|
331
|
+
--delta-from-pack-id 0123456789abcdef0123
|
|
277
332
|
./plugins/context-guard/bin/context-guard-pack slice --root . --path README.md --lines 1:40 --json
|
|
278
333
|
```
|
|
279
334
|
|
|
@@ -289,6 +344,8 @@ A few boundaries are intentional:
|
|
|
289
344
|
- `--manifest-out` writes a build-compatible manifest; `--pack-out` saves the rendered pack.
|
|
290
345
|
- `context-guard-pack suggest` is the lower-level additive local-only planning step. It ranks candidate files and line ranges from `--query`, `--diff`, repeated `--files`, and optional sanitized `--output` / `--test-output` files under `--root`, then writes a manifest that `build --manifest` can consume.
|
|
291
346
|
- `context-guard-pack build` assembles prioritized local file evidence into a Markdown body whose rendered UTF-8 bytes stay within `--budget-bytes`. JSON output records included, partial, duplicate, unsafe, missing, and budget-omitted sources.
|
|
347
|
+
- Every build reports a `content_address` (`sha256:<digest>`) of the exact rendered pack bytes while retaining the legacy `pack_id`. On `build` or `auto`, opt-in `--delta-from-pack-id PACK_ID` reads only `.context-guard/packs/PACK_ID.json` and reports bounded, fail-soft `rolling_delta` diagnostics. It never changes selection, the pack body, `pack_id`, or default behavior, and it is not a provider token/cost savings claim. Diagnostics are reported only in `--json` output or a stored artifact receipt; when `--no-artifact` is used, `--json` is required to report them, while legacy text stdout remains the exact pack body.
|
|
348
|
+
- Opt-in `build`/`auto --sketch-duplicate-veto` performs a rank-stable, pre-budget duplicate gate over already-sanitized slices; `suggest` is unchanged. It byte-confirms exact SHA-256 matches, then uses an honestly labeled sketch-set Jaccard heuristic: Unicode-casefolded ordered five-token shingles, frozen length framing, bottom 64 unique digests, minimum cardinality 12 on both sides, and an inclusive 0.90 threshold. Short sketches remain exact-only. After 100,000 verified eligible pairs, the first actually skipped pair fails open and disables later sketch work while exact digest/byte confirmation continues. Use the omitted source's own exact retrieval before editing or relying on evidence: a higher-ranked winner may not fit the final byte budget. JSON/receipts expose only `sketch_duplicate_veto.comparison_cap_reached` on the standalone build result (or `auto.build`), omission rows use `sketch_duplicate_source`, and flagged text summaries always append `sketch_comparison_cap_reached=true|false` even if artifact storage fails. No fingerprints, match identity, overlap, score, provider token, or cost-savings claim is emitted; without the flag, outputs and selection remain compatible.
|
|
292
349
|
- Bounded receipts are stored under `.context-guard/packs`. When path/root display is safe, JSON output includes copy-pasteable `slice` commands for exact sanitized retrieval; otherwise it records `retrieval_omitted_reason`.
|
|
293
350
|
|
|
294
351
|
The packer uses deterministic standard-library heuristics only: no network, model calls, embeddings, or provider-cost estimate. Byte counts are observed; token counts remain estimated `chars_div_4` proxies, not measured provider-token savings.
|
|
@@ -348,7 +405,7 @@ Add `--mode readable` only for sanitized prose previews. It uses a deterministic
|
|
|
348
405
|
./plugins/context-guard/bin/context-guard-trim-output --max-lines 120 -- npm test
|
|
349
406
|
```
|
|
350
407
|
|
|
351
|
-
Use `--digest markdown` or `--digest json` for a compact semantic digest instead of head/tail logs. Digest mode keeps status, exit code, truncation counts, runner failure facts, a sanitized failure signature, duplicate-line groups, representative lines, redaction counts, and suggested next queries while preserving the wrapped command exit code. Add `--artifact-receipt` with digest mode when you want the exact sanitized full output stored locally as a `context-guard-artifact` receipt; keep the emitted `contextguard-artifact:<id>` handle in agent context and re-expand with the emitted `context-guard-artifact receipt/get/search ...` commands before relying on omitted details. Wrapped commands time out after 600 seconds by default; tune this with `--timeout-seconds`.
|
|
408
|
+
Use `--digest markdown` or `--digest json` for a compact semantic digest instead of head/tail logs. When a command succeeds and its output is already smaller than the digest would be, the output is passed through with a one-line marker instead, so enabling digest mode on quiet commands cannot inflate context. A failing command always keeps the digest, because that is where the exit code and failure signature live; pass `--digest-always` to keep the structured digest in every case. Digest mode keeps status, exit code, truncation counts, runner failure facts, a sanitized failure signature, duplicate-line groups, representative lines, redaction counts, and suggested next queries while preserving the wrapped command exit code. Add `--artifact-receipt` with digest mode when you want the exact sanitized full output stored locally as a `context-guard-artifact` receipt; keep the emitted `contextguard-artifact:<id>` handle in agent context and re-expand with the emitted `context-guard-artifact receipt/get/search ...` commands before relying on omitted details. Wrapped commands time out after 600 seconds by default; tune this with `--timeout-seconds`.
|
|
352
409
|
|
|
353
410
|
### Sanitize search and diff output
|
|
354
411
|
|
|
@@ -414,6 +471,11 @@ These fields can flag likely volatile content near the prompt prefix, stable-pre
|
|
|
414
471
|
--dashboard-md bench/dashboard.md
|
|
415
472
|
```
|
|
416
473
|
|
|
474
|
+
Each task fixture may set `output_format` to `json` (the default) or opt in to
|
|
475
|
+
`stream-json`. Stream mode adds the runner-controlled `--verbose` flag and only
|
|
476
|
+
accepts a bounded NDJSON stream whose final event is a valid terminal result.
|
|
477
|
+
Its client-reported cost remains diagnostic and is not authoritative provider billing.
|
|
478
|
+
|
|
417
479
|
For deterministic local replay before a live provider run, add `--evidence-jsonl docs/benchmark-fixtures/token-savings-12task.evidence.example.jsonl` and, for the 12-task fixture, `--baseline-variant baseline_full_context_fixture`. Replay mode skips provider and `success_command` execution, writes the same CSV/report/dashboard surfaces, and marks synthetic/manual evidence as non-public-claim-eligible.
|
|
418
480
|
|
|
419
481
|
Read the report through its claim boundaries before writing any savings statement:
|
|
@@ -443,6 +505,8 @@ context-guard experiments plan visual-crop-ocr --json --full-evidence-receipt <i
|
|
|
443
505
|
context-guard experiments emit visual-crop-ocr --json --full-evidence-receipt <id> --crop-label <label> --crop-bounds 0,0,100,100 --image-size 800,600 --ocr-text "visible text" --ocr-confidence 0.9 --ocr-error-note "glyph may be uncertain" --missed-context-note "outside crop omitted"
|
|
444
506
|
context-guard experiments plan image-context-pack --json --exact-text-fallback-receipt <id> --reexpand-command "context-guard-artifact get <id> --full" --provider-boundary-ack --protected-zone-policy deny --missed-context-note "omitted text remains retrievable before any future image pack is used" --image-size 800,600 --packed-image-size 400,300
|
|
445
507
|
context-guard experiments plan semantic-checkpoint --json --goal "preserve current task state for review" --constraint "do not rewrite protected evidence" --decision "ship plan-only semantic-checkpoint gate first" --open-task "verify exact fallback before any checkpoint is used" --evidence-handle "roadmap=contextguard-artifact:0123456789abcdef" --missing-provenance-note "none known after review" --unresolved-question "which provenance handle fields become mandatory later" --exact-context-fallback-receipt 0123456789abcdef --reexpand-command "context-guard-artifact get 0123456789abcdef --full" --provider-boundary-ack --protected-zone-policy deny --missed-context-note "raw transcript remains retrievable before checkpoint metadata is used"
|
|
508
|
+
context-guard experiments plan proof-carrying-context --json --proof-unit-json '{"source_label":"context-filesystem-roadmap","receipt_id":"0123456789abcdef","content_sha256":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","safe_range":{"kind":"lines","start":82,"end":85},"captured_at":"2026-07-10T04:11:12Z","transform_policy":"safe_range_extract","rehydrate_command":"context-guard-artifact get 0123456789abcdef --full"}' --provider-boundary-ack --protected-zone-policy deny
|
|
509
|
+
context-guard experiments verify proof-carrying-context --artifact-dir ./artifacts --proof-unit-json '{"source_label":"context-filesystem-roadmap","receipt_id":"0123456789abcdef","content_sha256":"12637068ee51f2ddfe27f1c00836a51cb54ba6a5cfca7f2301a4a45fbade2d14","safe_range":{"kind":"lines","start":1,"end":1},"captured_at":"2026-07-10T04:11:12Z","transform_policy":"safe_range_extract","rehydrate_command":"context-guard-artifact get 0123456789abcdef --full"}' --json
|
|
446
510
|
context-guard experiments plan learned-compression --json --sanitized --trusted-source --exact-fallback-receipt <id> --reexpand-command "context-guard-artifact get <id> --full" < sanitized-prose.txt
|
|
447
511
|
context-guard experiments emit learned-compression --json --sanitized --trusted-source --exact-fallback-receipt <id> --reexpand-command "context-guard-artifact get <id> --full" --replacement-file compact-prose.txt < sanitized-prose.txt
|
|
448
512
|
context-guard experiments plan self-hosted-metrics-ledger --json --latency-ms 123.5 --peak-memory-mb 2048 --quality-score 0.98
|
|
@@ -459,6 +523,10 @@ context-guard experiments disable output-receipt-trim --root .
|
|
|
459
523
|
|
|
460
524
|
`plan semantic-checkpoint` is also plan-only/eval-only. Its CLI flags are optional so incomplete plans can produce reviewer JSON, but missing readiness fields block the JSON payload until exact context fallback is present. Ready plans require a goal, exact fallback receipt, a local re-expand command shaped as `context-guard-artifact get <id> --full` or `context-guard artifact get <id> --full`, provider-boundary acknowledgement, protected-zone policy `deny`, missed-context notes, and provenance review notes. `--missing-provenance-note` may be a review acknowledgement such as `none known after review`. The gate has no `emit`, `record`, or `serve` runtime, no `context-guard-semantic-checkpoint` binary, no file writes, transcript or prompt edits, model/provider/network calls, replacement context, or hosted token/cost savings claim.
|
|
461
525
|
|
|
526
|
+
`plan proof-carrying-context` is a default-off plan-only proof-envelope metadata readiness gate. It accepts bounded repeatable inline JSON, validates syntax and defined consistency only, and keeps the caller-supplied timestamp without generating or comparing current time. Protected-zone policy is declared-only; range bounds, receipt storage, source content, SHA-256, timestamp freshness, and rehydration remain unchecked and are reported as warnings. The command reads no source/artifact/config/stdin content, writes no files, calls no model/provider/network/subprocess, generates or replaces no context (`candidate_replacement` stays `null`), exposes no `emit`/`record`/`serve` runtime or new binary, and permits no hosted token/cost savings claim without provider-measured matched successful tasks.
|
|
527
|
+
|
|
528
|
+
`verify proof-carrying-context` is the separate read-only local verifier. The documented fixture is the exact UTF-8 string `ContextGuard proof fixture\n` (27 bytes, one line), whose SHA-256 is `12637068ee51f2ddfe27f1c00836a51cb54ba6a5cfca7f2301a4a45fbade2d14`. Verification requires one explicit artifact directory, searches no fallback, follows no symlink, requires the directory to be owned by the effective user with mode `0700` and both receipt leaves with mode `0600`, and reads the whole bounded file only to verify receipt/proof hashes, byte/line counts, and range bounds; it never retrieves or echoes range content. Exit `0` means only those local bindings passed; exit `2` means verification failed. Timestamp freshness and protected-zone semantics remain unchecked, rehydrate commands are syntax/receipt checked but never executed, `candidate_replacement` remains `null`, and no replacement, omission, or hosted-savings claim is authorized.
|
|
529
|
+
|
|
462
530
|
The local-proxy examples are intentionally split by side effect:
|
|
463
531
|
|
|
464
532
|
- `plan local-proxy` produces advisory metadata only; it does not enable forwarding.
|
|
@@ -477,6 +545,7 @@ Shipped experimental checker/planner surfaces, plus explicit local context-diff,
|
|
|
477
545
|
| `visual-crop-ocr` | Dry-run visual evidence advice plus an explicit `emit visual-crop-ocr` runtime for caller-supplied evidence packs. | `emit` requires a full visual evidence receipt, missed-context note, and complete user-supplied crop and/or OCR evidence; ContextGuard does not capture screenshots, crop images, run OCR, parse images, call external services, write files, or support hosted token/cost savings claims. |
|
|
478
546
|
| `image-context-pack` | Pxpipe-inspired dry-run plan metadata only for future image/context packing evaluation. | `plan` emits no image, replacement, evidence pack, binary artifact, ledger, listener, or proxy. It requires exact text fallback receipt/re-expand metadata before omitted text is used, protected-zone denial, missed-context notes, and an explicit provider boundary acknowledgement for provider/model measured matched-task evidence. `visual-crop-ocr` remains the caller-supplied visual evidence-pack surface; `image-context-pack` is not a duplicate emitter or verified exact binary/image fallback. |
|
|
479
547
|
| `semantic-checkpoint` | Plan-only/eval-only checkpoint readiness metadata for preserving task state during review. | `plan` emits deterministic JSON metadata only. CLI flags are optional, but readiness is blocked in JSON until exact context fallback, local re-expand metadata, provider-boundary acknowledgement, protected-zone denial, missed-context note, and provenance review note are present. `--missing-provenance-note` may be a review acknowledgement such as `none known after review`. It writes no files, edits no transcript or prompt, calls no model/provider/network, emits no replacement context, has no `emit`/`record`/`serve` runtime or new binary, and makes no hosted token/cost savings claim. |
|
|
548
|
+
| `proof-carrying-context` | Plan-only metadata readiness plus explicit read-only local receipt verification. | `plan` accepts at most 64 detailed inline JSON units without reading content. `verify` checks only one explicit private no-follow directory, strict receipt metadata, bounded whole-content bindings, range bounds, and command syntax without retrieving ranges or executing commands. Both keep `candidate_replacement: null`; neither grants replacement, omission, protected-zone, freshness, semantic-safety, or hosted-savings authority. |
|
|
480
549
|
| `learned-compression` | Deny-by-default policy checks plus an explicit `emit learned-compression` runtime for caller-supplied compact prose candidates with verified exact fallback content. | `emit` requires sanitized trusted prose, protected-signal denial, a verified local fallback artifact matching the input, and a smaller caller-supplied prose candidate; ContextGuard does not run compressors, embeddings, rerankers, model calls, subprocesses, external services, generated replacement text, or hosted savings claims. |
|
|
481
550
|
| `self-hosted-metrics-ledger` | Dry-run preview plus an explicit `record ... --ledger-jsonl` runtime for local/model-server latency, memory, quality, energy, throughput, and local-cost metrics. | The dry-run preview does not write a ledger; the explicit record command writes only local JSONL sidecars and still does not support hosted API token/cost savings claims. |
|
|
482
551
|
| `local-proxy` | Localhost-only advisory metadata, design-only `plan local-proxy-external-forwarding` review for future external forwarding, an explicit `record local-proxy-runtime-gate --ledger-jsonl` runtime for one local gate row, an explicit one-shot `serve local-proxy` loopback forwarding MVP, optional `--response-sandbox` compact artifact envelopes, and optional `--diagnostic-ledger-jsonl` shifted-cost diagnostics for successful forwarded requests. | `plan` writes no ledger. `record` writes only after localhost-only metadata and `--runtime-gate-ack`; it starts no listener, forwards no traffic, and performs no DNS lookup. `serve` additionally requires `--forwarding-gate-ack --once`, a private `--ready-file` nonce handoff, literal loopback bind/target IPs, nonzero ports, bounded bytes/timeouts, and credential-free requests; it performs no external forwarding, no CONNECT/TLS proxying, no API-key persistence, and no hosted-savings claim. `--response-sandbox` can store safe UTF-8 response text as a sanitized local artifact receipt and return a compact envelope with redacted rehydration command templates; it does not claim hosted token/cost savings. `--diagnostic-ledger-jsonl` writes only successful-forward diagnostics with no raw headers/bodies and no hosted-savings claim. `plan local-proxy-external-forwarding` emits threat-model/allowlist/redaction/provider-evidence design metadata only and still performs no DNS lookup, external service call, traffic forwarding, credential persistence, or hosted-savings claim. |
|
|
@@ -536,6 +605,10 @@ context-guard-setup --plan
|
|
|
536
605
|
|
|
537
606
|
Do not rely on `PATH` lookup for generated hooks by default. The setup wizard records explicit bundled or checkout-local helper paths; `--allow-path-helper-fallback` is only for trusted external installs and validates the resolved helper path, symlink state, and bounded identity probe before writing commands. The macOS app helper follows the same trust model: no launch-CWD discovery, no relative override paths, and no inherited ambient shell environment beyond the allowlisted values it needs to start.
|
|
538
607
|
|
|
608
|
+
## Local MCP adapter
|
|
609
|
+
|
|
610
|
+
`context-guard mcp` (or `context-guard-mcp`) is a dependency-free local stdio MCP server. Each process is fixed to one root and one namespace; it exposes only compression, sanitized artifact retrieval, and local statistics. It has no HTTP, SSE, network, provider, model, proxy, or automatic client-configuration surface. Stored fallback content is an exact sanitized copy, not raw input, and artifacts from another namespace are not retrievable. This local adapter makes no hosted token or cost-savings claim.
|
|
611
|
+
|
|
539
612
|
## Release checks
|
|
540
613
|
|
|
541
614
|
Before publishing or merging release-sensitive changes, run the copy check and both gates:
|
|
@@ -550,6 +623,16 @@ When a helper under `context-guard-kit/` changes, run `python3 scripts/sync_plug
|
|
|
550
623
|
|
|
551
624
|
Versioned release notes live in [CHANGELOG.md](CHANGELOG.md); the prepublish gate requires an entry matching the plugin manifest version before publishing.
|
|
552
625
|
|
|
626
|
+
### Experimental semantic-GC plan gate
|
|
627
|
+
|
|
628
|
+
`semantic-gc` is a default-off, deny-only, plan-review gate over a caller-declared graph. Default-off describes registry intent; the explicit plan CLI remains invocable and never enables omission or runtime action. Graph evaluation is suppressed when the complete envelope or topology is ambiguous. Unreachable nodes are review candidates, not proof of semantic irrelevance: omission and runtime action remain unauthorized. Candidate missed-context notes are untrusted. The planner does not read context/artifact content or verify provenance, fallback, providers, or hosted savings. Exit 0 means only `ready_for_plan_review`; it is never delete/omit authority.
|
|
629
|
+
|
|
630
|
+
context-guard experiments plan semantic-gc --json --context-unit-json '{"schema":"contextguard.semantic-gc-unit.v1","unit_id":"root","references":[],"is_root":true,"protected_zone":false}' --context-unit-json '{"schema":"contextguard.semantic-gc-unit.v1","unit_id":"orphan","references":[],"is_root":false,"protected_zone":false,"content_sha256":"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb","provenance":{"source_label":"canonical-example","receipt_id":"0123456789abcdef"},"missed_context_note":"A reviewer could lose the orphaned rationale.","exact_fallback_command":"context-guard-artifact get 0123456789abcdef --full"}' --provider-boundary-ack --human-review-ack --protected-zone-policy deny
|
|
631
|
+
|
|
632
|
+
`static-relevance` is a default-off compiler for bounded caller-supplied static evidence. Missing signals suppress all slices and review ordering; accepted empty edge lists are declarations, not verified observations. Built-in protected-path matches and explicit protected reasons are hard retention vetoes that move evidence first for human review only. This plan-review-only command does not scan or read any repository, does not invoke git, and does not invoke a parser, provider, network, or subprocess. Its deterministic review order does not authorize omission, deletion, deprioritization, replacement, or runtime action.
|
|
633
|
+
|
|
634
|
+
context-guard experiments plan static-relevance --json --relevance-unit-json '{"schema":"contextguard.static-relevance-unit.v1","unit_id":"src/cli.py::main","path":"src/cli.py","task_anchor":true,"protection_reasons":[],"symbol":{"name":"main","kind":"function","start_line":1,"end_line":40},"symbol_references":[],"dataflow_predecessors":[],"dataflow_successors":[],"git":{"blame_age_days":2,"blame_contributor_count":1,"path_change_count_90d":3}}' --protected-path-policy deny --provider-boundary-ack
|
|
635
|
+
|
|
553
636
|
## License
|
|
554
637
|
|
|
555
638
|
Copyright 2026 jinhongan. Licensed under the Apache License 2.0. See [LICENSE](LICENSE) and [NOTICE](NOTICE).
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Full sanitized textual evidence
|
|
2
|
+
|
|
3
|
+
Fixture-only baseline for one matched image-context-pack review task. The evidence below is caller-supplied sanitized text. It contains no image asset, image URL, binary payload, private path, or external service address.
|
|
4
|
+
|
|
5
|
+
Evidence:
|
|
6
|
+
- Review target: synthetic staging card `candidate-17`.
|
|
7
|
+
- Qualifying context: staging requires both the owner acknowledgement and the complete check result `all checks passed`.
|
|
8
|
+
- Owner acknowledgement: present.
|
|
9
|
+
- Complete check result: `all checks passed`.
|
|
10
|
+
- Decision: the sanitized evidence qualifies the card for plan review only.
|
|
11
|
+
- Missed context: none in this baseline.
|
|
12
|
+
- Full-text fallback: this entire narrative is declared available, but exact retrieval is not executed and therefore `verified=false`.
|
|
13
|
+
|
|
14
|
+
Boundaries:
|
|
15
|
+
- plan-only
|
|
16
|
+
- protected-zone deny
|
|
17
|
+
- no replacement
|
|
18
|
+
- no runtime
|
|
19
|
+
- no hosted claim
|
|
20
|
+
- no renderer call
|
|
21
|
+
- no OCR call
|
|
22
|
+
- no image-parser call
|
|
23
|
+
- no provider call
|
|
24
|
+
- no model call
|
|
25
|
+
- no network call
|
|
26
|
+
- no subprocess call
|
|
27
|
+
|
|
28
|
+
Byte counts in the companion row are sanitized textual UTF-8 byte proxies, never image bytes or provider tokens. The fixture does not establish token savings, cost savings, or quality non-inferiority.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Packed sanitized textual evidence
|
|
2
|
+
|
|
3
|
+
Fixture-only variant for the same matched image-context-pack review task. The evidence below is caller-supplied sanitized text. It contains no image asset, image URL, binary payload, private path, or external service address.
|
|
4
|
+
|
|
5
|
+
Initial packed evidence:
|
|
6
|
+
- Review target: synthetic staging card `candidate-17`.
|
|
7
|
+
- Complete check result: `all checks passed`.
|
|
8
|
+
- Omitted qualifying context at first: the owner acknowledgement requirement and its value were absent from the initial pack.
|
|
9
|
+
- Initial decision: insufficient because the qualifying context was incomplete.
|
|
10
|
+
|
|
11
|
+
Synthetic human correction:
|
|
12
|
+
- One synthetic human correction states that staging also requires the owner acknowledgement and that it is present.
|
|
13
|
+
- After that correction, the same sanitized decision can be completed successfully.
|
|
14
|
+
- Missed context remains recorded rather than pretending the initial evidence was complete.
|
|
15
|
+
- Full-text fallback: the baseline narrative is declared available for review, but exact retrieval is not executed and therefore `verified=false`.
|
|
16
|
+
|
|
17
|
+
Boundaries:
|
|
18
|
+
- plan-only
|
|
19
|
+
- protected-zone deny
|
|
20
|
+
- no replacement
|
|
21
|
+
- no runtime
|
|
22
|
+
- no hosted claim
|
|
23
|
+
- no renderer call
|
|
24
|
+
- no OCR call
|
|
25
|
+
- no image-parser call
|
|
26
|
+
- no provider call
|
|
27
|
+
- no model call
|
|
28
|
+
- no network call
|
|
29
|
+
- no subprocess call
|
|
30
|
+
|
|
31
|
+
The companion row's artifact count is a synthetic declaration only with no artifact read. Byte counts are sanitized textual UTF-8 byte proxies, never image bytes or provider tokens. Success after one correction does not establish token savings, cost savings, or quality non-inferiority.
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
{"artifacts_used": 0, "byte_metrics": {"image_bytes": false, "provider_tokens": false, "proxy_only": true, "source": "sanitized_textual_fixture", "unit": "utf8_bytes"}, "bytes_after": 1204, "bytes_before": 1204, "claim_boundary": {"hosted_api_cost_savings_claim_allowed": false, "hosted_api_token_savings_claim_allowed": false, "quality_non_inferiority_claim_allowed": false, "reason": "synthetic_fixture_only_no_provider_measurement"}, "corrections": 0, "cost_measured": false, "cost_usd": 0, "effort": "medium", "evaluation_controls": {"control_provenance": {"review_source": "synthetic_fixture", "verifier_label": "none"}, "exact_text_fallback": {"available": true, "content_sha256": "none", "receipt_id": "none", "retrieval_command": "none", "verified": false, "verifier_projection": null}, "human_correction": {"count": 0, "reason": "none"}, "missed_context_review": {"correction_required": false, "present": false, "review_completed": true, "summary": "none"}, "prompt_evidence": {"sha256": "f31750bb4885e23b1bef9035ee97710bdca0e41856845751223379fead1ee92b", "source_label": "image-context-pack-full-evidence.prompt.example.md"}, "protected_zone_review": {"included_prompt_like_regions": 0, "included_protected_regions": 0, "policy": "deny", "review_completed": true, "review_note": "synthetic fixture review; deny policy declared and no protected or prompt-like region included", "reviewer_label": "synthetic_fixture_reviewer"}, "provider_usage": {"primary_cost_measured": false, "primary_tokens_measured": false, "provider_called": false}, "shifted_cost": {"external_cost_measured": false, "external_tokens_measured": false, "status": "unmeasured"}, "source_omission": {"present": false, "transform": "none"}}, "evaluation_profile": "contextguard.bench.image-context-pack-evaluation.v1", "external_cost_measured": false, "external_cost_usd": 0, "external_tokens": 0, "external_tokens_measured": false, "hook_triggers": 0, "human_correction": {"count": 0, "performed": false, "reason": "none", "source": "synthetic_fixture"}, "missed_context": {"exact_text_fallback_available": true, "exact_text_fallback_verified": false, "human_correction_required": false, "present": false, "summary": "none"}, "model": "fixture-only", "notes": "synthetic full sanitized textual evidence baseline; fallback narrative declared but unverified; no provider call and no public claim", "primary_tokens_measured": false, "provenance": {"capture_command_or_export_id": "docs/benchmark-fixtures/image-context-pack.evidence.example.jsonl", "claim_scope": "local_replay_fixture_not_public_claim", "evidence_source_type": "synthetic_fixture"}, "provider_cached_tokens": 0, "provider_cached_tokens_measured": false, "provider_usage": {"primary_cost_measured": false, "primary_tokens_measured": false, "provider_cached_tokens_measured": false, "provider_called": false, "source": "synthetic_fixture"}, "schema_version": "contextguard.bench.run-evidence.v1", "shifted_cost": {"claim_allowed": false, "external_cost_measured": false, "external_tokens_measured": false, "status": "unmeasured"}, "success": true, "task_id": "image_context_pack_matched_correction_fixture", "tokens": {"cache_creation": 0, "cache_read": 0, "input_tokens": 0, "output_tokens": 0}, "turns": 0, "variant": "baseline_full_evidence_fixture", "wall_time_seconds": 0}
|
|
2
|
+
{"artifacts_used": 1, "byte_metrics": {"image_bytes": false, "provider_tokens": false, "proxy_only": true, "source": "sanitized_textual_fixture", "unit": "utf8_bytes"}, "bytes_after": 1579, "bytes_before": 1204, "claim_boundary": {"hosted_api_cost_savings_claim_allowed": false, "hosted_api_token_savings_claim_allowed": false, "quality_non_inferiority_claim_allowed": false, "reason": "synthetic_fixture_only_no_provider_measurement"}, "corrections": 1, "cost_measured": false, "cost_usd": 0, "effort": "medium", "evaluation_controls": {"control_provenance": {"review_source": "synthetic_fixture", "verifier_label": "none"}, "exact_text_fallback": {"available": true, "content_sha256": "none", "receipt_id": "none", "retrieval_command": "none", "verified": false, "verifier_projection": null}, "human_correction": {"count": 1, "reason": "initial pack omitted the qualifying owner acknowledgement context and required full-text fallback review"}, "missed_context_review": {"correction_required": true, "present": true, "review_completed": true, "summary": "initial packed evidence omitted the qualifying owner acknowledgement requirement and value"}, "prompt_evidence": {"sha256": "a0a9394e0ee7195f448b15f58bd1dc68653da5a2a814f35396dd5cce01530d41", "source_label": "image-context-pack-packed-evidence.prompt.example.md"}, "protected_zone_review": {"included_prompt_like_regions": 0, "included_protected_regions": 0, "policy": "deny", "review_completed": true, "review_note": "synthetic fixture review; deny policy declared and no protected or prompt-like region included", "reviewer_label": "synthetic_fixture_reviewer"}, "provider_usage": {"primary_cost_measured": false, "primary_tokens_measured": false, "provider_called": false}, "shifted_cost": {"external_cost_measured": false, "external_tokens_measured": false, "status": "unmeasured"}, "source_omission": {"present": true, "transform": "packed_textual_summary"}}, "evaluation_profile": "contextguard.bench.image-context-pack-evaluation.v1", "external_cost_measured": false, "external_cost_usd": 0, "external_tokens": 0, "external_tokens_measured": false, "hook_triggers": 0, "human_correction": {"count": 1, "performed": true, "reason": "initial pack omitted the qualifying owner acknowledgement context and required full-text fallback review", "source": "synthetic_fixture"}, "missed_context": {"exact_text_fallback_available": true, "exact_text_fallback_verified": false, "human_correction_required": true, "present": true, "summary": "initial packed evidence omitted the qualifying owner acknowledgement requirement and value"}, "model": "fixture-only", "notes": "synthetic packed textual evidence omitted the owner acknowledgement and required one correction; artifact count is declaration only; no artifact read; full-text fallback narrative unverified; no provider call and no public claim", "primary_tokens_measured": false, "provenance": {"capture_command_or_export_id": "docs/benchmark-fixtures/image-context-pack.evidence.example.jsonl", "claim_scope": "local_replay_fixture_not_public_claim", "evidence_source_type": "synthetic_fixture"}, "provider_cached_tokens": 0, "provider_cached_tokens_measured": false, "provider_usage": {"primary_cost_measured": false, "primary_tokens_measured": false, "provider_cached_tokens_measured": false, "provider_called": false, "source": "synthetic_fixture"}, "schema_version": "contextguard.bench.run-evidence.v1", "shifted_cost": {"claim_allowed": false, "external_cost_measured": false, "external_tokens_measured": false, "status": "unmeasured"}, "success": true, "task_id": "image_context_pack_matched_correction_fixture", "tokens": {"cache_creation": 0, "cache_read": 0, "input_tokens": 0, "output_tokens": 0}, "turns": 0, "variant": "fixture_only_image_context_pack", "wall_time_seconds": 0}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": "image_context_pack_matched_correction_fixture",
|
|
4
|
+
"prompt": "Fixture-only synthetic image-context-pack matched task. Compare caller-supplied sanitized textual evidence for one review decision. This is plan-only scaffolding with protected-zone deny, exact full-text fallback narrative, missed-context review, and no hosted claim. It ships no replacement or runtime and performs no renderer, OCR, image-parser, provider, model, network, or subprocess call.",
|
|
5
|
+
"model": "sonnet",
|
|
6
|
+
"effort": "medium",
|
|
7
|
+
"max_turns": 3,
|
|
8
|
+
"max_budget_usd": 1.0,
|
|
9
|
+
"allowed_tools": [],
|
|
10
|
+
"success_command": "python3 -c \"raise SystemExit('fixture-only placeholder: replace success_command before real benchmark runs')\"",
|
|
11
|
+
"success_cwd": ".",
|
|
12
|
+
"variant_prompt_files": {
|
|
13
|
+
"baseline_full_evidence_fixture": "image-context-pack-full-evidence.prompt.example.md",
|
|
14
|
+
"fixture_only_image_context_pack": "image-context-pack-packed-evidence.prompt.example.md"
|
|
15
|
+
},
|
|
16
|
+
"evaluation_profile": "contextguard.bench.image-context-pack-evaluation.v1"
|
|
17
|
+
}
|
|
18
|
+
]
|
|
@@ -28,12 +28,28 @@ Use them to decide what evidence a workflow has and what it does **not** prove:
|
|
|
28
28
|
5. Keep self-hosted local/model-server latency, memory, and quality metrics in the run-evidence ledger sidecar; do not fold them into hosted API token/cost savings claims unless provider-measured matched-task evidence separately supports that claim.
|
|
29
29
|
6. For deterministic local replay, add `--evidence-jsonl ... --dashboard-md ...`. Synthetic/manual replay evidence regenerates CSV/report/dashboard artifacts, but the report is marked `replay_only_not_public_claim` or `unknown_mixed_csv` unless every report row has complete provider-export provenance. Public hosted savings claims must additionally have `public_claim_readiness.claim_allowed=true`, which requires matched successful tasks, provider-measured token/cost, quality non-inferiority, shifted-cost accounting, explicit confidence/failure notes, and complete provider-export provenance.
|
|
30
30
|
|
|
31
|
+
## Reading a profiled image-context report
|
|
32
|
+
|
|
33
|
+
If a task opts into `evaluation_profile: "contextguard.bench.image-context-pack-evaluation.v1"`, the report gains an additive `evaluation_profiles.image_context_pack` block and the dashboard gains a compact "Image-context evaluation" section. Read them as review evidence, never as authority:
|
|
34
|
+
|
|
35
|
+
- `status` is either `blocked` or `ready_for_bounded_pilot_review`. There is no third, better value. `ready_for_bounded_pilot_review` means the imported evidence was complete and self-consistent enough for a bounded human pilot review — it is **not** promotion, runtime authority, quality proof, or a hosted API token/cost savings claim.
|
|
36
|
+
- `blocking_gate_ids` names what to fix. The lane emits exactly these stable IDs, in report/dashboard order: `profile_and_prompt_binding`, `protected_zone_deny_review`, `exact_text_fallback_binding`, `missed_context_review`, `human_correction_consistency`, `generic_matched_success_and_measurement`, and `evaluation_only_promotion_boundary`. Do not confuse this lane-scoped field with the top-level `public_claim_readiness.blocking_gate_ids`, which is a different set and is where `shifted_cost_accounting` appears.
|
|
37
|
+
- `evidence_levels` keeps modalities separate on purpose. `provider_measurement` (measured/unmeasured), `fallback_binding` (`imported_local_verifier_attestation`/missing/failed), `protected_zone` (review_attested/missing/failed), and `missed_context` (reviewed/missing) answer different questions; do not collapse them into one verdict. An `imported_local_verifier_attestation` proves local receipt/hash/command binding only — the runner does not authenticate who produced the record or reread the artifact.
|
|
38
|
+
- `sample_adequacy` reports matched counts with `policy_status: not_defined_for_promotion`. It never grants readiness, and no sample-size threshold is defined yet.
|
|
39
|
+
- Every public-authority field is clamped whenever a profile is present: `evaluation_only=true`, `promotion_authority=false`, `public_claim_allowed=false`, `public_claim_eligible=false`, `public_claim_readiness.claim_allowed=false`, profiled matched-pair claim flags false, and both `public_claim_status` and legacy `claim_status` set to `image_context_pack_evaluation_only_not_public_claim`. If you see a measured delta on a profiled report, it lives in `raw_metric_claim_status` and other explicitly metric-only fields; it is an observation, not a claim you may publish.
|
|
40
|
+
|
|
41
|
+
The profile validates only the evidence you import. Provider runs, images, credentials, and corpus selection remain operator-owned, and the runner performs no rendering, OCR, provider call, network access, proxying, automatic omission, or runtime replacement to produce this block.
|
|
42
|
+
|
|
31
43
|
## Safe wording
|
|
32
44
|
|
|
33
45
|
Use language like:
|
|
34
46
|
|
|
35
47
|
> In this matched successful task set, primary token telemetry was observed for both variants and the report shows `token_savings_pct` for the optimized variant. Byte reductions and provider-cache fields are diagnostic context, not independent savings proof.
|
|
36
48
|
|
|
49
|
+
For a profiled image-context report, use language like:
|
|
50
|
+
|
|
51
|
+
> This profiled replay reached `ready_for_bounded_pilot_review`: the imported prompt binding, fallback attestation, protected-zone review, and missed-context review were complete and self-consistent. That authorizes a bounded human pilot review only. It is not promotion, not runtime authority, not quality proof, and not a hosted API token/cost savings claim.
|
|
52
|
+
|
|
37
53
|
Avoid language like:
|
|
38
54
|
|
|
39
55
|
> ContextGuard guarantees this workflow will save tokens or cost.
|