Skip to content

Commit 4cd67f5

Browse files
committed
Refine AI Agent Guidelines Workflow #7257
1 parent 7f26c3d commit 4cd67f5

3 files changed

Lines changed: 84 additions & 30 deletions

File tree

.github/ISSUE/ticket-refactor-playwright-setup.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Ticket: Refactor Playwright Setup Function for Test-Specific Configurations
22

3-
GH ticket id: #
3+
GH ticket id: #7256
44

55
**Assignee:** Gemini
66
**Status:** Done
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
title: Refine AI Agent Guidelines Workflow
3+
labels: documentation, process
4+
---
5+
6+
GH ticket id: #7257
7+
8+
### 1. Summary
9+
10+
This ticket addresses the observation that the "ticket-first" mandate within `AGENTS.md` was frequently being bypassed by AI agents. The hypothesis is that once an agent enters a "flow state" for a coding task, it deprioritizes procedural checks.
11+
12+
### 2. Goal
13+
14+
The goal was to restructure the development workflow in `AGENTS.md` to make the ticket-creation step a non-negotiable "gate" rather than a step in a linear process. This change is intended to align with the AI's natural processing logic and improve compliance.
15+
16+
### 3. Changes Implemented
17+
18+
- The `## 4. Development Workflow` section was replaced with a new `## 4. Development Workflow: Triage and Gating Protocol`.
19+
- This new protocol explicitly separates tasks into "Conceptual" and "Actionable".
20+
- For actionable tasks, it establishes a mandatory "Ticket-First" Gate, stating that no file modification tools can be used until a ticket is created.
21+
- The important concept of the self-improving knowledge base was preserved and reframed under a new `### The Virtuous Cycle: Enhancing the Knowledge Base` subsection, which logically follows the implementation steps.
22+
23+
### 4. Status
24+
25+
This task is complete. The changes have been applied to `AGENTS.md`.

AGENTS.md

Lines changed: 58 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ At the beginning of every new session, you **MUST** perform the following steps
2929
- The distinction between class namespaces (e.g., `Neo.component.Base`) and `ntype` shortcuts (e.g., `'button'`).
3030

3131
3. **Read the Base Class (`src/core/Base.mjs`):** This is the foundation for all components and classes. Focus on:
32-
- The `static config` system: **CRITICAL:** You must deeply understand the difference between **reactive configs** (e.g., `myConfig_`), which generate `before/afterSet` hooks and are fundamental to the framework's reactivity, and **non-reactive configs**, which are applied to the prototype. Misinterpreting this is a critical failure. The trailing underscore is the key indicator.
32+
- The `static config` system: **CRITICAL:** You must deeply understand the difference between **reactive configs**
33+
(e.g., `myConfig_`), which generate `before/afterSet` hooks and are fundamental to the framework's reactivity,
34+
and **non-reactive configs**, which are applied to the prototype. Misinterpreting this is a critical failure.
35+
The trailing underscore is the key indicator.
3336
- The instance lifecycle: `construct()`, `onConstructed()`, `initAsync()`, and `destroy()`.
3437
- The reactivity hooks: `beforeGet*`, `beforeSet*`, `afterSet*`.
3538

@@ -81,24 +84,31 @@ files may lack, it is highly recommended to read the most relevant guide file fr
8184
the #1 ranked file. A good heuristic is to aim to read the top 1-2 source files and the top 1-2 relevant guides to get
8285
a balanced understanding.
8386

84-
- **Prioritize Content Types:** Always prioritize `guide` and `src` results for implementation details and current best practices. Treat `blog` results as sources for historical and conceptual context; their code examples may be outdated.
87+
- **Prioritize Content Types:** Always prioritize `guide` and `src` results for implementation details and current best
88+
practices. Treat `blog` results as sources for historical and conceptual context; their code examples may be outdated.
8589

8690
### Query Strategies
8791

8892
Do not assume you will get the perfect answer on the first try. Use a systematic approach to querying.
8993

9094
#### 1. Strategy for High-Level Conceptual Questions
9195

92-
When asked a broad, high-level, or conceptual question (e.g., "what makes this framework stand out?"), you must use a more guided approach to find the most important "pillar content".
96+
When asked a broad, high-level, or conceptual question (e.g., "what makes this framework stand out?"), you must use a
97+
more guided approach to find the most important "pillar content".
9398

94-
1. **Consult the Information Architecture:** Before formulating a query, read the file `learn/tree.json`. This file defines the intended structure of the learning content.
95-
2. **Identify Key Concepts:** Use the top-level categories in the tree (e.g., "Benefits", "Fundamentals") to identify the most important concepts.
96-
3. **Formulate Initial Query:** Base your first query on these high-level concepts to ensure you start your exploration from the project's intended information architecture.
99+
1. **Consult the Information Architecture:** Before formulating a query, read the file `learn/tree.json`.
100+
This file defines the intended structure of the learning content.
101+
2. **Identify Key Concepts:** Use the top-level categories in the tree (e.g., "Benefits", "Fundamentals") to identify
102+
the most important concepts.
103+
3. **Formulate Initial Query:** Base your first query on these high-level concepts to ensure you start your exploration
104+
from the project's intended information architecture.
97105

98106
#### 2. Discovery Pattern (Broad to Narrow)
99107

100108
When you need to understand a new concept or feature area:
101-
1. **Query Foundational Concepts First:** Always begin a broad inquiry by querying for foundational terms like `"benefits"`, `"concept"`, `"architecture"`, and `"vision"`. Prioritize reading files from the `learn/benefits` directory or top-level `README.md` and `.github/*.md` files if they appear in these initial results.
109+
1. **Query Foundational Concepts First:** Always begin a broad inquiry by querying for foundational terms like
110+
`"benefits"`, `"concept"`, `"architecture"`, and `"vision"`. Prioritize reading files from the `learn/benefits`
111+
directory or top-level `README.md` and `.github/*.md` files if they appear in these initial results.
102112
2. **Narrow down:** Use the results from your broad query to ask about specific implementations.
103113
- `npm run ai:query -- -q "Button component examples"`
104114
- `npm run ai:query -- -q "what is Neo.component.Base?"`
@@ -211,39 +221,58 @@ keywords based on the knowledge you've gathered from reading the core files.
211221
If the `npm run ai:query` command itself fails or throws an error, consult the setup guide at `.github/AI_QUICK_START.md`
212222
to ensure the environment is configured correctly and the knowledge base is properly built.
213223

214-
## 4. Development Workflow
224+
## 4. Development Workflow: Triage and Gating Protocol
215225

216-
Integrate the query tool and the ticketing system into your development process.
226+
You **MUST** follow this protocol for every user request to ensure work is tracked and context is maintained.
217227

218-
1. **Understand the Task & Identify Intent:** When a new request is received, first determine the user's intent.
219-
- **Conceptual/Informational:** Is the user asking for an explanation, brainstorming ideas, or asking a question that does not involve changing files? (e.g., "How does reactivity work?", "Should we move these files?"). If so, proceed directly to answering the query. No ticket is needed.
220-
- **Actionable/Modification:** Does the user's request require creating, deleting, or modifying files in the repository? (e.g., "Fix this bug," "Add JSDoc to this file," "Create a new release"). If so, proceed to the next step.
221-
- **Note:** A conceptual discussion can often lead to an actionable task. When the conversation shifts from "what if we..." to "let's do...", you must treat this as a new actionable request and follow the ticket-first mandate before proceeding.
228+
### Step 1: Triage the Request
222229

223-
2. **Ensure a Ticket Exists (Ticket-First Mandate):**
224-
- For any modification task, check if the request is already associated with an existing ticket file in `.github/ISSUE/`.
225-
- If not, your first action **MUST** be to create one. The ticket should summarize the task, its scope, and the goal. Inform the user that you are creating the ticket to track the work, following the process defined in `.github/TICKET_STRATEGY.md`.
230+
First, classify the user's request into one of two categories:
226231

227-
3. **Query & Analyze:** With a ticket now in place, use the **Discovery Pattern** to understand the context and find relevant files. When reading, focus on understanding the existing class structure, method signatures, configuration patterns, and overall architecture. **If you encounter source code lacking intent-driven comments, apply the "Knowledge Base Enhancement Strategy" to add meaningful documentation before proceeding.** Your goal is to make your changes fit in seamlessly.
232+
- **A) Conceptual/Informational:** The user is asking a question, seeking an explanation, or brainstorming.
233+
No files will be created, modified, or deleted.
234+
- **Action:** Proceed directly to using the knowledge base and other tools to answer the user's query. **No ticket is required.**
228235

229-
4. **Implement Changes:** Write or modify the code, strictly adhering to the conventions you observed.
236+
- **B) Actionable/Modification:** The user's request requires creating, deleting, or modifying files in the repository
237+
(e.g., "Fix this bug," "Add JSDoc," "Create a release").
238+
- **Action:** Proceed to **Step 2**.
230239

231-
5. **Verify:** After making changes, run any relevant verification tools, such as tests, to ensure your changes are correct and meet the project's standards. For bug fixes, ensure you've created regression tests (see `learn/guides/UnitTestingWithSiesta.md` for guidance).
240+
**Note:** A conceptual discussion can become an actionable task. The moment the intent shifts from "what if..." to
241+
"let's do...", you must treat it as a new actionable request and start this protocol from Step 1.
232242

233-
6. **Use `text` over `html` in VDOM:** When creating VDOM nodes, always prefer using the `text` property over the `html`
243+
### Step 2: The "Ticket-First" Gate
234244

235-
## This Changes the Workflow
245+
For any **Actionable/Modification** request, a ticket is mandatory. This is a non-negotiable gate.
236246

237-
The enhanced workflow becomes:
247+
1. **Check for an Existing Ticket:** Does the request reference an existing ticket file in `.github/ISSUE/`?
248+
2. **Create a New Ticket:** If no ticket exists, your immediate next action **MUST** be to create one.
249+
- Inform the user: "This is an actionable request. I will create a ticket to track this work, as per our workflow."
250+
- Follow the process in `.github/TICKET_STRATEGY.md` to create the ticket file.
238251

239-
1. **Query for understanding** (as before)
240-
2. **Read available documentation**
241-
3. **If source lacks context**: Analyze the code and **add meaningful comments**
242-
4. **Implement your changes** with the new understanding
243-
5. **The knowledge base gets richer** for the next session
252+
**CRITICAL:** You are not permitted to use any file modification tools (`replace`, `write_file`) or run any
253+
file-system-altering shell commands until a ticket has been created and acknowledged.
244254

245-
This approach transforms the AI agent from just a consumer of documentation to a **contributor** to the project's
246-
long-term maintainability.
255+
### Step 3: The Implementation Loop
256+
257+
Once you have passed the "Ticket-First" Gate, you may proceed with the task.
258+
259+
1. **Query & Analyze:** Use the **Discovery Pattern** to understand the context. If you find source code lacking
260+
intent-driven comments, apply the **Knowledge Base Enhancement Strategy** to add them *before* implementing your main changes.
261+
2. **Implement Changes:** Write or modify code, adhering to project conventions.
262+
3. **Verify:** Run tests and other verification tools to confirm your changes are correct.
263+
264+
### The Virtuous Cycle: Enhancing the Knowledge Base
265+
266+
The Implementation Loop creates a virtuous cycle that continuously improves the project's knowledge base:
267+
268+
1. **Query for understanding** (as before).
269+
2. **Read available documentation**.
270+
3. **If source lacks context**: Analyze the code and **add meaningful, intent-driven comments**.
271+
4. **Implement your changes** with the new, deeper understanding.
272+
5. **The knowledge base gets richer**, making the next query more effective.
273+
274+
This approach transforms the AI agent from just a consumer of documentation to a **contributor**
275+
to the project's long-term maintainability.
247276

248277
## 5. Session Maintenance
249278

0 commit comments

Comments
 (0)