fix: make codemap's model of agent sessions truthful - #84
Open
JordanCoin wants to merge 1 commit into
Open
Conversation
Five accuracy fixes, each driven by a failing test captured from running codemap on its own repo during a real agent session: - Resolver: Go imports that aren't relative or under the module path are stdlib/third-party and no longer fall through to fuzzy suffix matching. Previously stdlib "context" resolved to cmd/context.go (and "embed" to skills/embed.go), fabricating hub status. Also slash-normalize Go package index keys so module lookups work on Windows. - Hubs: hub status now counts only non-test importers, and test files never rank as hubs (mcp/main_test.go was a "top-5 hub"). Centralized in scanner.HubThreshold/CountHubImporters/IsTestFile and applied across CLI, hooks, and MCP surfaces. - Intent: zero/low-confidence classifications no longer emit intent markers or "Next codemap:" advice (a PR-merge prompt used to get feature-work advice from a confidence-0 guess). New vcs category recognizes merge/review/release workflows and suggests --diff instead. - Provenance: the post-edit hook records agent edits to .codemap/agent_edits.jsonl; working-set and session-progress output now separate "this agent edited" from "changed on disk", so git merges and checkouts observed by the watch daemon stop being reported as 25 files the agent supposedly edited. - CLI: --importers explains empty results (same-package Go files never import each other) without leaking into token-budgeted blast-radius bundles; bare-word typos like 'codemap drift' get a friendly error; --help lists all subcommands; config init stops auto-including runtime residue extensions (log, pid, gitignore, ...). Cross-platform: verified with GOOS=windows and GOOS=linux builds; new code uses filepath/ToSlash normalization and O_APPEND-safe logging throughout. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Summary
Five accuracy fixes, all TDD (failing test first), all sourced from running codemap on its own repo during a real agent session and catching it being wrong:
scanner/astgrep.go's stdlib"context"import was resolving tocmd/context.go, fabricating its 10-importer hub status (same for"embed"→skills/embed.go, rendered as a self-edge in--deps). Go package index keys are now slash-normalized so module lookups also work on Windows.mcp/main_test.gowas a "top-5 hub"). Centralized inscanner.HubThreshold/CountHubImporters/IsTestFile, applied across CLI, hooks, and MCP.Next codemap:advice. A PR-merge prompt previously gotcategory: feature, confidence: 0plus "runcodemap --deps— feature work tends to cross existing dependencies". Newvcscategory recognizes merge/review/release prompts and suggests--diff..codemap/agent_edits.jsonl); working-set/session output now separates "this agent edited" from "changed on disk". Agit mergeobserved by the watch daemon no longer reports as "25 files edited (+649 lines in watch/events.go)".--importersexplains empty results (same-package Go files never import each other) while blast-radius bundles keep omitting empty sections;codemap driftsays "path does not exist, see --help" instead oflstat drift;--helplists every subcommand;config initstops auto-includinglog/pid/gitignore-class residue.After this change, codemap-on-codemap reports exactly one hub —
internal/buildinfo/version.go— which is the true answer.Type of change
Verification
go test -race ./...green on macOSGOOS=windowsandGOOS=linuxbuilds pass; new code usesfilepath/ToSlashnormalization and O_APPEND-safe appends only🤖 Generated with Claude Code