Skip to content

Commit da24909

Browse files
ciscoRankushRankush KumarcursoragentShreyas281299
authored
docs(ai-docs): update AGENTS.md (AI agent constraints and workflow) (webex#618)
Co-authored-by: Rankush Kumar <rankkuma+cisco@cisco.com> Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: Shreyas Sharma <72344404+Shreyas281299@users.noreply.github.com>
1 parent a12f239 commit da24909

1 file changed

Lines changed: 49 additions & 18 deletions

File tree

AGENTS.md

Lines changed: 49 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
This is the main orchestrator for AI assistants working on this repository. It routes you to the correct templates and documentation based on the developer's task.
66

7+
**For every developer request:** (1) Identify task type (A–E below). (2) If the work is in an existing package or widget, load that scope's ai-docs (see [Package and widget ai-docs reference](#package-and-widget-ai-docs-reference)) and follow its AGENTS.md. (3) Open the template for that type and complete its mandatory pre-steps (see [Mandatory pre-steps by task type](#mandatory-pre-steps-by-task-type)). (4) Then follow the rest of this guide and the template.
8+
79
---
810

911
## Quick Start
@@ -13,9 +15,11 @@ This is the main orchestrator for AI assistants working on this repository. It r
1315
1. **Understand the task** - Identify what type of work is needed
1416
2. **Break down large or multi-part tasks** - If the prompt mixes multiple tasks (for example, "create new widget" **and** "fix a bug" or "add a feature"), or the task is very large, split it into smaller, clearly scoped subtasks and handle them one by one
1517
3. **Route to appropriate template** - Use modular templates for guidance
16-
4. **Generate/fix code** - Follow established patterns
17-
5. **Update documentation** - Keep ai-docs in sync with code changes
18-
6. **Ask for review** - Confirm completion with developer
18+
4. **Load package/widget ai-docs when working in that scope** - If fixing, generating, or enhancing code in an existing package or widget, read that scope's [ai-docs/AGENTS.md and ARCHITECTURE.md](#package-and-widget-ai-docs-reference) and follow them (see CRITICAL RULES rule 3).
19+
5. **Complete that template's mandatory pre-step section** - See [Mandatory pre-steps by task type](#mandatory-pre-steps-by-task-type) in CRITICAL RULES. Do not generate code until pre-steps are done or the developer explicitly waives them.
20+
6. **Generate/fix code** - Follow established patterns
21+
7. **Update documentation** - Keep ai-docs in sync with code changes
22+
8. **Ask for review** - Confirm completion with developer
1923

2024
---
2125

@@ -50,8 +54,8 @@ If the developer's message contains multiple distinct task types (for example, "
5054

5155
**E. Understanding Architecture**
5256
- Developer needs to understand how something works
53-
- **Read:** Package's `ai-docs/AGENTS.md` (usage) and `ai-docs/ARCHITECTURE.md` (technical details)
54-
- **Available for:** station-login, user-state, store, cc-components, cc-widgets, ui-logging, test-fixtures
57+
- **Read:** That scope's `ai-docs/AGENTS.md` (usage) and `ai-docs/ARCHITECTURE.md` (technical details); use [Package and widget ai-docs reference](#package-and-widget-ai-docs-reference) to find the path.
58+
- **Available for:** station-login, user-state, store, cc-components, cc-widgets, ui-logging, test-fixtures; for task package use per-widget ai-docs (CallControl, IncomingTask, OutdialCall, TaskList).
5559

5660
---
5761

@@ -148,6 +152,24 @@ Once provided, I'll analyze it and generate the widget accordingly.
148152

149153
**DO NOT proceed without design input.**
150154

155+
### 3. Use Package/Widget ai-docs When Working in That Scope
156+
157+
When fixing, generating, or enhancing code in a package or widget, you MUST read and follow that scope's `ai-docs/AGENTS.md` (and `ai-docs/ARCHITECTURE.md` where available). See [Package and widget ai-docs reference](#package-and-widget-ai-docs-reference) in Step 2. The root AGENTS.md is the orchestrator; each package/widget AGENTS.md is the authoritative reference for that scope—use both.
158+
159+
### 4. Complete Template Pre-Steps Before Code
160+
161+
Before generating or changing any code, you MUST complete the **pre-step section** of the template for the task type (see table below). Either fill it from the developer's message and confirm, or ask the developer for missing items. Do not proceed to implementation steps until pre-steps are done or the developer explicitly asks to skip them.
162+
163+
#### Mandatory pre-steps by task type (Rule 4)
164+
165+
| Task type | Template | Mandatory pre-step (complete before code) |
166+
| --------- | -------- | ----------------------------------------- |
167+
| **A. Create New Widget** | [new-widget/00-master.md](./ai-docs/templates/new-widget/00-master.md) | Design input + [01-pre-questions.md](./ai-docs/templates/new-widget/01-pre-questions.md) (widget name, 4 technical inputs) |
168+
| **B. Fix Bug** | [existing-widget/bug-fix.md](./ai-docs/templates/existing-widget/bug-fix.md) | [Pre-Fix Questions](./ai-docs/templates/existing-widget/bug-fix.md) (bug info, scope, impact, existing tests) |
169+
| **C. Add Feature** | [existing-widget/feature-enhancement.md](./ai-docs/templates/existing-widget/feature-enhancement.md) | [Pre-Enhancement Questions](./ai-docs/templates/existing-widget/feature-enhancement.md) (feature info, requirements, compatibility, design input) |
170+
| **D. Documentation only** | documentation templates | Optional: confirm scope with developer (no code change) |
171+
| **E. Understanding** | Package ai-docs | None (read-only) |
172+
151173
---
152174

153175
## Step 2: Load Context
@@ -162,9 +184,26 @@ Once provided, I'll analyze it and generate the widget accordingly.
162184
- [web-component-patterns.md](./ai-docs/patterns/web-component-patterns.md) - r2wc patterns
163185
- [testing-patterns.md](./ai-docs/patterns/testing-patterns.md) - Jest, RTL, Playwright
164186

165-
2. **Package documentation** - If working on existing widget
166-
- `packages/contact-center/{widget-name}/ai-docs/AGENTS.md` - Usage and API
167-
- `packages/contact-center/{widget-name}/ai-docs/ARCHITECTURE.md` - Technical details
187+
2. **Package/widget ai-docs (mandatory when working in that scope)**
188+
When fixing, generating, or enhancing code in a package or widget, you **MUST** read that scope's `ai-docs/AGENTS.md` (and `ARCHITECTURE.md` where listed) and follow its instructions. The root AGENTS.md orchestrates; package/widget AGENTS.md is the authoritative reference for that scope. Use the table below to find the right path.
189+
190+
#### Package and widget ai-docs reference
191+
192+
| Scope you're working on | AGENTS.md | ARCHITECTURE.md |
193+
| ----------------------- | --------- | --------------- |
194+
| **station-login** | [packages/contact-center/station-login/ai-docs/AGENTS.md](packages/contact-center/station-login/ai-docs/AGENTS.md) | Same folder |
195+
| **user-state** | [packages/contact-center/user-state/ai-docs/AGENTS.md](packages/contact-center/user-state/ai-docs/AGENTS.md) | Same folder |
196+
| **task – CallControl** | [packages/contact-center/task/ai-docs/widgets/CallControl/AGENTS.md](packages/contact-center/task/ai-docs/widgets/CallControl/AGENTS.md) | Same folder |
197+
| **task – IncomingTask** | [packages/contact-center/task/ai-docs/widgets/IncomingTask/AGENTS.md](packages/contact-center/task/ai-docs/widgets/IncomingTask/AGENTS.md) | Same folder |
198+
| **task – OutdialCall** | [packages/contact-center/task/ai-docs/widgets/OutdialCall/AGENTS.md](packages/contact-center/task/ai-docs/widgets/OutdialCall/AGENTS.md) | Same folder |
199+
| **task – TaskList** | [packages/contact-center/task/ai-docs/widgets/TaskList/AGENTS.md](packages/contact-center/task/ai-docs/widgets/TaskList/AGENTS.md) | Same folder |
200+
| **store** | [packages/contact-center/store/ai-docs/AGENTS.md](packages/contact-center/store/ai-docs/AGENTS.md) | Same folder |
201+
| **cc-components** | [packages/contact-center/cc-components/ai-docs/AGENTS.md](packages/contact-center/cc-components/ai-docs/AGENTS.md) | Same folder |
202+
| **cc-widgets** | [packages/contact-center/cc-widgets/ai-docs/AGENTS.md](packages/contact-center/cc-widgets/ai-docs/AGENTS.md) | Same folder |
203+
| **ui-logging** | [packages/contact-center/ui-logging/ai-docs/AGENTS.md](packages/contact-center/ui-logging/ai-docs/AGENTS.md) | Same folder |
204+
| **samples-cc-react-app** | [widgets-samples/cc/samples-cc-react-app/ai-docs/AGENTS.md](widgets-samples/cc/samples-cc-react-app/ai-docs/AGENTS.md) | Same folder if present |
205+
206+
**Task package note:** The task package has multiple widgets (CallControl, IncomingTask, OutdialCall, TaskList). When working on one of them, use that widget's ai-docs path above, not a generic task path.
168207

169208
### Conditionally Read
170209

@@ -173,16 +212,6 @@ Once provided, I'll analyze it and generate the widget accordingly.
173212
- Find available methods, events, types
174213
- Check method signatures before using
175214

176-
**If modifying store:**
177-
- Read: `packages/contact-center/store/ai-docs/AGENTS.md`
178-
- Read: `packages/contact-center/store/ai-docs/ARCHITECTURE.md`
179-
180-
**If creating/using components:**
181-
- Read: `packages/contact-center/cc-components/ai-docs/AGENTS.md`
182-
183-
**If working with metrics/logging:**
184-
- Read: `packages/contact-center/ui-logging/ai-docs/AGENTS.md`
185-
186215
---
187216

188217
## Step 3: SDK API Consultation (Before Code Generation)
@@ -303,6 +332,8 @@ SDK (Contact Center API)
303332

304333
**Follow the template you were routed to in Step 1**
305334

335+
You must have already completed that template's pre-step section (Pre-Enhancement Questions, Pre-Fix Questions, or 01-pre-questions as applicable); if not, do that first.
336+
306337
**During code generation:**
307338
1. Follow pattern documentation strictly
308339
2. Reference existing widgets for examples

0 commit comments

Comments
 (0)