Turn any requirements doc or gap analysis into ServiceNow epics and stories, powered by your AI of choice via LiteLLM.
Writing a gap analysis or PRD is one thing. Manually translating it into dozens of epics and user stories in ServiceNow is another matter entirely: tedious, time-consuming, and error-prone.
This tool bridges that gap. Give it any document (a gap analysis, a product requirements doc, a feature list) and it uses AI to extract the intent, structure it into epics and user stories, and push them directly into your ServiceNow Agile 2.0 product, ready for refinement, estimation, and sprint planning.
The workflow fits however you prefer to work. You can run the scripts from a terminal, or use your IDE's integrated terminal and edit the intermediate stories.json file in the editor before pushing to ServiceNow. The two-step design is intentional: AI does the heavy lifting, you stay in control of what actually gets created.
Requirements rarely start as a clean document. They live in meeting recordings, Miro boards, Figma files, Confluence pages, email threads, and whiteboard photos. Today's AI tools make it easier than ever to consolidate that scattered input into a coherent requirements doc or gap analysis: summarise a transcript, describe a wireframe, pull together notes from multiple sources.
Once you have that document, this tool takes over: turning it into a structured, reviewable backlog in ServiceNow with minimal manual effort. Think of it as the last mile between "we know what we need to build" and "it's in the backlog and ready to plan."
1. analyze_doc.py --input <doc> → stories.json (AI step)
2. create_stories.py → ServiceNow (API step)
Step 1 sends your document to an AI model, which produces a structured stories.json file containing epics and user stories.
Step 2 reads stories.json and pushes the records to your ServiceNow instance via the Table API.
stories.json is intentionally a human-readable intermediate file. Open it in your editor, review the output, make any adjustments, then run step 2.
Python 3.9+ is required. On macOS and Linux, the command is typically python3. On Windows it is usually python. Verify your version with:
python3 --versionpip is the standard Python package installer and is included with Python 3.4+. If it is missing, run:
python3 -m ensurepip --upgradeIt is recommended to use a virtual environment to keep dependencies isolated:
python3 -m venv .venv
source .venv/bin/activate # macOS / Linux
.venv\Scripts\activate # WindowsThen install the dependencies:
pip install litellm requests pyyaml python-dotenv| Package | Used by | Purpose |
|---|---|---|
litellm |
analyze_doc.py |
Model-agnostic AI gateway, normalises calls across Anthropic, OpenAI, Gemini, and others |
requests |
create_stories.py |
HTTP client for the ServiceNow Table API |
pyyaml |
both | Reads schema.yaml |
python-dotenv |
both | Loads credentials from .env into the environment |
1. Copy the example env file and fill in your values:
cp .env.example .env
2. Configure ServiceNow connection (in .env):
SERVICENOW_INSTANCE=https://your-instance.service-now.com
SERVICENOW_PRODUCT_SYS_ID=your_product_sys_id_here3. Choose an auth method (in .env):
OAuth 2.0 (default):
SERVICENOW_AUTH=oauth
SERVICENOW_CLIENT_ID=your_client_id
SERVICENOW_CLIENT_SECRET=your_client_secretBasic auth:
SERVICENOW_AUTH=basic
SERVICENOW_USERNAME=your_username
SERVICENOW_PASSWORD=your_password4. Configure an AI model (in .env):
AI_MODEL=claude-sonnet-4-6
ANTHROPIC_API_KEY=sk-ant-...If AI_MODEL is not set, the script auto-detects from whichever API key is present. Supported providers via LiteLLM: Anthropic, OpenAI, Google Gemini, Azure OpenAI, Mistral, Cohere, and more.
Step 1: Analyse your document
Run analyze_doc.py with the path to your input file (from your terminal or IDE integrated terminal):
python scripts/analyze_doc.py --input path/to/GAP_ANALYSIS.mdThis generates scripts/stories.json. Open it in your editor, review the epics and stories the AI produced, and make any edits before continuing.
Step 2: Push to ServiceNow
# Preview what would be created (no API calls made):
python scripts/create_stories.py --dry-run
# Create all epics and stories:
python scripts/create_stories.py
# Update content on already-created stories (matched by title):
python scripts/create_stories.py --updatescripts/schema.yaml is the single config file for everything structural. Edit it to customise behaviour without touching the scripts:
| Section | What it controls |
|---|---|
tables |
Target ServiceNow table names (rm_epic / rm_story by default) and field definitions |
priorities |
Human-readable priority keys → ServiceNow numeric values, plus guidance injected into the AI prompt |
ai.instructions |
Prompt instructions for how the AI groups epics, formats stories, and writes acceptance criteria |
This project is intentionally minimal. Fork it and tailor it to your workflow:
- Different tables? Update
tablesinschema.yamlto target any ServiceNow table, not justrm_epic/rm_story. - Different fields? Add or remove entries under
tables.epic.fieldsandtables.story.fieldswith no code changes needed. - Different priorities? Edit the
prioritiessection to match your team's values and ServiceNow field options. - Different AI behaviour? Tweak the
ai.instructionssection inschema.yamlto change how epics are grouped, how stories are written, or what acceptance criteria look like. - Different input format? The scripts accept any plain text file: markdown, plain text, CSV exports, whatever your team produces.
| File | Purpose |
|---|---|
scripts/analyze_doc.py |
Step 1: AI analysis, writes stories.json |
scripts/create_stories.py |
Step 2: ServiceNow API, reads stories.json |
scripts/schema.yaml |
Shared config for tables, priorities, and AI instructions |
.env.example |
Template for credentials, copy to .env |
scripts/stories.json |
Generated intermediate file (gitignored) |