feat(apply,verify): validate-then-fetch freshness check to cut context bloat#5
Open
thekkagent wants to merge 5 commits into
Open
feat(apply,verify): validate-then-fetch freshness check to cut context bloat#5thekkagent wants to merge 5 commits into
thekkagent wants to merge 5 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
/beat:applyand/beat:verifyre-read all spec artifacts (and often whole source files) every time the skill is entered, with no freshness check. In long, iterative runs (apply → verify → fix → re-verify …) within a single resumed session, this fills the model's context with duplicate copies of unchanged files — driving cost up, recall down (context rot), and eventually forcing lossy compaction. The recipe is optimized for cold start; run warm/resumed, the always-refetch assumption mismatches and the reads become redundant.Approach
Treat the filesystem/git as the source of truth and the in-context copy as a cache — validate-then-fetch instead of always-refetch. Pure instruction edits to two skills (no runtime code, no schema changes, no new reference doc).
applygit status --short beat/changes/<name>/and re-read only what changed, reusing the in-context copy otherwise.offset/limit) when reorienting on a large unchanged file.git statusshows unchanged but the content can't be recalled (likely compacted away), re-read it — targeted, not blind whole-file.verifystatus.yaml,config.yaml) and collects artifact paths instead of reading large artifacts into context.verification-subagent-prompt.mdupdated so the subagent reads them itself (more independent — raw disk, no transcription drift; also prompt-cache safe).code-reviewer-prompt.mdalready took paths/git-range — no change.Testing
node scripts/sync-references.mjs --check(references in sync) and content-presence checks across all edited skills.tests/skill-content/test-apply-enforcement.sh(+2 assertions) andtest-verify-enforcement.sh(+1 assertion) added for the new rules. These run viaclaude -pheadless and should be exercised in CI.Non-goals
No persisting validators (hash/SHA) into
status.yaml; no changes toplan/design/distill/archive/explore(run ~once per change, marginal payoff); no runtime scripts.🤖 Generated with Claude Code