---
inclusion: manual
---

# How to Build Your Customer Knowledge Base in Kiro

A step-by-step guide for AWS Account Managers to set up a local, queryable knowledge base that makes Kiro 10x more useful for territory management.

---

## What you'll end up with

A local knowledge base on your machine that lets you type one word to Kiro and instantly get:
- Salesforce Account IDs, tiers, revenue, and metadata for every account in your territory
- 12-digit AWS Account IDs mapped to each customer (required for Billing Central MCP)
- Your own meeting notes, contacts, tech stack intel, and next steps per account
- Auto-enrichment from Outlook emails and Kiro conversations over time

Once set up, Kiro stops asking you to look things up — it already knows your customers.

---

## Before you start — Prerequisites

| Requirement | Why you need it | How to check |
|---|---|---|
| **Kiro IDE** installed | Your workspace and agent | You're reading this in Kiro |
| **OneDrive** syncing | Where your source files live | Check `C:\Users\<you>\OneDrive - amazon.com\` exists |
| **Node.js v18+** or **Python 3.10+** | To run the KB build script | Run `node --version` or `python --version` in terminal |
| **MCP servers configured** | AWSentral, Billing Central, OneDrive, Outlook | Check `.kiro/settings/mcp.json` or user-level `~/.kiro/settings/mcp.json` |

If you don't have Node or Python, ask Kiro: *"Help me install Node.js on Windows"* — it'll walk you through it.

---

## Step 1: Export your Salesforce account report

This is your **authoritative source** for account metadata.

### How to export

1. Open the pre-built Salesforce report: [Territory Accounts Report](https://aws-crm.lightning.force.com/lightning/r/Report/00ORU000003xuAv2AI/view?queryScope=userFolders)
2. **Make it yours:** The report is pre-built but filtered to someone else's territory. You need to save your own copy:
   - Click **Save As** → give it a name like `<Your Name> Territory Accounts 2026`
   - Click **Edit** on your new report
   - Find the **Owner Alias** or **Territory** filter and change it to your alias
   - Click **Save & Run** — you should now see only your accounts
3. Make sure these columns are included:

```
Account Name
18 Character Account ID    ← critical, this is your primary key
Billing City
Billing Country
Company Annual Revenue
Employees
Industry
Account Quota Target
Website
GTM Sector
Sub Industry
Is T2K
Total Addressable Spend
Account Sub Segment / Sub Segment
```

4. Click **Export** → **Export as Excel (.xlsx)**
5. Save to your OneDrive, e.g.: `C:\Users\<you>\OneDrive - amazon.com\1. Accounts\My Territory Accounts.xlsx`

> **Direct link to the report**: https://aws-crm.lightning.force.com/lightning/r/Report/00ORU000003xuAv2AI/view?queryScope=userFolders

### Watch out for these quirks

- **Salesforce report exports have junk rows at the top** (title, filters, banner). The parser needs to find the real header row by scanning for a cell that says `"Account Name"`.
- **Footer rows** (`Total`, `Count`, `Confidential Information...`) must be skipped.
- **Duplicate column names** — Salesforce sometimes exports two `Industry` columns (system picklist + custom field). Keep the first non-empty value.
- **15 vs 18 character Salesforce IDs** — Always use the 18-character version. If your report only has 15-char IDs, the build script can expand them using the standard checksum algorithm.

---

## Step 2: Export your AWS Account IDs

This is **gold**. Billing Central MCP needs the 12-digit AWS Account ID before it can look up billing, invoices, service usage, or credits. Without this file, Kiro has to guess or ask you every time.

### How to export

1. Open the **EMEA Revenue Deep Dive** report on Tableau: [Monthly Revenue Deep Dive](https://awstableau.corp.amazon.com/t/WWSalesInsights/views/MonthlyRevenueDeep/DeepMonthlyRevenue?:embed=y&:iid=1)
2. The report **automatically filters to your territory** based on your login — no need to change any filters. Verify the accounts shown are yours.
3. Download the report — it should contain at minimum:

```
AWS Account ID (12-digit)
Country
Salesforce Account Name
Salesforce 18-char Account ID
Revenue Month
Revenue Amount (USD)
```

4. Save as CSV to your OneDrive, e.g.: `C:\Users\<you>\OneDrive - amazon.com\1. Accounts\My AWS Account IDs.csv`

> **Direct link to the Tableau report**: https://awstableau.corp.amazon.com/t/WWSalesInsights/views/MonthlyRevenueDeep/DeepMonthlyRevenue

### Watch out for these quirks

- **Leading zeros get stripped** by Excel. An AWS Account ID like `054495490683` becomes `54495490683` (11 digits). The build script detects IDs shorter than 12 chars and pads them, but be aware.
- **Account names don't always match exactly** between Salesforce and the revenue export. The build script uses soft matching (case-insensitive, contains) as a fallback when the 18-char SF ID isn't available.
- **Date formats vary** — `2/1/2026` gets normalized to `2026-02` automatically.

---

## Step 3: (Optional) Add your meeting notes and customer intel

Your knowledge base is built to receive customer context — meeting notes, key contacts, tech stack details, next steps, issues, anything you know about your accounts. This is what makes the KB personal and what makes Kiro truly useful over time.

**You don't have to do this now.** Steps 1 and 2 are enough to get a working KB. But whenever you're ready, there are several ways to feed your notes in:

- **Add an "Account Context" column to your Excel** — free-form notes per row, gets imported on build
- **Use the CLI after building** — `node kb.js add-note "Acme Corp" "Met with CTO, interested in Bedrock" --tag meeting`
- **Let Kiro do it for you** — once your steering file is set up (Step 6), Kiro can scrape customer info from your conversations and save it automatically
- **Paste from wherever you keep notes today** — OneNote, Word docs, email threads, whatever works for you

Everyone stores their customer intel differently, so there's no single right way. The important thing is that the KB is open and ready to receive it whenever you want to start.

> **Want to add your notes now?** Great — pick whichever method above works for you.
> **Want to do it later?** No problem — move on to Step 4 and come back to this anytime.

---

## Step 4: Build the knowledge base

Once both files are in OneDrive, you have two options:

### Option A: Use the pre-built Node.js tool (recommended)

If someone on your team already has the KB builder (like the `robin-kb/` package), copy it to your workspace and run:

```bash
# Install dependencies
cd robin-kb && npm install

# Build the KB (point to your files)
node build-kb.js
```

The script will:
1. Parse your SF Excel (handling header offset, footer rows, duplicate columns)
2. Parse your AWS CSV (padding IDs, normalizing dates)
3. Join them by 18-char SF Account ID (with soft name matching as fallback)
4. Preserve any existing notes from a previous build
5. Write the KB to `.kiro/knowledge-base/<your-alias>-accounts-kb.json`

### Option B: Use the Python tool

If you prefer Python:

```bash
python joao_accounts_2026.py
```

### Option C: Ask Kiro to build it for you

Paste this into Kiro chat:

> I have my Salesforce territory report at `C:\Users\<me>\OneDrive - amazon.com\1. Accounts\<filename>.xlsx` and my AWS Account IDs at `C:\Users\<me>\OneDrive - amazon.com\1. Accounts\<filename>.csv`. Help me build a queryable knowledge base that joins these two files by Salesforce 18-char Account ID, preserves any notes I add, and gives me a CLI to search accounts, look up AWS IDs, and add meeting notes.

Kiro will scaffold the whole thing for you.

---

## Step 5: Verify your build

After building, run these checks:

| Check | Command | What to look for |
|---|---|---|
| Account count | `node kb.js` or `python script.py` | Should match your SF report row count |
| Spot-check an account | `node kb.js get "Company Name"` | SF ID, AWS IDs, revenue, notes all present |
| AWS ID format | `node kb.js list` | All AWS IDs should be exactly 12 digits |
| Revenue sanity | `node kb.js list` | Top accounts by revenue should match what you know |
| Notes preserved | `node kb.js get "Company Name"` | If you had notes before rebuild, they should still be there |

---

## Step 6: Wire it into Kiro — the steering file that makes it all work

This is where the magic happens. A **steering file** is a small markdown file in your Kiro workspace that tells Kiro how to use your knowledge base. Once it's set up, you type one word and Kiro instantly accesses your customer data — Salesforce IDs, AWS Account IDs, revenue, notes, everything.

But a good steering file does much more than just point to your data. Here's what mine does:

- **Instant account lookups** — I type a customer name and Kiro returns their SF ID, AWS Account IDs, tier, revenue, and all my notes
- **Auto-saves conversation context** — after every Kiro chat about a customer, it scrapes relevant information (contacts, tech stack, next steps, issues) and saves it back to the KB automatically. Every conversation makes the KB richer.
- **Reviews my Outlook inbox** — it periodically catches email exchanges with customers and extracts key information (meeting confirmations, action items, escalations) into the KB
- **Logs calendar meetings to Salesforce** — it pulls external meetings from Outlook, matches them to territory accounts, creates contacts if needed, and logs them as Salesforce events

### 6a. Create your territory steering file

Create `.kiro/steering/territory-accounts-guide.md`:

```markdown
---
inclusion: manual
---

# Territory Accounts Query Guide

When the user asks about territory accounts, payer IDs, AWS Account IDs,
customer billing, or account lookups, follow this guide.

## Quick Reference

**Script path**: `<path to your kb.js or .py script>`
**JSON data store**: `<path to your KB JSON file>`

## Available Commands

| Command | What it does |
|---|---|
| `node kb.js` | Territory summary |
| `node kb.js search "<name>"` | Search by account name |
| `node kb.js get "<name>"` | Full account details |
| `node kb.js aws_ids "<name>"` | Get AWS Account IDs |
| `node kb.js by-aws <12-digit>` | Reverse lookup by AWS ID |
| `node kb.js add-note "<name>" "note text" --tag meeting` | Add a note |
| `node kb.js rebuild` | Rebuild from source files |

## Saving Context After Conversations

When new information is gathered about an account, save it back:
`node kb.js add-note "<Account Name>" "<what you learned>" --tag meeting,contacts`

## Context Keys You Can Save Per Account

- business_model — What the company does
- software_stack — Tools and platforms they use
- contacts — Key people (name, role, email)
- issues_reported — Customer issues with dates
- next_steps — Agreed actions
- opportunities — Opportunity context
- partner_ecosystem — Partners involved
- technical_notes — Architecture, workloads, infrastructure
- engagement_history — Meeting summaries and interactions
- aws_account_ids — 12-digit AWS Account IDs
```

Set `inclusion: manual` so you load it with `#territory-accounts-guide` when needed, or set `inclusion: auto` if you want it always available.

### 6b. Create a hook (gives you a slash command)

Create `.kiro/hooks/territory-information.kiro.hook`:

```json
{
  "name": "Territory Information",
  "version": "1.0.0",
  "when": { "type": "userTriggered" },
  "then": {
    "type": "askAgent",
    "prompt": "Run the territory knowledge base summary command and show the output. Then remind the user of available sub-commands (search, get, aws_ids, by-aws, add-note, rebuild)."
  }
}
```

Now typing `/territory-information` in Kiro chat runs your KB and shows your territory at a glance.

### 6c. (Optional) Create a save-context steering file

This is the auto-save feature. Create `.kiro/steering/save-chat-context.md`:

```markdown
---
inclusion: manual
---

# Save Chat Context

When the user asks to save context or save this conversation:

1. Summarize the current conversation
2. Identify which customer accounts were discussed
3. For each account discussed, extract:
   - New contacts discovered (name, role, email)
   - Technical details (architecture, workloads, services)
   - Next steps and action items
   - Issues or blockers mentioned
4. Save the extracted info back to the knowledge base using:
   `node kb.js add-note "<Account Name>" "<extracted info>" --tag <relevant-tags>`
5. Confirm what was saved and to which accounts
```

### 6d. (Optional) Create a log-meetings steering file

This automates logging your Outlook calendar meetings to Salesforce. Create `.kiro/steering/log-calendar-meetings.md` with instructions to:

1. Pull external meetings from your Outlook calendar for a given time range
2. Match each meeting to a territory account (by attendee email domain or subject)
3. Check if the meeting is already logged in Salesforce
4. Create contacts for new external attendees (with LinkedIn lookup for titles)
5. Log each meeting as a Salesforce Event linked to the right account and contact

This is a more advanced automation — ask Kiro to help you build it once your base KB is working.

### What this all looks like in practice

Once wired up, your daily workflow becomes:

| What you want | What you type in Kiro |
|---|---|
| See your territory at a glance | `/territory-information` |
| Look up a customer | `#territory-accounts-guide` then "tell me about Acme Corp" |
| After a customer call | "save context" → Kiro extracts and saves to KB |
| Log last 2 weeks of meetings | `/log-calendar-meetings` → "2 weeks" |
| Check billing for a customer | Kiro already knows the AWS Account ID from your KB |

---

## Step 7 (optional): Auto-enrich over time

Once the base KB is working, you can layer on automations:

### Auto-save conversation context

Create a steering file that tells Kiro to scrape relevant customer information (contacts, tech stack, next steps, issues) from your conversations and save it back to the KB automatically. This way every Kiro chat makes your KB richer.

### Auto-scan Outlook inbox

Create a hook or steering file that periodically reviews your Outlook inbox for customer email exchanges and extracts key information (meeting confirmations, action items, escalations) into your KB.

### Billing metadata enrichment

After your first Territory Billing Analysis run, save discovered payer IDs, linked account counts, and org types back to the KB. Future runs skip the discovery step entirely.

### MCP-powered lookups

With AWS Account IDs in your KB, you can now use Billing Central MCP directly:

| What you want | MCP tool | Input |
|---|---|---|
| Account billing summary | `search_account` | 12-digit AWS Account ID |
| Monthly service breakdown | `view_service_usage` | AWS Account ID + month |
| Org structure (linked accounts) | `list_linked_accounts` | Payer AWS Account ID |
| Credits and promotions | `view_credits_promotions` | AWS Account ID |
| Invoices | `view_invoices` | AWS Account ID |

---

## The data model (what the KB JSON looks like)

```jsonc
{
  "generatedAt": "2026-04-27T...",
  "owner": "Your Name",
  "accountCount": 42,
  "accounts": [
    {
      "salesforceName": "Acme Corp",
      "salesforceId18": "0010z00001ThH7gAAF",
      "awsAccountIds": ["825138316831", "093046422337"],
      "country": "NL",
      "salesforceFields": {
        "billingCity": "Amsterdam",
        "billingCountry": "NL",
        "companyAnnualRevenue": 500000000,
        "industry": "Software & Internet",
        "isT2K": "No",
        "totalAddressableSpend": 2500000,
        "accountSubSegment": "ENT LARGE"
      },
      "revenue": {
        "2026-02": 15000.00,
        "2026-03": 18000.00,
        "total": 33000.00
      },
      "billing": {
        "payerId": "825138316831",
        "linkedCount": 12,
        "lastVerified": "2026-04-27T..."
      },
      "notes": [
        {
          "at": "2026-04-27T...",
          "text": "Met with CTO — interested in Bedrock for document processing",
          "tags": ["meeting", "genai"]
        }
      ]
    }
  ]
}
```

**Primary key**: `salesforceId18` (18-char Salesforce Account ID)
**Secondary keys**: `salesforceName` (case-insensitive), any AWS Account ID

---

## Troubleshooting

| Problem | Cause | Fix |
|---|---|---|
| "Account count is 0" | Parser can't find the header row | Open the Excel and check which row has `Account Name` — the parser scans for it |
| "AWS IDs are 11 digits" | Excel stripped leading zeros | The build script should auto-pad; if not, re-save the CSV as text |
| "Notes disappeared after rebuild" | Merge failed — SF ID changed or file was corrupted | Check that `salesforceId18` is consistent between builds; notes merge by this key |
| "Billing Central says account not found" | Wrong AWS Account ID (using SF ID instead) | Billing Central needs the 12-digit AWS Account ID, not the Salesforce ID |
| "Soft name match picked the wrong account" | Similar names in your territory | Add the 18-char SF ID to your AWS CSV export to avoid ambiguity |
| "MCP server not responding" | Server crashed or config issue | Check MCP server status in Kiro, restart if needed |

---

## Architecture overview

```
┌─────────────────────┐     ┌──────────────────────┐
│  Salesforce Report   │     │  AWS Revenue Export   │
│  (.xlsx on OneDrive) │     │  (.csv on OneDrive)   │
└────────┬────────────┘     └────────┬─────────────┘
         │                           │
         ▼                           ▼
┌─────────────────────────────────────────────────┐
│              KB Build Script                     │
│  • Parse SF (skip headers/footers, dedup cols)  │
│  • Parse AWS CSV (pad IDs, normalize dates)     │
│  • Join by 18-char SF ID (soft match fallback)  │
│  • Preserve existing notes on rebuild           │
└────────────────────┬────────────────────────────┘
                     │
                     ▼
         ┌───────────────────────┐
         │   KB JSON File        │
         │   (single source of   │
         │    truth per user)    │
         └─────┬─────────┬──────┘
               │         │
               ▼         ▼
        ┌──────────┐  ┌──────────────┐
        │ CLI Tool │  │ Kiro Steering│
        │ (search, │  │ + Hook       │
        │  get,    │  │ (slash cmd)  │
        │  notes)  │  └──────────────┘
        └──────────┘
               │
               ▼
        ┌──────────────────┐
        │  MCP Servers     │
        │  (Billing Central│
        │   AWSentral,     │
        │   Outlook)       │
        └──────────────────┘
```

---

## Key design principles

1. **Single JSON file** — better than a database for a one-user KB. Easy to diff, share, and back up.
2. **Preserve user content on every rebuild** — notes and billing metadata survive source file refreshes. Merge by stable primary key (SF 18-char ID).
3. **Two entry points** — a CLI for humans, a steering file + hook for Kiro. They complement each other.
4. **Separate raw metadata from enriched data** — SF fields stay verbatim in `salesforceFields`; everything you discover (billing, notes, AWS IDs) hangs off the account in its own branch.
5. **Lean on MCP servers, don't reinvent** — the KB's job is to *remember* what MCP told you so you don't pay the discovery cost twice.
6. **Expect dirty data** — leading-zero stripping, duplicate columns, header drift, name mismatches. Handle all of these gracefully.
