feat(prompts): disable squint features when repo has no .squint.db#947
feat(prompts): disable squint features when repo has no .squint.db#947zbigniewsobiecki merged 2 commits intodevfrom
Conversation
nhopeatall
left a comment
There was a problem hiding this comment.
Summary
Clean, well-structured feature flag for disabling squint instructions when no .squint.db is present. The plumbing is correct, templates are properly gated, tests are thorough, and all CI checks pass.
Should Fix (non-blocking)
- src/agents/prompts/templates/review.eta:16 — The Philosophy section still says "Use squint to see the forest, not just the trees" without a
squintEnabledgate. WhensquintEnabled=false, the agent sees a reference to squint with no context on what it is. Consider gating this or rephrasing to something tool-agnostic. Same applies to the review body format example on lines 230-231 ("...with squint evidence") — these create dangling references to a tool the agent can't use.
Notes
- The
squint-explorationpartial's internal gating (<% if (it.squintEnabled) { %> ... <% } else { %> ... <% } %>) means the 4 templates that only include it without additional inline squint text (respond-to-pr-comment,respond-to-ci,respond-to-review,resolve-conflicts) are already correctly handled — no changes needed there. - The
undefinedargument fordebugContextinadapter.ts(line 165) is clean positional passing for the newrepoDirparameter. - Adding
SQUINT_DB_PATHto codex and opencode env filters completes parity with claude-code. - Tests are thorough: all 3 code paths (
repoDirwith DB,repoDirwithout DB, norepoDir) are covered, plus template rendering assertions for both enabled/disabled states across all gated templates.
🕵️ claude-code · claude-opus-4-6 · run details
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
@aaight address code review concerns |
…y and body format Gate the "Use squint to see the forest, not just the trees" line in the Philosophy section and the "...with squint evidence" examples in the review body format template behind squintEnabled checks, addressing the remaining ungated squint references flagged in code review. Also adds test assertions to cover the Philosophy section gating and the body format example gating. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Addressed the code review concerns from @nhopeatall — both dangling squint references in
Also extended
All 82 tests pass, lint and type checks clean. 🕵️ claude-code · claude-sonnet-4-6 · run details |
nhopeatall
left a comment
There was a problem hiding this comment.
Summary
LGTM — Clean, well-scoped feature flag that gates squint instructions in agent prompts based on .squint.db availability. The implementation is correct, consistent, and well-tested.
Review Notes
Architecture: The approach is sound — computing squintEnabled in buildPromptContext and passing it through the template context is the right abstraction level. The partial squint-exploration.eta is self-gated, so the 4 templates that weren't modified in this PR (respond-to-pr-comment, respond-to-review, resolve-conflicts, respond-to-ci) correctly get the fallback behavior via the partial's own conditional.
Correctness verified:
adapter.tspassesundefinedfordebugContext(5th arg) to reachrepoDir(6th arg) — matches the function signatureresolveSquintDbPathis called aftersetupRemoteSquintDbin the execution pipeline (line 180 vs 199 inexecutionPipeline.ts), so remote DB downloads are picked up correctly- Template
elsebranches provide sensible fallback instructions (ListDirectory, ReadFile, RipGrep, etc.) squintEnabled: undefined(default when not provided) is falsy in Eta templates, so existing call sites that don't pass the flag get the non-squint path — safe default- Env filter additions for codex/opencode match the existing claude-code pattern
Test coverage: Thorough — both promptContext.test.ts (5 cases covering true/false/undefined/no-call) and prompts.test.ts (20+ cases covering all template×flag combinations) are solid.
All CI checks pass (lint, typecheck, tests, integration tests).
🕵️ claude-code · claude-opus-4-6 · run details
Summary
squintEnabledflag toPromptContext— computed fromresolveSquintDbPath()inbuildPromptContext, passed viarepoDirparameter fromadapter.tsimplementation.eta,planning.eta,splitting.eta,review.eta,respond-to-planning-comment.eta+ partialssquint-exploration.etaandtmux.etaall conditionally render squint content only whensquintEnabled: trueSQUINT_DB_PATHto codex and opencode env filters — so squint database path passes through when available (previously only claude-code had it)Fixes: https://trello.com/c/dG1f8dXj/467-disable-all-squint-features-when-repo-has-no-squintdb-file
What was changed
PromptContext plumbing (
src/agents/prompts/index.ts,src/agents/shared/promptContext.ts,src/backends/adapter.ts)squintEnabled?: booleantoPromptContextinterface andgetTemplateVariables()return listrepoDir?: stringparam tobuildPromptContext()— computessquintEnabled: repoDir ? resolveSquintDbPath(repoDir) !== null : falseadapter.tsnow passesrepoDirtobuildPromptContext()(it was already available as a parameter)Template gating (7 files)
partials/squint-exploration.eta— wrapped entire squint protocol in<% if (it.squintEnabled) { %>with a fallback "no Squint database" messagepartials/tmux.eta— gatedsquint-modules/squint-featuressession name examplesimplementation.eta— gated Phase 1 squint drill-down and Phase 3squint symbols listinstructionplanning.eta— gated squint repo grounding instructions (steps 2-6)splitting.eta— gated squint repo grounding instructions (steps 2-6)review.eta— gated Phase 1 squint overview, "Squint for Conflict Detection" section, strategic questions with squint refs, severity level squint refs, anti-patterns squint refrespond-to-planning-comment.eta— gated squint exploration instructions (steps 3-6)Env filters (
src/backends/codex/env.ts,src/backends/opencode/env.ts)SQUINT_DB_PATHtoALLOWED_ENV_EXACTin both backends (previously only claude-code had it)Test plan
buildPromptContextwithrepoDirpointing to a repo with.squint.db→squintEnabled: truebuildPromptContextwithrepoDirpointing to a repo without.squint.db→squintEnabled: falsebuildPromptContextwithoutrepoDir→squintEnabled: false(no call toresolveSquintDbPath)squintEnabled: true→ includes squint instructionssquintEnabled: false→ no squint instructions, core instructions preservedsquint-explorationpartial fallback message shown when disabledtmuxpartial session names gated correctly🤖 Generated with Claude Code
🕵️ claude-code · claude-sonnet-4-6 · run details