> For the complete documentation index, see [llms.txt](https://docs.walnutai.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.walnutai.ai/core-features/gap-analysis/phase-2-missing-story-detection.md).

# Phase 2: Missing Story Detection

**Phase 2:** Missing Story Detection identifies functionality that exists in the codebase but is not documented as user stories. WalnutAI also validates existing stories to assess coverage and provides AI-driven suggestions for improving and updating them. In this phase, the code acts as the baseline, and WalnutAI detects undocumented or incomplete requirement coverage.

* **Before starting the analysis:**
  * The project must be connected to one or more repositories.
  * Ensure the repositories were properly integrated during project creation.
  * The codebase from the selected repositories will be used as the reference for comparison against existing user stories.
* **To start the analysis:**

  * Click **Start Analysis**&#x20;

  <figure><img src="/files/ZzWNE4HZDNolNZW0L68F" alt=""><figcaption></figcaption></figure>

  * Select one or more connected repositories.

  <figure><img src="/files/lS3pyuefW0etizdRldK5" alt=""><figcaption></figcaption></figure>

  * Click **Start Analysing** to begin evaluation.

  <figure><img src="/files/q5xQXrx6cBx9t0SfwlrP" alt=""><figcaption></figcaption></figure>
* **During analysis:**

  * WalnutAI scans the selected repository and branch.
  * It compares implemented code with documented user stories.
  * It identifies functionality implemented in code but not documented as a story.
  * It detects stories that require corrections or acceptance criteria improvements.
  * It enhances acceptance criteria to fully reflect implemented behaviour.
  * It generates new user story suggestions for uncovered features.

  <figure><img src="/files/NlavSUJCtI7IAymX1Hx1" alt=""><figcaption></figcaption></figure>
* **After the analysis completes, the dashboard displays:**
  * **Stories Analysed** – Total number of stories reviewed.
  * **Corrections Needed** – Stories requiring refinement.
  * **Missing Stories** – Undocumented features detected from code.
  * **High Priority** – Critical missing or impacted stories.
* **In the Analysis Results section:**
  * Separate tabs for **Corrected Stories** and **Missing Stories** with respective counts.
* **For Corrected Stories:**

  * Click on Option to **Select All** or select individual stories and directly  **Apply Correction** using the **Apply Correction** action.

  <figure><img src="/files/r9kGa72pkLA3b3Tb2zZQ" alt=""><figcaption></figcaption></figure>

  * Clear selection option to reset selections.

  <figure><img src="/files/g7bs3AHkfVnad2IwHK8h" alt=""><figcaption></figcaption></figure>

  * Click on Story for Side-by-side comparison of **Original** and **Corrected** versions.

  <figure><img src="/files/R9b5wTRFKfxtQENRZoBD" alt=""><figcaption></figcaption></figure>

  * &#x20;Updated Title, Description, and Acceptance Criteria suggested by Walnut AI.
  * &#x20;Highlighted improvements in acceptance criteria coverage.
  * &#x20;Confidence percentage indicating alignment strength.
  * &#x20;**AI Reasoning** explaining why corrections are recommended.

  <figure><img src="/files/8WOPcTNEeWlAj6giW63j" alt=""><figcaption></figcaption></figure>
* **For Missing Stories:**

  * Click on Option to **Select All** or select individual stories and directly create user stories using the **Create Story** action.

  <figure><img src="/files/JTXGXPV0Njuiq8qKOvjT" alt=""><figcaption></figcaption></figure>

  * Clear selection option to reset selections.

  <figure><img src="/files/1olMOaGpmWfY1LhekZoV" alt=""><figcaption></figcaption></figure>

  * Suggested story title derived from code behaviour.
  * Priority level (e.g., High).
  * The **Confidence Score** indicates how strongly the detected functionality aligns with the suggested or corrected user story based on Walnut AI’s semantic and structural analysis.
  * **Functionality Description** generated from implementation.
  * **Suggested Acceptance Criteria** based on detected logic.
  * **Related Code Files** showing impacted source files.

  <figure><img src="/files/62bz7PFrhAgHRo6VnDpZ" alt=""><figcaption></figcaption></figure>
* Click **Run New Analysis** to scan the updated codebase and user stories again, ensuring newly implemented features and recent changes are reflected in the analysis results

<figure><img src="/files/PebDDINSFArxOJ62vS6d" alt=""><figcaption></figcaption></figure>

Phase 2 ensures implemented features are fully documented, improves requirement and acceptance criteria quality, maintains code-to-requirement traceability, and keeps documentation aligned with actual system behaviour while preventing undocumented development.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.walnutai.ai/core-features/gap-analysis/phase-2-missing-story-detection.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
