@ictechgy/context-guard 0.4.14 → 0.4.15
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 +7 -0
- package/README.ko.md +26 -0
- package/README.md +27 -0
- 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 +25 -0
- package/plugins/context-guard/README.md +25 -0
- package/plugins/context-guard/bin/context-guard-bench +1305 -115
- package/plugins/context-guard/bin/context-guard-experiments +3080 -133
- package/plugins/context-guard/bin/context-guard-mcp +999 -0
- package/plugins/context-guard/bin/context-guard-pack +634 -9
- package/plugins/context-guard/lib/context_guard_commands.py +8 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,13 @@ All notable changes for the ContextGuard plugin are documented here.
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [0.4.15] - 2026-07-15
|
|
8
|
+
|
|
9
|
+
- 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.
|
|
10
|
+
- 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.
|
|
11
|
+
- 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.
|
|
12
|
+
- Expanded hostile-input, concurrency, source/package parity, release-smoke, and cross-platform regression coverage while preserving default-off, local-first, no-new-dependency behavior.
|
|
13
|
+
|
|
7
14
|
## [0.4.14] - 2026-07-10
|
|
8
15
|
|
|
9
16
|
- 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
|
@@ -261,6 +261,10 @@ long-command 2>&1 | ./plugins/context-guard/bin/context-guard-artifact store --c
|
|
|
261
261
|
--manifest-out suggested-pack.json --budget-bytes 12000 --json --adaptive-k --adaptive-k-policy recall
|
|
262
262
|
./plugins/context-guard/bin/context-guard-pack build \
|
|
263
263
|
--root . --manifest suggested-pack.json --budget-bytes 12000 --json
|
|
264
|
+
# 하나의 정확한 private local receipt와 선택적으로 진단 비교:
|
|
265
|
+
./plugins/context-guard/bin/context-guard-pack build \
|
|
266
|
+
--root . --manifest suggested-pack.json --budget-bytes 12000 --json --no-artifact \
|
|
267
|
+
--delta-from-pack-id 0123456789abcdef0123
|
|
264
268
|
./plugins/context-guard/bin/context-guard-pack slice --root . --path README.md --lines 1:40 --json
|
|
265
269
|
```
|
|
266
270
|
|
|
@@ -276,6 +280,8 @@ long-command 2>&1 | ./plugins/context-guard/bin/context-guard-artifact store --c
|
|
|
276
280
|
- `--manifest-out`은 `build`가 읽을 수 있는 manifest를 저장하고, `--pack-out`은 렌더링된 팩 본문을 저장합니다.
|
|
277
281
|
- `context-guard-pack suggest`는 더 낮은 수준의 로컬 전용 준비 단계입니다. `--query`, `--diff`, 반복 `--files`, 그리고 `--root` 아래의 선택적 `--output` / `--test-output` 텍스트 파일을 가림 처리한 신호에서 후보 파일과 줄 범위를 순위화한 뒤 `build --manifest`가 바로 읽을 수 있는 manifest를 씁니다.
|
|
278
282
|
- `context-guard-pack build`는 우선순위가 있는 로컬 파일 근거를 렌더링된 UTF-8 바이트 기준 `--budget-bytes` 안의 Markdown 팩으로 조립합니다. JSON 출력은 포함·부분 포함·중복·unsafe·missing·예산 초과로 누락된 source를 기록합니다.
|
|
283
|
+
- 모든 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 본문을 그대로 유지합니다.
|
|
284
|
+
- 선택적 `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
285
|
- 제한된 로컬 요약 기록은 `.context-guard/packs`에 저장됩니다. `path`와 `root`를 안전하게 표시할 수 있을 때만 정확한 가림 처리 slice 명령을 제공하고, 안전하지 않으면 팩 본문과 JSON 메타데이터에 `retrieval_omitted_reason`을 남깁니다.
|
|
280
286
|
|
|
281
287
|
표준 라이브러리 기반의 결정적 휴리스틱만 사용하며, 네트워크·모델 호출·임베딩·provider 비용 추정은 하지 않습니다. 바이트 수는 관측값이고, 토큰 수는 provider가 실제 측정한 토큰 절감값이 아니라 추정 `chars_div_4` proxy입니다.
|
|
@@ -396,6 +402,8 @@ context-guard experiments plan visual-crop-ocr --json --full-evidence-receipt <i
|
|
|
396
402
|
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
403
|
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
404
|
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"
|
|
405
|
+
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
|
|
406
|
+
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
407
|
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
408
|
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
409
|
context-guard experiments plan self-hosted-metrics-ledger --json --latency-ms 123.5 --peak-memory-mb 2048 --quality-score 0.98
|
|
@@ -410,6 +418,10 @@ context-guard experiments disable output-receipt-trim --root .
|
|
|
410
418
|
|
|
411
419
|
`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
420
|
|
|
421
|
+
`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을 허용하지 않습니다.
|
|
422
|
+
|
|
423
|
+
`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 권한을 부여하지 않습니다.
|
|
424
|
+
|
|
413
425
|
local-proxy 예시는 side effect 기준으로 나뉩니다.
|
|
414
426
|
|
|
415
427
|
- `plan local-proxy`는 advisory metadata만 만들며 forwarding을 켜지 않습니다.
|
|
@@ -484,6 +496,10 @@ context-guard-setup --plan
|
|
|
484
496
|
|
|
485
497
|
생성되는 hook 명령은 기본적으로 `PATH` 조회에 의존하지 않습니다. setup 마법사는 명시적인 패키지/체크아웃 헬퍼 경로를 기록하며, `--allow-path-helper-fallback`은 신뢰한 외부 설치를 사용할 때만 canonical 경로·symlink 없음·bounded identity probe 검증 후 허용됩니다. macOS 앱 헬퍼도 같은 신뢰 모델을 따릅니다. launch CWD 탐색, 상대 override 경로, 필요한 allowlist 값을 넘어선 상위 셸 환경 상속을 사용하지 않습니다.
|
|
486
498
|
|
|
499
|
+
## 로컬 MCP 어댑터
|
|
500
|
+
|
|
501
|
+
`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 절감을 주장하지 않습니다.
|
|
502
|
+
|
|
487
503
|
## 릴리스 확인
|
|
488
504
|
|
|
489
505
|
릴리스에 민감한 변경을 배포하거나 머지하기 전에는 동기화 확인과 두 게이트를 모두 실행하세요.
|
|
@@ -498,6 +514,16 @@ python3 scripts/release_smoke.py
|
|
|
498
514
|
|
|
499
515
|
버전별 릴리스 노트는 [CHANGELOG.md](CHANGELOG.md)에 기록하며, 사전 배포 게이트는 플러그인 매니페스트 버전과 일치하는 항목이 있는지 확인합니다.
|
|
500
516
|
|
|
517
|
+
### 실험적 semantic-GC plan gate
|
|
518
|
+
|
|
519
|
+
`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 권한이 아닙니다.
|
|
520
|
+
|
|
521
|
+
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
|
|
522
|
+
|
|
523
|
+
`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도 승인하지 않습니다.
|
|
524
|
+
|
|
525
|
+
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
|
|
526
|
+
|
|
501
527
|
## 라이선스
|
|
502
528
|
|
|
503
529
|
Copyright 2026 jinhongan. Apache License 2.0으로 배포됩니다. 자세한 내용은 [LICENSE](LICENSE)와 [NOTICE](NOTICE)를 참고하세요.
|
package/README.md
CHANGED
|
@@ -274,6 +274,10 @@ Artifact mode is for capture, sandbox search, and retrieval. It stores sanitized
|
|
|
274
274
|
--manifest-out suggested-pack.json --budget-bytes 12000 --json --adaptive-k --adaptive-k-policy recall
|
|
275
275
|
./plugins/context-guard/bin/context-guard-pack build \
|
|
276
276
|
--root . --manifest suggested-pack.json --budget-bytes 12000 --json
|
|
277
|
+
# Optional diagnostic comparison against one exact private local receipt:
|
|
278
|
+
./plugins/context-guard/bin/context-guard-pack build \
|
|
279
|
+
--root . --manifest suggested-pack.json --budget-bytes 12000 --json --no-artifact \
|
|
280
|
+
--delta-from-pack-id 0123456789abcdef0123
|
|
277
281
|
./plugins/context-guard/bin/context-guard-pack slice --root . --path README.md --lines 1:40 --json
|
|
278
282
|
```
|
|
279
283
|
|
|
@@ -289,6 +293,8 @@ A few boundaries are intentional:
|
|
|
289
293
|
- `--manifest-out` writes a build-compatible manifest; `--pack-out` saves the rendered pack.
|
|
290
294
|
- `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
295
|
- `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.
|
|
296
|
+
- 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.
|
|
297
|
+
- 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
298
|
- 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
299
|
|
|
294
300
|
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.
|
|
@@ -443,6 +449,8 @@ context-guard experiments plan visual-crop-ocr --json --full-evidence-receipt <i
|
|
|
443
449
|
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
450
|
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
451
|
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"
|
|
452
|
+
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
|
|
453
|
+
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
454
|
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
455
|
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
456
|
context-guard experiments plan self-hosted-metrics-ledger --json --latency-ms 123.5 --peak-memory-mb 2048 --quality-score 0.98
|
|
@@ -459,6 +467,10 @@ context-guard experiments disable output-receipt-trim --root .
|
|
|
459
467
|
|
|
460
468
|
`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
469
|
|
|
470
|
+
`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.
|
|
471
|
+
|
|
472
|
+
`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.
|
|
473
|
+
|
|
462
474
|
The local-proxy examples are intentionally split by side effect:
|
|
463
475
|
|
|
464
476
|
- `plan local-proxy` produces advisory metadata only; it does not enable forwarding.
|
|
@@ -477,6 +489,7 @@ Shipped experimental checker/planner surfaces, plus explicit local context-diff,
|
|
|
477
489
|
| `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
490
|
| `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
491
|
| `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. |
|
|
492
|
+
| `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
493
|
| `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
494
|
| `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
495
|
| `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 +549,10 @@ context-guard-setup --plan
|
|
|
536
549
|
|
|
537
550
|
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
551
|
|
|
552
|
+
## Local MCP adapter
|
|
553
|
+
|
|
554
|
+
`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.
|
|
555
|
+
|
|
539
556
|
## Release checks
|
|
540
557
|
|
|
541
558
|
Before publishing or merging release-sensitive changes, run the copy check and both gates:
|
|
@@ -550,6 +567,16 @@ When a helper under `context-guard-kit/` changes, run `python3 scripts/sync_plug
|
|
|
550
567
|
|
|
551
568
|
Versioned release notes live in [CHANGELOG.md](CHANGELOG.md); the prepublish gate requires an entry matching the plugin manifest version before publishing.
|
|
552
569
|
|
|
570
|
+
### Experimental semantic-GC plan gate
|
|
571
|
+
|
|
572
|
+
`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.
|
|
573
|
+
|
|
574
|
+
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
|
|
575
|
+
|
|
576
|
+
`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.
|
|
577
|
+
|
|
578
|
+
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
|
|
579
|
+
|
|
553
580
|
## License
|
|
554
581
|
|
|
555
582
|
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.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Experimental benchmark fixtures
|
|
2
2
|
|
|
3
|
-
These fixtures are **fixture-only** starter scaffolds for future visual/OCR, learned-compression, reversible output-transform, and token-savings roadmap experiments. They are **synthetic**, package-visible examples for `context-guard-bench` task and variant shapes; they are **not shipped benchmark results**, not OCR/compression implementations, not cache/tool-deferral implementations, and not hosted API savings claims.
|
|
3
|
+
These fixtures are **fixture-only** starter scaffolds for future image-context-pack, visual/OCR, learned-compression, reversible output-transform, and token-savings roadmap experiments. They are **synthetic**, package-visible examples for `context-guard-bench` task and variant shapes; they are **not shipped benchmark results**, not image packing/OCR/compression implementations, not cache/tool-deferral implementations, and not hosted API savings claims.
|
|
4
4
|
|
|
5
5
|
Use them when designing an experiment that starts from ContextGuard's existing benchmark discipline:
|
|
6
6
|
|
|
@@ -35,15 +35,66 @@ The included token-savings evidence file is deliberately `synthetic_fixture` pro
|
|
|
35
35
|
|
|
36
36
|
This runner-native swap only proves command shape and prompt selection until the user supplies real sanitized tasks, success checks, and provider telemetry. It does **not** make dry-run output, artifact receipts, byte counts, or digest metadata into token/cost savings evidence. For real non-dry-run output-transform experiments, keep task IDs matched across baseline and digest variants and require provider-measured primary token/cost fields on matched successful tasks before making any comparison claim.
|
|
37
37
|
|
|
38
|
+
## Optional image-context evaluation profile
|
|
39
|
+
|
|
40
|
+
`context-guard-bench` supports an optional, versioned evaluation profile for image-context-pack replays. A task opts in with `"evaluation_profile": "contextguard.bench.image-context-pack-evaluation.v1"`, and every evidence row for that task repeats the same value plus an `evaluation_controls` block. Absence means today's generic behavior: a fixture, report, or workflow that does not opt in acquires no new required field and no changed claim decision.
|
|
41
|
+
|
|
42
|
+
The profile is **evaluation-only**. It makes imported image-context evidence machine-reviewable; it adds no image renderer, OCR engine, image parser, provider client or SDK, credential handling, network access, proxy, daemon, subprocess transformer, automatic context omission, replacement runtime, or hosted savings claim. **Operators own the real work**: provider runs, images, credentials, and corpus selection stay with you. The runner only validates the evidence you import, and only against local, bounded checks.
|
|
43
|
+
|
|
44
|
+
`evaluation_controls` carries bounded, typed fields:
|
|
45
|
+
|
|
46
|
+
- `prompt_evidence` — SHA-256 of the selected variant prompt file plus a sanitized source label. The runner recomputes the hash with the existing no-follow bounded reader and compares it.
|
|
47
|
+
- `source_omission` — whether any source text was omitted or transformed for this variant.
|
|
48
|
+
- `exact_text_fallback` — receipt ID, content SHA-256, exact local retrieval command, and a bounded projection of one imported proof-verifier result. Required when `source_omission.present=true`. The runner labels this `imported_local_verifier_attestation`: it checks that the record is internally consistent and binds the same receipt/hash/command, but it does **not** authenticate who produced the record and does **not** reread the artifact.
|
|
49
|
+
- `protected_zone_review` — `deny` policy, explicit review completion, zero included protected or prompt-like regions, reviewer/source label, and a review note. This is a human/tool attestation, not semantic proof.
|
|
50
|
+
- `missed_context_review` — completion flag, presence flag, bounded summary, and correction-required flag.
|
|
51
|
+
- `human_correction` — count and bounded reason; the count must equal the existing top-level `corrections` field.
|
|
52
|
+
- `provider_usage` and `shifted_cost` — measurement flags that must agree with the generic normalized fields. Lane metadata can never upgrade an unmeasured value into a measured one.
|
|
53
|
+
- `control_provenance` — bounded local verifier/review identifiers, kept separate from provider-export provenance.
|
|
54
|
+
|
|
55
|
+
Every string, array, and nested block is bounded, and unknown keys are rejected for v1 so a typo cannot become a false pass. Schema evolution requires a new profile version.
|
|
56
|
+
|
|
57
|
+
### Rejected before write versus accepted and blocked
|
|
58
|
+
|
|
59
|
+
Evidence that cannot be interpreted safely or unambiguously is **rejected before anything is written** — no CSV, ledger, report, dashboard, or lock sidecar is created. Evidence that is well-formed but negative is **accepted and scored as blocked**, so a reviewer can still read why it failed.
|
|
60
|
+
|
|
61
|
+
| Evidence condition | Outcome |
|
|
62
|
+
| --- | --- |
|
|
63
|
+
| Missing control block; wrong type, oversize, unknown v1 key or version; task/row profile mismatch; duplicate, mixed, or partial profile batch | rejected before write |
|
|
64
|
+
| `--resume`, or a pre-existing non-empty CSV, for a profiled replay | rejected before write |
|
|
65
|
+
| Missing or unsafe prompt mapping, or a prompt SHA mismatch | rejected before write |
|
|
66
|
+
| Correction counts or measurement flags that contradict the generic fields | rejected before write |
|
|
67
|
+
| A fallback record that claims verification while its own schema, status, blockers, replacement, receipt, hash, or command fields contradict that claim | rejected before write |
|
|
68
|
+
| Explicitly unverified or failed fallback; non-`deny`, incomplete, or unknown protected-zone review; reported missed context; explicitly unmeasured provider or shifted cost; correction-burden or failure-rate regression | accepted, lane blocked |
|
|
69
|
+
|
|
70
|
+
Errors are bounded and redacted: raw prompts, prompt paths, artifact directories, receipt contents, and secret-shaped values are never echoed. In v1 a profiled replay requires a fresh empty CSV and a complete baseline/candidate batch. Incremental replay is deliberately given up so profile context cannot silently vanish from a resumed or pre-existing report.
|
|
71
|
+
|
|
72
|
+
### Status ceiling
|
|
73
|
+
|
|
74
|
+
A profiled report exposes `evaluation_profiles.image_context_pack` with `status: blocked` or `status: ready_for_bounded_pilot_review`.
|
|
75
|
+
|
|
76
|
+
**`ready_for_bounded_pilot_review` is the ceiling, and it is not an achievement.** It is not promotion, not runtime authority, not quality proof, and not a hosted API token/cost savings claim. It means only that the imported evidence was complete and internally consistent enough to justify a bounded human pilot review.
|
|
77
|
+
|
|
78
|
+
For any profiled report the runner clamps every public-authority surface: `evaluation_only=true`, `promotion_authority=false`, `public_claim_allowed=false`, top-level `public_claim_eligible=false`, `public_claim_status` and legacy `claim_status` set to the stable non-candidate value `image_context_pack_evaluation_only_not_public_claim`, generic `public_claim_readiness.claim_allowed=false`, and profiled matched-pair `token_savings_claim_allowed` and `shifted_cost_claim_allowed` false. Pre-clamp measurements survive only in explicitly non-authoritative fields such as `raw_metric_claim_status`. The report also carries a `sample_adequacy` observation with matched counts and `policy_status: not_defined_for_promotion`: this feature defines no sample-size or promotion threshold, and a future consensus decision must.
|
|
79
|
+
|
|
38
80
|
## Included fixture sets
|
|
39
81
|
|
|
40
82
|
| Fixture set | Task file | Variant file | Evidence replay file | Intended future experiment |
|
|
41
83
|
| --- | --- | --- | --- | --- |
|
|
84
|
+
| Matched image-context-pack correction | [`benchmark-fixtures/image-context-pack.tasks.example.json`](benchmark-fixtures/image-context-pack.tasks.example.json) | [`benchmark-fixtures/image-context-pack.variants.example.json`](benchmark-fixtures/image-context-pack.variants.example.json) | [`benchmark-fixtures/image-context-pack.evidence.example.jsonl`](benchmark-fixtures/image-context-pack.evidence.example.jsonl) | Replay one full sanitized textual baseline against one synthetic packed textual variant that succeeds only after one recorded human correction, without turning byte proxies into a hosted claim. |
|
|
42
85
|
| Visual/OCR evidence | [`benchmark-fixtures/visual-ocr.tasks.example.json`](benchmark-fixtures/visual-ocr.tasks.example.json) | [`benchmark-fixtures/visual-ocr.variants.example.json`](benchmark-fixtures/visual-ocr.variants.example.json) | n/a | Compare full visual evidence against cropped or OCR-derived evidence after the user supplies sanitized textual evidence, missed-context notes, crop/OCR telemetry, and provider telemetry. |
|
|
43
86
|
| Learned compression | [`benchmark-fixtures/learned-compression.tasks.example.json`](benchmark-fixtures/learned-compression.tasks.example.json) | [`benchmark-fixtures/learned-compression.variants.example.json`](benchmark-fixtures/learned-compression.variants.example.json) | n/a | Compare sanitized baseline context packs against a fixture-only compressed digest candidate after exact retrieval or receipt fallback, quality gates, and shifted costs are measured. |
|
|
44
87
|
| Reversible output transform | [`benchmark-fixtures/output-transform.tasks.example.json`](benchmark-fixtures/output-transform.tasks.example.json) | [`benchmark-fixtures/output-transform.variants.example.json`](benchmark-fixtures/output-transform.variants.example.json) | n/a | Compare raw sanitized command output against a digest plus artifact receipt after variant prompt files, success checks, and provider telemetry are supplied. |
|
|
45
88
|
| Token-savings 12-task roadmap | [`benchmark-fixtures/token-savings-12task.tasks.example.json`](benchmark-fixtures/token-savings-12task.tasks.example.json) | [`benchmark-fixtures/token-savings-12task.variants.example.json`](benchmark-fixtures/token-savings-12task.variants.example.json) | [`benchmark-fixtures/token-savings-12task.evidence.example.jsonl`](benchmark-fixtures/token-savings-12task.evidence.example.jsonl) | Exercise a canonical 12-task spread for bugfix, exploration, review, log analysis, migration, docs, refactor, performance, telemetry, cache layout, tool-schema deferral, and artifact receipt experiments after real success commands and provider telemetry are supplied. |
|
|
46
89
|
|
|
90
|
+
## Matched image-context-pack correction fixture notes
|
|
91
|
+
|
|
92
|
+
The image-context-pack fixture is a deterministic replay over one task and two variants. The baseline supplies full sanitized textual evidence. The packed variant explicitly records that qualifying context was omitted at first, then records one **synthetic human correction** and retains the missed-context disclosure. Its full-text fallback is narrative/shape only and remains `verified=false`; the fixture does not retrieve an artifact or prove that the initial pack was complete.
|
|
93
|
+
|
|
94
|
+
Both rows are plan-only, use protected-zone deny, and describe byte counts only as sanitized textual UTF-8 proxies—not image bytes or provider tokens. The fixture performs no renderer, OCR, image-parser, provider, model, network, or subprocess call; ships no replacement or runtime; and makes no hosted claim. A successful synthetic replay after one correction does not establish quality non-inferiority, token savings, or cost savings.
|
|
95
|
+
|
|
96
|
+
The fixture opts into the image-context evaluation profile described above, so its known-negative evidence exercises the blocked path rather than the rejection path: the unverified fallback (`verified=false`) and the one recorded correction produce an explicitly **blocked** lane score with stable blocker IDs, not a parse failure and not a claim. It is a worked example of what negative-but-reviewable evidence looks like. Because it is provider-unmeasured synthetic evidence, it cannot reach `ready_for_bounded_pilot_review` no matter how its nested metadata is written.
|
|
97
|
+
|
|
47
98
|
## Visual/OCR fixture notes
|
|
48
99
|
|
|
49
100
|
The visual/OCR fixtures describe sanitized textual visual evidence only and now demonstrate `variant_prompt_files` for full visual evidence versus cropped/OCR-derived evidence. They do not include image assets, crop images, run OCR, prune visual tokens, or call a model. Future experiments should record image dimensions, crop area, visible area, omitted or missed context, OCR confidence/error notes, full visual fallback conditions, provider image/text token telemetry when available, task success, corrections, and any external/local processing cost.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ictechgy/context-guard",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.15",
|
|
4
4
|
"description": "ContextGuard CLI helpers for keeping AI coding agent context focused and local-first.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/ictechgy/context-guard#readme",
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"context-guard-pack": "plugins/context-guard/bin/context-guard-pack",
|
|
26
26
|
"context-guard-tool-prune": "plugins/context-guard/bin/context-guard-tool-prune",
|
|
27
27
|
"context-guard-compress": "plugins/context-guard/bin/context-guard-compress",
|
|
28
|
+
"context-guard-mcp": "plugins/context-guard/bin/context-guard-mcp",
|
|
28
29
|
"context-guard-bench": "plugins/context-guard/bin/context-guard-bench",
|
|
29
30
|
"context-guard-read-symbol": "plugins/context-guard/bin/context-guard-read-symbol",
|
|
30
31
|
"context-guard-rewrite-bash": "plugins/context-guard/bin/context-guard-rewrite-bash",
|
|
@@ -79,6 +79,7 @@ context-guard-sanitize-output -- rg -n "TOKEN|SECRET" .
|
|
|
79
79
|
context-guard-sanitize-output -- git diff
|
|
80
80
|
context-guard-pack auto --root . --query "failing tests review" --diff HEAD --manifest-out suggested-pack.json --pack-out context-pack.md --budget-bytes 12000 --json --explain --adaptive-k --adaptive-k-policy recall
|
|
81
81
|
context-guard-pack build --root . --manifest suggested-pack.json --budget-bytes 12000 --json
|
|
82
|
+
context-guard-pack build --root . --manifest suggested-pack.json --budget-bytes 12000 --json --no-artifact --delta-from-pack-id 0123456789abcdef0123
|
|
82
83
|
context-guard-pack slice --root . --path README.md --lines 1:40 --json
|
|
83
84
|
context-guard-cache-score --input prompt.json --provider openai --json
|
|
84
85
|
context-guard-tool-prune select --catalog tools.json --query "review failing tests" --top 5 --budget-bytes 12000 --json
|
|
@@ -90,6 +91,10 @@ context-guard-statusline-merged
|
|
|
90
91
|
|
|
91
92
|
## 헬퍼가 하는 일
|
|
92
93
|
|
|
94
|
+
모든 pack build는 기존 `pack_id`를 바꾸지 않고 렌더링된 byte의 SHA-256 `content_address`를 포함합니다. `build`와 `auto`의 선택적 `--delta-from-pack-id PACK_ID`는 private local receipt 하나만 bounded/fail-soft 방식으로 비교합니다. `rolling_delta`는 진단 전용이고 selection이나 pack 본문을 바꾸지 않으며 provider token/cost savings claim이 아닙니다. 진단은 `--json` 출력 또는 저장된 artifact receipt에서만 보고됩니다. `--no-artifact`를 쓰면 진단 보고에 `--json`이 필요하며, 기존 text stdout은 정확한 pack 본문을 그대로 유지합니다.
|
|
95
|
+
|
|
96
|
+
선택적 `build`/`auto --sketch-duplicate-veto`는 sanitized slice에 rank-stable pre-budget gate를 적용하며 `suggest`는 그대로 둡니다. exact digest 후보는 byte로 확인합니다. 근사 gate는 고정 framing의 Unicode-casefold 순서 보존 5-token shingle, bottom 64 unique digest, 양쪽 최소 12, inclusive 0.90의 sketch-set Jaccard입니다. 짧은 sketch는 exact-only입니다. eligible pair 100,000개 검증 뒤 실제 skipped pair에서 fail open하고 이후 digest-only로 동작합니다. winner가 최종 budget에서 렌더링되지 않을 수 있으므로 누락 source 자체의 exact retrieval을 편집/근거 사용 전에 확인하십시오. `sketch_duplicate_source`, standalone build/`auto.build`의 `sketch_duplicate_veto.comparison_cap_reached`, flagged text의 `sketch_comparison_cap_reached=true|false`만 receipt 실패와 무관하게 관측됩니다. fingerprint, match identity, overlap, score, provider token/cost savings claim은 내보내지 않으며 flag-off 동작은 호환됩니다.
|
|
97
|
+
|
|
93
98
|
- **설정 마법사**는 `.claude/settings.json`을 덮어쓰지 않고 병합한 뒤, 읽기 전용 `context-guard-diet scan` 요약을 보여줍니다. 자동화에서 적용 후 검사 요약이 필요 없으면 `--no-diet-scan`을 사용하세요. `PATH` helper fallback은 기본적으로 꺼져 있으며, `--allow-path-helper-fallback`과 identity 검증을 통과해야만 사용됩니다.
|
|
94
99
|
- **컨텍스트 관리 스캐너**는 누락된 `permissions.deny` 가드레일, Bash 출력 축약 훅, 상태표시줄 설정, 넓은 읽기 허용, 비용이 큰 기본 모델/추론 강도, 많은 MCP 서버, 크거나 민감해 보이는 에이전트 규칙 파일, 부피가 크거나 민감해 보이는 로컬 경로에 대한 자문형 context-exclusion 추천을 확인합니다.
|
|
95
100
|
- **대용량 읽기 가드와 심볼 리더**는 파일 전체 읽기 전에 검색, 심볼 구간, 작은 줄 범위 읽기 순서로 에이전트를 안내합니다. Python, JavaScript/TypeScript, Go, Rust 소스 구간 읽기를 지원합니다.
|
|
@@ -121,12 +126,22 @@ ContextGuard는 모델 토큰을 줄이기 위해 작업을 외부 AI 서비스
|
|
|
121
126
|
|
|
122
127
|
미래 learned, self-hosted 최적화 아이디어는 [`research/experimental-token-reduction-radar.md`](https://github.com/ictechgy/context-guard/blob/main/research/experimental-token-reduction-radar.md)에 gated experiment로 기록하며, fixture-only 시작 예시는 [`docs/experimental-benchmark-fixtures.md`](https://github.com/ictechgy/context-guard/blob/main/docs/experimental-benchmark-fixtures.md)에 둡니다. learned compression은 `context-guard experiments plan learned-compression` dry-run checker와 명시적 `context-guard experiments emit learned-compression` caller-supplied candidate emitter만 shipped 상태이고, self-hosted-metrics-ledger는 dry-run preview와 명시적 `context-guard experiments record self-hosted-metrics-ledger` local JSONL record를 제공하며, dry-run preview는 ledger 파일을 쓰지 않습니다. visual crop/OCR은 caller-supplied evidence-pack emit, image-context-pack은 pxpipe-inspired image/context packing 평가를 위한 plan-only dry-run gate, semantic-checkpoint는 review용 task-state checkpoint 계획을 위한 plan-only/eval-only gate, context-diff는 verified-receipt caller-supplied replacement emit만 제공합니다. image-context-pack은 exact text artifact fallback, protected-zone denial, provider-boundary acknowledgement for provider-measured matched tasks, missed-context guardrail, 그리고 visual-crop-ocr이 기존 caller-supplied visual evidence-pack surface라는 plan output 확인이 필요하며, image rendering, OCR 실행, image parsing, model/provider call, proxy traffic, binary artifact 저장, replacement evidence 출력, hosted token/cost savings claim을 하지 않습니다. semantic-checkpoint는 CLI flag가 optional이지만 JSON readiness에서 exact context fallback/re-expand, provider-boundary ack, protected-zone policy `deny`, missed-context note, provenance review note가 없으면 blocked이며, `--missing-provenance-note`는 `none known after review` 같은 검토 확인 문구일 수 있습니다. 허용되는 re-expand command는 `context-guard-artifact get <id> --full` 또는 `context-guard artifact get <id> --full` 형태이고, 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은 없습니다. local proxy는 `context-guard experiments plan local-proxy` localhost-only dry-run advisory plan, design-only `context-guard experiments plan local-proxy-external-forwarding` gate, 명시적 `context-guard experiments record local-proxy-runtime-gate --ledger-jsonl ...` gate row record, private ready-file nonce가 필요한 one-shot `context-guard experiments serve local-proxy` loopback forwarding MVP와 successful forwarded request용 optional shifted-cost diagnostic JSONL row만 shipped 상태입니다. record는 no listener/no traffic forwarding/no DNS lookup/no external service/no API-key persistence boundary를 유지하고, serve는 private ready-file nonce, literal loopback IP, `--once`, credential-free request만 허용하고 CONNECT/TLS proxying도 지원하지 않습니다. `--response-sandbox`는 safe UTF-8 response text만 local artifact receipt로 저장하고 raw body 대신 redacted rehydration command template가 담긴 compact envelope를 돌려주며 hosted token/cost savings claim은 아닙니다. `--diagnostic-ledger-jsonl`은 successful forwarded request 뒤에만 진단 row를 쓰며 raw header/body나 hosted-savings evidence를 저장하지 않습니다. `plan local-proxy-external-forwarding`은 threat model, HTTPS allowlist, credential redaction, provider-evidence boundary를 점검하는 dry-run design gate이고 listener, DNS lookup, external service call, traffic forwarding, credential persistence, external proxy forwarding runtime, hosted savings claim을 제공하지 않습니다. learned/synthetic compressor 실행·embedding·reranker·model call·생성형 replacement, generated OCR/crop, visual-token pruning, plan-only image-context-pack dry-run gate를 넘어선 image-context-pack rendering/runtime, plan-only semantic-checkpoint gate를 넘어선 emit/record/serve runtime이나 replacement context/file-writing checkpoint store/transcript-prompt edit/provider-backed checkpointing, self-hosted KV/latent runtime 최적화, one-shot literal-loopback local proxy MVP를 넘어선 external/daemon/credential-bearing proxy forwarding runtime은 shipped가 아닙니다. 이 radar와 fixture는 provider가 측정한 matched-task 근거 없이 hosted API 절감을 주장하지 않습니다. Radar의 later-roadmap gate는 neural/semantic compression, trust-tiered injection-aware compression, generated visual-token reduction, broader local proxy forwarding constraint도 별도 미래 PR이 gate를 통과하기 전까지 experimental/non-shipped로 묶습니다.
|
|
123
128
|
|
|
129
|
+
`plan proof-carrying-context`는 bounded repeatable inline JSON의 proof-envelope metadata 구문과 정의된 일관성만 확인하는 기본 비활성 plan-only readiness gate입니다. Caller timestamp를 보존하지만 현재 시간이나 freshness는 검사하지 않고 protected-zone policy는 선언 전용입니다. 이 plan command에는 range bounds, receipt storage, source content, SHA-256, timestamp freshness, rehydration이 unchecked warning으로 남으며 source/artifact/config/stdin read, file write, model/provider/network/subprocess call, context 생성·대체, `emit`/`record`/`serve` runtime, 새 binary, hosted savings claim은 없습니다. `candidate_replacement`는 항상 `null`입니다.
|
|
130
|
+
|
|
131
|
+
`verify proof-carrying-context`는 별도의 read-only local verifier입니다. 문서 fixture는 정확한 UTF-8 문자열 `ContextGuard proof fixture\n`(27 bytes, 1 line)이고 SHA-256은 `12637068ee51f2ddfe27f1c00836a51cb54ba6a5cfca7f2301a4a45fbade2d14`입니다. Explicit artifact directory 하나만 사용하고 fallback search를 수행하지 않고 symlink를 follow하지 않으며 effective-user-owned directory `0700`과 두 receipt leaf 모두 mode `0600`을 요구합니다. Bounded whole-file read로 receipt/proof SHA, byte/line count, range bounds만 확인하고 range content는 retrieve/echo하지 않습니다. Exit `0`은 local binding pass, exit `2`는 verification failure이며 timestamp freshness/protected-zone semantics는 unchecked입니다. Rehydrate command는 syntax/receipt binding만 확인하고 실행하지 않으며 `candidate_replacement: null`을 유지하고 replacement/omission/hosted-savings authority를 부여하지 않습니다.
|
|
132
|
+
|
|
124
133
|
```bash
|
|
125
134
|
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"
|
|
135
|
+
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
|
|
136
|
+
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
|
|
126
137
|
```
|
|
127
138
|
|
|
128
139
|
교차 에이전트 규칙 스니펫은 안내용입니다. 대상 에이전트가 반드시 따른다고 보장할 수 없으므로, 절감 주장이 필요하면 실제 전후 동작을 직접 측정하세요.
|
|
129
140
|
|
|
141
|
+
## 로컬 MCP 어댑터
|
|
142
|
+
|
|
143
|
+
`context-guard mcp`와 `context-guard-mcp`는 의존성 없는 로컬 stdio MCP 자식 프로세스를 실행합니다. 프로세스는 root와 namespace 하나로 격리되고 sanitization된 compression, 정확한 sanitization artifact fallback, 로컬 통계만 제공합니다. HTTP, 네트워크, provider, model, proxy 통합이나 client 설정 변경은 없습니다. artifact는 namespace 사이에서 접근할 수 없고 hosted token/cost 절감도 주장하지 않습니다.
|
|
144
|
+
|
|
130
145
|
## 로컬 배포 테스트
|
|
131
146
|
|
|
132
147
|
마켓플레이스 저장소 루트에서 실행합니다.
|
|
@@ -148,6 +163,16 @@ claude --plugin-dir ./plugins/context-guard
|
|
|
148
163
|
/plugin install context-guard@context-guard
|
|
149
164
|
```
|
|
150
165
|
|
|
166
|
+
### 실험적 semantic-GC plan gate
|
|
167
|
+
|
|
168
|
+
`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 권한이 아닙니다.
|
|
169
|
+
|
|
170
|
+
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
|
|
171
|
+
|
|
172
|
+
`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도 승인하지 않습니다.
|
|
173
|
+
|
|
174
|
+
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
|
|
175
|
+
|
|
151
176
|
## 라이선스
|
|
152
177
|
|
|
153
178
|
Copyright 2026 jinhongan. Apache License 2.0으로 배포됩니다. [LICENSE](LICENSE)와 [NOTICE](NOTICE)를 참고하세요.
|