Feature Context Analysis
Purpose
Two things go wrong when this phase is skipped.
The agent asks the user questions the code answers, spending the user's attention on facts and
then having none left for the decisions only the user can make. Or the agent builds in a style
the codebase does not use — a second HTTP client, a third validation approach, an abstraction
that already exists two packages away — and the review is about the shape of the code rather
than about whether the feature is right.
The output is a context report: findings cite evidence and distinguish observation, inference
and unresolved questions. "Not found in this sweep" is bounded search evidence, not proof of
absence throughout the system.
Workflow
- Scope the sweep to the feature. Read what the feature will plausibly touch and one ring
around it. A whole-repository survey costs more than it returns and produces a report nobody
uses.
If the feature is too ambiguous to select relevant paths, ask the smallest scope question;
repository investigation does not require delaying a question only the user can answer.
- Work the checklist in
references/investigation-checklist.md — build, dependencies,
layering, persistence, messaging, configuration, security, observability, testing, delivery.
Relevant concerns get a finding, bounded "not found", "not examined" or "unavailable".
- Cite everything.
path:line, a dependency coordinate with its version, or the command
and what it printed. A finding with no citation goes in as an assumption or not at all.
- Close the unknowns it can close. Walk the discovery ledger and mark each unknown this
sweep answered, with the evidence. This is the phase's main product.
- List reusable components by name and location, with what each would have to change.
- List the conflicts — anything in the request that the codebase makes awkward, expensive
or impossible, and what the code says about why.
- Label every technology finding as observed, never as required. That distinction is the
whole reason the report is trustworthy.
- Preserve traceability. Assign or reuse
F-* for evidence and resolve U-* by appending the
fact/source; name the input feature revision so later baseline changes can invalidate findings.
Reuse the existing ledger when present; otherwise concise inline IDs/unknowns are enough.
Record repository revision and relevant working-tree changes as well as the feature input.
Decision rules
IF a pattern appears repeatedly
THEN report instances, independent contexts, counter-examples and declared/enforced policy.
Repetition alone does not establish authority or decide this feature's design.
IF a pattern appears once
THEN it is evidence of that instance, possibly the closest relevant precedent;
explain its scope without generalising it to the whole project.
IF a technology is declared but no direct source use was found
THEN distinguish declared, resolved for the target configuration and observed active use.
Check configuration, auto-configuration, generated code and reflective loading when relevant;
absence of imports does not prove it unused or available on the target runtime.
IF no implementation was found in the inspected scope
THEN state paths, search terms and limits; deployment/platform behavior may live elsewhere.
Report "not found here", not "the project does not need it".
IF the feature needs a capability and something close already exists
THEN name it, say precisely what it lacks, and let the decision phase choose between
extending it and adding a second one.
IF version-specific API behaviour matters
THEN inspect compiler release/toolchain and resolved dependency evidence for the relevant
module/profile/configuration, including parents/BOMs/constraints and runtime image.
If resolution is unavailable, label the declared version and leave behavior conditional.
Preserve target versions rather than upgrading them to fit an API.
Constraints
- Observation is not authorisation. "The project uses Kafka" is a fact about the project.
"This feature will use Kafka" is a decision, and it is not this phase's to make.
- Do not infer a standard from a majority. Consistency across a codebase can mean a
standard, a template, or one person who wrote most of it. The report says how many places and
whether there is a counter-example; it does not conclude.
- Do not report what you did not read. "The codebase appears to use X" without a path is
the failure mode this phase exists to prevent.
- Do not fix anything. Defects found during the sweep are reported, not repaired — they are
either in scope, in which case the scope phase adds them, or they are someone else's change.
Output
Existing architecture <shape, with the paths that show it>
Input revisions <Product/Engineering or Tech Feature revision IDs>
Relevant modules <path -> what it owns>
Relevant components <name, path, what it does>
Existing patterns <pattern, count, counter-examples>
Existing technologies <name, version, where used, observed>
Reusable components <name -> what it would need>
Potential conflicts <request item vs what the code makes hard, with evidence>
Constraints from the code <enforced/documented requirement vs change cost, with evidence>
Questions answered <U-* -> F-*, evidence>
Still unknown <U-nn, search limits/access gaps, smallest next evidence or question>
Scale the report to the feature: omit irrelevant rows and reuse existing artifacts. Before handing
off, verify cited paths match the current revision and each resolved unknown is actually supported.
Do not mark a product decision answered merely because one implementation was found.
1---2name: feature-context-analysis3description: Reading the repository for one specific feature: which technologies and patterns are actually present, which components the feature can reuse, which questions the code has already answered, and — stated as findings rather than silence — which it has not. Use when a scoped feature needs repository evidence before clarification or technology selection, when it is about to be built in a style the codebase does not use, when "the project uses X" is being asserted without a path, when an abstraction is about to be created that already exists, or when picking up a codebase you have not read. Does not decide whether a found technology may be used for this feature (feature-decision-analysis), does not enumerate what the change will touch (feature-architecture-analysis), and is not a general method for reading an unfamiliar enterprise codebase (enterprise-application-architecture) or auditing it for defects (java-code-smells).4---56# Feature Context Analysis78## Purpose910Two things go wrong when this phase is skipped.1112The agent asks the user questions the code answers, spending the user's attention on facts and13then having none left for the decisions only the user can make. Or the agent builds in a style14the codebase does not use — a second HTTP client, a third validation approach, an abstraction15that already exists two packages away — and the review is about the shape of the code rather16than about whether the feature is right.1718The output is a **context report**: findings cite evidence and distinguish observation, inference19and unresolved questions. "Not found in this sweep" is bounded search evidence, not proof of20absence throughout the system.2122## Workflow23241. **Scope the sweep to the feature.** Read what the feature will plausibly touch and one ring25 around it. A whole-repository survey costs more than it returns and produces a report nobody26 uses.27 If the feature is too ambiguous to select relevant paths, ask the smallest scope question;28 repository investigation does not require delaying a question only the user can answer.292. **Work the checklist** in `references/investigation-checklist.md` — build, dependencies,30 layering, persistence, messaging, configuration, security, observability, testing, delivery.31 Relevant concerns get a finding, bounded "not found", "not examined" or "unavailable".323. **Cite everything.** `path:line`, a dependency coordinate with its version, or the command33 and what it printed. A finding with no citation goes in as an assumption or not at all.344. **Close the unknowns it can close.** Walk the discovery ledger and mark each unknown this35 sweep answered, with the evidence. This is the phase's main product.365. **List reusable components** by name and location, with what each would have to change.376. **List the conflicts** — anything in the request that the codebase makes awkward, expensive38 or impossible, and what the code says about why.397. **Label every technology finding as observed**, never as required. That distinction is the40 whole reason the report is trustworthy.418. **Preserve traceability.** Assign or reuse `F-*` for evidence and resolve `U-*` by appending the42 fact/source; name the input feature revision so later baseline changes can invalidate findings.43 Reuse the existing ledger when present; otherwise concise inline IDs/unknowns are enough.44 Record repository revision and relevant working-tree changes as well as the feature input.4546## Decision rules4748```text49IF a pattern appears repeatedly50THEN report instances, independent contexts, counter-examples and declared/enforced policy.51 Repetition alone does not establish authority or decide this feature's design.5253IF a pattern appears once54THEN it is evidence of that instance, possibly the closest relevant precedent;55 explain its scope without generalising it to the whole project.5657IF a technology is declared but no direct source use was found58THEN distinguish declared, resolved for the target configuration and observed active use.59 Check configuration, auto-configuration, generated code and reflective loading when relevant;60 absence of imports does not prove it unused or available on the target runtime.6162IF no implementation was found in the inspected scope63THEN state paths, search terms and limits; deployment/platform behavior may live elsewhere.64 Report "not found here", not "the project does not need it".6566IF the feature needs a capability and something close already exists67THEN name it, say precisely what it lacks, and let the decision phase choose between68 extending it and adding a second one.6970IF version-specific API behaviour matters71THEN inspect compiler release/toolchain and resolved dependency evidence for the relevant72 module/profile/configuration, including parents/BOMs/constraints and runtime image.73 If resolution is unavailable, label the declared version and leave behavior conditional.74 Preserve target versions rather than upgrading them to fit an API.75```7677## Constraints7879- **Observation is not authorisation.** "The project uses Kafka" is a fact about the project.80 "This feature will use Kafka" is a decision, and it is not this phase's to make.81- **Do not infer a standard from a majority.** Consistency across a codebase can mean a82 standard, a template, or one person who wrote most of it. The report says how many places and83 whether there is a counter-example; it does not conclude.84- **Do not report what you did not read.** "The codebase appears to use X" without a path is85 the failure mode this phase exists to prevent.86- **Do not fix anything.** Defects found during the sweep are reported, not repaired — they are87 either in scope, in which case the scope phase adds them, or they are someone else's change.8889## Output9091```text92Existing architecture <shape, with the paths that show it>93Input revisions <Product/Engineering or Tech Feature revision IDs>94Relevant modules <path -> what it owns>95Relevant components <name, path, what it does>96Existing patterns <pattern, count, counter-examples>97Existing technologies <name, version, where used, observed>98Reusable components <name -> what it would need>99Potential conflicts <request item vs what the code makes hard, with evidence>100Constraints from the code <enforced/documented requirement vs change cost, with evidence>101Questions answered <U-* -> F-*, evidence>102Still unknown <U-nn, search limits/access gaps, smallest next evidence or question>103```104105Scale the report to the feature: omit irrelevant rows and reuse existing artifacts. Before handing106off, verify cited paths match the current revision and each resolved unknown is actually supported.107Do not mark a product decision answered merely because one implementation was found.