2025-12-23 15:42:35 -08:00
# 🛞 UPDATE AGENTS MODE
Start all UPDATE AGENTS MODE responses with '🛞'
2026-01-27 12:11:00 -08:00
```
⋅
╭───╮
│ ● │
│ ◡ │ Time to level up AGENTS.md!
╰───╯
```
2026-02-17 09:13:23 -08:00
Interactive Q&A flow to update an existing `AGENTS.md` with new learnings and project knowledge.
2025-12-23 15:42:35 -08:00
---
## Step 1: Pre-flight Check
2026-02-17 09:13:23 -08:00
Check if `AGENTS.md` exists in project root.
2025-12-23 15:42:35 -08:00
2026-02-18 15:16:11 -08:00
**If missing: ** "No AGENTS.md found. Create one from scratch? I can analyze the codebase and generate an initial file." Stop and wait. If yes, use `plan2code---init.md` workflow.
2025-12-23 15:42:35 -08:00
2026-02-17 09:13:23 -08:00
**If exists: ** Read and summarize:
- Main sections (bullets)
- Current line count
2025-12-23 15:42:35 -08:00
2026-03-01 12:24:11 -08:00
Check for `.agents-docs/` directory:
**If `.agents-docs/` exists: **
```
Structure: Progressive discovery (index + N section files)
Section files:
- .agents-docs/AGENTS-architecture.md
- .agents-docs/AGENTS-development.md
[etc.]
```
**If `.agents-docs/` does not exist: ** Note: `Structure: Single-file (no .agents-docs/ directory)`
**IMPORTANT — you MUST offer restructuring. ** Stop and ask:
> "Your AGENTS.md uses a single-file format. Want to restructure for progressive discovery? This splits detailed sections into `.agents-docs/` files and converts AGENTS.md to a lightweight index with summaries and links."
Wait for user response before continuing. If user accepts, restructure existing content: create `.agents-docs/` directory with section files, convert AGENTS.md to index with summaries and links. Always-inline sections (Project Overview, Git Commit Messages, How to Use This File) stay in AGENTS.md. If user declines, continue with single-file editing.
2026-02-17 09:13:23 -08:00
Proceed to Step 2.
2025-12-23 15:42:35 -08:00
---
## Step 2: Context Detection
2026-02-17 09:13:23 -08:00
Check for recent conversation context.
2025-12-23 15:42:35 -08:00
2026-02-17 09:13:23 -08:00
**If recent work exists: ** "I noticed we just worked on [description]. Worth documenting:"
- [Insight #1 ]
- [Insight #2 ]
- [Insight #3 if applicable]
2025-12-23 15:42:35 -08:00
2026-02-17 09:13:23 -08:00
"Add any of these to AGENTS.md?"
**If no context: ** Skip to Step 3.
2025-12-23 15:42:35 -08:00
---
## Step 3: Update Menu
Present the user with update options:
2026-01-27 12:11:00 -08:00
> ```
> ⋅
2026-02-22 21:48:13 -08:00
> ╭───╮
> │ ● │
2026-01-27 12:11:00 -08:00
> │ ~ │ What should we update?
> ╰───╯
> ```
>
2025-12-23 15:42:35 -08:00
> "What would you like to add or update in AGENTS.md?"
>
> **Options:**
> - **1. Commands** - Build, test, run, lint, or other CLI commands
> - **2. Architecture** - How components interact, data flow, key patterns
> - **3. Gotchas/Pitfalls** - Traps to avoid, non-obvious behaviors
> - **4. Testing** - Test patterns, how to run specific tests, fixtures
> - **5. Environment/Config** - Setup quirks, env variables, configuration
> - **6. General Rules** - Coding conventions, style rules, project-specific practices
2026-02-17 09:13:23 -08:00
> - **7. Git Commit Messages** - Commit message conventions, AI attribution rules
> - **8. Something else** - Tell me what you'd like to add
2025-12-23 15:42:35 -08:00
>
> You can also ask me to:
> - **Review for corrections** - Check if any existing content is outdated or wrong
> - **Prune/consolidate** - Trim redundant or verbose sections
>
> "Which would you like to do? (You can pick multiple, e.g., '1 and 3')"
---
## Step 4: Gather Details
2026-02-17 09:13:23 -08:00
| Category | Questions |
|----------|-----------|
| Commands | Purpose? Flags? Prerequisites? |
| Architecture | Components? Interactions? Pattern? |
| Gotchas | What was unexpected? Workaround? |
| Testing | Commands? Fixtures? Mocking? |
| Environment | Local/CI/deploy? Env vars/files? |
| Rules | Project-wide or specific? Why? |
| Git Commit Messages | Format? Attribution? Conventions? |
| Other | "Tell me what to add." |
| Review | Per section: "Still accurate?" |
| Prune | Suggest trims, confirm before applying |
2025-12-23 15:42:35 -08:00
---
2026-01-27 12:11:00 -08:00
## Step 5: Confirm & Apply
2025-12-23 15:42:35 -08:00
2026-03-01 12:24:11 -08:00
Before changes, route edits to the correct file when `.agents-docs/` exists:
- Always-inline sections (Project Overview, Git Commit Messages, How to Use This File) → edit AGENTS.md directly
- All other sections → edit the corresponding `.agents-docs/AGENTS-<section-name>.md` file
Preview format:
> **File:** `.agents-docs/AGENTS-architecture.md` (or `AGENTS.md` for inline sections)
2026-02-17 09:13:23 -08:00
> **Section:** [name]
> **Change:** [description]
2025-12-23 15:42:35 -08:00
> ```
2026-02-17 09:13:23 -08:00
> [Preview text]
2025-12-23 15:42:35 -08:00
> ```
> "Does this look right? (yes/no/adjust)"
2026-02-17 09:13:23 -08:00
- "adjust" -> ask what to change, repeat
- "yes" -> apply edit, insert in appropriate section (create if needed), preserve structure
2025-12-23 15:42:35 -08:00
2026-03-01 12:24:11 -08:00
### Section File Lifecycle (when `.agents-docs/` exists)
- **New section (>~10 lines):** Create `.agents-docs/AGENTS-<section-name>.md` with breadcrumb header, add summary + link in AGENTS.md
- **New section (<~10 lines):** Keep inline in AGENTS.md
- **Delete section:** Remove the `.agents-docs/` file and its summary + link from AGENTS.md
- **Orphan cleanup:** After all edits, check for `.agents-docs/` files with no corresponding AGENTS.md section — offer to remove them
2025-12-23 15:42:35 -08:00
---
2026-01-27 12:11:00 -08:00
## Step 6: Summary & Next
2025-12-23 15:42:35 -08:00
2026-02-17 09:13:23 -08:00
After applying:
> "Done! Changed:"
> - [Summary]
2026-03-01 12:24:11 -08:00
If `.agents-docs/` exists:
> Structure: AGENTS.md (index) + N section files in .agents-docs/
> Index line count: X/500
Otherwise:
> Line count: X/500
2026-02-17 09:13:23 -08:00
> "Add anything else?"
2025-12-23 15:42:35 -08:00
2026-02-17 09:13:23 -08:00
If yes, return to Step 3. If done, proceed to Step 7.
2026-01-27 12:11:00 -08:00
---
## Step 7: AI Agent File Sync
2026-02-17 09:13:23 -08:00
Check for other AI agent config files and offer to replace with AGENTS.md references.
2026-01-27 12:11:00 -08:00
### Files to Detect
2026-02-17 09:13:23 -08:00
| File | Reference Path |
|------|----------------|
| `CLAUDE.md` (root) | `./AGENTS.md` |
| `GEMINI.md` (root) | `./AGENTS.md` |
| `.cursorrules` (root) | `./AGENTS.md` |
| `.github/copilot-instructions.md` | `../AGENTS.md` |
| `.cursor/rules/*.md` | `../../AGENTS.md` |
| `.windsurf/rules/*.md` | `../../AGENTS.md` |
2026-01-27 12:11:00 -08:00
2026-02-17 09:13:23 -08:00
**No files found: ** Skip silently, end workflow.
2026-01-27 12:11:00 -08:00
2026-02-17 09:13:23 -08:00
### If Files Found
2026-01-27 12:11:00 -08:00
2026-02-17 09:13:23 -08:00
```
2026-02-22 12:54:33 -08:00
o o
\ /
+---+
| o |
| ~ | Found other AI agent configs!
+---+
2026-02-17 09:13:23 -08:00
```
2026-01-27 12:11:00 -08:00
2026-02-17 09:13:23 -08:00
> Found AI config files that could reference AGENTS.md:
2026-01-27 12:11:00 -08:00
>
2026-02-17 09:13:23 -08:00
> | File | Size |
> |------|------|
2026-01-27 12:11:00 -08:00
> | `CLAUDE.md` | 45 lines |
>
2026-02-17 09:13:23 -08:00
> Replace with AGENTS.md references?
> - **Yes** - Update all
> - **Select** - Choose specific (numbered list)
> - **No** - Keep as-is
2026-01-27 12:11:00 -08:00
2026-02-17 09:13:23 -08:00
**Warning ** for files >10 lines: "[file] has custom content that will be replaced."
2026-01-27 12:11:00 -08:00
### Reference Template
``` markdown
# CLAUDE.md
See [AGENTS.md ](./AGENTS.md ) for complete project documentation including:
- Development commands and setup
- Architecture overview
- Environment variables
- Testing patterns
- Deployment guides
2026-03-01 12:24:11 -08:00
- Section details in .agents-docs/
2026-01-27 12:11:00 -08:00
```
2026-02-17 09:13:23 -08:00
**For directory configs ** (`.cursor/rules/` , `.windsurf/rules/` ): Delete existing `.md` files, create single `reference.md` .
2026-01-27 12:11:00 -08:00
2025-12-23 15:42:35 -08:00
---
2026-02-17 09:13:23 -08:00
## Update Rules
2025-12-23 15:42:35 -08:00
2026-02-17 09:13:23 -08:00
1. **Surgical edits ** - Don't rewrite unchanged sections
2. **Preserve style ** - Match existing formatting/tone
3. **Actionable only ** - Every entry helps agents do something
4. **Under 500 lines ** - Warn if approaching limit
5. **No generic advice ** - Must be project-specific
6. **No duplication ** - Check for similar content first
7. **Group logically ** - Place near related content
8. **Be specific ** - Include exact commands, paths, names
2026-03-01 12:24:11 -08:00
9. **Route edits to correct file ** - Inline sections edit AGENTS.md directly, detailed sections edit the corresponding .agents-docs/ file
2025-12-23 15:42:35 -08:00
---
## Example Session
```
2026-02-17 09:13:23 -08:00
Agent: Found AGENTS.md covering:
- Build/test commands
- Project structure
2025-12-23 15:42:35 -08:00
- API conventions
2026-02-17 09:13:23 -08:00
Line count: 127
2026-03-01 12:24:11 -08:00
Structure: Single-file (no .agents-docs/ directory)
Your AGENTS.md uses a single-file format. Want to
restructure for progressive discovery?
User: No thanks, just update it.
Agent: OK, keeping single-file format.
2025-12-23 15:42:35 -08:00
2026-02-17 09:13:23 -08:00
Recent work on auth flow. Worth documenting:
- JWT refresh token must validate before access token
- Auth tests require TEST_SECRET env var
2025-12-23 15:42:35 -08:00
2026-02-17 09:13:23 -08:00
Add these?
2025-12-23 15:42:35 -08:00
2026-02-17 09:13:23 -08:00
User: Yes, both.
2025-12-23 15:42:35 -08:00
2026-02-17 09:13:23 -08:00
Agent: Adding:
**Section:** Gotchas
2025-12-23 15:42:35 -08:00
```
2026-02-17 09:13:23 -08:00
- JWT refresh token must validate before access token in auth flow
2025-12-23 15:42:35 -08:00
```
2026-02-17 09:13:23 -08:00
**Section:** Testing
2025-12-23 15:42:35 -08:00
```
2026-02-17 09:13:23 -08:00
- Auth tests require TEST_SECRET env variable
2025-12-23 15:42:35 -08:00
```
2026-02-17 09:13:23 -08:00
Look right?
2025-12-23 15:42:35 -08:00
User: Yes
2026-02-17 09:13:23 -08:00
Agent: Done! Added 2 entries to Gotchas and Testing.
Line count: 131/500
2025-12-23 15:42:35 -08:00
2026-02-17 09:13:23 -08:00
Add anything else?
2025-12-23 15:42:35 -08:00
2026-02-17 09:13:23 -08:00
User: No
2026-01-27 12:11:00 -08:00
2026-02-17 09:13:23 -08:00
Agent: Found CLAUDE.md (23 lines). Replace with AGENTS.md reference?
2026-01-27 12:11:00 -08:00
2026-02-17 09:13:23 -08:00
User: Yes
2026-01-27 12:11:00 -08:00
2026-02-17 09:13:23 -08:00
Agent: Updated CLAUDE.md. AGENTS.md is your single source of truth now!
2025-12-23 15:42:35 -08:00
```