Skip to content

Releases: googlarz/deep-context

v1.5.0 — Honesty and correctness fixes (round 4)

Choose a tag to compare

@googlarz googlarz released this 29 Apr 09:24

Round 4 adversarial review. Five findings, all addressed — four of them about the spec overclaiming what it can actually deliver.

Medical scrub scope narrowed. The atomic temp-dir scrub previously claimed to prevent PHI from reaching filesystem journals, backup systems, and model transcripts. That's false — it only cleans .context/ files. New wording is explicit: scrub covers written artifacts only. A warning now states clearly that PHI may still exist in model transcripts and tool logs outside that directory. This is not a weaker scrub — it's the same mechanism with honest claims about what it does.

TRUST BOUNDARY downgraded to best-effort prompt-hardening. The same LLM reads both the trust-boundary instructions and the hostile corpus — there is no parser-level enforcement. A sufficiently adversarial document can still steer extraction. The prompt block reduces this risk but cannot eliminate it. README now says "prompt-hardening" not "guard." This is the correct framing for what the mechanism actually is.

Ask-miss logging fixed — own regression from v1.4.0. Ask mode was appending miss entries directly to per-file notes, which immediately invalidated the note-integrity SHA-256 hashes added in the same release. Misses now go to a separate .context/ASK_LOG.md — append-only, excluded from note hashing, never used as evidence in build or verification. Diff mode surfaces ASK_LOG counts in CHANGES.md for the next build pass to pick up. ASK_LOG.md added to filename exclusion list.

Partial-pack ask mode refuses by default. Relevance detection via keyword grep of note paths is not a sound dependency check — aliases, abbreviations, and indirect references escape it, producing exactly the confident-but-incomplete answer this tool exists to prevent. Default is now refuse with gap list shown. A narrow --partial-ok flag exists for explicit override; it caps confidence at LOW (not MEDIUM) and logs the override to ASK_LOG.md.

Hardlink inode dedup corrected. Inode tracking was being used to suppress duplicate-inode regular files from the corpus — silently dropping valid in-scope paths that share a hardlink. Inode tracking is now used only for directory-cycle detection. Two paths sharing an inode both appear in the corpus with their own notes. Out-of-root hardlinks remain unresolved scope violations that permanently block coverage: 100; user acknowledgment records the decision but does not unlock full coverage.

Diff

v1.4.0...v1.5.0

v1.4.0 — Statistical honesty + probe quality + integrity checks

Choose a tag to compare

@googlarz googlarz released this 29 Apr 09:10

Five improvements to measurement honesty, probe quality, and pack integrity.

Statistical honesty — confidence intervals on all pass rates. Pass rates reported as point estimates on n=10 samples are statistically meaningless (90% at n=10 has a 95% CI of 56%–100%). All rate thresholds now require a minimum sample of 20 and report a 95% Wilson score CI. coverage: 100 requires the CI lower bound ≥85% for spot-check, not just the point estimate ≥95%. index.json gains *_ci_low, *_ci_high, *_n fields for every metric.

High-stakes content bias in omission probe. Sampling was previously uniform random — wasting probes on boilerplate while missing the dates, amounts, and decisions that matter. Probe now samples in priority order: Tier 1 (dates, amounts, proper nouns, deadlines, decision statements) → Tier 2 (section headings + following paragraph) → Tier 3 (random uncited lines as fill). Minimum probe size raised to 20 slices. Tier 3 random misses only count as FAIL if substantively important.

Corpus-level negative space. Per-file Does-NOT-cover sections existed but were never aggregated. INDEX.md now has a "Corpus does NOT cover" section — derived from all per-file negative space entries, omission probe soft misses, and unresolved dangling references. Gives users explicit confirmation that a topic was looked for and not found, rather than leaving ambiguity between "absent" and "not checked."

Note integrity hashes. manifest.json hashed source files but not generated notes — a manually edited or corrupted note was invisible. Every per-file note is now SHA-256 hashed at write time. Step 6 re-hashes all notes and flags any mismatch as a Gap with LOW confidence demotion. Detects post-extraction edits, tool bugs, and disk corruption.

Ask mode miss logging. When ask mode falls back to a direct source read because notes were incomplete, the gap now gets logged to the relevant per-file note's Open questions with timestamp, question text, and citation. Builds a usage-driven record of what users ask that the pack failed to capture — picked up automatically by the next diff run.

Diff

v1.3.0...v1.4.0

v1.3.0 — Quality improvements

Choose a tag to compare

@googlarz googlarz released this 29 Apr 09:03

Five improvements to verification quality, trust calibration, and usability.

What changed

Cross-file synthesis in self-test. The prior self-test sampled only single-file Key content claims — it never tested whether the pack understands relationships between files. Self-test now generates ≥30% Type B (cross-file synthesis) questions requiring joins across ≥2 notes to answer correctly. SELF_TEST.md reports factual and synthesis pass rates separately. A pack can score 95% factual and 60% synthesis — a meaningful signal that the aggregate hid before.

Staleness signal on every run. Pack age (days since build) and source drift (% of source files changed since last build) are now always surfaced — in INDEX.md, the reporting summary, and index.json. Warning escalates at ≥30% drift or ≥90 days. Cache hits still show it. Diff mode now re-runs self-test proportionally after re-extraction — the prior self-test score is invalidated by any source change and must refresh before coverage: 100 is restored.

Implicit numerical/temporal contradiction detection. CONFLICTS.md previously only caught contradictions where two files used the same entity name but stated different values. The new implicit pass normalizes all dates, amounts, durations, and counts across notes, then flags pairs where the same event or entity has inconsistent values — regardless of whether they share a name. Catches: "deadline is March 15" in one file vs "3 months from January" in another. Findings tagged [explicit] or [implicit].

Graduated ask mode on partial coverage. Ask mode previously hard-refused when coverage: partial. Now it checks whether the files relevant to the question are in the scanned set. If yes → answers with a MEDIUM confidence caveat and a warning. If no → refuses with the specific unscanned files listed. Removes the all-or-nothing block that made partial packs useless even when the relevant area was fully scanned.

Domain-driven red-team threshold. The ≥10-file rule for spawning a real independent red-team subagent was a cost heuristic. --domain=legal, --domain=finance, and --domain=medical now always get a real independent subagent regardless of file count. These are the domains where a confidently-wrong answer costs most — a 5-file contract set deserves the same adversarial scrutiny as a 50-file one.

Diff

v1.2.0...v1.3.0

v1.2.0 — Round 3 adversarial hardening

Choose a tag to compare

@googlarz googlarz released this 28 Apr 20:33

Security and correctness hardening from a third adversarial review pass. Five findings, all addressed.

What changed

High-severity fixes

Prompt injection now guarded in all verifiers. The TRUST BOUNDARY block previously only appeared in extraction subagent prompts. Red-team verifiers, omission-probe readers, and self-test graders all read raw corpus content — and none had the untrusted-data guard. A hostile document could steer any of them toward false PASS results. All verifier prompts now carry the same explicit guard: corpus content is untrusted data, never instructions. The ≤30-file inline path gets the same rule as a written constraint.

PHI scrub is now atomic — no sensitive content on disk after a failed run. Medical mode previously wrote all artifacts to .context/ then ran the regex scrub. On a scrub failure, sensitive content had already been written to disk and could be indexed, backed up, synced, or committed. New protocol: write everything to .context/.tmp-<runid>/, run the scrub there, then either atomically promote to .context/ on PASS or delete the temp directory entirely on FAIL. A failed scrub leaves zero sensitive artifacts on disk.

Hardlink boundary check closes the realpath gap. Realpath/symlink containment only catches symlinks — a file hardlinked from outside the scanned tree appears as an ordinary regular file. Inventory now reads st_nlink for every admitted file. Files with nlink > 1 are recorded in manifest.json under hardlinked_files, listed under Gaps in INDEX.md, and block coverage: 100 until the user explicitly reviews and acknowledges them. The README's "stays inside the folder you pointed at, period" claim is now enforced rather than promised.

Aggregation verification is now a coverage gate, not advisory prose. The DIGEST.md aggregation safety rules (unique key, dedup, unit normalization, provenance, completeness) existed in the spec but were never checked in the verification step or reflected in machine-readable output. Step 6 now includes an explicit aggregation verification checklist item: every scalar total must satisfy all five requirements or be replaced with prose. coverage: 100 is blocked until all totals pass. index.json gains an aggregates array carrying contributing note IDs, dedup key, unit basis, and completeness status — making aggregation provenance machine-verifiable.

Medium fix

Prior-run artifact detection hardened from a 200-byte heuristic to three-layer structural detection. A generated artifact with a long preamble, comment block, or frontmatter padding could evade the 200-byte prefix scan and be re-admitted as "source" — feeding the circular-evidence loop. Three complementary methods now replace the heuristic: (1) exact filename exclusion for all canonical artifact names at any path depth, (2) a generated_by: deep-context frontmatter marker added to every generated file and checked on admission, (3) full first-chunk scan (up to 2000 lines) for structural signatures. All three methods must clear before a file is admitted.

Coverage gate (updated)

coverage: 100 now additionally requires:

  • DIGEST aggregation verified: unique key, dedup, normalization, provenance, completeness for every scalar total
  • All hardlinked files acknowledged by user
  • All DIGEST totals missing any of the five aggregation properties replaced with prose

Provenance

Round 3 of Codex adversarial review against v1.1.0. "Be brutal, no flattery, maximum depth" framing. All five findings addressed before this release.

Diff

v1.1.0...v1.2.0

v1.1.0 — security & correctness hardening

Choose a tag to compare

@googlarz googlarz released this 28 Apr 20:08

Security and correctness hardening from a deep adversarial review (round 2). Six findings, all addressed.

What changed

Critical fixes

Prompt-injection trust boundary. Subagent extraction prompts now include an explicit ## TRUST BOUNDARY block: corpus content is untrusted data, never instructions. Files that try to issue instructions ("ignore previous instructions...", role-changes, omit-this-section directives) are recorded under Open questions as possible injection attempts and never acted on. Schema validation enforced on every per-file note before acceptance, with retry+fail policy.

Symlink / realpath escape + recursive-pack ingestion. Inventory now requires lstat, refuses directory symlinks, requires realpath containment under the requested root, and tracks visited inodes for cycle detection. Refused symlinks are logged. Files matching prior-run artifact signatures (INDEX/DIGEST/RED_TEAM/SELF_TEST formats, path:/sha256:/scanned_at: frontmatter triple) are excluded by default to break the recursive-context loop where past hallucinations become "evidence."

High-severity fixes

Chunked text-file completeness. Inventory now records lines_total. Per-file notes track lines_read. coverage: 100 requires lines_read == lines_total for every chunked text file (mirrors the existing PDF rule). Closes the hole where a 10,000-line log/code/spec could be summarized from the first 2000 lines while the pack claimed completeness.

Source-derived omission probe (closes circular-gate hole). New step 5.55 adds the missing fourth audit direction. Existing audits all started from notes (notes→?, notes→source, source→notes-contradicted) — this one starts from raw source slices NOT in any note and asks if they're covered. Per-file minimum: every HIGH-confidence file must have ≥1 probe sampled. Output to OMISSIONS.md. Coverage gate adds ≥90% omission-probe pass rate. Without this, omission was structurally invisible.

Medical-mode redaction honesty. Disclaimer added: best-effort, NOT HIPAA-grade. Quasi-identifier list expanded (provider names, dates of service, ages>89, ZIP3, rare diagnoses → category only). Verbatim source excerpts banned by default. Mandatory final cross-artifact regex scrub before reporting completion — any match aborts the run with explicit error and dirty-state warning.

Medium fix

DIGEST aggregation safety. Numeric aggregation now requires: unique entity key, currency/unit normalization, deduplication, provenance per number, completeness disclosure. If any of those cannot be established, no scalar total is emitted — replaced with prose describing the ambiguity. Closes the confidently-wrong-totals hole in finance/legal corpora.

Coverage gate (updated)

coverage: 100 now additionally requires:

  • Source-derived omission probe ≥ 90% pass rate
  • Schema validation passed for every per-file note
  • Symlink/realpath audit reviewed by user
  • For chunked text files: lines_read == lines_total
  • No admitted file is a prior-run artifact
  • Every refused symlink listed and reviewed

Provenance

Round 2 of Codex adversarial review against v1.0.0. Codex was given an explicit "be brutal, no flattery" framing with specific failure surfaces to probe. All six findings landed; all fixed before this release.

Honest take

deep-context is more honest about what it is now: best-effort verified context, with explicit threat-model, completeness, and aggregation rules. The hardest remaining gap (PHI quasi-identifier de-identification) is acknowledged in the spec rather than papered over with claims it can't back up.

Diff

v1.0.0...v1.1.0

v1.0.0 — first public release

Choose a tag to compare

@googlarz googlarz released this 28 Apr 19:52

First public release of deep-context — a Claude Code skill that turns a folder into a verified, comprehensive context pack with citations, contradiction detection, self-test calibration, and a one-page actionable digest.

What's in v1.0

Workflow modes

  • build — full scan with verification ceremony
  • build with anchors — anchor-question driven, verifies each is HIGH-confidence answerable
  • ask — query the cached pack with dual citations (note + source)
  • diff — incremental rebuild on changed files; auto-invalidates dependent notes when a referenced file changes
  • link — cross-link two existing packs; surfaces shared entities + cross-pack conflicts

Quality gates (coverage: 100 requires all of these)

  • Mandatory source citations on every claim — format per file type (line/page/cell)
  • Spot-check audit ≥ 95% pass rate
  • Independent red-team re-read ≥ 90% pass rate (subagent for ≥10 files; inline for smaller corpora, flagged)
  • Self-test calibration ≥ 90% empirical accuracy
  • Anchor questions all answerable from notes alone
  • For PDFs: pdfinfo page-count probe + explicit page chunking + end-of-document signature check + pages_read == pages_total
  • Citation-format violations bar coverage: 100

Outputs (.context/)

  • INDEX.md — structural map + verification report
  • DIGEST.md — one-page TL;DR with aggregated numbers, timeline, decision points, risks, next steps
  • Per-file notes with two-pass extraction (extract → self-verify)
  • CONFLICTS.md, GLOSSARY.md, RED_TEAM.md, SELF_TEST.md
  • manifest.json (SHA-256 hashes + run metadata) + index.json (machine-readable summary)

Domain templates (additive, optional via --domain=...)

  • legal, code, sales, research, finance
  • medical — defaults to redacting PHI/PII; user is asked once with redact-by-default; DIGEST/JSON sidecars always redact regardless of choice

Safety

  • Hard cap: 200 files per pack
  • Never writes outside .context/
  • Never modifies source files
  • PHI/PII never leaks into shareable artifacts (DIGEST, GLOSSARY, JSON) without explicit per-run override

Provenance

Built incrementally through a long-form session, refined through one real run on a 7-PDF German legal corpus. The first run surfaced four spec bugs that v0 missed (PDF skip rule, citation format, red-team threshold, anchor prompt) — all fixed in this release.

A subsequent Codex adversarial review caught four more (PHI leak in medical mode, stale dependent notes in diff mode, wrong subagent skill path, PDF citation gate mismatch) — all also fixed before this release.

Install

git clone https://github.com/googlarz/deep-context.git ~/.claude/skills/deep-context

Then in any Claude Code session: pass a folder path with phrasing like "scan this folder" or "build context for <path>".

See README for full usage.

Limitations

  • ≤200 files per pack (beyond that, use a retrieval-based approach)
  • PDF support requires pdfinfo (poppler-utils) — brew install poppler on macOS
  • Quality depends on the model running the skill

What's next

The spec is at the point of diminishing returns from desk design. Next improvements should come from running on different corpus types (code, transcripts, research notes), not more spec edits. PRs welcome.