Documentation
¶
Overview ¶
Package repo implements BroCode's deterministic project intelligence layer: a repo map (entry points, structure, hot files) built without the LLM, and cross-session usage tracking ("the more BroCode is used, the smarter it gets"). Both persist under .brocode/ and are injected into the system prompt so every session starts warm without spending tokens on re-discovery.
- RepoMap: tree (depth-2) + entry points, built deterministically from the filesystem, cached to .brocode/repo-map.json keyed by a content hash of the file list — rebuilt only when the project actually changes.
- Usage: counts how often each file is read/edited per session, aggregated across sessions in .brocode/usage.json, so warm starts can prioritize the files the team actually works on (not just the ones the LLM guessed).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Map ¶
type Map struct {
// Tree is a compact depth-2 directory listing (relative paths).
Tree []string `json:"tree"`
// EntryPoints are the files/commands a developer reaches for first
// (main.go, package.json bin, cmd/, index.ts, ...).
EntryPoints []string `json:"entry_points"`
// HotFiles are the top-N files by usage frequency ("" when no usage yet).
HotFiles []string `json:"hot_files"`
// Hash is the content hash of the file list this map was built from.
Hash string `json:"hash"`
}
Map is the deterministic project map: a depth-2 tree plus detected entry points and the most-used files (from cross-session usage).
func BuildMap ¶
BuildMap walks the workspace and produces a deterministic Map, honoring the cache: when the file-list hash matches the cached map's hash it is returned as-is (no re-scan). Usage is merged in so hot files reflect the latest cross-session counts. Returns nil when the workspace is unusable.
type Usage ¶
type Usage struct {
// contains filtered or unexported fields
}
Usage counts how often each file was read or edited across sessions, so warm starts can prioritize what the team actually works on. Persisted to .brocode/usage.json; counts decay slowly so long-gone hotspots fade.