> 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/intelligence-hub/generate-user-stories/code-repository-to-requirement.md).

# Code (Repository-to-Requirement)

**When to Use Code-Based Requirement Extraction:**\
Use this feature when your project requirements already exist in your code repository. Instead of manually rewriting them, the requirements are imported and organized into structured **Epics, Features, and User Stories**

* **Existing Connection:** If a repository was selected during project setup from [GitLab](/getting-started/projects/create-a-new-project/external-data-and-connections/how-to-integrate-gitlab-with-walnut.md), [GitHub](/getting-started/projects/create-a-new-project/external-data-and-connections/how-to-integrate-github-with-walnut.md), [Bitbucket](/getting-started/projects/create-a-new-project/external-data-and-connections/how-to-integrate-bitbucket-with-walnut.md), or Azure Repos, it will be available and visible under the Code option within the Intelligence Hub.
* **New Connection:** If no repo is found, click Add Repo. This redirects you to the Project Setup page to complete the link.
* **Extraction:** Once connected, the system automatically extracts Epics, Features, and User Stories from the repository.
* **Generation:** Select any user story to generate test cases.
* Click Save to store the generated Epics, Features, User Stories, and Test Cases.

{% hint style="info" %}
Result: Upon saving, items are stored in Action Items, and Test Cases populate the Test Cases page.
{% endhint %}


---

# 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/intelligence-hub/generate-user-stories/code-repository-to-requirement.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.
