Codemap
Codemap is structured repository knowledge in qp.yaml: package purpose, key types, entry points, conventions, and glossary terms.
It powers:
qp explain- richer
qp contextoutput - better planning/agent brief relevance
Codemap Structure
codemap:
packages:
internal/runner:
desc: Core task execution engine
key_types: [Runner, Result, EventStream]
entry_points: [Run]
conventions:
- Keep stdout/stderr handling deterministic for tests
depends_on: [internal/config]
conventions:
- Keep task names verb-first and user-facing
glossary:
guard: Validation bundle that always evaluates all configured checksQuerying With qp explain
qp explain accepts:
- task names (or aliases)
- codemap package names
- codemap key type / entry point names
- glossary terms
qp explain check
qp explain internal/runner
qp explain Runner
qp explain guard
qp explain internal/runner --jsonThis gives maintainers and agents a shared semantic lookup path instead of hunting through source manually.
Inferring A Starter Codemap
Generate an initial codemap block:
qp init --codemapInference scans source directories and supports multiple ecosystems (Go, Python, JS/TS, Rust, Java, C/C++).
It appends an inferred codemap.packages section to qp.yaml if one does not already exist.
Practical Refinement Workflow
- Run
qp init --codemap. - Trim noisy/inaccurate inferred entries.
- Add missing domain vocabulary to
glossary. - Add conventions that should influence code review and agent behavior.
- Keep codemap updated as architecture evolves.
Worked Example: Domain-Mapped Repo
codemap:
packages:
internal/features/profile:
desc: Data profile analysis and reporting
key_types: [Service, ProfileResult]
entry_points: [Run]
depends_on: [internal/platform/duckdb]
internal/features/validate:
desc: Config and workbook validation
key_types: [Validator]
entry_points: [Validate]
glossary:
profile: Statistical summary of dataset characteristics
drift: Divergence between baseline and target distributionsNow:
qp explain profile
qp explain internal/features/profileBoth humans and automation can quickly resolve domain intent.
Relationship To Scopes
Scopes answer “where should changes happen?”
Codemap answers “what do these areas mean?”
Use both together for high-signal planning and repair flows.
Next Step
For change-intent generation tied to files and task/scopes, continue to Planning.