> 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="https://295337183-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9aroNmDWVJAmMjkdy0hx%2Fuploads%2F8miCiIiUaR4eDxZxVCPc%2Fimage.png?alt=media&amp;token=034a3959-4d9e-4e0d-876a-4d1f00f5726d" alt=""><figcaption></figcaption></figure>

  * Select one or more connected repositories.

  <figure><img src="https://295337183-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9aroNmDWVJAmMjkdy0hx%2Fuploads%2F7B3rGACYDnsIpsSzrKX3%2Fimage.png?alt=media&amp;token=d06dd9ed-630e-451c-b6c3-e7e435b2e6b2" alt=""><figcaption></figcaption></figure>

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

  <figure><img src="https://295337183-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9aroNmDWVJAmMjkdy0hx%2Fuploads%2FEFHbc6MYEErZjTmfMcG7%2Fimage.png?alt=media&amp;token=c1338651-de37-403b-98ae-04005eb3579c" 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="https://295337183-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9aroNmDWVJAmMjkdy0hx%2Fuploads%2FVqENmRAj8TSmOtHpEM13%2Fimage.png?alt=media&amp;token=9c5207ea-cf02-463c-8130-daab82c91716" 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="https://295337183-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9aroNmDWVJAmMjkdy0hx%2Fuploads%2FkuOL4a3eIAdD6Cbng8vh%2Fimage.png?alt=media&amp;token=240d0f5d-5cd2-4a31-a846-c1ef729f3203" alt=""><figcaption></figcaption></figure>

  * Clear selection option to reset selections.

  <figure><img src="https://295337183-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9aroNmDWVJAmMjkdy0hx%2Fuploads%2FxDcX9zuk3Xo25UfJZtWd%2Fimage.png?alt=media&amp;token=8f001493-120e-4fb1-b9ab-43f3125425a7" alt=""><figcaption></figcaption></figure>

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

  <figure><img src="https://295337183-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9aroNmDWVJAmMjkdy0hx%2Fuploads%2FiuaxvH2JLskIUz6TIdIW%2Fimage.png?alt=media&amp;token=6197e213-844a-454f-9155-aede4712599b" 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="https://295337183-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9aroNmDWVJAmMjkdy0hx%2Fuploads%2FDAPLue2C3R6Xz4BoqLHe%2Fimage.png?alt=media&amp;token=246ca945-18dc-451f-8a6e-ea244d3f58d4" 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="https://295337183-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9aroNmDWVJAmMjkdy0hx%2Fuploads%2FM3CbzQcrPot8LsLY4eRK%2Fimage.png?alt=media&amp;token=dc6186fc-3bba-4ccd-9d5f-5d89faeea03d" alt=""><figcaption></figcaption></figure>

  * Clear selection option to reset selections.

  <figure><img src="https://295337183-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9aroNmDWVJAmMjkdy0hx%2Fuploads%2FHtYsxdAoYgVdEtlY5I0X%2Fimage.png?alt=media&amp;token=06cd084e-87ac-4692-b282-a2470ce370d6" 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="https://295337183-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9aroNmDWVJAmMjkdy0hx%2Fuploads%2FAyByk3ZI6y0auypUE71z%2Fimage.png?alt=media&amp;token=b7223350-490a-4d21-b047-0f358dc8385c" 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="https://295337183-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9aroNmDWVJAmMjkdy0hx%2Fuploads%2FE2Ci6TgLck3SSIdKWaSV%2Fimage.png?alt=media&amp;token=1e8c1814-f688-4e95-88cb-a6d31da4942a" 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.
