| name | infer-scope-from-code |
| description | Infer the v1 scope.yaml (selected / deferred / rejected capabilities plus depth caps, within-domain coverage gaps, and constraint trace) by scoring KB capabilities against scan-index.json signals during /codify. Bounds the selection to the domains already chosen in the domain-selection proposal and the profile posture from the project-profile proposal. Used exclusively by product-keeper in the /codify play. |
| version | 0.1.0 |
| user-invocable | false |
| model | sonnet |
| allowed-tools | Read, Write, Grep, Glob |
| deprecated | true |
| deprecated_note | #434 ProductOS realignment — superseded by the command model; retained for Phase E reference, not installed |
infer-scope-from-code
Called by product-keeper during /codify after infer-domain-selection-from-code and infer-project-profile-from-code complete. Produces scope/scope.yaml at {stm_base}/{issue}/evidence/codify/proposals/scope/scope.yaml.
Purpose
During /codify (brownfield bootstrap), the scope artifact that /specify normally produces via configure-capabilities (KB walk + user decisions on optional capabilities) must instead be reverse-engineered from the existing codebase. This skill consumes scan-index.json plus the two prior proposals (domain-selection, project-profile) and emits a scope proposal grounded entirely in scan-index signals. It never invents evidence, never selects a capability outside the already-chosen domains, and always surfaces low-evidence items rather than silently rejecting them.
The capability universe is bounded by the intersection of:
selected_domains from the domain-selection proposal (narrows the KB walk)
- KB capability listings under
{kb_domain_dir}/{domain}.md (enumerated as ## Features blocks with IDs and Inclusion rules)
For every KB capability inside a selected domain, this skill scores scan-index evidence and classifies the capability as selected (high/medium evidence), deferred (low evidence, scaffolds only), or rejected (zero evidence). Capabilities whose KB Inclusion rule fires on profile posture but have no scan evidence go into within_domain_coverage_gaps — the code is silent on them, not absent.
Input
Receive from product-keeper via JSON contract.
scan_index_path (path, required) — scan-index.json produced by scan-codebase.
related_proposal_paths (list, required) — must contain the absolute paths to the already-emitted domain-selection.yaml and project-profile.yaml proposals. Validation halts if either is missing.
kb_domain_dir (path, required) — core/components/memory/knowledge/domain/. Drives the capability walk.
stm_base (path, required) — STM root resolved from .garura/core/config.yaml stm.base-path.
issue (str, required) — issue number driving /codify.