workdir: promote from hint to authoritative-with-confidence + aggressive cwd-binding heuristics #4
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally filed by @coilysiren on 2026-05-14T22:28:24Z - https://github.com/coilysiren/cli-guard/issues/59
Problem
Today
workdir.Detectis described as a hint andscope.Resolveis authoritative, but the gap between them gets crossed constantly: cwd-keyed views in downstream consumers (session-lattice's plannedcwd_sessionsview, repo-recall, dispatch routing) want a specific-repo answer, and most active Claude Code sessions live at a parent path like~/projects/coilysiren/rather than a specific repo. The current signal chain (env → nearest.git→ first-segment-under-coilysiren → cwd) bottoms out at the parent for those sessions and there is no notion of confidence to gate consumers.Origin: session-lattice docs/decisions.md (CLIguard side-issue), recorded as the precondition for the
cwd_sessionsview.Proposed change
Promote
workdirfrom hint to authoritative-with-confidence. Keepscopeas the audit-row binder, but makeworkdirsomething downstream views can trust by tagging the answer with a confidence band and adding more aggressive signals above the current chain.Shape
New signals (in precedence order, above current chain)
coily bind <repo>(or equivalent) verb that pins the binding for the current shell session via$COILY_PRIMARY_DIRor a session state file under~/.coily/session/<pid-tree-key>.ConfidenceHigh.ConfidenceMediumif from session state,ConfidenceLowif reconstructed from recent-touch heuristic.ConfidenceMedium.npm,uv,pip,cargo,go,dotnet,brew), require that the resolved repo carry a matching language manifest (package.json,pyproject.toml,Cargo.toml,go.mod,*.csproj, etc.). If the resolved repo does not match the package manager, downgrade toConfidenceNoneand surface a recovery message naming the manifest mismatch. This is a gate, not a separate signal: it post-filters the answer the other signals produced.Existing signals remain, with confidence tags
SourceEnv→ConfidenceHighSourceGit→ConfidenceMediumSourceCoilysiren→ConfidenceLow(this is exactly the case session-lattice flagged as gutting the cwd-keyed view)SourceCWD→ConfidenceNoneBoundary considerations
ttlcache, (c) optional dependency that degrades to current behavior when unavailable. Lean toward (c) so the package stays usable in environments without repo-recall.~/.coily/session/<key>.yamlwith a short TTL.ConfidenceLoworConfidenceNoneanswers without acknowledging the downgrade. Document this in the package doc.Acceptance
workdir.Resultcarries aConfidencefield.Related
cd <path>no-op). Both touchcd-shaped behavior but the code paths do not overlap.cwd_sessionsview (blocked on this).